tdf#106746: pDelPam is a bit special
[LibreOffice.git] / configure.ac
blobfcab984b346d8deae89ea0a18302a036454f5c12
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 102 -*-
2 dnl configure.ac serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 # The version number in the second argument to AC_INIT should be four numbers separated by
6 # periods. Some parts of the code requires the first one to be less than 128 and the others to be less
7 # than 256. The four numbers can optionally be followed by a period and a free-form string containing
8 # no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
9 # several non-alphanumeric characters, those are split off and used only for the
10 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
12 AC_INIT([LibreOffice],[6.1.0.0.alpha0+],[],[],[http://documentfoundation.org/])
14 AC_PREREQ([2.59])
16 if test -n "$BUILD_TYPE"; then
17     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
20 save_CC=$CC
21 save_CXX=$CXX
23 BUILD_TYPE="LibO"
24 SCPDEFS=""
25 GIT_NEEDED_SUBMODULES=""
26 LO_PATH= # used by path_munge to construct a PATH variable
28 FilterLibs()
30     filteredlibs=
31     for f in $1; do
32         case "$f" in
33             # let's start with Fedora's paths for now
34             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
35                 # ignore it: on UNIXoids it is searched by default anyway
36                 # but if it's given explicitly then it may override other paths
37                 # (on Mac OS X it would be an error to use it instead of SDK)
38                 ;;
39             *)
40                 filteredlibs="$filteredlibs $f"
41                 ;;
42         esac
43     done
46 PathFormat()
48     formatted_path="$1"
49     if test "$build_os" = "cygwin"; then
50         pf_conv_to_dos=
51         # spaces,parentheses,brackets,braces are problematic in pathname
52         # so are backslashes
53         case "$formatted_path" in
54             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
55                 pf_conv_to_dos="yes"
56             ;;
57         esac
58         if test "$pf_conv_to_dos" = "yes"; then
59             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
60                 formatted_path=`cygpath -sm "$formatted_path"`
61             else
62                 formatted_path=`cygpath -d "$formatted_path"`
63             fi
64             if test $? -ne 0;  then
65                 AC_MSG_ERROR([path conversion failed for "$1".])
66             fi
67         fi
68         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
69         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
70         if test "$fp_count_slash$fp_count_colon" != "00"; then
71             if test "$fp_count_colon" = "0"; then
72                 new_formatted_path=`realpath "$formatted_path"`
73                 if test $? -ne 0;  then
74                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
75                 else
76                     formatted_path="$new_formatted_path"
77                 fi
78             fi
79             formatted_path=`cygpath -m "$formatted_path"`
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84     fi
87 AbsolutePath()
89     # There appears to be no simple and portable method to get an absolute and
90     # canonical path, so we try creating the directory if does not exist and
91     # utilizing the shell and pwd.
92     rel="$1"
93     absolute_path=""
94     test ! -e "$rel" && mkdir -p "$rel"
95     if test -d "$rel" ; then
96         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
97         absolute_path="$(pwd)"
98         cd - > /dev/null
99     else
100         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
101     fi
104 rm -f warn
105 have_WARNINGS="no"
106 add_warning()
108     if test "$have_WARNINGS" = "no"; then
109         echo "*************************************" > warn
110         have_WARNINGS="yes"
111         if which tput >/dev/null 2>/dev/null && test `tput colors` -ge 8; then
112             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
113             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
114         else
115             COLORWARN="* WARNING :"
116         fi
117     fi
118     echo "$COLORWARN $@" >> warn
121 dnl Some Mac User have the bad habbit of letting a lot fo crap
122 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
123 dnl that confuse the build.
124 dnl For the ones that use LODE, let's be nice and protect them
125 dnl from themselves
127 mac_sanitize_path()
129     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
130 dnl a common but nevertheless necessary thing that may be in a fancy
131 dnl path location is git, so make sure we have it
132     mac_git_path=`which git 2>/dev/null`
133     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
134         mac_path="$mac_path:`dirname $mac_git_path`"
135     fi
136 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
137 dnl path location is gpg, so make sure we find it
138     mac_gpg_path=`which gpg 2>/dev/null`
139     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
140         mac_path="$mac_path:`dirname $mac_gpg_path`"
141     fi
142     PATH="$mac_path"
143     unset mac_path
144     unset mac_git_path
145     unset mac_gpg_path
148 echo "********************************************************************"
149 echo "*"
150 echo "*   Running ${PACKAGE_NAME} build configuration."
151 echo "*"
152 echo "********************************************************************"
153 echo ""
155 dnl ===================================================================
156 dnl checks build and host OSes
157 dnl do this before argument processing to allow for platform dependent defaults
158 dnl ===================================================================
159 AC_CANONICAL_HOST
161 AC_MSG_CHECKING([for product name])
162 PRODUCTNAME="AC_PACKAGE_NAME"
163 if test -n "$with_product_name" -a "$with_product_name" != no; then
164     PRODUCTNAME="$with_product_name"
166 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
167     PRODUCTNAME="${PRODUCTNAME}Dev"
169 AC_MSG_RESULT([$PRODUCTNAME])
170 AC_SUBST(PRODUCTNAME)
171 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
172 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
174 dnl ===================================================================
175 dnl Our version is defined by the AC_INIT() at the top of this script.
176 dnl ===================================================================
178 AC_MSG_CHECKING([for package version])
179 if test -n "$with_package_version" -a "$with_package_version" != no; then
180     PACKAGE_VERSION="$with_package_version"
182 AC_MSG_RESULT([$PACKAGE_VERSION])
184 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
186 LIBO_VERSION_MAJOR=$1
187 LIBO_VERSION_MINOR=$2
188 LIBO_VERSION_MICRO=$3
189 LIBO_VERSION_PATCH=$4
191 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
192 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
193 # no way to encode that into an integer in general.
194 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
196 LIBO_VERSION_SUFFIX=$5
197 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
198 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
199 # they get undoubled before actually passed to sed.
200 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
201 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
202 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
203 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
205 AC_SUBST(LIBO_VERSION_MAJOR)
206 AC_SUBST(LIBO_VERSION_MINOR)
207 AC_SUBST(LIBO_VERSION_MICRO)
208 AC_SUBST(LIBO_VERSION_PATCH)
209 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
210 AC_SUBST(LIBO_VERSION_SUFFIX)
211 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
213 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
214 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
215 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
216 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
218 LIBO_THIS_YEAR=`date +%Y`
219 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
221 dnl ===================================================================
222 dnl Product version
223 dnl ===================================================================
224 AC_MSG_CHECKING([for product version])
225 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
226 AC_MSG_RESULT([$PRODUCTVERSION])
227 AC_SUBST(PRODUCTVERSION)
229 AC_PROG_EGREP
230 # AC_PROG_EGREP doesn't set GREP on all systems as well
231 AC_PATH_PROG(GREP, grep)
233 BUILDDIR=`pwd`
234 cd $srcdir
235 SRC_ROOT=`pwd`
236 cd $BUILDDIR
237 x_Cygwin=[\#]
239 dnl ======================================
240 dnl Required GObject introspection version
241 dnl ======================================
242 INTROSPECTION_REQUIRED_VERSION=1.32.0
244 dnl ===================================================================
245 dnl Search all the common names for GNU Make
246 dnl ===================================================================
247 AC_MSG_CHECKING([for GNU Make])
249 # try to use our own make if it is available and GNUMAKE was not already defined
250 if test -z "$GNUMAKE"; then
251     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
252         GNUMAKE="$LODE_HOME/opt/bin/make"
253     elif test -x "/opt/lo/bin/make"; then
254         GNUMAKE="/opt/lo/bin/make"
255     fi
258 GNUMAKE_WIN_NATIVE=
259 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
260     if test -n "$a"; then
261         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
262         if test $? -eq 0;  then
263             if test "$build_os" = "cygwin"; then
264                 if test -n "$($a -v | grep 'Built for Windows')" ; then
265                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
266                     GNUMAKE_WIN_NATIVE="TRUE"
267                 else
268                     GNUMAKE=`which $a`
269                 fi
270             else
271                 GNUMAKE=`which $a`
272             fi
273             break
274         fi
275     fi
276 done
277 AC_MSG_RESULT($GNUMAKE)
278 if test -z "$GNUMAKE"; then
279     AC_MSG_ERROR([not found. install GNU Make.])
280 else
281     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
282         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
283     fi
286 win_short_path_for_make()
288     local_short_path="$1"
289     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
290         cygpath -sm "$local_short_path"
291     else
292         cygpath -u "$(cygpath -d "$local_short_path")"
293     fi
297 if test "$build_os" = "cygwin"; then
298     PathFormat "$SRC_ROOT"
299     SRC_ROOT="$formatted_path"
300     PathFormat "$BUILDDIR"
301     BUILDDIR="$formatted_path"
302     x_Cygwin=
303     AC_MSG_CHECKING(for explicit COMSPEC)
304     if test -z "$COMSPEC"; then
305         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
306     else
307         AC_MSG_RESULT([found: $COMSPEC])
308     fi
311 AC_SUBST(SRC_ROOT)
312 AC_SUBST(BUILDDIR)
313 AC_SUBST(x_Cygwin)
314 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
315 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
317 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
318     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
321 # need sed in os checks...
322 AC_PATH_PROGS(SED, sed)
323 if test -z "$SED"; then
324     AC_MSG_ERROR([install sed to run this script])
327 # Set the ENABLE_LTO variable
328 # ===================================================================
329 AC_MSG_CHECKING([whether to use link-time optimization])
330 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
331     ENABLE_LTO="TRUE"
332     AC_MSG_RESULT([yes])
333     AC_DEFINE(STATIC_LINKING)
334 else
335     ENABLE_LTO=""
336     AC_MSG_RESULT([no])
338 AC_SUBST(ENABLE_LTO)
340 AC_ARG_ENABLE(fuzz-options,
341     AS_HELP_STRING([--enable-fuzz-options],
342         [Randomly enable or disable each of those configurable options
343          that are supposed to be freely selectable without interdependencies,
344          or where bad interaction from interdependencies is automatically avoided.])
347 dnl ===================================================================
348 dnl When building for Android, --with-android-ndk,
349 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
350 dnl mandatory
351 dnl ===================================================================
353 AC_ARG_WITH(android-ndk,
354     AS_HELP_STRING([--with-android-ndk],
355         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
358 AC_ARG_WITH(android-ndk-toolchain-version,
359     AS_HELP_STRING([--with-android-ndk-toolchain-version],
360         [Specify which toolchain version to use, of those present in the
361         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
362         with_android_ndk_toolchain_version=clang5.0)
364 AC_ARG_WITH(android-sdk,
365     AS_HELP_STRING([--with-android-sdk],
366         [Specify location of the Android SDK. Mandatory when building for Android.]),
369 ANDROID_NDK_HOME=
370 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
371     with_android_ndk="$SRC_ROOT/external/android-ndk"
373 if test -n "$with_android_ndk"; then
374     ANDROID_NDK_HOME=$with_android_ndk
376     # Set up a lot of pre-canned defaults
378     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
379         if test ! -f $ANDROID_NDK_HOME/source.properties; then
380             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
381         fi
382         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
383     else
384         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
385     fi
386     if test -z "$ANDROID_NDK_VERSION";  then
387         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
388     fi
389     case $ANDROID_NDK_VERSION in
390     r9*|r10*)
391         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
392         ;;
393     11.1.*|12.1.*|13.1.*|14.1.*)
394         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
395         ;;
396     16.*)
397         ;;
398     *)
399         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk.])
400         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk."
401         ;;
402     esac
404     ANDROID_API_LEVEL=14
405     android_cpu=$host_cpu
406     ANDROID_ARCH=$android_cpu
407     if test $host_cpu = arm; then
408         android_platform_prefix=$android_cpu-linux-androideabi
409         android_gnu_prefix=$android_platform_prefix
410         LLVM_TRIPLE=armv7-none-linux-androideabi
411         ANDROID_APP_ABI=armeabi-v7a
412         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
413     elif test $host_cpu = aarch64; then
414         android_platform_prefix=$android_cpu-linux-android
415         android_gnu_prefix=$android_platform_prefix
416         LLVM_TRIPLE=aarch64-none-linux-android
417         # minimum android version that supports aarch64
418         ANDROID_API_LEVEL=21
419         ANDROID_APP_ABI=arm64-v8a
420         ANDROID_ARCH=arm64
421     elif test $host_cpu = mips; then
422         android_platform_prefix=mipsel-linux-android
423         android_gnu_prefix=$android_platform_prefix
424         LLVM_TRIPLE=mipsel-none-linux-android
425         ANDROID_APP_ABI=mips
426     else
427         # host_cpu is something like "i386" or "i686" I guess, NDK uses
428         # "x86" in some contexts
429         android_cpu=x86
430         android_platform_prefix=$android_cpu
431         android_gnu_prefix=i686-linux-android
432         LLVM_TRIPLE=i686-none-linux-android
433         ANDROID_APP_ABI=x86
434         ANDROID_ARCH=$android_cpu
435         ANDROIDCFLAGS="-march=atom"
436     fi
438     case "$with_android_ndk_toolchain_version" in
439     clang5.0)
440         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
441         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION
442         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm
443         ;;
444     *)
445         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
446     esac
448     if test ! -d $ANDROID_BINUTILS_DIR; then
449         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
450     elif test ! -d $ANDROID_COMPILER_DIR; then
451         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
452     fi
454     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
455     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
456     # manage to link the (app-specific) single huge .so that is built for the app in
457     # android/source/ if there is debug information in a significant part of the object files.
458     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
459     # all objects have been built with debug information.)
460     case $build_os in
461     linux-gnu*)
462         ndk_build_os=linux
463         ;;
464     darwin*)
465         ndk_build_os=darwin
466         ;;
467     *)
468         AC_MSG_ERROR([We only support building for Android from Linux or OS X])
469         ;;
470     esac
471     ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
472     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
473     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
475     test -z "$SYSBASE" && SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
476     test -z "$AR" && AR=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ar
477     test -z "$NM" && NM=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-nm
478     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-objdump
479     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ranlib
480     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-strip
482     ANDROIDCFLAGS="$ANDROIDCFLAGS -gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT -target $LLVM_TRIPLE$ANDROID_API_LEVEL -no-canonical-prefixes"
483     # android is using different sysroots for compilation and linking, but as
484     # there is no full separation in configure and elsewhere, use isystem for
485     # compilation stuff and sysroot for linking
486     ANDROIDCFLAGS="$ANDROIDCFLAGS -D__ANDROID_API__=$ANDROID_API_LEVEL -isystem $ANDROID_NDK_HOME/sysroot/usr/include"
487     ANDROIDCFLAGS="$ANDROIDCFLAGS -isystem $ANDROID_NDK_HOME/sysroot/usr/include/$android_gnu_prefix"
488     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$SYSBASE -ffunction-sections -fdata-sections -Qunused-arguments"
489     if test "$ANDROID_APP_ABI" = "armeabi-v7a"; then
490     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/libs/$ANDROID_APP_ABI -D_GTHREAD_USE_MUTEX_INIT_FUNC=1"
491     else
492     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/libs/$ANDROID_APP_ABI"
493     fi
494     if test "$ENABLE_LTO" = TRUE; then
495         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
496         # $CC and $CXX when building external libraries
497         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
498     fi
500     if test "$ANDROID_APP_ABI" = "armeabi-v7a"; then
501     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/libs/$ANDROID_APP_ABI/include -std=c++11"
502     else
503     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/include -I$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++abi/include -I$ANDROID_NDK_HOME/sources/android/support/include -std=c++11"
504     fi
506     if test -z "$CC"; then
507         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
508     fi
509     if test -z "$CXX"; then
510         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
511     fi
513     # remember to download the ownCloud Android library later
514     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
516 AC_SUBST(ANDROID_NDK_HOME)
517 AC_SUBST(ANDROID_APP_ABI)
518 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
520 dnl ===================================================================
521 dnl --with-android-sdk
522 dnl ===================================================================
523 ANDROID_SDK_HOME=
524 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
525     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
527 if test -n "$with_android_sdk"; then
528     ANDROID_SDK_HOME=$with_android_sdk
529     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
531 AC_SUBST(ANDROID_SDK_HOME)
533 dnl ===================================================================
534 dnl The following is a list of supported systems.
535 dnl Sequential to keep the logic very simple
536 dnl These values may be checked and reset later.
537 dnl ===================================================================
538 #defaults unless the os test overrides this:
539 test_randr=yes
540 test_xrender=yes
541 test_cups=yes
542 test_dbus=yes
543 test_fontconfig=yes
544 test_cairo=no
546 # Default values, as such probably valid just for Linux, set
547 # differently below just for Mac OSX,but at least better than
548 # hardcoding these as we used to do. Much of this is duplicated also
549 # in solenv for old build system and for gbuild, ideally we should
550 # perhaps define stuff like this only here in configure.ac?
552 LINKFLAGSSHL="-shared"
553 PICSWITCH="-fpic"
554 DLLPOST=".so"
556 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
558 INSTROOTBASESUFFIX=
559 INSTROOTCONTENTSUFFIX=
560 SDKDIRNAME=sdk
562 case "$host_os" in
564 solaris*)
565     test_gtk=yes
566     build_gstreamer_1_0=yes
567     build_gstreamer_0_10=yes
568     test_freetype=yes
569     _os=SunOS
571     dnl ===========================================================
572     dnl Check whether we're using Solaris 10 - SPARC or Intel.
573     dnl ===========================================================
574     AC_MSG_CHECKING([the Solaris operating system release])
575     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
576     if test "$_os_release" -lt "10"; then
577         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
578     else
579         AC_MSG_RESULT([ok ($_os_release)])
580     fi
582     dnl Check whether we're using a SPARC or i386 processor
583     AC_MSG_CHECKING([the processor type])
584     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
585         AC_MSG_RESULT([ok ($host_cpu)])
586     else
587         AC_MSG_ERROR([only SPARC and i386 processors are supported])
588     fi
589     ;;
591 linux-gnu*|k*bsd*-gnu*)
592     test_gtk=yes
593     build_gstreamer_1_0=yes
594     build_gstreamer_0_10=yes
595     test_kde4=yes
596     test_kde5=yes
597     test_qt5=yes
598     test_gtk3_kde5=yes
599     if test "$enable_fuzzers" != yes; then
600         test_freetype=yes
601         test_fontconfig=yes
602     else
603         test_freetype=no
604         test_fontconfig=no
605         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
606     fi
607     _os=Linux
608     ;;
610 gnu)
611     test_randr=no
612     test_xrender=no
613     _os=GNU
614      ;;
616 cygwin*|interix*)
618     # When building on Windows normally with MSVC under Cygwin,
619     # configure thinks that the host platform (the platform the
620     # built code will run on) is Cygwin, even if it obviously is
621     # Windows, which in Autoconf terminology is called
622     # "mingw32". (Which is misleading as MinGW is the name of the
623     # tool-chain, not an operating system.)
625     # Somewhat confusing, yes. But this configure script doesn't
626     # look at $host etc that much, it mostly uses its own $_os
627     # variable, set here in this case statement.
629     test_cups=no
630     test_dbus=no
631     test_randr=no
632     test_xrender=no
633     test_freetype=no
634     test_fontconfig=no
635     _os=WINNT
637     DLLPOST=".dll"
638     LINKFLAGSNOUNDEFS=
639     ;;
641 darwin*) # Mac OS X or iOS
642     test_gtk=yes
643     test_randr=no
644     test_xrender=no
645     test_freetype=no
646     test_fontconfig=no
647     test_dbus=no
648     if test -n "$LODE_HOME" ; then
649         mac_sanitize_path
650         AC_MSG_NOTICE([sanitized the PATH to $PATH])
651     fi
652     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
653         build_for_ios=YES
654         _os=iOS
655         test_gtk=no
656         test_cups=no
657         enable_mpl_subset=yes
658         enable_lotuswordpro=no
659         enable_coinmp=no
660         enable_lpsolve=no
661         enable_postgresql_sdbc=no
662         enable_extension_integration=no
663         enable_report_builder=no
664         with_theme="tango"
665         with_ppds=no
666         if test "$enable_ios_simulator" = "yes"; then
667             host=x86_64-apple-darwin
668         fi
669     else
670         _os=Darwin
671         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
672         INSTROOTCONTENTSUFFIX=/Contents
673         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
674     fi
675     enable_systray=no
676     # See comment above the case "$host_os"
677     LINKFLAGSSHL="-dynamiclib -single_module"
679     # -fPIC is default
680     PICSWITCH=""
682     DLLPOST=".dylib"
684     # -undefined error is the default
685     LINKFLAGSNOUNDEFS=""
688 freebsd*)
689     test_gtk=yes
690     build_gstreamer_1_0=yes
691     build_gstreamer_0_10=yes
692     test_kde4=yes
693     test_kde5=yes
694     test_qt5=yes
695     test_gtk3_kde5=yes
696     test_freetype=yes
697     AC_MSG_CHECKING([the FreeBSD operating system release])
698     if test -n "$with_os_version"; then
699         OSVERSION="$with_os_version"
700     else
701         OSVERSION=`/sbin/sysctl -n kern.osreldate`
702     fi
703     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
704     AC_MSG_CHECKING([which thread library to use])
705     if test "$OSVERSION" -lt "500016"; then
706         PTHREAD_CFLAGS="-D_THREAD_SAFE"
707         PTHREAD_LIBS="-pthread"
708     elif test "$OSVERSION" -lt "502102"; then
709         PTHREAD_CFLAGS="-D_THREAD_SAFE"
710         PTHREAD_LIBS="-lc_r"
711     else
712         PTHREAD_CFLAGS=""
713         PTHREAD_LIBS="-pthread"
714     fi
715     AC_MSG_RESULT([$PTHREAD_LIBS])
716     _os=FreeBSD
717     ;;
719 *netbsd*)
720     test_gtk=yes
721     build_gstreamer_1_0=yes
722     build_gstreamer_0_10=yes
723     test_kde4=yes
724     test_kde5=yes
725     test_qt5=yes
726     test_gtk3_kde5=yes
727     test_freetype=yes
728     PTHREAD_LIBS="-pthread -lpthread"
729     _os=NetBSD
730     ;;
732 aix*)
733     test_randr=no
734     test_freetype=yes
735     PTHREAD_LIBS=-pthread
736     _os=AIX
737     ;;
739 openbsd*)
740     test_gtk=yes
741     test_freetype=yes
742     PTHREAD_CFLAGS="-D_THREAD_SAFE"
743     PTHREAD_LIBS="-pthread"
744     _os=OpenBSD
745     ;;
747 dragonfly*)
748     test_gtk=yes
749     build_gstreamer_1_0=yes
750     build_gstreamer_0_10=yes
751     test_kde4=yes
752     test_kde5=yes
753     test_qt5=yes
754     test_gtk3_kde5=yes
755     test_freetype=yes
756     PTHREAD_LIBS="-pthread"
757     _os=DragonFly
758     ;;
760 linux-android*)
761     build_gstreamer_1_0=no
762     build_gstreamer_0_10=no
763     enable_lotuswordpro=no
764     enable_mpl_subset=yes
765     enable_coinmp=yes
766     enable_lpsolve=no
767     enable_report_builder=no
768     enable_odk=no
769     enable_postgresql_sdbc=no
770     enable_python=no
771     with_theme="tango"
772     test_cups=no
773     test_dbus=no
774     test_fontconfig=no
775     test_freetype=no
776     test_gtk=no
777     test_kde4=no
778     test_kde5=no
779     test_qt5=no
780     test_gtk3_kde5=no
781     test_randr=no
782     test_xrender=no
783     _os=Android
785     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
786     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
787     ;;
789 haiku*)
790     test_cups=no
791     test_dbus=no
792     test_randr=no
793     test_xrender=no
794     test_freetype=yes
795     enable_java=no
796     enable_opengl=no
797     enable_odk=no
798     enable_gconf=no
799     enable_gnome_vfs=no
800     enable_gstreamer=no
801     enable_vlc=no
802     enable_gltf=no
803     enable_collada=no
804     enable_coinmp=no
805     enable_pdfium=no
806     enable_postgresql_sdbc=no
807     enable_firebird_sdbc=no
808     _os=Haiku
809     ;;
812     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
813     ;;
814 esac
816 if test "$_os" = "Android" ; then
817     # Verify that the NDK and SDK options are proper
818     if test -z "$with_android_ndk"; then
819         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
820     elif test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
821         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
822     fi
824     if test -z "$ANDROID_SDK_HOME"; then
825         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
826     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
827         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
828     fi
830     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
831     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
832         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
833                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
834                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
835         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
836         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
837         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
838     fi
839     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
840         AC_MSG_WARN([android support repository not found - install with
841                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
842                      to allow the build to download the specified version of the android support libraries])
843         add_warning "android support repository not found - install with"
844         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
845         add_warning "to allow the build to download the specified version of the android support libraries"
846     fi
849 if test "$_os" = "AIX"; then
850     AC_PATH_PROG(GAWK, gawk)
851     if test -z "$GAWK"; then
852         AC_MSG_ERROR([gawk not found in \$PATH])
853     fi
856 AC_SUBST(SDKDIRNAME)
858 AC_SUBST(PTHREAD_CFLAGS)
859 AC_SUBST(PTHREAD_LIBS)
861 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
862 # By default use the ones specified by our build system,
863 # but explicit override is possible.
864 AC_MSG_CHECKING(for explicit AFLAGS)
865 if test -n "$AFLAGS"; then
866     AC_MSG_RESULT([$AFLAGS])
867     x_AFLAGS=
868 else
869     AC_MSG_RESULT(no)
870     x_AFLAGS=[\#]
872 AC_MSG_CHECKING(for explicit CFLAGS)
873 if test -n "$CFLAGS"; then
874     AC_MSG_RESULT([$CFLAGS])
875     x_CFLAGS=
876 else
877     AC_MSG_RESULT(no)
878     x_CFLAGS=[\#]
880 AC_MSG_CHECKING(for explicit CXXFLAGS)
881 if test -n "$CXXFLAGS"; then
882     AC_MSG_RESULT([$CXXFLAGS])
883     x_CXXFLAGS=
884 else
885     AC_MSG_RESULT(no)
886     x_CXXFLAGS=[\#]
888 AC_MSG_CHECKING(for explicit OBJCFLAGS)
889 if test -n "$OBJCFLAGS"; then
890     AC_MSG_RESULT([$OBJCFLAGS])
891     x_OBJCFLAGS=
892 else
893     AC_MSG_RESULT(no)
894     x_OBJCFLAGS=[\#]
896 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
897 if test -n "$OBJCXXFLAGS"; then
898     AC_MSG_RESULT([$OBJCXXFLAGS])
899     x_OBJCXXFLAGS=
900 else
901     AC_MSG_RESULT(no)
902     x_OBJCXXFLAGS=[\#]
904 AC_MSG_CHECKING(for explicit LDFLAGS)
905 if test -n "$LDFLAGS"; then
906     AC_MSG_RESULT([$LDFLAGS])
907     x_LDFLAGS=
908 else
909     AC_MSG_RESULT(no)
910     x_LDFLAGS=[\#]
912 AC_SUBST(AFLAGS)
913 AC_SUBST(CFLAGS)
914 AC_SUBST(CXXFLAGS)
915 AC_SUBST(OBJCFLAGS)
916 AC_SUBST(OBJCXXFLAGS)
917 AC_SUBST(LDFLAGS)
918 AC_SUBST(x_AFLAGS)
919 AC_SUBST(x_CFLAGS)
920 AC_SUBST(x_CXXFLAGS)
921 AC_SUBST(x_OBJCFLAGS)
922 AC_SUBST(x_OBJCXXFLAGS)
923 AC_SUBST(x_LDFLAGS)
925 dnl These are potentially set for MSVC, in the code checking for UCRT below:
926 my_original_CFLAGS=$CFLAGS
927 my_original_CXXFLAGS=$CXXFLAGS
928 my_original_CPPFLAGS=$CPPFLAGS
930 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
931 dnl Needs to precede the AC_SEARCH_LIBS call below, which apparently calls
932 dnl AC_PROG_CC internally.
933 if test "$_os" != "WINNT"; then
934     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
935     save_CFLAGS=$CFLAGS
936     AC_PROG_CC
937     CFLAGS=$save_CFLAGS
940 if test $_os != "WINNT"; then
941     save_LIBS="$LIBS"
942     AC_SEARCH_LIBS([dlsym], [dl],
943         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
944         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
945     LIBS="$save_LIBS"
947 AC_SUBST(DLOPEN_LIBS)
949 ###############################################################################
950 # Extensions switches --enable/--disable
951 ###############################################################################
952 # By default these should be enabled unless having extra dependencies.
953 # If there is extra dependency over configure options then the enable should
954 # be automagic based on whether the requiring feature is enabled or not.
955 # All this options change anything only with --enable-extension-integration.
957 # The name of this option and its help string makes it sound as if
958 # extensions are built anyway, just not integrated in the installer,
959 # if you use --disable-extension-integration. Is that really the
960 # case?
962 AC_ARG_ENABLE(ios-simulator,
963     AS_HELP_STRING([--enable-ios-simulator],
964         [build i386 or x86_64 for ios simulator])
967 libo_FUZZ_ARG_ENABLE(extension-integration,
968     AS_HELP_STRING([--disable-extension-integration],
969         [Disable integration of the built extensions in the installer of the
970          product. Use this switch to disable the integration.])
973 AC_ARG_ENABLE(avmedia,
974     AS_HELP_STRING([--disable-avmedia],
975         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
978 AC_ARG_ENABLE(database-connectivity,
979     AS_HELP_STRING([--disable-database-connectivity],
980         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
983 # This doesn't mean not building (or "integrating") extensions
984 # (although it probably should; i.e. it should imply
985 # --disable-extension-integration I guess), it means not supporting
986 # any extension mechanism at all
987 libo_FUZZ_ARG_ENABLE(extensions,
988     AS_HELP_STRING([--disable-extensions],
989         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
992 AC_ARG_ENABLE(scripting,
993     AS_HELP_STRING([--disable-scripting],
994         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
997 # This is mainly for Android and iOS, but could potentially be used in some
998 # special case otherwise, too, so factored out as a separate setting
1000 AC_ARG_ENABLE(dynamic-loading,
1001     AS_HELP_STRING([--disable-dynamic-loading],
1002         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1005 libo_FUZZ_ARG_ENABLE(ext-mariadb-connector,
1006     AS_HELP_STRING([--enable-ext-mariadb-connector],
1007         [Enable the build of the MariaDB/MySQL Connector extension.])
1010 libo_FUZZ_ARG_ENABLE(report-builder,
1011     AS_HELP_STRING([--disable-report-builder],
1012         [Disable the Report Builder.])
1015 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1016     AS_HELP_STRING([--enable-ext-wiki-publisher],
1017         [Enable the Wiki Publisher extension.])
1020 libo_FUZZ_ARG_ENABLE(lpsolve,
1021     AS_HELP_STRING([--disable-lpsolve],
1022         [Disable compilation of the lp solve solver ])
1024 libo_FUZZ_ARG_ENABLE(coinmp,
1025     AS_HELP_STRING([--disable-coinmp],
1026         [Disable compilation of the CoinMP solver ])
1029 libo_FUZZ_ARG_ENABLE(pdfimport,
1030     AS_HELP_STRING([--disable-pdfimport],
1031         [Disable building the PDF import feature.])
1034 libo_FUZZ_ARG_ENABLE(pdfium,
1035     AS_HELP_STRING([--disable-pdfium],
1036         [Disable building PDFium.])
1039 ###############################################################################
1041 dnl ---------- *** ----------
1043 libo_FUZZ_ARG_ENABLE(mergelibs,
1044     AS_HELP_STRING([--enable-mergelibs],
1045         [Merge several of the smaller libraries into one big, "merged", one.])
1048 libo_FUZZ_ARG_ENABLE(breakpad,
1049     AS_HELP_STRING([--enable-breakpad],
1050         [Enables breakpad for crash reporting.])
1053 AC_ARG_ENABLE(fetch-external,
1054     AS_HELP_STRING([--disable-fetch-external],
1055         [Disables fetching external tarballs from web sources.])
1058 AC_ARG_ENABLE(fuzzers,
1059     AS_HELP_STRING([--enable-fuzzers],
1060         [Enables building libfuzzer targets for fuzz testing.])
1063 libo_FUZZ_ARG_ENABLE(pch,
1064     AS_HELP_STRING([--enable-pch],
1065         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1068 libo_FUZZ_ARG_ENABLE(epm,
1069     AS_HELP_STRING([--enable-epm],
1070         [LibreOffice includes self-packaging code, that requires epm, however epm is
1071          useless for large scale package building.])
1074 libo_FUZZ_ARG_ENABLE(odk,
1075     AS_HELP_STRING([--disable-odk],
1076         [LibreOffice includes an ODK, office development kit which some packagers may
1077          wish to build without.])
1080 AC_ARG_ENABLE(mpl-subset,
1081     AS_HELP_STRING([--enable-mpl-subset],
1082         [Don't compile any pieces which are not MPL or more liberally licensed])
1085 libo_FUZZ_ARG_ENABLE(evolution2,
1086     AS_HELP_STRING([--enable-evolution2],
1087         [Allows the built-in evolution 2 addressbook connectivity build to be
1088          enabled.])
1091 AC_ARG_ENABLE(avahi,
1092     AS_HELP_STRING([--enable-avahi],
1093         [Determines whether to use Avahi to advertise Impress to remote controls.])
1096 libo_FUZZ_ARG_ENABLE(werror,
1097     AS_HELP_STRING([--enable-werror],
1098         [Turn warnings to errors. (Has no effect in modules where the treating
1099          of warnings as errors is disabled explicitly.)]),
1102 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1103     AS_HELP_STRING([--enable-assert-always-abort],
1104         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1107 libo_FUZZ_ARG_ENABLE(dbgutil,
1108     AS_HELP_STRING([--enable-dbgutil],
1109         [Provide debugging support from --enable-debug and include additional debugging
1110          utilities such as object counting or more expensive checks.
1111          This is the recommended option for developers.
1112          Note that this makes the build ABI incompatible, it is not possible to mix object
1113          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1115 libo_FUZZ_ARG_ENABLE(debug,
1116     AS_HELP_STRING([--enable-debug],
1117         [Include debugging information, disable compiler optimization and inlining plus
1118          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1120 libo_FUZZ_ARG_ENABLE(sal-log,
1121     AS_HELP_STRING([--enable-sal-log],
1122         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1124 AC_ARG_ENABLE(selective-debuginfo,
1125     AS_HELP_STRING([--enable-selective-debuginfo],
1126         [If --enable-debug or --enable-dbgutil is used, build debugging information
1127          (-g compiler flag) only for the specified gbuild build targets
1128          (where all means everything, - prepended means not to enable, / appended means
1129          everything in the directory; there is no ordering, more specific overrides
1130          more general, and disabling takes precedence).
1131          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1133 libo_FUZZ_ARG_ENABLE(symbols,
1134     AS_HELP_STRING([--enable-symbols],
1135         [Generate debug information.
1136          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1137          otherwise.]))
1139 libo_FUZZ_ARG_ENABLE(optimized,
1140     AS_HELP_STRING([--disable-optimized],
1141         [Whether to compile with optimization flags.
1142          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1143          otherwise.]))
1145 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1146     AS_HELP_STRING([--disable-runtime-optimizations],
1147         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1148          JVM JIT) that are known to interact badly with certain dynamic analysis
1149          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1150          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1151          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1153 AC_ARG_WITH(valgrind,
1154     AS_HELP_STRING([--with-valgrind],
1155         [Make availability of Valgrind headers a hard requirement.]))
1157 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1158     AS_HELP_STRING([--enable-compiler-plugins],
1159         [Enable compiler plugins that will perform additional checks during
1160          building. Enabled automatically by --enable-dbgutil.
1161          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1162 COMPILER_PLUGINS_DEBUG=
1163 if test "$enable_compiler_plugins" = debug; then
1164     enable_compiler_plugins=yes
1165     COMPILER_PLUGINS_DEBUG=TRUE
1168 libo_FUZZ_ARG_ENABLE(ooenv,
1169     AS_HELP_STRING([--disable-ooenv],
1170         [Disable ooenv for the instdir installation.]))
1172 AC_ARG_ENABLE(lto,
1173     AS_HELP_STRING([--enable-lto],
1174         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1175          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1176          linker. For MSVC, this option is broken at the moment. This is experimental work
1177          in progress that shouldn't be used unless you are working on it.)]))
1179 AC_ARG_ENABLE(python,
1180     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1181         [Enables or disables Python support at run-time.
1182          Also specifies what Python to use. 'auto' is the default.
1183          'fully-internal' even forces the internal version for uses of Python
1184          during the build.]))
1186 libo_FUZZ_ARG_ENABLE(gtk,
1187     AS_HELP_STRING([--disable-gtk],
1188         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1189 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1191 libo_FUZZ_ARG_ENABLE(gtk3,
1192     AS_HELP_STRING([--disable-gtk3],
1193         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1194 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1196 libo_FUZZ_ARG_ENABLE(systray,
1197     AS_HELP_STRING([--disable-systray],
1198         [Determines whether to build the systray quickstarter.]),
1199 ,test "${enable_systray+set}" = set || enable_systray=yes)
1201 AC_ARG_ENABLE(split-app-modules,
1202     AS_HELP_STRING([--enable-split-app-modules],
1203         [Split file lists for app modules, e.g. base, calc.
1204          Has effect only with make distro-pack-install]),
1207 AC_ARG_ENABLE(split-opt-features,
1208     AS_HELP_STRING([--enable-split-opt-features],
1209         [Split file lists for some optional features, e.g. pyuno, testtool.
1210          Has effect only with make distro-pack-install]),
1213 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1214     AS_HELP_STRING([--disable-cairo-canvas],
1215         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1218 libo_FUZZ_ARG_ENABLE(dbus,
1219     AS_HELP_STRING([--disable-dbus],
1220         [Determines whether to enable features that depend on dbus.
1221          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1222 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1224 libo_FUZZ_ARG_ENABLE(sdremote,
1225     AS_HELP_STRING([--disable-sdremote],
1226         [Determines whether to enable Impress remote control (i.e. the server component).]),
1227 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1229 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1230     AS_HELP_STRING([--disable-sdremote-bluetooth],
1231         [Determines whether to build sdremote with bluetooth support.
1232          Requires dbus on Linux.]))
1234 libo_FUZZ_ARG_ENABLE(gio,
1235     AS_HELP_STRING([--disable-gio],
1236         [Determines whether to use the GIO support.]),
1237 ,test "${enable_gio+set}" = set || enable_gio=yes)
1239 AC_ARG_ENABLE(kde4,
1240     AS_HELP_STRING([--enable-kde4],
1241         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1242          KDE4 are available.]),
1245 AC_ARG_ENABLE(qt5,
1246     AS_HELP_STRING([--enable-qt5],
1247         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1248          available.]),
1251 AC_ARG_ENABLE(kde5,
1252     AS_HELP_STRING([--enable-kde5],
1253         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1254          KF5 are available.]),
1257 AC_ARG_ENABLE(gtk3_kde5,
1258     AS_HELP_STRING([--enable-gtk3-kde5],
1259         [Determines whether to use Gtk3 vclplug with KDE file dialogs on
1260          platforms where Gtk3, Qt5 and Plasma is available.]),
1263 libo_FUZZ_ARG_ENABLE(gui,
1264     AS_HELP_STRING([--disable-gui],
1265         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1266          command-line option. Not related to LibreOffice Online functionality. Don't use
1267          unless you are certain you need to. Nobody will help you if you insist on trying
1268          this and run into problems.]),
1269 ,test "${enable_gui+set}" = set || enable_gui=yes)
1271 libo_FUZZ_ARG_ENABLE(randr,
1272     AS_HELP_STRING([--disable-randr],
1273         [Disable RandR support in the vcl project.]),
1274 ,test "${enable_randr+set}" = set || enable_randr=yes)
1276 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1277     AS_HELP_STRING([--disable-gstreamer-1-0],
1278         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1279 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1281 AC_ARG_ENABLE(gstreamer-0-10,
1282     AS_HELP_STRING([--enable-gstreamer-0-10],
1283         [Enable building with the gstreamer 0.10 avmedia backend.]),
1284 ,enable_gstreamer_0_10=no)
1286 libo_FUZZ_ARG_ENABLE(vlc,
1287     AS_HELP_STRING([--enable-vlc],
1288         [Enable building with the (experimental) VLC avmedia backend.]),
1289 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1291 libo_FUZZ_ARG_ENABLE(neon,
1292     AS_HELP_STRING([--disable-neon],
1293         [Disable neon and the compilation of webdav binding.]),
1296 libo_FUZZ_ARG_ENABLE([eot],
1297     [AS_HELP_STRING([--enable-eot],
1298         [Enable support for Embedded OpenType fonts.])],
1299 ,test "${enable_eot+set}" = set || enable_eot=no)
1301 libo_FUZZ_ARG_ENABLE(cve-tests,
1302     AS_HELP_STRING([--disable-cve-tests],
1303         [Prevent CVE tests to be executed]),
1306 libo_FUZZ_ARG_ENABLE(chart-tests,
1307     AS_HELP_STRING([--enable-chart-tests],
1308         [Executes chart XShape tests. In a perfect world these tests would be
1309          stable and everyone could run them, in reality it is best to run them
1310          only on a few machines that are known to work and maintained by people
1311          who can judge if a test failure is a regression or not.]),
1314 AC_ARG_ENABLE(build-unowinreg,
1315     AS_HELP_STRING([--enable-build-unowinreg],
1316         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1317          compiler is needed on Linux.]),
1320 AC_ARG_ENABLE(dependency-tracking,
1321     AS_HELP_STRING([--enable-dependency-tracking],
1322         [Do not reject slow dependency extractors.])[
1323   --disable-dependency-tracking
1324                           Disables generation of dependency information.
1325                           Speed up one-time builds.],
1328 AC_ARG_ENABLE(icecream,
1329     AS_HELP_STRING([--enable-icecream],
1330         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1331          It defaults to /opt/icecream for the location of the icecream gcc/g++
1332          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1335 libo_FUZZ_ARG_ENABLE(cups,
1336     AS_HELP_STRING([--disable-cups],
1337         [Do not build cups support.])
1340 AC_ARG_ENABLE(ccache,
1341     AS_HELP_STRING([--disable-ccache],
1342         [Do not try to use ccache automatically.
1343          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1344          CC/CXX are not yet set, and --enable-icecream is not given, we
1345          attempt to use ccache. --disable-ccache disables ccache completely.
1349 AC_ARG_ENABLE(64-bit,
1350     AS_HELP_STRING([--enable-64-bit],
1351         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1352          At the moment meaningful only for Windows.]), ,)
1354 libo_FUZZ_ARG_ENABLE(online-update,
1355     AS_HELP_STRING([--enable-online-update],
1356         [Enable the online update service that will check for new versions of
1357          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1358          If the value is "mar", the experimental Mozilla-like update will be
1359          enabled instead of the traditional update mechanism.]),
1362 AC_ARG_WITH(update-config,
1363     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1364                    [Path to the update config ini file]))
1366 libo_FUZZ_ARG_ENABLE(extension-update,
1367     AS_HELP_STRING([--disable-extension-update],
1368         [Disable possibility to update installed extensions.]),
1371 libo_FUZZ_ARG_ENABLE(release-build,
1372     AS_HELP_STRING([--enable-release-build],
1373         [Enable release build. Note that the "release build" choice is orthogonal to
1374          whether symbols are present, debug info is generated, or optimization
1375          is done.
1376          See http://wiki.documentfoundation.org/Development/DevBuild]),
1379 AC_ARG_ENABLE(windows-build-signing,
1380     AS_HELP_STRING([--enable-windows-build-signing],
1381         [Enable signing of windows binaries (*.exe, *.dll)]),
1384 AC_ARG_ENABLE(silent-msi,
1385     AS_HELP_STRING([--enable-silent-msi],
1386         [Enable MSI with LIMITUI=1 (silent install).]),
1389 AC_ARG_ENABLE(macosx-code-signing,
1390     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1391         [Sign executables, dylibs, frameworks and the app bundle. If you
1392          don't provide an identity the first suitable certificate
1393          in your keychain is used.]),
1396 AC_ARG_ENABLE(macosx-package-signing,
1397     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1398         [Create a .pkg suitable for uploading to the Mac App Store and sign
1399          it. If you don't provide an identity the first suitable certificate
1400          in your keychain is used.]),
1403 AC_ARG_ENABLE(macosx-sandbox,
1404     AS_HELP_STRING([--enable-macosx-sandbox],
1405         [Make the app bundle run in a sandbox. Requires code signing.
1406          Is required by apps distributed in the Mac App Store, and implies
1407          adherence to App Store rules.]),
1410 AC_ARG_WITH(macosx-bundle-identifier,
1411     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1412         [Define the OS X bundle identifier. Default is the somewhat weird
1413          org.libreoffice.script ("script", huh?).]),
1414 ,with_macosx_bundle_identifier=org.libreoffice.script)
1416 AC_ARG_WITH(product-name,
1417     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1418         [Define the product name. Default is AC_PACKAGE_NAME.]),
1419 ,with_product_name=$PRODUCTNAME)
1421 AC_ARG_WITH(package-version,
1422     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1423         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1426 libo_FUZZ_ARG_ENABLE(readonly-installset,
1427     AS_HELP_STRING([--enable-readonly-installset],
1428         [Prevents any attempts by LibreOffice to write into its installation. That means
1429          at least that no "system-wide" extensions can be added. Experimental work in
1430          progress.]),
1433 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1434     AS_HELP_STRING([--disable-postgresql-sdbc],
1435         [Disable the build of the PostgreSQL-SDBC driver.])
1438 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1439     AS_HELP_STRING([--disable-lotuswordpro],
1440         [Disable the build of the Lotus Word Pro filter.]),
1441 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1443 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1444     AS_HELP_STRING([--disable-firebird-sdbc],
1445         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1446 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1448 AC_ARG_ENABLE(bogus-pkg-config,
1449     AS_HELP_STRING([--enable-bogus-pkg-config],
1450         [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.]),
1453 AC_ARG_ENABLE(openssl,
1454     AS_HELP_STRING([--disable-openssl],
1455         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1456          components will either use GNUTLS or NSS. Work in progress,
1457          use only if you are hacking on it.]),
1458 ,enable_openssl=yes)
1460 AC_ARG_ENABLE(library-bin-tar,
1461     AS_HELP_STRING([--enable-library-bin-tar],
1462         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1463         Some libraries can save their build result in a tarball
1464         stored in TARFILE_LOCATION. That binary tarball is
1465         uniquely identified by the source tarball,
1466         the content of the config_host.mk file and the content
1467         of the top-level directory in core for that library
1468         If this option is enabled, then if such a tarfile exist, it will be untarred
1469         instead of the source tarfile, and the build step will be skipped for that
1470         library.
1471         If a proper tarfile does not exist, then the normal source-based
1472         build is done for that library and a proper binary tarfile is created
1473         for the next time.]),
1476 AC_ARG_ENABLE(dconf,
1477     AS_HELP_STRING([--disable-dconf],
1478         [Disable the dconf configuration backend (enabled by default where
1479          available).]))
1481 libo_FUZZ_ARG_ENABLE(formula-logger,
1482     AS_HELP_STRING(
1483         [--enable-formula-logger],
1484         [Enable formula logger for logging formula calculation flow in Calc.]
1485     )
1488 dnl ===================================================================
1489 dnl Optional Packages (--with/without-)
1490 dnl ===================================================================
1492 AC_ARG_WITH(gcc-home,
1493     AS_HELP_STRING([--with-gcc-home],
1494         [Specify the location of gcc/g++ manually. This can be used in conjunction
1495          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1496          non-default path.]),
1499 AC_ARG_WITH(gnu-patch,
1500     AS_HELP_STRING([--with-gnu-patch],
1501         [Specify location of GNU patch on Solaris or FreeBSD.]),
1504 AC_ARG_WITH(build-platform-configure-options,
1505     AS_HELP_STRING([--with-build-platform-configure-options],
1506         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1509 AC_ARG_WITH(gnu-cp,
1510     AS_HELP_STRING([--with-gnu-cp],
1511         [Specify location of GNU cp on Solaris or FreeBSD.]),
1514 AC_ARG_WITH(external-tar,
1515     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1516         [Specify an absolute path of where to find (and store) tarfiles.]),
1517     TARFILE_LOCATION=$withval ,
1520 AC_ARG_WITH(referenced-git,
1521     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1522         [Specify another checkout directory to reference. This makes use of
1523                  git submodule update --reference, and saves a lot of diskspace
1524                  when having multiple trees side-by-side.]),
1525     GIT_REFERENCE_SRC=$withval ,
1528 AC_ARG_WITH(linked-git,
1529     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1530         [Specify a directory where the repositories of submodules are located.
1531          This uses a method similar to git-new-workdir to get submodules.]),
1532     GIT_LINK_SRC=$withval ,
1535 AC_ARG_WITH(galleries,
1536     AS_HELP_STRING([--with-galleries],
1537         [Specify how galleries should be built. It is possible either to
1538          build these internally from source ("build"),
1539          or to disable them ("no")]),
1542 AC_ARG_WITH(theme,
1543     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1544         [Choose which themes to include. By default those themes with an '*' are included.
1545          Possible choices: *breeze, *breeze_dark, crystal, *colibre, *elementary, *galaxy, *hicontrast, oxygen, *sifr, *sifr_dark, *tango, tango_testing.]),
1548 libo_FUZZ_ARG_WITH(helppack-integration,
1549     AS_HELP_STRING([--without-helppack-integration],
1550         [It will not integrate the helppacks to the installer
1551          of the product. Please use this switch to use the online help
1552          or separate help packages.]),
1555 libo_FUZZ_ARG_WITH(fonts,
1556     AS_HELP_STRING([--without-fonts],
1557         [LibreOffice includes some third-party fonts to provide a reliable basis for
1558          help content, templates, samples, etc. When these fonts are already
1559          known to be available on the system then you should use this option.]),
1562 AC_ARG_WITH(epm,
1563     AS_HELP_STRING([--with-epm],
1564         [Decides which epm to use. Default is to use the one from the system if
1565          one is built. When either this is not there or you say =internal epm
1566          will be built.]),
1569 AC_ARG_WITH(package-format,
1570     AS_HELP_STRING([--with-package-format],
1571         [Specify package format(s) for LibreOffice installation sets. The
1572          implicit --without-package-format leads to no installation sets being
1573          generated. Possible values: aix, archive, bsd, deb, dmg,
1574          installed, msi, pkg, and rpm.
1575          Example: --with-package-format='deb rpm']),
1578 AC_ARG_WITH(tls,
1579     AS_HELP_STRING([--with-tls],
1580         [Decides which TLS/SSL and cryptographic implementations to use for
1581          LibreOffice's code. Notice that this doesn't apply for depending
1582          libraries like "neon", for example. Default is to use OpenSSL
1583          although NSS is also possible. Notice that selecting NSS restricts
1584          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1585          restrict by now the usage of NSS in LO's code. Possible values:
1586          openssl, nss. Example: --with-tls="nss"]),
1589 AC_ARG_WITH(system-libs,
1590     AS_HELP_STRING([--with-system-libs],
1591         [Use libraries already on system -- enables all --with-system-* flags.]),
1594 AC_ARG_WITH(system-bzip2,
1595     AS_HELP_STRING([--with-system-bzip2],
1596         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1597     [with_system_bzip2="$with_system_libs"])
1599 AC_ARG_WITH(system-headers,
1600     AS_HELP_STRING([--with-system-headers],
1601         [Use headers already on system -- enables all --with-system-* flags for
1602          external packages whose headers are the only entities used i.e.
1603          boost/odbc/sane-header(s).]),,
1604     [with_system_headers="$with_system_libs"])
1606 AC_ARG_WITH(system-jars,
1607     AS_HELP_STRING([--without-system-jars],
1608         [When building with --with-system-libs, also the needed jars are expected
1609          on the system. Use this to disable that]),,
1610     [with_system_jars="$with_system_libs"])
1612 AC_ARG_WITH(system-cairo,
1613     AS_HELP_STRING([--with-system-cairo],
1614         [Use cairo libraries already on system.  Happens automatically for
1615          (implicit) --enable-gtk and for --enable-gtk3.]))
1617 AC_ARG_WITH(system-epoxy,
1618     AS_HELP_STRING([--with-system-epoxy],
1619         [Use epoxy libraries already on system.  Happens automatically for
1620          --enable-gtk3.]),,
1621        [with_system_epoxy="$with_system_libs"])
1623 AC_ARG_WITH(myspell-dicts,
1624     AS_HELP_STRING([--with-myspell-dicts],
1625         [Adds myspell dictionaries to the LibreOffice installation set]),
1628 AC_ARG_WITH(system-dicts,
1629     AS_HELP_STRING([--without-system-dicts],
1630         [Do not use dictionaries from system paths.]),
1633 AC_ARG_WITH(external-dict-dir,
1634     AS_HELP_STRING([--with-external-dict-dir],
1635         [Specify external dictionary dir.]),
1638 AC_ARG_WITH(external-hyph-dir,
1639     AS_HELP_STRING([--with-external-hyph-dir],
1640         [Specify external hyphenation pattern dir.]),
1643 AC_ARG_WITH(external-thes-dir,
1644     AS_HELP_STRING([--with-external-thes-dir],
1645         [Specify external thesaurus dir.]),
1648 AC_ARG_WITH(system-zlib,
1649     AS_HELP_STRING([--with-system-zlib],
1650         [Use zlib already on system.]),,
1651     [with_system_zlib=auto])
1653 AC_ARG_WITH(system-jpeg,
1654     AS_HELP_STRING([--with-system-jpeg],
1655         [Use jpeg already on system.]),,
1656     [with_system_jpeg="$with_system_libs"])
1658 AC_ARG_WITH(system-clucene,
1659     AS_HELP_STRING([--with-system-clucene],
1660         [Use clucene already on system.]),,
1661     [with_system_clucene="$with_system_libs"])
1663 AC_ARG_WITH(system-expat,
1664     AS_HELP_STRING([--with-system-expat],
1665         [Use expat already on system.]),,
1666     [with_system_expat="$with_system_libs"])
1668 AC_ARG_WITH(system-libxml,
1669     AS_HELP_STRING([--with-system-libxml],
1670         [Use libxml/libxslt already on system.]),,
1671     [with_system_libxml=auto])
1673 AC_ARG_WITH(system-icu,
1674     AS_HELP_STRING([--with-system-icu],
1675         [Use icu already on system.]),,
1676     [with_system_icu="$with_system_libs"])
1678 AC_ARG_WITH(system-ucpp,
1679     AS_HELP_STRING([--with-system-ucpp],
1680         [Use ucpp already on system.]),,
1681     [])
1683 AC_ARG_WITH(system-openldap,
1684     AS_HELP_STRING([--with-system-openldap],
1685         [Use the OpenLDAP LDAP SDK already on system.]),,
1686     [with_system_openldap="$with_system_libs"])
1688 AC_ARG_WITH(system-poppler,
1689     AS_HELP_STRING([--with-system-poppler],
1690         [Use system poppler (only needed for PDF import).]),,
1691     [with_system_poppler="$with_system_libs"])
1693 AC_ARG_WITH(system-gpgmepp,
1694     AS_HELP_STRING([--with-system-gpgmepp],
1695         [Use gpgmepp already on system]),,
1696     [with_system_gpgmepp="$with_system_libs"])
1698 AC_ARG_WITH(system-apache-commons,
1699     AS_HELP_STRING([--with-system-apache-commons],
1700         [Use Apache commons libraries already on system.]),,
1701     [with_system_apache_commons="$with_system_jars"])
1703 AC_ARG_WITH(system-mariadb,
1704     AS_HELP_STRING([--with-system-mariadb],
1705         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1706          extension.]),,
1707     [with_system_mariadb="$with_system_libs"])
1709 AC_ARG_ENABLE(bundle-mariadb,
1710     AS_HELP_STRING([--enable-bundle-mariadb],
1711         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1714 AC_ARG_WITH(system-mysql-cppconn,
1715     AS_HELP_STRING([--with-system-mysql-cppconn],
1716         [Use MySQL C++ Connector libraries already on system.]),,
1717     [with_system_mysql_cppconn="$with_system_libs"])
1719 AC_ARG_WITH(system-postgresql,
1720     AS_HELP_STRING([--with-system-postgresql],
1721         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1722          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1723     [with_system_postgresql="$with_system_libs"])
1725 AC_ARG_WITH(libpq-path,
1726     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1727         [Use this PostgreSQL C interface (libpq) installation for building
1728          the PostgreSQL-SDBC extension.]),
1731 AC_ARG_WITH(system-firebird,
1732     AS_HELP_STRING([--with-system-firebird],
1733         [Use Firebird libraries already on system, for building the Firebird-SDBC
1734          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1735     [with_system_firebird="$with_system_libs"])
1737 AC_ARG_WITH(system-libtommath,
1738             AS_HELP_STRING([--with-system-libtommath],
1739                            [Use libtommath already on system]),,
1740             [with_system_libtommath="$with_system_libs"])
1742 AC_ARG_WITH(system-hsqldb,
1743     AS_HELP_STRING([--with-system-hsqldb],
1744         [Use hsqldb already on system.]))
1746 AC_ARG_WITH(hsqldb-jar,
1747     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1748         [Specify path to jarfile manually.]),
1749     HSQLDB_JAR=$withval)
1751 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1752     AS_HELP_STRING([--disable-scripting-beanshell],
1753         [Disable support for scripts in BeanShell.]),
1757 AC_ARG_WITH(system-beanshell,
1758     AS_HELP_STRING([--with-system-beanshell],
1759         [Use beanshell already on system.]),,
1760     [with_system_beanshell="$with_system_jars"])
1762 AC_ARG_WITH(beanshell-jar,
1763     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1764         [Specify path to jarfile manually.]),
1765     BSH_JAR=$withval)
1767 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1768     AS_HELP_STRING([--disable-scripting-javascript],
1769         [Disable support for scripts in JavaScript.]),
1773 AC_ARG_WITH(system-rhino,
1774     AS_HELP_STRING([--with-system-rhino],
1775         [Use rhino already on system.]),,)
1776 #    [with_system_rhino="$with_system_jars"])
1777 # Above is not used as we have different debug interface
1778 # patched into internal rhino. This code needs to be fixed
1779 # before we can enable it by default.
1781 AC_ARG_WITH(rhino-jar,
1782     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1783         [Specify path to jarfile manually.]),
1784     RHINO_JAR=$withval)
1786 AC_ARG_WITH(commons-logging-jar,
1787     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1788         [Specify path to jarfile manually.]),
1789     COMMONS_LOGGING_JAR=$withval)
1791 AC_ARG_WITH(system-jfreereport,
1792     AS_HELP_STRING([--with-system-jfreereport],
1793         [Use JFreeReport already on system.]),,
1794     [with_system_jfreereport="$with_system_jars"])
1796 AC_ARG_WITH(sac-jar,
1797     AS_HELP_STRING([--with-sac-jar=JARFILE],
1798         [Specify path to jarfile manually.]),
1799     SAC_JAR=$withval)
1801 AC_ARG_WITH(libxml-jar,
1802     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1803         [Specify path to jarfile manually.]),
1804     LIBXML_JAR=$withval)
1806 AC_ARG_WITH(flute-jar,
1807     AS_HELP_STRING([--with-flute-jar=JARFILE],
1808         [Specify path to jarfile manually.]),
1809     FLUTE_JAR=$withval)
1811 AC_ARG_WITH(jfreereport-jar,
1812     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1813         [Specify path to jarfile manually.]),
1814     JFREEREPORT_JAR=$withval)
1816 AC_ARG_WITH(liblayout-jar,
1817     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1818         [Specify path to jarfile manually.]),
1819     LIBLAYOUT_JAR=$withval)
1821 AC_ARG_WITH(libloader-jar,
1822     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1823         [Specify path to jarfile manually.]),
1824     LIBLOADER_JAR=$withval)
1826 AC_ARG_WITH(libformula-jar,
1827     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1828         [Specify path to jarfile manually.]),
1829     LIBFORMULA_JAR=$withval)
1831 AC_ARG_WITH(librepository-jar,
1832     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1833         [Specify path to jarfile manually.]),
1834     LIBREPOSITORY_JAR=$withval)
1836 AC_ARG_WITH(libfonts-jar,
1837     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1838         [Specify path to jarfile manually.]),
1839     LIBFONTS_JAR=$withval)
1841 AC_ARG_WITH(libserializer-jar,
1842     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1843         [Specify path to jarfile manually.]),
1844     LIBSERIALIZER_JAR=$withval)
1846 AC_ARG_WITH(libbase-jar,
1847     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1848         [Specify path to jarfile manually.]),
1849     LIBBASE_JAR=$withval)
1851 AC_ARG_WITH(system-odbc,
1852     AS_HELP_STRING([--with-system-odbc],
1853         [Use the odbc headers already on system.]),,
1854     [with_system_odbc="auto"])
1856 AC_ARG_WITH(system-sane,
1857     AS_HELP_STRING([--with-system-sane],
1858         [Use sane.h already on system.]),,
1859     [with_system_sane="$with_system_headers"])
1861 AC_ARG_WITH(system-bluez,
1862     AS_HELP_STRING([--with-system-bluez],
1863         [Use bluetooth.h already on system.]),,
1864     [with_system_bluez="$with_system_headers"])
1866 AC_ARG_WITH(system-curl,
1867     AS_HELP_STRING([--with-system-curl],
1868         [Use curl already on system.]),,
1869     [with_system_curl=auto])
1871 AC_ARG_WITH(system-boost,
1872     AS_HELP_STRING([--with-system-boost],
1873         [Use boost already on system.]),,
1874     [with_system_boost="$with_system_headers"])
1876 AC_ARG_WITH(system-glm,
1877     AS_HELP_STRING([--with-system-glm],
1878         [Use glm already on system.]),,
1879     [with_system_glm="$with_system_headers"])
1881 AC_ARG_WITH(system-hunspell,
1882     AS_HELP_STRING([--with-system-hunspell],
1883         [Use libhunspell already on system.]),,
1884     [with_system_hunspell="$with_system_libs"])
1886 AC_ARG_WITH(system-mythes,
1887     AS_HELP_STRING([--with-system-mythes],
1888         [Use mythes already on system.]),,
1889     [with_system_mythes="$with_system_libs"])
1891 AC_ARG_WITH(system-altlinuxhyph,
1892     AS_HELP_STRING([--with-system-altlinuxhyph],
1893         [Use ALTLinuxhyph already on system.]),,
1894     [with_system_altlinuxhyph="$with_system_libs"])
1896 AC_ARG_WITH(system-lpsolve,
1897     AS_HELP_STRING([--with-system-lpsolve],
1898         [Use lpsolve already on system.]),,
1899     [with_system_lpsolve="$with_system_libs"])
1901 AC_ARG_WITH(system-coinmp,
1902     AS_HELP_STRING([--with-system-coinmp],
1903         [Use CoinMP already on system.]),,
1904     [with_system_coinmp="$with_system_libs"])
1906 AC_ARG_WITH(system-liblangtag,
1907     AS_HELP_STRING([--with-system-liblangtag],
1908         [Use liblangtag library already on system.]),,
1909     [with_system_liblangtag="$with_system_libs"])
1911 AC_ARG_WITH(webdav,
1912     AS_HELP_STRING([--with-webdav],
1913         [Specify which library to use for webdav implementation.
1914          Possible values: "neon", "serf", "no". The default value is "neon".
1915          Example: --with-webdav="serf"]),
1916     WITH_WEBDAV=$withval,
1917     WITH_WEBDAV="neon")
1919 AC_ARG_WITH(linker-hash-style,
1920     AS_HELP_STRING([--with-linker-hash-style],
1921         [Use linker with --hash-style=<style> when linking shared objects.
1922          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1923          if supported on the build system, and "sysv" otherwise.]))
1925 AC_ARG_WITH(jdk-home,
1926     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1927         [If you have installed JDK 1.6 or later on your system please supply the
1928          path here. Note that this is not the location of the java command but the
1929          location of the entire distribution.]),
1932 AC_ARG_WITH(help,
1933     AS_HELP_STRING([--with-help],
1934         [Enable the build of help. There is a special parameter "common" that
1935          can be used to bundle only the common part, .e.g help-specific icons.
1936          This is useful when you build the helpcontent separately.])
1937     [
1938                           Usage:     --with-help    build the old local help
1939                                  --without-help     no local help (default)
1940                                  --with-help=html   build the new HTML local help
1941                                  --with-help=online build the new HTML online help
1942                                  --with-help=common bundle common files for the local
1943                                                     help but do not build the whole help
1944     ],
1947 libo_FUZZ_ARG_WITH(java,
1948     AS_HELP_STRING([--with-java=<java command>],
1949         [Specify the name of the Java interpreter command. Typically "java"
1950          which is the default.
1952          To build without support for Java components, applets, accessibility
1953          or the XML filters written in Java, use --without-java or --with-java=no.]),
1954     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1955     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
1958 AC_ARG_WITH(jvm-path,
1959     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
1960         [Use a specific JVM search path at runtime.
1961          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
1964 AC_ARG_WITH(ant-home,
1965     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
1966         [If you have installed Jakarta Ant on your system, please supply the path here.
1967          Note that this is not the location of the Ant binary but the location
1968          of the entire distribution.]),
1971 AC_ARG_WITH(symbol-config,
1972     AS_HELP_STRING([--with-symbol-config],
1973         [Configuration for the crashreport symbol upload]),
1974         [],
1975         [with_symbol_config=no])
1977 AC_ARG_WITH(export-validation,
1978     AS_HELP_STRING([--without-export-validation],
1979         [Disable validating OOXML and ODF files as exported from in-tree tests.
1980          Use this option e.g. if your system only provides Java 5.]),
1981 ,with_export_validation=auto)
1983 AC_ARG_WITH(bffvalidator,
1984     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
1985         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
1986          Requires installed Microsoft Office Binary File Format Validator.
1987          Note: export-validation (--with-export-validation) is required to be turned on.
1988          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
1989 ,with_bffvalidator=no)
1991 libo_FUZZ_ARG_WITH(junit,
1992     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
1993         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
1994          --without-junit disables those tests. Not relevant in the --without-java case.]),
1995 ,with_junit=yes)
1997 AC_ARG_WITH(hamcrest,
1998     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
1999         [Specifies the hamcrest jar file to use for JUnit-based tests.
2000          --without-junit disables those tests. Not relevant in the --without-java case.]),
2001 ,with_hamcrest=yes)
2003 AC_ARG_WITH(perl-home,
2004     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2005         [If you have installed Perl 5 Distribution, on your system, please
2006          supply the path here. Note that this is not the location of the Perl
2007          binary but the location of the entire distribution.]),
2010 libo_FUZZ_ARG_WITH(doxygen,
2011     AS_HELP_STRING(
2012         [--with-doxygen=<absolute path to doxygen executable>],
2013         [Specifies the doxygen executable to use when generating ODK C/C++
2014          documentation. --without-doxygen disables generation of ODK C/C++
2015          documentation. Not relevant in the --disable-odk case.]),
2016 ,with_doxygen=yes)
2018 AC_ARG_WITH(visual-studio,
2019     AS_HELP_STRING([--with-visual-studio=<2015/2017>],
2020         [Specify which Visual Studio version to use in case several are
2021          installed. If not specified, defaults to 2015.]),
2024 AC_ARG_WITH(windows-sdk,
2025     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
2026         [Specify which Windows SDK, or "Windows Kit", version to use
2027          in case the one that came with the selected Visual Studio
2028          is not what you want for some reason. Note that not all compiler/SDK
2029          combinations are supported. The intent is that this option should not
2030          be needed.]),
2033 AC_ARG_WITH(lang,
2034     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2035         [Use this option to build LibreOffice with additional UI language support.
2036          English (US) is always included by default.
2037          Separate multiple languages with space.
2038          For all languages, use --with-lang=ALL.]),
2041 AC_ARG_WITH(locales,
2042     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2043         [Use this option to limit the locale information built in.
2044          Separate multiple locales with space.
2045          Very experimental and might well break stuff.
2046          Just a desperate measure to shrink code and data size.
2047          By default all the locales available is included.
2048          This option is completely unrelated to --with-lang.])
2049     [
2050                           Affects also our character encoding conversion
2051                           tables for encodings mainly targeted for a
2052                           particular locale, like EUC-CN and EUC-TW for
2053                           zh, ISO-2022-JP for ja.
2055                           Affects also our add-on break iterator data for
2056                           some languages.
2058                           For the default, all locales, don't use this switch at all.
2059                           Specifying just the language part of a locale means all matching
2060                           locales will be included.
2061     ],
2064 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2065 libo_FUZZ_ARG_WITH(krb5,
2066     AS_HELP_STRING([--with-krb5],
2067         [Enable MIT Kerberos 5 support in modules that support it.
2068          By default automatically enabled on platforms
2069          where a good system Kerberos 5 is available.]),
2072 libo_FUZZ_ARG_WITH(gssapi,
2073     AS_HELP_STRING([--with-gssapi],
2074         [Enable GSSAPI support in modules that support it.
2075          By default automatically enabled on platforms
2076          where a good system GSSAPI is available.]),
2079 AC_ARG_WITH(iwyu,
2080     AS_HELP_STRING([--with-iwyu],
2081         [Use given IWYU binary path to check unneeded includes instead of building.
2082          Use only if you are hacking on it.]),
2085 libo_FUZZ_ARG_WITH(lxml,
2086     AS_HELP_STRING([--without-lxml],
2087         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2088          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2089          report widget classes and ids.]),
2092 dnl ===================================================================
2093 dnl Branding
2094 dnl ===================================================================
2096 AC_ARG_WITH(branding,
2097     AS_HELP_STRING([--with-branding=/path/to/images],
2098         [Use given path to retrieve branding images set.])
2099     [
2100                           Search for intro.png about.svg and flat_logo.svg.
2101                           If any is missing, default ones will be used instead.
2103                           Search also progress.conf for progress
2104                           settings on intro screen :
2106                           PROGRESSBARCOLOR="255,255,255" Set color of
2107                           progress bar. Comma separated RGB decimal values.
2108                           PROGRESSSIZE="407,6" Set size of progress bar.
2109                           Comma separated decimal values (width, height).
2110                           PROGRESSPOSITION="61,317" Set position of progress
2111                           bar from left,top. Comma separated decimal values.
2112                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2113                           bar frame. Comma separated RGB decimal values.
2114                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2115                           bar text. Comma separated RGB decimal values.
2116                           PROGRESSTEXTBASELINE="287" Set vertical position of
2117                           progress bar text from top. Decimal value.
2119                           Default values will be used if not found.
2120     ],
2124 AC_ARG_WITH(extra-buildid,
2125     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2126         [Show addition build identification in about dialog.]),
2130 AC_ARG_WITH(vendor,
2131     AS_HELP_STRING([--with-vendor="John the Builder"],
2132         [Set vendor of the build.]),
2135 AC_ARG_WITH(android-package-name,
2136     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2137         [Set Android package name of the build.]),
2140 AC_ARG_WITH(compat-oowrappers,
2141     AS_HELP_STRING([--with-compat-oowrappers],
2142         [Install oo* wrappers in parallel with
2143          lo* ones to keep backward compatibility.
2144          Has effect only with make distro-pack-install]),
2147 AC_ARG_WITH(os-version,
2148     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2149         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2152 AC_ARG_WITH(mingw-cross-compiler,
2153     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2154         [Specify the MinGW cross-compiler to use.
2155          When building on the ODK on Unix and building unowinreg.dll,
2156          specify the MinGW C++ cross-compiler.]),
2159 AC_ARG_WITH(idlc-cpp,
2160     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2161         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2164 AC_ARG_WITH(build-version,
2165     AS_HELP_STRING([--with-build-version="Built by Jim"],
2166         [Allows the builder to add a custom version tag that will appear in the
2167          Help/About box for QA purposes.]),
2168 with_build_version=$withval,
2171 AC_ARG_WITH(alloc,
2172     AS_HELP_STRING([--with-alloc],
2173         [Define which allocator to build with (choices are internal, system).]),
2176 AC_ARG_WITH(parallelism,
2177     AS_HELP_STRING([--with-parallelism],
2178         [Number of jobs to run simultaneously during build. Parallel builds can
2179         save a lot of time on multi-cpu machines. Defaults to the number of
2180         CPUs on the machine, unless you configure --enable-icecream - then to
2181         10.]),
2184 AC_ARG_WITH(all-tarballs,
2185     AS_HELP_STRING([--with-all-tarballs],
2186         [Download all external tarballs unconditionally]))
2188 AC_ARG_WITH(gdrive-client-id,
2189     AS_HELP_STRING([--with-gdrive-client-id],
2190         [Provides the client id of the application for OAuth2 authentication
2191         on Google Drive. If either this or --with-gdrive-client-secret is
2192         empty, the feature will be disabled]),
2195 AC_ARG_WITH(gdrive-client-secret,
2196     AS_HELP_STRING([--with-gdrive-client-secret],
2197         [Provides the client secret of the application for OAuth2
2198         authentication on Google Drive. If either this or
2199         --with-gdrive-client-id is empty, the feature will be disabled]),
2202 AC_ARG_WITH(alfresco-cloud-client-id,
2203     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2204         [Provides the client id of the application for OAuth2 authentication
2205         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2206         empty, the feature will be disabled]),
2209 AC_ARG_WITH(alfresco-cloud-client-secret,
2210     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2211         [Provides the client secret of the application for OAuth2
2212         authentication on Alfresco Cloud. If either this or
2213         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2216 AC_ARG_WITH(onedrive-client-id,
2217     AS_HELP_STRING([--with-onedrive-client-id],
2218         [Provides the client id of the application for OAuth2 authentication
2219         on OneDrive. If either this or --with-onedrive-client-secret is
2220         empty, the feature will be disabled]),
2223 AC_ARG_WITH(onedrive-client-secret,
2224     AS_HELP_STRING([--with-onedrive-client-secret],
2225         [Provides the client secret of the application for OAuth2
2226         authentication on OneDrive. If either this or
2227         --with-onedrive-client-id is empty, the feature will be disabled]),
2229 dnl ===================================================================
2230 dnl Do we want to use pre-build binary tarball for recompile
2231 dnl ===================================================================
2233 if test "$enable_library_bin_tar" = "yes" ; then
2234     USE_LIBRARY_BIN_TAR=TRUE
2235 else
2236     USE_LIBRARY_BIN_TAR=
2238 AC_SUBST(USE_LIBRARY_BIN_TAR)
2240 dnl ===================================================================
2241 dnl Test whether build target is Release Build
2242 dnl ===================================================================
2243 AC_MSG_CHECKING([whether build target is Release Build])
2244 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2245     AC_MSG_RESULT([no])
2246     ENABLE_RELEASE_BUILD=
2247 else
2248     AC_MSG_RESULT([yes])
2249     ENABLE_RELEASE_BUILD=TRUE
2251 AC_SUBST(ENABLE_RELEASE_BUILD)
2253 dnl ===================================================================
2254 dnl Test whether to sign Windows Build
2255 dnl ===================================================================
2256 AC_MSG_CHECKING([whether to sign windows build])
2257 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2258     AC_MSG_RESULT([yes])
2259     WINDOWS_BUILD_SIGNING="TRUE"
2260 else
2261     AC_MSG_RESULT([no])
2262     WINDOWS_BUILD_SIGNING="FALSE"
2264 AC_SUBST(WINDOWS_BUILD_SIGNING)
2266 dnl ===================================================================
2267 dnl MacOSX build and runtime environment options
2268 dnl ===================================================================
2270 AC_ARG_WITH(macosx-sdk,
2271     AS_HELP_STRING([--with-macosx-sdk=<version>],
2272         [Prefer a specific SDK for building.])
2273     [
2274                           If the requested SDK is not available, a search for the oldest one will be done.
2275                           With current Xcode versions, only the latest SDK is included, so this option is
2276                           not terribly useful. It works fine to build with a new SDK and run the result
2277                           on an older OS.
2279                           e. g.: --with-macosx-sdk=10.9
2281                           there are 3 options to control the MacOSX build:
2282                           --with-macosx-sdk (referred as 'sdk' below)
2283                           --with-macosx-version-min-required (referred as 'min' below)
2284                           --with-macosx-version-max-allowed (referred as 'max' below)
2286                           the connection between these value and the default they take is as follow:
2287                           ( ? means not specified on the command line, s means the SDK version found,
2288                           constraint: 8 <= x <= y <= z)
2290                           ==========================================
2291                            command line      || config result
2292                           ==========================================
2293                           min  | max  | sdk  || min  | max  | sdk  |
2294                           ?    | ?    | ?    || 10.9 | 10.s | 10.s |
2295                           ?    | ?    | 10.x || 10.9 | 10.x | 10.x |
2296                           ?    | 10.x | ?    || 10.9 | 10.s | 10.s |
2297                           ?    | 10.x | 10.y || 10.9 | 10.x | 10.y |
2298                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2299                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2300                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2301                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2304                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2305                           for a detailed technical explanation of these variables
2307                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2308     ],
2311 AC_ARG_WITH(macosx-version-min-required,
2312     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2313         [set the minimum OS version needed to run the built LibreOffice])
2314     [
2315                           e. g.: --with-macos-version-min-required=10.9
2316                           see --with-macosx-sdk for more info
2317     ],
2320 AC_ARG_WITH(macosx-version-max-allowed,
2321     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2322         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2323     [
2324                           e. g.: --with-macos-version-max-allowed=10.9
2325                           see --with-macosx-sdk for more info
2326     ],
2330 dnl ===================================================================
2331 dnl options for stuff used during cross-compilation build
2332 dnl Not quite superseded by --with-build-platform-configure-options.
2333 dnl TODO: check, if the "force" option is still needed anywhere.
2334 dnl ===================================================================
2336 AC_ARG_WITH(system-icu-for-build,
2337     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2338         [Use icu already on system for build tools (cross-compilation only).]))
2341 dnl ===================================================================
2342 dnl Check for incompatible options set by fuzzing, and reset those
2343 dnl automatically to working combinations
2344 dnl ===================================================================
2346 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2347         "$enable_dbus" != "$enable_avahi"; then
2348     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2349     enable_avahi=$enable_dbus
2352 dnl ===================================================================
2353 dnl check for required programs (grep, awk, sed, bash)
2354 dnl ===================================================================
2356 pathmunge ()
2358     if test -n "$1"; then
2359         if test "$build_os" = "cygwin"; then
2360             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2361                 PathFormat "$1"
2362                 new_path=`cygpath -sm "$formatted_path"`
2363             else
2364                 PathFormat "$1"
2365                 new_path=`cygpath -u "$formatted_path"`
2366             fi
2367         else
2368             new_path="$1"
2369         fi
2370         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2371             if test "$2" = "after"; then
2372                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2373             else
2374                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2375             fi
2376         fi
2377         unset new_path
2378     fi
2381 AC_PROG_AWK
2382 AC_PATH_PROG( AWK, $AWK)
2383 if test -z "$AWK"; then
2384     AC_MSG_ERROR([install awk to run this script])
2387 AC_PATH_PROG(BASH, bash)
2388 if test -z "$BASH"; then
2389     AC_MSG_ERROR([bash not found in \$PATH])
2391 AC_SUBST(BASH)
2393 AC_MSG_CHECKING([for GNU or BSD tar])
2394 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2395     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2396     if test $? -eq 0;  then
2397         GNUTAR=$a
2398         break
2399     fi
2400 done
2401 AC_MSG_RESULT($GNUTAR)
2402 if test -z "$GNUTAR"; then
2403     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2405 AC_SUBST(GNUTAR)
2407 AC_MSG_CHECKING([for tar's option to strip components])
2408 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2409 if test $? -eq 0; then
2410     STRIP_COMPONENTS="--strip-components"
2411 else
2412     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2413     if test $? -eq 0; then
2414         STRIP_COMPONENTS="--strip-path"
2415     else
2416         STRIP_COMPONENTS="unsupported"
2417     fi
2419 AC_MSG_RESULT($STRIP_COMPONENTS)
2420 if test x$STRIP_COMPONENTS = xunsupported; then
2421     AC_MSG_ERROR([you need a tar that is able to strip components.])
2423 AC_SUBST(STRIP_COMPONENTS)
2425 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2426 dnl desktop OSes from "mobile" ones.
2428 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2429 dnl In other words, that when building for an OS that is not a
2430 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2432 dnl Note the direction of the implication; there is no assumption that
2433 dnl cross-compiling would imply a non-desktop OS.
2435 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2436     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2437     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2438     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2441 # Whether to build "avmedia" functionality or not.
2443 if test -z "$enable_avmedia"; then
2444     enable_avmedia=yes
2447 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2448 if test "$enable_avmedia" = yes; then
2449     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2450 else
2451     USE_AVMEDIA_DUMMY='TRUE'
2453 AC_SUBST(USE_AVMEDIA_DUMMY)
2455 # Decide whether to build database connectivity stuff (including
2456 # Base) or not. We probably don't want to on non-desktop OSes.
2457 if test -z "$enable_database_connectivity"; then
2458     # --disable-database-connectivity is unfinished work in progress
2459     # and the iOS test app doesn't link if we actually try to use it.
2460     # if test $_os != iOS -a $_os != Android; then
2461     if test $_os != iOS; then
2462         enable_database_connectivity=yes
2463     fi
2466 if test "$enable_database_connectivity" = yes; then
2467     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2468     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2471 if test -z "$enable_extensions"; then
2472     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2473     if test $_os != iOS -a $_os != Android; then
2474         enable_extensions=yes
2475     fi
2478 if test "$enable_extensions" = yes; then
2479     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2480     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2483 if test -z "$enable_scripting"; then
2484     # Disable scripting for iOS unless specifically overridden
2485     # with --enable-scripting.
2486     if test $_os != iOS; then
2487         enable_scripting=yes
2488     fi
2491 DISABLE_SCRIPTING=''
2492 if test "$enable_scripting" = yes; then
2493     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2494     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2495 else
2496     DISABLE_SCRIPTING='TRUE'
2497     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2500 if test $_os = iOS -o $_os = Android; then
2501     # Disable dynamic_loading always for iOS and Android
2502     enable_dynamic_loading=no
2503 elif test -z "$enable_dynamic_loading"; then
2504     # Otherwise enable it unless speficically disabled
2505     enable_dynamic_loading=yes
2508 DISABLE_DYNLOADING=''
2509 if test "$enable_dynamic_loading" = yes; then
2510     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2511 else
2512     DISABLE_DYNLOADING='TRUE'
2514 AC_SUBST(DISABLE_DYNLOADING)
2516 # remenber SYSBASE value
2517 AC_SUBST(SYSBASE)
2519 dnl ===================================================================
2520 dnl  Sort out various gallery compilation options
2521 dnl ===================================================================
2522 AC_MSG_CHECKING([how to build and package galleries])
2523 if test -n "${with_galleries}"; then
2524     if test "$with_galleries" = "build"; then
2525         WITH_GALLERY_BUILD=TRUE
2526         AC_MSG_RESULT([build from source images internally])
2527     elif test "$with_galleries" = "no"; then
2528         WITH_GALLERY_BUILD=
2529         AC_MSG_RESULT([disable non-internal gallery build])
2530     else
2531         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2532     fi
2533 else
2534     if test $_os != iOS -a $_os != Android; then
2535         WITH_GALLERY_BUILD=TRUE
2536         AC_MSG_RESULT([internal src images for desktop])
2537     else
2538         WITH_GALLERY_BUILD=
2539         AC_MSG_RESULT([disable src image build])
2540     fi
2542 AC_SUBST(WITH_GALLERY_BUILD)
2544 dnl ===================================================================
2545 dnl  Checks if ccache is available
2546 dnl ===================================================================
2547 if test "$_os" = "WINNT"; then
2548     # on windows/VC build do not use ccache
2549     CCACHE=""
2550 elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2551     case "%$CC%$CXX%" in
2552     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2553     # assume that's good then
2554     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2555         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2556         ;;
2557     *)
2558         AC_PATH_PROG([CCACHE],[ccache],[not found])
2559         if test "$CCACHE" = "not found"; then
2560             CCACHE=""
2561         else
2562             # Need to check for ccache version: otherwise prevents
2563             # caching of the results (like "-x objective-c++" for Mac)
2564             if test $_os = Darwin -o $_os = iOS; then
2565                 # Check ccache version
2566                 AC_MSG_CHECKING([whether version of ccache is suitable])
2567                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2568                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2569                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2570                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2571                 else
2572                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2573                     CCACHE=""
2574                 fi
2575             fi
2576         fi
2577         ;;
2578     esac
2579 else
2580     CCACHE=""
2583 if test "$CCACHE" != ""; then
2584     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2585     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2586     if test "$ccache_size" = ""; then
2587         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2588         if test "$ccache_size" = ""; then
2589             ccache_size=0
2590         fi
2591         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2592         if test $ccache_size -lt 1024; then
2593             CCACHE=""
2594             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2595             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2596         else
2597             # warn that ccache may be too small for debug build
2598             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2599             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2600         fi
2601     else
2602         if test $ccache_size -lt 5; then
2603             #warn that ccache may be too small for debug build
2604             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2605             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2606         fi
2607     fi
2610 dnl ===================================================================
2611 dnl  Checks for C compiler,
2612 dnl  The check for the C++ compiler is later on.
2613 dnl ===================================================================
2614 if test "$_os" != "WINNT"; then
2615     GCC_HOME_SET="true"
2616     AC_MSG_CHECKING([gcc home])
2617     if test -z "$with_gcc_home"; then
2618         if test "$enable_icecream" = "yes"; then
2619             if test -d "/usr/lib/icecc/bin"; then
2620                 GCC_HOME="/usr/lib/icecc/"
2621             else
2622                 GCC_HOME="/opt/icecream/"
2623             fi
2624         else
2625             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2626             GCC_HOME_SET="false"
2627         fi
2628     else
2629         GCC_HOME="$with_gcc_home"
2630     fi
2631     AC_MSG_RESULT($GCC_HOME)
2632     AC_SUBST(GCC_HOME)
2634     if test "$GCC_HOME_SET" = "true"; then
2635         if test -z "$CC"; then
2636             CC="$GCC_HOME/bin/gcc"
2637         fi
2638         if test -z "$CXX"; then
2639             CXX="$GCC_HOME/bin/g++"
2640         fi
2641     fi
2644 COMPATH=`dirname "$CC"`
2645 if test "$COMPATH" = "."; then
2646     AC_PATH_PROGS(COMPATH, $CC)
2647     dnl double square bracket to get single because of M4 quote...
2648     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2650 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2652 dnl ===================================================================
2653 dnl Java support
2654 dnl ===================================================================
2655 AC_MSG_CHECKING([whether to build with Java support])
2656 if test "$with_java" != "no"; then
2657     if test "$DISABLE_SCRIPTING" = TRUE; then
2658         AC_MSG_RESULT([no, overridden by --disable-scripting])
2659         ENABLE_JAVA=""
2660         with_java=no
2661     else
2662         AC_MSG_RESULT([yes])
2663         ENABLE_JAVA="TRUE"
2664         AC_DEFINE(HAVE_FEATURE_JAVA)
2665     fi
2666 else
2667     AC_MSG_RESULT([no])
2668     ENABLE_JAVA=""
2671 AC_SUBST(ENABLE_JAVA)
2673 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2675 dnl ENABLE_JAVA="" indicate no Java support at all
2677 dnl ===================================================================
2678 dnl Check OS X SDK and compiler
2679 dnl ===================================================================
2681 if test $_os = Darwin -o $_os = iOS; then
2683     # If no --with-macosx-sdk option is given, look for one
2685     # The intent is that for "most" Mac-based developers, a suitable
2686     # SDK will be found automatically without any configure options.
2688     # For developers with a current Xcode, the lowest-numbered SDK
2689     # higher than or equal to the minimum required should be found.
2691     AC_MSG_CHECKING([what Mac OS X SDK to use])
2692     for _macosx_sdk in $with_macosx_sdk 10.13 10.12; do
2693         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2694         if test -d "$MACOSX_SDK_PATH"; then
2695             with_macosx_sdk="${_macosx_sdk}"
2696             break
2697         else
2698             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2699             if test -d "$MACOSX_SDK_PATH"; then
2700                 with_macosx_sdk="${_macosx_sdk}"
2701                 break
2702             fi
2703         fi
2704     done
2705     if test ! -d "$MACOSX_SDK_PATH"; then
2706         AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2707     fi
2709     if test $_os = iOS; then
2710         if test "$enable_ios_simulator" = "yes"; then
2711             useos=iphonesimulator
2712         else
2713             useos=iphoneos
2714         fi
2715         MACOSX_SDK_PATH=`xcrun --sdk ${useos} --show-sdk-path 2> /dev/null`
2716     fi
2717     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2720     case $with_macosx_sdk in
2721     10.9)
2722         MACOSX_SDK_VERSION=1090
2723         ;;
2724     10.10)
2725         MACOSX_SDK_VERSION=101000
2726         ;;
2727     10.11)
2728         MACOSX_SDK_VERSION=101100
2729         ;;
2730     10.12)
2731         MACOSX_SDK_VERSION=101200
2732         ;;
2733     10.13)
2734         MACOSX_SDK_VERSION=101300
2735         ;;
2736     *)
2737         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.9--13])
2738         ;;
2739     esac
2741     if test "$with_macosx_version_min_required" = "" ; then
2742         with_macosx_version_min_required="10.9";
2743     fi
2745     if test "$with_macosx_version_max_allowed" = "" ; then
2746         with_macosx_version_max_allowed="$with_macosx_sdk"
2747     fi
2749     # export this so that "xcrun" invocations later return matching values
2750     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2751     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2752     export DEVELOPER_DIR
2753     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2754     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2756     case "$with_macosx_version_min_required" in
2757     10.9)
2758         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2759         ;;
2760     10.10)
2761         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2762         ;;
2763     10.11)
2764         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2765         ;;
2766     10.12)
2767         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2768         ;;
2769     10.13)
2770         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2771         ;;
2772     *)
2773         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.9--13])
2774         ;;
2775     esac
2776     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2778     LIBTOOL=/usr/bin/libtool
2779     INSTALL_NAME_TOOL=install_name_tool
2780     if test -z "$save_CC"; then
2781         AC_MSG_CHECKING([what compiler to use])
2782         stdlib=-stdlib=libc++
2783         if test "$ENABLE_LTO" = TRUE; then
2784             lto=-flto
2785         fi
2786         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2787         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2788         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2789         AR=`xcrun -find ar`
2790         NM=`xcrun -find nm`
2791         STRIP=`xcrun -find strip`
2792         LIBTOOL=`xcrun -find libtool`
2793         RANLIB=`xcrun -find ranlib`
2794         AC_MSG_RESULT([$CC and $CXX])
2795     fi
2797     case "$with_macosx_version_max_allowed" in
2798     10.9)
2799         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2800         ;;
2801     10.10)
2802         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2803         ;;
2804     10.11)
2805         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2806         ;;
2807     10.12)
2808         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2809         ;;
2810     10.13)
2811         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2812         ;;
2813     *)
2814         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.9--13])
2815         ;;
2816     esac
2818     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2819     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2820         AC_MSG_RESULT([$MAC_OS_X_VERSION_MIN_REQUIRED])
2821         AC_MSG_RESULT([$MAC_OS_X_VERSION_MAX_REQUIRED])
2822         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2823     else
2824         AC_MSG_RESULT([ok])
2825     fi
2827     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2828     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2829         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2830     else
2831         AC_MSG_RESULT([ok])
2832     fi
2833     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2834     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2836     AC_MSG_CHECKING([whether to do code signing])
2838     if test "$enable_macosx_code_signing" = yes; then
2839         # By default use the first suitable certificate (?).
2841         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2842         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2843         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2844         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2845         # "Developer ID Application" one.
2847         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2848         if test -n "$identity"; then
2849             MACOSX_CODESIGNING_IDENTITY=$identity
2850             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2851             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2852         else
2853             AC_MSG_ERROR([cannot determine identity to use])
2854         fi
2855     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2856         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2857         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2858         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2859     else
2860         AC_MSG_RESULT([no])
2861     fi
2863     AC_MSG_CHECKING([whether to create a Mac App Store package])
2865     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2866         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2867     elif test "$enable_macosx_package_signing" = yes; then
2868         # By default use the first suitable certificate.
2869         # It should be a "3rd Party Mac Developer Installer" one
2871         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2872         if test -n "$identity"; then
2873             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2874             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2875             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2876         else
2877             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2878         fi
2879     elif test -n "$enable_macosx_package_signing"; then
2880         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2881         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2882         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2883     else
2884         AC_MSG_RESULT([no])
2885     fi
2887     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2888         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2889     fi
2891     AC_MSG_CHECKING([whether to sandbox the application])
2893     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2894         AC_MSG_ERROR([OS X sandboxing requires code signing])
2895     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2896         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2897     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2898         ENABLE_MACOSX_SANDBOX=TRUE
2899         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2900         AC_MSG_RESULT([yes])
2901     else
2902         AC_MSG_RESULT([no])
2903     fi
2905     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2906     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2907     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2909 AC_SUBST(MACOSX_SDK_PATH)
2910 AC_SUBST(MACOSX_SDK_VERSION)
2911 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2912 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2913 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
2914 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2915 AC_SUBST(INSTALL_NAME_TOOL)
2916 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2917 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2918 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2919 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2920 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2922 dnl ===================================================================
2923 dnl Check iOS SDK and compiler
2924 dnl ===================================================================
2926 if test $_os = iOS; then
2927     AC_MSG_CHECKING([what iOS SDK to use])
2928     current_sdk_ver=11.2
2929     if test "$enable_ios_simulator" = "yes"; then
2930         platform=iPhoneSimulator
2931         versionmin=-mios-simulator-version-min=$current_sdk_ver
2932     else
2933         platform=iPhoneOS
2934         versionmin=-miphoneos-version-min=$current_sdk_ver
2935     fi
2936     xcode_developer=`xcode-select -print-path`
2938     for sdkver in $current_sdk_ver; do
2939         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2940         if test -d $t; then
2941             ios_sdk=$sdkver
2942             sysroot=$t
2943             break
2944         fi
2945     done
2947     if test -z "$sysroot"; then
2948         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
2949     fi
2951     AC_MSG_RESULT($sysroot)
2953     IOS_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
2954     IOS_DEPLOYMENT_VERSION=$current_sdk_ver
2956     # LTO is not really recommended for iOS builds,
2957     # the link time will be astronomical
2958     if test "$ENABLE_LTO" = TRUE; then
2959         lto=-flto
2960     fi
2962     stdlib="-stdlib=libc++"
2964     CC="`xcrun -find clang` -arch $host_cpu -isysroot $sysroot $lto $versionmin"
2965     CXX="`xcrun -find clang++` -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
2967     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2968     AR=`xcrun -find ar`
2969     NM=`xcrun -find nm`
2970     STRIP=`xcrun -find strip`
2971     LIBTOOL=`xcrun -find libtool`
2972     RANLIB=`xcrun -find ranlib`
2975 AC_SUBST(IOS_SDK)
2976 AC_SUBST(IOS_DEPLOYMENT_VERSION)
2978 AC_MSG_CHECKING([whether to treat the installation as read-only])
2980 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
2981         "$enable_extensions" != yes; then
2982     enable_readonly_installset=yes
2984 if test "$enable_readonly_installset" = yes; then
2985     AC_MSG_RESULT([yes])
2986     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
2987 else
2988     AC_MSG_RESULT([no])
2991 dnl ===================================================================
2992 dnl Structure of install set
2993 dnl ===================================================================
2995 if test $_os = Darwin; then
2996     LIBO_BIN_FOLDER=MacOS
2997     LIBO_ETC_FOLDER=Resources
2998     LIBO_LIBEXEC_FOLDER=MacOS
2999     LIBO_LIB_FOLDER=Frameworks
3000     LIBO_LIB_PYUNO_FOLDER=Resources
3001     LIBO_SHARE_FOLDER=Resources
3002     LIBO_SHARE_HELP_FOLDER=Resources/help
3003     LIBO_SHARE_JAVA_FOLDER=Resources/java
3004     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3005     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3006     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3007     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3008     LIBO_URE_BIN_FOLDER=MacOS
3009     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3010     LIBO_URE_LIB_FOLDER=Frameworks
3011     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3012     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3013 elif test $_os = WINNT; then
3014     LIBO_BIN_FOLDER=program
3015     LIBO_ETC_FOLDER=program
3016     LIBO_LIBEXEC_FOLDER=program
3017     LIBO_LIB_FOLDER=program
3018     LIBO_LIB_PYUNO_FOLDER=program
3019     LIBO_SHARE_FOLDER=share
3020     LIBO_SHARE_HELP_FOLDER=help
3021     LIBO_SHARE_JAVA_FOLDER=program/classes
3022     LIBO_SHARE_PRESETS_FOLDER=presets
3023     LIBO_SHARE_READMES_FOLDER=readmes
3024     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3025     LIBO_SHARE_SHELL_FOLDER=program/shell
3026     LIBO_URE_BIN_FOLDER=program
3027     LIBO_URE_ETC_FOLDER=program
3028     LIBO_URE_LIB_FOLDER=program
3029     LIBO_URE_MISC_FOLDER=program
3030     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3031 else
3032     LIBO_BIN_FOLDER=program
3033     LIBO_ETC_FOLDER=program
3034     LIBO_LIBEXEC_FOLDER=program
3035     LIBO_LIB_FOLDER=program
3036     LIBO_LIB_PYUNO_FOLDER=program
3037     LIBO_SHARE_FOLDER=share
3038     LIBO_SHARE_HELP_FOLDER=help
3039     LIBO_SHARE_JAVA_FOLDER=program/classes
3040     LIBO_SHARE_PRESETS_FOLDER=presets
3041     LIBO_SHARE_READMES_FOLDER=readmes
3042     if test "$enable_fuzzers" != yes; then
3043         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3044     else
3045         LIBO_SHARE_RESOURCE_FOLDER=resource
3046     fi
3047     LIBO_SHARE_SHELL_FOLDER=program/shell
3048     LIBO_URE_BIN_FOLDER=program
3049     LIBO_URE_ETC_FOLDER=program
3050     LIBO_URE_LIB_FOLDER=program
3051     LIBO_URE_MISC_FOLDER=program
3052     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3054 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3055 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3056 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3057 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3058 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3059 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3060 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3061 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3062 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3063 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3064 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3065 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3066 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3067 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3068 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3069 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3071 # Not all of them needed in config_host.mk, add more if need arises
3072 AC_SUBST(LIBO_BIN_FOLDER)
3073 AC_SUBST(LIBO_ETC_FOLDER)
3074 AC_SUBST(LIBO_LIB_FOLDER)
3075 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3076 AC_SUBST(LIBO_SHARE_FOLDER)
3077 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3078 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3079 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3080 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3081 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3082 AC_SUBST(LIBO_URE_BIN_FOLDER)
3083 AC_SUBST(LIBO_URE_ETC_FOLDER)
3084 AC_SUBST(LIBO_URE_LIB_FOLDER)
3085 AC_SUBST(LIBO_URE_MISC_FOLDER)
3086 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3088 dnl ===================================================================
3089 dnl Windows specific tests and stuff
3090 dnl ===================================================================
3092 reg_get_value()
3094     # Return value: $regvalue
3095     unset regvalue
3097     local _regentry="/proc/registry${1}/${2}"
3098     if test -f "$_regentry"; then
3099         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3100         # Registry keys read via /proc/registry* are always \0 terminated!
3101         local _regvalue=$(tr -d '\0' < "$_regentry")
3102         if test $? -eq 0; then
3103             regvalue=$_regvalue
3104         fi
3105     fi
3108 # Get a value from the 32-bit side of the Registry
3109 reg_get_value_32()
3111     reg_get_value "32" "$1"
3114 # Get a value from the 64-bit side of the Registry
3115 reg_get_value_64()
3117     reg_get_value "64" "$1"
3120 if test "$_os" = "WINNT"; then
3121     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3122     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3123         AC_MSG_RESULT([no])
3124         WINDOWS_SDK_ARCH="x86"
3125     else
3126         AC_MSG_RESULT([yes])
3127         WINDOWS_SDK_ARCH="x64"
3128         BITNESS_OVERRIDE=64
3129     fi
3131 if test "$_os" = "iOS"; then
3132     cross_compiling="yes"
3135 if test "$cross_compiling" = "yes"; then
3136     export CROSS_COMPILING=TRUE
3137 else
3138     CROSS_COMPILING=
3139     BUILD_TYPE="$BUILD_TYPE NATIVE"
3141 AC_SUBST(CROSS_COMPILING)
3143 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3144 if test "$GCC" = "yes"; then
3145     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
3146     bsymbolic_functions_ldflags_save=$LDFLAGS
3147     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3148     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3149 #include <stdio.h>
3150         ],[
3151 printf ("hello world\n");
3152         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3153     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3154         AC_MSG_RESULT( found )
3155     else
3156         AC_MSG_RESULT( not found )
3157     fi
3158     LDFLAGS=$bsymbolic_functions_ldflags_save
3160 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3162 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3163 # NOTE: must _not_ be used for bundled external libraries!
3164 ISYSTEM=
3165 if test "$GCC" = "yes"; then
3166     AC_MSG_CHECKING( for -isystem )
3167     save_CFLAGS=$CFLAGS
3168     CFLAGS="$CFLAGS -Werror"
3169     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3170     CFLAGS=$save_CFLAGS
3171     if test -n "$ISYSTEM"; then
3172         AC_MSG_RESULT(yes)
3173     else
3174         AC_MSG_RESULT(no)
3175     fi
3177 if test -z "$ISYSTEM"; then
3178     # fall back to using -I
3179     ISYSTEM=-I
3181 AC_SUBST(ISYSTEM)
3183 dnl ===================================================================
3184 dnl  Check which Visual Studio compiler is used
3185 dnl ===================================================================
3187 map_vs_year_to_version()
3189     # Return value: $vsversion
3191     unset vsversion
3193     case $1 in
3194     2015)
3195         vsversion=14.0;;
3196     2017)
3197         vsversion=15.0;;
3198     *)
3199         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3200     esac
3203 vs_versions_to_check()
3205     # Args: $1 (optional) : versions to check, in the order of preference
3206     # Return value: $vsversions
3208     unset vsversions
3210     if test -n "$1"; then
3211         map_vs_year_to_version "$1"
3212         vsversions=$vsversion
3213     else
3214         # By default we prefer 2015/2017, in this order
3215         vsversions="14.0 15.0"
3216     fi
3219 win_get_env_from_vsvars32bat()
3221     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3222     if test $vcnum = "150"; then
3223       # Also seems to be located in another directory under the same name: vsvars32.bat
3224       # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3225       printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3226     else
3227       printf '@call "%s/../Common7/Tools/vsvars32.bat"\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3228     fi
3229     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3230     chmod +x $WRAPPERBATCHFILEPATH
3231     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3232     rm -f $WRAPPERBATCHFILEPATH
3233     printf '%s' "$_win_get_env_from_vsvars32bat"
3236 find_ucrt()
3238     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3239     if test -n "$regvalue"; then
3240         PathFormat "$regvalue"
3241         UCRTSDKDIR=$formatted_path
3242         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3243         UCRTVERSION=$regvalue
3244         # Rest if not exist
3245         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3246           UCRTSDKDIR=
3247         fi
3248     fi
3249     if test -z "$UCRTSDKDIR"; then
3250         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3251         if test "$vcnum" = "150"; then
3252           ide_env_file="${ide_env_dir}VsDevCmd.bat"
3253         else
3254           ide_env_file="${ide_env_dir}/vsvars32.bat"
3255         fi
3256         if test -f "$ide_env_file"; then
3257             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3258             UCRTSDKDIR=$formatted_path
3259             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3260             dnl Hack needed at least by tml:
3261             if test "$UCRTVERSION" = 10.0.15063.0 \
3262                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3263                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3264             then
3265                 UCRTVERSION=10.0.14393.0
3266             fi
3267         else
3268           AC_MSG_ERROR([No UCRT found])
3269         fi
3270     fi
3273 find_msvc()
3275     # Find Visual C++ 2015/2017
3276     # Args: $1 (optional) : The VS version year
3277     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3279     unset vctest vcnum vcnumwithdot vcbuildnumber
3281     vs_versions_to_check "$1"
3283     for ver in $vsversions; do
3284         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3285         if test -n "$regvalue"; then
3286             vctest=$regvalue
3287             break
3288         fi
3289         # As always MSVC 15.0 is special here
3290         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver
3291         if test -n "$regvalue"; then
3292             AC_MSG_RESULT([found: $regvalue])
3293             PathFormat "$regvalue"
3294             vctest=$formatted_path
3295             break
3296         fi
3297     done
3298     if test -n "$vctest"; then
3299         vcnumwithdot=$ver
3300         case "$vcnumwithdot" in
3301         14.0)
3302             vcyear=2015
3303             vcnum=140
3304             ;;
3305         15.0)
3306             vcyear=2017
3307             vcnum=150
3308             vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3309             ;;
3310         esac
3311     fi
3314 SOLARINC=
3315 MSBUILD_PATH=
3316 DEVENV=
3317 if test "$_os" = "WINNT"; then
3318     AC_MSG_CHECKING([Visual C++])
3320     find_msvc "$with_visual_studio"
3321     if test -z "$vctest"; then
3322         if test -n "$with_visual_studio"; then
3323             AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3324         else
3325             AC_MSG_ERROR([No Visual Studio 2015/2017 installation found])
3326         fi
3327     fi
3329     if test "$BITNESS_OVERRIDE" = ""; then
3330         if test -f "$vctest/bin/cl.exe"; then
3331             VC_PRODUCT_DIR=$vctest
3332         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3333             VC_PRODUCT_DIR=$vctest/VC
3334         else
3335             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3336         fi
3337     else
3338         if test -f "$vctest/bin/amd64/cl.exe"; then
3339             VC_PRODUCT_DIR=$vctest
3340         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3341             VC_PRODUCT_DIR=$vctest/VC
3342         else
3343             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])
3344         fi
3345     fi
3347     AC_MSG_CHECKING([for short pathname of VC product directory])
3348     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3349     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3351     UCRTSDKDIR=
3352     UCRTVERSION=
3354     AC_MSG_CHECKING([for UCRT location])
3355     find_ucrt
3356     # find_ucrt errors out if it doesn't find it
3357     AC_MSG_RESULT([found])
3358     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3359     ucrtincpath_formatted=$formatted_path
3360     # SOLARINC is used for external modules and must be set too.
3361     # And no, it's not sufficient to set SOLARINC only, as configure
3362     # itself doesn't honour it.
3363     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3364     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3365     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3366     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3368     AC_SUBST(UCRTSDKDIR)
3369     AC_SUBST(UCRTVERSION)
3371     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3372     # Find the proper version of MSBuild.exe to use based on the VS version
3373     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3374     if test -n "$regvalue" ; then
3375         AC_MSG_RESULT([found: $regvalue])
3376         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3377     else
3378         if test $vcnum = "150"; then
3379             if test "$BITNESS_OVERRIDE" = ""; then
3380                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3381             else
3382                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3383             fi
3384             MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3385         else
3386             AC_MSG_ERROR([No msbuild found, Visual Studio installation broken?])
3387         fi
3388         AC_MSG_RESULT([$regvalue])
3389     fi
3391     # Find the version of devenv.exe
3392     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3393     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3394     if test ! -e "$DEVENV"; then
3395         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3396     fi
3398     dnl ===========================================================
3399     dnl  Check for the corresponding mspdb*.dll
3400     dnl ===========================================================
3402     MSPDB_PATH=
3403     CL_DIR=
3404     CL_LIB=
3406     if test "$BITNESS_OVERRIDE" = ""; then
3407         if test "$vcnum" = "150"; then
3408             MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86"
3409             CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX86/x86
3410         else
3411             MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3412             CL_DIR=bin
3413         fi
3414     else
3415         if test "$vcnum" = "150"; then
3416             MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64"
3417             CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX64/x64
3418         else
3419             MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3420             CL_DIR=bin/amd64
3421         fi
3422     fi
3424     # MSVC 15.0 has libraries from 14.0?
3425     if test  "$vcnum" = "150"; then
3426         mspdbnum="140"
3427     else
3428         mspdbnum=$vcnum
3429     fi
3431     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3432         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3433     fi
3435     MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3436     MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3438     dnl The path needs to be added before cl is called
3439     PATH="$MSPDB_PATH:$PATH"
3441     AC_MSG_CHECKING([cl.exe])
3443     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3444     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3445     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3446     # is not enough?
3448     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3449     dnl needed when building CLR code:
3450     if test -z "$MSVC_CXX"; then
3451         if test "$BITNESS_OVERRIDE" = ""; then
3452             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3453                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3454             fi
3455         else
3456             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3457                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3458             fi
3459         fi
3461         # This gives us a posix path with 8.3 filename restrictions
3462         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3463     fi
3465     if test -z "$CC"; then
3466         CC=$MSVC_CXX
3467     fi
3468     if test "$BITNESS_OVERRIDE" = ""; then
3469         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3470         MSVC_CXX="$MSVC_CXX -arch:SSE"
3471     fi
3473     if test -n "$CC"; then
3474         # Remove /cl.exe from CC case insensitive
3475         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3476         if test "$BITNESS_OVERRIDE" = ""; then
3477            if test "$vcnum" = "150"; then
3478                COMPATH="$VC_PRODUCT_DIR"
3479            else
3480                COMPATH=`echo "$CC" | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3481            fi
3482         else
3483             if test -n "$VC_PRODUCT_DIR"; then
3484                 COMPATH=$VC_PRODUCT_DIR
3485             fi
3486         fi
3487         if test "$BITNESS_OVERRIDE" = ""; then
3488             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3489             CC="$CC -arch:SSE"
3490         fi
3492         if test "$vcnum" = "150"; then
3493             COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3494         fi
3496         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3498         PathFormat "$COMPATH"
3499         COMPATH="$formatted_path"
3501         VCVER=$vcnum
3502         MSVSVER=$vcyear
3504         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3505         # are always "better", we list them in reverse chronological order.
3507         case $vcnum in
3508         140)
3509             COMEX=19
3510             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3511             ;;
3512         150)
3513             COMEX=19
3514             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3515             ;;
3516         esac
3518         # The expectation is that --with-windows-sdk should not need to be used
3519         if test -n "$with_windows_sdk"; then
3520             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3521             *" "$with_windows_sdk" "*)
3522                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3523                 ;;
3524             *)
3525                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3526                 ;;
3527             esac
3528         fi
3530         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3531         ac_objext=obj
3532         ac_exeext=exe
3534     else
3535         AC_MSG_ERROR([Visual C++ not found after all, huh])
3536     fi
3538     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3539     # version of the Explorer extension (and maybe other small
3540     # bits, too) needed when installing a 32-bit LibreOffice on a
3541     # 64-bit OS. The 64-bit Explorer extension is a feature that
3542     # has been present since long in OOo. Don't confuse it with
3543     # building LibreOffice itself as 64-bit code.
3545     BUILD_X64=
3546     CXX_X64_BINARY=
3547     LINK_X64_BINARY=
3549     if test "$BITNESS_OVERRIDE" = ""; then
3550         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3551         if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3552             # Prefer native x64 compiler to cross-compiler, in case we are running
3553             # the build on a 64-bit OS.
3554             if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3555                 BUILD_X64=TRUE
3556                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3557                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3558             elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3559                 BUILD_X64=TRUE
3560                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3561                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3562             fi
3563         elif test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib"; then
3564             # nobody uses 32-bit OS to build, just pick the 64-bit compiler
3565             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3566                 BUILD_X64=TRUE
3567                 CXX_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"
3568                 LINK_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/link.exe"
3569             fi
3570         fi
3571         if test "$BUILD_X64" = TRUE; then
3572             AC_MSG_RESULT([found])
3573         else
3574             AC_MSG_RESULT([not found])
3575             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3576         fi
3577     fi
3578     AC_SUBST(BUILD_X64)
3580     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3581     AC_SUBST(CXX_X64_BINARY)
3582     AC_SUBST(LINK_X64_BINARY)
3584 AC_SUBST(VCVER)
3585 AC_SUBST(DEVENV)
3586 PathFormat "$MSPDB_PATH"
3587 MSPDB_PATH="$formatted_path"
3588 AC_SUBST(MSVC_CXX)
3591 # unowinreg.dll
3593 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3594 AC_SUBST(UNOWINREG_DLL)
3596 COM_IS_CLANG=
3597 AC_MSG_CHECKING([whether the compiler is actually Clang])
3598 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3599     #ifndef __clang__
3600     you lose
3601     #endif
3602     int foo=42;
3603     ]])],
3604     [AC_MSG_RESULT([yes])
3605      COM_IS_CLANG=TRUE],
3606     [AC_MSG_RESULT([no])])
3608 CC_PLAIN=$CC
3609 if test "$COM_IS_CLANG" = TRUE; then
3610     AC_MSG_CHECKING([the Clang version])
3611     if test "$_os" = WINNT; then
3612         dnl In which case, assume clang-cl:
3613         my_args="/EP /TC"
3614         dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3615         dnl clang-cl:
3616         CC_PLAIN=
3617         for i in $CC; do
3618             case $i in
3619             -FIIntrin.h)
3620                 ;;
3621             *)
3622                 CC_PLAIN="$CC_PLAIN $i"
3623                 ;;
3624             esac
3625         done
3626     else
3627         my_args="-E -P"
3628     fi
3629     clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args -`
3630     CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3631     CLANGVER=`echo $clang_version \
3632         | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3633     AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3634     AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3635     AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3637 AC_SUBST(COM_IS_CLANG)
3639 SHOWINCLUDES_PREFIX=
3640 if test "$_os" = WINNT; then
3641     dnl We need to guess the prefix of the -showIncludes output, it can be
3642     dnl localized
3643     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3644     echo "#include <stdlib.h>" > conftest.c
3645     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3646         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3647     rm -f conftest.c conftest.obj
3648     if test -z "$SHOWINCLUDES_PREFIX"; then
3649         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3650     else
3651         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3652     fi
3654 AC_SUBST(SHOWINCLUDES_PREFIX)
3657 # prefix C with ccache if needed
3659 if test "$CCACHE" != ""; then
3660     AC_MSG_CHECKING([whether $CC is already ccached])
3662     AC_LANG_PUSH([C])
3663     save_CFLAGS=$CFLAGS
3664     CFLAGS="$CFLAGS --ccache-skip -O2"
3665     dnl an empty program will do, we're checking the compiler flags
3666     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3667                       [use_ccache=yes], [use_ccache=no])
3668     if test $use_ccache = yes; then
3669         AC_MSG_RESULT([yes])
3670     else
3671         CC="$CCACHE $CC"
3672         AC_MSG_RESULT([no])
3673     fi
3674     CFLAGS=$save_CFLAGS
3675     AC_LANG_POP([C])
3678 # ===================================================================
3679 # check various GCC options that Clang does not support now but maybe
3680 # will somewhen in the future, check them even for GCC, so that the
3681 # flags are set
3682 # ===================================================================
3684 HAVE_GCC_GGDB2=
3685 HAVE_GCC_FINLINE_LIMIT=
3686 HAVE_GCC_FNO_INLINE=
3687 if test "$GCC" = "yes"; then
3688     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3689     save_CFLAGS=$CFLAGS
3690     CFLAGS="$CFLAGS -Werror -ggdb2"
3691     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3692     CFLAGS=$save_CFLAGS
3693     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3694         AC_MSG_RESULT([yes])
3695     else
3696         AC_MSG_RESULT([no])
3697     fi
3699     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3700     save_CFLAGS=$CFLAGS
3701     CFLAGS="$CFLAGS -Werror -finline-limit=0"
3702     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3703     CFLAGS=$save_CFLAGS
3704     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3705         AC_MSG_RESULT([yes])
3706     else
3707         AC_MSG_RESULT([no])
3708     fi
3710     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3711     save_CFLAGS=$CFLAGS
3712     CFLAGS="$CFLAGS -Werror -fno-inline"
3713     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3714     CFLAGS=$save_CFLAGS
3715     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3716         AC_MSG_RESULT([yes])
3717     else
3718         AC_MSG_RESULT([no])
3719     fi
3721     if test "$host_cpu" = "m68k"; then
3722         AC_MSG_CHECKING([whether $CC supports -mlong-jump-table-offsets])
3723         save_CFLAGS=$CFLAGS
3724         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3725         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3726         CFLAGS=$save_CFLAGS
3727         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3728             AC_MSG_RESULT([yes])
3729         else
3730             AC_MSG_ERROR([no])
3731         fi
3732     fi
3734 AC_SUBST(HAVE_GCC_GGDB2)
3735 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3736 AC_SUBST(HAVE_GCC_FNO_INLINE)
3738 dnl ===================================================================
3739 dnl  Test the gcc version
3740 dnl ===================================================================
3741 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3742     AC_MSG_CHECKING([the GCC version])
3743     _gcc_version=`$CC -dumpversion`
3744     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3745         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3746     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3748     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3750     if test "$gcc_full_version" -lt 40801; then
3751         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.8.1])
3752     fi
3753 else
3754     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3755     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3756     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3757     # (which reports itself as GCC 4.2.1).
3758     GCC_VERSION=
3760 AC_SUBST(GCC_VERSION)
3762 dnl Set the ENABLE_DBGUTIL variable
3763 dnl ===================================================================
3764 AC_MSG_CHECKING([whether to build with additional debug utilities])
3765 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3766     ENABLE_DBGUTIL="TRUE"
3767     # this is an extra var so it can have different default on different MSVC
3768     # versions (in case there are version specific problems with it)
3769     MSVC_USE_DEBUG_RUNTIME="TRUE"
3771     AC_MSG_RESULT([yes])
3772     # cppunit and graphite expose STL in public headers
3773     if test "$with_system_cppunit" = "yes"; then
3774         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3775     else
3776         with_system_cppunit=no
3777     fi
3778     if test "$with_system_graphite" = "yes"; then
3779         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3780     else
3781         with_system_graphite=no
3782     fi
3783     if test "$with_system_mysql_cppconn" = "yes"; then
3784         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3785     else
3786         with_system_mysql_cppconn=no
3787     fi
3788     if test "$with_system_orcus" = "yes"; then
3789         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3790     else
3791         with_system_orcus=no
3792     fi
3793     if test "$with_system_libcmis" = "yes"; then
3794         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3795     else
3796         with_system_libcmis=no
3797     fi
3798     if test "$with_system_hunspell" = "yes"; then
3799         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3800     else
3801         with_system_hunspell=no
3802     fi
3803     if test "$with_system_gpgmepp" = "yes"; then
3804         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3805     else
3806         with_system_gpgmepp=no
3807     fi
3808 else
3809     ENABLE_DBGUTIL=""
3810     MSVC_USE_DEBUG_RUNTIME=""
3811     AC_MSG_RESULT([no])
3813 AC_SUBST(ENABLE_DBGUTIL)
3814 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3816 dnl Set the ENABLE_DEBUG variable.
3817 dnl ===================================================================
3818 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3819     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3821 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3822     if test -z "$libo_fuzzed_enable_debug"; then
3823         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3824     else
3825         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3826         enable_debug=yes
3827     fi
3830 AC_MSG_CHECKING([whether to do a debug build])
3831 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3832     ENABLE_DEBUG="TRUE"
3833     if test -n "$ENABLE_DBGUTIL" ; then
3834         AC_MSG_RESULT([yes (dbgutil)])
3835     else
3836         AC_MSG_RESULT([yes])
3837     fi
3838 else
3839     ENABLE_DEBUG=""
3840     AC_MSG_RESULT([no])
3842 AC_SUBST(ENABLE_DEBUG)
3844 if test "$enable_sal_log" = yes; then
3845     ENABLE_SAL_LOG=TRUE
3847 AC_SUBST(ENABLE_SAL_LOG)
3849 dnl Selective debuginfo
3850 ENABLE_DEBUGINFO_FOR=
3851 if test -n "$ENABLE_DEBUG"; then
3852     AC_MSG_CHECKING([whether to use selective debuginfo])
3853     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3854         if test "$enable_selective_debuginfo" = "yes"; then
3855             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3856         fi
3857         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3858         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3859     else
3860         ENABLE_DEBUGINFO_FOR=all
3861         AC_MSG_RESULT([no, for all])
3862     fi
3863 else
3864     if test -n "$enable_selective_debuginfo"; then
3865         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
3866     fi
3868 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3870 dnl Check for enable symbols option
3871 dnl ===================================================================
3872 AC_MSG_CHECKING([whether to generate debug information])
3873 if test -z "$enable_symbols"; then
3874     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3875         enable_symbols=yes
3876     else
3877         enable_symbols=no
3878     fi
3880 if test "$enable_symbols" != no; then
3881     ENABLE_SYMBOLS=TRUE
3882     AC_MSG_RESULT([yes])
3883 else
3884     ENABLE_SYMBOLS=
3885     AC_MSG_RESULT([no])
3887 AC_SUBST(ENABLE_SYMBOLS)
3889 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
3890     # Building on Android with full symbols: without enough memory the linker never finishes currently.
3891     AC_MSG_CHECKING([whether enough memory is available for linking])
3892     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
3893     # Check for 15GB, as Linux reports a bit less than the physical memory size.
3894     if test -n "$mem_size" -a $mem_size -lt 15728640; then
3895         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
3896     else
3897         AC_MSG_RESULT([yes])
3898     fi
3901 AC_MSG_CHECKING([whether to compile with optimization flags])
3902 if test -z "$enable_optimized"; then
3903     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3904         enable_optimized=no
3905     else
3906         enable_optimized=yes
3907     fi
3909 if test "$enable_optimized" != no; then
3910     ENABLE_OPTIMIZED=TRUE
3911     AC_MSG_RESULT([yes])
3912 else
3913     ENABLE_OPTIMIZED=
3914     AC_MSG_RESULT([no])
3916 AC_SUBST(ENABLE_OPTIMIZED)
3919 # determine CPUNAME, OS, ...
3920 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
3922 case "$host_os" in
3924 aix*)
3925     COM=GCC
3926     CPUNAME=POWERPC
3927     USING_X11=TRUE
3928     OS=AIX
3929     RTL_OS=AIX
3930     RTL_ARCH=PowerPC
3931     PLATFORMID=aix_powerpc
3932     P_SEP=:
3933     ;;
3935 cygwin*)
3936     COM=MSC
3937     USING_X11=
3938     OS=WNT
3939     RTL_OS=Windows
3940     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3941         P_SEP=";"
3942     else
3943         P_SEP=:
3944     fi
3945     case "$host_cpu" in
3946     i*86|x86_64)
3947         if test "$BITNESS_OVERRIDE" = 64; then
3948             CPUNAME=X86_64
3949             RTL_ARCH=X86_64
3950             PLATFORMID=windows_x86_64
3951             WINDOWS_X64=1
3952             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
3953         else
3954             CPUNAME=INTEL
3955             RTL_ARCH=x86
3956             PLATFORMID=windows_x86
3957         fi
3958         ;;
3959     *)
3960         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3961         ;;
3962     esac
3963     SCPDEFS="$SCPDEFS -D_MSC_VER"
3964     ;;
3966 darwin*)
3967     COM=GCC
3968     USING_X11=
3969     OS=MACOSX
3970     RTL_OS=MacOSX
3971     P_SEP=:
3973     case "$host_cpu" in
3974     arm)
3975         AC_MSG_ERROR([Can't build 32-bit code for iOS])
3976         ;;
3977     arm64)
3978         OS=IOS
3979         if test "$enable_ios_simulator" = "yes"; then
3980             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
3981         else
3982             CPUNAME=ARM64
3983             RTL_ARCH=ARM_EABI
3984             PLATFORMID=ios_arm64
3985         fi
3986         ;;
3987     i*86)
3988         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
3989         ;;
3990     x86_64)
3991         if test "$enable_ios_simulator" = "yes"; then
3992             OS=IOS
3993         fi
3994         CPUNAME=X86_64
3995         RTL_ARCH=X86_64
3996         PLATFORMID=macosx_x86_64
3997         ;;
3998     *)
3999         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4000         ;;
4001     esac
4002     ;;
4004 dragonfly*)
4005     COM=GCC
4006     USING_X11=TRUE
4007     OS=DRAGONFLY
4008     RTL_OS=DragonFly
4009     P_SEP=:
4011     case "$host_cpu" in
4012     i*86)
4013         CPUNAME=INTEL
4014         RTL_ARCH=x86
4015         PLATFORMID=dragonfly_x86
4016         ;;
4017     x86_64)
4018         CPUNAME=X86_64
4019         RTL_ARCH=X86_64
4020         PLATFORMID=dragonfly_x86_64
4021         ;;
4022     *)
4023         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4024         ;;
4025     esac
4026     ;;
4028 freebsd*)
4029     COM=GCC
4030     USING_X11=TRUE
4031     RTL_OS=FreeBSD
4032     OS=FREEBSD
4033     P_SEP=:
4035     case "$host_cpu" in
4036     i*86)
4037         CPUNAME=INTEL
4038         RTL_ARCH=x86
4039         PLATFORMID=freebsd_x86
4040         ;;
4041     x86_64|amd64)
4042         CPUNAME=X86_64
4043         RTL_ARCH=X86_64
4044         PLATFORMID=freebsd_x86_64
4045         ;;
4046     *)
4047         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4048         ;;
4049     esac
4050     ;;
4052 haiku*)
4053     COM=GCC
4054     USING_X11=
4055     GUIBASE=haiku
4056     RTL_OS=Haiku
4057     OS=HAIKU
4058     P_SEP=:
4060     case "$host_cpu" in
4061     i*86)
4062         CPUNAME=INTEL
4063         RTL_ARCH=x86
4064         PLATFORMID=haiku_x86
4065         ;;
4066     x86_64|amd64)
4067         CPUNAME=X86_64
4068         RTL_ARCH=X86_64
4069         PLATFORMID=haiku_x86_64
4070         ;;
4071     *)
4072         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4073         ;;
4074     esac
4075     ;;
4077 kfreebsd*)
4078     COM=GCC
4079     USING_X11=TRUE
4080     OS=LINUX
4081     RTL_OS=kFreeBSD
4082     P_SEP=:
4084     case "$host_cpu" in
4086     i*86)
4087         CPUNAME=INTEL
4088         RTL_ARCH=x86
4089         PLATFORMID=kfreebsd_x86
4090         ;;
4091     x86_64)
4092         CPUNAME=X86_64
4093         RTL_ARCH=X86_64
4094         PLATFORMID=kfreebsd_x86_64
4095         ;;
4096     *)
4097         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4098         ;;
4099     esac
4100     ;;
4102 linux-gnu*)
4103     COM=GCC
4104     USING_X11=TRUE
4105     OS=LINUX
4106     RTL_OS=Linux
4107     P_SEP=:
4109     case "$host_cpu" in
4111     aarch64)
4112         CPUNAME=AARCH64
4113         PLATFORMID=linux_aarch64
4114         RTL_ARCH=AARCH64
4115         ;;
4116     alpha)
4117         CPUNAME=AXP
4118         RTL_ARCH=ALPHA
4119         PLATFORMID=linux_alpha
4120         ;;
4121     arm*)
4122         CPUNAME=ARM
4123         EPM_FLAGS="-a arm"
4124         RTL_ARCH=ARM_EABI
4125         PLATFORMID=linux_arm_eabi
4126         case "$host_cpu" in
4127         arm*-linux)
4128             RTL_ARCH=ARM_OABI
4129             PLATFORMID=linux_arm_oabi
4130             ;;
4131         esac
4132         ;;
4133     hppa)
4134         CPUNAME=HPPA
4135         RTL_ARCH=HPPA
4136         EPM_FLAGS="-a hppa"
4137         PLATFORMID=linux_hppa
4138         ;;
4139     i*86)
4140         CPUNAME=INTEL
4141         RTL_ARCH=x86
4142         PLATFORMID=linux_x86
4143         ;;
4144     ia64)
4145         CPUNAME=IA64
4146         RTL_ARCH=IA64
4147         PLATFORMID=linux_ia64
4148         ;;
4149     mips)
4150         CPUNAME=GODSON
4151         RTL_ARCH=MIPS_EB
4152         EPM_FLAGS="-a mips"
4153         PLATFORMID=linux_mips_eb
4154         ;;
4155     mips64)
4156         CPUNAME=GODSON64
4157         RTL_ARCH=MIPS64_EB
4158         EPM_FLAGS="-a mips64"
4159         PLATFORMID=linux_mips64_eb
4160         ;;
4161     mips64el)
4162         CPUNAME=GODSON64
4163         RTL_ARCH=MIPS64_EL
4164         EPM_FLAGS="-a mips64el"
4165         PLATFORMID=linux_mips64_el
4166         ;;
4167     mipsel)
4168         CPUNAME=GODSON
4169         RTL_ARCH=MIPS_EL
4170         EPM_FLAGS="-a mipsel"
4171         PLATFORMID=linux_mips_el
4172         ;;
4173     m68k)
4174         CPUNAME=M68K
4175         RTL_ARCH=M68K
4176         PLATFORMID=linux_m68k
4177         ;;
4178     powerpc)
4179         CPUNAME=POWERPC
4180         RTL_ARCH=PowerPC
4181         PLATFORMID=linux_powerpc
4182         ;;
4183     powerpc64)
4184         CPUNAME=POWERPC64
4185         RTL_ARCH=PowerPC_64
4186         PLATFORMID=linux_powerpc64
4187         ;;
4188     powerpc64le)
4189         CPUNAME=POWERPC64
4190         RTL_ARCH=PowerPC_64_LE
4191         PLATFORMID=linux_powerpc64_le
4192         ;;
4193     sparc)
4194         CPUNAME=SPARC
4195         RTL_ARCH=SPARC
4196         PLATFORMID=linux_sparc
4197         ;;
4198     sparc64)
4199         CPUNAME=SPARC64
4200         RTL_ARCH=SPARC64
4201         PLATFORMID=linux_sparc64
4202         ;;
4203     s390)
4204         CPUNAME=S390
4205         RTL_ARCH=S390
4206         PLATFORMID=linux_s390
4207         ;;
4208     s390x)
4209         CPUNAME=S390X
4210         RTL_ARCH=S390x
4211         PLATFORMID=linux_s390x
4212         ;;
4213     x86_64)
4214         CPUNAME=X86_64
4215         RTL_ARCH=X86_64
4216         PLATFORMID=linux_x86_64
4217         ;;
4218     *)
4219         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4220         ;;
4221     esac
4222     ;;
4224 linux-android*)
4225     COM=GCC
4226     USING_X11=
4227     OS=ANDROID
4228     RTL_OS=Android
4229     P_SEP=:
4231     case "$host_cpu" in
4233     arm|armel)
4234         CPUNAME=ARM
4235         RTL_ARCH=ARM_EABI
4236         PLATFORMID=android_arm_eabi
4237         ;;
4238     aarch64)
4239         CPUNAME=AARCH64
4240         RTL_ARCH=AARCH64
4241         PLATFORMID=android_aarch64
4242         ;;
4243     mips|mipsel)
4244         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4245         RTL_ARCH=MIPS_EL
4246         PLATFORMID=android_mips_el
4247         ;;
4248     i*86)
4249         CPUNAME=INTEL
4250         RTL_ARCH=x86
4251         PLATFORMID=android_x86
4252         ;;
4253     *)
4254         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4255         ;;
4256     esac
4257     ;;
4259 *netbsd*)
4260     COM=GCC
4261     USING_X11=TRUE
4262     OS=NETBSD
4263     RTL_OS=NetBSD
4264     P_SEP=:
4266     case "$host_cpu" in
4267     i*86)
4268         CPUNAME=INTEL
4269         RTL_ARCH=x86
4270         PLATFORMID=netbsd_x86
4271         ;;
4272     powerpc)
4273         CPUNAME=POWERPC
4274         RTL_ARCH=PowerPC
4275         PLATFORMID=netbsd_powerpc
4276         ;;
4277     sparc)
4278         CPUNAME=SPARC
4279         RTL_ARCH=SPARC
4280         PLATFORMID=netbsd_sparc
4281         ;;
4282     x86_64)
4283         CPUNAME=X86_64
4284         RTL_ARCH=X86_64
4285         PLATFORMID=netbsd_x86_64
4286         ;;
4287     *)
4288         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4289         ;;
4290     esac
4291     ;;
4293 openbsd*)
4294     COM=GCC
4295     USING_X11=TRUE
4296     OS=OPENBSD
4297     RTL_OS=OpenBSD
4298     P_SEP=:
4300     case "$host_cpu" in
4301     i*86)
4302         CPUNAME=INTEL
4303         RTL_ARCH=x86
4304         PLATFORMID=openbsd_x86
4305         ;;
4306     x86_64)
4307         CPUNAME=X86_64
4308         RTL_ARCH=X86_64
4309         PLATFORMID=openbsd_x86_64
4310         ;;
4311     *)
4312         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4313         ;;
4314     esac
4315     SOLARINC="$SOLARINC -I/usr/local/include"
4316     ;;
4318 solaris*)
4319     COM=GCC
4320     USING_X11=TRUE
4321     OS=SOLARIS
4322     RTL_OS=Solaris
4323     P_SEP=:
4325     case "$host_cpu" in
4326     i*86)
4327         CPUNAME=INTEL
4328         RTL_ARCH=x86
4329         PLATFORMID=solaris_x86
4330         ;;
4331     sparc)
4332         CPUNAME=SPARC
4333         RTL_ARCH=SPARC
4334         PLATFORMID=solaris_sparc
4335         ;;
4336     sparc64)
4337         CPUNAME=SPARC64
4338         RTL_ARCH=SPARC64
4339         PLATFORMID=solaris_sparc64
4340         ;;
4341     *)
4342         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4343         ;;
4344     esac
4345     SOLARINC="$SOLARINC -I/usr/local/include"
4346     ;;
4349     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4350     ;;
4351 esac
4353 if test "$with_x" = "no"; then
4354     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4357 ENABLE_HEADLESS=""
4358 if test "$enable_gui" = "no"; then
4359     if test "$USING_X11" != TRUE; then
4360         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4361     fi
4362     USING_X11=
4363     ENABLE_HEADLESS=TRUE
4364     AC_DEFINE(HAVE_FEATURE_UI,0)
4365     test_cairo=yes
4367 AC_SUBST(ENABLE_HEADLESS)
4369 WORKDIR="${BUILDDIR}/workdir"
4370 INSTDIR="${BUILDDIR}/instdir"
4371 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4372 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4373 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4374 AC_SUBST(COM)
4375 AC_SUBST(CPUNAME)
4376 AC_SUBST(RTL_OS)
4377 AC_SUBST(RTL_ARCH)
4378 AC_SUBST(EPM_FLAGS)
4379 AC_SUBST(USING_X11)
4380 AC_SUBST([INSTDIR])
4381 AC_SUBST([INSTROOT])
4382 AC_SUBST([INSTROOTBASE])
4383 AC_SUBST(OS)
4384 AC_SUBST(P_SEP)
4385 AC_SUBST(WORKDIR)
4386 AC_SUBST(PLATFORMID)
4387 AC_SUBST(WINDOWS_X64)
4388 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4390 dnl ===================================================================
4391 dnl Test which package format to use
4392 dnl ===================================================================
4393 AC_MSG_CHECKING([which package format to use])
4394 if test -n "$with_package_format" -a "$with_package_format" != no; then
4395     for i in $with_package_format; do
4396         case "$i" in
4397         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4398             ;;
4399         *)
4400             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4401 aix - AIX software distribution
4402 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4403 deb - Debian software distribution
4404 pkg - Solaris software distribution
4405 rpm - RedHat software distribution
4407 LibreOffice additionally supports:
4408 archive - .tar.gz or .zip
4409 dmg - Mac OS X .dmg
4410 installed - installation tree
4411 msi - Windows .msi
4412         ])
4413             ;;
4414         esac
4415     done
4416     # fakeroot is needed to ensure correct file ownerships/permissions
4417     # inside deb packages and tar archives created on Linux and Solaris.
4418     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4419         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4420         if test "$FAKEROOT" = "no"; then
4421             AC_MSG_ERROR(
4422                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4423         fi
4424     fi
4425     PKGFORMAT="$with_package_format"
4426     AC_MSG_RESULT([$PKGFORMAT])
4427 else
4428     PKGFORMAT=
4429     AC_MSG_RESULT([none])
4431 AC_SUBST(PKGFORMAT)
4433 dnl ===================================================================
4434 dnl Set up a different compiler to produce tools to run on the build
4435 dnl machine when doing cross-compilation
4436 dnl ===================================================================
4438 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4439 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4440 if test "$cross_compiling" = "yes"; then
4441     AC_MSG_CHECKING([for BUILD platform configuration])
4442     echo
4443     rm -rf CONF-FOR-BUILD config_build.mk
4444     mkdir CONF-FOR-BUILD
4445     # Here must be listed all files needed when running the configure script. In particular, also
4446     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4447     # keep them in the same order as there.
4448     (cd $SRC_ROOT && tar cf - \
4449         config.guess \
4450         bin/get_config_variables \
4451         solenv/bin/getcompver.awk \
4452         solenv/inc/langlist.mk \
4453         download.lst \
4454         config_host.mk.in \
4455         config_host_lang.mk.in \
4456         Makefile.in \
4457         lo.xcent.in \
4458         bin/bffvalidator.sh.in \
4459         bin/odfvalidator.sh.in \
4460         bin/officeotron.sh.in \
4461         instsetoo_native/util/openoffice.lst.in \
4462         config_host/*.in \
4463         sysui/desktop/macosx/Info.plist.in) \
4464     | (cd CONF-FOR-BUILD && tar xf -)
4465     cp configure CONF-FOR-BUILD
4466     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4467     (
4468     unset COM USING_X11 OS CPUNAME
4469     unset CC CXX SYSBASE CFLAGS
4470     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4471     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4472     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4473     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4474     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4475     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4476     cd CONF-FOR-BUILD
4477     sub_conf_opts=""
4478     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4479     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4480     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4481     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4482     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4483     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4484     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4485     # Don't bother having configure look for stuff not needed for the build platform anyway
4486     ./configure \
4487         --disable-cups \
4488         --disable-gtk3 \
4489         --disable-pdfimport \
4490         --disable-postgresql-sdbc \
4491         --with-parallelism="$with_parallelism" \
4492         --without-doxygen \
4493         --without-java \
4494         $sub_conf_opts \
4495         --srcdir=$srcdir \
4496         2>&1 | sed -e 's/^/    /'
4497     test -f ./config_host.mk 2>/dev/null || exit
4498     cp config_host.mk ../config_build.mk
4499     cp config_host_lang.mk ../config_build_lang.mk
4500     mv config.log ../config.Build.log
4501     mkdir -p ../config_build
4502     mv config_host/*.h ../config_build
4503     . ./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
4505     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
4506         VV='$'$V
4507         VV=`eval "echo $VV"`
4508         if test -n "$VV"; then
4509             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4510             echo "$line" >>build-config
4511         fi
4512     done
4514     for V in INSTDIR INSTROOT WORKDIR; do
4515         VV='$'$V
4516         VV=`eval "echo $VV"`
4517         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4518         if test -n "$VV"; then
4519             line="${V}_FOR_BUILD='$VV'"
4520             echo "$line" >>build-config
4521         fi
4522     done
4524     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4525     echo "$line" >>build-config
4527     )
4528     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4529     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])
4530     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4531              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4533     eval `cat CONF-FOR-BUILD/build-config`
4535     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4537     rm -rf CONF-FOR-BUILD
4538 else
4539     OS_FOR_BUILD="$OS"
4540     CC_FOR_BUILD="$CC"
4541     CXX_FOR_BUILD="$CXX"
4542     INSTDIR_FOR_BUILD="$INSTDIR"
4543     INSTROOT_FOR_BUILD="$INSTROOT"
4544     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4545     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4546     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4547     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4548     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4549     WORKDIR_FOR_BUILD="$WORKDIR"
4551 AC_SUBST(OS_FOR_BUILD)
4552 AC_SUBST(INSTDIR_FOR_BUILD)
4553 AC_SUBST(INSTROOT_FOR_BUILD)
4554 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4555 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4556 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4557 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4558 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4559 AC_SUBST(WORKDIR_FOR_BUILD)
4561 dnl ===================================================================
4562 dnl Check for syslog header
4563 dnl ===================================================================
4564 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4566 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4567 dnl ===================================================================
4568 AC_MSG_CHECKING([whether to turn warnings to errors])
4569 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4570     ENABLE_WERROR="TRUE"
4571     AC_MSG_RESULT([yes])
4572 else
4573     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4574         ENABLE_WERROR="TRUE"
4575         AC_MSG_RESULT([yes])
4576     else
4577         AC_MSG_RESULT([no])
4578     fi
4580 AC_SUBST(ENABLE_WERROR)
4582 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4583 dnl ===================================================================
4584 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4585 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4586     ASSERT_ALWAYS_ABORT="TRUE"
4587     AC_MSG_RESULT([yes])
4588 else
4589     ASSERT_ALWAYS_ABORT="FALSE"
4590     AC_MSG_RESULT([no])
4592 AC_SUBST(ASSERT_ALWAYS_ABORT)
4594 # Determine whether to use ooenv for the instdir installation
4595 # ===================================================================
4596 if test $_os != "WINNT" -a $_os != "Darwin"; then
4597     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4598     if test "$enable_ooenv" = "no"; then
4599         AC_MSG_RESULT([no])
4600     else
4601         ENABLE_OOENV="TRUE"
4602         AC_MSG_RESULT([yes])
4603     fi
4605 AC_SUBST(ENABLE_OOENV)
4607 if test "$USING_X11" != TRUE; then
4608     # be sure to do not mess with unneeded stuff
4609     test_randr=no
4610     test_xrender=no
4611     test_cups=no
4612     test_dbus=no
4613     test_gtk=no
4614     build_gstreamer_1_0=no
4615     build_gstreamer_0_10=no
4616     test_kde4=no
4617     test_kde5=no
4618     test_qt5=no
4619     test_gtk3_kde5=no
4620     enable_cairo_canvas=no
4623 if test "$OS" = "HAIKU"; then
4624     enable_cairo_canvas=yes
4627 dnl ===================================================================
4628 dnl check for cups support
4629 dnl ===================================================================
4630 ENABLE_CUPS=""
4632 if test "$enable_cups" = "no"; then
4633     test_cups=no
4636 AC_MSG_CHECKING([whether to enable CUPS support])
4637 if test "$test_cups" = "yes"; then
4638     ENABLE_CUPS="TRUE"
4639     AC_MSG_RESULT([yes])
4641     AC_MSG_CHECKING([whether cups support is present])
4642     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4643     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4644     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4645         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4646     fi
4648 else
4649     AC_MSG_RESULT([no])
4652 AC_SUBST(ENABLE_CUPS)
4654 # fontconfig checks
4655 if test "$test_fontconfig" = "yes"; then
4656     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4657     SYSTEM_FONTCONFIG=TRUE
4658     FilterLibs "${FONTCONFIG_LIBS}"
4659     FONTCONFIG_LIBS="${filteredlibs}"
4661 AC_SUBST(FONTCONFIG_CFLAGS)
4662 AC_SUBST(FONTCONFIG_LIBS)
4663 AC_SUBST([SYSTEM_FONTCONFIG])
4665 dnl whether to find & fetch external tarballs?
4666 dnl ===================================================================
4667 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4668    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4669        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4670    else
4671        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4672    fi
4674 if test -z "$TARFILE_LOCATION"; then
4675     if test -d "$SRC_ROOT/src" ; then
4676         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4677         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4678     fi
4679     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4680 else
4681     AbsolutePath "$TARFILE_LOCATION"
4682     PathFormat "${absolute_path}"
4683     TARFILE_LOCATION="${formatted_path}"
4685 AC_SUBST(TARFILE_LOCATION)
4687 AC_MSG_CHECKING([whether we want to fetch tarballs])
4688 if test "$enable_fetch_external" != "no"; then
4689     if test "$with_all_tarballs" = "yes"; then
4690         AC_MSG_RESULT([yes, all of them])
4691         DO_FETCH_TARBALLS="ALL"
4692     else
4693         AC_MSG_RESULT([yes, if we use them])
4694         DO_FETCH_TARBALLS="TRUE"
4695     fi
4696 else
4697     AC_MSG_RESULT([no])
4698     DO_FETCH_TARBALLS=
4700 AC_SUBST(DO_FETCH_TARBALLS)
4702 AC_MSG_CHECKING([whether to build help])
4703 HELP_COMMON_ONLY=FALSE
4704 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4705     BUILD_TYPE="$BUILD_TYPE HELP"
4706     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4707     case "$with_help" in
4708     "common")
4709         HELP_COMMON_ONLY=TRUE
4710         AC_MSG_RESULT([common only])
4711         ;;
4712     "html")
4713         ENABLE_HTMLHELP=TRUE
4714         AC_MSG_RESULT([HTML])
4715         ;;
4716     "online")
4717         ENABLE_HTMLHELP=TRUE
4718         HELP_ONLINE=TRUE
4719         AC_MSG_RESULT([HTML])
4720         ;;
4721     *)
4722         SCPDEFS="$SCPDEFS -DWITH_HELP"
4723         AC_MSG_RESULT([yes])
4724         ;;
4725     esac
4726 else
4727     AC_MSG_RESULT([no])
4729 AC_SUBST([ENABLE_HTMLHELP])
4730 AC_SUBST(HELP_COMMON_ONLY)
4731 AC_SUBST([HELP_ONLINE])
4733 dnl Test whether to include MySpell dictionaries
4734 dnl ===================================================================
4735 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4736 if test "$with_myspell_dicts" = "yes"; then
4737     AC_MSG_RESULT([yes])
4738     WITH_MYSPELL_DICTS=TRUE
4739     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4740     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4741 else
4742     AC_MSG_RESULT([no])
4743     WITH_MYSPELL_DICTS=
4745 AC_SUBST(WITH_MYSPELL_DICTS)
4747 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4748 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4749     if test "$with_system_dicts" = yes; then
4750         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4751     fi
4752     with_system_dicts=no
4755 AC_MSG_CHECKING([whether to use dicts from external paths])
4756 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4757     AC_MSG_RESULT([yes])
4758     SYSTEM_DICTS=TRUE
4759     AC_MSG_CHECKING([for spelling dictionary directory])
4760     if test -n "$with_external_dict_dir"; then
4761         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4762     else
4763         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4764         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4765             DICT_SYSTEM_DIR=file:///usr/share/myspell
4766         fi
4767     fi
4768     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4769     AC_MSG_CHECKING([for hyphenation patterns directory])
4770     if test -n "$with_external_hyph_dir"; then
4771         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4772     else
4773         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4774     fi
4775     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4776     AC_MSG_CHECKING([for thesaurus directory])
4777     if test -n "$with_external_thes_dir"; then
4778         THES_SYSTEM_DIR=file://$with_external_thes_dir
4779     else
4780         THES_SYSTEM_DIR=file:///usr/share/mythes
4781     fi
4782     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4783 else
4784     AC_MSG_RESULT([no])
4785     SYSTEM_DICTS=
4787 AC_SUBST(SYSTEM_DICTS)
4788 AC_SUBST(DICT_SYSTEM_DIR)
4789 AC_SUBST(HYPH_SYSTEM_DIR)
4790 AC_SUBST(THES_SYSTEM_DIR)
4792 dnl ===================================================================
4793 dnl enable pch by default on windows
4794 dnl enable it explicitly otherwise
4795 ENABLE_PCH=""
4796 if test "$enable_pch" = yes -a "$enable_compiler_plugins" = yes; then
4797     if test -z "$libo_fuzzed_enable_pch"; then
4798         AC_MSG_ERROR([--enable-pch cannot be used with --enable-compiler-plugins])
4799     else
4800         AC_MSG_NOTICE([Resetting --enable-pch=no])
4801         enable_pch=no
4802     fi
4805 AC_MSG_CHECKING([whether to enable pch feature])
4806 if test "$enable_pch" != "no"; then
4807     if test "$_os" = "WINNT"; then
4808         ENABLE_PCH="TRUE"
4809         AC_MSG_RESULT([yes])
4810     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4811         ENABLE_PCH="TRUE"
4812         AC_MSG_RESULT([yes])
4813     elif test -n "$enable_pch"; then
4814         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4815     else
4816         AC_MSG_RESULT([no])
4817     fi
4818 else
4819     AC_MSG_RESULT([no])
4821 AC_SUBST(ENABLE_PCH)
4823 TAB=`printf '\t'`
4825 AC_MSG_CHECKING([the GNU Make version])
4826 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4827 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4828 if test "$_make_longver" -ge "038200"; then
4829     AC_MSG_RESULT([$GNUMAKE $_make_version])
4831 elif test "$_make_longver" -ge "038100"; then
4832     if test "$build_os" = "cygwin"; then
4833         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4834     fi
4835     AC_MSG_RESULT([$GNUMAKE $_make_version])
4837     dnl ===================================================================
4838     dnl Search all the common names for sha1sum
4839     dnl ===================================================================
4840     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4841     if test -z "$SHA1SUM"; then
4842         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
4843     elif test "$SHA1SUM" = "openssl"; then
4844         SHA1SUM="openssl sha1"
4845     fi
4846     AC_MSG_CHECKING([for GNU Make bug 20033])
4847     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4848     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4849 A := \$(wildcard *.a)
4851 .PHONY: all
4852 all: \$(A:.a=.b)
4853 <TAB>@echo survived bug20033.
4855 .PHONY: setup
4856 setup:
4857 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4859 define d1
4860 @echo lala \$(1)
4861 @sleep 1
4862 endef
4864 define d2
4865 @echo tyty \$(1)
4866 @sleep 1
4867 endef
4869 %.b : %.a
4870 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4871 <TAB>\$(call d1,\$(CHECKSUM)),\
4872 <TAB>\$(call d2,\$(CHECKSUM)))
4874     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4875         no_parallelism_make="YES"
4876         AC_MSG_RESULT([yes, disable parallelism])
4877     else
4878         AC_MSG_RESULT([no, keep parallelism enabled])
4879     fi
4880     rm -rf $TESTGMAKEBUG20033
4881 else
4882     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4885 # find if gnumake support file function
4886 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
4887 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4888 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4889     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
4891 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4892 \$(file >test.txt,Success )
4894 .PHONY: all
4895 all:
4896 <TAB>@cat test.txt
4899 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4900 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4901     HAVE_GNUMAKE_FILE_FUNC=TRUE
4902     AC_MSG_RESULT([yes])
4903 else
4904     AC_MSG_RESULT([no])
4906 rm -rf $TESTGMAKEFILEFUNC
4907 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4908 AC_SUBST(GNUMAKE_WIN_NATIVE)
4910 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
4911 STALE_MAKE=
4912 if test "$_make_ver_check" = ""; then
4913    STALE_MAKE=TRUE
4916 HAVE_LD_HASH_STYLE=FALSE
4917 WITH_LINKER_HASH_STYLE=
4918 AC_MSG_CHECKING([for --hash-style gcc linker support])
4919 if test "$GCC" = "yes"; then
4920     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4921         hash_styles="gnu sysv"
4922     elif test "$with_linker_hash_style" = "no"; then
4923         hash_styles=
4924     else
4925         hash_styles="$with_linker_hash_style"
4926     fi
4928     for hash_style in $hash_styles; do
4929         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4930         hash_style_ldflags_save=$LDFLAGS
4931         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
4933         AC_RUN_IFELSE([AC_LANG_PROGRAM(
4934             [
4935 #include <stdio.h>
4936             ],[
4937 printf ("");
4938             ])],
4939             [
4940                   HAVE_LD_HASH_STYLE=TRUE
4941                   WITH_LINKER_HASH_STYLE=$hash_style
4942             ],
4943             [HAVE_LD_HASH_STYLE=FALSE],
4944             [HAVE_LD_HASH_STYLE=FALSE])
4945         LDFLAGS=$hash_style_ldflags_save
4946     done
4948     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
4949         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
4950     else
4951         AC_MSG_RESULT( no )
4952     fi
4953     LDFLAGS=$hash_style_ldflags_save
4954 else
4955     AC_MSG_RESULT( no )
4957 AC_SUBST(HAVE_LD_HASH_STYLE)
4958 AC_SUBST(WITH_LINKER_HASH_STYLE)
4960 dnl ===================================================================
4961 dnl Check whether there's a Perl version available.
4962 dnl ===================================================================
4963 if test -z "$with_perl_home"; then
4964     AC_PATH_PROG(PERL, perl)
4965 else
4966     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
4967     _perl_path="$with_perl_home/bin/perl"
4968     if test -x "$_perl_path"; then
4969         PERL=$_perl_path
4970     else
4971         AC_MSG_ERROR([$_perl_path not found])
4972     fi
4975 dnl ===================================================================
4976 dnl Testing for Perl version 5 or greater.
4977 dnl $] is the Perl version variable, it is returned as an integer
4978 dnl ===================================================================
4979 if test "$PERL"; then
4980     AC_MSG_CHECKING([the Perl version])
4981     ${PERL} -e "exit($]);"
4982     _perl_version=$?
4983     if test "$_perl_version" -lt 5; then
4984         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
4985     fi
4986     AC_MSG_RESULT([Perl $_perl_version])
4987 else
4988     AC_MSG_ERROR([Perl not found, install Perl 5])
4991 dnl ===================================================================
4992 dnl Testing for required Perl modules
4993 dnl ===================================================================
4995 AC_MSG_CHECKING([for required Perl modules])
4996 perl_use_string="use Cwd ; use Digest::MD5"
4997 if test "$_os" = "WINNT"; then
4998     if test -n "$PKGFORMAT"; then
4999         for i in "$PKGFORMAT"; do
5000             case "$i" in
5001             msi)
5002                 # for getting fonts versions to use in MSI
5003                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5004                 ;;
5005             esac
5006         done
5007     fi
5009 if `$PERL -e '$perl_use_string'>/dev/null 2>&1`; then
5010     AC_MSG_RESULT([all modules found])
5011 else
5012     AC_MSG_RESULT([failed to find some modules])
5013     # Find out which modules are missing.
5014     for i in "$perl_use_string"; do
5015         if test "$i" != "use" -a "$i" != ";"; then
5016             if ! `$PERL -e 'use $i;'>/dev/null 2>&1`; then
5017                 missing_perl_modules="$missing_perl_modules $i"
5018             fi
5019         fi
5020     done
5021     AC_MSG_ERROR([
5022     The missing Perl modules are: $missing_perl_modules
5023     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5026 dnl ===================================================================
5027 dnl Check for pkg-config
5028 dnl ===================================================================
5029 if test "$_os" != "WINNT"; then
5030     PKG_PROG_PKG_CONFIG
5033 if test "$_os" != "WINNT"; then
5035     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5036     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5037     # explicitly. Or put /path/to/compiler in PATH yourself.
5039     # Use wrappers for LTO
5040     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5041         AC_CHECK_TOOL(AR,gcc-ar)
5042         AC_CHECK_TOOL(NM,gcc-nm)
5043         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5044     else
5045         AC_CHECK_TOOL(AR,ar)
5046         AC_CHECK_TOOL(NM,nm)
5047         AC_CHECK_TOOL(RANLIB,ranlib)
5048     fi
5049     AC_CHECK_TOOL(OBJDUMP,objdump)
5050     AC_CHECK_TOOL(READELF,readelf)
5051     AC_CHECK_TOOL(STRIP,strip)
5052     if test "$_os" = "WINNT"; then
5053         AC_CHECK_TOOL(DLLTOOL,dlltool)
5054         AC_CHECK_TOOL(WINDRES,windres)
5055     fi
5057 AC_SUBST(AR)
5058 AC_SUBST(DLLTOOL)
5059 AC_SUBST(NM)
5060 AC_SUBST(OBJDUMP)
5061 AC_SUBST(PKG_CONFIG)
5062 AC_SUBST(RANLIB)
5063 AC_SUBST(READELF)
5064 AC_SUBST(STRIP)
5065 AC_SUBST(WINDRES)
5067 dnl ===================================================================
5068 dnl pkg-config checks on Mac OS X
5069 dnl ===================================================================
5071 if test $_os = Darwin; then
5072     AC_MSG_CHECKING([for bogus pkg-config])
5073     if test -n "$PKG_CONFIG"; then
5074         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5075             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5076         else
5077             if test "$enable_bogus_pkg_config" = "yes"; then
5078                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5079             else
5080                 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.])
5081             fi
5082         fi
5083     else
5084         AC_MSG_RESULT([no, good])
5085     fi
5088 find_csc()
5090     # Return value: $csctest
5092     unset csctest
5094     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5095     if test -n "$regvalue"; then
5096         csctest=$regvalue
5097         return
5098     fi
5101 find_al()
5103     # Return value: $altest
5105     unset altest
5107     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5108         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5109         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5110             altest=$regvalue
5111             return
5112         fi
5113     done
5115     # We need this additional check to detect 4.6.1 or above.
5116     for ver in 4.7 4.6.2 4.6.1; do
5117         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5118         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5119             altest=$regvalue
5120             return
5121         fi
5123         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/WOW6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools"
5124         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5125             altest=$regvalue
5126             return
5127         fi
5128     done
5131 find_dotnetsdk()
5133     # Return value: $frametest (that's a silly name...)
5135     unset frametest
5137     for ver in 1.1 2.0; do
5138         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
5139         if test -n "$regvalue"; then
5140             frametest=$regvalue
5141             return
5142         fi
5143     done
5146 find_dotnetsdk46()
5148     unset frametest
5150     for ver in 4.7 4.6.2 4.6.1 4.6; do
5151         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5152         if test -n "$regvalue"; then
5153             frametest=$regvalue
5154             return
5155         fi
5156         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5157         if test -n "$regvalue"; then
5158             frametest=$regvalue
5159             return
5160         fi
5161     done
5164 find_winsdk_version()
5166     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5167     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5169     unset winsdktest winsdkbinsubdir winsdklibsubdir
5171     case "$1" in
5172     7.*)
5173         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5174         if test -n "$regvalue"; then
5175             winsdktest=$regvalue
5176             winsdklibsubdir=.
5177             return
5178         fi
5179         ;;
5180     8.0|8.0A)
5181         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5182         if test -n "$regvalue"; then
5183             winsdktest=$regvalue
5184             winsdklibsubdir=win8
5185             return
5186         fi
5187         ;;
5188     8.1|8.1A)
5189         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5190         if test -n "$regvalue"; then
5191             winsdktest=$regvalue
5192             winsdklibsubdir=winv6.3
5193             return
5194         fi
5195         ;;
5196     10.0)
5197         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5198         if test -n "$regvalue"; then
5199             winsdktest=$regvalue
5200             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5201             if test -n "$regvalue"; then
5202                 winsdkbinsubdir="$regvalue".0
5203             fi
5204             winsdklibsubdir=$regvalue
5205             if test "$regvalue" = "10.0.14393"; then
5206                 winsdklibsubdir="10.0.14393.0"
5207             elif test "$regvalue" = "10.0.16299"; then
5208                 winsdklibsubdir="10.0.16299.0"
5209             elif test "$regvalue" = "10.0.15063"; then
5210                 winsdklibsubdir="10.0.15063.0"
5211                 dnl Hack needed at least by tml:
5212                 if test ! -f "${winsdktest}/Include/10.0.15063.0/um/sqlext.h" \
5213                     -a -f "${winsdktest}/Include/10.0.14393.0/um/sqlext.h"
5214                 then
5215                     winsdklibsubdir="10.0.14393.0"
5216                 fi
5217             fi
5218             return
5219         fi
5220         ;;
5221     esac
5224 find_winsdk()
5226     # Return value: From find_winsdk_version
5228     unset winsdktest
5230     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5231         find_winsdk_version $ver
5232         if test -n "$winsdktest"; then
5233             return
5234         fi
5235     done
5238 find_msms()
5240     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5241     if test $VCVER = 150; then
5242         my_msm_files="Microsoft_VC141_CRT_x86.msm ${my_msm_files}"
5243     fi
5244     AC_MSG_CHECKING([for ${my_msm_files}])
5245     msmdir=
5246     for ver in 14.0 15.0; do
5247         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5248         if test -n "$regvalue"; then
5249             for f in ${my_msm_files}; do
5250                 if test -e "$regvalue/${f}"; then
5251                     msmdir=$regvalue
5252                     break
5253                 fi
5254             done
5255         fi
5256     done
5257     dnl Is the following fallback really necessary, or was it added in response
5258     dnl to never having started Visual Studio on a given machine, so the
5259     dnl registry keys checked above had presumably not yet been created?
5260     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5261     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5262     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5263     dnl expanding to "C:\Program Files\Common Files"), which would need
5264     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5265     dnl obtain its value from cygwin:
5266     if test -z "$msmdir"; then
5267         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5268         for f in ${my_msm_files}; do
5269             if test -e "$my_msm_dir/${f}"; then
5270                 msmdir=$my_msm_dir
5271             fi
5272         done
5273     fi
5275     dnl Starting from MSVC 15.0, merge modules are located in different directory
5276     if test $VCVER = 150; then
5277         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5278             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])
5279             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5280             for f in ${my_msm_files}; do
5281                 if test -e "$my_msm_dir/${f}"; then
5282                     msmdir=$my_msm_dir
5283                     break
5284                 fi
5285             done
5286         done
5287     fi
5289     if test -n "$msmdir"; then
5290         msmdir=`cygpath -m "$msmdir"`
5291         AC_MSG_RESULT([$msmdir])
5292     else
5293         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5294             AC_MSG_ERROR([not found])
5295         else
5296             AC_MSG_WARN([not found])
5297             add_warning "MSM none of ${my_msm_files} found"
5298         fi
5299     fi
5302 find_msvc_x64_dlls()
5304     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5305     if test "$VCVER" = 150; then
5306         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5307             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT])
5308             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5309                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5310                 break
5311             fi
5312             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5313                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5314                 break
5315             fi
5316         done
5317     fi
5318     msvcdlls="msvcp140.dll vcruntime140.dll"
5319     for dll in $msvcdlls; do
5320         if ! test -f "$msvcdllpath/$dll"; then
5321             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5322         fi
5323     done
5326 dnl =========================================
5327 dnl Check for the Windows  SDK.
5328 dnl =========================================
5329 if test "$_os" = "WINNT"; then
5330     AC_MSG_CHECKING([for Windows SDK])
5331     if test "$build_os" = "cygwin"; then
5332         find_winsdk
5333         WINDOWS_SDK_HOME=$winsdktest
5335         # normalize if found
5336         if test -n "$WINDOWS_SDK_HOME"; then
5337             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5338             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5339         fi
5341         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5342     fi
5344     if test -n "$WINDOWS_SDK_HOME"; then
5345         # Remove a possible trailing backslash
5346         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5348         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5349              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5350              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5351             have_windows_sdk_headers=yes
5352         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5353              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5354              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5355             have_windows_sdk_headers=yes
5356         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5357              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5358              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5359             have_windows_sdk_headers=yes
5360         else
5361             have_windows_sdk_headers=no
5362         fi
5364         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5365             have_windows_sdk_libs=yes
5366         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5367             have_windows_sdk_libs=yes
5368         else
5369             have_windows_sdk_libs=no
5370         fi
5372         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5373             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5374 the  Windows SDK are installed.])
5375         fi
5376     fi
5378     if test -z "$WINDOWS_SDK_HOME"; then
5379         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5380     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
5381         WINDOWS_SDK_VERSION=70
5382         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
5383     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5384         WINDOWS_SDK_VERSION=80
5385         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5386     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5387         WINDOWS_SDK_VERSION=81
5388         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5389     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5390         WINDOWS_SDK_VERSION=10
5391         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5392     else
5393         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5394     fi
5395     PathFormat "$WINDOWS_SDK_HOME"
5396     WINDOWS_SDK_HOME="$formatted_path"
5397     if test "$build_os" = "cygwin"; then
5398         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5399         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5400             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5401         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5402             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5403         fi
5404     fi
5406     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5407     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5408     dnl but not in v8.0), so allow this to be overridden with a
5409     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5410     dnl and configuration error if no WiLangId.vbs is found would arguably be
5411     dnl better, but I do not know under which conditions exactly it is needed by
5412     dnl msiglobal.pm:
5413     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5414         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5415         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5416             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5417         fi
5418         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5419             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5420         fi
5421         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5422             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5423         fi
5424     fi
5425     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5426         if test -n "$with_package_format" -a "$with_package_format" != no; then
5427             for i in "$with_package_format"; do
5428                 if test "$i" = "msi"; then
5429                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5430                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5431                     fi
5432                 fi
5433             done
5434         fi
5435     fi
5437 AC_SUBST(WINDOWS_SDK_HOME)
5438 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5439 AC_SUBST(WINDOWS_SDK_VERSION)
5440 AC_SUBST(WINDOWS_SDK_WILANGID)
5442 if test "$build_os" = "cygwin"; then
5443     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5444     dnl dir, it also determines that dir's path w/o an arch segment if any,
5445     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5446     AC_MSG_CHECKING([for midl.exe])
5448     find_winsdk
5449     if test -n "$winsdkbinsubdir" \
5450         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5451     then
5452         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5453         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5454     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5455         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5456         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5457     elif test -f "$winsdktest/Bin/midl.exe"; then
5458         MIDL_PATH=$winsdktest/Bin
5459         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5460     fi
5461     if test ! -f "$MIDL_PATH/midl.exe"; then
5462         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5463     else
5464         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5465     fi
5467     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5468     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5470     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5471          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5472          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5473          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5474     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5475          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5476          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5477          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5478     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5479          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5480          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5481          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5482     else
5483         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5484     fi
5486     dnl Check csc.exe
5487     AC_MSG_CHECKING([for csc.exe])
5488     find_csc
5489     if test -f "$csctest/csc.exe"; then
5490         CSC_PATH="$csctest"
5491     fi
5492     if test ! -f "$CSC_PATH/csc.exe"; then
5493         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5494     else
5495         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5496     fi
5498     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5500     dnl Check al.exe
5501     AC_MSG_CHECKING([for al.exe])
5502     find_winsdk
5503     if test -n "$winsdkbinsubdir" \
5504         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5505     then
5506         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5507     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5508         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5509     elif test -f "$winsdktest/Bin/al.exe"; then
5510         AL_PATH="$winsdktest/Bin"
5511     fi
5513     if test -z "$AL_PATH"; then
5514         find_al
5515         if test -f "$altest/bin/al.exe"; then
5516             AL_PATH="$altest/bin"
5517         elif test -f "$altest/al.exe"; then
5518             AL_PATH="$altest"
5519         fi
5520     fi
5521     if test ! -f "$AL_PATH/al.exe"; then
5522         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5523     else
5524         AC_MSG_RESULT([$AL_PATH/al.exe])
5525     fi
5527     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5529     dnl Check mscoree.lib / .NET Framework dir
5530     AC_MSG_CHECKING(.NET Framework)
5531     find_dotnetsdk
5532     if test -f "$frametest/lib/mscoree.lib"; then
5533         DOTNET_FRAMEWORK_HOME="$frametest"
5534     else
5535         find_winsdk
5536         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5537             DOTNET_FRAMEWORK_HOME="$winsdktest"
5538         else
5539             find_dotnetsdk46
5540             PathFormat "$frametest"
5541             frametest="$formatted_path"
5542             if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5543                  DOTNET_FRAMEWORK_HOME="$frametest"
5544             fi
5545         fi
5546     fi
5548     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
5549         AC_MSG_ERROR([mscoree.lib not found])
5550     fi
5551     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5553     PathFormat "$MIDL_PATH"
5554     MIDL_PATH="$formatted_path"
5556     PathFormat "$AL_PATH"
5557     AL_PATH="$formatted_path"
5559     PathFormat "$DOTNET_FRAMEWORK_HOME"
5560     DOTNET_FRAMEWORK_HOME="$formatted_path"
5562     PathFormat "$CSC_PATH"
5563     CSC_PATH="$formatted_path"
5566 dnl ===================================================================
5567 dnl Check if stdc headers are available excluding MSVC.
5568 dnl ===================================================================
5569 if test "$_os" != "WINNT"; then
5570     AC_HEADER_STDC
5573 dnl ===================================================================
5574 dnl Testing for C++ compiler and version...
5575 dnl ===================================================================
5577 if test "$_os" != "WINNT"; then
5578     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5579     save_CXXFLAGS=$CXXFLAGS
5580     AC_PROG_CXX
5581     CXXFLAGS=$save_CXXFLAGS
5582 else
5583     if test -n "$CC" -a -z "$CXX"; then
5584         CXX="$CC"
5585     fi
5588 dnl At least MSVC 2015 Update 1 is known to sporadically emit warning C4592
5589 dnl ("implementation limitation" when defining OUStringLiteral variables in
5590 dnl vcl/source/app/IconThemeInfo.cxx), while Update 3 is known good, and it is
5591 dnl probably a good idea to require that anyway.  A reliable way to check for
5592 dnl MSVC 2015 Update 3 appears to be to check for support of C++17 nested
5593 dnl namespace definitions (which requires /std:c++latest to be enabled):
5594 if test "$COM" = MSC -a "$VCVER" = 140; then
5595     AC_MSG_CHECKING([whether MSVC 2015 compiler $MSVC_CXX is at least Update 3])
5596     save_CXX=$CXX
5597     save_CXXFLAGS=$CXXFLAGS
5598     CXX=$MSVC_CXX
5599     CXXFLAGS="$CXXFLAGS /std:c++latest"
5600     AC_LANG_PUSH([C++])
5601     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5602         namespace A::B {}
5603     ]])], [good=yes], [good=no])
5604     AC_LANG_POP([C++])
5605     CXX=$save_CXX
5606     CXXFLAGS=$save_CXXFLAGS
5607     AC_MSG_RESULT([$good])
5608     if test "$good" = no; then
5609         AC_MSG_ERROR([When using MSVC 2015, at least Update 3 must be installed])
5610     fi
5613 dnl check for GNU C++ compiler version
5614 if test "$GXX" = "yes"; then
5615     AC_MSG_CHECKING([the GNU C++ compiler version])
5617     _gpp_version=`$CXX -dumpversion`
5618     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5620     if test "$_gpp_majmin" -lt "401"; then
5621         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5622     else
5623         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5624     fi
5626     dnl see https://code.google.com/p/android/issues/detail?id=41770
5627     if test "$_gpp_majmin" -ge "401"; then
5628         glibcxx_threads=no
5629         AC_LANG_PUSH([C++])
5630         AC_REQUIRE_CPP
5631         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5632         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5633             #include <bits/c++config.h>]],[[
5634             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5635             && !defined(_GLIBCXX__PTHREADS) \
5636             && !defined(_GLIBCXX_HAS_GTHREADS)
5637             choke me
5638             #endif
5639         ]])],[AC_MSG_RESULT([yes])
5640         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5641         AC_LANG_POP([C++])
5642         if test $glibcxx_threads = yes; then
5643             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5644         fi
5645      fi
5647 AC_SUBST(BOOST_CXXFLAGS)
5650 # prefx CXX with ccache if needed
5652 if test "$CCACHE" != ""; then
5653     AC_MSG_CHECKING([whether $CXX is already ccached])
5654     AC_LANG_PUSH([C++])
5655     save_CXXFLAGS=$CXXFLAGS
5656     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5657     dnl an empty program will do, we're checking the compiler flags
5658     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5659                       [use_ccache=yes], [use_ccache=no])
5660     if test $use_ccache = yes; then
5661         AC_MSG_RESULT([yes])
5662     else
5663         CXX="$CCACHE $CXX"
5664         AC_MSG_RESULT([no])
5665     fi
5666     CXXFLAGS=$save_CXXFLAGS
5667     AC_LANG_POP([C++])
5670 dnl ===================================================================
5671 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5672 dnl ===================================================================
5674 if test "$_os" != "WINNT"; then
5675     AC_PROG_CXXCPP
5677     dnl Check whether there's a C pre-processor.
5678     AC_PROG_CPP
5682 dnl ===================================================================
5683 dnl Find integral type sizes and alignments
5684 dnl ===================================================================
5686 if test "$_os" != "WINNT"; then
5688 if test "$_os" == "iOS"; then
5689     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5690     ac_cv_sizeof_long=8
5691     ac_cv_sizeof_short=2
5692     ac_cv_sizeof_int=4
5693     ac_cv_sizeof_long_long=8
5694     ac_cv_sizeof_double=8
5695     ac_cv_sizeof_voidp=8
5696 else
5697     AC_CHECK_SIZEOF(long)
5698     AC_CHECK_SIZEOF(short)
5699     AC_CHECK_SIZEOF(int)
5700     AC_CHECK_SIZEOF(long long)
5701     AC_CHECK_SIZEOF(double)
5702     AC_CHECK_SIZEOF(void*)
5705     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5706     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5707     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5708     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5709     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5711     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5712     m4_pattern_allow([AC_CHECK_ALIGNOF])
5713     m4_ifdef([AC_CHECK_ALIGNOF],
5714         [
5715             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5716             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5717             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5718             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5719         ],
5720         [
5721             case "$_os-$host_cpu" in
5722             Linux-i686)
5723                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5724                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5725                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5726                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5727                 ;;
5728             Linux-x86_64)
5729                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5730                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5731                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5732                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5733                 ;;
5734             *)
5735                 if test -z "$ac_cv_alignof_short" -o \
5736                         -z "$ac_cv_alignof_int" -o \
5737                         -z "$ac_cv_alignof_long" -o \
5738                         -z "$ac_cv_alignof_double"; then
5739                    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.])
5740                 fi
5741                 ;;
5742             esac
5743         ])
5745     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5746     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5747     if test $ac_cv_sizeof_long -eq 8; then
5748         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5749     elif test $ac_cv_sizeof_double -eq 8; then
5750         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5751     else
5752         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5753     fi
5755     dnl Check for large file support
5756     AC_SYS_LARGEFILE
5757     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5758         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5759     fi
5760     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5761         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5762     fi
5763 else
5764     # Hardcode for MSVC
5765     SAL_TYPES_SIZEOFSHORT=2
5766     SAL_TYPES_SIZEOFINT=4
5767     SAL_TYPES_SIZEOFLONG=4
5768     SAL_TYPES_SIZEOFLONGLONG=8
5769     if test "$BITNESS_OVERRIDE" = ""; then
5770         SAL_TYPES_SIZEOFPOINTER=4
5771     else
5772         SAL_TYPES_SIZEOFPOINTER=8
5773     fi
5774     SAL_TYPES_ALIGNMENT2=2
5775     SAL_TYPES_ALIGNMENT4=4
5776     SAL_TYPES_ALIGNMENT8=8
5777     LFS_CFLAGS=''
5779 AC_SUBST(LFS_CFLAGS)
5781 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5782 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5783 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5784 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5785 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5786 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5787 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5788 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5790 dnl ===================================================================
5791 dnl Check whether to enable runtime optimizations
5792 dnl ===================================================================
5793 ENABLE_RUNTIME_OPTIMIZATIONS=
5794 AC_MSG_CHECKING([whether to enable runtime optimizations])
5795 if test -z "$enable_runtime_optimizations"; then
5796     for i in $CC; do
5797         case $i in
5798         -fsanitize=*)
5799             enable_runtime_optimizations=no
5800             break
5801             ;;
5802         esac
5803     done
5805 if test "$enable_runtime_optimizations" != no; then
5806     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5807     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5808     AC_MSG_RESULT([yes])
5809 else
5810     AC_MSG_RESULT([no])
5812 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5814 dnl ===================================================================
5815 dnl Check if valgrind headers are available
5816 dnl ===================================================================
5817 ENABLE_VALGRIND=
5818 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
5819     prev_cppflags=$CPPFLAGS
5820     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5821     # or where does it come from?
5822     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5823     AC_CHECK_HEADER([valgrind/valgrind.h],
5824         [ENABLE_VALGRIND=TRUE])
5825     CPPFLAGS=$prev_cppflags
5827 AC_SUBST([ENABLE_VALGRIND])
5828 if test -z "$ENABLE_VALGRIND"; then
5829     if test "$with_valgrind" = yes; then
5830         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
5831     fi
5832     VALGRIND_CFLAGS=
5834 AC_SUBST([VALGRIND_CFLAGS])
5837 dnl ===================================================================
5838 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5839 dnl ===================================================================
5841 # We need at least the sys/sdt.h include header.
5842 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5843 if test "$SDT_H_FOUND" = "TRUE"; then
5844     # Found sys/sdt.h header, now make sure the c++ compiler works.
5845     # Old g++ versions had problems with probes in constructors/destructors.
5846     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5847     AC_LANG_PUSH([C++])
5848     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5849     #include <sys/sdt.h>
5850     class ProbeClass
5851     {
5852     private:
5853       int& ref;
5854       const char *name;
5856     public:
5857       ProbeClass(int& v, const char *n) : ref(v), name(n)
5858       {
5859         DTRACE_PROBE2(_test_, cons, name, ref);
5860       }
5862       void method(int min)
5863       {
5864         DTRACE_PROBE3(_test_, meth, name, ref, min);
5865         ref -= min;
5866       }
5868       ~ProbeClass()
5869       {
5870         DTRACE_PROBE2(_test_, dest, name, ref);
5871       }
5872     };
5873     ]],[[
5874     int i = 64;
5875     DTRACE_PROBE1(_test_, call, i);
5876     ProbeClass inst = ProbeClass(i, "call");
5877     inst.method(24);
5878     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5879           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5880     AC_LANG_POP([C++])
5882 AC_CONFIG_HEADERS([config_host/config_probes.h])
5884 dnl ===================================================================
5885 dnl GCC features
5886 dnl ===================================================================
5887 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
5888     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5889     save_CFLAGS=$CFLAGS
5890     CFLAGS="$CFLAGS -Werror -mno-avx"
5891     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5892     CFLAGS=$save_CFLAGS
5893     if test "$HAVE_GCC_AVX" = "TRUE"; then
5894         AC_MSG_RESULT([yes])
5895     else
5896         AC_MSG_RESULT([no])
5897     fi
5899     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5900     save_CFLAGS=$CFLAGS
5901     CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
5902     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5903     CFLAGS=$save_CFLAGS
5904     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5905         AC_MSG_RESULT([yes])
5906     else
5907         AC_MSG_RESULT([no])
5908     fi
5910     AC_MSG_CHECKING([whether $CC supports atomic functions])
5911     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5912     int v = 0;
5913     if (__sync_add_and_fetch(&v, 1) != 1 ||
5914         __sync_sub_and_fetch(&v, 1) != 0)
5915         return 1;
5916     __sync_synchronize();
5917     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5918         v != 1)
5919         return 1;
5920     return 0;
5921 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5922     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5923         AC_MSG_RESULT([yes])
5924         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5925     else
5926         AC_MSG_RESULT([no])
5927     fi
5929     AC_MSG_CHECKING([whether $CC supports __builtin_ffs])
5930     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
5931     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
5932         AC_MSG_RESULT([yes])
5933         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
5934     else
5935         AC_MSG_RESULT([no])
5936     fi
5938     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5939     save_CFLAGS=$CFLAGS
5940     CFLAGS="$CFLAGS -Werror"
5941     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5942             __attribute__((deprecated("test"))) void f();
5943         ])], [
5944             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5945             AC_MSG_RESULT([yes])
5946         ], [AC_MSG_RESULT([no])])
5947     CFLAGS=$save_CFLAGS
5949     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
5950     AC_LANG_PUSH([C++])
5951     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5952             #include <cstddef>
5953             #include <cxxabi.h>
5954             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
5955         ])], [
5956             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
5957             AC_MSG_RESULT([yes])
5958         ], [AC_MSG_RESULT([no])])
5959     AC_LANG_POP([C++])
5961     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
5962     AC_LANG_PUSH([C++])
5963     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5964             #include <cstddef>
5965             #include <cxxabi.h>
5966             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
5967         ])], [
5968             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
5969             AC_MSG_RESULT([yes])
5970         ], [AC_MSG_RESULT([no])])
5971     AC_LANG_POP([C++])
5973     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
5974     AC_LANG_PUSH([C++])
5975     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5976             #include <cxxabi.h>
5977             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
5978         ])], [
5979             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
5980             AC_MSG_RESULT([yes])
5981         ], [AC_MSG_RESULT([no])])
5982     AC_LANG_POP([C++])
5984     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
5985     AC_LANG_PUSH([C++])
5986     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5987             #include <cstddef>
5988             #include <cxxabi.h>
5989             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
5990         ])], [
5991             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
5992             AC_MSG_RESULT([yes])
5993         ], [AC_MSG_RESULT([no])])
5994     AC_LANG_POP([C++])
5996     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
5997     AC_LANG_PUSH([C++])
5998     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5999             #include <cstddef>
6000             #include <cxxabi.h>
6001             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6002         ])], [
6003             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6004             AC_MSG_RESULT([yes])
6005         ], [AC_MSG_RESULT([no])])
6006     AC_LANG_POP([C++])
6008     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6009     AC_LANG_PUSH([C++])
6010     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6011             #include <cxxabi.h>
6012             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6013         ])], [
6014             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6015             AC_MSG_RESULT([yes])
6016         ], [AC_MSG_RESULT([no])])
6017     AC_LANG_POP([C++])
6019     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6020     AC_LANG_PUSH([C++])
6021     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6022             #include <cxxabi.h>
6023             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6024         ])], [
6025             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6026             AC_MSG_RESULT([yes])
6027         ], [AC_MSG_RESULT([no])])
6028     AC_LANG_POP([C++])
6030     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
6031     AC_LANG_PUSH([C++])
6032     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6033             #include <cstddef>
6034             #include <cxxabi.h>
6035             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6036         ])], [
6037             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6038             AC_MSG_RESULT([yes])
6039         ], [AC_MSG_RESULT([no])])
6040     AC_LANG_POP([C++])
6042     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
6043     AC_LANG_PUSH([C++])
6044     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6045             #include <cstddef>
6046             #include <cxxabi.h>
6047             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6048         ])], [
6049             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6050             AC_MSG_RESULT([yes])
6051         ], [AC_MSG_RESULT([no])])
6052     AC_LANG_POP([C++])
6054     dnl Available in GCC 4.9 and at least since Clang 3.4:
6055     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6056     AC_LANG_PUSH([C++])
6057     save_CXXFLAGS=$CXXFLAGS
6058     CXXFLAGS="$CXXFLAGS -Werror"
6059     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6060             struct __attribute__((warn_unused)) dummy {};
6061         ])], [
6062             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6063             AC_MSG_RESULT([yes])
6064         ], [AC_MSG_RESULT([no])])
6065     CXXFLAGS=$save_CXXFLAGS
6066 AC_LANG_POP([C++])
6069 AC_SUBST(HAVE_GCC_AVX)
6070 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6071 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6072 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6074 dnl ===================================================================
6075 dnl Identify the C++ library
6076 dnl ===================================================================
6078 AC_MSG_CHECKING([What the C++ library is])
6079 AC_LANG_PUSH([C++])
6080 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6081 #include <utility>
6082 #ifndef __GLIBCXX__
6083 foo bar
6084 #endif
6085 ]])],
6086     [CPP_LIBRARY=GLIBCXX
6087      cpp_library_name="GNU libstdc++"
6088     ],
6089     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6090 #include <utility>
6091 #ifndef _LIBCPP_VERSION
6092 foo bar
6093 #endif
6094 ]])],
6095     [CPP_LIBRARY=LIBCPP
6096      cpp_library_name="LLVM libc++"
6097      AC_DEFINE([HAVE_LIBCXX])
6098     ],
6099     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6100 #include <utility>
6101 #ifndef _MSC_VER
6102 foo bar
6103 #endif
6104 ]])],
6105     [CPP_LIBRARY=MSVCRT
6106      cpp_library_name="Microsoft"
6107     ],
6108     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6109 AC_MSG_RESULT([$cpp_library_name])
6110 AC_LANG_POP([C++])
6112 dnl ===================================================================
6113 dnl Check for gperf
6114 dnl ===================================================================
6115 AC_PATH_PROG(GPERF, gperf)
6116 if test -z "$GPERF"; then
6117     AC_MSG_ERROR([gperf not found but needed. Install it.])
6119 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6120     GPERF=`cygpath -m $GPERF`
6122 AC_MSG_CHECKING([gperf version])
6123 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
6124     AC_MSG_RESULT([OK])
6125 else
6126     AC_MSG_ERROR([too old, you need at least 3.0.0])
6128 AC_SUBST(GPERF)
6130 dnl ===================================================================
6131 dnl Check for system libcmis
6132 dnl ===================================================================
6133 # libcmis requires curl and we can't build curl for iOS
6134 if test $_os != iOS; then
6135     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.0])
6136     ENABLE_LIBCMIS=TRUE
6137 else
6138     ENABLE_LIBCMIS=
6140 AC_SUBST(ENABLE_LIBCMIS)
6142 dnl ===================================================================
6143 dnl C++11
6144 dnl ===================================================================
6146 my_cxx17switches=
6147 libo_FUZZ_ARG_ENABLE(c++17,
6148     AS_HELP_STRING([--disable-c++17],
6149         [Do not attempt to run GCC/Clang in C++17 mode (needed for Coverity).])
6152 CXXFLAGS_CXX11=
6153 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6154     AC_MSG_CHECKING([whether $CXX supports C++11])
6155     AC_MSG_RESULT(yes)
6156     # MSVC supports (a subset of) CXX11 without any switch
6157 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6158     HAVE_CXX11=
6159     AC_MSG_CHECKING([whether $CXX supports C++17, C++14, or C++11])
6160     dnl But only use C++17 if the gperf that is being used knows not to emit
6161     dnl "register" in C++ output:
6162     printf 'foo\n' | $GPERF -L C++ > conftest.inc
6163     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'
6164     if test "$enable_c__17" != no; then
6165         my_flags="-std=gnu++17 -std=gnu++1z -std=c++17 -std=c++1z $my_flags"
6166     fi
6167     for flag in $my_flags; do
6168         if test "$COM" = MSC; then
6169             flag="-Xclang $flag"
6170         fi
6171         save_CXXFLAGS=$CXXFLAGS
6172         CXXFLAGS="$CXXFLAGS $flag -Werror"
6173         if test "$SYSTEM_LIBCMIS" = TRUE; then
6174             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6175         fi
6176         AC_LANG_PUSH([C++])
6177         dnl Clang 3.9 supports __float128 since
6178         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6179         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6180         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6181         dnl $flag is supported below, so check this first):
6182         my_float128hack=
6183         my_float128hack_impl=-D__float128=void
6184         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6185             #include <vector>
6186             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6187             // (__float128)
6188             ]])
6189         ],,[
6190             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6191             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6192             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6193             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6194             dnl place where __float128 is used is in a template specialization, -D__float128=void
6195             dnl will avoid the problem there while still causing a problem if somebody actually uses
6196             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6197             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6198             dnl "fixed" with this hack):
6199             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6200             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6201                 #include <vector>
6202                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6203                 // (__float128)
6204                 ]])
6205             ],[my_float128hack=$my_float128hack_impl])
6206         ])
6207         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6208             #include <algorithm>
6209             #include <functional>
6210             #include <vector>
6212             #include <string.h>
6213             #pragma GCC diagnostic push
6214             #pragma GCC diagnostic ignored "-Wpragmas"
6215                 // make GCC not warn about next pragma
6216             #pragma GCC diagnostic ignored "-Wdeprecated-register"
6217                 // make Clang with -std < C++17 not even warn about register
6218             #include "conftest.inc"
6219             #pragma GCC diagnostic pop
6221             #if defined SYSTEM_LIBCMIS
6222             // See ucb/source/ucp/cmis/auth_provider.hxx:
6223             #if __GNUC__ >= 7
6224             #pragma GCC diagnostic push
6225             #pragma GCC diagnostic ignored "-Wdeprecated"
6226             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6227             #endif
6228             #include <libcmis/libcmis.hxx>
6229             #if __GNUC__ >= 7
6230             #pragma GCC diagnostic pop
6231             #endif
6232             #endif
6234             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6235                 std::sort(v.begin(), v.end(), fn);
6236             }
6237             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6238         AC_LANG_POP([C++])
6239         CXXFLAGS=$save_CXXFLAGS
6240         if test -n "$CXXFLAGS_CXX11"; then
6241             HAVE_CXX11=TRUE
6242             break
6243         fi
6244     done
6245     rm conftest.inc
6246     if test "$HAVE_CXX11" = TRUE; then
6247         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6248     else
6249         AC_MSG_ERROR(no)
6250     fi
6252 AC_SUBST(CXXFLAGS_CXX11)
6254 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6255 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6256 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6257 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6258 dnl again towards 4.7.2:
6259 if test $CPP_LIBRARY = GLIBCXX; then
6260     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6261     AC_LANG_PUSH([C++])
6262     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6263 #include <list>
6264 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6265     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6266     //   GCC 4.7.0: 20120322
6267     //   GCC 4.7.1: 20120614
6268     // and using a range check is not possible as the mapping between
6269     // __GLIBCXX__ values and GCC versions is not monotonic
6270 /* ok */
6271 #else
6272 abi broken
6273 #endif
6274         ]])], [AC_MSG_RESULT(no, ok)],
6275         [AC_MSG_ERROR(yes)])
6276     AC_LANG_POP([C++])
6279 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6280 save_CXXFLAGS=$CXXFLAGS
6281 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6282 AC_LANG_PUSH([C++])
6284 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6285 #include <stddef.h>
6287 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6289 namespace
6291         struct b
6292         {
6293                 int i;
6294                 int j;
6295         };
6297 ]], [[
6298 struct a
6300         int i;
6301         int j;
6303 a thinga[]={{0,0}, {1,1}};
6304 b thingb[]={{0,0}, {1,1}};
6305 size_t i = sizeof(sal_n_array_size(thinga));
6306 size_t j = sizeof(sal_n_array_size(thingb));
6307 return !(i != 0 && j != 0);
6309     ], [ AC_MSG_RESULT(yes) ],
6310     [ AC_MSG_ERROR(no)])
6311 AC_LANG_POP([C++])
6312 CXXFLAGS=$save_CXXFLAGS
6314 AC_MSG_CHECKING([whether $CXX supports C++14 constexpr])
6315 save_CXXFLAGS=$CXXFLAGS
6316 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6317 AC_LANG_PUSH([C++])
6318 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6319     // A somewhat over-complicated way of checking for
6320     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6321     // in constexpr function":
6322     #include <cassert>
6323     template<typename T> inline constexpr T f(T x) { return x; }
6324     template<typename T> inline constexpr T g(T x) {
6325         assert(f(static_cast<int>(x)));
6326         return x;
6327     }
6328     enum E { e };
6329     auto v = g(E::e);
6331     struct S {
6332         int n_;
6333         constexpr bool f() {
6334             int n = n_;
6335             int i = 0;
6336             while (n > 0) { --n; ++i; }
6337             assert(i >= 0);
6338             return i == 0;
6339         }
6340     };
6341     constexpr auto v2 = S{10}.f();
6342     ]])], [cxx14_constexpr=yes], [cxx14_constexpr=no])
6343 AC_LANG_POP([C++])
6344 CXXFLAGS=$save_CXXFLAGS
6345 AC_MSG_RESULT([$cxx14_constexpr])
6346 if test "$cxx14_constexpr" = yes; then
6347     AC_DEFINE([HAVE_CXX14_CONSTEXPR])
6350 dnl _Pragma support (may require C++11)
6351 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6352     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6353     AC_LANG_PUSH([C++])
6354     save_CXXFLAGS=$CXXFLAGS
6355     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6356     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6357             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6358         ])], [
6359             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6360             AC_MSG_RESULT([yes])
6361         ], [AC_MSG_RESULT([no])])
6362     AC_LANG_POP([C++])
6363     CXXFLAGS=$save_CXXFLAGS
6366 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6367 if test "$GCC" = yes; then
6368     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6369     AC_LANG_PUSH([C++])
6370     save_CXXFLAGS=$CXXFLAGS
6371     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6372     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6373     CXXFLAGS=$save_CXXFLAGS
6374     AC_LANG_POP([C++])
6375     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6376         AC_MSG_RESULT([yes])
6377     else
6378         AC_MSG_RESULT([no])
6379     fi
6381 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6383 dnl ===================================================================
6384 dnl system stl sanity tests
6385 dnl ===================================================================
6386 if test "$_os" != "WINNT"; then
6388     AC_LANG_PUSH([C++])
6390     save_CPPFLAGS="$CPPFLAGS"
6391     if test -n "$MACOSX_SDK_PATH"; then
6392         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6393     fi
6395     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6396     # only.
6397     if test "$CPP_LIBRARY" = GLIBCXX; then
6398         dnl gcc#19664, gcc#22482, rhbz#162935
6399         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6400         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6401         AC_MSG_RESULT([$stlvisok])
6402         if test "$stlvisok" = "no"; then
6403             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6404         fi
6405     fi
6407     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6408     # when we don't make any dynamic libraries?
6409     if test "$DISABLE_DYNLOADING" = ""; then
6410         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6411         cat > conftestlib1.cc <<_ACEOF
6412 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6413 struct S2: S1<int> { virtual ~S2(); };
6414 S2::~S2() {}
6415 _ACEOF
6416         cat > conftestlib2.cc <<_ACEOF
6417 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6418 struct S2: S1<int> { virtual ~S2(); };
6419 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6420 _ACEOF
6421         gccvisinlineshiddenok=yes
6422         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6423             gccvisinlineshiddenok=no
6424         else
6425             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6426             dnl known to not work with -z defs (unsetting which makes the test
6427             dnl moot, though):
6428             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6429             if test "$COM_IS_CLANG" = TRUE; then
6430                 for i in $CXX $CXXFLAGS; do
6431                     case $i in
6432                     -fsanitize=*)
6433                         my_linkflagsnoundefs=
6434                         break
6435                         ;;
6436                     esac
6437                 done
6438             fi
6439             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6440                 gccvisinlineshiddenok=no
6441             fi
6442         fi
6444         rm -fr libconftest*
6445         AC_MSG_RESULT([$gccvisinlineshiddenok])
6446         if test "$gccvisinlineshiddenok" = "no"; then
6447             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6448         fi
6449     fi
6451    AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6452     cat >visibility.cxx <<_ACEOF
6453 #pragma GCC visibility push(hidden)
6454 struct __attribute__ ((visibility ("default"))) TestStruct {
6455   static void Init();
6457 __attribute__ ((visibility ("default"))) void TestFunc() {
6458   TestStruct::Init();
6460 _ACEOF
6461     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6462         gccvisbroken=yes
6463     else
6464         case "$host_cpu" in
6465         i?86|x86_64)
6466             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6467                 gccvisbroken=no
6468             else
6469                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6470                     gccvisbroken=no
6471                 else
6472                     gccvisbroken=yes
6473                 fi
6474             fi
6475             ;;
6476         *)
6477             gccvisbroken=no
6478             ;;
6479         esac
6480     fi
6481     rm -f visibility.s visibility.cxx
6483     AC_MSG_RESULT([$gccvisbroken])
6484     if test "$gccvisbroken" = "yes"; then
6485         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6486     fi
6488     CPPFLAGS="$save_CPPFLAGS"
6490     AC_LANG_POP([C++])
6493 dnl ===================================================================
6494 dnl  Clang++ tests
6495 dnl ===================================================================
6497 HAVE_GCC_FNO_DEFAULT_INLINE=
6498 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6499 if test "$GCC" = "yes"; then
6500     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6501     AC_LANG_PUSH([C++])
6502     save_CXXFLAGS=$CXXFLAGS
6503     CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6504     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6505     CXXFLAGS=$save_CXXFLAGS
6506     AC_LANG_POP([C++])
6507     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6508         AC_MSG_RESULT([yes])
6509     else
6510         AC_MSG_RESULT([no])
6511     fi
6513     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6514     AC_LANG_PUSH([C++])
6515     save_CXXFLAGS=$CXXFLAGS
6516     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6517     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6518     CXXFLAGS=$save_CXXFLAGS
6519     AC_LANG_POP([C++])
6520     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6521         AC_MSG_RESULT([yes])
6522     else
6523         AC_MSG_RESULT([no])
6524     fi
6526 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6527 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6529 dnl ===================================================================
6530 dnl Compiler plugins
6531 dnl ===================================================================
6533 COMPILER_PLUGINS=
6534 # currently only Clang
6536 if test "$COM_IS_CLANG" != "TRUE"; then
6537     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6538         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6539         enable_compiler_plugins=no
6540     fi
6543 if test "$COM_IS_CLANG" = "TRUE"; then
6544     if test -n "$enable_compiler_plugins"; then
6545         compiler_plugins="$enable_compiler_plugins"
6546     elif test -n "$ENABLE_DBGUTIL"; then
6547         compiler_plugins=test
6548     else
6549         compiler_plugins=no
6550     fi
6551     if test "$compiler_plugins" != no -a "$CLANGVER" -lt 30800; then
6552         if test "$compiler_plugins" = yes; then
6553             AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 3.8.0.])
6554         else
6555             compiler_plugins=no
6556         fi
6557     fi
6558     if test "$compiler_plugins" != "no"; then
6559         dnl The prefix where Clang resides, override to where Clang resides if
6560         dnl using a source build:
6561         if test -z "$CLANGDIR"; then
6562             CLANGDIR=/usr
6563         fi
6564         AC_LANG_PUSH([C++])
6565         save_CPPFLAGS=$CPPFLAGS
6566         save_CXX=$CXX
6567         # compiler plugins must be built with "native" compiler that was used to build Clang itself:
6568         : "${COMPILER_PLUGINS_CXX=g++}"
6569         CXX=$COMPILER_PLUGINS_CXX
6570         CPPFLAGS="$CPPFLAGS -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6571         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6572             [COMPILER_PLUGINS=TRUE],
6573             [
6574             if test "$compiler_plugins" = "yes"; then
6575                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6576             else
6577                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6578                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6579             fi
6580             ])
6581         CXX=$save_CXX
6582         CPPFLAGS=$save_CPPFLAGS
6583         AC_LANG_POP([C++])
6584     fi
6585 else
6586     if test "$enable_compiler_plugins" = "yes"; then
6587         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6588     fi
6590 AC_SUBST(COMPILER_PLUGINS)
6591 AC_SUBST(COMPILER_PLUGINS_CXX)
6592 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
6593 AC_SUBST(COMPILER_PLUGINS_DEBUG)
6594 AC_SUBST(CLANGDIR)
6595 AC_SUBST(CLANGLIBDIR)
6597 # Plugin to help linker.
6598 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6599 # This makes --enable-lto build with clang work.
6600 AC_SUBST(LD_PLUGIN)
6602 dnl ===================================================================
6603 dnl allocator
6604 dnl ===================================================================
6605 AC_MSG_CHECKING([which memory allocator to use])
6606 if test "$with_alloc" = "system"; then
6607     AC_MSG_RESULT([system])
6608     ALLOC="SYS_ALLOC"
6610 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6611     AC_MSG_RESULT([internal])
6613 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6614 AC_SUBST(HAVE_POSIX_FALLOCATE)
6615 AC_SUBST(ALLOC)
6617 dnl ===================================================================
6618 dnl Custom build version
6619 dnl ===================================================================
6621 AC_MSG_CHECKING([whether to add custom build version])
6622 if test "$with_build_version" != ""; then
6623     BUILD_VER_STRING=$with_build_version
6624     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6625 else
6626     BUILD_VER_STRING=
6627     AC_MSG_RESULT([no])
6629 AC_SUBST(BUILD_VER_STRING)
6631 JITC_PROCESSOR_TYPE=""
6632 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6633     # IBMs JDK needs this...
6634     JITC_PROCESSOR_TYPE=6
6635     export JITC_PROCESSOR_TYPE
6637 AC_SUBST([JITC_PROCESSOR_TYPE])
6639 # Misc Windows Stuff
6640 AC_ARG_WITH(vcredist-dir,
6641     AS_HELP_STRING([--with-vcredist-dir],
6642         [path to the directory with the arch-specific executables (vc_redist.x64.exe, vc_redist.x86.exe)
6643         for packaging into the installsets (without those the target system needs to install
6644         the Visual C++ Runtimes manually)]),
6646 VCREDIST_DIR="$with_vcredist_dir"
6647 if test $_os = "WINNT"; then
6648     find_msvc_x64_dlls
6649     find_msms
6650     MSVC_DLL_PATH="$msvcdllpath"
6651     MSVC_DLLS="$msvcdlls"
6652     MSM_PATH="$msmdir"
6653     # MSVC 15.3 changed it to VC141
6654     if echo "$MSVC_DLL_PATH" | grep -q "VC141.CRT$"; then
6655         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
6656     else
6657         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6658     fi
6659     if test "$VCREDIST_DIR" = "no"; then
6660         dnl explicitly disabled
6661         VCREDIST_DIR=""
6662     else
6663         if test -f "$VCREDIST_DIR/vc_redist.$WINDOWS_SDK_ARCH.exe"; then
6664             VCREDIST_EXE="vc_redist.$WINDOWS_SDK_ARCH.exe"
6665         else
6666             VCREDIST_DIR=""
6667             if test -n "$PKGFORMAT"; then
6668                for i in "$PKGFORMAT"; do
6669                    case "$i" in
6670                    msi)
6671                        AC_MSG_WARN([--without-vcredist-dir not specified or exe not found - installer will have runtime dependency])
6672                        add_warning "--without-vcredist-dir not specified or exe not found - installer will have runtime dependency"
6673                        ;;
6674                    esac
6675                done
6676             fi
6677         fi
6678     fi
6681 AC_SUBST(VCREDIST_DIR)
6682 AC_SUBST(VCREDIST_EXE)
6683 AC_SUBST(MSVC_DLL_PATH)
6684 AC_SUBST(MSVC_DLLS)
6685 AC_SUBST(MSM_PATH)
6687 dnl ===================================================================
6688 dnl Checks for Java
6689 dnl ===================================================================
6690 if test "$ENABLE_JAVA" != ""; then
6692     # Windows-specific tests
6693     if test "$build_os" = "cygwin"; then
6694         if test "$BITNESS_OVERRIDE" = 64; then
6695             bitness=64
6696         else
6697             bitness=32
6698         fi
6700         if test -z "$with_jdk_home"; then
6701             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
6702             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
6703             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
6704             if test -n "$regvalue"; then
6705                 ver=$regvalue
6706                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
6707                 _jdk_home=$regvalue
6708             fi
6709             if test -z "$with_jdk_home"; then
6710                 for ver in 1.8 1.7 1.6; do
6711                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6712                     if test -n "$regvalue"; then
6713                         _jdk_home=$regvalue
6714                         break
6715                     fi
6716                 done
6717             fi
6718             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6719                 with_jdk_home="$_jdk_home"
6720                 howfound="found automatically"
6721             else
6722                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6723             fi
6724         else
6725             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6726             howfound="you passed"
6727         fi
6728     fi
6730     # 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.
6731     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6732     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6733         with_jdk_home=`/usr/libexec/java_home`
6734     fi
6736     JAVA_HOME=; export JAVA_HOME
6737     if test -z "$with_jdk_home"; then
6738         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6739     else
6740         _java_path="$with_jdk_home/bin/$with_java"
6741         dnl Check if there is a Java interpreter at all.
6742         if test -x "$_java_path"; then
6743             JAVAINTERPRETER=$_java_path
6744         else
6745             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6746         fi
6747     fi
6749     dnl Check that the JDK found is correct architecture (at least 2 reasons to
6750     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
6751     dnl loaded by java to run JunitTests:
6752     if test "$build_os" = "cygwin"; then
6753         shortjdkhome=`cygpath -d "$with_jdk_home"`
6754         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
6755             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6756             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6757         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
6758             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6759             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6760         fi
6762         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6763             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6764         fi
6765         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6766     elif test "$cross_compiling" != "yes"; then
6767         case $CPUNAME in
6768             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
6769                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6770                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6771                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6772                 fi
6773                 ;;
6774             *) # assumption: everything else 32-bit
6775                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6776                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6777                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6778                 fi
6779                 ;;
6780         esac
6781     fi
6784 HAVE_JAVA9=
6785 dnl ===================================================================
6786 dnl Checks for JDK.
6787 dnl ===================================================================
6789 # Note that JAVA_HOME as for now always means the *build* platform's
6790 # JAVA_HOME. Whether all the complexity here actually is needed any
6791 # more or not, no idea.
6793 if test "$ENABLE_JAVA" != ""; then
6794     _gij_longver=0
6795     AC_MSG_CHECKING([the installed JDK])
6796     if test -n "$JAVAINTERPRETER"; then
6797         dnl java -version sends output to stderr!
6798         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6799             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6800         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6801             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6802         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6803             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6804         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6805             JDK=ibm
6807             dnl IBM JDK specific tests
6808             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6809             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6811             if test "$_jdk_ver" -lt 10600; then
6812                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
6813             fi
6815             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6817             if test "$with_jdk_home" = ""; then
6818                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6819 you must use the "--with-jdk-home" configure option explicitly])
6820             fi
6822             JAVA_HOME=$with_jdk_home
6823         else
6824             JDK=sun
6826             dnl Sun JDK specific tests
6827             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6828             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6830             if test "$_jdk_ver" -lt 10600; then
6831                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
6832             fi
6833             if test "$_jdk_ver" -gt 10600; then
6834                 JAVA_CLASSPATH_NOT_SET=TRUE
6835             fi
6836             if test "$_jdk_ver" -ge 10900; then
6837                 HAVE_JAVA9=TRUE
6838             fi
6840             AC_MSG_RESULT([checked (JDK $_jdk)])
6841             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6842             if test "$_os" = "WINNT"; then
6843                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6844             fi
6846             # set to limit VM usage for JunitTests
6847             JAVAIFLAGS=-Xmx64M
6848             # set to limit VM usage for javac
6849             JAVAFLAGS=-J-Xmx128M
6850         fi
6851     else
6852         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
6853     fi
6854 else
6855     dnl Java disabled
6856     JAVA_HOME=
6857     export JAVA_HOME
6860 dnl ===================================================================
6861 dnl Set target Java bytecode version
6862 dnl ===================================================================
6863 if test "$ENABLE_JAVA" != ""; then
6864     if test "$HAVE_JAVA9" = "TRUE"; then
6865         _java_target_ver="1.6"
6866     else
6867         _java_target_ver="1.5"
6868     fi
6869     JAVA_SOURCE_VER="$_java_target_ver"
6870     JAVA_TARGET_VER="$_java_target_ver"
6873 dnl ===================================================================
6874 dnl Checks for javac
6875 dnl ===================================================================
6876 if test "$ENABLE_JAVA" != ""; then
6877     javacompiler="javac"
6878     if test -z "$with_jdk_home"; then
6879         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6880     else
6881         _javac_path="$with_jdk_home/bin/$javacompiler"
6882         dnl Check if there is a Java compiler at all.
6883         if test -x "$_javac_path"; then
6884             JAVACOMPILER=$_javac_path
6885         fi
6886     fi
6887     if test -z "$JAVACOMPILER"; then
6888         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6889     fi
6890     if test "$build_os" = "cygwin"; then
6891         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6892             JAVACOMPILER="${JAVACOMPILER}.exe"
6893         fi
6894         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
6895     fi
6898 dnl ===================================================================
6899 dnl Checks for javadoc
6900 dnl ===================================================================
6901 if test "$ENABLE_JAVA" != ""; then
6902     if test -z "$with_jdk_home"; then
6903         AC_PATH_PROG(JAVADOC, javadoc)
6904     else
6905         _javadoc_path="$with_jdk_home/bin/javadoc"
6906         dnl Check if there is a javadoc at all.
6907         if test -x "$_javadoc_path"; then
6908             JAVADOC=$_javadoc_path
6909         else
6910             AC_PATH_PROG(JAVADOC, javadoc)
6911         fi
6912     fi
6913     if test -z "$JAVADOC"; then
6914         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6915     fi
6916     if test "$build_os" = "cygwin"; then
6917         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6918             JAVADOC="${JAVADOC}.exe"
6919         fi
6920         JAVADOC=`win_short_path_for_make "$JAVADOC"`
6921     fi
6923     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6924     JAVADOCISGJDOC="yes"
6925     fi
6927 AC_SUBST(JAVADOCISGJDOC)
6929 if test "$ENABLE_JAVA" != ""; then
6930     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
6931     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
6932         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
6933            # try to recover first by looking whether we have a alternatives
6934            # system as in Debian or newer SuSEs where following /usr/bin/javac
6935            # over /etc/alternatives/javac leads to the right bindir where we
6936            # just need to strip a bit away to get a valid JAVA_HOME
6937            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
6938         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
6939             # maybe only one level of symlink (e.g. on Mac)
6940             JAVA_HOME=$(readlink $JAVACOMPILER)
6941             if test "$(dirname $JAVA_HOME)" = "."; then
6942                 # we've got no path to trim back
6943                 JAVA_HOME=""
6944             fi
6945         else
6946             # else warn
6947             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
6948             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
6949             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
6950             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
6951         fi
6952         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
6953         if test "$JAVA_HOME" != "/usr"; then
6954             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6955                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
6956                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
6957                 dnl Tiger already returns a JDK path..
6958                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
6959             else
6960                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
6961                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
6962                 dnl that checks which version to run
6963                 if test -f "$JAVA_HOME"; then
6964                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
6965                 fi
6966             fi
6967         fi
6968     fi
6969     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
6971     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
6972     if test -z "$JAVA_HOME"; then
6973         if test "x$with_jdk_home" = "x"; then
6974             cat > findhome.java <<_ACEOF
6975 [import java.io.File;
6977 class findhome
6979     public static void main(String args[])
6980     {
6981         String jrelocation = System.getProperty("java.home");
6982         File jre = new File(jrelocation);
6983         System.out.println(jre.getParent());
6984     }
6986 _ACEOF
6987             AC_MSG_CHECKING([if javac works])
6988             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
6989             AC_TRY_EVAL(javac_cmd)
6990             if test $? = 0 -a -f ./findhome.class; then
6991                 AC_MSG_RESULT([javac works])
6992             else
6993                 echo "configure: javac test failed" >&5
6994                 cat findhome.java >&5
6995                 AC_MSG_ERROR([javac does not work - java projects will not build!])
6996             fi
6997             AC_MSG_CHECKING([if gij knows its java.home])
6998             JAVA_HOME=`$JAVAINTERPRETER findhome`
6999             if test $? = 0 -a "$JAVA_HOME" != ""; then
7000                 AC_MSG_RESULT([$JAVA_HOME])
7001             else
7002                 echo "configure: java test failed" >&5
7003                 cat findhome.java >&5
7004                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7005             fi
7006             # clean-up after ourselves
7007             rm -f ./findhome.java ./findhome.class
7008         else
7009             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7010         fi
7011     fi
7013     # now check if $JAVA_HOME is really valid
7014     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7015         case "${JAVA_HOME}" in
7016             /Library/Java/JavaVirtualMachines/*)
7017                 ;;
7018             *)
7019                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7020                 ;;
7021         esac
7022         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7023             JAVA_HOME_OK="NO"
7024         fi
7025     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7026         JAVA_HOME_OK="NO"
7027     fi
7028     if test "$JAVA_HOME_OK" = "NO"; then
7029         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7030         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7031         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
7032         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7033         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7034         add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
7035     fi
7036     PathFormat "$JAVA_HOME"
7037     JAVA_HOME="$formatted_path"
7040 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7041     "$_os" != Darwin
7042 then
7043     AC_MSG_CHECKING([for JAWT lib])
7044     if test "$_os" = WINNT; then
7045         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7046         JAWTLIB=jawt.lib
7047     else
7048         case "$host_cpu" in
7049         arm*)
7050             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7051             JAVA_ARCH=$my_java_arch
7052             ;;
7053         i*86)
7054             my_java_arch=i386
7055             ;;
7056         m68k)
7057             my_java_arch=m68k
7058             ;;
7059         powerpc)
7060             my_java_arch=ppc
7061             ;;
7062         powerpc64)
7063             my_java_arch=ppc64
7064             ;;
7065         powerpc64le)
7066             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7067             JAVA_ARCH=$my_java_arch
7068             ;;
7069         sparc64)
7070             my_java_arch=sparcv9
7071             ;;
7072         x86_64)
7073             my_java_arch=amd64
7074             ;;
7075         *)
7076             my_java_arch=$host_cpu
7077             ;;
7078         esac
7079         # This is where JDK9 puts the library
7080         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7081             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7082         else
7083             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7084         fi
7085         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7086     fi
7087     AC_MSG_RESULT([$JAWTLIB])
7089 AC_SUBST(JAWTLIB)
7091 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7092     case "$host_os" in
7094     aix*)
7095         JAVAINC="-I$JAVA_HOME/include"
7096         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7097         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7098         ;;
7100     cygwin*)
7101         JAVAINC="-I$JAVA_HOME/include/win32"
7102         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7103         ;;
7105     darwin*)
7106         if test -d "$JAVA_HOME/include/darwin"; then
7107             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7108         else
7109             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7110         fi
7111         ;;
7113     dragonfly*)
7114         JAVAINC="-I$JAVA_HOME/include"
7115         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7116         ;;
7118     freebsd*)
7119         JAVAINC="-I$JAVA_HOME/include"
7120         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7121         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7122         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7123         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7124         ;;
7126     k*bsd*-gnu*)
7127         JAVAINC="-I$JAVA_HOME/include"
7128         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7129         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7130         ;;
7132     linux-gnu*)
7133         JAVAINC="-I$JAVA_HOME/include"
7134         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7135         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7136         ;;
7138     *netbsd*)
7139         JAVAINC="-I$JAVA_HOME/include"
7140         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7141         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7142        ;;
7144     openbsd*)
7145         JAVAINC="-I$JAVA_HOME/include"
7146         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7147         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7148         ;;
7150     solaris*)
7151         JAVAINC="-I$JAVA_HOME/include"
7152         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7153         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7154         ;;
7155     esac
7157 SOLARINC="$SOLARINC $JAVAINC"
7159 AC_SUBST(JAVACOMPILER)
7160 AC_SUBST(JAVADOC)
7161 AC_SUBST(JAVAINTERPRETER)
7162 AC_SUBST(JAVAIFLAGS)
7163 AC_SUBST(JAVAFLAGS)
7164 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7165 AC_SUBST(JAVA_HOME)
7166 AC_SUBST(JAVA_SOURCE_VER)
7167 AC_SUBST(JAVA_TARGET_VER)
7168 AC_SUBST(JDK)
7171 dnl ===================================================================
7172 dnl Export file validation
7173 dnl ===================================================================
7174 AC_MSG_CHECKING([whether to enable export file validation])
7175 if test "$with_export_validation" != "no"; then
7176     if test -z "$ENABLE_JAVA"; then
7177         if test "$with_export_validation" = "yes"; then
7178             AC_MSG_ERROR([requested, but Java is disabled])
7179         else
7180             AC_MSG_RESULT([no, as Java is disabled])
7181         fi
7182     elif test "$_jdk_ver" -lt 10800; then
7183         if test "$with_export_validation" = "yes"; then
7184             AC_MSG_ERROR([requested, but Java is too old, need Java 8])
7185         else
7186             AC_MSG_RESULT([no, as Java is too old, need Java 8])
7187         fi
7188     else
7189         AC_MSG_RESULT([yes])
7190         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7192         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7193         if test -z "$ODFVALIDATOR"; then
7194             # remember to download the ODF toolkit with validator later
7195             AC_MSG_NOTICE([no odfvalidator found, will download it])
7196             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7197             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7199             # and fetch name of odfvalidator jar name from download.lst
7200             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7201             AC_SUBST(ODFVALIDATOR_JAR)
7203             if test -z "$ODFVALIDATOR_JAR"; then
7204                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7205             fi
7206         fi
7207         if test "$build_os" = "cygwin"; then
7208             # In case of Cygwin it will be executed from Windows,
7209             # so we need to run bash and absolute path to validator
7210             # so instead of "odfvalidator" it will be
7211             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7212             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7213         else
7214             ODFVALIDATOR="sh $ODFVALIDATOR"
7215         fi
7216         AC_SUBST(ODFVALIDATOR)
7219         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7220         if test -z "$OFFICEOTRON"; then
7221             # remember to download the officeotron with validator later
7222             AC_MSG_NOTICE([no officeotron found, will download it])
7223             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7224             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7226             # and fetch name of officeotron jar name from download.lst
7227             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7228             AC_SUBST(OFFICEOTRON_JAR)
7230             if test -z "$OFFICEOTRON_JAR"; then
7231                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7232             fi
7233         else
7234             # check version of existing officeotron
7235             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7236             if test 0"$OFFICEOTRON_VER" -lt 704; then
7237                 AC_MSG_ERROR([officeotron too old])
7238             fi
7239         fi
7240         if test "$build_os" = "cygwin"; then
7241             # In case of Cygwin it will be executed from Windows,
7242             # so we need to run bash and absolute path to validator
7243             # so instead of "odfvalidator" it will be
7244             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7245             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7246         else
7247             OFFICEOTRON="sh $OFFICEOTRON"
7248         fi
7249     fi
7250     AC_SUBST(OFFICEOTRON)
7251 else
7252     AC_MSG_RESULT([no])
7255 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7256 if test "$with_bffvalidator" != "no"; then
7257     AC_DEFINE(HAVE_BFFVALIDATOR)
7259     if test "$with_export_validation" = "no"; then
7260         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7261     fi
7263     if test "$with_bffvalidator" = "yes"; then
7264         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7265     else
7266         BFFVALIDATOR="$with_bffvalidator"
7267     fi
7269     if test "$build_os" = "cygwin"; then
7270         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7271             AC_MSG_RESULT($BFFVALIDATOR)
7272         else
7273             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7274         fi
7275     elif test -n "$BFFVALIDATOR"; then
7276         # We are not in Cygwin but need to run Windows binary with wine
7277         AC_PATH_PROGS(WINE, wine)
7279         # so swap in a shell wrapper that converts paths transparently
7280         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7281         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7282         AC_SUBST(BFFVALIDATOR_EXE)
7283         AC_MSG_RESULT($BFFVALIDATOR)
7284     else
7285         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7286     fi
7287     AC_SUBST(BFFVALIDATOR)
7288 else
7289     AC_MSG_RESULT([no])
7292 dnl ===================================================================
7293 dnl Check for C preprocessor to use
7294 dnl ===================================================================
7295 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7296 if test -n "$with_idlc_cpp"; then
7297     AC_MSG_RESULT([$with_idlc_cpp])
7298     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7299 else
7300     AC_MSG_RESULT([ucpp])
7301     AC_MSG_CHECKING([which ucpp tp use])
7302     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7303         AC_MSG_RESULT([external])
7304         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7305     else
7306         AC_MSG_RESULT([internal])
7307         BUILD_TYPE="$BUILD_TYPE UCPP"
7308     fi
7310 AC_SUBST(SYSTEM_UCPP)
7312 dnl ===================================================================
7313 dnl Check for epm (not needed for Windows)
7314 dnl ===================================================================
7315 AC_MSG_CHECKING([whether to enable EPM for packing])
7316 if test "$enable_epm" = "yes"; then
7317     AC_MSG_RESULT([yes])
7318     if test "$_os" != "WINNT"; then
7319         if test $_os = Darwin; then
7320             EPM=internal
7321         elif test -n "$with_epm"; then
7322             EPM=$with_epm
7323         else
7324             AC_PATH_PROG(EPM, epm, no)
7325         fi
7326         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7327             AC_MSG_NOTICE([EPM will be built.])
7328             BUILD_TYPE="$BUILD_TYPE EPM"
7329             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7330         else
7331             # Gentoo has some epm which is something different...
7332             AC_MSG_CHECKING([whether the found epm is the right epm])
7333             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7334                 AC_MSG_RESULT([yes])
7335             else
7336                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7337             fi
7338             AC_MSG_CHECKING([epm version])
7339             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7340             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7341                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7342                 AC_MSG_RESULT([OK, >= 3.7])
7343             else
7344                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7345                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7346             fi
7347         fi
7348     fi
7350     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7351         AC_MSG_CHECKING([for rpm])
7352         for a in "$RPM" rpmbuild rpm; do
7353             $a --usage >/dev/null 2> /dev/null
7354             if test $? -eq 0; then
7355                 RPM=$a
7356                 break
7357             else
7358                 $a --version >/dev/null 2> /dev/null
7359                 if test $? -eq 0; then
7360                     RPM=$a
7361                     break
7362                 fi
7363             fi
7364         done
7365         if test -z "$RPM"; then
7366             AC_MSG_ERROR([not found])
7367         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7368             RPM_PATH=`which $RPM`
7369             AC_MSG_RESULT([$RPM_PATH])
7370             SCPDEFS="$SCPDEFS -DWITH_RPM"
7371         else
7372             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7373         fi
7374     fi
7375     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7376         AC_PATH_PROG(DPKG, dpkg, no)
7377         if test "$DPKG" = "no"; then
7378             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7379         fi
7380     fi
7381     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7382        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7383         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7384             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7385                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7386                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7387                     AC_MSG_RESULT([yes])
7388                 else
7389                     AC_MSG_RESULT([no])
7390                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7391                         _pt="rpm"
7392                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7393                         add_warning "the rpms will need to be installed with --nodeps"
7394                     else
7395                         _pt="pkg"
7396                     fi
7397                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7398                     add_warning "the ${_pt}s will not be relocatable"
7399                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7400                                  relocation will work, you need to patch your epm with the
7401                                  patch in epm/epm-3.7.patch or build with
7402                                  --with-epm=internal which will build a suitable epm])
7403                 fi
7404             fi
7405         fi
7406     fi
7407     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7408         AC_PATH_PROG(PKGMK, pkgmk, no)
7409         if test "$PKGMK" = "no"; then
7410             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7411         fi
7412     fi
7413     AC_SUBST(RPM)
7414     AC_SUBST(DPKG)
7415     AC_SUBST(PKGMK)
7416 else
7417     for i in $PKGFORMAT; do
7418         case "$i" in
7419         aix | bsd | deb | pkg | rpm | native | portable)
7420             AC_MSG_ERROR(
7421                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7422             ;;
7423         esac
7424     done
7425     AC_MSG_RESULT([no])
7426     EPM=NO
7428 AC_SUBST(EPM)
7430 ENABLE_LWP=
7431 if test "$enable_lotuswordpro" = "yes"; then
7432     ENABLE_LWP="TRUE"
7434 AC_SUBST(ENABLE_LWP)
7436 dnl ===================================================================
7437 dnl Check for building ODK
7438 dnl ===================================================================
7439 if test "$enable_odk" = no; then
7440     unset DOXYGEN
7441 else
7442     if test "$with_doxygen" = no; then
7443         AC_MSG_CHECKING([for doxygen])
7444         unset DOXYGEN
7445         AC_MSG_RESULT([no])
7446     else
7447         if test "$with_doxygen" = yes; then
7448             AC_PATH_PROG([DOXYGEN], [doxygen])
7449             if test -z "$DOXYGEN"; then
7450                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7451             fi
7452             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
7453                 if ! dot -V 2>/dev/null; then
7454                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
7455                 fi
7456             fi
7457         else
7458             AC_MSG_CHECKING([for doxygen])
7459             DOXYGEN=$with_doxygen
7460             AC_MSG_RESULT([$DOXYGEN])
7461         fi
7462         if test -n "$DOXYGEN"; then
7463             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7464             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7465             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7466                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7467             fi
7468         fi
7469     fi
7471 AC_SUBST([DOXYGEN])
7473 AC_MSG_CHECKING([whether to build the ODK])
7474 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7475     AC_MSG_RESULT([yes])
7477     if test "$with_java" != "no"; then
7478         AC_MSG_CHECKING([whether to build unowinreg.dll])
7479         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7480             # build on Win by default
7481             enable_build_unowinreg=yes
7482         fi
7483         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7484             AC_MSG_RESULT([no])
7485             BUILD_UNOWINREG=
7486         else
7487             AC_MSG_RESULT([yes])
7488             BUILD_UNOWINREG=TRUE
7489         fi
7490         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7491             if test -z "$with_mingw_cross_compiler"; then
7492                 dnl Guess...
7493                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7494             elif test -x "$with_mingw_cross_compiler"; then
7495                  MINGWCXX="$with_mingw_cross_compiler"
7496             else
7497                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7498             fi
7500             if test "$MINGWCXX" = "false"; then
7501                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7502             fi
7504             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7505             if test -x "$mingwstrip_test"; then
7506                 MINGWSTRIP="$mingwstrip_test"
7507             else
7508                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7509             fi
7511             if test "$MINGWSTRIP" = "false"; then
7512                 AC_MSG_ERROR(MinGW32 binutils not found.)
7513             fi
7514         fi
7515     fi
7516     BUILD_TYPE="$BUILD_TYPE ODK"
7517 else
7518     AC_MSG_RESULT([no])
7519     BUILD_UNOWINREG=
7521 AC_SUBST(BUILD_UNOWINREG)
7522 AC_SUBST(MINGWCXX)
7523 AC_SUBST(MINGWSTRIP)
7525 dnl ===================================================================
7526 dnl Check for system zlib
7527 dnl ===================================================================
7528 if test "$with_system_zlib" = "auto"; then
7529     case "$_os" in
7530     WINNT)
7531         with_system_zlib="$with_system_libs"
7532         ;;
7533     *)
7534         if test "$enable_fuzzers" != "yes"; then
7535             with_system_zlib=yes
7536         else
7537             with_system_zlib=no
7538         fi
7539         ;;
7540     esac
7543 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7544 dnl and has no pkg-config for it at least on some tinderboxes,
7545 dnl so leaving that out for now
7546 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7547 AC_MSG_CHECKING([which zlib to use])
7548 if test "$with_system_zlib" = "yes"; then
7549     AC_MSG_RESULT([external])
7550     SYSTEM_ZLIB=TRUE
7551     AC_CHECK_HEADER(zlib.h, [],
7552         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7553     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7554         [AC_MSG_ERROR(zlib not found or functional)], [])
7555 else
7556     AC_MSG_RESULT([internal])
7557     SYSTEM_ZLIB=
7558     BUILD_TYPE="$BUILD_TYPE ZLIB"
7559     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7560     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7562 AC_SUBST(ZLIB_CFLAGS)
7563 AC_SUBST(ZLIB_LIBS)
7564 AC_SUBST(SYSTEM_ZLIB)
7566 dnl ===================================================================
7567 dnl Check for system jpeg
7568 dnl ===================================================================
7569 AC_MSG_CHECKING([which libjpeg to use])
7570 if test "$with_system_jpeg" = "yes"; then
7571     AC_MSG_RESULT([external])
7572     SYSTEM_LIBJPEG=TRUE
7573     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7574         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7575     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7576         [AC_MSG_ERROR(jpeg library not found or fuctional)], [])
7577 else
7578     SYSTEM_LIBJPEG=
7579     AC_MSG_RESULT([internal, libjpeg-turbo])
7580     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
7581     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
7582     if test "$COM" = "MSC"; then
7583         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
7584     else
7585         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
7586     fi
7588     case "$host_cpu" in
7589     x86_64 | amd64 | i*86 | x86 | ia32)
7590         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7591         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7592             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7593                 NASM="$LODE_HOME/opt/bin/nasm"
7594             elif test -x "/opt/lo/bin/nasm"; then
7595                 NASM="/opt/lo/bin/nasm"
7596             fi
7597         fi
7599         if test -n "$NASM"; then
7600             AC_MSG_CHECKING([for object file format of host system])
7601             case "$host_os" in
7602               cygwin* | mingw* | pw32* | interix*)
7603                 case "$host_cpu" in
7604                   x86_64)
7605                     objfmt='Win64-COFF'
7606                     ;;
7607                   *)
7608                     objfmt='Win32-COFF'
7609                     ;;
7610                 esac
7611               ;;
7612               msdosdjgpp* | go32*)
7613                 objfmt='COFF'
7614               ;;
7615               os2-emx*)                 # not tested
7616                 objfmt='MSOMF'          # obj
7617               ;;
7618               linux*coff* | linux*oldld*)
7619                 objfmt='COFF'           # ???
7620               ;;
7621               linux*aout*)
7622                 objfmt='a.out'
7623               ;;
7624               linux*)
7625                 case "$host_cpu" in
7626                   x86_64)
7627                     objfmt='ELF64'
7628                     ;;
7629                   *)
7630                     objfmt='ELF'
7631                     ;;
7632                 esac
7633               ;;
7634               kfreebsd* | freebsd* | netbsd* | openbsd*)
7635                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
7636                   objfmt='BSD-a.out'
7637                 else
7638                   case "$host_cpu" in
7639                     x86_64 | amd64)
7640                       objfmt='ELF64'
7641                       ;;
7642                     *)
7643                       objfmt='ELF'
7644                       ;;
7645                   esac
7646                 fi
7647               ;;
7648               solaris* | sunos* | sysv* | sco*)
7649                 case "$host_cpu" in
7650                   x86_64)
7651                     objfmt='ELF64'
7652                     ;;
7653                   *)
7654                     objfmt='ELF'
7655                     ;;
7656                 esac
7657               ;;
7658               darwin* | rhapsody* | nextstep* | openstep* | macos*)
7659                 case "$host_cpu" in
7660                   x86_64)
7661                     objfmt='Mach-O64'
7662                     ;;
7663                   *)
7664                     objfmt='Mach-O'
7665                     ;;
7666                 esac
7667               ;;
7668               *)
7669                 objfmt='ELF ?'
7670               ;;
7671             esac
7673             AC_MSG_RESULT([$objfmt])
7674             if test "$objfmt" = 'ELF ?'; then
7675               objfmt='ELF'
7676               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
7677             fi
7679             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
7680             case "$objfmt" in
7681               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
7682               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
7683               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
7684               COFF)       NAFLAGS='-fcoff -DCOFF';;
7685               a.out)      NAFLAGS='-faout -DAOUT';;
7686               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
7687               ELF)        NAFLAGS='-felf -DELF';;
7688               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
7689               RDF)        NAFLAGS='-frdf -DRDF';;
7690               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
7691               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
7692             esac
7693             AC_MSG_RESULT([$NAFLAGS])
7695             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
7696             cat > conftest.asm << EOF
7697             [%line __oline__ "configure"
7698                     section .text
7699                     global  _main,main
7700             _main:
7701             main:   xor     eax,eax
7702                     ret
7703             ]
7705             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
7706             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
7707               AC_MSG_RESULT(yes)
7708             else
7709               echo "configure: failed program was:" >&AC_FD_CC
7710               cat conftest.asm >&AC_FD_CC
7711               rm -rf conftest*
7712               AC_MSG_RESULT(no)
7713               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
7714               NASM=""
7715             fi
7717         fi
7719         if test -z "$NASM"; then
7720 cat << _EOS
7721 ****************************************************************************
7722 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
7723 To get one please:
7725 _EOS
7726             if test "$build_os" = "cygwin"; then
7727 cat << _EOS
7728 install a pre-compiled binary for Win32
7730 mkdir -p /opt/lo/bin
7731 cd /opt/lo/bin
7732 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7733 chmod +x nasm
7735 or get and install one from http://www.nasm.us/
7737 Then re-run autogen.sh
7739 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7740 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7742 _EOS
7743             else
7744 cat << _EOS
7745 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
7747 _EOS
7748             fi
7749             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
7750             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
7751         fi
7752       ;;
7753     esac
7756 AC_SUBST(NASM)
7757 AC_SUBST(LIBJPEG_CFLAGS)
7758 AC_SUBST(LIBJPEG_LIBS)
7759 AC_SUBST(SYSTEM_LIBJPEG)
7761 dnl ===================================================================
7762 dnl Check for system clucene
7763 dnl ===================================================================
7764 dnl we should rather be using
7765 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7766 dnl but the contribs-lib check seems tricky
7767 AC_MSG_CHECKING([which clucene to use])
7768 if test "$with_system_clucene" = "yes"; then
7769     AC_MSG_RESULT([external])
7770     SYSTEM_CLUCENE=TRUE
7771     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7772     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7773     FilterLibs "${CLUCENE_LIBS}"
7774     CLUCENE_LIBS="${filteredlibs}"
7775     AC_LANG_PUSH([C++])
7776     save_CXXFLAGS=$CXXFLAGS
7777     save_CPPFLAGS=$CPPFLAGS
7778     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7779     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7780     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7781     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7782     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7783                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7784     CXXFLAGS=$save_CXXFLAGS
7785     CPPFLAGS=$save_CPPFLAGS
7786     AC_LANG_POP([C++])
7788     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7789 else
7790     AC_MSG_RESULT([internal])
7791     SYSTEM_CLUCENE=
7792     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7794 AC_SUBST(SYSTEM_CLUCENE)
7795 AC_SUBST(CLUCENE_CFLAGS)
7796 AC_SUBST(CLUCENE_LIBS)
7798 dnl ===================================================================
7799 dnl Check for system expat
7800 dnl ===================================================================
7801 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
7803 dnl ===================================================================
7804 dnl Check for system xmlsec
7805 dnl ===================================================================
7806 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24])
7808 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7809 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7810     ENABLE_EOT="TRUE"
7811     AC_DEFINE([ENABLE_EOT])
7812     AC_MSG_RESULT([yes])
7814     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7815 else
7816     ENABLE_EOT=
7817     AC_MSG_RESULT([no])
7819 AC_SUBST([ENABLE_EOT])
7821 dnl ===================================================================
7822 dnl Check for DLP libs
7823 dnl ===================================================================
7824 AS_IF([test "$COM" = "MSC"],
7825       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7826       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7828 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7830 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7832 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
7834 AS_IF([test "$COM" = "MSC"],
7835       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7836       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7838 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7840 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7842 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7843 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.8])
7845 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7847 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7849 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7851 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
7852 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.13])
7854 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
7855 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.7])
7857 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7859 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
7860 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
7862 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7864 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7866 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
7868 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
7870 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
7871 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.4])
7873 dnl ===================================================================
7874 dnl Check for system lcms2
7875 dnl ===================================================================
7876 if test "$with_system_lcms2" != "yes"; then
7877     SYSTEM_LCMS2=
7879 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7880 if test "$GCC" = "yes"; then
7881     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7883 if test "$COM" = "MSC"; then # override the above
7884     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7887 dnl ===================================================================
7888 dnl Check for system cppunit
7889 dnl ===================================================================
7890 if test "$cross_compiling" != "yes"; then
7891     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
7894 dnl ===================================================================
7895 dnl Check whether freetype is available
7896 dnl ===================================================================
7897 if test  "$test_freetype" = "yes"; then
7898     AC_MSG_CHECKING([whether freetype is available])
7899     # FreeType has 3 different kinds of versions
7900     # * release, like 2.4.10
7901     # * libtool, like 13.0.7 (this what pkg-config returns)
7902     # * soname
7903     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7904     #
7905     # 9.9.3 is 2.2.0
7906     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7907     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7908     FilterLibs "${FREETYPE_LIBS}"
7909     FREETYPE_LIBS="${filteredlibs}"
7910     SYSTEM_FREETYPE=TRUE
7911 else
7912     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
7913     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
7915 AC_SUBST(FREETYPE_CFLAGS)
7916 AC_SUBST(FREETYPE_LIBS)
7917 AC_SUBST([SYSTEM_FREETYPE])
7919 # ===================================================================
7920 # Check for system libxslt
7921 # to prevent incompatibilities between internal libxml2 and external libxslt,
7922 # or vice versa, use with_system_libxml here
7923 # ===================================================================
7924 if test "$with_system_libxml" = "auto"; then
7925     case "$_os" in
7926     WINNT|iOS|Android)
7927         with_system_libxml="$with_system_libs"
7928         ;;
7929     *)
7930         if test "$enable_fuzzers" != "yes"; then
7931             with_system_libxml=yes
7932         else
7933             with_system_libxml=no
7934         fi
7935         ;;
7936     esac
7939 AC_MSG_CHECKING([which libxslt to use])
7940 if test "$with_system_libxml" = "yes"; then
7941     AC_MSG_RESULT([external])
7942     SYSTEM_LIBXSLT=TRUE
7943     if test "$_os" = "Darwin"; then
7944         dnl make sure to use SDK path
7945         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7946         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7947         dnl omit -L/usr/lib
7948         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7949         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7950     else
7951         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7952         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7953         FilterLibs "${LIBXSLT_LIBS}"
7954         LIBXSLT_LIBS="${filteredlibs}"
7955         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7956         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7957         FilterLibs "${LIBEXSLT_LIBS}"
7958         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
7959     fi
7961     dnl Check for xsltproc
7962     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7963     if test "$XSLTPROC" = "no"; then
7964         AC_MSG_ERROR([xsltproc is required])
7965     fi
7966 else
7967     AC_MSG_RESULT([internal])
7968     SYSTEM_LIBXSLT=
7969     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
7971     if test "$cross_compiling" = "yes"; then
7972         AC_PATH_PROG(XSLTPROC, xsltproc, no)
7973         if test "$XSLTPROC" = "no"; then
7974             AC_MSG_ERROR([xsltproc is required])
7975         fi
7976     fi
7978 AC_SUBST(SYSTEM_LIBXSLT)
7979 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
7980     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
7982 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
7984 AC_SUBST(LIBEXSLT_CFLAGS)
7985 AC_SUBST(LIBEXSLT_LIBS)
7986 AC_SUBST(LIBXSLT_CFLAGS)
7987 AC_SUBST(LIBXSLT_LIBS)
7988 AC_SUBST(XSLTPROC)
7990 # ===================================================================
7991 # Check for system libxml
7992 # ===================================================================
7993 AC_MSG_CHECKING([which libxml to use])
7994 if test "$with_system_libxml" = "yes"; then
7995     AC_MSG_RESULT([external])
7996     SYSTEM_LIBXML=TRUE
7997     if test "$_os" = "Darwin"; then
7998         dnl make sure to use SDK path
7999         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8000         dnl omit -L/usr/lib
8001         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8002     elif test $_os = iOS; then
8003         dnl make sure to use SDK path
8004         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8005         LIBXML_CFLAGS="-I$usr/include/libxml2"
8006         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8007     else
8008         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8009         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8010         FilterLibs "${LIBXML_LIBS}"
8011         LIBXML_LIBS="${filteredlibs}"
8012     fi
8014     dnl Check for xmllint
8015     AC_PATH_PROG(XMLLINT, xmllint, no)
8016     if test "$XMLLINT" = "no"; then
8017         AC_MSG_ERROR([xmllint is required])
8018     fi
8019 else
8020     AC_MSG_RESULT([internal])
8021     SYSTEM_LIBXML=
8022     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8023     if test "$COM" = "MSC"; then
8024         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8025     fi
8026     if test "$COM" = "MSC"; then
8027         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8028     else
8029         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8030     fi
8031     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8033 AC_SUBST(SYSTEM_LIBXML)
8034 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8035     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8037 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8038 AC_SUBST(LIBXML_CFLAGS)
8039 AC_SUBST(LIBXML_LIBS)
8040 AC_SUBST(XMLLINT)
8042 # =====================================================================
8043 # Checking for a Python interpreter with version >= 2.6.
8044 # Build and runtime requires Python 3 compatible version (>= 2.6).
8045 # Optionally user can pass an option to configure, i. e.
8046 # ./configure PYTHON=/usr/bin/python
8047 # =====================================================================
8048 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8049     # This allows a lack of system python with no error, we use internal one in that case.
8050     AM_PATH_PYTHON([2.6],, [:])
8051     # Clean PYTHON_VERSION checked below if cross-compiling
8052     PYTHON_VERSION=""
8053     if test "$PYTHON" != ":"; then
8054         PYTHON_FOR_BUILD=$PYTHON
8055     fi
8057 AC_SUBST(PYTHON_FOR_BUILD)
8059 # Checks for Python to use for Pyuno
8060 AC_MSG_CHECKING([which Python to use for Pyuno])
8061 case "$enable_python" in
8062 no|disable)
8063     if test -z $PYTHON_FOR_BUILD; then
8064         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8065         # requirement from the choice whether to include Python stuff in the installer, but why
8066         # bother?
8067         AC_MSG_ERROR([Python is required at build time.])
8068     fi
8069     enable_python=no
8070     AC_MSG_RESULT([none])
8071     ;;
8072 ""|yes|auto)
8073     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8074         AC_MSG_RESULT([no, overridden by --disable-scripting])
8075         enable_python=no
8076     elif test $build_os = cygwin; then
8077         dnl When building on Windows we don't attempt to use any installed
8078         dnl "system"  Python.
8079         AC_MSG_RESULT([fully internal])
8080         enable_python=internal
8081     elif test "$cross_compiling" = yes; then
8082         AC_MSG_RESULT([system])
8083         enable_python=system
8084     else
8085         # Unset variables set by the above AM_PATH_PYTHON so that
8086         # we actually do check anew.
8087         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
8088         AM_PATH_PYTHON([3.3],, [:])
8089         if test "$PYTHON" = ":"; then
8090             if test -z "$PYTHON_FOR_BUILD"; then
8091                 AC_MSG_RESULT([fully internal])
8092             else
8093                 AC_MSG_RESULT([internal])
8094             fi
8095             enable_python=internal
8096         else
8097             AC_MSG_RESULT([system])
8098             enable_python=system
8099         fi
8100     fi
8101     ;;
8102 internal)
8103     AC_MSG_RESULT([internal])
8104     ;;
8105 fully-internal)
8106     AC_MSG_RESULT([fully internal])
8107     enable_python=internal
8108     ;;
8109 system)
8110     AC_MSG_RESULT([system])
8111     ;;
8113     AC_MSG_ERROR([Incorrect --enable-python option])
8114     ;;
8115 esac
8117 if test $enable_python != no; then
8118     BUILD_TYPE="$BUILD_TYPE PYUNO"
8121 if test $enable_python = system; then
8122     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8123         python_version=2.7
8124         PYTHON=python$python_version
8125         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
8126             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
8127             PYTHON_LIBS="-framework Python"
8128         else
8129             PYTHON_CFLAGS="`$PYTHON-config --includes`"
8130             PYTHON_LIBS="`$PYTHON-config --libs`"
8131         fi
8132     fi
8133     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8134         # Fallback: Accept these in the environment, or as set above
8135         # for MacOSX.
8136         :
8137     elif test "$cross_compiling" != yes; then
8138         # Unset variables set by the above AM_PATH_PYTHON so that
8139         # we actually do check anew.
8140         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
8141         # This causes an error if no python command is found
8142         AM_PATH_PYTHON([3.3])
8143         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8144         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8145         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8146         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8147         if test -z "$PKG_CONFIG"; then
8148             PYTHON_CFLAGS="-I$python_include"
8149             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8150         elif $PKG_CONFIG --exists python-$python_version; then
8151             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8152             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8153         else
8154             PYTHON_CFLAGS="-I$python_include"
8155             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8156         fi
8157         FilterLibs "${PYTHON_LIBS}"
8158         PYTHON_LIBS="${filteredlibs}"
8159     else
8160         dnl How to find out the cross-compilation Python installation path?
8161         AC_MSG_CHECKING([for python version])
8162         AS_IF([test -n "$PYTHON_VERSION"],
8163               [AC_MSG_RESULT([$PYTHON_VERSION])],
8164               [AC_MSG_RESULT([not found])
8165                AC_MSG_ERROR([no usable python found])])
8166         test -n "$PYTHON_CFLAGS" && break
8167     fi
8169     dnl Check if the headers really work
8170     save_CPPFLAGS="$CPPFLAGS"
8171     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8172     AC_CHECK_HEADER(Python.h)
8173     CPPFLAGS="$save_CPPFLAGS"
8175     # let the PYTHON_FOR_BUILD match the same python installation that
8176     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8177     # better for PythonTests.
8178     PYTHON_FOR_BUILD=$PYTHON
8181 if test "$with_lxml" != no; then
8182     if test -z "$PYTHON_FOR_BUILD"; then
8183         case $build_os in
8184             cygwin)
8185                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8186                 ;;
8187             *)
8188                 if test "$cross_compiling" != yes ; then
8189                     BUILD_TYPE="$BUILD_TYPE LXML"
8190                 fi
8191                 ;;
8192         esac
8193     else
8194         AC_MSG_CHECKING([for python lxml])
8195         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8196             AC_MSG_RESULT([yes])
8197         else
8198             case $build_os in
8199                 cygwin)
8200                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8201                     ;;
8202                 *)
8203                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8204                         BUILD_TYPE="$BUILD_TYPE LXML"
8205                         AC_MSG_RESULT([no, using internal lxml])
8206                     else
8207                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8208                     fi
8209                     ;;
8210             esac
8211         fi
8212     fi
8215 dnl By now enable_python should be "system", "internal" or "no"
8216 case $enable_python in
8217 system)
8218     SYSTEM_PYTHON=TRUE
8220     if test "x$ac_cv_header_Python_h" != "xyes"; then
8221        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8222     fi
8224     AC_LANG_PUSH(C)
8225     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8226     AC_MSG_CHECKING([for correct python library version])
8227        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8228 #include <Python.h>
8230 int main(int argc, char **argv) {
8231    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
8232        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8233    else return 1;
8235        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3, or Python >= 2.6 when building with Python 2])],[AC_MSG_RESULT([skipped; cross-compiling])])
8236     CFLAGS=$save_CFLAGS
8237     AC_LANG_POP(C)
8239     dnl FIXME Check if the Python library can be linked with, too?
8240     ;;
8242 internal)
8243     SYSTEM_PYTHON=
8244     PYTHON_VERSION_MAJOR=3
8245     PYTHON_VERSION_MINOR=5
8246     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.4
8247     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8248         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8249     fi
8250     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8251     BUILD_TYPE="$BUILD_TYPE PYTHON"
8252     # Embedded Python dies without Home set
8253     if test "$HOME" = ""; then
8254         export HOME=""
8255     fi
8256     # bz2 tarball and bzip2 is not standard
8257     if test -z "$BZIP2"; then
8258         AC_PATH_PROG( BZIP2, bzip2)
8259         if test -z "$BZIP2"; then
8260             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
8261         fi
8262     fi
8263     ;;
8265     DISABLE_PYTHON=TRUE
8266     SYSTEM_PYTHON=
8267     ;;
8269     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8270     ;;
8271 esac
8273 AC_SUBST(DISABLE_PYTHON)
8274 AC_SUBST(SYSTEM_PYTHON)
8275 AC_SUBST(PYTHON_CFLAGS)
8276 AC_SUBST(PYTHON_LIBS)
8277 AC_SUBST(PYTHON_VERSION)
8278 AC_SUBST(PYTHON_VERSION_MAJOR)
8279 AC_SUBST(PYTHON_VERSION_MINOR)
8281 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8282 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8283     AC_MSG_RESULT([yes])
8284     ENABLE_MARIADBC=TRUE
8285     MARIADBC_MAJOR=1
8286     MARIADBC_MINOR=0
8287     MARIADBC_MICRO=2
8288     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8289 else
8290     AC_MSG_RESULT([no])
8291     ENABLE_MARIADBC=
8293 AC_SUBST(ENABLE_MARIADBC)
8294 AC_SUBST(MARIADBC_MAJOR)
8295 AC_SUBST(MARIADBC_MINOR)
8296 AC_SUBST(MARIADBC_MICRO)
8298 if test "$ENABLE_MARIADBC" = "TRUE"; then
8300     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8302     dnl ===================================================================
8303     dnl Check for system MariaDB
8304     dnl ===================================================================
8305     AC_MSG_CHECKING([which MariaDB to use])
8306     if test "$with_system_mariadb" = "yes"; then
8307         AC_MSG_RESULT([external])
8308         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8309         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8310         if test -z "$MARIADBCONFIG"; then
8311             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8312             if test -z "$MARIADBCONFIG"; then
8313                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8314                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8315             fi
8316         fi
8317         AC_MSG_CHECKING([MariaDB version])
8318         MARIADB_VERSION=`$MARIADBCONFIG --version`
8319         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8320         if test "$MARIADB_MAJOR" -ge "5"; then
8321             AC_MSG_RESULT([OK])
8322         else
8323             AC_MSG_ERROR([too old, use 5.0.x or later])
8324         fi
8325         AC_MSG_CHECKING([for MariaDB Client library])
8326         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8327         if test "$COM_IS_CLANG" = TRUE; then
8328             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8329         fi
8330         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8331         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8332         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8333         dnl linux32:
8334         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8335             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8336             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8337                 | sed -e 's|/lib64/|/lib/|')
8338         fi
8339         FilterLibs "${MARIADB_LIBS}"
8340         MARIADB_LIBS="${filteredlibs}"
8341         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8342         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8343         if test "$enable_bundle_mariadb" = "yes"; then
8344             AC_MSG_RESULT([yes])
8345             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8346             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8348 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8350 /g' | grep -E '(mysqlclient|mariadb)')
8351             if test "$_os" = "Darwin"; then
8352                 LIBMARIADB=${LIBMARIADB}.dylib
8353             elif test "$_os" = "WINNT"; then
8354                 LIBMARIADB=${LIBMARIADB}.dll
8355             else
8356                 LIBMARIADB=${LIBMARIADB}.so
8357             fi
8358             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8359             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8360             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8361                 AC_MSG_RESULT([found.])
8362                 PathFormat "$LIBMARIADB_PATH"
8363                 LIBMARIADB_PATH="$formatted_path"
8364             else
8365                 AC_MSG_ERROR([not found.])
8366             fi
8367         else
8368             AC_MSG_RESULT([no])
8369             BUNDLE_MARIADB_CONNECTOR_C=
8370         fi
8371     else
8372         AC_MSG_RESULT([internal])
8373         SYSTEM_MARIADB_CONNECTOR_C=
8374         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8375         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8376         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8377     fi
8379     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8380     AC_SUBST(MARIADB_CFLAGS)
8381     AC_SUBST(MARIADB_LIBS)
8382     AC_SUBST(LIBMARIADB)
8383     AC_SUBST(LIBMARIADB_PATH)
8384     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8386     AC_LANG_PUSH([C++])
8387     dnl ===================================================================
8388     dnl Check for system MySQL C++ Connector
8389     dnl ===================================================================
8390     # FIXME!
8391     # who thought this too-generic cppconn dir was a good idea?
8392     AC_MSG_CHECKING([MySQL Connector/C++])
8393     if test "$with_system_mysql_cppconn" = "yes"; then
8394         AC_MSG_RESULT([external])
8395         SYSTEM_MYSQL_CONNECTOR_CPP=TRUE
8396         AC_LANG_PUSH([C++])
8397         AC_CHECK_HEADER(mysql_driver.h, [],
8398                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8399         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8400                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8401         save_LIBS=$LIBS
8402         LIBS="$LIBS -lmysqlcppconn"
8403         AC_MSG_CHECKING([version])
8404         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8405 #include <mysql_driver.h>
8407 int main(int argc, char **argv) {
8408     sql::Driver *driver;
8409     driver = get_driver_instance();
8410     if (driver->getMajorVersion() > 1 || \
8411        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8412        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8413         return 0;
8414       else
8415         return 1;
8417       ]])],[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])])
8419         AC_LANG_POP([C++])
8420         LIBS=$save_LIBS
8421     else
8422         AC_MSG_RESULT([internal])
8423         BUILD_TYPE="$BUILD_TYPE MYSQL_CONNECTOR_CPP"
8424         SYSTEM_MYSQL_CONNECTOR_CPP=
8425     fi
8426     AC_LANG_POP([C++])
8428 AC_SUBST(SYSTEM_MYSQL_CONNECTOR_CPP)
8430 dnl ===================================================================
8431 dnl Check for system hsqldb
8432 dnl ===================================================================
8433 if test "$with_java" != "no"; then
8434     HSQLDB_USE_JDBC_4_1=
8435     AC_MSG_CHECKING([which hsqldb to use])
8436     if test "$with_system_hsqldb" = "yes"; then
8437         AC_MSG_RESULT([external])
8438         SYSTEM_HSQLDB=TRUE
8439         if test -z $HSQLDB_JAR; then
8440             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8441         fi
8442         if ! test -f $HSQLDB_JAR; then
8443                AC_MSG_ERROR(hsqldb.jar not found.)
8444         fi
8445         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8446         export HSQLDB_JAR
8447         if $PERL -e \
8448            'use Archive::Zip;
8449             my $file = "$ENV{'HSQLDB_JAR'}";
8450             my $zip = Archive::Zip->new( $file );
8451             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8452             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8453             {
8454                 push @l, split(/\n/, $mf);
8455                 foreach my $line (@l)
8456                 {
8457                     if ($line =~ m/Specification-Version:/)
8458                     {
8459                         ($t, $version) = split (/:/,$line);
8460                         $version =~ s/^\s//;
8461                         ($a, $b, $c, $d) = split (/\./,$version);
8462                         if ($c == "0" && $d > "8")
8463                         {
8464                             exit 0;
8465                         }
8466                         else
8467                         {
8468                             exit 1;
8469                         }
8470                     }
8471                 }
8472             }
8473             else
8474             {
8475                 exit 1;
8476             }'; then
8477             AC_MSG_RESULT([yes])
8478         else
8479             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8480         fi
8481     else
8482         AC_MSG_RESULT([internal])
8483         SYSTEM_HSQLDB=
8484         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8485         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8486         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8487         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8488             AC_MSG_RESULT([yes])
8489             HSQLDB_USE_JDBC_4_1=TRUE
8490         else
8491             AC_MSG_RESULT([no])
8492         fi
8493     fi
8494     AC_SUBST(SYSTEM_HSQLDB)
8495     AC_SUBST(HSQLDB_JAR)
8496     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8499 dnl ===================================================================
8500 dnl Check for PostgreSQL stuff
8501 dnl ===================================================================
8502 if test "x$enable_postgresql_sdbc" != "xno"; then
8503     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8505     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8506         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8507     fi
8508     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8509         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8510     fi
8512     postgres_interface=""
8513     if test "$with_system_postgresql" = "yes"; then
8514         postgres_interface="external PostgreSQL"
8515         SYSTEM_POSTGRESQL=TRUE
8516         if test "$_os" = Darwin; then
8517             supp_path=''
8518             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8519                 pg_supp_path="$P_SEP$d$pg_supp_path"
8520             done
8521         fi
8522         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8523         if test -z "$PGCONFIG"; then
8524             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8525         fi
8526         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8527         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8528         FilterLibs "${POSTGRESQL_LIB}"
8529         POSTGRESQL_LIB="${filteredlibs}"
8530     else
8531         # if/when anything else than PostgreSQL uses Kerberos,
8532         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8533         WITH_KRB5=
8534         WITH_GSSAPI=
8535         case "$_os" in
8536         Darwin)
8537             # MacOS X has system MIT Kerberos 5 since 10.4
8538             if test "$with_krb5" != "no"; then
8539                 WITH_KRB5=TRUE
8540                 save_LIBS=$LIBS
8541                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8542                 # that the libraries where these functions are located on macOS will change, is it?
8543                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8544                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8545                 KRB5_LIBS=$LIBS
8546                 LIBS=$save_LIBS
8547                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8548                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8549                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8550                 LIBS=$save_LIBS
8551             fi
8552             if test "$with_gssapi" != "no"; then
8553                 WITH_GSSAPI=TRUE
8554                 save_LIBS=$LIBS
8555                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8556                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8557                 GSSAPI_LIBS=$LIBS
8558                 LIBS=$save_LIBS
8559             fi
8560             ;;
8561         WINNT)
8562             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8563                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8564             fi
8565             ;;
8566         Linux|GNU|*BSD|DragonFly)
8567             if test "$with_krb5" != "no"; then
8568                 WITH_KRB5=TRUE
8569                 save_LIBS=$LIBS
8570                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8571                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8572                 KRB5_LIBS=$LIBS
8573                 LIBS=$save_LIBS
8574                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8575                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8576                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8577                 LIBS=$save_LIBS
8578             fi
8579             if test "$with_gssapi" != "no"; then
8580                 WITH_GSSAPI=TRUE
8581                 save_LIBS=$LIBS
8582                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8583                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8584                 GSSAPI_LIBS=$LIBS
8585                 LIBS=$save_LIBS
8586             fi
8587             ;;
8588         *)
8589             if test "$with_krb5" = "yes"; then
8590                 WITH_KRB5=TRUE
8591                 save_LIBS=$LIBS
8592                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8593                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8594                 KRB5_LIBS=$LIBS
8595                 LIBS=$save_LIBS
8596                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8597                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8598                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8599                 LIBS=$save_LIBS
8600             fi
8601             if test "$with_gssapi" = "yes"; then
8602                 WITH_GSSAPI=TRUE
8603                 save_LIBS=$LIBS
8604                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8605                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8606                 LIBS=$save_LIBS
8607                 GSSAPI_LIBS=$LIBS
8608             fi
8609         esac
8611         if test -n "$with_libpq_path"; then
8612             SYSTEM_POSTGRESQL=TRUE
8613             postgres_interface="external libpq"
8614             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8615             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8616         else
8617             SYSTEM_POSTGRESQL=
8618             postgres_interface="internal"
8619             POSTGRESQL_LIB=""
8620             POSTGRESQL_INC="%OVERRIDE_ME%"
8621             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8622         fi
8623     fi
8625     AC_MSG_CHECKING([PostgreSQL C interface])
8626     AC_MSG_RESULT([$postgres_interface])
8628     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8629         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8630         save_CFLAGS=$CFLAGS
8631         save_CPPFLAGS=$CPPFLAGS
8632         save_LIBS=$LIBS
8633         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8634         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8635         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8636         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8637             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8638         CFLAGS=$save_CFLAGS
8639         CPPFLAGS=$save_CPPFLAGS
8640         LIBS=$save_LIBS
8641     fi
8642     BUILD_POSTGRESQL_SDBC=TRUE
8644 AC_SUBST(WITH_KRB5)
8645 AC_SUBST(WITH_GSSAPI)
8646 AC_SUBST(GSSAPI_LIBS)
8647 AC_SUBST(KRB5_LIBS)
8648 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8649 AC_SUBST(SYSTEM_POSTGRESQL)
8650 AC_SUBST(POSTGRESQL_INC)
8651 AC_SUBST(POSTGRESQL_LIB)
8653 dnl ===================================================================
8654 dnl Check for Firebird stuff
8655 dnl ===================================================================
8656 ENABLE_FIREBIRD_SDBC=""
8657 if test "$enable_firebird_sdbc" = "yes" ; then
8658     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8660     dnl ===================================================================
8661     dnl Check for system Firebird
8662     dnl ===================================================================
8663     AC_MSG_CHECKING([which Firebird to use])
8664     if test "$with_system_firebird" = "yes"; then
8665         AC_MSG_RESULT([external])
8666         SYSTEM_FIREBIRD=TRUE
8667         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8668         if test -z "$FIREBIRDCONFIG"; then
8669             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8670             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8671                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8672             ])
8673             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8674         else
8675             AC_MSG_NOTICE([fb_config found])
8676             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8677             AC_MSG_CHECKING([for Firebird Client library])
8678             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8679             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8680             FilterLibs "${FIREBIRD_LIBS}"
8681             FIREBIRD_LIBS="${filteredlibs}"
8682         fi
8683         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8684         AC_MSG_CHECKING([Firebird version])
8685         if test -n "${FIREBIRD_VERSION}"; then
8686             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8687             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8688             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8689                 AC_MSG_RESULT([OK])
8690             else
8691                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
8692             fi
8693         else
8694             __save_CFLAGS="${CFLAGS}"
8695             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8696             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8697 #if defined(FB_API_VER) && FB_API_VER == 30
8698 int fb_api_is_30(void) { return 0; }
8699 #else
8700 #error "Wrong Firebird API version"
8701 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
8702             CFLAGS="${__save_CFLAGS}"
8703         fi
8704         ENABLE_FIREBIRD_SDBC="TRUE"
8705     elif test "$enable_database_connectivity" != yes; then
8706         AC_MSG_RESULT([none])
8707     elif test "$cross_compiling" = "yes"; then
8708         AC_MSG_RESULT([none])
8709     else
8710         dnl Embedded Firebird has version 3.0
8711         AC_DEFINE(HAVE_FIREBIRD_30, 1)
8712         dnl We need libatomic-ops for any non X86/X64 system
8713         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8714             dnl ===================================================================
8715             dnl Check for system libatomic-ops
8716             dnl ===================================================================
8717             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8718             if test "$with_system_libatomic_ops" = "yes"; then
8719                 SYSTEM_LIBATOMIC_OPS=TRUE
8720                 AC_CHECK_HEADERS(atomic_ops.h, [],
8721                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8722             else
8723                 SYSTEM_LIBATOMIC_OPS=
8724                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8725                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8726                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8727             fi
8728         fi
8730         AC_MSG_RESULT([internal])
8731         SYSTEM_FIREBIRD=
8732         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
8733         FIREBIRD_LIBS="-lfbclient"
8735         if test "$with_system_libtommath" = "yes"; then
8736             SYSTEM_LIBTOMMATH=TRUE
8737             dnl check for tommath presence
8738             save_LIBS=$LIBS
8739             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
8740             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
8741             LIBS=$save_LIBS
8742         else
8743             SYSTEM_LIBTOMMATH=
8744             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
8745             LIBTOMMATH_LIBS="-ltommath"
8746             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
8747         fi
8749         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8750         ENABLE_FIREBIRD_SDBC="TRUE"
8751     fi
8753 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8754 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8755 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8756 AC_SUBST(LIBATOMIC_OPS_LIBS)
8757 AC_SUBST(SYSTEM_FIREBIRD)
8758 AC_SUBST(FIREBIRD_CFLAGS)
8759 AC_SUBST(FIREBIRD_LIBS)
8760 AC_SUBST([TOMMATH_CFLAGS])
8761 AC_SUBST([TOMMATH_LIBS])
8763 dnl ===================================================================
8764 dnl Check for system curl
8765 dnl ===================================================================
8766 AC_MSG_CHECKING([which libcurl to use])
8767 if test "$with_system_curl" = "auto"; then
8768     with_system_curl="$with_system_libs"
8771 if test "$with_system_curl" = "yes"; then
8772     AC_MSG_RESULT([external])
8773     SYSTEM_CURL=TRUE
8775     # First try PKGCONFIG and then fall back
8776     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8778     if test -n "$CURL_PKG_ERRORS"; then
8779         AC_PATH_PROG(CURLCONFIG, curl-config)
8780         if test -z "$CURLCONFIG"; then
8781             AC_MSG_ERROR([curl development files not found])
8782         fi
8783         CURL_LIBS=`$CURLCONFIG --libs`
8784         FilterLibs "${CURL_LIBS}"
8785         CURL_LIBS="${filteredlibs}"
8786         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8787         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8789         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8790         case $curl_version in
8791         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8792         dnl so they need to be doubled to end up in the configure script
8793         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8794             AC_MSG_RESULT([yes])
8795             ;;
8796         *)
8797             AC_MSG_ERROR([no, you have $curl_version])
8798             ;;
8799         esac
8800     fi
8802     ENABLE_CURL=TRUE
8803 elif test $_os = iOS; then
8804     # Let's see if we need curl, I think not?
8805     AC_MSG_RESULT([none])
8806     ENABLE_CURL=
8807 else
8808     AC_MSG_RESULT([internal])
8809     SYSTEM_CURL=
8810     BUILD_TYPE="$BUILD_TYPE CURL"
8811     ENABLE_CURL=TRUE
8813 AC_SUBST(SYSTEM_CURL)
8814 AC_SUBST(CURL_CFLAGS)
8815 AC_SUBST(CURL_LIBS)
8816 AC_SUBST(ENABLE_CURL)
8818 dnl ===================================================================
8819 dnl Check for system boost
8820 dnl ===================================================================
8821 AC_MSG_CHECKING([which boost to use])
8822 if test "$with_system_boost" = "yes"; then
8823     AC_MSG_RESULT([external])
8824     SYSTEM_BOOST=TRUE
8825     AX_BOOST_BASE(1.47)
8826     AX_BOOST_DATE_TIME
8827     AX_BOOST_FILESYSTEM
8828     AX_BOOST_IOSTREAMS
8829     AX_BOOST_LOCALE
8830     AC_LANG_PUSH([C++])
8831     save_CXXFLAGS=$CXXFLAGS
8832     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8833     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8834        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8835     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8836        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8837     CXXFLAGS=$save_CXXFLAGS
8838     AC_LANG_POP([C++])
8839     # this is in m4/ax_boost_base.m4
8840     FilterLibs "${BOOST_LDFLAGS}"
8841     BOOST_LDFLAGS="${filteredlibs}"
8842 else
8843     AC_MSG_RESULT([internal])
8844     BUILD_TYPE="$BUILD_TYPE BOOST"
8845     SYSTEM_BOOST=
8846     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
8847         # use warning-suppressing wrapper headers
8848         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
8849     else
8850         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
8851     fi
8853 AC_SUBST(SYSTEM_BOOST)
8855 dnl ===================================================================
8856 dnl Check for system mdds
8857 dnl ===================================================================
8858 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.2 >= 1.2.3], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8860 dnl ===================================================================
8861 dnl Check for system glm
8862 dnl ===================================================================
8863 AC_MSG_CHECKING([which glm to use])
8864 if test "$with_system_glm" = "yes"; then
8865     AC_MSG_RESULT([external])
8866     SYSTEM_GLM=TRUE
8867     AC_LANG_PUSH([C++])
8868     AC_CHECK_HEADER([glm/glm.hpp], [],
8869        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8870     AC_LANG_POP([C++])
8871 else
8872     AC_MSG_RESULT([internal])
8873     BUILD_TYPE="$BUILD_TYPE GLM"
8874     SYSTEM_GLM=
8875     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8877 AC_SUBST([GLM_CFLAGS])
8878 AC_SUBST([SYSTEM_GLM])
8880 dnl ===================================================================
8881 dnl Check for system odbc
8882 dnl ===================================================================
8883 AC_MSG_CHECKING([which odbc headers to use])
8884 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
8885     AC_MSG_RESULT([external])
8886     SYSTEM_ODBC_HEADERS=TRUE
8888     if test "$build_os" = "cygwin"; then
8889         save_CPPFLAGS=$CPPFLAGS
8890         find_winsdk
8891         PathFormat "$winsdktest"
8892         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"
8893         AC_CHECK_HEADER(sqlext.h, [],
8894             [AC_MSG_ERROR(odbc not found. install odbc)],
8895             [#include <windows.h>])
8896         CPPFLAGS=$save_CPPFLAGS
8897     else
8898         AC_CHECK_HEADER(sqlext.h, [],
8899             [AC_MSG_ERROR(odbc not found. install odbc)],[])
8900     fi
8901 elif test "$enable_database_connectivity" != yes; then
8902     AC_MSG_RESULT([none])
8903 else
8904     AC_MSG_RESULT([internal])
8905     SYSTEM_ODBC_HEADERS=
8907 AC_SUBST(SYSTEM_ODBC_HEADERS)
8910 dnl ===================================================================
8911 dnl Check for system openldap
8912 dnl ===================================================================
8914 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8915 AC_MSG_CHECKING([which openldap library to use])
8916 if test "$with_system_openldap" = "yes"; then
8917     AC_MSG_RESULT([external])
8918     SYSTEM_OPENLDAP=TRUE
8919     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8920     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8921     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8922 else
8923     AC_MSG_RESULT([internal])
8924     SYSTEM_OPENLDAP=
8925     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8928 AC_SUBST(SYSTEM_OPENLDAP)
8930 dnl ===================================================================
8931 dnl Check for system NSS
8932 dnl ===================================================================
8933 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
8934     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8935     AC_DEFINE(HAVE_FEATURE_NSS)
8936     ENABLE_NSS="TRUE"
8937     AC_DEFINE(ENABLE_NSS)
8938 elif test $_os != iOS ; then
8939     with_tls=openssl
8941 AC_SUBST(ENABLE_NSS)
8943 dnl ===================================================================
8944 dnl Check for TLS/SSL and cryptographic implementation to use
8945 dnl ===================================================================
8946 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8947 if test -n "$with_tls"; then
8948     case $with_tls in
8949     openssl)
8950         AC_DEFINE(USE_TLS_OPENSSL)
8951         TLS=OPENSSL
8953         if test "$enable_openssl" != "yes"; then
8954             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8955         fi
8957         # warn that OpenSSL has been selected but not all TLS code has this option
8958         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
8959         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
8960         ;;
8961     nss)
8962         AC_DEFINE(USE_TLS_NSS)
8963         TLS=NSS
8964         ;;
8965     no)
8966         AC_MSG_WARN([Skipping TLS/SSL])
8967         ;;
8968     *)
8969         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8970 openssl - OpenSSL
8971 nss - Mozilla's Network Security Services (NSS)
8972     ])
8973         ;;
8974     esac
8975 else
8976     # default to using NSS, it results in smaller oox lib
8977     AC_DEFINE(USE_TLS_NSS)
8978     TLS=NSS
8980 AC_MSG_RESULT([$TLS])
8981 AC_SUBST(TLS)
8983 dnl ===================================================================
8984 dnl Check for system sane
8985 dnl ===================================================================
8986 AC_MSG_CHECKING([which sane header to use])
8987 if test "$with_system_sane" = "yes"; then
8988     AC_MSG_RESULT([external])
8989     AC_CHECK_HEADER(sane/sane.h, [],
8990       [AC_MSG_ERROR(sane not found. install sane)], [])
8991 else
8992     AC_MSG_RESULT([internal])
8993     BUILD_TYPE="$BUILD_TYPE SANE"
8996 dnl ===================================================================
8997 dnl Check for system icu
8998 dnl ===================================================================
8999 SYSTEM_GENBRK=
9000 SYSTEM_GENCCODE=
9001 SYSTEM_GENCMN=
9003 ICU_MAJOR=60
9004 ICU_MINOR=2
9005 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9006 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9007 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9008 AC_MSG_CHECKING([which icu to use])
9009 if test "$with_system_icu" = "yes"; then
9010     AC_MSG_RESULT([external])
9011     SYSTEM_ICU=TRUE
9012     AC_LANG_PUSH([C++])
9013     AC_MSG_CHECKING([for unicode/rbbi.h])
9014     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9015     AC_LANG_POP([C++])
9017     if test "$cross_compiling" != "yes"; then
9018         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9019         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9020         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9021         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9022     fi
9024     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9025         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9026         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9027         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9028         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9029         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9030             AC_MSG_RESULT([yes])
9031         else
9032             AC_MSG_RESULT([no])
9033             if test "$with_system_icu_for_build" != "force"; then
9034                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9035 You can use --with-system-icu-for-build=force to use it anyway.])
9036             fi
9037         fi
9038     fi
9040     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9041         # using the system icu tools can lead to version confusion, use the
9042         # ones from the build environment when cross-compiling
9043         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9044         if test -z "$SYSTEM_GENBRK"; then
9045             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9046         fi
9047         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9048         if test -z "$SYSTEM_GENCCODE"; then
9049             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9050         fi
9051         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9052         if test -z "$SYSTEM_GENCMN"; then
9053             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9054         fi
9055         if test "$ICU_MAJOR" -ge "49"; then
9056             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9057             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9058             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9059         else
9060             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9061             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9062             ICU_RECLASSIFIED_HEBREW_LETTER=
9063         fi
9064     fi
9066     if test "$cross_compiling" = "yes"; then
9067         if test "$ICU_MAJOR" -ge "50"; then
9068             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9069             ICU_MINOR=""
9070         fi
9071     fi
9072 else
9073     AC_MSG_RESULT([internal])
9074     SYSTEM_ICU=
9075     BUILD_TYPE="$BUILD_TYPE ICU"
9076     # surprisingly set these only for "internal" (to be used by various other
9077     # external libs): the system icu-config is quite unhelpful and spits out
9078     # dozens of weird flags and also default path -I/usr/include
9079     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9080     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9082 if test "$ICU_MAJOR" -ge "59"; then
9083     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9084     # with -std=c++11 but not all external libraries can be built with that,
9085     # for those use a bit-compatible typedef uint16_t UChar; see
9086     # icu/source/common/unicode/umachine.h
9087     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9088 else
9089     ICU_UCHAR_TYPE=""
9091 AC_SUBST(SYSTEM_ICU)
9092 AC_SUBST(SYSTEM_GENBRK)
9093 AC_SUBST(SYSTEM_GENCCODE)
9094 AC_SUBST(SYSTEM_GENCMN)
9095 AC_SUBST(ICU_MAJOR)
9096 AC_SUBST(ICU_MINOR)
9097 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9098 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9099 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9100 AC_SUBST(ICU_CFLAGS)
9101 AC_SUBST(ICU_LIBS)
9102 AC_SUBST(ICU_UCHAR_TYPE)
9104 dnl ==================================================================
9105 dnl Breakpad
9106 dnl ==================================================================
9107 AC_MSG_CHECKING([whether to enable breakpad])
9108 if test "$enable_breakpad" != yes; then
9109     AC_MSG_RESULT([no])
9110 else
9111     AC_MSG_RESULT([yes])
9112     ENABLE_BREAKPAD="TRUE"
9113     AC_DEFINE(ENABLE_BREAKPAD)
9114     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9115     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9117     AC_MSG_CHECKING([for crashreport config])
9118     if test "$with_symbol_config" = "no"; then
9119         BREAKPAD_SYMBOL_CONFIG="invalid"
9120         AC_MSG_RESULT([no])
9121     else
9122         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9123         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9124         AC_MSG_RESULT([yes])
9125     fi
9126     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9128 AC_SUBST(ENABLE_BREAKPAD)
9130 dnl ==================================================================
9131 dnl libfuzzer
9132 dnl ==================================================================
9133 AC_MSG_CHECKING([whether to enable fuzzers])
9134 if test "$enable_fuzzers" != yes; then
9135     AC_MSG_RESULT([no])
9136 else
9137     AC_MSG_RESULT([yes])
9138     ENABLE_FUZZERS="TRUE"
9139     AC_DEFINE(ENABLE_FUZZERS)
9140     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9142 AC_SUBST(ENABLE_FUZZERS)
9144 dnl ===================================================================
9145 dnl Orcus
9146 dnl ===================================================================
9147 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.13 >= 0.13.3])
9148 if test "$with_system_orcus" != "yes"; then
9149     if test "$SYSTEM_BOOST" = "TRUE"; then
9150         # ===========================================================
9151         # Determine if we are going to need to link with Boost.System
9152         # ===========================================================
9153         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9154         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9155         dnl in documentation has no effect.
9156         AC_MSG_CHECKING([if we need to link with Boost.System])
9157         AC_LANG_PUSH([C++])
9158         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9159                 @%:@include <boost/version.hpp>
9160             ]],[[
9161                 #if BOOST_VERSION >= 105000
9162                 #   error yes, we need to link with Boost.System
9163                 #endif
9164             ]])],[
9165                 AC_MSG_RESULT([no])
9166             ],[
9167                 AC_MSG_RESULT([yes])
9168                 AX_BOOST_SYSTEM
9169         ])
9170         AC_LANG_POP([C++])
9171     fi
9173 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9174 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9175 AC_SUBST([BOOST_SYSTEM_LIB])
9176 AC_SUBST(SYSTEM_LIBORCUS)
9178 dnl ===================================================================
9179 dnl HarfBuzz
9180 dnl ===================================================================
9181 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9182                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9183                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9185 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9186                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9187                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9189 if test "$COM" = "MSC"; then # override the above
9190     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9191     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9194 if test "$with_system_harfbuzz" = "yes"; then
9195     if test "$with_system_graphite" = "no"; then
9196         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9197     fi
9198     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9199     _save_libs="$LIBS"
9200     _save_cflags="$CFLAGS"
9201     LIBS="$LIBS $HARFBUZZ_LIBS"
9202     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9203     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9204     LIBS="$_save_libs"
9205     CFLAGS="$_save_cflags"
9206 else
9207     if test "$with_system_graphite" = "yes"; then
9208         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9209     fi
9212 AC_MSG_CHECKING([whether to use X11])
9213 dnl ***************************************
9214 dnl testing for X libraries and includes...
9215 dnl ***************************************
9216 if test "$USING_X11" = TRUE; then
9217     AC_DEFINE(HAVE_FEATURE_X11)
9219 AC_MSG_RESULT([$USING_X11])
9221 if test "$USING_X11" = TRUE; then
9222     AC_PATH_X
9223     AC_PATH_XTRA
9224     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9226     if test -z "$x_includes"; then
9227         x_includes="default_x_includes"
9228     fi
9229     if test -z "$x_libraries"; then
9230         x_libraries="default_x_libraries"
9231     fi
9232     CFLAGS="$CFLAGS $X_CFLAGS"
9233     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9234     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9235 else
9236     x_includes="no_x_includes"
9237     x_libraries="no_x_libraries"
9240 if test "$USING_X11" = TRUE; then
9241     dnl ===================================================================
9242     dnl Check for extension headers
9243     dnl ===================================================================
9244     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9245      [#include <X11/extensions/shape.h>])
9247     # vcl needs ICE and SM
9248     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9249     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9250         [AC_MSG_ERROR(ICE library not found)])
9251     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9252     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9253         [AC_MSG_ERROR(SM library not found)])
9256 dnl ===================================================================
9257 dnl Check for system Xrender
9258 dnl ===================================================================
9259 AC_MSG_CHECKING([whether to use Xrender])
9260 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9261     AC_MSG_RESULT([yes])
9262     PKG_CHECK_MODULES(XRENDER, xrender)
9263     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9264     FilterLibs "${XRENDER_LIBS}"
9265     XRENDER_LIBS="${filteredlibs}"
9266     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9267       [AC_MSG_ERROR(libXrender not found or functional)], [])
9268     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9269       [AC_MSG_ERROR(Xrender not found. install X)], [])
9270 else
9271     AC_MSG_RESULT([no])
9273 AC_SUBST(XRENDER_CFLAGS)
9274 AC_SUBST(XRENDER_LIBS)
9276 dnl ===================================================================
9277 dnl Check for XRandr
9278 dnl ===================================================================
9279 AC_MSG_CHECKING([whether to enable RandR support])
9280 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9281     AC_MSG_RESULT([yes])
9282     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9283     if test "$ENABLE_RANDR" != "TRUE"; then
9284         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9285                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9286         XRANDR_CFLAGS=" "
9287         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9288           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9289         XRANDR_LIBS="-lXrandr "
9290         ENABLE_RANDR="TRUE"
9291     fi
9292     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9293     FilterLibs "${XRANDR_LIBS}"
9294     XRANDR_LIBS="${filteredlibs}"
9295 else
9296     ENABLE_RANDR=""
9297     AC_MSG_RESULT([no])
9299 AC_SUBST(XRANDR_CFLAGS)
9300 AC_SUBST(XRANDR_LIBS)
9301 AC_SUBST(ENABLE_RANDR)
9303 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9304     WITH_WEBDAV="serf"
9306 if test $_os = iOS -o $_os = Android; then
9307     WITH_WEBDAV="no"
9309 AC_MSG_CHECKING([for webdav library])
9310 case "$WITH_WEBDAV" in
9311 serf)
9312     AC_MSG_RESULT([serf])
9313     # Check for system apr-util
9314     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9315                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9316                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9317     if test "$COM" = "MSC"; then
9318         APR_LIB_DIR="LibR"
9319         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9320         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9321     fi
9323     # Check for system serf
9324     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9325                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9326     if test "$COM" = "MSC"; then
9327         SERF_LIB_DIR="Release"
9328         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9329         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9330     fi
9331     ;;
9332 neon)
9333     AC_MSG_RESULT([neon])
9334     # Check for system neon
9335     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9336     if test "$with_system_neon" = "yes"; then
9337         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9338     else
9339         NEON_VERSION=0295
9340     fi
9341     AC_SUBST(NEON_VERSION)
9342     ;;
9344     AC_MSG_RESULT([none, disabled])
9345     WITH_WEBDAV=""
9346     ;;
9347 esac
9348 AC_SUBST(WITH_WEBDAV)
9350 dnl ===================================================================
9351 dnl Check for disabling cve_tests
9352 dnl ===================================================================
9353 AC_MSG_CHECKING([whether to execute CVE tests])
9354 # If not explicitly enabled or disabled, default
9355 if test -z "$enable_cve_tests"; then
9356     case "$OS" in
9357     WNT)
9358         # Default cves off for windows with its wild and wonderful
9359         # varienty of AV software kicking in and panicking
9360         enable_cve_tests=no
9361         ;;
9362     *)
9363         # otherwise yes
9364         enable_cve_tests=yes
9365         ;;
9366     esac
9368 if test "$enable_cve_tests" = "no"; then
9369     AC_MSG_RESULT([no])
9370     DISABLE_CVE_TESTS=TRUE
9371     AC_SUBST(DISABLE_CVE_TESTS)
9372 else
9373     AC_MSG_RESULT([yes])
9376 dnl ===================================================================
9377 dnl Check for enabling chart XShape tests
9378 dnl ===================================================================
9379 AC_MSG_CHECKING([whether to execute chart XShape tests])
9380 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9381     AC_MSG_RESULT([yes])
9382     ENABLE_CHART_TESTS=TRUE
9383     AC_SUBST(ENABLE_CHART_TESTS)
9384 else
9385     AC_MSG_RESULT([no])
9388 dnl ===================================================================
9389 dnl Check for system openssl
9390 dnl ===================================================================
9391 DISABLE_OPENSSL=
9392 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9393 if test "$enable_openssl" = "yes"; then
9394     AC_MSG_RESULT([no])
9395     if test "$_os" = Darwin ; then
9396         # OpenSSL is deprecated when building for 10.7 or later.
9397         #
9398         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9399         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9401         with_system_openssl=no
9402         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9403     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9404             && test "$with_system_openssl" != "no"; then
9405         with_system_openssl=yes
9406         SYSTEM_OPENSSL=TRUE
9407         OPENSSL_CFLAGS=
9408         OPENSSL_LIBS="-lssl -lcrypto"
9409     else
9410         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9411     fi
9412     if test "$with_system_openssl" = "yes"; then
9413         AC_MSG_CHECKING([whether openssl supports SHA512])
9414         AC_LANG_PUSH([C])
9415         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9416             SHA512_CTX context;
9417 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9418         AC_LANG_POP(C)
9419     fi
9420 else
9421     AC_MSG_RESULT([yes])
9422     DISABLE_OPENSSL=TRUE
9424     # warn that although OpenSSL is disabled, system libraries may depend on it
9425     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9426     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9429 AC_SUBST([DISABLE_OPENSSL])
9431 dnl ===================================================================
9432 dnl Check for building gnutls
9433 dnl ===================================================================
9434 AC_MSG_CHECKING([whether to use gnutls])
9435 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9436     AC_MSG_RESULT([yes])
9437     AM_PATH_LIBGCRYPT()
9438     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9439         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9440                       available in the system to use as replacement.]]))
9441     FilterLibs "${LIBGCRYPT_LIBS}"
9442     LIBGCRYPT_LIBS="${filteredlibs}"
9443 else
9444     AC_MSG_RESULT([no])
9447 AC_SUBST([LIBGCRYPT_CFLAGS])
9448 AC_SUBST([LIBGCRYPT_LIBS])
9450 dnl ===================================================================
9451 dnl Check for system redland
9452 dnl ===================================================================
9453 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9454 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9455 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9456 if test "$with_system_redland" = "yes"; then
9457     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9458             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9459 else
9460     RAPTOR_MAJOR="0"
9461     RASQAL_MAJOR="3"
9462     REDLAND_MAJOR="0"
9464 AC_SUBST(RAPTOR_MAJOR)
9465 AC_SUBST(RASQAL_MAJOR)
9466 AC_SUBST(REDLAND_MAJOR)
9468 dnl ===================================================================
9469 dnl Check for system hunspell
9470 dnl ===================================================================
9471 AC_MSG_CHECKING([which libhunspell to use])
9472 if test "$with_system_hunspell" = "yes"; then
9473     AC_MSG_RESULT([external])
9474     SYSTEM_HUNSPELL=TRUE
9475     AC_LANG_PUSH([C++])
9476     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9477     if test "$HUNSPELL_PC" != "TRUE"; then
9478         AC_CHECK_HEADER(hunspell.hxx, [],
9479             [
9480             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9481             [AC_MSG_ERROR(hunspell headers not found.)], [])
9482             ], [])
9483         AC_CHECK_LIB([hunspell], [main], [:],
9484            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9485         HUNSPELL_LIBS=-lhunspell
9486     fi
9487     AC_LANG_POP([C++])
9488     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9489     FilterLibs "${HUNSPELL_LIBS}"
9490     HUNSPELL_LIBS="${filteredlibs}"
9491 else
9492     AC_MSG_RESULT([internal])
9493     SYSTEM_HUNSPELL=
9494     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9495     if test "$COM" = "MSC"; then
9496         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9497     else
9498         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.6"
9499     fi
9500     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9502 AC_SUBST(SYSTEM_HUNSPELL)
9503 AC_SUBST(HUNSPELL_CFLAGS)
9504 AC_SUBST(HUNSPELL_LIBS)
9506 dnl ===================================================================
9507 dnl Checking for altlinuxhyph
9508 dnl ===================================================================
9509 AC_MSG_CHECKING([which altlinuxhyph to use])
9510 if test "$with_system_altlinuxhyph" = "yes"; then
9511     AC_MSG_RESULT([external])
9512     SYSTEM_HYPH=TRUE
9513     AC_CHECK_HEADER(hyphen.h, [],
9514        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9515     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9516        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9517        [#include <hyphen.h>])
9518     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9519         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9520     if test -z "$HYPHEN_LIB"; then
9521         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9522            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9523     fi
9524     if test -z "$HYPHEN_LIB"; then
9525         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9526            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9527     fi
9528 else
9529     AC_MSG_RESULT([internal])
9530     SYSTEM_HYPH=
9531     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9532     if test "$COM" = "MSC"; then
9533         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9534     else
9535         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9536     fi
9538 AC_SUBST(SYSTEM_HYPH)
9539 AC_SUBST(HYPHEN_LIB)
9541 dnl ===================================================================
9542 dnl Checking for mythes
9543 dnl ===================================================================
9544 AC_MSG_CHECKING([which mythes to use])
9545 if test "$with_system_mythes" = "yes"; then
9546     AC_MSG_RESULT([external])
9547     SYSTEM_MYTHES=TRUE
9548     AC_LANG_PUSH([C++])
9549     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9550     if test "$MYTHES_PKGCONFIG" = "no"; then
9551         AC_CHECK_HEADER(mythes.hxx, [],
9552             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9553         AC_CHECK_LIB([mythes-1.2], [main], [:],
9554             [ MYTHES_FOUND=no], [])
9555     if test "$MYTHES_FOUND" = "no"; then
9556         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9557                 [ MYTHES_FOUND=no], [])
9558     fi
9559     if test "$MYTHES_FOUND" = "no"; then
9560         AC_MSG_ERROR([mythes library not found!.])
9561     fi
9562     fi
9563     AC_LANG_POP([C++])
9564     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9565     FilterLibs "${MYTHES_LIBS}"
9566     MYTHES_LIBS="${filteredlibs}"
9567 else
9568     AC_MSG_RESULT([internal])
9569     SYSTEM_MYTHES=
9570     BUILD_TYPE="$BUILD_TYPE MYTHES"
9571     if test "$COM" = "MSC"; then
9572         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9573     else
9574         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9575     fi
9577 AC_SUBST(SYSTEM_MYTHES)
9578 AC_SUBST(MYTHES_CFLAGS)
9579 AC_SUBST(MYTHES_LIBS)
9581 dnl ===================================================================
9582 dnl How should we build the linear programming solver ?
9583 dnl ===================================================================
9585 ENABLE_COINMP=
9586 AC_MSG_CHECKING([whether to build with CoinMP])
9587 if test "$enable_coinmp" != "no"; then
9588     ENABLE_COINMP=TRUE
9589     AC_MSG_RESULT([yes])
9590     if test "$with_system_coinmp" = "yes"; then
9591         SYSTEM_COINMP=TRUE
9592         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9593         FilterLibs "${COINMP_LIBS}"
9594         COINMP_LIBS="${filteredlibs}"
9595     else
9596         BUILD_TYPE="$BUILD_TYPE COINMP"
9597     fi
9598 else
9599     AC_MSG_RESULT([no])
9601 AC_SUBST(ENABLE_COINMP)
9602 AC_SUBST(SYSTEM_COINMP)
9603 AC_SUBST(COINMP_CFLAGS)
9604 AC_SUBST(COINMP_LIBS)
9606 ENABLE_LPSOLVE=
9607 AC_MSG_CHECKING([whether to build with lpsolve])
9608 if test "$enable_lpsolve" != "no"; then
9609     ENABLE_LPSOLVE=TRUE
9610     AC_MSG_RESULT([yes])
9611 else
9612     AC_MSG_RESULT([no])
9614 AC_SUBST(ENABLE_LPSOLVE)
9616 if test "$ENABLE_LPSOLVE" = TRUE; then
9617     AC_MSG_CHECKING([which lpsolve to use])
9618     if test "$with_system_lpsolve" = "yes"; then
9619         AC_MSG_RESULT([external])
9620         SYSTEM_LPSOLVE=TRUE
9621         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9622            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9623         save_LIBS=$LIBS
9624         # some systems need this. Like Ubuntu....
9625         AC_CHECK_LIB(m, floor)
9626         AC_CHECK_LIB(dl, dlopen)
9627         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9628             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9629         LIBS=$save_LIBS
9630     else
9631         AC_MSG_RESULT([internal])
9632         SYSTEM_LPSOLVE=
9633         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9634     fi
9636 AC_SUBST(SYSTEM_LPSOLVE)
9638 dnl ===================================================================
9639 dnl Checking for libexttextcat
9640 dnl ===================================================================
9641 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9642 if test "$with_system_libexttextcat" = "yes"; then
9643     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9645 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9647 dnl ***************************************
9648 dnl testing libc version for Linux...
9649 dnl ***************************************
9650 if test "$_os" = "Linux"; then
9651     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9652     exec 6>/dev/null # no output
9653     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9654     exec 6>&1 # output on again
9655     if test "$HAVE_LIBC"; then
9656         AC_MSG_RESULT([yes])
9657     else
9658         AC_MSG_ERROR([no, upgrade libc])
9659     fi
9662 dnl =========================================
9663 dnl Check for uuidgen
9664 dnl =========================================
9665 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9666     # presence is already tested above in the WINDOWS_SDK_HOME check
9667     UUIDGEN=uuidgen.exe
9668     AC_SUBST(UUIDGEN)
9669 else
9670     AC_PATH_PROG([UUIDGEN], [uuidgen])
9671     if test -z "$UUIDGEN"; then
9672         AC_MSG_WARN([uuid is needed for building installation sets])
9673     fi
9676 dnl ***************************************
9677 dnl Checking for bison and flex
9678 dnl ***************************************
9679 AC_PATH_PROG(BISON, bison)
9680 if test -z "$BISON"; then
9681     AC_MSG_ERROR([no bison found in \$PATH, install it])
9682 else
9683     AC_MSG_CHECKING([the bison version])
9684     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9685     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9686     # Accept newer than 2.0
9687     if test "$_bison_longver" -lt 2000; then
9688         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9689     fi
9692 AC_PATH_PROG(FLEX, flex)
9693 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9694     FLEX=`cygpath -m $FLEX`
9696 if test -z "$FLEX"; then
9697     AC_MSG_ERROR([no flex found in \$PATH, install it])
9698 else
9699     AC_MSG_CHECKING([the flex version])
9700     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9701     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9702         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9703     fi
9705 AC_SUBST([FLEX])
9706 dnl ***************************************
9707 dnl Checking for patch
9708 dnl ***************************************
9709 AC_PATH_PROG(PATCH, patch)
9710 if test -z "$PATCH"; then
9711     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9714 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9715 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9716     if test -z "$with_gnu_patch"; then
9717         GNUPATCH=$PATCH
9718     else
9719         if test -x "$with_gnu_patch"; then
9720             GNUPATCH=$with_gnu_patch
9721         else
9722             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9723         fi
9724     fi
9726     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9727     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9728         AC_MSG_RESULT([yes])
9729     else
9730         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9731     fi
9732 else
9733     GNUPATCH=$PATCH
9736 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9737     GNUPATCH=`cygpath -m $GNUPATCH`
9740 dnl We also need to check for --with-gnu-cp
9742 if test -z "$with_gnu_cp"; then
9743     # check the place where the good stuff is hidden on Solaris...
9744     if test -x /usr/gnu/bin/cp; then
9745         GNUCP=/usr/gnu/bin/cp
9746     else
9747         AC_PATH_PROGS(GNUCP, gnucp cp)
9748     fi
9749     if test -z $GNUCP; then
9750         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9751     fi
9752 else
9753     if test -x "$with_gnu_cp"; then
9754         GNUCP=$with_gnu_cp
9755     else
9756         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9757     fi
9760 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9761     GNUCP=`cygpath -m $GNUCP`
9764 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9765 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9766     AC_MSG_RESULT([yes])
9767 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9768     AC_MSG_RESULT([yes])
9769 else
9770     case "$build_os" in
9771     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9772         x_GNUCP=[\#]
9773         GNUCP=''
9774         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9775         ;;
9776     *)
9777         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9778         ;;
9779     esac
9782 AC_SUBST(GNUPATCH)
9783 AC_SUBST(GNUCP)
9784 AC_SUBST(x_GNUCP)
9786 dnl ***************************************
9787 dnl testing assembler path
9788 dnl ***************************************
9789 ML_EXE=""
9790 if test "$_os" = "WINNT"; then
9791     if test "$BITNESS_OVERRIDE" = ""; then
9792         assembler=ml.exe
9793         assembler_bin=$CL_DIR
9794     else
9795         assembler=ml64.exe
9796         assembler_bin=$CL_DIR
9797     fi
9799     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9800     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9801         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9802         AC_MSG_RESULT([found])
9803         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9804     else
9805         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9806     fi
9808     PathFormat "$ASM_HOME"
9809     ASM_HOME="$formatted_path"
9810 else
9811     ASM_HOME=""
9814 AC_SUBST(ML_EXE)
9816 dnl ===================================================================
9817 dnl We need zip and unzip
9818 dnl ===================================================================
9819 AC_PATH_PROG(ZIP, zip)
9820 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9821 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9822     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],,)
9825 AC_PATH_PROG(UNZIP, unzip)
9826 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9828 dnl ===================================================================
9829 dnl Zip must be a specific type for different build types.
9830 dnl ===================================================================
9831 if test $build_os = cygwin; then
9832     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9833         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9834     fi
9837 dnl ===================================================================
9838 dnl We need touch with -h option support.
9839 dnl ===================================================================
9840 AC_PATH_PROG(TOUCH, touch)
9841 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
9842 touch warn
9843 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
9844     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],,)
9847 dnl ===================================================================
9848 dnl Check for system epoxy
9849 dnl ===================================================================
9850 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
9852 dnl ===================================================================
9853 dnl Set vcl option: coordinate device in double or sal_Int32
9854 dnl ===================================================================
9856 dnl disabled for now, we don't want subtle differences between OSs
9857 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
9858 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
9859 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
9860 dnl     AC_MSG_RESULT([double])
9861 dnl else
9862 dnl     AC_MSG_RESULT([sal_Int32])
9863 dnl fi
9865 dnl ===================================================================
9866 dnl Test which vclplugs have to be built.
9867 dnl ===================================================================
9868 R=""
9869 if test "$USING_X11" != TRUE; then
9870     enable_gtk=no
9871     enable_gtk3=no
9873 GTK3_CFLAGS=""
9874 GTK3_LIBS=""
9875 ENABLE_GTK3=""
9876 if test "x$enable_gtk3" = "xyes"; then
9877     if test "$with_system_cairo" = no; then
9878         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
9879     fi
9880     : ${with_system_cairo:=yes}
9881     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="")
9882     if test "x$ENABLE_GTK3" = "xTRUE"; then
9883         R="gtk3"
9884         dnl Avoid installed by unpackaged files for now.
9885         if test -z "$PKGFORMAT"; then
9886             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
9887         fi
9888     else
9889         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
9890     fi
9891     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9892     FilterLibs "${GTK3_LIBS}"
9893     GTK3_LIBS="${filteredlibs}"
9895     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
9896     if test "$with_system_epoxy" != "yes"; then
9897         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
9898     fi
9900 AC_SUBST(GTK3_LIBS)
9901 AC_SUBST(GTK3_CFLAGS)
9902 AC_SUBST(ENABLE_GTK3)
9904 ENABLE_GTK=""
9905 if test "x$enable_gtk" = "xyes"; then
9906     if test "$with_system_cairo" = no; then
9907         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
9908     fi
9909     : ${with_system_cairo:=yes}
9910     ENABLE_GTK="TRUE"
9911     AC_DEFINE(ENABLE_GTK)
9912     R="gtk $R"
9914 AC_SUBST(ENABLE_GTK)
9916 ENABLE_KDE4=""
9917 if test "x$enable_kde4" = "xyes"; then
9918     ENABLE_KDE4="TRUE"
9919     AC_DEFINE(ENABLE_KDE4)
9920     R="$R kde4"
9922 AC_SUBST(ENABLE_KDE4)
9924 ENABLE_QT5=""
9925 if test "x$enable_qt5" = "xyes"; then
9926     ENABLE_QT5="TRUE"
9927     AC_DEFINE(ENABLE_QT5)
9928     R="$R qt5"
9930 AC_SUBST(ENABLE_QT5)
9932 ENABLE_KDE5=""
9933 if test "x$enable_kde5" = "xyes"; then
9934     ENABLE_KDE5="TRUE"
9935     AC_DEFINE(ENABLE_KDE5)
9936     R="$R kde5"
9938 AC_SUBST(ENABLE_KDE5)
9940 ENABLE_GTK3_KDE5=""
9941 if test "x$enable_gtk3_kde5" = "xyes"; then
9942     ENABLE_GTK3_KDE5="TRUE"
9943     AC_DEFINE(ENABLE_GTK3_KDE5)
9944     R="$R gtk3_kde5"
9946 AC_SUBST(ENABLE_GTK3_KDE5)
9948 build_vcl_plugins="$R"
9949 if test -z "$build_vcl_plugins"; then
9950     build_vcl_plugins="none"
9952 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
9954 dnl ===================================================================
9955 dnl check for dbus support
9956 dnl ===================================================================
9957 ENABLE_DBUS=""
9958 DBUS_CFLAGS=""
9959 DBUS_LIBS=""
9961 if test "$enable_dbus" = "no"; then
9962     test_dbus=no
9965 AC_MSG_CHECKING([whether to enable DBUS support])
9966 if test "$test_dbus" = "yes"; then
9967     ENABLE_DBUS="TRUE"
9968     AC_MSG_RESULT([yes])
9969     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
9970     AC_DEFINE(ENABLE_DBUS)
9971     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9972     FilterLibs "${DBUS_LIBS}"
9973     DBUS_LIBS="${filteredlibs}"
9974 else
9975     AC_MSG_RESULT([no])
9978 AC_SUBST(ENABLE_DBUS)
9979 AC_SUBST(DBUS_CFLAGS)
9980 AC_SUBST(DBUS_LIBS)
9982 AC_MSG_CHECKING([whether to enable Impress remote control])
9983 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
9984     AC_MSG_RESULT([yes])
9985     ENABLE_SDREMOTE=TRUE
9986     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
9988     # If not explicitly enabled or disabled, default
9989     if test -z "$enable_sdremote_bluetooth"; then
9990         case "$OS" in
9991         LINUX|MACOSX|WNT)
9992             # Default to yes for these
9993             enable_sdremote_bluetooth=yes
9994             ;;
9995         *)
9996             # otherwise no
9997             enable_sdremote_bluetooth=no
9998             ;;
9999         esac
10000     fi
10001     # $enable_sdremote_bluetooth is guaranteed non-empty now
10003     if test "$enable_sdremote_bluetooth" != "no"; then
10004         if test "$OS" = "LINUX"; then
10005             if test "$ENABLE_DBUS" = "TRUE"; then
10006                 AC_MSG_RESULT([yes])
10007                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10008                 dnl ===================================================================
10009                 dnl Check for system bluez
10010                 dnl ===================================================================
10011                 AC_MSG_CHECKING([which Bluetooth header to use])
10012                 if test "$with_system_bluez" = "yes"; then
10013                     AC_MSG_RESULT([external])
10014                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10015                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10016                     SYSTEM_BLUEZ=TRUE
10017                 else
10018                     AC_MSG_RESULT([internal])
10019                     SYSTEM_BLUEZ=
10020                 fi
10021             else
10022                 AC_MSG_RESULT([no, dbus disabled])
10023                 ENABLE_SDREMOTE_BLUETOOTH=
10024                 SYSTEM_BLUEZ=
10025             fi
10026         else
10027             AC_MSG_RESULT([yes])
10028             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10029             SYSTEM_BLUEZ=
10030         fi
10031     else
10032         AC_MSG_RESULT([no])
10033         ENABLE_SDREMOTE_BLUETOOTH=
10034         SYSTEM_BLUEZ=
10035     fi
10036 else
10037     ENABLE_SDREMOTE=
10038     SYSTEM_BLUEZ=
10039     AC_MSG_RESULT([no])
10041 AC_SUBST(ENABLE_SDREMOTE)
10042 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10043 AC_SUBST(SYSTEM_BLUEZ)
10045 dnl ===================================================================
10046 dnl Check whether the gtk 2.0 libraries are available.
10047 dnl ===================================================================
10049 GTK_CFLAGS=""
10050 GTK_LIBS=""
10051 ENABLE_SYSTRAY_GTK=""
10052 if test  "$test_gtk" = "yes"; then
10054     if test "$ENABLE_GTK" = "TRUE"; then
10055         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]))
10056         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10057         FilterLibs "${GTK_LIBS}"
10058         GTK_LIBS="${filteredlibs}"
10059         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]))
10060         BUILD_TYPE="$BUILD_TYPE GTK"
10061         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10062         FilterLibs "${GTHREAD_LIBS}"
10063         GTHREAD_LIBS="${filteredlibs}"
10065         if test "x$enable_systray" = "xyes"; then
10066             ENABLE_SYSTRAY_GTK="TRUE"
10067         fi
10069         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10070         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10071                           [ENABLE_GTK_PRINT="TRUE"],
10072                           [ENABLE_GTK_PRINT=""])
10073         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10074         FilterLibs "${GTK_PRINT_LIBS}"
10075         GTK_PRINT_LIBS="${filteredlibs}"
10077         AC_MSG_CHECKING([whether to enable GIO support])
10078         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10079             dnl Need at least 2.26 for the dbus support.
10080             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10081                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10082             if test "$ENABLE_GIO" = "TRUE"; then
10083                 AC_DEFINE(ENABLE_GIO)
10084                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10085                 FilterLibs "${GIO_LIBS}"
10086                 GIO_LIBS="${filteredlibs}"
10087             fi
10088         else
10089             AC_MSG_RESULT([no])
10090         fi
10091     fi
10093 AC_SUBST(ENABLE_GIO)
10094 AC_SUBST(GIO_CFLAGS)
10095 AC_SUBST(GIO_LIBS)
10096 AC_SUBST(ENABLE_SYSTRAY_GTK)
10097 AC_SUBST(GTK_CFLAGS)
10098 AC_SUBST(GTK_LIBS)
10099 AC_SUBST(GTHREAD_CFLAGS)
10100 AC_SUBST(GTHREAD_LIBS)
10101 AC_SUBST([ENABLE_GTK_PRINT])
10102 AC_SUBST([GTK_PRINT_CFLAGS])
10103 AC_SUBST([GTK_PRINT_LIBS])
10106 dnl ===================================================================
10108 SPLIT_APP_MODULES=""
10109 if test "$enable_split_app_modules" = "yes"; then
10110     SPLIT_APP_MODULES="TRUE"
10112 AC_SUBST(SPLIT_APP_MODULES)
10114 SPLIT_OPT_FEATURES=""
10115 if test "$enable_split_opt_features" = "yes"; then
10116     SPLIT_OPT_FEATURES="TRUE"
10118 AC_SUBST(SPLIT_OPT_FEATURES)
10120 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10121     if test "$enable_cairo_canvas" = yes; then
10122         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10123     fi
10124     enable_cairo_canvas=no
10125 elif test -z "$enable_cairo_canvas"; then
10126     enable_cairo_canvas=yes
10129 ENABLE_CAIRO_CANVAS=""
10130 if test "$enable_cairo_canvas" = "yes"; then
10131     test_cairo=yes
10132     ENABLE_CAIRO_CANVAS="TRUE"
10133     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10135 AC_SUBST(ENABLE_CAIRO_CANVAS)
10137 dnl ===================================================================
10138 dnl Check whether the GStreamer libraries are available.
10139 dnl It's possible to build avmedia with both GStreamer backends!
10140 dnl ===================================================================
10142 ENABLE_GSTREAMER_1_0=""
10144 if test "$build_gstreamer_1_0" = "yes"; then
10146     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10147     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10148         ENABLE_GSTREAMER_1_0="TRUE"
10149         AC_MSG_RESULT([yes])
10150         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10151         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10152         FilterLibs "${GSTREAMER_1_0_LIBS}"
10153         GSTREAMER_1_0_LIBS="${filteredlibs}"
10154     else
10155         AC_MSG_RESULT([no])
10156     fi
10158 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10159 AC_SUBST(GSTREAMER_1_0_LIBS)
10160 AC_SUBST(ENABLE_GSTREAMER_1_0)
10163 ENABLE_GSTREAMER_0_10=""
10164 if test "$build_gstreamer_0_10" = "yes"; then
10166     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10167     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10168         ENABLE_GSTREAMER_0_10="TRUE"
10169         AC_MSG_RESULT([yes])
10170         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10171             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10172         ])
10173         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10174         FilterLibs "${GSTREAMER_0_10_LIBS}"
10175         GSTREAMER_0_10_LIBS="${filteredlibs}"
10176     else
10177         AC_MSG_RESULT([no])
10178     fi
10181 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10182 AC_SUBST(GSTREAMER_0_10_LIBS)
10183 AC_SUBST(ENABLE_GSTREAMER_0_10)
10185 dnl ===================================================================
10186 dnl Check whether to build the VLC avmedia backend
10187 dnl ===================================================================
10189 ENABLE_VLC=""
10191 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10192 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10193     ENABLE_VLC="TRUE"
10194     AC_MSG_RESULT([yes])
10195 else
10196     AC_MSG_RESULT([no])
10198 AC_SUBST(ENABLE_VLC)
10200 ENABLE_OPENGL_TRANSITIONS=
10201 ENABLE_OPENGL_CANVAS=
10202 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10203    : # disable
10204 elif test "$_os" = "Darwin"; then
10205     # We use frameworks on Mac OS X, no need for detail checks
10206     ENABLE_OPENGL_TRANSITIONS=TRUE
10207     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10208     ENABLE_OPENGL_CANVAS=TRUE
10209 elif test $_os = WINNT; then
10210     ENABLE_OPENGL_TRANSITIONS=TRUE
10211     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10212     ENABLE_OPENGL_CANVAS=TRUE
10213 else
10214     if test "$USING_X11" = TRUE; then
10215         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10216         ENABLE_OPENGL_TRANSITIONS=TRUE
10217         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10218         ENABLE_OPENGL_CANVAS=TRUE
10219     fi
10222 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10223 AC_SUBST(ENABLE_OPENGL_CANVAS)
10225 dnl =================================================
10226 dnl Check whether to build with OpenCL support.
10227 dnl =================================================
10229 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10230     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10231     # platform (optional at run-time, used through clew).
10232     BUILD_TYPE="$BUILD_TYPE OPENCL"
10233     AC_DEFINE(HAVE_FEATURE_OPENCL)
10236 dnl =================================================
10237 dnl Check whether to build with dconf support.
10238 dnl =================================================
10240 if test "$enable_dconf" != no; then
10241     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10242         if test "$enable_dconf" = yes; then
10243             AC_MSG_ERROR([dconf not found])
10244         else
10245             enable_dconf=no
10246         fi])
10248 AC_MSG_CHECKING([whether to enable dconf])
10249 if test "$enable_dconf" = no; then
10250     DCONF_CFLAGS=
10251     DCONF_LIBS=
10252     ENABLE_DCONF=
10253     AC_MSG_RESULT([no])
10254 else
10255     ENABLE_DCONF=TRUE
10256     AC_DEFINE(ENABLE_DCONF)
10257     AC_MSG_RESULT([yes])
10259 AC_SUBST([DCONF_CFLAGS])
10260 AC_SUBST([DCONF_LIBS])
10261 AC_SUBST([ENABLE_DCONF])
10263 # pdf import?
10264 AC_MSG_CHECKING([whether to build the PDF import feature])
10265 ENABLE_PDFIMPORT=
10266 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10267     AC_MSG_RESULT([yes])
10268     ENABLE_PDFIMPORT=TRUE
10269     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10271     dnl ===================================================================
10272     dnl Check for system poppler
10273     dnl ===================================================================
10274     AC_MSG_CHECKING([which PDF import backend to use])
10275     if test "$with_system_poppler" = "yes"; then
10276         AC_MSG_RESULT([external])
10277         SYSTEM_POPPLER=TRUE
10278         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10279         AC_LANG_PUSH([C++])
10280         save_CXXFLAGS=$CXXFLAGS
10281         save_CPPFLAGS=$CPPFLAGS
10282         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10283         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10284         AC_CHECK_HEADER([cpp/poppler-version.h],
10285             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10286             [])
10287         CXXFLAGS=$save_CXXFLAGS
10288         CPPFLAGS=$save_CPPFLAGS
10289         AC_LANG_POP([C++])
10290         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10292         FilterLibs "${POPPLER_LIBS}"
10293         POPPLER_LIBS="${filteredlibs}"
10294     else
10295         AC_MSG_RESULT([internal])
10296         SYSTEM_POPPLER=
10297         BUILD_TYPE="$BUILD_TYPE POPPLER"
10298         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10299     fi
10300     AC_DEFINE([ENABLE_PDFIMPORT],1)
10301 else
10302     AC_MSG_RESULT([no])
10304 AC_SUBST(ENABLE_PDFIMPORT)
10305 AC_SUBST(SYSTEM_POPPLER)
10306 AC_SUBST(POPPLER_CFLAGS)
10307 AC_SUBST(POPPLER_LIBS)
10309 # pdf import?
10310 AC_MSG_CHECKING([whether to build PDFium])
10311 ENABLE_PDFIUM=
10312 if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then
10313     AC_MSG_RESULT([yes])
10314     ENABLE_PDFIUM=TRUE
10315     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10316     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10317 else
10318     AC_MSG_RESULT([no])
10320 AC_SUBST(ENABLE_PDFIUM)
10322 SYSTEM_GPGMEPP=
10324 if test "$build_for_ios" = "YES"; then
10325     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10326     AC_MSG_RESULT([yes])
10327 elif test "$enable_mpl_subset" = "yes"; then
10328     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10329     AC_MSG_RESULT([yes])
10330 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10331     dnl ===================================================================
10332     dnl Check for system gpgme
10333     dnl ===================================================================
10334     AC_MSG_CHECKING([which gpgmepp to use])
10335     if test "$with_system_gpgmepp" = "yes"; then
10336         AC_MSG_RESULT([external])
10337         SYSTEM_GPGMEPP=TRUE
10339         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10340         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10341             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10342         # progress_callback is the only func with plain C linkage
10343         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10344         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10345             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10346         AC_CHECK_HEADER(gpgme.h, [],
10347             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10348     else
10349         AC_MSG_RESULT([internal])
10350         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10351         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10353         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10354         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10355         if test "$_os" != "WINNT"; then
10356             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10357             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10358         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10359             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10360         fi
10361     fi
10362     ENABLE_GPGMEPP=TRUE
10363     AC_DEFINE([HAVE_FEATURE_GPGME])
10364     AC_PATH_PROG(GPG, gpg)
10365     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10366     # so let's exclude that manually for the moment
10367     if test -n "$GPG" -a "$_os" != "WINNT"; then
10368         # make sure we not only have a working gpgme, but a full working
10369         # gpg installation to run OpenPGP signature verification
10370         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10371     fi
10372     if test "$_os" = "Linux"; then
10373       uid=`id -u`
10374       AC_MSG_CHECKING([for /run/user/$uid])
10375       if test -d /run/user/$uid; then
10376         AC_MSG_RESULT([yes])
10377         AC_PATH_PROG(GPGCONF, gpgconf)
10378         AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10379         if $GPGCONF --dump-options > /dev/null ; then
10380           if $GPGCONF --dump-options | grep -q create-socketdir ; then
10381             AC_MSG_RESULT([yes])
10382             AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10383           else
10384             AC_MSG_RESULT([no])
10385           fi
10386         else
10387           AC_MSG_RESULT([no. missing or broken gpgconf?])
10388         fi
10389       else
10390         AC_MSG_RESULT([no])
10391      fi
10392    fi
10394 AC_SUBST(ENABLE_GPGMEPP)
10395 AC_SUBST(SYSTEM_GPGMEPP)
10396 AC_SUBST(GPG_ERROR_CFLAGS)
10397 AC_SUBST(GPG_ERROR_LIBS)
10398 AC_SUBST(LIBASSUAN_CFLAGS)
10399 AC_SUBST(LIBASSUAN_LIBS)
10400 AC_SUBST(GPGMEPP_CFLAGS)
10401 AC_SUBST(GPGMEPP_LIBS)
10402 AC_SUBST(GPGCONF)
10403 AC_SUBST(HAVE_GPGCONF_SOCKETDIR)
10405 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10406 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10407     AC_MSG_RESULT([yes])
10408     ENABLE_MEDIAWIKI=TRUE
10409     BUILD_TYPE="$BUILD_TYPE XSLTML"
10410     if test  "x$with_java" = "xno"; then
10411         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10412     fi
10413 else
10414     AC_MSG_RESULT([no])
10415     ENABLE_MEDIAWIKI=
10416     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10418 AC_SUBST(ENABLE_MEDIAWIKI)
10420 AC_MSG_CHECKING([whether to build the Report Builder])
10421 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10422     AC_MSG_RESULT([yes])
10423     ENABLE_REPORTBUILDER=TRUE
10424     AC_MSG_CHECKING([which jfreereport libs to use])
10425     if test "$with_system_jfreereport" = "yes"; then
10426         SYSTEM_JFREEREPORT=TRUE
10427         AC_MSG_RESULT([external])
10428         if test -z $SAC_JAR; then
10429             SAC_JAR=/usr/share/java/sac.jar
10430         fi
10431         if ! test -f $SAC_JAR; then
10432              AC_MSG_ERROR(sac.jar not found.)
10433         fi
10435         if test -z $LIBXML_JAR; then
10436             if test -f /usr/share/java/libxml-1.0.0.jar; then
10437                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10438             elif test -f /usr/share/java/libxml.jar; then
10439                 LIBXML_JAR=/usr/share/java/libxml.jar
10440             else
10441                 AC_MSG_ERROR(libxml.jar replacement not found.)
10442             fi
10443         elif ! test -f $LIBXML_JAR; then
10444             AC_MSG_ERROR(libxml.jar not found.)
10445         fi
10447         if test -z $FLUTE_JAR; then
10448             if test -f/usr/share/java/flute-1.3.0.jar; then
10449                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10450             elif test -f /usr/share/java/flute.jar; then
10451                 FLUTE_JAR=/usr/share/java/flute.jar
10452             else
10453                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10454             fi
10455         elif ! test -f $FLUTE_JAR; then
10456             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10457         fi
10459         if test -z $JFREEREPORT_JAR; then
10460             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10461                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10462             elif test -f /usr/share/java/flow-engine.jar; then
10463                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10464             else
10465                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10466             fi
10467         elif ! test -f  $JFREEREPORT_JAR; then
10468                 AC_MSG_ERROR(jfreereport.jar not found.)
10469         fi
10471         if test -z $LIBLAYOUT_JAR; then
10472             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10473                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10474             elif test -f /usr/share/java/liblayout.jar; then
10475                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10476             else
10477                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10478             fi
10479         elif ! test -f $LIBLAYOUT_JAR; then
10480                 AC_MSG_ERROR(liblayout.jar not found.)
10481         fi
10483         if test -z $LIBLOADER_JAR; then
10484             if test -f /usr/share/java/libloader-1.0.0.jar; then
10485                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10486             elif test -f /usr/share/java/libloader.jar; then
10487                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10488             else
10489                 AC_MSG_ERROR(libloader.jar replacement not found.)
10490             fi
10491         elif ! test -f  $LIBLOADER_JAR; then
10492             AC_MSG_ERROR(libloader.jar not found.)
10493         fi
10495         if test -z $LIBFORMULA_JAR; then
10496             if test -f /usr/share/java/libformula-0.2.0.jar; then
10497                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10498             elif test -f /usr/share/java/libformula.jar; then
10499                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10500             else
10501                 AC_MSG_ERROR(libformula.jar replacement not found.)
10502             fi
10503         elif ! test -f $LIBFORMULA_JAR; then
10504                 AC_MSG_ERROR(libformula.jar not found.)
10505         fi
10507         if test -z $LIBREPOSITORY_JAR; then
10508             if test -f /usr/share/java/librepository-1.0.0.jar; then
10509                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10510             elif test -f /usr/share/java/librepository.jar; then
10511                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10512             else
10513                 AC_MSG_ERROR(librepository.jar replacement not found.)
10514             fi
10515         elif ! test -f $LIBREPOSITORY_JAR; then
10516             AC_MSG_ERROR(librepository.jar not found.)
10517         fi
10519         if test -z $LIBFONTS_JAR; then
10520             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10521                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10522             elif test -f /usr/share/java/libfonts.jar; then
10523                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10524             else
10525                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10526             fi
10527         elif ! test -f $LIBFONTS_JAR; then
10528                 AC_MSG_ERROR(libfonts.jar not found.)
10529         fi
10531         if test -z $LIBSERIALIZER_JAR; then
10532             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10533                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10534             elif test -f /usr/share/java/libserializer.jar; then
10535                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10536             else
10537                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10538             fi
10539         elif ! test -f $LIBSERIALIZER_JAR; then
10540                 AC_MSG_ERROR(libserializer.jar not found.)
10541         fi
10543         if test -z $LIBBASE_JAR; then
10544             if test -f /usr/share/java/libbase-1.0.0.jar; then
10545                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10546             elif test -f /usr/share/java/libbase.jar; then
10547                 LIBBASE_JAR=/usr/share/java/libbase.jar
10548             else
10549                 AC_MSG_ERROR(libbase.jar replacement not found.)
10550             fi
10551         elif ! test -f $LIBBASE_JAR; then
10552             AC_MSG_ERROR(libbase.jar not found.)
10553         fi
10555     else
10556         AC_MSG_RESULT([internal])
10557         SYSTEM_JFREEREPORT=
10558         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10559     fi
10560 else
10561     AC_MSG_RESULT([no])
10562     ENABLE_REPORTBUILDER=
10563     SYSTEM_JFREEREPORT=
10565 AC_SUBST(ENABLE_REPORTBUILDER)
10566 AC_SUBST(SYSTEM_JFREEREPORT)
10567 AC_SUBST(SAC_JAR)
10568 AC_SUBST(LIBXML_JAR)
10569 AC_SUBST(FLUTE_JAR)
10570 AC_SUBST(JFREEREPORT_JAR)
10571 AC_SUBST(LIBBASE_JAR)
10572 AC_SUBST(LIBLAYOUT_JAR)
10573 AC_SUBST(LIBLOADER_JAR)
10574 AC_SUBST(LIBFORMULA_JAR)
10575 AC_SUBST(LIBREPOSITORY_JAR)
10576 AC_SUBST(LIBFONTS_JAR)
10577 AC_SUBST(LIBSERIALIZER_JAR)
10579 # this has to be here because both the Wiki Publisher and the SRB use
10580 # commons-logging
10581 COMMONS_LOGGING_VERSION=1.2
10582 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10583     AC_MSG_CHECKING([which Apache commons-* libs to use])
10584     if test "$with_system_apache_commons" = "yes"; then
10585         SYSTEM_APACHE_COMMONS=TRUE
10586         AC_MSG_RESULT([external])
10587         if test -z $COMMONS_LOGGING_JAR; then
10588             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10589                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10590            elif test -f /usr/share/java/commons-logging.jar; then
10591                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
10592             else
10593                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
10594             fi
10595         elif ! test -f $COMMONS_LOGGING_JAR; then
10596             AC_MSG_ERROR(commons-logging.jar not found.)
10597         fi
10598     else
10599         AC_MSG_RESULT([internal])
10600         SYSTEM_APACHE_COMMONS=
10601         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
10602     fi
10604 AC_SUBST(SYSTEM_APACHE_COMMONS)
10605 AC_SUBST(COMMONS_LOGGING_JAR)
10606 AC_SUBST(COMMONS_LOGGING_VERSION)
10608 # scripting provider for BeanShell?
10609 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10610 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10611     AC_MSG_RESULT([yes])
10612     ENABLE_SCRIPTING_BEANSHELL=TRUE
10614     dnl ===================================================================
10615     dnl Check for system beanshell
10616     dnl ===================================================================
10617     AC_MSG_CHECKING([which beanshell to use])
10618     if test "$with_system_beanshell" = "yes"; then
10619         AC_MSG_RESULT([external])
10620         SYSTEM_BSH=TRUE
10621         if test -z $BSH_JAR; then
10622             BSH_JAR=/usr/share/java/bsh.jar
10623         fi
10624         if ! test -f $BSH_JAR; then
10625             AC_MSG_ERROR(bsh.jar not found.)
10626         fi
10627     else
10628         AC_MSG_RESULT([internal])
10629         SYSTEM_BSH=
10630         BUILD_TYPE="$BUILD_TYPE BSH"
10631     fi
10632 else
10633     AC_MSG_RESULT([no])
10634     ENABLE_SCRIPTING_BEANSHELL=
10635     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10637 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10638 AC_SUBST(SYSTEM_BSH)
10639 AC_SUBST(BSH_JAR)
10641 # scripting provider for JavaScript?
10642 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10643 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10644     AC_MSG_RESULT([yes])
10645     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10647     dnl ===================================================================
10648     dnl Check for system rhino
10649     dnl ===================================================================
10650     AC_MSG_CHECKING([which rhino to use])
10651     if test "$with_system_rhino" = "yes"; then
10652         AC_MSG_RESULT([external])
10653         SYSTEM_RHINO=TRUE
10654         if test -z $RHINO_JAR; then
10655             RHINO_JAR=/usr/share/java/js.jar
10656         fi
10657         if ! test -f $RHINO_JAR; then
10658             AC_MSG_ERROR(js.jar not found.)
10659         fi
10660     else
10661         AC_MSG_RESULT([internal])
10662         SYSTEM_RHINO=
10663         BUILD_TYPE="$BUILD_TYPE RHINO"
10664     fi
10665 else
10666     AC_MSG_RESULT([no])
10667     ENABLE_SCRIPTING_JAVASCRIPT=
10668     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10670 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10671 AC_SUBST(SYSTEM_RHINO)
10672 AC_SUBST(RHINO_JAR)
10674 # This is only used in KDE3/KDE4 checks to determine if /usr/lib64
10675 # paths should be added to library search path. So lets put all 64-bit
10676 # platforms there.
10677 supports_multilib=
10678 case "$host_cpu" in
10679 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
10680     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10681         supports_multilib="yes"
10682     fi
10683     ;;
10685     ;;
10686 esac
10688 dnl ===================================================================
10689 dnl KDE4 Integration
10690 dnl ===================================================================
10692 KDE4_CFLAGS=""
10693 KDE4_LIBS=""
10694 QMAKE4="qmake"
10695 MOC4="moc"
10696 KDE4_GLIB_CFLAGS=""
10697 KDE4_GLIB_LIBS=""
10698 KDE4_HAVE_GLIB=""
10699 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
10700     qt4_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
10701     qt4_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
10703     kde4_incdirs="/usr/include /usr/include/kde4 $x_includes"
10704     kde4_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
10706     if test -n "$supports_multilib"; then
10707         qt4_libdirs="$qt4_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
10708         kde4_libdirs="$kde4_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
10709     fi
10711     if test -n "$QTDIR"; then
10712         qt4_incdirs="$QTDIR/include $qt4_incdirs"
10713         if test -z "$supports_multilib"; then
10714             qt4_libdirs="$QTDIR/lib $qt4_libdirs"
10715         else
10716             qt4_libdirs="$QTDIR/lib64 $QTDIR/lib $qt4_libdirs"
10717         fi
10718     fi
10719     if test -n "$QT4DIR"; then
10720         qt4_incdirs="$QT4DIR/include $qt4_incdirs"
10721         if test -z "$supports_multilib"; then
10722             qt4_libdirs="$QT4DIR/lib $qt4_libdirs"
10723         else
10724             qt4_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt4_libdirs"
10725         fi
10726     fi
10728     if test -n "$KDEDIR"; then
10729         kde4_incdirs="$KDEDIR/include $kde4_incdirs"
10730         if test -z "$supports_multilib"; then
10731             kde4_libdirs="$KDEDIR/lib $kde4_libdirs"
10732         else
10733             kde4_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde4_libdirs"
10734         fi
10735     fi
10736     if test -n "$KDE4DIR"; then
10737         kde4_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde4_incdirs"
10738         if test -z "$supports_multilib"; then
10739             kde4_libdirs="$KDE4DIR/lib $kde4_libdirs"
10740         else
10741             kde4_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde4_libdirs"
10742         fi
10743     fi
10745     qt4_test_include="Qt/qobject.h"
10746     qt4_test_library="libQtNetwork.so"
10747     kde4_test_include="kwindowsystem.h"
10748     kde4_test_library="libsolid.so"
10750     AC_MSG_CHECKING([for Qt4 headers])
10751     qt4_header_dir="no"
10752     for inc_dir in $qt4_incdirs; do
10753         if test -r "$inc_dir/$qt4_test_include"; then
10754             qt4_header_dir="$inc_dir"
10755             break
10756         fi
10757     done
10759     AC_MSG_RESULT([$qt4_header_dir])
10760     if test "x$qt4_header_dir" = "xno"; then
10761         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10762     fi
10764     dnl Check for qmake
10765     AC_PATH_PROGS( QMAKE4, [qmake-qt4 qmake], no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
10766     if test "$QMAKE4" = "no"; then
10767         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10768     else
10769         qmake4_test_ver="`$QMAKE4 -v 2>&1 | sed -n -e '/^Using Qt version 4\./p'`"
10770         if test -z "$qmake4_test_ver"; then
10771             AC_MSG_ERROR([Wrong qmake for Qt4 found. Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
10772         fi
10773     fi
10775     qt4_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt4_libdirs"
10776     AC_MSG_CHECKING([for Qt4 libraries])
10777     qt4_lib_dir="no"
10778     for lib_dir in $qt4_libdirs; do
10779         if test -r "$lib_dir/$qt4_test_library"; then
10780             qt4_lib_dir="$lib_dir"
10781             PKG_CONFIG_PATH="$qt4_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
10782             break
10783         fi
10784     done
10786     AC_MSG_RESULT([$qt4_lib_dir])
10788     if test "x$qt4_lib_dir" = "xno"; then
10789         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10790     fi
10792     dnl Check for Meta Object Compiler
10794     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10795     MOC4="$MOCQT4"
10796     if test "$MOC4" = "no"; then
10797         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10798         if test "$MOC4" = "no"; then
10799             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10800 the root of your Qt installation by exporting QT4DIR before running "configure".])
10801         fi
10802     fi
10804     dnl Check for KDE4 headers
10805     AC_MSG_CHECKING([for KDE4 headers])
10806     kde4_incdir="no"
10807     for kde4_check in $kde4_incdirs; do
10808         if test -r "$kde4_check/$kde4_test_include"; then
10809             kde4_incdir="$kde4_check"
10810             break
10811         fi
10812     done
10813     AC_MSG_RESULT([$kde4_incdir])
10814     if test "x$kde4_incdir" = "xno"; then
10815         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10816     fi
10817     if test "$kde4_incdir" = "/usr/include"; then kde4_incdir=; fi
10819     dnl Check for KDE4 libraries
10820     AC_MSG_CHECKING([for KDE4 libraries])
10821     kde4_libdir="no"
10822     for kde4_check in $kde4_libdirs; do
10823         if test -r "$kde4_check/$kde4_test_library"; then
10824             kde4_libdir="$kde4_check"
10825             break
10826         fi
10827     done
10829     AC_MSG_RESULT([$kde4_libdir])
10830     if test "x$kde4_libdir" = "xno"; then
10831         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10832     fi
10834     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
10835     if ! test -z "$kde4_incdir"; then
10836         KDE4_CFLAGS="-I$kde4_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10837     else
10838         KDE4_CFLAGS="$QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10839     fi
10841     KDE4_LIBS="-L$kde4_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt4_lib_dir $QT4_LIBS"
10842     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10843     FilterLibs "$KDE4_LIBS"
10844     KDE4_LIBS="$filteredlibs"
10846     AC_LANG_PUSH([C++])
10847     save_CXXFLAGS=$CXXFLAGS
10848     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10849     AC_MSG_CHECKING([whether KDE is >= 4.2])
10850        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10851 #include <kdeversion.h>
10853 int main(int argc, char **argv) {
10854        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
10855        else return 1;
10857 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[AC_MSG_ERROR([KDE support not tested with cross-compilation])])
10858     CXXFLAGS=$save_CXXFLAGS
10859     AC_LANG_POP([C++])
10861     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
10862     # Sets also KDE4_GLIB_CFLAGS/KDE4_GLIB_LIBS if successful.
10863     PKG_CHECK_MODULES(KDE4_GLIB,[glib-2.0 >= 2.4],
10864         [
10865             KDE4_HAVE_GLIB=TRUE
10866             AC_DEFINE(KDE4_HAVE_GLIB,1)
10867             KDE4_GLIB_CFLAGS=$(printf '%s' "$KDE4_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10868             FilterLibs "${KDE4_GLIB_LIBS}"
10869             KDE4_GLIB_LIBS="${filteredlibs}"
10871             qt4_fix_warning=
10873             AC_LANG_PUSH([C++])
10874             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
10875             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
10876             #  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
10877             #               ^~~~~~~~~~~~~~~~~~~~~~~
10878             #               vptr for 'QObjectPrivate'
10879             # so temporarily ignore here whichever way would be used to make such errors fatal
10880             # (-fno-sanitize-recover=... or UBSAN_OPTIONS halt_on_error=1):
10881             save_CXX=$CXX
10882             CXX=$(printf %s "$CXX" \
10883                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
10884             save_UBSAN_OPTIONS=$UBSAN_OPTIONS
10885             UBSAN_OPTIONS=$UBSAN_OPTIONS:halt_on_error=0
10886             save_CXXFLAGS=$CXXFLAGS
10887             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10888             save_LIBS=$LIBS
10889             LIBS="$LIBS $KDE4_LIBS"
10890             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
10892             # Prepare meta object data
10893             TSTBASE="tst_exclude_socket_notifiers"
10894             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
10895             ln -fs "${TSTMOC}.hxx"
10896             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10898             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10899 #include <cstdlib>
10900 #include "tst_exclude_socket_notifiers.moc"
10902 int main(int argc, char *argv[])
10904     QCoreApplication app(argc, argv);
10905     exit(tst_processEventsExcludeSocket());
10906     return 0;
10908             ]])],[
10909                 AC_MSG_RESULT([yes])
10910             ],[
10911                 AC_MSG_RESULT([no])
10912                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
10913                 if test -z "$qt4_fix_warning"; then
10914                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
10915                 fi
10916                 qt4_fix_warning=1
10917                 add_warning "  https://bugreports.qt.io/browse/QTBUG-37380 (needed)"
10918                 ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
10920             # Remove meta object data
10921             rm -f "${TSTBASE}."*
10923             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
10925             # Prepare meta object data
10926             TSTBASE="tst_exclude_posted_events"
10927             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
10928             ln -fs "${TSTMOC}.hxx"
10929             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10931             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10932 #include <cstdlib>
10933 #include "tst_exclude_posted_events.moc"
10935 int main(int argc, char *argv[])
10937     QCoreApplication app(argc, argv);
10938     exit(tst_excludePostedEvents());
10939     return 0;
10941             ]])],[
10942                 AC_MSG_RESULT([yes])
10943             ],[
10944                 AC_MSG_RESULT([no])
10945                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
10946                 if test -z "$qt4_fix_warning"; then
10947                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
10948                 fi
10949                 qt4_fix_warning=1
10950                 add_warning "  https://bugreports.qt.io/browse/QTBUG-34614 (needed)"
10951             ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
10953             # Remove meta object data
10954             rm -f "${TSTBASE}."*
10956             if test -n "$qt4_fix_warning"; then
10957                 add_warning "  https://bugreports.qt.io/browse/QTBUG-38585 (recommended)"
10958             fi
10960             LIBS=$save_LIBS
10961             CXXFLAGS=$save_CXXFLAGS
10962             UBSAN_OPTIONS=$save_UBSAN_OPTIONS
10963             CXX=$save_CXX
10964             AC_LANG_POP([C++])
10965         ],
10966         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
10968 AC_SUBST(KDE4_CFLAGS)
10969 AC_SUBST(KDE4_LIBS)
10970 AC_SUBST(MOC4)
10971 AC_SUBST(KDE4_GLIB_CFLAGS)
10972 AC_SUBST(KDE4_GLIB_LIBS)
10973 AC_SUBST(KDE4_HAVE_GLIB)
10975 dnl ===================================================================
10976 dnl QT5 Integration
10977 dnl ===================================================================
10979 QT5_CFLAGS=""
10980 QT5_LIBS=""
10981 QMAKE5="qmake"
10982 MOC5="moc"
10983 QT5_GLIB_CFLAGS=""
10984 QT5_GLIB_LIBS=""
10985 QT5_HAVE_GLIB=""
10986 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
10987         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
10988         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
10989 then
10990     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
10991     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
10993     if test -n "$supports_multilib"; then
10994         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
10995     fi
10997     qt5_test_include="QtWidgets/qapplication.h"
10998     qt5_test_library="libQt5Widgets.so"
11000     dnl Check for qmake5
11001     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
11002     if test "$QMAKE5" = "no"; then
11003         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11004     else
11005         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11006         if test -z "$qmake5_test_ver"; then
11007             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11008         fi
11009         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11010         qt5_minimal_minor="6"
11011         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11012             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11013         else
11014             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11015         fi
11016     fi
11018     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11019     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11021     AC_MSG_CHECKING([for Qt5 headers])
11022     qt5_incdir="no"
11023     for inc_dir in $qt5_incdirs; do
11024         if test -r "$inc_dir/$qt5_test_include"; then
11025             qt5_incdir="$inc_dir"
11026             break
11027         fi
11028     done
11029     AC_MSG_RESULT([$qt5_incdir])
11030     if test "x$qt5_incdir" = "xno"; then
11031         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11032     fi
11034     AC_MSG_CHECKING([for Qt5 libraries])
11035     qt5_libdir="no"
11036     for lib_dir in $qt5_libdirs; do
11037         if test -r "$lib_dir/$qt5_test_library"; then
11038             qt5_libdir="$lib_dir"
11039             break
11040         fi
11041     done
11042     AC_MSG_RESULT([$qt5_libdir])
11043     if test "x$qt5_libdir" = "xno"; then
11044         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11045     fi
11047     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11048     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11050     dnl Check for Meta Object Compiler
11052     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
11053     if test "$MOC5" = "no"; then
11054         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11055 the root of your Qt installation by exporting QT5DIR before running "configure".])
11056     fi
11058     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11059     # Sets also QT5_GLIB_CFLAGS/QT5_GLIB_LIBS if successful.
11060     PKG_CHECK_MODULES(QT5_GLIB,[glib-2.0 >= 2.4],
11061         [
11062             QT5_HAVE_GLIB=1
11063             AC_DEFINE(QT5_HAVE_GLIB,1)
11064         ],
11065         AC_MSG_WARN([[No Glib found, Qt5 support will not use native file pickers!]])
11066     )
11068 AC_SUBST(QT5_CFLAGS)
11069 AC_SUBST(QT5_LIBS)
11070 AC_SUBST(MOC5)
11071 AC_SUBST(QT5_GLIB_CFLAGS)
11072 AC_SUBST(QT5_GLIB_LIBS)
11073 AC_SUBST(QT5_HAVE_GLIB)
11075 dnl ===================================================================
11076 dnl KDE5 Integration
11077 dnl ===================================================================
11079 KF5_CFLAGS=""
11080 KF5_LIBS=""
11081 KF5_CONFIG="kf5-config"
11082 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11083         \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11084         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11085 then
11086     kf5_incdirs="$KF5INC /usr/include/ $x_includes"
11087     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $x_libraries"
11088     if test -n "$supports_multilib"; then
11089         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11090     fi
11092     kf5_test_include="KF5/kcoreaddons_version.h"
11093     kf5_test_library="libKF5CoreAddons.so"
11094     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11096     dnl kf5 KDE4 support compatibility installed
11097     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11098     if test "$KF5_CONFIG" != "no"; then
11099         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11100         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11101     fi
11103     dnl Check for KF5 headers
11104     AC_MSG_CHECKING([for KF5 headers])
11105     kf5_incdir="no"
11106     for kf5_check in $kf5_incdirs; do
11107         if test -r "$kf5_check/$kf5_test_include"; then
11108             kf5_incdir="$kf5_check/KF5"
11109             break
11110         fi
11111     done
11112     AC_MSG_RESULT([$kf5_incdir])
11113     if test "x$kf5_incdir" = "xno"; then
11114         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11115     fi
11117     dnl Check for KF5 libraries
11118     AC_MSG_CHECKING([for KF5 libraries])
11119     kf5_libdir="no"
11120     for kf5_check in $kf5_libdirs; do
11121         if test -r "$kf5_check/$kf5_test_library"; then
11122             kf5_libdir="$kf5_check"
11123             break
11124         fi
11125     done
11127     AC_MSG_RESULT([$kf5_libdir])
11128     if test "x$kf5_libdir" = "xno"; then
11129         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11130     fi
11132     PKG_CHECK_MODULES(KF5_XCB,[xcb],,[AC_MSG_ERROR([XCB not installed])])
11134     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"
11135     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network -lQt5X11Extras $KF5_XCB_LIBS"
11136     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11138     AC_LANG_PUSH([C++])
11139     save_CXXFLAGS=$CXXFLAGS
11140     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11141     AC_MSG_CHECKING([whether KDE is >= 5.0])
11142        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11143 #include <kcoreaddons_version.h>
11145 int main(int argc, char **argv) {
11146        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11147        else return 1;
11149        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11150     CXXFLAGS=$save_CXXFLAGS
11151     AC_LANG_POP([C++])
11153 AC_SUBST(KF5_CFLAGS)
11154 AC_SUBST(KF5_LIBS)
11156 dnl ===================================================================
11157 dnl Test whether to include Evolution 2 support
11158 dnl ===================================================================
11159 AC_MSG_CHECKING([whether to enable evolution 2 support])
11160 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11161     AC_MSG_RESULT([yes])
11162     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11163     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11164     FilterLibs "${GOBJECT_LIBS}"
11165     GOBJECT_LIBS="${filteredlibs}"
11166     ENABLE_EVOAB2="TRUE"
11167 else
11168     ENABLE_EVOAB2=""
11169     AC_MSG_RESULT([no])
11171 AC_SUBST(ENABLE_EVOAB2)
11172 AC_SUBST(GOBJECT_CFLAGS)
11173 AC_SUBST(GOBJECT_LIBS)
11175 dnl ===================================================================
11176 dnl Test which themes to include
11177 dnl ===================================================================
11178 AC_MSG_CHECKING([which themes to include])
11179 # if none given use default subset of available themes
11180 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11181     with_theme="breeze breeze_dark colibre elementary galaxy hicontrast sifr sifr_dark tango"
11182     # test -z "$ENABLE_RELEASE_BUILD" && with_theme="$with_theme tango_testing"
11185 WITH_THEMES=""
11186 if test "x$with_theme" != "xno"; then
11187     for theme in $with_theme; do
11188         case $theme in
11189         breeze|breeze_dark|crystal|colibre|elementary|galaxy|hicontrast|oxygen|sifr|sifr_dark|tango|tango_testing) real_theme="$theme" ;;
11190         default) real_theme=galaxy ;;
11191         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11192         esac
11193         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11194     done
11196 AC_MSG_RESULT([$WITH_THEMES])
11197 AC_SUBST([WITH_THEMES])
11198 # FIXME: remove this, and the convenience default->galaxy remapping after a crace period
11199 for theme in $with_theme; do
11200     case $theme in
11201     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=galaxy]) ;;
11202     *) ;;
11203     esac
11204 done
11206 dnl ===================================================================
11207 dnl Test whether to integrate helppacks into the product's installer
11208 dnl ===================================================================
11209 AC_MSG_CHECKING([for helppack integration])
11210 if test "$with_helppack_integration" = "no"; then
11211     WITH_HELPPACK_INTEGRATION=
11212     AC_MSG_RESULT([no integration])
11213 else
11214     WITH_HELPPACK_INTEGRATION=TRUE
11215     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11216     AC_MSG_RESULT([integration])
11218 AC_SUBST(WITH_HELPPACK_INTEGRATION)
11220 ###############################################################################
11221 # Extensions checking
11222 ###############################################################################
11223 AC_MSG_CHECKING([for extensions integration])
11224 if test "x$enable_extension_integration" != "xno"; then
11225     WITH_EXTENSION_INTEGRATION=TRUE
11226     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11227     AC_MSG_RESULT([yes, use integration])
11228 else
11229     WITH_EXTENSION_INTEGRATION=
11230     AC_MSG_RESULT([no, do not integrate])
11232 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11234 dnl Should any extra extensions be included?
11235 dnl There are standalone tests for each of these below.
11236 WITH_EXTRA_EXTENSIONS=
11237 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11239 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11240 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11241 if test "x$with_java" != "xno"; then
11242     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11243     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11246 TEST_FONTS_MISSING=0
11248 # $1  = font family
11249 # $2+ = accepted font mappings
11250 test_font_map()
11252     FONT="$1" ; shift
11253     AC_MSG_CHECKING([font mapping for '$FONT'])
11254     FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
11255     FONTFILE_LOWER="$(echo $FONTFILE | $AWK '{print tolower($0)}')"
11257     TESTEXPR="'${FONTFILE_LOWER}' = '$(echo $FONT | $AWK '{print tolower($0)}').ttf'"
11258     while test "$#" -ge 1 ; do
11259         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
11260         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
11261     done
11262     if test $TESTEXPR
11263     then
11264         AC_MSG_RESULT([ok])
11265     else
11266         AC_MSG_WARN([unknown ($FONTFILE)])
11267         add_warning "unknown ($FONTFILE)"
11268         TEST_FONTS_MISSING=1
11269     fi
11272 dnl ===================================================================
11273 dnl Test whether to include fonts
11274 dnl ===================================================================
11275 AC_MSG_CHECKING([whether to include third-party fonts])
11276 if test "$with_fonts" != "no"; then
11277     AC_MSG_RESULT([yes])
11278     WITH_FONTS=TRUE
11279     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11280     AC_DEFINE(HAVE_MORE_FONTS)
11281 else
11282     AC_MSG_RESULT([no])
11283     WITH_FONTS=
11284     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11285     if test "$test_fontconfig" = "yes"; then
11286         AC_PATH_PROG([FCMATCH], [fc-match])
11287         if test -z "$FCMATCH"; then
11288             AC_MSG_WARN([Unable to query installed fonts - unit tests disabled.])
11289             TEST_FONTS_MISSING=1
11290         else
11291             test_font_map 'Calibri' 'Carlito'
11292             test_font_map 'DejaVuSans' 'DejaVuSans'
11293             if test ${TEST_FONTS_MISSING} -eq 1
11294             then
11295                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
11296                 add_warning "Unknown font mappings - unit tests disabled."
11297             fi
11298         fi
11299     else
11300         TEST_FONTS_MISSING=1
11301     fi
11303 AC_SUBST(WITH_FONTS)
11304 AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
11307 dnl ===================================================================
11308 dnl Test whether to enable online update service
11309 dnl ===================================================================
11310 AC_MSG_CHECKING([whether to enable online update])
11311 ENABLE_ONLINE_UPDATE=
11312 ENABLE_ONLINE_UPDATE_MAR=
11313 UPDATE_CONFIG=
11314 if test "$enable_online_update" = ""; then
11315     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11316         AC_MSG_RESULT([yes])
11317         ENABLE_ONLINE_UPDATE="TRUE"
11318     else
11319         AC_MSG_RESULT([no])
11320     fi
11321 else
11322     if test "$enable_online_update" = "mar"; then
11323         AC_MSG_RESULT([yes - MAR-based online update])
11324         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11325         if test "$with_update_config" = ""; then
11326             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11327         fi
11328         UPDATE_CONFIG="$with_update_config"
11329         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11330     elif test "$enable_online_update" = "yes"; then
11331         AC_MSG_RESULT([yes])
11332         ENABLE_ONLINE_UPDATE="TRUE"
11333     else
11334         AC_MSG_RESULT([no])
11335     fi
11337 AC_SUBST(ENABLE_ONLINE_UPDATE)
11338 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11339 AC_SUBST(UPDATE_CONFIG)
11341 dnl ===================================================================
11342 dnl Test whether we need bzip2
11343 dnl ===================================================================
11344 SYSTEM_BZIP2=
11345 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11346     AC_MSG_CHECKING([whether to use system bzip2])
11347     if test "$with_system_bzip2" = yes; then
11348         SYSTEM_BZIP2=TRUE
11349         AC_MSG_RESULT([yes])
11350         PKG_CHECK_MODULES(BZIP2, bzip2)
11351         FilterLibs "${BZIP2_LIBS}"
11352         BZIP2_LIBS="${filteredlibs}"
11353     else
11354         AC_MSG_RESULT([no])
11355         BUILD_TYPE="$BUILD_TYPE BZIP2"
11356     fi
11358 AC_SUBST(SYSTEM_BZIP2)
11359 AC_SUBST(BZIP2_CFLAGS)
11360 AC_SUBST(BZIP2_LIBS)
11362 dnl ===================================================================
11363 dnl Test whether to enable extension update
11364 dnl ===================================================================
11365 AC_MSG_CHECKING([whether to enable extension update])
11366 ENABLE_EXTENSION_UPDATE=
11367 if test "x$enable_extension_update" = "xno"; then
11368     AC_MSG_RESULT([no])
11369 else
11370     AC_MSG_RESULT([yes])
11371     ENABLE_EXTENSION_UPDATE="TRUE"
11372     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11373     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11375 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11378 dnl ===================================================================
11379 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11380 dnl ===================================================================
11381 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11382 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11383     AC_MSG_RESULT([no])
11384     ENABLE_SILENT_MSI=
11385 else
11386     AC_MSG_RESULT([yes])
11387     ENABLE_SILENT_MSI=TRUE
11388     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11390 AC_SUBST(ENABLE_SILENT_MSI)
11392 AC_MSG_CHECKING([whether and how to use Xinerama])
11393 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11394     if test "$x_libraries" = "default_x_libraries"; then
11395         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11396         if test "x$XINERAMALIB" = x; then
11397            XINERAMALIB="/usr/lib"
11398         fi
11399     else
11400         XINERAMALIB="$x_libraries"
11401     fi
11402     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11403         # we have both versions, let the user decide but use the dynamic one
11404         # per default
11405         USE_XINERAMA=TRUE
11406         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11407             XINERAMA_LINK=dynamic
11408         else
11409             XINERAMA_LINK=static
11410         fi
11411     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11412         # we have only the dynamic version
11413         USE_XINERAMA=TRUE
11414         XINERAMA_LINK=dynamic
11415     elif test -e "$XINERAMALIB/libXinerama.a"; then
11416         # static version
11417         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11418             USE_XINERAMA=TRUE
11419             XINERAMA_LINK=static
11420         else
11421             USE_XINERAMA=
11422             XINERAMA_LINK=none
11423         fi
11424     else
11425         # no Xinerama
11426         USE_XINERAMA=
11427         XINERAMA_LINK=none
11428     fi
11429     if test "$USE_XINERAMA" = "TRUE"; then
11430         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11431         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11432             [AC_MSG_ERROR(Xinerama header not found.)], [])
11433         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11434         if test "x$XEXTLIB" = x; then
11435            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11436         fi
11437         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11438         if test "$_os" = "FreeBSD"; then
11439             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11440         fi
11441         if test "$_os" = "Linux"; then
11442             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11443         fi
11444         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11445             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11446     else
11447         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11448     fi
11449 else
11450     USE_XINERAMA=
11451     XINERAMA_LINK=none
11452     AC_MSG_RESULT([no])
11454 AC_SUBST(USE_XINERAMA)
11455 AC_SUBST(XINERAMA_LINK)
11457 dnl ===================================================================
11458 dnl Test whether to build cairo or rely on the system version
11459 dnl ===================================================================
11461 if test "$USING_X11" = TRUE; then
11462     # Used in vcl/Library_vclplug_gen.mk
11463     test_cairo=yes
11466 if test "$test_cairo" = "yes"; then
11467     AC_MSG_CHECKING([whether to use the system cairo])
11469     : ${with_system_cairo:=$with_system_libs}
11470     if test "$with_system_cairo" = "yes"; then
11471         SYSTEM_CAIRO=TRUE
11472         AC_MSG_RESULT([yes])
11474         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11475         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11476         FilterLibs "${CAIRO_LIBS}"
11477         CAIRO_LIBS="${filteredlibs}"
11479         if test "$test_xrender" = "yes"; then
11480             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11481             AC_LANG_PUSH([C])
11482             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11483 #ifdef PictStandardA8
11484 #else
11485       return fail;
11486 #endif
11487 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11489             AC_LANG_POP([C])
11490         fi
11491     else
11492         SYSTEM_CAIRO=
11493         AC_MSG_RESULT([no])
11495         BUILD_TYPE="$BUILD_TYPE CAIRO"
11496     fi
11499 AC_SUBST(SYSTEM_CAIRO)
11500 AC_SUBST(CAIRO_CFLAGS)
11501 AC_SUBST(CAIRO_LIBS)
11503 dnl ===================================================================
11504 dnl Test whether to use avahi
11505 dnl ===================================================================
11506 if test "$_os" = "WINNT"; then
11507     # Windows uses bundled mDNSResponder
11508     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11509 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11510     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11511                       [ENABLE_AVAHI="TRUE"])
11512     AC_DEFINE(HAVE_FEATURE_AVAHI)
11513     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11514     FilterLibs "${AVAHI_LIBS}"
11515     AVAHI_LIBS="${filteredlibs}"
11518 AC_SUBST(ENABLE_AVAHI)
11519 AC_SUBST(AVAHI_CFLAGS)
11520 AC_SUBST(AVAHI_LIBS)
11522 dnl ===================================================================
11523 dnl Test whether to use liblangtag
11524 dnl ===================================================================
11525 SYSTEM_LIBLANGTAG=
11526 AC_MSG_CHECKING([whether to use system liblangtag])
11527 if test "$with_system_liblangtag" = yes; then
11528     SYSTEM_LIBLANGTAG=TRUE
11529     AC_MSG_RESULT([yes])
11530     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11531     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11532     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11533     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11534     FilterLibs "${LIBLANGTAG_LIBS}"
11535     LIBLANGTAG_LIBS="${filteredlibs}"
11536 else
11537     SYSTEM_LIBLANGTAG=
11538     AC_MSG_RESULT([no])
11539     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11540     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11541     if test "$COM" = "MSC"; then
11542         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11543     else
11544         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11545     fi
11547 AC_SUBST(SYSTEM_LIBLANGTAG)
11548 AC_SUBST(LIBLANGTAG_CFLAGS)
11549 AC_SUBST(LIBLANGTAG_LIBS)
11551 dnl ===================================================================
11552 dnl Test whether to build libpng or rely on the system version
11553 dnl ===================================================================
11555 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11557 dnl ===================================================================
11558 dnl Check for runtime JVM search path
11559 dnl ===================================================================
11560 if test "$ENABLE_JAVA" != ""; then
11561     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11562     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11563         AC_MSG_RESULT([yes])
11564         if ! test -d "$with_jvm_path"; then
11565             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11566         fi
11567         if ! test -d "$with_jvm_path"jvm; then
11568             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11569         fi
11570         JVM_ONE_PATH_CHECK="$with_jvm_path"
11571         AC_SUBST(JVM_ONE_PATH_CHECK)
11572     else
11573         AC_MSG_RESULT([no])
11574     fi
11577 dnl ===================================================================
11578 dnl Test for the presence of Ant and that it works
11579 dnl ===================================================================
11581 if test "$ENABLE_JAVA" != ""; then
11582     ANT_HOME=; export ANT_HOME
11583     WITH_ANT_HOME=; export WITH_ANT_HOME
11584     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11585         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11586             if test "$_os" = "WINNT"; then
11587                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11588             else
11589                 with_ant_home="$LODE_HOME/opt/ant"
11590             fi
11591         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11592             with_ant_home="$LODE_HOME/opt/ant"
11593         fi
11594     fi
11595     if test -z "$with_ant_home"; then
11596         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11597     else
11598         if test "$_os" = "WINNT"; then
11599             # AC_PATH_PROGS needs unix path
11600             with_ant_home=`cygpath -u "$with_ant_home"`
11601         fi
11602         AbsolutePath "$with_ant_home"
11603         with_ant_home=$absolute_path
11604         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11605         WITH_ANT_HOME=$with_ant_home
11606         ANT_HOME=$with_ant_home
11607     fi
11609     if test -z "$ANT"; then
11610         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11611     else
11612         # resolve relative or absolute symlink
11613         while test -h "$ANT"; do
11614             a_cwd=`pwd`
11615             a_basename=`basename "$ANT"`
11616             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11617             cd "`dirname "$ANT"`"
11618             cd "`dirname "$a_script"`"
11619             ANT="`pwd`"/"`basename "$a_script"`"
11620             cd "$a_cwd"
11621         done
11623         AC_MSG_CHECKING([if $ANT works])
11624         cat > conftest.java << EOF
11625         public class conftest {
11626             int testmethod(int a, int b) {
11627                     return a + b;
11628             }
11629         }
11632         cat > conftest.xml << EOF
11633         <project name="conftest" default="conftest">
11634         <target name="conftest">
11635             <javac srcdir="." includes="conftest.java">
11636             </javac>
11637         </target>
11638         </project>
11641         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11642         if test $? = 0 -a -f ./conftest.class; then
11643             AC_MSG_RESULT([Ant works])
11644             if test -z "$WITH_ANT_HOME"; then
11645                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11646                 if test -z "$ANT_HOME"; then
11647                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11648                 fi
11649             else
11650                 ANT_HOME="$WITH_ANT_HOME"
11651             fi
11652         else
11653             echo "configure: Ant test failed" >&5
11654             cat conftest.java >&5
11655             cat conftest.xml >&5
11656             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11657         fi
11658         rm -f conftest* core core.* *.core
11659     fi
11660     if test -z "$ANT_HOME"; then
11661         ANT_HOME="NO_ANT_HOME"
11662     else
11663         PathFormat "$ANT_HOME"
11664         ANT_HOME="$formatted_path"
11665         PathFormat "$ANT"
11666         ANT="$formatted_path"
11667     fi
11668     AC_SUBST(ANT_HOME)
11669     AC_SUBST(ANT)
11671     dnl Checking for ant.jar
11672     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11673         AC_MSG_CHECKING([Ant lib directory])
11674         if test -f $ANT_HOME/lib/ant.jar; then
11675             ANT_LIB="$ANT_HOME/lib"
11676         else
11677             if test -f $ANT_HOME/ant.jar; then
11678                 ANT_LIB="$ANT_HOME"
11679             else
11680                 if test -f /usr/share/java/ant.jar; then
11681                     ANT_LIB=/usr/share/java
11682                 else
11683                     if test -f /usr/share/ant-core/lib/ant.jar; then
11684                         ANT_LIB=/usr/share/ant-core/lib
11685                     else
11686                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11687                             ANT_LIB="$ANT_HOME/lib/ant"
11688                         else
11689                             if test -f /usr/share/lib/ant/ant.jar; then
11690                                 ANT_LIB=/usr/share/lib/ant
11691                             else
11692                                 AC_MSG_ERROR([Ant libraries not found!])
11693                             fi
11694                         fi
11695                     fi
11696                 fi
11697             fi
11698         fi
11699         PathFormat "$ANT_LIB"
11700         ANT_LIB="$formatted_path"
11701         AC_MSG_RESULT([Ant lib directory found.])
11702     fi
11703     AC_SUBST(ANT_LIB)
11705     ant_minver=1.6.0
11706     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11708     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11709     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11710     ant_version_major=`echo $ant_version | cut -d. -f1`
11711     ant_version_minor=`echo $ant_version | cut -d. -f2`
11712     echo "configure: ant_version $ant_version " >&5
11713     echo "configure: ant_version_major $ant_version_major " >&5
11714     echo "configure: ant_version_minor $ant_version_minor " >&5
11715     if test "$ant_version_major" -ge "2"; then
11716         AC_MSG_RESULT([yes, $ant_version])
11717     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11718         AC_MSG_RESULT([yes, $ant_version])
11719     else
11720         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11721     fi
11723     rm -f conftest* core core.* *.core
11726 OOO_JUNIT_JAR=
11727 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11728     AC_MSG_CHECKING([for JUnit 4])
11729     if test "$with_junit" = "yes"; then
11730         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
11731             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
11732         elif test -e /usr/share/java/junit4.jar; then
11733             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11734         else
11735            if test -e /usr/share/lib/java/junit.jar; then
11736               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11737            else
11738               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11739            fi
11740         fi
11741     else
11742         OOO_JUNIT_JAR=$with_junit
11743     fi
11744     if test "$_os" = "WINNT"; then
11745         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11746     fi
11747     printf 'import org.junit.Before;' > conftest.java
11748     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11749         AC_MSG_RESULT([$OOO_JUNIT_JAR])
11750     else
11751         AC_MSG_ERROR(
11752 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
11753  specify its pathname via --with-junit=..., or disable it via --without-junit])
11754     fi
11755     rm -f conftest.class conftest.java
11756     if test $OOO_JUNIT_JAR != ""; then
11757     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11758     fi
11760 AC_SUBST(OOO_JUNIT_JAR)
11762 HAMCREST_JAR=
11763 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11764     AC_MSG_CHECKING([for included Hamcrest])
11765     printf 'import org.hamcrest.BaseDescription;' > conftest.java
11766     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11767         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
11768     else
11769         AC_MSG_RESULT([Not included])
11770         AC_MSG_CHECKING([for standalone hamcrest jar.])
11771         if test "$with_hamcrest" = "yes"; then
11772             if test -e /usr/share/lib/java/hamcrest.jar; then
11773                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
11774             elif test -e /usr/share/java/hamcrest/core.jar; then
11775                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
11776             else
11777                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
11778             fi
11779         else
11780             HAMCREST_JAR=$with_hamcrest
11781         fi
11782         if test "$_os" = "WINNT"; then
11783             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
11784         fi
11785         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
11786             AC_MSG_RESULT([$HAMCREST_JAR])
11787         else
11788             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),
11789                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
11790         fi
11791     fi
11792     rm -f conftest.class conftest.java
11794 AC_SUBST(HAMCREST_JAR)
11797 AC_SUBST(SCPDEFS)
11800 # check for wget and curl
11802 WGET=
11803 CURL=
11805 if test "$enable_fetch_external" != "no"; then
11807 CURL=`which curl 2>/dev/null`
11809 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
11810     # wget new enough?
11811     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
11812     if test $? -eq 0; then
11813         WGET=$i
11814         break
11815     fi
11816 done
11818 if test -z "$WGET" -a -z "$CURL"; then
11819     AC_MSG_ERROR([neither wget nor curl found!])
11824 AC_SUBST(WGET)
11825 AC_SUBST(CURL)
11828 # check for sha256sum
11830 SHA256SUM=
11832 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
11833     eval "$i -a 256 --version" > /dev/null 2>&1
11834     ret=$?
11835     if test $ret -eq 0; then
11836         SHA256SUM="$i -a 256"
11837         break
11838     fi
11839 done
11841 if test -z "$SHA256SUM"; then
11842     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
11843         eval "$i --version" > /dev/null 2>&1
11844         ret=$?
11845         if test $ret -eq 0; then
11846             SHA256SUM=$i
11847             break
11848         fi
11849     done
11852 if test -z "$SHA256SUM"; then
11853     AC_MSG_ERROR([no sha256sum found!])
11856 AC_SUBST(SHA256SUM)
11858 dnl ===================================================================
11859 dnl Dealing with l10n options
11860 dnl ===================================================================
11861 AC_MSG_CHECKING([which languages to be built])
11862 # get list of all languages
11863 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
11864 # the sed command does the following:
11865 #   + if a line ends with a backslash, append the next line to it
11866 #   + adds " on the beginning of the value (after =)
11867 #   + adds " at the end of the value
11868 #   + removes en-US; we want to put it on the beginning
11869 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
11870 [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)]
11871 ALL_LANGS="en-US $completelangiso"
11872 # check the configured localizations
11873 WITH_LANG="$with_lang"
11874 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
11875     AC_MSG_RESULT([en-US])
11876 else
11877     AC_MSG_RESULT([$WITH_LANG])
11878     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
11879     if test -z "$MSGFMT"; then
11880         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
11881             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
11882         elif test -x "/opt/lo/bin/msgfmt"; then
11883             MSGFMT="/opt/lo/bin/msgfmt"
11884         else
11885             AC_CHECK_PROGS(MSGFMT, [msgfmt])
11886             if test -z "$MSGFMT"; then
11887                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
11888             fi
11889         fi
11890     fi
11891     if test -z "$MSGUNIQ"; then
11892         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
11893             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
11894         elif test -x "/opt/lo/bin/msguniq"; then
11895             MSGUNIQ="/opt/lo/bin/msguniq"
11896         else
11897             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
11898             if test -z "$MSGUNIQ"; then
11899                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
11900             fi
11901         fi
11902     fi
11904 AC_SUBST(MSGFMT)
11905 AC_SUBST(MSGUNIQ)
11906 # check that the list is valid
11907 for lang in $WITH_LANG; do
11908     test "$lang" = "ALL" && continue
11909     # need to check for the exact string, so add space before and after the list of all languages
11910     for vl in $ALL_LANGS; do
11911         if test "$vl" = "$lang"; then
11912            break
11913         fi
11914     done
11915     if test "$vl" != "$lang"; then
11916         # if you're reading this - you prolly quoted your languages remove the quotes ...
11917         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
11918     fi
11919 done
11920 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
11921     echo $WITH_LANG | grep -q en-US
11922     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
11924 # list with substituted ALL
11925 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
11926 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
11927 test "$WITH_LANG" = "en-US" && WITH_LANG=
11928 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
11929     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
11930     ALL_LANGS=`echo $ALL_LANGS qtz`
11932 AC_SUBST(ALL_LANGS)
11933 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
11934 AC_SUBST(WITH_LANG)
11935 AC_SUBST(WITH_LANG_LIST)
11936 AC_SUBST(GIT_NEEDED_SUBMODULES)
11938 WITH_POOR_HELP_LOCALIZATIONS=
11939 if test -d "$SRC_ROOT/translations/source"; then
11940     for l in `ls -1 $SRC_ROOT/translations/source`; do
11941         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
11942             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
11943         fi
11944     done
11946 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
11948 if test -n "$with_locales"; then
11949     WITH_LOCALES="$with_locales"
11951     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
11952     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
11953     # config_host/config_locales.h.in
11954     for locale in $WITH_LOCALES; do
11955         lang=${locale%_*}
11957         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
11959         case $lang in
11960         hi|mr*ne)
11961             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
11962             ;;
11963         bg|ru)
11964             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
11965             ;;
11966         esac
11967     done
11968 else
11969     AC_DEFINE(WITH_LOCALE_ALL)
11971 AC_SUBST(WITH_LOCALES)
11973 dnl git submodule update --reference
11974 dnl ===================================================================
11975 if test -n "${GIT_REFERENCE_SRC}"; then
11976     for repo in ${GIT_NEEDED_SUBMODULES}; do
11977         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
11978             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
11979         fi
11980     done
11982 AC_SUBST(GIT_REFERENCE_SRC)
11984 dnl git submodules linked dirs
11985 dnl ===================================================================
11986 if test -n "${GIT_LINK_SRC}"; then
11987     for repo in ${GIT_NEEDED_SUBMODULES}; do
11988         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
11989             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
11990         fi
11991     done
11993 AC_SUBST(GIT_LINK_SRC)
11995 dnl branding
11996 dnl ===================================================================
11997 AC_MSG_CHECKING([for alternative branding images directory])
11998 # initialize mapped arrays
11999 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12000 brand_files="$BRAND_INTRO_IMAGES about.svg"
12002 if test -z "$with_branding" -o "$with_branding" = "no"; then
12003     AC_MSG_RESULT([none])
12004     DEFAULT_BRAND_IMAGES="$brand_files"
12005 else
12006     if ! test -d $with_branding ; then
12007         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12008     else
12009         AC_MSG_RESULT([$with_branding])
12010         CUSTOM_BRAND_DIR="$with_branding"
12011         for lfile in $brand_files
12012         do
12013             if ! test -f $with_branding/$lfile ; then
12014                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12015                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12016             else
12017                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12018             fi
12019         done
12020         check_for_progress="yes"
12021     fi
12023 AC_SUBST([BRAND_INTRO_IMAGES])
12024 AC_SUBST([CUSTOM_BRAND_DIR])
12025 AC_SUBST([CUSTOM_BRAND_IMAGES])
12026 AC_SUBST([DEFAULT_BRAND_IMAGES])
12029 AC_MSG_CHECKING([for 'intro' progress settings])
12030 PROGRESSBARCOLOR=
12031 PROGRESSSIZE=
12032 PROGRESSPOSITION=
12033 PROGRESSFRAMECOLOR=
12034 PROGRESSTEXTCOLOR=
12035 PROGRESSTEXTBASELINE=
12037 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12038     source "$with_branding/progress.conf"
12039     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12040 else
12041     AC_MSG_RESULT([none])
12044 AC_SUBST(PROGRESSBARCOLOR)
12045 AC_SUBST(PROGRESSSIZE)
12046 AC_SUBST(PROGRESSPOSITION)
12047 AC_SUBST(PROGRESSFRAMECOLOR)
12048 AC_SUBST(PROGRESSTEXTCOLOR)
12049 AC_SUBST(PROGRESSTEXTBASELINE)
12052 AC_MSG_CHECKING([for extra build ID])
12053 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12054     EXTRA_BUILDID="$with_extra_buildid"
12056 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12057 if test -n "$EXTRA_BUILDID" ; then
12058     AC_MSG_RESULT([$EXTRA_BUILDID])
12059 else
12060     AC_MSG_RESULT([not set])
12062 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12064 OOO_VENDOR=
12065 AC_MSG_CHECKING([for vendor])
12066 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12067     OOO_VENDOR="$USERNAME"
12069     if test -z "$OOO_VENDOR"; then
12070         OOO_VENDOR="$USER"
12071     fi
12073     if test -z "$OOO_VENDOR"; then
12074         OOO_VENDOR="`id -u -n`"
12075     fi
12077     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12078 else
12079     OOO_VENDOR="$with_vendor"
12080     AC_MSG_RESULT([$OOO_VENDOR])
12082 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12083 AC_SUBST(OOO_VENDOR)
12085 if test "$_os" = "Android" ; then
12086     ANDROID_PACKAGE_NAME=
12087     AC_MSG_CHECKING([for Android package name])
12088     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12089         if test -n "$ENABLE_DEBUG"; then
12090             # Default to the package name that makes ndk-gdb happy.
12091             ANDROID_PACKAGE_NAME="org.libreoffice"
12092         else
12093             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12094         fi
12096         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12097     else
12098         ANDROID_PACKAGE_NAME="$with_android_package_name"
12099         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12100     fi
12101     AC_SUBST(ANDROID_PACKAGE_NAME)
12104 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12105 if test "$with_compat_oowrappers" = "yes"; then
12106     WITH_COMPAT_OOWRAPPERS=TRUE
12107     AC_MSG_RESULT(yes)
12108 else
12109     WITH_COMPAT_OOWRAPPERS=
12110     AC_MSG_RESULT(no)
12112 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12114 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12115 AC_MSG_CHECKING([for install dirname])
12116 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12117     INSTALLDIRNAME="$with_install_dirname"
12119 AC_MSG_RESULT([$INSTALLDIRNAME])
12120 AC_SUBST(INSTALLDIRNAME)
12122 AC_MSG_CHECKING([for prefix])
12123 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12124 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12125 PREFIXDIR="$prefix"
12126 AC_MSG_RESULT([$PREFIXDIR])
12127 AC_SUBST(PREFIXDIR)
12129 LIBDIR=[$(eval echo $(eval echo $libdir))]
12130 AC_SUBST(LIBDIR)
12132 DATADIR=[$(eval echo $(eval echo $datadir))]
12133 AC_SUBST(DATADIR)
12135 MANDIR=[$(eval echo $(eval echo $mandir))]
12136 AC_SUBST(MANDIR)
12138 DOCDIR=[$(eval echo $(eval echo $docdir))]
12139 AC_SUBST(DOCDIR)
12141 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12142 AC_SUBST(INSTALLDIR)
12144 TESTINSTALLDIR="${BUILDDIR}/test-install"
12145 AC_SUBST(TESTINSTALLDIR)
12148 # ===================================================================
12149 # OAuth2 id and secrets
12150 # ===================================================================
12152 AC_MSG_CHECKING([for Google Drive client id and secret])
12153 GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12154 GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12155 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12156     GDRIVE_CLIENT_ID="\"\""
12159 if test "$with_gdrive_client_secret" = "no" -o -z "$with_gdrive_client_secret"; then
12160     GDRIVE_CLIENT_SECRET="\"\""
12163 if test -z "$GDRIVE_CLIENT_ID" -o -z "$GDRIVE_CLIENT_SECRET"; then
12164     AC_MSG_RESULT([not set])
12165 else
12166     AC_MSG_RESULT([set])
12169 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12170 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12172 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12173 ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12174 ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12175 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12176     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12179 if test "$with_alfresco_cloud_client_secret" = "no" -o -z "$with_alfresco_cloud_client_secret"; then
12180     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12183 if test -z "$ALFRESCO_CLOUD_CLIENT_ID" -o -z "$ALFRESCO_CLOUD_CLIENT_SECRET"; then
12184     AC_MSG_RESULT([not set])
12185 else
12186     AC_MSG_RESULT([set])
12188 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12189 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12191 AC_MSG_CHECKING([for OneDrive client id and secret])
12192 ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12193 ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12194 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12195     ONEDRIVE_CLIENT_ID="\"\""
12198 if test "$with_onedrive_client_secret" = "no" -o -z "$with_onedrive_client_secret"; then
12199     ONEDRIVE_CLIENT_SECRET="\"\""
12202 if test -z "$ONEDRIVE_CLIENT_ID" -o -z "$ONEDRIVE_CLIENT_SECRET"; then
12203     AC_MSG_RESULT([not set])
12204 else
12205     AC_MSG_RESULT([set])
12207 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12208 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12211 dnl ===================================================================
12212 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12213 dnl --enable-dependency-tracking configure option
12214 dnl ===================================================================
12215 AC_MSG_CHECKING([whether to enable dependency tracking])
12216 if test "$enable_dependency_tracking" = "no"; then
12217     nodep=TRUE
12218     AC_MSG_RESULT([no])
12219 else
12220     AC_MSG_RESULT([yes])
12222 AC_SUBST(nodep)
12224 dnl ===================================================================
12225 dnl Number of CPUs to use during the build
12226 dnl ===================================================================
12227 AC_MSG_CHECKING([for number of processors to use])
12228 # plain --with-parallelism is just the default
12229 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12230     if test "$with_parallelism" = "no"; then
12231         PARALLELISM=0
12232     else
12233         PARALLELISM=$with_parallelism
12234     fi
12235 else
12236     if test "$enable_icecream" = "yes"; then
12237         PARALLELISM="10"
12238     else
12239         case `uname -s` in
12241         Darwin|FreeBSD|NetBSD|OpenBSD)
12242             PARALLELISM=`sysctl -n hw.ncpu`
12243             ;;
12245         Linux)
12246             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12247         ;;
12248         # what else than above does profit here *and* has /proc?
12249         *)
12250             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12251             ;;
12252         esac
12254         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12255         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12256     fi
12259 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12260     if test -z "$with_parallelism"; then
12261             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12262             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12263             PARALLELISM="1"
12264     else
12265         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."
12266     fi
12269 if test $PARALLELISM -eq 0; then
12270     AC_MSG_RESULT([explicit make -j option needed])
12271 else
12272     AC_MSG_RESULT([$PARALLELISM])
12274 AC_SUBST(PARALLELISM)
12276 IWYU_PATH="$with_iwyu"
12277 AC_SUBST(IWYU_PATH)
12278 if test ! -z "$IWYU_PATH"; then
12279     if test ! -f "$IWYU_PATH"; then
12280         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12281     fi
12285 # Set up ILIB for MSVC build
12287 ILIB1=
12288 if test "$build_os" = "cygwin"; then
12289     ILIB="."
12290     if test -n "$JAVA_HOME"; then
12291         ILIB="$ILIB;$JAVA_HOME/lib"
12292     fi
12293     ILIB1=-link
12294     if test "$BITNESS_OVERRIDE" = 64; then
12295         if test $vcnum = "150"; then
12296             ILIB="$ILIB;$COMPATH/lib/x64"
12297             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12298         else
12299             ILIB="$ILIB;$COMPATH/lib/amd64"
12300             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/amd64"
12301         fi
12302         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12303         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12304         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12305             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12306             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12307         fi
12308         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12309         ucrtlibpath_formatted=$formatted_path
12310         ILIB="$ILIB;$ucrtlibpath_formatted"
12311         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12312     else
12313         if test $vcnum = "150"; then
12314             ILIB="$ILIB;$COMPATH/lib/x86"
12315             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12316         else
12317             ILIB="$ILIB;$COMPATH/lib"
12318             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib"
12319         fi
12320         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12321         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12322         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12323             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12324             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12325         fi
12326         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12327         ucrtlibpath_formatted=$formatted_path
12328         ILIB="$ILIB;$ucrtlibpath_formatted"
12329         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12330     fi
12331     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12332         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12333     else
12334         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12335     fi
12337     AC_SUBST(ILIB)
12340 dnl We should be able to drop the below check when bumping the GCC baseline to
12341 dnl 4.9, as <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54577>
12342 dnl "deque<T>::erase() still takes iterator instead of const_iterator" should be
12343 dnl fixed there with <https://gcc.gnu.org/git/?p=gcc.git;a=commit;
12344 dnl h=6b0e18ca48bb4b4c01e7b5be2b98849943fdcf91>:
12345 AC_MSG_CHECKING(
12346     [whether C++11 use of const_iterator in standard containers is broken])
12347 save_CXXFLAGS=$CXXFLAGS
12348 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12349 AC_LANG_PUSH([C++])
12350 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12351     #include <list>
12352     ]],[[
12353         std::list<int> l;
12354         l.erase(l.cbegin());
12355     ]])],
12356     [broken=no], [broken=yes])
12357 AC_LANG_POP([C++])
12358 CXXFLAGS=$save_CXXFLAGS
12359 AC_MSG_RESULT([$broken])
12360 if test "$broken" = yes; then
12361     AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
12365 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12366 save_CXXFLAGS=$CXXFLAGS
12367 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12368 save_LIBS=$LIBS
12369 if test -n "$ILIB1"; then
12370     LIBS="$LIBS $ILIB1"
12372 AC_LANG_PUSH([C++])
12373 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12374     // Exit with failure if the static initializer_list is stored on the
12375     // stack (as done by Clang < 3.4):
12376     #include <initializer_list>
12377     struct S {};
12378     bool g(void const * p1, void const * p2) {
12379         int n;
12380         return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12381     }
12382     bool f(void const * p1) {
12383         static std::initializer_list<S> s { S() };
12384         return g(p1, s.begin());
12385     }
12386     ]],[[
12387         int n;
12388         return f(&n) ? 0 : 1;
12389     ]])], [broken=no], [broken=yes],[broken='assuming not (cross-compiling)'])
12390 AC_LANG_POP([C++])
12391 LIBS=$save_LIBS
12392 CXXFLAGS=$save_CXXFLAGS
12393 AC_MSG_RESULT([$broken])
12394 if test "$broken" = yes -a "$_os" != "iOS"; then
12395     AC_MSG_ERROR([working support for static initializer_list needed])
12399 # ===================================================================
12400 # Creating bigger shared library to link against
12401 # ===================================================================
12402 AC_MSG_CHECKING([whether to create huge library])
12403 MERGELIBS=
12405 if test $_os = iOS -o $_os = Android; then
12406     # Never any point in mergelibs for these as we build just static
12407     # libraries anyway...
12408     enable_mergelibs=no
12411 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12412     if test $_os != Linux -a $_os != WINNT; then
12413         add_warning "--enable-mergelibs is not tested for this platform"
12414     fi
12415     MERGELIBS="TRUE"
12416     AC_MSG_RESULT([yes])
12417 else
12418     AC_MSG_RESULT([no])
12420 AC_SUBST([MERGELIBS])
12422 dnl ===================================================================
12423 dnl icerun is a wrapper that stops us spawning tens of processes
12424 dnl locally - for tools that can't be executed on the compile cluster
12425 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12426 dnl ===================================================================
12427 AC_MSG_CHECKING([whether to use icerun wrapper])
12428 ICECREAM_RUN=
12429 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12430     ICECREAM_RUN=icerun
12431     AC_MSG_RESULT([yes])
12432 else
12433     AC_MSG_RESULT([no])
12435 AC_SUBST(ICECREAM_RUN)
12437 dnl ===================================================================
12438 dnl Setup the ICECC_VERSION for the build the same way it was set for
12439 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12440 dnl ===================================================================
12441 x_ICECC_VERSION=[\#]
12442 if test -n "$ICECC_VERSION" ; then
12443     x_ICECC_VERSION=
12445 AC_SUBST(x_ICECC_VERSION)
12446 AC_SUBST(ICECC_VERSION)
12448 dnl ===================================================================
12450 AC_MSG_CHECKING([MPL subset])
12451 MPL_SUBSET=
12453 if test "$enable_mpl_subset" = "yes"; then
12454     warn_report=false
12455     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12456         warn_report=true
12457     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12458         warn_report=true
12459     fi
12460     if test "$warn_report" = "true"; then
12461         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12462     fi
12463     if test "x$enable_postgresql_sdbc" != "xno"; then
12464         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12465     fi
12466     if test "$enable_lotuswordpro" = "yes"; then
12467         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12468     fi
12469     if test "$WITH_WEBDAV" = "neon"; then
12470         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12471     fi
12472     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12473         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12474     fi
12475     if test -n "$ENABLE_PDFIMPORT"; then
12476         if test "x$SYSTEM_POPPLER" = "x"; then
12477             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12478         fi
12479     fi
12480     # cf. m4/libo_check_extension.m4
12481     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12482         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12483     fi
12484     for theme in $WITH_THEMES; do
12485         case $theme in
12486         breeze|crystal|default|hicontrast|oxygen|sifr)
12487             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12488         *) : ;;
12489         esac
12490     done
12492     ENABLE_OPENGL_TRANSITIONS=
12494     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12495         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12496     fi
12498     MPL_SUBSET="TRUE"
12499     AC_DEFINE(MPL_HAVE_SUBSET)
12500     AC_MSG_RESULT([only])
12501 else
12502     AC_MSG_RESULT([no restrictions])
12504 AC_SUBST(MPL_SUBSET)
12506 dnl ===================================================================
12508 AC_MSG_CHECKING([formula logger])
12509 ENABLE_FORMULA_LOGGER=
12511 if test "x$enable_formula_logger" = "xyes"; then
12512     AC_MSG_RESULT([yes])
12513     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12514     ENABLE_FORMULA_LOGGER=TRUE
12515 elif test -n "$ENABLE_DBGUTIL" ; then
12516     AC_MSG_RESULT([yes])
12517     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12518     ENABLE_FORMULA_LOGGER=TRUE
12519 else
12520     AC_MSG_RESULT([no])
12523 AC_SUBST(ENABLE_FORMULA_LOGGER)
12525 dnl ===================================================================
12526 dnl Setting up the environment.
12527 dnl ===================================================================
12528 AC_MSG_NOTICE([setting up the build environment variables...])
12530 AC_SUBST(COMPATH)
12532 if test "$build_os" = "cygwin"; then
12533     if test -d "$COMPATH/atlmfc/lib"; then
12534         ATL_LIB="$COMPATH/atlmfc/lib"
12535         ATL_INCLUDE="$COMPATH/atlmfc/include"
12536     else
12537         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12538         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12539     fi
12540     if test "$BITNESS_OVERRIDE" = 64; then
12541         if test $VCVER = "150"; then
12542             ATL_LIB="$ATL_LIB/x64"
12543         else
12544             ATL_LIB="$ATL_LIB/amd64"
12545         fi
12546     else
12547         if test $VCVER = "150"; then
12548             ATL_LIB="$ATL_LIB/x86"
12549         fi
12550     fi
12551     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12552     PathFormat "/usr/bin/find.exe"
12553     FIND="$formatted_path"
12554     PathFormat "/usr/bin/sort.exe"
12555     SORT="$formatted_path"
12556     PathFormat "/usr/bin/grep.exe"
12557     WIN_GREP="$formatted_path"
12558     PathFormat "/usr/bin/ls.exe"
12559     WIN_LS="$formatted_path"
12560     PathFormat "/usr/bin/touch.exe"
12561     WIN_TOUCH="$formatted_path"
12562 else
12563     FIND=find
12564     SORT=sort
12567 AC_SUBST(ATL_INCLUDE)
12568 AC_SUBST(ATL_LIB)
12569 AC_SUBST(FIND)
12570 AC_SUBST(SORT)
12571 AC_SUBST(WIN_GREP)
12572 AC_SUBST(WIN_LS)
12573 AC_SUBST(WIN_TOUCH)
12575 AC_SUBST(BUILD_TYPE)
12577 AC_SUBST(SOLARINC)
12579 PathFormat "$PERL"
12580 PERL="$formatted_path"
12581 AC_SUBST(PERL)
12583 if test -n "$TMPDIR"; then
12584     TEMP_DIRECTORY="$TMPDIR"
12585 else
12586     TEMP_DIRECTORY="/tmp"
12588 if test "$build_os" = "cygwin"; then
12589     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12591 AC_SUBST(TEMP_DIRECTORY)
12593 # setup the PATH for the environment
12594 if test -n "$LO_PATH_FOR_BUILD"; then
12595     LO_PATH="$LO_PATH_FOR_BUILD"
12596 else
12597     LO_PATH="$PATH"
12599     case "$host_os" in
12601     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12602         if test "$ENABLE_JAVA" != ""; then
12603             pathmunge "$JAVA_HOME/bin" "after"
12604         fi
12605         ;;
12607     cygwin*)
12608         # Win32 make needs native paths
12609         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12610             LO_PATH=`cygpath -p -m "$PATH"`
12611         fi
12612         if test "$BITNESS_OVERRIDE" = 64; then
12613             # needed for msi packaging
12614             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12615         fi
12616         # .NET 4.6 and higher don't have bin directory
12617         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12618             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12619         fi
12620         pathmunge "$ASM_HOME" "before"
12621         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12622         pathmunge "$CSC_PATH" "before"
12623         pathmunge "$MIDL_PATH" "before"
12624         pathmunge "$AL_PATH" "before"
12625         pathmunge "$MSPDB_PATH" "before"
12626         if test -n "$MSBUILD_PATH" ; then
12627             pathmunge "$MSBUILD_PATH" "before"
12628         fi
12629         if test "$BITNESS_OVERRIDE" = 64; then
12630             pathmunge "$COMPATH/bin/amd64" "before"
12631             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12632         else
12633             pathmunge "$COMPATH/bin" "before"
12634             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12635         fi
12636         if test "$ENABLE_JAVA" != ""; then
12637             if test -d "$JAVA_HOME/jre/bin/client"; then
12638                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12639             fi
12640             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12641                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12642             fi
12643             pathmunge "$JAVA_HOME/bin" "before"
12644         fi
12645         ;;
12647     solaris*)
12648         pathmunge "/usr/css/bin" "before"
12649         if test "$ENABLE_JAVA" != ""; then
12650             pathmunge "$JAVA_HOME/bin" "after"
12651         fi
12652         ;;
12653     esac
12656 AC_SUBST(LO_PATH)
12658 libo_FUZZ_SUMMARY
12660 # Generate a configuration sha256 we can use for deps
12661 if test -f config_host.mk; then
12662     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12664 if test -f config_host_lang.mk; then
12665     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12668 CFLAGS=$my_original_CFLAGS
12669 CXXFLAGS=$my_original_CXXFLAGS
12670 CPPFLAGS=$my_original_CPPFLAGS
12672 AC_CONFIG_FILES([config_host.mk
12673                  config_host_lang.mk
12674                  Makefile
12675                  lo.xcent
12676                  bin/bffvalidator.sh
12677                  bin/odfvalidator.sh
12678                  bin/officeotron.sh
12679                  instsetoo_native/util/openoffice.lst
12680                  sysui/desktop/macosx/Info.plist])
12681 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12682 AC_CONFIG_HEADERS([config_host/config_clang.h])
12683 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12684 AC_CONFIG_HEADERS([config_host/config_eot.h])
12685 AC_CONFIG_HEADERS([config_host/config_extension_update.h])
12686 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12687 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12688 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12689 AC_CONFIG_HEADERS([config_host/config_features.h])
12690 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12691 AC_CONFIG_HEADERS([config_host/config_folders.h])
12692 AC_CONFIG_HEADERS([config_host/config_gio.h])
12693 AC_CONFIG_HEADERS([config_host/config_global.h])
12694 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12695 AC_CONFIG_HEADERS([config_host/config_java.h])
12696 AC_CONFIG_HEADERS([config_host/config_langs.h])
12697 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12698 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12699 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12700 AC_CONFIG_HEADERS([config_host/config_locales.h])
12701 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12702 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12703 AC_CONFIG_HEADERS([config_host/config_qt5.h])
12704 AC_CONFIG_HEADERS([config_host/config_kde5.h])
12705 AC_CONFIG_HEADERS([config_host/config_gtk3_kde5.h])
12706 AC_CONFIG_HEADERS([config_host/config_oox.h])
12707 AC_CONFIG_HEADERS([config_host/config_options.h])
12708 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12709 AC_CONFIG_HEADERS([config_host/config_test.h])
12710 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12711 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12712 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12713 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12714 AC_CONFIG_HEADERS([config_host/config_version.h])
12715 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12716 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12717 AC_CONFIG_HEADERS([config_host/config_python.h])
12718 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12719 AC_OUTPUT
12721 if test "$CROSS_COMPILING" = TRUE; then
12722     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12725 # touch the config timestamp file
12726 if test ! -f config_host.mk.stamp; then
12727     echo > config_host.mk.stamp
12728 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12729     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12730 else
12731     echo > config_host.mk.stamp
12734 # touch the config lang timestamp file
12735 if test ! -f config_host_lang.mk.stamp; then
12736     echo > config_host_lang.mk.stamp
12737 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12738     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12739 else
12740     echo > config_host_lang.mk.stamp
12744 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12746 cat << _EOS
12747 ****************************************************************************
12748 WARNING:
12749 Your make version is known to be horribly slow, and hard to debug
12750 problems with. To get a reasonably functional make please do:
12752 to install a pre-compiled binary make for Win32
12754  mkdir -p /opt/lo/bin
12755  cd /opt/lo/bin
12756  wget https://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
12757  cp make-85047eb-msvc.exe make
12758  chmod +x make
12760 to install from source:
12761 place yourself in a working directory of you choice.
12763  git clone git://git.savannah.gnu.org/make.git
12765  [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"]
12766  set PATH=%PATH%;C:\Cygwin\bin
12767  [or Cygwin64, if that is what you have]
12768  cd path-to-make-repo-you-cloned-above
12769  build_w32.bat --without-guile
12771 should result in a WinRel/gnumake.exe.
12772 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12774 Then re-run autogen.sh
12776 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12777 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12779 _EOS
12782 cat << _EOF
12783 ****************************************************************************
12785 To build, run:
12786 $GNUMAKE
12788 To view some help, run:
12789 $GNUMAKE help
12791 _EOF
12793 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12794     cat << _EOF
12795 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12796 _EOF
12798     if test $_os = Darwin; then
12799         echo open instdir/$PRODUCTNAME.app
12800     else
12801         echo instdir/program/soffice
12802     fi
12803     cat << _EOF
12805 If you want to run the smoketest, run:
12806 $GNUMAKE check
12808 _EOF
12811 if test -f warn; then
12812     cat warn
12813     rm warn
12816 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: