Bump version to 6.1.7.16
[LibreOffice.git] / configure.ac
blob41023489ba9bfa9684446f073b2d14455aa875bb
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 powered by CIB],[6.1.7.16],[],[],[https://libreoffice.cib.eu/])
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_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
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 AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
941 else
942 ENDIANNESS=little
944 AC_SUBST(ENDIANNESS)
946 if test $_os != "WINNT"; then
947     save_LIBS="$LIBS"
948     AC_SEARCH_LIBS([dlsym], [dl],
949         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
950         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
951     LIBS="$save_LIBS"
953 AC_SUBST(DLOPEN_LIBS)
955 ###############################################################################
956 # Extensions switches --enable/--disable
957 ###############################################################################
958 # By default these should be enabled unless having extra dependencies.
959 # If there is extra dependency over configure options then the enable should
960 # be automagic based on whether the requiring feature is enabled or not.
961 # All this options change anything only with --enable-extension-integration.
963 # The name of this option and its help string makes it sound as if
964 # extensions are built anyway, just not integrated in the installer,
965 # if you use --disable-extension-integration. Is that really the
966 # case?
968 AC_ARG_ENABLE(ios-simulator,
969     AS_HELP_STRING([--enable-ios-simulator],
970         [build i386 or x86_64 for ios simulator])
973 libo_FUZZ_ARG_ENABLE(extension-integration,
974     AS_HELP_STRING([--disable-extension-integration],
975         [Disable integration of the built extensions in the installer of the
976          product. Use this switch to disable the integration.])
979 AC_ARG_ENABLE(avmedia,
980     AS_HELP_STRING([--disable-avmedia],
981         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
984 AC_ARG_ENABLE(database-connectivity,
985     AS_HELP_STRING([--disable-database-connectivity],
986         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
989 # This doesn't mean not building (or "integrating") extensions
990 # (although it probably should; i.e. it should imply
991 # --disable-extension-integration I guess), it means not supporting
992 # any extension mechanism at all
993 libo_FUZZ_ARG_ENABLE(extensions,
994     AS_HELP_STRING([--disable-extensions],
995         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
998 AC_ARG_ENABLE(scripting,
999     AS_HELP_STRING([--disable-scripting],
1000         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1003 # This is mainly for Android and iOS, but could potentially be used in some
1004 # special case otherwise, too, so factored out as a separate setting
1006 AC_ARG_ENABLE(dynamic-loading,
1007     AS_HELP_STRING([--disable-dynamic-loading],
1008         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1011 libo_FUZZ_ARG_ENABLE(ext-mariadb-connector,
1012     AS_HELP_STRING([--enable-ext-mariadb-connector],
1013         [Enable the build of the MariaDB/MySQL Connector extension.])
1016 libo_FUZZ_ARG_ENABLE(report-builder,
1017     AS_HELP_STRING([--disable-report-builder],
1018         [Disable the Report Builder.])
1021 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1022     AS_HELP_STRING([--enable-ext-wiki-publisher],
1023         [Enable the Wiki Publisher extension.])
1026 libo_FUZZ_ARG_ENABLE(lpsolve,
1027     AS_HELP_STRING([--disable-lpsolve],
1028         [Disable compilation of the lp solve solver ])
1030 libo_FUZZ_ARG_ENABLE(coinmp,
1031     AS_HELP_STRING([--disable-coinmp],
1032         [Disable compilation of the CoinMP solver ])
1035 libo_FUZZ_ARG_ENABLE(pdfimport,
1036     AS_HELP_STRING([--disable-pdfimport],
1037         [Disable building the PDF import feature.])
1040 libo_FUZZ_ARG_ENABLE(pdfium,
1041     AS_HELP_STRING([--disable-pdfium],
1042         [Disable building PDFium.])
1045 ###############################################################################
1047 dnl ---------- *** ----------
1049 libo_FUZZ_ARG_ENABLE(mergelibs,
1050     AS_HELP_STRING([--enable-mergelibs],
1051         [Merge several of the smaller libraries into one big, "merged", one.])
1054 libo_FUZZ_ARG_ENABLE(breakpad,
1055     AS_HELP_STRING([--enable-breakpad],
1056         [Enables breakpad for crash reporting.])
1059 libo_FUZZ_ARG_ENABLE(crashdump,
1060     AS_HELP_STRING([--disable-crashdump],
1061         [Disable dump.ini and dump-file, when --enable-breakpad])
1064 AC_ARG_ENABLE(fetch-external,
1065     AS_HELP_STRING([--disable-fetch-external],
1066         [Disables fetching external tarballs from web sources.])
1069 AC_ARG_ENABLE(fuzzers,
1070     AS_HELP_STRING([--enable-fuzzers],
1071         [Enables building libfuzzer targets for fuzz testing.])
1074 libo_FUZZ_ARG_ENABLE(pch,
1075     AS_HELP_STRING([--enable-pch],
1076         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1079 libo_FUZZ_ARG_ENABLE(epm,
1080     AS_HELP_STRING([--enable-epm],
1081         [LibreOffice includes self-packaging code, that requires epm, however epm is
1082          useless for large scale package building.])
1085 libo_FUZZ_ARG_ENABLE(odk,
1086     AS_HELP_STRING([--disable-odk],
1087         [LibreOffice includes an ODK, office development kit which some packagers may
1088          wish to build without.])
1091 AC_ARG_ENABLE(mpl-subset,
1092     AS_HELP_STRING([--enable-mpl-subset],
1093         [Don't compile any pieces which are not MPL or more liberally licensed])
1096 libo_FUZZ_ARG_ENABLE(evolution2,
1097     AS_HELP_STRING([--enable-evolution2],
1098         [Allows the built-in evolution 2 addressbook connectivity build to be
1099          enabled.])
1102 AC_ARG_ENABLE(avahi,
1103     AS_HELP_STRING([--enable-avahi],
1104         [Determines whether to use Avahi to advertise Impress to remote controls.])
1107 libo_FUZZ_ARG_ENABLE(werror,
1108     AS_HELP_STRING([--enable-werror],
1109         [Turn warnings to errors. (Has no effect in modules where the treating
1110          of warnings as errors is disabled explicitly.)]),
1113 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1114     AS_HELP_STRING([--enable-assert-always-abort],
1115         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1118 libo_FUZZ_ARG_ENABLE(dbgutil,
1119     AS_HELP_STRING([--enable-dbgutil],
1120         [Provide debugging support from --enable-debug and include additional debugging
1121          utilities such as object counting or more expensive checks.
1122          This is the recommended option for developers.
1123          Note that this makes the build ABI incompatible, it is not possible to mix object
1124          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1126 libo_FUZZ_ARG_ENABLE(debug,
1127     AS_HELP_STRING([--enable-debug],
1128         [Include debugging information, disable compiler optimization and inlining plus
1129          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1131 libo_FUZZ_ARG_ENABLE(sal-log,
1132     AS_HELP_STRING([--enable-sal-log],
1133         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1135 AC_ARG_ENABLE(selective-debuginfo,
1136     AS_HELP_STRING([--enable-selective-debuginfo],
1137         [If --enable-debug or --enable-dbgutil is used, build debugging information
1138          (-g compiler flag) only for the specified gbuild build targets
1139          (where all means everything, - prepended means not to enable, / appended means
1140          everything in the directory; there is no ordering, more specific overrides
1141          more general, and disabling takes precedence).
1142          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1144 libo_FUZZ_ARG_ENABLE(symbols,
1145     AS_HELP_STRING([--enable-symbols],
1146         [Generate debug information.
1147          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1148          otherwise.]))
1150 libo_FUZZ_ARG_ENABLE(optimized,
1151     AS_HELP_STRING([--disable-optimized],
1152         [Whether to compile with optimization flags.
1153          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1154          otherwise.]))
1156 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1157     AS_HELP_STRING([--disable-runtime-optimizations],
1158         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1159          JVM JIT) that are known to interact badly with certain dynamic analysis
1160          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1161          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1162          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1164 AC_ARG_WITH(valgrind,
1165     AS_HELP_STRING([--with-valgrind],
1166         [Make availability of Valgrind headers a hard requirement.]))
1168 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1169     AS_HELP_STRING([--enable-compiler-plugins],
1170         [Enable compiler plugins that will perform additional checks during
1171          building. Enabled automatically by --enable-dbgutil.
1172          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1173 COMPILER_PLUGINS_DEBUG=
1174 if test "$enable_compiler_plugins" = debug; then
1175     enable_compiler_plugins=yes
1176     COMPILER_PLUGINS_DEBUG=TRUE
1179 libo_FUZZ_ARG_ENABLE(ooenv,
1180     AS_HELP_STRING([--disable-ooenv],
1181         [Disable ooenv for the instdir installation.]))
1183 libo_FUZZ_ARG_ENABLE(libnumbertext,
1184     AS_HELP_STRING([--disable-libnumbertext],
1185         [Disable use of numbertext external library.]))
1187 AC_ARG_ENABLE(lto,
1188     AS_HELP_STRING([--enable-lto],
1189         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1190          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1191          linker. For MSVC, this option is broken at the moment. This is experimental work
1192          in progress that shouldn't be used unless you are working on it.)]))
1194 AC_ARG_ENABLE(python,
1195     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1196         [Enables or disables Python support at run-time.
1197          Also specifies what Python to use. 'auto' is the default.
1198          'fully-internal' even forces the internal version for uses of Python
1199          during the build.]))
1201 libo_FUZZ_ARG_ENABLE(gtk,
1202     AS_HELP_STRING([--disable-gtk],
1203         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1204 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1206 libo_FUZZ_ARG_ENABLE(gtk3,
1207     AS_HELP_STRING([--disable-gtk3],
1208         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1209 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1211 AC_ARG_ENABLE(split-app-modules,
1212     AS_HELP_STRING([--enable-split-app-modules],
1213         [Split file lists for app modules, e.g. base, calc.
1214          Has effect only with make distro-pack-install]),
1217 AC_ARG_ENABLE(split-opt-features,
1218     AS_HELP_STRING([--enable-split-opt-features],
1219         [Split file lists for some optional features, e.g. pyuno, testtool.
1220          Has effect only with make distro-pack-install]),
1223 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1224     AS_HELP_STRING([--disable-cairo-canvas],
1225         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1228 libo_FUZZ_ARG_ENABLE(dbus,
1229     AS_HELP_STRING([--disable-dbus],
1230         [Determines whether to enable features that depend on dbus.
1231          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1232 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1234 libo_FUZZ_ARG_ENABLE(sdremote,
1235     AS_HELP_STRING([--disable-sdremote],
1236         [Determines whether to enable Impress remote control (i.e. the server component).]),
1237 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1239 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1240     AS_HELP_STRING([--disable-sdremote-bluetooth],
1241         [Determines whether to build sdremote with bluetooth support.
1242          Requires dbus on Linux.]))
1244 libo_FUZZ_ARG_ENABLE(gio,
1245     AS_HELP_STRING([--disable-gio],
1246         [Determines whether to use the GIO support.]),
1247 ,test "${enable_gio+set}" = set || enable_gio=yes)
1249 AC_ARG_ENABLE(kde4,
1250     AS_HELP_STRING([--enable-kde4],
1251         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1252          KDE4 are available.]),
1255 AC_ARG_ENABLE(qt5,
1256     AS_HELP_STRING([--enable-qt5],
1257         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1258          available.]),
1261 AC_ARG_ENABLE(kde5,
1262     AS_HELP_STRING([--enable-kde5],
1263         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1264          KF5 are available.]),
1267 AC_ARG_ENABLE(gtk3_kde5,
1268     AS_HELP_STRING([--enable-gtk3-kde5],
1269         [Determines whether to use Gtk3 vclplug with KDE file dialogs on
1270          platforms where Gtk3, Qt5 and Plasma is available.]),
1273 libo_FUZZ_ARG_ENABLE(gui,
1274     AS_HELP_STRING([--disable-gui],
1275         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1276          command-line option. Not related to LibreOffice Online functionality. Don't use
1277          unless you are certain you need to. Nobody will help you if you insist on trying
1278          this and run into problems.]),
1279 ,test "${enable_gui+set}" = set || enable_gui=yes)
1281 libo_FUZZ_ARG_ENABLE(randr,
1282     AS_HELP_STRING([--disable-randr],
1283         [Disable RandR support in the vcl project.]),
1284 ,test "${enable_randr+set}" = set || enable_randr=yes)
1286 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1287     AS_HELP_STRING([--disable-gstreamer-1-0],
1288         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1289 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1291 AC_ARG_ENABLE(gstreamer-0-10,
1292     AS_HELP_STRING([--enable-gstreamer-0-10],
1293         [Enable building with the gstreamer 0.10 avmedia backend.]),
1294 ,enable_gstreamer_0_10=no)
1296 libo_FUZZ_ARG_ENABLE(vlc,
1297     AS_HELP_STRING([--enable-vlc],
1298         [Enable building with the (experimental) VLC avmedia backend.]),
1299 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1301 libo_FUZZ_ARG_ENABLE(neon,
1302     AS_HELP_STRING([--disable-neon],
1303         [Disable neon and the compilation of webdav binding.]),
1306 libo_FUZZ_ARG_ENABLE([eot],
1307     [AS_HELP_STRING([--enable-eot],
1308         [Enable support for Embedded OpenType fonts.])],
1309 ,test "${enable_eot+set}" = set || enable_eot=no)
1311 libo_FUZZ_ARG_ENABLE(cve-tests,
1312     AS_HELP_STRING([--disable-cve-tests],
1313         [Prevent CVE tests to be executed]),
1316 libo_FUZZ_ARG_ENABLE(chart-tests,
1317     AS_HELP_STRING([--enable-chart-tests],
1318         [Executes chart XShape tests. In a perfect world these tests would be
1319          stable and everyone could run them, in reality it is best to run them
1320          only on a few machines that are known to work and maintained by people
1321          who can judge if a test failure is a regression or not.]),
1324 AC_ARG_ENABLE(build-unowinreg,
1325     AS_HELP_STRING([--enable-build-unowinreg],
1326         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1327          compiler is needed on Linux.]),
1330 AC_ARG_ENABLE(dependency-tracking,
1331     AS_HELP_STRING([--enable-dependency-tracking],
1332         [Do not reject slow dependency extractors.])[
1333   --disable-dependency-tracking
1334                           Disables generation of dependency information.
1335                           Speed up one-time builds.],
1338 AC_ARG_ENABLE(icecream,
1339     AS_HELP_STRING([--enable-icecream],
1340         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1341          It defaults to /opt/icecream for the location of the icecream gcc/g++
1342          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1345 libo_FUZZ_ARG_ENABLE(cups,
1346     AS_HELP_STRING([--disable-cups],
1347         [Do not build cups support.])
1350 AC_ARG_ENABLE(ccache,
1351     AS_HELP_STRING([--disable-ccache],
1352         [Do not try to use ccache automatically.
1353          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1354          CC/CXX are not yet set, and --enable-icecream is not given, we
1355          attempt to use ccache. --disable-ccache disables ccache completely.
1359 AC_ARG_ENABLE(64-bit,
1360     AS_HELP_STRING([--enable-64-bit],
1361         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1362          At the moment meaningful only for Windows.]), ,)
1364 libo_FUZZ_ARG_ENABLE(online-update,
1365     AS_HELP_STRING([--enable-online-update],
1366         [Enable the online update service that will check for new versions of
1367          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1368          If the value is "mar", the experimental Mozilla-like update will be
1369          enabled instead of the traditional update mechanism.]),
1372 AC_ARG_WITH(update-config,
1373     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1374                    [Path to the update config ini file]))
1376 libo_FUZZ_ARG_ENABLE(extension-update,
1377     AS_HELP_STRING([--disable-extension-update],
1378         [Disable possibility to update installed extensions.]),
1381 libo_FUZZ_ARG_ENABLE(release-build,
1382     AS_HELP_STRING([--enable-release-build],
1383         [Enable release build. Note that the "release build" choice is orthogonal to
1384          whether symbols are present, debug info is generated, or optimization
1385          is done.
1386          See http://wiki.documentfoundation.org/Development/DevBuild]),
1389 AC_ARG_ENABLE(windows-build-signing,
1390     AS_HELP_STRING([--enable-windows-build-signing],
1391         [Enable signing of windows binaries (*.exe, *.dll)]),
1394 AC_ARG_ENABLE(silent-msi,
1395     AS_HELP_STRING([--enable-silent-msi],
1396         [Enable MSI with LIMITUI=1 (silent install).]),
1399 AC_ARG_ENABLE(macosx-code-signing,
1400     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1401         [Sign executables, dylibs, frameworks and the app bundle. If you
1402          don't provide an identity the first suitable certificate
1403          in your keychain is used.]),
1406 AC_ARG_ENABLE(macosx-package-signing,
1407     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1408         [Create a .pkg suitable for uploading to the Mac App Store and sign
1409          it. If you don't provide an identity the first suitable certificate
1410          in your keychain is used.]),
1413 AC_ARG_ENABLE(macosx-sandbox,
1414     AS_HELP_STRING([--enable-macosx-sandbox],
1415         [Make the app bundle run in a sandbox. Requires code signing.
1416          Is required by apps distributed in the Mac App Store, and implies
1417          adherence to App Store rules.]),
1420 AC_ARG_WITH(macosx-bundle-identifier,
1421     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1422         [Define the OS X bundle identifier. Default is the somewhat weird
1423          org.libreoffice.script ("script", huh?).]),
1424 ,with_macosx_bundle_identifier=org.libreoffice.script)
1426 AC_ARG_WITH(product-name,
1427     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1428         [Define the product name. Default is AC_PACKAGE_NAME.]),
1429 ,with_product_name=$PRODUCTNAME)
1431 AC_ARG_WITH(package-version,
1432     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1433         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1436 libo_FUZZ_ARG_ENABLE(readonly-installset,
1437     AS_HELP_STRING([--enable-readonly-installset],
1438         [Prevents any attempts by LibreOffice to write into its installation. That means
1439          at least that no "system-wide" extensions can be added. Partly experimental work in
1440          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1443 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1444     AS_HELP_STRING([--disable-postgresql-sdbc],
1445         [Disable the build of the PostgreSQL-SDBC driver.])
1448 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1449     AS_HELP_STRING([--disable-lotuswordpro],
1450         [Disable the build of the Lotus Word Pro filter.]),
1451 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1453 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1454     AS_HELP_STRING([--disable-firebird-sdbc],
1455         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1456 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1458 AC_ARG_ENABLE(bogus-pkg-config,
1459     AS_HELP_STRING([--enable-bogus-pkg-config],
1460         [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.]),
1463 AC_ARG_ENABLE(openssl,
1464     AS_HELP_STRING([--disable-openssl],
1465         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1466          components will either use GNUTLS or NSS. Work in progress,
1467          use only if you are hacking on it.]),
1468 ,enable_openssl=yes)
1470 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1471     AS_HELP_STRING([--enable-cipher-openssl-backend],
1472         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1473          Requires --enable-openssl.]))
1475 AC_ARG_ENABLE(library-bin-tar,
1476     AS_HELP_STRING([--enable-library-bin-tar],
1477         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1478         Some libraries can save their build result in a tarball
1479         stored in TARFILE_LOCATION. That binary tarball is
1480         uniquely identified by the source tarball,
1481         the content of the config_host.mk file and the content
1482         of the top-level directory in core for that library
1483         If this option is enabled, then if such a tarfile exist, it will be untarred
1484         instead of the source tarfile, and the build step will be skipped for that
1485         library.
1486         If a proper tarfile does not exist, then the normal source-based
1487         build is done for that library and a proper binary tarfile is created
1488         for the next time.]),
1491 AC_ARG_ENABLE(dconf,
1492     AS_HELP_STRING([--disable-dconf],
1493         [Disable the dconf configuration backend (enabled by default where
1494          available).]))
1496 libo_FUZZ_ARG_ENABLE(formula-logger,
1497     AS_HELP_STRING(
1498         [--enable-formula-logger],
1499         [Enable formula logger for logging formula calculation flow in Calc.]
1500     )
1503 dnl ===================================================================
1504 dnl Optional Packages (--with/without-)
1505 dnl ===================================================================
1507 AC_ARG_WITH(gcc-home,
1508     AS_HELP_STRING([--with-gcc-home],
1509         [Specify the location of gcc/g++ manually. This can be used in conjunction
1510          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1511          non-default path.]),
1514 AC_ARG_WITH(gnu-patch,
1515     AS_HELP_STRING([--with-gnu-patch],
1516         [Specify location of GNU patch on Solaris or FreeBSD.]),
1519 AC_ARG_WITH(build-platform-configure-options,
1520     AS_HELP_STRING([--with-build-platform-configure-options],
1521         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1524 AC_ARG_WITH(gnu-cp,
1525     AS_HELP_STRING([--with-gnu-cp],
1526         [Specify location of GNU cp on Solaris or FreeBSD.]),
1529 AC_ARG_WITH(external-tar,
1530     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1531         [Specify an absolute path of where to find (and store) tarfiles.]),
1532     TARFILE_LOCATION=$withval ,
1535 AC_ARG_WITH(referenced-git,
1536     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1537         [Specify another checkout directory to reference. This makes use of
1538                  git submodule update --reference, and saves a lot of diskspace
1539                  when having multiple trees side-by-side.]),
1540     GIT_REFERENCE_SRC=$withval ,
1543 AC_ARG_WITH(linked-git,
1544     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1545         [Specify a directory where the repositories of submodules are located.
1546          This uses a method similar to git-new-workdir to get submodules.]),
1547     GIT_LINK_SRC=$withval ,
1550 AC_ARG_WITH(galleries,
1551     AS_HELP_STRING([--with-galleries],
1552         [Specify how galleries should be built. It is possible either to
1553          build these internally from source ("build"),
1554          or to disable them ("no")]),
1557 AC_ARG_WITH(theme,
1558     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1559         [Choose which themes to include. By default those themes with an '*' are included.
1560          Possible choices: *breeze, *breeze_dark, *cib, *colibre, *elementary, *karasa_jaga, *sifr, *sifr_dark, *tango.]),
1563 libo_FUZZ_ARG_WITH(helppack-integration,
1564     AS_HELP_STRING([--without-helppack-integration],
1565         [It will not integrate the helppacks to the installer
1566          of the product. Please use this switch to use the online help
1567          or separate help packages.]),
1570 libo_FUZZ_ARG_WITH(fonts,
1571     AS_HELP_STRING([--without-fonts],
1572         [LibreOffice includes some third-party fonts to provide a reliable basis for
1573          help content, templates, samples, etc. When these fonts are already
1574          known to be available on the system then you should use this option.]),
1577 AC_ARG_WITH(epm,
1578     AS_HELP_STRING([--with-epm],
1579         [Decides which epm to use. Default is to use the one from the system if
1580          one is built. When either this is not there or you say =internal epm
1581          will be built.]),
1584 AC_ARG_WITH(package-format,
1585     AS_HELP_STRING([--with-package-format],
1586         [Specify package format(s) for LibreOffice installation sets. The
1587          implicit --without-package-format leads to no installation sets being
1588          generated. Possible values: aix, archive, bsd, deb, dmg,
1589          installed, msi, pkg, and rpm.
1590          Example: --with-package-format='deb rpm']),
1593 AC_ARG_WITH(tls,
1594     AS_HELP_STRING([--with-tls],
1595         [Decides which TLS/SSL and cryptographic implementations to use for
1596          LibreOffice's code. Notice that this doesn't apply for depending
1597          libraries like "neon", for example. Default is to use OpenSSL
1598          although NSS is also possible. Notice that selecting NSS restricts
1599          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1600          restrict by now the usage of NSS in LO's code. Possible values:
1601          openssl, nss. Example: --with-tls="nss"]),
1604 AC_ARG_WITH(system-libs,
1605     AS_HELP_STRING([--with-system-libs],
1606         [Use libraries already on system -- enables all --with-system-* flags.]),
1609 AC_ARG_WITH(system-bzip2,
1610     AS_HELP_STRING([--with-system-bzip2],
1611         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1612     [with_system_bzip2="$with_system_libs"])
1614 AC_ARG_WITH(system-headers,
1615     AS_HELP_STRING([--with-system-headers],
1616         [Use headers already on system -- enables all --with-system-* flags for
1617          external packages whose headers are the only entities used i.e.
1618          boost/odbc/sane-header(s).]),,
1619     [with_system_headers="$with_system_libs"])
1621 AC_ARG_WITH(system-jars,
1622     AS_HELP_STRING([--without-system-jars],
1623         [When building with --with-system-libs, also the needed jars are expected
1624          on the system. Use this to disable that]),,
1625     [with_system_jars="$with_system_libs"])
1627 AC_ARG_WITH(system-cairo,
1628     AS_HELP_STRING([--with-system-cairo],
1629         [Use cairo libraries already on system.  Happens automatically for
1630          (implicit) --enable-gtk and for --enable-gtk3.]))
1632 AC_ARG_WITH(system-epoxy,
1633     AS_HELP_STRING([--with-system-epoxy],
1634         [Use epoxy libraries already on system.  Happens automatically for
1635          --enable-gtk3.]),,
1636        [with_system_epoxy="$with_system_libs"])
1638 AC_ARG_WITH(myspell-dicts,
1639     AS_HELP_STRING([--with-myspell-dicts],
1640         [Adds myspell dictionaries to the LibreOffice installation set]),
1643 AC_ARG_WITH(system-dicts,
1644     AS_HELP_STRING([--without-system-dicts],
1645         [Do not use dictionaries from system paths.]),
1648 AC_ARG_WITH(external-dict-dir,
1649     AS_HELP_STRING([--with-external-dict-dir],
1650         [Specify external dictionary dir.]),
1653 AC_ARG_WITH(external-hyph-dir,
1654     AS_HELP_STRING([--with-external-hyph-dir],
1655         [Specify external hyphenation pattern dir.]),
1658 AC_ARG_WITH(external-thes-dir,
1659     AS_HELP_STRING([--with-external-thes-dir],
1660         [Specify external thesaurus dir.]),
1663 AC_ARG_WITH(system-zlib,
1664     AS_HELP_STRING([--with-system-zlib],
1665         [Use zlib already on system.]),,
1666     [with_system_zlib=auto])
1668 AC_ARG_WITH(system-jpeg,
1669     AS_HELP_STRING([--with-system-jpeg],
1670         [Use jpeg already on system.]),,
1671     [with_system_jpeg="$with_system_libs"])
1673 AC_ARG_WITH(system-clucene,
1674     AS_HELP_STRING([--with-system-clucene],
1675         [Use clucene already on system.]),,
1676     [with_system_clucene="$with_system_libs"])
1678 AC_ARG_WITH(system-expat,
1679     AS_HELP_STRING([--with-system-expat],
1680         [Use expat already on system.]),,
1681     [with_system_expat="$with_system_libs"])
1683 AC_ARG_WITH(system-libxml,
1684     AS_HELP_STRING([--with-system-libxml],
1685         [Use libxml/libxslt already on system.]),,
1686     [with_system_libxml=auto])
1688 AC_ARG_WITH(system-icu,
1689     AS_HELP_STRING([--with-system-icu],
1690         [Use icu already on system.]),,
1691     [with_system_icu="$with_system_libs"])
1693 AC_ARG_WITH(system-ucpp,
1694     AS_HELP_STRING([--with-system-ucpp],
1695         [Use ucpp already on system.]),,
1696     [])
1698 AC_ARG_WITH(system-openldap,
1699     AS_HELP_STRING([--with-system-openldap],
1700         [Use the OpenLDAP LDAP SDK already on system.]),,
1701     [with_system_openldap="$with_system_libs"])
1703 AC_ARG_WITH(system-poppler,
1704     AS_HELP_STRING([--with-system-poppler],
1705         [Use system poppler (only needed for PDF import).]),,
1706     [with_system_poppler="$with_system_libs"])
1708 AC_ARG_WITH(system-gpgmepp,
1709     AS_HELP_STRING([--with-system-gpgmepp],
1710         [Use gpgmepp already on system]),,
1711     [with_system_gpgmepp="$with_system_libs"])
1713 AC_ARG_WITH(system-apache-commons,
1714     AS_HELP_STRING([--with-system-apache-commons],
1715         [Use Apache commons libraries already on system.]),,
1716     [with_system_apache_commons="$with_system_jars"])
1718 AC_ARG_WITH(system-mariadb,
1719     AS_HELP_STRING([--with-system-mariadb],
1720         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1721          extension.]),,
1722     [with_system_mariadb="$with_system_libs"])
1724 AC_ARG_ENABLE(bundle-mariadb,
1725     AS_HELP_STRING([--enable-bundle-mariadb],
1726         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1729 AC_ARG_WITH(system-mysql-cppconn,
1730     AS_HELP_STRING([--with-system-mysql-cppconn],
1731         [Use MySQL C++ Connector libraries already on system.]),,
1732     [with_system_mysql_cppconn="$with_system_libs"])
1734 AC_ARG_WITH(system-postgresql,
1735     AS_HELP_STRING([--with-system-postgresql],
1736         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1737          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1738     [with_system_postgresql="$with_system_libs"])
1740 AC_ARG_WITH(libpq-path,
1741     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1742         [Use this PostgreSQL C interface (libpq) installation for building
1743          the PostgreSQL-SDBC extension.]),
1746 AC_ARG_WITH(system-firebird,
1747     AS_HELP_STRING([--with-system-firebird],
1748         [Use Firebird libraries already on system, for building the Firebird-SDBC
1749          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1750     [with_system_firebird="$with_system_libs"])
1752 AC_ARG_WITH(system-libtommath,
1753             AS_HELP_STRING([--with-system-libtommath],
1754                            [Use libtommath already on system]),,
1755             [with_system_libtommath="$with_system_libs"])
1757 AC_ARG_WITH(system-hsqldb,
1758     AS_HELP_STRING([--with-system-hsqldb],
1759         [Use hsqldb already on system.]))
1761 AC_ARG_WITH(hsqldb-jar,
1762     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1763         [Specify path to jarfile manually.]),
1764     HSQLDB_JAR=$withval)
1766 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1767     AS_HELP_STRING([--disable-scripting-beanshell],
1768         [Disable support for scripts in BeanShell.]),
1772 AC_ARG_WITH(system-beanshell,
1773     AS_HELP_STRING([--with-system-beanshell],
1774         [Use beanshell already on system.]),,
1775     [with_system_beanshell="$with_system_jars"])
1777 AC_ARG_WITH(beanshell-jar,
1778     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1779         [Specify path to jarfile manually.]),
1780     BSH_JAR=$withval)
1782 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1783     AS_HELP_STRING([--disable-scripting-javascript],
1784         [Disable support for scripts in JavaScript.]),
1788 AC_ARG_WITH(system-rhino,
1789     AS_HELP_STRING([--with-system-rhino],
1790         [Use rhino already on system.]),,)
1791 #    [with_system_rhino="$with_system_jars"])
1792 # Above is not used as we have different debug interface
1793 # patched into internal rhino. This code needs to be fixed
1794 # before we can enable it by default.
1796 AC_ARG_WITH(rhino-jar,
1797     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1798         [Specify path to jarfile manually.]),
1799     RHINO_JAR=$withval)
1801 AC_ARG_WITH(commons-logging-jar,
1802     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1803         [Specify path to jarfile manually.]),
1804     COMMONS_LOGGING_JAR=$withval)
1806 AC_ARG_WITH(system-jfreereport,
1807     AS_HELP_STRING([--with-system-jfreereport],
1808         [Use JFreeReport already on system.]),,
1809     [with_system_jfreereport="$with_system_jars"])
1811 AC_ARG_WITH(sac-jar,
1812     AS_HELP_STRING([--with-sac-jar=JARFILE],
1813         [Specify path to jarfile manually.]),
1814     SAC_JAR=$withval)
1816 AC_ARG_WITH(libxml-jar,
1817     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1818         [Specify path to jarfile manually.]),
1819     LIBXML_JAR=$withval)
1821 AC_ARG_WITH(flute-jar,
1822     AS_HELP_STRING([--with-flute-jar=JARFILE],
1823         [Specify path to jarfile manually.]),
1824     FLUTE_JAR=$withval)
1826 AC_ARG_WITH(jfreereport-jar,
1827     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1828         [Specify path to jarfile manually.]),
1829     JFREEREPORT_JAR=$withval)
1831 AC_ARG_WITH(liblayout-jar,
1832     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1833         [Specify path to jarfile manually.]),
1834     LIBLAYOUT_JAR=$withval)
1836 AC_ARG_WITH(libloader-jar,
1837     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1838         [Specify path to jarfile manually.]),
1839     LIBLOADER_JAR=$withval)
1841 AC_ARG_WITH(libformula-jar,
1842     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1843         [Specify path to jarfile manually.]),
1844     LIBFORMULA_JAR=$withval)
1846 AC_ARG_WITH(librepository-jar,
1847     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1848         [Specify path to jarfile manually.]),
1849     LIBREPOSITORY_JAR=$withval)
1851 AC_ARG_WITH(libfonts-jar,
1852     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1853         [Specify path to jarfile manually.]),
1854     LIBFONTS_JAR=$withval)
1856 AC_ARG_WITH(libserializer-jar,
1857     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1858         [Specify path to jarfile manually.]),
1859     LIBSERIALIZER_JAR=$withval)
1861 AC_ARG_WITH(libbase-jar,
1862     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1863         [Specify path to jarfile manually.]),
1864     LIBBASE_JAR=$withval)
1866 AC_ARG_WITH(system-odbc,
1867     AS_HELP_STRING([--with-system-odbc],
1868         [Use the odbc headers already on system.]),,
1869     [with_system_odbc="auto"])
1871 AC_ARG_WITH(system-sane,
1872     AS_HELP_STRING([--with-system-sane],
1873         [Use sane.h already on system.]),,
1874     [with_system_sane="$with_system_headers"])
1876 AC_ARG_WITH(system-bluez,
1877     AS_HELP_STRING([--with-system-bluez],
1878         [Use bluetooth.h already on system.]),,
1879     [with_system_bluez="$with_system_headers"])
1881 AC_ARG_WITH(system-curl,
1882     AS_HELP_STRING([--with-system-curl],
1883         [Use curl already on system.]),,
1884     [with_system_curl=auto])
1886 AC_ARG_WITH(system-boost,
1887     AS_HELP_STRING([--with-system-boost],
1888         [Use boost already on system.]),,
1889     [with_system_boost="$with_system_headers"])
1891 AC_ARG_WITH(system-glm,
1892     AS_HELP_STRING([--with-system-glm],
1893         [Use glm already on system.]),,
1894     [with_system_glm="$with_system_headers"])
1896 AC_ARG_WITH(system-hunspell,
1897     AS_HELP_STRING([--with-system-hunspell],
1898         [Use libhunspell already on system.]),,
1899     [with_system_hunspell="$with_system_libs"])
1901 AC_ARG_WITH(system-mythes,
1902     AS_HELP_STRING([--with-system-mythes],
1903         [Use mythes already on system.]),,
1904     [with_system_mythes="$with_system_libs"])
1906 AC_ARG_WITH(system-altlinuxhyph,
1907     AS_HELP_STRING([--with-system-altlinuxhyph],
1908         [Use ALTLinuxhyph already on system.]),,
1909     [with_system_altlinuxhyph="$with_system_libs"])
1911 AC_ARG_WITH(system-lpsolve,
1912     AS_HELP_STRING([--with-system-lpsolve],
1913         [Use lpsolve already on system.]),,
1914     [with_system_lpsolve="$with_system_libs"])
1916 AC_ARG_WITH(system-coinmp,
1917     AS_HELP_STRING([--with-system-coinmp],
1918         [Use CoinMP already on system.]),,
1919     [with_system_coinmp="$with_system_libs"])
1921 AC_ARG_WITH(system-liblangtag,
1922     AS_HELP_STRING([--with-system-liblangtag],
1923         [Use liblangtag library already on system.]),,
1924     [with_system_liblangtag="$with_system_libs"])
1926 AC_ARG_WITH(webdav,
1927     AS_HELP_STRING([--with-webdav],
1928         [Specify which library to use for webdav implementation.
1929          Possible values: "neon", "serf", "no". The default value is "neon".
1930          Example: --with-webdav="serf"]),
1931     WITH_WEBDAV=$withval,
1932     WITH_WEBDAV="neon")
1934 AC_ARG_WITH(linker-hash-style,
1935     AS_HELP_STRING([--with-linker-hash-style],
1936         [Use linker with --hash-style=<style> when linking shared objects.
1937          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1938          if supported on the build system, and "sysv" otherwise.]))
1940 AC_ARG_WITH(jdk-home,
1941     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1942         [If you have installed JDK 1.6 or later on your system please supply the
1943          path here. Note that this is not the location of the java command but the
1944          location of the entire distribution.]),
1947 AC_ARG_WITH(help,
1948     AS_HELP_STRING([--with-help],
1949         [Enable the build of help. There is a special parameter "common" that
1950          can be used to bundle only the common part, .e.g help-specific icons.
1951          This is useful when you build the helpcontent separately.])
1952     [
1953                           Usage:     --with-help    build the old local help
1954                                  --without-help     no local help (default)
1955                                  --with-help=html   build the new HTML local help
1956                                  --with-help=online build the new HTML online help
1957     ],
1960 libo_FUZZ_ARG_WITH(java,
1961     AS_HELP_STRING([--with-java=<java command>],
1962         [Specify the name of the Java interpreter command. Typically "java"
1963          which is the default.
1965          To build without support for Java components, applets, accessibility
1966          or the XML filters written in Java, use --without-java or --with-java=no.]),
1967     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1968     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
1971 AC_ARG_WITH(jvm-path,
1972     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
1973         [Use a specific JVM search path at runtime.
1974          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
1977 AC_ARG_WITH(ant-home,
1978     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
1979         [If you have installed Jakarta Ant on your system, please supply the path here.
1980          Note that this is not the location of the Ant binary but the location
1981          of the entire distribution.]),
1984 AC_ARG_WITH(symbol-config,
1985     AS_HELP_STRING([--with-symbol-config],
1986         [Configuration for the crashreport symbol upload]),
1987         [],
1988         [with_symbol_config=no])
1990 AC_ARG_WITH(export-validation,
1991     AS_HELP_STRING([--without-export-validation],
1992         [Disable validating OOXML and ODF files as exported from in-tree tests.
1993          Use this option e.g. if your system only provides Java 5.]),
1994 ,with_export_validation=auto)
1996 AC_ARG_WITH(bffvalidator,
1997     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
1998         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
1999          Requires installed Microsoft Office Binary File Format Validator.
2000          Note: export-validation (--with-export-validation) is required to be turned on.
2001          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2002 ,with_bffvalidator=no)
2004 libo_FUZZ_ARG_WITH(junit,
2005     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2006         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2007          --without-junit disables those tests. Not relevant in the --without-java case.]),
2008 ,with_junit=yes)
2010 AC_ARG_WITH(hamcrest,
2011     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2012         [Specifies the hamcrest jar file to use for JUnit-based tests.
2013          --without-junit disables those tests. Not relevant in the --without-java case.]),
2014 ,with_hamcrest=yes)
2016 AC_ARG_WITH(perl-home,
2017     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2018         [If you have installed Perl 5 Distribution, on your system, please
2019          supply the path here. Note that this is not the location of the Perl
2020          binary but the location of the entire distribution.]),
2023 libo_FUZZ_ARG_WITH(doxygen,
2024     AS_HELP_STRING(
2025         [--with-doxygen=<absolute path to doxygen executable>],
2026         [Specifies the doxygen executable to use when generating ODK C/C++
2027          documentation. --without-doxygen disables generation of ODK C/C++
2028          documentation. Not relevant in the --disable-odk case.]),
2029 ,with_doxygen=yes)
2031 AC_ARG_WITH(visual-studio,
2032     AS_HELP_STRING([--with-visual-studio=<2015/2017>],
2033         [Specify which Visual Studio version to use in case several are
2034          installed. If not specified, defaults to 2015.]),
2037 AC_ARG_WITH(windows-sdk,
2038     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
2039         [Specify which Windows SDK, or "Windows Kit", version to use
2040          in case the one that came with the selected Visual Studio
2041          is not what you want for some reason. Note that not all compiler/SDK
2042          combinations are supported. The intent is that this option should not
2043          be needed.]),
2046 AC_ARG_WITH(lang,
2047     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2048         [Use this option to build LibreOffice with additional UI language support.
2049          English (US) is always included by default.
2050          Separate multiple languages with space.
2051          For all languages, use --with-lang=ALL.]),
2054 AC_ARG_WITH(locales,
2055     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2056         [Use this option to limit the locale information built in.
2057          Separate multiple locales with space.
2058          Very experimental and might well break stuff.
2059          Just a desperate measure to shrink code and data size.
2060          By default all the locales available is included.
2061          This option is completely unrelated to --with-lang.])
2062     [
2063                           Affects also our character encoding conversion
2064                           tables for encodings mainly targeted for a
2065                           particular locale, like EUC-CN and EUC-TW for
2066                           zh, ISO-2022-JP for ja.
2068                           Affects also our add-on break iterator data for
2069                           some languages.
2071                           For the default, all locales, don't use this switch at all.
2072                           Specifying just the language part of a locale means all matching
2073                           locales will be included.
2074     ],
2077 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2078 libo_FUZZ_ARG_WITH(krb5,
2079     AS_HELP_STRING([--with-krb5],
2080         [Enable MIT Kerberos 5 support in modules that support it.
2081          By default automatically enabled on platforms
2082          where a good system Kerberos 5 is available.]),
2085 libo_FUZZ_ARG_WITH(gssapi,
2086     AS_HELP_STRING([--with-gssapi],
2087         [Enable GSSAPI support in modules that support it.
2088          By default automatically enabled on platforms
2089          where a good system GSSAPI is available.]),
2092 AC_ARG_WITH(iwyu,
2093     AS_HELP_STRING([--with-iwyu],
2094         [Use given IWYU binary path to check unneeded includes instead of building.
2095          Use only if you are hacking on it.]),
2098 libo_FUZZ_ARG_WITH(lxml,
2099     AS_HELP_STRING([--without-lxml],
2100         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2101          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2102          report widget classes and ids.]),
2105 dnl ===================================================================
2106 dnl Branding
2107 dnl ===================================================================
2109 AC_ARG_WITH(branding,
2110     AS_HELP_STRING([--with-branding=/path/to/images],
2111         [Use given path to retrieve branding images set.])
2112     [
2113                           Search for intro.png about.svg and flat_logo.svg.
2114                           If any is missing, default ones will be used instead.
2116                           Search also progress.conf for progress
2117                           settings on intro screen :
2119                           PROGRESSBARCOLOR="255,255,255" Set color of
2120                           progress bar. Comma separated RGB decimal values.
2121                           PROGRESSSIZE="407,6" Set size of progress bar.
2122                           Comma separated decimal values (width, height).
2123                           PROGRESSPOSITION="61,317" Set position of progress
2124                           bar from left,top. Comma separated decimal values.
2125                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2126                           bar frame. Comma separated RGB decimal values.
2127                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2128                           bar text. Comma separated RGB decimal values.
2129                           PROGRESSTEXTBASELINE="287" Set vertical position of
2130                           progress bar text from top. Decimal value.
2132                           Default values will be used if not found.
2133     ],
2137 AC_ARG_WITH(extra-buildid,
2138     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2139         [Show addition build identification in about dialog.]),
2143 AC_ARG_WITH(vendor,
2144     AS_HELP_STRING([--with-vendor="John the Builder"],
2145         [Set vendor of the build.]),
2148 AC_ARG_WITH(android-package-name,
2149     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2150         [Set Android package name of the build.]),
2153 AC_ARG_WITH(compat-oowrappers,
2154     AS_HELP_STRING([--with-compat-oowrappers],
2155         [Install oo* wrappers in parallel with
2156          lo* ones to keep backward compatibility.
2157          Has effect only with make distro-pack-install]),
2160 AC_ARG_WITH(os-version,
2161     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2162         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2165 AC_ARG_WITH(mingw-cross-compiler,
2166     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2167         [Specify the MinGW cross-compiler to use.
2168          When building on the ODK on Unix and building unowinreg.dll,
2169          specify the MinGW C++ cross-compiler.]),
2172 AC_ARG_WITH(idlc-cpp,
2173     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2174         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2177 AC_ARG_WITH(build-version,
2178     AS_HELP_STRING([--with-build-version="Built by Jim"],
2179         [Allows the builder to add a custom version tag that will appear in the
2180          Help/About box for QA purposes.]),
2181 with_build_version=$withval,
2184 AC_ARG_WITH(alloc,
2185     AS_HELP_STRING([--with-alloc],
2186         [Define which allocator to build with (choices are internal, system).]),
2189 AC_ARG_WITH(parallelism,
2190     AS_HELP_STRING([--with-parallelism],
2191         [Number of jobs to run simultaneously during build. Parallel builds can
2192         save a lot of time on multi-cpu machines. Defaults to the number of
2193         CPUs on the machine, unless you configure --enable-icecream - then to
2194         10.]),
2197 AC_ARG_WITH(all-tarballs,
2198     AS_HELP_STRING([--with-all-tarballs],
2199         [Download all external tarballs unconditionally]))
2201 AC_ARG_WITH(gdrive-client-id,
2202     AS_HELP_STRING([--with-gdrive-client-id],
2203         [Provides the client id of the application for OAuth2 authentication
2204         on Google Drive. If either this or --with-gdrive-client-secret is
2205         empty, the feature will be disabled]),
2208 AC_ARG_WITH(gdrive-client-secret,
2209     AS_HELP_STRING([--with-gdrive-client-secret],
2210         [Provides the client secret of the application for OAuth2
2211         authentication on Google Drive. If either this or
2212         --with-gdrive-client-id is empty, the feature will be disabled]),
2215 AC_ARG_WITH(alfresco-cloud-client-id,
2216     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2217         [Provides the client id of the application for OAuth2 authentication
2218         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2219         empty, the feature will be disabled]),
2222 AC_ARG_WITH(alfresco-cloud-client-secret,
2223     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2224         [Provides the client secret of the application for OAuth2
2225         authentication on Alfresco Cloud. If either this or
2226         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2229 AC_ARG_WITH(onedrive-client-id,
2230     AS_HELP_STRING([--with-onedrive-client-id],
2231         [Provides the client id of the application for OAuth2 authentication
2232         on OneDrive. If either this or --with-onedrive-client-secret is
2233         empty, the feature will be disabled]),
2236 AC_ARG_WITH(onedrive-client-secret,
2237     AS_HELP_STRING([--with-onedrive-client-secret],
2238         [Provides the client secret of the application for OAuth2
2239         authentication on OneDrive. If either this or
2240         --with-onedrive-client-id is empty, the feature will be disabled]),
2242 dnl ===================================================================
2243 dnl Do we want to use pre-build binary tarball for recompile
2244 dnl ===================================================================
2246 if test "$enable_library_bin_tar" = "yes" ; then
2247     USE_LIBRARY_BIN_TAR=TRUE
2248 else
2249     USE_LIBRARY_BIN_TAR=
2251 AC_SUBST(USE_LIBRARY_BIN_TAR)
2253 dnl ===================================================================
2254 dnl Test whether build target is Release Build
2255 dnl ===================================================================
2256 AC_MSG_CHECKING([whether build target is Release Build])
2257 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2258     AC_MSG_RESULT([no])
2259     ENABLE_RELEASE_BUILD=
2260 else
2261     AC_MSG_RESULT([yes])
2262     ENABLE_RELEASE_BUILD=TRUE
2264 AC_SUBST(ENABLE_RELEASE_BUILD)
2266 dnl ===================================================================
2267 dnl Test whether to sign Windows Build
2268 dnl ===================================================================
2269 AC_MSG_CHECKING([whether to sign windows build])
2270 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2271     AC_MSG_RESULT([yes])
2272     WINDOWS_BUILD_SIGNING="TRUE"
2273 else
2274     AC_MSG_RESULT([no])
2275     WINDOWS_BUILD_SIGNING="FALSE"
2277 AC_SUBST(WINDOWS_BUILD_SIGNING)
2279 dnl ===================================================================
2280 dnl MacOSX build and runtime environment options
2281 dnl ===================================================================
2283 AC_ARG_WITH(macosx-sdk,
2284     AS_HELP_STRING([--with-macosx-sdk=<version>],
2285         [Prefer a specific SDK for building.])
2286     [
2287                           If the requested SDK is not available, a search for the oldest one will be done.
2288                           With current Xcode versions, only the latest SDK is included, so this option is
2289                           not terribly useful. It works fine to build with a new SDK and run the result
2290                           on an older OS.
2292                           e. g.: --with-macosx-sdk=10.9
2294                           there are 3 options to control the MacOSX build:
2295                           --with-macosx-sdk (referred as 'sdk' below)
2296                           --with-macosx-version-min-required (referred as 'min' below)
2297                           --with-macosx-version-max-allowed (referred as 'max' below)
2299                           the connection between these value and the default they take is as follow:
2300                           ( ? means not specified on the command line, s means the SDK version found,
2301                           constraint: 8 <= x <= y <= z)
2303                           ==========================================
2304                            command line      || config result
2305                           ==========================================
2306                           min  | max  | sdk  || min  | max  | sdk  |
2307                           ?    | ?    | ?    || 10.9 | 10.s | 10.s |
2308                           ?    | ?    | 10.x || 10.9 | 10.x | 10.x |
2309                           ?    | 10.x | ?    || 10.9 | 10.s | 10.s |
2310                           ?    | 10.x | 10.y || 10.9 | 10.x | 10.y |
2311                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2312                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2313                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2314                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2317                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2318                           for a detailed technical explanation of these variables
2320                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2321     ],
2324 AC_ARG_WITH(macosx-version-min-required,
2325     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2326         [set the minimum OS version needed to run the built LibreOffice])
2327     [
2328                           e. g.: --with-macos-version-min-required=10.9
2329                           see --with-macosx-sdk for more info
2330     ],
2333 AC_ARG_WITH(macosx-version-max-allowed,
2334     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2335         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2336     [
2337                           e. g.: --with-macos-version-max-allowed=10.9
2338                           see --with-macosx-sdk for more info
2339     ],
2343 dnl ===================================================================
2344 dnl options for stuff used during cross-compilation build
2345 dnl Not quite superseded by --with-build-platform-configure-options.
2346 dnl TODO: check, if the "force" option is still needed anywhere.
2347 dnl ===================================================================
2349 AC_ARG_WITH(system-icu-for-build,
2350     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2351         [Use icu already on system for build tools (cross-compilation only).]))
2354 dnl ===================================================================
2355 dnl Check for incompatible options set by fuzzing, and reset those
2356 dnl automatically to working combinations
2357 dnl ===================================================================
2359 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2360         "$enable_dbus" != "$enable_avahi"; then
2361     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2362     enable_avahi=$enable_dbus
2365 dnl ===================================================================
2366 dnl check for required programs (grep, awk, sed, bash)
2367 dnl ===================================================================
2369 pathmunge ()
2371     if test -n "$1"; then
2372         if test "$build_os" = "cygwin"; then
2373             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2374                 PathFormat "$1"
2375                 new_path=`cygpath -sm "$formatted_path"`
2376             else
2377                 PathFormat "$1"
2378                 new_path=`cygpath -u "$formatted_path"`
2379             fi
2380         else
2381             new_path="$1"
2382         fi
2383         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2384             if test "$2" = "after"; then
2385                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2386             else
2387                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2388             fi
2389         fi
2390         unset new_path
2391     fi
2394 AC_PROG_AWK
2395 AC_PATH_PROG( AWK, $AWK)
2396 if test -z "$AWK"; then
2397     AC_MSG_ERROR([install awk to run this script])
2400 AC_PATH_PROG(BASH, bash)
2401 if test -z "$BASH"; then
2402     AC_MSG_ERROR([bash not found in \$PATH])
2404 AC_SUBST(BASH)
2406 AC_MSG_CHECKING([for GNU or BSD tar])
2407 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2408     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2409     if test $? -eq 0;  then
2410         GNUTAR=$a
2411         break
2412     fi
2413 done
2414 AC_MSG_RESULT($GNUTAR)
2415 if test -z "$GNUTAR"; then
2416     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2418 AC_SUBST(GNUTAR)
2420 AC_MSG_CHECKING([for tar's option to strip components])
2421 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2422 if test $? -eq 0; then
2423     STRIP_COMPONENTS="--strip-components"
2424 else
2425     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2426     if test $? -eq 0; then
2427         STRIP_COMPONENTS="--strip-path"
2428     else
2429         STRIP_COMPONENTS="unsupported"
2430     fi
2432 AC_MSG_RESULT($STRIP_COMPONENTS)
2433 if test x$STRIP_COMPONENTS = xunsupported; then
2434     AC_MSG_ERROR([you need a tar that is able to strip components.])
2436 AC_SUBST(STRIP_COMPONENTS)
2438 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2439 dnl desktop OSes from "mobile" ones.
2441 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2442 dnl In other words, that when building for an OS that is not a
2443 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2445 dnl Note the direction of the implication; there is no assumption that
2446 dnl cross-compiling would imply a non-desktop OS.
2448 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2449     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2450     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2451     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2454 # Whether to build "avmedia" functionality or not.
2456 if test -z "$enable_avmedia"; then
2457     enable_avmedia=yes
2460 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2461 if test "$enable_avmedia" = yes; then
2462     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2463 else
2464     USE_AVMEDIA_DUMMY='TRUE'
2466 AC_SUBST(USE_AVMEDIA_DUMMY)
2468 # Decide whether to build database connectivity stuff (including
2469 # Base) or not. We probably don't want to on non-desktop OSes.
2470 if test -z "$enable_database_connectivity"; then
2471     # --disable-database-connectivity is unfinished work in progress
2472     # and the iOS test app doesn't link if we actually try to use it.
2473     # if test $_os != iOS -a $_os != Android; then
2474     if test $_os != iOS; then
2475         enable_database_connectivity=yes
2476     fi
2479 if test "$enable_database_connectivity" = yes; then
2480     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2481     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2484 if test -z "$enable_extensions"; then
2485     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2486     if test $_os != iOS -a $_os != Android; then
2487         enable_extensions=yes
2488     fi
2491 if test "$enable_extensions" = yes; then
2492     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2493     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2496 if test -z "$enable_scripting"; then
2497     # Disable scripting for iOS unless specifically overridden
2498     # with --enable-scripting.
2499     if test $_os != iOS; then
2500         enable_scripting=yes
2501     fi
2504 DISABLE_SCRIPTING=''
2505 if test "$enable_scripting" = yes; then
2506     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2507     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2508 else
2509     DISABLE_SCRIPTING='TRUE'
2510     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2513 if test $_os = iOS -o $_os = Android; then
2514     # Disable dynamic_loading always for iOS and Android
2515     enable_dynamic_loading=no
2516 elif test -z "$enable_dynamic_loading"; then
2517     # Otherwise enable it unless speficically disabled
2518     enable_dynamic_loading=yes
2521 DISABLE_DYNLOADING=''
2522 if test "$enable_dynamic_loading" = yes; then
2523     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2524 else
2525     DISABLE_DYNLOADING='TRUE'
2527 AC_SUBST(DISABLE_DYNLOADING)
2529 # remenber SYSBASE value
2530 AC_SUBST(SYSBASE)
2532 dnl ===================================================================
2533 dnl  Sort out various gallery compilation options
2534 dnl ===================================================================
2535 AC_MSG_CHECKING([how to build and package galleries])
2536 if test -n "${with_galleries}"; then
2537     if test "$with_galleries" = "build"; then
2538         WITH_GALLERY_BUILD=TRUE
2539         AC_MSG_RESULT([build from source images internally])
2540     elif test "$with_galleries" = "no"; then
2541         WITH_GALLERY_BUILD=
2542         AC_MSG_RESULT([disable non-internal gallery build])
2543     else
2544         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2545     fi
2546 else
2547     if test $_os != iOS -a $_os != Android; then
2548         WITH_GALLERY_BUILD=TRUE
2549         AC_MSG_RESULT([internal src images for desktop])
2550     else
2551         WITH_GALLERY_BUILD=
2552         AC_MSG_RESULT([disable src image build])
2553     fi
2555 AC_SUBST(WITH_GALLERY_BUILD)
2557 dnl ===================================================================
2558 dnl  Checks if ccache is available
2559 dnl ===================================================================
2560 if test "$_os" = "WINNT"; then
2561     # on windows/VC build do not use ccache
2562     CCACHE=""
2563 elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2564     case "%$CC%$CXX%" in
2565     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2566     # assume that's good then
2567     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2568         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2569         ;;
2570     *)
2571         AC_PATH_PROG([CCACHE],[ccache],[not found])
2572         if test "$CCACHE" = "not found"; then
2573             CCACHE=""
2574         else
2575             # Need to check for ccache version: otherwise prevents
2576             # caching of the results (like "-x objective-c++" for Mac)
2577             if test $_os = Darwin -o $_os = iOS; then
2578                 # Check ccache version
2579                 AC_MSG_CHECKING([whether version of ccache is suitable])
2580                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2581                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2582                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2583                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2584                 else
2585                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2586                     CCACHE=""
2587                 fi
2588             fi
2589         fi
2590         ;;
2591     esac
2592 else
2593     CCACHE=""
2596 if test "$CCACHE" != ""; then
2597     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2598     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2599     if test "$ccache_size" = ""; then
2600         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2601         if test "$ccache_size" = ""; then
2602             ccache_size=0
2603         fi
2604         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2605         if test $ccache_size -lt 1024; then
2606             CCACHE=""
2607             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2608             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2609         else
2610             # warn that ccache may be too small for debug build
2611             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2612             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2613         fi
2614     else
2615         if test $ccache_size -lt 5; then
2616             #warn that ccache may be too small for debug build
2617             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2618             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2619         fi
2620     fi
2623 dnl ===================================================================
2624 dnl  Checks for C compiler,
2625 dnl  The check for the C++ compiler is later on.
2626 dnl ===================================================================
2627 if test "$_os" != "WINNT"; then
2628     GCC_HOME_SET="true"
2629     AC_MSG_CHECKING([gcc home])
2630     if test -z "$with_gcc_home"; then
2631         if test "$enable_icecream" = "yes"; then
2632             if test -d "/usr/lib/icecc/bin"; then
2633                 GCC_HOME="/usr/lib/icecc/"
2634             elif test -d "/usr/libexec/icecc/bin"; then
2635                 GCC_HOME="/usr/libexec/icecc/"
2636             elif test -d "/opt/icecream/bin"; then
2637                 GCC_HOME="/opt/icecream/"
2638             else
2639                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2641             fi
2642         else
2643             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2644             GCC_HOME_SET="false"
2645         fi
2646     else
2647         GCC_HOME="$with_gcc_home"
2648     fi
2649     AC_MSG_RESULT($GCC_HOME)
2650     AC_SUBST(GCC_HOME)
2652     if test "$GCC_HOME_SET" = "true"; then
2653         if test -z "$CC"; then
2654             CC="$GCC_HOME/bin/gcc"
2655         fi
2656         if test -z "$CXX"; then
2657             CXX="$GCC_HOME/bin/g++"
2658         fi
2659     fi
2662 COMPATH=`dirname "$CC"`
2663 if test "$COMPATH" = "."; then
2664     AC_PATH_PROGS(COMPATH, $CC)
2665     dnl double square bracket to get single because of M4 quote...
2666     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2668 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2670 dnl ===================================================================
2671 dnl Java support
2672 dnl ===================================================================
2673 AC_MSG_CHECKING([whether to build with Java support])
2674 if test "$with_java" != "no"; then
2675     if test "$DISABLE_SCRIPTING" = TRUE; then
2676         AC_MSG_RESULT([no, overridden by --disable-scripting])
2677         ENABLE_JAVA=""
2678         with_java=no
2679     else
2680         AC_MSG_RESULT([yes])
2681         ENABLE_JAVA="TRUE"
2682         AC_DEFINE(HAVE_FEATURE_JAVA)
2683     fi
2684 else
2685     AC_MSG_RESULT([no])
2686     ENABLE_JAVA=""
2689 AC_SUBST(ENABLE_JAVA)
2691 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2693 dnl ENABLE_JAVA="" indicate no Java support at all
2695 dnl ===================================================================
2696 dnl Check OS X SDK and compiler
2697 dnl ===================================================================
2699 if test $_os = Darwin -o $_os = iOS; then
2701     # If no --with-macosx-sdk option is given, look for one
2703     # The intent is that for "most" Mac-based developers, a suitable
2704     # SDK will be found automatically without any configure options.
2706     # For developers with a current Xcode, the lowest-numbered SDK
2707     # higher than or equal to the minimum required should be found.
2709     AC_MSG_CHECKING([what Mac OS X SDK to use])
2710     for _macosx_sdk in $with_macosx_sdk 10.14 10.13 10.12; do
2711         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2712         if test -d "$MACOSX_SDK_PATH"; then
2713             with_macosx_sdk="${_macosx_sdk}"
2714             break
2715         else
2716             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2717             if test -d "$MACOSX_SDK_PATH"; then
2718                 with_macosx_sdk="${_macosx_sdk}"
2719                 break
2720             fi
2721         fi
2722     done
2723     if test ! -d "$MACOSX_SDK_PATH"; then
2724         AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2725     fi
2727     if test $_os = iOS; then
2728         if test "$enable_ios_simulator" = "yes"; then
2729             useos=iphonesimulator
2730         else
2731             useos=iphoneos
2732         fi
2733         MACOSX_SDK_PATH=`xcrun --sdk ${useos} --show-sdk-path 2> /dev/null`
2734     fi
2735     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2738     case $with_macosx_sdk in
2739     10.9)
2740         MACOSX_SDK_VERSION=1090
2741         ;;
2742     10.10)
2743         MACOSX_SDK_VERSION=101000
2744         ;;
2745     10.11)
2746         MACOSX_SDK_VERSION=101100
2747         ;;
2748     10.12)
2749         MACOSX_SDK_VERSION=101200
2750         ;;
2751     10.13)
2752         MACOSX_SDK_VERSION=101300
2753         ;;
2754     10.14)
2755         MACOSX_SDK_VERSION=101400
2756         ;;
2757     *)
2758         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.9--13])
2759         ;;
2760     esac
2762     if test "$with_macosx_version_min_required" = "" ; then
2763         with_macosx_version_min_required="10.9";
2764     fi
2766     if test "$with_macosx_version_max_allowed" = "" ; then
2767         with_macosx_version_max_allowed="$with_macosx_sdk"
2768     fi
2770     # export this so that "xcrun" invocations later return matching values
2771     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2772     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2773     export DEVELOPER_DIR
2774     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2775     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2777     case "$with_macosx_version_min_required" in
2778     10.9)
2779         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2780         ;;
2781     10.10)
2782         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2783         ;;
2784     10.11)
2785         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2786         ;;
2787     10.12)
2788         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2789         ;;
2790     10.13)
2791         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2792         ;;
2793     10.14)
2794         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2795         ;;
2796     *)
2797         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.9--13])
2798         ;;
2799     esac
2800     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2802     LIBTOOL=/usr/bin/libtool
2803     INSTALL_NAME_TOOL=install_name_tool
2804     if test -z "$save_CC"; then
2805         AC_MSG_CHECKING([what compiler to use])
2806         stdlib=-stdlib=libc++
2807         if test "$ENABLE_LTO" = TRUE; then
2808             lto=-flto
2809         fi
2810         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2811         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2812         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2813         AR=`xcrun -find ar`
2814         NM=`xcrun -find nm`
2815         STRIP=`xcrun -find strip`
2816         LIBTOOL=`xcrun -find libtool`
2817         RANLIB=`xcrun -find ranlib`
2818         AC_MSG_RESULT([$CC and $CXX])
2819     fi
2821     case "$with_macosx_version_max_allowed" in
2822     10.9)
2823         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2824         ;;
2825     10.10)
2826         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2827         ;;
2828     10.11)
2829         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2830         ;;
2831     10.12)
2832         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2833         ;;
2834     10.13)
2835         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2836         ;;
2837     10.14)
2838         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2839         ;;
2840     *)
2841         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.9--13])
2842         ;;
2843     esac
2845     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2846     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2847         AC_MSG_RESULT([$MAC_OS_X_VERSION_MIN_REQUIRED])
2848         AC_MSG_RESULT([$MAC_OS_X_VERSION_MAX_REQUIRED])
2849         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2850     else
2851         AC_MSG_RESULT([ok])
2852     fi
2854     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2855     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2856         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2857     else
2858         AC_MSG_RESULT([ok])
2859     fi
2860     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2861     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2863     AC_MSG_CHECKING([whether to do code signing])
2865     if test "$enable_macosx_code_signing" = yes; then
2866         # By default use the first suitable certificate (?).
2868         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2869         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2870         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2871         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2872         # "Developer ID Application" one.
2874         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2875         if test -n "$identity"; then
2876             MACOSX_CODESIGNING_IDENTITY=$identity
2877             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2878             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2879         else
2880             AC_MSG_ERROR([cannot determine identity to use])
2881         fi
2882     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2883         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2884         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2885         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2886     else
2887         AC_MSG_RESULT([no])
2888     fi
2890     AC_MSG_CHECKING([whether to create a Mac App Store package])
2892     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2893         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2894     elif test "$enable_macosx_package_signing" = yes; then
2895         # By default use the first suitable certificate.
2896         # It should be a "3rd Party Mac Developer Installer" one
2898         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2899         if test -n "$identity"; then
2900             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2901             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2902             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2903         else
2904             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2905         fi
2906     elif test -n "$enable_macosx_package_signing"; then
2907         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2908         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2909         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2910     else
2911         AC_MSG_RESULT([no])
2912     fi
2914     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2915         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2916     fi
2918     AC_MSG_CHECKING([whether to sandbox the application])
2920     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2921         AC_MSG_ERROR([OS X sandboxing requires code signing])
2922     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2923         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2924     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2925         ENABLE_MACOSX_SANDBOX=TRUE
2926         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2927         AC_MSG_RESULT([yes])
2928     else
2929         AC_MSG_RESULT([no])
2930     fi
2932     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2933     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2934     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2936 AC_SUBST(MACOSX_SDK_PATH)
2937 AC_SUBST(MACOSX_SDK_VERSION)
2938 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2939 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2940 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
2941 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2942 AC_SUBST(INSTALL_NAME_TOOL)
2943 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2944 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2945 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2946 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2947 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2949 dnl ===================================================================
2950 dnl Check iOS SDK and compiler
2951 dnl ===================================================================
2953 if test $_os = iOS; then
2954     AC_MSG_CHECKING([what iOS SDK to use])
2955     current_sdk_ver=11.3
2956     if test "$enable_ios_simulator" = "yes"; then
2957         platform=iPhoneSimulator
2958         versionmin=-mios-simulator-version-min=$current_sdk_ver
2959     else
2960         platform=iPhoneOS
2961         versionmin=-miphoneos-version-min=$current_sdk_ver
2962     fi
2963     xcode_developer=`xcode-select -print-path`
2965     for sdkver in $current_sdk_ver; do
2966         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2967         if test -d $t; then
2968             ios_sdk=$sdkver
2969             sysroot=$t
2970             break
2971         fi
2972     done
2974     if test -z "$sysroot"; then
2975         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
2976     fi
2978     AC_MSG_RESULT($sysroot)
2980     IOS_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
2981     IOS_DEPLOYMENT_VERSION=$current_sdk_ver
2983     # LTO is not really recommended for iOS builds,
2984     # the link time will be astronomical
2985     if test "$ENABLE_LTO" = TRUE; then
2986         lto=-flto
2987     fi
2989     stdlib="-stdlib=libc++"
2991     CC="`xcrun -find clang` -arch $host_cpu -isysroot $sysroot $lto $versionmin"
2992     CXX="`xcrun -find clang++` -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
2994     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2995     AR=`xcrun -find ar`
2996     NM=`xcrun -find nm`
2997     STRIP=`xcrun -find strip`
2998     LIBTOOL=`xcrun -find libtool`
2999     RANLIB=`xcrun -find ranlib`
3002 AC_SUBST(IOS_SDK)
3003 AC_SUBST(IOS_DEPLOYMENT_VERSION)
3005 AC_MSG_CHECKING([whether to treat the installation as read-only])
3007 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3008         "$enable_extensions" != yes; then
3009     enable_readonly_installset=yes
3011 if test "$enable_readonly_installset" = yes; then
3012     AC_MSG_RESULT([yes])
3013     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3014 else
3015     AC_MSG_RESULT([no])
3018 dnl ===================================================================
3019 dnl Structure of install set
3020 dnl ===================================================================
3022 if test $_os = Darwin; then
3023     LIBO_BIN_FOLDER=MacOS
3024     LIBO_ETC_FOLDER=Resources
3025     LIBO_LIBEXEC_FOLDER=MacOS
3026     LIBO_LIB_FOLDER=Frameworks
3027     LIBO_LIB_PYUNO_FOLDER=Resources
3028     LIBO_SHARE_FOLDER=Resources
3029     LIBO_SHARE_HELP_FOLDER=Resources/help
3030     LIBO_SHARE_JAVA_FOLDER=Resources/java
3031     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3032     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3033     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3034     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3035     LIBO_URE_BIN_FOLDER=MacOS
3036     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3037     LIBO_URE_LIB_FOLDER=Frameworks
3038     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3039     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3040 elif test $_os = WINNT; then
3041     LIBO_BIN_FOLDER=program
3042     LIBO_ETC_FOLDER=program
3043     LIBO_LIBEXEC_FOLDER=program
3044     LIBO_LIB_FOLDER=program
3045     LIBO_LIB_PYUNO_FOLDER=program
3046     LIBO_SHARE_FOLDER=share
3047     LIBO_SHARE_HELP_FOLDER=help
3048     LIBO_SHARE_JAVA_FOLDER=program/classes
3049     LIBO_SHARE_PRESETS_FOLDER=presets
3050     LIBO_SHARE_READMES_FOLDER=readmes
3051     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3052     LIBO_SHARE_SHELL_FOLDER=program/shell
3053     LIBO_URE_BIN_FOLDER=program
3054     LIBO_URE_ETC_FOLDER=program
3055     LIBO_URE_LIB_FOLDER=program
3056     LIBO_URE_MISC_FOLDER=program
3057     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3058 else
3059     LIBO_BIN_FOLDER=program
3060     LIBO_ETC_FOLDER=program
3061     LIBO_LIBEXEC_FOLDER=program
3062     LIBO_LIB_FOLDER=program
3063     LIBO_LIB_PYUNO_FOLDER=program
3064     LIBO_SHARE_FOLDER=share
3065     LIBO_SHARE_HELP_FOLDER=help
3066     LIBO_SHARE_JAVA_FOLDER=program/classes
3067     LIBO_SHARE_PRESETS_FOLDER=presets
3068     LIBO_SHARE_READMES_FOLDER=readmes
3069     if test "$enable_fuzzers" != yes; then
3070         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3071     else
3072         LIBO_SHARE_RESOURCE_FOLDER=resource
3073     fi
3074     LIBO_SHARE_SHELL_FOLDER=program/shell
3075     LIBO_URE_BIN_FOLDER=program
3076     LIBO_URE_ETC_FOLDER=program
3077     LIBO_URE_LIB_FOLDER=program
3078     LIBO_URE_MISC_FOLDER=program
3079     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3081 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3082 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3083 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3084 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3085 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3086 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3087 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3088 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3089 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3090 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3091 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3092 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3093 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3094 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3095 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3096 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3098 # Not all of them needed in config_host.mk, add more if need arises
3099 AC_SUBST(LIBO_BIN_FOLDER)
3100 AC_SUBST(LIBO_ETC_FOLDER)
3101 AC_SUBST(LIBO_LIB_FOLDER)
3102 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3103 AC_SUBST(LIBO_SHARE_FOLDER)
3104 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3105 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3106 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3107 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3108 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3109 AC_SUBST(LIBO_URE_BIN_FOLDER)
3110 AC_SUBST(LIBO_URE_ETC_FOLDER)
3111 AC_SUBST(LIBO_URE_LIB_FOLDER)
3112 AC_SUBST(LIBO_URE_MISC_FOLDER)
3113 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3115 dnl ===================================================================
3116 dnl Windows specific tests and stuff
3117 dnl ===================================================================
3119 reg_get_value()
3121     # Return value: $regvalue
3122     unset regvalue
3124     local _regentry="/proc/registry${1}/${2}"
3125     if test -f "$_regentry"; then
3126         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3127         # Registry keys read via /proc/registry* are always \0 terminated!
3128         local _regvalue=$(tr -d '\0' < "$_regentry")
3129         if test $? -eq 0; then
3130             regvalue=$_regvalue
3131         fi
3132     fi
3135 # Get a value from the 32-bit side of the Registry
3136 reg_get_value_32()
3138     reg_get_value "32" "$1"
3141 # Get a value from the 64-bit side of the Registry
3142 reg_get_value_64()
3144     reg_get_value "64" "$1"
3147 if test "$_os" = "WINNT"; then
3148     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3149     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3150         AC_MSG_RESULT([no])
3151         WINDOWS_SDK_ARCH="x86"
3152     else
3153         AC_MSG_RESULT([yes])
3154         WINDOWS_SDK_ARCH="x64"
3155         BITNESS_OVERRIDE=64
3156     fi
3158 if test "$_os" = "iOS"; then
3159     cross_compiling="yes"
3162 if test "$cross_compiling" = "yes"; then
3163     export CROSS_COMPILING=TRUE
3164 else
3165     CROSS_COMPILING=
3166     BUILD_TYPE="$BUILD_TYPE NATIVE"
3168 AC_SUBST(CROSS_COMPILING)
3170 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3171 if test "$GCC" = "yes"; then
3172     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
3173     bsymbolic_functions_ldflags_save=$LDFLAGS
3174     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3175     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3176 #include <stdio.h>
3177         ],[
3178 printf ("hello world\n");
3179         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3180     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3181         AC_MSG_RESULT( found )
3182     else
3183         AC_MSG_RESULT( not found )
3184     fi
3185     LDFLAGS=$bsymbolic_functions_ldflags_save
3187 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3189 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3190 # NOTE: must _not_ be used for bundled external libraries!
3191 ISYSTEM=
3192 if test "$GCC" = "yes"; then
3193     AC_MSG_CHECKING( for -isystem )
3194     save_CFLAGS=$CFLAGS
3195     CFLAGS="$CFLAGS -Werror"
3196     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3197     CFLAGS=$save_CFLAGS
3198     if test -n "$ISYSTEM"; then
3199         AC_MSG_RESULT(yes)
3200     else
3201         AC_MSG_RESULT(no)
3202     fi
3204 if test -z "$ISYSTEM"; then
3205     # fall back to using -I
3206     ISYSTEM=-I
3208 AC_SUBST(ISYSTEM)
3210 dnl ===================================================================
3211 dnl  Check which Visual Studio compiler is used
3212 dnl ===================================================================
3214 map_vs_year_to_version()
3216     # Return value: $vsversion
3218     unset vsversion
3220     case $1 in
3221     2015)
3222         vsversion=14.0;;
3223     2017)
3224         vsversion=15.0;;
3225     *)
3226         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3227     esac
3230 vs_versions_to_check()
3232     # Args: $1 (optional) : versions to check, in the order of preference
3233     # Return value: $vsversions
3235     unset vsversions
3237     if test -n "$1"; then
3238         map_vs_year_to_version "$1"
3239         vsversions=$vsversion
3240     else
3241         # By default we prefer 2015/2017, in this order
3242         vsversions="14.0 15.0"
3243     fi
3246 win_get_env_from_vsvars32bat()
3248     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3249     if test $vcnum = "150"; then
3250       # Also seems to be located in another directory under the same name: vsvars32.bat
3251       # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3252       printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3253     else
3254       printf '@call "%s/../Common7/Tools/vsvars32.bat"\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3255     fi
3256     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3257     chmod +x $WRAPPERBATCHFILEPATH
3258     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3259     rm -f $WRAPPERBATCHFILEPATH
3260     printf '%s' "$_win_get_env_from_vsvars32bat"
3263 find_ucrt()
3265     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3266     if test -n "$regvalue"; then
3267         PathFormat "$regvalue"
3268         UCRTSDKDIR=$formatted_path
3269         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3270         UCRTVERSION=$regvalue
3271         # Rest if not exist
3272         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3273           UCRTSDKDIR=
3274         fi
3275     fi
3276     if test -z "$UCRTSDKDIR"; then
3277         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3278         if test "$vcnum" = "150"; then
3279           ide_env_file="${ide_env_dir}VsDevCmd.bat"
3280         else
3281           ide_env_file="${ide_env_dir}/vsvars32.bat"
3282         fi
3283         if test -f "$ide_env_file"; then
3284             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3285             UCRTSDKDIR=$formatted_path
3286             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3287             dnl Hack needed at least by tml:
3288             if test "$UCRTVERSION" = 10.0.15063.0 \
3289                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3290                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3291             then
3292                 UCRTVERSION=10.0.14393.0
3293             fi
3294         else
3295           AC_MSG_ERROR([No UCRT found])
3296         fi
3297     fi
3300 find_msvc()
3302     # Find Visual C++ 2015/2017
3303     # Args: $1 (optional) : The VS version year
3304     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3306     unset vctest vcnum vcnumwithdot vcbuildnumber
3308     vs_versions_to_check "$1"
3310     for ver in $vsversions; do
3311         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3312         if test -n "$regvalue"; then
3313             vctest=$regvalue
3314             break
3315         fi
3316         # As always MSVC 15.0 is special here
3317         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver
3318         if test -n "$regvalue"; then
3319             AC_MSG_RESULT([found: $regvalue])
3320             PathFormat "$regvalue"
3321             vctest=$formatted_path
3322             break
3323         fi
3324     done
3325     if test -n "$vctest"; then
3326         vcnumwithdot=$ver
3327         case "$vcnumwithdot" in
3328         14.0)
3329             vcyear=2015
3330             vcnum=140
3331             ;;
3332         15.0)
3333             vcyear=2017
3334             vcnum=150
3335             vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3336             ;;
3337         esac
3338     fi
3341 SOLARINC=
3342 MSBUILD_PATH=
3343 DEVENV=
3344 if test "$_os" = "WINNT"; then
3345     AC_MSG_CHECKING([Visual C++])
3347     find_msvc "$with_visual_studio"
3348     if test -z "$vctest"; then
3349         if test -n "$with_visual_studio"; then
3350             AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3351         else
3352             AC_MSG_ERROR([No Visual Studio 2015/2017 installation found])
3353         fi
3354     fi
3356     if test "$BITNESS_OVERRIDE" = ""; then
3357         if test -f "$vctest/bin/cl.exe"; then
3358             VC_PRODUCT_DIR=$vctest
3359         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3360             VC_PRODUCT_DIR=$vctest/VC
3361         else
3362             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3363         fi
3364     else
3365         if test -f "$vctest/bin/amd64/cl.exe"; then
3366             VC_PRODUCT_DIR=$vctest
3367         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3368             VC_PRODUCT_DIR=$vctest/VC
3369         else
3370             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])
3371         fi
3372     fi
3374     AC_MSG_CHECKING([for short pathname of VC product directory])
3375     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3376     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3378     UCRTSDKDIR=
3379     UCRTVERSION=
3381     AC_MSG_CHECKING([for UCRT location])
3382     find_ucrt
3383     # find_ucrt errors out if it doesn't find it
3384     AC_MSG_RESULT([found])
3385     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3386     ucrtincpath_formatted=$formatted_path
3387     # SOLARINC is used for external modules and must be set too.
3388     # And no, it's not sufficient to set SOLARINC only, as configure
3389     # itself doesn't honour it.
3390     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3391     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3392     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3393     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3395     AC_SUBST(UCRTSDKDIR)
3396     AC_SUBST(UCRTVERSION)
3398     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3399     # Find the proper version of MSBuild.exe to use based on the VS version
3400     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3401     if test -n "$regvalue" ; then
3402         AC_MSG_RESULT([found: $regvalue])
3403         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3404     else
3405         if test $vcnum = "150"; then
3406             if test "$BITNESS_OVERRIDE" = ""; then
3407                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3408             else
3409                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3410             fi
3411             MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3412         elif test $vcnum = "140"; then
3413             if test "$BITNESS_OVERRIDE" = ""; then
3414                 regvalue="$VC_PRODUCT_DIR/../MSBuild/15.0/Bin"
3415             else
3416                 regvalue="$VC_PRODUCT_DIR/../MSBuild/15.0/Bin/amd64"
3417             fi
3418             MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3419         else
3420             AC_MSG_ERROR([No msbuild found, Visual Studio installation broken?])
3421         fi
3422         AC_MSG_RESULT([$regvalue])
3423     fi
3425     # Find the version of devenv.exe
3426     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3427     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3428     if test ! -e "$DEVENV"; then
3429         AC_MSG_WARN([No devenv.exe found, Visual Studio installation broken?])
3430     fi
3432     dnl ===========================================================
3433     dnl  Check for the corresponding mspdb*.dll
3434     dnl ===========================================================
3436     MSPDB_PATH=
3437     CL_DIR=
3438     CL_LIB=
3440     if test "$BITNESS_OVERRIDE" = ""; then
3441         if test "$vcnum" = "150"; then
3442             MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86"
3443             CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX86/x86
3444         else
3445             MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3446             CL_DIR=bin
3447         fi
3448     else
3449         if test "$vcnum" = "150"; then
3450             MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64"
3451             CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX64/x64
3452         else
3453             MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3454             CL_DIR=bin/amd64
3455         fi
3456     fi
3458     # MSVC 15.0 has libraries from 14.0?
3459     if test  "$vcnum" = "150"; then
3460         mspdbnum="140"
3461     else
3462         mspdbnum=$vcnum
3463     fi
3465     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3466         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3467     fi
3469     MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3470     MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3472     dnl The path needs to be added before cl is called
3473     PATH="$MSPDB_PATH:$PATH"
3475     AC_MSG_CHECKING([cl.exe])
3477     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3478     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3479     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3480     # is not enough?
3482     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3483     dnl needed when building CLR code:
3484     if test -z "$MSVC_CXX"; then
3485         if test "$BITNESS_OVERRIDE" = ""; then
3486             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3487                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3488             fi
3489         else
3490             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3491                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3492             fi
3493         fi
3495         # This gives us a posix path with 8.3 filename restrictions
3496         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3497     fi
3499     if test -z "$CC"; then
3500         CC=$MSVC_CXX
3501     fi
3502     if test "$BITNESS_OVERRIDE" = ""; then
3503         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3504         MSVC_CXX="$MSVC_CXX -arch:SSE"
3505     fi
3507     if test -n "$CC"; then
3508         # Remove /cl.exe from CC case insensitive
3509         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3510         if test "$BITNESS_OVERRIDE" = ""; then
3511            if test "$vcnum" = "150"; then
3512                COMPATH="$VC_PRODUCT_DIR"
3513            else
3514                COMPATH=`echo "$CC" | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3515            fi
3516         else
3517             if test -n "$VC_PRODUCT_DIR"; then
3518                 COMPATH=$VC_PRODUCT_DIR
3519             fi
3520         fi
3521         if test "$BITNESS_OVERRIDE" = ""; then
3522             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3523             CC="$CC -arch:SSE"
3524         fi
3526         if test "$vcnum" = "150"; then
3527             COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3528         fi
3530         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3532         PathFormat "$COMPATH"
3533         COMPATH="$formatted_path"
3535         VCVER=$vcnum
3536         MSVSVER=$vcyear
3538         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3539         # are always "better", we list them in reverse chronological order.
3541         case $vcnum in
3542         140)
3543             COMEX=19
3544             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3545             ;;
3546         150)
3547             COMEX=19
3548             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3549             ;;
3550         esac
3552         # The expectation is that --with-windows-sdk should not need to be used
3553         if test -n "$with_windows_sdk"; then
3554             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3555             *" "$with_windows_sdk" "*)
3556                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3557                 ;;
3558             *)
3559                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3560                 ;;
3561             esac
3562         fi
3564         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3565         ac_objext=obj
3566         ac_exeext=exe
3568     else
3569         AC_MSG_ERROR([Visual C++ not found after all, huh])
3570     fi
3572     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3573     # version of the Explorer extension (and maybe other small
3574     # bits, too) needed when installing a 32-bit LibreOffice on a
3575     # 64-bit OS. The 64-bit Explorer extension is a feature that
3576     # has been present since long in OOo. Don't confuse it with
3577     # building LibreOffice itself as 64-bit code.
3579     BUILD_X64=
3580     CXX_X64_BINARY=
3581     LINK_X64_BINARY=
3583     if test "$BITNESS_OVERRIDE" = ""; then
3584         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3585         if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3586             # Prefer native x64 compiler to cross-compiler, in case we are running
3587             # the build on a 64-bit OS.
3588             if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3589                 BUILD_X64=TRUE
3590                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3591                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3592             elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3593                 BUILD_X64=TRUE
3594                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3595                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3596             fi
3597         elif test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib"; then
3598             # nobody uses 32-bit OS to build, just pick the 64-bit compiler
3599             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3600                 BUILD_X64=TRUE
3601                 CXX_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"
3602                 LINK_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/link.exe"
3603             fi
3604         fi
3605         if test "$BUILD_X64" = TRUE; then
3606             AC_MSG_RESULT([found])
3607         else
3608             AC_MSG_RESULT([not found])
3609             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3610         fi
3611     fi
3612     AC_SUBST(BUILD_X64)
3614     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3615     AC_SUBST(CXX_X64_BINARY)
3616     AC_SUBST(LINK_X64_BINARY)
3618 AC_SUBST(VCVER)
3619 AC_SUBST(DEVENV)
3620 PathFormat "$MSPDB_PATH"
3621 MSPDB_PATH="$formatted_path"
3622 AC_SUBST(MSVC_CXX)
3625 # unowinreg.dll
3627 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3628 AC_SUBST(UNOWINREG_DLL)
3630 COM_IS_CLANG=
3631 AC_MSG_CHECKING([whether the compiler is actually Clang])
3632 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3633     #ifndef __clang__
3634     you lose
3635     #endif
3636     int foo=42;
3637     ]])],
3638     [AC_MSG_RESULT([yes])
3639      COM_IS_CLANG=TRUE],
3640     [AC_MSG_RESULT([no])])
3642 CC_PLAIN=$CC
3643 if test "$COM_IS_CLANG" = TRUE; then
3644     AC_MSG_CHECKING([the Clang version])
3645     if test "$_os" = WINNT; then
3646         dnl In which case, assume clang-cl:
3647         my_args="/EP /TC"
3648         dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3649         dnl clang-cl:
3650         CC_PLAIN=
3651         for i in $CC; do
3652             case $i in
3653             -FIIntrin.h)
3654                 ;;
3655             *)
3656                 CC_PLAIN="$CC_PLAIN $i"
3657                 ;;
3658             esac
3659         done
3660     else
3661         my_args="-E -P"
3662     fi
3663     clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args -`
3664     CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3665     CLANGVER=`echo $clang_version \
3666         | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3667     AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3668     AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3669     AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3671 AC_SUBST(COM_IS_CLANG)
3672 AC_SUBST(CLANGVER)
3674 SHOWINCLUDES_PREFIX=
3675 if test "$_os" = WINNT; then
3676     dnl We need to guess the prefix of the -showIncludes output, it can be
3677     dnl localized
3678     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3679     echo "#include <stdlib.h>" > conftest.c
3680     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3681         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3682     rm -f conftest.c conftest.obj
3683     if test -z "$SHOWINCLUDES_PREFIX"; then
3684         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3685     else
3686         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3687     fi
3689 AC_SUBST(SHOWINCLUDES_PREFIX)
3692 # prefix C with ccache if needed
3694 if test "$CCACHE" != ""; then
3695     AC_MSG_CHECKING([whether $CC is already ccached])
3697     AC_LANG_PUSH([C])
3698     save_CFLAGS=$CFLAGS
3699     CFLAGS="$CFLAGS --ccache-skip -O2"
3700     dnl an empty program will do, we're checking the compiler flags
3701     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3702                       [use_ccache=yes], [use_ccache=no])
3703     if test $use_ccache = yes; then
3704         AC_MSG_RESULT([yes])
3705     else
3706         CC="$CCACHE $CC"
3707         AC_MSG_RESULT([no])
3708     fi
3709     CFLAGS=$save_CFLAGS
3710     AC_LANG_POP([C])
3713 # ===================================================================
3714 # check various GCC options that Clang does not support now but maybe
3715 # will somewhen in the future, check them even for GCC, so that the
3716 # flags are set
3717 # ===================================================================
3719 HAVE_GCC_GGDB2=
3720 HAVE_GCC_FINLINE_LIMIT=
3721 HAVE_GCC_FNO_INLINE=
3722 if test "$GCC" = "yes"; then
3723     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3724     save_CFLAGS=$CFLAGS
3725     CFLAGS="$CFLAGS -Werror -ggdb2"
3726     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3727     CFLAGS=$save_CFLAGS
3728     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3729         AC_MSG_RESULT([yes])
3730     else
3731         AC_MSG_RESULT([no])
3732     fi
3734     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3735     save_CFLAGS=$CFLAGS
3736     CFLAGS="$CFLAGS -Werror -finline-limit=0"
3737     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3738     CFLAGS=$save_CFLAGS
3739     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3740         AC_MSG_RESULT([yes])
3741     else
3742         AC_MSG_RESULT([no])
3743     fi
3745     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3746     save_CFLAGS=$CFLAGS
3747     CFLAGS="$CFLAGS -Werror -fno-inline"
3748     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3749     CFLAGS=$save_CFLAGS
3750     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3751         AC_MSG_RESULT([yes])
3752     else
3753         AC_MSG_RESULT([no])
3754     fi
3756     if test "$host_cpu" = "m68k"; then
3757         AC_MSG_CHECKING([whether $CC supports -mlong-jump-table-offsets])
3758         save_CFLAGS=$CFLAGS
3759         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3760         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3761         CFLAGS=$save_CFLAGS
3762         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3763             AC_MSG_RESULT([yes])
3764         else
3765             AC_MSG_ERROR([no])
3766         fi
3767     fi
3769 AC_SUBST(HAVE_GCC_GGDB2)
3770 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3771 AC_SUBST(HAVE_GCC_FNO_INLINE)
3773 dnl ===================================================================
3774 dnl  Test the gcc version
3775 dnl ===================================================================
3776 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3777     AC_MSG_CHECKING([the GCC version])
3778     _gcc_version=`$CC -dumpversion`
3779     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3780         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3781     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3783     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3785     if test "$gcc_full_version" -lt 40801; then
3786         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.8.1])
3787     fi
3788 else
3789     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3790     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3791     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3792     # (which reports itself as GCC 4.2.1).
3793     GCC_VERSION=
3795 AC_SUBST(GCC_VERSION)
3797 dnl Set the ENABLE_DBGUTIL variable
3798 dnl ===================================================================
3799 AC_MSG_CHECKING([whether to build with additional debug utilities])
3800 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3801     ENABLE_DBGUTIL="TRUE"
3802     # this is an extra var so it can have different default on different MSVC
3803     # versions (in case there are version specific problems with it)
3804     MSVC_USE_DEBUG_RUNTIME="TRUE"
3806     AC_MSG_RESULT([yes])
3807     # cppunit and graphite expose STL in public headers
3808     if test "$with_system_cppunit" = "yes"; then
3809         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3810     else
3811         with_system_cppunit=no
3812     fi
3813     if test "$with_system_graphite" = "yes"; then
3814         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3815     else
3816         with_system_graphite=no
3817     fi
3818     if test "$with_system_mysql_cppconn" = "yes"; then
3819         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3820     else
3821         with_system_mysql_cppconn=no
3822     fi
3823     if test "$with_system_orcus" = "yes"; then
3824         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3825     else
3826         with_system_orcus=no
3827     fi
3828     if test "$with_system_libcmis" = "yes"; then
3829         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3830     else
3831         with_system_libcmis=no
3832     fi
3833     if test "$with_system_hunspell" = "yes"; then
3834         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3835     else
3836         with_system_hunspell=no
3837     fi
3838     if test "$with_system_gpgmepp" = "yes"; then
3839         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3840     else
3841         with_system_gpgmepp=no
3842     fi
3843     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3844     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3845     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3846     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3847     # of those two is using the system variant:
3848     if test "$with_system_libnumbertext" = "yes"; then
3849         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3850     else
3851         with_system_libnumbertext=no
3852     fi
3853     if test "$with_system_libwps" = "yes"; then
3854         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3855     else
3856         with_system_libwps=no
3857     fi
3858 else
3859     ENABLE_DBGUTIL=""
3860     MSVC_USE_DEBUG_RUNTIME=""
3861     AC_MSG_RESULT([no])
3863 AC_SUBST(ENABLE_DBGUTIL)
3864 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3866 dnl Set the ENABLE_DEBUG variable.
3867 dnl ===================================================================
3868 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3869     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3871 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3872     if test -z "$libo_fuzzed_enable_debug"; then
3873         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3874     else
3875         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3876         enable_debug=yes
3877     fi
3880 AC_MSG_CHECKING([whether to do a debug build])
3881 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3882     ENABLE_DEBUG="TRUE"
3883     if test -n "$ENABLE_DBGUTIL" ; then
3884         AC_MSG_RESULT([yes (dbgutil)])
3885     else
3886         AC_MSG_RESULT([yes])
3887     fi
3888 else
3889     ENABLE_DEBUG=""
3890     AC_MSG_RESULT([no])
3892 AC_SUBST(ENABLE_DEBUG)
3894 if test "$enable_sal_log" = yes; then
3895     ENABLE_SAL_LOG=TRUE
3897 AC_SUBST(ENABLE_SAL_LOG)
3899 dnl Selective debuginfo
3900 ENABLE_DEBUGINFO_FOR=
3901 if test -n "$ENABLE_DEBUG"; then
3902     AC_MSG_CHECKING([whether to use selective debuginfo])
3903     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3904         if test "$enable_selective_debuginfo" = "yes"; then
3905             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3906         fi
3907         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3908         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3909     else
3910         ENABLE_DEBUGINFO_FOR=all
3911         AC_MSG_RESULT([no, for all])
3912     fi
3913 else
3914     if test -n "$enable_selective_debuginfo"; then
3915         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
3916     fi
3918 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3920 dnl Check for enable symbols option
3921 dnl ===================================================================
3922 AC_MSG_CHECKING([whether to generate debug information])
3923 if test -z "$enable_symbols"; then
3924     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3925         enable_symbols=yes
3926     else
3927         enable_symbols=no
3928     fi
3930 if test "$enable_symbols" != no; then
3931     ENABLE_SYMBOLS=TRUE
3932     AC_MSG_RESULT([yes])
3933 else
3934     ENABLE_SYMBOLS=
3935     AC_MSG_RESULT([no])
3937 AC_SUBST(ENABLE_SYMBOLS)
3939 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
3940     # Building on Android with full symbols: without enough memory the linker never finishes currently.
3941     AC_MSG_CHECKING([whether enough memory is available for linking])
3942     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
3943     # Check for 15GB, as Linux reports a bit less than the physical memory size.
3944     if test -n "$mem_size" -a $mem_size -lt 15728640; then
3945         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
3946     else
3947         AC_MSG_RESULT([yes])
3948     fi
3951 AC_MSG_CHECKING([whether to compile with optimization flags])
3952 if test -z "$enable_optimized"; then
3953     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3954         enable_optimized=no
3955     else
3956         enable_optimized=yes
3957     fi
3959 if test "$enable_optimized" != no; then
3960     ENABLE_OPTIMIZED=TRUE
3961     AC_MSG_RESULT([yes])
3962 else
3963     ENABLE_OPTIMIZED=
3964     AC_MSG_RESULT([no])
3966 AC_SUBST(ENABLE_OPTIMIZED)
3969 # determine CPUNAME, OS, ...
3970 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
3972 case "$host_os" in
3974 aix*)
3975     COM=GCC
3976     CPUNAME=POWERPC
3977     USING_X11=TRUE
3978     OS=AIX
3979     RTL_OS=AIX
3980     RTL_ARCH=PowerPC
3981     PLATFORMID=aix_powerpc
3982     P_SEP=:
3983     ;;
3985 cygwin*)
3986     COM=MSC
3987     USING_X11=
3988     OS=WNT
3989     RTL_OS=Windows
3990     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3991         P_SEP=";"
3992     else
3993         P_SEP=:
3994     fi
3995     case "$host_cpu" in
3996     i*86|x86_64)
3997         if test "$BITNESS_OVERRIDE" = 64; then
3998             CPUNAME=X86_64
3999             RTL_ARCH=X86_64
4000             PLATFORMID=windows_x86_64
4001             WINDOWS_X64=1
4002             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4003         else
4004             CPUNAME=INTEL
4005             RTL_ARCH=x86
4006             PLATFORMID=windows_x86
4007         fi
4008         ;;
4009     *)
4010         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4011         ;;
4012     esac
4013     SCPDEFS="$SCPDEFS -D_MSC_VER"
4014     ;;
4016 darwin*)
4017     COM=GCC
4018     USING_X11=
4019     OS=MACOSX
4020     RTL_OS=MacOSX
4021     P_SEP=:
4023     case "$host_cpu" in
4024     arm)
4025         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4026         ;;
4027     arm64)
4028         OS=IOS
4029         if test "$enable_ios_simulator" = "yes"; then
4030             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4031         else
4032             CPUNAME=ARM64
4033             RTL_ARCH=ARM_EABI
4034             PLATFORMID=ios_arm64
4035         fi
4036         ;;
4037     i*86)
4038         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4039         ;;
4040     x86_64)
4041         if test "$enable_ios_simulator" = "yes"; then
4042             OS=IOS
4043         fi
4044         CPUNAME=X86_64
4045         RTL_ARCH=X86_64
4046         PLATFORMID=macosx_x86_64
4047         ;;
4048     *)
4049         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4050         ;;
4051     esac
4052     ;;
4054 dragonfly*)
4055     COM=GCC
4056     USING_X11=TRUE
4057     OS=DRAGONFLY
4058     RTL_OS=DragonFly
4059     P_SEP=:
4061     case "$host_cpu" in
4062     i*86)
4063         CPUNAME=INTEL
4064         RTL_ARCH=x86
4065         PLATFORMID=dragonfly_x86
4066         ;;
4067     x86_64)
4068         CPUNAME=X86_64
4069         RTL_ARCH=X86_64
4070         PLATFORMID=dragonfly_x86_64
4071         ;;
4072     *)
4073         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4074         ;;
4075     esac
4076     ;;
4078 freebsd*)
4079     COM=GCC
4080     USING_X11=TRUE
4081     RTL_OS=FreeBSD
4082     OS=FREEBSD
4083     P_SEP=:
4085     case "$host_cpu" in
4086     i*86)
4087         CPUNAME=INTEL
4088         RTL_ARCH=x86
4089         PLATFORMID=freebsd_x86
4090         ;;
4091     x86_64|amd64)
4092         CPUNAME=X86_64
4093         RTL_ARCH=X86_64
4094         PLATFORMID=freebsd_x86_64
4095         ;;
4096     *)
4097         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4098         ;;
4099     esac
4100     ;;
4102 haiku*)
4103     COM=GCC
4104     USING_X11=
4105     GUIBASE=haiku
4106     RTL_OS=Haiku
4107     OS=HAIKU
4108     P_SEP=:
4110     case "$host_cpu" in
4111     i*86)
4112         CPUNAME=INTEL
4113         RTL_ARCH=x86
4114         PLATFORMID=haiku_x86
4115         ;;
4116     x86_64|amd64)
4117         CPUNAME=X86_64
4118         RTL_ARCH=X86_64
4119         PLATFORMID=haiku_x86_64
4120         ;;
4121     *)
4122         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4123         ;;
4124     esac
4125     ;;
4127 kfreebsd*)
4128     COM=GCC
4129     USING_X11=TRUE
4130     OS=LINUX
4131     RTL_OS=kFreeBSD
4132     P_SEP=:
4134     case "$host_cpu" in
4136     i*86)
4137         CPUNAME=INTEL
4138         RTL_ARCH=x86
4139         PLATFORMID=kfreebsd_x86
4140         ;;
4141     x86_64)
4142         CPUNAME=X86_64
4143         RTL_ARCH=X86_64
4144         PLATFORMID=kfreebsd_x86_64
4145         ;;
4146     *)
4147         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4148         ;;
4149     esac
4150     ;;
4152 linux-gnu*)
4153     COM=GCC
4154     USING_X11=TRUE
4155     OS=LINUX
4156     RTL_OS=Linux
4157     P_SEP=:
4159     case "$host_cpu" in
4161     aarch64)
4162         CPUNAME=AARCH64
4163         PLATFORMID=linux_aarch64
4164         RTL_ARCH=AARCH64
4165         ;;
4166     alpha)
4167         CPUNAME=AXP
4168         RTL_ARCH=ALPHA
4169         PLATFORMID=linux_alpha
4170         ;;
4171     arm*)
4172         CPUNAME=ARM
4173         EPM_FLAGS="-a arm"
4174         RTL_ARCH=ARM_EABI
4175         PLATFORMID=linux_arm_eabi
4176         case "$host_cpu" in
4177         arm*-linux)
4178             RTL_ARCH=ARM_OABI
4179             PLATFORMID=linux_arm_oabi
4180             ;;
4181         esac
4182         ;;
4183     hppa)
4184         CPUNAME=HPPA
4185         RTL_ARCH=HPPA
4186         EPM_FLAGS="-a hppa"
4187         PLATFORMID=linux_hppa
4188         ;;
4189     i*86)
4190         CPUNAME=INTEL
4191         RTL_ARCH=x86
4192         PLATFORMID=linux_x86
4193         ;;
4194     ia64)
4195         CPUNAME=IA64
4196         RTL_ARCH=IA64
4197         PLATFORMID=linux_ia64
4198         ;;
4199     mips)
4200         CPUNAME=GODSON
4201         RTL_ARCH=MIPS_EB
4202         EPM_FLAGS="-a mips"
4203         PLATFORMID=linux_mips_eb
4204         ;;
4205     mips64)
4206         CPUNAME=GODSON64
4207         RTL_ARCH=MIPS64_EB
4208         EPM_FLAGS="-a mips64"
4209         PLATFORMID=linux_mips64_eb
4210         ;;
4211     mips64el)
4212         CPUNAME=GODSON64
4213         RTL_ARCH=MIPS64_EL
4214         EPM_FLAGS="-a mips64el"
4215         PLATFORMID=linux_mips64_el
4216         ;;
4217     mipsel)
4218         CPUNAME=GODSON
4219         RTL_ARCH=MIPS_EL
4220         EPM_FLAGS="-a mipsel"
4221         PLATFORMID=linux_mips_el
4222         ;;
4223     m68k)
4224         CPUNAME=M68K
4225         RTL_ARCH=M68K
4226         PLATFORMID=linux_m68k
4227         ;;
4228     powerpc)
4229         CPUNAME=POWERPC
4230         RTL_ARCH=PowerPC
4231         PLATFORMID=linux_powerpc
4232         ;;
4233     powerpc64)
4234         CPUNAME=POWERPC64
4235         RTL_ARCH=PowerPC_64
4236         PLATFORMID=linux_powerpc64
4237         ;;
4238     powerpc64le)
4239         CPUNAME=POWERPC64
4240         RTL_ARCH=PowerPC_64_LE
4241         PLATFORMID=linux_powerpc64_le
4242         ;;
4243     sparc)
4244         CPUNAME=SPARC
4245         RTL_ARCH=SPARC
4246         PLATFORMID=linux_sparc
4247         ;;
4248     sparc64)
4249         CPUNAME=SPARC64
4250         RTL_ARCH=SPARC64
4251         PLATFORMID=linux_sparc64
4252         ;;
4253     s390)
4254         CPUNAME=S390
4255         RTL_ARCH=S390
4256         PLATFORMID=linux_s390
4257         ;;
4258     s390x)
4259         CPUNAME=S390X
4260         RTL_ARCH=S390x
4261         PLATFORMID=linux_s390x
4262         ;;
4263     x86_64)
4264         CPUNAME=X86_64
4265         RTL_ARCH=X86_64
4266         PLATFORMID=linux_x86_64
4267         ;;
4268     *)
4269         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4270         ;;
4271     esac
4272     ;;
4274 linux-android*)
4275     COM=GCC
4276     USING_X11=
4277     OS=ANDROID
4278     RTL_OS=Android
4279     P_SEP=:
4281     case "$host_cpu" in
4283     arm|armel)
4284         CPUNAME=ARM
4285         RTL_ARCH=ARM_EABI
4286         PLATFORMID=android_arm_eabi
4287         ;;
4288     aarch64)
4289         CPUNAME=AARCH64
4290         RTL_ARCH=AARCH64
4291         PLATFORMID=android_aarch64
4292         ;;
4293     mips|mipsel)
4294         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4295         RTL_ARCH=MIPS_EL
4296         PLATFORMID=android_mips_el
4297         ;;
4298     i*86)
4299         CPUNAME=INTEL
4300         RTL_ARCH=x86
4301         PLATFORMID=android_x86
4302         ;;
4303     *)
4304         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4305         ;;
4306     esac
4307     ;;
4309 *netbsd*)
4310     COM=GCC
4311     USING_X11=TRUE
4312     OS=NETBSD
4313     RTL_OS=NetBSD
4314     P_SEP=:
4316     case "$host_cpu" in
4317     i*86)
4318         CPUNAME=INTEL
4319         RTL_ARCH=x86
4320         PLATFORMID=netbsd_x86
4321         ;;
4322     powerpc)
4323         CPUNAME=POWERPC
4324         RTL_ARCH=PowerPC
4325         PLATFORMID=netbsd_powerpc
4326         ;;
4327     sparc)
4328         CPUNAME=SPARC
4329         RTL_ARCH=SPARC
4330         PLATFORMID=netbsd_sparc
4331         ;;
4332     x86_64)
4333         CPUNAME=X86_64
4334         RTL_ARCH=X86_64
4335         PLATFORMID=netbsd_x86_64
4336         ;;
4337     *)
4338         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4339         ;;
4340     esac
4341     ;;
4343 openbsd*)
4344     COM=GCC
4345     USING_X11=TRUE
4346     OS=OPENBSD
4347     RTL_OS=OpenBSD
4348     P_SEP=:
4350     case "$host_cpu" in
4351     i*86)
4352         CPUNAME=INTEL
4353         RTL_ARCH=x86
4354         PLATFORMID=openbsd_x86
4355         ;;
4356     x86_64)
4357         CPUNAME=X86_64
4358         RTL_ARCH=X86_64
4359         PLATFORMID=openbsd_x86_64
4360         ;;
4361     *)
4362         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4363         ;;
4364     esac
4365     SOLARINC="$SOLARINC -I/usr/local/include"
4366     ;;
4368 solaris*)
4369     COM=GCC
4370     USING_X11=TRUE
4371     OS=SOLARIS
4372     RTL_OS=Solaris
4373     P_SEP=:
4375     case "$host_cpu" in
4376     i*86)
4377         CPUNAME=INTEL
4378         RTL_ARCH=x86
4379         PLATFORMID=solaris_x86
4380         ;;
4381     sparc)
4382         CPUNAME=SPARC
4383         RTL_ARCH=SPARC
4384         PLATFORMID=solaris_sparc
4385         ;;
4386     sparc64)
4387         CPUNAME=SPARC64
4388         RTL_ARCH=SPARC64
4389         PLATFORMID=solaris_sparc64
4390         ;;
4391     *)
4392         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4393         ;;
4394     esac
4395     SOLARINC="$SOLARINC -I/usr/local/include"
4396     ;;
4399     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4400     ;;
4401 esac
4403 if test "$with_x" = "no"; then
4404     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4407 ENABLE_HEADLESS=""
4408 if test "$enable_gui" = "no"; then
4409     if test "$USING_X11" != TRUE; then
4410         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4411     fi
4412     USING_X11=
4413     ENABLE_HEADLESS=TRUE
4414     AC_DEFINE(HAVE_FEATURE_UI,0)
4415     test_cairo=yes
4417 AC_SUBST(ENABLE_HEADLESS)
4419 WORKDIR="${BUILDDIR}/workdir"
4420 INSTDIR="${BUILDDIR}/instdir"
4421 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4422 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4423 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4424 AC_SUBST(COM)
4425 AC_SUBST(CPUNAME)
4426 AC_SUBST(RTL_OS)
4427 AC_SUBST(RTL_ARCH)
4428 AC_SUBST(EPM_FLAGS)
4429 AC_SUBST(USING_X11)
4430 AC_SUBST([INSTDIR])
4431 AC_SUBST([INSTROOT])
4432 AC_SUBST([INSTROOTBASE])
4433 AC_SUBST(OS)
4434 AC_SUBST(P_SEP)
4435 AC_SUBST(WORKDIR)
4436 AC_SUBST(PLATFORMID)
4437 AC_SUBST(WINDOWS_X64)
4438 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4440 dnl ===================================================================
4441 dnl Test which package format to use
4442 dnl ===================================================================
4443 AC_MSG_CHECKING([which package format to use])
4444 if test -n "$with_package_format" -a "$with_package_format" != no; then
4445     for i in $with_package_format; do
4446         case "$i" in
4447         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4448             ;;
4449         *)
4450             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4451 aix - AIX software distribution
4452 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4453 deb - Debian software distribution
4454 pkg - Solaris software distribution
4455 rpm - RedHat software distribution
4457 LibreOffice additionally supports:
4458 archive - .tar.gz or .zip
4459 dmg - Mac OS X .dmg
4460 installed - installation tree
4461 msi - Windows .msi
4462         ])
4463             ;;
4464         esac
4465     done
4466     # fakeroot is needed to ensure correct file ownerships/permissions
4467     # inside deb packages and tar archives created on Linux and Solaris.
4468     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4469         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4470         if test "$FAKEROOT" = "no"; then
4471             AC_MSG_ERROR(
4472                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4473         fi
4474     fi
4475     PKGFORMAT="$with_package_format"
4476     AC_MSG_RESULT([$PKGFORMAT])
4477 else
4478     PKGFORMAT=
4479     AC_MSG_RESULT([none])
4481 AC_SUBST(PKGFORMAT)
4483 dnl ===================================================================
4484 dnl Set up a different compiler to produce tools to run on the build
4485 dnl machine when doing cross-compilation
4486 dnl ===================================================================
4488 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4489 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4490 if test "$cross_compiling" = "yes"; then
4491     AC_MSG_CHECKING([for BUILD platform configuration])
4492     echo
4493     rm -rf CONF-FOR-BUILD config_build.mk
4494     mkdir CONF-FOR-BUILD
4495     # Here must be listed all files needed when running the configure script. In particular, also
4496     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4497     # keep them in the same order as there.
4498     (cd $SRC_ROOT && tar cf - \
4499         config.guess \
4500         bin/get_config_variables \
4501         solenv/bin/getcompver.awk \
4502         solenv/inc/langlist.mk \
4503         download.lst \
4504         config_host.mk.in \
4505         config_host_lang.mk.in \
4506         Makefile.in \
4507         lo.xcent.in \
4508         bin/bffvalidator.sh.in \
4509         bin/odfvalidator.sh.in \
4510         bin/officeotron.sh.in \
4511         instsetoo_native/util/openoffice.lst.in \
4512         config_host/*.in \
4513         sysui/desktop/macosx/Info.plist.in) \
4514     | (cd CONF-FOR-BUILD && tar xf -)
4515     cp configure CONF-FOR-BUILD
4516     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4517     (
4518     unset COM USING_X11 OS CPUNAME
4519     unset CC CXX SYSBASE CFLAGS
4520     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4521     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4522     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4523     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4524     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4525     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4526     cd CONF-FOR-BUILD
4527     sub_conf_opts=""
4528     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4529     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4530     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4531     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4532     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4533     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4534     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4535     # Don't bother having configure look for stuff not needed for the build platform anyway
4536     ./configure \
4537         --disable-cups \
4538         --disable-gtk3 \
4539         --disable-pdfimport \
4540         --disable-postgresql-sdbc \
4541         --with-parallelism="$with_parallelism" \
4542         --without-doxygen \
4543         --without-java \
4544         $sub_conf_opts \
4545         --srcdir=$srcdir \
4546         2>&1 | sed -e 's/^/    /'
4547     test -f ./config_host.mk 2>/dev/null || exit
4548     cp config_host.mk ../config_build.mk
4549     cp config_host_lang.mk ../config_build_lang.mk
4550     mv config.log ../config.Build.log
4551     mkdir -p ../config_build
4552     mv config_host/*.h ../config_build
4553     . ./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
4555     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
4556         VV='$'$V
4557         VV=`eval "echo $VV"`
4558         if test -n "$VV"; then
4559             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4560             echo "$line" >>build-config
4561         fi
4562     done
4564     for V in INSTDIR INSTROOT WORKDIR; do
4565         VV='$'$V
4566         VV=`eval "echo $VV"`
4567         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4568         if test -n "$VV"; then
4569             line="${V}_FOR_BUILD='$VV'"
4570             echo "$line" >>build-config
4571         fi
4572     done
4574     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4575     echo "$line" >>build-config
4577     )
4578     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4579     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])
4580     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4581              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4583     eval `cat CONF-FOR-BUILD/build-config`
4585     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4587     rm -rf CONF-FOR-BUILD
4588 else
4589     OS_FOR_BUILD="$OS"
4590     CC_FOR_BUILD="$CC"
4591     CXX_FOR_BUILD="$CXX"
4592     INSTDIR_FOR_BUILD="$INSTDIR"
4593     INSTROOT_FOR_BUILD="$INSTROOT"
4594     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4595     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4596     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4597     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4598     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4599     WORKDIR_FOR_BUILD="$WORKDIR"
4601 AC_SUBST(OS_FOR_BUILD)
4602 AC_SUBST(INSTDIR_FOR_BUILD)
4603 AC_SUBST(INSTROOT_FOR_BUILD)
4604 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4605 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4606 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4607 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4608 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4609 AC_SUBST(WORKDIR_FOR_BUILD)
4611 dnl ===================================================================
4612 dnl Check for syslog header
4613 dnl ===================================================================
4614 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4616 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4617 dnl ===================================================================
4618 AC_MSG_CHECKING([whether to turn warnings to errors])
4619 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4620     ENABLE_WERROR="TRUE"
4621     AC_MSG_RESULT([yes])
4622 else
4623     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4624         ENABLE_WERROR="TRUE"
4625         AC_MSG_RESULT([yes])
4626     else
4627         AC_MSG_RESULT([no])
4628     fi
4630 AC_SUBST(ENABLE_WERROR)
4632 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4633 dnl ===================================================================
4634 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4635 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4636     ASSERT_ALWAYS_ABORT="TRUE"
4637     AC_MSG_RESULT([yes])
4638 else
4639     ASSERT_ALWAYS_ABORT="FALSE"
4640     AC_MSG_RESULT([no])
4642 AC_SUBST(ASSERT_ALWAYS_ABORT)
4644 # Determine whether to use ooenv for the instdir installation
4645 # ===================================================================
4646 if test $_os != "WINNT" -a $_os != "Darwin"; then
4647     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4648     if test "$enable_ooenv" = "no"; then
4649         AC_MSG_RESULT([no])
4650     else
4651         ENABLE_OOENV="TRUE"
4652         AC_MSG_RESULT([yes])
4653     fi
4655 AC_SUBST(ENABLE_OOENV)
4657 if test "$USING_X11" != TRUE; then
4658     # be sure to do not mess with unneeded stuff
4659     test_randr=no
4660     test_xrender=no
4661     test_cups=no
4662     test_dbus=no
4663     test_gtk=no
4664     build_gstreamer_1_0=no
4665     build_gstreamer_0_10=no
4666     test_kde4=no
4667     test_kde5=no
4668     test_qt5=no
4669     test_gtk3_kde5=no
4670     enable_cairo_canvas=no
4673 if test "$OS" = "HAIKU"; then
4674     enable_cairo_canvas=yes
4675     test_qt5=yes
4678 dnl ===================================================================
4679 dnl check for cups support
4680 dnl ===================================================================
4681 ENABLE_CUPS=""
4683 if test "$enable_cups" = "no"; then
4684     test_cups=no
4687 AC_MSG_CHECKING([whether to enable CUPS support])
4688 if test "$test_cups" = "yes"; then
4689     ENABLE_CUPS="TRUE"
4690     AC_MSG_RESULT([yes])
4692     AC_MSG_CHECKING([whether cups support is present])
4693     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4694     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4695     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4696         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4697     fi
4699 else
4700     AC_MSG_RESULT([no])
4703 AC_SUBST(ENABLE_CUPS)
4705 # fontconfig checks
4706 if test "$test_fontconfig" = "yes"; then
4707     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4708     SYSTEM_FONTCONFIG=TRUE
4709     FilterLibs "${FONTCONFIG_LIBS}"
4710     FONTCONFIG_LIBS="${filteredlibs}"
4712 AC_SUBST(FONTCONFIG_CFLAGS)
4713 AC_SUBST(FONTCONFIG_LIBS)
4714 AC_SUBST([SYSTEM_FONTCONFIG])
4716 dnl whether to find & fetch external tarballs?
4717 dnl ===================================================================
4718 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4719    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4720        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4721    else
4722        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4723    fi
4725 if test -z "$TARFILE_LOCATION"; then
4726     if test -d "$SRC_ROOT/src" ; then
4727         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4728         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4729     fi
4730     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4731 else
4732     AbsolutePath "$TARFILE_LOCATION"
4733     PathFormat "${absolute_path}"
4734     TARFILE_LOCATION="${formatted_path}"
4736 AC_SUBST(TARFILE_LOCATION)
4738 AC_MSG_CHECKING([whether we want to fetch tarballs])
4739 if test "$enable_fetch_external" != "no"; then
4740     if test "$with_all_tarballs" = "yes"; then
4741         AC_MSG_RESULT([yes, all of them])
4742         DO_FETCH_TARBALLS="ALL"
4743     else
4744         AC_MSG_RESULT([yes, if we use them])
4745         DO_FETCH_TARBALLS="TRUE"
4746     fi
4747 else
4748     AC_MSG_RESULT([no])
4749     DO_FETCH_TARBALLS=
4751 AC_SUBST(DO_FETCH_TARBALLS)
4753 AC_MSG_CHECKING([whether to build help])
4754 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4755     BUILD_TYPE="$BUILD_TYPE HELP"
4756     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4757     case "$with_help" in
4758     "html")
4759         ENABLE_HTMLHELP=TRUE
4760         SCPDEFS="$SCPDEFS -DWITH_HELP"
4761         AC_MSG_RESULT([HTML])
4762         ;;
4763     "online")
4764         ENABLE_HTMLHELP=TRUE
4765         HELP_ONLINE=TRUE
4766         AC_MSG_RESULT([HTML])
4767         ;;
4768     yes)
4769         SCPDEFS="$SCPDEFS -DWITH_HELP"
4770         AC_MSG_RESULT([yes])
4771         ;;
4772     *)
4773         AC_MSG_ERROR([Unknown --with-help=$with_help])
4774         ;;
4775     esac
4776 else
4777     AC_MSG_RESULT([no])
4779 AC_SUBST([ENABLE_HTMLHELP])
4780 AC_SUBST([HELP_ONLINE])
4782 dnl Test whether to include MySpell dictionaries
4783 dnl ===================================================================
4784 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4785 if test "$with_myspell_dicts" = "yes"; then
4786     AC_MSG_RESULT([yes])
4787     WITH_MYSPELL_DICTS=TRUE
4788     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4789     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4790 else
4791     AC_MSG_RESULT([no])
4792     WITH_MYSPELL_DICTS=
4794 AC_SUBST(WITH_MYSPELL_DICTS)
4796 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4797 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4798     if test "$with_system_dicts" = yes; then
4799         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4800     fi
4801     with_system_dicts=no
4804 AC_MSG_CHECKING([whether to use dicts from external paths])
4805 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4806     AC_MSG_RESULT([yes])
4807     SYSTEM_DICTS=TRUE
4808     AC_MSG_CHECKING([for spelling dictionary directory])
4809     if test -n "$with_external_dict_dir"; then
4810         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4811     else
4812         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4813         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4814             DICT_SYSTEM_DIR=file:///usr/share/myspell
4815         fi
4816     fi
4817     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4818     AC_MSG_CHECKING([for hyphenation patterns directory])
4819     if test -n "$with_external_hyph_dir"; then
4820         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4821     else
4822         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4823     fi
4824     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4825     AC_MSG_CHECKING([for thesaurus directory])
4826     if test -n "$with_external_thes_dir"; then
4827         THES_SYSTEM_DIR=file://$with_external_thes_dir
4828     else
4829         THES_SYSTEM_DIR=file:///usr/share/mythes
4830     fi
4831     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4832 else
4833     AC_MSG_RESULT([no])
4834     SYSTEM_DICTS=
4836 AC_SUBST(SYSTEM_DICTS)
4837 AC_SUBST(DICT_SYSTEM_DIR)
4838 AC_SUBST(HYPH_SYSTEM_DIR)
4839 AC_SUBST(THES_SYSTEM_DIR)
4841 dnl ===================================================================
4842 dnl enable pch by default on windows
4843 dnl enable it explicitly otherwise
4844 ENABLE_PCH=""
4845 if test "$enable_pch" = yes -a "$enable_compiler_plugins" = yes; then
4846     if test -z "$libo_fuzzed_enable_pch"; then
4847         AC_MSG_ERROR([--enable-pch cannot be used with --enable-compiler-plugins])
4848     else
4849         AC_MSG_NOTICE([Resetting --enable-pch=no])
4850         enable_pch=no
4851     fi
4854 AC_MSG_CHECKING([whether to enable pch feature])
4855 if test "$enable_pch" != "no"; then
4856     if test "$_os" = "WINNT"; then
4857         ENABLE_PCH="TRUE"
4858         AC_MSG_RESULT([yes])
4859     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4860         ENABLE_PCH="TRUE"
4861         AC_MSG_RESULT([yes])
4862     elif test -n "$enable_pch"; then
4863         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4864     else
4865         AC_MSG_RESULT([no])
4866     fi
4867 else
4868     AC_MSG_RESULT([no])
4870 AC_SUBST(ENABLE_PCH)
4872 TAB=`printf '\t'`
4874 AC_MSG_CHECKING([the GNU Make version])
4875 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4876 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4877 if test "$_make_longver" -ge "038200"; then
4878     AC_MSG_RESULT([$GNUMAKE $_make_version])
4880 elif test "$_make_longver" -ge "038100"; then
4881     if test "$build_os" = "cygwin"; then
4882         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4883     fi
4884     AC_MSG_RESULT([$GNUMAKE $_make_version])
4886     dnl ===================================================================
4887     dnl Search all the common names for sha1sum
4888     dnl ===================================================================
4889     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4890     if test -z "$SHA1SUM"; then
4891         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
4892     elif test "$SHA1SUM" = "openssl"; then
4893         SHA1SUM="openssl sha1"
4894     fi
4895     AC_MSG_CHECKING([for GNU Make bug 20033])
4896     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4897     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4898 A := \$(wildcard *.a)
4900 .PHONY: all
4901 all: \$(A:.a=.b)
4902 <TAB>@echo survived bug20033.
4904 .PHONY: setup
4905 setup:
4906 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4908 define d1
4909 @echo lala \$(1)
4910 @sleep 1
4911 endef
4913 define d2
4914 @echo tyty \$(1)
4915 @sleep 1
4916 endef
4918 %.b : %.a
4919 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4920 <TAB>\$(call d1,\$(CHECKSUM)),\
4921 <TAB>\$(call d2,\$(CHECKSUM)))
4923     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4924         no_parallelism_make="YES"
4925         AC_MSG_RESULT([yes, disable parallelism])
4926     else
4927         AC_MSG_RESULT([no, keep parallelism enabled])
4928     fi
4929     rm -rf $TESTGMAKEBUG20033
4930 else
4931     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4934 # find if gnumake support file function
4935 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
4936 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4937 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4938     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
4940 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4941 \$(file >test.txt,Success )
4943 .PHONY: all
4944 all:
4945 <TAB>@cat test.txt
4948 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4949 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4950     HAVE_GNUMAKE_FILE_FUNC=TRUE
4951     AC_MSG_RESULT([yes])
4952 else
4953     AC_MSG_RESULT([no])
4955 rm -rf $TESTGMAKEFILEFUNC
4956 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4957 AC_SUBST(GNUMAKE_WIN_NATIVE)
4959 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
4960 STALE_MAKE=
4961 if test "$_make_ver_check" = ""; then
4962    STALE_MAKE=TRUE
4965 HAVE_LD_HASH_STYLE=FALSE
4966 WITH_LINKER_HASH_STYLE=
4967 AC_MSG_CHECKING([for --hash-style gcc linker support])
4968 if test "$GCC" = "yes"; then
4969     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4970         hash_styles="gnu sysv"
4971     elif test "$with_linker_hash_style" = "no"; then
4972         hash_styles=
4973     else
4974         hash_styles="$with_linker_hash_style"
4975     fi
4977     for hash_style in $hash_styles; do
4978         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4979         hash_style_ldflags_save=$LDFLAGS
4980         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
4982         AC_RUN_IFELSE([AC_LANG_PROGRAM(
4983             [
4984 #include <stdio.h>
4985             ],[
4986 printf ("");
4987             ])],
4988             [
4989                   HAVE_LD_HASH_STYLE=TRUE
4990                   WITH_LINKER_HASH_STYLE=$hash_style
4991             ],
4992             [HAVE_LD_HASH_STYLE=FALSE],
4993             [HAVE_LD_HASH_STYLE=FALSE])
4994         LDFLAGS=$hash_style_ldflags_save
4995     done
4997     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
4998         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
4999     else
5000         AC_MSG_RESULT( no )
5001     fi
5002     LDFLAGS=$hash_style_ldflags_save
5003 else
5004     AC_MSG_RESULT( no )
5006 AC_SUBST(HAVE_LD_HASH_STYLE)
5007 AC_SUBST(WITH_LINKER_HASH_STYLE)
5009 dnl ===================================================================
5010 dnl Check whether there's a Perl version available.
5011 dnl ===================================================================
5012 if test -z "$with_perl_home"; then
5013     AC_PATH_PROG(PERL, perl)
5014 else
5015     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5016     _perl_path="$with_perl_home/bin/perl"
5017     if test -x "$_perl_path"; then
5018         PERL=$_perl_path
5019     else
5020         AC_MSG_ERROR([$_perl_path not found])
5021     fi
5024 dnl ===================================================================
5025 dnl Testing for Perl version 5 or greater.
5026 dnl $] is the Perl version variable, it is returned as an integer
5027 dnl ===================================================================
5028 if test "$PERL"; then
5029     AC_MSG_CHECKING([the Perl version])
5030     ${PERL} -e "exit($]);"
5031     _perl_version=$?
5032     if test "$_perl_version" -lt 5; then
5033         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5034     fi
5035     AC_MSG_RESULT([Perl $_perl_version])
5036 else
5037     AC_MSG_ERROR([Perl not found, install Perl 5])
5040 dnl ===================================================================
5041 dnl Testing for required Perl modules
5042 dnl ===================================================================
5044 AC_MSG_CHECKING([for required Perl modules])
5045 perl_use_string="use Cwd ; use Digest::MD5"
5046 if test "$_os" = "WINNT"; then
5047     if test -n "$PKGFORMAT"; then
5048         for i in $PKGFORMAT; do
5049             case "$i" in
5050             msi)
5051                 # for getting fonts versions to use in MSI
5052                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5053                 ;;
5054             esac
5055         done
5056     fi
5058 if test "$with_system_hsqldb" = "yes"; then
5059         perl_use_string="$perl_use_string ; use Archive::Zip"
5061 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5062     AC_MSG_RESULT([all modules found])
5063 else
5064     AC_MSG_RESULT([failed to find some modules])
5065     # Find out which modules are missing.
5066     for i in $perl_use_string; do
5067         if test "$i" != "use" -a "$i" != ";"; then
5068             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5069                 missing_perl_modules="$missing_perl_modules $i"
5070             fi
5071         fi
5072     done
5073     AC_MSG_ERROR([
5074     The missing Perl modules are: $missing_perl_modules
5075     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5078 dnl ===================================================================
5079 dnl Check for pkg-config
5080 dnl ===================================================================
5081 if test "$_os" != "WINNT"; then
5082     PKG_PROG_PKG_CONFIG
5085 if test "$_os" != "WINNT"; then
5087     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5088     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5089     # explicitly. Or put /path/to/compiler in PATH yourself.
5091     # Use wrappers for LTO
5092     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5093         AC_CHECK_TOOL(AR,gcc-ar)
5094         AC_CHECK_TOOL(NM,gcc-nm)
5095         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5096     else
5097         AC_CHECK_TOOL(AR,ar)
5098         AC_CHECK_TOOL(NM,nm)
5099         AC_CHECK_TOOL(RANLIB,ranlib)
5100     fi
5101     AC_CHECK_TOOL(OBJDUMP,objdump)
5102     AC_CHECK_TOOL(READELF,readelf)
5103     AC_CHECK_TOOL(STRIP,strip)
5104     if test "$_os" = "WINNT"; then
5105         AC_CHECK_TOOL(DLLTOOL,dlltool)
5106         AC_CHECK_TOOL(WINDRES,windres)
5107     fi
5109 AC_SUBST(AR)
5110 AC_SUBST(DLLTOOL)
5111 AC_SUBST(NM)
5112 AC_SUBST(OBJDUMP)
5113 AC_SUBST(PKG_CONFIG)
5114 AC_SUBST(RANLIB)
5115 AC_SUBST(READELF)
5116 AC_SUBST(STRIP)
5117 AC_SUBST(WINDRES)
5119 dnl ===================================================================
5120 dnl pkg-config checks on Mac OS X
5121 dnl ===================================================================
5123 if test $_os = Darwin; then
5124     AC_MSG_CHECKING([for bogus pkg-config])
5125     if test -n "$PKG_CONFIG"; then
5126         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5127             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5128         else
5129             if test "$enable_bogus_pkg_config" = "yes"; then
5130                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5131             else
5132                 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.])
5133             fi
5134         fi
5135     else
5136         AC_MSG_RESULT([no, good])
5137     fi
5140 find_csc()
5142     # Return value: $csctest
5144     unset csctest
5146     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5147     if test -n "$regvalue"; then
5148         csctest=$regvalue
5149         return
5150     fi
5153 find_al()
5155     # Return value: $altest
5157     unset altest
5159     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5160         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5161         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5162             altest=$regvalue
5163             return
5164         fi
5165     done
5167     # We need this additional check to detect 4.6.1 or above.
5168     for ver in 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5169         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5170         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5171             altest=$regvalue
5172             return
5173         fi
5175         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/WOW6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools"
5176         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5177             altest=$regvalue
5178             return
5179         fi
5180     done
5183 find_dotnetsdk46()
5185     unset frametest
5187     for ver in 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5188         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5189         if test -n "$regvalue"; then
5190             frametest=$regvalue
5191             return
5192         fi
5193         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5194         if test -n "$regvalue"; then
5195             frametest=$regvalue
5196             return
5197         fi
5198     done
5201 find_winsdk_version()
5203     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5204     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5206     unset winsdktest winsdkbinsubdir winsdklibsubdir
5208     case "$1" in
5209     7.*)
5210         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5211         if test -n "$regvalue"; then
5212             winsdktest=$regvalue
5213             winsdklibsubdir=.
5214             return
5215         fi
5216         ;;
5217     8.0|8.0A)
5218         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5219         if test -n "$regvalue"; then
5220             winsdktest=$regvalue
5221             winsdklibsubdir=win8
5222             return
5223         fi
5224         ;;
5225     8.1|8.1A)
5226         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5227         if test -n "$regvalue"; then
5228             winsdktest=$regvalue
5229             winsdklibsubdir=winv6.3
5230             return
5231         fi
5232         ;;
5233     10.0)
5234         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5235         if test -n "$regvalue"; then
5236             winsdktest=$regvalue
5237             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5238             if test -n "$regvalue"; then
5239                 winsdkbinsubdir="$regvalue".0
5240                 winsdklibsubdir=$winsdkbinsubdir
5241                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5242                 # test exist the SDK path
5243                 if test -d "$tmppath"; then
5244                    # when path is convertable to a short path then path is okay
5245                    if ! cygpath -d "$tmppath"; then
5246                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5247                    fi
5248                 else
5249                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5250                 fi
5251             fi
5252             return
5253         fi
5254         ;;
5255     esac
5258 find_winsdk()
5260     # Return value: From find_winsdk_version
5262     unset winsdktest
5264     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5265         find_winsdk_version $ver
5266         if test -n "$winsdktest"; then
5267             return
5268         fi
5269     done
5272 find_msms()
5274     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5275     if test $VCVER = 150; then
5276         my_msm_files="Microsoft_VC141_CRT_x86.msm ${my_msm_files}"
5277     fi
5278     AC_MSG_CHECKING([for ${my_msm_files}])
5279     msmdir=
5280     for ver in 14.0 15.0; do
5281         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5282         if test -n "$regvalue"; then
5283             for f in ${my_msm_files}; do
5284                 if test -e "$regvalue/${f}"; then
5285                     msmdir=$regvalue
5286                     break
5287                 fi
5288             done
5289         fi
5290     done
5291     dnl Is the following fallback really necessary, or was it added in response
5292     dnl to never having started Visual Studio on a given machine, so the
5293     dnl registry keys checked above had presumably not yet been created?
5294     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5295     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5296     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5297     dnl expanding to "C:\Program Files\Common Files"), which would need
5298     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5299     dnl obtain its value from cygwin:
5300     if test -z "$msmdir"; then
5301         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5302         for f in ${my_msm_files}; do
5303             if test -e "$my_msm_dir/${f}"; then
5304                 msmdir=$my_msm_dir
5305             fi
5306         done
5307     fi
5309     dnl Starting from MSVC 15.0, merge modules are located in different directory
5310     if test $VCVER = 150; then
5311         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5312             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])
5313             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5314             for f in ${my_msm_files}; do
5315                 if test -e "$my_msm_dir/${f}"; then
5316                     msmdir=$my_msm_dir
5317                     break
5318                 fi
5319             done
5320         done
5321     fi
5323     if test -n "$msmdir"; then
5324         msmdir=`cygpath -m "$msmdir"`
5325         AC_MSG_RESULT([$msmdir])
5326     else
5327         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5328             AC_MSG_ERROR([not found])
5329         else
5330             AC_MSG_WARN([not found])
5331             add_warning "MSM none of ${my_msm_files} found"
5332         fi
5333     fi
5336 find_msvc_x64_dlls()
5338     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5339     if test "$VCVER" = 150; then
5340         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5341             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT])
5342             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5343                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5344                 break
5345             fi
5346             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5347                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5348                 break
5349             fi
5350         done
5351     fi
5352     msvcdlls="msvcp140.dll vcruntime140.dll"
5353     for dll in $msvcdlls; do
5354         if ! test -f "$msvcdllpath/$dll"; then
5355             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5356         fi
5357     done
5360 dnl =========================================
5361 dnl Check for the Windows  SDK.
5362 dnl =========================================
5363 if test "$_os" = "WINNT"; then
5364     AC_MSG_CHECKING([for Windows SDK])
5365     if test "$build_os" = "cygwin"; then
5366         find_winsdk
5367         WINDOWS_SDK_HOME=$winsdktest
5369         # normalize if found
5370         if test -n "$WINDOWS_SDK_HOME"; then
5371             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5372             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5373         fi
5375         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5376     fi
5378     if test -n "$WINDOWS_SDK_HOME"; then
5379         # Remove a possible trailing backslash
5380         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5382         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5383              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5384              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5385             have_windows_sdk_headers=yes
5386         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5387              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5388              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5389             have_windows_sdk_headers=yes
5390         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5391              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5392              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5393             have_windows_sdk_headers=yes
5394         else
5395             have_windows_sdk_headers=no
5396         fi
5398         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5399             have_windows_sdk_libs=yes
5400         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5401             have_windows_sdk_libs=yes
5402         else
5403             have_windows_sdk_libs=no
5404         fi
5406         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5407             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5408 the  Windows SDK are installed.])
5409         fi
5410     fi
5412     if test -z "$WINDOWS_SDK_HOME"; then
5413         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5414     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
5415         WINDOWS_SDK_VERSION=70
5416         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
5417     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5418         WINDOWS_SDK_VERSION=80
5419         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5420     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5421         WINDOWS_SDK_VERSION=81
5422         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5423     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5424         WINDOWS_SDK_VERSION=10
5425         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5426     else
5427         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5428     fi
5429     PathFormat "$WINDOWS_SDK_HOME"
5430     WINDOWS_SDK_HOME="$formatted_path"
5431     if test "$build_os" = "cygwin"; then
5432         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5433         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5434             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5435         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5436             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5437         fi
5438     fi
5440     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5441     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5442     dnl but not in v8.0), so allow this to be overridden with a
5443     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5444     dnl and configuration error if no WiLangId.vbs is found would arguably be
5445     dnl better, but I do not know under which conditions exactly it is needed by
5446     dnl msiglobal.pm:
5447     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5448         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5449         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5450             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5451         fi
5452         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5453             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5454         fi
5455         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5456             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5457         fi
5458     fi
5459     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5460         if test -n "$with_package_format" -a "$with_package_format" != no; then
5461             for i in "$with_package_format"; do
5462                 if test "$i" = "msi"; then
5463                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5464                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5465                     fi
5466                 fi
5467             done
5468         fi
5469     fi
5471 AC_SUBST(WINDOWS_SDK_HOME)
5472 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5473 AC_SUBST(WINDOWS_SDK_VERSION)
5474 AC_SUBST(WINDOWS_SDK_WILANGID)
5476 if test "$build_os" = "cygwin"; then
5477     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5478     dnl dir, it also determines that dir's path w/o an arch segment if any,
5479     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5480     AC_MSG_CHECKING([for midl.exe])
5482     find_winsdk
5483     if test -n "$winsdkbinsubdir" \
5484         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5485     then
5486         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5487         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5488     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5489         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5490         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5491     elif test -f "$winsdktest/Bin/midl.exe"; then
5492         MIDL_PATH=$winsdktest/Bin
5493         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5494     fi
5495     if test ! -f "$MIDL_PATH/midl.exe"; then
5496         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5497     else
5498         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5499     fi
5501     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5502     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5504     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5505          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5506          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5507          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5508     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5509          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5510          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5511          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5512     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5513          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5514          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5515          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5516     else
5517         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5518     fi
5520     dnl Check csc.exe
5521     AC_MSG_CHECKING([for csc.exe])
5522     find_csc
5523     if test -f "$csctest/csc.exe"; then
5524         CSC_PATH="$csctest"
5525     fi
5526     if test ! -f "$CSC_PATH/csc.exe"; then
5527         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5528     else
5529         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5530     fi
5532     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5534     dnl Check al.exe
5535     AC_MSG_CHECKING([for al.exe])
5536     find_winsdk
5537     if test -n "$winsdkbinsubdir" \
5538         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5539     then
5540         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5541     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5542         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5543     elif test -f "$winsdktest/Bin/al.exe"; then
5544         AL_PATH="$winsdktest/Bin"
5545     fi
5547     if test -z "$AL_PATH"; then
5548         find_al
5549         if test -f "$altest/bin/al.exe"; then
5550             AL_PATH="$altest/bin"
5551         elif test -f "$altest/al.exe"; then
5552             AL_PATH="$altest"
5553         fi
5554     fi
5555     if test ! -f "$AL_PATH/al.exe"; then
5556         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5557     else
5558         AC_MSG_RESULT([$AL_PATH/al.exe])
5559     fi
5561     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5563     dnl Check mscoree.lib / .NET Framework dir
5564     AC_MSG_CHECKING(.NET Framework)
5565     find_dotnetsdk46
5566     PathFormat "$frametest"
5567     frametest="$formatted_path"
5568     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5569         DOTNET_FRAMEWORK_HOME="$frametest"
5570     else
5571         find_winsdk
5572         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5573             DOTNET_FRAMEWORK_HOME="$winsdktest"
5574         fi
5575     fi
5576     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
5577         AC_MSG_ERROR([mscoree.lib not found])
5578     fi
5579     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5581     PathFormat "$MIDL_PATH"
5582     MIDL_PATH="$formatted_path"
5584     PathFormat "$AL_PATH"
5585     AL_PATH="$formatted_path"
5587     PathFormat "$DOTNET_FRAMEWORK_HOME"
5588     DOTNET_FRAMEWORK_HOME="$formatted_path"
5590     PathFormat "$CSC_PATH"
5591     CSC_PATH="$formatted_path"
5594 dnl ===================================================================
5595 dnl Check if stdc headers are available excluding MSVC.
5596 dnl ===================================================================
5597 if test "$_os" != "WINNT"; then
5598     AC_HEADER_STDC
5601 dnl ===================================================================
5602 dnl Testing for C++ compiler and version...
5603 dnl ===================================================================
5605 if test "$_os" != "WINNT"; then
5606     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5607     save_CXXFLAGS=$CXXFLAGS
5608     AC_PROG_CXX
5609     CXXFLAGS=$save_CXXFLAGS
5610 else
5611     if test -n "$CC" -a -z "$CXX"; then
5612         CXX="$CC"
5613     fi
5616 dnl At least MSVC 2015 Update 1 is known to sporadically emit warning C4592
5617 dnl ("implementation limitation" when defining OUStringLiteral variables in
5618 dnl vcl/source/app/IconThemeInfo.cxx), while Update 3 is known good, and it is
5619 dnl probably a good idea to require that anyway.  A reliable way to check for
5620 dnl MSVC 2015 Update 3 appears to be to check for support of C++17 nested
5621 dnl namespace definitions (which requires /std:c++latest to be enabled):
5622 if test "$COM" = MSC -a "$VCVER" = 140; then
5623     AC_MSG_CHECKING([whether MSVC 2015 compiler $MSVC_CXX is at least Update 3])
5624     save_CXX=$CXX
5625     save_CXXFLAGS=$CXXFLAGS
5626     CXX=$MSVC_CXX
5627     CXXFLAGS="$CXXFLAGS /std:c++latest"
5628     AC_LANG_PUSH([C++])
5629     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5630         namespace A::B {}
5631     ]])], [good=yes], [good=no])
5632     AC_LANG_POP([C++])
5633     CXX=$save_CXX
5634     CXXFLAGS=$save_CXXFLAGS
5635     AC_MSG_RESULT([$good])
5636     if test "$good" = no; then
5637         AC_MSG_ERROR([When using MSVC 2015, at least Update 3 must be installed])
5638     fi
5641 dnl check for GNU C++ compiler version
5642 if test "$GXX" = "yes"; then
5643     AC_MSG_CHECKING([the GNU C++ compiler version])
5645     _gpp_version=`$CXX -dumpversion`
5646     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5648     if test "$_gpp_majmin" -lt "401"; then
5649         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5650     else
5651         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5652     fi
5654     dnl see https://code.google.com/p/android/issues/detail?id=41770
5655     if test "$_gpp_majmin" -ge "401"; then
5656         glibcxx_threads=no
5657         AC_LANG_PUSH([C++])
5658         AC_REQUIRE_CPP
5659         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5660         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5661             #include <bits/c++config.h>]],[[
5662             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5663             && !defined(_GLIBCXX__PTHREADS) \
5664             && !defined(_GLIBCXX_HAS_GTHREADS)
5665             choke me
5666             #endif
5667         ]])],[AC_MSG_RESULT([yes])
5668         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5669         AC_LANG_POP([C++])
5670         if test $glibcxx_threads = yes; then
5671             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5672         fi
5673      fi
5675 AC_SUBST(BOOST_CXXFLAGS)
5678 # prefx CXX with ccache if needed
5680 if test "$CCACHE" != ""; then
5681     AC_MSG_CHECKING([whether $CXX is already ccached])
5682     AC_LANG_PUSH([C++])
5683     save_CXXFLAGS=$CXXFLAGS
5684     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5685     dnl an empty program will do, we're checking the compiler flags
5686     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5687                       [use_ccache=yes], [use_ccache=no])
5688     if test $use_ccache = yes; then
5689         AC_MSG_RESULT([yes])
5690     else
5691         CXX="$CCACHE $CXX"
5692         AC_MSG_RESULT([no])
5693     fi
5694     CXXFLAGS=$save_CXXFLAGS
5695     AC_LANG_POP([C++])
5698 dnl ===================================================================
5699 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5700 dnl ===================================================================
5702 if test "$_os" != "WINNT"; then
5703     AC_PROG_CXXCPP
5705     dnl Check whether there's a C pre-processor.
5706     AC_PROG_CPP
5710 dnl ===================================================================
5711 dnl Find integral type sizes and alignments
5712 dnl ===================================================================
5714 if test "$_os" != "WINNT"; then
5716 if test "$_os" == "iOS"; then
5717     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5718     ac_cv_sizeof_long=8
5719     ac_cv_sizeof_short=2
5720     ac_cv_sizeof_int=4
5721     ac_cv_sizeof_long_long=8
5722     ac_cv_sizeof_double=8
5723     ac_cv_sizeof_voidp=8
5724 else
5725     AC_CHECK_SIZEOF(long)
5726     AC_CHECK_SIZEOF(short)
5727     AC_CHECK_SIZEOF(int)
5728     AC_CHECK_SIZEOF(long long)
5729     AC_CHECK_SIZEOF(double)
5730     AC_CHECK_SIZEOF(void*)
5733     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5734     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5735     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5736     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5737     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5739     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5740     m4_pattern_allow([AC_CHECK_ALIGNOF])
5741     m4_ifdef([AC_CHECK_ALIGNOF],
5742         [
5743             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5744             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5745             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5746             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5747         ],
5748         [
5749             case "$_os-$host_cpu" in
5750             Linux-i686)
5751                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5752                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5753                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5754                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5755                 ;;
5756             Linux-x86_64)
5757                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5758                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5759                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5760                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5761                 ;;
5762             *)
5763                 if test -z "$ac_cv_alignof_short" -o \
5764                         -z "$ac_cv_alignof_int" -o \
5765                         -z "$ac_cv_alignof_long" -o \
5766                         -z "$ac_cv_alignof_double"; then
5767                    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.])
5768                 fi
5769                 ;;
5770             esac
5771         ])
5773     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5774     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5775     if test $ac_cv_sizeof_long -eq 8; then
5776         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5777     elif test $ac_cv_sizeof_double -eq 8; then
5778         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5779     else
5780         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5781     fi
5783     dnl Check for large file support
5784     AC_SYS_LARGEFILE
5785     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5786         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5787     fi
5788     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5789         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5790     fi
5791 else
5792     # Hardcode for MSVC
5793     SAL_TYPES_SIZEOFSHORT=2
5794     SAL_TYPES_SIZEOFINT=4
5795     SAL_TYPES_SIZEOFLONG=4
5796     SAL_TYPES_SIZEOFLONGLONG=8
5797     if test "$BITNESS_OVERRIDE" = ""; then
5798         SAL_TYPES_SIZEOFPOINTER=4
5799     else
5800         SAL_TYPES_SIZEOFPOINTER=8
5801     fi
5802     SAL_TYPES_ALIGNMENT2=2
5803     SAL_TYPES_ALIGNMENT4=4
5804     SAL_TYPES_ALIGNMENT8=8
5805     LFS_CFLAGS=''
5807 AC_SUBST(LFS_CFLAGS)
5809 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5810 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5811 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5812 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5813 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5814 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5815 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5816 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5818 dnl ===================================================================
5819 dnl Check whether to enable runtime optimizations
5820 dnl ===================================================================
5821 ENABLE_RUNTIME_OPTIMIZATIONS=
5822 AC_MSG_CHECKING([whether to enable runtime optimizations])
5823 if test -z "$enable_runtime_optimizations"; then
5824     for i in $CC; do
5825         case $i in
5826         -fsanitize=*)
5827             enable_runtime_optimizations=no
5828             break
5829             ;;
5830         esac
5831     done
5833 if test "$enable_runtime_optimizations" != no; then
5834     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5835     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5836     AC_MSG_RESULT([yes])
5837 else
5838     AC_MSG_RESULT([no])
5840 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5842 dnl ===================================================================
5843 dnl Check if valgrind headers are available
5844 dnl ===================================================================
5845 ENABLE_VALGRIND=
5846 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
5847     prev_cppflags=$CPPFLAGS
5848     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5849     # or where does it come from?
5850     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5851     AC_CHECK_HEADER([valgrind/valgrind.h],
5852         [ENABLE_VALGRIND=TRUE])
5853     CPPFLAGS=$prev_cppflags
5855 AC_SUBST([ENABLE_VALGRIND])
5856 if test -z "$ENABLE_VALGRIND"; then
5857     if test "$with_valgrind" = yes; then
5858         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
5859     fi
5860     VALGRIND_CFLAGS=
5862 AC_SUBST([VALGRIND_CFLAGS])
5865 dnl ===================================================================
5866 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5867 dnl ===================================================================
5869 # We need at least the sys/sdt.h include header.
5870 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5871 if test "$SDT_H_FOUND" = "TRUE"; then
5872     # Found sys/sdt.h header, now make sure the c++ compiler works.
5873     # Old g++ versions had problems with probes in constructors/destructors.
5874     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5875     AC_LANG_PUSH([C++])
5876     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5877     #include <sys/sdt.h>
5878     class ProbeClass
5879     {
5880     private:
5881       int& ref;
5882       const char *name;
5884     public:
5885       ProbeClass(int& v, const char *n) : ref(v), name(n)
5886       {
5887         DTRACE_PROBE2(_test_, cons, name, ref);
5888       }
5890       void method(int min)
5891       {
5892         DTRACE_PROBE3(_test_, meth, name, ref, min);
5893         ref -= min;
5894       }
5896       ~ProbeClass()
5897       {
5898         DTRACE_PROBE2(_test_, dest, name, ref);
5899       }
5900     };
5901     ]],[[
5902     int i = 64;
5903     DTRACE_PROBE1(_test_, call, i);
5904     ProbeClass inst = ProbeClass(i, "call");
5905     inst.method(24);
5906     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5907           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5908     AC_LANG_POP([C++])
5910 AC_CONFIG_HEADERS([config_host/config_probes.h])
5912 dnl ===================================================================
5913 dnl GCC features
5914 dnl ===================================================================
5915 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
5916     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5917     save_CFLAGS=$CFLAGS
5918     CFLAGS="$CFLAGS -Werror -mno-avx"
5919     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5920     CFLAGS=$save_CFLAGS
5921     if test "$HAVE_GCC_AVX" = "TRUE"; then
5922         AC_MSG_RESULT([yes])
5923     else
5924         AC_MSG_RESULT([no])
5925     fi
5927     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5928     save_CFLAGS=$CFLAGS
5929     CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
5930     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5931     CFLAGS=$save_CFLAGS
5932     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5933         AC_MSG_RESULT([yes])
5934     else
5935         AC_MSG_RESULT([no])
5936     fi
5938     AC_MSG_CHECKING([whether $CC supports atomic functions])
5939     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5940     int v = 0;
5941     if (__sync_add_and_fetch(&v, 1) != 1 ||
5942         __sync_sub_and_fetch(&v, 1) != 0)
5943         return 1;
5944     __sync_synchronize();
5945     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5946         v != 1)
5947         return 1;
5948     return 0;
5949 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5950     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5951         AC_MSG_RESULT([yes])
5952         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5953     else
5954         AC_MSG_RESULT([no])
5955     fi
5957     AC_MSG_CHECKING([whether $CC supports __builtin_ffs])
5958     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
5959     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
5960         AC_MSG_RESULT([yes])
5961         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
5962     else
5963         AC_MSG_RESULT([no])
5964     fi
5966     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5967     save_CFLAGS=$CFLAGS
5968     CFLAGS="$CFLAGS -Werror"
5969     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5970             __attribute__((deprecated("test"))) void f();
5971         ])], [
5972             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5973             AC_MSG_RESULT([yes])
5974         ], [AC_MSG_RESULT([no])])
5975     CFLAGS=$save_CFLAGS
5977     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
5978     AC_LANG_PUSH([C++])
5979     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5980             #include <cstddef>
5981             #include <cxxabi.h>
5982             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
5983         ])], [
5984             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
5985             AC_MSG_RESULT([yes])
5986         ], [AC_MSG_RESULT([no])])
5987     AC_LANG_POP([C++])
5989     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
5990     AC_LANG_PUSH([C++])
5991     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5992             #include <cstddef>
5993             #include <cxxabi.h>
5994             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
5995         ])], [
5996             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
5997             AC_MSG_RESULT([yes])
5998         ], [AC_MSG_RESULT([no])])
5999     AC_LANG_POP([C++])
6001     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
6002     AC_LANG_PUSH([C++])
6003     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6004             #include <cxxabi.h>
6005             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6006         ])], [
6007             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6008             AC_MSG_RESULT([yes])
6009         ], [AC_MSG_RESULT([no])])
6010     AC_LANG_POP([C++])
6012     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
6013     AC_LANG_PUSH([C++])
6014     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6015             #include <cstddef>
6016             #include <cxxabi.h>
6017             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6018         ])], [
6019             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6020             AC_MSG_RESULT([yes])
6021         ], [AC_MSG_RESULT([no])])
6022     AC_LANG_POP([C++])
6024     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
6025     AC_LANG_PUSH([C++])
6026     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6027             #include <cstddef>
6028             #include <cxxabi.h>
6029             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6030         ])], [
6031             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6032             AC_MSG_RESULT([yes])
6033         ], [AC_MSG_RESULT([no])])
6034     AC_LANG_POP([C++])
6036     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6037     AC_LANG_PUSH([C++])
6038     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6039             #include <cxxabi.h>
6040             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6041         ])], [
6042             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6043             AC_MSG_RESULT([yes])
6044         ], [AC_MSG_RESULT([no])])
6045     AC_LANG_POP([C++])
6047     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6048     AC_LANG_PUSH([C++])
6049     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6050             #include <cxxabi.h>
6051             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6052         ])], [
6053             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6054             AC_MSG_RESULT([yes])
6055         ], [AC_MSG_RESULT([no])])
6056     AC_LANG_POP([C++])
6058     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
6059     AC_LANG_PUSH([C++])
6060     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6061             #include <cstddef>
6062             #include <cxxabi.h>
6063             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6064         ])], [
6065             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6066             AC_MSG_RESULT([yes])
6067         ], [AC_MSG_RESULT([no])])
6068     AC_LANG_POP([C++])
6070     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
6071     AC_LANG_PUSH([C++])
6072     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6073             #include <cstddef>
6074             #include <cxxabi.h>
6075             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6076         ])], [
6077             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6078             AC_MSG_RESULT([yes])
6079         ], [AC_MSG_RESULT([no])])
6080     AC_LANG_POP([C++])
6082     dnl Available in GCC 4.9 and at least since Clang 3.4:
6083     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6084     AC_LANG_PUSH([C++])
6085     save_CXXFLAGS=$CXXFLAGS
6086     CXXFLAGS="$CXXFLAGS -Werror"
6087     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6088             struct __attribute__((warn_unused)) dummy {};
6089         ])], [
6090             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6091             AC_MSG_RESULT([yes])
6092         ], [AC_MSG_RESULT([no])])
6093     CXXFLAGS=$save_CXXFLAGS
6094 AC_LANG_POP([C++])
6097 AC_SUBST(HAVE_GCC_AVX)
6098 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6099 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6100 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6102 dnl ===================================================================
6103 dnl Identify the C++ library
6104 dnl ===================================================================
6106 AC_MSG_CHECKING([What the C++ library is])
6107 AC_LANG_PUSH([C++])
6108 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6109 #include <utility>
6110 #ifndef __GLIBCXX__
6111 foo bar
6112 #endif
6113 ]])],
6114     [CPP_LIBRARY=GLIBCXX
6115      cpp_library_name="GNU libstdc++"
6116     ],
6117     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6118 #include <utility>
6119 #ifndef _LIBCPP_VERSION
6120 foo bar
6121 #endif
6122 ]])],
6123     [CPP_LIBRARY=LIBCPP
6124      cpp_library_name="LLVM libc++"
6125      AC_DEFINE([HAVE_LIBCXX])
6126     ],
6127     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6128 #include <utility>
6129 #ifndef _MSC_VER
6130 foo bar
6131 #endif
6132 ]])],
6133     [CPP_LIBRARY=MSVCRT
6134      cpp_library_name="Microsoft"
6135     ],
6136     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6137 AC_MSG_RESULT([$cpp_library_name])
6138 AC_LANG_POP([C++])
6140 dnl ===================================================================
6141 dnl Check for gperf
6142 dnl ===================================================================
6143 AC_PATH_PROG(GPERF, gperf)
6144 if test -z "$GPERF"; then
6145     AC_MSG_ERROR([gperf not found but needed. Install it.])
6147 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6148     GPERF=`cygpath -m $GPERF`
6150 AC_MSG_CHECKING([gperf version])
6151 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
6152     AC_MSG_RESULT([OK])
6153 else
6154     AC_MSG_ERROR([too old, you need at least 3.0.0])
6156 AC_SUBST(GPERF)
6158 dnl ===================================================================
6159 dnl Check for system libcmis
6160 dnl ===================================================================
6161 # libcmis requires curl and we can't build curl for iOS
6162 if test $_os != iOS; then
6163     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.0])
6164     ENABLE_LIBCMIS=TRUE
6165 else
6166     ENABLE_LIBCMIS=
6168 AC_SUBST(ENABLE_LIBCMIS)
6170 dnl ===================================================================
6171 dnl C++11
6172 dnl ===================================================================
6174 my_cxx17switches=
6175 libo_FUZZ_ARG_ENABLE(c++17,
6176     AS_HELP_STRING([--disable-c++17],
6177         [Do not attempt to run GCC/Clang in C++17 mode (needed for Coverity).])
6180 CXXFLAGS_CXX11=
6181 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6182     AC_MSG_CHECKING([whether $CXX supports C++11])
6183     AC_MSG_RESULT(yes)
6184     # MSVC supports (a subset of) CXX11 without any switch
6185 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6186     HAVE_CXX11=
6187     AC_MSG_CHECKING([whether $CXX supports C++17, C++14, or C++11])
6188     dnl But only use C++17 if the gperf that is being used knows not to emit
6189     dnl "register" in C++ output:
6190     printf 'foo\n' | $GPERF -L C++ > conftest.inc
6191     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'
6192     if test "$enable_c__17" != no; then
6193         my_flags="-std=gnu++17 -std=gnu++1z -std=c++17 -std=c++1z $my_flags"
6194     fi
6195     for flag in $my_flags; do
6196         if test "$COM" = MSC; then
6197             flag="-Xclang $flag"
6198         fi
6199         save_CXXFLAGS=$CXXFLAGS
6200         CXXFLAGS="$CXXFLAGS $flag -Werror"
6201         if test "$SYSTEM_LIBCMIS" = TRUE; then
6202             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6203         fi
6204         AC_LANG_PUSH([C++])
6205         dnl Clang 3.9 supports __float128 since
6206         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6207         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6208         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6209         dnl $flag is supported below, so check this first):
6210         my_float128hack=
6211         my_float128hack_impl=-D__float128=void
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         ],,[
6218             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6219             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6220             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6221             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6222             dnl place where __float128 is used is in a template specialization, -D__float128=void
6223             dnl will avoid the problem there while still causing a problem if somebody actually uses
6224             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6225             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6226             dnl "fixed" with this hack):
6227             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6228             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6229                 #include <vector>
6230                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6231                 // (__float128)
6232                 ]])
6233             ],[my_float128hack=$my_float128hack_impl])
6234         ])
6235         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6236             #include <algorithm>
6237             #include <functional>
6238             #include <vector>
6240             #include <string.h>
6241             #pragma GCC diagnostic push
6242             #pragma GCC diagnostic ignored "-Wpragmas"
6243                 // make GCC not warn about next pragma
6244             #pragma GCC diagnostic ignored "-Wdeprecated-register"
6245                 // make Clang with -std < C++17 not even warn about register
6246             #include "conftest.inc"
6247             #pragma GCC diagnostic pop
6249             #if defined SYSTEM_LIBCMIS
6250             // See ucb/source/ucp/cmis/auth_provider.hxx:
6251             #if __GNUC__ >= 7
6252             #pragma GCC diagnostic push
6253             #pragma GCC diagnostic ignored "-Wdeprecated"
6254             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6255             #endif
6256             #include <libcmis/libcmis.hxx>
6257             #if __GNUC__ >= 7
6258             #pragma GCC diagnostic pop
6259             #endif
6260             #endif
6262             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6263                 std::sort(v.begin(), v.end(), fn);
6264             }
6265             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6266         AC_LANG_POP([C++])
6267         CXXFLAGS=$save_CXXFLAGS
6268         if test -n "$CXXFLAGS_CXX11"; then
6269             HAVE_CXX11=TRUE
6270             break
6271         fi
6272     done
6273     rm conftest.inc
6274     if test "$HAVE_CXX11" = TRUE; then
6275         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6276     else
6277         AC_MSG_ERROR(no)
6278     fi
6280 AC_SUBST(CXXFLAGS_CXX11)
6282 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6283 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6284 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6285 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6286 dnl again towards 4.7.2:
6287 if test $CPP_LIBRARY = GLIBCXX; then
6288     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6289     AC_LANG_PUSH([C++])
6290     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6291 #include <list>
6292 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6293     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6294     //   GCC 4.7.0: 20120322
6295     //   GCC 4.7.1: 20120614
6296     // and using a range check is not possible as the mapping between
6297     // __GLIBCXX__ values and GCC versions is not monotonic
6298 /* ok */
6299 #else
6300 abi broken
6301 #endif
6302         ]])], [AC_MSG_RESULT(no, ok)],
6303         [AC_MSG_ERROR(yes)])
6304     AC_LANG_POP([C++])
6307 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6308 save_CXXFLAGS=$CXXFLAGS
6309 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6310 AC_LANG_PUSH([C++])
6312 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6313 #include <stddef.h>
6315 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6317 namespace
6319         struct b
6320         {
6321                 int i;
6322                 int j;
6323         };
6325 ]], [[
6326 struct a
6328         int i;
6329         int j;
6331 a thinga[]={{0,0}, {1,1}};
6332 b thingb[]={{0,0}, {1,1}};
6333 size_t i = sizeof(sal_n_array_size(thinga));
6334 size_t j = sizeof(sal_n_array_size(thingb));
6335 return !(i != 0 && j != 0);
6337     ], [ AC_MSG_RESULT(yes) ],
6338     [ AC_MSG_ERROR(no)])
6339 AC_LANG_POP([C++])
6340 CXXFLAGS=$save_CXXFLAGS
6342 AC_MSG_CHECKING([whether $CXX supports C++14 constexpr])
6343 save_CXXFLAGS=$CXXFLAGS
6344 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6345 AC_LANG_PUSH([C++])
6346 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6347     // A somewhat over-complicated way of checking for
6348     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6349     // in constexpr function":
6350     #include <cassert>
6351     template<typename T> inline constexpr T f(T x) { return x; }
6352     template<typename T> inline constexpr T g(T x) {
6353         assert(f(static_cast<int>(x)));
6354         return x;
6355     }
6356     enum E { e };
6357     auto v = g(E::e);
6359     struct S {
6360         int n_;
6361         constexpr bool f() {
6362             int n = n_;
6363             int i = 0;
6364             while (n > 0) { --n; ++i; }
6365             assert(i >= 0);
6366             return i == 0;
6367         }
6368     };
6369     constexpr auto v2 = S{10}.f();
6370     ]])], [cxx14_constexpr=yes], [cxx14_constexpr=no])
6371 AC_LANG_POP([C++])
6372 CXXFLAGS=$save_CXXFLAGS
6373 AC_MSG_RESULT([$cxx14_constexpr])
6374 if test "$cxx14_constexpr" = yes; then
6375     AC_DEFINE([HAVE_CXX14_CONSTEXPR])
6378 dnl _Pragma support (may require C++11)
6379 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6380     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6381     AC_LANG_PUSH([C++])
6382     save_CXXFLAGS=$CXXFLAGS
6383     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6384     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6385             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6386         ])], [
6387             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6388             AC_MSG_RESULT([yes])
6389         ], [AC_MSG_RESULT([no])])
6390     AC_LANG_POP([C++])
6391     CXXFLAGS=$save_CXXFLAGS
6394 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6395 if test "$GCC" = yes; then
6396     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6397     AC_LANG_PUSH([C++])
6398     save_CXXFLAGS=$CXXFLAGS
6399     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6400     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6401     CXXFLAGS=$save_CXXFLAGS
6402     AC_LANG_POP([C++])
6403     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6404         AC_MSG_RESULT([yes])
6405     else
6406         AC_MSG_RESULT([no])
6407     fi
6409 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6411 dnl ===================================================================
6412 dnl system stl sanity tests
6413 dnl ===================================================================
6414 if test "$_os" != "WINNT"; then
6416     AC_LANG_PUSH([C++])
6418     save_CPPFLAGS="$CPPFLAGS"
6419     if test -n "$MACOSX_SDK_PATH"; then
6420         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6421     fi
6423     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6424     # only.
6425     if test "$CPP_LIBRARY" = GLIBCXX; then
6426         dnl gcc#19664, gcc#22482, rhbz#162935
6427         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6428         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6429         AC_MSG_RESULT([$stlvisok])
6430         if test "$stlvisok" = "no"; then
6431             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6432         fi
6433     fi
6435     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6436     # when we don't make any dynamic libraries?
6437     if test "$DISABLE_DYNLOADING" = ""; then
6438         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6439         cat > conftestlib1.cc <<_ACEOF
6440 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6441 struct S2: S1<int> { virtual ~S2(); };
6442 S2::~S2() {}
6443 _ACEOF
6444         cat > conftestlib2.cc <<_ACEOF
6445 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6446 struct S2: S1<int> { virtual ~S2(); };
6447 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6448 _ACEOF
6449         gccvisinlineshiddenok=yes
6450         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6451             gccvisinlineshiddenok=no
6452         else
6453             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6454             dnl known to not work with -z defs (unsetting which makes the test
6455             dnl moot, though):
6456             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6457             if test "$COM_IS_CLANG" = TRUE; then
6458                 for i in $CXX $CXXFLAGS; do
6459                     case $i in
6460                     -fsanitize=*)
6461                         my_linkflagsnoundefs=
6462                         break
6463                         ;;
6464                     esac
6465                 done
6466             fi
6467             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6468                 gccvisinlineshiddenok=no
6469             fi
6470         fi
6472         rm -fr libconftest*
6473         AC_MSG_RESULT([$gccvisinlineshiddenok])
6474         if test "$gccvisinlineshiddenok" = "no"; then
6475             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6476         fi
6477     fi
6479    AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6480     cat >visibility.cxx <<_ACEOF
6481 #pragma GCC visibility push(hidden)
6482 struct __attribute__ ((visibility ("default"))) TestStruct {
6483   static void Init();
6485 __attribute__ ((visibility ("default"))) void TestFunc() {
6486   TestStruct::Init();
6488 _ACEOF
6489     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6490         gccvisbroken=yes
6491     else
6492         case "$host_cpu" in
6493         i?86|x86_64)
6494             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6495                 gccvisbroken=no
6496             else
6497                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6498                     gccvisbroken=no
6499                 else
6500                     gccvisbroken=yes
6501                 fi
6502             fi
6503             ;;
6504         *)
6505             gccvisbroken=no
6506             ;;
6507         esac
6508     fi
6509     rm -f visibility.s visibility.cxx
6511     AC_MSG_RESULT([$gccvisbroken])
6512     if test "$gccvisbroken" = "yes"; then
6513         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6514     fi
6516     CPPFLAGS="$save_CPPFLAGS"
6518     AC_LANG_POP([C++])
6521 dnl ===================================================================
6522 dnl  Clang++ tests
6523 dnl ===================================================================
6525 HAVE_GCC_FNO_DEFAULT_INLINE=
6526 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6527 if test "$GCC" = "yes"; then
6528     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6529     AC_LANG_PUSH([C++])
6530     save_CXXFLAGS=$CXXFLAGS
6531     CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6532     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6533     CXXFLAGS=$save_CXXFLAGS
6534     AC_LANG_POP([C++])
6535     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6536         AC_MSG_RESULT([yes])
6537     else
6538         AC_MSG_RESULT([no])
6539     fi
6541     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6542     AC_LANG_PUSH([C++])
6543     save_CXXFLAGS=$CXXFLAGS
6544     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6545     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6546     CXXFLAGS=$save_CXXFLAGS
6547     AC_LANG_POP([C++])
6548     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6549         AC_MSG_RESULT([yes])
6550     else
6551         AC_MSG_RESULT([no])
6552     fi
6554 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6555 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6557 dnl ===================================================================
6558 dnl Compiler plugins
6559 dnl ===================================================================
6561 COMPILER_PLUGINS=
6562 # currently only Clang
6564 if test "$COM_IS_CLANG" != "TRUE"; then
6565     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6566         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6567         enable_compiler_plugins=no
6568     fi
6571 if test "$COM_IS_CLANG" = "TRUE"; then
6572     if test -n "$enable_compiler_plugins"; then
6573         compiler_plugins="$enable_compiler_plugins"
6574     elif test -n "$ENABLE_DBGUTIL"; then
6575         compiler_plugins=test
6576     else
6577         compiler_plugins=no
6578     fi
6579     if test "$compiler_plugins" != no -a "$CLANGVER" -lt 30800; then
6580         if test "$compiler_plugins" = yes; then
6581             AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 3.8.0.])
6582         else
6583             compiler_plugins=no
6584         fi
6585     fi
6586     if test "$compiler_plugins" != "no"; then
6587         dnl The prefix where Clang resides, override to where Clang resides if
6588         dnl using a source build:
6589         if test -z "$CLANGDIR"; then
6590             CLANGDIR=/usr
6591         fi
6592         AC_LANG_PUSH([C++])
6593         save_CPPFLAGS=$CPPFLAGS
6594         save_CXX=$CXX
6595         # compiler plugins must be built with "native" compiler that was used to build Clang itself:
6596         : "${COMPILER_PLUGINS_CXX=g++ -std=c++11}"
6597         CXX=$COMPILER_PLUGINS_CXX
6598         CPPFLAGS="$CPPFLAGS -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6599         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6600             [COMPILER_PLUGINS=TRUE],
6601             [
6602             if test "$compiler_plugins" = "yes"; then
6603                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6604             else
6605                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6606                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6607             fi
6608             ])
6609         CXX=$save_CXX
6610         CPPFLAGS=$save_CPPFLAGS
6611         AC_LANG_POP([C++])
6612     fi
6613 else
6614     if test "$enable_compiler_plugins" = "yes"; then
6615         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6616     fi
6618 AC_SUBST(COMPILER_PLUGINS)
6619 AC_SUBST(COMPILER_PLUGINS_CXX)
6620 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
6621 AC_SUBST(COMPILER_PLUGINS_DEBUG)
6622 AC_SUBST(CLANGDIR)
6623 AC_SUBST(CLANGLIBDIR)
6625 # Plugin to help linker.
6626 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6627 # This makes --enable-lto build with clang work.
6628 AC_SUBST(LD_PLUGIN)
6630 dnl ===================================================================
6631 dnl allocator
6632 dnl ===================================================================
6633 AC_MSG_CHECKING([which memory allocator to use])
6634 if test "$with_alloc" = "system"; then
6635     AC_MSG_RESULT([system])
6636     ALLOC="SYS_ALLOC"
6638 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6639     AC_MSG_RESULT([internal])
6641 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6642 AC_SUBST(HAVE_POSIX_FALLOCATE)
6643 AC_SUBST(ALLOC)
6645 dnl ===================================================================
6646 dnl Custom build version
6647 dnl ===================================================================
6649 AC_MSG_CHECKING([whether to add custom build version])
6650 if test "$with_build_version" != ""; then
6651     BUILD_VER_STRING=$with_build_version
6652     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6653 else
6654     BUILD_VER_STRING=
6655     AC_MSG_RESULT([no])
6657 AC_SUBST(BUILD_VER_STRING)
6659 JITC_PROCESSOR_TYPE=""
6660 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6661     # IBMs JDK needs this...
6662     JITC_PROCESSOR_TYPE=6
6663     export JITC_PROCESSOR_TYPE
6665 AC_SUBST([JITC_PROCESSOR_TYPE])
6667 # Misc Windows Stuff
6668 AC_ARG_WITH(ucrt-dir,
6669     AS_HELP_STRING([--with-ucrt-dir],
6670         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
6671         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
6672         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
6673             Windows6.1-KB2999226-x64.msu
6674             Windows6.1-KB2999226-x86.msu
6675             Windows8.1-KB2999226-x64.msu
6676             Windows8.1-KB2999226-x86.msu
6677             Windows8-RT-KB2999226-x64.msu
6678             Windows8-RT-KB2999226-x86.msu
6679         A zip archive including those files is available from Microsoft site:
6680         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
6682 UCRT_REDISTDIR="$with_ucrt_dir"
6683 if test $_os = "WINNT"; then
6684     find_msvc_x64_dlls
6685     find_msms
6686     MSVC_DLL_PATH="$msvcdllpath"
6687     MSVC_DLLS="$msvcdlls"
6688     MSM_PATH="$msmdir"
6689     # MSVC 15.3 changed it to VC141
6690     if echo "$MSVC_DLL_PATH" | grep -q "VC141.CRT$"; then
6691         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
6692     else
6693         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6694     fi
6695     if test "$UCRT_REDISTDIR" = "no"; then
6696         dnl explicitly disabled
6697         UCRT_REDISTDIR=""
6698     else
6699         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
6700                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
6701                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
6702                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
6703                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
6704                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
6705             UCRT_REDISTDIR=""
6706             if test -n "$PKGFORMAT"; then
6707                for i in $PKGFORMAT; do
6708                    case "$i" in
6709                    msi)
6710                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
6711                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
6712                        ;;
6713                    esac
6714                done
6715             fi
6716         fi
6717     fi
6720 AC_SUBST(UCRT_REDISTDIR)
6721 AC_SUBST(MSVC_DLL_PATH)
6722 AC_SUBST(MSVC_DLLS)
6723 AC_SUBST(MSM_PATH)
6725 dnl ===================================================================
6726 dnl Checks for Java
6727 dnl ===================================================================
6728 if test "$ENABLE_JAVA" != ""; then
6730     # Windows-specific tests
6731     if test "$build_os" = "cygwin"; then
6732         if test "$BITNESS_OVERRIDE" = 64; then
6733             bitness=64
6734         else
6735             bitness=32
6736         fi
6738         if test -z "$with_jdk_home"; then
6739             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
6740             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
6741             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
6742             if test -n "$regvalue"; then
6743                 ver=$regvalue
6744                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
6745                 _jdk_home=$regvalue
6746             fi
6747             if test -z "$with_jdk_home"; then
6748                 for ver in 1.8 1.7 1.6; do
6749                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6750                     if test -n "$regvalue"; then
6751                         _jdk_home=$regvalue
6752                         break
6753                     fi
6754                 done
6755             fi
6756             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6757                 with_jdk_home="$_jdk_home"
6758                 howfound="found automatically"
6759             else
6760                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6761             fi
6762         else
6763             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6764             howfound="you passed"
6765         fi
6766     fi
6768     # 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.
6769     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6770     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6771         with_jdk_home=`/usr/libexec/java_home`
6772     fi
6774     JAVA_HOME=; export JAVA_HOME
6775     if test -z "$with_jdk_home"; then
6776         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6777     else
6778         _java_path="$with_jdk_home/bin/$with_java"
6779         dnl Check if there is a Java interpreter at all.
6780         if test -x "$_java_path"; then
6781             JAVAINTERPRETER=$_java_path
6782         else
6783             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6784         fi
6785     fi
6787     dnl Check that the JDK found is correct architecture (at least 2 reasons to
6788     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
6789     dnl loaded by java to run JunitTests:
6790     if test "$build_os" = "cygwin"; then
6791         shortjdkhome=`cygpath -d "$with_jdk_home"`
6792         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
6793             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6794             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6795         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
6796             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6797             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6798         fi
6800         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6801             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6802         fi
6803         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6804     elif test "$cross_compiling" != "yes"; then
6805         case $CPUNAME in
6806             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
6807                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6808                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6809                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6810                 fi
6811                 ;;
6812             *) # assumption: everything else 32-bit
6813                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6814                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6815                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6816                 fi
6817                 ;;
6818         esac
6819     fi
6822 HAVE_JAVA9=
6823 dnl ===================================================================
6824 dnl Checks for JDK.
6825 dnl ===================================================================
6827 # Note that JAVA_HOME as for now always means the *build* platform's
6828 # JAVA_HOME. Whether all the complexity here actually is needed any
6829 # more or not, no idea.
6831 if test "$ENABLE_JAVA" != ""; then
6832     _gij_longver=0
6833     AC_MSG_CHECKING([the installed JDK])
6834     if test -n "$JAVAINTERPRETER"; then
6835         dnl java -version sends output to stderr!
6836         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6837             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6838         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6839             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6840         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6841             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6842         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6843             JDK=ibm
6845             dnl IBM JDK specific tests
6846             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6847             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6849             if test "$_jdk_ver" -lt 10600; then
6850                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
6851             fi
6853             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6855             if test "$with_jdk_home" = ""; then
6856                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6857 you must use the "--with-jdk-home" configure option explicitly])
6858             fi
6860             JAVA_HOME=$with_jdk_home
6861         else
6862             JDK=sun
6864             dnl Sun JDK specific tests
6865             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6866             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6868             if test "$_jdk_ver" -lt 10600; then
6869                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
6870             fi
6871             if test "$_jdk_ver" -gt 10600; then
6872                 JAVA_CLASSPATH_NOT_SET=TRUE
6873             fi
6874             if test "$_jdk_ver" -ge 10900; then
6875                 HAVE_JAVA9=TRUE
6876             fi
6878             AC_MSG_RESULT([checked (JDK $_jdk)])
6879             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6880             if test "$_os" = "WINNT"; then
6881                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6882             fi
6884             # set to limit VM usage for JunitTests
6885             JAVAIFLAGS=-Xmx64M
6886             # set to limit VM usage for javac
6887             JAVAFLAGS=-J-Xmx128M
6888         fi
6889     else
6890         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
6891     fi
6892 else
6893     dnl Java disabled
6894     JAVA_HOME=
6895     export JAVA_HOME
6898 dnl ===================================================================
6899 dnl Set target Java bytecode version
6900 dnl ===================================================================
6901 if test "$ENABLE_JAVA" != ""; then
6902     if test "$HAVE_JAVA9" = "TRUE"; then
6903         _java_target_ver="1.6"
6904     else
6905         _java_target_ver="1.5"
6906     fi
6907     JAVA_SOURCE_VER="$_java_target_ver"
6908     JAVA_TARGET_VER="$_java_target_ver"
6911 dnl ===================================================================
6912 dnl Checks for javac
6913 dnl ===================================================================
6914 if test "$ENABLE_JAVA" != ""; then
6915     javacompiler="javac"
6916     if test -z "$with_jdk_home"; then
6917         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6918     else
6919         _javac_path="$with_jdk_home/bin/$javacompiler"
6920         dnl Check if there is a Java compiler at all.
6921         if test -x "$_javac_path"; then
6922             JAVACOMPILER=$_javac_path
6923         fi
6924     fi
6925     if test -z "$JAVACOMPILER"; then
6926         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6927     fi
6928     if test "$build_os" = "cygwin"; then
6929         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6930             JAVACOMPILER="${JAVACOMPILER}.exe"
6931         fi
6932         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
6933     fi
6936 dnl ===================================================================
6937 dnl Checks for javadoc
6938 dnl ===================================================================
6939 if test "$ENABLE_JAVA" != ""; then
6940     if test -z "$with_jdk_home"; then
6941         AC_PATH_PROG(JAVADOC, javadoc)
6942     else
6943         _javadoc_path="$with_jdk_home/bin/javadoc"
6944         dnl Check if there is a javadoc at all.
6945         if test -x "$_javadoc_path"; then
6946             JAVADOC=$_javadoc_path
6947         else
6948             AC_PATH_PROG(JAVADOC, javadoc)
6949         fi
6950     fi
6951     if test -z "$JAVADOC"; then
6952         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6953     fi
6954     if test "$build_os" = "cygwin"; then
6955         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6956             JAVADOC="${JAVADOC}.exe"
6957         fi
6958         JAVADOC=`win_short_path_for_make "$JAVADOC"`
6959     fi
6961     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6962     JAVADOCISGJDOC="yes"
6963     fi
6965 AC_SUBST(JAVADOCISGJDOC)
6967 if test "$ENABLE_JAVA" != ""; then
6968     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
6969     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
6970         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
6971            # try to recover first by looking whether we have a alternatives
6972            # system as in Debian or newer SuSEs where following /usr/bin/javac
6973            # over /etc/alternatives/javac leads to the right bindir where we
6974            # just need to strip a bit away to get a valid JAVA_HOME
6975            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
6976         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
6977             # maybe only one level of symlink (e.g. on Mac)
6978             JAVA_HOME=$(readlink $JAVACOMPILER)
6979             if test "$(dirname $JAVA_HOME)" = "."; then
6980                 # we've got no path to trim back
6981                 JAVA_HOME=""
6982             fi
6983         else
6984             # else warn
6985             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
6986             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
6987             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
6988             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
6989         fi
6990         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
6991         if test "$JAVA_HOME" != "/usr"; then
6992             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6993                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
6994                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
6995                 dnl Tiger already returns a JDK path..
6996                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
6997             else
6998                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
6999                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7000                 dnl that checks which version to run
7001                 if test -f "$JAVA_HOME"; then
7002                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7003                 fi
7004             fi
7005         fi
7006     fi
7007     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7009     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7010     if test -z "$JAVA_HOME"; then
7011         if test "x$with_jdk_home" = "x"; then
7012             cat > findhome.java <<_ACEOF
7013 [import java.io.File;
7015 class findhome
7017     public static void main(String args[])
7018     {
7019         String jrelocation = System.getProperty("java.home");
7020         File jre = new File(jrelocation);
7021         System.out.println(jre.getParent());
7022     }
7024 _ACEOF
7025             AC_MSG_CHECKING([if javac works])
7026             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7027             AC_TRY_EVAL(javac_cmd)
7028             if test $? = 0 -a -f ./findhome.class; then
7029                 AC_MSG_RESULT([javac works])
7030             else
7031                 echo "configure: javac test failed" >&5
7032                 cat findhome.java >&5
7033                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7034             fi
7035             AC_MSG_CHECKING([if gij knows its java.home])
7036             JAVA_HOME=`$JAVAINTERPRETER findhome`
7037             if test $? = 0 -a "$JAVA_HOME" != ""; then
7038                 AC_MSG_RESULT([$JAVA_HOME])
7039             else
7040                 echo "configure: java test failed" >&5
7041                 cat findhome.java >&5
7042                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7043             fi
7044             # clean-up after ourselves
7045             rm -f ./findhome.java ./findhome.class
7046         else
7047             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7048         fi
7049     fi
7051     # now check if $JAVA_HOME is really valid
7052     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7053         case "${JAVA_HOME}" in
7054             /Library/Java/JavaVirtualMachines/*)
7055                 ;;
7056             *)
7057                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7058                 ;;
7059         esac
7060         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7061             JAVA_HOME_OK="NO"
7062         fi
7063     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7064         JAVA_HOME_OK="NO"
7065     fi
7066     if test "$JAVA_HOME_OK" = "NO"; then
7067         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7068         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7069         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
7070         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7071         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7072         add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
7073     fi
7074     PathFormat "$JAVA_HOME"
7075     JAVA_HOME="$formatted_path"
7078 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7079     "$_os" != Darwin
7080 then
7081     AC_MSG_CHECKING([for JAWT lib])
7082     if test "$_os" = WINNT; then
7083         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7084         JAWTLIB=jawt.lib
7085     else
7086         case "$host_cpu" in
7087         arm*)
7088             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7089             JAVA_ARCH=$my_java_arch
7090             ;;
7091         i*86)
7092             my_java_arch=i386
7093             ;;
7094         m68k)
7095             my_java_arch=m68k
7096             ;;
7097         powerpc)
7098             my_java_arch=ppc
7099             ;;
7100         powerpc64)
7101             my_java_arch=ppc64
7102             ;;
7103         powerpc64le)
7104             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7105             JAVA_ARCH=$my_java_arch
7106             ;;
7107         sparc64)
7108             my_java_arch=sparcv9
7109             ;;
7110         x86_64)
7111             my_java_arch=amd64
7112             ;;
7113         *)
7114             my_java_arch=$host_cpu
7115             ;;
7116         esac
7117         # This is where JDK9 puts the library
7118         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7119             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7120         else
7121             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7122         fi
7123         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7124     fi
7125     AC_MSG_RESULT([$JAWTLIB])
7127 AC_SUBST(JAWTLIB)
7129 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7130     case "$host_os" in
7132     aix*)
7133         JAVAINC="-I$JAVA_HOME/include"
7134         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7135         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7136         ;;
7138     cygwin*)
7139         JAVAINC="-I$JAVA_HOME/include/win32"
7140         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7141         ;;
7143     darwin*)
7144         if test -d "$JAVA_HOME/include/darwin"; then
7145             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7146         else
7147             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7148         fi
7149         ;;
7151     dragonfly*)
7152         JAVAINC="-I$JAVA_HOME/include"
7153         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7154         ;;
7156     freebsd*)
7157         JAVAINC="-I$JAVA_HOME/include"
7158         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7159         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7160         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7161         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7162         ;;
7164     k*bsd*-gnu*)
7165         JAVAINC="-I$JAVA_HOME/include"
7166         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7167         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7168         ;;
7170     linux-gnu*)
7171         JAVAINC="-I$JAVA_HOME/include"
7172         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7173         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7174         ;;
7176     *netbsd*)
7177         JAVAINC="-I$JAVA_HOME/include"
7178         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7179         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7180        ;;
7182     openbsd*)
7183         JAVAINC="-I$JAVA_HOME/include"
7184         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7185         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7186         ;;
7188     solaris*)
7189         JAVAINC="-I$JAVA_HOME/include"
7190         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7191         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7192         ;;
7193     esac
7195 SOLARINC="$SOLARINC $JAVAINC"
7197 AC_SUBST(JAVACOMPILER)
7198 AC_SUBST(JAVADOC)
7199 AC_SUBST(JAVAINTERPRETER)
7200 AC_SUBST(JAVAIFLAGS)
7201 AC_SUBST(JAVAFLAGS)
7202 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7203 AC_SUBST(JAVA_HOME)
7204 AC_SUBST(JAVA_SOURCE_VER)
7205 AC_SUBST(JAVA_TARGET_VER)
7206 AC_SUBST(JDK)
7209 dnl ===================================================================
7210 dnl Export file validation
7211 dnl ===================================================================
7212 AC_MSG_CHECKING([whether to enable export file validation])
7213 if test "$with_export_validation" != "no"; then
7214     if test -z "$ENABLE_JAVA"; then
7215         if test "$with_export_validation" = "yes"; then
7216             AC_MSG_ERROR([requested, but Java is disabled])
7217         else
7218             AC_MSG_RESULT([no, as Java is disabled])
7219         fi
7220     elif test "$_jdk_ver" -lt 10800; then
7221         if test "$with_export_validation" = "yes"; then
7222             AC_MSG_ERROR([requested, but Java is too old, need Java 8])
7223         else
7224             AC_MSG_RESULT([no, as Java is too old, need Java 8])
7225         fi
7226     else
7227         AC_MSG_RESULT([yes])
7228         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7230         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7231         if test -z "$ODFVALIDATOR"; then
7232             # remember to download the ODF toolkit with validator later
7233             AC_MSG_NOTICE([no odfvalidator found, will download it])
7234             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7235             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7237             # and fetch name of odfvalidator jar name from download.lst
7238             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7239             AC_SUBST(ODFVALIDATOR_JAR)
7241             if test -z "$ODFVALIDATOR_JAR"; then
7242                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7243             fi
7244         fi
7245         if test "$build_os" = "cygwin"; then
7246             # In case of Cygwin it will be executed from Windows,
7247             # so we need to run bash and absolute path to validator
7248             # so instead of "odfvalidator" it will be
7249             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7250             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7251         else
7252             ODFVALIDATOR="sh $ODFVALIDATOR"
7253         fi
7254         AC_SUBST(ODFVALIDATOR)
7257         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7258         if test -z "$OFFICEOTRON"; then
7259             # remember to download the officeotron with validator later
7260             AC_MSG_NOTICE([no officeotron found, will download it])
7261             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7262             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7264             # and fetch name of officeotron jar name from download.lst
7265             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7266             AC_SUBST(OFFICEOTRON_JAR)
7268             if test -z "$OFFICEOTRON_JAR"; then
7269                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7270             fi
7271         else
7272             # check version of existing officeotron
7273             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7274             if test 0"$OFFICEOTRON_VER" -lt 704; then
7275                 AC_MSG_ERROR([officeotron too old])
7276             fi
7277         fi
7278         if test "$build_os" = "cygwin"; then
7279             # In case of Cygwin it will be executed from Windows,
7280             # so we need to run bash and absolute path to validator
7281             # so instead of "odfvalidator" it will be
7282             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7283             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7284         else
7285             OFFICEOTRON="sh $OFFICEOTRON"
7286         fi
7287     fi
7288     AC_SUBST(OFFICEOTRON)
7289 else
7290     AC_MSG_RESULT([no])
7293 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7294 if test "$with_bffvalidator" != "no"; then
7295     AC_DEFINE(HAVE_BFFVALIDATOR)
7297     if test "$with_export_validation" = "no"; then
7298         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7299     fi
7301     if test "$with_bffvalidator" = "yes"; then
7302         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7303     else
7304         BFFVALIDATOR="$with_bffvalidator"
7305     fi
7307     if test "$build_os" = "cygwin"; then
7308         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7309             AC_MSG_RESULT($BFFVALIDATOR)
7310         else
7311             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7312         fi
7313     elif test -n "$BFFVALIDATOR"; then
7314         # We are not in Cygwin but need to run Windows binary with wine
7315         AC_PATH_PROGS(WINE, wine)
7317         # so swap in a shell wrapper that converts paths transparently
7318         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7319         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7320         AC_SUBST(BFFVALIDATOR_EXE)
7321         AC_MSG_RESULT($BFFVALIDATOR)
7322     else
7323         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7324     fi
7325     AC_SUBST(BFFVALIDATOR)
7326 else
7327     AC_MSG_RESULT([no])
7330 dnl ===================================================================
7331 dnl Check for C preprocessor to use
7332 dnl ===================================================================
7333 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7334 if test -n "$with_idlc_cpp"; then
7335     AC_MSG_RESULT([$with_idlc_cpp])
7336     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7337 else
7338     AC_MSG_RESULT([ucpp])
7339     AC_MSG_CHECKING([which ucpp tp use])
7340     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7341         AC_MSG_RESULT([external])
7342         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7343     else
7344         AC_MSG_RESULT([internal])
7345         BUILD_TYPE="$BUILD_TYPE UCPP"
7346     fi
7348 AC_SUBST(SYSTEM_UCPP)
7350 dnl ===================================================================
7351 dnl Check for epm (not needed for Windows)
7352 dnl ===================================================================
7353 AC_MSG_CHECKING([whether to enable EPM for packing])
7354 if test "$enable_epm" = "yes"; then
7355     AC_MSG_RESULT([yes])
7356     if test "$_os" != "WINNT"; then
7357         if test $_os = Darwin; then
7358             EPM=internal
7359         elif test -n "$with_epm"; then
7360             EPM=$with_epm
7361         else
7362             AC_PATH_PROG(EPM, epm, no)
7363         fi
7364         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7365             AC_MSG_NOTICE([EPM will be built.])
7366             BUILD_TYPE="$BUILD_TYPE EPM"
7367             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7368         else
7369             # Gentoo has some epm which is something different...
7370             AC_MSG_CHECKING([whether the found epm is the right epm])
7371             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7372                 AC_MSG_RESULT([yes])
7373             else
7374                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7375             fi
7376             AC_MSG_CHECKING([epm version])
7377             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7378             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7379                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7380                 AC_MSG_RESULT([OK, >= 3.7])
7381             else
7382                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7383                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7384             fi
7385         fi
7386     fi
7388     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7389         AC_MSG_CHECKING([for rpm])
7390         for a in "$RPM" rpmbuild rpm; do
7391             $a --usage >/dev/null 2> /dev/null
7392             if test $? -eq 0; then
7393                 RPM=$a
7394                 break
7395             else
7396                 $a --version >/dev/null 2> /dev/null
7397                 if test $? -eq 0; then
7398                     RPM=$a
7399                     break
7400                 fi
7401             fi
7402         done
7403         if test -z "$RPM"; then
7404             AC_MSG_ERROR([not found])
7405         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7406             RPM_PATH=`which $RPM`
7407             AC_MSG_RESULT([$RPM_PATH])
7408             SCPDEFS="$SCPDEFS -DWITH_RPM"
7409         else
7410             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7411         fi
7412     fi
7413     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7414         AC_PATH_PROG(DPKG, dpkg, no)
7415         if test "$DPKG" = "no"; then
7416             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7417         fi
7418     fi
7419     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7420        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7421         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7422             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7423                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7424                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7425                     AC_MSG_RESULT([yes])
7426                 else
7427                     AC_MSG_RESULT([no])
7428                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7429                         _pt="rpm"
7430                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7431                         add_warning "the rpms will need to be installed with --nodeps"
7432                     else
7433                         _pt="pkg"
7434                     fi
7435                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7436                     add_warning "the ${_pt}s will not be relocatable"
7437                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7438                                  relocation will work, you need to patch your epm with the
7439                                  patch in epm/epm-3.7.patch or build with
7440                                  --with-epm=internal which will build a suitable epm])
7441                 fi
7442             fi
7443         fi
7444     fi
7445     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7446         AC_PATH_PROG(PKGMK, pkgmk, no)
7447         if test "$PKGMK" = "no"; then
7448             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7449         fi
7450     fi
7451     AC_SUBST(RPM)
7452     AC_SUBST(DPKG)
7453     AC_SUBST(PKGMK)
7454 else
7455     for i in $PKGFORMAT; do
7456         case "$i" in
7457         aix | bsd | deb | pkg | rpm | native | portable)
7458             AC_MSG_ERROR(
7459                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7460             ;;
7461         esac
7462     done
7463     AC_MSG_RESULT([no])
7464     EPM=NO
7466 AC_SUBST(EPM)
7468 ENABLE_LWP=
7469 if test "$enable_lotuswordpro" = "yes"; then
7470     ENABLE_LWP="TRUE"
7472 AC_SUBST(ENABLE_LWP)
7474 dnl ===================================================================
7475 dnl Check for building ODK
7476 dnl ===================================================================
7477 if test "$enable_odk" = no; then
7478     unset DOXYGEN
7479 else
7480     if test "$with_doxygen" = no; then
7481         AC_MSG_CHECKING([for doxygen])
7482         unset DOXYGEN
7483         AC_MSG_RESULT([no])
7484     else
7485         if test "$with_doxygen" = yes; then
7486             AC_PATH_PROG([DOXYGEN], [doxygen])
7487             if test -z "$DOXYGEN"; then
7488                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7489             fi
7490             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
7491                 if ! dot -V 2>/dev/null; then
7492                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
7493                 fi
7494             fi
7495         else
7496             AC_MSG_CHECKING([for doxygen])
7497             DOXYGEN=$with_doxygen
7498             AC_MSG_RESULT([$DOXYGEN])
7499         fi
7500         if test -n "$DOXYGEN"; then
7501             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7502             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7503             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7504                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7505             fi
7506         fi
7507     fi
7509 AC_SUBST([DOXYGEN])
7511 AC_MSG_CHECKING([whether to build the ODK])
7512 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7513     AC_MSG_RESULT([yes])
7515     if test "$with_java" != "no"; then
7516         AC_MSG_CHECKING([whether to build unowinreg.dll])
7517         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7518             # build on Win by default
7519             enable_build_unowinreg=yes
7520         fi
7521         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7522             AC_MSG_RESULT([no])
7523             BUILD_UNOWINREG=
7524         else
7525             AC_MSG_RESULT([yes])
7526             BUILD_UNOWINREG=TRUE
7527         fi
7528         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7529             if test -z "$with_mingw_cross_compiler"; then
7530                 dnl Guess...
7531                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7532             elif test -x "$with_mingw_cross_compiler"; then
7533                  MINGWCXX="$with_mingw_cross_compiler"
7534             else
7535                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7536             fi
7538             if test "$MINGWCXX" = "false"; then
7539                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7540             fi
7542             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7543             if test -x "$mingwstrip_test"; then
7544                 MINGWSTRIP="$mingwstrip_test"
7545             else
7546                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7547             fi
7549             if test "$MINGWSTRIP" = "false"; then
7550                 AC_MSG_ERROR(MinGW32 binutils not found.)
7551             fi
7552         fi
7553     fi
7554     BUILD_TYPE="$BUILD_TYPE ODK"
7555 else
7556     AC_MSG_RESULT([no])
7557     BUILD_UNOWINREG=
7559 AC_SUBST(BUILD_UNOWINREG)
7560 AC_SUBST(MINGWCXX)
7561 AC_SUBST(MINGWSTRIP)
7563 dnl ===================================================================
7564 dnl Check for system zlib
7565 dnl ===================================================================
7566 if test "$with_system_zlib" = "auto"; then
7567     case "$_os" in
7568     WINNT)
7569         with_system_zlib="$with_system_libs"
7570         ;;
7571     *)
7572         if test "$enable_fuzzers" != "yes"; then
7573             with_system_zlib=yes
7574         else
7575             with_system_zlib=no
7576         fi
7577         ;;
7578     esac
7581 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7582 dnl and has no pkg-config for it at least on some tinderboxes,
7583 dnl so leaving that out for now
7584 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7585 AC_MSG_CHECKING([which zlib to use])
7586 if test "$with_system_zlib" = "yes"; then
7587     AC_MSG_RESULT([external])
7588     SYSTEM_ZLIB=TRUE
7589     AC_CHECK_HEADER(zlib.h, [],
7590         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7591     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7592         [AC_MSG_ERROR(zlib not found or functional)], [])
7593 else
7594     AC_MSG_RESULT([internal])
7595     SYSTEM_ZLIB=
7596     BUILD_TYPE="$BUILD_TYPE ZLIB"
7597     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7598     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7600 AC_SUBST(ZLIB_CFLAGS)
7601 AC_SUBST(ZLIB_LIBS)
7602 AC_SUBST(SYSTEM_ZLIB)
7604 dnl ===================================================================
7605 dnl Check for system jpeg
7606 dnl ===================================================================
7607 AC_MSG_CHECKING([which libjpeg to use])
7608 if test "$with_system_jpeg" = "yes"; then
7609     AC_MSG_RESULT([external])
7610     SYSTEM_LIBJPEG=TRUE
7611     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7612         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7613     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7614         [AC_MSG_ERROR(jpeg library not found or fuctional)], [])
7615 else
7616     SYSTEM_LIBJPEG=
7617     AC_MSG_RESULT([internal, libjpeg-turbo])
7618     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
7619     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
7620     if test "$COM" = "MSC"; then
7621         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
7622     else
7623         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
7624     fi
7626     case "$host_cpu" in
7627     x86_64 | amd64 | i*86 | x86 | ia32)
7628         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7629         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7630             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7631                 NASM="$LODE_HOME/opt/bin/nasm"
7632             elif test -x "/opt/lo/bin/nasm"; then
7633                 NASM="/opt/lo/bin/nasm"
7634             fi
7635         fi
7637         if test -n "$NASM"; then
7638             AC_MSG_CHECKING([for object file format of host system])
7639             case "$host_os" in
7640               cygwin* | mingw* | pw32* | interix*)
7641                 case "$host_cpu" in
7642                   x86_64)
7643                     objfmt='Win64-COFF'
7644                     ;;
7645                   *)
7646                     objfmt='Win32-COFF'
7647                     ;;
7648                 esac
7649               ;;
7650               msdosdjgpp* | go32*)
7651                 objfmt='COFF'
7652               ;;
7653               os2-emx*)                 # not tested
7654                 objfmt='MSOMF'          # obj
7655               ;;
7656               linux*coff* | linux*oldld*)
7657                 objfmt='COFF'           # ???
7658               ;;
7659               linux*aout*)
7660                 objfmt='a.out'
7661               ;;
7662               linux*)
7663                 case "$host_cpu" in
7664                   x86_64)
7665                     objfmt='ELF64'
7666                     ;;
7667                   *)
7668                     objfmt='ELF'
7669                     ;;
7670                 esac
7671               ;;
7672               kfreebsd* | freebsd* | netbsd* | openbsd*)
7673                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
7674                   objfmt='BSD-a.out'
7675                 else
7676                   case "$host_cpu" in
7677                     x86_64 | amd64)
7678                       objfmt='ELF64'
7679                       ;;
7680                     *)
7681                       objfmt='ELF'
7682                       ;;
7683                   esac
7684                 fi
7685               ;;
7686               solaris* | sunos* | sysv* | sco*)
7687                 case "$host_cpu" in
7688                   x86_64)
7689                     objfmt='ELF64'
7690                     ;;
7691                   *)
7692                     objfmt='ELF'
7693                     ;;
7694                 esac
7695               ;;
7696               darwin* | rhapsody* | nextstep* | openstep* | macos*)
7697                 case "$host_cpu" in
7698                   x86_64)
7699                     objfmt='Mach-O64'
7700                     ;;
7701                   *)
7702                     objfmt='Mach-O'
7703                     ;;
7704                 esac
7705               ;;
7706               *)
7707                 objfmt='ELF ?'
7708               ;;
7709             esac
7711             AC_MSG_RESULT([$objfmt])
7712             if test "$objfmt" = 'ELF ?'; then
7713               objfmt='ELF'
7714               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
7715             fi
7717             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
7718             case "$objfmt" in
7719               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
7720               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
7721               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
7722               COFF)       NAFLAGS='-fcoff -DCOFF';;
7723               a.out)      NAFLAGS='-faout -DAOUT';;
7724               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
7725               ELF)        NAFLAGS='-felf -DELF';;
7726               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
7727               RDF)        NAFLAGS='-frdf -DRDF';;
7728               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
7729               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
7730             esac
7731             AC_MSG_RESULT([$NAFLAGS])
7733             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
7734             cat > conftest.asm << EOF
7735             [%line __oline__ "configure"
7736                     section .text
7737                     global  _main,main
7738             _main:
7739             main:   xor     eax,eax
7740                     ret
7741             ]
7743             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
7744             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
7745               AC_MSG_RESULT(yes)
7746             else
7747               echo "configure: failed program was:" >&AC_FD_CC
7748               cat conftest.asm >&AC_FD_CC
7749               rm -rf conftest*
7750               AC_MSG_RESULT(no)
7751               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
7752               NASM=""
7753             fi
7755         fi
7757         if test -z "$NASM"; then
7758 cat << _EOS
7759 ****************************************************************************
7760 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
7761 To get one please:
7763 _EOS
7764             if test "$build_os" = "cygwin"; then
7765 cat << _EOS
7766 install a pre-compiled binary for Win32
7768 mkdir -p /opt/lo/bin
7769 cd /opt/lo/bin
7770 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7771 chmod +x nasm
7773 or get and install one from http://www.nasm.us/
7775 Then re-run autogen.sh
7777 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7778 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7780 _EOS
7781             else
7782 cat << _EOS
7783 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
7785 _EOS
7786             fi
7787             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
7788             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
7789         fi
7790       ;;
7791     esac
7794 AC_SUBST(NASM)
7795 AC_SUBST(LIBJPEG_CFLAGS)
7796 AC_SUBST(LIBJPEG_LIBS)
7797 AC_SUBST(SYSTEM_LIBJPEG)
7799 dnl ===================================================================
7800 dnl Check for system clucene
7801 dnl ===================================================================
7802 dnl we should rather be using
7803 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7804 dnl but the contribs-lib check seems tricky
7805 AC_MSG_CHECKING([which clucene to use])
7806 if test "$with_system_clucene" = "yes"; then
7807     AC_MSG_RESULT([external])
7808     SYSTEM_CLUCENE=TRUE
7809     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7810     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7811     FilterLibs "${CLUCENE_LIBS}"
7812     CLUCENE_LIBS="${filteredlibs}"
7813     AC_LANG_PUSH([C++])
7814     save_CXXFLAGS=$CXXFLAGS
7815     save_CPPFLAGS=$CPPFLAGS
7816     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7817     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7818     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7819     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7820     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7821                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7822     CXXFLAGS=$save_CXXFLAGS
7823     CPPFLAGS=$save_CPPFLAGS
7824     AC_LANG_POP([C++])
7826     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7827 else
7828     AC_MSG_RESULT([internal])
7829     SYSTEM_CLUCENE=
7830     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7832 AC_SUBST(SYSTEM_CLUCENE)
7833 AC_SUBST(CLUCENE_CFLAGS)
7834 AC_SUBST(CLUCENE_LIBS)
7836 dnl ===================================================================
7837 dnl Check for system expat
7838 dnl ===================================================================
7839 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
7841 dnl ===================================================================
7842 dnl Check for system xmlsec
7843 dnl ===================================================================
7844 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24])
7846 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7847 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7848     ENABLE_EOT="TRUE"
7849     AC_DEFINE([ENABLE_EOT])
7850     AC_MSG_RESULT([yes])
7852     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7853 else
7854     ENABLE_EOT=
7855     AC_MSG_RESULT([no])
7857 AC_SUBST([ENABLE_EOT])
7859 dnl ===================================================================
7860 dnl Check for DLP libs
7861 dnl ===================================================================
7862 AS_IF([test "$COM" = "MSC"],
7863       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7864       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7866 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7868 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7870 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
7872 AS_IF([test "$COM" = "MSC"],
7873       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7874       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7876 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7878 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7880 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7881 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.9])
7883 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7885 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7887 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7889 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
7890 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.14])
7892 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
7893 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
7895 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7897 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
7898 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
7900 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7902 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7904 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
7906 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
7908 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
7909 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
7911 dnl ===================================================================
7912 dnl Check for system lcms2
7913 dnl ===================================================================
7914 if test "$with_system_lcms2" != "yes"; then
7915     SYSTEM_LCMS2=
7917 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7918 if test "$GCC" = "yes"; then
7919     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7921 if test "$COM" = "MSC"; then # override the above
7922     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7925 dnl ===================================================================
7926 dnl Check for system cppunit
7927 dnl ===================================================================
7928 if test "$cross_compiling" != "yes"; then
7929     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
7932 dnl ===================================================================
7933 dnl Check whether freetype is available
7934 dnl ===================================================================
7935 if test  "$test_freetype" = "yes"; then
7936     AC_MSG_CHECKING([whether freetype is available])
7937     # FreeType has 3 different kinds of versions
7938     # * release, like 2.4.10
7939     # * libtool, like 13.0.7 (this what pkg-config returns)
7940     # * soname
7941     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7942     #
7943     # 9.9.3 is 2.2.0
7944     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7945     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7946     FilterLibs "${FREETYPE_LIBS}"
7947     FREETYPE_LIBS="${filteredlibs}"
7948     SYSTEM_FREETYPE=TRUE
7949 else
7950     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
7951     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
7953 AC_SUBST(FREETYPE_CFLAGS)
7954 AC_SUBST(FREETYPE_LIBS)
7955 AC_SUBST([SYSTEM_FREETYPE])
7957 # ===================================================================
7958 # Check for system libxslt
7959 # to prevent incompatibilities between internal libxml2 and external libxslt,
7960 # or vice versa, use with_system_libxml here
7961 # ===================================================================
7962 if test "$with_system_libxml" = "auto"; then
7963     case "$_os" in
7964     WINNT|iOS|Android)
7965         with_system_libxml="$with_system_libs"
7966         ;;
7967     *)
7968         if test "$enable_fuzzers" != "yes"; then
7969             with_system_libxml=yes
7970         else
7971             with_system_libxml=no
7972         fi
7973         ;;
7974     esac
7977 AC_MSG_CHECKING([which libxslt to use])
7978 if test "$with_system_libxml" = "yes"; then
7979     AC_MSG_RESULT([external])
7980     SYSTEM_LIBXSLT=TRUE
7981     if test "$_os" = "Darwin"; then
7982         dnl make sure to use SDK path
7983         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7984         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7985         dnl omit -L/usr/lib
7986         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7987         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7988     else
7989         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7990         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7991         FilterLibs "${LIBXSLT_LIBS}"
7992         LIBXSLT_LIBS="${filteredlibs}"
7993         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7994         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7995         FilterLibs "${LIBEXSLT_LIBS}"
7996         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
7997     fi
7999     dnl Check for xsltproc
8000     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8001     if test "$XSLTPROC" = "no"; then
8002         AC_MSG_ERROR([xsltproc is required])
8003     fi
8004 else
8005     AC_MSG_RESULT([internal])
8006     SYSTEM_LIBXSLT=
8007     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8009     if test "$cross_compiling" = "yes"; then
8010         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8011         if test "$XSLTPROC" = "no"; then
8012             AC_MSG_ERROR([xsltproc is required])
8013         fi
8014     fi
8016 AC_SUBST(SYSTEM_LIBXSLT)
8017 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8018     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8020 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8022 AC_SUBST(LIBEXSLT_CFLAGS)
8023 AC_SUBST(LIBEXSLT_LIBS)
8024 AC_SUBST(LIBXSLT_CFLAGS)
8025 AC_SUBST(LIBXSLT_LIBS)
8026 AC_SUBST(XSLTPROC)
8028 # ===================================================================
8029 # Check for system libxml
8030 # ===================================================================
8031 AC_MSG_CHECKING([which libxml to use])
8032 if test "$with_system_libxml" = "yes"; then
8033     AC_MSG_RESULT([external])
8034     SYSTEM_LIBXML=TRUE
8035     if test "$_os" = "Darwin"; then
8036         dnl make sure to use SDK path
8037         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8038         dnl omit -L/usr/lib
8039         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8040     elif test $_os = iOS; then
8041         dnl make sure to use SDK path
8042         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8043         LIBXML_CFLAGS="-I$usr/include/libxml2"
8044         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8045     else
8046         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8047         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8048         FilterLibs "${LIBXML_LIBS}"
8049         LIBXML_LIBS="${filteredlibs}"
8050     fi
8052     dnl Check for xmllint
8053     AC_PATH_PROG(XMLLINT, xmllint, no)
8054     if test "$XMLLINT" = "no"; then
8055         AC_MSG_ERROR([xmllint is required])
8056     fi
8057 else
8058     AC_MSG_RESULT([internal])
8059     SYSTEM_LIBXML=
8060     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8061     if test "$COM" = "MSC"; then
8062         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8063     fi
8064     if test "$COM" = "MSC"; then
8065         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8066     else
8067         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8068     fi
8069     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8071 AC_SUBST(SYSTEM_LIBXML)
8072 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8073     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8075 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8076 AC_SUBST(LIBXML_CFLAGS)
8077 AC_SUBST(LIBXML_LIBS)
8078 AC_SUBST(XMLLINT)
8080 # =====================================================================
8081 # Checking for a Python interpreter with version >= 2.7.
8082 # Build and runtime requires Python 3 compatible version (>= 2.7).
8083 # Optionally user can pass an option to configure, i. e.
8084 # ./configure PYTHON=/usr/bin/python
8085 # =====================================================================
8086 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8087     # This allows a lack of system python with no error, we use internal one in that case.
8088     AM_PATH_PYTHON([2.7],, [:])
8089     # Clean PYTHON_VERSION checked below if cross-compiling
8090     PYTHON_VERSION=""
8091     if test "$PYTHON" != ":"; then
8092         PYTHON_FOR_BUILD=$PYTHON
8093     fi
8095 AC_SUBST(PYTHON_FOR_BUILD)
8097 # Checks for Python to use for Pyuno
8098 AC_MSG_CHECKING([which Python to use for Pyuno])
8099 case "$enable_python" in
8100 no|disable)
8101     if test -z $PYTHON_FOR_BUILD; then
8102         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8103         # requirement from the choice whether to include Python stuff in the installer, but why
8104         # bother?
8105         AC_MSG_ERROR([Python is required at build time.])
8106     fi
8107     enable_python=no
8108     AC_MSG_RESULT([none])
8109     ;;
8110 ""|yes|auto)
8111     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8112         AC_MSG_RESULT([no, overridden by --disable-scripting])
8113         enable_python=no
8114     elif test $build_os = cygwin; then
8115         dnl When building on Windows we don't attempt to use any installed
8116         dnl "system"  Python.
8117         AC_MSG_RESULT([fully internal])
8118         enable_python=internal
8119     elif test "$cross_compiling" = yes; then
8120         AC_MSG_RESULT([system])
8121         enable_python=system
8122     else
8123         if test -z "$PYTHON_FOR_BUILD"; then
8124             AC_MSG_RESULT([fully internal])
8125         else
8126             AC_MSG_RESULT([internal])
8127         fi
8128         enable_python=internal
8129     fi
8130     ;;
8131 internal)
8132     AC_MSG_RESULT([internal])
8133     ;;
8134 fully-internal)
8135     AC_MSG_RESULT([fully internal])
8136     enable_python=internal
8137     ;;
8138 system)
8139     AC_MSG_RESULT([system])
8140     ;;
8142     AC_MSG_ERROR([Incorrect --enable-python option])
8143     ;;
8144 esac
8146 if test $enable_python != no; then
8147     BUILD_TYPE="$BUILD_TYPE PYUNO"
8150 if test $enable_python = system; then
8151     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8152         python_version=2.7
8153         PYTHON=python$python_version
8154         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
8155             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
8156             PYTHON_LIBS="-framework Python"
8157         else
8158             PYTHON_CFLAGS="`$PYTHON-config --includes`"
8159             PYTHON_LIBS="`$PYTHON-config --libs`"
8160         fi
8161     fi
8162     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8163         # Fallback: Accept these in the environment, or as set above
8164         # for MacOSX.
8165         :
8166     elif test "$cross_compiling" != yes; then
8167         # Unset variables set by the above AM_PATH_PYTHON so that
8168         # we actually do check anew.
8169         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
8170         # This causes an error if no python command is found
8171         AM_PATH_PYTHON([3.3])
8172         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8173         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8174         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8175         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8176         if test -z "$PKG_CONFIG"; then
8177             PYTHON_CFLAGS="-I$python_include"
8178             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8179         elif $PKG_CONFIG --exists python-$python_version; then
8180             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8181             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8182         else
8183             PYTHON_CFLAGS="-I$python_include"
8184             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8185         fi
8186         FilterLibs "${PYTHON_LIBS}"
8187         PYTHON_LIBS="${filteredlibs}"
8188     else
8189         dnl How to find out the cross-compilation Python installation path?
8190         AC_MSG_CHECKING([for python version])
8191         AS_IF([test -n "$PYTHON_VERSION"],
8192               [AC_MSG_RESULT([$PYTHON_VERSION])],
8193               [AC_MSG_RESULT([not found])
8194                AC_MSG_ERROR([no usable python found])])
8195         test -n "$PYTHON_CFLAGS" && break
8196     fi
8198     dnl Check if the headers really work
8199     save_CPPFLAGS="$CPPFLAGS"
8200     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8201     AC_CHECK_HEADER(Python.h)
8202     CPPFLAGS="$save_CPPFLAGS"
8204     # let the PYTHON_FOR_BUILD match the same python installation that
8205     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8206     # better for PythonTests.
8207     PYTHON_FOR_BUILD=$PYTHON
8210 if test "$with_lxml" != no; then
8211     if test -z "$PYTHON_FOR_BUILD"; then
8212         case $build_os in
8213             cygwin)
8214                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8215                 ;;
8216             *)
8217                 if test "$cross_compiling" != yes ; then
8218                     BUILD_TYPE="$BUILD_TYPE LXML"
8219                 fi
8220                 ;;
8221         esac
8222     else
8223         AC_MSG_CHECKING([for python lxml])
8224         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8225             AC_MSG_RESULT([yes])
8226         else
8227             case $build_os in
8228                 cygwin)
8229                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8230                     ;;
8231                 *)
8232                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8233                         BUILD_TYPE="$BUILD_TYPE LXML"
8234                         AC_MSG_RESULT([no, using internal lxml])
8235                     else
8236                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8237                     fi
8238                     ;;
8239             esac
8240         fi
8241     fi
8244 dnl By now enable_python should be "system", "internal" or "no"
8245 case $enable_python in
8246 system)
8247     SYSTEM_PYTHON=TRUE
8249     if test "x$ac_cv_header_Python_h" != "xyes"; then
8250        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8251     fi
8253     AC_LANG_PUSH(C)
8254     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8255     AC_MSG_CHECKING([for correct python library version])
8256        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8257 #include <Python.h>
8259 int main(int argc, char **argv) {
8260    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8261        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8262    else return 1;
8264        ]])],[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])])
8265     CFLAGS=$save_CFLAGS
8266     AC_LANG_POP(C)
8268     dnl FIXME Check if the Python library can be linked with, too?
8269     ;;
8271 internal)
8272     SYSTEM_PYTHON=
8273     PYTHON_VERSION_MAJOR=3
8274     PYTHON_VERSION_MINOR=5
8275     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.9
8276     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8277         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8278     fi
8279     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8280     BUILD_TYPE="$BUILD_TYPE PYTHON"
8281     # Embedded Python dies without Home set
8282     if test "$HOME" = ""; then
8283         export HOME=""
8284     fi
8285     ;;
8287     DISABLE_PYTHON=TRUE
8288     SYSTEM_PYTHON=
8289     ;;
8291     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8292     ;;
8293 esac
8295 AC_SUBST(DISABLE_PYTHON)
8296 AC_SUBST(SYSTEM_PYTHON)
8297 AC_SUBST(PYTHON_CFLAGS)
8298 AC_SUBST(PYTHON_LIBS)
8299 AC_SUBST(PYTHON_VERSION)
8300 AC_SUBST(PYTHON_VERSION_MAJOR)
8301 AC_SUBST(PYTHON_VERSION_MINOR)
8303 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8304 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8305     AC_MSG_RESULT([yes])
8306     ENABLE_MARIADBC=TRUE
8307     MARIADBC_MAJOR=1
8308     MARIADBC_MINOR=0
8309     MARIADBC_MICRO=2
8310     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8311 else
8312     AC_MSG_RESULT([no])
8313     ENABLE_MARIADBC=
8315 AC_SUBST(ENABLE_MARIADBC)
8316 AC_SUBST(MARIADBC_MAJOR)
8317 AC_SUBST(MARIADBC_MINOR)
8318 AC_SUBST(MARIADBC_MICRO)
8320 if test "$ENABLE_MARIADBC" = "TRUE"; then
8322     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8324     dnl ===================================================================
8325     dnl Check for system MariaDB
8326     dnl ===================================================================
8327     AC_MSG_CHECKING([which MariaDB to use])
8328     if test "$with_system_mariadb" = "yes"; then
8329         AC_MSG_RESULT([external])
8330         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8331         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8332         if test -z "$MARIADBCONFIG"; then
8333             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8334             if test -z "$MARIADBCONFIG"; then
8335                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8336                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8337             fi
8338         fi
8339         AC_MSG_CHECKING([MariaDB version])
8340         MARIADB_VERSION=`$MARIADBCONFIG --version`
8341         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8342         if test "$MARIADB_MAJOR" -ge "5"; then
8343             AC_MSG_RESULT([OK])
8344         else
8345             AC_MSG_ERROR([too old, use 5.0.x or later])
8346         fi
8347         AC_MSG_CHECKING([for MariaDB Client library])
8348         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8349         if test "$COM_IS_CLANG" = TRUE; then
8350             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8351         fi
8352         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8353         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8354         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8355         dnl linux32:
8356         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8357             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8358             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8359                 | sed -e 's|/lib64/|/lib/|')
8360         fi
8361         FilterLibs "${MARIADB_LIBS}"
8362         MARIADB_LIBS="${filteredlibs}"
8363         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8364         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8365         if test "$enable_bundle_mariadb" = "yes"; then
8366             AC_MSG_RESULT([yes])
8367             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8368             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8370 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8372 /g' | grep -E '(mysqlclient|mariadb)')
8373             if test "$_os" = "Darwin"; then
8374                 LIBMARIADB=${LIBMARIADB}.dylib
8375             elif test "$_os" = "WINNT"; then
8376                 LIBMARIADB=${LIBMARIADB}.dll
8377             else
8378                 LIBMARIADB=${LIBMARIADB}.so
8379             fi
8380             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8381             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8382             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8383                 AC_MSG_RESULT([found.])
8384                 PathFormat "$LIBMARIADB_PATH"
8385                 LIBMARIADB_PATH="$formatted_path"
8386             else
8387                 AC_MSG_ERROR([not found.])
8388             fi
8389         else
8390             AC_MSG_RESULT([no])
8391             BUNDLE_MARIADB_CONNECTOR_C=
8392         fi
8393     else
8394         AC_MSG_RESULT([internal])
8395         SYSTEM_MARIADB_CONNECTOR_C=
8396         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8397         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8398         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8399     fi
8401     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8402     AC_SUBST(MARIADB_CFLAGS)
8403     AC_SUBST(MARIADB_LIBS)
8404     AC_SUBST(LIBMARIADB)
8405     AC_SUBST(LIBMARIADB_PATH)
8406     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8408     AC_LANG_PUSH([C++])
8409     dnl ===================================================================
8410     dnl Check for system MySQL C++ Connector
8411     dnl ===================================================================
8412     # FIXME!
8413     # who thought this too-generic cppconn dir was a good idea?
8414     AC_MSG_CHECKING([MySQL Connector/C++])
8415     if test "$with_system_mysql_cppconn" = "yes"; then
8416         AC_MSG_RESULT([external])
8417         SYSTEM_MYSQL_CONNECTOR_CPP=TRUE
8418         AC_LANG_PUSH([C++])
8419         AC_CHECK_HEADER(mysql_driver.h, [],
8420                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8421         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8422                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8423         save_LIBS=$LIBS
8424         LIBS="$LIBS -lmysqlcppconn"
8425         AC_MSG_CHECKING([version])
8426         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8427 #include <mysql_driver.h>
8429 int main(int argc, char **argv) {
8430     sql::Driver *driver;
8431     driver = get_driver_instance();
8432     if (driver->getMajorVersion() > 1 || \
8433        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8434        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8435         return 0;
8436       else
8437         return 1;
8439       ]])],[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])])
8441         AC_LANG_POP([C++])
8442         LIBS=$save_LIBS
8443     else
8444         AC_MSG_RESULT([internal])
8445         BUILD_TYPE="$BUILD_TYPE MYSQL_CONNECTOR_CPP"
8446         SYSTEM_MYSQL_CONNECTOR_CPP=
8447     fi
8448     AC_LANG_POP([C++])
8450 AC_SUBST(SYSTEM_MYSQL_CONNECTOR_CPP)
8452 dnl ===================================================================
8453 dnl Check for system hsqldb
8454 dnl ===================================================================
8455 if test "$with_java" != "no"; then
8456     HSQLDB_USE_JDBC_4_1=
8457     AC_MSG_CHECKING([which hsqldb to use])
8458     if test "$with_system_hsqldb" = "yes"; then
8459         AC_MSG_RESULT([external])
8460         SYSTEM_HSQLDB=TRUE
8461         if test -z $HSQLDB_JAR; then
8462             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8463         fi
8464         if ! test -f $HSQLDB_JAR; then
8465                AC_MSG_ERROR(hsqldb.jar not found.)
8466         fi
8467         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8468         export HSQLDB_JAR
8469         if $PERL -e \
8470            'use Archive::Zip;
8471             my $file = "$ENV{'HSQLDB_JAR'}";
8472             my $zip = Archive::Zip->new( $file );
8473             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8474             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8475             {
8476                 push @l, split(/\n/, $mf);
8477                 foreach my $line (@l)
8478                 {
8479                     if ($line =~ m/Specification-Version:/)
8480                     {
8481                         ($t, $version) = split (/:/,$line);
8482                         $version =~ s/^\s//;
8483                         ($a, $b, $c, $d) = split (/\./,$version);
8484                         if ($c == "0" && $d > "8")
8485                         {
8486                             exit 0;
8487                         }
8488                         else
8489                         {
8490                             exit 1;
8491                         }
8492                     }
8493                 }
8494             }
8495             else
8496             {
8497                 exit 1;
8498             }'; then
8499             AC_MSG_RESULT([yes])
8500         else
8501             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8502         fi
8503     else
8504         AC_MSG_RESULT([internal])
8505         SYSTEM_HSQLDB=
8506         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8507         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8508         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8509         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8510             AC_MSG_RESULT([yes])
8511             HSQLDB_USE_JDBC_4_1=TRUE
8512         else
8513             AC_MSG_RESULT([no])
8514         fi
8515     fi
8516     AC_SUBST(SYSTEM_HSQLDB)
8517     AC_SUBST(HSQLDB_JAR)
8518     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8521 dnl ===================================================================
8522 dnl Check for PostgreSQL stuff
8523 dnl ===================================================================
8524 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
8525 if test "x$enable_postgresql_sdbc" != "xno"; then
8526     AC_MSG_RESULT([yes])
8527     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8529     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8530         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8531     fi
8532     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8533         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8534     fi
8536     postgres_interface=""
8537     if test "$with_system_postgresql" = "yes"; then
8538         postgres_interface="external PostgreSQL"
8539         SYSTEM_POSTGRESQL=TRUE
8540         if test "$_os" = Darwin; then
8541             supp_path=''
8542             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8543                 pg_supp_path="$P_SEP$d$pg_supp_path"
8544             done
8545         fi
8546         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8547         if test -z "$PGCONFIG"; then
8548             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8549         fi
8550         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8551         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8552         FilterLibs "${POSTGRESQL_LIB}"
8553         POSTGRESQL_LIB="${filteredlibs}"
8554     else
8555         # if/when anything else than PostgreSQL uses Kerberos,
8556         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8557         WITH_KRB5=
8558         WITH_GSSAPI=
8559         case "$_os" in
8560         Darwin)
8561             # MacOS X has system MIT Kerberos 5 since 10.4
8562             if test "$with_krb5" != "no"; then
8563                 WITH_KRB5=TRUE
8564                 save_LIBS=$LIBS
8565                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8566                 # that the libraries where these functions are located on macOS will change, is it?
8567                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8568                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8569                 KRB5_LIBS=$LIBS
8570                 LIBS=$save_LIBS
8571                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8572                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8573                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8574                 LIBS=$save_LIBS
8575             fi
8576             if test "$with_gssapi" != "no"; then
8577                 WITH_GSSAPI=TRUE
8578                 save_LIBS=$LIBS
8579                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8580                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8581                 GSSAPI_LIBS=$LIBS
8582                 LIBS=$save_LIBS
8583             fi
8584             ;;
8585         WINNT)
8586             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8587                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8588             fi
8589             ;;
8590         Linux|GNU|*BSD|DragonFly)
8591             if test "$with_krb5" != "no"; then
8592                 WITH_KRB5=TRUE
8593                 save_LIBS=$LIBS
8594                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8595                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8596                 KRB5_LIBS=$LIBS
8597                 LIBS=$save_LIBS
8598                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8599                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8600                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8601                 LIBS=$save_LIBS
8602             fi
8603             if test "$with_gssapi" != "no"; then
8604                 WITH_GSSAPI=TRUE
8605                 save_LIBS=$LIBS
8606                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8607                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8608                 GSSAPI_LIBS=$LIBS
8609                 LIBS=$save_LIBS
8610             fi
8611             ;;
8612         *)
8613             if test "$with_krb5" = "yes"; then
8614                 WITH_KRB5=TRUE
8615                 save_LIBS=$LIBS
8616                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8617                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8618                 KRB5_LIBS=$LIBS
8619                 LIBS=$save_LIBS
8620                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8621                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8622                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8623                 LIBS=$save_LIBS
8624             fi
8625             if test "$with_gssapi" = "yes"; then
8626                 WITH_GSSAPI=TRUE
8627                 save_LIBS=$LIBS
8628                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8629                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8630                 LIBS=$save_LIBS
8631                 GSSAPI_LIBS=$LIBS
8632             fi
8633         esac
8635         if test -n "$with_libpq_path"; then
8636             SYSTEM_POSTGRESQL=TRUE
8637             postgres_interface="external libpq"
8638             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8639             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8640         else
8641             SYSTEM_POSTGRESQL=
8642             postgres_interface="internal"
8643             POSTGRESQL_LIB=""
8644             POSTGRESQL_INC="%OVERRIDE_ME%"
8645             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8646         fi
8647     fi
8649     AC_MSG_CHECKING([PostgreSQL C interface])
8650     AC_MSG_RESULT([$postgres_interface])
8652     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8653         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8654         save_CFLAGS=$CFLAGS
8655         save_CPPFLAGS=$CPPFLAGS
8656         save_LIBS=$LIBS
8657         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8658         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8659         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8660         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8661             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8662         CFLAGS=$save_CFLAGS
8663         CPPFLAGS=$save_CPPFLAGS
8664         LIBS=$save_LIBS
8665     fi
8666     BUILD_POSTGRESQL_SDBC=TRUE
8667 else
8668     AC_MSG_RESULT([no])
8670 AC_SUBST(WITH_KRB5)
8671 AC_SUBST(WITH_GSSAPI)
8672 AC_SUBST(GSSAPI_LIBS)
8673 AC_SUBST(KRB5_LIBS)
8674 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8675 AC_SUBST(SYSTEM_POSTGRESQL)
8676 AC_SUBST(POSTGRESQL_INC)
8677 AC_SUBST(POSTGRESQL_LIB)
8679 dnl ===================================================================
8680 dnl Check for Firebird stuff
8681 dnl ===================================================================
8682 ENABLE_FIREBIRD_SDBC=
8683 if test "$enable_firebird_sdbc" = "yes" ; then
8684     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8686     dnl ===================================================================
8687     dnl Check for system Firebird
8688     dnl ===================================================================
8689     AC_MSG_CHECKING([which Firebird to use])
8690     if test "$with_system_firebird" = "yes"; then
8691         AC_MSG_RESULT([external])
8692         SYSTEM_FIREBIRD=TRUE
8693         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8694         if test -z "$FIREBIRDCONFIG"; then
8695             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8696             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8697                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8698             ])
8699             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8700         else
8701             AC_MSG_NOTICE([fb_config found])
8702             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8703             AC_MSG_CHECKING([for Firebird Client library])
8704             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8705             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8706             FilterLibs "${FIREBIRD_LIBS}"
8707             FIREBIRD_LIBS="${filteredlibs}"
8708         fi
8709         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8710         AC_MSG_CHECKING([Firebird version])
8711         if test -n "${FIREBIRD_VERSION}"; then
8712             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8713             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8714             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8715                 AC_MSG_RESULT([OK])
8716             else
8717                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
8718             fi
8719         else
8720             __save_CFLAGS="${CFLAGS}"
8721             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8722             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8723 #if defined(FB_API_VER) && FB_API_VER == 30
8724 int fb_api_is_30(void) { return 0; }
8725 #else
8726 #error "Wrong Firebird API version"
8727 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
8728             CFLAGS="${__save_CFLAGS}"
8729         fi
8730         ENABLE_FIREBIRD_SDBC=TRUE
8731         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
8732     elif test "$enable_database_connectivity" != yes; then
8733         AC_MSG_RESULT([none])
8734     elif test "$cross_compiling" = "yes"; then
8735         AC_MSG_RESULT([none])
8736     else
8737         dnl Embedded Firebird has version 3.0
8738         AC_DEFINE(HAVE_FIREBIRD_30, 1)
8739         dnl We need libatomic-ops for any non X86/X64 system
8740         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8741             dnl ===================================================================
8742             dnl Check for system libatomic-ops
8743             dnl ===================================================================
8744             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8745             if test "$with_system_libatomic_ops" = "yes"; then
8746                 SYSTEM_LIBATOMIC_OPS=TRUE
8747                 AC_CHECK_HEADERS(atomic_ops.h, [],
8748                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8749             else
8750                 SYSTEM_LIBATOMIC_OPS=
8751                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8752                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8753                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8754             fi
8755         fi
8757         AC_MSG_RESULT([internal])
8758         SYSTEM_FIREBIRD=
8759         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
8760         FIREBIRD_LIBS="-lfbclient"
8762         if test "$with_system_libtommath" = "yes"; then
8763             SYSTEM_LIBTOMMATH=TRUE
8764             dnl check for tommath presence
8765             save_LIBS=$LIBS
8766             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
8767             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
8768             LIBS=$save_LIBS
8769         else
8770             SYSTEM_LIBTOMMATH=
8771             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
8772             LIBTOMMATH_LIBS="-ltommath"
8773             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
8774         fi
8776         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8777         ENABLE_FIREBIRD_SDBC=TRUE
8778         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
8779     fi
8781 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8782 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8783 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8784 AC_SUBST(LIBATOMIC_OPS_LIBS)
8785 AC_SUBST(SYSTEM_FIREBIRD)
8786 AC_SUBST(FIREBIRD_CFLAGS)
8787 AC_SUBST(FIREBIRD_LIBS)
8788 AC_SUBST([TOMMATH_CFLAGS])
8789 AC_SUBST([TOMMATH_LIBS])
8791 dnl ===================================================================
8792 dnl Check for system curl
8793 dnl ===================================================================
8794 AC_MSG_CHECKING([which libcurl to use])
8795 if test "$with_system_curl" = "auto"; then
8796     with_system_curl="$with_system_libs"
8799 if test "$with_system_curl" = "yes"; then
8800     AC_MSG_RESULT([external])
8801     SYSTEM_CURL=TRUE
8803     # First try PKGCONFIG and then fall back
8804     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8806     if test -n "$CURL_PKG_ERRORS"; then
8807         AC_PATH_PROG(CURLCONFIG, curl-config)
8808         if test -z "$CURLCONFIG"; then
8809             AC_MSG_ERROR([curl development files not found])
8810         fi
8811         CURL_LIBS=`$CURLCONFIG --libs`
8812         FilterLibs "${CURL_LIBS}"
8813         CURL_LIBS="${filteredlibs}"
8814         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8815         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8817         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8818         case $curl_version in
8819         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8820         dnl so they need to be doubled to end up in the configure script
8821         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8822             AC_MSG_RESULT([yes])
8823             ;;
8824         *)
8825             AC_MSG_ERROR([no, you have $curl_version])
8826             ;;
8827         esac
8828     fi
8830     ENABLE_CURL=TRUE
8831 elif test $_os = iOS; then
8832     # Let's see if we need curl, I think not?
8833     AC_MSG_RESULT([none])
8834     ENABLE_CURL=
8835 else
8836     AC_MSG_RESULT([internal])
8837     SYSTEM_CURL=
8838     BUILD_TYPE="$BUILD_TYPE CURL"
8839     ENABLE_CURL=TRUE
8841 AC_SUBST(SYSTEM_CURL)
8842 AC_SUBST(CURL_CFLAGS)
8843 AC_SUBST(CURL_LIBS)
8844 AC_SUBST(ENABLE_CURL)
8846 dnl ===================================================================
8847 dnl Check for system boost
8848 dnl ===================================================================
8849 AC_MSG_CHECKING([which boost to use])
8850 if test "$with_system_boost" = "yes"; then
8851     AC_MSG_RESULT([external])
8852     SYSTEM_BOOST=TRUE
8853     AX_BOOST_BASE(1.47)
8854     AX_BOOST_DATE_TIME
8855     AX_BOOST_FILESYSTEM
8856     AX_BOOST_IOSTREAMS
8857     AX_BOOST_LOCALE
8858     AC_LANG_PUSH([C++])
8859     save_CXXFLAGS=$CXXFLAGS
8860     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8861     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8862        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8863     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8864        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8865     CXXFLAGS=$save_CXXFLAGS
8866     AC_LANG_POP([C++])
8867     # this is in m4/ax_boost_base.m4
8868     FilterLibs "${BOOST_LDFLAGS}"
8869     BOOST_LDFLAGS="${filteredlibs}"
8870 else
8871     AC_MSG_RESULT([internal])
8872     BUILD_TYPE="$BUILD_TYPE BOOST"
8873     SYSTEM_BOOST=
8874     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
8875         # use warning-suppressing wrapper headers
8876         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
8877     else
8878         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
8879     fi
8881 AC_SUBST(SYSTEM_BOOST)
8883 dnl ===================================================================
8884 dnl Check for system mdds
8885 dnl ===================================================================
8886 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.2 >= 1.2.3], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8888 dnl ===================================================================
8889 dnl Check for system glm
8890 dnl ===================================================================
8891 AC_MSG_CHECKING([which glm to use])
8892 if test "$with_system_glm" = "yes"; then
8893     AC_MSG_RESULT([external])
8894     SYSTEM_GLM=TRUE
8895     AC_LANG_PUSH([C++])
8896     AC_CHECK_HEADER([glm/glm.hpp], [],
8897        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8898     AC_LANG_POP([C++])
8899 else
8900     AC_MSG_RESULT([internal])
8901     BUILD_TYPE="$BUILD_TYPE GLM"
8902     SYSTEM_GLM=
8903     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8905 AC_SUBST([GLM_CFLAGS])
8906 AC_SUBST([SYSTEM_GLM])
8908 dnl ===================================================================
8909 dnl Check for system odbc
8910 dnl ===================================================================
8911 AC_MSG_CHECKING([which odbc headers to use])
8912 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
8913     AC_MSG_RESULT([external])
8914     SYSTEM_ODBC_HEADERS=TRUE
8916     if test "$build_os" = "cygwin"; then
8917         save_CPPFLAGS=$CPPFLAGS
8918         find_winsdk
8919         PathFormat "$winsdktest"
8920         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"
8921         AC_CHECK_HEADER(sqlext.h, [],
8922             [AC_MSG_ERROR(odbc not found. install odbc)],
8923             [#include <windows.h>])
8924         CPPFLAGS=$save_CPPFLAGS
8925     else
8926         AC_CHECK_HEADER(sqlext.h, [],
8927             [AC_MSG_ERROR(odbc not found. install odbc)],[])
8928     fi
8929 elif test "$enable_database_connectivity" != yes; then
8930     AC_MSG_RESULT([none])
8931 else
8932     AC_MSG_RESULT([internal])
8933     SYSTEM_ODBC_HEADERS=
8935 AC_SUBST(SYSTEM_ODBC_HEADERS)
8938 dnl ===================================================================
8939 dnl Check for system openldap
8940 dnl ===================================================================
8942 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8943 AC_MSG_CHECKING([which openldap library to use])
8944 if test "$with_system_openldap" = "yes"; then
8945     AC_MSG_RESULT([external])
8946     SYSTEM_OPENLDAP=TRUE
8947     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8948     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8949     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8950 else
8951     AC_MSG_RESULT([internal])
8952     SYSTEM_OPENLDAP=
8953     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8956 AC_SUBST(SYSTEM_OPENLDAP)
8958 dnl ===================================================================
8959 dnl Check for system NSS
8960 dnl ===================================================================
8961 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
8962     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8963     AC_DEFINE(HAVE_FEATURE_NSS)
8964     ENABLE_NSS="TRUE"
8965     AC_DEFINE(ENABLE_NSS)
8966 elif test $_os != iOS ; then
8967     with_tls=openssl
8969 AC_SUBST(ENABLE_NSS)
8971 dnl ===================================================================
8972 dnl Check for TLS/SSL and cryptographic implementation to use
8973 dnl ===================================================================
8974 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8975 if test -n "$with_tls"; then
8976     case $with_tls in
8977     openssl)
8978         AC_DEFINE(USE_TLS_OPENSSL)
8979         TLS=OPENSSL
8981         if test "$enable_openssl" != "yes"; then
8982             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8983         fi
8985         # warn that OpenSSL has been selected but not all TLS code has this option
8986         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
8987         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
8988         ;;
8989     nss)
8990         AC_DEFINE(USE_TLS_NSS)
8991         TLS=NSS
8992         ;;
8993     no)
8994         AC_MSG_WARN([Skipping TLS/SSL])
8995         ;;
8996     *)
8997         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8998 openssl - OpenSSL
8999 nss - Mozilla's Network Security Services (NSS)
9000     ])
9001         ;;
9002     esac
9003 else
9004     # default to using NSS, it results in smaller oox lib
9005     AC_DEFINE(USE_TLS_NSS)
9006     TLS=NSS
9008 AC_MSG_RESULT([$TLS])
9009 AC_SUBST(TLS)
9011 dnl ===================================================================
9012 dnl Check for system sane
9013 dnl ===================================================================
9014 AC_MSG_CHECKING([which sane header to use])
9015 if test "$with_system_sane" = "yes"; then
9016     AC_MSG_RESULT([external])
9017     AC_CHECK_HEADER(sane/sane.h, [],
9018       [AC_MSG_ERROR(sane not found. install sane)], [])
9019 else
9020     AC_MSG_RESULT([internal])
9021     BUILD_TYPE="$BUILD_TYPE SANE"
9024 dnl ===================================================================
9025 dnl Check for system icu
9026 dnl ===================================================================
9027 SYSTEM_GENBRK=
9028 SYSTEM_GENCCODE=
9029 SYSTEM_GENCMN=
9031 ICU_MAJOR=61
9032 ICU_MINOR=1
9033 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9034 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9035 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9036 AC_MSG_CHECKING([which icu to use])
9037 if test "$with_system_icu" = "yes"; then
9038     AC_MSG_RESULT([external])
9039     SYSTEM_ICU=TRUE
9040     AC_LANG_PUSH([C++])
9041     AC_MSG_CHECKING([for unicode/rbbi.h])
9042     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9043     AC_LANG_POP([C++])
9045     if test "$cross_compiling" != "yes"; then
9046         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9047         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9048         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9049         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9050     fi
9052     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9053         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9054         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9055         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9056         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9057         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9058             AC_MSG_RESULT([yes])
9059         else
9060             AC_MSG_RESULT([no])
9061             if test "$with_system_icu_for_build" != "force"; then
9062                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9063 You can use --with-system-icu-for-build=force to use it anyway.])
9064             fi
9065         fi
9066     fi
9068     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9069         # using the system icu tools can lead to version confusion, use the
9070         # ones from the build environment when cross-compiling
9071         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9072         if test -z "$SYSTEM_GENBRK"; then
9073             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9074         fi
9075         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9076         if test -z "$SYSTEM_GENCCODE"; then
9077             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9078         fi
9079         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9080         if test -z "$SYSTEM_GENCMN"; then
9081             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9082         fi
9083         if test "$ICU_MAJOR" -ge "49"; then
9084             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9085             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9086             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9087         else
9088             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9089             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9090             ICU_RECLASSIFIED_HEBREW_LETTER=
9091         fi
9092     fi
9094     if test "$cross_compiling" = "yes"; then
9095         if test "$ICU_MAJOR" -ge "50"; then
9096             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9097             ICU_MINOR=""
9098         fi
9099     fi
9100 else
9101     AC_MSG_RESULT([internal])
9102     SYSTEM_ICU=
9103     BUILD_TYPE="$BUILD_TYPE ICU"
9104     # surprisingly set these only for "internal" (to be used by various other
9105     # external libs): the system icu-config is quite unhelpful and spits out
9106     # dozens of weird flags and also default path -I/usr/include
9107     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9108     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9110 if test "$ICU_MAJOR" -ge "59"; then
9111     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9112     # with -std=c++11 but not all external libraries can be built with that,
9113     # for those use a bit-compatible typedef uint16_t UChar; see
9114     # icu/source/common/unicode/umachine.h
9115     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9116 else
9117     ICU_UCHAR_TYPE=""
9119 AC_SUBST(SYSTEM_ICU)
9120 AC_SUBST(SYSTEM_GENBRK)
9121 AC_SUBST(SYSTEM_GENCCODE)
9122 AC_SUBST(SYSTEM_GENCMN)
9123 AC_SUBST(ICU_MAJOR)
9124 AC_SUBST(ICU_MINOR)
9125 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9126 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9127 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9128 AC_SUBST(ICU_CFLAGS)
9129 AC_SUBST(ICU_LIBS)
9130 AC_SUBST(ICU_UCHAR_TYPE)
9132 dnl ==================================================================
9133 dnl Breakpad
9134 dnl ==================================================================
9135 DEFAULT_CRASHDUMP_VALUE="true"
9136 AC_MSG_CHECKING([whether to enable breakpad])
9137 if test "$enable_breakpad" != yes; then
9138     AC_MSG_RESULT([no])
9139 else
9140     AC_MSG_RESULT([yes])
9141     ENABLE_BREAKPAD="TRUE"
9142     AC_DEFINE(ENABLE_BREAKPAD)
9143     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9144     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9146     AC_MSG_CHECKING([for disable crash dump])
9147     if test "$enable_crashdump" = no; then
9148         DEFAULT_CRASHDUMP_VALUE="false"
9149         AC_MSG_RESULT([yes])
9150     else
9151        AC_MSG_RESULT([no])
9152     fi
9154     AC_MSG_CHECKING([for crashreport config])
9155     if test "$with_symbol_config" = "no"; then
9156         BREAKPAD_SYMBOL_CONFIG="invalid"
9157         AC_MSG_RESULT([no])
9158     else
9159         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9160         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9161         AC_MSG_RESULT([yes])
9162     fi
9163     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9165 AC_SUBST(ENABLE_BREAKPAD)
9166 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
9168 dnl ==================================================================
9169 dnl libfuzzer
9170 dnl ==================================================================
9171 AC_MSG_CHECKING([whether to enable fuzzers])
9172 if test "$enable_fuzzers" != yes; then
9173     AC_MSG_RESULT([no])
9174 else
9175     AC_MSG_RESULT([yes])
9176     ENABLE_FUZZERS="TRUE"
9177     AC_DEFINE(ENABLE_FUZZERS)
9178     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9180 AC_SUBST(ENABLE_FUZZERS)
9182 dnl ===================================================================
9183 dnl Orcus
9184 dnl ===================================================================
9185 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.13 >= 0.13.3])
9186 if test "$with_system_orcus" != "yes"; then
9187     if test "$SYSTEM_BOOST" = "TRUE"; then
9188         # ===========================================================
9189         # Determine if we are going to need to link with Boost.System
9190         # ===========================================================
9191         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9192         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9193         dnl in documentation has no effect.
9194         AC_MSG_CHECKING([if we need to link with Boost.System])
9195         AC_LANG_PUSH([C++])
9196         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9197                 @%:@include <boost/version.hpp>
9198             ]],[[
9199                 #if BOOST_VERSION >= 105000
9200                 #   error yes, we need to link with Boost.System
9201                 #endif
9202             ]])],[
9203                 AC_MSG_RESULT([no])
9204             ],[
9205                 AC_MSG_RESULT([yes])
9206                 AX_BOOST_SYSTEM
9207         ])
9208         AC_LANG_POP([C++])
9209     fi
9211 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9212 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9213 AC_SUBST([BOOST_SYSTEM_LIB])
9214 AC_SUBST(SYSTEM_LIBORCUS)
9216 dnl ===================================================================
9217 dnl HarfBuzz
9218 dnl ===================================================================
9219 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9220                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9221                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9223 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9224                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9225                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9227 if test "$COM" = "MSC"; then # override the above
9228     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9229     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9232 if test "$with_system_harfbuzz" = "yes"; then
9233     if test "$with_system_graphite" = "no"; then
9234         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9235     fi
9236     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9237     _save_libs="$LIBS"
9238     _save_cflags="$CFLAGS"
9239     LIBS="$LIBS $HARFBUZZ_LIBS"
9240     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9241     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9242     LIBS="$_save_libs"
9243     CFLAGS="$_save_cflags"
9244 else
9245     if test "$with_system_graphite" = "yes"; then
9246         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9247     fi
9250 AC_MSG_CHECKING([whether to use X11])
9251 dnl ***************************************
9252 dnl testing for X libraries and includes...
9253 dnl ***************************************
9254 if test "$USING_X11" = TRUE; then
9255     AC_DEFINE(HAVE_FEATURE_X11)
9257 AC_MSG_RESULT([$USING_X11])
9259 if test "$USING_X11" = TRUE; then
9260     AC_PATH_X
9261     AC_PATH_XTRA
9262     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9264     if test -z "$x_includes"; then
9265         x_includes="default_x_includes"
9266     fi
9267     if test -z "$x_libraries"; then
9268         x_libraries="default_x_libraries"
9269     fi
9270     CFLAGS="$CFLAGS $X_CFLAGS"
9271     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9272     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9273 else
9274     x_includes="no_x_includes"
9275     x_libraries="no_x_libraries"
9278 if test "$USING_X11" = TRUE; then
9279     dnl ===================================================================
9280     dnl Check for extension headers
9281     dnl ===================================================================
9282     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9283      [#include <X11/extensions/shape.h>])
9285     # vcl needs ICE and SM
9286     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9287     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9288         [AC_MSG_ERROR(ICE library not found)])
9289     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9290     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9291         [AC_MSG_ERROR(SM library not found)])
9294 dnl ===================================================================
9295 dnl Check for system Xrender
9296 dnl ===================================================================
9297 AC_MSG_CHECKING([whether to use Xrender])
9298 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9299     AC_MSG_RESULT([yes])
9300     PKG_CHECK_MODULES(XRENDER, xrender)
9301     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9302     FilterLibs "${XRENDER_LIBS}"
9303     XRENDER_LIBS="${filteredlibs}"
9304     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9305       [AC_MSG_ERROR(libXrender not found or functional)], [])
9306     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9307       [AC_MSG_ERROR(Xrender not found. install X)], [])
9308 else
9309     AC_MSG_RESULT([no])
9311 AC_SUBST(XRENDER_CFLAGS)
9312 AC_SUBST(XRENDER_LIBS)
9314 dnl ===================================================================
9315 dnl Check for XRandr
9316 dnl ===================================================================
9317 AC_MSG_CHECKING([whether to enable RandR support])
9318 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9319     AC_MSG_RESULT([yes])
9320     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9321     if test "$ENABLE_RANDR" != "TRUE"; then
9322         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9323                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9324         XRANDR_CFLAGS=" "
9325         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9326           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9327         XRANDR_LIBS="-lXrandr "
9328         ENABLE_RANDR="TRUE"
9329     fi
9330     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9331     FilterLibs "${XRANDR_LIBS}"
9332     XRANDR_LIBS="${filteredlibs}"
9333 else
9334     ENABLE_RANDR=""
9335     AC_MSG_RESULT([no])
9337 AC_SUBST(XRANDR_CFLAGS)
9338 AC_SUBST(XRANDR_LIBS)
9339 AC_SUBST(ENABLE_RANDR)
9341 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9342     WITH_WEBDAV="serf"
9344 if test $_os = iOS -o $_os = Android; then
9345     WITH_WEBDAV="no"
9347 AC_MSG_CHECKING([for webdav library])
9348 case "$WITH_WEBDAV" in
9349 serf)
9350     AC_MSG_RESULT([serf])
9351     # Check for system apr-util
9352     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9353                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9354                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9355     if test "$COM" = "MSC"; then
9356         APR_LIB_DIR="LibR"
9357         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9358         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9359     fi
9361     # Check for system serf
9362     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9363                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9364     if test "$COM" = "MSC"; then
9365         SERF_LIB_DIR="Release"
9366         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9367         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9368     fi
9369     ;;
9370 neon)
9371     AC_MSG_RESULT([neon])
9372     # Check for system neon
9373     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9374     if test "$with_system_neon" = "yes"; then
9375         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9376     else
9377         NEON_VERSION=0295
9378     fi
9379     AC_SUBST(NEON_VERSION)
9380     ;;
9382     AC_MSG_RESULT([none, disabled])
9383     WITH_WEBDAV=""
9384     ;;
9385 esac
9386 AC_SUBST(WITH_WEBDAV)
9388 dnl ===================================================================
9389 dnl Check for disabling cve_tests
9390 dnl ===================================================================
9391 AC_MSG_CHECKING([whether to execute CVE tests])
9392 # If not explicitly enabled or disabled, default
9393 if test -z "$enable_cve_tests"; then
9394     case "$OS" in
9395     WNT)
9396         # Default cves off for windows with its wild and wonderful
9397         # varienty of AV software kicking in and panicking
9398         enable_cve_tests=no
9399         ;;
9400     *)
9401         # otherwise yes
9402         enable_cve_tests=yes
9403         ;;
9404     esac
9406 if test "$enable_cve_tests" = "no"; then
9407     AC_MSG_RESULT([no])
9408     DISABLE_CVE_TESTS=TRUE
9409     AC_SUBST(DISABLE_CVE_TESTS)
9410 else
9411     AC_MSG_RESULT([yes])
9414 dnl ===================================================================
9415 dnl Check for enabling chart XShape tests
9416 dnl ===================================================================
9417 AC_MSG_CHECKING([whether to execute chart XShape tests])
9418 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9419     AC_MSG_RESULT([yes])
9420     ENABLE_CHART_TESTS=TRUE
9421     AC_SUBST(ENABLE_CHART_TESTS)
9422 else
9423     AC_MSG_RESULT([no])
9426 dnl ===================================================================
9427 dnl Check for system openssl
9428 dnl ===================================================================
9429 DISABLE_OPENSSL=
9430 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9431 if test "$enable_openssl" = "yes"; then
9432     AC_MSG_RESULT([no])
9433     if test "$_os" = Darwin ; then
9434         # OpenSSL is deprecated when building for 10.7 or later.
9435         #
9436         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9437         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9439         with_system_openssl=no
9440         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9441     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9442             && test "$with_system_openssl" != "no"; then
9443         with_system_openssl=yes
9444         SYSTEM_OPENSSL=TRUE
9445         OPENSSL_CFLAGS=
9446         OPENSSL_LIBS="-lssl -lcrypto"
9447     else
9448         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9449     fi
9450     if test "$with_system_openssl" = "yes"; then
9451         AC_MSG_CHECKING([whether openssl supports SHA512])
9452         AC_LANG_PUSH([C])
9453         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9454             SHA512_CTX context;
9455 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9456         AC_LANG_POP(C)
9457     fi
9458 else
9459     AC_MSG_RESULT([yes])
9460     DISABLE_OPENSSL=TRUE
9462     # warn that although OpenSSL is disabled, system libraries may depend on it
9463     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9464     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9467 AC_SUBST([DISABLE_OPENSSL])
9469 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
9470     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
9471         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
9472         enable_cipher_openssl_backend=no
9473     else
9474         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
9475     fi
9477 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
9478 ENABLE_CIPHER_OPENSSL_BACKEND=
9479 if test "$enable_cipher_openssl_backend" = yes; then
9480     AC_MSG_RESULT([yes])
9481     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
9482 else
9483     AC_MSG_RESULT([no])
9485 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
9487 dnl ===================================================================
9488 dnl Check for building gnutls
9489 dnl ===================================================================
9490 AC_MSG_CHECKING([whether to use gnutls])
9491 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9492     AC_MSG_RESULT([yes])
9493     AM_PATH_LIBGCRYPT()
9494     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9495         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9496                       available in the system to use as replacement.]]))
9497     FilterLibs "${LIBGCRYPT_LIBS}"
9498     LIBGCRYPT_LIBS="${filteredlibs}"
9499 else
9500     AC_MSG_RESULT([no])
9503 AC_SUBST([LIBGCRYPT_CFLAGS])
9504 AC_SUBST([LIBGCRYPT_LIBS])
9506 dnl ===================================================================
9507 dnl Check for system redland
9508 dnl ===================================================================
9509 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9510 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9511 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9512 if test "$with_system_redland" = "yes"; then
9513     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9514             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9515 else
9516     RAPTOR_MAJOR="0"
9517     RASQAL_MAJOR="3"
9518     REDLAND_MAJOR="0"
9520 AC_SUBST(RAPTOR_MAJOR)
9521 AC_SUBST(RASQAL_MAJOR)
9522 AC_SUBST(REDLAND_MAJOR)
9524 dnl ===================================================================
9525 dnl Check for system hunspell
9526 dnl ===================================================================
9527 AC_MSG_CHECKING([which libhunspell to use])
9528 if test "$with_system_hunspell" = "yes"; then
9529     AC_MSG_RESULT([external])
9530     SYSTEM_HUNSPELL=TRUE
9531     AC_LANG_PUSH([C++])
9532     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9533     if test "$HUNSPELL_PC" != "TRUE"; then
9534         AC_CHECK_HEADER(hunspell.hxx, [],
9535             [
9536             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9537             [AC_MSG_ERROR(hunspell headers not found.)], [])
9538             ], [])
9539         AC_CHECK_LIB([hunspell], [main], [:],
9540            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9541         HUNSPELL_LIBS=-lhunspell
9542     fi
9543     AC_LANG_POP([C++])
9544     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9545     FilterLibs "${HUNSPELL_LIBS}"
9546     HUNSPELL_LIBS="${filteredlibs}"
9547 else
9548     AC_MSG_RESULT([internal])
9549     SYSTEM_HUNSPELL=
9550     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9551     if test "$COM" = "MSC"; then
9552         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9553     else
9554         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.6"
9555     fi
9556     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9558 AC_SUBST(SYSTEM_HUNSPELL)
9559 AC_SUBST(HUNSPELL_CFLAGS)
9560 AC_SUBST(HUNSPELL_LIBS)
9562 dnl ===================================================================
9563 dnl Checking for altlinuxhyph
9564 dnl ===================================================================
9565 AC_MSG_CHECKING([which altlinuxhyph to use])
9566 if test "$with_system_altlinuxhyph" = "yes"; then
9567     AC_MSG_RESULT([external])
9568     SYSTEM_HYPH=TRUE
9569     AC_CHECK_HEADER(hyphen.h, [],
9570        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9571     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9572        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9573        [#include <hyphen.h>])
9574     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9575         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9576     if test -z "$HYPHEN_LIB"; then
9577         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9578            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9579     fi
9580     if test -z "$HYPHEN_LIB"; then
9581         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9582            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9583     fi
9584 else
9585     AC_MSG_RESULT([internal])
9586     SYSTEM_HYPH=
9587     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9588     if test "$COM" = "MSC"; then
9589         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9590     else
9591         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9592     fi
9594 AC_SUBST(SYSTEM_HYPH)
9595 AC_SUBST(HYPHEN_LIB)
9597 dnl ===================================================================
9598 dnl Checking for mythes
9599 dnl ===================================================================
9600 AC_MSG_CHECKING([which mythes to use])
9601 if test "$with_system_mythes" = "yes"; then
9602     AC_MSG_RESULT([external])
9603     SYSTEM_MYTHES=TRUE
9604     AC_LANG_PUSH([C++])
9605     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9606     if test "$MYTHES_PKGCONFIG" = "no"; then
9607         AC_CHECK_HEADER(mythes.hxx, [],
9608             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9609         AC_CHECK_LIB([mythes-1.2], [main], [:],
9610             [ MYTHES_FOUND=no], [])
9611     if test "$MYTHES_FOUND" = "no"; then
9612         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9613                 [ MYTHES_FOUND=no], [])
9614     fi
9615     if test "$MYTHES_FOUND" = "no"; then
9616         AC_MSG_ERROR([mythes library not found!.])
9617     fi
9618     fi
9619     AC_LANG_POP([C++])
9620     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9621     FilterLibs "${MYTHES_LIBS}"
9622     MYTHES_LIBS="${filteredlibs}"
9623 else
9624     AC_MSG_RESULT([internal])
9625     SYSTEM_MYTHES=
9626     BUILD_TYPE="$BUILD_TYPE MYTHES"
9627     if test "$COM" = "MSC"; then
9628         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9629     else
9630         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9631     fi
9633 AC_SUBST(SYSTEM_MYTHES)
9634 AC_SUBST(MYTHES_CFLAGS)
9635 AC_SUBST(MYTHES_LIBS)
9637 dnl ===================================================================
9638 dnl How should we build the linear programming solver ?
9639 dnl ===================================================================
9641 ENABLE_COINMP=
9642 AC_MSG_CHECKING([whether to build with CoinMP])
9643 if test "$enable_coinmp" != "no"; then
9644     ENABLE_COINMP=TRUE
9645     AC_MSG_RESULT([yes])
9646     if test "$with_system_coinmp" = "yes"; then
9647         SYSTEM_COINMP=TRUE
9648         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9649         FilterLibs "${COINMP_LIBS}"
9650         COINMP_LIBS="${filteredlibs}"
9651     else
9652         BUILD_TYPE="$BUILD_TYPE COINMP"
9653     fi
9654 else
9655     AC_MSG_RESULT([no])
9657 AC_SUBST(ENABLE_COINMP)
9658 AC_SUBST(SYSTEM_COINMP)
9659 AC_SUBST(COINMP_CFLAGS)
9660 AC_SUBST(COINMP_LIBS)
9662 ENABLE_LPSOLVE=
9663 AC_MSG_CHECKING([whether to build with lpsolve])
9664 if test "$enable_lpsolve" != "no"; then
9665     ENABLE_LPSOLVE=TRUE
9666     AC_MSG_RESULT([yes])
9667 else
9668     AC_MSG_RESULT([no])
9670 AC_SUBST(ENABLE_LPSOLVE)
9672 if test "$ENABLE_LPSOLVE" = TRUE; then
9673     AC_MSG_CHECKING([which lpsolve to use])
9674     if test "$with_system_lpsolve" = "yes"; then
9675         AC_MSG_RESULT([external])
9676         SYSTEM_LPSOLVE=TRUE
9677         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9678            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9679         save_LIBS=$LIBS
9680         # some systems need this. Like Ubuntu....
9681         AC_CHECK_LIB(m, floor)
9682         AC_CHECK_LIB(dl, dlopen)
9683         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9684             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9685         LIBS=$save_LIBS
9686     else
9687         AC_MSG_RESULT([internal])
9688         SYSTEM_LPSOLVE=
9689         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9690     fi
9692 AC_SUBST(SYSTEM_LPSOLVE)
9694 dnl ===================================================================
9695 dnl Checking for libexttextcat
9696 dnl ===================================================================
9697 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9698 if test "$with_system_libexttextcat" = "yes"; then
9699     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9701 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9703 dnl ===================================================================
9704 dnl Checking for libnumbertext
9705 dnl ===================================================================
9706 AC_MSG_CHECKING([whether to use libnumbertext])
9707 if test "$enable_libnumbertext" = "no"; then
9708     AC_MSG_RESULT([no])
9709     ENABLE_LIBNUMBERTEXT=
9710     SYSTEM_LIBNUMBERTEXT=
9711 else
9712     AC_MSG_RESULT([yes])
9713     ENABLE_LIBNUMBERTEXT=TRUE
9714     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
9715     if test "$with_system_libnumbertext" = "yes"; then
9716         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
9717         SYSTEM_LIBNUMBERTEXT=YES
9718     else
9719         SYSTEM_LIBNUMBERTEXT=
9720         AC_LANG_PUSH([C++])
9721         save_CXXFLAGS=$CXXFLAGS
9722         CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
9723         AC_CHECK_HEADERS([codecvt regex])
9724         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
9725                 [ ENABLE_LIBNUMBERTEXT=''
9726                   LIBNUMBERTEXT_CFLAGS=''
9727                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
9728                                Enable libnumbertext fallback (missing number to number name conversion).])
9729                 ])
9730         CXXFLAGS=$save_CXXFLAGS
9731         AC_LANG_POP([C++])
9732     fi
9733     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
9734         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
9735     fi
9737 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
9738 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
9739 AC_SUBST(ENABLE_LIBNUMBERTEXT)
9740 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
9742 dnl ***************************************
9743 dnl testing libc version for Linux...
9744 dnl ***************************************
9745 if test "$_os" = "Linux"; then
9746     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9747     exec 6>/dev/null # no output
9748     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9749     exec 6>&1 # output on again
9750     if test "$HAVE_LIBC"; then
9751         AC_MSG_RESULT([yes])
9752     else
9753         AC_MSG_ERROR([no, upgrade libc])
9754     fi
9757 dnl =========================================
9758 dnl Check for uuidgen
9759 dnl =========================================
9760 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9761     # presence is already tested above in the WINDOWS_SDK_HOME check
9762     UUIDGEN=uuidgen.exe
9763     AC_SUBST(UUIDGEN)
9764 else
9765     AC_PATH_PROG([UUIDGEN], [uuidgen])
9766     if test -z "$UUIDGEN"; then
9767         AC_MSG_WARN([uuid is needed for building installation sets])
9768     fi
9771 dnl ***************************************
9772 dnl Checking for bison and flex
9773 dnl ***************************************
9774 AC_PATH_PROG(BISON, bison)
9775 if test -z "$BISON"; then
9776     AC_MSG_ERROR([no bison found in \$PATH, install it])
9777 else
9778     AC_MSG_CHECKING([the bison version])
9779     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9780     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9781     # Accept newer than 2.0
9782     if test "$_bison_longver" -lt 2000; then
9783         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9784     fi
9787 AC_PATH_PROG(FLEX, flex)
9788 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9789     FLEX=`cygpath -m $FLEX`
9791 if test -z "$FLEX"; then
9792     AC_MSG_ERROR([no flex found in \$PATH, install it])
9793 else
9794     AC_MSG_CHECKING([the flex version])
9795     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9796     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9797         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9798     fi
9800 AC_SUBST([FLEX])
9801 dnl ***************************************
9802 dnl Checking for patch
9803 dnl ***************************************
9804 AC_PATH_PROG(PATCH, patch)
9805 if test -z "$PATCH"; then
9806     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9809 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9810 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9811     if test -z "$with_gnu_patch"; then
9812         GNUPATCH=$PATCH
9813     else
9814         if test -x "$with_gnu_patch"; then
9815             GNUPATCH=$with_gnu_patch
9816         else
9817             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9818         fi
9819     fi
9821     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9822     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9823         AC_MSG_RESULT([yes])
9824     else
9825         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9826     fi
9827 else
9828     GNUPATCH=$PATCH
9831 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9832     GNUPATCH=`cygpath -m $GNUPATCH`
9835 dnl We also need to check for --with-gnu-cp
9837 if test -z "$with_gnu_cp"; then
9838     # check the place where the good stuff is hidden on Solaris...
9839     if test -x /usr/gnu/bin/cp; then
9840         GNUCP=/usr/gnu/bin/cp
9841     else
9842         AC_PATH_PROGS(GNUCP, gnucp cp)
9843     fi
9844     if test -z $GNUCP; then
9845         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9846     fi
9847 else
9848     if test -x "$with_gnu_cp"; then
9849         GNUCP=$with_gnu_cp
9850     else
9851         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9852     fi
9855 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9856     GNUCP=`cygpath -m $GNUCP`
9859 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9860 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9861     AC_MSG_RESULT([yes])
9862 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9863     AC_MSG_RESULT([yes])
9864 else
9865     case "$build_os" in
9866     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9867         x_GNUCP=[\#]
9868         GNUCP=''
9869         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9870         ;;
9871     *)
9872         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9873         ;;
9874     esac
9877 AC_SUBST(GNUPATCH)
9878 AC_SUBST(GNUCP)
9879 AC_SUBST(x_GNUCP)
9881 dnl ***************************************
9882 dnl testing assembler path
9883 dnl ***************************************
9884 ML_EXE=""
9885 if test "$_os" = "WINNT"; then
9886     if test "$BITNESS_OVERRIDE" = ""; then
9887         assembler=ml.exe
9888         assembler_bin=$CL_DIR
9889     else
9890         assembler=ml64.exe
9891         assembler_bin=$CL_DIR
9892     fi
9894     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9895     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9896         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9897         AC_MSG_RESULT([found])
9898         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9899     else
9900         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9901     fi
9903     PathFormat "$ASM_HOME"
9904     ASM_HOME="$formatted_path"
9905 else
9906     ASM_HOME=""
9909 AC_SUBST(ML_EXE)
9911 dnl ===================================================================
9912 dnl We need zip and unzip
9913 dnl ===================================================================
9914 AC_PATH_PROG(ZIP, zip)
9915 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9916 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9917     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],,)
9920 AC_PATH_PROG(UNZIP, unzip)
9921 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9923 dnl ===================================================================
9924 dnl Zip must be a specific type for different build types.
9925 dnl ===================================================================
9926 if test $build_os = cygwin; then
9927     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9928         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9929     fi
9932 dnl ===================================================================
9933 dnl We need touch with -h option support.
9934 dnl ===================================================================
9935 AC_PATH_PROG(TOUCH, touch)
9936 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
9937 touch warn
9938 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
9939     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],,)
9942 dnl ===================================================================
9943 dnl Check for system epoxy
9944 dnl ===================================================================
9945 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
9947 dnl ===================================================================
9948 dnl Set vcl option: coordinate device in double or sal_Int32
9949 dnl ===================================================================
9951 dnl disabled for now, we don't want subtle differences between OSs
9952 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
9953 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
9954 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
9955 dnl     AC_MSG_RESULT([double])
9956 dnl else
9957 dnl     AC_MSG_RESULT([sal_Int32])
9958 dnl fi
9960 dnl ===================================================================
9961 dnl Test which vclplugs have to be built.
9962 dnl ===================================================================
9963 R=""
9964 if test "$USING_X11" != TRUE; then
9965     enable_gtk=no
9966     enable_gtk3=no
9968 GTK3_CFLAGS=""
9969 GTK3_LIBS=""
9970 ENABLE_GTK3=""
9971 if test "x$enable_gtk3" = "xyes"; then
9972     if test "$with_system_cairo" = no; then
9973         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
9974     fi
9975     : ${with_system_cairo:=yes}
9976     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="")
9977     if test "x$ENABLE_GTK3" = "xTRUE"; then
9978         R="gtk3"
9979         GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
9980     else
9981         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
9982     fi
9983     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9984     FilterLibs "${GTK3_LIBS}"
9985     GTK3_LIBS="${filteredlibs}"
9987     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
9988     if test "$with_system_epoxy" != "yes"; then
9989         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
9990         AC_CHECK_HEADER(EGL/eglplatform.h, [],
9991                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
9992     fi
9994 AC_SUBST(GTK3_LIBS)
9995 AC_SUBST(GTK3_CFLAGS)
9996 AC_SUBST(ENABLE_GTK3)
9998 ENABLE_GTK=""
9999 if test "x$enable_gtk" = "xyes"; then
10000     if test "$with_system_cairo" = no; then
10001         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
10002     fi
10003     : ${with_system_cairo:=yes}
10004     ENABLE_GTK="TRUE"
10005     AC_DEFINE(ENABLE_GTK)
10006     R="gtk $R"
10008 AC_SUBST(ENABLE_GTK)
10010 ENABLE_KDE4=""
10011 if test "x$enable_kde4" = "xyes"; then
10012     ENABLE_KDE4="TRUE"
10013     AC_DEFINE(ENABLE_KDE4)
10014     R="$R kde4"
10016 AC_SUBST(ENABLE_KDE4)
10018 ENABLE_QT5=""
10019 if test "x$enable_qt5" = "xyes"; then
10020     ENABLE_QT5="TRUE"
10021     AC_DEFINE(ENABLE_QT5)
10022     R="$R qt5"
10024 AC_SUBST(ENABLE_QT5)
10026 ENABLE_KDE5=""
10027 if test "x$enable_kde5" = "xyes"; then
10028     ENABLE_KDE5="TRUE"
10029     AC_DEFINE(ENABLE_KDE5)
10030     R="$R kde5"
10032 AC_SUBST(ENABLE_KDE5)
10034 ENABLE_GTK3_KDE5=""
10035 if test "x$enable_gtk3_kde5" = "xyes"; then
10036     ENABLE_GTK3_KDE5="TRUE"
10037     AC_DEFINE(ENABLE_GTK3_KDE5)
10038     R="$R gtk3_kde5"
10040 AC_SUBST(ENABLE_GTK3_KDE5)
10042 build_vcl_plugins="$R"
10043 if test -z "$build_vcl_plugins"; then
10044     build_vcl_plugins="none"
10046 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10048 dnl ===================================================================
10049 dnl check for dbus support
10050 dnl ===================================================================
10051 ENABLE_DBUS=""
10052 DBUS_CFLAGS=""
10053 DBUS_LIBS=""
10055 if test "$enable_dbus" = "no"; then
10056     test_dbus=no
10059 AC_MSG_CHECKING([whether to enable DBUS support])
10060 if test "$test_dbus" = "yes"; then
10061     ENABLE_DBUS="TRUE"
10062     AC_MSG_RESULT([yes])
10063     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
10064     AC_DEFINE(ENABLE_DBUS)
10065     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10066     FilterLibs "${DBUS_LIBS}"
10067     DBUS_LIBS="${filteredlibs}"
10068 else
10069     AC_MSG_RESULT([no])
10072 AC_SUBST(ENABLE_DBUS)
10073 AC_SUBST(DBUS_CFLAGS)
10074 AC_SUBST(DBUS_LIBS)
10076 AC_MSG_CHECKING([whether to enable Impress remote control])
10077 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10078     AC_MSG_RESULT([yes])
10079     ENABLE_SDREMOTE=TRUE
10080     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10082     # If not explicitly enabled or disabled, default
10083     if test -z "$enable_sdremote_bluetooth"; then
10084         case "$OS" in
10085         LINUX|MACOSX|WNT)
10086             # Default to yes for these
10087             enable_sdremote_bluetooth=yes
10088             ;;
10089         *)
10090             # otherwise no
10091             enable_sdremote_bluetooth=no
10092             ;;
10093         esac
10094     fi
10095     # $enable_sdremote_bluetooth is guaranteed non-empty now
10097     if test "$enable_sdremote_bluetooth" != "no"; then
10098         if test "$OS" = "LINUX"; then
10099             if test "$ENABLE_DBUS" = "TRUE"; then
10100                 AC_MSG_RESULT([yes])
10101                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10102                 dnl ===================================================================
10103                 dnl Check for system bluez
10104                 dnl ===================================================================
10105                 AC_MSG_CHECKING([which Bluetooth header to use])
10106                 if test "$with_system_bluez" = "yes"; then
10107                     AC_MSG_RESULT([external])
10108                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10109                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10110                     SYSTEM_BLUEZ=TRUE
10111                 else
10112                     AC_MSG_RESULT([internal])
10113                     SYSTEM_BLUEZ=
10114                 fi
10115             else
10116                 AC_MSG_RESULT([no, dbus disabled])
10117                 ENABLE_SDREMOTE_BLUETOOTH=
10118                 SYSTEM_BLUEZ=
10119             fi
10120         else
10121             AC_MSG_RESULT([yes])
10122             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10123             SYSTEM_BLUEZ=
10124         fi
10125     else
10126         AC_MSG_RESULT([no])
10127         ENABLE_SDREMOTE_BLUETOOTH=
10128         SYSTEM_BLUEZ=
10129     fi
10130 else
10131     ENABLE_SDREMOTE=
10132     SYSTEM_BLUEZ=
10133     AC_MSG_RESULT([no])
10135 AC_SUBST(ENABLE_SDREMOTE)
10136 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10137 AC_SUBST(SYSTEM_BLUEZ)
10139 dnl ===================================================================
10140 dnl Check whether the gtk 2.0 libraries are available.
10141 dnl ===================================================================
10143 GTK_CFLAGS=""
10144 GTK_LIBS=""
10145 if test  "$test_gtk" = "yes"; then
10147     if test "$ENABLE_GTK" = "TRUE"; then
10148         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]))
10149         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10150         FilterLibs "${GTK_LIBS}"
10151         GTK_LIBS="${filteredlibs}"
10152         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]))
10153         BUILD_TYPE="$BUILD_TYPE GTK"
10154         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10155         FilterLibs "${GTHREAD_LIBS}"
10156         GTHREAD_LIBS="${filteredlibs}"
10158         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10159         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10160                           [ENABLE_GTK_PRINT="TRUE"],
10161                           [ENABLE_GTK_PRINT=""])
10162         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10163         FilterLibs "${GTK_PRINT_LIBS}"
10164         GTK_PRINT_LIBS="${filteredlibs}"
10165     fi
10167     if test "$ENABLE_GTK" = "TRUE" || test "$ENABLE_GTK3" = "TRUE"; then
10168         AC_MSG_CHECKING([whether to enable GIO support])
10169         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10170             dnl Need at least 2.26 for the dbus support.
10171             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10172                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10173             if test "$ENABLE_GIO" = "TRUE"; then
10174                 AC_DEFINE(ENABLE_GIO)
10175                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10176                 FilterLibs "${GIO_LIBS}"
10177                 GIO_LIBS="${filteredlibs}"
10178             fi
10179         else
10180             AC_MSG_RESULT([no])
10181         fi
10182     fi
10184 AC_SUBST(ENABLE_GIO)
10185 AC_SUBST(GIO_CFLAGS)
10186 AC_SUBST(GIO_LIBS)
10187 AC_SUBST(GTK_CFLAGS)
10188 AC_SUBST(GTK_LIBS)
10189 AC_SUBST(GTHREAD_CFLAGS)
10190 AC_SUBST(GTHREAD_LIBS)
10191 AC_SUBST([ENABLE_GTK_PRINT])
10192 AC_SUBST([GTK_PRINT_CFLAGS])
10193 AC_SUBST([GTK_PRINT_LIBS])
10196 dnl ===================================================================
10198 SPLIT_APP_MODULES=""
10199 if test "$enable_split_app_modules" = "yes"; then
10200     SPLIT_APP_MODULES="TRUE"
10202 AC_SUBST(SPLIT_APP_MODULES)
10204 SPLIT_OPT_FEATURES=""
10205 if test "$enable_split_opt_features" = "yes"; then
10206     SPLIT_OPT_FEATURES="TRUE"
10208 AC_SUBST(SPLIT_OPT_FEATURES)
10210 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10211     if test "$enable_cairo_canvas" = yes; then
10212         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10213     fi
10214     enable_cairo_canvas=no
10215 elif test -z "$enable_cairo_canvas"; then
10216     enable_cairo_canvas=yes
10219 ENABLE_CAIRO_CANVAS=""
10220 if test "$enable_cairo_canvas" = "yes"; then
10221     test_cairo=yes
10222     ENABLE_CAIRO_CANVAS="TRUE"
10223     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10225 AC_SUBST(ENABLE_CAIRO_CANVAS)
10227 dnl ===================================================================
10228 dnl Check whether the GStreamer libraries are available.
10229 dnl It's possible to build avmedia with both GStreamer backends!
10230 dnl ===================================================================
10232 ENABLE_GSTREAMER_1_0=""
10234 if test "$build_gstreamer_1_0" = "yes"; then
10236     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10237     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10238         ENABLE_GSTREAMER_1_0="TRUE"
10239         AC_MSG_RESULT([yes])
10240         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10241         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10242         FilterLibs "${GSTREAMER_1_0_LIBS}"
10243         GSTREAMER_1_0_LIBS="${filteredlibs}"
10244     else
10245         AC_MSG_RESULT([no])
10246     fi
10248 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10249 AC_SUBST(GSTREAMER_1_0_LIBS)
10250 AC_SUBST(ENABLE_GSTREAMER_1_0)
10253 ENABLE_GSTREAMER_0_10=""
10254 if test "$build_gstreamer_0_10" = "yes"; then
10256     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10257     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10258         ENABLE_GSTREAMER_0_10="TRUE"
10259         AC_MSG_RESULT([yes])
10260         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10261             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10262         ])
10263         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10264         FilterLibs "${GSTREAMER_0_10_LIBS}"
10265         GSTREAMER_0_10_LIBS="${filteredlibs}"
10266     else
10267         AC_MSG_RESULT([no])
10268     fi
10271 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10272 AC_SUBST(GSTREAMER_0_10_LIBS)
10273 AC_SUBST(ENABLE_GSTREAMER_0_10)
10275 dnl ===================================================================
10276 dnl Check whether to build the VLC avmedia backend
10277 dnl ===================================================================
10279 ENABLE_VLC=""
10281 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10282 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10283     ENABLE_VLC="TRUE"
10284     AC_MSG_RESULT([yes])
10285 else
10286     AC_MSG_RESULT([no])
10288 AC_SUBST(ENABLE_VLC)
10290 ENABLE_OPENGL_TRANSITIONS=
10291 ENABLE_OPENGL_CANVAS=
10292 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10293    : # disable
10294 elif test "$_os" = "Darwin"; then
10295     # We use frameworks on Mac OS X, no need for detail checks
10296     ENABLE_OPENGL_TRANSITIONS=TRUE
10297     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10298     ENABLE_OPENGL_CANVAS=TRUE
10299 elif test $_os = WINNT; then
10300     ENABLE_OPENGL_TRANSITIONS=TRUE
10301     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10302     ENABLE_OPENGL_CANVAS=TRUE
10303 else
10304     if test "$USING_X11" = TRUE; then
10305         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10306         ENABLE_OPENGL_TRANSITIONS=TRUE
10307         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10308         ENABLE_OPENGL_CANVAS=TRUE
10309     fi
10312 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10313 AC_SUBST(ENABLE_OPENGL_CANVAS)
10315 dnl =================================================
10316 dnl Check whether to build with OpenCL support.
10317 dnl =================================================
10319 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10320     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10321     # platform (optional at run-time, used through clew).
10322     BUILD_TYPE="$BUILD_TYPE OPENCL"
10323     AC_DEFINE(HAVE_FEATURE_OPENCL)
10326 dnl =================================================
10327 dnl Check whether to build with dconf support.
10328 dnl =================================================
10330 if test "$enable_dconf" != no; then
10331     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10332         if test "$enable_dconf" = yes; then
10333             AC_MSG_ERROR([dconf not found])
10334         else
10335             enable_dconf=no
10336         fi])
10338 AC_MSG_CHECKING([whether to enable dconf])
10339 if test "$enable_dconf" = no; then
10340     DCONF_CFLAGS=
10341     DCONF_LIBS=
10342     ENABLE_DCONF=
10343     AC_MSG_RESULT([no])
10344 else
10345     ENABLE_DCONF=TRUE
10346     AC_DEFINE(ENABLE_DCONF)
10347     AC_MSG_RESULT([yes])
10349 AC_SUBST([DCONF_CFLAGS])
10350 AC_SUBST([DCONF_LIBS])
10351 AC_SUBST([ENABLE_DCONF])
10353 # pdf import?
10354 AC_MSG_CHECKING([whether to build the PDF import feature])
10355 ENABLE_PDFIMPORT=
10356 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10357     AC_MSG_RESULT([yes])
10358     ENABLE_PDFIMPORT=TRUE
10359     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10361     dnl ===================================================================
10362     dnl Check for system poppler
10363     dnl ===================================================================
10364     AC_MSG_CHECKING([which PDF import backend to use])
10365     if test "$with_system_poppler" = "yes"; then
10366         AC_MSG_RESULT([external])
10367         SYSTEM_POPPLER=TRUE
10368         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10369         AC_LANG_PUSH([C++])
10370         save_CXXFLAGS=$CXXFLAGS
10371         save_CPPFLAGS=$CPPFLAGS
10372         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10373         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10374         AC_CHECK_HEADER([cpp/poppler-version.h],
10375             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10376             [])
10377         CXXFLAGS=$save_CXXFLAGS
10378         CPPFLAGS=$save_CPPFLAGS
10379         AC_LANG_POP([C++])
10380         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10382         FilterLibs "${POPPLER_LIBS}"
10383         POPPLER_LIBS="${filteredlibs}"
10384     else
10385         AC_MSG_RESULT([internal])
10386         SYSTEM_POPPLER=
10387         BUILD_TYPE="$BUILD_TYPE POPPLER"
10388         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10389     fi
10390     AC_DEFINE([ENABLE_PDFIMPORT],1)
10391 else
10392     AC_MSG_RESULT([no])
10394 AC_SUBST(ENABLE_PDFIMPORT)
10395 AC_SUBST(SYSTEM_POPPLER)
10396 AC_SUBST(POPPLER_CFLAGS)
10397 AC_SUBST(POPPLER_LIBS)
10399 # pdf import?
10400 AC_MSG_CHECKING([whether to build PDFium])
10401 ENABLE_PDFIUM=
10402 if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then
10403     AC_MSG_RESULT([yes])
10404     ENABLE_PDFIUM=TRUE
10405     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10406     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10407 else
10408     AC_MSG_RESULT([no])
10410 AC_SUBST(ENABLE_PDFIUM)
10412 SYSTEM_GPGMEPP=
10414 if test "$build_for_ios" = "YES"; then
10415     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10416     AC_MSG_RESULT([yes])
10417 elif test "$enable_mpl_subset" = "yes"; then
10418     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10419     AC_MSG_RESULT([yes])
10420 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10421     dnl ===================================================================
10422     dnl Check for system gpgme
10423     dnl ===================================================================
10424     AC_MSG_CHECKING([which gpgmepp to use])
10425     if test "$with_system_gpgmepp" = "yes"; then
10426         AC_MSG_RESULT([external])
10427         SYSTEM_GPGMEPP=TRUE
10429         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10430         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10431             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10432         # progress_callback is the only func with plain C linkage
10433         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10434         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10435             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10436         AC_CHECK_HEADER(gpgme.h, [],
10437             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10438     else
10439         AC_MSG_RESULT([internal])
10440         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10441         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10443         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10444         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10445         if test "$_os" != "WINNT"; then
10446             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10447             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10448         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10449             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10450         fi
10451     fi
10452     ENABLE_GPGMEPP=TRUE
10453     AC_DEFINE([HAVE_FEATURE_GPGME])
10454     AC_PATH_PROG(GPG, gpg)
10455     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10456     # so let's exclude that manually for the moment
10457     if test -n "$GPG" -a "$_os" != "WINNT"; then
10458         # make sure we not only have a working gpgme, but a full working
10459         # gpg installation to run OpenPGP signature verification
10460         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10461     fi
10462     if test "$_os" = "Linux"; then
10463       uid=`id -u`
10464       AC_MSG_CHECKING([for /run/user/$uid])
10465       if test -d /run/user/$uid; then
10466         AC_MSG_RESULT([yes])
10467         AC_PATH_PROG(GPGCONF, gpgconf)
10468         AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10469         if $GPGCONF --dump-options > /dev/null ; then
10470           if $GPGCONF --dump-options | grep -q create-socketdir ; then
10471             AC_MSG_RESULT([yes])
10472             AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10473           else
10474             AC_MSG_RESULT([no])
10475           fi
10476         else
10477           AC_MSG_RESULT([no. missing or broken gpgconf?])
10478         fi
10479       else
10480         AC_MSG_RESULT([no])
10481      fi
10482    fi
10484 AC_SUBST(ENABLE_GPGMEPP)
10485 AC_SUBST(SYSTEM_GPGMEPP)
10486 AC_SUBST(GPG_ERROR_CFLAGS)
10487 AC_SUBST(GPG_ERROR_LIBS)
10488 AC_SUBST(LIBASSUAN_CFLAGS)
10489 AC_SUBST(LIBASSUAN_LIBS)
10490 AC_SUBST(GPGMEPP_CFLAGS)
10491 AC_SUBST(GPGMEPP_LIBS)
10492 AC_SUBST(GPGCONF)
10493 AC_SUBST(HAVE_GPGCONF_SOCKETDIR)
10495 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10496 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10497     AC_MSG_RESULT([yes])
10498     ENABLE_MEDIAWIKI=TRUE
10499     BUILD_TYPE="$BUILD_TYPE XSLTML"
10500     if test  "x$with_java" = "xno"; then
10501         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10502     fi
10503 else
10504     AC_MSG_RESULT([no])
10505     ENABLE_MEDIAWIKI=
10506     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10508 AC_SUBST(ENABLE_MEDIAWIKI)
10510 AC_MSG_CHECKING([whether to build the Report Builder])
10511 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10512     AC_MSG_RESULT([yes])
10513     ENABLE_REPORTBUILDER=TRUE
10514     AC_MSG_CHECKING([which jfreereport libs to use])
10515     if test "$with_system_jfreereport" = "yes"; then
10516         SYSTEM_JFREEREPORT=TRUE
10517         AC_MSG_RESULT([external])
10518         if test -z $SAC_JAR; then
10519             SAC_JAR=/usr/share/java/sac.jar
10520         fi
10521         if ! test -f $SAC_JAR; then
10522              AC_MSG_ERROR(sac.jar not found.)
10523         fi
10525         if test -z $LIBXML_JAR; then
10526             if test -f /usr/share/java/libxml-1.0.0.jar; then
10527                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10528             elif test -f /usr/share/java/libxml.jar; then
10529                 LIBXML_JAR=/usr/share/java/libxml.jar
10530             else
10531                 AC_MSG_ERROR(libxml.jar replacement not found.)
10532             fi
10533         elif ! test -f $LIBXML_JAR; then
10534             AC_MSG_ERROR(libxml.jar not found.)
10535         fi
10537         if test -z $FLUTE_JAR; then
10538             if test -f/usr/share/java/flute-1.3.0.jar; then
10539                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10540             elif test -f /usr/share/java/flute.jar; then
10541                 FLUTE_JAR=/usr/share/java/flute.jar
10542             else
10543                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10544             fi
10545         elif ! test -f $FLUTE_JAR; then
10546             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10547         fi
10549         if test -z $JFREEREPORT_JAR; then
10550             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10551                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10552             elif test -f /usr/share/java/flow-engine.jar; then
10553                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10554             else
10555                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10556             fi
10557         elif ! test -f  $JFREEREPORT_JAR; then
10558                 AC_MSG_ERROR(jfreereport.jar not found.)
10559         fi
10561         if test -z $LIBLAYOUT_JAR; then
10562             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10563                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10564             elif test -f /usr/share/java/liblayout.jar; then
10565                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10566             else
10567                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10568             fi
10569         elif ! test -f $LIBLAYOUT_JAR; then
10570                 AC_MSG_ERROR(liblayout.jar not found.)
10571         fi
10573         if test -z $LIBLOADER_JAR; then
10574             if test -f /usr/share/java/libloader-1.0.0.jar; then
10575                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10576             elif test -f /usr/share/java/libloader.jar; then
10577                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10578             else
10579                 AC_MSG_ERROR(libloader.jar replacement not found.)
10580             fi
10581         elif ! test -f  $LIBLOADER_JAR; then
10582             AC_MSG_ERROR(libloader.jar not found.)
10583         fi
10585         if test -z $LIBFORMULA_JAR; then
10586             if test -f /usr/share/java/libformula-0.2.0.jar; then
10587                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10588             elif test -f /usr/share/java/libformula.jar; then
10589                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10590             else
10591                 AC_MSG_ERROR(libformula.jar replacement not found.)
10592             fi
10593         elif ! test -f $LIBFORMULA_JAR; then
10594                 AC_MSG_ERROR(libformula.jar not found.)
10595         fi
10597         if test -z $LIBREPOSITORY_JAR; then
10598             if test -f /usr/share/java/librepository-1.0.0.jar; then
10599                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10600             elif test -f /usr/share/java/librepository.jar; then
10601                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10602             else
10603                 AC_MSG_ERROR(librepository.jar replacement not found.)
10604             fi
10605         elif ! test -f $LIBREPOSITORY_JAR; then
10606             AC_MSG_ERROR(librepository.jar not found.)
10607         fi
10609         if test -z $LIBFONTS_JAR; then
10610             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10611                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10612             elif test -f /usr/share/java/libfonts.jar; then
10613                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10614             else
10615                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10616             fi
10617         elif ! test -f $LIBFONTS_JAR; then
10618                 AC_MSG_ERROR(libfonts.jar not found.)
10619         fi
10621         if test -z $LIBSERIALIZER_JAR; then
10622             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10623                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10624             elif test -f /usr/share/java/libserializer.jar; then
10625                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10626             else
10627                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10628             fi
10629         elif ! test -f $LIBSERIALIZER_JAR; then
10630                 AC_MSG_ERROR(libserializer.jar not found.)
10631         fi
10633         if test -z $LIBBASE_JAR; then
10634             if test -f /usr/share/java/libbase-1.0.0.jar; then
10635                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10636             elif test -f /usr/share/java/libbase.jar; then
10637                 LIBBASE_JAR=/usr/share/java/libbase.jar
10638             else
10639                 AC_MSG_ERROR(libbase.jar replacement not found.)
10640             fi
10641         elif ! test -f $LIBBASE_JAR; then
10642             AC_MSG_ERROR(libbase.jar not found.)
10643         fi
10645     else
10646         AC_MSG_RESULT([internal])
10647         SYSTEM_JFREEREPORT=
10648         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10649     fi
10650 else
10651     AC_MSG_RESULT([no])
10652     ENABLE_REPORTBUILDER=
10653     SYSTEM_JFREEREPORT=
10655 AC_SUBST(ENABLE_REPORTBUILDER)
10656 AC_SUBST(SYSTEM_JFREEREPORT)
10657 AC_SUBST(SAC_JAR)
10658 AC_SUBST(LIBXML_JAR)
10659 AC_SUBST(FLUTE_JAR)
10660 AC_SUBST(JFREEREPORT_JAR)
10661 AC_SUBST(LIBBASE_JAR)
10662 AC_SUBST(LIBLAYOUT_JAR)
10663 AC_SUBST(LIBLOADER_JAR)
10664 AC_SUBST(LIBFORMULA_JAR)
10665 AC_SUBST(LIBREPOSITORY_JAR)
10666 AC_SUBST(LIBFONTS_JAR)
10667 AC_SUBST(LIBSERIALIZER_JAR)
10669 # this has to be here because both the Wiki Publisher and the SRB use
10670 # commons-logging
10671 COMMONS_LOGGING_VERSION=1.2
10672 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10673     AC_MSG_CHECKING([which Apache commons-* libs to use])
10674     if test "$with_system_apache_commons" = "yes"; then
10675         SYSTEM_APACHE_COMMONS=TRUE
10676         AC_MSG_RESULT([external])
10677         if test -z $COMMONS_LOGGING_JAR; then
10678             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10679                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10680            elif test -f /usr/share/java/commons-logging.jar; then
10681                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
10682             else
10683                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
10684             fi
10685         elif ! test -f $COMMONS_LOGGING_JAR; then
10686             AC_MSG_ERROR(commons-logging.jar not found.)
10687         fi
10688     else
10689         AC_MSG_RESULT([internal])
10690         SYSTEM_APACHE_COMMONS=
10691         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
10692     fi
10694 AC_SUBST(SYSTEM_APACHE_COMMONS)
10695 AC_SUBST(COMMONS_LOGGING_JAR)
10696 AC_SUBST(COMMONS_LOGGING_VERSION)
10698 # scripting provider for BeanShell?
10699 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10700 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10701     AC_MSG_RESULT([yes])
10702     ENABLE_SCRIPTING_BEANSHELL=TRUE
10704     dnl ===================================================================
10705     dnl Check for system beanshell
10706     dnl ===================================================================
10707     AC_MSG_CHECKING([which beanshell to use])
10708     if test "$with_system_beanshell" = "yes"; then
10709         AC_MSG_RESULT([external])
10710         SYSTEM_BSH=TRUE
10711         if test -z $BSH_JAR; then
10712             BSH_JAR=/usr/share/java/bsh.jar
10713         fi
10714         if ! test -f $BSH_JAR; then
10715             AC_MSG_ERROR(bsh.jar not found.)
10716         fi
10717     else
10718         AC_MSG_RESULT([internal])
10719         SYSTEM_BSH=
10720         BUILD_TYPE="$BUILD_TYPE BSH"
10721     fi
10722 else
10723     AC_MSG_RESULT([no])
10724     ENABLE_SCRIPTING_BEANSHELL=
10725     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10727 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10728 AC_SUBST(SYSTEM_BSH)
10729 AC_SUBST(BSH_JAR)
10731 # scripting provider for JavaScript?
10732 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10733 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10734     AC_MSG_RESULT([yes])
10735     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10737     dnl ===================================================================
10738     dnl Check for system rhino
10739     dnl ===================================================================
10740     AC_MSG_CHECKING([which rhino to use])
10741     if test "$with_system_rhino" = "yes"; then
10742         AC_MSG_RESULT([external])
10743         SYSTEM_RHINO=TRUE
10744         if test -z $RHINO_JAR; then
10745             RHINO_JAR=/usr/share/java/js.jar
10746         fi
10747         if ! test -f $RHINO_JAR; then
10748             AC_MSG_ERROR(js.jar not found.)
10749         fi
10750     else
10751         AC_MSG_RESULT([internal])
10752         SYSTEM_RHINO=
10753         BUILD_TYPE="$BUILD_TYPE RHINO"
10754     fi
10755 else
10756     AC_MSG_RESULT([no])
10757     ENABLE_SCRIPTING_JAVASCRIPT=
10758     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10760 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10761 AC_SUBST(SYSTEM_RHINO)
10762 AC_SUBST(RHINO_JAR)
10764 # This is only used in KDE3/KDE4 checks to determine if /usr/lib64
10765 # paths should be added to library search path. So lets put all 64-bit
10766 # platforms there.
10767 supports_multilib=
10768 case "$host_cpu" in
10769 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
10770     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10771         supports_multilib="yes"
10772     fi
10773     ;;
10775     ;;
10776 esac
10778 dnl ===================================================================
10779 dnl KDE4 Integration
10780 dnl ===================================================================
10782 KDE4_CFLAGS=""
10783 KDE4_LIBS=""
10784 QMAKE4="qmake"
10785 MOC4="moc"
10786 KDE4_GLIB_CFLAGS=""
10787 KDE4_GLIB_LIBS=""
10788 KDE4_HAVE_GLIB=""
10789 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
10790     qt4_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
10791     qt4_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
10793     kde4_incdirs="/usr/include /usr/include/kde4 $x_includes"
10794     kde4_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
10796     if test -n "$supports_multilib"; then
10797         qt4_libdirs="$qt4_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
10798         kde4_libdirs="$kde4_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
10799     fi
10801     if test -n "$QTDIR"; then
10802         qt4_incdirs="$QTDIR/include $qt4_incdirs"
10803         if test -z "$supports_multilib"; then
10804             qt4_libdirs="$QTDIR/lib $qt4_libdirs"
10805         else
10806             qt4_libdirs="$QTDIR/lib64 $QTDIR/lib $qt4_libdirs"
10807         fi
10808     fi
10809     if test -n "$QT4DIR"; then
10810         qt4_incdirs="$QT4DIR/include $qt4_incdirs"
10811         if test -z "$supports_multilib"; then
10812             qt4_libdirs="$QT4DIR/lib $qt4_libdirs"
10813         else
10814             qt4_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt4_libdirs"
10815         fi
10816     fi
10818     if test -n "$KDEDIR"; then
10819         kde4_incdirs="$KDEDIR/include $kde4_incdirs"
10820         if test -z "$supports_multilib"; then
10821             kde4_libdirs="$KDEDIR/lib $kde4_libdirs"
10822         else
10823             kde4_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde4_libdirs"
10824         fi
10825     fi
10826     if test -n "$KDE4DIR"; then
10827         kde4_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde4_incdirs"
10828         if test -z "$supports_multilib"; then
10829             kde4_libdirs="$KDE4DIR/lib $kde4_libdirs"
10830         else
10831             kde4_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde4_libdirs"
10832         fi
10833     fi
10835     qt4_test_include="Qt/qobject.h"
10836     qt4_test_library="libQtNetwork.so"
10837     kde4_test_include="kwindowsystem.h"
10838     kde4_test_library="libsolid.so"
10840     AC_MSG_CHECKING([for Qt4 headers])
10841     qt4_header_dir="no"
10842     for inc_dir in $qt4_incdirs; do
10843         if test -r "$inc_dir/$qt4_test_include"; then
10844             qt4_header_dir="$inc_dir"
10845             break
10846         fi
10847     done
10849     AC_MSG_RESULT([$qt4_header_dir])
10850     if test "x$qt4_header_dir" = "xno"; then
10851         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10852     fi
10854     dnl Check for qmake
10855     AC_PATH_PROGS( QMAKE4, [qmake-qt4 qmake], no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
10856     if test "$QMAKE4" = "no"; then
10857         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10858     else
10859         qmake4_test_ver="`$QMAKE4 -v 2>&1 | sed -n -e '/^Using Qt version 4\./p'`"
10860         if test -z "$qmake4_test_ver"; then
10861             AC_MSG_ERROR([Wrong qmake for Qt4 found. Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
10862         fi
10863     fi
10865     qt4_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt4_libdirs"
10866     AC_MSG_CHECKING([for Qt4 libraries])
10867     qt4_lib_dir="no"
10868     for lib_dir in $qt4_libdirs; do
10869         if test -r "$lib_dir/$qt4_test_library"; then
10870             qt4_lib_dir="$lib_dir"
10871             PKG_CONFIG_PATH="$qt4_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
10872             break
10873         fi
10874     done
10876     AC_MSG_RESULT([$qt4_lib_dir])
10878     if test "x$qt4_lib_dir" = "xno"; then
10879         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10880     fi
10882     dnl Check for Meta Object Compiler
10884     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10885     MOC4="$MOCQT4"
10886     if test "$MOC4" = "no"; then
10887         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10888         if test "$MOC4" = "no"; then
10889             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10890 the root of your Qt installation by exporting QT4DIR before running "configure".])
10891         fi
10892     fi
10894     dnl Check for KDE4 headers
10895     AC_MSG_CHECKING([for KDE4 headers])
10896     kde4_incdir="no"
10897     for kde4_check in $kde4_incdirs; do
10898         if test -r "$kde4_check/$kde4_test_include"; then
10899             kde4_incdir="$kde4_check"
10900             break
10901         fi
10902     done
10903     AC_MSG_RESULT([$kde4_incdir])
10904     if test "x$kde4_incdir" = "xno"; then
10905         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10906     fi
10907     if test "$kde4_incdir" = "/usr/include"; then kde4_incdir=; fi
10909     dnl Check for KDE4 libraries
10910     AC_MSG_CHECKING([for KDE4 libraries])
10911     kde4_libdir="no"
10912     for kde4_check in $kde4_libdirs; do
10913         if test -r "$kde4_check/$kde4_test_library"; then
10914             kde4_libdir="$kde4_check"
10915             break
10916         fi
10917     done
10919     AC_MSG_RESULT([$kde4_libdir])
10920     if test "x$kde4_libdir" = "xno"; then
10921         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10922     fi
10924     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
10925     if ! test -z "$kde4_incdir"; then
10926         KDE4_CFLAGS="-I$kde4_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10927     else
10928         KDE4_CFLAGS="$QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10929     fi
10931     KDE4_LIBS="-L$kde4_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt4_lib_dir $QT4_LIBS"
10932     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10933     FilterLibs "$KDE4_LIBS"
10934     KDE4_LIBS="$filteredlibs"
10936     AC_LANG_PUSH([C++])
10937     save_CXXFLAGS=$CXXFLAGS
10938     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10939     AC_MSG_CHECKING([whether KDE is >= 4.2])
10940        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10941 #include <kdeversion.h>
10943 int main(int argc, char **argv) {
10944        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
10945        else return 1;
10947 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[AC_MSG_ERROR([KDE support not tested with cross-compilation])])
10948     CXXFLAGS=$save_CXXFLAGS
10949     AC_LANG_POP([C++])
10951     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
10952     # Sets also KDE4_GLIB_CFLAGS/KDE4_GLIB_LIBS if successful.
10953     PKG_CHECK_MODULES(KDE4_GLIB,[glib-2.0 >= 2.4],
10954         [
10955             KDE4_HAVE_GLIB=TRUE
10956             AC_DEFINE(KDE4_HAVE_GLIB,1)
10957             KDE4_GLIB_CFLAGS=$(printf '%s' "$KDE4_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10958             FilterLibs "${KDE4_GLIB_LIBS}"
10959             KDE4_GLIB_LIBS="${filteredlibs}"
10961             qt4_fix_warning=
10963             AC_LANG_PUSH([C++])
10964             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
10965             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
10966             #  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
10967             #               ^~~~~~~~~~~~~~~~~~~~~~~
10968             #               vptr for 'QObjectPrivate'
10969             # so temporarily ignore here whichever way would be used to make such errors fatal
10970             # (-fno-sanitize-recover=... or UBSAN_OPTIONS halt_on_error=1):
10971             save_CXX=$CXX
10972             CXX=$(printf %s "$CXX" \
10973                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
10974             save_UBSAN_OPTIONS=$UBSAN_OPTIONS
10975             UBSAN_OPTIONS=$UBSAN_OPTIONS:halt_on_error=0
10976             save_CXXFLAGS=$CXXFLAGS
10977             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10978             save_LIBS=$LIBS
10979             LIBS="$LIBS $KDE4_LIBS"
10980             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
10982             # Prepare meta object data
10983             TSTBASE="tst_exclude_socket_notifiers"
10984             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
10985             ln -fs "${TSTMOC}.hxx"
10986             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10988             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10989 #include <cstdlib>
10990 #include "tst_exclude_socket_notifiers.moc"
10992 int main(int argc, char *argv[])
10994     QCoreApplication app(argc, argv);
10995     exit(tst_processEventsExcludeSocket());
10996     return 0;
10998             ]])],[
10999                 AC_MSG_RESULT([yes])
11000             ],[
11001                 AC_MSG_RESULT([no])
11002                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11003                 if test -z "$qt4_fix_warning"; then
11004                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11005                 fi
11006                 qt4_fix_warning=1
11007                 add_warning "  https://bugreports.qt.io/browse/QTBUG-37380 (needed)"
11008                 ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11010             # Remove meta object data
11011             rm -f "${TSTBASE}."*
11013             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
11015             # Prepare meta object data
11016             TSTBASE="tst_exclude_posted_events"
11017             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11018             ln -fs "${TSTMOC}.hxx"
11019             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11021             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11022 #include <cstdlib>
11023 #include "tst_exclude_posted_events.moc"
11025 int main(int argc, char *argv[])
11027     QCoreApplication app(argc, argv);
11028     exit(tst_excludePostedEvents());
11029     return 0;
11031             ]])],[
11032                 AC_MSG_RESULT([yes])
11033             ],[
11034                 AC_MSG_RESULT([no])
11035                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11036                 if test -z "$qt4_fix_warning"; then
11037                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11038                 fi
11039                 qt4_fix_warning=1
11040                 add_warning "  https://bugreports.qt.io/browse/QTBUG-34614 (needed)"
11041             ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11043             # Remove meta object data
11044             rm -f "${TSTBASE}."*
11046             if test -n "$qt4_fix_warning"; then
11047                 add_warning "  https://bugreports.qt.io/browse/QTBUG-38585 (recommended)"
11048             fi
11050             LIBS=$save_LIBS
11051             CXXFLAGS=$save_CXXFLAGS
11052             UBSAN_OPTIONS=$save_UBSAN_OPTIONS
11053             CXX=$save_CXX
11054             AC_LANG_POP([C++])
11055         ],
11056         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11058 AC_SUBST(KDE4_CFLAGS)
11059 AC_SUBST(KDE4_LIBS)
11060 AC_SUBST(MOC4)
11061 AC_SUBST(KDE4_GLIB_CFLAGS)
11062 AC_SUBST(KDE4_GLIB_LIBS)
11063 AC_SUBST(KDE4_HAVE_GLIB)
11065 dnl ===================================================================
11066 dnl QT5 Integration
11067 dnl ===================================================================
11069 QT5_CFLAGS=""
11070 QT5_LIBS=""
11071 QMAKE5="qmake"
11072 MOC5="moc"
11073 QT5_GLIB_CFLAGS=""
11074 QT5_GLIB_LIBS=""
11075 QT5_HAVE_GLIB=""
11076 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11077         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11078         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11079 then
11080     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11081     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11083     if test -n "$supports_multilib"; then
11084         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11085     fi
11087     qt5_test_include="QtWidgets/qapplication.h"
11088     qt5_test_library="libQt5Widgets.so"
11090     dnl Check for qmake5
11091     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
11092     if test "$QMAKE5" = "no"; then
11093         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11094     else
11095         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11096         if test -z "$qmake5_test_ver"; then
11097             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11098         fi
11099         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11100         qt5_minimal_minor="6"
11101         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11102             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11103         else
11104             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11105         fi
11106     fi
11108     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11109     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11111     AC_MSG_CHECKING([for Qt5 headers])
11112     qt5_incdir="no"
11113     for inc_dir in $qt5_incdirs; do
11114         if test -r "$inc_dir/$qt5_test_include"; then
11115             qt5_incdir="$inc_dir"
11116             break
11117         fi
11118     done
11119     AC_MSG_RESULT([$qt5_incdir])
11120     if test "x$qt5_incdir" = "xno"; then
11121         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11122     fi
11124     AC_MSG_CHECKING([for Qt5 libraries])
11125     qt5_libdir="no"
11126     for lib_dir in $qt5_libdirs; do
11127         if test -r "$lib_dir/$qt5_test_library"; then
11128             qt5_libdir="$lib_dir"
11129             break
11130         fi
11131     done
11132     AC_MSG_RESULT([$qt5_libdir])
11133     if test "x$qt5_libdir" = "xno"; then
11134         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11135     fi
11137     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11138     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11140     dnl Check for Meta Object Compiler
11142     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
11143     if test "$MOC5" = "no"; then
11144         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11145 the root of your Qt installation by exporting QT5DIR before running "configure".])
11146     fi
11148     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11149     # Sets also QT5_GLIB_CFLAGS/QT5_GLIB_LIBS if successful.
11150     PKG_CHECK_MODULES(QT5_GLIB,[glib-2.0 >= 2.4],
11151         [
11152             QT5_HAVE_GLIB=1
11153             AC_DEFINE(QT5_HAVE_GLIB,1)
11154         ],
11155         AC_MSG_WARN([[No Glib found, Qt5 support will not use native file pickers!]])
11156     )
11158 AC_SUBST(QT5_CFLAGS)
11159 AC_SUBST(QT5_LIBS)
11160 AC_SUBST(MOC5)
11161 AC_SUBST(QT5_GLIB_CFLAGS)
11162 AC_SUBST(QT5_GLIB_LIBS)
11163 AC_SUBST(QT5_HAVE_GLIB)
11165 dnl ===================================================================
11166 dnl KDE5 Integration
11167 dnl ===================================================================
11169 KF5_CFLAGS=""
11170 KF5_LIBS=""
11171 KF5_CONFIG="kf5-config"
11172 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11173         \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11174         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11175 then
11176     kf5_incdirs="$KF5INC /usr/include/ $x_includes"
11177     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $x_libraries"
11178     if test -n "$supports_multilib"; then
11179         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11180     fi
11182     kf5_test_include="KF5/kcoreaddons_version.h"
11183     kf5_test_library="libKF5CoreAddons.so"
11184     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11186     dnl kf5 KDE4 support compatibility installed
11187     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11188     if test "$KF5_CONFIG" != "no"; then
11189         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11190         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11191     fi
11193     dnl Check for KF5 headers
11194     AC_MSG_CHECKING([for KF5 headers])
11195     kf5_incdir="no"
11196     for kf5_check in $kf5_incdirs; do
11197         if test -r "$kf5_check/$kf5_test_include"; then
11198             kf5_incdir="$kf5_check/KF5"
11199             break
11200         fi
11201     done
11202     AC_MSG_RESULT([$kf5_incdir])
11203     if test "x$kf5_incdir" = "xno"; then
11204         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11205     fi
11207     dnl Check for KF5 libraries
11208     AC_MSG_CHECKING([for KF5 libraries])
11209     kf5_libdir="no"
11210     for kf5_check in $kf5_libdirs; do
11211         if test -r "$kf5_check/$kf5_test_library"; then
11212             kf5_libdir="$kf5_check"
11213             break
11214         fi
11215     done
11217     AC_MSG_RESULT([$kf5_libdir])
11218     if test "x$kf5_libdir" = "xno"; then
11219         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11220     fi
11222     PKG_CHECK_MODULES(KF5_XCB,[xcb],,[AC_MSG_ERROR([XCB not installed])])
11224     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"
11225     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network -lQt5X11Extras $KF5_XCB_LIBS"
11226     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11228     AC_LANG_PUSH([C++])
11229     save_CXXFLAGS=$CXXFLAGS
11230     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11231     AC_MSG_CHECKING([whether KDE is >= 5.0])
11232        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11233 #include <kcoreaddons_version.h>
11235 int main(int argc, char **argv) {
11236        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11237        else return 1;
11239        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11240     CXXFLAGS=$save_CXXFLAGS
11241     AC_LANG_POP([C++])
11243 AC_SUBST(KF5_CFLAGS)
11244 AC_SUBST(KF5_LIBS)
11246 dnl ===================================================================
11247 dnl Test whether to include Evolution 2 support
11248 dnl ===================================================================
11249 AC_MSG_CHECKING([whether to enable evolution 2 support])
11250 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11251     AC_MSG_RESULT([yes])
11252     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11253     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11254     FilterLibs "${GOBJECT_LIBS}"
11255     GOBJECT_LIBS="${filteredlibs}"
11256     ENABLE_EVOAB2="TRUE"
11257 else
11258     ENABLE_EVOAB2=""
11259     AC_MSG_RESULT([no])
11261 AC_SUBST(ENABLE_EVOAB2)
11262 AC_SUBST(GOBJECT_CFLAGS)
11263 AC_SUBST(GOBJECT_LIBS)
11265 dnl ===================================================================
11266 dnl Test which themes to include
11267 dnl ===================================================================
11268 AC_MSG_CHECKING([which themes to include])
11269 # if none given use default subset of available themes
11270 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11271     with_theme="breeze breeze_dark cib colibre elementary karasa_jaga sifr sifr_dark tango"
11274 WITH_THEMES=""
11275 if test "x$with_theme" != "xno"; then
11276     for theme in $with_theme; do
11277         case $theme in
11278         breeze|breeze_dark|colibre|elementary|karasa_jaga|sifr|sifr_dark|tango|cib) real_theme="$theme" ;;
11279         default) real_theme=colibre ;;
11280         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11281         esac
11282         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11283     done
11285 AC_MSG_RESULT([$WITH_THEMES])
11286 AC_SUBST([WITH_THEMES])
11287 # FIXME: remove this, and the convenience default->colibre remapping after a crace period
11288 for theme in $with_theme; do
11289     case $theme in
11290     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11291     *) ;;
11292     esac
11293 done
11295 dnl ===================================================================
11296 dnl Test whether to integrate helppacks into the product's installer
11297 dnl ===================================================================
11298 AC_MSG_CHECKING([for helppack integration])
11299 if test "$with_helppack_integration" = "no"; then
11300     WITH_HELPPACK_INTEGRATION=
11301     AC_MSG_RESULT([no integration])
11302 else
11303     WITH_HELPPACK_INTEGRATION=TRUE
11304     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11305     AC_MSG_RESULT([integration])
11307 AC_SUBST(WITH_HELPPACK_INTEGRATION)
11309 ###############################################################################
11310 # Extensions checking
11311 ###############################################################################
11312 AC_MSG_CHECKING([for extensions integration])
11313 if test "x$enable_extension_integration" != "xno"; then
11314     WITH_EXTENSION_INTEGRATION=TRUE
11315     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11316     AC_MSG_RESULT([yes, use integration])
11317 else
11318     WITH_EXTENSION_INTEGRATION=
11319     AC_MSG_RESULT([no, do not integrate])
11321 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11323 dnl Should any extra extensions be included?
11324 dnl There are standalone tests for each of these below.
11325 WITH_EXTRA_EXTENSIONS=
11326 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11328 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11329 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11330 if test "x$with_java" != "xno"; then
11331     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11332     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11335 TEST_FONTS_MISSING=0
11337 # $1  = font family
11338 # $2+ = accepted font mappings
11339 test_font_map()
11341     FONT="$1" ; shift
11342     AC_MSG_CHECKING([font mapping for '$FONT'])
11343     FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
11344     FONTFILE_LOWER="$(echo $FONTFILE | $AWK '{print tolower($0)}')"
11346     TESTEXPR="'${FONTFILE_LOWER}' = '$(echo $FONT | $AWK '{print tolower($0)}').ttf'"
11347     while test "$#" -ge 1 ; do
11348         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
11349         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
11350     done
11351     if test $TESTEXPR
11352     then
11353         AC_MSG_RESULT([ok])
11354     else
11355         AC_MSG_WARN([unknown ($FONTFILE)])
11356         add_warning "unknown ($FONTFILE)"
11357         TEST_FONTS_MISSING=1
11358     fi
11361 dnl ===================================================================
11362 dnl Test whether to include fonts
11363 dnl ===================================================================
11364 AC_MSG_CHECKING([whether to include third-party fonts])
11365 if test "$with_fonts" != "no"; then
11366     AC_MSG_RESULT([yes])
11367     WITH_FONTS=TRUE
11368     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11369     AC_DEFINE(HAVE_MORE_FONTS)
11370 else
11371     AC_MSG_RESULT([no])
11372     WITH_FONTS=
11373     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11374     if test "$test_fontconfig" = "yes"; then
11375         AC_PATH_PROG([FCMATCH], [fc-match])
11376         if test -z "$FCMATCH"; then
11377             AC_MSG_WARN([Unable to query installed fonts - unit tests disabled.])
11378             TEST_FONTS_MISSING=1
11379         else
11380             test_font_map 'Calibri' 'Carlito'
11381             test_font_map 'DejaVuSans' 'DejaVuSans'
11382             if test ${TEST_FONTS_MISSING} -eq 1
11383             then
11384                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
11385                 add_warning "Unknown font mappings - unit tests disabled."
11386             fi
11387         fi
11388     else
11389         TEST_FONTS_MISSING=1
11390     fi
11392 AC_SUBST(WITH_FONTS)
11393 AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
11396 dnl ===================================================================
11397 dnl Test whether to enable online update service
11398 dnl ===================================================================
11399 AC_MSG_CHECKING([whether to enable online update])
11400 ENABLE_ONLINE_UPDATE=
11401 ENABLE_ONLINE_UPDATE_MAR=
11402 UPDATE_CONFIG=
11403 if test "$enable_online_update" = ""; then
11404     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11405         AC_MSG_RESULT([yes])
11406         ENABLE_ONLINE_UPDATE="TRUE"
11407     else
11408         AC_MSG_RESULT([no])
11409     fi
11410 else
11411     if test "$enable_online_update" = "mar"; then
11412         AC_MSG_RESULT([yes - MAR-based online update])
11413         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11414         if test "$with_update_config" = ""; then
11415             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11416         fi
11417         UPDATE_CONFIG="$with_update_config"
11418         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11419     elif test "$enable_online_update" = "yes"; then
11420         AC_MSG_RESULT([yes])
11421         ENABLE_ONLINE_UPDATE="TRUE"
11422     else
11423         AC_MSG_RESULT([no])
11424     fi
11426 AC_SUBST(ENABLE_ONLINE_UPDATE)
11427 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11428 AC_SUBST(UPDATE_CONFIG)
11430 dnl ===================================================================
11431 dnl Test whether we need bzip2
11432 dnl ===================================================================
11433 SYSTEM_BZIP2=
11434 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11435     AC_MSG_CHECKING([whether to use system bzip2])
11436     if test "$with_system_bzip2" = yes; then
11437         SYSTEM_BZIP2=TRUE
11438         AC_MSG_RESULT([yes])
11439         PKG_CHECK_MODULES(BZIP2, bzip2)
11440         FilterLibs "${BZIP2_LIBS}"
11441         BZIP2_LIBS="${filteredlibs}"
11442     else
11443         AC_MSG_RESULT([no])
11444         BUILD_TYPE="$BUILD_TYPE BZIP2"
11445     fi
11447 AC_SUBST(SYSTEM_BZIP2)
11448 AC_SUBST(BZIP2_CFLAGS)
11449 AC_SUBST(BZIP2_LIBS)
11451 dnl ===================================================================
11452 dnl Test whether to enable extension update
11453 dnl ===================================================================
11454 AC_MSG_CHECKING([whether to enable extension update])
11455 ENABLE_EXTENSION_UPDATE=
11456 if test "x$enable_extension_update" = "xno"; then
11457     AC_MSG_RESULT([no])
11458 else
11459     AC_MSG_RESULT([yes])
11460     ENABLE_EXTENSION_UPDATE="TRUE"
11461     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11462     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11464 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11467 dnl ===================================================================
11468 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11469 dnl ===================================================================
11470 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11471 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11472     AC_MSG_RESULT([no])
11473     ENABLE_SILENT_MSI=
11474 else
11475     AC_MSG_RESULT([yes])
11476     ENABLE_SILENT_MSI=TRUE
11477     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11479 AC_SUBST(ENABLE_SILENT_MSI)
11481 AC_MSG_CHECKING([whether and how to use Xinerama])
11482 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11483     if test "$x_libraries" = "default_x_libraries"; then
11484         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11485         if test "x$XINERAMALIB" = x; then
11486            XINERAMALIB="/usr/lib"
11487         fi
11488     else
11489         XINERAMALIB="$x_libraries"
11490     fi
11491     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11492         # we have both versions, let the user decide but use the dynamic one
11493         # per default
11494         USE_XINERAMA=TRUE
11495         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11496             XINERAMA_LINK=dynamic
11497         else
11498             XINERAMA_LINK=static
11499         fi
11500     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11501         # we have only the dynamic version
11502         USE_XINERAMA=TRUE
11503         XINERAMA_LINK=dynamic
11504     elif test -e "$XINERAMALIB/libXinerama.a"; then
11505         # static version
11506         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11507             USE_XINERAMA=TRUE
11508             XINERAMA_LINK=static
11509         else
11510             USE_XINERAMA=
11511             XINERAMA_LINK=none
11512         fi
11513     else
11514         # no Xinerama
11515         USE_XINERAMA=
11516         XINERAMA_LINK=none
11517     fi
11518     if test "$USE_XINERAMA" = "TRUE"; then
11519         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11520         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11521             [AC_MSG_ERROR(Xinerama header not found.)], [])
11522         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11523         if test "x$XEXTLIB" = x; then
11524            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11525         fi
11526         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11527         if test "$_os" = "FreeBSD"; then
11528             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11529         fi
11530         if test "$_os" = "Linux"; then
11531             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11532         fi
11533         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11534             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11535     else
11536         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11537     fi
11538 else
11539     USE_XINERAMA=
11540     XINERAMA_LINK=none
11541     AC_MSG_RESULT([no])
11543 AC_SUBST(USE_XINERAMA)
11544 AC_SUBST(XINERAMA_LINK)
11546 dnl ===================================================================
11547 dnl Test whether to build cairo or rely on the system version
11548 dnl ===================================================================
11550 if test "$USING_X11" = TRUE; then
11551     # Used in vcl/Library_vclplug_gen.mk
11552     test_cairo=yes
11555 if test "$test_cairo" = "yes"; then
11556     AC_MSG_CHECKING([whether to use the system cairo])
11558     : ${with_system_cairo:=$with_system_libs}
11559     if test "$with_system_cairo" = "yes"; then
11560         SYSTEM_CAIRO=TRUE
11561         AC_MSG_RESULT([yes])
11563         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11564         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11565         FilterLibs "${CAIRO_LIBS}"
11566         CAIRO_LIBS="${filteredlibs}"
11568         if test "$test_xrender" = "yes"; then
11569             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11570             AC_LANG_PUSH([C])
11571             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11572 #ifdef PictStandardA8
11573 #else
11574       return fail;
11575 #endif
11576 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11578             AC_LANG_POP([C])
11579         fi
11580     else
11581         SYSTEM_CAIRO=
11582         AC_MSG_RESULT([no])
11584         BUILD_TYPE="$BUILD_TYPE CAIRO"
11585     fi
11588 AC_SUBST(SYSTEM_CAIRO)
11589 AC_SUBST(CAIRO_CFLAGS)
11590 AC_SUBST(CAIRO_LIBS)
11592 dnl ===================================================================
11593 dnl Test whether to use avahi
11594 dnl ===================================================================
11595 if test "$_os" = "WINNT"; then
11596     # Windows uses bundled mDNSResponder
11597     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11598 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11599     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11600                       [ENABLE_AVAHI="TRUE"])
11601     AC_DEFINE(HAVE_FEATURE_AVAHI)
11602     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11603     FilterLibs "${AVAHI_LIBS}"
11604     AVAHI_LIBS="${filteredlibs}"
11607 AC_SUBST(ENABLE_AVAHI)
11608 AC_SUBST(AVAHI_CFLAGS)
11609 AC_SUBST(AVAHI_LIBS)
11611 dnl ===================================================================
11612 dnl Test whether to use liblangtag
11613 dnl ===================================================================
11614 SYSTEM_LIBLANGTAG=
11615 AC_MSG_CHECKING([whether to use system liblangtag])
11616 if test "$with_system_liblangtag" = yes; then
11617     SYSTEM_LIBLANGTAG=TRUE
11618     AC_MSG_RESULT([yes])
11619     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11620     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11621     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11622     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11623     FilterLibs "${LIBLANGTAG_LIBS}"
11624     LIBLANGTAG_LIBS="${filteredlibs}"
11625 else
11626     SYSTEM_LIBLANGTAG=
11627     AC_MSG_RESULT([no])
11628     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11629     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11630     if test "$COM" = "MSC"; then
11631         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11632     else
11633         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11634     fi
11636 AC_SUBST(SYSTEM_LIBLANGTAG)
11637 AC_SUBST(LIBLANGTAG_CFLAGS)
11638 AC_SUBST(LIBLANGTAG_LIBS)
11640 dnl ===================================================================
11641 dnl Test whether to build libpng or rely on the system version
11642 dnl ===================================================================
11644 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11646 dnl ===================================================================
11647 dnl Check for runtime JVM search path
11648 dnl ===================================================================
11649 if test "$ENABLE_JAVA" != ""; then
11650     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11651     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11652         AC_MSG_RESULT([yes])
11653         if ! test -d "$with_jvm_path"; then
11654             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11655         fi
11656         if ! test -d "$with_jvm_path"jvm; then
11657             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11658         fi
11659         JVM_ONE_PATH_CHECK="$with_jvm_path"
11660         AC_SUBST(JVM_ONE_PATH_CHECK)
11661     else
11662         AC_MSG_RESULT([no])
11663     fi
11666 dnl ===================================================================
11667 dnl Test for the presence of Ant and that it works
11668 dnl ===================================================================
11670 if test "$ENABLE_JAVA" != ""; then
11671     ANT_HOME=; export ANT_HOME
11672     WITH_ANT_HOME=; export WITH_ANT_HOME
11673     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11674         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11675             if test "$_os" = "WINNT"; then
11676                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11677             else
11678                 with_ant_home="$LODE_HOME/opt/ant"
11679             fi
11680         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11681             with_ant_home="$LODE_HOME/opt/ant"
11682         fi
11683     fi
11684     if test -z "$with_ant_home"; then
11685         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11686     else
11687         if test "$_os" = "WINNT"; then
11688             # AC_PATH_PROGS needs unix path
11689             with_ant_home=`cygpath -u "$with_ant_home"`
11690         fi
11691         AbsolutePath "$with_ant_home"
11692         with_ant_home=$absolute_path
11693         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11694         WITH_ANT_HOME=$with_ant_home
11695         ANT_HOME=$with_ant_home
11696     fi
11698     if test -z "$ANT"; then
11699         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11700     else
11701         # resolve relative or absolute symlink
11702         while test -h "$ANT"; do
11703             a_cwd=`pwd`
11704             a_basename=`basename "$ANT"`
11705             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11706             cd "`dirname "$ANT"`"
11707             cd "`dirname "$a_script"`"
11708             ANT="`pwd`"/"`basename "$a_script"`"
11709             cd "$a_cwd"
11710         done
11712         AC_MSG_CHECKING([if $ANT works])
11713         cat > conftest.java << EOF
11714         public class conftest {
11715             int testmethod(int a, int b) {
11716                     return a + b;
11717             }
11718         }
11721         cat > conftest.xml << EOF
11722         <project name="conftest" default="conftest">
11723         <target name="conftest">
11724             <javac srcdir="." includes="conftest.java">
11725             </javac>
11726         </target>
11727         </project>
11730         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11731         if test $? = 0 -a -f ./conftest.class; then
11732             AC_MSG_RESULT([Ant works])
11733             if test -z "$WITH_ANT_HOME"; then
11734                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11735                 if test -z "$ANT_HOME"; then
11736                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11737                 fi
11738             else
11739                 ANT_HOME="$WITH_ANT_HOME"
11740             fi
11741         else
11742             echo "configure: Ant test failed" >&5
11743             cat conftest.java >&5
11744             cat conftest.xml >&5
11745             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11746         fi
11747         rm -f conftest* core core.* *.core
11748     fi
11749     if test -z "$ANT_HOME"; then
11750         ANT_HOME="NO_ANT_HOME"
11751     else
11752         PathFormat "$ANT_HOME"
11753         ANT_HOME="$formatted_path"
11754         PathFormat "$ANT"
11755         ANT="$formatted_path"
11756     fi
11757     AC_SUBST(ANT_HOME)
11758     AC_SUBST(ANT)
11760     dnl Checking for ant.jar
11761     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11762         AC_MSG_CHECKING([Ant lib directory])
11763         if test -f $ANT_HOME/lib/ant.jar; then
11764             ANT_LIB="$ANT_HOME/lib"
11765         else
11766             if test -f $ANT_HOME/ant.jar; then
11767                 ANT_LIB="$ANT_HOME"
11768             else
11769                 if test -f /usr/share/java/ant.jar; then
11770                     ANT_LIB=/usr/share/java
11771                 else
11772                     if test -f /usr/share/ant-core/lib/ant.jar; then
11773                         ANT_LIB=/usr/share/ant-core/lib
11774                     else
11775                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11776                             ANT_LIB="$ANT_HOME/lib/ant"
11777                         else
11778                             if test -f /usr/share/lib/ant/ant.jar; then
11779                                 ANT_LIB=/usr/share/lib/ant
11780                             else
11781                                 AC_MSG_ERROR([Ant libraries not found!])
11782                             fi
11783                         fi
11784                     fi
11785                 fi
11786             fi
11787         fi
11788         PathFormat "$ANT_LIB"
11789         ANT_LIB="$formatted_path"
11790         AC_MSG_RESULT([Ant lib directory found.])
11791     fi
11792     AC_SUBST(ANT_LIB)
11794     ant_minver=1.6.0
11795     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11797     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11798     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11799     ant_version_major=`echo $ant_version | cut -d. -f1`
11800     ant_version_minor=`echo $ant_version | cut -d. -f2`
11801     echo "configure: ant_version $ant_version " >&5
11802     echo "configure: ant_version_major $ant_version_major " >&5
11803     echo "configure: ant_version_minor $ant_version_minor " >&5
11804     if test "$ant_version_major" -ge "2"; then
11805         AC_MSG_RESULT([yes, $ant_version])
11806     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11807         AC_MSG_RESULT([yes, $ant_version])
11808     else
11809         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11810     fi
11812     rm -f conftest* core core.* *.core
11815 OOO_JUNIT_JAR=
11816 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11817     AC_MSG_CHECKING([for JUnit 4])
11818     if test "$with_junit" = "yes"; then
11819         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
11820             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
11821         elif test -e /usr/share/java/junit4.jar; then
11822             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11823         else
11824            if test -e /usr/share/lib/java/junit.jar; then
11825               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11826            else
11827               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11828            fi
11829         fi
11830     else
11831         OOO_JUNIT_JAR=$with_junit
11832     fi
11833     if test "$_os" = "WINNT"; then
11834         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11835     fi
11836     printf 'import org.junit.Before;' > conftest.java
11837     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11838         AC_MSG_RESULT([$OOO_JUNIT_JAR])
11839     else
11840         AC_MSG_ERROR(
11841 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
11842  specify its pathname via --with-junit=..., or disable it via --without-junit])
11843     fi
11844     rm -f conftest.class conftest.java
11845     if test $OOO_JUNIT_JAR != ""; then
11846     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11847     fi
11849 AC_SUBST(OOO_JUNIT_JAR)
11851 HAMCREST_JAR=
11852 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11853     AC_MSG_CHECKING([for included Hamcrest])
11854     printf 'import org.hamcrest.BaseDescription;' > conftest.java
11855     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11856         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
11857     else
11858         AC_MSG_RESULT([Not included])
11859         AC_MSG_CHECKING([for standalone hamcrest jar.])
11860         if test "$with_hamcrest" = "yes"; then
11861             if test -e /usr/share/lib/java/hamcrest.jar; then
11862                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
11863             elif test -e /usr/share/java/hamcrest/core.jar; then
11864                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
11865             else
11866                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
11867             fi
11868         else
11869             HAMCREST_JAR=$with_hamcrest
11870         fi
11871         if test "$_os" = "WINNT"; then
11872             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
11873         fi
11874         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
11875             AC_MSG_RESULT([$HAMCREST_JAR])
11876         else
11877             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),
11878                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
11879         fi
11880     fi
11881     rm -f conftest.class conftest.java
11883 AC_SUBST(HAMCREST_JAR)
11886 AC_SUBST(SCPDEFS)
11889 # check for wget and curl
11891 WGET=
11892 CURL=
11894 if test "$enable_fetch_external" != "no"; then
11896 CURL=`which curl 2>/dev/null`
11898 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
11899     # wget new enough?
11900     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
11901     if test $? -eq 0; then
11902         WGET=$i
11903         break
11904     fi
11905 done
11907 if test -z "$WGET" -a -z "$CURL"; then
11908     AC_MSG_ERROR([neither wget nor curl found!])
11913 AC_SUBST(WGET)
11914 AC_SUBST(CURL)
11917 # check for sha256sum
11919 SHA256SUM=
11921 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
11922     eval "$i -a 256 --version" > /dev/null 2>&1
11923     ret=$?
11924     if test $ret -eq 0; then
11925         SHA256SUM="$i -a 256"
11926         break
11927     fi
11928 done
11930 if test -z "$SHA256SUM"; then
11931     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
11932         eval "$i --version" > /dev/null 2>&1
11933         ret=$?
11934         if test $ret -eq 0; then
11935             SHA256SUM=$i
11936             break
11937         fi
11938     done
11941 if test -z "$SHA256SUM"; then
11942     AC_MSG_ERROR([no sha256sum found!])
11945 AC_SUBST(SHA256SUM)
11947 dnl ===================================================================
11948 dnl Dealing with l10n options
11949 dnl ===================================================================
11950 AC_MSG_CHECKING([which languages to be built])
11951 # get list of all languages
11952 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
11953 # the sed command does the following:
11954 #   + if a line ends with a backslash, append the next line to it
11955 #   + adds " on the beginning of the value (after =)
11956 #   + adds " at the end of the value
11957 #   + removes en-US; we want to put it on the beginning
11958 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
11959 [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)]
11960 ALL_LANGS="en-US $completelangiso"
11961 # check the configured localizations
11962 WITH_LANG="$with_lang"
11963 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
11964     AC_MSG_RESULT([en-US])
11965 else
11966     AC_MSG_RESULT([$WITH_LANG])
11967     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
11968     if test -z "$MSGFMT"; then
11969         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
11970             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
11971         elif test -x "/opt/lo/bin/msgfmt"; then
11972             MSGFMT="/opt/lo/bin/msgfmt"
11973         else
11974             AC_CHECK_PROGS(MSGFMT, [msgfmt])
11975             if test -z "$MSGFMT"; then
11976                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
11977             fi
11978         fi
11979     fi
11980     if test -z "$MSGUNIQ"; then
11981         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
11982             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
11983         elif test -x "/opt/lo/bin/msguniq"; then
11984             MSGUNIQ="/opt/lo/bin/msguniq"
11985         else
11986             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
11987             if test -z "$MSGUNIQ"; then
11988                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
11989             fi
11990         fi
11991     fi
11993 AC_SUBST(MSGFMT)
11994 AC_SUBST(MSGUNIQ)
11995 # check that the list is valid
11996 for lang in $WITH_LANG; do
11997     test "$lang" = "ALL" && continue
11998     # need to check for the exact string, so add space before and after the list of all languages
11999     for vl in $ALL_LANGS; do
12000         if test "$vl" = "$lang"; then
12001            break
12002         fi
12003     done
12004     if test "$vl" != "$lang"; then
12005         # if you're reading this - you prolly quoted your languages remove the quotes ...
12006         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12007     fi
12008 done
12009 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12010     echo $WITH_LANG | grep -q en-US
12011     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12013 # list with substituted ALL
12014 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12015 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12016 test "$WITH_LANG" = "en-US" && WITH_LANG=
12017 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12018     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12019     ALL_LANGS=`echo $ALL_LANGS qtz`
12021 AC_SUBST(ALL_LANGS)
12022 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12023 AC_SUBST(WITH_LANG)
12024 AC_SUBST(WITH_LANG_LIST)
12025 AC_SUBST(GIT_NEEDED_SUBMODULES)
12027 WITH_POOR_HELP_LOCALIZATIONS=
12028 if test -d "$SRC_ROOT/translations/source"; then
12029     for l in `ls -1 $SRC_ROOT/translations/source`; do
12030         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12031             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12032         fi
12033     done
12035 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12037 if test -n "$with_locales"; then
12038     WITH_LOCALES="$with_locales"
12040     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12041     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12042     # config_host/config_locales.h.in
12043     for locale in $WITH_LOCALES; do
12044         lang=${locale%_*}
12046         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12048         case $lang in
12049         hi|mr*ne)
12050             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12051             ;;
12052         bg|ru)
12053             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12054             ;;
12055         esac
12056     done
12057 else
12058     AC_DEFINE(WITH_LOCALE_ALL)
12060 AC_SUBST(WITH_LOCALES)
12062 dnl git submodule update --reference
12063 dnl ===================================================================
12064 if test -n "${GIT_REFERENCE_SRC}"; then
12065     for repo in ${GIT_NEEDED_SUBMODULES}; do
12066         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12067             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12068         fi
12069     done
12071 AC_SUBST(GIT_REFERENCE_SRC)
12073 dnl git submodules linked dirs
12074 dnl ===================================================================
12075 if test -n "${GIT_LINK_SRC}"; then
12076     for repo in ${GIT_NEEDED_SUBMODULES}; do
12077         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12078             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12079         fi
12080     done
12082 AC_SUBST(GIT_LINK_SRC)
12084 dnl branding
12085 dnl ===================================================================
12086 AC_MSG_CHECKING([for alternative branding images directory])
12087 # initialize mapped arrays
12088 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12089 brand_files="$BRAND_INTRO_IMAGES about.svg"
12091 if test -z "$with_branding" -o "$with_branding" = "no"; then
12092     AC_MSG_RESULT([none])
12093     DEFAULT_BRAND_IMAGES="$brand_files"
12094 else
12095     if ! test -d $with_branding ; then
12096         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12097     else
12098         AC_MSG_RESULT([$with_branding])
12099         CUSTOM_BRAND_DIR="$with_branding"
12100         for lfile in $brand_files
12101         do
12102             if ! test -f $with_branding/$lfile ; then
12103                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12104                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12105             else
12106                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12107             fi
12108         done
12109         check_for_progress="yes"
12110     fi
12112 AC_SUBST([BRAND_INTRO_IMAGES])
12113 AC_SUBST([CUSTOM_BRAND_DIR])
12114 AC_SUBST([CUSTOM_BRAND_IMAGES])
12115 AC_SUBST([DEFAULT_BRAND_IMAGES])
12118 AC_MSG_CHECKING([for 'intro' progress settings])
12119 PROGRESSBARCOLOR=
12120 PROGRESSSIZE=
12121 PROGRESSPOSITION=
12122 PROGRESSFRAMECOLOR=
12123 PROGRESSTEXTCOLOR=
12124 PROGRESSTEXTBASELINE=
12126 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12127     source "$with_branding/progress.conf"
12128     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12129 else
12130     AC_MSG_RESULT([none])
12133 AC_SUBST(PROGRESSBARCOLOR)
12134 AC_SUBST(PROGRESSSIZE)
12135 AC_SUBST(PROGRESSPOSITION)
12136 AC_SUBST(PROGRESSFRAMECOLOR)
12137 AC_SUBST(PROGRESSTEXTCOLOR)
12138 AC_SUBST(PROGRESSTEXTBASELINE)
12141 AC_MSG_CHECKING([for extra build ID])
12142 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12143     EXTRA_BUILDID="$with_extra_buildid"
12145 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12146 if test -n "$EXTRA_BUILDID" ; then
12147     AC_MSG_RESULT([$EXTRA_BUILDID])
12148 else
12149     AC_MSG_RESULT([not set])
12151 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12153 OOO_VENDOR=
12154 AC_MSG_CHECKING([for vendor])
12155 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12156     OOO_VENDOR="$USERNAME"
12158     if test -z "$OOO_VENDOR"; then
12159         OOO_VENDOR="$USER"
12160     fi
12162     if test -z "$OOO_VENDOR"; then
12163         OOO_VENDOR="`id -u -n`"
12164     fi
12166     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12167 else
12168     OOO_VENDOR="$with_vendor"
12169     AC_MSG_RESULT([$OOO_VENDOR])
12171 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12172 AC_SUBST(OOO_VENDOR)
12174 if test "$_os" = "Android" ; then
12175     ANDROID_PACKAGE_NAME=
12176     AC_MSG_CHECKING([for Android package name])
12177     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12178         if test -n "$ENABLE_DEBUG"; then
12179             # Default to the package name that makes ndk-gdb happy.
12180             ANDROID_PACKAGE_NAME="org.libreoffice"
12181         else
12182             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12183         fi
12185         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12186     else
12187         ANDROID_PACKAGE_NAME="$with_android_package_name"
12188         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12189     fi
12190     AC_SUBST(ANDROID_PACKAGE_NAME)
12193 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12194 if test "$with_compat_oowrappers" = "yes"; then
12195     WITH_COMPAT_OOWRAPPERS=TRUE
12196     AC_MSG_RESULT(yes)
12197 else
12198     WITH_COMPAT_OOWRAPPERS=
12199     AC_MSG_RESULT(no)
12201 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12203 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12204 AC_MSG_CHECKING([for install dirname])
12205 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12206     INSTALLDIRNAME="$with_install_dirname"
12208 AC_MSG_RESULT([$INSTALLDIRNAME])
12209 AC_SUBST(INSTALLDIRNAME)
12211 AC_MSG_CHECKING([for prefix])
12212 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12213 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12214 PREFIXDIR="$prefix"
12215 AC_MSG_RESULT([$PREFIXDIR])
12216 AC_SUBST(PREFIXDIR)
12218 LIBDIR=[$(eval echo $(eval echo $libdir))]
12219 AC_SUBST(LIBDIR)
12221 DATADIR=[$(eval echo $(eval echo $datadir))]
12222 AC_SUBST(DATADIR)
12224 MANDIR=[$(eval echo $(eval echo $mandir))]
12225 AC_SUBST(MANDIR)
12227 DOCDIR=[$(eval echo $(eval echo $docdir))]
12228 AC_SUBST(DOCDIR)
12230 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12231 AC_SUBST(INSTALLDIR)
12233 TESTINSTALLDIR="${BUILDDIR}/test-install"
12234 AC_SUBST(TESTINSTALLDIR)
12237 # ===================================================================
12238 # OAuth2 id and secrets
12239 # ===================================================================
12241 AC_MSG_CHECKING([for Google Drive client id and secret])
12242 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12243     AC_MSG_RESULT([not set])
12244     GDRIVE_CLIENT_ID="\"\""
12245     GDRIVE_CLIENT_SECRET="\"\""
12246 else
12247     AC_MSG_RESULT([set])
12248     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12249     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12251 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12252 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12254 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12255 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12256     AC_MSG_RESULT([not set])
12257     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12258     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12259 else
12260     AC_MSG_RESULT([set])
12261     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12262     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12264 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12265 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12267 AC_MSG_CHECKING([for OneDrive client id and secret])
12268 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12269     AC_MSG_RESULT([not set])
12270     ONEDRIVE_CLIENT_ID="\"\""
12271     ONEDRIVE_CLIENT_SECRET="\"\""
12272 else
12273     AC_MSG_RESULT([set])
12274     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12275     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12277 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12278 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12281 dnl ===================================================================
12282 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12283 dnl --enable-dependency-tracking configure option
12284 dnl ===================================================================
12285 AC_MSG_CHECKING([whether to enable dependency tracking])
12286 if test "$enable_dependency_tracking" = "no"; then
12287     nodep=TRUE
12288     AC_MSG_RESULT([no])
12289 else
12290     AC_MSG_RESULT([yes])
12292 AC_SUBST(nodep)
12294 dnl ===================================================================
12295 dnl Number of CPUs to use during the build
12296 dnl ===================================================================
12297 AC_MSG_CHECKING([for number of processors to use])
12298 # plain --with-parallelism is just the default
12299 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12300     if test "$with_parallelism" = "no"; then
12301         PARALLELISM=0
12302     else
12303         PARALLELISM=$with_parallelism
12304     fi
12305 else
12306     if test "$enable_icecream" = "yes"; then
12307         PARALLELISM="10"
12308     else
12309         case `uname -s` in
12311         Darwin|FreeBSD|NetBSD|OpenBSD)
12312             PARALLELISM=`sysctl -n hw.ncpu`
12313             ;;
12315         Linux)
12316             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12317         ;;
12318         # what else than above does profit here *and* has /proc?
12319         *)
12320             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12321             ;;
12322         esac
12324         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12325         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12326     fi
12329 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12330     if test -z "$with_parallelism"; then
12331             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12332             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12333             PARALLELISM="1"
12334     else
12335         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."
12336     fi
12339 if test $PARALLELISM -eq 0; then
12340     AC_MSG_RESULT([explicit make -j option needed])
12341 else
12342     AC_MSG_RESULT([$PARALLELISM])
12344 AC_SUBST(PARALLELISM)
12346 IWYU_PATH="$with_iwyu"
12347 AC_SUBST(IWYU_PATH)
12348 if test ! -z "$IWYU_PATH"; then
12349     if test ! -f "$IWYU_PATH"; then
12350         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12351     fi
12355 # Set up ILIB for MSVC build
12357 ILIB1=
12358 if test "$build_os" = "cygwin"; then
12359     ILIB="."
12360     if test -n "$JAVA_HOME"; then
12361         ILIB="$ILIB;$JAVA_HOME/lib"
12362     fi
12363     ILIB1=-link
12364     if test "$BITNESS_OVERRIDE" = 64; then
12365         if test $vcnum = "150"; then
12366             ILIB="$ILIB;$COMPATH/lib/x64"
12367             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12368         else
12369             ILIB="$ILIB;$COMPATH/lib/amd64"
12370             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/amd64"
12371         fi
12372         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12373         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12374         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12375             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12376             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12377         fi
12378         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12379         ucrtlibpath_formatted=$formatted_path
12380         ILIB="$ILIB;$ucrtlibpath_formatted"
12381         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12382     else
12383         if test $vcnum = "150"; then
12384             ILIB="$ILIB;$COMPATH/lib/x86"
12385             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12386         else
12387             ILIB="$ILIB;$COMPATH/lib"
12388             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib"
12389         fi
12390         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12391         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12392         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12393             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12394             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12395         fi
12396         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12397         ucrtlibpath_formatted=$formatted_path
12398         ILIB="$ILIB;$ucrtlibpath_formatted"
12399         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12400     fi
12401     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12402         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12403     else
12404         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12405     fi
12407     AC_SUBST(ILIB)
12410 dnl We should be able to drop the below check when bumping the GCC baseline to
12411 dnl 4.9, as <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54577>
12412 dnl "deque<T>::erase() still takes iterator instead of const_iterator" should be
12413 dnl fixed there with <https://gcc.gnu.org/git/?p=gcc.git;a=commit;
12414 dnl h=6b0e18ca48bb4b4c01e7b5be2b98849943fdcf91>:
12415 AC_MSG_CHECKING(
12416     [whether C++11 use of const_iterator in standard containers is broken])
12417 save_CXXFLAGS=$CXXFLAGS
12418 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12419 AC_LANG_PUSH([C++])
12420 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12421     #include <list>
12422     ]],[[
12423         std::list<int> l;
12424         l.erase(l.cbegin());
12425     ]])],
12426     [broken=no], [broken=yes])
12427 AC_LANG_POP([C++])
12428 CXXFLAGS=$save_CXXFLAGS
12429 AC_MSG_RESULT([$broken])
12430 if test "$broken" = yes; then
12431     AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
12435 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12436 save_CXXFLAGS=$CXXFLAGS
12437 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12438 save_LIBS=$LIBS
12439 if test -n "$ILIB1"; then
12440     LIBS="$LIBS $ILIB1"
12442 AC_LANG_PUSH([C++])
12443 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12444     // Exit with failure if the static initializer_list is stored on the
12445     // stack (as done by Clang < 3.4):
12446     #include <initializer_list>
12447     struct S {};
12448     bool g(void const * p1, void const * p2) {
12449         int n;
12450         return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12451     }
12452     bool f(void const * p1) {
12453         static std::initializer_list<S> s { S() };
12454         return g(p1, s.begin());
12455     }
12456     ]],[[
12457         int n;
12458         return f(&n) ? 0 : 1;
12459     ]])], [broken=no], [broken=yes],[broken='assuming not (cross-compiling)'])
12460 AC_LANG_POP([C++])
12461 LIBS=$save_LIBS
12462 CXXFLAGS=$save_CXXFLAGS
12463 AC_MSG_RESULT([$broken])
12464 if test "$broken" = yes -a "$_os" != "iOS"; then
12465     AC_MSG_ERROR([working support for static initializer_list needed])
12469 # ===================================================================
12470 # Creating bigger shared library to link against
12471 # ===================================================================
12472 AC_MSG_CHECKING([whether to create huge library])
12473 MERGELIBS=
12475 if test $_os = iOS -o $_os = Android; then
12476     # Never any point in mergelibs for these as we build just static
12477     # libraries anyway...
12478     enable_mergelibs=no
12481 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12482     if test $_os != Linux -a $_os != WINNT; then
12483         add_warning "--enable-mergelibs is not tested for this platform"
12484     fi
12485     MERGELIBS="TRUE"
12486     AC_MSG_RESULT([yes])
12487 else
12488     AC_MSG_RESULT([no])
12490 AC_SUBST([MERGELIBS])
12492 dnl ===================================================================
12493 dnl icerun is a wrapper that stops us spawning tens of processes
12494 dnl locally - for tools that can't be executed on the compile cluster
12495 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12496 dnl ===================================================================
12497 AC_MSG_CHECKING([whether to use icerun wrapper])
12498 ICECREAM_RUN=
12499 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12500     ICECREAM_RUN=icerun
12501     AC_MSG_RESULT([yes])
12502 else
12503     AC_MSG_RESULT([no])
12505 AC_SUBST(ICECREAM_RUN)
12507 dnl ===================================================================
12508 dnl Setup the ICECC_VERSION for the build the same way it was set for
12509 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12510 dnl ===================================================================
12511 x_ICECC_VERSION=[\#]
12512 if test -n "$ICECC_VERSION" ; then
12513     x_ICECC_VERSION=
12515 AC_SUBST(x_ICECC_VERSION)
12516 AC_SUBST(ICECC_VERSION)
12518 dnl ===================================================================
12520 AC_MSG_CHECKING([MPL subset])
12521 MPL_SUBSET=
12523 if test "$enable_mpl_subset" = "yes"; then
12524     warn_report=false
12525     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12526         warn_report=true
12527     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12528         warn_report=true
12529     fi
12530     if test "$warn_report" = "true"; then
12531         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12532     fi
12533     if test "x$enable_postgresql_sdbc" != "xno"; then
12534         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12535     fi
12536     if test "$enable_lotuswordpro" = "yes"; then
12537         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12538     fi
12539     if test "$WITH_WEBDAV" = "neon"; then
12540         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12541     fi
12542     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12543         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12544     fi
12545     if test -n "$ENABLE_PDFIMPORT"; then
12546         if test "x$SYSTEM_POPPLER" = "x"; then
12547             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12548         fi
12549     fi
12550     # cf. m4/libo_check_extension.m4
12551     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12552         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12553     fi
12554     for theme in $WITH_THEMES; do
12555         case $theme in
12556         breeze|breeze_dark|sifr|sifr_dark|elementary|karasa_jaga) #blacklist of icon themes under GPL or LGPL
12557             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12558         *) : ;;
12559         esac
12560     done
12562     ENABLE_OPENGL_TRANSITIONS=
12564     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12565         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12566     fi
12568     MPL_SUBSET="TRUE"
12569     AC_DEFINE(MPL_HAVE_SUBSET)
12570     AC_MSG_RESULT([only])
12571 else
12572     AC_MSG_RESULT([no restrictions])
12574 AC_SUBST(MPL_SUBSET)
12576 dnl ===================================================================
12578 AC_MSG_CHECKING([formula logger])
12579 ENABLE_FORMULA_LOGGER=
12581 if test "x$enable_formula_logger" = "xyes"; then
12582     AC_MSG_RESULT([yes])
12583     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12584     ENABLE_FORMULA_LOGGER=TRUE
12585 elif test -n "$ENABLE_DBGUTIL" ; then
12586     AC_MSG_RESULT([yes])
12587     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12588     ENABLE_FORMULA_LOGGER=TRUE
12589 else
12590     AC_MSG_RESULT([no])
12593 AC_SUBST(ENABLE_FORMULA_LOGGER)
12595 dnl ===================================================================
12596 dnl Setting up the environment.
12597 dnl ===================================================================
12598 AC_MSG_NOTICE([setting up the build environment variables...])
12600 AC_SUBST(COMPATH)
12602 if test "$build_os" = "cygwin"; then
12603     if test -d "$COMPATH/atlmfc/lib"; then
12604         ATL_LIB="$COMPATH/atlmfc/lib"
12605         ATL_INCLUDE="$COMPATH/atlmfc/include"
12606     else
12607         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12608         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12609     fi
12610     if test "$BITNESS_OVERRIDE" = 64; then
12611         if test $VCVER = "150"; then
12612             ATL_LIB="$ATL_LIB/x64"
12613         else
12614             ATL_LIB="$ATL_LIB/amd64"
12615         fi
12616     else
12617         if test $VCVER = "150"; then
12618             ATL_LIB="$ATL_LIB/x86"
12619         fi
12620     fi
12621     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12622     PathFormat "/usr/bin/find.exe"
12623     FIND="$formatted_path"
12624     PathFormat "/usr/bin/sort.exe"
12625     SORT="$formatted_path"
12626     PathFormat "/usr/bin/grep.exe"
12627     WIN_GREP="$formatted_path"
12628     PathFormat "/usr/bin/ls.exe"
12629     WIN_LS="$formatted_path"
12630     PathFormat "/usr/bin/touch.exe"
12631     WIN_TOUCH="$formatted_path"
12632 else
12633     FIND=find
12634     SORT=sort
12637 AC_SUBST(ATL_INCLUDE)
12638 AC_SUBST(ATL_LIB)
12639 AC_SUBST(FIND)
12640 AC_SUBST(SORT)
12641 AC_SUBST(WIN_GREP)
12642 AC_SUBST(WIN_LS)
12643 AC_SUBST(WIN_TOUCH)
12645 AC_SUBST(BUILD_TYPE)
12647 AC_SUBST(SOLARINC)
12649 PathFormat "$PERL"
12650 PERL="$formatted_path"
12651 AC_SUBST(PERL)
12653 if test -n "$TMPDIR"; then
12654     TEMP_DIRECTORY="$TMPDIR"
12655 else
12656     TEMP_DIRECTORY="/tmp"
12658 if test "$build_os" = "cygwin"; then
12659     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12661 AC_SUBST(TEMP_DIRECTORY)
12663 # setup the PATH for the environment
12664 if test -n "$LO_PATH_FOR_BUILD"; then
12665     LO_PATH="$LO_PATH_FOR_BUILD"
12666 else
12667     LO_PATH="$PATH"
12669     case "$host_os" in
12671     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12672         if test "$ENABLE_JAVA" != ""; then
12673             pathmunge "$JAVA_HOME/bin" "after"
12674         fi
12675         ;;
12677     cygwin*)
12678         # Win32 make needs native paths
12679         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12680             LO_PATH=`cygpath -p -m "$PATH"`
12681         fi
12682         if test "$BITNESS_OVERRIDE" = 64; then
12683             # needed for msi packaging
12684             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12685         fi
12686         # .NET 4.6 and higher don't have bin directory
12687         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12688             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12689         fi
12690         pathmunge "$ASM_HOME" "before"
12691         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12692         pathmunge "$CSC_PATH" "before"
12693         pathmunge "$MIDL_PATH" "before"
12694         pathmunge "$AL_PATH" "before"
12695         pathmunge "$MSPDB_PATH" "before"
12696         if test -n "$MSBUILD_PATH" ; then
12697             pathmunge "$MSBUILD_PATH" "before"
12698         fi
12699         if test "$BITNESS_OVERRIDE" = 64; then
12700             pathmunge "$COMPATH/bin/amd64" "before"
12701             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12702         else
12703             pathmunge "$COMPATH/bin" "before"
12704             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12705         fi
12706         if test "$ENABLE_JAVA" != ""; then
12707             if test -d "$JAVA_HOME/jre/bin/client"; then
12708                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12709             fi
12710             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12711                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12712             fi
12713             pathmunge "$JAVA_HOME/bin" "before"
12714         fi
12715         ;;
12717     solaris*)
12718         pathmunge "/usr/css/bin" "before"
12719         if test "$ENABLE_JAVA" != ""; then
12720             pathmunge "$JAVA_HOME/bin" "after"
12721         fi
12722         ;;
12723     esac
12726 AC_SUBST(LO_PATH)
12728 libo_FUZZ_SUMMARY
12730 # Generate a configuration sha256 we can use for deps
12731 if test -f config_host.mk; then
12732     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12734 if test -f config_host_lang.mk; then
12735     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12738 CFLAGS=$my_original_CFLAGS
12739 CXXFLAGS=$my_original_CXXFLAGS
12740 CPPFLAGS=$my_original_CPPFLAGS
12742 AC_CONFIG_FILES([config_host.mk
12743                  config_host_lang.mk
12744                  Makefile
12745                  lo.xcent
12746                  bin/bffvalidator.sh
12747                  bin/odfvalidator.sh
12748                  bin/officeotron.sh
12749                  instsetoo_native/util/openoffice.lst
12750                  sysui/desktop/macosx/Info.plist])
12751 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12752 AC_CONFIG_HEADERS([config_host/config_clang.h])
12753 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12754 AC_CONFIG_HEADERS([config_host/config_eot.h])
12755 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12756 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12757 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12758 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12759 AC_CONFIG_HEADERS([config_host/config_features.h])
12760 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12761 AC_CONFIG_HEADERS([config_host/config_folders.h])
12762 AC_CONFIG_HEADERS([config_host/config_gio.h])
12763 AC_CONFIG_HEADERS([config_host/config_global.h])
12764 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12765 AC_CONFIG_HEADERS([config_host/config_java.h])
12766 AC_CONFIG_HEADERS([config_host/config_langs.h])
12767 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12768 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12769 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12770 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
12771 AC_CONFIG_HEADERS([config_host/config_locales.h])
12772 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12773 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12774 AC_CONFIG_HEADERS([config_host/config_qt5.h])
12775 AC_CONFIG_HEADERS([config_host/config_kde5.h])
12776 AC_CONFIG_HEADERS([config_host/config_gtk3_kde5.h])
12777 AC_CONFIG_HEADERS([config_host/config_oox.h])
12778 AC_CONFIG_HEADERS([config_host/config_options.h])
12779 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12780 AC_CONFIG_HEADERS([config_host/config_test.h])
12781 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12782 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12783 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12784 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12785 AC_CONFIG_HEADERS([config_host/config_version.h])
12786 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12787 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12788 AC_CONFIG_HEADERS([config_host/config_python.h])
12789 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12790 AC_OUTPUT
12792 if test "$CROSS_COMPILING" = TRUE; then
12793     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12796 # touch the config timestamp file
12797 if test ! -f config_host.mk.stamp; then
12798     echo > config_host.mk.stamp
12799 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12800     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12801 else
12802     echo > config_host.mk.stamp
12805 # touch the config lang timestamp file
12806 if test ! -f config_host_lang.mk.stamp; then
12807     echo > config_host_lang.mk.stamp
12808 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12809     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12810 else
12811     echo > config_host_lang.mk.stamp
12815 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12817 cat << _EOS
12818 ****************************************************************************
12819 WARNING:
12820 Your make version is known to be horribly slow, and hard to debug
12821 problems with. To get a reasonably functional make please do:
12823 to install a pre-compiled binary make for Win32
12825  mkdir -p /opt/lo/bin
12826  cd /opt/lo/bin
12827  wget https://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
12828  cp make-85047eb-msvc.exe make
12829  chmod +x make
12831 to install from source:
12832 place yourself in a working directory of you choice.
12834  git clone git://git.savannah.gnu.org/make.git
12836  [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"]
12837  set PATH=%PATH%;C:\Cygwin\bin
12838  [or Cygwin64, if that is what you have]
12839  cd path-to-make-repo-you-cloned-above
12840  build_w32.bat --without-guile
12842 should result in a WinRel/gnumake.exe.
12843 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12845 Then re-run autogen.sh
12847 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12848 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12850 _EOS
12853 cat << _EOF
12854 ****************************************************************************
12856 To build, run:
12857 $GNUMAKE
12859 To view some help, run:
12860 $GNUMAKE help
12862 _EOF
12864 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12865     cat << _EOF
12866 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12867 _EOF
12869     if test $_os = Darwin; then
12870         echo open instdir/$PRODUCTNAME.app
12871     else
12872         echo instdir/program/soffice
12873     fi
12874     cat << _EOF
12876 If you want to run the smoketest, run:
12877 $GNUMAKE check
12879 _EOF
12882 if test -f warn; then
12883     cat warn
12884     rm warn
12887 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: