tdf#117228: crash in SfxItemSet::GetItemState...
[LibreOffice.git] / configure.ac
blob1d7770709b3253f03bcb1424e055fef47b54ab7b
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.1.0.0.alpha1+],[],[],[http://documentfoundation.org/])
14 AC_PREREQ([2.59])
16 if test -n "$BUILD_TYPE"; then
17     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
20 save_CC=$CC
21 save_CXX=$CXX
23 BUILD_TYPE="LibO"
24 SCPDEFS=""
25 GIT_NEEDED_SUBMODULES=""
26 LO_PATH= # used by path_munge to construct a PATH variable
28 FilterLibs()
30     filteredlibs=
31     for f in $1; do
32         case "$f" in
33             # let's start with Fedora's paths for now
34             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
35                 # ignore it: on UNIXoids it is searched by default anyway
36                 # but if it's given explicitly then it may override other paths
37                 # (on Mac OS X it would be an error to use it instead of SDK)
38                 ;;
39             *)
40                 filteredlibs="$filteredlibs $f"
41                 ;;
42         esac
43     done
46 PathFormat()
48     formatted_path="$1"
49     if test "$build_os" = "cygwin"; then
50         pf_conv_to_dos=
51         # spaces,parentheses,brackets,braces are problematic in pathname
52         # so are backslashes
53         case "$formatted_path" in
54             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
55                 pf_conv_to_dos="yes"
56             ;;
57         esac
58         if test "$pf_conv_to_dos" = "yes"; then
59             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
60                 formatted_path=`cygpath -sm "$formatted_path"`
61             else
62                 formatted_path=`cygpath -d "$formatted_path"`
63             fi
64             if test $? -ne 0;  then
65                 AC_MSG_ERROR([path conversion failed for "$1".])
66             fi
67         fi
68         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
69         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
70         if test "$fp_count_slash$fp_count_colon" != "00"; then
71             if test "$fp_count_colon" = "0"; then
72                 new_formatted_path=`realpath "$formatted_path"`
73                 if test $? -ne 0;  then
74                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
75                 else
76                     formatted_path="$new_formatted_path"
77                 fi
78             fi
79             formatted_path=`cygpath -m "$formatted_path"`
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84     fi
87 AbsolutePath()
89     # There appears to be no simple and portable method to get an absolute and
90     # canonical path, so we try creating the directory if does not exist and
91     # utilizing the shell and pwd.
92     rel="$1"
93     absolute_path=""
94     test ! -e "$rel" && mkdir -p "$rel"
95     if test -d "$rel" ; then
96         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
97         absolute_path="$(pwd)"
98         cd - > /dev/null
99     else
100         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
101     fi
104 rm -f warn
105 have_WARNINGS="no"
106 add_warning()
108     if test "$have_WARNINGS" = "no"; then
109         echo "*************************************" > warn
110         have_WARNINGS="yes"
111         if which tput >/dev/null 2>/dev/null && test `tput colors` -ge 8; then
112             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
113             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
114         else
115             COLORWARN="* WARNING :"
116         fi
117     fi
118     echo "$COLORWARN $@" >> warn
121 dnl Some Mac User have the bad habbit of letting a lot fo crap
122 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
123 dnl that confuse the build.
124 dnl For the ones that use LODE, let's be nice and protect them
125 dnl from themselves
127 mac_sanitize_path()
129     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
130 dnl a common but nevertheless necessary thing that may be in a fancy
131 dnl path location is git, so make sure we have it
132     mac_git_path=`which git 2>/dev/null`
133     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
134         mac_path="$mac_path:`dirname $mac_git_path`"
135     fi
136 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
137 dnl path location is gpg, so make sure we find it
138     mac_gpg_path=`which gpg 2>/dev/null`
139     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
140         mac_path="$mac_path:`dirname $mac_gpg_path`"
141     fi
142     PATH="$mac_path"
143     unset mac_path
144     unset mac_git_path
145     unset mac_gpg_path
148 echo "********************************************************************"
149 echo "*"
150 echo "*   Running ${PACKAGE_NAME} build configuration."
151 echo "*"
152 echo "********************************************************************"
153 echo ""
155 dnl ===================================================================
156 dnl checks build and host OSes
157 dnl do this before argument processing to allow for platform dependent defaults
158 dnl ===================================================================
159 AC_CANONICAL_HOST
161 AC_MSG_CHECKING([for product name])
162 PRODUCTNAME="AC_PACKAGE_NAME"
163 if test -n "$with_product_name" -a "$with_product_name" != no; then
164     PRODUCTNAME="$with_product_name"
166 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
167     PRODUCTNAME="${PRODUCTNAME}Dev"
169 AC_MSG_RESULT([$PRODUCTNAME])
170 AC_SUBST(PRODUCTNAME)
171 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
172 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
174 dnl ===================================================================
175 dnl Our version is defined by the AC_INIT() at the top of this script.
176 dnl ===================================================================
178 AC_MSG_CHECKING([for package version])
179 if test -n "$with_package_version" -a "$with_package_version" != no; then
180     PACKAGE_VERSION="$with_package_version"
182 AC_MSG_RESULT([$PACKAGE_VERSION])
184 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
186 LIBO_VERSION_MAJOR=$1
187 LIBO_VERSION_MINOR=$2
188 LIBO_VERSION_MICRO=$3
189 LIBO_VERSION_PATCH=$4
191 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
192 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
193 # no way to encode that into an integer in general.
194 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
196 LIBO_VERSION_SUFFIX=$5
197 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
198 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
199 # they get undoubled before actually passed to sed.
200 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
201 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
202 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
203 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
205 AC_SUBST(LIBO_VERSION_MAJOR)
206 AC_SUBST(LIBO_VERSION_MINOR)
207 AC_SUBST(LIBO_VERSION_MICRO)
208 AC_SUBST(LIBO_VERSION_PATCH)
209 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
210 AC_SUBST(LIBO_VERSION_SUFFIX)
211 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
213 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
214 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
215 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
216 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
218 LIBO_THIS_YEAR=`date +%Y`
219 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
221 dnl ===================================================================
222 dnl Product version
223 dnl ===================================================================
224 AC_MSG_CHECKING([for product version])
225 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
226 AC_MSG_RESULT([$PRODUCTVERSION])
227 AC_SUBST(PRODUCTVERSION)
229 AC_PROG_EGREP
230 # AC_PROG_EGREP doesn't set GREP on all systems as well
231 AC_PATH_PROG(GREP, grep)
233 BUILDDIR=`pwd`
234 cd $srcdir
235 SRC_ROOT=`pwd`
236 cd $BUILDDIR
237 x_Cygwin=[\#]
239 dnl ======================================
240 dnl Required GObject introspection version
241 dnl ======================================
242 INTROSPECTION_REQUIRED_VERSION=1.32.0
244 dnl ===================================================================
245 dnl Search all the common names for GNU Make
246 dnl ===================================================================
247 AC_MSG_CHECKING([for GNU Make])
249 # try to use our own make if it is available and GNUMAKE was not already defined
250 if test -z "$GNUMAKE"; then
251     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
252         GNUMAKE="$LODE_HOME/opt/bin/make"
253     elif test -x "/opt/lo/bin/make"; then
254         GNUMAKE="/opt/lo/bin/make"
255     fi
258 GNUMAKE_WIN_NATIVE=
259 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
260     if test -n "$a"; then
261         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
262         if test $? -eq 0;  then
263             if test "$build_os" = "cygwin"; then
264                 if test -n "$($a -v | grep 'Built for Windows')" ; then
265                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
266                     GNUMAKE_WIN_NATIVE="TRUE"
267                 else
268                     GNUMAKE=`which $a`
269                 fi
270             else
271                 GNUMAKE=`which $a`
272             fi
273             break
274         fi
275     fi
276 done
277 AC_MSG_RESULT($GNUMAKE)
278 if test -z "$GNUMAKE"; then
279     AC_MSG_ERROR([not found. install GNU Make.])
280 else
281     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
282         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
283     fi
286 win_short_path_for_make()
288     local_short_path="$1"
289     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
290         cygpath -sm "$local_short_path"
291     else
292         cygpath -u "$(cygpath -d "$local_short_path")"
293     fi
297 if test "$build_os" = "cygwin"; then
298     PathFormat "$SRC_ROOT"
299     SRC_ROOT="$formatted_path"
300     PathFormat "$BUILDDIR"
301     BUILDDIR="$formatted_path"
302     x_Cygwin=
303     AC_MSG_CHECKING(for explicit COMSPEC)
304     if test -z "$COMSPEC"; then
305         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
306     else
307         AC_MSG_RESULT([found: $COMSPEC])
308     fi
311 AC_SUBST(SRC_ROOT)
312 AC_SUBST(BUILDDIR)
313 AC_SUBST(x_Cygwin)
314 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
315 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
317 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
318     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
321 # need sed in os checks...
322 AC_PATH_PROGS(SED, sed)
323 if test -z "$SED"; then
324     AC_MSG_ERROR([install sed to run this script])
327 # Set the ENABLE_LTO variable
328 # ===================================================================
329 AC_MSG_CHECKING([whether to use link-time optimization])
330 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
331     ENABLE_LTO="TRUE"
332     AC_MSG_RESULT([yes])
333     AC_DEFINE(STATIC_LINKING)
334 else
335     ENABLE_LTO=""
336     AC_MSG_RESULT([no])
338 AC_SUBST(ENABLE_LTO)
340 AC_ARG_ENABLE(fuzz-options,
341     AS_HELP_STRING([--enable-fuzz-options],
342         [Randomly enable or disable each of those configurable options
343          that are supposed to be freely selectable without interdependencies,
344          or where bad interaction from interdependencies is automatically avoided.])
347 dnl ===================================================================
348 dnl When building for Android, --with-android-ndk,
349 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
350 dnl mandatory
351 dnl ===================================================================
353 AC_ARG_WITH(android-ndk,
354     AS_HELP_STRING([--with-android-ndk],
355         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
358 AC_ARG_WITH(android-ndk-toolchain-version,
359     AS_HELP_STRING([--with-android-ndk-toolchain-version],
360         [Specify which toolchain version to use, of those present in the
361         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
362         with_android_ndk_toolchain_version=clang5.0)
364 AC_ARG_WITH(android-sdk,
365     AS_HELP_STRING([--with-android-sdk],
366         [Specify location of the Android SDK. Mandatory when building for Android.]),
369 ANDROID_NDK_HOME=
370 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
371     with_android_ndk="$SRC_ROOT/external/android-ndk"
373 if test -n "$with_android_ndk"; then
374     ANDROID_NDK_HOME=$with_android_ndk
376     # Set up a lot of pre-canned defaults
378     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
379         if test ! -f $ANDROID_NDK_HOME/source.properties; then
380             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
381         fi
382         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
383     else
384         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
385     fi
386     if test -z "$ANDROID_NDK_VERSION";  then
387         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
388     fi
389     case $ANDROID_NDK_VERSION in
390     r9*|r10*)
391         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
392         ;;
393     11.1.*|12.1.*|13.1.*|14.1.*)
394         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
395         ;;
396     16.*)
397         ;;
398     *)
399         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk.])
400         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk."
401         ;;
402     esac
404     ANDROID_API_LEVEL=14
405     android_cpu=$host_cpu
406     ANDROID_ARCH=$android_cpu
407     if test $host_cpu = arm; then
408         android_platform_prefix=$android_cpu-linux-androideabi
409         android_gnu_prefix=$android_platform_prefix
410         LLVM_TRIPLE=armv7-none-linux-androideabi
411         ANDROID_APP_ABI=armeabi-v7a
412         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
413     elif test $host_cpu = aarch64; then
414         android_platform_prefix=$android_cpu-linux-android
415         android_gnu_prefix=$android_platform_prefix
416         LLVM_TRIPLE=aarch64-none-linux-android
417         # minimum android version that supports aarch64
418         ANDROID_API_LEVEL=21
419         ANDROID_APP_ABI=arm64-v8a
420         ANDROID_ARCH=arm64
421     elif test $host_cpu = mips; then
422         android_platform_prefix=mipsel-linux-android
423         android_gnu_prefix=$android_platform_prefix
424         LLVM_TRIPLE=mipsel-none-linux-android
425         ANDROID_APP_ABI=mips
426     else
427         # host_cpu is something like "i386" or "i686" I guess, NDK uses
428         # "x86" in some contexts
429         android_cpu=x86
430         android_platform_prefix=$android_cpu
431         android_gnu_prefix=i686-linux-android
432         LLVM_TRIPLE=i686-none-linux-android
433         ANDROID_APP_ABI=x86
434         ANDROID_ARCH=$android_cpu
435         ANDROIDCFLAGS="-march=atom"
436     fi
438     case "$with_android_ndk_toolchain_version" in
439     clang5.0)
440         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
441         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION
442         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm
443         ;;
444     *)
445         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
446     esac
448     if test ! -d $ANDROID_BINUTILS_DIR; then
449         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
450     elif test ! -d $ANDROID_COMPILER_DIR; then
451         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
452     fi
454     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
455     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
456     # manage to link the (app-specific) single huge .so that is built for the app in
457     # android/source/ if there is debug information in a significant part of the object files.
458     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
459     # all objects have been built with debug information.)
460     case $build_os in
461     linux-gnu*)
462         ndk_build_os=linux
463         ;;
464     darwin*)
465         ndk_build_os=darwin
466         ;;
467     *)
468         AC_MSG_ERROR([We only support building for Android from Linux or OS X])
469         ;;
470     esac
471     ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
472     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
473     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
475     test -z "$SYSBASE" && SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
476     test -z "$AR" && AR=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ar
477     test -z "$NM" && NM=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-nm
478     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-objdump
479     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ranlib
480     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-strip
482     ANDROIDCFLAGS="$ANDROIDCFLAGS -gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT -target $LLVM_TRIPLE$ANDROID_API_LEVEL -no-canonical-prefixes"
483     # android is using different sysroots for compilation and linking, but as
484     # there is no full separation in configure and elsewhere, use isystem for
485     # compilation stuff and sysroot for linking
486     ANDROIDCFLAGS="$ANDROIDCFLAGS -D__ANDROID_API__=$ANDROID_API_LEVEL -isystem $ANDROID_NDK_HOME/sysroot/usr/include"
487     ANDROIDCFLAGS="$ANDROIDCFLAGS -isystem $ANDROID_NDK_HOME/sysroot/usr/include/$android_gnu_prefix"
488     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$SYSBASE -ffunction-sections -fdata-sections -Qunused-arguments"
489     if test "$ANDROID_APP_ABI" = "armeabi-v7a"; then
490     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/libs/$ANDROID_APP_ABI -D_GTHREAD_USE_MUTEX_INIT_FUNC=1"
491     else
492     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/libs/$ANDROID_APP_ABI"
493     fi
494     if test "$ENABLE_LTO" = TRUE; then
495         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
496         # $CC and $CXX when building external libraries
497         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
498     fi
500     if test "$ANDROID_APP_ABI" = "armeabi-v7a"; then
501     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/libs/$ANDROID_APP_ABI/include -std=c++11"
502     else
503     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/include -I$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++abi/include -I$ANDROID_NDK_HOME/sources/android/support/include -std=c++11"
504     fi
506     if test -z "$CC"; then
507         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
508     fi
509     if test -z "$CXX"; then
510         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
511     fi
513     # remember to download the ownCloud Android library later
514     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
516 AC_SUBST(ANDROID_NDK_HOME)
517 AC_SUBST(ANDROID_APP_ABI)
518 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
520 dnl ===================================================================
521 dnl --with-android-sdk
522 dnl ===================================================================
523 ANDROID_SDK_HOME=
524 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
525     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
527 if test -n "$with_android_sdk"; then
528     ANDROID_SDK_HOME=$with_android_sdk
529     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
531 AC_SUBST(ANDROID_SDK_HOME)
533 dnl ===================================================================
534 dnl The following is a list of supported systems.
535 dnl Sequential to keep the logic very simple
536 dnl These values may be checked and reset later.
537 dnl ===================================================================
538 #defaults unless the os test overrides this:
539 test_randr=yes
540 test_xrender=yes
541 test_cups=yes
542 test_dbus=yes
543 test_fontconfig=yes
544 test_cairo=no
546 # Default values, as such probably valid just for Linux, set
547 # differently below just for Mac OSX,but at least better than
548 # hardcoding these as we used to do. Much of this is duplicated also
549 # in solenv for old build system and for gbuild, ideally we should
550 # perhaps define stuff like this only here in configure.ac?
552 LINKFLAGSSHL="-shared"
553 PICSWITCH="-fpic"
554 DLLPOST=".so"
556 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
558 INSTROOTBASESUFFIX=
559 INSTROOTCONTENTSUFFIX=
560 SDKDIRNAME=sdk
562 case "$host_os" in
564 solaris*)
565     test_gtk=yes
566     build_gstreamer_1_0=yes
567     build_gstreamer_0_10=yes
568     test_freetype=yes
569     _os=SunOS
571     dnl ===========================================================
572     dnl Check whether we're using Solaris 10 - SPARC or Intel.
573     dnl ===========================================================
574     AC_MSG_CHECKING([the Solaris operating system release])
575     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
576     if test "$_os_release" -lt "10"; then
577         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
578     else
579         AC_MSG_RESULT([ok ($_os_release)])
580     fi
582     dnl Check whether we're using a SPARC or i386 processor
583     AC_MSG_CHECKING([the processor type])
584     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
585         AC_MSG_RESULT([ok ($host_cpu)])
586     else
587         AC_MSG_ERROR([only SPARC and i386 processors are supported])
588     fi
589     ;;
591 linux-gnu*|k*bsd*-gnu*)
592     test_gtk=yes
593     build_gstreamer_1_0=yes
594     build_gstreamer_0_10=yes
595     test_kde4=yes
596     test_kde5=yes
597     test_qt5=yes
598     test_gtk3_kde5=yes
599     if test "$enable_fuzzers" != yes; then
600         test_freetype=yes
601         test_fontconfig=yes
602     else
603         test_freetype=no
604         test_fontconfig=no
605         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
606     fi
607     _os=Linux
608     ;;
610 gnu)
611     test_randr=no
612     test_xrender=no
613     _os=GNU
614      ;;
616 cygwin*|interix*)
618     # When building on Windows normally with MSVC under Cygwin,
619     # configure thinks that the host platform (the platform the
620     # built code will run on) is Cygwin, even if it obviously is
621     # Windows, which in Autoconf terminology is called
622     # "mingw32". (Which is misleading as MinGW is the name of the
623     # tool-chain, not an operating system.)
625     # Somewhat confusing, yes. But this configure script doesn't
626     # look at $host etc that much, it mostly uses its own $_os
627     # variable, set here in this case statement.
629     test_cups=no
630     test_dbus=no
631     test_randr=no
632     test_xrender=no
633     test_freetype=no
634     test_fontconfig=no
635     _os=WINNT
637     DLLPOST=".dll"
638     LINKFLAGSNOUNDEFS=
639     ;;
641 darwin*) # Mac OS X or iOS
642     test_gtk=yes
643     test_randr=no
644     test_xrender=no
645     test_freetype=no
646     test_fontconfig=no
647     test_dbus=no
648     if test -n "$LODE_HOME" ; then
649         mac_sanitize_path
650         AC_MSG_NOTICE([sanitized the PATH to $PATH])
651     fi
652     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
653         build_for_ios=YES
654         _os=iOS
655         test_gtk=no
656         test_cups=no
657         enable_mpl_subset=yes
658         enable_lotuswordpro=no
659         enable_coinmp=no
660         enable_lpsolve=no
661         enable_postgresql_sdbc=no
662         enable_extension_integration=no
663         enable_report_builder=no
664         with_theme="tango"
665         with_ppds=no
666         if test "$enable_ios_simulator" = "yes"; then
667             host=x86_64-apple-darwin
668         fi
669     else
670         _os=Darwin
671         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
672         INSTROOTCONTENTSUFFIX=/Contents
673         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
674     fi
675     # See comment above the case "$host_os"
676     LINKFLAGSSHL="-dynamiclib -single_module"
678     # -fPIC is default
679     PICSWITCH=""
681     DLLPOST=".dylib"
683     # -undefined error is the default
684     LINKFLAGSNOUNDEFS=""
687 freebsd*)
688     test_gtk=yes
689     build_gstreamer_1_0=yes
690     build_gstreamer_0_10=yes
691     test_kde4=yes
692     test_kde5=yes
693     test_qt5=yes
694     test_gtk3_kde5=yes
695     test_freetype=yes
696     AC_MSG_CHECKING([the FreeBSD operating system release])
697     if test -n "$with_os_version"; then
698         OSVERSION="$with_os_version"
699     else
700         OSVERSION=`/sbin/sysctl -n kern.osreldate`
701     fi
702     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
703     AC_MSG_CHECKING([which thread library to use])
704     if test "$OSVERSION" -lt "500016"; then
705         PTHREAD_CFLAGS="-D_THREAD_SAFE"
706         PTHREAD_LIBS="-pthread"
707     elif test "$OSVERSION" -lt "502102"; then
708         PTHREAD_CFLAGS="-D_THREAD_SAFE"
709         PTHREAD_LIBS="-lc_r"
710     else
711         PTHREAD_CFLAGS=""
712         PTHREAD_LIBS="-pthread"
713     fi
714     AC_MSG_RESULT([$PTHREAD_LIBS])
715     _os=FreeBSD
716     ;;
718 *netbsd*)
719     test_gtk=yes
720     build_gstreamer_1_0=yes
721     build_gstreamer_0_10=yes
722     test_kde4=yes
723     test_kde5=yes
724     test_qt5=yes
725     test_gtk3_kde5=yes
726     test_freetype=yes
727     PTHREAD_LIBS="-pthread -lpthread"
728     _os=NetBSD
729     ;;
731 aix*)
732     test_randr=no
733     test_freetype=yes
734     PTHREAD_LIBS=-pthread
735     _os=AIX
736     ;;
738 openbsd*)
739     test_gtk=yes
740     test_freetype=yes
741     PTHREAD_CFLAGS="-D_THREAD_SAFE"
742     PTHREAD_LIBS="-pthread"
743     _os=OpenBSD
744     ;;
746 dragonfly*)
747     test_gtk=yes
748     build_gstreamer_1_0=yes
749     build_gstreamer_0_10=yes
750     test_kde4=yes
751     test_kde5=yes
752     test_qt5=yes
753     test_gtk3_kde5=yes
754     test_freetype=yes
755     PTHREAD_LIBS="-pthread"
756     _os=DragonFly
757     ;;
759 linux-android*)
760     build_gstreamer_1_0=no
761     build_gstreamer_0_10=no
762     enable_lotuswordpro=no
763     enable_mpl_subset=yes
764     enable_coinmp=yes
765     enable_lpsolve=no
766     enable_report_builder=no
767     enable_odk=no
768     enable_postgresql_sdbc=no
769     enable_python=no
770     with_theme="tango"
771     test_cups=no
772     test_dbus=no
773     test_fontconfig=no
774     test_freetype=no
775     test_gtk=no
776     test_kde4=no
777     test_kde5=no
778     test_qt5=no
779     test_gtk3_kde5=no
780     test_randr=no
781     test_xrender=no
782     _os=Android
784     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
785     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
786     ;;
788 haiku*)
789     test_cups=no
790     test_dbus=no
791     test_randr=no
792     test_xrender=no
793     test_freetype=yes
794     enable_java=no
795     enable_opengl=no
796     enable_odk=no
797     enable_gconf=no
798     enable_gnome_vfs=no
799     enable_gstreamer=no
800     enable_vlc=no
801     enable_gltf=no
802     enable_collada=no
803     enable_coinmp=no
804     enable_pdfium=no
805     enable_postgresql_sdbc=no
806     enable_firebird_sdbc=no
807     _os=Haiku
808     ;;
811     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
812     ;;
813 esac
815 if test "$_os" = "Android" ; then
816     # Verify that the NDK and SDK options are proper
817     if test -z "$with_android_ndk"; then
818         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
819     elif test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
820         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
821     fi
823     if test -z "$ANDROID_SDK_HOME"; then
824         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
825     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
826         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
827     fi
829     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
830     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
831         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
832                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
833                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
834         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
835         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
836         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
837     fi
838     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
839         AC_MSG_WARN([android support repository not found - install with
840                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
841                      to allow the build to download the specified version of the android support libraries])
842         add_warning "android support repository not found - install with"
843         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
844         add_warning "to allow the build to download the specified version of the android support libraries"
845     fi
848 if test "$_os" = "AIX"; then
849     AC_PATH_PROG(GAWK, gawk)
850     if test -z "$GAWK"; then
851         AC_MSG_ERROR([gawk not found in \$PATH])
852     fi
855 AC_SUBST(SDKDIRNAME)
857 AC_SUBST(PTHREAD_CFLAGS)
858 AC_SUBST(PTHREAD_LIBS)
860 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
861 # By default use the ones specified by our build system,
862 # but explicit override is possible.
863 AC_MSG_CHECKING(for explicit AFLAGS)
864 if test -n "$AFLAGS"; then
865     AC_MSG_RESULT([$AFLAGS])
866     x_AFLAGS=
867 else
868     AC_MSG_RESULT(no)
869     x_AFLAGS=[\#]
871 AC_MSG_CHECKING(for explicit CFLAGS)
872 if test -n "$CFLAGS"; then
873     AC_MSG_RESULT([$CFLAGS])
874     x_CFLAGS=
875 else
876     AC_MSG_RESULT(no)
877     x_CFLAGS=[\#]
879 AC_MSG_CHECKING(for explicit CXXFLAGS)
880 if test -n "$CXXFLAGS"; then
881     AC_MSG_RESULT([$CXXFLAGS])
882     x_CXXFLAGS=
883 else
884     AC_MSG_RESULT(no)
885     x_CXXFLAGS=[\#]
887 AC_MSG_CHECKING(for explicit OBJCFLAGS)
888 if test -n "$OBJCFLAGS"; then
889     AC_MSG_RESULT([$OBJCFLAGS])
890     x_OBJCFLAGS=
891 else
892     AC_MSG_RESULT(no)
893     x_OBJCFLAGS=[\#]
895 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
896 if test -n "$OBJCXXFLAGS"; then
897     AC_MSG_RESULT([$OBJCXXFLAGS])
898     x_OBJCXXFLAGS=
899 else
900     AC_MSG_RESULT(no)
901     x_OBJCXXFLAGS=[\#]
903 AC_MSG_CHECKING(for explicit LDFLAGS)
904 if test -n "$LDFLAGS"; then
905     AC_MSG_RESULT([$LDFLAGS])
906     x_LDFLAGS=
907 else
908     AC_MSG_RESULT(no)
909     x_LDFLAGS=[\#]
911 AC_SUBST(AFLAGS)
912 AC_SUBST(CFLAGS)
913 AC_SUBST(CXXFLAGS)
914 AC_SUBST(OBJCFLAGS)
915 AC_SUBST(OBJCXXFLAGS)
916 AC_SUBST(LDFLAGS)
917 AC_SUBST(x_AFLAGS)
918 AC_SUBST(x_CFLAGS)
919 AC_SUBST(x_CXXFLAGS)
920 AC_SUBST(x_OBJCFLAGS)
921 AC_SUBST(x_OBJCXXFLAGS)
922 AC_SUBST(x_LDFLAGS)
924 dnl These are potentially set for MSVC, in the code checking for UCRT below:
925 my_original_CFLAGS=$CFLAGS
926 my_original_CXXFLAGS=$CXXFLAGS
927 my_original_CPPFLAGS=$CPPFLAGS
929 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
930 dnl Needs to precede the AC_SEARCH_LIBS call below, which apparently calls
931 dnl AC_PROG_CC internally.
932 if test "$_os" != "WINNT"; then
933     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
934     save_CFLAGS=$CFLAGS
935     AC_PROG_CC
936     CFLAGS=$save_CFLAGS
939 if test $_os != "WINNT"; then
940     save_LIBS="$LIBS"
941     AC_SEARCH_LIBS([dlsym], [dl],
942         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
943         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
944     LIBS="$save_LIBS"
946 AC_SUBST(DLOPEN_LIBS)
948 ###############################################################################
949 # Extensions switches --enable/--disable
950 ###############################################################################
951 # By default these should be enabled unless having extra dependencies.
952 # If there is extra dependency over configure options then the enable should
953 # be automagic based on whether the requiring feature is enabled or not.
954 # All this options change anything only with --enable-extension-integration.
956 # The name of this option and its help string makes it sound as if
957 # extensions are built anyway, just not integrated in the installer,
958 # if you use --disable-extension-integration. Is that really the
959 # case?
961 AC_ARG_ENABLE(ios-simulator,
962     AS_HELP_STRING([--enable-ios-simulator],
963         [build i386 or x86_64 for ios simulator])
966 libo_FUZZ_ARG_ENABLE(extension-integration,
967     AS_HELP_STRING([--disable-extension-integration],
968         [Disable integration of the built extensions in the installer of the
969          product. Use this switch to disable the integration.])
972 AC_ARG_ENABLE(avmedia,
973     AS_HELP_STRING([--disable-avmedia],
974         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
977 AC_ARG_ENABLE(database-connectivity,
978     AS_HELP_STRING([--disable-database-connectivity],
979         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
982 # This doesn't mean not building (or "integrating") extensions
983 # (although it probably should; i.e. it should imply
984 # --disable-extension-integration I guess), it means not supporting
985 # any extension mechanism at all
986 libo_FUZZ_ARG_ENABLE(extensions,
987     AS_HELP_STRING([--disable-extensions],
988         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
991 AC_ARG_ENABLE(scripting,
992     AS_HELP_STRING([--disable-scripting],
993         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
996 # This is mainly for Android and iOS, but could potentially be used in some
997 # special case otherwise, too, so factored out as a separate setting
999 AC_ARG_ENABLE(dynamic-loading,
1000     AS_HELP_STRING([--disable-dynamic-loading],
1001         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1004 libo_FUZZ_ARG_ENABLE(ext-mariadb-connector,
1005     AS_HELP_STRING([--enable-ext-mariadb-connector],
1006         [Enable the build of the MariaDB/MySQL Connector extension.])
1009 libo_FUZZ_ARG_ENABLE(report-builder,
1010     AS_HELP_STRING([--disable-report-builder],
1011         [Disable the Report Builder.])
1014 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1015     AS_HELP_STRING([--enable-ext-wiki-publisher],
1016         [Enable the Wiki Publisher extension.])
1019 libo_FUZZ_ARG_ENABLE(lpsolve,
1020     AS_HELP_STRING([--disable-lpsolve],
1021         [Disable compilation of the lp solve solver ])
1023 libo_FUZZ_ARG_ENABLE(coinmp,
1024     AS_HELP_STRING([--disable-coinmp],
1025         [Disable compilation of the CoinMP solver ])
1028 libo_FUZZ_ARG_ENABLE(pdfimport,
1029     AS_HELP_STRING([--disable-pdfimport],
1030         [Disable building the PDF import feature.])
1033 libo_FUZZ_ARG_ENABLE(pdfium,
1034     AS_HELP_STRING([--disable-pdfium],
1035         [Disable building PDFium.])
1038 ###############################################################################
1040 dnl ---------- *** ----------
1042 libo_FUZZ_ARG_ENABLE(mergelibs,
1043     AS_HELP_STRING([--enable-mergelibs],
1044         [Merge several of the smaller libraries into one big, "merged", one.])
1047 libo_FUZZ_ARG_ENABLE(breakpad,
1048     AS_HELP_STRING([--enable-breakpad],
1049         [Enables breakpad for crash reporting.])
1052 AC_ARG_ENABLE(fetch-external,
1053     AS_HELP_STRING([--disable-fetch-external],
1054         [Disables fetching external tarballs from web sources.])
1057 AC_ARG_ENABLE(fuzzers,
1058     AS_HELP_STRING([--enable-fuzzers],
1059         [Enables building libfuzzer targets for fuzz testing.])
1062 libo_FUZZ_ARG_ENABLE(pch,
1063     AS_HELP_STRING([--enable-pch],
1064         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1067 libo_FUZZ_ARG_ENABLE(epm,
1068     AS_HELP_STRING([--enable-epm],
1069         [LibreOffice includes self-packaging code, that requires epm, however epm is
1070          useless for large scale package building.])
1073 libo_FUZZ_ARG_ENABLE(odk,
1074     AS_HELP_STRING([--disable-odk],
1075         [LibreOffice includes an ODK, office development kit which some packagers may
1076          wish to build without.])
1079 AC_ARG_ENABLE(mpl-subset,
1080     AS_HELP_STRING([--enable-mpl-subset],
1081         [Don't compile any pieces which are not MPL or more liberally licensed])
1084 libo_FUZZ_ARG_ENABLE(evolution2,
1085     AS_HELP_STRING([--enable-evolution2],
1086         [Allows the built-in evolution 2 addressbook connectivity build to be
1087          enabled.])
1090 AC_ARG_ENABLE(avahi,
1091     AS_HELP_STRING([--enable-avahi],
1092         [Determines whether to use Avahi to advertise Impress to remote controls.])
1095 libo_FUZZ_ARG_ENABLE(werror,
1096     AS_HELP_STRING([--enable-werror],
1097         [Turn warnings to errors. (Has no effect in modules where the treating
1098          of warnings as errors is disabled explicitly.)]),
1101 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1102     AS_HELP_STRING([--enable-assert-always-abort],
1103         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1106 libo_FUZZ_ARG_ENABLE(dbgutil,
1107     AS_HELP_STRING([--enable-dbgutil],
1108         [Provide debugging support from --enable-debug and include additional debugging
1109          utilities such as object counting or more expensive checks.
1110          This is the recommended option for developers.
1111          Note that this makes the build ABI incompatible, it is not possible to mix object
1112          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1114 libo_FUZZ_ARG_ENABLE(debug,
1115     AS_HELP_STRING([--enable-debug],
1116         [Include debugging information, disable compiler optimization and inlining plus
1117          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1119 libo_FUZZ_ARG_ENABLE(sal-log,
1120     AS_HELP_STRING([--enable-sal-log],
1121         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1123 AC_ARG_ENABLE(selective-debuginfo,
1124     AS_HELP_STRING([--enable-selective-debuginfo],
1125         [If --enable-debug or --enable-dbgutil is used, build debugging information
1126          (-g compiler flag) only for the specified gbuild build targets
1127          (where all means everything, - prepended means not to enable, / appended means
1128          everything in the directory; there is no ordering, more specific overrides
1129          more general, and disabling takes precedence).
1130          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1132 libo_FUZZ_ARG_ENABLE(symbols,
1133     AS_HELP_STRING([--enable-symbols],
1134         [Generate debug information.
1135          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1136          otherwise.]))
1138 libo_FUZZ_ARG_ENABLE(optimized,
1139     AS_HELP_STRING([--disable-optimized],
1140         [Whether to compile with optimization flags.
1141          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1142          otherwise.]))
1144 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1145     AS_HELP_STRING([--disable-runtime-optimizations],
1146         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1147          JVM JIT) that are known to interact badly with certain dynamic analysis
1148          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1149          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1150          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1152 AC_ARG_WITH(valgrind,
1153     AS_HELP_STRING([--with-valgrind],
1154         [Make availability of Valgrind headers a hard requirement.]))
1156 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1157     AS_HELP_STRING([--enable-compiler-plugins],
1158         [Enable compiler plugins that will perform additional checks during
1159          building. Enabled automatically by --enable-dbgutil.
1160          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1161 COMPILER_PLUGINS_DEBUG=
1162 if test "$enable_compiler_plugins" = debug; then
1163     enable_compiler_plugins=yes
1164     COMPILER_PLUGINS_DEBUG=TRUE
1167 libo_FUZZ_ARG_ENABLE(ooenv,
1168     AS_HELP_STRING([--disable-ooenv],
1169         [Disable ooenv for the instdir installation.]))
1171 libo_FUZZ_ARG_ENABLE(libnumbertext,
1172     AS_HELP_STRING([--disable-libnumbertext],
1173         [Disable use of numbertext external library.]))
1175 AC_ARG_ENABLE(lto,
1176     AS_HELP_STRING([--enable-lto],
1177         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1178          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1179          linker. For MSVC, this option is broken at the moment. This is experimental work
1180          in progress that shouldn't be used unless you are working on it.)]))
1182 AC_ARG_ENABLE(python,
1183     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1184         [Enables or disables Python support at run-time.
1185          Also specifies what Python to use. 'auto' is the default.
1186          'fully-internal' even forces the internal version for uses of Python
1187          during the build.]))
1189 libo_FUZZ_ARG_ENABLE(gtk,
1190     AS_HELP_STRING([--disable-gtk],
1191         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1192 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1194 libo_FUZZ_ARG_ENABLE(gtk3,
1195     AS_HELP_STRING([--disable-gtk3],
1196         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1197 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1199 AC_ARG_ENABLE(split-app-modules,
1200     AS_HELP_STRING([--enable-split-app-modules],
1201         [Split file lists for app modules, e.g. base, calc.
1202          Has effect only with make distro-pack-install]),
1205 AC_ARG_ENABLE(split-opt-features,
1206     AS_HELP_STRING([--enable-split-opt-features],
1207         [Split file lists for some optional features, e.g. pyuno, testtool.
1208          Has effect only with make distro-pack-install]),
1211 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1212     AS_HELP_STRING([--disable-cairo-canvas],
1213         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1216 libo_FUZZ_ARG_ENABLE(dbus,
1217     AS_HELP_STRING([--disable-dbus],
1218         [Determines whether to enable features that depend on dbus.
1219          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1220 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1222 libo_FUZZ_ARG_ENABLE(sdremote,
1223     AS_HELP_STRING([--disable-sdremote],
1224         [Determines whether to enable Impress remote control (i.e. the server component).]),
1225 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1227 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1228     AS_HELP_STRING([--disable-sdremote-bluetooth],
1229         [Determines whether to build sdremote with bluetooth support.
1230          Requires dbus on Linux.]))
1232 libo_FUZZ_ARG_ENABLE(gio,
1233     AS_HELP_STRING([--disable-gio],
1234         [Determines whether to use the GIO support.]),
1235 ,test "${enable_gio+set}" = set || enable_gio=yes)
1237 AC_ARG_ENABLE(kde4,
1238     AS_HELP_STRING([--enable-kde4],
1239         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1240          KDE4 are available.]),
1243 AC_ARG_ENABLE(qt5,
1244     AS_HELP_STRING([--enable-qt5],
1245         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1246          available.]),
1249 AC_ARG_ENABLE(kde5,
1250     AS_HELP_STRING([--enable-kde5],
1251         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1252          KF5 are available.]),
1255 AC_ARG_ENABLE(gtk3_kde5,
1256     AS_HELP_STRING([--enable-gtk3-kde5],
1257         [Determines whether to use Gtk3 vclplug with KDE file dialogs on
1258          platforms where Gtk3, Qt5 and Plasma is available.]),
1261 libo_FUZZ_ARG_ENABLE(gui,
1262     AS_HELP_STRING([--disable-gui],
1263         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1264          command-line option. Not related to LibreOffice Online functionality. Don't use
1265          unless you are certain you need to. Nobody will help you if you insist on trying
1266          this and run into problems.]),
1267 ,test "${enable_gui+set}" = set || enable_gui=yes)
1269 libo_FUZZ_ARG_ENABLE(randr,
1270     AS_HELP_STRING([--disable-randr],
1271         [Disable RandR support in the vcl project.]),
1272 ,test "${enable_randr+set}" = set || enable_randr=yes)
1274 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1275     AS_HELP_STRING([--disable-gstreamer-1-0],
1276         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1277 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1279 AC_ARG_ENABLE(gstreamer-0-10,
1280     AS_HELP_STRING([--enable-gstreamer-0-10],
1281         [Enable building with the gstreamer 0.10 avmedia backend.]),
1282 ,enable_gstreamer_0_10=no)
1284 libo_FUZZ_ARG_ENABLE(vlc,
1285     AS_HELP_STRING([--enable-vlc],
1286         [Enable building with the (experimental) VLC avmedia backend.]),
1287 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1289 libo_FUZZ_ARG_ENABLE(neon,
1290     AS_HELP_STRING([--disable-neon],
1291         [Disable neon and the compilation of webdav binding.]),
1294 libo_FUZZ_ARG_ENABLE([eot],
1295     [AS_HELP_STRING([--enable-eot],
1296         [Enable support for Embedded OpenType fonts.])],
1297 ,test "${enable_eot+set}" = set || enable_eot=no)
1299 libo_FUZZ_ARG_ENABLE(cve-tests,
1300     AS_HELP_STRING([--disable-cve-tests],
1301         [Prevent CVE tests to be executed]),
1304 libo_FUZZ_ARG_ENABLE(chart-tests,
1305     AS_HELP_STRING([--enable-chart-tests],
1306         [Executes chart XShape tests. In a perfect world these tests would be
1307          stable and everyone could run them, in reality it is best to run them
1308          only on a few machines that are known to work and maintained by people
1309          who can judge if a test failure is a regression or not.]),
1312 AC_ARG_ENABLE(build-unowinreg,
1313     AS_HELP_STRING([--enable-build-unowinreg],
1314         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1315          compiler is needed on Linux.]),
1318 AC_ARG_ENABLE(dependency-tracking,
1319     AS_HELP_STRING([--enable-dependency-tracking],
1320         [Do not reject slow dependency extractors.])[
1321   --disable-dependency-tracking
1322                           Disables generation of dependency information.
1323                           Speed up one-time builds.],
1326 AC_ARG_ENABLE(icecream,
1327     AS_HELP_STRING([--enable-icecream],
1328         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1329          It defaults to /opt/icecream for the location of the icecream gcc/g++
1330          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1333 libo_FUZZ_ARG_ENABLE(cups,
1334     AS_HELP_STRING([--disable-cups],
1335         [Do not build cups support.])
1338 AC_ARG_ENABLE(ccache,
1339     AS_HELP_STRING([--disable-ccache],
1340         [Do not try to use ccache automatically.
1341          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1342          CC/CXX are not yet set, and --enable-icecream is not given, we
1343          attempt to use ccache. --disable-ccache disables ccache completely.
1347 AC_ARG_ENABLE(64-bit,
1348     AS_HELP_STRING([--enable-64-bit],
1349         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1350          At the moment meaningful only for Windows.]), ,)
1352 libo_FUZZ_ARG_ENABLE(online-update,
1353     AS_HELP_STRING([--enable-online-update],
1354         [Enable the online update service that will check for new versions of
1355          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1356          If the value is "mar", the experimental Mozilla-like update will be
1357          enabled instead of the traditional update mechanism.]),
1360 AC_ARG_WITH(update-config,
1361     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1362                    [Path to the update config ini file]))
1364 libo_FUZZ_ARG_ENABLE(extension-update,
1365     AS_HELP_STRING([--disable-extension-update],
1366         [Disable possibility to update installed extensions.]),
1369 libo_FUZZ_ARG_ENABLE(release-build,
1370     AS_HELP_STRING([--enable-release-build],
1371         [Enable release build. Note that the "release build" choice is orthogonal to
1372          whether symbols are present, debug info is generated, or optimization
1373          is done.
1374          See http://wiki.documentfoundation.org/Development/DevBuild]),
1377 AC_ARG_ENABLE(windows-build-signing,
1378     AS_HELP_STRING([--enable-windows-build-signing],
1379         [Enable signing of windows binaries (*.exe, *.dll)]),
1382 AC_ARG_ENABLE(silent-msi,
1383     AS_HELP_STRING([--enable-silent-msi],
1384         [Enable MSI with LIMITUI=1 (silent install).]),
1387 AC_ARG_ENABLE(macosx-code-signing,
1388     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1389         [Sign executables, dylibs, frameworks and the app bundle. If you
1390          don't provide an identity the first suitable certificate
1391          in your keychain is used.]),
1394 AC_ARG_ENABLE(macosx-package-signing,
1395     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1396         [Create a .pkg suitable for uploading to the Mac App Store and sign
1397          it. If you don't provide an identity the first suitable certificate
1398          in your keychain is used.]),
1401 AC_ARG_ENABLE(macosx-sandbox,
1402     AS_HELP_STRING([--enable-macosx-sandbox],
1403         [Make the app bundle run in a sandbox. Requires code signing.
1404          Is required by apps distributed in the Mac App Store, and implies
1405          adherence to App Store rules.]),
1408 AC_ARG_WITH(macosx-bundle-identifier,
1409     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1410         [Define the OS X bundle identifier. Default is the somewhat weird
1411          org.libreoffice.script ("script", huh?).]),
1412 ,with_macosx_bundle_identifier=org.libreoffice.script)
1414 AC_ARG_WITH(product-name,
1415     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1416         [Define the product name. Default is AC_PACKAGE_NAME.]),
1417 ,with_product_name=$PRODUCTNAME)
1419 AC_ARG_WITH(package-version,
1420     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1421         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1424 libo_FUZZ_ARG_ENABLE(readonly-installset,
1425     AS_HELP_STRING([--enable-readonly-installset],
1426         [Prevents any attempts by LibreOffice to write into its installation. That means
1427          at least that no "system-wide" extensions can be added. Partly experimental work in
1428          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1431 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1432     AS_HELP_STRING([--disable-postgresql-sdbc],
1433         [Disable the build of the PostgreSQL-SDBC driver.])
1436 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1437     AS_HELP_STRING([--disable-lotuswordpro],
1438         [Disable the build of the Lotus Word Pro filter.]),
1439 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1441 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1442     AS_HELP_STRING([--disable-firebird-sdbc],
1443         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1444 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1446 AC_ARG_ENABLE(bogus-pkg-config,
1447     AS_HELP_STRING([--enable-bogus-pkg-config],
1448         [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.]),
1451 AC_ARG_ENABLE(openssl,
1452     AS_HELP_STRING([--disable-openssl],
1453         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1454          components will either use GNUTLS or NSS. Work in progress,
1455          use only if you are hacking on it.]),
1456 ,enable_openssl=yes)
1458 AC_ARG_ENABLE(library-bin-tar,
1459     AS_HELP_STRING([--enable-library-bin-tar],
1460         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1461         Some libraries can save their build result in a tarball
1462         stored in TARFILE_LOCATION. That binary tarball is
1463         uniquely identified by the source tarball,
1464         the content of the config_host.mk file and the content
1465         of the top-level directory in core for that library
1466         If this option is enabled, then if such a tarfile exist, it will be untarred
1467         instead of the source tarfile, and the build step will be skipped for that
1468         library.
1469         If a proper tarfile does not exist, then the normal source-based
1470         build is done for that library and a proper binary tarfile is created
1471         for the next time.]),
1474 AC_ARG_ENABLE(dconf,
1475     AS_HELP_STRING([--disable-dconf],
1476         [Disable the dconf configuration backend (enabled by default where
1477          available).]))
1479 libo_FUZZ_ARG_ENABLE(formula-logger,
1480     AS_HELP_STRING(
1481         [--enable-formula-logger],
1482         [Enable formula logger for logging formula calculation flow in Calc.]
1483     )
1486 dnl ===================================================================
1487 dnl Optional Packages (--with/without-)
1488 dnl ===================================================================
1490 AC_ARG_WITH(gcc-home,
1491     AS_HELP_STRING([--with-gcc-home],
1492         [Specify the location of gcc/g++ manually. This can be used in conjunction
1493          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1494          non-default path.]),
1497 AC_ARG_WITH(gnu-patch,
1498     AS_HELP_STRING([--with-gnu-patch],
1499         [Specify location of GNU patch on Solaris or FreeBSD.]),
1502 AC_ARG_WITH(build-platform-configure-options,
1503     AS_HELP_STRING([--with-build-platform-configure-options],
1504         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1507 AC_ARG_WITH(gnu-cp,
1508     AS_HELP_STRING([--with-gnu-cp],
1509         [Specify location of GNU cp on Solaris or FreeBSD.]),
1512 AC_ARG_WITH(external-tar,
1513     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1514         [Specify an absolute path of where to find (and store) tarfiles.]),
1515     TARFILE_LOCATION=$withval ,
1518 AC_ARG_WITH(referenced-git,
1519     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1520         [Specify another checkout directory to reference. This makes use of
1521                  git submodule update --reference, and saves a lot of diskspace
1522                  when having multiple trees side-by-side.]),
1523     GIT_REFERENCE_SRC=$withval ,
1526 AC_ARG_WITH(linked-git,
1527     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1528         [Specify a directory where the repositories of submodules are located.
1529          This uses a method similar to git-new-workdir to get submodules.]),
1530     GIT_LINK_SRC=$withval ,
1533 AC_ARG_WITH(galleries,
1534     AS_HELP_STRING([--with-galleries],
1535         [Specify how galleries should be built. It is possible either to
1536          build these internally from source ("build"),
1537          or to disable them ("no")]),
1540 AC_ARG_WITH(theme,
1541     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1542         [Choose which themes to include. By default those themes with an '*' are included.
1543          Possible choices: *breeze, *breeze_dark, *colibre, *elementary, *karasa_jaga, *sifr, *sifr_dark, *tango.]),
1546 libo_FUZZ_ARG_WITH(helppack-integration,
1547     AS_HELP_STRING([--without-helppack-integration],
1548         [It will not integrate the helppacks to the installer
1549          of the product. Please use this switch to use the online help
1550          or separate help packages.]),
1553 libo_FUZZ_ARG_WITH(fonts,
1554     AS_HELP_STRING([--without-fonts],
1555         [LibreOffice includes some third-party fonts to provide a reliable basis for
1556          help content, templates, samples, etc. When these fonts are already
1557          known to be available on the system then you should use this option.]),
1560 AC_ARG_WITH(epm,
1561     AS_HELP_STRING([--with-epm],
1562         [Decides which epm to use. Default is to use the one from the system if
1563          one is built. When either this is not there or you say =internal epm
1564          will be built.]),
1567 AC_ARG_WITH(package-format,
1568     AS_HELP_STRING([--with-package-format],
1569         [Specify package format(s) for LibreOffice installation sets. The
1570          implicit --without-package-format leads to no installation sets being
1571          generated. Possible values: aix, archive, bsd, deb, dmg,
1572          installed, msi, pkg, and rpm.
1573          Example: --with-package-format='deb rpm']),
1576 AC_ARG_WITH(tls,
1577     AS_HELP_STRING([--with-tls],
1578         [Decides which TLS/SSL and cryptographic implementations to use for
1579          LibreOffice's code. Notice that this doesn't apply for depending
1580          libraries like "neon", for example. Default is to use OpenSSL
1581          although NSS is also possible. Notice that selecting NSS restricts
1582          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1583          restrict by now the usage of NSS in LO's code. Possible values:
1584          openssl, nss. Example: --with-tls="nss"]),
1587 AC_ARG_WITH(system-libs,
1588     AS_HELP_STRING([--with-system-libs],
1589         [Use libraries already on system -- enables all --with-system-* flags.]),
1592 AC_ARG_WITH(system-bzip2,
1593     AS_HELP_STRING([--with-system-bzip2],
1594         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1595     [with_system_bzip2="$with_system_libs"])
1597 AC_ARG_WITH(system-headers,
1598     AS_HELP_STRING([--with-system-headers],
1599         [Use headers already on system -- enables all --with-system-* flags for
1600          external packages whose headers are the only entities used i.e.
1601          boost/odbc/sane-header(s).]),,
1602     [with_system_headers="$with_system_libs"])
1604 AC_ARG_WITH(system-jars,
1605     AS_HELP_STRING([--without-system-jars],
1606         [When building with --with-system-libs, also the needed jars are expected
1607          on the system. Use this to disable that]),,
1608     [with_system_jars="$with_system_libs"])
1610 AC_ARG_WITH(system-cairo,
1611     AS_HELP_STRING([--with-system-cairo],
1612         [Use cairo libraries already on system.  Happens automatically for
1613          (implicit) --enable-gtk and for --enable-gtk3.]))
1615 AC_ARG_WITH(system-epoxy,
1616     AS_HELP_STRING([--with-system-epoxy],
1617         [Use epoxy libraries already on system.  Happens automatically for
1618          --enable-gtk3.]),,
1619        [with_system_epoxy="$with_system_libs"])
1621 AC_ARG_WITH(myspell-dicts,
1622     AS_HELP_STRING([--with-myspell-dicts],
1623         [Adds myspell dictionaries to the LibreOffice installation set]),
1626 AC_ARG_WITH(system-dicts,
1627     AS_HELP_STRING([--without-system-dicts],
1628         [Do not use dictionaries from system paths.]),
1631 AC_ARG_WITH(external-dict-dir,
1632     AS_HELP_STRING([--with-external-dict-dir],
1633         [Specify external dictionary dir.]),
1636 AC_ARG_WITH(external-hyph-dir,
1637     AS_HELP_STRING([--with-external-hyph-dir],
1638         [Specify external hyphenation pattern dir.]),
1641 AC_ARG_WITH(external-thes-dir,
1642     AS_HELP_STRING([--with-external-thes-dir],
1643         [Specify external thesaurus dir.]),
1646 AC_ARG_WITH(system-zlib,
1647     AS_HELP_STRING([--with-system-zlib],
1648         [Use zlib already on system.]),,
1649     [with_system_zlib=auto])
1651 AC_ARG_WITH(system-jpeg,
1652     AS_HELP_STRING([--with-system-jpeg],
1653         [Use jpeg already on system.]),,
1654     [with_system_jpeg="$with_system_libs"])
1656 AC_ARG_WITH(system-clucene,
1657     AS_HELP_STRING([--with-system-clucene],
1658         [Use clucene already on system.]),,
1659     [with_system_clucene="$with_system_libs"])
1661 AC_ARG_WITH(system-expat,
1662     AS_HELP_STRING([--with-system-expat],
1663         [Use expat already on system.]),,
1664     [with_system_expat="$with_system_libs"])
1666 AC_ARG_WITH(system-libxml,
1667     AS_HELP_STRING([--with-system-libxml],
1668         [Use libxml/libxslt already on system.]),,
1669     [with_system_libxml=auto])
1671 AC_ARG_WITH(system-icu,
1672     AS_HELP_STRING([--with-system-icu],
1673         [Use icu already on system.]),,
1674     [with_system_icu="$with_system_libs"])
1676 AC_ARG_WITH(system-ucpp,
1677     AS_HELP_STRING([--with-system-ucpp],
1678         [Use ucpp already on system.]),,
1679     [])
1681 AC_ARG_WITH(system-openldap,
1682     AS_HELP_STRING([--with-system-openldap],
1683         [Use the OpenLDAP LDAP SDK already on system.]),,
1684     [with_system_openldap="$with_system_libs"])
1686 AC_ARG_WITH(system-poppler,
1687     AS_HELP_STRING([--with-system-poppler],
1688         [Use system poppler (only needed for PDF import).]),,
1689     [with_system_poppler="$with_system_libs"])
1691 AC_ARG_WITH(system-gpgmepp,
1692     AS_HELP_STRING([--with-system-gpgmepp],
1693         [Use gpgmepp already on system]),,
1694     [with_system_gpgmepp="$with_system_libs"])
1696 AC_ARG_WITH(system-apache-commons,
1697     AS_HELP_STRING([--with-system-apache-commons],
1698         [Use Apache commons libraries already on system.]),,
1699     [with_system_apache_commons="$with_system_jars"])
1701 AC_ARG_WITH(system-mariadb,
1702     AS_HELP_STRING([--with-system-mariadb],
1703         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1704          extension.]),,
1705     [with_system_mariadb="$with_system_libs"])
1707 AC_ARG_ENABLE(bundle-mariadb,
1708     AS_HELP_STRING([--enable-bundle-mariadb],
1709         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1712 AC_ARG_WITH(system-mysql-cppconn,
1713     AS_HELP_STRING([--with-system-mysql-cppconn],
1714         [Use MySQL C++ Connector libraries already on system.]),,
1715     [with_system_mysql_cppconn="$with_system_libs"])
1717 AC_ARG_WITH(system-postgresql,
1718     AS_HELP_STRING([--with-system-postgresql],
1719         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1720          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1721     [with_system_postgresql="$with_system_libs"])
1723 AC_ARG_WITH(libpq-path,
1724     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1725         [Use this PostgreSQL C interface (libpq) installation for building
1726          the PostgreSQL-SDBC extension.]),
1729 AC_ARG_WITH(system-firebird,
1730     AS_HELP_STRING([--with-system-firebird],
1731         [Use Firebird libraries already on system, for building the Firebird-SDBC
1732          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1733     [with_system_firebird="$with_system_libs"])
1735 AC_ARG_WITH(system-libtommath,
1736             AS_HELP_STRING([--with-system-libtommath],
1737                            [Use libtommath already on system]),,
1738             [with_system_libtommath="$with_system_libs"])
1740 AC_ARG_WITH(system-hsqldb,
1741     AS_HELP_STRING([--with-system-hsqldb],
1742         [Use hsqldb already on system.]))
1744 AC_ARG_WITH(hsqldb-jar,
1745     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1746         [Specify path to jarfile manually.]),
1747     HSQLDB_JAR=$withval)
1749 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1750     AS_HELP_STRING([--disable-scripting-beanshell],
1751         [Disable support for scripts in BeanShell.]),
1755 AC_ARG_WITH(system-beanshell,
1756     AS_HELP_STRING([--with-system-beanshell],
1757         [Use beanshell already on system.]),,
1758     [with_system_beanshell="$with_system_jars"])
1760 AC_ARG_WITH(beanshell-jar,
1761     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1762         [Specify path to jarfile manually.]),
1763     BSH_JAR=$withval)
1765 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1766     AS_HELP_STRING([--disable-scripting-javascript],
1767         [Disable support for scripts in JavaScript.]),
1771 AC_ARG_WITH(system-rhino,
1772     AS_HELP_STRING([--with-system-rhino],
1773         [Use rhino already on system.]),,)
1774 #    [with_system_rhino="$with_system_jars"])
1775 # Above is not used as we have different debug interface
1776 # patched into internal rhino. This code needs to be fixed
1777 # before we can enable it by default.
1779 AC_ARG_WITH(rhino-jar,
1780     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1781         [Specify path to jarfile manually.]),
1782     RHINO_JAR=$withval)
1784 AC_ARG_WITH(commons-logging-jar,
1785     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1786         [Specify path to jarfile manually.]),
1787     COMMONS_LOGGING_JAR=$withval)
1789 AC_ARG_WITH(system-jfreereport,
1790     AS_HELP_STRING([--with-system-jfreereport],
1791         [Use JFreeReport already on system.]),,
1792     [with_system_jfreereport="$with_system_jars"])
1794 AC_ARG_WITH(sac-jar,
1795     AS_HELP_STRING([--with-sac-jar=JARFILE],
1796         [Specify path to jarfile manually.]),
1797     SAC_JAR=$withval)
1799 AC_ARG_WITH(libxml-jar,
1800     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1801         [Specify path to jarfile manually.]),
1802     LIBXML_JAR=$withval)
1804 AC_ARG_WITH(flute-jar,
1805     AS_HELP_STRING([--with-flute-jar=JARFILE],
1806         [Specify path to jarfile manually.]),
1807     FLUTE_JAR=$withval)
1809 AC_ARG_WITH(jfreereport-jar,
1810     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1811         [Specify path to jarfile manually.]),
1812     JFREEREPORT_JAR=$withval)
1814 AC_ARG_WITH(liblayout-jar,
1815     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1816         [Specify path to jarfile manually.]),
1817     LIBLAYOUT_JAR=$withval)
1819 AC_ARG_WITH(libloader-jar,
1820     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1821         [Specify path to jarfile manually.]),
1822     LIBLOADER_JAR=$withval)
1824 AC_ARG_WITH(libformula-jar,
1825     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1826         [Specify path to jarfile manually.]),
1827     LIBFORMULA_JAR=$withval)
1829 AC_ARG_WITH(librepository-jar,
1830     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1831         [Specify path to jarfile manually.]),
1832     LIBREPOSITORY_JAR=$withval)
1834 AC_ARG_WITH(libfonts-jar,
1835     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1836         [Specify path to jarfile manually.]),
1837     LIBFONTS_JAR=$withval)
1839 AC_ARG_WITH(libserializer-jar,
1840     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1841         [Specify path to jarfile manually.]),
1842     LIBSERIALIZER_JAR=$withval)
1844 AC_ARG_WITH(libbase-jar,
1845     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1846         [Specify path to jarfile manually.]),
1847     LIBBASE_JAR=$withval)
1849 AC_ARG_WITH(system-odbc,
1850     AS_HELP_STRING([--with-system-odbc],
1851         [Use the odbc headers already on system.]),,
1852     [with_system_odbc="auto"])
1854 AC_ARG_WITH(system-sane,
1855     AS_HELP_STRING([--with-system-sane],
1856         [Use sane.h already on system.]),,
1857     [with_system_sane="$with_system_headers"])
1859 AC_ARG_WITH(system-bluez,
1860     AS_HELP_STRING([--with-system-bluez],
1861         [Use bluetooth.h already on system.]),,
1862     [with_system_bluez="$with_system_headers"])
1864 AC_ARG_WITH(system-curl,
1865     AS_HELP_STRING([--with-system-curl],
1866         [Use curl already on system.]),,
1867     [with_system_curl=auto])
1869 AC_ARG_WITH(system-boost,
1870     AS_HELP_STRING([--with-system-boost],
1871         [Use boost already on system.]),,
1872     [with_system_boost="$with_system_headers"])
1874 AC_ARG_WITH(system-glm,
1875     AS_HELP_STRING([--with-system-glm],
1876         [Use glm already on system.]),,
1877     [with_system_glm="$with_system_headers"])
1879 AC_ARG_WITH(system-hunspell,
1880     AS_HELP_STRING([--with-system-hunspell],
1881         [Use libhunspell already on system.]),,
1882     [with_system_hunspell="$with_system_libs"])
1884 AC_ARG_WITH(system-mythes,
1885     AS_HELP_STRING([--with-system-mythes],
1886         [Use mythes already on system.]),,
1887     [with_system_mythes="$with_system_libs"])
1889 AC_ARG_WITH(system-altlinuxhyph,
1890     AS_HELP_STRING([--with-system-altlinuxhyph],
1891         [Use ALTLinuxhyph already on system.]),,
1892     [with_system_altlinuxhyph="$with_system_libs"])
1894 AC_ARG_WITH(system-lpsolve,
1895     AS_HELP_STRING([--with-system-lpsolve],
1896         [Use lpsolve already on system.]),,
1897     [with_system_lpsolve="$with_system_libs"])
1899 AC_ARG_WITH(system-coinmp,
1900     AS_HELP_STRING([--with-system-coinmp],
1901         [Use CoinMP already on system.]),,
1902     [with_system_coinmp="$with_system_libs"])
1904 AC_ARG_WITH(system-liblangtag,
1905     AS_HELP_STRING([--with-system-liblangtag],
1906         [Use liblangtag library already on system.]),,
1907     [with_system_liblangtag="$with_system_libs"])
1909 AC_ARG_WITH(webdav,
1910     AS_HELP_STRING([--with-webdav],
1911         [Specify which library to use for webdav implementation.
1912          Possible values: "neon", "serf", "no". The default value is "neon".
1913          Example: --with-webdav="serf"]),
1914     WITH_WEBDAV=$withval,
1915     WITH_WEBDAV="neon")
1917 AC_ARG_WITH(linker-hash-style,
1918     AS_HELP_STRING([--with-linker-hash-style],
1919         [Use linker with --hash-style=<style> when linking shared objects.
1920          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1921          if supported on the build system, and "sysv" otherwise.]))
1923 AC_ARG_WITH(jdk-home,
1924     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1925         [If you have installed JDK 1.6 or later on your system please supply the
1926          path here. Note that this is not the location of the java command but the
1927          location of the entire distribution.]),
1930 AC_ARG_WITH(help,
1931     AS_HELP_STRING([--with-help],
1932         [Enable the build of help. There is a special parameter "common" that
1933          can be used to bundle only the common part, .e.g help-specific icons.
1934          This is useful when you build the helpcontent separately.])
1935     [
1936                           Usage:     --with-help    build the old local help
1937                                  --without-help     no local help (default)
1938                                  --with-help=html   build the new HTML local help
1939                                  --with-help=online build the new HTML online help
1940     ],
1943 libo_FUZZ_ARG_WITH(java,
1944     AS_HELP_STRING([--with-java=<java command>],
1945         [Specify the name of the Java interpreter command. Typically "java"
1946          which is the default.
1948          To build without support for Java components, applets, accessibility
1949          or the XML filters written in Java, use --without-java or --with-java=no.]),
1950     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1951     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
1954 AC_ARG_WITH(jvm-path,
1955     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
1956         [Use a specific JVM search path at runtime.
1957          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
1960 AC_ARG_WITH(ant-home,
1961     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
1962         [If you have installed Jakarta Ant on your system, please supply the path here.
1963          Note that this is not the location of the Ant binary but the location
1964          of the entire distribution.]),
1967 AC_ARG_WITH(symbol-config,
1968     AS_HELP_STRING([--with-symbol-config],
1969         [Configuration for the crashreport symbol upload]),
1970         [],
1971         [with_symbol_config=no])
1973 AC_ARG_WITH(export-validation,
1974     AS_HELP_STRING([--without-export-validation],
1975         [Disable validating OOXML and ODF files as exported from in-tree tests.
1976          Use this option e.g. if your system only provides Java 5.]),
1977 ,with_export_validation=auto)
1979 AC_ARG_WITH(bffvalidator,
1980     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
1981         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
1982          Requires installed Microsoft Office Binary File Format Validator.
1983          Note: export-validation (--with-export-validation) is required to be turned on.
1984          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
1985 ,with_bffvalidator=no)
1987 libo_FUZZ_ARG_WITH(junit,
1988     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
1989         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
1990          --without-junit disables those tests. Not relevant in the --without-java case.]),
1991 ,with_junit=yes)
1993 AC_ARG_WITH(hamcrest,
1994     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
1995         [Specifies the hamcrest jar file to use for JUnit-based tests.
1996          --without-junit disables those tests. Not relevant in the --without-java case.]),
1997 ,with_hamcrest=yes)
1999 AC_ARG_WITH(perl-home,
2000     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2001         [If you have installed Perl 5 Distribution, on your system, please
2002          supply the path here. Note that this is not the location of the Perl
2003          binary but the location of the entire distribution.]),
2006 libo_FUZZ_ARG_WITH(doxygen,
2007     AS_HELP_STRING(
2008         [--with-doxygen=<absolute path to doxygen executable>],
2009         [Specifies the doxygen executable to use when generating ODK C/C++
2010          documentation. --without-doxygen disables generation of ODK C/C++
2011          documentation. Not relevant in the --disable-odk case.]),
2012 ,with_doxygen=yes)
2014 AC_ARG_WITH(visual-studio,
2015     AS_HELP_STRING([--with-visual-studio=<2015/2017>],
2016         [Specify which Visual Studio version to use in case several are
2017          installed. If not specified, defaults to 2015.]),
2020 AC_ARG_WITH(windows-sdk,
2021     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
2022         [Specify which Windows SDK, or "Windows Kit", version to use
2023          in case the one that came with the selected Visual Studio
2024          is not what you want for some reason. Note that not all compiler/SDK
2025          combinations are supported. The intent is that this option should not
2026          be needed.]),
2029 AC_ARG_WITH(lang,
2030     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2031         [Use this option to build LibreOffice with additional UI language support.
2032          English (US) is always included by default.
2033          Separate multiple languages with space.
2034          For all languages, use --with-lang=ALL.]),
2037 AC_ARG_WITH(locales,
2038     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2039         [Use this option to limit the locale information built in.
2040          Separate multiple locales with space.
2041          Very experimental and might well break stuff.
2042          Just a desperate measure to shrink code and data size.
2043          By default all the locales available is included.
2044          This option is completely unrelated to --with-lang.])
2045     [
2046                           Affects also our character encoding conversion
2047                           tables for encodings mainly targeted for a
2048                           particular locale, like EUC-CN and EUC-TW for
2049                           zh, ISO-2022-JP for ja.
2051                           Affects also our add-on break iterator data for
2052                           some languages.
2054                           For the default, all locales, don't use this switch at all.
2055                           Specifying just the language part of a locale means all matching
2056                           locales will be included.
2057     ],
2060 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2061 libo_FUZZ_ARG_WITH(krb5,
2062     AS_HELP_STRING([--with-krb5],
2063         [Enable MIT Kerberos 5 support in modules that support it.
2064          By default automatically enabled on platforms
2065          where a good system Kerberos 5 is available.]),
2068 libo_FUZZ_ARG_WITH(gssapi,
2069     AS_HELP_STRING([--with-gssapi],
2070         [Enable GSSAPI support in modules that support it.
2071          By default automatically enabled on platforms
2072          where a good system GSSAPI is available.]),
2075 AC_ARG_WITH(iwyu,
2076     AS_HELP_STRING([--with-iwyu],
2077         [Use given IWYU binary path to check unneeded includes instead of building.
2078          Use only if you are hacking on it.]),
2081 libo_FUZZ_ARG_WITH(lxml,
2082     AS_HELP_STRING([--without-lxml],
2083         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2084          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2085          report widget classes and ids.]),
2088 dnl ===================================================================
2089 dnl Branding
2090 dnl ===================================================================
2092 AC_ARG_WITH(branding,
2093     AS_HELP_STRING([--with-branding=/path/to/images],
2094         [Use given path to retrieve branding images set.])
2095     [
2096                           Search for intro.png about.svg and flat_logo.svg.
2097                           If any is missing, default ones will be used instead.
2099                           Search also progress.conf for progress
2100                           settings on intro screen :
2102                           PROGRESSBARCOLOR="255,255,255" Set color of
2103                           progress bar. Comma separated RGB decimal values.
2104                           PROGRESSSIZE="407,6" Set size of progress bar.
2105                           Comma separated decimal values (width, height).
2106                           PROGRESSPOSITION="61,317" Set position of progress
2107                           bar from left,top. Comma separated decimal values.
2108                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2109                           bar frame. Comma separated RGB decimal values.
2110                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2111                           bar text. Comma separated RGB decimal values.
2112                           PROGRESSTEXTBASELINE="287" Set vertical position of
2113                           progress bar text from top. Decimal value.
2115                           Default values will be used if not found.
2116     ],
2120 AC_ARG_WITH(extra-buildid,
2121     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2122         [Show addition build identification in about dialog.]),
2126 AC_ARG_WITH(vendor,
2127     AS_HELP_STRING([--with-vendor="John the Builder"],
2128         [Set vendor of the build.]),
2131 AC_ARG_WITH(android-package-name,
2132     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2133         [Set Android package name of the build.]),
2136 AC_ARG_WITH(compat-oowrappers,
2137     AS_HELP_STRING([--with-compat-oowrappers],
2138         [Install oo* wrappers in parallel with
2139          lo* ones to keep backward compatibility.
2140          Has effect only with make distro-pack-install]),
2143 AC_ARG_WITH(os-version,
2144     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2145         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2148 AC_ARG_WITH(mingw-cross-compiler,
2149     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2150         [Specify the MinGW cross-compiler to use.
2151          When building on the ODK on Unix and building unowinreg.dll,
2152          specify the MinGW C++ cross-compiler.]),
2155 AC_ARG_WITH(idlc-cpp,
2156     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2157         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2160 AC_ARG_WITH(build-version,
2161     AS_HELP_STRING([--with-build-version="Built by Jim"],
2162         [Allows the builder to add a custom version tag that will appear in the
2163          Help/About box for QA purposes.]),
2164 with_build_version=$withval,
2167 AC_ARG_WITH(alloc,
2168     AS_HELP_STRING([--with-alloc],
2169         [Define which allocator to build with (choices are internal, system).]),
2172 AC_ARG_WITH(parallelism,
2173     AS_HELP_STRING([--with-parallelism],
2174         [Number of jobs to run simultaneously during build. Parallel builds can
2175         save a lot of time on multi-cpu machines. Defaults to the number of
2176         CPUs on the machine, unless you configure --enable-icecream - then to
2177         10.]),
2180 AC_ARG_WITH(all-tarballs,
2181     AS_HELP_STRING([--with-all-tarballs],
2182         [Download all external tarballs unconditionally]))
2184 AC_ARG_WITH(gdrive-client-id,
2185     AS_HELP_STRING([--with-gdrive-client-id],
2186         [Provides the client id of the application for OAuth2 authentication
2187         on Google Drive. If either this or --with-gdrive-client-secret is
2188         empty, the feature will be disabled]),
2191 AC_ARG_WITH(gdrive-client-secret,
2192     AS_HELP_STRING([--with-gdrive-client-secret],
2193         [Provides the client secret of the application for OAuth2
2194         authentication on Google Drive. If either this or
2195         --with-gdrive-client-id is empty, the feature will be disabled]),
2198 AC_ARG_WITH(alfresco-cloud-client-id,
2199     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2200         [Provides the client id of the application for OAuth2 authentication
2201         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2202         empty, the feature will be disabled]),
2205 AC_ARG_WITH(alfresco-cloud-client-secret,
2206     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2207         [Provides the client secret of the application for OAuth2
2208         authentication on Alfresco Cloud. If either this or
2209         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2212 AC_ARG_WITH(onedrive-client-id,
2213     AS_HELP_STRING([--with-onedrive-client-id],
2214         [Provides the client id of the application for OAuth2 authentication
2215         on OneDrive. If either this or --with-onedrive-client-secret is
2216         empty, the feature will be disabled]),
2219 AC_ARG_WITH(onedrive-client-secret,
2220     AS_HELP_STRING([--with-onedrive-client-secret],
2221         [Provides the client secret of the application for OAuth2
2222         authentication on OneDrive. If either this or
2223         --with-onedrive-client-id is empty, the feature will be disabled]),
2225 dnl ===================================================================
2226 dnl Do we want to use pre-build binary tarball for recompile
2227 dnl ===================================================================
2229 if test "$enable_library_bin_tar" = "yes" ; then
2230     USE_LIBRARY_BIN_TAR=TRUE
2231 else
2232     USE_LIBRARY_BIN_TAR=
2234 AC_SUBST(USE_LIBRARY_BIN_TAR)
2236 dnl ===================================================================
2237 dnl Test whether build target is Release Build
2238 dnl ===================================================================
2239 AC_MSG_CHECKING([whether build target is Release Build])
2240 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2241     AC_MSG_RESULT([no])
2242     ENABLE_RELEASE_BUILD=
2243 else
2244     AC_MSG_RESULT([yes])
2245     ENABLE_RELEASE_BUILD=TRUE
2247 AC_SUBST(ENABLE_RELEASE_BUILD)
2249 dnl ===================================================================
2250 dnl Test whether to sign Windows Build
2251 dnl ===================================================================
2252 AC_MSG_CHECKING([whether to sign windows build])
2253 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2254     AC_MSG_RESULT([yes])
2255     WINDOWS_BUILD_SIGNING="TRUE"
2256 else
2257     AC_MSG_RESULT([no])
2258     WINDOWS_BUILD_SIGNING="FALSE"
2260 AC_SUBST(WINDOWS_BUILD_SIGNING)
2262 dnl ===================================================================
2263 dnl MacOSX build and runtime environment options
2264 dnl ===================================================================
2266 AC_ARG_WITH(macosx-sdk,
2267     AS_HELP_STRING([--with-macosx-sdk=<version>],
2268         [Prefer a specific SDK for building.])
2269     [
2270                           If the requested SDK is not available, a search for the oldest one will be done.
2271                           With current Xcode versions, only the latest SDK is included, so this option is
2272                           not terribly useful. It works fine to build with a new SDK and run the result
2273                           on an older OS.
2275                           e. g.: --with-macosx-sdk=10.9
2277                           there are 3 options to control the MacOSX build:
2278                           --with-macosx-sdk (referred as 'sdk' below)
2279                           --with-macosx-version-min-required (referred as 'min' below)
2280                           --with-macosx-version-max-allowed (referred as 'max' below)
2282                           the connection between these value and the default they take is as follow:
2283                           ( ? means not specified on the command line, s means the SDK version found,
2284                           constraint: 8 <= x <= y <= z)
2286                           ==========================================
2287                            command line      || config result
2288                           ==========================================
2289                           min  | max  | sdk  || min  | max  | sdk  |
2290                           ?    | ?    | ?    || 10.9 | 10.s | 10.s |
2291                           ?    | ?    | 10.x || 10.9 | 10.x | 10.x |
2292                           ?    | 10.x | ?    || 10.9 | 10.s | 10.s |
2293                           ?    | 10.x | 10.y || 10.9 | 10.x | 10.y |
2294                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2295                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2296                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2297                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2300                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2301                           for a detailed technical explanation of these variables
2303                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2304     ],
2307 AC_ARG_WITH(macosx-version-min-required,
2308     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2309         [set the minimum OS version needed to run the built LibreOffice])
2310     [
2311                           e. g.: --with-macos-version-min-required=10.9
2312                           see --with-macosx-sdk for more info
2313     ],
2316 AC_ARG_WITH(macosx-version-max-allowed,
2317     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2318         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2319     [
2320                           e. g.: --with-macos-version-max-allowed=10.9
2321                           see --with-macosx-sdk for more info
2322     ],
2326 dnl ===================================================================
2327 dnl options for stuff used during cross-compilation build
2328 dnl Not quite superseded by --with-build-platform-configure-options.
2329 dnl TODO: check, if the "force" option is still needed anywhere.
2330 dnl ===================================================================
2332 AC_ARG_WITH(system-icu-for-build,
2333     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2334         [Use icu already on system for build tools (cross-compilation only).]))
2337 dnl ===================================================================
2338 dnl Check for incompatible options set by fuzzing, and reset those
2339 dnl automatically to working combinations
2340 dnl ===================================================================
2342 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2343         "$enable_dbus" != "$enable_avahi"; then
2344     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2345     enable_avahi=$enable_dbus
2348 dnl ===================================================================
2349 dnl check for required programs (grep, awk, sed, bash)
2350 dnl ===================================================================
2352 pathmunge ()
2354     if test -n "$1"; then
2355         if test "$build_os" = "cygwin"; then
2356             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2357                 PathFormat "$1"
2358                 new_path=`cygpath -sm "$formatted_path"`
2359             else
2360                 PathFormat "$1"
2361                 new_path=`cygpath -u "$formatted_path"`
2362             fi
2363         else
2364             new_path="$1"
2365         fi
2366         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2367             if test "$2" = "after"; then
2368                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2369             else
2370                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2371             fi
2372         fi
2373         unset new_path
2374     fi
2377 AC_PROG_AWK
2378 AC_PATH_PROG( AWK, $AWK)
2379 if test -z "$AWK"; then
2380     AC_MSG_ERROR([install awk to run this script])
2383 AC_PATH_PROG(BASH, bash)
2384 if test -z "$BASH"; then
2385     AC_MSG_ERROR([bash not found in \$PATH])
2387 AC_SUBST(BASH)
2389 AC_MSG_CHECKING([for GNU or BSD tar])
2390 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2391     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2392     if test $? -eq 0;  then
2393         GNUTAR=$a
2394         break
2395     fi
2396 done
2397 AC_MSG_RESULT($GNUTAR)
2398 if test -z "$GNUTAR"; then
2399     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2401 AC_SUBST(GNUTAR)
2403 AC_MSG_CHECKING([for tar's option to strip components])
2404 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2405 if test $? -eq 0; then
2406     STRIP_COMPONENTS="--strip-components"
2407 else
2408     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2409     if test $? -eq 0; then
2410         STRIP_COMPONENTS="--strip-path"
2411     else
2412         STRIP_COMPONENTS="unsupported"
2413     fi
2415 AC_MSG_RESULT($STRIP_COMPONENTS)
2416 if test x$STRIP_COMPONENTS = xunsupported; then
2417     AC_MSG_ERROR([you need a tar that is able to strip components.])
2419 AC_SUBST(STRIP_COMPONENTS)
2421 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2422 dnl desktop OSes from "mobile" ones.
2424 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2425 dnl In other words, that when building for an OS that is not a
2426 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2428 dnl Note the direction of the implication; there is no assumption that
2429 dnl cross-compiling would imply a non-desktop OS.
2431 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2432     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2433     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2434     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2437 # Whether to build "avmedia" functionality or not.
2439 if test -z "$enable_avmedia"; then
2440     enable_avmedia=yes
2443 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2444 if test "$enable_avmedia" = yes; then
2445     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2446 else
2447     USE_AVMEDIA_DUMMY='TRUE'
2449 AC_SUBST(USE_AVMEDIA_DUMMY)
2451 # Decide whether to build database connectivity stuff (including
2452 # Base) or not. We probably don't want to on non-desktop OSes.
2453 if test -z "$enable_database_connectivity"; then
2454     # --disable-database-connectivity is unfinished work in progress
2455     # and the iOS test app doesn't link if we actually try to use it.
2456     # if test $_os != iOS -a $_os != Android; then
2457     if test $_os != iOS; then
2458         enable_database_connectivity=yes
2459     fi
2462 if test "$enable_database_connectivity" = yes; then
2463     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2464     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2467 if test -z "$enable_extensions"; then
2468     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2469     if test $_os != iOS -a $_os != Android; then
2470         enable_extensions=yes
2471     fi
2474 if test "$enable_extensions" = yes; then
2475     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2476     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2479 if test -z "$enable_scripting"; then
2480     # Disable scripting for iOS unless specifically overridden
2481     # with --enable-scripting.
2482     if test $_os != iOS; then
2483         enable_scripting=yes
2484     fi
2487 DISABLE_SCRIPTING=''
2488 if test "$enable_scripting" = yes; then
2489     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2490     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2491 else
2492     DISABLE_SCRIPTING='TRUE'
2493     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2496 if test $_os = iOS -o $_os = Android; then
2497     # Disable dynamic_loading always for iOS and Android
2498     enable_dynamic_loading=no
2499 elif test -z "$enable_dynamic_loading"; then
2500     # Otherwise enable it unless speficically disabled
2501     enable_dynamic_loading=yes
2504 DISABLE_DYNLOADING=''
2505 if test "$enable_dynamic_loading" = yes; then
2506     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2507 else
2508     DISABLE_DYNLOADING='TRUE'
2510 AC_SUBST(DISABLE_DYNLOADING)
2512 # remenber SYSBASE value
2513 AC_SUBST(SYSBASE)
2515 dnl ===================================================================
2516 dnl  Sort out various gallery compilation options
2517 dnl ===================================================================
2518 AC_MSG_CHECKING([how to build and package galleries])
2519 if test -n "${with_galleries}"; then
2520     if test "$with_galleries" = "build"; then
2521         WITH_GALLERY_BUILD=TRUE
2522         AC_MSG_RESULT([build from source images internally])
2523     elif test "$with_galleries" = "no"; then
2524         WITH_GALLERY_BUILD=
2525         AC_MSG_RESULT([disable non-internal gallery build])
2526     else
2527         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2528     fi
2529 else
2530     if test $_os != iOS -a $_os != Android; then
2531         WITH_GALLERY_BUILD=TRUE
2532         AC_MSG_RESULT([internal src images for desktop])
2533     else
2534         WITH_GALLERY_BUILD=
2535         AC_MSG_RESULT([disable src image build])
2536     fi
2538 AC_SUBST(WITH_GALLERY_BUILD)
2540 dnl ===================================================================
2541 dnl  Checks if ccache is available
2542 dnl ===================================================================
2543 if test "$_os" = "WINNT"; then
2544     # on windows/VC build do not use ccache
2545     CCACHE=""
2546 elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2547     case "%$CC%$CXX%" in
2548     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2549     # assume that's good then
2550     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2551         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2552         ;;
2553     *)
2554         AC_PATH_PROG([CCACHE],[ccache],[not found])
2555         if test "$CCACHE" = "not found"; then
2556             CCACHE=""
2557         else
2558             # Need to check for ccache version: otherwise prevents
2559             # caching of the results (like "-x objective-c++" for Mac)
2560             if test $_os = Darwin -o $_os = iOS; then
2561                 # Check ccache version
2562                 AC_MSG_CHECKING([whether version of ccache is suitable])
2563                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2564                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2565                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2566                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2567                 else
2568                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2569                     CCACHE=""
2570                 fi
2571             fi
2572         fi
2573         ;;
2574     esac
2575 else
2576     CCACHE=""
2579 if test "$CCACHE" != ""; then
2580     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2581     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2582     if test "$ccache_size" = ""; then
2583         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2584         if test "$ccache_size" = ""; then
2585             ccache_size=0
2586         fi
2587         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2588         if test $ccache_size -lt 1024; then
2589             CCACHE=""
2590             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2591             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2592         else
2593             # warn that ccache may be too small for debug build
2594             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2595             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2596         fi
2597     else
2598         if test $ccache_size -lt 5; then
2599             #warn that ccache may be too small for debug build
2600             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2601             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2602         fi
2603     fi
2606 dnl ===================================================================
2607 dnl  Checks for C compiler,
2608 dnl  The check for the C++ compiler is later on.
2609 dnl ===================================================================
2610 if test "$_os" != "WINNT"; then
2611     GCC_HOME_SET="true"
2612     AC_MSG_CHECKING([gcc home])
2613     if test -z "$with_gcc_home"; then
2614         if test "$enable_icecream" = "yes"; then
2615             if test -d "/usr/lib/icecc/bin"; then
2616                 GCC_HOME="/usr/lib/icecc/"
2617             elif test -d "/usr/libexec/icecc/bin"; then
2618                 GCC_HOME="/usr/libexec/icecc/"
2619             elif test -d "/opt/icecream/bin"; then
2620                 GCC_HOME="/opt/icecream/"
2621             else
2622                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2624             fi
2625         else
2626             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2627             GCC_HOME_SET="false"
2628         fi
2629     else
2630         GCC_HOME="$with_gcc_home"
2631     fi
2632     AC_MSG_RESULT($GCC_HOME)
2633     AC_SUBST(GCC_HOME)
2635     if test "$GCC_HOME_SET" = "true"; then
2636         if test -z "$CC"; then
2637             CC="$GCC_HOME/bin/gcc"
2638         fi
2639         if test -z "$CXX"; then
2640             CXX="$GCC_HOME/bin/g++"
2641         fi
2642     fi
2645 COMPATH=`dirname "$CC"`
2646 if test "$COMPATH" = "."; then
2647     AC_PATH_PROGS(COMPATH, $CC)
2648     dnl double square bracket to get single because of M4 quote...
2649     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2651 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2653 dnl ===================================================================
2654 dnl Java support
2655 dnl ===================================================================
2656 AC_MSG_CHECKING([whether to build with Java support])
2657 if test "$with_java" != "no"; then
2658     if test "$DISABLE_SCRIPTING" = TRUE; then
2659         AC_MSG_RESULT([no, overridden by --disable-scripting])
2660         ENABLE_JAVA=""
2661         with_java=no
2662     else
2663         AC_MSG_RESULT([yes])
2664         ENABLE_JAVA="TRUE"
2665         AC_DEFINE(HAVE_FEATURE_JAVA)
2666     fi
2667 else
2668     AC_MSG_RESULT([no])
2669     ENABLE_JAVA=""
2672 AC_SUBST(ENABLE_JAVA)
2674 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2676 dnl ENABLE_JAVA="" indicate no Java support at all
2678 dnl ===================================================================
2679 dnl Check OS X SDK and compiler
2680 dnl ===================================================================
2682 if test $_os = Darwin -o $_os = iOS; then
2684     # If no --with-macosx-sdk option is given, look for one
2686     # The intent is that for "most" Mac-based developers, a suitable
2687     # SDK will be found automatically without any configure options.
2689     # For developers with a current Xcode, the lowest-numbered SDK
2690     # higher than or equal to the minimum required should be found.
2692     AC_MSG_CHECKING([what Mac OS X SDK to use])
2693     for _macosx_sdk in $with_macosx_sdk 10.13 10.12; do
2694         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2695         if test -d "$MACOSX_SDK_PATH"; then
2696             with_macosx_sdk="${_macosx_sdk}"
2697             break
2698         else
2699             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2700             if test -d "$MACOSX_SDK_PATH"; then
2701                 with_macosx_sdk="${_macosx_sdk}"
2702                 break
2703             fi
2704         fi
2705     done
2706     if test ! -d "$MACOSX_SDK_PATH"; then
2707         AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2708     fi
2710     if test $_os = iOS; then
2711         if test "$enable_ios_simulator" = "yes"; then
2712             useos=iphonesimulator
2713         else
2714             useos=iphoneos
2715         fi
2716         MACOSX_SDK_PATH=`xcrun --sdk ${useos} --show-sdk-path 2> /dev/null`
2717     fi
2718     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2721     case $with_macosx_sdk in
2722     10.9)
2723         MACOSX_SDK_VERSION=1090
2724         ;;
2725     10.10)
2726         MACOSX_SDK_VERSION=101000
2727         ;;
2728     10.11)
2729         MACOSX_SDK_VERSION=101100
2730         ;;
2731     10.12)
2732         MACOSX_SDK_VERSION=101200
2733         ;;
2734     10.13)
2735         MACOSX_SDK_VERSION=101300
2736         ;;
2737     *)
2738         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.9--13])
2739         ;;
2740     esac
2742     if test "$with_macosx_version_min_required" = "" ; then
2743         with_macosx_version_min_required="10.9";
2744     fi
2746     if test "$with_macosx_version_max_allowed" = "" ; then
2747         with_macosx_version_max_allowed="$with_macosx_sdk"
2748     fi
2750     # export this so that "xcrun" invocations later return matching values
2751     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2752     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2753     export DEVELOPER_DIR
2754     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2755     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2757     case "$with_macosx_version_min_required" in
2758     10.9)
2759         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2760         ;;
2761     10.10)
2762         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2763         ;;
2764     10.11)
2765         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2766         ;;
2767     10.12)
2768         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2769         ;;
2770     10.13)
2771         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2772         ;;
2773     *)
2774         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.9--13])
2775         ;;
2776     esac
2777     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2779     LIBTOOL=/usr/bin/libtool
2780     INSTALL_NAME_TOOL=install_name_tool
2781     if test -z "$save_CC"; then
2782         AC_MSG_CHECKING([what compiler to use])
2783         stdlib=-stdlib=libc++
2784         if test "$ENABLE_LTO" = TRUE; then
2785             lto=-flto
2786         fi
2787         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2788         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2789         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2790         AR=`xcrun -find ar`
2791         NM=`xcrun -find nm`
2792         STRIP=`xcrun -find strip`
2793         LIBTOOL=`xcrun -find libtool`
2794         RANLIB=`xcrun -find ranlib`
2795         AC_MSG_RESULT([$CC and $CXX])
2796     fi
2798     case "$with_macosx_version_max_allowed" in
2799     10.9)
2800         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2801         ;;
2802     10.10)
2803         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2804         ;;
2805     10.11)
2806         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2807         ;;
2808     10.12)
2809         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2810         ;;
2811     10.13)
2812         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2813         ;;
2814     *)
2815         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.9--13])
2816         ;;
2817     esac
2819     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2820     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2821         AC_MSG_RESULT([$MAC_OS_X_VERSION_MIN_REQUIRED])
2822         AC_MSG_RESULT([$MAC_OS_X_VERSION_MAX_REQUIRED])
2823         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2824     else
2825         AC_MSG_RESULT([ok])
2826     fi
2828     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2829     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2830         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2831     else
2832         AC_MSG_RESULT([ok])
2833     fi
2834     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2835     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2837     AC_MSG_CHECKING([whether to do code signing])
2839     if test "$enable_macosx_code_signing" = yes; then
2840         # By default use the first suitable certificate (?).
2842         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2843         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2844         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2845         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2846         # "Developer ID Application" one.
2848         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2849         if test -n "$identity"; then
2850             MACOSX_CODESIGNING_IDENTITY=$identity
2851             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2852             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2853         else
2854             AC_MSG_ERROR([cannot determine identity to use])
2855         fi
2856     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2857         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2858         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2859         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2860     else
2861         AC_MSG_RESULT([no])
2862     fi
2864     AC_MSG_CHECKING([whether to create a Mac App Store package])
2866     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2867         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2868     elif test "$enable_macosx_package_signing" = yes; then
2869         # By default use the first suitable certificate.
2870         # It should be a "3rd Party Mac Developer Installer" one
2872         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2873         if test -n "$identity"; then
2874             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2875             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2876             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2877         else
2878             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2879         fi
2880     elif test -n "$enable_macosx_package_signing"; then
2881         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2882         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2883         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2884     else
2885         AC_MSG_RESULT([no])
2886     fi
2888     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2889         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2890     fi
2892     AC_MSG_CHECKING([whether to sandbox the application])
2894     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2895         AC_MSG_ERROR([OS X sandboxing requires code signing])
2896     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2897         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2898     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2899         ENABLE_MACOSX_SANDBOX=TRUE
2900         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2901         AC_MSG_RESULT([yes])
2902     else
2903         AC_MSG_RESULT([no])
2904     fi
2906     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2907     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2908     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2910 AC_SUBST(MACOSX_SDK_PATH)
2911 AC_SUBST(MACOSX_SDK_VERSION)
2912 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2913 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2914 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
2915 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2916 AC_SUBST(INSTALL_NAME_TOOL)
2917 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2918 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2919 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2920 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2921 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2923 dnl ===================================================================
2924 dnl Check iOS SDK and compiler
2925 dnl ===================================================================
2927 if test $_os = iOS; then
2928     AC_MSG_CHECKING([what iOS SDK to use])
2929     current_sdk_ver=11.3
2930     if test "$enable_ios_simulator" = "yes"; then
2931         platform=iPhoneSimulator
2932         versionmin=-mios-simulator-version-min=$current_sdk_ver
2933     else
2934         platform=iPhoneOS
2935         versionmin=-miphoneos-version-min=$current_sdk_ver
2936     fi
2937     xcode_developer=`xcode-select -print-path`
2939     for sdkver in $current_sdk_ver; do
2940         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2941         if test -d $t; then
2942             ios_sdk=$sdkver
2943             sysroot=$t
2944             break
2945         fi
2946     done
2948     if test -z "$sysroot"; then
2949         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
2950     fi
2952     AC_MSG_RESULT($sysroot)
2954     IOS_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
2955     IOS_DEPLOYMENT_VERSION=$current_sdk_ver
2957     # LTO is not really recommended for iOS builds,
2958     # the link time will be astronomical
2959     if test "$ENABLE_LTO" = TRUE; then
2960         lto=-flto
2961     fi
2963     stdlib="-stdlib=libc++"
2965     CC="`xcrun -find clang` -arch $host_cpu -isysroot $sysroot $lto $versionmin"
2966     CXX="`xcrun -find clang++` -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
2968     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2969     AR=`xcrun -find ar`
2970     NM=`xcrun -find nm`
2971     STRIP=`xcrun -find strip`
2972     LIBTOOL=`xcrun -find libtool`
2973     RANLIB=`xcrun -find ranlib`
2976 AC_SUBST(IOS_SDK)
2977 AC_SUBST(IOS_DEPLOYMENT_VERSION)
2979 AC_MSG_CHECKING([whether to treat the installation as read-only])
2981 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
2982         "$enable_extensions" != yes; then
2983     enable_readonly_installset=yes
2985 if test "$enable_readonly_installset" = yes; then
2986     AC_MSG_RESULT([yes])
2987     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
2988 else
2989     AC_MSG_RESULT([no])
2992 dnl ===================================================================
2993 dnl Structure of install set
2994 dnl ===================================================================
2996 if test $_os = Darwin; then
2997     LIBO_BIN_FOLDER=MacOS
2998     LIBO_ETC_FOLDER=Resources
2999     LIBO_LIBEXEC_FOLDER=MacOS
3000     LIBO_LIB_FOLDER=Frameworks
3001     LIBO_LIB_PYUNO_FOLDER=Resources
3002     LIBO_SHARE_FOLDER=Resources
3003     LIBO_SHARE_HELP_FOLDER=Resources/help
3004     LIBO_SHARE_JAVA_FOLDER=Resources/java
3005     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3006     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3007     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3008     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3009     LIBO_URE_BIN_FOLDER=MacOS
3010     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3011     LIBO_URE_LIB_FOLDER=Frameworks
3012     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3013     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3014 elif test $_os = WINNT; then
3015     LIBO_BIN_FOLDER=program
3016     LIBO_ETC_FOLDER=program
3017     LIBO_LIBEXEC_FOLDER=program
3018     LIBO_LIB_FOLDER=program
3019     LIBO_LIB_PYUNO_FOLDER=program
3020     LIBO_SHARE_FOLDER=share
3021     LIBO_SHARE_HELP_FOLDER=help
3022     LIBO_SHARE_JAVA_FOLDER=program/classes
3023     LIBO_SHARE_PRESETS_FOLDER=presets
3024     LIBO_SHARE_READMES_FOLDER=readmes
3025     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3026     LIBO_SHARE_SHELL_FOLDER=program/shell
3027     LIBO_URE_BIN_FOLDER=program
3028     LIBO_URE_ETC_FOLDER=program
3029     LIBO_URE_LIB_FOLDER=program
3030     LIBO_URE_MISC_FOLDER=program
3031     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3032 else
3033     LIBO_BIN_FOLDER=program
3034     LIBO_ETC_FOLDER=program
3035     LIBO_LIBEXEC_FOLDER=program
3036     LIBO_LIB_FOLDER=program
3037     LIBO_LIB_PYUNO_FOLDER=program
3038     LIBO_SHARE_FOLDER=share
3039     LIBO_SHARE_HELP_FOLDER=help
3040     LIBO_SHARE_JAVA_FOLDER=program/classes
3041     LIBO_SHARE_PRESETS_FOLDER=presets
3042     LIBO_SHARE_READMES_FOLDER=readmes
3043     if test "$enable_fuzzers" != yes; then
3044         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3045     else
3046         LIBO_SHARE_RESOURCE_FOLDER=resource
3047     fi
3048     LIBO_SHARE_SHELL_FOLDER=program/shell
3049     LIBO_URE_BIN_FOLDER=program
3050     LIBO_URE_ETC_FOLDER=program
3051     LIBO_URE_LIB_FOLDER=program
3052     LIBO_URE_MISC_FOLDER=program
3053     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3055 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3056 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3057 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3058 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3059 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3060 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3061 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3062 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3063 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3064 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3065 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3066 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3067 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3068 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3069 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3070 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3072 # Not all of them needed in config_host.mk, add more if need arises
3073 AC_SUBST(LIBO_BIN_FOLDER)
3074 AC_SUBST(LIBO_ETC_FOLDER)
3075 AC_SUBST(LIBO_LIB_FOLDER)
3076 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3077 AC_SUBST(LIBO_SHARE_FOLDER)
3078 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3079 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3080 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3081 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3082 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3083 AC_SUBST(LIBO_URE_BIN_FOLDER)
3084 AC_SUBST(LIBO_URE_ETC_FOLDER)
3085 AC_SUBST(LIBO_URE_LIB_FOLDER)
3086 AC_SUBST(LIBO_URE_MISC_FOLDER)
3087 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3089 dnl ===================================================================
3090 dnl Windows specific tests and stuff
3091 dnl ===================================================================
3093 reg_get_value()
3095     # Return value: $regvalue
3096     unset regvalue
3098     local _regentry="/proc/registry${1}/${2}"
3099     if test -f "$_regentry"; then
3100         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3101         # Registry keys read via /proc/registry* are always \0 terminated!
3102         local _regvalue=$(tr -d '\0' < "$_regentry")
3103         if test $? -eq 0; then
3104             regvalue=$_regvalue
3105         fi
3106     fi
3109 # Get a value from the 32-bit side of the Registry
3110 reg_get_value_32()
3112     reg_get_value "32" "$1"
3115 # Get a value from the 64-bit side of the Registry
3116 reg_get_value_64()
3118     reg_get_value "64" "$1"
3121 if test "$_os" = "WINNT"; then
3122     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3123     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3124         AC_MSG_RESULT([no])
3125         WINDOWS_SDK_ARCH="x86"
3126     else
3127         AC_MSG_RESULT([yes])
3128         WINDOWS_SDK_ARCH="x64"
3129         BITNESS_OVERRIDE=64
3130     fi
3132 if test "$_os" = "iOS"; then
3133     cross_compiling="yes"
3136 if test "$cross_compiling" = "yes"; then
3137     export CROSS_COMPILING=TRUE
3138 else
3139     CROSS_COMPILING=
3140     BUILD_TYPE="$BUILD_TYPE NATIVE"
3142 AC_SUBST(CROSS_COMPILING)
3144 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3145 if test "$GCC" = "yes"; then
3146     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
3147     bsymbolic_functions_ldflags_save=$LDFLAGS
3148     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3149     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3150 #include <stdio.h>
3151         ],[
3152 printf ("hello world\n");
3153         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3154     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3155         AC_MSG_RESULT( found )
3156     else
3157         AC_MSG_RESULT( not found )
3158     fi
3159     LDFLAGS=$bsymbolic_functions_ldflags_save
3161 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3163 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3164 # NOTE: must _not_ be used for bundled external libraries!
3165 ISYSTEM=
3166 if test "$GCC" = "yes"; then
3167     AC_MSG_CHECKING( for -isystem )
3168     save_CFLAGS=$CFLAGS
3169     CFLAGS="$CFLAGS -Werror"
3170     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3171     CFLAGS=$save_CFLAGS
3172     if test -n "$ISYSTEM"; then
3173         AC_MSG_RESULT(yes)
3174     else
3175         AC_MSG_RESULT(no)
3176     fi
3178 if test -z "$ISYSTEM"; then
3179     # fall back to using -I
3180     ISYSTEM=-I
3182 AC_SUBST(ISYSTEM)
3184 dnl ===================================================================
3185 dnl  Check which Visual Studio compiler is used
3186 dnl ===================================================================
3188 map_vs_year_to_version()
3190     # Return value: $vsversion
3192     unset vsversion
3194     case $1 in
3195     2015)
3196         vsversion=14.0;;
3197     2017)
3198         vsversion=15.0;;
3199     *)
3200         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3201     esac
3204 vs_versions_to_check()
3206     # Args: $1 (optional) : versions to check, in the order of preference
3207     # Return value: $vsversions
3209     unset vsversions
3211     if test -n "$1"; then
3212         map_vs_year_to_version "$1"
3213         vsversions=$vsversion
3214     else
3215         # By default we prefer 2015/2017, in this order
3216         vsversions="14.0 15.0"
3217     fi
3220 win_get_env_from_vsvars32bat()
3222     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3223     if test $vcnum = "150"; then
3224       # Also seems to be located in another directory under the same name: vsvars32.bat
3225       # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3226       printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3227     else
3228       printf '@call "%s/../Common7/Tools/vsvars32.bat"\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3229     fi
3230     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3231     chmod +x $WRAPPERBATCHFILEPATH
3232     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3233     rm -f $WRAPPERBATCHFILEPATH
3234     printf '%s' "$_win_get_env_from_vsvars32bat"
3237 find_ucrt()
3239     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3240     if test -n "$regvalue"; then
3241         PathFormat "$regvalue"
3242         UCRTSDKDIR=$formatted_path
3243         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3244         UCRTVERSION=$regvalue
3245         # Rest if not exist
3246         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3247           UCRTSDKDIR=
3248         fi
3249     fi
3250     if test -z "$UCRTSDKDIR"; then
3251         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3252         if test "$vcnum" = "150"; then
3253           ide_env_file="${ide_env_dir}VsDevCmd.bat"
3254         else
3255           ide_env_file="${ide_env_dir}/vsvars32.bat"
3256         fi
3257         if test -f "$ide_env_file"; then
3258             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3259             UCRTSDKDIR=$formatted_path
3260             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3261             dnl Hack needed at least by tml:
3262             if test "$UCRTVERSION" = 10.0.15063.0 \
3263                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3264                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3265             then
3266                 UCRTVERSION=10.0.14393.0
3267             fi
3268         else
3269           AC_MSG_ERROR([No UCRT found])
3270         fi
3271     fi
3274 find_msvc()
3276     # Find Visual C++ 2015/2017
3277     # Args: $1 (optional) : The VS version year
3278     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3280     unset vctest vcnum vcnumwithdot vcbuildnumber
3282     vs_versions_to_check "$1"
3284     for ver in $vsversions; do
3285         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3286         if test -n "$regvalue"; then
3287             vctest=$regvalue
3288             break
3289         fi
3290         # As always MSVC 15.0 is special here
3291         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver
3292         if test -n "$regvalue"; then
3293             AC_MSG_RESULT([found: $regvalue])
3294             PathFormat "$regvalue"
3295             vctest=$formatted_path
3296             break
3297         fi
3298     done
3299     if test -n "$vctest"; then
3300         vcnumwithdot=$ver
3301         case "$vcnumwithdot" in
3302         14.0)
3303             vcyear=2015
3304             vcnum=140
3305             ;;
3306         15.0)
3307             vcyear=2017
3308             vcnum=150
3309             vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3310             ;;
3311         esac
3312     fi
3315 SOLARINC=
3316 MSBUILD_PATH=
3317 DEVENV=
3318 if test "$_os" = "WINNT"; then
3319     AC_MSG_CHECKING([Visual C++])
3321     find_msvc "$with_visual_studio"
3322     if test -z "$vctest"; then
3323         if test -n "$with_visual_studio"; then
3324             AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3325         else
3326             AC_MSG_ERROR([No Visual Studio 2015/2017 installation found])
3327         fi
3328     fi
3330     if test "$BITNESS_OVERRIDE" = ""; then
3331         if test -f "$vctest/bin/cl.exe"; then
3332             VC_PRODUCT_DIR=$vctest
3333         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3334             VC_PRODUCT_DIR=$vctest/VC
3335         else
3336             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3337         fi
3338     else
3339         if test -f "$vctest/bin/amd64/cl.exe"; then
3340             VC_PRODUCT_DIR=$vctest
3341         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3342             VC_PRODUCT_DIR=$vctest/VC
3343         else
3344             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe or $vctest/bin/amd64/cl.exe or $vctest/bin/x86_amd64/cl.exe])
3345         fi
3346     fi
3348     AC_MSG_CHECKING([for short pathname of VC product directory])
3349     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3350     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3352     UCRTSDKDIR=
3353     UCRTVERSION=
3355     AC_MSG_CHECKING([for UCRT location])
3356     find_ucrt
3357     # find_ucrt errors out if it doesn't find it
3358     AC_MSG_RESULT([found])
3359     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3360     ucrtincpath_formatted=$formatted_path
3361     # SOLARINC is used for external modules and must be set too.
3362     # And no, it's not sufficient to set SOLARINC only, as configure
3363     # itself doesn't honour it.
3364     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3365     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3366     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3367     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3369     AC_SUBST(UCRTSDKDIR)
3370     AC_SUBST(UCRTVERSION)
3372     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3373     # Find the proper version of MSBuild.exe to use based on the VS version
3374     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3375     if test -n "$regvalue" ; then
3376         AC_MSG_RESULT([found: $regvalue])
3377         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3378     else
3379         if test $vcnum = "150"; then
3380             if test "$BITNESS_OVERRIDE" = ""; then
3381                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3382             else
3383                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3384             fi
3385             MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3386         else
3387             AC_MSG_ERROR([No msbuild found, Visual Studio installation broken?])
3388         fi
3389         AC_MSG_RESULT([$regvalue])
3390     fi
3392     # Find the version of devenv.exe
3393     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3394     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3395     if test ! -e "$DEVENV"; then
3396         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3397     fi
3399     dnl ===========================================================
3400     dnl  Check for the corresponding mspdb*.dll
3401     dnl ===========================================================
3403     MSPDB_PATH=
3404     CL_DIR=
3405     CL_LIB=
3407     if test "$BITNESS_OVERRIDE" = ""; then
3408         if test "$vcnum" = "150"; then
3409             MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86"
3410             CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX86/x86
3411         else
3412             MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3413             CL_DIR=bin
3414         fi
3415     else
3416         if test "$vcnum" = "150"; then
3417             MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64"
3418             CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX64/x64
3419         else
3420             MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3421             CL_DIR=bin/amd64
3422         fi
3423     fi
3425     # MSVC 15.0 has libraries from 14.0?
3426     if test  "$vcnum" = "150"; then
3427         mspdbnum="140"
3428     else
3429         mspdbnum=$vcnum
3430     fi
3432     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3433         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3434     fi
3436     MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3437     MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3439     dnl The path needs to be added before cl is called
3440     PATH="$MSPDB_PATH:$PATH"
3442     AC_MSG_CHECKING([cl.exe])
3444     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3445     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3446     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3447     # is not enough?
3449     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3450     dnl needed when building CLR code:
3451     if test -z "$MSVC_CXX"; then
3452         if test "$BITNESS_OVERRIDE" = ""; then
3453             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3454                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3455             fi
3456         else
3457             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3458                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3459             fi
3460         fi
3462         # This gives us a posix path with 8.3 filename restrictions
3463         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3464     fi
3466     if test -z "$CC"; then
3467         CC=$MSVC_CXX
3468     fi
3469     if test "$BITNESS_OVERRIDE" = ""; then
3470         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3471         MSVC_CXX="$MSVC_CXX -arch:SSE"
3472     fi
3474     if test -n "$CC"; then
3475         # Remove /cl.exe from CC case insensitive
3476         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3477         if test "$BITNESS_OVERRIDE" = ""; then
3478            if test "$vcnum" = "150"; then
3479                COMPATH="$VC_PRODUCT_DIR"
3480            else
3481                COMPATH=`echo "$CC" | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3482            fi
3483         else
3484             if test -n "$VC_PRODUCT_DIR"; then
3485                 COMPATH=$VC_PRODUCT_DIR
3486             fi
3487         fi
3488         if test "$BITNESS_OVERRIDE" = ""; then
3489             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3490             CC="$CC -arch:SSE"
3491         fi
3493         if test "$vcnum" = "150"; then
3494             COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3495         fi
3497         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3499         PathFormat "$COMPATH"
3500         COMPATH="$formatted_path"
3502         VCVER=$vcnum
3503         MSVSVER=$vcyear
3505         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3506         # are always "better", we list them in reverse chronological order.
3508         case $vcnum in
3509         140)
3510             COMEX=19
3511             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3512             ;;
3513         150)
3514             COMEX=19
3515             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3516             ;;
3517         esac
3519         # The expectation is that --with-windows-sdk should not need to be used
3520         if test -n "$with_windows_sdk"; then
3521             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3522             *" "$with_windows_sdk" "*)
3523                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3524                 ;;
3525             *)
3526                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3527                 ;;
3528             esac
3529         fi
3531         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3532         ac_objext=obj
3533         ac_exeext=exe
3535     else
3536         AC_MSG_ERROR([Visual C++ not found after all, huh])
3537     fi
3539     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3540     # version of the Explorer extension (and maybe other small
3541     # bits, too) needed when installing a 32-bit LibreOffice on a
3542     # 64-bit OS. The 64-bit Explorer extension is a feature that
3543     # has been present since long in OOo. Don't confuse it with
3544     # building LibreOffice itself as 64-bit code.
3546     BUILD_X64=
3547     CXX_X64_BINARY=
3548     LINK_X64_BINARY=
3550     if test "$BITNESS_OVERRIDE" = ""; then
3551         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3552         if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3553             # Prefer native x64 compiler to cross-compiler, in case we are running
3554             # the build on a 64-bit OS.
3555             if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3556                 BUILD_X64=TRUE
3557                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3558                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3559             elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3560                 BUILD_X64=TRUE
3561                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3562                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3563             fi
3564         elif test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib"; then
3565             # nobody uses 32-bit OS to build, just pick the 64-bit compiler
3566             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3567                 BUILD_X64=TRUE
3568                 CXX_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"
3569                 LINK_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/link.exe"
3570             fi
3571         fi
3572         if test "$BUILD_X64" = TRUE; then
3573             AC_MSG_RESULT([found])
3574         else
3575             AC_MSG_RESULT([not found])
3576             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3577         fi
3578     fi
3579     AC_SUBST(BUILD_X64)
3581     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3582     AC_SUBST(CXX_X64_BINARY)
3583     AC_SUBST(LINK_X64_BINARY)
3585 AC_SUBST(VCVER)
3586 AC_SUBST(DEVENV)
3587 PathFormat "$MSPDB_PATH"
3588 MSPDB_PATH="$formatted_path"
3589 AC_SUBST(MSVC_CXX)
3592 # unowinreg.dll
3594 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3595 AC_SUBST(UNOWINREG_DLL)
3597 COM_IS_CLANG=
3598 AC_MSG_CHECKING([whether the compiler is actually Clang])
3599 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3600     #ifndef __clang__
3601     you lose
3602     #endif
3603     int foo=42;
3604     ]])],
3605     [AC_MSG_RESULT([yes])
3606      COM_IS_CLANG=TRUE],
3607     [AC_MSG_RESULT([no])])
3609 CC_PLAIN=$CC
3610 if test "$COM_IS_CLANG" = TRUE; then
3611     AC_MSG_CHECKING([the Clang version])
3612     if test "$_os" = WINNT; then
3613         dnl In which case, assume clang-cl:
3614         my_args="/EP /TC"
3615         dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3616         dnl clang-cl:
3617         CC_PLAIN=
3618         for i in $CC; do
3619             case $i in
3620             -FIIntrin.h)
3621                 ;;
3622             *)
3623                 CC_PLAIN="$CC_PLAIN $i"
3624                 ;;
3625             esac
3626         done
3627     else
3628         my_args="-E -P"
3629     fi
3630     clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args -`
3631     CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3632     CLANGVER=`echo $clang_version \
3633         | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3634     AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3635     AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3636     AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3638 AC_SUBST(COM_IS_CLANG)
3639 AC_SUBST(CLANGVER)
3641 SHOWINCLUDES_PREFIX=
3642 if test "$_os" = WINNT; then
3643     dnl We need to guess the prefix of the -showIncludes output, it can be
3644     dnl localized
3645     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3646     echo "#include <stdlib.h>" > conftest.c
3647     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3648         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3649     rm -f conftest.c conftest.obj
3650     if test -z "$SHOWINCLUDES_PREFIX"; then
3651         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3652     else
3653         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3654     fi
3656 AC_SUBST(SHOWINCLUDES_PREFIX)
3659 # prefix C with ccache if needed
3661 if test "$CCACHE" != ""; then
3662     AC_MSG_CHECKING([whether $CC is already ccached])
3664     AC_LANG_PUSH([C])
3665     save_CFLAGS=$CFLAGS
3666     CFLAGS="$CFLAGS --ccache-skip -O2"
3667     dnl an empty program will do, we're checking the compiler flags
3668     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3669                       [use_ccache=yes], [use_ccache=no])
3670     if test $use_ccache = yes; then
3671         AC_MSG_RESULT([yes])
3672     else
3673         CC="$CCACHE $CC"
3674         AC_MSG_RESULT([no])
3675     fi
3676     CFLAGS=$save_CFLAGS
3677     AC_LANG_POP([C])
3680 # ===================================================================
3681 # check various GCC options that Clang does not support now but maybe
3682 # will somewhen in the future, check them even for GCC, so that the
3683 # flags are set
3684 # ===================================================================
3686 HAVE_GCC_GGDB2=
3687 HAVE_GCC_FINLINE_LIMIT=
3688 HAVE_GCC_FNO_INLINE=
3689 if test "$GCC" = "yes"; then
3690     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3691     save_CFLAGS=$CFLAGS
3692     CFLAGS="$CFLAGS -Werror -ggdb2"
3693     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3694     CFLAGS=$save_CFLAGS
3695     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3696         AC_MSG_RESULT([yes])
3697     else
3698         AC_MSG_RESULT([no])
3699     fi
3701     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3702     save_CFLAGS=$CFLAGS
3703     CFLAGS="$CFLAGS -Werror -finline-limit=0"
3704     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3705     CFLAGS=$save_CFLAGS
3706     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3707         AC_MSG_RESULT([yes])
3708     else
3709         AC_MSG_RESULT([no])
3710     fi
3712     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3713     save_CFLAGS=$CFLAGS
3714     CFLAGS="$CFLAGS -Werror -fno-inline"
3715     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3716     CFLAGS=$save_CFLAGS
3717     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3718         AC_MSG_RESULT([yes])
3719     else
3720         AC_MSG_RESULT([no])
3721     fi
3723     if test "$host_cpu" = "m68k"; then
3724         AC_MSG_CHECKING([whether $CC supports -mlong-jump-table-offsets])
3725         save_CFLAGS=$CFLAGS
3726         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3727         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3728         CFLAGS=$save_CFLAGS
3729         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3730             AC_MSG_RESULT([yes])
3731         else
3732             AC_MSG_ERROR([no])
3733         fi
3734     fi
3736 AC_SUBST(HAVE_GCC_GGDB2)
3737 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3738 AC_SUBST(HAVE_GCC_FNO_INLINE)
3740 dnl ===================================================================
3741 dnl  Test the gcc version
3742 dnl ===================================================================
3743 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3744     AC_MSG_CHECKING([the GCC version])
3745     _gcc_version=`$CC -dumpversion`
3746     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3747         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3748     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3750     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3752     if test "$gcc_full_version" -lt 40801; then
3753         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.8.1])
3754     fi
3755 else
3756     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3757     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3758     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3759     # (which reports itself as GCC 4.2.1).
3760     GCC_VERSION=
3762 AC_SUBST(GCC_VERSION)
3764 dnl Set the ENABLE_DBGUTIL variable
3765 dnl ===================================================================
3766 AC_MSG_CHECKING([whether to build with additional debug utilities])
3767 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3768     ENABLE_DBGUTIL="TRUE"
3769     # this is an extra var so it can have different default on different MSVC
3770     # versions (in case there are version specific problems with it)
3771     MSVC_USE_DEBUG_RUNTIME="TRUE"
3773     AC_MSG_RESULT([yes])
3774     # cppunit and graphite expose STL in public headers
3775     if test "$with_system_cppunit" = "yes"; then
3776         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3777     else
3778         with_system_cppunit=no
3779     fi
3780     if test "$with_system_graphite" = "yes"; then
3781         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3782     else
3783         with_system_graphite=no
3784     fi
3785     if test "$with_system_mysql_cppconn" = "yes"; then
3786         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3787     else
3788         with_system_mysql_cppconn=no
3789     fi
3790     if test "$with_system_orcus" = "yes"; then
3791         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3792     else
3793         with_system_orcus=no
3794     fi
3795     if test "$with_system_libcmis" = "yes"; then
3796         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3797     else
3798         with_system_libcmis=no
3799     fi
3800     if test "$with_system_hunspell" = "yes"; then
3801         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3802     else
3803         with_system_hunspell=no
3804     fi
3805     if test "$with_system_gpgmepp" = "yes"; then
3806         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3807     else
3808         with_system_gpgmepp=no
3809     fi
3810     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3811     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3812     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3813     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3814     # of those two is using the system variant:
3815     if test "$with_system_libnumbertext" = "yes"; then
3816         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3817     else
3818         with_system_libnumbertext=no
3819     fi
3820     if test "$with_system_libwps" = "yes"; then
3821         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3822     else
3823         with_system_libwps=no
3824     fi
3825 else
3826     ENABLE_DBGUTIL=""
3827     MSVC_USE_DEBUG_RUNTIME=""
3828     AC_MSG_RESULT([no])
3830 AC_SUBST(ENABLE_DBGUTIL)
3831 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3833 dnl Set the ENABLE_DEBUG variable.
3834 dnl ===================================================================
3835 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3836     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3838 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3839     if test -z "$libo_fuzzed_enable_debug"; then
3840         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3841     else
3842         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3843         enable_debug=yes
3844     fi
3847 AC_MSG_CHECKING([whether to do a debug build])
3848 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3849     ENABLE_DEBUG="TRUE"
3850     if test -n "$ENABLE_DBGUTIL" ; then
3851         AC_MSG_RESULT([yes (dbgutil)])
3852     else
3853         AC_MSG_RESULT([yes])
3854     fi
3855 else
3856     ENABLE_DEBUG=""
3857     AC_MSG_RESULT([no])
3859 AC_SUBST(ENABLE_DEBUG)
3861 if test "$enable_sal_log" = yes; then
3862     ENABLE_SAL_LOG=TRUE
3864 AC_SUBST(ENABLE_SAL_LOG)
3866 dnl Selective debuginfo
3867 ENABLE_DEBUGINFO_FOR=
3868 if test -n "$ENABLE_DEBUG"; then
3869     AC_MSG_CHECKING([whether to use selective debuginfo])
3870     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3871         if test "$enable_selective_debuginfo" = "yes"; then
3872             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3873         fi
3874         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3875         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3876     else
3877         ENABLE_DEBUGINFO_FOR=all
3878         AC_MSG_RESULT([no, for all])
3879     fi
3880 else
3881     if test -n "$enable_selective_debuginfo"; then
3882         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
3883     fi
3885 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3887 dnl Check for enable symbols option
3888 dnl ===================================================================
3889 AC_MSG_CHECKING([whether to generate debug information])
3890 if test -z "$enable_symbols"; then
3891     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3892         enable_symbols=yes
3893     else
3894         enable_symbols=no
3895     fi
3897 if test "$enable_symbols" != no; then
3898     ENABLE_SYMBOLS=TRUE
3899     AC_MSG_RESULT([yes])
3900 else
3901     ENABLE_SYMBOLS=
3902     AC_MSG_RESULT([no])
3904 AC_SUBST(ENABLE_SYMBOLS)
3906 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
3907     # Building on Android with full symbols: without enough memory the linker never finishes currently.
3908     AC_MSG_CHECKING([whether enough memory is available for linking])
3909     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
3910     # Check for 15GB, as Linux reports a bit less than the physical memory size.
3911     if test -n "$mem_size" -a $mem_size -lt 15728640; then
3912         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
3913     else
3914         AC_MSG_RESULT([yes])
3915     fi
3918 AC_MSG_CHECKING([whether to compile with optimization flags])
3919 if test -z "$enable_optimized"; then
3920     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3921         enable_optimized=no
3922     else
3923         enable_optimized=yes
3924     fi
3926 if test "$enable_optimized" != no; then
3927     ENABLE_OPTIMIZED=TRUE
3928     AC_MSG_RESULT([yes])
3929 else
3930     ENABLE_OPTIMIZED=
3931     AC_MSG_RESULT([no])
3933 AC_SUBST(ENABLE_OPTIMIZED)
3936 # determine CPUNAME, OS, ...
3937 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
3939 case "$host_os" in
3941 aix*)
3942     COM=GCC
3943     CPUNAME=POWERPC
3944     USING_X11=TRUE
3945     OS=AIX
3946     RTL_OS=AIX
3947     RTL_ARCH=PowerPC
3948     PLATFORMID=aix_powerpc
3949     P_SEP=:
3950     ;;
3952 cygwin*)
3953     COM=MSC
3954     USING_X11=
3955     OS=WNT
3956     RTL_OS=Windows
3957     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3958         P_SEP=";"
3959     else
3960         P_SEP=:
3961     fi
3962     case "$host_cpu" in
3963     i*86|x86_64)
3964         if test "$BITNESS_OVERRIDE" = 64; then
3965             CPUNAME=X86_64
3966             RTL_ARCH=X86_64
3967             PLATFORMID=windows_x86_64
3968             WINDOWS_X64=1
3969             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
3970         else
3971             CPUNAME=INTEL
3972             RTL_ARCH=x86
3973             PLATFORMID=windows_x86
3974         fi
3975         ;;
3976     *)
3977         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3978         ;;
3979     esac
3980     SCPDEFS="$SCPDEFS -D_MSC_VER"
3981     ;;
3983 darwin*)
3984     COM=GCC
3985     USING_X11=
3986     OS=MACOSX
3987     RTL_OS=MacOSX
3988     P_SEP=:
3990     case "$host_cpu" in
3991     arm)
3992         AC_MSG_ERROR([Can't build 32-bit code for iOS])
3993         ;;
3994     arm64)
3995         OS=IOS
3996         if test "$enable_ios_simulator" = "yes"; then
3997             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
3998         else
3999             CPUNAME=ARM64
4000             RTL_ARCH=ARM_EABI
4001             PLATFORMID=ios_arm64
4002         fi
4003         ;;
4004     i*86)
4005         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4006         ;;
4007     x86_64)
4008         if test "$enable_ios_simulator" = "yes"; then
4009             OS=IOS
4010         fi
4011         CPUNAME=X86_64
4012         RTL_ARCH=X86_64
4013         PLATFORMID=macosx_x86_64
4014         ;;
4015     *)
4016         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4017         ;;
4018     esac
4019     ;;
4021 dragonfly*)
4022     COM=GCC
4023     USING_X11=TRUE
4024     OS=DRAGONFLY
4025     RTL_OS=DragonFly
4026     P_SEP=:
4028     case "$host_cpu" in
4029     i*86)
4030         CPUNAME=INTEL
4031         RTL_ARCH=x86
4032         PLATFORMID=dragonfly_x86
4033         ;;
4034     x86_64)
4035         CPUNAME=X86_64
4036         RTL_ARCH=X86_64
4037         PLATFORMID=dragonfly_x86_64
4038         ;;
4039     *)
4040         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4041         ;;
4042     esac
4043     ;;
4045 freebsd*)
4046     COM=GCC
4047     USING_X11=TRUE
4048     RTL_OS=FreeBSD
4049     OS=FREEBSD
4050     P_SEP=:
4052     case "$host_cpu" in
4053     i*86)
4054         CPUNAME=INTEL
4055         RTL_ARCH=x86
4056         PLATFORMID=freebsd_x86
4057         ;;
4058     x86_64|amd64)
4059         CPUNAME=X86_64
4060         RTL_ARCH=X86_64
4061         PLATFORMID=freebsd_x86_64
4062         ;;
4063     *)
4064         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4065         ;;
4066     esac
4067     ;;
4069 haiku*)
4070     COM=GCC
4071     USING_X11=
4072     GUIBASE=haiku
4073     RTL_OS=Haiku
4074     OS=HAIKU
4075     P_SEP=:
4077     case "$host_cpu" in
4078     i*86)
4079         CPUNAME=INTEL
4080         RTL_ARCH=x86
4081         PLATFORMID=haiku_x86
4082         ;;
4083     x86_64|amd64)
4084         CPUNAME=X86_64
4085         RTL_ARCH=X86_64
4086         PLATFORMID=haiku_x86_64
4087         ;;
4088     *)
4089         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4090         ;;
4091     esac
4092     ;;
4094 kfreebsd*)
4095     COM=GCC
4096     USING_X11=TRUE
4097     OS=LINUX
4098     RTL_OS=kFreeBSD
4099     P_SEP=:
4101     case "$host_cpu" in
4103     i*86)
4104         CPUNAME=INTEL
4105         RTL_ARCH=x86
4106         PLATFORMID=kfreebsd_x86
4107         ;;
4108     x86_64)
4109         CPUNAME=X86_64
4110         RTL_ARCH=X86_64
4111         PLATFORMID=kfreebsd_x86_64
4112         ;;
4113     *)
4114         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4115         ;;
4116     esac
4117     ;;
4119 linux-gnu*)
4120     COM=GCC
4121     USING_X11=TRUE
4122     OS=LINUX
4123     RTL_OS=Linux
4124     P_SEP=:
4126     case "$host_cpu" in
4128     aarch64)
4129         CPUNAME=AARCH64
4130         PLATFORMID=linux_aarch64
4131         RTL_ARCH=AARCH64
4132         ;;
4133     alpha)
4134         CPUNAME=AXP
4135         RTL_ARCH=ALPHA
4136         PLATFORMID=linux_alpha
4137         ;;
4138     arm*)
4139         CPUNAME=ARM
4140         EPM_FLAGS="-a arm"
4141         RTL_ARCH=ARM_EABI
4142         PLATFORMID=linux_arm_eabi
4143         case "$host_cpu" in
4144         arm*-linux)
4145             RTL_ARCH=ARM_OABI
4146             PLATFORMID=linux_arm_oabi
4147             ;;
4148         esac
4149         ;;
4150     hppa)
4151         CPUNAME=HPPA
4152         RTL_ARCH=HPPA
4153         EPM_FLAGS="-a hppa"
4154         PLATFORMID=linux_hppa
4155         ;;
4156     i*86)
4157         CPUNAME=INTEL
4158         RTL_ARCH=x86
4159         PLATFORMID=linux_x86
4160         ;;
4161     ia64)
4162         CPUNAME=IA64
4163         RTL_ARCH=IA64
4164         PLATFORMID=linux_ia64
4165         ;;
4166     mips)
4167         CPUNAME=GODSON
4168         RTL_ARCH=MIPS_EB
4169         EPM_FLAGS="-a mips"
4170         PLATFORMID=linux_mips_eb
4171         ;;
4172     mips64)
4173         CPUNAME=GODSON64
4174         RTL_ARCH=MIPS64_EB
4175         EPM_FLAGS="-a mips64"
4176         PLATFORMID=linux_mips64_eb
4177         ;;
4178     mips64el)
4179         CPUNAME=GODSON64
4180         RTL_ARCH=MIPS64_EL
4181         EPM_FLAGS="-a mips64el"
4182         PLATFORMID=linux_mips64_el
4183         ;;
4184     mipsel)
4185         CPUNAME=GODSON
4186         RTL_ARCH=MIPS_EL
4187         EPM_FLAGS="-a mipsel"
4188         PLATFORMID=linux_mips_el
4189         ;;
4190     m68k)
4191         CPUNAME=M68K
4192         RTL_ARCH=M68K
4193         PLATFORMID=linux_m68k
4194         ;;
4195     powerpc)
4196         CPUNAME=POWERPC
4197         RTL_ARCH=PowerPC
4198         PLATFORMID=linux_powerpc
4199         ;;
4200     powerpc64)
4201         CPUNAME=POWERPC64
4202         RTL_ARCH=PowerPC_64
4203         PLATFORMID=linux_powerpc64
4204         ;;
4205     powerpc64le)
4206         CPUNAME=POWERPC64
4207         RTL_ARCH=PowerPC_64_LE
4208         PLATFORMID=linux_powerpc64_le
4209         ;;
4210     sparc)
4211         CPUNAME=SPARC
4212         RTL_ARCH=SPARC
4213         PLATFORMID=linux_sparc
4214         ;;
4215     sparc64)
4216         CPUNAME=SPARC64
4217         RTL_ARCH=SPARC64
4218         PLATFORMID=linux_sparc64
4219         ;;
4220     s390)
4221         CPUNAME=S390
4222         RTL_ARCH=S390
4223         PLATFORMID=linux_s390
4224         ;;
4225     s390x)
4226         CPUNAME=S390X
4227         RTL_ARCH=S390x
4228         PLATFORMID=linux_s390x
4229         ;;
4230     x86_64)
4231         CPUNAME=X86_64
4232         RTL_ARCH=X86_64
4233         PLATFORMID=linux_x86_64
4234         ;;
4235     *)
4236         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4237         ;;
4238     esac
4239     ;;
4241 linux-android*)
4242     COM=GCC
4243     USING_X11=
4244     OS=ANDROID
4245     RTL_OS=Android
4246     P_SEP=:
4248     case "$host_cpu" in
4250     arm|armel)
4251         CPUNAME=ARM
4252         RTL_ARCH=ARM_EABI
4253         PLATFORMID=android_arm_eabi
4254         ;;
4255     aarch64)
4256         CPUNAME=AARCH64
4257         RTL_ARCH=AARCH64
4258         PLATFORMID=android_aarch64
4259         ;;
4260     mips|mipsel)
4261         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4262         RTL_ARCH=MIPS_EL
4263         PLATFORMID=android_mips_el
4264         ;;
4265     i*86)
4266         CPUNAME=INTEL
4267         RTL_ARCH=x86
4268         PLATFORMID=android_x86
4269         ;;
4270     *)
4271         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4272         ;;
4273     esac
4274     ;;
4276 *netbsd*)
4277     COM=GCC
4278     USING_X11=TRUE
4279     OS=NETBSD
4280     RTL_OS=NetBSD
4281     P_SEP=:
4283     case "$host_cpu" in
4284     i*86)
4285         CPUNAME=INTEL
4286         RTL_ARCH=x86
4287         PLATFORMID=netbsd_x86
4288         ;;
4289     powerpc)
4290         CPUNAME=POWERPC
4291         RTL_ARCH=PowerPC
4292         PLATFORMID=netbsd_powerpc
4293         ;;
4294     sparc)
4295         CPUNAME=SPARC
4296         RTL_ARCH=SPARC
4297         PLATFORMID=netbsd_sparc
4298         ;;
4299     x86_64)
4300         CPUNAME=X86_64
4301         RTL_ARCH=X86_64
4302         PLATFORMID=netbsd_x86_64
4303         ;;
4304     *)
4305         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4306         ;;
4307     esac
4308     ;;
4310 openbsd*)
4311     COM=GCC
4312     USING_X11=TRUE
4313     OS=OPENBSD
4314     RTL_OS=OpenBSD
4315     P_SEP=:
4317     case "$host_cpu" in
4318     i*86)
4319         CPUNAME=INTEL
4320         RTL_ARCH=x86
4321         PLATFORMID=openbsd_x86
4322         ;;
4323     x86_64)
4324         CPUNAME=X86_64
4325         RTL_ARCH=X86_64
4326         PLATFORMID=openbsd_x86_64
4327         ;;
4328     *)
4329         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4330         ;;
4331     esac
4332     SOLARINC="$SOLARINC -I/usr/local/include"
4333     ;;
4335 solaris*)
4336     COM=GCC
4337     USING_X11=TRUE
4338     OS=SOLARIS
4339     RTL_OS=Solaris
4340     P_SEP=:
4342     case "$host_cpu" in
4343     i*86)
4344         CPUNAME=INTEL
4345         RTL_ARCH=x86
4346         PLATFORMID=solaris_x86
4347         ;;
4348     sparc)
4349         CPUNAME=SPARC
4350         RTL_ARCH=SPARC
4351         PLATFORMID=solaris_sparc
4352         ;;
4353     sparc64)
4354         CPUNAME=SPARC64
4355         RTL_ARCH=SPARC64
4356         PLATFORMID=solaris_sparc64
4357         ;;
4358     *)
4359         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4360         ;;
4361     esac
4362     SOLARINC="$SOLARINC -I/usr/local/include"
4363     ;;
4366     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4367     ;;
4368 esac
4370 if test "$with_x" = "no"; then
4371     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4374 ENABLE_HEADLESS=""
4375 if test "$enable_gui" = "no"; then
4376     if test "$USING_X11" != TRUE; then
4377         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4378     fi
4379     USING_X11=
4380     ENABLE_HEADLESS=TRUE
4381     AC_DEFINE(HAVE_FEATURE_UI,0)
4382     test_cairo=yes
4384 AC_SUBST(ENABLE_HEADLESS)
4386 WORKDIR="${BUILDDIR}/workdir"
4387 INSTDIR="${BUILDDIR}/instdir"
4388 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4389 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4390 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4391 AC_SUBST(COM)
4392 AC_SUBST(CPUNAME)
4393 AC_SUBST(RTL_OS)
4394 AC_SUBST(RTL_ARCH)
4395 AC_SUBST(EPM_FLAGS)
4396 AC_SUBST(USING_X11)
4397 AC_SUBST([INSTDIR])
4398 AC_SUBST([INSTROOT])
4399 AC_SUBST([INSTROOTBASE])
4400 AC_SUBST(OS)
4401 AC_SUBST(P_SEP)
4402 AC_SUBST(WORKDIR)
4403 AC_SUBST(PLATFORMID)
4404 AC_SUBST(WINDOWS_X64)
4405 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4407 dnl ===================================================================
4408 dnl Test which package format to use
4409 dnl ===================================================================
4410 AC_MSG_CHECKING([which package format to use])
4411 if test -n "$with_package_format" -a "$with_package_format" != no; then
4412     for i in $with_package_format; do
4413         case "$i" in
4414         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4415             ;;
4416         *)
4417             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4418 aix - AIX software distribution
4419 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4420 deb - Debian software distribution
4421 pkg - Solaris software distribution
4422 rpm - RedHat software distribution
4424 LibreOffice additionally supports:
4425 archive - .tar.gz or .zip
4426 dmg - Mac OS X .dmg
4427 installed - installation tree
4428 msi - Windows .msi
4429         ])
4430             ;;
4431         esac
4432     done
4433     # fakeroot is needed to ensure correct file ownerships/permissions
4434     # inside deb packages and tar archives created on Linux and Solaris.
4435     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4436         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4437         if test "$FAKEROOT" = "no"; then
4438             AC_MSG_ERROR(
4439                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4440         fi
4441     fi
4442     PKGFORMAT="$with_package_format"
4443     AC_MSG_RESULT([$PKGFORMAT])
4444 else
4445     PKGFORMAT=
4446     AC_MSG_RESULT([none])
4448 AC_SUBST(PKGFORMAT)
4450 dnl ===================================================================
4451 dnl Set up a different compiler to produce tools to run on the build
4452 dnl machine when doing cross-compilation
4453 dnl ===================================================================
4455 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4456 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4457 if test "$cross_compiling" = "yes"; then
4458     AC_MSG_CHECKING([for BUILD platform configuration])
4459     echo
4460     rm -rf CONF-FOR-BUILD config_build.mk
4461     mkdir CONF-FOR-BUILD
4462     # Here must be listed all files needed when running the configure script. In particular, also
4463     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4464     # keep them in the same order as there.
4465     (cd $SRC_ROOT && tar cf - \
4466         config.guess \
4467         bin/get_config_variables \
4468         solenv/bin/getcompver.awk \
4469         solenv/inc/langlist.mk \
4470         download.lst \
4471         config_host.mk.in \
4472         config_host_lang.mk.in \
4473         Makefile.in \
4474         lo.xcent.in \
4475         bin/bffvalidator.sh.in \
4476         bin/odfvalidator.sh.in \
4477         bin/officeotron.sh.in \
4478         instsetoo_native/util/openoffice.lst.in \
4479         config_host/*.in \
4480         sysui/desktop/macosx/Info.plist.in) \
4481     | (cd CONF-FOR-BUILD && tar xf -)
4482     cp configure CONF-FOR-BUILD
4483     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4484     (
4485     unset COM USING_X11 OS CPUNAME
4486     unset CC CXX SYSBASE CFLAGS
4487     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4488     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4489     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4490     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4491     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4492     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4493     cd CONF-FOR-BUILD
4494     sub_conf_opts=""
4495     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4496     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4497     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4498     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4499     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4500     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4501     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4502     # Don't bother having configure look for stuff not needed for the build platform anyway
4503     ./configure \
4504         --disable-cups \
4505         --disable-gtk3 \
4506         --disable-pdfimport \
4507         --disable-postgresql-sdbc \
4508         --with-parallelism="$with_parallelism" \
4509         --without-doxygen \
4510         --without-java \
4511         $sub_conf_opts \
4512         --srcdir=$srcdir \
4513         2>&1 | sed -e 's/^/    /'
4514     test -f ./config_host.mk 2>/dev/null || exit
4515     cp config_host.mk ../config_build.mk
4516     cp config_host_lang.mk ../config_build_lang.mk
4517     mv config.log ../config.Build.log
4518     mkdir -p ../config_build
4519     mv config_host/*.h ../config_build
4520     . ./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
4522     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
4523         VV='$'$V
4524         VV=`eval "echo $VV"`
4525         if test -n "$VV"; then
4526             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4527             echo "$line" >>build-config
4528         fi
4529     done
4531     for V in INSTDIR INSTROOT WORKDIR; do
4532         VV='$'$V
4533         VV=`eval "echo $VV"`
4534         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4535         if test -n "$VV"; then
4536             line="${V}_FOR_BUILD='$VV'"
4537             echo "$line" >>build-config
4538         fi
4539     done
4541     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4542     echo "$line" >>build-config
4544     )
4545     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4546     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])
4547     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4548              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4550     eval `cat CONF-FOR-BUILD/build-config`
4552     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4554     rm -rf CONF-FOR-BUILD
4555 else
4556     OS_FOR_BUILD="$OS"
4557     CC_FOR_BUILD="$CC"
4558     CXX_FOR_BUILD="$CXX"
4559     INSTDIR_FOR_BUILD="$INSTDIR"
4560     INSTROOT_FOR_BUILD="$INSTROOT"
4561     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4562     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4563     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4564     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4565     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4566     WORKDIR_FOR_BUILD="$WORKDIR"
4568 AC_SUBST(OS_FOR_BUILD)
4569 AC_SUBST(INSTDIR_FOR_BUILD)
4570 AC_SUBST(INSTROOT_FOR_BUILD)
4571 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4572 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4573 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4574 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4575 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4576 AC_SUBST(WORKDIR_FOR_BUILD)
4578 dnl ===================================================================
4579 dnl Check for syslog header
4580 dnl ===================================================================
4581 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4583 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4584 dnl ===================================================================
4585 AC_MSG_CHECKING([whether to turn warnings to errors])
4586 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4587     ENABLE_WERROR="TRUE"
4588     AC_MSG_RESULT([yes])
4589 else
4590     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4591         ENABLE_WERROR="TRUE"
4592         AC_MSG_RESULT([yes])
4593     else
4594         AC_MSG_RESULT([no])
4595     fi
4597 AC_SUBST(ENABLE_WERROR)
4599 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4600 dnl ===================================================================
4601 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4602 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4603     ASSERT_ALWAYS_ABORT="TRUE"
4604     AC_MSG_RESULT([yes])
4605 else
4606     ASSERT_ALWAYS_ABORT="FALSE"
4607     AC_MSG_RESULT([no])
4609 AC_SUBST(ASSERT_ALWAYS_ABORT)
4611 # Determine whether to use ooenv for the instdir installation
4612 # ===================================================================
4613 if test $_os != "WINNT" -a $_os != "Darwin"; then
4614     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4615     if test "$enable_ooenv" = "no"; then
4616         AC_MSG_RESULT([no])
4617     else
4618         ENABLE_OOENV="TRUE"
4619         AC_MSG_RESULT([yes])
4620     fi
4622 AC_SUBST(ENABLE_OOENV)
4624 if test "$USING_X11" != TRUE; then
4625     # be sure to do not mess with unneeded stuff
4626     test_randr=no
4627     test_xrender=no
4628     test_cups=no
4629     test_dbus=no
4630     test_gtk=no
4631     build_gstreamer_1_0=no
4632     build_gstreamer_0_10=no
4633     test_kde4=no
4634     test_kde5=no
4635     test_qt5=no
4636     test_gtk3_kde5=no
4637     enable_cairo_canvas=no
4640 if test "$OS" = "HAIKU"; then
4641     enable_cairo_canvas=yes
4642     test_qt5=yes
4645 dnl ===================================================================
4646 dnl check for cups support
4647 dnl ===================================================================
4648 ENABLE_CUPS=""
4650 if test "$enable_cups" = "no"; then
4651     test_cups=no
4654 AC_MSG_CHECKING([whether to enable CUPS support])
4655 if test "$test_cups" = "yes"; then
4656     ENABLE_CUPS="TRUE"
4657     AC_MSG_RESULT([yes])
4659     AC_MSG_CHECKING([whether cups support is present])
4660     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4661     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4662     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4663         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4664     fi
4666 else
4667     AC_MSG_RESULT([no])
4670 AC_SUBST(ENABLE_CUPS)
4672 # fontconfig checks
4673 if test "$test_fontconfig" = "yes"; then
4674     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4675     SYSTEM_FONTCONFIG=TRUE
4676     FilterLibs "${FONTCONFIG_LIBS}"
4677     FONTCONFIG_LIBS="${filteredlibs}"
4679 AC_SUBST(FONTCONFIG_CFLAGS)
4680 AC_SUBST(FONTCONFIG_LIBS)
4681 AC_SUBST([SYSTEM_FONTCONFIG])
4683 dnl whether to find & fetch external tarballs?
4684 dnl ===================================================================
4685 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4686    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4687        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4688    else
4689        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4690    fi
4692 if test -z "$TARFILE_LOCATION"; then
4693     if test -d "$SRC_ROOT/src" ; then
4694         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4695         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4696     fi
4697     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4698 else
4699     AbsolutePath "$TARFILE_LOCATION"
4700     PathFormat "${absolute_path}"
4701     TARFILE_LOCATION="${formatted_path}"
4703 AC_SUBST(TARFILE_LOCATION)
4705 AC_MSG_CHECKING([whether we want to fetch tarballs])
4706 if test "$enable_fetch_external" != "no"; then
4707     if test "$with_all_tarballs" = "yes"; then
4708         AC_MSG_RESULT([yes, all of them])
4709         DO_FETCH_TARBALLS="ALL"
4710     else
4711         AC_MSG_RESULT([yes, if we use them])
4712         DO_FETCH_TARBALLS="TRUE"
4713     fi
4714 else
4715     AC_MSG_RESULT([no])
4716     DO_FETCH_TARBALLS=
4718 AC_SUBST(DO_FETCH_TARBALLS)
4720 AC_MSG_CHECKING([whether to build help])
4721 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4722     BUILD_TYPE="$BUILD_TYPE HELP"
4723     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4724     case "$with_help" in
4725     "html")
4726         ENABLE_HTMLHELP=TRUE
4727         SCPDEFS="$SCPDEFS -DWITH_HELP"
4728         AC_MSG_RESULT([HTML])
4729         ;;
4730     "online")
4731         ENABLE_HTMLHELP=TRUE
4732         HELP_ONLINE=TRUE
4733         AC_MSG_RESULT([HTML])
4734         ;;
4735     yes)
4736         SCPDEFS="$SCPDEFS -DWITH_HELP"
4737         AC_MSG_RESULT([yes])
4738         ;;
4739     *)
4740         AC_MSG_ERROR([Unknown --with-help=$with_help])
4741         ;;
4742     esac
4743 else
4744     AC_MSG_RESULT([no])
4746 AC_SUBST([ENABLE_HTMLHELP])
4747 AC_SUBST([HELP_ONLINE])
4749 dnl Test whether to include MySpell dictionaries
4750 dnl ===================================================================
4751 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4752 if test "$with_myspell_dicts" = "yes"; then
4753     AC_MSG_RESULT([yes])
4754     WITH_MYSPELL_DICTS=TRUE
4755     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4756     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4757 else
4758     AC_MSG_RESULT([no])
4759     WITH_MYSPELL_DICTS=
4761 AC_SUBST(WITH_MYSPELL_DICTS)
4763 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4764 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4765     if test "$with_system_dicts" = yes; then
4766         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4767     fi
4768     with_system_dicts=no
4771 AC_MSG_CHECKING([whether to use dicts from external paths])
4772 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4773     AC_MSG_RESULT([yes])
4774     SYSTEM_DICTS=TRUE
4775     AC_MSG_CHECKING([for spelling dictionary directory])
4776     if test -n "$with_external_dict_dir"; then
4777         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4778     else
4779         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4780         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4781             DICT_SYSTEM_DIR=file:///usr/share/myspell
4782         fi
4783     fi
4784     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4785     AC_MSG_CHECKING([for hyphenation patterns directory])
4786     if test -n "$with_external_hyph_dir"; then
4787         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4788     else
4789         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4790     fi
4791     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4792     AC_MSG_CHECKING([for thesaurus directory])
4793     if test -n "$with_external_thes_dir"; then
4794         THES_SYSTEM_DIR=file://$with_external_thes_dir
4795     else
4796         THES_SYSTEM_DIR=file:///usr/share/mythes
4797     fi
4798     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4799 else
4800     AC_MSG_RESULT([no])
4801     SYSTEM_DICTS=
4803 AC_SUBST(SYSTEM_DICTS)
4804 AC_SUBST(DICT_SYSTEM_DIR)
4805 AC_SUBST(HYPH_SYSTEM_DIR)
4806 AC_SUBST(THES_SYSTEM_DIR)
4808 dnl ===================================================================
4809 dnl enable pch by default on windows
4810 dnl enable it explicitly otherwise
4811 ENABLE_PCH=""
4812 if test "$enable_pch" = yes -a "$enable_compiler_plugins" = yes; then
4813     if test -z "$libo_fuzzed_enable_pch"; then
4814         AC_MSG_ERROR([--enable-pch cannot be used with --enable-compiler-plugins])
4815     else
4816         AC_MSG_NOTICE([Resetting --enable-pch=no])
4817         enable_pch=no
4818     fi
4821 AC_MSG_CHECKING([whether to enable pch feature])
4822 if test "$enable_pch" != "no"; then
4823     if test "$_os" = "WINNT"; then
4824         ENABLE_PCH="TRUE"
4825         AC_MSG_RESULT([yes])
4826     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4827         ENABLE_PCH="TRUE"
4828         AC_MSG_RESULT([yes])
4829     elif test -n "$enable_pch"; then
4830         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4831     else
4832         AC_MSG_RESULT([no])
4833     fi
4834 else
4835     AC_MSG_RESULT([no])
4837 AC_SUBST(ENABLE_PCH)
4839 TAB=`printf '\t'`
4841 AC_MSG_CHECKING([the GNU Make version])
4842 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4843 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4844 if test "$_make_longver" -ge "038200"; then
4845     AC_MSG_RESULT([$GNUMAKE $_make_version])
4847 elif test "$_make_longver" -ge "038100"; then
4848     if test "$build_os" = "cygwin"; then
4849         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4850     fi
4851     AC_MSG_RESULT([$GNUMAKE $_make_version])
4853     dnl ===================================================================
4854     dnl Search all the common names for sha1sum
4855     dnl ===================================================================
4856     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4857     if test -z "$SHA1SUM"; then
4858         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
4859     elif test "$SHA1SUM" = "openssl"; then
4860         SHA1SUM="openssl sha1"
4861     fi
4862     AC_MSG_CHECKING([for GNU Make bug 20033])
4863     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4864     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4865 A := \$(wildcard *.a)
4867 .PHONY: all
4868 all: \$(A:.a=.b)
4869 <TAB>@echo survived bug20033.
4871 .PHONY: setup
4872 setup:
4873 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4875 define d1
4876 @echo lala \$(1)
4877 @sleep 1
4878 endef
4880 define d2
4881 @echo tyty \$(1)
4882 @sleep 1
4883 endef
4885 %.b : %.a
4886 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4887 <TAB>\$(call d1,\$(CHECKSUM)),\
4888 <TAB>\$(call d2,\$(CHECKSUM)))
4890     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4891         no_parallelism_make="YES"
4892         AC_MSG_RESULT([yes, disable parallelism])
4893     else
4894         AC_MSG_RESULT([no, keep parallelism enabled])
4895     fi
4896     rm -rf $TESTGMAKEBUG20033
4897 else
4898     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4901 # find if gnumake support file function
4902 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
4903 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4904 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4905     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
4907 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4908 \$(file >test.txt,Success )
4910 .PHONY: all
4911 all:
4912 <TAB>@cat test.txt
4915 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4916 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4917     HAVE_GNUMAKE_FILE_FUNC=TRUE
4918     AC_MSG_RESULT([yes])
4919 else
4920     AC_MSG_RESULT([no])
4922 rm -rf $TESTGMAKEFILEFUNC
4923 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4924 AC_SUBST(GNUMAKE_WIN_NATIVE)
4926 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
4927 STALE_MAKE=
4928 if test "$_make_ver_check" = ""; then
4929    STALE_MAKE=TRUE
4932 HAVE_LD_HASH_STYLE=FALSE
4933 WITH_LINKER_HASH_STYLE=
4934 AC_MSG_CHECKING([for --hash-style gcc linker support])
4935 if test "$GCC" = "yes"; then
4936     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4937         hash_styles="gnu sysv"
4938     elif test "$with_linker_hash_style" = "no"; then
4939         hash_styles=
4940     else
4941         hash_styles="$with_linker_hash_style"
4942     fi
4944     for hash_style in $hash_styles; do
4945         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4946         hash_style_ldflags_save=$LDFLAGS
4947         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
4949         AC_RUN_IFELSE([AC_LANG_PROGRAM(
4950             [
4951 #include <stdio.h>
4952             ],[
4953 printf ("");
4954             ])],
4955             [
4956                   HAVE_LD_HASH_STYLE=TRUE
4957                   WITH_LINKER_HASH_STYLE=$hash_style
4958             ],
4959             [HAVE_LD_HASH_STYLE=FALSE],
4960             [HAVE_LD_HASH_STYLE=FALSE])
4961         LDFLAGS=$hash_style_ldflags_save
4962     done
4964     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
4965         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
4966     else
4967         AC_MSG_RESULT( no )
4968     fi
4969     LDFLAGS=$hash_style_ldflags_save
4970 else
4971     AC_MSG_RESULT( no )
4973 AC_SUBST(HAVE_LD_HASH_STYLE)
4974 AC_SUBST(WITH_LINKER_HASH_STYLE)
4976 dnl ===================================================================
4977 dnl Check whether there's a Perl version available.
4978 dnl ===================================================================
4979 if test -z "$with_perl_home"; then
4980     AC_PATH_PROG(PERL, perl)
4981 else
4982     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
4983     _perl_path="$with_perl_home/bin/perl"
4984     if test -x "$_perl_path"; then
4985         PERL=$_perl_path
4986     else
4987         AC_MSG_ERROR([$_perl_path not found])
4988     fi
4991 dnl ===================================================================
4992 dnl Testing for Perl version 5 or greater.
4993 dnl $] is the Perl version variable, it is returned as an integer
4994 dnl ===================================================================
4995 if test "$PERL"; then
4996     AC_MSG_CHECKING([the Perl version])
4997     ${PERL} -e "exit($]);"
4998     _perl_version=$?
4999     if test "$_perl_version" -lt 5; then
5000         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5001     fi
5002     AC_MSG_RESULT([Perl $_perl_version])
5003 else
5004     AC_MSG_ERROR([Perl not found, install Perl 5])
5007 dnl ===================================================================
5008 dnl Testing for required Perl modules
5009 dnl ===================================================================
5011 AC_MSG_CHECKING([for required Perl modules])
5012 perl_use_string="use Cwd ; use Digest::MD5"
5013 if test "$_os" = "WINNT"; then
5014     if test -n "$PKGFORMAT"; then
5015         for i in $PKGFORMAT; do
5016             case "$i" in
5017             msi)
5018                 # for getting fonts versions to use in MSI
5019                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5020                 ;;
5021             esac
5022         done
5023     fi
5025 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5026     AC_MSG_RESULT([all modules found])
5027 else
5028     AC_MSG_RESULT([failed to find some modules])
5029     # Find out which modules are missing.
5030     for i in $perl_use_string; do
5031         if test "$i" != "use" -a "$i" != ";"; then
5032             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5033                 missing_perl_modules="$missing_perl_modules $i"
5034             fi
5035         fi
5036     done
5037     AC_MSG_ERROR([
5038     The missing Perl modules are: $missing_perl_modules
5039     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5042 dnl ===================================================================
5043 dnl Check for pkg-config
5044 dnl ===================================================================
5045 if test "$_os" != "WINNT"; then
5046     PKG_PROG_PKG_CONFIG
5049 if test "$_os" != "WINNT"; then
5051     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5052     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5053     # explicitly. Or put /path/to/compiler in PATH yourself.
5055     # Use wrappers for LTO
5056     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5057         AC_CHECK_TOOL(AR,gcc-ar)
5058         AC_CHECK_TOOL(NM,gcc-nm)
5059         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5060     else
5061         AC_CHECK_TOOL(AR,ar)
5062         AC_CHECK_TOOL(NM,nm)
5063         AC_CHECK_TOOL(RANLIB,ranlib)
5064     fi
5065     AC_CHECK_TOOL(OBJDUMP,objdump)
5066     AC_CHECK_TOOL(READELF,readelf)
5067     AC_CHECK_TOOL(STRIP,strip)
5068     if test "$_os" = "WINNT"; then
5069         AC_CHECK_TOOL(DLLTOOL,dlltool)
5070         AC_CHECK_TOOL(WINDRES,windres)
5071     fi
5073 AC_SUBST(AR)
5074 AC_SUBST(DLLTOOL)
5075 AC_SUBST(NM)
5076 AC_SUBST(OBJDUMP)
5077 AC_SUBST(PKG_CONFIG)
5078 AC_SUBST(RANLIB)
5079 AC_SUBST(READELF)
5080 AC_SUBST(STRIP)
5081 AC_SUBST(WINDRES)
5083 dnl ===================================================================
5084 dnl pkg-config checks on Mac OS X
5085 dnl ===================================================================
5087 if test $_os = Darwin; then
5088     AC_MSG_CHECKING([for bogus pkg-config])
5089     if test -n "$PKG_CONFIG"; then
5090         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5091             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5092         else
5093             if test "$enable_bogus_pkg_config" = "yes"; then
5094                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5095             else
5096                 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.])
5097             fi
5098         fi
5099     else
5100         AC_MSG_RESULT([no, good])
5101     fi
5104 find_csc()
5106     # Return value: $csctest
5108     unset csctest
5110     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5111     if test -n "$regvalue"; then
5112         csctest=$regvalue
5113         return
5114     fi
5117 find_al()
5119     # Return value: $altest
5121     unset altest
5123     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5124         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5125         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5126             altest=$regvalue
5127             return
5128         fi
5129     done
5131     # We need this additional check to detect 4.6.1 or above.
5132     for ver in 4.7.1 4.7 4.6.2 4.6.1; do
5133         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5134         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5135             altest=$regvalue
5136             return
5137         fi
5139         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/WOW6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools"
5140         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5141             altest=$regvalue
5142             return
5143         fi
5144     done
5147 find_dotnetsdk()
5149     # Return value: $frametest (that's a silly name...)
5151     unset frametest
5153     for ver in 1.1 2.0; do
5154         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
5155         if test -n "$regvalue"; then
5156             frametest=$regvalue
5157             return
5158         fi
5159     done
5162 find_dotnetsdk46()
5164     unset frametest
5166     for ver in 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5167         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5168         if test -n "$regvalue"; then
5169             frametest=$regvalue
5170             return
5171         fi
5172         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5173         if test -n "$regvalue"; then
5174             frametest=$regvalue
5175             return
5176         fi
5177     done
5180 find_winsdk_version()
5182     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5183     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5185     unset winsdktest winsdkbinsubdir winsdklibsubdir
5187     case "$1" in
5188     7.*)
5189         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5190         if test -n "$regvalue"; then
5191             winsdktest=$regvalue
5192             winsdklibsubdir=.
5193             return
5194         fi
5195         ;;
5196     8.0|8.0A)
5197         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5198         if test -n "$regvalue"; then
5199             winsdktest=$regvalue
5200             winsdklibsubdir=win8
5201             return
5202         fi
5203         ;;
5204     8.1|8.1A)
5205         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5206         if test -n "$regvalue"; then
5207             winsdktest=$regvalue
5208             winsdklibsubdir=winv6.3
5209             return
5210         fi
5211         ;;
5212     10.0)
5213         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5214         if test -n "$regvalue"; then
5215             winsdktest=$regvalue
5216             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5217             if test -n "$regvalue"; then
5218                 winsdkbinsubdir="$regvalue".0
5219             fi
5220             winsdklibsubdir=$regvalue
5221             if test "$regvalue" = "10.0.14393"; then
5222                 winsdklibsubdir="10.0.14393.0"
5223             elif test "$regvalue" = "10.0.16299"; then
5224                 winsdklibsubdir="10.0.16299.0"
5225             elif test "$regvalue" = "10.0.15063"; then
5226                 winsdklibsubdir="10.0.15063.0"
5227             elif test "$regvalue" = "10.0.17134"; then
5228                 winsdklibsubdir="$regvalue.0"
5229             fi
5230             return
5231         fi
5232         ;;
5233     esac
5236 find_winsdk()
5238     # Return value: From find_winsdk_version
5240     unset winsdktest
5242     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5243         find_winsdk_version $ver
5244         if test -n "$winsdktest"; then
5245             return
5246         fi
5247     done
5250 find_msms()
5252     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5253     if test $VCVER = 150; then
5254         my_msm_files="Microsoft_VC141_CRT_x86.msm ${my_msm_files}"
5255     fi
5256     AC_MSG_CHECKING([for ${my_msm_files}])
5257     msmdir=
5258     for ver in 14.0 15.0; do
5259         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5260         if test -n "$regvalue"; then
5261             for f in ${my_msm_files}; do
5262                 if test -e "$regvalue/${f}"; then
5263                     msmdir=$regvalue
5264                     break
5265                 fi
5266             done
5267         fi
5268     done
5269     dnl Is the following fallback really necessary, or was it added in response
5270     dnl to never having started Visual Studio on a given machine, so the
5271     dnl registry keys checked above had presumably not yet been created?
5272     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5273     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5274     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5275     dnl expanding to "C:\Program Files\Common Files"), which would need
5276     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5277     dnl obtain its value from cygwin:
5278     if test -z "$msmdir"; then
5279         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5280         for f in ${my_msm_files}; do
5281             if test -e "$my_msm_dir/${f}"; then
5282                 msmdir=$my_msm_dir
5283             fi
5284         done
5285     fi
5287     dnl Starting from MSVC 15.0, merge modules are located in different directory
5288     if test $VCVER = 150; then
5289         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5290             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])
5291             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5292             for f in ${my_msm_files}; do
5293                 if test -e "$my_msm_dir/${f}"; then
5294                     msmdir=$my_msm_dir
5295                     break
5296                 fi
5297             done
5298         done
5299     fi
5301     if test -n "$msmdir"; then
5302         msmdir=`cygpath -m "$msmdir"`
5303         AC_MSG_RESULT([$msmdir])
5304     else
5305         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5306             AC_MSG_ERROR([not found])
5307         else
5308             AC_MSG_WARN([not found])
5309             add_warning "MSM none of ${my_msm_files} found"
5310         fi
5311     fi
5314 find_msvc_x64_dlls()
5316     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5317     if test "$VCVER" = 150; then
5318         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5319             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT])
5320             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5321                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5322                 break
5323             fi
5324             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5325                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5326                 break
5327             fi
5328         done
5329     fi
5330     msvcdlls="msvcp140.dll vcruntime140.dll"
5331     for dll in $msvcdlls; do
5332         if ! test -f "$msvcdllpath/$dll"; then
5333             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5334         fi
5335     done
5338 dnl =========================================
5339 dnl Check for the Windows  SDK.
5340 dnl =========================================
5341 if test "$_os" = "WINNT"; then
5342     AC_MSG_CHECKING([for Windows SDK])
5343     if test "$build_os" = "cygwin"; then
5344         find_winsdk
5345         WINDOWS_SDK_HOME=$winsdktest
5347         # normalize if found
5348         if test -n "$WINDOWS_SDK_HOME"; then
5349             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5350             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5351         fi
5353         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5354     fi
5356     if test -n "$WINDOWS_SDK_HOME"; then
5357         # Remove a possible trailing backslash
5358         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5360         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5361              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5362              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5363             have_windows_sdk_headers=yes
5364         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5365              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5366              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5367             have_windows_sdk_headers=yes
5368         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5369              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5370              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5371             have_windows_sdk_headers=yes
5372         else
5373             have_windows_sdk_headers=no
5374         fi
5376         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5377             have_windows_sdk_libs=yes
5378         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5379             have_windows_sdk_libs=yes
5380         else
5381             have_windows_sdk_libs=no
5382         fi
5384         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5385             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5386 the  Windows SDK are installed.])
5387         fi
5388     fi
5390     if test -z "$WINDOWS_SDK_HOME"; then
5391         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5392     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
5393         WINDOWS_SDK_VERSION=70
5394         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
5395     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5396         WINDOWS_SDK_VERSION=80
5397         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5398     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5399         WINDOWS_SDK_VERSION=81
5400         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5401     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5402         WINDOWS_SDK_VERSION=10
5403         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5404     else
5405         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5406     fi
5407     PathFormat "$WINDOWS_SDK_HOME"
5408     WINDOWS_SDK_HOME="$formatted_path"
5409     if test "$build_os" = "cygwin"; then
5410         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5411         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5412             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5413         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5414             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5415         fi
5416     fi
5418     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5419     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5420     dnl but not in v8.0), so allow this to be overridden with a
5421     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5422     dnl and configuration error if no WiLangId.vbs is found would arguably be
5423     dnl better, but I do not know under which conditions exactly it is needed by
5424     dnl msiglobal.pm:
5425     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5426         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5427         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5428             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5429         fi
5430         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5431             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5432         fi
5433         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5434             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5435         fi
5436     fi
5437     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5438         if test -n "$with_package_format" -a "$with_package_format" != no; then
5439             for i in "$with_package_format"; do
5440                 if test "$i" = "msi"; then
5441                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5442                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5443                     fi
5444                 fi
5445             done
5446         fi
5447     fi
5449 AC_SUBST(WINDOWS_SDK_HOME)
5450 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5451 AC_SUBST(WINDOWS_SDK_VERSION)
5452 AC_SUBST(WINDOWS_SDK_WILANGID)
5454 if test "$build_os" = "cygwin"; then
5455     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5456     dnl dir, it also determines that dir's path w/o an arch segment if any,
5457     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5458     AC_MSG_CHECKING([for midl.exe])
5460     find_winsdk
5461     if test -n "$winsdkbinsubdir" \
5462         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5463     then
5464         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5465         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5466     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5467         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5468         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5469     elif test -f "$winsdktest/Bin/midl.exe"; then
5470         MIDL_PATH=$winsdktest/Bin
5471         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5472     fi
5473     if test ! -f "$MIDL_PATH/midl.exe"; then
5474         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5475     else
5476         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5477     fi
5479     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5480     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5482     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5483          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5484          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5485          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5486     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5487          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5488          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5489          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5490     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5491          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5492          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5493          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5494     else
5495         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5496     fi
5498     dnl Check csc.exe
5499     AC_MSG_CHECKING([for csc.exe])
5500     find_csc
5501     if test -f "$csctest/csc.exe"; then
5502         CSC_PATH="$csctest"
5503     fi
5504     if test ! -f "$CSC_PATH/csc.exe"; then
5505         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5506     else
5507         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5508     fi
5510     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5512     dnl Check al.exe
5513     AC_MSG_CHECKING([for al.exe])
5514     find_winsdk
5515     if test -n "$winsdkbinsubdir" \
5516         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5517     then
5518         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5519     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5520         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5521     elif test -f "$winsdktest/Bin/al.exe"; then
5522         AL_PATH="$winsdktest/Bin"
5523     fi
5525     if test -z "$AL_PATH"; then
5526         find_al
5527         if test -f "$altest/bin/al.exe"; then
5528             AL_PATH="$altest/bin"
5529         elif test -f "$altest/al.exe"; then
5530             AL_PATH="$altest"
5531         fi
5532     fi
5533     if test ! -f "$AL_PATH/al.exe"; then
5534         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5535     else
5536         AC_MSG_RESULT([$AL_PATH/al.exe])
5537     fi
5539     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5541     dnl Check mscoree.lib / .NET Framework dir
5542     AC_MSG_CHECKING(.NET Framework)
5543     find_dotnetsdk
5544     if test -f "$frametest/lib/mscoree.lib"; then
5545         DOTNET_FRAMEWORK_HOME="$frametest"
5546     else
5547         find_winsdk
5548         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5549             DOTNET_FRAMEWORK_HOME="$winsdktest"
5550         else
5551             find_dotnetsdk46
5552             PathFormat "$frametest"
5553             frametest="$formatted_path"
5554             if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5555                  DOTNET_FRAMEWORK_HOME="$frametest"
5556             fi
5557         fi
5558     fi
5560     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
5561         AC_MSG_ERROR([mscoree.lib not found])
5562     fi
5563     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5565     PathFormat "$MIDL_PATH"
5566     MIDL_PATH="$formatted_path"
5568     PathFormat "$AL_PATH"
5569     AL_PATH="$formatted_path"
5571     PathFormat "$DOTNET_FRAMEWORK_HOME"
5572     DOTNET_FRAMEWORK_HOME="$formatted_path"
5574     PathFormat "$CSC_PATH"
5575     CSC_PATH="$formatted_path"
5578 dnl ===================================================================
5579 dnl Check if stdc headers are available excluding MSVC.
5580 dnl ===================================================================
5581 if test "$_os" != "WINNT"; then
5582     AC_HEADER_STDC
5585 dnl ===================================================================
5586 dnl Testing for C++ compiler and version...
5587 dnl ===================================================================
5589 if test "$_os" != "WINNT"; then
5590     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5591     save_CXXFLAGS=$CXXFLAGS
5592     AC_PROG_CXX
5593     CXXFLAGS=$save_CXXFLAGS
5594 else
5595     if test -n "$CC" -a -z "$CXX"; then
5596         CXX="$CC"
5597     fi
5600 dnl At least MSVC 2015 Update 1 is known to sporadically emit warning C4592
5601 dnl ("implementation limitation" when defining OUStringLiteral variables in
5602 dnl vcl/source/app/IconThemeInfo.cxx), while Update 3 is known good, and it is
5603 dnl probably a good idea to require that anyway.  A reliable way to check for
5604 dnl MSVC 2015 Update 3 appears to be to check for support of C++17 nested
5605 dnl namespace definitions (which requires /std:c++latest to be enabled):
5606 if test "$COM" = MSC -a "$VCVER" = 140; then
5607     AC_MSG_CHECKING([whether MSVC 2015 compiler $MSVC_CXX is at least Update 3])
5608     save_CXX=$CXX
5609     save_CXXFLAGS=$CXXFLAGS
5610     CXX=$MSVC_CXX
5611     CXXFLAGS="$CXXFLAGS /std:c++latest"
5612     AC_LANG_PUSH([C++])
5613     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5614         namespace A::B {}
5615     ]])], [good=yes], [good=no])
5616     AC_LANG_POP([C++])
5617     CXX=$save_CXX
5618     CXXFLAGS=$save_CXXFLAGS
5619     AC_MSG_RESULT([$good])
5620     if test "$good" = no; then
5621         AC_MSG_ERROR([When using MSVC 2015, at least Update 3 must be installed])
5622     fi
5625 dnl check for GNU C++ compiler version
5626 if test "$GXX" = "yes"; then
5627     AC_MSG_CHECKING([the GNU C++ compiler version])
5629     _gpp_version=`$CXX -dumpversion`
5630     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5632     if test "$_gpp_majmin" -lt "401"; then
5633         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5634     else
5635         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5636     fi
5638     dnl see https://code.google.com/p/android/issues/detail?id=41770
5639     if test "$_gpp_majmin" -ge "401"; then
5640         glibcxx_threads=no
5641         AC_LANG_PUSH([C++])
5642         AC_REQUIRE_CPP
5643         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5644         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5645             #include <bits/c++config.h>]],[[
5646             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5647             && !defined(_GLIBCXX__PTHREADS) \
5648             && !defined(_GLIBCXX_HAS_GTHREADS)
5649             choke me
5650             #endif
5651         ]])],[AC_MSG_RESULT([yes])
5652         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5653         AC_LANG_POP([C++])
5654         if test $glibcxx_threads = yes; then
5655             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5656         fi
5657      fi
5659 AC_SUBST(BOOST_CXXFLAGS)
5662 # prefx CXX with ccache if needed
5664 if test "$CCACHE" != ""; then
5665     AC_MSG_CHECKING([whether $CXX is already ccached])
5666     AC_LANG_PUSH([C++])
5667     save_CXXFLAGS=$CXXFLAGS
5668     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5669     dnl an empty program will do, we're checking the compiler flags
5670     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5671                       [use_ccache=yes], [use_ccache=no])
5672     if test $use_ccache = yes; then
5673         AC_MSG_RESULT([yes])
5674     else
5675         CXX="$CCACHE $CXX"
5676         AC_MSG_RESULT([no])
5677     fi
5678     CXXFLAGS=$save_CXXFLAGS
5679     AC_LANG_POP([C++])
5682 dnl ===================================================================
5683 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5684 dnl ===================================================================
5686 if test "$_os" != "WINNT"; then
5687     AC_PROG_CXXCPP
5689     dnl Check whether there's a C pre-processor.
5690     AC_PROG_CPP
5694 dnl ===================================================================
5695 dnl Find integral type sizes and alignments
5696 dnl ===================================================================
5698 if test "$_os" != "WINNT"; then
5700 if test "$_os" == "iOS"; then
5701     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5702     ac_cv_sizeof_long=8
5703     ac_cv_sizeof_short=2
5704     ac_cv_sizeof_int=4
5705     ac_cv_sizeof_long_long=8
5706     ac_cv_sizeof_double=8
5707     ac_cv_sizeof_voidp=8
5708 else
5709     AC_CHECK_SIZEOF(long)
5710     AC_CHECK_SIZEOF(short)
5711     AC_CHECK_SIZEOF(int)
5712     AC_CHECK_SIZEOF(long long)
5713     AC_CHECK_SIZEOF(double)
5714     AC_CHECK_SIZEOF(void*)
5717     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5718     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5719     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5720     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5721     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5723     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5724     m4_pattern_allow([AC_CHECK_ALIGNOF])
5725     m4_ifdef([AC_CHECK_ALIGNOF],
5726         [
5727             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5728             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5729             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5730             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5731         ],
5732         [
5733             case "$_os-$host_cpu" in
5734             Linux-i686)
5735                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5736                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5737                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5738                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5739                 ;;
5740             Linux-x86_64)
5741                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5742                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5743                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5744                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5745                 ;;
5746             *)
5747                 if test -z "$ac_cv_alignof_short" -o \
5748                         -z "$ac_cv_alignof_int" -o \
5749                         -z "$ac_cv_alignof_long" -o \
5750                         -z "$ac_cv_alignof_double"; then
5751                    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.])
5752                 fi
5753                 ;;
5754             esac
5755         ])
5757     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5758     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5759     if test $ac_cv_sizeof_long -eq 8; then
5760         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5761     elif test $ac_cv_sizeof_double -eq 8; then
5762         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5763     else
5764         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5765     fi
5767     dnl Check for large file support
5768     AC_SYS_LARGEFILE
5769     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5770         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5771     fi
5772     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5773         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5774     fi
5775 else
5776     # Hardcode for MSVC
5777     SAL_TYPES_SIZEOFSHORT=2
5778     SAL_TYPES_SIZEOFINT=4
5779     SAL_TYPES_SIZEOFLONG=4
5780     SAL_TYPES_SIZEOFLONGLONG=8
5781     if test "$BITNESS_OVERRIDE" = ""; then
5782         SAL_TYPES_SIZEOFPOINTER=4
5783     else
5784         SAL_TYPES_SIZEOFPOINTER=8
5785     fi
5786     SAL_TYPES_ALIGNMENT2=2
5787     SAL_TYPES_ALIGNMENT4=4
5788     SAL_TYPES_ALIGNMENT8=8
5789     LFS_CFLAGS=''
5791 AC_SUBST(LFS_CFLAGS)
5793 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5794 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5795 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5796 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5797 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5798 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5799 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5800 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5802 dnl ===================================================================
5803 dnl Check whether to enable runtime optimizations
5804 dnl ===================================================================
5805 ENABLE_RUNTIME_OPTIMIZATIONS=
5806 AC_MSG_CHECKING([whether to enable runtime optimizations])
5807 if test -z "$enable_runtime_optimizations"; then
5808     for i in $CC; do
5809         case $i in
5810         -fsanitize=*)
5811             enable_runtime_optimizations=no
5812             break
5813             ;;
5814         esac
5815     done
5817 if test "$enable_runtime_optimizations" != no; then
5818     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5819     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5820     AC_MSG_RESULT([yes])
5821 else
5822     AC_MSG_RESULT([no])
5824 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5826 dnl ===================================================================
5827 dnl Check if valgrind headers are available
5828 dnl ===================================================================
5829 ENABLE_VALGRIND=
5830 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
5831     prev_cppflags=$CPPFLAGS
5832     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5833     # or where does it come from?
5834     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5835     AC_CHECK_HEADER([valgrind/valgrind.h],
5836         [ENABLE_VALGRIND=TRUE])
5837     CPPFLAGS=$prev_cppflags
5839 AC_SUBST([ENABLE_VALGRIND])
5840 if test -z "$ENABLE_VALGRIND"; then
5841     if test "$with_valgrind" = yes; then
5842         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
5843     fi
5844     VALGRIND_CFLAGS=
5846 AC_SUBST([VALGRIND_CFLAGS])
5849 dnl ===================================================================
5850 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5851 dnl ===================================================================
5853 # We need at least the sys/sdt.h include header.
5854 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5855 if test "$SDT_H_FOUND" = "TRUE"; then
5856     # Found sys/sdt.h header, now make sure the c++ compiler works.
5857     # Old g++ versions had problems with probes in constructors/destructors.
5858     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5859     AC_LANG_PUSH([C++])
5860     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5861     #include <sys/sdt.h>
5862     class ProbeClass
5863     {
5864     private:
5865       int& ref;
5866       const char *name;
5868     public:
5869       ProbeClass(int& v, const char *n) : ref(v), name(n)
5870       {
5871         DTRACE_PROBE2(_test_, cons, name, ref);
5872       }
5874       void method(int min)
5875       {
5876         DTRACE_PROBE3(_test_, meth, name, ref, min);
5877         ref -= min;
5878       }
5880       ~ProbeClass()
5881       {
5882         DTRACE_PROBE2(_test_, dest, name, ref);
5883       }
5884     };
5885     ]],[[
5886     int i = 64;
5887     DTRACE_PROBE1(_test_, call, i);
5888     ProbeClass inst = ProbeClass(i, "call");
5889     inst.method(24);
5890     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5891           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5892     AC_LANG_POP([C++])
5894 AC_CONFIG_HEADERS([config_host/config_probes.h])
5896 dnl ===================================================================
5897 dnl GCC features
5898 dnl ===================================================================
5899 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
5900     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5901     save_CFLAGS=$CFLAGS
5902     CFLAGS="$CFLAGS -Werror -mno-avx"
5903     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5904     CFLAGS=$save_CFLAGS
5905     if test "$HAVE_GCC_AVX" = "TRUE"; then
5906         AC_MSG_RESULT([yes])
5907     else
5908         AC_MSG_RESULT([no])
5909     fi
5911     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5912     save_CFLAGS=$CFLAGS
5913     CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
5914     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5915     CFLAGS=$save_CFLAGS
5916     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5917         AC_MSG_RESULT([yes])
5918     else
5919         AC_MSG_RESULT([no])
5920     fi
5922     AC_MSG_CHECKING([whether $CC supports atomic functions])
5923     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5924     int v = 0;
5925     if (__sync_add_and_fetch(&v, 1) != 1 ||
5926         __sync_sub_and_fetch(&v, 1) != 0)
5927         return 1;
5928     __sync_synchronize();
5929     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5930         v != 1)
5931         return 1;
5932     return 0;
5933 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5934     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5935         AC_MSG_RESULT([yes])
5936         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5937     else
5938         AC_MSG_RESULT([no])
5939     fi
5941     AC_MSG_CHECKING([whether $CC supports __builtin_ffs])
5942     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
5943     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
5944         AC_MSG_RESULT([yes])
5945         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
5946     else
5947         AC_MSG_RESULT([no])
5948     fi
5950     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5951     save_CFLAGS=$CFLAGS
5952     CFLAGS="$CFLAGS -Werror"
5953     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5954             __attribute__((deprecated("test"))) void f();
5955         ])], [
5956             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5957             AC_MSG_RESULT([yes])
5958         ], [AC_MSG_RESULT([no])])
5959     CFLAGS=$save_CFLAGS
5961     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
5962     AC_LANG_PUSH([C++])
5963     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5964             #include <cstddef>
5965             #include <cxxabi.h>
5966             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
5967         ])], [
5968             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
5969             AC_MSG_RESULT([yes])
5970         ], [AC_MSG_RESULT([no])])
5971     AC_LANG_POP([C++])
5973     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
5974     AC_LANG_PUSH([C++])
5975     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5976             #include <cstddef>
5977             #include <cxxabi.h>
5978             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
5979         ])], [
5980             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
5981             AC_MSG_RESULT([yes])
5982         ], [AC_MSG_RESULT([no])])
5983     AC_LANG_POP([C++])
5985     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
5986     AC_LANG_PUSH([C++])
5987     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5988             #include <cxxabi.h>
5989             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
5990         ])], [
5991             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
5992             AC_MSG_RESULT([yes])
5993         ], [AC_MSG_RESULT([no])])
5994     AC_LANG_POP([C++])
5996     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
5997     AC_LANG_PUSH([C++])
5998     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5999             #include <cstddef>
6000             #include <cxxabi.h>
6001             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6002         ])], [
6003             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6004             AC_MSG_RESULT([yes])
6005         ], [AC_MSG_RESULT([no])])
6006     AC_LANG_POP([C++])
6008     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
6009     AC_LANG_PUSH([C++])
6010     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6011             #include <cstddef>
6012             #include <cxxabi.h>
6013             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6014         ])], [
6015             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6016             AC_MSG_RESULT([yes])
6017         ], [AC_MSG_RESULT([no])])
6018     AC_LANG_POP([C++])
6020     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6021     AC_LANG_PUSH([C++])
6022     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6023             #include <cxxabi.h>
6024             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6025         ])], [
6026             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6027             AC_MSG_RESULT([yes])
6028         ], [AC_MSG_RESULT([no])])
6029     AC_LANG_POP([C++])
6031     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6032     AC_LANG_PUSH([C++])
6033     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6034             #include <cxxabi.h>
6035             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6036         ])], [
6037             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6038             AC_MSG_RESULT([yes])
6039         ], [AC_MSG_RESULT([no])])
6040     AC_LANG_POP([C++])
6042     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
6043     AC_LANG_PUSH([C++])
6044     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6045             #include <cstddef>
6046             #include <cxxabi.h>
6047             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6048         ])], [
6049             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6050             AC_MSG_RESULT([yes])
6051         ], [AC_MSG_RESULT([no])])
6052     AC_LANG_POP([C++])
6054     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
6055     AC_LANG_PUSH([C++])
6056     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6057             #include <cstddef>
6058             #include <cxxabi.h>
6059             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6060         ])], [
6061             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6062             AC_MSG_RESULT([yes])
6063         ], [AC_MSG_RESULT([no])])
6064     AC_LANG_POP([C++])
6066     dnl Available in GCC 4.9 and at least since Clang 3.4:
6067     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6068     AC_LANG_PUSH([C++])
6069     save_CXXFLAGS=$CXXFLAGS
6070     CXXFLAGS="$CXXFLAGS -Werror"
6071     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6072             struct __attribute__((warn_unused)) dummy {};
6073         ])], [
6074             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6075             AC_MSG_RESULT([yes])
6076         ], [AC_MSG_RESULT([no])])
6077     CXXFLAGS=$save_CXXFLAGS
6078 AC_LANG_POP([C++])
6081 AC_SUBST(HAVE_GCC_AVX)
6082 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6083 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6084 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6086 dnl ===================================================================
6087 dnl Identify the C++ library
6088 dnl ===================================================================
6090 AC_MSG_CHECKING([What the C++ library is])
6091 AC_LANG_PUSH([C++])
6092 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6093 #include <utility>
6094 #ifndef __GLIBCXX__
6095 foo bar
6096 #endif
6097 ]])],
6098     [CPP_LIBRARY=GLIBCXX
6099      cpp_library_name="GNU libstdc++"
6100     ],
6101     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6102 #include <utility>
6103 #ifndef _LIBCPP_VERSION
6104 foo bar
6105 #endif
6106 ]])],
6107     [CPP_LIBRARY=LIBCPP
6108      cpp_library_name="LLVM libc++"
6109      AC_DEFINE([HAVE_LIBCXX])
6110     ],
6111     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6112 #include <utility>
6113 #ifndef _MSC_VER
6114 foo bar
6115 #endif
6116 ]])],
6117     [CPP_LIBRARY=MSVCRT
6118      cpp_library_name="Microsoft"
6119     ],
6120     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6121 AC_MSG_RESULT([$cpp_library_name])
6122 AC_LANG_POP([C++])
6124 dnl ===================================================================
6125 dnl Check for gperf
6126 dnl ===================================================================
6127 AC_PATH_PROG(GPERF, gperf)
6128 if test -z "$GPERF"; then
6129     AC_MSG_ERROR([gperf not found but needed. Install it.])
6131 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6132     GPERF=`cygpath -m $GPERF`
6134 AC_MSG_CHECKING([gperf version])
6135 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
6136     AC_MSG_RESULT([OK])
6137 else
6138     AC_MSG_ERROR([too old, you need at least 3.0.0])
6140 AC_SUBST(GPERF)
6142 dnl ===================================================================
6143 dnl Check for system libcmis
6144 dnl ===================================================================
6145 # libcmis requires curl and we can't build curl for iOS
6146 if test $_os != iOS; then
6147     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.0])
6148     ENABLE_LIBCMIS=TRUE
6149 else
6150     ENABLE_LIBCMIS=
6152 AC_SUBST(ENABLE_LIBCMIS)
6154 dnl ===================================================================
6155 dnl C++11
6156 dnl ===================================================================
6158 my_cxx17switches=
6159 libo_FUZZ_ARG_ENABLE(c++17,
6160     AS_HELP_STRING([--disable-c++17],
6161         [Do not attempt to run GCC/Clang in C++17 mode (needed for Coverity).])
6164 CXXFLAGS_CXX11=
6165 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6166     AC_MSG_CHECKING([whether $CXX supports C++11])
6167     AC_MSG_RESULT(yes)
6168     # MSVC supports (a subset of) CXX11 without any switch
6169 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6170     HAVE_CXX11=
6171     AC_MSG_CHECKING([whether $CXX supports C++17, C++14, or C++11])
6172     dnl But only use C++17 if the gperf that is being used knows not to emit
6173     dnl "register" in C++ output:
6174     printf 'foo\n' | $GPERF -L C++ > conftest.inc
6175     my_flags='-std=gnu++14 -std=gnu++1y -std=c++14 -std=c++1y -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x'
6176     if test "$enable_c__17" != no; then
6177         my_flags="-std=gnu++17 -std=gnu++1z -std=c++17 -std=c++1z $my_flags"
6178     fi
6179     for flag in $my_flags; do
6180         if test "$COM" = MSC; then
6181             flag="-Xclang $flag"
6182         fi
6183         save_CXXFLAGS=$CXXFLAGS
6184         CXXFLAGS="$CXXFLAGS $flag -Werror"
6185         if test "$SYSTEM_LIBCMIS" = TRUE; then
6186             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6187         fi
6188         AC_LANG_PUSH([C++])
6189         dnl Clang 3.9 supports __float128 since
6190         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6191         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6192         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6193         dnl $flag is supported below, so check this first):
6194         my_float128hack=
6195         my_float128hack_impl=-D__float128=void
6196         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6197             #include <vector>
6198             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6199             // (__float128)
6200             ]])
6201         ],,[
6202             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6203             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6204             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6205             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6206             dnl place where __float128 is used is in a template specialization, -D__float128=void
6207             dnl will avoid the problem there while still causing a problem if somebody actually uses
6208             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6209             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6210             dnl "fixed" with this hack):
6211             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6212             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6213                 #include <vector>
6214                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6215                 // (__float128)
6216                 ]])
6217             ],[my_float128hack=$my_float128hack_impl])
6218         ])
6219         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6220             #include <algorithm>
6221             #include <functional>
6222             #include <vector>
6224             #include <string.h>
6225             #pragma GCC diagnostic push
6226             #pragma GCC diagnostic ignored "-Wpragmas"
6227                 // make GCC not warn about next pragma
6228             #pragma GCC diagnostic ignored "-Wdeprecated-register"
6229                 // make Clang with -std < C++17 not even warn about register
6230             #include "conftest.inc"
6231             #pragma GCC diagnostic pop
6233             #if defined SYSTEM_LIBCMIS
6234             // See ucb/source/ucp/cmis/auth_provider.hxx:
6235             #if __GNUC__ >= 7
6236             #pragma GCC diagnostic push
6237             #pragma GCC diagnostic ignored "-Wdeprecated"
6238             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6239             #endif
6240             #include <libcmis/libcmis.hxx>
6241             #if __GNUC__ >= 7
6242             #pragma GCC diagnostic pop
6243             #endif
6244             #endif
6246             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6247                 std::sort(v.begin(), v.end(), fn);
6248             }
6249             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6250         AC_LANG_POP([C++])
6251         CXXFLAGS=$save_CXXFLAGS
6252         if test -n "$CXXFLAGS_CXX11"; then
6253             HAVE_CXX11=TRUE
6254             break
6255         fi
6256     done
6257     rm conftest.inc
6258     if test "$HAVE_CXX11" = TRUE; then
6259         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6260     else
6261         AC_MSG_ERROR(no)
6262     fi
6264 AC_SUBST(CXXFLAGS_CXX11)
6266 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6267 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6268 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6269 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6270 dnl again towards 4.7.2:
6271 if test $CPP_LIBRARY = GLIBCXX; then
6272     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6273     AC_LANG_PUSH([C++])
6274     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6275 #include <list>
6276 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6277     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6278     //   GCC 4.7.0: 20120322
6279     //   GCC 4.7.1: 20120614
6280     // and using a range check is not possible as the mapping between
6281     // __GLIBCXX__ values and GCC versions is not monotonic
6282 /* ok */
6283 #else
6284 abi broken
6285 #endif
6286         ]])], [AC_MSG_RESULT(no, ok)],
6287         [AC_MSG_ERROR(yes)])
6288     AC_LANG_POP([C++])
6291 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6292 save_CXXFLAGS=$CXXFLAGS
6293 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6294 AC_LANG_PUSH([C++])
6296 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6297 #include <stddef.h>
6299 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6301 namespace
6303         struct b
6304         {
6305                 int i;
6306                 int j;
6307         };
6309 ]], [[
6310 struct a
6312         int i;
6313         int j;
6315 a thinga[]={{0,0}, {1,1}};
6316 b thingb[]={{0,0}, {1,1}};
6317 size_t i = sizeof(sal_n_array_size(thinga));
6318 size_t j = sizeof(sal_n_array_size(thingb));
6319 return !(i != 0 && j != 0);
6321     ], [ AC_MSG_RESULT(yes) ],
6322     [ AC_MSG_ERROR(no)])
6323 AC_LANG_POP([C++])
6324 CXXFLAGS=$save_CXXFLAGS
6326 AC_MSG_CHECKING([whether $CXX supports C++14 constexpr])
6327 save_CXXFLAGS=$CXXFLAGS
6328 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6329 AC_LANG_PUSH([C++])
6330 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6331     // A somewhat over-complicated way of checking for
6332     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6333     // in constexpr function":
6334     #include <cassert>
6335     template<typename T> inline constexpr T f(T x) { return x; }
6336     template<typename T> inline constexpr T g(T x) {
6337         assert(f(static_cast<int>(x)));
6338         return x;
6339     }
6340     enum E { e };
6341     auto v = g(E::e);
6343     struct S {
6344         int n_;
6345         constexpr bool f() {
6346             int n = n_;
6347             int i = 0;
6348             while (n > 0) { --n; ++i; }
6349             assert(i >= 0);
6350             return i == 0;
6351         }
6352     };
6353     constexpr auto v2 = S{10}.f();
6354     ]])], [cxx14_constexpr=yes], [cxx14_constexpr=no])
6355 AC_LANG_POP([C++])
6356 CXXFLAGS=$save_CXXFLAGS
6357 AC_MSG_RESULT([$cxx14_constexpr])
6358 if test "$cxx14_constexpr" = yes; then
6359     AC_DEFINE([HAVE_CXX14_CONSTEXPR])
6362 dnl _Pragma support (may require C++11)
6363 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6364     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6365     AC_LANG_PUSH([C++])
6366     save_CXXFLAGS=$CXXFLAGS
6367     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6368     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6369             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6370         ])], [
6371             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6372             AC_MSG_RESULT([yes])
6373         ], [AC_MSG_RESULT([no])])
6374     AC_LANG_POP([C++])
6375     CXXFLAGS=$save_CXXFLAGS
6378 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6379 if test "$GCC" = yes; then
6380     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6381     AC_LANG_PUSH([C++])
6382     save_CXXFLAGS=$CXXFLAGS
6383     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6384     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6385     CXXFLAGS=$save_CXXFLAGS
6386     AC_LANG_POP([C++])
6387     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6388         AC_MSG_RESULT([yes])
6389     else
6390         AC_MSG_RESULT([no])
6391     fi
6393 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6395 dnl ===================================================================
6396 dnl system stl sanity tests
6397 dnl ===================================================================
6398 if test "$_os" != "WINNT"; then
6400     AC_LANG_PUSH([C++])
6402     save_CPPFLAGS="$CPPFLAGS"
6403     if test -n "$MACOSX_SDK_PATH"; then
6404         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6405     fi
6407     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6408     # only.
6409     if test "$CPP_LIBRARY" = GLIBCXX; then
6410         dnl gcc#19664, gcc#22482, rhbz#162935
6411         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6412         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6413         AC_MSG_RESULT([$stlvisok])
6414         if test "$stlvisok" = "no"; then
6415             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6416         fi
6417     fi
6419     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6420     # when we don't make any dynamic libraries?
6421     if test "$DISABLE_DYNLOADING" = ""; then
6422         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6423         cat > conftestlib1.cc <<_ACEOF
6424 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6425 struct S2: S1<int> { virtual ~S2(); };
6426 S2::~S2() {}
6427 _ACEOF
6428         cat > conftestlib2.cc <<_ACEOF
6429 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6430 struct S2: S1<int> { virtual ~S2(); };
6431 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6432 _ACEOF
6433         gccvisinlineshiddenok=yes
6434         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6435             gccvisinlineshiddenok=no
6436         else
6437             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6438             dnl known to not work with -z defs (unsetting which makes the test
6439             dnl moot, though):
6440             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6441             if test "$COM_IS_CLANG" = TRUE; then
6442                 for i in $CXX $CXXFLAGS; do
6443                     case $i in
6444                     -fsanitize=*)
6445                         my_linkflagsnoundefs=
6446                         break
6447                         ;;
6448                     esac
6449                 done
6450             fi
6451             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6452                 gccvisinlineshiddenok=no
6453             fi
6454         fi
6456         rm -fr libconftest*
6457         AC_MSG_RESULT([$gccvisinlineshiddenok])
6458         if test "$gccvisinlineshiddenok" = "no"; then
6459             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6460         fi
6461     fi
6463    AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6464     cat >visibility.cxx <<_ACEOF
6465 #pragma GCC visibility push(hidden)
6466 struct __attribute__ ((visibility ("default"))) TestStruct {
6467   static void Init();
6469 __attribute__ ((visibility ("default"))) void TestFunc() {
6470   TestStruct::Init();
6472 _ACEOF
6473     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6474         gccvisbroken=yes
6475     else
6476         case "$host_cpu" in
6477         i?86|x86_64)
6478             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6479                 gccvisbroken=no
6480             else
6481                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6482                     gccvisbroken=no
6483                 else
6484                     gccvisbroken=yes
6485                 fi
6486             fi
6487             ;;
6488         *)
6489             gccvisbroken=no
6490             ;;
6491         esac
6492     fi
6493     rm -f visibility.s visibility.cxx
6495     AC_MSG_RESULT([$gccvisbroken])
6496     if test "$gccvisbroken" = "yes"; then
6497         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6498     fi
6500     CPPFLAGS="$save_CPPFLAGS"
6502     AC_LANG_POP([C++])
6505 dnl ===================================================================
6506 dnl  Clang++ tests
6507 dnl ===================================================================
6509 HAVE_GCC_FNO_DEFAULT_INLINE=
6510 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6511 if test "$GCC" = "yes"; then
6512     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6513     AC_LANG_PUSH([C++])
6514     save_CXXFLAGS=$CXXFLAGS
6515     CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6516     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6517     CXXFLAGS=$save_CXXFLAGS
6518     AC_LANG_POP([C++])
6519     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6520         AC_MSG_RESULT([yes])
6521     else
6522         AC_MSG_RESULT([no])
6523     fi
6525     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6526     AC_LANG_PUSH([C++])
6527     save_CXXFLAGS=$CXXFLAGS
6528     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6529     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6530     CXXFLAGS=$save_CXXFLAGS
6531     AC_LANG_POP([C++])
6532     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6533         AC_MSG_RESULT([yes])
6534     else
6535         AC_MSG_RESULT([no])
6536     fi
6538 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6539 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6541 dnl ===================================================================
6542 dnl Compiler plugins
6543 dnl ===================================================================
6545 COMPILER_PLUGINS=
6546 # currently only Clang
6548 if test "$COM_IS_CLANG" != "TRUE"; then
6549     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6550         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6551         enable_compiler_plugins=no
6552     fi
6555 if test "$COM_IS_CLANG" = "TRUE"; then
6556     if test -n "$enable_compiler_plugins"; then
6557         compiler_plugins="$enable_compiler_plugins"
6558     elif test -n "$ENABLE_DBGUTIL"; then
6559         compiler_plugins=test
6560     else
6561         compiler_plugins=no
6562     fi
6563     if test "$compiler_plugins" != no -a "$CLANGVER" -lt 30800; then
6564         if test "$compiler_plugins" = yes; then
6565             AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 3.8.0.])
6566         else
6567             compiler_plugins=no
6568         fi
6569     fi
6570     if test "$compiler_plugins" != "no"; then
6571         dnl The prefix where Clang resides, override to where Clang resides if
6572         dnl using a source build:
6573         if test -z "$CLANGDIR"; then
6574             CLANGDIR=/usr
6575         fi
6576         AC_LANG_PUSH([C++])
6577         save_CPPFLAGS=$CPPFLAGS
6578         save_CXX=$CXX
6579         # compiler plugins must be built with "native" compiler that was used to build Clang itself:
6580         : "${COMPILER_PLUGINS_CXX=g++}"
6581         CXX=$COMPILER_PLUGINS_CXX
6582         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6583         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6584             [COMPILER_PLUGINS=TRUE],
6585             [
6586             if test "$compiler_plugins" = "yes"; then
6587                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6588             else
6589                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6590                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6591             fi
6592             ])
6593         CXX=$save_CXX
6594         CPPFLAGS=$save_CPPFLAGS
6595         AC_LANG_POP([C++])
6596     fi
6597 else
6598     if test "$enable_compiler_plugins" = "yes"; then
6599         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6600     fi
6602 AC_SUBST(COMPILER_PLUGINS)
6603 AC_SUBST(COMPILER_PLUGINS_CXX)
6604 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
6605 AC_SUBST(COMPILER_PLUGINS_DEBUG)
6606 AC_SUBST(CLANGDIR)
6607 AC_SUBST(CLANGLIBDIR)
6609 # Plugin to help linker.
6610 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6611 # This makes --enable-lto build with clang work.
6612 AC_SUBST(LD_PLUGIN)
6614 dnl ===================================================================
6615 dnl allocator
6616 dnl ===================================================================
6617 AC_MSG_CHECKING([which memory allocator to use])
6618 if test "$with_alloc" = "system"; then
6619     AC_MSG_RESULT([system])
6620     ALLOC="SYS_ALLOC"
6622 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6623     AC_MSG_RESULT([internal])
6625 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6626 AC_SUBST(HAVE_POSIX_FALLOCATE)
6627 AC_SUBST(ALLOC)
6629 dnl ===================================================================
6630 dnl Custom build version
6631 dnl ===================================================================
6633 AC_MSG_CHECKING([whether to add custom build version])
6634 if test "$with_build_version" != ""; then
6635     BUILD_VER_STRING=$with_build_version
6636     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6637 else
6638     BUILD_VER_STRING=
6639     AC_MSG_RESULT([no])
6641 AC_SUBST(BUILD_VER_STRING)
6643 JITC_PROCESSOR_TYPE=""
6644 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6645     # IBMs JDK needs this...
6646     JITC_PROCESSOR_TYPE=6
6647     export JITC_PROCESSOR_TYPE
6649 AC_SUBST([JITC_PROCESSOR_TYPE])
6651 # Misc Windows Stuff
6652 AC_ARG_WITH(ucrt-dir,
6653     AS_HELP_STRING([--with-ucrt-dir],
6654         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
6655         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
6656         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
6657             Windows6.1-KB2999226-x64.msu
6658             Windows6.1-KB2999226-x86.msu
6659             Windows8.1-KB2999226-x64.msu
6660             Windows8.1-KB2999226-x86.msu
6661             Windows8-RT-KB2999226-x64.msu
6662             Windows8-RT-KB2999226-x86.msu
6663         A zip archive including those files is available from Microsoft site:
6664         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
6666 UCRT_REDISTDIR="$with_ucrt_dir"
6667 if test $_os = "WINNT"; then
6668     find_msvc_x64_dlls
6669     find_msms
6670     MSVC_DLL_PATH="$msvcdllpath"
6671     MSVC_DLLS="$msvcdlls"
6672     MSM_PATH="$msmdir"
6673     # MSVC 15.3 changed it to VC141
6674     if echo "$MSVC_DLL_PATH" | grep -q "VC141.CRT$"; then
6675         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
6676     else
6677         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6678     fi
6679     if test "$UCRT_REDISTDIR" = "no"; then
6680         dnl explicitly disabled
6681         UCRT_REDISTDIR=""
6682     else
6683         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
6684                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
6685                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
6686                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
6687                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
6688                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
6689             UCRT_REDISTDIR=""
6690             if test -n "$PKGFORMAT"; then
6691                for i in $PKGFORMAT; do
6692                    case "$i" in
6693                    msi)
6694                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
6695                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
6696                        ;;
6697                    esac
6698                done
6699             fi
6700         fi
6701     fi
6704 AC_SUBST(UCRT_REDISTDIR)
6705 AC_SUBST(MSVC_DLL_PATH)
6706 AC_SUBST(MSVC_DLLS)
6707 AC_SUBST(MSM_PATH)
6709 dnl ===================================================================
6710 dnl Checks for Java
6711 dnl ===================================================================
6712 if test "$ENABLE_JAVA" != ""; then
6714     # Windows-specific tests
6715     if test "$build_os" = "cygwin"; then
6716         if test "$BITNESS_OVERRIDE" = 64; then
6717             bitness=64
6718         else
6719             bitness=32
6720         fi
6722         if test -z "$with_jdk_home"; then
6723             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
6724             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
6725             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
6726             if test -n "$regvalue"; then
6727                 ver=$regvalue
6728                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
6729                 _jdk_home=$regvalue
6730             fi
6731             if test -z "$with_jdk_home"; then
6732                 for ver in 1.8 1.7 1.6; do
6733                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6734                     if test -n "$regvalue"; then
6735                         _jdk_home=$regvalue
6736                         break
6737                     fi
6738                 done
6739             fi
6740             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6741                 with_jdk_home="$_jdk_home"
6742                 howfound="found automatically"
6743             else
6744                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6745             fi
6746         else
6747             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6748             howfound="you passed"
6749         fi
6750     fi
6752     # MacOS X: /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.
6753     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6754     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6755         with_jdk_home=`/usr/libexec/java_home`
6756     fi
6758     JAVA_HOME=; export JAVA_HOME
6759     if test -z "$with_jdk_home"; then
6760         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6761     else
6762         _java_path="$with_jdk_home/bin/$with_java"
6763         dnl Check if there is a Java interpreter at all.
6764         if test -x "$_java_path"; then
6765             JAVAINTERPRETER=$_java_path
6766         else
6767             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6768         fi
6769     fi
6771     dnl Check that the JDK found is correct architecture (at least 2 reasons to
6772     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
6773     dnl loaded by java to run JunitTests:
6774     if test "$build_os" = "cygwin"; then
6775         shortjdkhome=`cygpath -d "$with_jdk_home"`
6776         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
6777             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6778             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6779         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
6780             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6781             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6782         fi
6784         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6785             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6786         fi
6787         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6788     elif test "$cross_compiling" != "yes"; then
6789         case $CPUNAME in
6790             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
6791                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6792                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6793                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6794                 fi
6795                 ;;
6796             *) # assumption: everything else 32-bit
6797                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6798                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6799                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6800                 fi
6801                 ;;
6802         esac
6803     fi
6806 HAVE_JAVA9=
6807 dnl ===================================================================
6808 dnl Checks for JDK.
6809 dnl ===================================================================
6811 # Note that JAVA_HOME as for now always means the *build* platform's
6812 # JAVA_HOME. Whether all the complexity here actually is needed any
6813 # more or not, no idea.
6815 if test "$ENABLE_JAVA" != ""; then
6816     _gij_longver=0
6817     AC_MSG_CHECKING([the installed JDK])
6818     if test -n "$JAVAINTERPRETER"; then
6819         dnl java -version sends output to stderr!
6820         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6821             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6822         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6823             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6824         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6825             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6826         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6827             JDK=ibm
6829             dnl IBM JDK specific tests
6830             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6831             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6833             if test "$_jdk_ver" -lt 10600; then
6834                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
6835             fi
6837             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6839             if test "$with_jdk_home" = ""; then
6840                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6841 you must use the "--with-jdk-home" configure option explicitly])
6842             fi
6844             JAVA_HOME=$with_jdk_home
6845         else
6846             JDK=sun
6848             dnl Sun JDK specific tests
6849             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6850             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6852             if test "$_jdk_ver" -lt 10600; then
6853                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
6854             fi
6855             if test "$_jdk_ver" -gt 10600; then
6856                 JAVA_CLASSPATH_NOT_SET=TRUE
6857             fi
6858             if test "$_jdk_ver" -ge 10900; then
6859                 HAVE_JAVA9=TRUE
6860             fi
6862             AC_MSG_RESULT([checked (JDK $_jdk)])
6863             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6864             if test "$_os" = "WINNT"; then
6865                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6866             fi
6868             # set to limit VM usage for JunitTests
6869             JAVAIFLAGS=-Xmx64M
6870             # set to limit VM usage for javac
6871             JAVAFLAGS=-J-Xmx128M
6872         fi
6873     else
6874         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
6875     fi
6876 else
6877     dnl Java disabled
6878     JAVA_HOME=
6879     export JAVA_HOME
6882 dnl ===================================================================
6883 dnl Set target Java bytecode version
6884 dnl ===================================================================
6885 if test "$ENABLE_JAVA" != ""; then
6886     if test "$HAVE_JAVA9" = "TRUE"; then
6887         _java_target_ver="1.6"
6888     else
6889         _java_target_ver="1.5"
6890     fi
6891     JAVA_SOURCE_VER="$_java_target_ver"
6892     JAVA_TARGET_VER="$_java_target_ver"
6895 dnl ===================================================================
6896 dnl Checks for javac
6897 dnl ===================================================================
6898 if test "$ENABLE_JAVA" != ""; then
6899     javacompiler="javac"
6900     if test -z "$with_jdk_home"; then
6901         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6902     else
6903         _javac_path="$with_jdk_home/bin/$javacompiler"
6904         dnl Check if there is a Java compiler at all.
6905         if test -x "$_javac_path"; then
6906             JAVACOMPILER=$_javac_path
6907         fi
6908     fi
6909     if test -z "$JAVACOMPILER"; then
6910         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6911     fi
6912     if test "$build_os" = "cygwin"; then
6913         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6914             JAVACOMPILER="${JAVACOMPILER}.exe"
6915         fi
6916         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
6917     fi
6920 dnl ===================================================================
6921 dnl Checks for javadoc
6922 dnl ===================================================================
6923 if test "$ENABLE_JAVA" != ""; then
6924     if test -z "$with_jdk_home"; then
6925         AC_PATH_PROG(JAVADOC, javadoc)
6926     else
6927         _javadoc_path="$with_jdk_home/bin/javadoc"
6928         dnl Check if there is a javadoc at all.
6929         if test -x "$_javadoc_path"; then
6930             JAVADOC=$_javadoc_path
6931         else
6932             AC_PATH_PROG(JAVADOC, javadoc)
6933         fi
6934     fi
6935     if test -z "$JAVADOC"; then
6936         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6937     fi
6938     if test "$build_os" = "cygwin"; then
6939         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6940             JAVADOC="${JAVADOC}.exe"
6941         fi
6942         JAVADOC=`win_short_path_for_make "$JAVADOC"`
6943     fi
6945     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6946     JAVADOCISGJDOC="yes"
6947     fi
6949 AC_SUBST(JAVADOCISGJDOC)
6951 if test "$ENABLE_JAVA" != ""; then
6952     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
6953     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
6954         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
6955            # try to recover first by looking whether we have a alternatives
6956            # system as in Debian or newer SuSEs where following /usr/bin/javac
6957            # over /etc/alternatives/javac leads to the right bindir where we
6958            # just need to strip a bit away to get a valid JAVA_HOME
6959            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
6960         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
6961             # maybe only one level of symlink (e.g. on Mac)
6962             JAVA_HOME=$(readlink $JAVACOMPILER)
6963             if test "$(dirname $JAVA_HOME)" = "."; then
6964                 # we've got no path to trim back
6965                 JAVA_HOME=""
6966             fi
6967         else
6968             # else warn
6969             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
6970             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
6971             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
6972             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
6973         fi
6974         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
6975         if test "$JAVA_HOME" != "/usr"; then
6976             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6977                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
6978                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
6979                 dnl Tiger already returns a JDK path..
6980                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
6981             else
6982                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
6983                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
6984                 dnl that checks which version to run
6985                 if test -f "$JAVA_HOME"; then
6986                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
6987                 fi
6988             fi
6989         fi
6990     fi
6991     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
6993     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
6994     if test -z "$JAVA_HOME"; then
6995         if test "x$with_jdk_home" = "x"; then
6996             cat > findhome.java <<_ACEOF
6997 [import java.io.File;
6999 class findhome
7001     public static void main(String args[])
7002     {
7003         String jrelocation = System.getProperty("java.home");
7004         File jre = new File(jrelocation);
7005         System.out.println(jre.getParent());
7006     }
7008 _ACEOF
7009             AC_MSG_CHECKING([if javac works])
7010             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7011             AC_TRY_EVAL(javac_cmd)
7012             if test $? = 0 -a -f ./findhome.class; then
7013                 AC_MSG_RESULT([javac works])
7014             else
7015                 echo "configure: javac test failed" >&5
7016                 cat findhome.java >&5
7017                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7018             fi
7019             AC_MSG_CHECKING([if gij knows its java.home])
7020             JAVA_HOME=`$JAVAINTERPRETER findhome`
7021             if test $? = 0 -a "$JAVA_HOME" != ""; then
7022                 AC_MSG_RESULT([$JAVA_HOME])
7023             else
7024                 echo "configure: java test failed" >&5
7025                 cat findhome.java >&5
7026                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7027             fi
7028             # clean-up after ourselves
7029             rm -f ./findhome.java ./findhome.class
7030         else
7031             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7032         fi
7033     fi
7035     # now check if $JAVA_HOME is really valid
7036     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7037         case "${JAVA_HOME}" in
7038             /Library/Java/JavaVirtualMachines/*)
7039                 ;;
7040             *)
7041                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7042                 ;;
7043         esac
7044         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7045             JAVA_HOME_OK="NO"
7046         fi
7047     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7048         JAVA_HOME_OK="NO"
7049     fi
7050     if test "$JAVA_HOME_OK" = "NO"; then
7051         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7052         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7053         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
7054         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7055         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7056         add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
7057     fi
7058     PathFormat "$JAVA_HOME"
7059     JAVA_HOME="$formatted_path"
7062 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7063     "$_os" != Darwin
7064 then
7065     AC_MSG_CHECKING([for JAWT lib])
7066     if test "$_os" = WINNT; then
7067         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7068         JAWTLIB=jawt.lib
7069     else
7070         case "$host_cpu" in
7071         arm*)
7072             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7073             JAVA_ARCH=$my_java_arch
7074             ;;
7075         i*86)
7076             my_java_arch=i386
7077             ;;
7078         m68k)
7079             my_java_arch=m68k
7080             ;;
7081         powerpc)
7082             my_java_arch=ppc
7083             ;;
7084         powerpc64)
7085             my_java_arch=ppc64
7086             ;;
7087         powerpc64le)
7088             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7089             JAVA_ARCH=$my_java_arch
7090             ;;
7091         sparc64)
7092             my_java_arch=sparcv9
7093             ;;
7094         x86_64)
7095             my_java_arch=amd64
7096             ;;
7097         *)
7098             my_java_arch=$host_cpu
7099             ;;
7100         esac
7101         # This is where JDK9 puts the library
7102         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7103             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7104         else
7105             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7106         fi
7107         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7108     fi
7109     AC_MSG_RESULT([$JAWTLIB])
7111 AC_SUBST(JAWTLIB)
7113 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7114     case "$host_os" in
7116     aix*)
7117         JAVAINC="-I$JAVA_HOME/include"
7118         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7119         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7120         ;;
7122     cygwin*)
7123         JAVAINC="-I$JAVA_HOME/include/win32"
7124         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7125         ;;
7127     darwin*)
7128         if test -d "$JAVA_HOME/include/darwin"; then
7129             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7130         else
7131             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7132         fi
7133         ;;
7135     dragonfly*)
7136         JAVAINC="-I$JAVA_HOME/include"
7137         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7138         ;;
7140     freebsd*)
7141         JAVAINC="-I$JAVA_HOME/include"
7142         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7143         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7144         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7145         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7146         ;;
7148     k*bsd*-gnu*)
7149         JAVAINC="-I$JAVA_HOME/include"
7150         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7151         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7152         ;;
7154     linux-gnu*)
7155         JAVAINC="-I$JAVA_HOME/include"
7156         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7157         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7158         ;;
7160     *netbsd*)
7161         JAVAINC="-I$JAVA_HOME/include"
7162         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7163         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7164        ;;
7166     openbsd*)
7167         JAVAINC="-I$JAVA_HOME/include"
7168         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7169         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7170         ;;
7172     solaris*)
7173         JAVAINC="-I$JAVA_HOME/include"
7174         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7175         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7176         ;;
7177     esac
7179 SOLARINC="$SOLARINC $JAVAINC"
7181 AC_SUBST(JAVACOMPILER)
7182 AC_SUBST(JAVADOC)
7183 AC_SUBST(JAVAINTERPRETER)
7184 AC_SUBST(JAVAIFLAGS)
7185 AC_SUBST(JAVAFLAGS)
7186 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7187 AC_SUBST(JAVA_HOME)
7188 AC_SUBST(JAVA_SOURCE_VER)
7189 AC_SUBST(JAVA_TARGET_VER)
7190 AC_SUBST(JDK)
7193 dnl ===================================================================
7194 dnl Export file validation
7195 dnl ===================================================================
7196 AC_MSG_CHECKING([whether to enable export file validation])
7197 if test "$with_export_validation" != "no"; then
7198     if test -z "$ENABLE_JAVA"; then
7199         if test "$with_export_validation" = "yes"; then
7200             AC_MSG_ERROR([requested, but Java is disabled])
7201         else
7202             AC_MSG_RESULT([no, as Java is disabled])
7203         fi
7204     elif test "$_jdk_ver" -lt 10800; then
7205         if test "$with_export_validation" = "yes"; then
7206             AC_MSG_ERROR([requested, but Java is too old, need Java 8])
7207         else
7208             AC_MSG_RESULT([no, as Java is too old, need Java 8])
7209         fi
7210     else
7211         AC_MSG_RESULT([yes])
7212         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7214         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7215         if test -z "$ODFVALIDATOR"; then
7216             # remember to download the ODF toolkit with validator later
7217             AC_MSG_NOTICE([no odfvalidator found, will download it])
7218             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7219             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7221             # and fetch name of odfvalidator jar name from download.lst
7222             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7223             AC_SUBST(ODFVALIDATOR_JAR)
7225             if test -z "$ODFVALIDATOR_JAR"; then
7226                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7227             fi
7228         fi
7229         if test "$build_os" = "cygwin"; then
7230             # In case of Cygwin it will be executed from Windows,
7231             # so we need to run bash and absolute path to validator
7232             # so instead of "odfvalidator" it will be
7233             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7234             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7235         else
7236             ODFVALIDATOR="sh $ODFVALIDATOR"
7237         fi
7238         AC_SUBST(ODFVALIDATOR)
7241         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7242         if test -z "$OFFICEOTRON"; then
7243             # remember to download the officeotron with validator later
7244             AC_MSG_NOTICE([no officeotron found, will download it])
7245             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7246             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7248             # and fetch name of officeotron jar name from download.lst
7249             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7250             AC_SUBST(OFFICEOTRON_JAR)
7252             if test -z "$OFFICEOTRON_JAR"; then
7253                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7254             fi
7255         else
7256             # check version of existing officeotron
7257             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7258             if test 0"$OFFICEOTRON_VER" -lt 704; then
7259                 AC_MSG_ERROR([officeotron too old])
7260             fi
7261         fi
7262         if test "$build_os" = "cygwin"; then
7263             # In case of Cygwin it will be executed from Windows,
7264             # so we need to run bash and absolute path to validator
7265             # so instead of "odfvalidator" it will be
7266             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7267             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7268         else
7269             OFFICEOTRON="sh $OFFICEOTRON"
7270         fi
7271     fi
7272     AC_SUBST(OFFICEOTRON)
7273 else
7274     AC_MSG_RESULT([no])
7277 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7278 if test "$with_bffvalidator" != "no"; then
7279     AC_DEFINE(HAVE_BFFVALIDATOR)
7281     if test "$with_export_validation" = "no"; then
7282         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7283     fi
7285     if test "$with_bffvalidator" = "yes"; then
7286         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7287     else
7288         BFFVALIDATOR="$with_bffvalidator"
7289     fi
7291     if test "$build_os" = "cygwin"; then
7292         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7293             AC_MSG_RESULT($BFFVALIDATOR)
7294         else
7295             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7296         fi
7297     elif test -n "$BFFVALIDATOR"; then
7298         # We are not in Cygwin but need to run Windows binary with wine
7299         AC_PATH_PROGS(WINE, wine)
7301         # so swap in a shell wrapper that converts paths transparently
7302         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7303         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7304         AC_SUBST(BFFVALIDATOR_EXE)
7305         AC_MSG_RESULT($BFFVALIDATOR)
7306     else
7307         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7308     fi
7309     AC_SUBST(BFFVALIDATOR)
7310 else
7311     AC_MSG_RESULT([no])
7314 dnl ===================================================================
7315 dnl Check for C preprocessor to use
7316 dnl ===================================================================
7317 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7318 if test -n "$with_idlc_cpp"; then
7319     AC_MSG_RESULT([$with_idlc_cpp])
7320     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7321 else
7322     AC_MSG_RESULT([ucpp])
7323     AC_MSG_CHECKING([which ucpp tp use])
7324     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7325         AC_MSG_RESULT([external])
7326         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7327     else
7328         AC_MSG_RESULT([internal])
7329         BUILD_TYPE="$BUILD_TYPE UCPP"
7330     fi
7332 AC_SUBST(SYSTEM_UCPP)
7334 dnl ===================================================================
7335 dnl Check for epm (not needed for Windows)
7336 dnl ===================================================================
7337 AC_MSG_CHECKING([whether to enable EPM for packing])
7338 if test "$enable_epm" = "yes"; then
7339     AC_MSG_RESULT([yes])
7340     if test "$_os" != "WINNT"; then
7341         if test $_os = Darwin; then
7342             EPM=internal
7343         elif test -n "$with_epm"; then
7344             EPM=$with_epm
7345         else
7346             AC_PATH_PROG(EPM, epm, no)
7347         fi
7348         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7349             AC_MSG_NOTICE([EPM will be built.])
7350             BUILD_TYPE="$BUILD_TYPE EPM"
7351             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7352         else
7353             # Gentoo has some epm which is something different...
7354             AC_MSG_CHECKING([whether the found epm is the right epm])
7355             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7356                 AC_MSG_RESULT([yes])
7357             else
7358                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7359             fi
7360             AC_MSG_CHECKING([epm version])
7361             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7362             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7363                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7364                 AC_MSG_RESULT([OK, >= 3.7])
7365             else
7366                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7367                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7368             fi
7369         fi
7370     fi
7372     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7373         AC_MSG_CHECKING([for rpm])
7374         for a in "$RPM" rpmbuild rpm; do
7375             $a --usage >/dev/null 2> /dev/null
7376             if test $? -eq 0; then
7377                 RPM=$a
7378                 break
7379             else
7380                 $a --version >/dev/null 2> /dev/null
7381                 if test $? -eq 0; then
7382                     RPM=$a
7383                     break
7384                 fi
7385             fi
7386         done
7387         if test -z "$RPM"; then
7388             AC_MSG_ERROR([not found])
7389         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7390             RPM_PATH=`which $RPM`
7391             AC_MSG_RESULT([$RPM_PATH])
7392             SCPDEFS="$SCPDEFS -DWITH_RPM"
7393         else
7394             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7395         fi
7396     fi
7397     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7398         AC_PATH_PROG(DPKG, dpkg, no)
7399         if test "$DPKG" = "no"; then
7400             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7401         fi
7402     fi
7403     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7404        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7405         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7406             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7407                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7408                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7409                     AC_MSG_RESULT([yes])
7410                 else
7411                     AC_MSG_RESULT([no])
7412                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7413                         _pt="rpm"
7414                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7415                         add_warning "the rpms will need to be installed with --nodeps"
7416                     else
7417                         _pt="pkg"
7418                     fi
7419                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7420                     add_warning "the ${_pt}s will not be relocatable"
7421                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7422                                  relocation will work, you need to patch your epm with the
7423                                  patch in epm/epm-3.7.patch or build with
7424                                  --with-epm=internal which will build a suitable epm])
7425                 fi
7426             fi
7427         fi
7428     fi
7429     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7430         AC_PATH_PROG(PKGMK, pkgmk, no)
7431         if test "$PKGMK" = "no"; then
7432             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7433         fi
7434     fi
7435     AC_SUBST(RPM)
7436     AC_SUBST(DPKG)
7437     AC_SUBST(PKGMK)
7438 else
7439     for i in $PKGFORMAT; do
7440         case "$i" in
7441         aix | bsd | deb | pkg | rpm | native | portable)
7442             AC_MSG_ERROR(
7443                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7444             ;;
7445         esac
7446     done
7447     AC_MSG_RESULT([no])
7448     EPM=NO
7450 AC_SUBST(EPM)
7452 ENABLE_LWP=
7453 if test "$enable_lotuswordpro" = "yes"; then
7454     ENABLE_LWP="TRUE"
7456 AC_SUBST(ENABLE_LWP)
7458 dnl ===================================================================
7459 dnl Check for building ODK
7460 dnl ===================================================================
7461 if test "$enable_odk" = no; then
7462     unset DOXYGEN
7463 else
7464     if test "$with_doxygen" = no; then
7465         AC_MSG_CHECKING([for doxygen])
7466         unset DOXYGEN
7467         AC_MSG_RESULT([no])
7468     else
7469         if test "$with_doxygen" = yes; then
7470             AC_PATH_PROG([DOXYGEN], [doxygen])
7471             if test -z "$DOXYGEN"; then
7472                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7473             fi
7474             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
7475                 if ! dot -V 2>/dev/null; then
7476                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
7477                 fi
7478             fi
7479         else
7480             AC_MSG_CHECKING([for doxygen])
7481             DOXYGEN=$with_doxygen
7482             AC_MSG_RESULT([$DOXYGEN])
7483         fi
7484         if test -n "$DOXYGEN"; then
7485             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7486             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7487             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7488                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7489             fi
7490         fi
7491     fi
7493 AC_SUBST([DOXYGEN])
7495 AC_MSG_CHECKING([whether to build the ODK])
7496 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7497     AC_MSG_RESULT([yes])
7499     if test "$with_java" != "no"; then
7500         AC_MSG_CHECKING([whether to build unowinreg.dll])
7501         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7502             # build on Win by default
7503             enable_build_unowinreg=yes
7504         fi
7505         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7506             AC_MSG_RESULT([no])
7507             BUILD_UNOWINREG=
7508         else
7509             AC_MSG_RESULT([yes])
7510             BUILD_UNOWINREG=TRUE
7511         fi
7512         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7513             if test -z "$with_mingw_cross_compiler"; then
7514                 dnl Guess...
7515                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7516             elif test -x "$with_mingw_cross_compiler"; then
7517                  MINGWCXX="$with_mingw_cross_compiler"
7518             else
7519                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7520             fi
7522             if test "$MINGWCXX" = "false"; then
7523                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7524             fi
7526             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7527             if test -x "$mingwstrip_test"; then
7528                 MINGWSTRIP="$mingwstrip_test"
7529             else
7530                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7531             fi
7533             if test "$MINGWSTRIP" = "false"; then
7534                 AC_MSG_ERROR(MinGW32 binutils not found.)
7535             fi
7536         fi
7537     fi
7538     BUILD_TYPE="$BUILD_TYPE ODK"
7539 else
7540     AC_MSG_RESULT([no])
7541     BUILD_UNOWINREG=
7543 AC_SUBST(BUILD_UNOWINREG)
7544 AC_SUBST(MINGWCXX)
7545 AC_SUBST(MINGWSTRIP)
7547 dnl ===================================================================
7548 dnl Check for system zlib
7549 dnl ===================================================================
7550 if test "$with_system_zlib" = "auto"; then
7551     case "$_os" in
7552     WINNT)
7553         with_system_zlib="$with_system_libs"
7554         ;;
7555     *)
7556         if test "$enable_fuzzers" != "yes"; then
7557             with_system_zlib=yes
7558         else
7559             with_system_zlib=no
7560         fi
7561         ;;
7562     esac
7565 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7566 dnl and has no pkg-config for it at least on some tinderboxes,
7567 dnl so leaving that out for now
7568 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7569 AC_MSG_CHECKING([which zlib to use])
7570 if test "$with_system_zlib" = "yes"; then
7571     AC_MSG_RESULT([external])
7572     SYSTEM_ZLIB=TRUE
7573     AC_CHECK_HEADER(zlib.h, [],
7574         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7575     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7576         [AC_MSG_ERROR(zlib not found or functional)], [])
7577 else
7578     AC_MSG_RESULT([internal])
7579     SYSTEM_ZLIB=
7580     BUILD_TYPE="$BUILD_TYPE ZLIB"
7581     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7582     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7584 AC_SUBST(ZLIB_CFLAGS)
7585 AC_SUBST(ZLIB_LIBS)
7586 AC_SUBST(SYSTEM_ZLIB)
7588 dnl ===================================================================
7589 dnl Check for system jpeg
7590 dnl ===================================================================
7591 AC_MSG_CHECKING([which libjpeg to use])
7592 if test "$with_system_jpeg" = "yes"; then
7593     AC_MSG_RESULT([external])
7594     SYSTEM_LIBJPEG=TRUE
7595     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7596         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7597     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7598         [AC_MSG_ERROR(jpeg library not found or fuctional)], [])
7599 else
7600     SYSTEM_LIBJPEG=
7601     AC_MSG_RESULT([internal, libjpeg-turbo])
7602     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
7603     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
7604     if test "$COM" = "MSC"; then
7605         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
7606     else
7607         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
7608     fi
7610     case "$host_cpu" in
7611     x86_64 | amd64 | i*86 | x86 | ia32)
7612         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7613         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7614             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7615                 NASM="$LODE_HOME/opt/bin/nasm"
7616             elif test -x "/opt/lo/bin/nasm"; then
7617                 NASM="/opt/lo/bin/nasm"
7618             fi
7619         fi
7621         if test -n "$NASM"; then
7622             AC_MSG_CHECKING([for object file format of host system])
7623             case "$host_os" in
7624               cygwin* | mingw* | pw32* | interix*)
7625                 case "$host_cpu" in
7626                   x86_64)
7627                     objfmt='Win64-COFF'
7628                     ;;
7629                   *)
7630                     objfmt='Win32-COFF'
7631                     ;;
7632                 esac
7633               ;;
7634               msdosdjgpp* | go32*)
7635                 objfmt='COFF'
7636               ;;
7637               os2-emx*)                 # not tested
7638                 objfmt='MSOMF'          # obj
7639               ;;
7640               linux*coff* | linux*oldld*)
7641                 objfmt='COFF'           # ???
7642               ;;
7643               linux*aout*)
7644                 objfmt='a.out'
7645               ;;
7646               linux*)
7647                 case "$host_cpu" in
7648                   x86_64)
7649                     objfmt='ELF64'
7650                     ;;
7651                   *)
7652                     objfmt='ELF'
7653                     ;;
7654                 esac
7655               ;;
7656               kfreebsd* | freebsd* | netbsd* | openbsd*)
7657                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
7658                   objfmt='BSD-a.out'
7659                 else
7660                   case "$host_cpu" in
7661                     x86_64 | amd64)
7662                       objfmt='ELF64'
7663                       ;;
7664                     *)
7665                       objfmt='ELF'
7666                       ;;
7667                   esac
7668                 fi
7669               ;;
7670               solaris* | sunos* | sysv* | sco*)
7671                 case "$host_cpu" in
7672                   x86_64)
7673                     objfmt='ELF64'
7674                     ;;
7675                   *)
7676                     objfmt='ELF'
7677                     ;;
7678                 esac
7679               ;;
7680               darwin* | rhapsody* | nextstep* | openstep* | macos*)
7681                 case "$host_cpu" in
7682                   x86_64)
7683                     objfmt='Mach-O64'
7684                     ;;
7685                   *)
7686                     objfmt='Mach-O'
7687                     ;;
7688                 esac
7689               ;;
7690               *)
7691                 objfmt='ELF ?'
7692               ;;
7693             esac
7695             AC_MSG_RESULT([$objfmt])
7696             if test "$objfmt" = 'ELF ?'; then
7697               objfmt='ELF'
7698               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
7699             fi
7701             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
7702             case "$objfmt" in
7703               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
7704               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
7705               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
7706               COFF)       NAFLAGS='-fcoff -DCOFF';;
7707               a.out)      NAFLAGS='-faout -DAOUT';;
7708               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
7709               ELF)        NAFLAGS='-felf -DELF';;
7710               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
7711               RDF)        NAFLAGS='-frdf -DRDF';;
7712               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
7713               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
7714             esac
7715             AC_MSG_RESULT([$NAFLAGS])
7717             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
7718             cat > conftest.asm << EOF
7719             [%line __oline__ "configure"
7720                     section .text
7721                     global  _main,main
7722             _main:
7723             main:   xor     eax,eax
7724                     ret
7725             ]
7727             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
7728             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
7729               AC_MSG_RESULT(yes)
7730             else
7731               echo "configure: failed program was:" >&AC_FD_CC
7732               cat conftest.asm >&AC_FD_CC
7733               rm -rf conftest*
7734               AC_MSG_RESULT(no)
7735               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
7736               NASM=""
7737             fi
7739         fi
7741         if test -z "$NASM"; then
7742 cat << _EOS
7743 ****************************************************************************
7744 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
7745 To get one please:
7747 _EOS
7748             if test "$build_os" = "cygwin"; then
7749 cat << _EOS
7750 install a pre-compiled binary for Win32
7752 mkdir -p /opt/lo/bin
7753 cd /opt/lo/bin
7754 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7755 chmod +x nasm
7757 or get and install one from http://www.nasm.us/
7759 Then re-run autogen.sh
7761 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7762 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7764 _EOS
7765             else
7766 cat << _EOS
7767 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
7769 _EOS
7770             fi
7771             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
7772             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
7773         fi
7774       ;;
7775     esac
7778 AC_SUBST(NASM)
7779 AC_SUBST(LIBJPEG_CFLAGS)
7780 AC_SUBST(LIBJPEG_LIBS)
7781 AC_SUBST(SYSTEM_LIBJPEG)
7783 dnl ===================================================================
7784 dnl Check for system clucene
7785 dnl ===================================================================
7786 dnl we should rather be using
7787 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7788 dnl but the contribs-lib check seems tricky
7789 AC_MSG_CHECKING([which clucene to use])
7790 if test "$with_system_clucene" = "yes"; then
7791     AC_MSG_RESULT([external])
7792     SYSTEM_CLUCENE=TRUE
7793     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7794     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7795     FilterLibs "${CLUCENE_LIBS}"
7796     CLUCENE_LIBS="${filteredlibs}"
7797     AC_LANG_PUSH([C++])
7798     save_CXXFLAGS=$CXXFLAGS
7799     save_CPPFLAGS=$CPPFLAGS
7800     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7801     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7802     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7803     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7804     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7805                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7806     CXXFLAGS=$save_CXXFLAGS
7807     CPPFLAGS=$save_CPPFLAGS
7808     AC_LANG_POP([C++])
7810     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7811 else
7812     AC_MSG_RESULT([internal])
7813     SYSTEM_CLUCENE=
7814     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7816 AC_SUBST(SYSTEM_CLUCENE)
7817 AC_SUBST(CLUCENE_CFLAGS)
7818 AC_SUBST(CLUCENE_LIBS)
7820 dnl ===================================================================
7821 dnl Check for system expat
7822 dnl ===================================================================
7823 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
7825 dnl ===================================================================
7826 dnl Check for system xmlsec
7827 dnl ===================================================================
7828 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24])
7830 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7831 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7832     ENABLE_EOT="TRUE"
7833     AC_DEFINE([ENABLE_EOT])
7834     AC_MSG_RESULT([yes])
7836     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7837 else
7838     ENABLE_EOT=
7839     AC_MSG_RESULT([no])
7841 AC_SUBST([ENABLE_EOT])
7843 dnl ===================================================================
7844 dnl Check for DLP libs
7845 dnl ===================================================================
7846 AS_IF([test "$COM" = "MSC"],
7847       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7848       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7850 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7852 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7854 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
7856 AS_IF([test "$COM" = "MSC"],
7857       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7858       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7860 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7862 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7864 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7865 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.9])
7867 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7869 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7871 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7873 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
7874 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.14])
7876 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
7877 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
7879 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7881 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
7882 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
7884 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7886 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7888 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
7890 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
7892 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
7893 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
7895 dnl ===================================================================
7896 dnl Check for system lcms2
7897 dnl ===================================================================
7898 if test "$with_system_lcms2" != "yes"; then
7899     SYSTEM_LCMS2=
7901 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7902 if test "$GCC" = "yes"; then
7903     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7905 if test "$COM" = "MSC"; then # override the above
7906     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7909 dnl ===================================================================
7910 dnl Check for system cppunit
7911 dnl ===================================================================
7912 if test "$cross_compiling" != "yes"; then
7913     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
7916 dnl ===================================================================
7917 dnl Check whether freetype is available
7918 dnl ===================================================================
7919 if test  "$test_freetype" = "yes"; then
7920     AC_MSG_CHECKING([whether freetype is available])
7921     # FreeType has 3 different kinds of versions
7922     # * release, like 2.4.10
7923     # * libtool, like 13.0.7 (this what pkg-config returns)
7924     # * soname
7925     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7926     #
7927     # 9.9.3 is 2.2.0
7928     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7929     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7930     FilterLibs "${FREETYPE_LIBS}"
7931     FREETYPE_LIBS="${filteredlibs}"
7932     SYSTEM_FREETYPE=TRUE
7933 else
7934     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
7935     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
7937 AC_SUBST(FREETYPE_CFLAGS)
7938 AC_SUBST(FREETYPE_LIBS)
7939 AC_SUBST([SYSTEM_FREETYPE])
7941 # ===================================================================
7942 # Check for system libxslt
7943 # to prevent incompatibilities between internal libxml2 and external libxslt,
7944 # or vice versa, use with_system_libxml here
7945 # ===================================================================
7946 if test "$with_system_libxml" = "auto"; then
7947     case "$_os" in
7948     WINNT|iOS|Android)
7949         with_system_libxml="$with_system_libs"
7950         ;;
7951     *)
7952         if test "$enable_fuzzers" != "yes"; then
7953             with_system_libxml=yes
7954         else
7955             with_system_libxml=no
7956         fi
7957         ;;
7958     esac
7961 AC_MSG_CHECKING([which libxslt to use])
7962 if test "$with_system_libxml" = "yes"; then
7963     AC_MSG_RESULT([external])
7964     SYSTEM_LIBXSLT=TRUE
7965     if test "$_os" = "Darwin"; then
7966         dnl make sure to use SDK path
7967         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7968         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7969         dnl omit -L/usr/lib
7970         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7971         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7972     else
7973         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7974         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7975         FilterLibs "${LIBXSLT_LIBS}"
7976         LIBXSLT_LIBS="${filteredlibs}"
7977         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7978         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7979         FilterLibs "${LIBEXSLT_LIBS}"
7980         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
7981     fi
7983     dnl Check for xsltproc
7984     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7985     if test "$XSLTPROC" = "no"; then
7986         AC_MSG_ERROR([xsltproc is required])
7987     fi
7988 else
7989     AC_MSG_RESULT([internal])
7990     SYSTEM_LIBXSLT=
7991     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
7993     if test "$cross_compiling" = "yes"; then
7994         AC_PATH_PROG(XSLTPROC, xsltproc, no)
7995         if test "$XSLTPROC" = "no"; then
7996             AC_MSG_ERROR([xsltproc is required])
7997         fi
7998     fi
8000 AC_SUBST(SYSTEM_LIBXSLT)
8001 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8002     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8004 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8006 AC_SUBST(LIBEXSLT_CFLAGS)
8007 AC_SUBST(LIBEXSLT_LIBS)
8008 AC_SUBST(LIBXSLT_CFLAGS)
8009 AC_SUBST(LIBXSLT_LIBS)
8010 AC_SUBST(XSLTPROC)
8012 # ===================================================================
8013 # Check for system libxml
8014 # ===================================================================
8015 AC_MSG_CHECKING([which libxml to use])
8016 if test "$with_system_libxml" = "yes"; then
8017     AC_MSG_RESULT([external])
8018     SYSTEM_LIBXML=TRUE
8019     if test "$_os" = "Darwin"; then
8020         dnl make sure to use SDK path
8021         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8022         dnl omit -L/usr/lib
8023         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8024     elif test $_os = iOS; then
8025         dnl make sure to use SDK path
8026         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8027         LIBXML_CFLAGS="-I$usr/include/libxml2"
8028         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8029     else
8030         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8031         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8032         FilterLibs "${LIBXML_LIBS}"
8033         LIBXML_LIBS="${filteredlibs}"
8034     fi
8036     dnl Check for xmllint
8037     AC_PATH_PROG(XMLLINT, xmllint, no)
8038     if test "$XMLLINT" = "no"; then
8039         AC_MSG_ERROR([xmllint is required])
8040     fi
8041 else
8042     AC_MSG_RESULT([internal])
8043     SYSTEM_LIBXML=
8044     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8045     if test "$COM" = "MSC"; then
8046         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8047     fi
8048     if test "$COM" = "MSC"; then
8049         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8050     else
8051         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8052     fi
8053     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8055 AC_SUBST(SYSTEM_LIBXML)
8056 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8057     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8059 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8060 AC_SUBST(LIBXML_CFLAGS)
8061 AC_SUBST(LIBXML_LIBS)
8062 AC_SUBST(XMLLINT)
8064 # =====================================================================
8065 # Checking for a Python interpreter with version >= 2.7.
8066 # Build and runtime requires Python 3 compatible version (>= 2.7).
8067 # Optionally user can pass an option to configure, i. e.
8068 # ./configure PYTHON=/usr/bin/python
8069 # =====================================================================
8070 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8071     # This allows a lack of system python with no error, we use internal one in that case.
8072     AM_PATH_PYTHON([2.7],, [:])
8073     # Clean PYTHON_VERSION checked below if cross-compiling
8074     PYTHON_VERSION=""
8075     if test "$PYTHON" != ":"; then
8076         PYTHON_FOR_BUILD=$PYTHON
8077     fi
8079 AC_SUBST(PYTHON_FOR_BUILD)
8081 # Checks for Python to use for Pyuno
8082 AC_MSG_CHECKING([which Python to use for Pyuno])
8083 case "$enable_python" in
8084 no|disable)
8085     if test -z $PYTHON_FOR_BUILD; then
8086         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8087         # requirement from the choice whether to include Python stuff in the installer, but why
8088         # bother?
8089         AC_MSG_ERROR([Python is required at build time.])
8090     fi
8091     enable_python=no
8092     AC_MSG_RESULT([none])
8093     ;;
8094 ""|yes|auto)
8095     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8096         AC_MSG_RESULT([no, overridden by --disable-scripting])
8097         enable_python=no
8098     elif test $build_os = cygwin; then
8099         dnl When building on Windows we don't attempt to use any installed
8100         dnl "system"  Python.
8101         AC_MSG_RESULT([fully internal])
8102         enable_python=internal
8103     elif test "$cross_compiling" = yes; then
8104         AC_MSG_RESULT([system])
8105         enable_python=system
8106     else
8107         # Unset variables set by the above AM_PATH_PYTHON so that
8108         # we actually do check anew.
8109         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
8110         AM_PATH_PYTHON([3.3],, [:])
8111         if test "$PYTHON" = ":"; then
8112             if test -z "$PYTHON_FOR_BUILD"; then
8113                 AC_MSG_RESULT([fully internal])
8114             else
8115                 AC_MSG_RESULT([internal])
8116             fi
8117             enable_python=internal
8118         else
8119             AC_MSG_RESULT([system])
8120             enable_python=system
8121         fi
8122     fi
8123     ;;
8124 internal)
8125     AC_MSG_RESULT([internal])
8126     ;;
8127 fully-internal)
8128     AC_MSG_RESULT([fully internal])
8129     enable_python=internal
8130     ;;
8131 system)
8132     AC_MSG_RESULT([system])
8133     ;;
8135     AC_MSG_ERROR([Incorrect --enable-python option])
8136     ;;
8137 esac
8139 if test $enable_python != no; then
8140     BUILD_TYPE="$BUILD_TYPE PYUNO"
8143 if test $enable_python = system; then
8144     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8145         python_version=2.7
8146         PYTHON=python$python_version
8147         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
8148             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
8149             PYTHON_LIBS="-framework Python"
8150         else
8151             PYTHON_CFLAGS="`$PYTHON-config --includes`"
8152             PYTHON_LIBS="`$PYTHON-config --libs`"
8153         fi
8154     fi
8155     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8156         # Fallback: Accept these in the environment, or as set above
8157         # for MacOSX.
8158         :
8159     elif test "$cross_compiling" != yes; then
8160         # Unset variables set by the above AM_PATH_PYTHON so that
8161         # we actually do check anew.
8162         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
8163         # This causes an error if no python command is found
8164         AM_PATH_PYTHON([3.3])
8165         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8166         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8167         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8168         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8169         if test -z "$PKG_CONFIG"; then
8170             PYTHON_CFLAGS="-I$python_include"
8171             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8172         elif $PKG_CONFIG --exists python-$python_version; then
8173             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8174             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8175         else
8176             PYTHON_CFLAGS="-I$python_include"
8177             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8178         fi
8179         FilterLibs "${PYTHON_LIBS}"
8180         PYTHON_LIBS="${filteredlibs}"
8181     else
8182         dnl How to find out the cross-compilation Python installation path?
8183         AC_MSG_CHECKING([for python version])
8184         AS_IF([test -n "$PYTHON_VERSION"],
8185               [AC_MSG_RESULT([$PYTHON_VERSION])],
8186               [AC_MSG_RESULT([not found])
8187                AC_MSG_ERROR([no usable python found])])
8188         test -n "$PYTHON_CFLAGS" && break
8189     fi
8191     dnl Check if the headers really work
8192     save_CPPFLAGS="$CPPFLAGS"
8193     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8194     AC_CHECK_HEADER(Python.h)
8195     CPPFLAGS="$save_CPPFLAGS"
8197     # let the PYTHON_FOR_BUILD match the same python installation that
8198     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8199     # better for PythonTests.
8200     PYTHON_FOR_BUILD=$PYTHON
8203 if test "$with_lxml" != no; then
8204     if test -z "$PYTHON_FOR_BUILD"; then
8205         case $build_os in
8206             cygwin)
8207                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8208                 ;;
8209             *)
8210                 if test "$cross_compiling" != yes ; then
8211                     BUILD_TYPE="$BUILD_TYPE LXML"
8212                 fi
8213                 ;;
8214         esac
8215     else
8216         AC_MSG_CHECKING([for python lxml])
8217         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8218             AC_MSG_RESULT([yes])
8219         else
8220             case $build_os in
8221                 cygwin)
8222                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8223                     ;;
8224                 *)
8225                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8226                         BUILD_TYPE="$BUILD_TYPE LXML"
8227                         AC_MSG_RESULT([no, using internal lxml])
8228                     else
8229                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8230                     fi
8231                     ;;
8232             esac
8233         fi
8234     fi
8237 dnl By now enable_python should be "system", "internal" or "no"
8238 case $enable_python in
8239 system)
8240     SYSTEM_PYTHON=TRUE
8242     if test "x$ac_cv_header_Python_h" != "xyes"; then
8243        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8244     fi
8246     AC_LANG_PUSH(C)
8247     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8248     AC_MSG_CHECKING([for correct python library version])
8249        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8250 #include <Python.h>
8252 int main(int argc, char **argv) {
8253    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8254        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8255    else return 1;
8257        ]])],[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])])
8258     CFLAGS=$save_CFLAGS
8259     AC_LANG_POP(C)
8261     dnl FIXME Check if the Python library can be linked with, too?
8262     ;;
8264 internal)
8265     SYSTEM_PYTHON=
8266     PYTHON_VERSION_MAJOR=3
8267     PYTHON_VERSION_MINOR=5
8268     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.4
8269     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8270         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8271     fi
8272     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8273     BUILD_TYPE="$BUILD_TYPE PYTHON"
8274     # Embedded Python dies without Home set
8275     if test "$HOME" = ""; then
8276         export HOME=""
8277     fi
8278     ;;
8280     DISABLE_PYTHON=TRUE
8281     SYSTEM_PYTHON=
8282     ;;
8284     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8285     ;;
8286 esac
8288 AC_SUBST(DISABLE_PYTHON)
8289 AC_SUBST(SYSTEM_PYTHON)
8290 AC_SUBST(PYTHON_CFLAGS)
8291 AC_SUBST(PYTHON_LIBS)
8292 AC_SUBST(PYTHON_VERSION)
8293 AC_SUBST(PYTHON_VERSION_MAJOR)
8294 AC_SUBST(PYTHON_VERSION_MINOR)
8296 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8297 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8298     AC_MSG_RESULT([yes])
8299     ENABLE_MARIADBC=TRUE
8300     MARIADBC_MAJOR=1
8301     MARIADBC_MINOR=0
8302     MARIADBC_MICRO=2
8303     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8304 else
8305     AC_MSG_RESULT([no])
8306     ENABLE_MARIADBC=
8308 AC_SUBST(ENABLE_MARIADBC)
8309 AC_SUBST(MARIADBC_MAJOR)
8310 AC_SUBST(MARIADBC_MINOR)
8311 AC_SUBST(MARIADBC_MICRO)
8313 if test "$ENABLE_MARIADBC" = "TRUE"; then
8315     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8317     dnl ===================================================================
8318     dnl Check for system MariaDB
8319     dnl ===================================================================
8320     AC_MSG_CHECKING([which MariaDB to use])
8321     if test "$with_system_mariadb" = "yes"; then
8322         AC_MSG_RESULT([external])
8323         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8324         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8325         if test -z "$MARIADBCONFIG"; then
8326             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8327             if test -z "$MARIADBCONFIG"; then
8328                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8329                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8330             fi
8331         fi
8332         AC_MSG_CHECKING([MariaDB version])
8333         MARIADB_VERSION=`$MARIADBCONFIG --version`
8334         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8335         if test "$MARIADB_MAJOR" -ge "5"; then
8336             AC_MSG_RESULT([OK])
8337         else
8338             AC_MSG_ERROR([too old, use 5.0.x or later])
8339         fi
8340         AC_MSG_CHECKING([for MariaDB Client library])
8341         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8342         if test "$COM_IS_CLANG" = TRUE; then
8343             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8344         fi
8345         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8346         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8347         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8348         dnl linux32:
8349         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8350             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8351             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8352                 | sed -e 's|/lib64/|/lib/|')
8353         fi
8354         FilterLibs "${MARIADB_LIBS}"
8355         MARIADB_LIBS="${filteredlibs}"
8356         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8357         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8358         if test "$enable_bundle_mariadb" = "yes"; then
8359             AC_MSG_RESULT([yes])
8360             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8361             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8363 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8365 /g' | grep -E '(mysqlclient|mariadb)')
8366             if test "$_os" = "Darwin"; then
8367                 LIBMARIADB=${LIBMARIADB}.dylib
8368             elif test "$_os" = "WINNT"; then
8369                 LIBMARIADB=${LIBMARIADB}.dll
8370             else
8371                 LIBMARIADB=${LIBMARIADB}.so
8372             fi
8373             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8374             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8375             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8376                 AC_MSG_RESULT([found.])
8377                 PathFormat "$LIBMARIADB_PATH"
8378                 LIBMARIADB_PATH="$formatted_path"
8379             else
8380                 AC_MSG_ERROR([not found.])
8381             fi
8382         else
8383             AC_MSG_RESULT([no])
8384             BUNDLE_MARIADB_CONNECTOR_C=
8385         fi
8386     else
8387         AC_MSG_RESULT([internal])
8388         SYSTEM_MARIADB_CONNECTOR_C=
8389         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8390         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8391         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8392     fi
8394     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8395     AC_SUBST(MARIADB_CFLAGS)
8396     AC_SUBST(MARIADB_LIBS)
8397     AC_SUBST(LIBMARIADB)
8398     AC_SUBST(LIBMARIADB_PATH)
8399     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8401     AC_LANG_PUSH([C++])
8402     dnl ===================================================================
8403     dnl Check for system MySQL C++ Connector
8404     dnl ===================================================================
8405     # FIXME!
8406     # who thought this too-generic cppconn dir was a good idea?
8407     AC_MSG_CHECKING([MySQL Connector/C++])
8408     if test "$with_system_mysql_cppconn" = "yes"; then
8409         AC_MSG_RESULT([external])
8410         SYSTEM_MYSQL_CONNECTOR_CPP=TRUE
8411         AC_LANG_PUSH([C++])
8412         AC_CHECK_HEADER(mysql_driver.h, [],
8413                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8414         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8415                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8416         save_LIBS=$LIBS
8417         LIBS="$LIBS -lmysqlcppconn"
8418         AC_MSG_CHECKING([version])
8419         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8420 #include <mysql_driver.h>
8422 int main(int argc, char **argv) {
8423     sql::Driver *driver;
8424     driver = get_driver_instance();
8425     if (driver->getMajorVersion() > 1 || \
8426        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8427        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8428         return 0;
8429       else
8430         return 1;
8432       ]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR([not suitable, we need >= 1.0.6])],[AC_MSG_ERROR([MySQL C++ Connecter not tested with cross-compilation])])
8434         AC_LANG_POP([C++])
8435         LIBS=$save_LIBS
8436     else
8437         AC_MSG_RESULT([internal])
8438         BUILD_TYPE="$BUILD_TYPE MYSQL_CONNECTOR_CPP"
8439         SYSTEM_MYSQL_CONNECTOR_CPP=
8440     fi
8441     AC_LANG_POP([C++])
8443 AC_SUBST(SYSTEM_MYSQL_CONNECTOR_CPP)
8445 dnl ===================================================================
8446 dnl Check for system hsqldb
8447 dnl ===================================================================
8448 if test "$with_java" != "no"; then
8449     HSQLDB_USE_JDBC_4_1=
8450     AC_MSG_CHECKING([which hsqldb to use])
8451     if test "$with_system_hsqldb" = "yes"; then
8452         AC_MSG_RESULT([external])
8453         SYSTEM_HSQLDB=TRUE
8454         if test -z $HSQLDB_JAR; then
8455             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8456         fi
8457         if ! test -f $HSQLDB_JAR; then
8458                AC_MSG_ERROR(hsqldb.jar not found.)
8459         fi
8460         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8461         export HSQLDB_JAR
8462         if $PERL -e \
8463            'use Archive::Zip;
8464             my $file = "$ENV{'HSQLDB_JAR'}";
8465             my $zip = Archive::Zip->new( $file );
8466             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8467             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8468             {
8469                 push @l, split(/\n/, $mf);
8470                 foreach my $line (@l)
8471                 {
8472                     if ($line =~ m/Specification-Version:/)
8473                     {
8474                         ($t, $version) = split (/:/,$line);
8475                         $version =~ s/^\s//;
8476                         ($a, $b, $c, $d) = split (/\./,$version);
8477                         if ($c == "0" && $d > "8")
8478                         {
8479                             exit 0;
8480                         }
8481                         else
8482                         {
8483                             exit 1;
8484                         }
8485                     }
8486                 }
8487             }
8488             else
8489             {
8490                 exit 1;
8491             }'; then
8492             AC_MSG_RESULT([yes])
8493         else
8494             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8495         fi
8496     else
8497         AC_MSG_RESULT([internal])
8498         SYSTEM_HSQLDB=
8499         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8500         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8501         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8502         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8503             AC_MSG_RESULT([yes])
8504             HSQLDB_USE_JDBC_4_1=TRUE
8505         else
8506             AC_MSG_RESULT([no])
8507         fi
8508     fi
8509     AC_SUBST(SYSTEM_HSQLDB)
8510     AC_SUBST(HSQLDB_JAR)
8511     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8514 dnl ===================================================================
8515 dnl Check for PostgreSQL stuff
8516 dnl ===================================================================
8517 if test "x$enable_postgresql_sdbc" != "xno"; then
8518     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8520     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8521         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8522     fi
8523     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8524         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8525     fi
8527     postgres_interface=""
8528     if test "$with_system_postgresql" = "yes"; then
8529         postgres_interface="external PostgreSQL"
8530         SYSTEM_POSTGRESQL=TRUE
8531         if test "$_os" = Darwin; then
8532             supp_path=''
8533             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8534                 pg_supp_path="$P_SEP$d$pg_supp_path"
8535             done
8536         fi
8537         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8538         if test -z "$PGCONFIG"; then
8539             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8540         fi
8541         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8542         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8543         FilterLibs "${POSTGRESQL_LIB}"
8544         POSTGRESQL_LIB="${filteredlibs}"
8545     else
8546         # if/when anything else than PostgreSQL uses Kerberos,
8547         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8548         WITH_KRB5=
8549         WITH_GSSAPI=
8550         case "$_os" in
8551         Darwin)
8552             # MacOS X has system MIT Kerberos 5 since 10.4
8553             if test "$with_krb5" != "no"; then
8554                 WITH_KRB5=TRUE
8555                 save_LIBS=$LIBS
8556                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8557                 # that the libraries where these functions are located on macOS will change, is it?
8558                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8559                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8560                 KRB5_LIBS=$LIBS
8561                 LIBS=$save_LIBS
8562                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8563                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8564                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8565                 LIBS=$save_LIBS
8566             fi
8567             if test "$with_gssapi" != "no"; then
8568                 WITH_GSSAPI=TRUE
8569                 save_LIBS=$LIBS
8570                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8571                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8572                 GSSAPI_LIBS=$LIBS
8573                 LIBS=$save_LIBS
8574             fi
8575             ;;
8576         WINNT)
8577             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8578                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8579             fi
8580             ;;
8581         Linux|GNU|*BSD|DragonFly)
8582             if test "$with_krb5" != "no"; then
8583                 WITH_KRB5=TRUE
8584                 save_LIBS=$LIBS
8585                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8586                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8587                 KRB5_LIBS=$LIBS
8588                 LIBS=$save_LIBS
8589                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8590                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8591                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8592                 LIBS=$save_LIBS
8593             fi
8594             if test "$with_gssapi" != "no"; then
8595                 WITH_GSSAPI=TRUE
8596                 save_LIBS=$LIBS
8597                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8598                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8599                 GSSAPI_LIBS=$LIBS
8600                 LIBS=$save_LIBS
8601             fi
8602             ;;
8603         *)
8604             if test "$with_krb5" = "yes"; then
8605                 WITH_KRB5=TRUE
8606                 save_LIBS=$LIBS
8607                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8608                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8609                 KRB5_LIBS=$LIBS
8610                 LIBS=$save_LIBS
8611                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8612                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8613                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8614                 LIBS=$save_LIBS
8615             fi
8616             if test "$with_gssapi" = "yes"; then
8617                 WITH_GSSAPI=TRUE
8618                 save_LIBS=$LIBS
8619                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8620                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8621                 LIBS=$save_LIBS
8622                 GSSAPI_LIBS=$LIBS
8623             fi
8624         esac
8626         if test -n "$with_libpq_path"; then
8627             SYSTEM_POSTGRESQL=TRUE
8628             postgres_interface="external libpq"
8629             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8630             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8631         else
8632             SYSTEM_POSTGRESQL=
8633             postgres_interface="internal"
8634             POSTGRESQL_LIB=""
8635             POSTGRESQL_INC="%OVERRIDE_ME%"
8636             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8637         fi
8638     fi
8640     AC_MSG_CHECKING([PostgreSQL C interface])
8641     AC_MSG_RESULT([$postgres_interface])
8643     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8644         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8645         save_CFLAGS=$CFLAGS
8646         save_CPPFLAGS=$CPPFLAGS
8647         save_LIBS=$LIBS
8648         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8649         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8650         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8651         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8652             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8653         CFLAGS=$save_CFLAGS
8654         CPPFLAGS=$save_CPPFLAGS
8655         LIBS=$save_LIBS
8656     fi
8657     BUILD_POSTGRESQL_SDBC=TRUE
8659 AC_SUBST(WITH_KRB5)
8660 AC_SUBST(WITH_GSSAPI)
8661 AC_SUBST(GSSAPI_LIBS)
8662 AC_SUBST(KRB5_LIBS)
8663 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8664 AC_SUBST(SYSTEM_POSTGRESQL)
8665 AC_SUBST(POSTGRESQL_INC)
8666 AC_SUBST(POSTGRESQL_LIB)
8668 dnl ===================================================================
8669 dnl Check for Firebird stuff
8670 dnl ===================================================================
8671 ENABLE_FIREBIRD_SDBC=""
8672 if test "$enable_firebird_sdbc" = "yes" ; then
8673     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8675     dnl ===================================================================
8676     dnl Check for system Firebird
8677     dnl ===================================================================
8678     AC_MSG_CHECKING([which Firebird to use])
8679     if test "$with_system_firebird" = "yes"; then
8680         AC_MSG_RESULT([external])
8681         SYSTEM_FIREBIRD=TRUE
8682         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8683         if test -z "$FIREBIRDCONFIG"; then
8684             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8685             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8686                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8687             ])
8688             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8689         else
8690             AC_MSG_NOTICE([fb_config found])
8691             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8692             AC_MSG_CHECKING([for Firebird Client library])
8693             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8694             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8695             FilterLibs "${FIREBIRD_LIBS}"
8696             FIREBIRD_LIBS="${filteredlibs}"
8697         fi
8698         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8699         AC_MSG_CHECKING([Firebird version])
8700         if test -n "${FIREBIRD_VERSION}"; then
8701             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8702             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8703             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8704                 AC_MSG_RESULT([OK])
8705             else
8706                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
8707             fi
8708         else
8709             __save_CFLAGS="${CFLAGS}"
8710             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8711             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8712 #if defined(FB_API_VER) && FB_API_VER == 30
8713 int fb_api_is_30(void) { return 0; }
8714 #else
8715 #error "Wrong Firebird API version"
8716 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
8717             CFLAGS="${__save_CFLAGS}"
8718         fi
8719         ENABLE_FIREBIRD_SDBC="TRUE"
8720     elif test "$enable_database_connectivity" != yes; then
8721         AC_MSG_RESULT([none])
8722     elif test "$cross_compiling" = "yes"; then
8723         AC_MSG_RESULT([none])
8724     else
8725         dnl Embedded Firebird has version 3.0
8726         AC_DEFINE(HAVE_FIREBIRD_30, 1)
8727         dnl We need libatomic-ops for any non X86/X64 system
8728         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8729             dnl ===================================================================
8730             dnl Check for system libatomic-ops
8731             dnl ===================================================================
8732             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8733             if test "$with_system_libatomic_ops" = "yes"; then
8734                 SYSTEM_LIBATOMIC_OPS=TRUE
8735                 AC_CHECK_HEADERS(atomic_ops.h, [],
8736                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8737             else
8738                 SYSTEM_LIBATOMIC_OPS=
8739                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8740                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8741                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8742             fi
8743         fi
8745         AC_MSG_RESULT([internal])
8746         SYSTEM_FIREBIRD=
8747         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
8748         FIREBIRD_LIBS="-lfbclient"
8750         if test "$with_system_libtommath" = "yes"; then
8751             SYSTEM_LIBTOMMATH=TRUE
8752             dnl check for tommath presence
8753             save_LIBS=$LIBS
8754             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
8755             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
8756             LIBS=$save_LIBS
8757         else
8758             SYSTEM_LIBTOMMATH=
8759             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
8760             LIBTOMMATH_LIBS="-ltommath"
8761             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
8762         fi
8764         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8765         ENABLE_FIREBIRD_SDBC="TRUE"
8766         AC_DEFINE(ENABLE_FIREBIRD_SDBC)
8767     fi
8769 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8770 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8771 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8772 AC_SUBST(LIBATOMIC_OPS_LIBS)
8773 AC_SUBST(SYSTEM_FIREBIRD)
8774 AC_SUBST(FIREBIRD_CFLAGS)
8775 AC_SUBST(FIREBIRD_LIBS)
8776 AC_SUBST([TOMMATH_CFLAGS])
8777 AC_SUBST([TOMMATH_LIBS])
8779 dnl ===================================================================
8780 dnl Check for system curl
8781 dnl ===================================================================
8782 AC_MSG_CHECKING([which libcurl to use])
8783 if test "$with_system_curl" = "auto"; then
8784     with_system_curl="$with_system_libs"
8787 if test "$with_system_curl" = "yes"; then
8788     AC_MSG_RESULT([external])
8789     SYSTEM_CURL=TRUE
8791     # First try PKGCONFIG and then fall back
8792     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8794     if test -n "$CURL_PKG_ERRORS"; then
8795         AC_PATH_PROG(CURLCONFIG, curl-config)
8796         if test -z "$CURLCONFIG"; then
8797             AC_MSG_ERROR([curl development files not found])
8798         fi
8799         CURL_LIBS=`$CURLCONFIG --libs`
8800         FilterLibs "${CURL_LIBS}"
8801         CURL_LIBS="${filteredlibs}"
8802         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8803         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8805         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8806         case $curl_version in
8807         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8808         dnl so they need to be doubled to end up in the configure script
8809         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8810             AC_MSG_RESULT([yes])
8811             ;;
8812         *)
8813             AC_MSG_ERROR([no, you have $curl_version])
8814             ;;
8815         esac
8816     fi
8818     ENABLE_CURL=TRUE
8819 elif test $_os = iOS; then
8820     # Let's see if we need curl, I think not?
8821     AC_MSG_RESULT([none])
8822     ENABLE_CURL=
8823 else
8824     AC_MSG_RESULT([internal])
8825     SYSTEM_CURL=
8826     BUILD_TYPE="$BUILD_TYPE CURL"
8827     ENABLE_CURL=TRUE
8829 AC_SUBST(SYSTEM_CURL)
8830 AC_SUBST(CURL_CFLAGS)
8831 AC_SUBST(CURL_LIBS)
8832 AC_SUBST(ENABLE_CURL)
8834 dnl ===================================================================
8835 dnl Check for system boost
8836 dnl ===================================================================
8837 AC_MSG_CHECKING([which boost to use])
8838 if test "$with_system_boost" = "yes"; then
8839     AC_MSG_RESULT([external])
8840     SYSTEM_BOOST=TRUE
8841     AX_BOOST_BASE(1.47)
8842     AX_BOOST_DATE_TIME
8843     AX_BOOST_FILESYSTEM
8844     AX_BOOST_IOSTREAMS
8845     AX_BOOST_LOCALE
8846     AC_LANG_PUSH([C++])
8847     save_CXXFLAGS=$CXXFLAGS
8848     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8849     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8850        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8851     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8852        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8853     CXXFLAGS=$save_CXXFLAGS
8854     AC_LANG_POP([C++])
8855     # this is in m4/ax_boost_base.m4
8856     FilterLibs "${BOOST_LDFLAGS}"
8857     BOOST_LDFLAGS="${filteredlibs}"
8858 else
8859     AC_MSG_RESULT([internal])
8860     BUILD_TYPE="$BUILD_TYPE BOOST"
8861     SYSTEM_BOOST=
8862     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
8863         # use warning-suppressing wrapper headers
8864         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
8865     else
8866         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
8867     fi
8869 AC_SUBST(SYSTEM_BOOST)
8871 dnl ===================================================================
8872 dnl Check for system mdds
8873 dnl ===================================================================
8874 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.2 >= 1.2.3], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8876 dnl ===================================================================
8877 dnl Check for system glm
8878 dnl ===================================================================
8879 AC_MSG_CHECKING([which glm to use])
8880 if test "$with_system_glm" = "yes"; then
8881     AC_MSG_RESULT([external])
8882     SYSTEM_GLM=TRUE
8883     AC_LANG_PUSH([C++])
8884     AC_CHECK_HEADER([glm/glm.hpp], [],
8885        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8886     AC_LANG_POP([C++])
8887 else
8888     AC_MSG_RESULT([internal])
8889     BUILD_TYPE="$BUILD_TYPE GLM"
8890     SYSTEM_GLM=
8891     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8893 AC_SUBST([GLM_CFLAGS])
8894 AC_SUBST([SYSTEM_GLM])
8896 dnl ===================================================================
8897 dnl Check for system odbc
8898 dnl ===================================================================
8899 AC_MSG_CHECKING([which odbc headers to use])
8900 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
8901     AC_MSG_RESULT([external])
8902     SYSTEM_ODBC_HEADERS=TRUE
8904     if test "$build_os" = "cygwin"; then
8905         save_CPPFLAGS=$CPPFLAGS
8906         find_winsdk
8907         PathFormat "$winsdktest"
8908         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"
8909         AC_CHECK_HEADER(sqlext.h, [],
8910             [AC_MSG_ERROR(odbc not found. install odbc)],
8911             [#include <windows.h>])
8912         CPPFLAGS=$save_CPPFLAGS
8913     else
8914         AC_CHECK_HEADER(sqlext.h, [],
8915             [AC_MSG_ERROR(odbc not found. install odbc)],[])
8916     fi
8917 elif test "$enable_database_connectivity" != yes; then
8918     AC_MSG_RESULT([none])
8919 else
8920     AC_MSG_RESULT([internal])
8921     SYSTEM_ODBC_HEADERS=
8923 AC_SUBST(SYSTEM_ODBC_HEADERS)
8926 dnl ===================================================================
8927 dnl Check for system openldap
8928 dnl ===================================================================
8930 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8931 AC_MSG_CHECKING([which openldap library to use])
8932 if test "$with_system_openldap" = "yes"; then
8933     AC_MSG_RESULT([external])
8934     SYSTEM_OPENLDAP=TRUE
8935     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8936     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8937     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8938 else
8939     AC_MSG_RESULT([internal])
8940     SYSTEM_OPENLDAP=
8941     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8944 AC_SUBST(SYSTEM_OPENLDAP)
8946 dnl ===================================================================
8947 dnl Check for system NSS
8948 dnl ===================================================================
8949 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
8950     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8951     AC_DEFINE(HAVE_FEATURE_NSS)
8952     ENABLE_NSS="TRUE"
8953     AC_DEFINE(ENABLE_NSS)
8954 elif test $_os != iOS ; then
8955     with_tls=openssl
8957 AC_SUBST(ENABLE_NSS)
8959 dnl ===================================================================
8960 dnl Check for TLS/SSL and cryptographic implementation to use
8961 dnl ===================================================================
8962 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8963 if test -n "$with_tls"; then
8964     case $with_tls in
8965     openssl)
8966         AC_DEFINE(USE_TLS_OPENSSL)
8967         TLS=OPENSSL
8969         if test "$enable_openssl" != "yes"; then
8970             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8971         fi
8973         # warn that OpenSSL has been selected but not all TLS code has this option
8974         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
8975         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
8976         ;;
8977     nss)
8978         AC_DEFINE(USE_TLS_NSS)
8979         TLS=NSS
8980         ;;
8981     no)
8982         AC_MSG_WARN([Skipping TLS/SSL])
8983         ;;
8984     *)
8985         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8986 openssl - OpenSSL
8987 nss - Mozilla's Network Security Services (NSS)
8988     ])
8989         ;;
8990     esac
8991 else
8992     # default to using NSS, it results in smaller oox lib
8993     AC_DEFINE(USE_TLS_NSS)
8994     TLS=NSS
8996 AC_MSG_RESULT([$TLS])
8997 AC_SUBST(TLS)
8999 dnl ===================================================================
9000 dnl Check for system sane
9001 dnl ===================================================================
9002 AC_MSG_CHECKING([which sane header to use])
9003 if test "$with_system_sane" = "yes"; then
9004     AC_MSG_RESULT([external])
9005     AC_CHECK_HEADER(sane/sane.h, [],
9006       [AC_MSG_ERROR(sane not found. install sane)], [])
9007 else
9008     AC_MSG_RESULT([internal])
9009     BUILD_TYPE="$BUILD_TYPE SANE"
9012 dnl ===================================================================
9013 dnl Check for system icu
9014 dnl ===================================================================
9015 SYSTEM_GENBRK=
9016 SYSTEM_GENCCODE=
9017 SYSTEM_GENCMN=
9019 ICU_MAJOR=61
9020 ICU_MINOR=1
9021 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9022 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9023 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9024 AC_MSG_CHECKING([which icu to use])
9025 if test "$with_system_icu" = "yes"; then
9026     AC_MSG_RESULT([external])
9027     SYSTEM_ICU=TRUE
9028     AC_LANG_PUSH([C++])
9029     AC_MSG_CHECKING([for unicode/rbbi.h])
9030     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9031     AC_LANG_POP([C++])
9033     if test "$cross_compiling" != "yes"; then
9034         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9035         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9036         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9037         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9038     fi
9040     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9041         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9042         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9043         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9044         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9045         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9046             AC_MSG_RESULT([yes])
9047         else
9048             AC_MSG_RESULT([no])
9049             if test "$with_system_icu_for_build" != "force"; then
9050                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9051 You can use --with-system-icu-for-build=force to use it anyway.])
9052             fi
9053         fi
9054     fi
9056     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9057         # using the system icu tools can lead to version confusion, use the
9058         # ones from the build environment when cross-compiling
9059         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9060         if test -z "$SYSTEM_GENBRK"; then
9061             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9062         fi
9063         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9064         if test -z "$SYSTEM_GENCCODE"; then
9065             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9066         fi
9067         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9068         if test -z "$SYSTEM_GENCMN"; then
9069             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9070         fi
9071         if test "$ICU_MAJOR" -ge "49"; then
9072             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9073             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9074             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9075         else
9076             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9077             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9078             ICU_RECLASSIFIED_HEBREW_LETTER=
9079         fi
9080     fi
9082     if test "$cross_compiling" = "yes"; then
9083         if test "$ICU_MAJOR" -ge "50"; then
9084             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9085             ICU_MINOR=""
9086         fi
9087     fi
9088 else
9089     AC_MSG_RESULT([internal])
9090     SYSTEM_ICU=
9091     BUILD_TYPE="$BUILD_TYPE ICU"
9092     # surprisingly set these only for "internal" (to be used by various other
9093     # external libs): the system icu-config is quite unhelpful and spits out
9094     # dozens of weird flags and also default path -I/usr/include
9095     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9096     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9098 if test "$ICU_MAJOR" -ge "59"; then
9099     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9100     # with -std=c++11 but not all external libraries can be built with that,
9101     # for those use a bit-compatible typedef uint16_t UChar; see
9102     # icu/source/common/unicode/umachine.h
9103     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9104 else
9105     ICU_UCHAR_TYPE=""
9107 AC_SUBST(SYSTEM_ICU)
9108 AC_SUBST(SYSTEM_GENBRK)
9109 AC_SUBST(SYSTEM_GENCCODE)
9110 AC_SUBST(SYSTEM_GENCMN)
9111 AC_SUBST(ICU_MAJOR)
9112 AC_SUBST(ICU_MINOR)
9113 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9114 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9115 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9116 AC_SUBST(ICU_CFLAGS)
9117 AC_SUBST(ICU_LIBS)
9118 AC_SUBST(ICU_UCHAR_TYPE)
9120 dnl ==================================================================
9121 dnl Breakpad
9122 dnl ==================================================================
9123 AC_MSG_CHECKING([whether to enable breakpad])
9124 if test "$enable_breakpad" != yes; then
9125     AC_MSG_RESULT([no])
9126 else
9127     AC_MSG_RESULT([yes])
9128     ENABLE_BREAKPAD="TRUE"
9129     AC_DEFINE(ENABLE_BREAKPAD)
9130     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9131     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9133     AC_MSG_CHECKING([for crashreport config])
9134     if test "$with_symbol_config" = "no"; then
9135         BREAKPAD_SYMBOL_CONFIG="invalid"
9136         AC_MSG_RESULT([no])
9137     else
9138         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9139         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9140         AC_MSG_RESULT([yes])
9141     fi
9142     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9144 AC_SUBST(ENABLE_BREAKPAD)
9146 dnl ==================================================================
9147 dnl libfuzzer
9148 dnl ==================================================================
9149 AC_MSG_CHECKING([whether to enable fuzzers])
9150 if test "$enable_fuzzers" != yes; then
9151     AC_MSG_RESULT([no])
9152 else
9153     AC_MSG_RESULT([yes])
9154     ENABLE_FUZZERS="TRUE"
9155     AC_DEFINE(ENABLE_FUZZERS)
9156     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9158 AC_SUBST(ENABLE_FUZZERS)
9160 dnl ===================================================================
9161 dnl Orcus
9162 dnl ===================================================================
9163 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.13 >= 0.13.3])
9164 if test "$with_system_orcus" != "yes"; then
9165     if test "$SYSTEM_BOOST" = "TRUE"; then
9166         # ===========================================================
9167         # Determine if we are going to need to link with Boost.System
9168         # ===========================================================
9169         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9170         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9171         dnl in documentation has no effect.
9172         AC_MSG_CHECKING([if we need to link with Boost.System])
9173         AC_LANG_PUSH([C++])
9174         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9175                 @%:@include <boost/version.hpp>
9176             ]],[[
9177                 #if BOOST_VERSION >= 105000
9178                 #   error yes, we need to link with Boost.System
9179                 #endif
9180             ]])],[
9181                 AC_MSG_RESULT([no])
9182             ],[
9183                 AC_MSG_RESULT([yes])
9184                 AX_BOOST_SYSTEM
9185         ])
9186         AC_LANG_POP([C++])
9187     fi
9189 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9190 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9191 AC_SUBST([BOOST_SYSTEM_LIB])
9192 AC_SUBST(SYSTEM_LIBORCUS)
9194 dnl ===================================================================
9195 dnl HarfBuzz
9196 dnl ===================================================================
9197 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9198                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9199                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9201 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9202                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9203                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9205 if test "$COM" = "MSC"; then # override the above
9206     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9207     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9210 if test "$with_system_harfbuzz" = "yes"; then
9211     if test "$with_system_graphite" = "no"; then
9212         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9213     fi
9214     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9215     _save_libs="$LIBS"
9216     _save_cflags="$CFLAGS"
9217     LIBS="$LIBS $HARFBUZZ_LIBS"
9218     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9219     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9220     LIBS="$_save_libs"
9221     CFLAGS="$_save_cflags"
9222 else
9223     if test "$with_system_graphite" = "yes"; then
9224         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9225     fi
9228 AC_MSG_CHECKING([whether to use X11])
9229 dnl ***************************************
9230 dnl testing for X libraries and includes...
9231 dnl ***************************************
9232 if test "$USING_X11" = TRUE; then
9233     AC_DEFINE(HAVE_FEATURE_X11)
9235 AC_MSG_RESULT([$USING_X11])
9237 if test "$USING_X11" = TRUE; then
9238     AC_PATH_X
9239     AC_PATH_XTRA
9240     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9242     if test -z "$x_includes"; then
9243         x_includes="default_x_includes"
9244     fi
9245     if test -z "$x_libraries"; then
9246         x_libraries="default_x_libraries"
9247     fi
9248     CFLAGS="$CFLAGS $X_CFLAGS"
9249     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9250     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9251 else
9252     x_includes="no_x_includes"
9253     x_libraries="no_x_libraries"
9256 if test "$USING_X11" = TRUE; then
9257     dnl ===================================================================
9258     dnl Check for extension headers
9259     dnl ===================================================================
9260     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9261      [#include <X11/extensions/shape.h>])
9263     # vcl needs ICE and SM
9264     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9265     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9266         [AC_MSG_ERROR(ICE library not found)])
9267     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9268     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9269         [AC_MSG_ERROR(SM library not found)])
9272 dnl ===================================================================
9273 dnl Check for system Xrender
9274 dnl ===================================================================
9275 AC_MSG_CHECKING([whether to use Xrender])
9276 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9277     AC_MSG_RESULT([yes])
9278     PKG_CHECK_MODULES(XRENDER, xrender)
9279     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9280     FilterLibs "${XRENDER_LIBS}"
9281     XRENDER_LIBS="${filteredlibs}"
9282     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9283       [AC_MSG_ERROR(libXrender not found or functional)], [])
9284     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9285       [AC_MSG_ERROR(Xrender not found. install X)], [])
9286 else
9287     AC_MSG_RESULT([no])
9289 AC_SUBST(XRENDER_CFLAGS)
9290 AC_SUBST(XRENDER_LIBS)
9292 dnl ===================================================================
9293 dnl Check for XRandr
9294 dnl ===================================================================
9295 AC_MSG_CHECKING([whether to enable RandR support])
9296 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9297     AC_MSG_RESULT([yes])
9298     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9299     if test "$ENABLE_RANDR" != "TRUE"; then
9300         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9301                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9302         XRANDR_CFLAGS=" "
9303         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9304           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9305         XRANDR_LIBS="-lXrandr "
9306         ENABLE_RANDR="TRUE"
9307     fi
9308     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9309     FilterLibs "${XRANDR_LIBS}"
9310     XRANDR_LIBS="${filteredlibs}"
9311 else
9312     ENABLE_RANDR=""
9313     AC_MSG_RESULT([no])
9315 AC_SUBST(XRANDR_CFLAGS)
9316 AC_SUBST(XRANDR_LIBS)
9317 AC_SUBST(ENABLE_RANDR)
9319 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9320     WITH_WEBDAV="serf"
9322 if test $_os = iOS -o $_os = Android; then
9323     WITH_WEBDAV="no"
9325 AC_MSG_CHECKING([for webdav library])
9326 case "$WITH_WEBDAV" in
9327 serf)
9328     AC_MSG_RESULT([serf])
9329     # Check for system apr-util
9330     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9331                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9332                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9333     if test "$COM" = "MSC"; then
9334         APR_LIB_DIR="LibR"
9335         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9336         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9337     fi
9339     # Check for system serf
9340     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9341                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9342     if test "$COM" = "MSC"; then
9343         SERF_LIB_DIR="Release"
9344         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9345         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9346     fi
9347     ;;
9348 neon)
9349     AC_MSG_RESULT([neon])
9350     # Check for system neon
9351     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9352     if test "$with_system_neon" = "yes"; then
9353         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9354     else
9355         NEON_VERSION=0295
9356     fi
9357     AC_SUBST(NEON_VERSION)
9358     ;;
9360     AC_MSG_RESULT([none, disabled])
9361     WITH_WEBDAV=""
9362     ;;
9363 esac
9364 AC_SUBST(WITH_WEBDAV)
9366 dnl ===================================================================
9367 dnl Check for disabling cve_tests
9368 dnl ===================================================================
9369 AC_MSG_CHECKING([whether to execute CVE tests])
9370 # If not explicitly enabled or disabled, default
9371 if test -z "$enable_cve_tests"; then
9372     case "$OS" in
9373     WNT)
9374         # Default cves off for windows with its wild and wonderful
9375         # varienty of AV software kicking in and panicking
9376         enable_cve_tests=no
9377         ;;
9378     *)
9379         # otherwise yes
9380         enable_cve_tests=yes
9381         ;;
9382     esac
9384 if test "$enable_cve_tests" = "no"; then
9385     AC_MSG_RESULT([no])
9386     DISABLE_CVE_TESTS=TRUE
9387     AC_SUBST(DISABLE_CVE_TESTS)
9388 else
9389     AC_MSG_RESULT([yes])
9392 dnl ===================================================================
9393 dnl Check for enabling chart XShape tests
9394 dnl ===================================================================
9395 AC_MSG_CHECKING([whether to execute chart XShape tests])
9396 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9397     AC_MSG_RESULT([yes])
9398     ENABLE_CHART_TESTS=TRUE
9399     AC_SUBST(ENABLE_CHART_TESTS)
9400 else
9401     AC_MSG_RESULT([no])
9404 dnl ===================================================================
9405 dnl Check for system openssl
9406 dnl ===================================================================
9407 DISABLE_OPENSSL=
9408 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9409 if test "$enable_openssl" = "yes"; then
9410     AC_MSG_RESULT([no])
9411     if test "$_os" = Darwin ; then
9412         # OpenSSL is deprecated when building for 10.7 or later.
9413         #
9414         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9415         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9417         with_system_openssl=no
9418         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9419     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9420             && test "$with_system_openssl" != "no"; then
9421         with_system_openssl=yes
9422         SYSTEM_OPENSSL=TRUE
9423         OPENSSL_CFLAGS=
9424         OPENSSL_LIBS="-lssl -lcrypto"
9425     else
9426         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9427     fi
9428     if test "$with_system_openssl" = "yes"; then
9429         AC_MSG_CHECKING([whether openssl supports SHA512])
9430         AC_LANG_PUSH([C])
9431         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9432             SHA512_CTX context;
9433 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9434         AC_LANG_POP(C)
9435     fi
9436 else
9437     AC_MSG_RESULT([yes])
9438     DISABLE_OPENSSL=TRUE
9440     # warn that although OpenSSL is disabled, system libraries may depend on it
9441     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9442     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9445 AC_SUBST([DISABLE_OPENSSL])
9447 dnl ===================================================================
9448 dnl Check for building gnutls
9449 dnl ===================================================================
9450 AC_MSG_CHECKING([whether to use gnutls])
9451 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9452     AC_MSG_RESULT([yes])
9453     AM_PATH_LIBGCRYPT()
9454     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9455         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9456                       available in the system to use as replacement.]]))
9457     FilterLibs "${LIBGCRYPT_LIBS}"
9458     LIBGCRYPT_LIBS="${filteredlibs}"
9459 else
9460     AC_MSG_RESULT([no])
9463 AC_SUBST([LIBGCRYPT_CFLAGS])
9464 AC_SUBST([LIBGCRYPT_LIBS])
9466 dnl ===================================================================
9467 dnl Check for system redland
9468 dnl ===================================================================
9469 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9470 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9471 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9472 if test "$with_system_redland" = "yes"; then
9473     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9474             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9475 else
9476     RAPTOR_MAJOR="0"
9477     RASQAL_MAJOR="3"
9478     REDLAND_MAJOR="0"
9480 AC_SUBST(RAPTOR_MAJOR)
9481 AC_SUBST(RASQAL_MAJOR)
9482 AC_SUBST(REDLAND_MAJOR)
9484 dnl ===================================================================
9485 dnl Check for system hunspell
9486 dnl ===================================================================
9487 AC_MSG_CHECKING([which libhunspell to use])
9488 if test "$with_system_hunspell" = "yes"; then
9489     AC_MSG_RESULT([external])
9490     SYSTEM_HUNSPELL=TRUE
9491     AC_LANG_PUSH([C++])
9492     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9493     if test "$HUNSPELL_PC" != "TRUE"; then
9494         AC_CHECK_HEADER(hunspell.hxx, [],
9495             [
9496             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9497             [AC_MSG_ERROR(hunspell headers not found.)], [])
9498             ], [])
9499         AC_CHECK_LIB([hunspell], [main], [:],
9500            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9501         HUNSPELL_LIBS=-lhunspell
9502     fi
9503     AC_LANG_POP([C++])
9504     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9505     FilterLibs "${HUNSPELL_LIBS}"
9506     HUNSPELL_LIBS="${filteredlibs}"
9507 else
9508     AC_MSG_RESULT([internal])
9509     SYSTEM_HUNSPELL=
9510     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9511     if test "$COM" = "MSC"; then
9512         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9513     else
9514         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.6"
9515     fi
9516     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9518 AC_SUBST(SYSTEM_HUNSPELL)
9519 AC_SUBST(HUNSPELL_CFLAGS)
9520 AC_SUBST(HUNSPELL_LIBS)
9522 dnl ===================================================================
9523 dnl Checking for altlinuxhyph
9524 dnl ===================================================================
9525 AC_MSG_CHECKING([which altlinuxhyph to use])
9526 if test "$with_system_altlinuxhyph" = "yes"; then
9527     AC_MSG_RESULT([external])
9528     SYSTEM_HYPH=TRUE
9529     AC_CHECK_HEADER(hyphen.h, [],
9530        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9531     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9532        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9533        [#include <hyphen.h>])
9534     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9535         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9536     if test -z "$HYPHEN_LIB"; then
9537         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9538            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9539     fi
9540     if test -z "$HYPHEN_LIB"; then
9541         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9542            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9543     fi
9544 else
9545     AC_MSG_RESULT([internal])
9546     SYSTEM_HYPH=
9547     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9548     if test "$COM" = "MSC"; then
9549         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9550     else
9551         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9552     fi
9554 AC_SUBST(SYSTEM_HYPH)
9555 AC_SUBST(HYPHEN_LIB)
9557 dnl ===================================================================
9558 dnl Checking for mythes
9559 dnl ===================================================================
9560 AC_MSG_CHECKING([which mythes to use])
9561 if test "$with_system_mythes" = "yes"; then
9562     AC_MSG_RESULT([external])
9563     SYSTEM_MYTHES=TRUE
9564     AC_LANG_PUSH([C++])
9565     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9566     if test "$MYTHES_PKGCONFIG" = "no"; then
9567         AC_CHECK_HEADER(mythes.hxx, [],
9568             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9569         AC_CHECK_LIB([mythes-1.2], [main], [:],
9570             [ MYTHES_FOUND=no], [])
9571     if test "$MYTHES_FOUND" = "no"; then
9572         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9573                 [ MYTHES_FOUND=no], [])
9574     fi
9575     if test "$MYTHES_FOUND" = "no"; then
9576         AC_MSG_ERROR([mythes library not found!.])
9577     fi
9578     fi
9579     AC_LANG_POP([C++])
9580     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9581     FilterLibs "${MYTHES_LIBS}"
9582     MYTHES_LIBS="${filteredlibs}"
9583 else
9584     AC_MSG_RESULT([internal])
9585     SYSTEM_MYTHES=
9586     BUILD_TYPE="$BUILD_TYPE MYTHES"
9587     if test "$COM" = "MSC"; then
9588         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9589     else
9590         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9591     fi
9593 AC_SUBST(SYSTEM_MYTHES)
9594 AC_SUBST(MYTHES_CFLAGS)
9595 AC_SUBST(MYTHES_LIBS)
9597 dnl ===================================================================
9598 dnl How should we build the linear programming solver ?
9599 dnl ===================================================================
9601 ENABLE_COINMP=
9602 AC_MSG_CHECKING([whether to build with CoinMP])
9603 if test "$enable_coinmp" != "no"; then
9604     ENABLE_COINMP=TRUE
9605     AC_MSG_RESULT([yes])
9606     if test "$with_system_coinmp" = "yes"; then
9607         SYSTEM_COINMP=TRUE
9608         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9609         FilterLibs "${COINMP_LIBS}"
9610         COINMP_LIBS="${filteredlibs}"
9611     else
9612         BUILD_TYPE="$BUILD_TYPE COINMP"
9613     fi
9614 else
9615     AC_MSG_RESULT([no])
9617 AC_SUBST(ENABLE_COINMP)
9618 AC_SUBST(SYSTEM_COINMP)
9619 AC_SUBST(COINMP_CFLAGS)
9620 AC_SUBST(COINMP_LIBS)
9622 ENABLE_LPSOLVE=
9623 AC_MSG_CHECKING([whether to build with lpsolve])
9624 if test "$enable_lpsolve" != "no"; then
9625     ENABLE_LPSOLVE=TRUE
9626     AC_MSG_RESULT([yes])
9627 else
9628     AC_MSG_RESULT([no])
9630 AC_SUBST(ENABLE_LPSOLVE)
9632 if test "$ENABLE_LPSOLVE" = TRUE; then
9633     AC_MSG_CHECKING([which lpsolve to use])
9634     if test "$with_system_lpsolve" = "yes"; then
9635         AC_MSG_RESULT([external])
9636         SYSTEM_LPSOLVE=TRUE
9637         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9638            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9639         save_LIBS=$LIBS
9640         # some systems need this. Like Ubuntu....
9641         AC_CHECK_LIB(m, floor)
9642         AC_CHECK_LIB(dl, dlopen)
9643         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9644             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9645         LIBS=$save_LIBS
9646     else
9647         AC_MSG_RESULT([internal])
9648         SYSTEM_LPSOLVE=
9649         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9650     fi
9652 AC_SUBST(SYSTEM_LPSOLVE)
9654 dnl ===================================================================
9655 dnl Checking for libexttextcat
9656 dnl ===================================================================
9657 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9658 if test "$with_system_libexttextcat" = "yes"; then
9659     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9661 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9663 dnl ===================================================================
9664 dnl Checking for libnumbertext
9665 dnl ===================================================================
9666 AC_MSG_CHECKING([whether to use libnumbertext])
9667 if test "$enable_libnumbertext" = "no"; then
9668     AC_MSG_RESULT([no])
9669     ENABLE_LIBNUMBERTEXT=
9670     SYSTEM_LIBNUMBERTEXT=
9671 else
9672     AC_MSG_RESULT([yes])
9673     ENABLE_LIBNUMBERTEXT=TRUE
9674     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
9675     if test "$with_system_libnumbertext" = "yes"; then
9676         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
9677         SYSTEM_LIBNUMBERTEXT=YES
9678     else
9679         SYSTEM_LIBNUMBERTEXT=
9680         AC_LANG_PUSH([C++])
9681         save_CXXFLAGS=$CXXFLAGS
9682         CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
9683         AC_CHECK_HEADERS([codecvt regex])
9684         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
9685                 [ ENABLE_LIBNUMBERTEXT=''
9686                   LIBNUMBERTEXT_CFLAGS=''
9687                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
9688                                Enable libnumbertext fallback (missing number to number name conversion).])
9689                 ])
9690         CXXFLAGS=$save_CXXFLAGS
9691         AC_LANG_POP([C++])
9692     fi
9693     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
9694         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
9695     fi
9697 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
9698 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
9699 AC_SUBST(ENABLE_LIBNUMBERTEXT)
9700 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
9702 dnl ***************************************
9703 dnl testing libc version for Linux...
9704 dnl ***************************************
9705 if test "$_os" = "Linux"; then
9706     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9707     exec 6>/dev/null # no output
9708     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9709     exec 6>&1 # output on again
9710     if test "$HAVE_LIBC"; then
9711         AC_MSG_RESULT([yes])
9712     else
9713         AC_MSG_ERROR([no, upgrade libc])
9714     fi
9717 dnl =========================================
9718 dnl Check for uuidgen
9719 dnl =========================================
9720 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9721     # presence is already tested above in the WINDOWS_SDK_HOME check
9722     UUIDGEN=uuidgen.exe
9723     AC_SUBST(UUIDGEN)
9724 else
9725     AC_PATH_PROG([UUIDGEN], [uuidgen])
9726     if test -z "$UUIDGEN"; then
9727         AC_MSG_WARN([uuid is needed for building installation sets])
9728     fi
9731 dnl ***************************************
9732 dnl Checking for bison and flex
9733 dnl ***************************************
9734 AC_PATH_PROG(BISON, bison)
9735 if test -z "$BISON"; then
9736     AC_MSG_ERROR([no bison found in \$PATH, install it])
9737 else
9738     AC_MSG_CHECKING([the bison version])
9739     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9740     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9741     # Accept newer than 2.0
9742     if test "$_bison_longver" -lt 2000; then
9743         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9744     fi
9747 AC_PATH_PROG(FLEX, flex)
9748 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9749     FLEX=`cygpath -m $FLEX`
9751 if test -z "$FLEX"; then
9752     AC_MSG_ERROR([no flex found in \$PATH, install it])
9753 else
9754     AC_MSG_CHECKING([the flex version])
9755     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9756     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9757         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9758     fi
9760 AC_SUBST([FLEX])
9761 dnl ***************************************
9762 dnl Checking for patch
9763 dnl ***************************************
9764 AC_PATH_PROG(PATCH, patch)
9765 if test -z "$PATCH"; then
9766     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9769 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9770 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9771     if test -z "$with_gnu_patch"; then
9772         GNUPATCH=$PATCH
9773     else
9774         if test -x "$with_gnu_patch"; then
9775             GNUPATCH=$with_gnu_patch
9776         else
9777             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9778         fi
9779     fi
9781     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9782     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9783         AC_MSG_RESULT([yes])
9784     else
9785         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9786     fi
9787 else
9788     GNUPATCH=$PATCH
9791 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9792     GNUPATCH=`cygpath -m $GNUPATCH`
9795 dnl We also need to check for --with-gnu-cp
9797 if test -z "$with_gnu_cp"; then
9798     # check the place where the good stuff is hidden on Solaris...
9799     if test -x /usr/gnu/bin/cp; then
9800         GNUCP=/usr/gnu/bin/cp
9801     else
9802         AC_PATH_PROGS(GNUCP, gnucp cp)
9803     fi
9804     if test -z $GNUCP; then
9805         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9806     fi
9807 else
9808     if test -x "$with_gnu_cp"; then
9809         GNUCP=$with_gnu_cp
9810     else
9811         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9812     fi
9815 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9816     GNUCP=`cygpath -m $GNUCP`
9819 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9820 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9821     AC_MSG_RESULT([yes])
9822 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9823     AC_MSG_RESULT([yes])
9824 else
9825     case "$build_os" in
9826     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9827         x_GNUCP=[\#]
9828         GNUCP=''
9829         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9830         ;;
9831     *)
9832         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9833         ;;
9834     esac
9837 AC_SUBST(GNUPATCH)
9838 AC_SUBST(GNUCP)
9839 AC_SUBST(x_GNUCP)
9841 dnl ***************************************
9842 dnl testing assembler path
9843 dnl ***************************************
9844 ML_EXE=""
9845 if test "$_os" = "WINNT"; then
9846     if test "$BITNESS_OVERRIDE" = ""; then
9847         assembler=ml.exe
9848         assembler_bin=$CL_DIR
9849     else
9850         assembler=ml64.exe
9851         assembler_bin=$CL_DIR
9852     fi
9854     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9855     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9856         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9857         AC_MSG_RESULT([found])
9858         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9859     else
9860         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9861     fi
9863     PathFormat "$ASM_HOME"
9864     ASM_HOME="$formatted_path"
9865 else
9866     ASM_HOME=""
9869 AC_SUBST(ML_EXE)
9871 dnl ===================================================================
9872 dnl We need zip and unzip
9873 dnl ===================================================================
9874 AC_PATH_PROG(ZIP, zip)
9875 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9876 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9877     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],,)
9880 AC_PATH_PROG(UNZIP, unzip)
9881 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9883 dnl ===================================================================
9884 dnl Zip must be a specific type for different build types.
9885 dnl ===================================================================
9886 if test $build_os = cygwin; then
9887     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9888         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9889     fi
9892 dnl ===================================================================
9893 dnl We need touch with -h option support.
9894 dnl ===================================================================
9895 AC_PATH_PROG(TOUCH, touch)
9896 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
9897 touch warn
9898 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
9899     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],,)
9902 dnl ===================================================================
9903 dnl Check for system epoxy
9904 dnl ===================================================================
9905 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
9907 dnl ===================================================================
9908 dnl Set vcl option: coordinate device in double or sal_Int32
9909 dnl ===================================================================
9911 dnl disabled for now, we don't want subtle differences between OSs
9912 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
9913 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
9914 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
9915 dnl     AC_MSG_RESULT([double])
9916 dnl else
9917 dnl     AC_MSG_RESULT([sal_Int32])
9918 dnl fi
9920 dnl ===================================================================
9921 dnl Test which vclplugs have to be built.
9922 dnl ===================================================================
9923 R=""
9924 if test "$USING_X11" != TRUE; then
9925     enable_gtk=no
9926     enable_gtk3=no
9928 GTK3_CFLAGS=""
9929 GTK3_LIBS=""
9930 ENABLE_GTK3=""
9931 if test "x$enable_gtk3" = "xyes"; then
9932     if test "$with_system_cairo" = no; then
9933         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
9934     fi
9935     : ${with_system_cairo:=yes}
9936     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="")
9937     if test "x$ENABLE_GTK3" = "xTRUE"; then
9938         R="gtk3"
9939         dnl Avoid installed by unpackaged files for now.
9940         if test -z "$PKGFORMAT"; then
9941             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
9942         fi
9943     else
9944         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
9945     fi
9946     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9947     FilterLibs "${GTK3_LIBS}"
9948     GTK3_LIBS="${filteredlibs}"
9950     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
9951     if test "$with_system_epoxy" != "yes"; then
9952         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
9953         AC_CHECK_HEADER(EGL/eglplatform.h, [],
9954                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
9955     fi
9957 AC_SUBST(GTK3_LIBS)
9958 AC_SUBST(GTK3_CFLAGS)
9959 AC_SUBST(ENABLE_GTK3)
9961 ENABLE_GTK=""
9962 if test "x$enable_gtk" = "xyes"; then
9963     if test "$with_system_cairo" = no; then
9964         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
9965     fi
9966     : ${with_system_cairo:=yes}
9967     ENABLE_GTK="TRUE"
9968     AC_DEFINE(ENABLE_GTK)
9969     R="gtk $R"
9971 AC_SUBST(ENABLE_GTK)
9973 ENABLE_KDE4=""
9974 if test "x$enable_kde4" = "xyes"; then
9975     ENABLE_KDE4="TRUE"
9976     AC_DEFINE(ENABLE_KDE4)
9977     R="$R kde4"
9979 AC_SUBST(ENABLE_KDE4)
9981 ENABLE_QT5=""
9982 if test "x$enable_qt5" = "xyes"; then
9983     ENABLE_QT5="TRUE"
9984     AC_DEFINE(ENABLE_QT5)
9985     R="$R qt5"
9987 AC_SUBST(ENABLE_QT5)
9989 ENABLE_KDE5=""
9990 if test "x$enable_kde5" = "xyes"; then
9991     ENABLE_KDE5="TRUE"
9992     AC_DEFINE(ENABLE_KDE5)
9993     R="$R kde5"
9995 AC_SUBST(ENABLE_KDE5)
9997 ENABLE_GTK3_KDE5=""
9998 if test "x$enable_gtk3_kde5" = "xyes"; then
9999     ENABLE_GTK3_KDE5="TRUE"
10000     AC_DEFINE(ENABLE_GTK3_KDE5)
10001     R="$R gtk3_kde5"
10003 AC_SUBST(ENABLE_GTK3_KDE5)
10005 build_vcl_plugins="$R"
10006 if test -z "$build_vcl_plugins"; then
10007     build_vcl_plugins="none"
10009 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10011 dnl ===================================================================
10012 dnl check for dbus support
10013 dnl ===================================================================
10014 ENABLE_DBUS=""
10015 DBUS_CFLAGS=""
10016 DBUS_LIBS=""
10018 if test "$enable_dbus" = "no"; then
10019     test_dbus=no
10022 AC_MSG_CHECKING([whether to enable DBUS support])
10023 if test "$test_dbus" = "yes"; then
10024     ENABLE_DBUS="TRUE"
10025     AC_MSG_RESULT([yes])
10026     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
10027     AC_DEFINE(ENABLE_DBUS)
10028     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10029     FilterLibs "${DBUS_LIBS}"
10030     DBUS_LIBS="${filteredlibs}"
10031 else
10032     AC_MSG_RESULT([no])
10035 AC_SUBST(ENABLE_DBUS)
10036 AC_SUBST(DBUS_CFLAGS)
10037 AC_SUBST(DBUS_LIBS)
10039 AC_MSG_CHECKING([whether to enable Impress remote control])
10040 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10041     AC_MSG_RESULT([yes])
10042     ENABLE_SDREMOTE=TRUE
10043     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10045     # If not explicitly enabled or disabled, default
10046     if test -z "$enable_sdremote_bluetooth"; then
10047         case "$OS" in
10048         LINUX|MACOSX|WNT)
10049             # Default to yes for these
10050             enable_sdremote_bluetooth=yes
10051             ;;
10052         *)
10053             # otherwise no
10054             enable_sdremote_bluetooth=no
10055             ;;
10056         esac
10057     fi
10058     # $enable_sdremote_bluetooth is guaranteed non-empty now
10060     if test "$enable_sdremote_bluetooth" != "no"; then
10061         if test "$OS" = "LINUX"; then
10062             if test "$ENABLE_DBUS" = "TRUE"; then
10063                 AC_MSG_RESULT([yes])
10064                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10065                 dnl ===================================================================
10066                 dnl Check for system bluez
10067                 dnl ===================================================================
10068                 AC_MSG_CHECKING([which Bluetooth header to use])
10069                 if test "$with_system_bluez" = "yes"; then
10070                     AC_MSG_RESULT([external])
10071                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10072                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10073                     SYSTEM_BLUEZ=TRUE
10074                 else
10075                     AC_MSG_RESULT([internal])
10076                     SYSTEM_BLUEZ=
10077                 fi
10078             else
10079                 AC_MSG_RESULT([no, dbus disabled])
10080                 ENABLE_SDREMOTE_BLUETOOTH=
10081                 SYSTEM_BLUEZ=
10082             fi
10083         else
10084             AC_MSG_RESULT([yes])
10085             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10086             SYSTEM_BLUEZ=
10087         fi
10088     else
10089         AC_MSG_RESULT([no])
10090         ENABLE_SDREMOTE_BLUETOOTH=
10091         SYSTEM_BLUEZ=
10092     fi
10093 else
10094     ENABLE_SDREMOTE=
10095     SYSTEM_BLUEZ=
10096     AC_MSG_RESULT([no])
10098 AC_SUBST(ENABLE_SDREMOTE)
10099 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10100 AC_SUBST(SYSTEM_BLUEZ)
10102 dnl ===================================================================
10103 dnl Check whether the gtk 2.0 libraries are available.
10104 dnl ===================================================================
10106 GTK_CFLAGS=""
10107 GTK_LIBS=""
10108 if test  "$test_gtk" = "yes"; then
10110     if test "$ENABLE_GTK" = "TRUE"; then
10111         PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.18.0 gdk-pixbuf-2.0 >= 2.2 ,,AC_MSG_ERROR([requirements to build the gtk-plugin not met. Use --disable-gtk or install the missing packages]))
10112         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10113         FilterLibs "${GTK_LIBS}"
10114         GTK_LIBS="${filteredlibs}"
10115         PKG_CHECK_MODULES(GTHREAD, gthread-2.0,,AC_MSG_ERROR([requirements to build the gtk-plugin not met. Use --disable-gtk or install the missing packages]))
10116         BUILD_TYPE="$BUILD_TYPE GTK"
10117         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10118         FilterLibs "${GTHREAD_LIBS}"
10119         GTHREAD_LIBS="${filteredlibs}"
10121         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10122         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10123                           [ENABLE_GTK_PRINT="TRUE"],
10124                           [ENABLE_GTK_PRINT=""])
10125         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10126         FilterLibs "${GTK_PRINT_LIBS}"
10127         GTK_PRINT_LIBS="${filteredlibs}"
10129         AC_MSG_CHECKING([whether to enable GIO support])
10130         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10131             dnl Need at least 2.26 for the dbus support.
10132             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10133                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10134             if test "$ENABLE_GIO" = "TRUE"; then
10135                 AC_DEFINE(ENABLE_GIO)
10136                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10137                 FilterLibs "${GIO_LIBS}"
10138                 GIO_LIBS="${filteredlibs}"
10139             fi
10140         else
10141             AC_MSG_RESULT([no])
10142         fi
10143     fi
10145 AC_SUBST(ENABLE_GIO)
10146 AC_SUBST(GIO_CFLAGS)
10147 AC_SUBST(GIO_LIBS)
10148 AC_SUBST(GTK_CFLAGS)
10149 AC_SUBST(GTK_LIBS)
10150 AC_SUBST(GTHREAD_CFLAGS)
10151 AC_SUBST(GTHREAD_LIBS)
10152 AC_SUBST([ENABLE_GTK_PRINT])
10153 AC_SUBST([GTK_PRINT_CFLAGS])
10154 AC_SUBST([GTK_PRINT_LIBS])
10157 dnl ===================================================================
10159 SPLIT_APP_MODULES=""
10160 if test "$enable_split_app_modules" = "yes"; then
10161     SPLIT_APP_MODULES="TRUE"
10163 AC_SUBST(SPLIT_APP_MODULES)
10165 SPLIT_OPT_FEATURES=""
10166 if test "$enable_split_opt_features" = "yes"; then
10167     SPLIT_OPT_FEATURES="TRUE"
10169 AC_SUBST(SPLIT_OPT_FEATURES)
10171 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10172     if test "$enable_cairo_canvas" = yes; then
10173         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10174     fi
10175     enable_cairo_canvas=no
10176 elif test -z "$enable_cairo_canvas"; then
10177     enable_cairo_canvas=yes
10180 ENABLE_CAIRO_CANVAS=""
10181 if test "$enable_cairo_canvas" = "yes"; then
10182     test_cairo=yes
10183     ENABLE_CAIRO_CANVAS="TRUE"
10184     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10186 AC_SUBST(ENABLE_CAIRO_CANVAS)
10188 dnl ===================================================================
10189 dnl Check whether the GStreamer libraries are available.
10190 dnl It's possible to build avmedia with both GStreamer backends!
10191 dnl ===================================================================
10193 ENABLE_GSTREAMER_1_0=""
10195 if test "$build_gstreamer_1_0" = "yes"; then
10197     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10198     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10199         ENABLE_GSTREAMER_1_0="TRUE"
10200         AC_MSG_RESULT([yes])
10201         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10202         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10203         FilterLibs "${GSTREAMER_1_0_LIBS}"
10204         GSTREAMER_1_0_LIBS="${filteredlibs}"
10205     else
10206         AC_MSG_RESULT([no])
10207     fi
10209 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10210 AC_SUBST(GSTREAMER_1_0_LIBS)
10211 AC_SUBST(ENABLE_GSTREAMER_1_0)
10214 ENABLE_GSTREAMER_0_10=""
10215 if test "$build_gstreamer_0_10" = "yes"; then
10217     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10218     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10219         ENABLE_GSTREAMER_0_10="TRUE"
10220         AC_MSG_RESULT([yes])
10221         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10222             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10223         ])
10224         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10225         FilterLibs "${GSTREAMER_0_10_LIBS}"
10226         GSTREAMER_0_10_LIBS="${filteredlibs}"
10227     else
10228         AC_MSG_RESULT([no])
10229     fi
10232 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10233 AC_SUBST(GSTREAMER_0_10_LIBS)
10234 AC_SUBST(ENABLE_GSTREAMER_0_10)
10236 dnl ===================================================================
10237 dnl Check whether to build the VLC avmedia backend
10238 dnl ===================================================================
10240 ENABLE_VLC=""
10242 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10243 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10244     ENABLE_VLC="TRUE"
10245     AC_MSG_RESULT([yes])
10246 else
10247     AC_MSG_RESULT([no])
10249 AC_SUBST(ENABLE_VLC)
10251 ENABLE_OPENGL_TRANSITIONS=
10252 ENABLE_OPENGL_CANVAS=
10253 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10254    : # disable
10255 elif test "$_os" = "Darwin"; then
10256     # We use frameworks on Mac OS X, no need for detail checks
10257     ENABLE_OPENGL_TRANSITIONS=TRUE
10258     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10259     ENABLE_OPENGL_CANVAS=TRUE
10260 elif test $_os = WINNT; then
10261     ENABLE_OPENGL_TRANSITIONS=TRUE
10262     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10263     ENABLE_OPENGL_CANVAS=TRUE
10264 else
10265     if test "$USING_X11" = TRUE; then
10266         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10267         ENABLE_OPENGL_TRANSITIONS=TRUE
10268         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10269         ENABLE_OPENGL_CANVAS=TRUE
10270     fi
10273 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10274 AC_SUBST(ENABLE_OPENGL_CANVAS)
10276 dnl =================================================
10277 dnl Check whether to build with OpenCL support.
10278 dnl =================================================
10280 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10281     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10282     # platform (optional at run-time, used through clew).
10283     BUILD_TYPE="$BUILD_TYPE OPENCL"
10284     AC_DEFINE(HAVE_FEATURE_OPENCL)
10287 dnl =================================================
10288 dnl Check whether to build with dconf support.
10289 dnl =================================================
10291 if test "$enable_dconf" != no; then
10292     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10293         if test "$enable_dconf" = yes; then
10294             AC_MSG_ERROR([dconf not found])
10295         else
10296             enable_dconf=no
10297         fi])
10299 AC_MSG_CHECKING([whether to enable dconf])
10300 if test "$enable_dconf" = no; then
10301     DCONF_CFLAGS=
10302     DCONF_LIBS=
10303     ENABLE_DCONF=
10304     AC_MSG_RESULT([no])
10305 else
10306     ENABLE_DCONF=TRUE
10307     AC_DEFINE(ENABLE_DCONF)
10308     AC_MSG_RESULT([yes])
10310 AC_SUBST([DCONF_CFLAGS])
10311 AC_SUBST([DCONF_LIBS])
10312 AC_SUBST([ENABLE_DCONF])
10314 # pdf import?
10315 AC_MSG_CHECKING([whether to build the PDF import feature])
10316 ENABLE_PDFIMPORT=
10317 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10318     AC_MSG_RESULT([yes])
10319     ENABLE_PDFIMPORT=TRUE
10320     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10322     dnl ===================================================================
10323     dnl Check for system poppler
10324     dnl ===================================================================
10325     AC_MSG_CHECKING([which PDF import backend to use])
10326     if test "$with_system_poppler" = "yes"; then
10327         AC_MSG_RESULT([external])
10328         SYSTEM_POPPLER=TRUE
10329         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10330         AC_LANG_PUSH([C++])
10331         save_CXXFLAGS=$CXXFLAGS
10332         save_CPPFLAGS=$CPPFLAGS
10333         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10334         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10335         AC_CHECK_HEADER([cpp/poppler-version.h],
10336             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10337             [])
10338         CXXFLAGS=$save_CXXFLAGS
10339         CPPFLAGS=$save_CPPFLAGS
10340         AC_LANG_POP([C++])
10341         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10343         FilterLibs "${POPPLER_LIBS}"
10344         POPPLER_LIBS="${filteredlibs}"
10345     else
10346         AC_MSG_RESULT([internal])
10347         SYSTEM_POPPLER=
10348         BUILD_TYPE="$BUILD_TYPE POPPLER"
10349         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10350     fi
10351     AC_DEFINE([ENABLE_PDFIMPORT],1)
10352 else
10353     AC_MSG_RESULT([no])
10355 AC_SUBST(ENABLE_PDFIMPORT)
10356 AC_SUBST(SYSTEM_POPPLER)
10357 AC_SUBST(POPPLER_CFLAGS)
10358 AC_SUBST(POPPLER_LIBS)
10360 # pdf import?
10361 AC_MSG_CHECKING([whether to build PDFium])
10362 ENABLE_PDFIUM=
10363 if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then
10364     AC_MSG_RESULT([yes])
10365     ENABLE_PDFIUM=TRUE
10366     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10367     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10368 else
10369     AC_MSG_RESULT([no])
10371 AC_SUBST(ENABLE_PDFIUM)
10373 SYSTEM_GPGMEPP=
10375 if test "$build_for_ios" = "YES"; then
10376     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10377     AC_MSG_RESULT([yes])
10378 elif test "$enable_mpl_subset" = "yes"; then
10379     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10380     AC_MSG_RESULT([yes])
10381 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10382     dnl ===================================================================
10383     dnl Check for system gpgme
10384     dnl ===================================================================
10385     AC_MSG_CHECKING([which gpgmepp to use])
10386     if test "$with_system_gpgmepp" = "yes"; then
10387         AC_MSG_RESULT([external])
10388         SYSTEM_GPGMEPP=TRUE
10390         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10391         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10392             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10393         # progress_callback is the only func with plain C linkage
10394         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10395         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10396             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10397         AC_CHECK_HEADER(gpgme.h, [],
10398             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10399     else
10400         AC_MSG_RESULT([internal])
10401         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10402         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10404         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10405         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10406         if test "$_os" != "WINNT"; then
10407             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10408             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10409         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10410             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10411         fi
10412     fi
10413     ENABLE_GPGMEPP=TRUE
10414     AC_DEFINE([HAVE_FEATURE_GPGME])
10415     AC_PATH_PROG(GPG, gpg)
10416     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10417     # so let's exclude that manually for the moment
10418     if test -n "$GPG" -a "$_os" != "WINNT"; then
10419         # make sure we not only have a working gpgme, but a full working
10420         # gpg installation to run OpenPGP signature verification
10421         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10422     fi
10423     if test "$_os" = "Linux"; then
10424       uid=`id -u`
10425       AC_MSG_CHECKING([for /run/user/$uid])
10426       if test -d /run/user/$uid; then
10427         AC_MSG_RESULT([yes])
10428         AC_PATH_PROG(GPGCONF, gpgconf)
10429         AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10430         if $GPGCONF --dump-options > /dev/null ; then
10431           if $GPGCONF --dump-options | grep -q create-socketdir ; then
10432             AC_MSG_RESULT([yes])
10433             AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10434           else
10435             AC_MSG_RESULT([no])
10436           fi
10437         else
10438           AC_MSG_RESULT([no. missing or broken gpgconf?])
10439         fi
10440       else
10441         AC_MSG_RESULT([no])
10442      fi
10443    fi
10445 AC_SUBST(ENABLE_GPGMEPP)
10446 AC_SUBST(SYSTEM_GPGMEPP)
10447 AC_SUBST(GPG_ERROR_CFLAGS)
10448 AC_SUBST(GPG_ERROR_LIBS)
10449 AC_SUBST(LIBASSUAN_CFLAGS)
10450 AC_SUBST(LIBASSUAN_LIBS)
10451 AC_SUBST(GPGMEPP_CFLAGS)
10452 AC_SUBST(GPGMEPP_LIBS)
10453 AC_SUBST(GPGCONF)
10454 AC_SUBST(HAVE_GPGCONF_SOCKETDIR)
10456 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10457 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10458     AC_MSG_RESULT([yes])
10459     ENABLE_MEDIAWIKI=TRUE
10460     BUILD_TYPE="$BUILD_TYPE XSLTML"
10461     if test  "x$with_java" = "xno"; then
10462         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10463     fi
10464 else
10465     AC_MSG_RESULT([no])
10466     ENABLE_MEDIAWIKI=
10467     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10469 AC_SUBST(ENABLE_MEDIAWIKI)
10471 AC_MSG_CHECKING([whether to build the Report Builder])
10472 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10473     AC_MSG_RESULT([yes])
10474     ENABLE_REPORTBUILDER=TRUE
10475     AC_MSG_CHECKING([which jfreereport libs to use])
10476     if test "$with_system_jfreereport" = "yes"; then
10477         SYSTEM_JFREEREPORT=TRUE
10478         AC_MSG_RESULT([external])
10479         if test -z $SAC_JAR; then
10480             SAC_JAR=/usr/share/java/sac.jar
10481         fi
10482         if ! test -f $SAC_JAR; then
10483              AC_MSG_ERROR(sac.jar not found.)
10484         fi
10486         if test -z $LIBXML_JAR; then
10487             if test -f /usr/share/java/libxml-1.0.0.jar; then
10488                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10489             elif test -f /usr/share/java/libxml.jar; then
10490                 LIBXML_JAR=/usr/share/java/libxml.jar
10491             else
10492                 AC_MSG_ERROR(libxml.jar replacement not found.)
10493             fi
10494         elif ! test -f $LIBXML_JAR; then
10495             AC_MSG_ERROR(libxml.jar not found.)
10496         fi
10498         if test -z $FLUTE_JAR; then
10499             if test -f/usr/share/java/flute-1.3.0.jar; then
10500                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10501             elif test -f /usr/share/java/flute.jar; then
10502                 FLUTE_JAR=/usr/share/java/flute.jar
10503             else
10504                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10505             fi
10506         elif ! test -f $FLUTE_JAR; then
10507             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10508         fi
10510         if test -z $JFREEREPORT_JAR; then
10511             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10512                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10513             elif test -f /usr/share/java/flow-engine.jar; then
10514                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10515             else
10516                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10517             fi
10518         elif ! test -f  $JFREEREPORT_JAR; then
10519                 AC_MSG_ERROR(jfreereport.jar not found.)
10520         fi
10522         if test -z $LIBLAYOUT_JAR; then
10523             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10524                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10525             elif test -f /usr/share/java/liblayout.jar; then
10526                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10527             else
10528                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10529             fi
10530         elif ! test -f $LIBLAYOUT_JAR; then
10531                 AC_MSG_ERROR(liblayout.jar not found.)
10532         fi
10534         if test -z $LIBLOADER_JAR; then
10535             if test -f /usr/share/java/libloader-1.0.0.jar; then
10536                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10537             elif test -f /usr/share/java/libloader.jar; then
10538                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10539             else
10540                 AC_MSG_ERROR(libloader.jar replacement not found.)
10541             fi
10542         elif ! test -f  $LIBLOADER_JAR; then
10543             AC_MSG_ERROR(libloader.jar not found.)
10544         fi
10546         if test -z $LIBFORMULA_JAR; then
10547             if test -f /usr/share/java/libformula-0.2.0.jar; then
10548                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10549             elif test -f /usr/share/java/libformula.jar; then
10550                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10551             else
10552                 AC_MSG_ERROR(libformula.jar replacement not found.)
10553             fi
10554         elif ! test -f $LIBFORMULA_JAR; then
10555                 AC_MSG_ERROR(libformula.jar not found.)
10556         fi
10558         if test -z $LIBREPOSITORY_JAR; then
10559             if test -f /usr/share/java/librepository-1.0.0.jar; then
10560                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10561             elif test -f /usr/share/java/librepository.jar; then
10562                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10563             else
10564                 AC_MSG_ERROR(librepository.jar replacement not found.)
10565             fi
10566         elif ! test -f $LIBREPOSITORY_JAR; then
10567             AC_MSG_ERROR(librepository.jar not found.)
10568         fi
10570         if test -z $LIBFONTS_JAR; then
10571             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10572                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10573             elif test -f /usr/share/java/libfonts.jar; then
10574                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10575             else
10576                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10577             fi
10578         elif ! test -f $LIBFONTS_JAR; then
10579                 AC_MSG_ERROR(libfonts.jar not found.)
10580         fi
10582         if test -z $LIBSERIALIZER_JAR; then
10583             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10584                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10585             elif test -f /usr/share/java/libserializer.jar; then
10586                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10587             else
10588                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10589             fi
10590         elif ! test -f $LIBSERIALIZER_JAR; then
10591                 AC_MSG_ERROR(libserializer.jar not found.)
10592         fi
10594         if test -z $LIBBASE_JAR; then
10595             if test -f /usr/share/java/libbase-1.0.0.jar; then
10596                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10597             elif test -f /usr/share/java/libbase.jar; then
10598                 LIBBASE_JAR=/usr/share/java/libbase.jar
10599             else
10600                 AC_MSG_ERROR(libbase.jar replacement not found.)
10601             fi
10602         elif ! test -f $LIBBASE_JAR; then
10603             AC_MSG_ERROR(libbase.jar not found.)
10604         fi
10606     else
10607         AC_MSG_RESULT([internal])
10608         SYSTEM_JFREEREPORT=
10609         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10610     fi
10611 else
10612     AC_MSG_RESULT([no])
10613     ENABLE_REPORTBUILDER=
10614     SYSTEM_JFREEREPORT=
10616 AC_SUBST(ENABLE_REPORTBUILDER)
10617 AC_SUBST(SYSTEM_JFREEREPORT)
10618 AC_SUBST(SAC_JAR)
10619 AC_SUBST(LIBXML_JAR)
10620 AC_SUBST(FLUTE_JAR)
10621 AC_SUBST(JFREEREPORT_JAR)
10622 AC_SUBST(LIBBASE_JAR)
10623 AC_SUBST(LIBLAYOUT_JAR)
10624 AC_SUBST(LIBLOADER_JAR)
10625 AC_SUBST(LIBFORMULA_JAR)
10626 AC_SUBST(LIBREPOSITORY_JAR)
10627 AC_SUBST(LIBFONTS_JAR)
10628 AC_SUBST(LIBSERIALIZER_JAR)
10630 # this has to be here because both the Wiki Publisher and the SRB use
10631 # commons-logging
10632 COMMONS_LOGGING_VERSION=1.2
10633 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10634     AC_MSG_CHECKING([which Apache commons-* libs to use])
10635     if test "$with_system_apache_commons" = "yes"; then
10636         SYSTEM_APACHE_COMMONS=TRUE
10637         AC_MSG_RESULT([external])
10638         if test -z $COMMONS_LOGGING_JAR; then
10639             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10640                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10641            elif test -f /usr/share/java/commons-logging.jar; then
10642                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
10643             else
10644                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
10645             fi
10646         elif ! test -f $COMMONS_LOGGING_JAR; then
10647             AC_MSG_ERROR(commons-logging.jar not found.)
10648         fi
10649     else
10650         AC_MSG_RESULT([internal])
10651         SYSTEM_APACHE_COMMONS=
10652         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
10653     fi
10655 AC_SUBST(SYSTEM_APACHE_COMMONS)
10656 AC_SUBST(COMMONS_LOGGING_JAR)
10657 AC_SUBST(COMMONS_LOGGING_VERSION)
10659 # scripting provider for BeanShell?
10660 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10661 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10662     AC_MSG_RESULT([yes])
10663     ENABLE_SCRIPTING_BEANSHELL=TRUE
10665     dnl ===================================================================
10666     dnl Check for system beanshell
10667     dnl ===================================================================
10668     AC_MSG_CHECKING([which beanshell to use])
10669     if test "$with_system_beanshell" = "yes"; then
10670         AC_MSG_RESULT([external])
10671         SYSTEM_BSH=TRUE
10672         if test -z $BSH_JAR; then
10673             BSH_JAR=/usr/share/java/bsh.jar
10674         fi
10675         if ! test -f $BSH_JAR; then
10676             AC_MSG_ERROR(bsh.jar not found.)
10677         fi
10678     else
10679         AC_MSG_RESULT([internal])
10680         SYSTEM_BSH=
10681         BUILD_TYPE="$BUILD_TYPE BSH"
10682     fi
10683 else
10684     AC_MSG_RESULT([no])
10685     ENABLE_SCRIPTING_BEANSHELL=
10686     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10688 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10689 AC_SUBST(SYSTEM_BSH)
10690 AC_SUBST(BSH_JAR)
10692 # scripting provider for JavaScript?
10693 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10694 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10695     AC_MSG_RESULT([yes])
10696     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10698     dnl ===================================================================
10699     dnl Check for system rhino
10700     dnl ===================================================================
10701     AC_MSG_CHECKING([which rhino to use])
10702     if test "$with_system_rhino" = "yes"; then
10703         AC_MSG_RESULT([external])
10704         SYSTEM_RHINO=TRUE
10705         if test -z $RHINO_JAR; then
10706             RHINO_JAR=/usr/share/java/js.jar
10707         fi
10708         if ! test -f $RHINO_JAR; then
10709             AC_MSG_ERROR(js.jar not found.)
10710         fi
10711     else
10712         AC_MSG_RESULT([internal])
10713         SYSTEM_RHINO=
10714         BUILD_TYPE="$BUILD_TYPE RHINO"
10715     fi
10716 else
10717     AC_MSG_RESULT([no])
10718     ENABLE_SCRIPTING_JAVASCRIPT=
10719     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10721 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10722 AC_SUBST(SYSTEM_RHINO)
10723 AC_SUBST(RHINO_JAR)
10725 # This is only used in KDE3/KDE4 checks to determine if /usr/lib64
10726 # paths should be added to library search path. So lets put all 64-bit
10727 # platforms there.
10728 supports_multilib=
10729 case "$host_cpu" in
10730 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
10731     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10732         supports_multilib="yes"
10733     fi
10734     ;;
10736     ;;
10737 esac
10739 dnl ===================================================================
10740 dnl KDE4 Integration
10741 dnl ===================================================================
10743 KDE4_CFLAGS=""
10744 KDE4_LIBS=""
10745 QMAKE4="qmake"
10746 MOC4="moc"
10747 KDE4_GLIB_CFLAGS=""
10748 KDE4_GLIB_LIBS=""
10749 KDE4_HAVE_GLIB=""
10750 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
10751     qt4_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
10752     qt4_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
10754     kde4_incdirs="/usr/include /usr/include/kde4 $x_includes"
10755     kde4_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
10757     if test -n "$supports_multilib"; then
10758         qt4_libdirs="$qt4_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
10759         kde4_libdirs="$kde4_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
10760     fi
10762     if test -n "$QTDIR"; then
10763         qt4_incdirs="$QTDIR/include $qt4_incdirs"
10764         if test -z "$supports_multilib"; then
10765             qt4_libdirs="$QTDIR/lib $qt4_libdirs"
10766         else
10767             qt4_libdirs="$QTDIR/lib64 $QTDIR/lib $qt4_libdirs"
10768         fi
10769     fi
10770     if test -n "$QT4DIR"; then
10771         qt4_incdirs="$QT4DIR/include $qt4_incdirs"
10772         if test -z "$supports_multilib"; then
10773             qt4_libdirs="$QT4DIR/lib $qt4_libdirs"
10774         else
10775             qt4_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt4_libdirs"
10776         fi
10777     fi
10779     if test -n "$KDEDIR"; then
10780         kde4_incdirs="$KDEDIR/include $kde4_incdirs"
10781         if test -z "$supports_multilib"; then
10782             kde4_libdirs="$KDEDIR/lib $kde4_libdirs"
10783         else
10784             kde4_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde4_libdirs"
10785         fi
10786     fi
10787     if test -n "$KDE4DIR"; then
10788         kde4_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde4_incdirs"
10789         if test -z "$supports_multilib"; then
10790             kde4_libdirs="$KDE4DIR/lib $kde4_libdirs"
10791         else
10792             kde4_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde4_libdirs"
10793         fi
10794     fi
10796     qt4_test_include="Qt/qobject.h"
10797     qt4_test_library="libQtNetwork.so"
10798     kde4_test_include="kwindowsystem.h"
10799     kde4_test_library="libsolid.so"
10801     AC_MSG_CHECKING([for Qt4 headers])
10802     qt4_header_dir="no"
10803     for inc_dir in $qt4_incdirs; do
10804         if test -r "$inc_dir/$qt4_test_include"; then
10805             qt4_header_dir="$inc_dir"
10806             break
10807         fi
10808     done
10810     AC_MSG_RESULT([$qt4_header_dir])
10811     if test "x$qt4_header_dir" = "xno"; then
10812         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10813     fi
10815     dnl Check for qmake
10816     AC_PATH_PROGS( QMAKE4, [qmake-qt4 qmake], no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
10817     if test "$QMAKE4" = "no"; then
10818         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10819     else
10820         qmake4_test_ver="`$QMAKE4 -v 2>&1 | sed -n -e '/^Using Qt version 4\./p'`"
10821         if test -z "$qmake4_test_ver"; then
10822             AC_MSG_ERROR([Wrong qmake for Qt4 found. Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
10823         fi
10824     fi
10826     qt4_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt4_libdirs"
10827     AC_MSG_CHECKING([for Qt4 libraries])
10828     qt4_lib_dir="no"
10829     for lib_dir in $qt4_libdirs; do
10830         if test -r "$lib_dir/$qt4_test_library"; then
10831             qt4_lib_dir="$lib_dir"
10832             PKG_CONFIG_PATH="$qt4_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
10833             break
10834         fi
10835     done
10837     AC_MSG_RESULT([$qt4_lib_dir])
10839     if test "x$qt4_lib_dir" = "xno"; then
10840         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10841     fi
10843     dnl Check for Meta Object Compiler
10845     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10846     MOC4="$MOCQT4"
10847     if test "$MOC4" = "no"; then
10848         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10849         if test "$MOC4" = "no"; then
10850             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10851 the root of your Qt installation by exporting QT4DIR before running "configure".])
10852         fi
10853     fi
10855     dnl Check for KDE4 headers
10856     AC_MSG_CHECKING([for KDE4 headers])
10857     kde4_incdir="no"
10858     for kde4_check in $kde4_incdirs; do
10859         if test -r "$kde4_check/$kde4_test_include"; then
10860             kde4_incdir="$kde4_check"
10861             break
10862         fi
10863     done
10864     AC_MSG_RESULT([$kde4_incdir])
10865     if test "x$kde4_incdir" = "xno"; then
10866         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10867     fi
10868     if test "$kde4_incdir" = "/usr/include"; then kde4_incdir=; fi
10870     dnl Check for KDE4 libraries
10871     AC_MSG_CHECKING([for KDE4 libraries])
10872     kde4_libdir="no"
10873     for kde4_check in $kde4_libdirs; do
10874         if test -r "$kde4_check/$kde4_test_library"; then
10875             kde4_libdir="$kde4_check"
10876             break
10877         fi
10878     done
10880     AC_MSG_RESULT([$kde4_libdir])
10881     if test "x$kde4_libdir" = "xno"; then
10882         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10883     fi
10885     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
10886     if ! test -z "$kde4_incdir"; then
10887         KDE4_CFLAGS="-I$kde4_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10888     else
10889         KDE4_CFLAGS="$QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10890     fi
10892     KDE4_LIBS="-L$kde4_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt4_lib_dir $QT4_LIBS"
10893     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10894     FilterLibs "$KDE4_LIBS"
10895     KDE4_LIBS="$filteredlibs"
10897     AC_LANG_PUSH([C++])
10898     save_CXXFLAGS=$CXXFLAGS
10899     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10900     AC_MSG_CHECKING([whether KDE is >= 4.2])
10901        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10902 #include <kdeversion.h>
10904 int main(int argc, char **argv) {
10905        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
10906        else return 1;
10908 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[AC_MSG_ERROR([KDE support not tested with cross-compilation])])
10909     CXXFLAGS=$save_CXXFLAGS
10910     AC_LANG_POP([C++])
10912     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
10913     # Sets also KDE4_GLIB_CFLAGS/KDE4_GLIB_LIBS if successful.
10914     PKG_CHECK_MODULES(KDE4_GLIB,[glib-2.0 >= 2.4],
10915         [
10916             KDE4_HAVE_GLIB=TRUE
10917             AC_DEFINE(KDE4_HAVE_GLIB,1)
10918             KDE4_GLIB_CFLAGS=$(printf '%s' "$KDE4_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10919             FilterLibs "${KDE4_GLIB_LIBS}"
10920             KDE4_GLIB_LIBS="${filteredlibs}"
10922             qt4_fix_warning=
10924             AC_LANG_PUSH([C++])
10925             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
10926             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
10927             #  02 00 80 3a  90 8a 4e d2 3a 00 00 00  f0 b4 b9 a7 ff 7f 00 00  00 00 00 00 00 00 00 00  20 d8 4e d2
10928             #               ^~~~~~~~~~~~~~~~~~~~~~~
10929             #               vptr for 'QObjectPrivate'
10930             # so temporarily ignore here whichever way would be used to make such errors fatal
10931             # (-fno-sanitize-recover=... or UBSAN_OPTIONS halt_on_error=1):
10932             save_CXX=$CXX
10933             CXX=$(printf %s "$CXX" \
10934                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
10935             save_UBSAN_OPTIONS=$UBSAN_OPTIONS
10936             UBSAN_OPTIONS=$UBSAN_OPTIONS:halt_on_error=0
10937             save_CXXFLAGS=$CXXFLAGS
10938             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10939             save_LIBS=$LIBS
10940             LIBS="$LIBS $KDE4_LIBS"
10941             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
10943             # Prepare meta object data
10944             TSTBASE="tst_exclude_socket_notifiers"
10945             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
10946             ln -fs "${TSTMOC}.hxx"
10947             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10949             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10950 #include <cstdlib>
10951 #include "tst_exclude_socket_notifiers.moc"
10953 int main(int argc, char *argv[])
10955     QCoreApplication app(argc, argv);
10956     exit(tst_processEventsExcludeSocket());
10957     return 0;
10959             ]])],[
10960                 AC_MSG_RESULT([yes])
10961             ],[
10962                 AC_MSG_RESULT([no])
10963                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
10964                 if test -z "$qt4_fix_warning"; then
10965                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
10966                 fi
10967                 qt4_fix_warning=1
10968                 add_warning "  https://bugreports.qt.io/browse/QTBUG-37380 (needed)"
10969                 ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
10971             # Remove meta object data
10972             rm -f "${TSTBASE}."*
10974             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
10976             # Prepare meta object data
10977             TSTBASE="tst_exclude_posted_events"
10978             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
10979             ln -fs "${TSTMOC}.hxx"
10980             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10982             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10983 #include <cstdlib>
10984 #include "tst_exclude_posted_events.moc"
10986 int main(int argc, char *argv[])
10988     QCoreApplication app(argc, argv);
10989     exit(tst_excludePostedEvents());
10990     return 0;
10992             ]])],[
10993                 AC_MSG_RESULT([yes])
10994             ],[
10995                 AC_MSG_RESULT([no])
10996                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
10997                 if test -z "$qt4_fix_warning"; then
10998                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
10999                 fi
11000                 qt4_fix_warning=1
11001                 add_warning "  https://bugreports.qt.io/browse/QTBUG-34614 (needed)"
11002             ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11004             # Remove meta object data
11005             rm -f "${TSTBASE}."*
11007             if test -n "$qt4_fix_warning"; then
11008                 add_warning "  https://bugreports.qt.io/browse/QTBUG-38585 (recommended)"
11009             fi
11011             LIBS=$save_LIBS
11012             CXXFLAGS=$save_CXXFLAGS
11013             UBSAN_OPTIONS=$save_UBSAN_OPTIONS
11014             CXX=$save_CXX
11015             AC_LANG_POP([C++])
11016         ],
11017         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11019 AC_SUBST(KDE4_CFLAGS)
11020 AC_SUBST(KDE4_LIBS)
11021 AC_SUBST(MOC4)
11022 AC_SUBST(KDE4_GLIB_CFLAGS)
11023 AC_SUBST(KDE4_GLIB_LIBS)
11024 AC_SUBST(KDE4_HAVE_GLIB)
11026 dnl ===================================================================
11027 dnl QT5 Integration
11028 dnl ===================================================================
11030 QT5_CFLAGS=""
11031 QT5_LIBS=""
11032 QMAKE5="qmake"
11033 MOC5="moc"
11034 QT5_GLIB_CFLAGS=""
11035 QT5_GLIB_LIBS=""
11036 QT5_HAVE_GLIB=""
11037 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11038         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11039         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11040 then
11041     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11042     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11044     if test -n "$supports_multilib"; then
11045         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11046     fi
11048     qt5_test_include="QtWidgets/qapplication.h"
11049     qt5_test_library="libQt5Widgets.so"
11051     dnl Check for qmake5
11052     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
11053     if test "$QMAKE5" = "no"; then
11054         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11055     else
11056         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11057         if test -z "$qmake5_test_ver"; then
11058             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11059         fi
11060         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11061         qt5_minimal_minor="6"
11062         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11063             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11064         else
11065             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11066         fi
11067     fi
11069     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11070     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11072     AC_MSG_CHECKING([for Qt5 headers])
11073     qt5_incdir="no"
11074     for inc_dir in $qt5_incdirs; do
11075         if test -r "$inc_dir/$qt5_test_include"; then
11076             qt5_incdir="$inc_dir"
11077             break
11078         fi
11079     done
11080     AC_MSG_RESULT([$qt5_incdir])
11081     if test "x$qt5_incdir" = "xno"; then
11082         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11083     fi
11085     AC_MSG_CHECKING([for Qt5 libraries])
11086     qt5_libdir="no"
11087     for lib_dir in $qt5_libdirs; do
11088         if test -r "$lib_dir/$qt5_test_library"; then
11089             qt5_libdir="$lib_dir"
11090             break
11091         fi
11092     done
11093     AC_MSG_RESULT([$qt5_libdir])
11094     if test "x$qt5_libdir" = "xno"; then
11095         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11096     fi
11098     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11099     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11101     dnl Check for Meta Object Compiler
11103     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
11104     if test "$MOC5" = "no"; then
11105         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11106 the root of your Qt installation by exporting QT5DIR before running "configure".])
11107     fi
11109     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11110     # Sets also QT5_GLIB_CFLAGS/QT5_GLIB_LIBS if successful.
11111     PKG_CHECK_MODULES(QT5_GLIB,[glib-2.0 >= 2.4],
11112         [
11113             QT5_HAVE_GLIB=1
11114             AC_DEFINE(QT5_HAVE_GLIB,1)
11115         ],
11116         AC_MSG_WARN([[No Glib found, Qt5 support will not use native file pickers!]])
11117     )
11119 AC_SUBST(QT5_CFLAGS)
11120 AC_SUBST(QT5_LIBS)
11121 AC_SUBST(MOC5)
11122 AC_SUBST(QT5_GLIB_CFLAGS)
11123 AC_SUBST(QT5_GLIB_LIBS)
11124 AC_SUBST(QT5_HAVE_GLIB)
11126 dnl ===================================================================
11127 dnl KDE5 Integration
11128 dnl ===================================================================
11130 KF5_CFLAGS=""
11131 KF5_LIBS=""
11132 KF5_CONFIG="kf5-config"
11133 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11134         \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11135         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11136 then
11137     kf5_incdirs="$KF5INC /usr/include/ $x_includes"
11138     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $x_libraries"
11139     if test -n "$supports_multilib"; then
11140         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11141     fi
11143     kf5_test_include="KF5/kcoreaddons_version.h"
11144     kf5_test_library="libKF5CoreAddons.so"
11145     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11147     dnl kf5 KDE4 support compatibility installed
11148     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11149     if test "$KF5_CONFIG" != "no"; then
11150         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11151         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11152     fi
11154     dnl Check for KF5 headers
11155     AC_MSG_CHECKING([for KF5 headers])
11156     kf5_incdir="no"
11157     for kf5_check in $kf5_incdirs; do
11158         if test -r "$kf5_check/$kf5_test_include"; then
11159             kf5_incdir="$kf5_check/KF5"
11160             break
11161         fi
11162     done
11163     AC_MSG_RESULT([$kf5_incdir])
11164     if test "x$kf5_incdir" = "xno"; then
11165         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11166     fi
11168     dnl Check for KF5 libraries
11169     AC_MSG_CHECKING([for KF5 libraries])
11170     kf5_libdir="no"
11171     for kf5_check in $kf5_libdirs; do
11172         if test -r "$kf5_check/$kf5_test_library"; then
11173             kf5_libdir="$kf5_check"
11174             break
11175         fi
11176     done
11178     AC_MSG_RESULT([$kf5_libdir])
11179     if test "x$kf5_libdir" = "xno"; then
11180         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11181     fi
11183     PKG_CHECK_MODULES(KF5_XCB,[xcb],,[AC_MSG_ERROR([XCB not installed])])
11185     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 $KF5_XCB_CFLAGS"
11186     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network -lQt5X11Extras $KF5_XCB_LIBS"
11187     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11189     AC_LANG_PUSH([C++])
11190     save_CXXFLAGS=$CXXFLAGS
11191     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11192     AC_MSG_CHECKING([whether KDE is >= 5.0])
11193        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11194 #include <kcoreaddons_version.h>
11196 int main(int argc, char **argv) {
11197        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11198        else return 1;
11200        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11201     CXXFLAGS=$save_CXXFLAGS
11202     AC_LANG_POP([C++])
11204 AC_SUBST(KF5_CFLAGS)
11205 AC_SUBST(KF5_LIBS)
11207 dnl ===================================================================
11208 dnl Test whether to include Evolution 2 support
11209 dnl ===================================================================
11210 AC_MSG_CHECKING([whether to enable evolution 2 support])
11211 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11212     AC_MSG_RESULT([yes])
11213     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11214     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11215     FilterLibs "${GOBJECT_LIBS}"
11216     GOBJECT_LIBS="${filteredlibs}"
11217     ENABLE_EVOAB2="TRUE"
11218 else
11219     ENABLE_EVOAB2=""
11220     AC_MSG_RESULT([no])
11222 AC_SUBST(ENABLE_EVOAB2)
11223 AC_SUBST(GOBJECT_CFLAGS)
11224 AC_SUBST(GOBJECT_LIBS)
11226 dnl ===================================================================
11227 dnl Test which themes to include
11228 dnl ===================================================================
11229 AC_MSG_CHECKING([which themes to include])
11230 # if none given use default subset of available themes
11231 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11232     with_theme="breeze breeze_dark colibre elementary karasa_jaga sifr sifr_dark tango"
11235 WITH_THEMES=""
11236 if test "x$with_theme" != "xno"; then
11237     for theme in $with_theme; do
11238         case $theme in
11239         breeze|breeze_dark|colibre|elementary|karasa_jaga|sifr|sifr_dark|tango) real_theme="$theme" ;;
11240         default) real_theme=colibre ;;
11241         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11242         esac
11243         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11244     done
11246 AC_MSG_RESULT([$WITH_THEMES])
11247 AC_SUBST([WITH_THEMES])
11248 # FIXME: remove this, and the convenience default->colibre remapping after a crace period
11249 for theme in $with_theme; do
11250     case $theme in
11251     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11252     *) ;;
11253     esac
11254 done
11256 dnl ===================================================================
11257 dnl Test whether to integrate helppacks into the product's installer
11258 dnl ===================================================================
11259 AC_MSG_CHECKING([for helppack integration])
11260 if test "$with_helppack_integration" = "no"; then
11261     WITH_HELPPACK_INTEGRATION=
11262     AC_MSG_RESULT([no integration])
11263 else
11264     WITH_HELPPACK_INTEGRATION=TRUE
11265     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11266     AC_MSG_RESULT([integration])
11268 AC_SUBST(WITH_HELPPACK_INTEGRATION)
11270 ###############################################################################
11271 # Extensions checking
11272 ###############################################################################
11273 AC_MSG_CHECKING([for extensions integration])
11274 if test "x$enable_extension_integration" != "xno"; then
11275     WITH_EXTENSION_INTEGRATION=TRUE
11276     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11277     AC_MSG_RESULT([yes, use integration])
11278 else
11279     WITH_EXTENSION_INTEGRATION=
11280     AC_MSG_RESULT([no, do not integrate])
11282 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11284 dnl Should any extra extensions be included?
11285 dnl There are standalone tests for each of these below.
11286 WITH_EXTRA_EXTENSIONS=
11287 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11289 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11290 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11291 if test "x$with_java" != "xno"; then
11292     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11293     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11296 TEST_FONTS_MISSING=0
11298 # $1  = font family
11299 # $2+ = accepted font mappings
11300 test_font_map()
11302     FONT="$1" ; shift
11303     AC_MSG_CHECKING([font mapping for '$FONT'])
11304     FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
11305     FONTFILE_LOWER="$(echo $FONTFILE | $AWK '{print tolower($0)}')"
11307     TESTEXPR="'${FONTFILE_LOWER}' = '$(echo $FONT | $AWK '{print tolower($0)}').ttf'"
11308     while test "$#" -ge 1 ; do
11309         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
11310         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
11311     done
11312     if test $TESTEXPR
11313     then
11314         AC_MSG_RESULT([ok])
11315     else
11316         AC_MSG_WARN([unknown ($FONTFILE)])
11317         add_warning "unknown ($FONTFILE)"
11318         TEST_FONTS_MISSING=1
11319     fi
11322 dnl ===================================================================
11323 dnl Test whether to include fonts
11324 dnl ===================================================================
11325 AC_MSG_CHECKING([whether to include third-party fonts])
11326 if test "$with_fonts" != "no"; then
11327     AC_MSG_RESULT([yes])
11328     WITH_FONTS=TRUE
11329     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11330     AC_DEFINE(HAVE_MORE_FONTS)
11331 else
11332     AC_MSG_RESULT([no])
11333     WITH_FONTS=
11334     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11335     if test "$test_fontconfig" = "yes"; then
11336         AC_PATH_PROG([FCMATCH], [fc-match])
11337         if test -z "$FCMATCH"; then
11338             AC_MSG_WARN([Unable to query installed fonts - unit tests disabled.])
11339             TEST_FONTS_MISSING=1
11340         else
11341             test_font_map 'Calibri' 'Carlito'
11342             test_font_map 'DejaVuSans' 'DejaVuSans'
11343             if test ${TEST_FONTS_MISSING} -eq 1
11344             then
11345                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
11346                 add_warning "Unknown font mappings - unit tests disabled."
11347             fi
11348         fi
11349     else
11350         TEST_FONTS_MISSING=1
11351     fi
11353 AC_SUBST(WITH_FONTS)
11354 AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
11357 dnl ===================================================================
11358 dnl Test whether to enable online update service
11359 dnl ===================================================================
11360 AC_MSG_CHECKING([whether to enable online update])
11361 ENABLE_ONLINE_UPDATE=
11362 ENABLE_ONLINE_UPDATE_MAR=
11363 UPDATE_CONFIG=
11364 if test "$enable_online_update" = ""; then
11365     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11366         AC_MSG_RESULT([yes])
11367         ENABLE_ONLINE_UPDATE="TRUE"
11368     else
11369         AC_MSG_RESULT([no])
11370     fi
11371 else
11372     if test "$enable_online_update" = "mar"; then
11373         AC_MSG_RESULT([yes - MAR-based online update])
11374         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11375         if test "$with_update_config" = ""; then
11376             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11377         fi
11378         UPDATE_CONFIG="$with_update_config"
11379         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11380     elif test "$enable_online_update" = "yes"; then
11381         AC_MSG_RESULT([yes])
11382         ENABLE_ONLINE_UPDATE="TRUE"
11383     else
11384         AC_MSG_RESULT([no])
11385     fi
11387 AC_SUBST(ENABLE_ONLINE_UPDATE)
11388 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11389 AC_SUBST(UPDATE_CONFIG)
11391 dnl ===================================================================
11392 dnl Test whether we need bzip2
11393 dnl ===================================================================
11394 SYSTEM_BZIP2=
11395 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11396     AC_MSG_CHECKING([whether to use system bzip2])
11397     if test "$with_system_bzip2" = yes; then
11398         SYSTEM_BZIP2=TRUE
11399         AC_MSG_RESULT([yes])
11400         PKG_CHECK_MODULES(BZIP2, bzip2)
11401         FilterLibs "${BZIP2_LIBS}"
11402         BZIP2_LIBS="${filteredlibs}"
11403     else
11404         AC_MSG_RESULT([no])
11405         BUILD_TYPE="$BUILD_TYPE BZIP2"
11406     fi
11408 AC_SUBST(SYSTEM_BZIP2)
11409 AC_SUBST(BZIP2_CFLAGS)
11410 AC_SUBST(BZIP2_LIBS)
11412 dnl ===================================================================
11413 dnl Test whether to enable extension update
11414 dnl ===================================================================
11415 AC_MSG_CHECKING([whether to enable extension update])
11416 ENABLE_EXTENSION_UPDATE=
11417 if test "x$enable_extension_update" = "xno"; then
11418     AC_MSG_RESULT([no])
11419 else
11420     AC_MSG_RESULT([yes])
11421     ENABLE_EXTENSION_UPDATE="TRUE"
11422     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11423     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11425 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11428 dnl ===================================================================
11429 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11430 dnl ===================================================================
11431 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11432 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11433     AC_MSG_RESULT([no])
11434     ENABLE_SILENT_MSI=
11435 else
11436     AC_MSG_RESULT([yes])
11437     ENABLE_SILENT_MSI=TRUE
11438     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11440 AC_SUBST(ENABLE_SILENT_MSI)
11442 AC_MSG_CHECKING([whether and how to use Xinerama])
11443 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11444     if test "$x_libraries" = "default_x_libraries"; then
11445         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11446         if test "x$XINERAMALIB" = x; then
11447            XINERAMALIB="/usr/lib"
11448         fi
11449     else
11450         XINERAMALIB="$x_libraries"
11451     fi
11452     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11453         # we have both versions, let the user decide but use the dynamic one
11454         # per default
11455         USE_XINERAMA=TRUE
11456         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11457             XINERAMA_LINK=dynamic
11458         else
11459             XINERAMA_LINK=static
11460         fi
11461     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11462         # we have only the dynamic version
11463         USE_XINERAMA=TRUE
11464         XINERAMA_LINK=dynamic
11465     elif test -e "$XINERAMALIB/libXinerama.a"; then
11466         # static version
11467         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11468             USE_XINERAMA=TRUE
11469             XINERAMA_LINK=static
11470         else
11471             USE_XINERAMA=
11472             XINERAMA_LINK=none
11473         fi
11474     else
11475         # no Xinerama
11476         USE_XINERAMA=
11477         XINERAMA_LINK=none
11478     fi
11479     if test "$USE_XINERAMA" = "TRUE"; then
11480         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11481         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11482             [AC_MSG_ERROR(Xinerama header not found.)], [])
11483         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11484         if test "x$XEXTLIB" = x; then
11485            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11486         fi
11487         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11488         if test "$_os" = "FreeBSD"; then
11489             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11490         fi
11491         if test "$_os" = "Linux"; then
11492             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11493         fi
11494         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11495             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11496     else
11497         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11498     fi
11499 else
11500     USE_XINERAMA=
11501     XINERAMA_LINK=none
11502     AC_MSG_RESULT([no])
11504 AC_SUBST(USE_XINERAMA)
11505 AC_SUBST(XINERAMA_LINK)
11507 dnl ===================================================================
11508 dnl Test whether to build cairo or rely on the system version
11509 dnl ===================================================================
11511 if test "$USING_X11" = TRUE; then
11512     # Used in vcl/Library_vclplug_gen.mk
11513     test_cairo=yes
11516 if test "$test_cairo" = "yes"; then
11517     AC_MSG_CHECKING([whether to use the system cairo])
11519     : ${with_system_cairo:=$with_system_libs}
11520     if test "$with_system_cairo" = "yes"; then
11521         SYSTEM_CAIRO=TRUE
11522         AC_MSG_RESULT([yes])
11524         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11525         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11526         FilterLibs "${CAIRO_LIBS}"
11527         CAIRO_LIBS="${filteredlibs}"
11529         if test "$test_xrender" = "yes"; then
11530             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11531             AC_LANG_PUSH([C])
11532             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11533 #ifdef PictStandardA8
11534 #else
11535       return fail;
11536 #endif
11537 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11539             AC_LANG_POP([C])
11540         fi
11541     else
11542         SYSTEM_CAIRO=
11543         AC_MSG_RESULT([no])
11545         BUILD_TYPE="$BUILD_TYPE CAIRO"
11546     fi
11549 AC_SUBST(SYSTEM_CAIRO)
11550 AC_SUBST(CAIRO_CFLAGS)
11551 AC_SUBST(CAIRO_LIBS)
11553 dnl ===================================================================
11554 dnl Test whether to use avahi
11555 dnl ===================================================================
11556 if test "$_os" = "WINNT"; then
11557     # Windows uses bundled mDNSResponder
11558     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11559 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11560     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11561                       [ENABLE_AVAHI="TRUE"])
11562     AC_DEFINE(HAVE_FEATURE_AVAHI)
11563     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11564     FilterLibs "${AVAHI_LIBS}"
11565     AVAHI_LIBS="${filteredlibs}"
11568 AC_SUBST(ENABLE_AVAHI)
11569 AC_SUBST(AVAHI_CFLAGS)
11570 AC_SUBST(AVAHI_LIBS)
11572 dnl ===================================================================
11573 dnl Test whether to use liblangtag
11574 dnl ===================================================================
11575 SYSTEM_LIBLANGTAG=
11576 AC_MSG_CHECKING([whether to use system liblangtag])
11577 if test "$with_system_liblangtag" = yes; then
11578     SYSTEM_LIBLANGTAG=TRUE
11579     AC_MSG_RESULT([yes])
11580     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11581     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11582     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11583     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11584     FilterLibs "${LIBLANGTAG_LIBS}"
11585     LIBLANGTAG_LIBS="${filteredlibs}"
11586 else
11587     SYSTEM_LIBLANGTAG=
11588     AC_MSG_RESULT([no])
11589     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11590     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11591     if test "$COM" = "MSC"; then
11592         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11593     else
11594         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11595     fi
11597 AC_SUBST(SYSTEM_LIBLANGTAG)
11598 AC_SUBST(LIBLANGTAG_CFLAGS)
11599 AC_SUBST(LIBLANGTAG_LIBS)
11601 dnl ===================================================================
11602 dnl Test whether to build libpng or rely on the system version
11603 dnl ===================================================================
11605 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11607 dnl ===================================================================
11608 dnl Check for runtime JVM search path
11609 dnl ===================================================================
11610 if test "$ENABLE_JAVA" != ""; then
11611     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11612     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11613         AC_MSG_RESULT([yes])
11614         if ! test -d "$with_jvm_path"; then
11615             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11616         fi
11617         if ! test -d "$with_jvm_path"jvm; then
11618             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11619         fi
11620         JVM_ONE_PATH_CHECK="$with_jvm_path"
11621         AC_SUBST(JVM_ONE_PATH_CHECK)
11622     else
11623         AC_MSG_RESULT([no])
11624     fi
11627 dnl ===================================================================
11628 dnl Test for the presence of Ant and that it works
11629 dnl ===================================================================
11631 if test "$ENABLE_JAVA" != ""; then
11632     ANT_HOME=; export ANT_HOME
11633     WITH_ANT_HOME=; export WITH_ANT_HOME
11634     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11635         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11636             if test "$_os" = "WINNT"; then
11637                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11638             else
11639                 with_ant_home="$LODE_HOME/opt/ant"
11640             fi
11641         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11642             with_ant_home="$LODE_HOME/opt/ant"
11643         fi
11644     fi
11645     if test -z "$with_ant_home"; then
11646         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11647     else
11648         if test "$_os" = "WINNT"; then
11649             # AC_PATH_PROGS needs unix path
11650             with_ant_home=`cygpath -u "$with_ant_home"`
11651         fi
11652         AbsolutePath "$with_ant_home"
11653         with_ant_home=$absolute_path
11654         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11655         WITH_ANT_HOME=$with_ant_home
11656         ANT_HOME=$with_ant_home
11657     fi
11659     if test -z "$ANT"; then
11660         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11661     else
11662         # resolve relative or absolute symlink
11663         while test -h "$ANT"; do
11664             a_cwd=`pwd`
11665             a_basename=`basename "$ANT"`
11666             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11667             cd "`dirname "$ANT"`"
11668             cd "`dirname "$a_script"`"
11669             ANT="`pwd`"/"`basename "$a_script"`"
11670             cd "$a_cwd"
11671         done
11673         AC_MSG_CHECKING([if $ANT works])
11674         cat > conftest.java << EOF
11675         public class conftest {
11676             int testmethod(int a, int b) {
11677                     return a + b;
11678             }
11679         }
11682         cat > conftest.xml << EOF
11683         <project name="conftest" default="conftest">
11684         <target name="conftest">
11685             <javac srcdir="." includes="conftest.java">
11686             </javac>
11687         </target>
11688         </project>
11691         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11692         if test $? = 0 -a -f ./conftest.class; then
11693             AC_MSG_RESULT([Ant works])
11694             if test -z "$WITH_ANT_HOME"; then
11695                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11696                 if test -z "$ANT_HOME"; then
11697                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11698                 fi
11699             else
11700                 ANT_HOME="$WITH_ANT_HOME"
11701             fi
11702         else
11703             echo "configure: Ant test failed" >&5
11704             cat conftest.java >&5
11705             cat conftest.xml >&5
11706             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11707         fi
11708         rm -f conftest* core core.* *.core
11709     fi
11710     if test -z "$ANT_HOME"; then
11711         ANT_HOME="NO_ANT_HOME"
11712     else
11713         PathFormat "$ANT_HOME"
11714         ANT_HOME="$formatted_path"
11715         PathFormat "$ANT"
11716         ANT="$formatted_path"
11717     fi
11718     AC_SUBST(ANT_HOME)
11719     AC_SUBST(ANT)
11721     dnl Checking for ant.jar
11722     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11723         AC_MSG_CHECKING([Ant lib directory])
11724         if test -f $ANT_HOME/lib/ant.jar; then
11725             ANT_LIB="$ANT_HOME/lib"
11726         else
11727             if test -f $ANT_HOME/ant.jar; then
11728                 ANT_LIB="$ANT_HOME"
11729             else
11730                 if test -f /usr/share/java/ant.jar; then
11731                     ANT_LIB=/usr/share/java
11732                 else
11733                     if test -f /usr/share/ant-core/lib/ant.jar; then
11734                         ANT_LIB=/usr/share/ant-core/lib
11735                     else
11736                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11737                             ANT_LIB="$ANT_HOME/lib/ant"
11738                         else
11739                             if test -f /usr/share/lib/ant/ant.jar; then
11740                                 ANT_LIB=/usr/share/lib/ant
11741                             else
11742                                 AC_MSG_ERROR([Ant libraries not found!])
11743                             fi
11744                         fi
11745                     fi
11746                 fi
11747             fi
11748         fi
11749         PathFormat "$ANT_LIB"
11750         ANT_LIB="$formatted_path"
11751         AC_MSG_RESULT([Ant lib directory found.])
11752     fi
11753     AC_SUBST(ANT_LIB)
11755     ant_minver=1.6.0
11756     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11758     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11759     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11760     ant_version_major=`echo $ant_version | cut -d. -f1`
11761     ant_version_minor=`echo $ant_version | cut -d. -f2`
11762     echo "configure: ant_version $ant_version " >&5
11763     echo "configure: ant_version_major $ant_version_major " >&5
11764     echo "configure: ant_version_minor $ant_version_minor " >&5
11765     if test "$ant_version_major" -ge "2"; then
11766         AC_MSG_RESULT([yes, $ant_version])
11767     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11768         AC_MSG_RESULT([yes, $ant_version])
11769     else
11770         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11771     fi
11773     rm -f conftest* core core.* *.core
11776 OOO_JUNIT_JAR=
11777 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11778     AC_MSG_CHECKING([for JUnit 4])
11779     if test "$with_junit" = "yes"; then
11780         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
11781             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
11782         elif test -e /usr/share/java/junit4.jar; then
11783             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11784         else
11785            if test -e /usr/share/lib/java/junit.jar; then
11786               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11787            else
11788               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11789            fi
11790         fi
11791     else
11792         OOO_JUNIT_JAR=$with_junit
11793     fi
11794     if test "$_os" = "WINNT"; then
11795         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11796     fi
11797     printf 'import org.junit.Before;' > conftest.java
11798     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11799         AC_MSG_RESULT([$OOO_JUNIT_JAR])
11800     else
11801         AC_MSG_ERROR(
11802 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
11803  specify its pathname via --with-junit=..., or disable it via --without-junit])
11804     fi
11805     rm -f conftest.class conftest.java
11806     if test $OOO_JUNIT_JAR != ""; then
11807     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11808     fi
11810 AC_SUBST(OOO_JUNIT_JAR)
11812 HAMCREST_JAR=
11813 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11814     AC_MSG_CHECKING([for included Hamcrest])
11815     printf 'import org.hamcrest.BaseDescription;' > conftest.java
11816     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11817         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
11818     else
11819         AC_MSG_RESULT([Not included])
11820         AC_MSG_CHECKING([for standalone hamcrest jar.])
11821         if test "$with_hamcrest" = "yes"; then
11822             if test -e /usr/share/lib/java/hamcrest.jar; then
11823                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
11824             elif test -e /usr/share/java/hamcrest/core.jar; then
11825                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
11826             else
11827                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
11828             fi
11829         else
11830             HAMCREST_JAR=$with_hamcrest
11831         fi
11832         if test "$_os" = "WINNT"; then
11833             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
11834         fi
11835         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
11836             AC_MSG_RESULT([$HAMCREST_JAR])
11837         else
11838             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),
11839                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
11840         fi
11841     fi
11842     rm -f conftest.class conftest.java
11844 AC_SUBST(HAMCREST_JAR)
11847 AC_SUBST(SCPDEFS)
11850 # check for wget and curl
11852 WGET=
11853 CURL=
11855 if test "$enable_fetch_external" != "no"; then
11857 CURL=`which curl 2>/dev/null`
11859 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
11860     # wget new enough?
11861     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
11862     if test $? -eq 0; then
11863         WGET=$i
11864         break
11865     fi
11866 done
11868 if test -z "$WGET" -a -z "$CURL"; then
11869     AC_MSG_ERROR([neither wget nor curl found!])
11874 AC_SUBST(WGET)
11875 AC_SUBST(CURL)
11878 # check for sha256sum
11880 SHA256SUM=
11882 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
11883     eval "$i -a 256 --version" > /dev/null 2>&1
11884     ret=$?
11885     if test $ret -eq 0; then
11886         SHA256SUM="$i -a 256"
11887         break
11888     fi
11889 done
11891 if test -z "$SHA256SUM"; then
11892     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
11893         eval "$i --version" > /dev/null 2>&1
11894         ret=$?
11895         if test $ret -eq 0; then
11896             SHA256SUM=$i
11897             break
11898         fi
11899     done
11902 if test -z "$SHA256SUM"; then
11903     AC_MSG_ERROR([no sha256sum found!])
11906 AC_SUBST(SHA256SUM)
11908 dnl ===================================================================
11909 dnl Dealing with l10n options
11910 dnl ===================================================================
11911 AC_MSG_CHECKING([which languages to be built])
11912 # get list of all languages
11913 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
11914 # the sed command does the following:
11915 #   + if a line ends with a backslash, append the next line to it
11916 #   + adds " on the beginning of the value (after =)
11917 #   + adds " at the end of the value
11918 #   + removes en-US; we want to put it on the beginning
11919 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
11920 [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)]
11921 ALL_LANGS="en-US $completelangiso"
11922 # check the configured localizations
11923 WITH_LANG="$with_lang"
11924 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
11925     AC_MSG_RESULT([en-US])
11926 else
11927     AC_MSG_RESULT([$WITH_LANG])
11928     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
11929     if test -z "$MSGFMT"; then
11930         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
11931             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
11932         elif test -x "/opt/lo/bin/msgfmt"; then
11933             MSGFMT="/opt/lo/bin/msgfmt"
11934         else
11935             AC_CHECK_PROGS(MSGFMT, [msgfmt])
11936             if test -z "$MSGFMT"; then
11937                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
11938             fi
11939         fi
11940     fi
11941     if test -z "$MSGUNIQ"; then
11942         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
11943             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
11944         elif test -x "/opt/lo/bin/msguniq"; then
11945             MSGUNIQ="/opt/lo/bin/msguniq"
11946         else
11947             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
11948             if test -z "$MSGUNIQ"; then
11949                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
11950             fi
11951         fi
11952     fi
11954 AC_SUBST(MSGFMT)
11955 AC_SUBST(MSGUNIQ)
11956 # check that the list is valid
11957 for lang in $WITH_LANG; do
11958     test "$lang" = "ALL" && continue
11959     # need to check for the exact string, so add space before and after the list of all languages
11960     for vl in $ALL_LANGS; do
11961         if test "$vl" = "$lang"; then
11962            break
11963         fi
11964     done
11965     if test "$vl" != "$lang"; then
11966         # if you're reading this - you prolly quoted your languages remove the quotes ...
11967         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
11968     fi
11969 done
11970 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
11971     echo $WITH_LANG | grep -q en-US
11972     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
11974 # list with substituted ALL
11975 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
11976 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
11977 test "$WITH_LANG" = "en-US" && WITH_LANG=
11978 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
11979     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
11980     ALL_LANGS=`echo $ALL_LANGS qtz`
11982 AC_SUBST(ALL_LANGS)
11983 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
11984 AC_SUBST(WITH_LANG)
11985 AC_SUBST(WITH_LANG_LIST)
11986 AC_SUBST(GIT_NEEDED_SUBMODULES)
11988 WITH_POOR_HELP_LOCALIZATIONS=
11989 if test -d "$SRC_ROOT/translations/source"; then
11990     for l in `ls -1 $SRC_ROOT/translations/source`; do
11991         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
11992             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
11993         fi
11994     done
11996 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
11998 if test -n "$with_locales"; then
11999     WITH_LOCALES="$with_locales"
12001     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12002     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12003     # config_host/config_locales.h.in
12004     for locale in $WITH_LOCALES; do
12005         lang=${locale%_*}
12007         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12009         case $lang in
12010         hi|mr*ne)
12011             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12012             ;;
12013         bg|ru)
12014             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12015             ;;
12016         esac
12017     done
12018 else
12019     AC_DEFINE(WITH_LOCALE_ALL)
12021 AC_SUBST(WITH_LOCALES)
12023 dnl git submodule update --reference
12024 dnl ===================================================================
12025 if test -n "${GIT_REFERENCE_SRC}"; then
12026     for repo in ${GIT_NEEDED_SUBMODULES}; do
12027         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12028             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12029         fi
12030     done
12032 AC_SUBST(GIT_REFERENCE_SRC)
12034 dnl git submodules linked dirs
12035 dnl ===================================================================
12036 if test -n "${GIT_LINK_SRC}"; then
12037     for repo in ${GIT_NEEDED_SUBMODULES}; do
12038         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12039             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12040         fi
12041     done
12043 AC_SUBST(GIT_LINK_SRC)
12045 dnl branding
12046 dnl ===================================================================
12047 AC_MSG_CHECKING([for alternative branding images directory])
12048 # initialize mapped arrays
12049 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12050 brand_files="$BRAND_INTRO_IMAGES about.svg"
12052 if test -z "$with_branding" -o "$with_branding" = "no"; then
12053     AC_MSG_RESULT([none])
12054     DEFAULT_BRAND_IMAGES="$brand_files"
12055 else
12056     if ! test -d $with_branding ; then
12057         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12058     else
12059         AC_MSG_RESULT([$with_branding])
12060         CUSTOM_BRAND_DIR="$with_branding"
12061         for lfile in $brand_files
12062         do
12063             if ! test -f $with_branding/$lfile ; then
12064                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12065                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12066             else
12067                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12068             fi
12069         done
12070         check_for_progress="yes"
12071     fi
12073 AC_SUBST([BRAND_INTRO_IMAGES])
12074 AC_SUBST([CUSTOM_BRAND_DIR])
12075 AC_SUBST([CUSTOM_BRAND_IMAGES])
12076 AC_SUBST([DEFAULT_BRAND_IMAGES])
12079 AC_MSG_CHECKING([for 'intro' progress settings])
12080 PROGRESSBARCOLOR=
12081 PROGRESSSIZE=
12082 PROGRESSPOSITION=
12083 PROGRESSFRAMECOLOR=
12084 PROGRESSTEXTCOLOR=
12085 PROGRESSTEXTBASELINE=
12087 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12088     source "$with_branding/progress.conf"
12089     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12090 else
12091     AC_MSG_RESULT([none])
12094 AC_SUBST(PROGRESSBARCOLOR)
12095 AC_SUBST(PROGRESSSIZE)
12096 AC_SUBST(PROGRESSPOSITION)
12097 AC_SUBST(PROGRESSFRAMECOLOR)
12098 AC_SUBST(PROGRESSTEXTCOLOR)
12099 AC_SUBST(PROGRESSTEXTBASELINE)
12102 AC_MSG_CHECKING([for extra build ID])
12103 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12104     EXTRA_BUILDID="$with_extra_buildid"
12106 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12107 if test -n "$EXTRA_BUILDID" ; then
12108     AC_MSG_RESULT([$EXTRA_BUILDID])
12109 else
12110     AC_MSG_RESULT([not set])
12112 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12114 OOO_VENDOR=
12115 AC_MSG_CHECKING([for vendor])
12116 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12117     OOO_VENDOR="$USERNAME"
12119     if test -z "$OOO_VENDOR"; then
12120         OOO_VENDOR="$USER"
12121     fi
12123     if test -z "$OOO_VENDOR"; then
12124         OOO_VENDOR="`id -u -n`"
12125     fi
12127     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12128 else
12129     OOO_VENDOR="$with_vendor"
12130     AC_MSG_RESULT([$OOO_VENDOR])
12132 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12133 AC_SUBST(OOO_VENDOR)
12135 if test "$_os" = "Android" ; then
12136     ANDROID_PACKAGE_NAME=
12137     AC_MSG_CHECKING([for Android package name])
12138     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12139         if test -n "$ENABLE_DEBUG"; then
12140             # Default to the package name that makes ndk-gdb happy.
12141             ANDROID_PACKAGE_NAME="org.libreoffice"
12142         else
12143             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12144         fi
12146         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12147     else
12148         ANDROID_PACKAGE_NAME="$with_android_package_name"
12149         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12150     fi
12151     AC_SUBST(ANDROID_PACKAGE_NAME)
12154 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12155 if test "$with_compat_oowrappers" = "yes"; then
12156     WITH_COMPAT_OOWRAPPERS=TRUE
12157     AC_MSG_RESULT(yes)
12158 else
12159     WITH_COMPAT_OOWRAPPERS=
12160     AC_MSG_RESULT(no)
12162 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12164 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12165 AC_MSG_CHECKING([for install dirname])
12166 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12167     INSTALLDIRNAME="$with_install_dirname"
12169 AC_MSG_RESULT([$INSTALLDIRNAME])
12170 AC_SUBST(INSTALLDIRNAME)
12172 AC_MSG_CHECKING([for prefix])
12173 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12174 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12175 PREFIXDIR="$prefix"
12176 AC_MSG_RESULT([$PREFIXDIR])
12177 AC_SUBST(PREFIXDIR)
12179 LIBDIR=[$(eval echo $(eval echo $libdir))]
12180 AC_SUBST(LIBDIR)
12182 DATADIR=[$(eval echo $(eval echo $datadir))]
12183 AC_SUBST(DATADIR)
12185 MANDIR=[$(eval echo $(eval echo $mandir))]
12186 AC_SUBST(MANDIR)
12188 DOCDIR=[$(eval echo $(eval echo $docdir))]
12189 AC_SUBST(DOCDIR)
12191 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12192 AC_SUBST(INSTALLDIR)
12194 TESTINSTALLDIR="${BUILDDIR}/test-install"
12195 AC_SUBST(TESTINSTALLDIR)
12198 # ===================================================================
12199 # OAuth2 id and secrets
12200 # ===================================================================
12202 AC_MSG_CHECKING([for Google Drive client id and secret])
12203 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12204     AC_MSG_RESULT([not set])
12205     GDRIVE_CLIENT_ID="\"\""
12206     GDRIVE_CLIENT_SECRET="\"\""
12207 else
12208     AC_MSG_RESULT([set])
12209     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12210     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12212 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12213 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12215 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12216 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12217     AC_MSG_RESULT([not set])
12218     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12219     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12220 else
12221     AC_MSG_RESULT([set])
12222     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12223     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12225 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12226 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12228 AC_MSG_CHECKING([for OneDrive client id and secret])
12229 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12230     AC_MSG_RESULT([not set])
12231     ONEDRIVE_CLIENT_ID="\"\""
12232     ONEDRIVE_CLIENT_SECRET="\"\""
12233 else
12234     AC_MSG_RESULT([set])
12235     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12236     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12238 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12239 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12242 dnl ===================================================================
12243 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12244 dnl --enable-dependency-tracking configure option
12245 dnl ===================================================================
12246 AC_MSG_CHECKING([whether to enable dependency tracking])
12247 if test "$enable_dependency_tracking" = "no"; then
12248     nodep=TRUE
12249     AC_MSG_RESULT([no])
12250 else
12251     AC_MSG_RESULT([yes])
12253 AC_SUBST(nodep)
12255 dnl ===================================================================
12256 dnl Number of CPUs to use during the build
12257 dnl ===================================================================
12258 AC_MSG_CHECKING([for number of processors to use])
12259 # plain --with-parallelism is just the default
12260 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12261     if test "$with_parallelism" = "no"; then
12262         PARALLELISM=0
12263     else
12264         PARALLELISM=$with_parallelism
12265     fi
12266 else
12267     if test "$enable_icecream" = "yes"; then
12268         PARALLELISM="10"
12269     else
12270         case `uname -s` in
12272         Darwin|FreeBSD|NetBSD|OpenBSD)
12273             PARALLELISM=`sysctl -n hw.ncpu`
12274             ;;
12276         Linux)
12277             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12278         ;;
12279         # what else than above does profit here *and* has /proc?
12280         *)
12281             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12282             ;;
12283         esac
12285         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12286         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12287     fi
12290 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12291     if test -z "$with_parallelism"; then
12292             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12293             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12294             PARALLELISM="1"
12295     else
12296         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."
12297     fi
12300 if test $PARALLELISM -eq 0; then
12301     AC_MSG_RESULT([explicit make -j option needed])
12302 else
12303     AC_MSG_RESULT([$PARALLELISM])
12305 AC_SUBST(PARALLELISM)
12307 IWYU_PATH="$with_iwyu"
12308 AC_SUBST(IWYU_PATH)
12309 if test ! -z "$IWYU_PATH"; then
12310     if test ! -f "$IWYU_PATH"; then
12311         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12312     fi
12316 # Set up ILIB for MSVC build
12318 ILIB1=
12319 if test "$build_os" = "cygwin"; then
12320     ILIB="."
12321     if test -n "$JAVA_HOME"; then
12322         ILIB="$ILIB;$JAVA_HOME/lib"
12323     fi
12324     ILIB1=-link
12325     if test "$BITNESS_OVERRIDE" = 64; then
12326         if test $vcnum = "150"; then
12327             ILIB="$ILIB;$COMPATH/lib/x64"
12328             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12329         else
12330             ILIB="$ILIB;$COMPATH/lib/amd64"
12331             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/amd64"
12332         fi
12333         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12334         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12335         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12336             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12337             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12338         fi
12339         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12340         ucrtlibpath_formatted=$formatted_path
12341         ILIB="$ILIB;$ucrtlibpath_formatted"
12342         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12343     else
12344         if test $vcnum = "150"; then
12345             ILIB="$ILIB;$COMPATH/lib/x86"
12346             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12347         else
12348             ILIB="$ILIB;$COMPATH/lib"
12349             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib"
12350         fi
12351         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12352         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12353         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12354             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12355             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12356         fi
12357         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12358         ucrtlibpath_formatted=$formatted_path
12359         ILIB="$ILIB;$ucrtlibpath_formatted"
12360         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12361     fi
12362     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12363         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12364     else
12365         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12366     fi
12368     AC_SUBST(ILIB)
12371 dnl We should be able to drop the below check when bumping the GCC baseline to
12372 dnl 4.9, as <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54577>
12373 dnl "deque<T>::erase() still takes iterator instead of const_iterator" should be
12374 dnl fixed there with <https://gcc.gnu.org/git/?p=gcc.git;a=commit;
12375 dnl h=6b0e18ca48bb4b4c01e7b5be2b98849943fdcf91>:
12376 AC_MSG_CHECKING(
12377     [whether C++11 use of const_iterator in standard containers is broken])
12378 save_CXXFLAGS=$CXXFLAGS
12379 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12380 AC_LANG_PUSH([C++])
12381 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12382     #include <list>
12383     ]],[[
12384         std::list<int> l;
12385         l.erase(l.cbegin());
12386     ]])],
12387     [broken=no], [broken=yes])
12388 AC_LANG_POP([C++])
12389 CXXFLAGS=$save_CXXFLAGS
12390 AC_MSG_RESULT([$broken])
12391 if test "$broken" = yes; then
12392     AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
12396 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12397 save_CXXFLAGS=$CXXFLAGS
12398 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12399 save_LIBS=$LIBS
12400 if test -n "$ILIB1"; then
12401     LIBS="$LIBS $ILIB1"
12403 AC_LANG_PUSH([C++])
12404 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12405     // Exit with failure if the static initializer_list is stored on the
12406     // stack (as done by Clang < 3.4):
12407     #include <initializer_list>
12408     struct S {};
12409     bool g(void const * p1, void const * p2) {
12410         int n;
12411         return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12412     }
12413     bool f(void const * p1) {
12414         static std::initializer_list<S> s { S() };
12415         return g(p1, s.begin());
12416     }
12417     ]],[[
12418         int n;
12419         return f(&n) ? 0 : 1;
12420     ]])], [broken=no], [broken=yes],[broken='assuming not (cross-compiling)'])
12421 AC_LANG_POP([C++])
12422 LIBS=$save_LIBS
12423 CXXFLAGS=$save_CXXFLAGS
12424 AC_MSG_RESULT([$broken])
12425 if test "$broken" = yes -a "$_os" != "iOS"; then
12426     AC_MSG_ERROR([working support for static initializer_list needed])
12430 # ===================================================================
12431 # Creating bigger shared library to link against
12432 # ===================================================================
12433 AC_MSG_CHECKING([whether to create huge library])
12434 MERGELIBS=
12436 if test $_os = iOS -o $_os = Android; then
12437     # Never any point in mergelibs for these as we build just static
12438     # libraries anyway...
12439     enable_mergelibs=no
12442 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12443     if test $_os != Linux -a $_os != WINNT; then
12444         add_warning "--enable-mergelibs is not tested for this platform"
12445     fi
12446     MERGELIBS="TRUE"
12447     AC_MSG_RESULT([yes])
12448 else
12449     AC_MSG_RESULT([no])
12451 AC_SUBST([MERGELIBS])
12453 dnl ===================================================================
12454 dnl icerun is a wrapper that stops us spawning tens of processes
12455 dnl locally - for tools that can't be executed on the compile cluster
12456 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12457 dnl ===================================================================
12458 AC_MSG_CHECKING([whether to use icerun wrapper])
12459 ICECREAM_RUN=
12460 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12461     ICECREAM_RUN=icerun
12462     AC_MSG_RESULT([yes])
12463 else
12464     AC_MSG_RESULT([no])
12466 AC_SUBST(ICECREAM_RUN)
12468 dnl ===================================================================
12469 dnl Setup the ICECC_VERSION for the build the same way it was set for
12470 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12471 dnl ===================================================================
12472 x_ICECC_VERSION=[\#]
12473 if test -n "$ICECC_VERSION" ; then
12474     x_ICECC_VERSION=
12476 AC_SUBST(x_ICECC_VERSION)
12477 AC_SUBST(ICECC_VERSION)
12479 dnl ===================================================================
12481 AC_MSG_CHECKING([MPL subset])
12482 MPL_SUBSET=
12484 if test "$enable_mpl_subset" = "yes"; then
12485     warn_report=false
12486     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12487         warn_report=true
12488     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12489         warn_report=true
12490     fi
12491     if test "$warn_report" = "true"; then
12492         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12493     fi
12494     if test "x$enable_postgresql_sdbc" != "xno"; then
12495         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12496     fi
12497     if test "$enable_lotuswordpro" = "yes"; then
12498         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12499     fi
12500     if test "$WITH_WEBDAV" = "neon"; then
12501         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12502     fi
12503     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12504         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12505     fi
12506     if test -n "$ENABLE_PDFIMPORT"; then
12507         if test "x$SYSTEM_POPPLER" = "x"; then
12508             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12509         fi
12510     fi
12511     # cf. m4/libo_check_extension.m4
12512     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12513         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12514     fi
12515     for theme in $WITH_THEMES; do
12516         case $theme in
12517         breeze|default|sifr)
12518             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12519         *) : ;;
12520         esac
12521     done
12523     ENABLE_OPENGL_TRANSITIONS=
12525     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12526         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12527     fi
12529     MPL_SUBSET="TRUE"
12530     AC_DEFINE(MPL_HAVE_SUBSET)
12531     AC_MSG_RESULT([only])
12532 else
12533     AC_MSG_RESULT([no restrictions])
12535 AC_SUBST(MPL_SUBSET)
12537 dnl ===================================================================
12539 AC_MSG_CHECKING([formula logger])
12540 ENABLE_FORMULA_LOGGER=
12542 if test "x$enable_formula_logger" = "xyes"; then
12543     AC_MSG_RESULT([yes])
12544     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12545     ENABLE_FORMULA_LOGGER=TRUE
12546 elif test -n "$ENABLE_DBGUTIL" ; then
12547     AC_MSG_RESULT([yes])
12548     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12549     ENABLE_FORMULA_LOGGER=TRUE
12550 else
12551     AC_MSG_RESULT([no])
12554 AC_SUBST(ENABLE_FORMULA_LOGGER)
12556 dnl ===================================================================
12557 dnl Setting up the environment.
12558 dnl ===================================================================
12559 AC_MSG_NOTICE([setting up the build environment variables...])
12561 AC_SUBST(COMPATH)
12563 if test "$build_os" = "cygwin"; then
12564     if test -d "$COMPATH/atlmfc/lib"; then
12565         ATL_LIB="$COMPATH/atlmfc/lib"
12566         ATL_INCLUDE="$COMPATH/atlmfc/include"
12567     else
12568         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12569         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12570     fi
12571     if test "$BITNESS_OVERRIDE" = 64; then
12572         if test $VCVER = "150"; then
12573             ATL_LIB="$ATL_LIB/x64"
12574         else
12575             ATL_LIB="$ATL_LIB/amd64"
12576         fi
12577     else
12578         if test $VCVER = "150"; then
12579             ATL_LIB="$ATL_LIB/x86"
12580         fi
12581     fi
12582     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12583     PathFormat "/usr/bin/find.exe"
12584     FIND="$formatted_path"
12585     PathFormat "/usr/bin/sort.exe"
12586     SORT="$formatted_path"
12587     PathFormat "/usr/bin/grep.exe"
12588     WIN_GREP="$formatted_path"
12589     PathFormat "/usr/bin/ls.exe"
12590     WIN_LS="$formatted_path"
12591     PathFormat "/usr/bin/touch.exe"
12592     WIN_TOUCH="$formatted_path"
12593 else
12594     FIND=find
12595     SORT=sort
12598 AC_SUBST(ATL_INCLUDE)
12599 AC_SUBST(ATL_LIB)
12600 AC_SUBST(FIND)
12601 AC_SUBST(SORT)
12602 AC_SUBST(WIN_GREP)
12603 AC_SUBST(WIN_LS)
12604 AC_SUBST(WIN_TOUCH)
12606 AC_SUBST(BUILD_TYPE)
12608 AC_SUBST(SOLARINC)
12610 PathFormat "$PERL"
12611 PERL="$formatted_path"
12612 AC_SUBST(PERL)
12614 if test -n "$TMPDIR"; then
12615     TEMP_DIRECTORY="$TMPDIR"
12616 else
12617     TEMP_DIRECTORY="/tmp"
12619 if test "$build_os" = "cygwin"; then
12620     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12622 AC_SUBST(TEMP_DIRECTORY)
12624 # setup the PATH for the environment
12625 if test -n "$LO_PATH_FOR_BUILD"; then
12626     LO_PATH="$LO_PATH_FOR_BUILD"
12627 else
12628     LO_PATH="$PATH"
12630     case "$host_os" in
12632     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12633         if test "$ENABLE_JAVA" != ""; then
12634             pathmunge "$JAVA_HOME/bin" "after"
12635         fi
12636         ;;
12638     cygwin*)
12639         # Win32 make needs native paths
12640         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12641             LO_PATH=`cygpath -p -m "$PATH"`
12642         fi
12643         if test "$BITNESS_OVERRIDE" = 64; then
12644             # needed for msi packaging
12645             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12646         fi
12647         # .NET 4.6 and higher don't have bin directory
12648         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12649             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12650         fi
12651         pathmunge "$ASM_HOME" "before"
12652         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12653         pathmunge "$CSC_PATH" "before"
12654         pathmunge "$MIDL_PATH" "before"
12655         pathmunge "$AL_PATH" "before"
12656         pathmunge "$MSPDB_PATH" "before"
12657         if test -n "$MSBUILD_PATH" ; then
12658             pathmunge "$MSBUILD_PATH" "before"
12659         fi
12660         if test "$BITNESS_OVERRIDE" = 64; then
12661             pathmunge "$COMPATH/bin/amd64" "before"
12662             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12663         else
12664             pathmunge "$COMPATH/bin" "before"
12665             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12666         fi
12667         if test "$ENABLE_JAVA" != ""; then
12668             if test -d "$JAVA_HOME/jre/bin/client"; then
12669                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12670             fi
12671             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12672                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12673             fi
12674             pathmunge "$JAVA_HOME/bin" "before"
12675         fi
12676         ;;
12678     solaris*)
12679         pathmunge "/usr/css/bin" "before"
12680         if test "$ENABLE_JAVA" != ""; then
12681             pathmunge "$JAVA_HOME/bin" "after"
12682         fi
12683         ;;
12684     esac
12687 AC_SUBST(LO_PATH)
12689 libo_FUZZ_SUMMARY
12691 # Generate a configuration sha256 we can use for deps
12692 if test -f config_host.mk; then
12693     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12695 if test -f config_host_lang.mk; then
12696     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12699 CFLAGS=$my_original_CFLAGS
12700 CXXFLAGS=$my_original_CXXFLAGS
12701 CPPFLAGS=$my_original_CPPFLAGS
12703 AC_CONFIG_FILES([config_host.mk
12704                  config_host_lang.mk
12705                  Makefile
12706                  lo.xcent
12707                  bin/bffvalidator.sh
12708                  bin/odfvalidator.sh
12709                  bin/officeotron.sh
12710                  instsetoo_native/util/openoffice.lst
12711                  sysui/desktop/macosx/Info.plist])
12712 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12713 AC_CONFIG_HEADERS([config_host/config_clang.h])
12714 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12715 AC_CONFIG_HEADERS([config_host/config_eot.h])
12716 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12717 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12718 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12719 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12720 AC_CONFIG_HEADERS([config_host/config_features.h])
12721 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12722 AC_CONFIG_HEADERS([config_host/config_folders.h])
12723 AC_CONFIG_HEADERS([config_host/config_gio.h])
12724 AC_CONFIG_HEADERS([config_host/config_global.h])
12725 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12726 AC_CONFIG_HEADERS([config_host/config_java.h])
12727 AC_CONFIG_HEADERS([config_host/config_langs.h])
12728 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12729 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12730 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12731 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
12732 AC_CONFIG_HEADERS([config_host/config_locales.h])
12733 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12734 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12735 AC_CONFIG_HEADERS([config_host/config_qt5.h])
12736 AC_CONFIG_HEADERS([config_host/config_kde5.h])
12737 AC_CONFIG_HEADERS([config_host/config_gtk3_kde5.h])
12738 AC_CONFIG_HEADERS([config_host/config_oox.h])
12739 AC_CONFIG_HEADERS([config_host/config_options.h])
12740 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12741 AC_CONFIG_HEADERS([config_host/config_test.h])
12742 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12743 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12744 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12745 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12746 AC_CONFIG_HEADERS([config_host/config_version.h])
12747 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12748 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12749 AC_CONFIG_HEADERS([config_host/config_python.h])
12750 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12751 AC_OUTPUT
12753 if test "$CROSS_COMPILING" = TRUE; then
12754     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12757 # touch the config timestamp file
12758 if test ! -f config_host.mk.stamp; then
12759     echo > config_host.mk.stamp
12760 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12761     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12762 else
12763     echo > config_host.mk.stamp
12766 # touch the config lang timestamp file
12767 if test ! -f config_host_lang.mk.stamp; then
12768     echo > config_host_lang.mk.stamp
12769 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12770     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12771 else
12772     echo > config_host_lang.mk.stamp
12776 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12778 cat << _EOS
12779 ****************************************************************************
12780 WARNING:
12781 Your make version is known to be horribly slow, and hard to debug
12782 problems with. To get a reasonably functional make please do:
12784 to install a pre-compiled binary make for Win32
12786  mkdir -p /opt/lo/bin
12787  cd /opt/lo/bin
12788  wget https://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
12789  cp make-85047eb-msvc.exe make
12790  chmod +x make
12792 to install from source:
12793 place yourself in a working directory of you choice.
12795  git clone git://git.savannah.gnu.org/make.git
12797  [go to Start menu, click "All Programs", click "Visual Studio 2015", click "Visual Studio Tools", double-click "VS2015 x86 Native Tools Command Prompt" or "VS2015 x64 Native Tools Command Prompt"]
12798  set PATH=%PATH%;C:\Cygwin\bin
12799  [or Cygwin64, if that is what you have]
12800  cd path-to-make-repo-you-cloned-above
12801  build_w32.bat --without-guile
12803 should result in a WinRel/gnumake.exe.
12804 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12806 Then re-run autogen.sh
12808 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12809 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12811 _EOS
12814 cat << _EOF
12815 ****************************************************************************
12817 To build, run:
12818 $GNUMAKE
12820 To view some help, run:
12821 $GNUMAKE help
12823 _EOF
12825 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12826     cat << _EOF
12827 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12828 _EOF
12830     if test $_os = Darwin; then
12831         echo open instdir/$PRODUCTNAME.app
12832     else
12833         echo instdir/program/soffice
12834     fi
12835     cat << _EOF
12837 If you want to run the smoketest, run:
12838 $GNUMAKE check
12840 _EOF
12843 if test -f warn; then
12844     cat warn
12845     rm warn
12848 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: