Bump version to 6.1.7.29
[libreoffice.git] / configure.ac
blob627e5ddba65019bcfa74d36b49e685dccf79522d
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 102 -*-
2 dnl configure.ac serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 # The version number in the second argument to AC_INIT should be four numbers separated by
6 # periods. Some parts of the code requires the first one to be less than 128 and the others to be less
7 # than 256. The four numbers can optionally be followed by a period and a free-form string containing
8 # no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
9 # several non-alphanumeric characters, those are split off and used only for the
10 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
12 AC_INIT([LibreOffice powered by CIB],[6.1.7.29],[],[],[https://libreoffice.cib.eu/])
14 AC_PREREQ([2.59])
16 if test -n "$BUILD_TYPE"; then
17     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
20 save_CC=$CC
21 save_CXX=$CXX
23 BUILD_TYPE="LibO"
24 SCPDEFS=""
25 GIT_NEEDED_SUBMODULES=""
26 LO_PATH= # used by path_munge to construct a PATH variable
28 FilterLibs()
30     filteredlibs=
31     for f in $1; do
32         case "$f" in
33             # let's start with Fedora's paths for now
34             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
35                 # ignore it: on UNIXoids it is searched by default anyway
36                 # but if it's given explicitly then it may override other paths
37                 # (on Mac OS X it would be an error to use it instead of SDK)
38                 ;;
39             *)
40                 filteredlibs="$filteredlibs $f"
41                 ;;
42         esac
43     done
46 PathFormat()
48     formatted_path="$1"
49     if test "$build_os" = "cygwin"; then
50         pf_conv_to_dos=
51         # spaces,parentheses,brackets,braces are problematic in pathname
52         # so are backslashes
53         case "$formatted_path" in
54             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
55                 pf_conv_to_dos="yes"
56             ;;
57         esac
58         if test "$pf_conv_to_dos" = "yes"; then
59             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
60                 formatted_path=`cygpath -sm "$formatted_path"`
61             else
62                 formatted_path=`cygpath -d "$formatted_path"`
63             fi
64             if test $? -ne 0;  then
65                 AC_MSG_ERROR([path conversion failed for "$1".])
66             fi
67         fi
68         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
69         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
70         if test "$fp_count_slash$fp_count_colon" != "00"; then
71             if test "$fp_count_colon" = "0"; then
72                 new_formatted_path=`realpath "$formatted_path"`
73                 if test $? -ne 0;  then
74                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
75                 else
76                     formatted_path="$new_formatted_path"
77                 fi
78             fi
79             formatted_path=`cygpath -m "$formatted_path"`
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84     fi
87 AbsolutePath()
89     # There appears to be no simple and portable method to get an absolute and
90     # canonical path, so we try creating the directory if does not exist and
91     # utilizing the shell and pwd.
92     rel="$1"
93     absolute_path=""
94     test ! -e "$rel" && mkdir -p "$rel"
95     if test -d "$rel" ; then
96         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
97         absolute_path="$(pwd)"
98         cd - > /dev/null
99     else
100         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
101     fi
104 rm -f warn
105 have_WARNINGS="no"
106 add_warning()
108     if test "$have_WARNINGS" = "no"; then
109         echo "*************************************" > warn
110         have_WARNINGS="yes"
111         if which tput >/dev/null 2>/dev/null && test `tput colors` -ge 8; then
112             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
113             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
114         else
115             COLORWARN="* WARNING :"
116         fi
117     fi
118     echo "$COLORWARN $@" >> warn
121 dnl Some Mac User have the bad habbit of letting a lot fo crap
122 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
123 dnl that confuse the build.
124 dnl For the ones that use LODE, let's be nice and protect them
125 dnl from themselves
127 mac_sanitize_path()
129     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
130 dnl a common but nevertheless necessary thing that may be in a fancy
131 dnl path location is git, so make sure we have it
132     mac_git_path=`which git 2>/dev/null`
133     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
134         mac_path="$mac_path:`dirname $mac_git_path`"
135     fi
136 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
137 dnl path location is gpg, so make sure we find it
138     mac_gpg_path=`which gpg 2>/dev/null`
139     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
140         mac_path="$mac_path:`dirname $mac_gpg_path`"
141     fi
142     PATH="$mac_path"
143     unset mac_path
144     unset mac_git_path
145     unset mac_gpg_path
148 echo "********************************************************************"
149 echo "*"
150 echo "*   Running ${PACKAGE_NAME} build configuration."
151 echo "*"
152 echo "********************************************************************"
153 echo ""
155 dnl ===================================================================
156 dnl checks build and host OSes
157 dnl do this before argument processing to allow for platform dependent defaults
158 dnl ===================================================================
159 AC_CANONICAL_HOST
161 AC_MSG_CHECKING([for product name])
162 PRODUCTNAME="AC_PACKAGE_NAME"
163 if test -n "$with_product_name" -a "$with_product_name" != no; then
164     PRODUCTNAME="$with_product_name"
166 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
167     PRODUCTNAME="${PRODUCTNAME}Dev"
169 AC_MSG_RESULT([$PRODUCTNAME])
170 AC_SUBST(PRODUCTNAME)
171 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
172 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
174 dnl ===================================================================
175 dnl Our version is defined by the AC_INIT() at the top of this script.
176 dnl ===================================================================
178 AC_MSG_CHECKING([for package version])
179 if test -n "$with_package_version" -a "$with_package_version" != no; then
180     PACKAGE_VERSION="$with_package_version"
182 AC_MSG_RESULT([$PACKAGE_VERSION])
184 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
186 LIBO_VERSION_MAJOR=$1
187 LIBO_VERSION_MINOR=$2
188 LIBO_VERSION_MICRO=$3
189 LIBO_VERSION_PATCH=$4
191 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
192 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
193 # no way to encode that into an integer in general.
194 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
196 LIBO_VERSION_SUFFIX=$5
197 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
198 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
199 # they get undoubled before actually passed to sed.
200 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
201 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
202 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
203 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
205 AC_SUBST(LIBO_VERSION_MAJOR)
206 AC_SUBST(LIBO_VERSION_MINOR)
207 AC_SUBST(LIBO_VERSION_MICRO)
208 AC_SUBST(LIBO_VERSION_PATCH)
209 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
210 AC_SUBST(LIBO_VERSION_SUFFIX)
211 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
213 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
214 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
215 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
216 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
218 LIBO_THIS_YEAR=`date +%Y`
219 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
221 dnl ===================================================================
222 dnl Product version
223 dnl ===================================================================
224 AC_MSG_CHECKING([for product version])
225 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
226 AC_MSG_RESULT([$PRODUCTVERSION])
227 AC_SUBST(PRODUCTVERSION)
229 AC_PROG_EGREP
230 # AC_PROG_EGREP doesn't set GREP on all systems as well
231 AC_PATH_PROG(GREP, grep)
233 BUILDDIR=`pwd`
234 cd $srcdir
235 SRC_ROOT=`pwd`
236 cd $BUILDDIR
237 x_Cygwin=[\#]
239 dnl ======================================
240 dnl Required GObject introspection version
241 dnl ======================================
242 INTROSPECTION_REQUIRED_VERSION=1.32.0
244 dnl ===================================================================
245 dnl Search all the common names for GNU Make
246 dnl ===================================================================
247 AC_MSG_CHECKING([for GNU Make])
249 # try to use our own make if it is available and GNUMAKE was not already defined
250 if test -z "$GNUMAKE"; then
251     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
252         GNUMAKE="$LODE_HOME/opt/bin/make"
253     elif test -x "/opt/lo/bin/make"; then
254         GNUMAKE="/opt/lo/bin/make"
255     fi
258 GNUMAKE_WIN_NATIVE=
259 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
260     if test -n "$a"; then
261         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
262         if test $? -eq 0;  then
263             if test "$build_os" = "cygwin"; then
264                 if test -n "$($a -v | grep 'Built for Windows')" ; then
265                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
266                     GNUMAKE_WIN_NATIVE="TRUE"
267                 else
268                     GNUMAKE=`which $a`
269                 fi
270             else
271                 GNUMAKE=`which $a`
272             fi
273             break
274         fi
275     fi
276 done
277 AC_MSG_RESULT($GNUMAKE)
278 if test -z "$GNUMAKE"; then
279     AC_MSG_ERROR([not found. install GNU Make.])
280 else
281     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
282         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
283     fi
286 win_short_path_for_make()
288     local_short_path="$1"
289     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
290         cygpath -sm "$local_short_path"
291     else
292         cygpath -u "$(cygpath -d "$local_short_path")"
293     fi
297 if test "$build_os" = "cygwin"; then
298     PathFormat "$SRC_ROOT"
299     SRC_ROOT="$formatted_path"
300     PathFormat "$BUILDDIR"
301     BUILDDIR="$formatted_path"
302     x_Cygwin=
303     AC_MSG_CHECKING(for explicit COMSPEC)
304     if test -z "$COMSPEC"; then
305         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
306     else
307         AC_MSG_RESULT([found: $COMSPEC])
308     fi
311 AC_SUBST(SRC_ROOT)
312 AC_SUBST(BUILDDIR)
313 AC_SUBST(x_Cygwin)
314 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
315 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
317 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
318     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
321 # need sed in os checks...
322 AC_PATH_PROGS(SED, sed)
323 if test -z "$SED"; then
324     AC_MSG_ERROR([install sed to run this script])
327 # Set the ENABLE_LTO variable
328 # ===================================================================
329 AC_MSG_CHECKING([whether to use link-time optimization])
330 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
331     ENABLE_LTO="TRUE"
332     AC_MSG_RESULT([yes])
333     AC_DEFINE(STATIC_LINKING)
334 else
335     ENABLE_LTO=""
336     AC_MSG_RESULT([no])
338 AC_SUBST(ENABLE_LTO)
340 AC_ARG_ENABLE(fuzz-options,
341     AS_HELP_STRING([--enable-fuzz-options],
342         [Randomly enable or disable each of those configurable options
343          that are supposed to be freely selectable without interdependencies,
344          or where bad interaction from interdependencies is automatically avoided.])
347 dnl ===================================================================
348 dnl When building for Android, --with-android-ndk,
349 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
350 dnl mandatory
351 dnl ===================================================================
353 AC_ARG_WITH(android-ndk,
354     AS_HELP_STRING([--with-android-ndk],
355         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
358 AC_ARG_WITH(android-ndk-toolchain-version,
359     AS_HELP_STRING([--with-android-ndk-toolchain-version],
360         [Specify which toolchain version to use, of those present in the
361         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
362         with_android_ndk_toolchain_version=clang5.0)
364 AC_ARG_WITH(android-sdk,
365     AS_HELP_STRING([--with-android-sdk],
366         [Specify location of the Android SDK. Mandatory when building for Android.]),
369 ANDROID_NDK_HOME=
370 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
371     with_android_ndk="$SRC_ROOT/external/android-ndk"
373 if test -n "$with_android_ndk"; then
374     ANDROID_NDK_HOME=$with_android_ndk
376     # Set up a lot of pre-canned defaults
378     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
379         if test ! -f $ANDROID_NDK_HOME/source.properties; then
380             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
381         fi
382         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
383     else
384         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
385     fi
386     if test -z "$ANDROID_NDK_VERSION";  then
387         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
388     fi
389     case $ANDROID_NDK_VERSION in
390     r9*|r10*)
391         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
392         ;;
393     11.1.*|12.1.*|13.1.*|14.1.*)
394         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
395         ;;
396     16.*)
397         ;;
398     *)
399         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk.])
400         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk."
401         ;;
402     esac
404     ANDROID_API_LEVEL=14
405     android_cpu=$host_cpu
406     ANDROID_ARCH=$android_cpu
407     if test $host_cpu = arm; then
408         android_platform_prefix=$android_cpu-linux-androideabi
409         android_gnu_prefix=$android_platform_prefix
410         LLVM_TRIPLE=armv7-none-linux-androideabi
411         ANDROID_APP_ABI=armeabi-v7a
412         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
413     elif test $host_cpu = aarch64; then
414         android_platform_prefix=$android_cpu-linux-android
415         android_gnu_prefix=$android_platform_prefix
416         LLVM_TRIPLE=aarch64-none-linux-android
417         # minimum android version that supports aarch64
418         ANDROID_API_LEVEL=21
419         ANDROID_APP_ABI=arm64-v8a
420         ANDROID_ARCH=arm64
421     elif test $host_cpu = mips; then
422         android_platform_prefix=mipsel-linux-android
423         android_gnu_prefix=$android_platform_prefix
424         LLVM_TRIPLE=mipsel-none-linux-android
425         ANDROID_APP_ABI=mips
426     else
427         # host_cpu is something like "i386" or "i686" I guess, NDK uses
428         # "x86" in some contexts
429         android_cpu=x86
430         android_platform_prefix=$android_cpu
431         android_gnu_prefix=i686-linux-android
432         LLVM_TRIPLE=i686-none-linux-android
433         ANDROID_APP_ABI=x86
434         ANDROID_ARCH=$android_cpu
435         ANDROIDCFLAGS="-march=atom"
436     fi
438     case "$with_android_ndk_toolchain_version" in
439     clang5.0)
440         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
441         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION
442         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm
443         ;;
444     *)
445         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
446     esac
448     if test ! -d $ANDROID_BINUTILS_DIR; then
449         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
450     elif test ! -d $ANDROID_COMPILER_DIR; then
451         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
452     fi
454     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
455     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
456     # manage to link the (app-specific) single huge .so that is built for the app in
457     # android/source/ if there is debug information in a significant part of the object files.
458     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
459     # all objects have been built with debug information.)
460     case $build_os in
461     linux-gnu*)
462         ndk_build_os=linux
463         ;;
464     darwin*)
465         ndk_build_os=darwin
466         ;;
467     *)
468         AC_MSG_ERROR([We only support building for Android from Linux or OS X])
469         ;;
470     esac
471     ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
472     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
473     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
475     test -z "$SYSBASE" && SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
476     test -z "$AR" && AR=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ar
477     test -z "$NM" && NM=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-nm
478     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-objdump
479     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ranlib
480     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-strip
482     ANDROIDCFLAGS="$ANDROIDCFLAGS -gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT -target $LLVM_TRIPLE$ANDROID_API_LEVEL -no-canonical-prefixes"
483     # android is using different sysroots for compilation and linking, but as
484     # there is no full separation in configure and elsewhere, use isystem for
485     # compilation stuff and sysroot for linking
486     ANDROIDCFLAGS="$ANDROIDCFLAGS -D__ANDROID_API__=$ANDROID_API_LEVEL -isystem $ANDROID_NDK_HOME/sysroot/usr/include"
487     ANDROIDCFLAGS="$ANDROIDCFLAGS -isystem $ANDROID_NDK_HOME/sysroot/usr/include/$android_gnu_prefix"
488     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$SYSBASE -ffunction-sections -fdata-sections -Qunused-arguments"
489     if test "$ANDROID_APP_ABI" = "armeabi-v7a"; then
490     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/libs/$ANDROID_APP_ABI -D_GTHREAD_USE_MUTEX_INIT_FUNC=1"
491     else
492     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/libs/$ANDROID_APP_ABI"
493     fi
494     if test "$ENABLE_LTO" = TRUE; then
495         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
496         # $CC and $CXX when building external libraries
497         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
498     fi
500     if test "$ANDROID_APP_ABI" = "armeabi-v7a"; then
501     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/libs/$ANDROID_APP_ABI/include -std=c++11"
502     else
503     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/include -I$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++abi/include -I$ANDROID_NDK_HOME/sources/android/support/include -std=c++11"
504     fi
506     if test -z "$CC"; then
507         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
508     fi
509     if test -z "$CXX"; then
510         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
511     fi
513     # remember to download the ownCloud Android library later
514     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
516 AC_SUBST(ANDROID_NDK_HOME)
517 AC_SUBST(ANDROID_APP_ABI)
518 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
520 dnl ===================================================================
521 dnl --with-android-sdk
522 dnl ===================================================================
523 ANDROID_SDK_HOME=
524 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
525     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
527 if test -n "$with_android_sdk"; then
528     ANDROID_SDK_HOME=$with_android_sdk
529     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
531 AC_SUBST(ANDROID_SDK_HOME)
533 dnl ===================================================================
534 dnl The following is a list of supported systems.
535 dnl Sequential to keep the logic very simple
536 dnl These values may be checked and reset later.
537 dnl ===================================================================
538 #defaults unless the os test overrides this:
539 test_randr=yes
540 test_xrender=yes
541 test_cups=yes
542 test_dbus=yes
543 test_fontconfig=yes
544 test_cairo=no
546 # Default values, as such probably valid just for Linux, set
547 # differently below just for Mac OSX,but at least better than
548 # hardcoding these as we used to do. Much of this is duplicated also
549 # in solenv for old build system and for gbuild, ideally we should
550 # perhaps define stuff like this only here in configure.ac?
552 LINKFLAGSSHL="-shared"
553 PICSWITCH="-fpic"
554 DLLPOST=".so"
556 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
558 INSTROOTBASESUFFIX=
559 INSTROOTCONTENTSUFFIX=
560 SDKDIRNAME=sdk
562 case "$host_os" in
564 solaris*)
565     test_gtk=yes
566     build_gstreamer_1_0=yes
567     build_gstreamer_0_10=yes
568     test_freetype=yes
569     _os=SunOS
571     dnl ===========================================================
572     dnl Check whether we're using Solaris 10 - SPARC or Intel.
573     dnl ===========================================================
574     AC_MSG_CHECKING([the Solaris operating system release])
575     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
576     if test "$_os_release" -lt "10"; then
577         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
578     else
579         AC_MSG_RESULT([ok ($_os_release)])
580     fi
582     dnl Check whether we're using a SPARC or i386 processor
583     AC_MSG_CHECKING([the processor type])
584     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
585         AC_MSG_RESULT([ok ($host_cpu)])
586     else
587         AC_MSG_ERROR([only SPARC and i386 processors are supported])
588     fi
589     ;;
591 linux-gnu*|k*bsd*-gnu*)
592     test_gtk=yes
593     build_gstreamer_1_0=yes
594     build_gstreamer_0_10=yes
595     test_kde4=yes
596     test_kde5=yes
597     test_qt5=yes
598     test_gtk3_kde5=yes
599     if test "$enable_fuzzers" != yes; then
600         test_freetype=yes
601         test_fontconfig=yes
602     else
603         test_freetype=no
604         test_fontconfig=no
605         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
606     fi
607     _os=Linux
608     ;;
610 gnu)
611     test_randr=no
612     test_xrender=no
613     _os=GNU
614      ;;
616 cygwin*|interix*)
618     # When building on Windows normally with MSVC under Cygwin,
619     # configure thinks that the host platform (the platform the
620     # built code will run on) is Cygwin, even if it obviously is
621     # Windows, which in Autoconf terminology is called
622     # "mingw32". (Which is misleading as MinGW is the name of the
623     # tool-chain, not an operating system.)
625     # Somewhat confusing, yes. But this configure script doesn't
626     # look at $host etc that much, it mostly uses its own $_os
627     # variable, set here in this case statement.
629     test_cups=no
630     test_dbus=no
631     test_randr=no
632     test_xrender=no
633     test_freetype=no
634     test_fontconfig=no
635     _os=WINNT
637     DLLPOST=".dll"
638     LINKFLAGSNOUNDEFS=
639     ;;
641 darwin*) # Mac OS X or iOS
642     test_gtk=yes
643     test_randr=no
644     test_xrender=no
645     test_freetype=no
646     test_fontconfig=no
647     test_dbus=no
648     if test -n "$LODE_HOME" ; then
649         mac_sanitize_path
650         AC_MSG_NOTICE([sanitized the PATH to $PATH])
651     fi
652     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
653         build_for_ios=YES
654         _os=iOS
655         test_gtk=no
656         test_cups=no
657         enable_mpl_subset=yes
658         enable_lotuswordpro=no
659         enable_coinmp=no
660         enable_lpsolve=no
661         enable_postgresql_sdbc=no
662         enable_extension_integration=no
663         enable_report_builder=no
664         with_theme="tango"
665         with_ppds=no
666         if test "$enable_ios_simulator" = "yes"; then
667             host=x86_64-apple-darwin
668         fi
669     else
670         _os=Darwin
671         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
672         INSTROOTCONTENTSUFFIX=/Contents
673         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
674     fi
675     # See comment above the case "$host_os"
676     LINKFLAGSSHL="-dynamiclib -single_module"
678     # -fPIC is default
679     PICSWITCH=""
681     DLLPOST=".dylib"
683     # -undefined error is the default
684     LINKFLAGSNOUNDEFS=""
687 freebsd*)
688     test_gtk=yes
689     build_gstreamer_1_0=yes
690     build_gstreamer_0_10=yes
691     test_kde4=yes
692     test_kde5=yes
693     test_qt5=yes
694     test_gtk3_kde5=yes
695     test_freetype=yes
696     AC_MSG_CHECKING([the FreeBSD operating system release])
697     if test -n "$with_os_version"; then
698         OSVERSION="$with_os_version"
699     else
700         OSVERSION=`/sbin/sysctl -n kern.osreldate`
701     fi
702     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
703     AC_MSG_CHECKING([which thread library to use])
704     if test "$OSVERSION" -lt "500016"; then
705         PTHREAD_CFLAGS="-D_THREAD_SAFE"
706         PTHREAD_LIBS="-pthread"
707     elif test "$OSVERSION" -lt "502102"; then
708         PTHREAD_CFLAGS="-D_THREAD_SAFE"
709         PTHREAD_LIBS="-lc_r"
710     else
711         PTHREAD_CFLAGS=""
712         PTHREAD_LIBS="-pthread"
713     fi
714     AC_MSG_RESULT([$PTHREAD_LIBS])
715     _os=FreeBSD
716     ;;
718 *netbsd*)
719     test_gtk=yes
720     build_gstreamer_1_0=yes
721     build_gstreamer_0_10=yes
722     test_kde4=yes
723     test_kde5=yes
724     test_qt5=yes
725     test_gtk3_kde5=yes
726     test_freetype=yes
727     PTHREAD_LIBS="-pthread -lpthread"
728     _os=NetBSD
729     ;;
731 aix*)
732     test_randr=no
733     test_freetype=yes
734     PTHREAD_LIBS=-pthread
735     _os=AIX
736     ;;
738 openbsd*)
739     test_gtk=yes
740     test_freetype=yes
741     PTHREAD_CFLAGS="-D_THREAD_SAFE"
742     PTHREAD_LIBS="-pthread"
743     _os=OpenBSD
744     ;;
746 dragonfly*)
747     test_gtk=yes
748     build_gstreamer_1_0=yes
749     build_gstreamer_0_10=yes
750     test_kde4=yes
751     test_kde5=yes
752     test_qt5=yes
753     test_gtk3_kde5=yes
754     test_freetype=yes
755     PTHREAD_LIBS="-pthread"
756     _os=DragonFly
757     ;;
759 linux-android*)
760     build_gstreamer_1_0=no
761     build_gstreamer_0_10=no
762     enable_lotuswordpro=no
763     enable_mpl_subset=yes
764     enable_coinmp=yes
765     enable_lpsolve=no
766     enable_report_builder=no
767     enable_odk=no
768     enable_postgresql_sdbc=no
769     enable_python=no
770     with_theme="tango"
771     test_cups=no
772     test_dbus=no
773     test_fontconfig=no
774     test_freetype=no
775     test_gtk=no
776     test_kde4=no
777     test_kde5=no
778     test_qt5=no
779     test_gtk3_kde5=no
780     test_randr=no
781     test_xrender=no
782     _os=Android
784     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
785     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
786     ;;
788 haiku*)
789     test_cups=no
790     test_dbus=no
791     test_randr=no
792     test_xrender=no
793     test_freetype=yes
794     enable_java=no
795     enable_opengl=no
796     enable_odk=no
797     enable_gconf=no
798     enable_gnome_vfs=no
799     enable_gstreamer=no
800     enable_vlc=no
801     enable_gltf=no
802     enable_collada=no
803     enable_coinmp=no
804     enable_pdfium=no
805     enable_postgresql_sdbc=no
806     enable_firebird_sdbc=no
807     _os=Haiku
808     ;;
811     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
812     ;;
813 esac
815 if test "$_os" = "Android" ; then
816     # Verify that the NDK and SDK options are proper
817     if test -z "$with_android_ndk"; then
818         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
819     elif test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
820         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
821     fi
823     if test -z "$ANDROID_SDK_HOME"; then
824         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
825     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
826         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
827     fi
829     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
830     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
831         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
832                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
833                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
834         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
835         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
836         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
837     fi
838     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
839         AC_MSG_WARN([android support repository not found - install with
840                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
841                      to allow the build to download the specified version of the android support libraries])
842         add_warning "android support repository not found - install with"
843         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
844         add_warning "to allow the build to download the specified version of the android support libraries"
845     fi
848 if test "$_os" = "AIX"; then
849     AC_PATH_PROG(GAWK, gawk)
850     if test -z "$GAWK"; then
851         AC_MSG_ERROR([gawk not found in \$PATH])
852     fi
855 AC_SUBST(SDKDIRNAME)
857 AC_SUBST(PTHREAD_CFLAGS)
858 AC_SUBST(PTHREAD_LIBS)
860 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
861 # By default use the ones specified by our build system,
862 # but explicit override is possible.
863 AC_MSG_CHECKING(for explicit AFLAGS)
864 if test -n "$AFLAGS"; then
865     AC_MSG_RESULT([$AFLAGS])
866     x_AFLAGS=
867 else
868     AC_MSG_RESULT(no)
869     x_AFLAGS=[\#]
871 AC_MSG_CHECKING(for explicit CFLAGS)
872 if test -n "$CFLAGS"; then
873     AC_MSG_RESULT([$CFLAGS])
874     x_CFLAGS=
875 else
876     AC_MSG_RESULT(no)
877     x_CFLAGS=[\#]
879 AC_MSG_CHECKING(for explicit CXXFLAGS)
880 if test -n "$CXXFLAGS"; then
881     AC_MSG_RESULT([$CXXFLAGS])
882     x_CXXFLAGS=
883 else
884     AC_MSG_RESULT(no)
885     x_CXXFLAGS=[\#]
887 AC_MSG_CHECKING(for explicit OBJCFLAGS)
888 if test -n "$OBJCFLAGS"; then
889     AC_MSG_RESULT([$OBJCFLAGS])
890     x_OBJCFLAGS=
891 else
892     AC_MSG_RESULT(no)
893     x_OBJCFLAGS=[\#]
895 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
896 if test -n "$OBJCXXFLAGS"; then
897     AC_MSG_RESULT([$OBJCXXFLAGS])
898     x_OBJCXXFLAGS=
899 else
900     AC_MSG_RESULT(no)
901     x_OBJCXXFLAGS=[\#]
903 AC_MSG_CHECKING(for explicit LDFLAGS)
904 if test -n "$LDFLAGS"; then
905     AC_MSG_RESULT([$LDFLAGS])
906     x_LDFLAGS=
907 else
908     AC_MSG_RESULT(no)
909     x_LDFLAGS=[\#]
911 AC_SUBST(AFLAGS)
912 AC_SUBST(CFLAGS)
913 AC_SUBST(CXXFLAGS)
914 AC_SUBST(OBJCFLAGS)
915 AC_SUBST(OBJCXXFLAGS)
916 AC_SUBST(LDFLAGS)
917 AC_SUBST(x_AFLAGS)
918 AC_SUBST(x_CFLAGS)
919 AC_SUBST(x_CXXFLAGS)
920 AC_SUBST(x_OBJCFLAGS)
921 AC_SUBST(x_OBJCXXFLAGS)
922 AC_SUBST(x_LDFLAGS)
924 dnl These are potentially set for MSVC, in the code checking for UCRT below:
925 my_original_CFLAGS=$CFLAGS
926 my_original_CXXFLAGS=$CXXFLAGS
927 my_original_CPPFLAGS=$CPPFLAGS
929 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
930 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
931 dnl AC_PROG_CC internally.
932 if test "$_os" != "WINNT"; then
933     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
934     save_CFLAGS=$CFLAGS
935     AC_PROG_CC
936     CFLAGS=$save_CFLAGS
939 if test "$_os" != "WINNT"; then
940 AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
941 else
942 ENDIANNESS=little
944 AC_SUBST(ENDIANNESS)
946 if test $_os != "WINNT"; then
947     save_LIBS="$LIBS"
948     AC_SEARCH_LIBS([dlsym], [dl],
949         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
950         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
951     LIBS="$save_LIBS"
953 AC_SUBST(DLOPEN_LIBS)
955 ###############################################################################
956 # Extensions switches --enable/--disable
957 ###############################################################################
958 # By default these should be enabled unless having extra dependencies.
959 # If there is extra dependency over configure options then the enable should
960 # be automagic based on whether the requiring feature is enabled or not.
961 # All this options change anything only with --enable-extension-integration.
963 # The name of this option and its help string makes it sound as if
964 # extensions are built anyway, just not integrated in the installer,
965 # if you use --disable-extension-integration. Is that really the
966 # case?
968 AC_ARG_ENABLE(ios-simulator,
969     AS_HELP_STRING([--enable-ios-simulator],
970         [build i386 or x86_64 for ios simulator])
973 libo_FUZZ_ARG_ENABLE(extension-integration,
974     AS_HELP_STRING([--disable-extension-integration],
975         [Disable integration of the built extensions in the installer of the
976          product. Use this switch to disable the integration.])
979 AC_ARG_ENABLE(avmedia,
980     AS_HELP_STRING([--disable-avmedia],
981         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
984 AC_ARG_ENABLE(database-connectivity,
985     AS_HELP_STRING([--disable-database-connectivity],
986         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
989 # This doesn't mean not building (or "integrating") extensions
990 # (although it probably should; i.e. it should imply
991 # --disable-extension-integration I guess), it means not supporting
992 # any extension mechanism at all
993 libo_FUZZ_ARG_ENABLE(extensions,
994     AS_HELP_STRING([--disable-extensions],
995         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
998 AC_ARG_ENABLE(scripting,
999     AS_HELP_STRING([--disable-scripting],
1000         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1003 # This is mainly for Android and iOS, but could potentially be used in some
1004 # special case otherwise, too, so factored out as a separate setting
1006 AC_ARG_ENABLE(dynamic-loading,
1007     AS_HELP_STRING([--disable-dynamic-loading],
1008         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1011 libo_FUZZ_ARG_ENABLE(ext-mariadb-connector,
1012     AS_HELP_STRING([--enable-ext-mariadb-connector],
1013         [Enable the build of the MariaDB/MySQL Connector extension.])
1016 libo_FUZZ_ARG_ENABLE(report-builder,
1017     AS_HELP_STRING([--disable-report-builder],
1018         [Disable the Report Builder.])
1021 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1022     AS_HELP_STRING([--enable-ext-wiki-publisher],
1023         [Enable the Wiki Publisher extension.])
1026 libo_FUZZ_ARG_ENABLE(lpsolve,
1027     AS_HELP_STRING([--disable-lpsolve],
1028         [Disable compilation of the lp solve solver ])
1030 libo_FUZZ_ARG_ENABLE(coinmp,
1031     AS_HELP_STRING([--disable-coinmp],
1032         [Disable compilation of the CoinMP solver ])
1035 libo_FUZZ_ARG_ENABLE(pdfimport,
1036     AS_HELP_STRING([--disable-pdfimport],
1037         [Disable building the PDF import feature.])
1040 libo_FUZZ_ARG_ENABLE(pdfium,
1041     AS_HELP_STRING([--disable-pdfium],
1042         [Disable building PDFium.])
1045 ###############################################################################
1047 dnl ---------- *** ----------
1049 libo_FUZZ_ARG_ENABLE(mergelibs,
1050     AS_HELP_STRING([--enable-mergelibs],
1051         [Merge several of the smaller libraries into one big, "merged", one.])
1054 libo_FUZZ_ARG_ENABLE(breakpad,
1055     AS_HELP_STRING([--enable-breakpad],
1056         [Enables breakpad for crash reporting.])
1059 libo_FUZZ_ARG_ENABLE(crashdump,
1060     AS_HELP_STRING([--disable-crashdump],
1061         [Disable dump.ini and dump-file, when --enable-breakpad])
1064 AC_ARG_ENABLE(fetch-external,
1065     AS_HELP_STRING([--disable-fetch-external],
1066         [Disables fetching external tarballs from web sources.])
1069 AC_ARG_ENABLE(fuzzers,
1070     AS_HELP_STRING([--enable-fuzzers],
1071         [Enables building libfuzzer targets for fuzz testing.])
1074 libo_FUZZ_ARG_ENABLE(pch,
1075     AS_HELP_STRING([--enable-pch],
1076         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1079 libo_FUZZ_ARG_ENABLE(epm,
1080     AS_HELP_STRING([--enable-epm],
1081         [LibreOffice includes self-packaging code, that requires epm, however epm is
1082          useless for large scale package building.])
1085 libo_FUZZ_ARG_ENABLE(odk,
1086     AS_HELP_STRING([--disable-odk],
1087         [LibreOffice includes an ODK, office development kit which some packagers may
1088          wish to build without.])
1091 AC_ARG_ENABLE(mpl-subset,
1092     AS_HELP_STRING([--enable-mpl-subset],
1093         [Don't compile any pieces which are not MPL or more liberally licensed])
1096 libo_FUZZ_ARG_ENABLE(evolution2,
1097     AS_HELP_STRING([--enable-evolution2],
1098         [Allows the built-in evolution 2 addressbook connectivity build to be
1099          enabled.])
1102 AC_ARG_ENABLE(avahi,
1103     AS_HELP_STRING([--enable-avahi],
1104         [Determines whether to use Avahi to advertise Impress to remote controls.])
1107 libo_FUZZ_ARG_ENABLE(werror,
1108     AS_HELP_STRING([--enable-werror],
1109         [Turn warnings to errors. (Has no effect in modules where the treating
1110          of warnings as errors is disabled explicitly.)]),
1113 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1114     AS_HELP_STRING([--enable-assert-always-abort],
1115         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1118 libo_FUZZ_ARG_ENABLE(dbgutil,
1119     AS_HELP_STRING([--enable-dbgutil],
1120         [Provide debugging support from --enable-debug and include additional debugging
1121          utilities such as object counting or more expensive checks.
1122          This is the recommended option for developers.
1123          Note that this makes the build ABI incompatible, it is not possible to mix object
1124          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1126 libo_FUZZ_ARG_ENABLE(debug,
1127     AS_HELP_STRING([--enable-debug],
1128         [Include debugging information, disable compiler optimization and inlining plus
1129          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1131 libo_FUZZ_ARG_ENABLE(sal-log,
1132     AS_HELP_STRING([--enable-sal-log],
1133         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1135 AC_ARG_ENABLE(selective-debuginfo,
1136     AS_HELP_STRING([--enable-selective-debuginfo],
1137         [If --enable-debug or --enable-dbgutil is used, build debugging information
1138          (-g compiler flag) only for the specified gbuild build targets
1139          (where all means everything, - prepended means not to enable, / appended means
1140          everything in the directory; there is no ordering, more specific overrides
1141          more general, and disabling takes precedence).
1142          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1144 libo_FUZZ_ARG_ENABLE(symbols,
1145     AS_HELP_STRING([--enable-symbols],
1146         [Generate debug information.
1147          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1148          otherwise.]))
1150 libo_FUZZ_ARG_ENABLE(optimized,
1151     AS_HELP_STRING([--disable-optimized],
1152         [Whether to compile with optimization flags.
1153          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1154          otherwise.]))
1156 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1157     AS_HELP_STRING([--disable-runtime-optimizations],
1158         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1159          JVM JIT) that are known to interact badly with certain dynamic analysis
1160          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1161          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1162          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1164 AC_ARG_WITH(valgrind,
1165     AS_HELP_STRING([--with-valgrind],
1166         [Make availability of Valgrind headers a hard requirement.]))
1168 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1169     AS_HELP_STRING([--enable-compiler-plugins],
1170         [Enable compiler plugins that will perform additional checks during
1171          building. Enabled automatically by --enable-dbgutil.
1172          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1173 COMPILER_PLUGINS_DEBUG=
1174 if test "$enable_compiler_plugins" = debug; then
1175     enable_compiler_plugins=yes
1176     COMPILER_PLUGINS_DEBUG=TRUE
1179 libo_FUZZ_ARG_ENABLE(ooenv,
1180     AS_HELP_STRING([--disable-ooenv],
1181         [Disable ooenv for the instdir installation.]))
1183 libo_FUZZ_ARG_ENABLE(libnumbertext,
1184     AS_HELP_STRING([--disable-libnumbertext],
1185         [Disable use of numbertext external library.]))
1187 AC_ARG_ENABLE(lto,
1188     AS_HELP_STRING([--enable-lto],
1189         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1190          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1191          linker. For MSVC, this option is broken at the moment. This is experimental work
1192          in progress that shouldn't be used unless you are working on it.)]))
1194 AC_ARG_ENABLE(python,
1195     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1196         [Enables or disables Python support at run-time.
1197          Also specifies what Python to use. 'auto' is the default.
1198          'fully-internal' even forces the internal version for uses of Python
1199          during the build.]))
1201 libo_FUZZ_ARG_ENABLE(gtk,
1202     AS_HELP_STRING([--disable-gtk],
1203         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1204 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1206 libo_FUZZ_ARG_ENABLE(gtk3,
1207     AS_HELP_STRING([--disable-gtk3],
1208         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1209 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1211 AC_ARG_ENABLE(split-app-modules,
1212     AS_HELP_STRING([--enable-split-app-modules],
1213         [Split file lists for app modules, e.g. base, calc.
1214          Has effect only with make distro-pack-install]),
1217 AC_ARG_ENABLE(split-opt-features,
1218     AS_HELP_STRING([--enable-split-opt-features],
1219         [Split file lists for some optional features, e.g. pyuno, testtool.
1220          Has effect only with make distro-pack-install]),
1223 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1224     AS_HELP_STRING([--disable-cairo-canvas],
1225         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1228 libo_FUZZ_ARG_ENABLE(dbus,
1229     AS_HELP_STRING([--disable-dbus],
1230         [Determines whether to enable features that depend on dbus.
1231          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1232 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1234 libo_FUZZ_ARG_ENABLE(sdremote,
1235     AS_HELP_STRING([--disable-sdremote],
1236         [Determines whether to enable Impress remote control (i.e. the server component).]),
1237 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1239 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1240     AS_HELP_STRING([--disable-sdremote-bluetooth],
1241         [Determines whether to build sdremote with bluetooth support.
1242          Requires dbus on Linux.]))
1244 libo_FUZZ_ARG_ENABLE(gio,
1245     AS_HELP_STRING([--disable-gio],
1246         [Determines whether to use the GIO support.]),
1247 ,test "${enable_gio+set}" = set || enable_gio=yes)
1249 AC_ARG_ENABLE(kde4,
1250     AS_HELP_STRING([--enable-kde4],
1251         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1252          KDE4 are available.]),
1255 AC_ARG_ENABLE(qt5,
1256     AS_HELP_STRING([--enable-qt5],
1257         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1258          available.]),
1261 AC_ARG_ENABLE(kde5,
1262     AS_HELP_STRING([--enable-kde5],
1263         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1264          KF5 are available.]),
1267 AC_ARG_ENABLE(gtk3_kde5,
1268     AS_HELP_STRING([--enable-gtk3-kde5],
1269         [Determines whether to use Gtk3 vclplug with KDE file dialogs on
1270          platforms where Gtk3, Qt5 and Plasma is available.]),
1273 libo_FUZZ_ARG_ENABLE(gui,
1274     AS_HELP_STRING([--disable-gui],
1275         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1276          command-line option. Not related to LibreOffice Online functionality. Don't use
1277          unless you are certain you need to. Nobody will help you if you insist on trying
1278          this and run into problems.]),
1279 ,test "${enable_gui+set}" = set || enable_gui=yes)
1281 libo_FUZZ_ARG_ENABLE(randr,
1282     AS_HELP_STRING([--disable-randr],
1283         [Disable RandR support in the vcl project.]),
1284 ,test "${enable_randr+set}" = set || enable_randr=yes)
1286 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1287     AS_HELP_STRING([--disable-gstreamer-1-0],
1288         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1289 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1291 AC_ARG_ENABLE(gstreamer-0-10,
1292     AS_HELP_STRING([--enable-gstreamer-0-10],
1293         [Enable building with the gstreamer 0.10 avmedia backend.]),
1294 ,enable_gstreamer_0_10=no)
1296 libo_FUZZ_ARG_ENABLE(vlc,
1297     AS_HELP_STRING([--enable-vlc],
1298         [Enable building with the (experimental) VLC avmedia backend.]),
1299 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1301 libo_FUZZ_ARG_ENABLE(neon,
1302     AS_HELP_STRING([--disable-neon],
1303         [Disable neon and the compilation of webdav binding.]),
1306 libo_FUZZ_ARG_ENABLE([eot],
1307     [AS_HELP_STRING([--enable-eot],
1308         [Enable support for Embedded OpenType fonts.])],
1309 ,test "${enable_eot+set}" = set || enable_eot=no)
1311 libo_FUZZ_ARG_ENABLE(cve-tests,
1312     AS_HELP_STRING([--disable-cve-tests],
1313         [Prevent CVE tests to be executed]),
1316 libo_FUZZ_ARG_ENABLE(chart-tests,
1317     AS_HELP_STRING([--enable-chart-tests],
1318         [Executes chart XShape tests. In a perfect world these tests would be
1319          stable and everyone could run them, in reality it is best to run them
1320          only on a few machines that are known to work and maintained by people
1321          who can judge if a test failure is a regression or not.]),
1324 AC_ARG_ENABLE(build-unowinreg,
1325     AS_HELP_STRING([--enable-build-unowinreg],
1326         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1327          compiler is needed on Linux.]),
1330 AC_ARG_ENABLE(dependency-tracking,
1331     AS_HELP_STRING([--enable-dependency-tracking],
1332         [Do not reject slow dependency extractors.])[
1333   --disable-dependency-tracking
1334                           Disables generation of dependency information.
1335                           Speed up one-time builds.],
1338 AC_ARG_ENABLE(icecream,
1339     AS_HELP_STRING([--enable-icecream],
1340         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1341          It defaults to /opt/icecream for the location of the icecream gcc/g++
1342          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1345 libo_FUZZ_ARG_ENABLE(cups,
1346     AS_HELP_STRING([--disable-cups],
1347         [Do not build cups support.])
1350 AC_ARG_ENABLE(ccache,
1351     AS_HELP_STRING([--disable-ccache],
1352         [Do not try to use ccache automatically.
1353          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1354          CC/CXX are not yet set, and --enable-icecream is not given, we
1355          attempt to use ccache. --disable-ccache disables ccache completely.
1359 AC_ARG_ENABLE(64-bit,
1360     AS_HELP_STRING([--enable-64-bit],
1361         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1362          At the moment meaningful only for Windows.]), ,)
1364 libo_FUZZ_ARG_ENABLE(online-update,
1365     AS_HELP_STRING([--enable-online-update],
1366         [Enable the online update service that will check for new versions of
1367          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1368          If the value is "mar", the experimental Mozilla-like update will be
1369          enabled instead of the traditional update mechanism.]),
1372 AC_ARG_WITH(update-config,
1373     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1374                    [Path to the update config ini file]))
1376 libo_FUZZ_ARG_ENABLE(extension-update,
1377     AS_HELP_STRING([--disable-extension-update],
1378         [Disable possibility to update installed extensions.]),
1381 libo_FUZZ_ARG_ENABLE(release-build,
1382     AS_HELP_STRING([--enable-release-build],
1383         [Enable release build. Note that the "release build" choice is orthogonal to
1384          whether symbols are present, debug info is generated, or optimization
1385          is done.
1386          See http://wiki.documentfoundation.org/Development/DevBuild]),
1389 AC_ARG_ENABLE(windows-build-signing,
1390     AS_HELP_STRING([--enable-windows-build-signing],
1391         [Enable signing of windows binaries (*.exe, *.dll)]),
1394 AC_ARG_ENABLE(silent-msi,
1395     AS_HELP_STRING([--enable-silent-msi],
1396         [Enable MSI with LIMITUI=1 (silent install).]),
1399 AC_ARG_ENABLE(macosx-code-signing,
1400     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1401         [Sign executables, dylibs, frameworks and the app bundle. If you
1402          don't provide an identity the first suitable certificate
1403          in your keychain is used.]),
1406 AC_ARG_ENABLE(macosx-package-signing,
1407     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1408         [Create a .pkg suitable for uploading to the Mac App Store and sign
1409          it. If you don't provide an identity the first suitable certificate
1410          in your keychain is used.]),
1413 AC_ARG_ENABLE(macosx-sandbox,
1414     AS_HELP_STRING([--enable-macosx-sandbox],
1415         [Make the app bundle run in a sandbox. Requires code signing.
1416          Is required by apps distributed in the Mac App Store, and implies
1417          adherence to App Store rules.]),
1420 AC_ARG_WITH(macosx-bundle-identifier,
1421     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1422         [Define the OS X bundle identifier. Default is the somewhat weird
1423          org.libreoffice.script ("script", huh?).]),
1424 ,with_macosx_bundle_identifier=org.libreoffice.script)
1426 AC_ARG_WITH(product-name,
1427     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1428         [Define the product name. Default is AC_PACKAGE_NAME.]),
1429 ,with_product_name=$PRODUCTNAME)
1431 AC_ARG_WITH(package-version,
1432     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1433         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1436 libo_FUZZ_ARG_ENABLE(readonly-installset,
1437     AS_HELP_STRING([--enable-readonly-installset],
1438         [Prevents any attempts by LibreOffice to write into its installation. That means
1439          at least that no "system-wide" extensions can be added. Partly experimental work in
1440          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1443 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1444     AS_HELP_STRING([--disable-postgresql-sdbc],
1445         [Disable the build of the PostgreSQL-SDBC driver.])
1448 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1449     AS_HELP_STRING([--disable-lotuswordpro],
1450         [Disable the build of the Lotus Word Pro filter.]),
1451 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1453 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1454     AS_HELP_STRING([--disable-firebird-sdbc],
1455         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1456 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1458 AC_ARG_ENABLE(bogus-pkg-config,
1459     AS_HELP_STRING([--enable-bogus-pkg-config],
1460         [MACOSX only: on MacOSX pkg-config can cause trouble. by default if one is found in the PATH, an error is issued. This flag turn that error into a warning.]),
1463 AC_ARG_ENABLE(openssl,
1464     AS_HELP_STRING([--disable-openssl],
1465         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1466          components will either use GNUTLS or NSS. Work in progress,
1467          use only if you are hacking on it.]),
1468 ,enable_openssl=yes)
1470 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1471     AS_HELP_STRING([--enable-cipher-openssl-backend],
1472         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1473          Requires --enable-openssl.]))
1475 AC_ARG_ENABLE(library-bin-tar,
1476     AS_HELP_STRING([--enable-library-bin-tar],
1477         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1478         Some libraries can save their build result in a tarball
1479         stored in TARFILE_LOCATION. That binary tarball is
1480         uniquely identified by the source tarball,
1481         the content of the config_host.mk file and the content
1482         of the top-level directory in core for that library
1483         If this option is enabled, then if such a tarfile exist, it will be untarred
1484         instead of the source tarfile, and the build step will be skipped for that
1485         library.
1486         If a proper tarfile does not exist, then the normal source-based
1487         build is done for that library and a proper binary tarfile is created
1488         for the next time.]),
1491 AC_ARG_ENABLE(dconf,
1492     AS_HELP_STRING([--disable-dconf],
1493         [Disable the dconf configuration backend (enabled by default where
1494          available).]))
1496 libo_FUZZ_ARG_ENABLE(formula-logger,
1497     AS_HELP_STRING(
1498         [--enable-formula-logger],
1499         [Enable formula logger for logging formula calculation flow in Calc.]
1500     )
1503 dnl ===================================================================
1504 dnl Optional Packages (--with/without-)
1505 dnl ===================================================================
1507 AC_ARG_WITH(gcc-home,
1508     AS_HELP_STRING([--with-gcc-home],
1509         [Specify the location of gcc/g++ manually. This can be used in conjunction
1510          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1511          non-default path.]),
1514 AC_ARG_WITH(gnu-patch,
1515     AS_HELP_STRING([--with-gnu-patch],
1516         [Specify location of GNU patch on Solaris or FreeBSD.]),
1519 AC_ARG_WITH(build-platform-configure-options,
1520     AS_HELP_STRING([--with-build-platform-configure-options],
1521         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1524 AC_ARG_WITH(gnu-cp,
1525     AS_HELP_STRING([--with-gnu-cp],
1526         [Specify location of GNU cp on Solaris or FreeBSD.]),
1529 AC_ARG_WITH(external-tar,
1530     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1531         [Specify an absolute path of where to find (and store) tarfiles.]),
1532     TARFILE_LOCATION=$withval ,
1535 AC_ARG_WITH(referenced-git,
1536     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1537         [Specify another checkout directory to reference. This makes use of
1538                  git submodule update --reference, and saves a lot of diskspace
1539                  when having multiple trees side-by-side.]),
1540     GIT_REFERENCE_SRC=$withval ,
1543 AC_ARG_WITH(linked-git,
1544     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1545         [Specify a directory where the repositories of submodules are located.
1546          This uses a method similar to git-new-workdir to get submodules.]),
1547     GIT_LINK_SRC=$withval ,
1550 AC_ARG_WITH(galleries,
1551     AS_HELP_STRING([--with-galleries],
1552         [Specify how galleries should be built. It is possible either to
1553          build these internally from source ("build"),
1554          or to disable them ("no")]),
1557 AC_ARG_WITH(theme,
1558     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1559         [Choose which themes to include. By default those themes with an '*' are included.
1560          Possible choices: *breeze, *breeze_dark, *cib, *colibre, *elementary, *karasa_jaga, *sifr, *sifr_dark, *tango.]),
1563 libo_FUZZ_ARG_WITH(helppack-integration,
1564     AS_HELP_STRING([--without-helppack-integration],
1565         [It will not integrate the helppacks to the installer
1566          of the product. Please use this switch to use the online help
1567          or separate help packages.]),
1570 libo_FUZZ_ARG_WITH(fonts,
1571     AS_HELP_STRING([--without-fonts],
1572         [LibreOffice includes some third-party fonts to provide a reliable basis for
1573          help content, templates, samples, etc. When these fonts are already
1574          known to be available on the system then you should use this option.]),
1577 AC_ARG_WITH(epm,
1578     AS_HELP_STRING([--with-epm],
1579         [Decides which epm to use. Default is to use the one from the system if
1580          one is built. When either this is not there or you say =internal epm
1581          will be built.]),
1584 AC_ARG_WITH(package-format,
1585     AS_HELP_STRING([--with-package-format],
1586         [Specify package format(s) for LibreOffice installation sets. The
1587          implicit --without-package-format leads to no installation sets being
1588          generated. Possible values: aix, archive, bsd, deb, dmg,
1589          installed, msi, pkg, and rpm.
1590          Example: --with-package-format='deb rpm']),
1593 AC_ARG_WITH(tls,
1594     AS_HELP_STRING([--with-tls],
1595         [Decides which TLS/SSL and cryptographic implementations to use for
1596          LibreOffice's code. Notice that this doesn't apply for depending
1597          libraries like "neon", for example. Default is to use OpenSSL
1598          although NSS is also possible. Notice that selecting NSS restricts
1599          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1600          restrict by now the usage of NSS in LO's code. Possible values:
1601          openssl, nss. Example: --with-tls="nss"]),
1604 AC_ARG_WITH(system-libs,
1605     AS_HELP_STRING([--with-system-libs],
1606         [Use libraries already on system -- enables all --with-system-* flags.]),
1609 AC_ARG_WITH(system-bzip2,
1610     AS_HELP_STRING([--with-system-bzip2],
1611         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1612     [with_system_bzip2="$with_system_libs"])
1614 AC_ARG_WITH(system-headers,
1615     AS_HELP_STRING([--with-system-headers],
1616         [Use headers already on system -- enables all --with-system-* flags for
1617          external packages whose headers are the only entities used i.e.
1618          boost/odbc/sane-header(s).]),,
1619     [with_system_headers="$with_system_libs"])
1621 AC_ARG_WITH(system-jars,
1622     AS_HELP_STRING([--without-system-jars],
1623         [When building with --with-system-libs, also the needed jars are expected
1624          on the system. Use this to disable that]),,
1625     [with_system_jars="$with_system_libs"])
1627 AC_ARG_WITH(system-cairo,
1628     AS_HELP_STRING([--with-system-cairo],
1629         [Use cairo libraries already on system.  Happens automatically for
1630          (implicit) --enable-gtk and for --enable-gtk3.]))
1632 AC_ARG_WITH(system-epoxy,
1633     AS_HELP_STRING([--with-system-epoxy],
1634         [Use epoxy libraries already on system.  Happens automatically for
1635          --enable-gtk3.]),,
1636        [with_system_epoxy="$with_system_libs"])
1638 AC_ARG_WITH(myspell-dicts,
1639     AS_HELP_STRING([--with-myspell-dicts],
1640         [Adds myspell dictionaries to the LibreOffice installation set]),
1643 AC_ARG_WITH(system-dicts,
1644     AS_HELP_STRING([--without-system-dicts],
1645         [Do not use dictionaries from system paths.]),
1648 AC_ARG_WITH(external-dict-dir,
1649     AS_HELP_STRING([--with-external-dict-dir],
1650         [Specify external dictionary dir.]),
1653 AC_ARG_WITH(external-hyph-dir,
1654     AS_HELP_STRING([--with-external-hyph-dir],
1655         [Specify external hyphenation pattern dir.]),
1658 AC_ARG_WITH(external-thes-dir,
1659     AS_HELP_STRING([--with-external-thes-dir],
1660         [Specify external thesaurus dir.]),
1663 AC_ARG_WITH(system-zlib,
1664     AS_HELP_STRING([--with-system-zlib],
1665         [Use zlib already on system.]),,
1666     [with_system_zlib=auto])
1668 AC_ARG_WITH(system-jpeg,
1669     AS_HELP_STRING([--with-system-jpeg],
1670         [Use jpeg already on system.]),,
1671     [with_system_jpeg="$with_system_libs"])
1673 AC_ARG_WITH(system-clucene,
1674     AS_HELP_STRING([--with-system-clucene],
1675         [Use clucene already on system.]),,
1676     [with_system_clucene="$with_system_libs"])
1678 AC_ARG_WITH(system-expat,
1679     AS_HELP_STRING([--with-system-expat],
1680         [Use expat already on system.]),,
1681     [with_system_expat="$with_system_libs"])
1683 AC_ARG_WITH(system-libxml,
1684     AS_HELP_STRING([--with-system-libxml],
1685         [Use libxml/libxslt already on system.]),,
1686     [with_system_libxml=auto])
1688 AC_ARG_WITH(system-icu,
1689     AS_HELP_STRING([--with-system-icu],
1690         [Use icu already on system.]),,
1691     [with_system_icu="$with_system_libs"])
1693 AC_ARG_WITH(system-ucpp,
1694     AS_HELP_STRING([--with-system-ucpp],
1695         [Use ucpp already on system.]),,
1696     [])
1698 AC_ARG_WITH(system-openldap,
1699     AS_HELP_STRING([--with-system-openldap],
1700         [Use the OpenLDAP LDAP SDK already on system.]),,
1701     [with_system_openldap="$with_system_libs"])
1703 AC_ARG_WITH(system-poppler,
1704     AS_HELP_STRING([--with-system-poppler],
1705         [Use system poppler (only needed for PDF import).]),,
1706     [with_system_poppler="$with_system_libs"])
1708 AC_ARG_WITH(system-gpgmepp,
1709     AS_HELP_STRING([--with-system-gpgmepp],
1710         [Use gpgmepp already on system]),,
1711     [with_system_gpgmepp="$with_system_libs"])
1713 AC_ARG_WITH(system-mariadb,
1714     AS_HELP_STRING([--with-system-mariadb],
1715         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1716          extension.]),,
1717     [with_system_mariadb="$with_system_libs"])
1719 AC_ARG_ENABLE(bundle-mariadb,
1720     AS_HELP_STRING([--enable-bundle-mariadb],
1721         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1724 AC_ARG_WITH(system-mysql-cppconn,
1725     AS_HELP_STRING([--with-system-mysql-cppconn],
1726         [Use MySQL C++ Connector libraries already on system.]),,
1727     [with_system_mysql_cppconn="$with_system_libs"])
1729 AC_ARG_WITH(system-postgresql,
1730     AS_HELP_STRING([--with-system-postgresql],
1731         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1732          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1733     [with_system_postgresql="$with_system_libs"])
1735 AC_ARG_WITH(libpq-path,
1736     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1737         [Use this PostgreSQL C interface (libpq) installation for building
1738          the PostgreSQL-SDBC extension.]),
1741 AC_ARG_WITH(system-firebird,
1742     AS_HELP_STRING([--with-system-firebird],
1743         [Use Firebird libraries already on system, for building the Firebird-SDBC
1744          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1745     [with_system_firebird="$with_system_libs"])
1747 AC_ARG_WITH(system-libtommath,
1748             AS_HELP_STRING([--with-system-libtommath],
1749                            [Use libtommath already on system]),,
1750             [with_system_libtommath="$with_system_libs"])
1752 AC_ARG_WITH(system-hsqldb,
1753     AS_HELP_STRING([--with-system-hsqldb],
1754         [Use hsqldb already on system.]))
1756 AC_ARG_WITH(hsqldb-jar,
1757     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1758         [Specify path to jarfile manually.]),
1759     HSQLDB_JAR=$withval)
1761 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1762     AS_HELP_STRING([--disable-scripting-beanshell],
1763         [Disable support for scripts in BeanShell.]),
1767 AC_ARG_WITH(system-beanshell,
1768     AS_HELP_STRING([--with-system-beanshell],
1769         [Use beanshell already on system.]),,
1770     [with_system_beanshell="$with_system_jars"])
1772 AC_ARG_WITH(beanshell-jar,
1773     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1774         [Specify path to jarfile manually.]),
1775     BSH_JAR=$withval)
1777 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1778     AS_HELP_STRING([--disable-scripting-javascript],
1779         [Disable support for scripts in JavaScript.]),
1783 AC_ARG_WITH(system-rhino,
1784     AS_HELP_STRING([--with-system-rhino],
1785         [Use rhino already on system.]),,)
1786 #    [with_system_rhino="$with_system_jars"])
1787 # Above is not used as we have different debug interface
1788 # patched into internal rhino. This code needs to be fixed
1789 # before we can enable it by default.
1791 AC_ARG_WITH(rhino-jar,
1792     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1793         [Specify path to jarfile manually.]),
1794     RHINO_JAR=$withval)
1796 AC_ARG_WITH(system-jfreereport,
1797     AS_HELP_STRING([--with-system-jfreereport],
1798         [Use JFreeReport already on system.]),,
1799     [with_system_jfreereport="$with_system_jars"])
1801 AC_ARG_WITH(sac-jar,
1802     AS_HELP_STRING([--with-sac-jar=JARFILE],
1803         [Specify path to jarfile manually.]),
1804     SAC_JAR=$withval)
1806 AC_ARG_WITH(libxml-jar,
1807     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1808         [Specify path to jarfile manually.]),
1809     LIBXML_JAR=$withval)
1811 AC_ARG_WITH(flute-jar,
1812     AS_HELP_STRING([--with-flute-jar=JARFILE],
1813         [Specify path to jarfile manually.]),
1814     FLUTE_JAR=$withval)
1816 AC_ARG_WITH(jfreereport-jar,
1817     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1818         [Specify path to jarfile manually.]),
1819     JFREEREPORT_JAR=$withval)
1821 AC_ARG_WITH(liblayout-jar,
1822     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1823         [Specify path to jarfile manually.]),
1824     LIBLAYOUT_JAR=$withval)
1826 AC_ARG_WITH(libloader-jar,
1827     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1828         [Specify path to jarfile manually.]),
1829     LIBLOADER_JAR=$withval)
1831 AC_ARG_WITH(libformula-jar,
1832     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1833         [Specify path to jarfile manually.]),
1834     LIBFORMULA_JAR=$withval)
1836 AC_ARG_WITH(librepository-jar,
1837     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1838         [Specify path to jarfile manually.]),
1839     LIBREPOSITORY_JAR=$withval)
1841 AC_ARG_WITH(libfonts-jar,
1842     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1843         [Specify path to jarfile manually.]),
1844     LIBFONTS_JAR=$withval)
1846 AC_ARG_WITH(libserializer-jar,
1847     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1848         [Specify path to jarfile manually.]),
1849     LIBSERIALIZER_JAR=$withval)
1851 AC_ARG_WITH(libbase-jar,
1852     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1853         [Specify path to jarfile manually.]),
1854     LIBBASE_JAR=$withval)
1856 AC_ARG_WITH(system-odbc,
1857     AS_HELP_STRING([--with-system-odbc],
1858         [Use the odbc headers already on system.]),,
1859     [with_system_odbc="auto"])
1861 AC_ARG_WITH(system-sane,
1862     AS_HELP_STRING([--with-system-sane],
1863         [Use sane.h already on system.]),,
1864     [with_system_sane="$with_system_headers"])
1866 AC_ARG_WITH(system-bluez,
1867     AS_HELP_STRING([--with-system-bluez],
1868         [Use bluetooth.h already on system.]),,
1869     [with_system_bluez="$with_system_headers"])
1871 AC_ARG_WITH(system-curl,
1872     AS_HELP_STRING([--with-system-curl],
1873         [Use curl already on system.]),,
1874     [with_system_curl=auto])
1876 AC_ARG_WITH(system-boost,
1877     AS_HELP_STRING([--with-system-boost],
1878         [Use boost already on system.]),,
1879     [with_system_boost="$with_system_headers"])
1881 AC_ARG_WITH(system-glm,
1882     AS_HELP_STRING([--with-system-glm],
1883         [Use glm already on system.]),,
1884     [with_system_glm="$with_system_headers"])
1886 AC_ARG_WITH(system-hunspell,
1887     AS_HELP_STRING([--with-system-hunspell],
1888         [Use libhunspell already on system.]),,
1889     [with_system_hunspell="$with_system_libs"])
1891 AC_ARG_WITH(system-mythes,
1892     AS_HELP_STRING([--with-system-mythes],
1893         [Use mythes already on system.]),,
1894     [with_system_mythes="$with_system_libs"])
1896 AC_ARG_WITH(system-altlinuxhyph,
1897     AS_HELP_STRING([--with-system-altlinuxhyph],
1898         [Use ALTLinuxhyph already on system.]),,
1899     [with_system_altlinuxhyph="$with_system_libs"])
1901 AC_ARG_WITH(system-lpsolve,
1902     AS_HELP_STRING([--with-system-lpsolve],
1903         [Use lpsolve already on system.]),,
1904     [with_system_lpsolve="$with_system_libs"])
1906 AC_ARG_WITH(system-coinmp,
1907     AS_HELP_STRING([--with-system-coinmp],
1908         [Use CoinMP already on system.]),,
1909     [with_system_coinmp="$with_system_libs"])
1911 AC_ARG_WITH(system-liblangtag,
1912     AS_HELP_STRING([--with-system-liblangtag],
1913         [Use liblangtag library already on system.]),,
1914     [with_system_liblangtag="$with_system_libs"])
1916 AC_ARG_WITH(webdav,
1917     AS_HELP_STRING([--with-webdav],
1918         [Specify which library to use for webdav implementation.
1919          Possible values: "neon", "serf", "no". The default value is "neon".
1920          Example: --with-webdav="serf"]),
1921     WITH_WEBDAV=$withval,
1922     WITH_WEBDAV="neon")
1924 AC_ARG_WITH(linker-hash-style,
1925     AS_HELP_STRING([--with-linker-hash-style],
1926         [Use linker with --hash-style=<style> when linking shared objects.
1927          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1928          if supported on the build system, and "sysv" otherwise.]))
1930 AC_ARG_WITH(jdk-home,
1931     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1932         [If you have installed JDK 1.6 or later on your system please supply the
1933          path here. Note that this is not the location of the java command but the
1934          location of the entire distribution.]),
1937 AC_ARG_WITH(help,
1938     AS_HELP_STRING([--with-help],
1939         [Enable the build of help. There is a special parameter "common" that
1940          can be used to bundle only the common part, .e.g help-specific icons.
1941          This is useful when you build the helpcontent separately.])
1942     [
1943                           Usage:     --with-help    build the old local help
1944                                  --without-help     no local help (default)
1945                                  --with-help=html   build the new HTML local help
1946                                  --with-help=online build the new HTML online help
1947     ],
1950 libo_FUZZ_ARG_WITH(java,
1951     AS_HELP_STRING([--with-java=<java command>],
1952         [Specify the name of the Java interpreter command. Typically "java"
1953          which is the default.
1955          To build without support for Java components, applets, accessibility
1956          or the XML filters written in Java, use --without-java or --with-java=no.]),
1957     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1958     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
1961 AC_ARG_WITH(jvm-path,
1962     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
1963         [Use a specific JVM search path at runtime.
1964          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
1967 AC_ARG_WITH(ant-home,
1968     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
1969         [If you have installed Jakarta Ant on your system, please supply the path here.
1970          Note that this is not the location of the Ant binary but the location
1971          of the entire distribution.]),
1974 AC_ARG_WITH(symbol-config,
1975     AS_HELP_STRING([--with-symbol-config],
1976         [Configuration for the crashreport symbol upload]),
1977         [],
1978         [with_symbol_config=no])
1980 AC_ARG_WITH(export-validation,
1981     AS_HELP_STRING([--without-export-validation],
1982         [Disable validating OOXML and ODF files as exported from in-tree tests.
1983          Use this option e.g. if your system only provides Java 5.]),
1984 ,with_export_validation=auto)
1986 AC_ARG_WITH(bffvalidator,
1987     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
1988         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
1989          Requires installed Microsoft Office Binary File Format Validator.
1990          Note: export-validation (--with-export-validation) is required to be turned on.
1991          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
1992 ,with_bffvalidator=no)
1994 libo_FUZZ_ARG_WITH(junit,
1995     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
1996         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
1997          --without-junit disables those tests. Not relevant in the --without-java case.]),
1998 ,with_junit=yes)
2000 AC_ARG_WITH(hamcrest,
2001     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2002         [Specifies the hamcrest jar file to use for JUnit-based tests.
2003          --without-junit disables those tests. Not relevant in the --without-java case.]),
2004 ,with_hamcrest=yes)
2006 AC_ARG_WITH(perl-home,
2007     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2008         [If you have installed Perl 5 Distribution, on your system, please
2009          supply the path here. Note that this is not the location of the Perl
2010          binary but the location of the entire distribution.]),
2013 libo_FUZZ_ARG_WITH(doxygen,
2014     AS_HELP_STRING(
2015         [--with-doxygen=<absolute path to doxygen executable>],
2016         [Specifies the doxygen executable to use when generating ODK C/C++
2017          documentation. --without-doxygen disables generation of ODK C/C++
2018          documentation. Not relevant in the --disable-odk case.]),
2019 ,with_doxygen=yes)
2021 AC_ARG_WITH(visual-studio,
2022     AS_HELP_STRING([--with-visual-studio=<2015/2017>],
2023         [Specify which Visual Studio version to use in case several are
2024          installed. If not specified, defaults to 2015.]),
2027 AC_ARG_WITH(windows-sdk,
2028     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10>],
2029         [Specify which Windows SDK, or "Windows Kit", version to use
2030          in case the one that came with the selected Visual Studio
2031          is not what you want for some reason. Note that not all compiler/SDK
2032          combinations are supported. The intent is that this option should not
2033          be needed.]),
2036 AC_ARG_WITH(lang,
2037     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2038         [Use this option to build LibreOffice with additional UI language support.
2039          English (US) is always included by default.
2040          Separate multiple languages with space.
2041          For all languages, use --with-lang=ALL.]),
2044 AC_ARG_WITH(locales,
2045     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2046         [Use this option to limit the locale information built in.
2047          Separate multiple locales with space.
2048          Very experimental and might well break stuff.
2049          Just a desperate measure to shrink code and data size.
2050          By default all the locales available is included.
2051          This option is completely unrelated to --with-lang.])
2052     [
2053                           Affects also our character encoding conversion
2054                           tables for encodings mainly targeted for a
2055                           particular locale, like EUC-CN and EUC-TW for
2056                           zh, ISO-2022-JP for ja.
2058                           Affects also our add-on break iterator data for
2059                           some languages.
2061                           For the default, all locales, don't use this switch at all.
2062                           Specifying just the language part of a locale means all matching
2063                           locales will be included.
2064     ],
2067 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2068 libo_FUZZ_ARG_WITH(krb5,
2069     AS_HELP_STRING([--with-krb5],
2070         [Enable MIT Kerberos 5 support in modules that support it.
2071          By default automatically enabled on platforms
2072          where a good system Kerberos 5 is available.]),
2075 libo_FUZZ_ARG_WITH(gssapi,
2076     AS_HELP_STRING([--with-gssapi],
2077         [Enable GSSAPI support in modules that support it.
2078          By default automatically enabled on platforms
2079          where a good system GSSAPI is available.]),
2082 AC_ARG_WITH(iwyu,
2083     AS_HELP_STRING([--with-iwyu],
2084         [Use given IWYU binary path to check unneeded includes instead of building.
2085          Use only if you are hacking on it.]),
2088 libo_FUZZ_ARG_WITH(lxml,
2089     AS_HELP_STRING([--without-lxml],
2090         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2091          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2092          report widget classes and ids.]),
2095 dnl ===================================================================
2096 dnl Branding
2097 dnl ===================================================================
2099 AC_ARG_WITH(branding,
2100     AS_HELP_STRING([--with-branding=/path/to/images],
2101         [Use given path to retrieve branding images set.])
2102     [
2103                           Search for intro.png about.svg and flat_logo.svg.
2104                           If any is missing, default ones will be used instead.
2106                           Search also progress.conf for progress
2107                           settings on intro screen :
2109                           PROGRESSBARCOLOR="255,255,255" Set color of
2110                           progress bar. Comma separated RGB decimal values.
2111                           PROGRESSSIZE="407,6" Set size of progress bar.
2112                           Comma separated decimal values (width, height).
2113                           PROGRESSPOSITION="61,317" Set position of progress
2114                           bar from left,top. Comma separated decimal values.
2115                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2116                           bar frame. Comma separated RGB decimal values.
2117                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2118                           bar text. Comma separated RGB decimal values.
2119                           PROGRESSTEXTBASELINE="287" Set vertical position of
2120                           progress bar text from top. Decimal value.
2122                           Default values will be used if not found.
2123     ],
2127 AC_ARG_WITH(extra-buildid,
2128     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2129         [Show addition build identification in about dialog.]),
2133 AC_ARG_WITH(vendor,
2134     AS_HELP_STRING([--with-vendor="John the Builder"],
2135         [Set vendor of the build.]),
2138 AC_ARG_WITH(android-package-name,
2139     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2140         [Set Android package name of the build.]),
2143 AC_ARG_WITH(compat-oowrappers,
2144     AS_HELP_STRING([--with-compat-oowrappers],
2145         [Install oo* wrappers in parallel with
2146          lo* ones to keep backward compatibility.
2147          Has effect only with make distro-pack-install]),
2150 AC_ARG_WITH(os-version,
2151     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2152         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2155 AC_ARG_WITH(mingw-cross-compiler,
2156     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2157         [Specify the MinGW cross-compiler to use.
2158          When building on the ODK on Unix and building unowinreg.dll,
2159          specify the MinGW C++ cross-compiler.]),
2162 AC_ARG_WITH(idlc-cpp,
2163     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2164         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2167 AC_ARG_WITH(build-version,
2168     AS_HELP_STRING([--with-build-version="Built by Jim"],
2169         [Allows the builder to add a custom version tag that will appear in the
2170          Help/About box for QA purposes.]),
2171 with_build_version=$withval,
2174 AC_ARG_WITH(alloc,
2175     AS_HELP_STRING([--with-alloc],
2176         [Define which allocator to build with (choices are internal, system).]),
2179 AC_ARG_WITH(parallelism,
2180     AS_HELP_STRING([--with-parallelism],
2181         [Number of jobs to run simultaneously during build. Parallel builds can
2182         save a lot of time on multi-cpu machines. Defaults to the number of
2183         CPUs on the machine, unless you configure --enable-icecream - then to
2184         10.]),
2187 AC_ARG_WITH(all-tarballs,
2188     AS_HELP_STRING([--with-all-tarballs],
2189         [Download all external tarballs unconditionally]))
2191 AC_ARG_WITH(gdrive-client-id,
2192     AS_HELP_STRING([--with-gdrive-client-id],
2193         [Provides the client id of the application for OAuth2 authentication
2194         on Google Drive. If either this or --with-gdrive-client-secret is
2195         empty, the feature will be disabled]),
2198 AC_ARG_WITH(gdrive-client-secret,
2199     AS_HELP_STRING([--with-gdrive-client-secret],
2200         [Provides the client secret of the application for OAuth2
2201         authentication on Google Drive. If either this or
2202         --with-gdrive-client-id is empty, the feature will be disabled]),
2205 AC_ARG_WITH(alfresco-cloud-client-id,
2206     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2207         [Provides the client id of the application for OAuth2 authentication
2208         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2209         empty, the feature will be disabled]),
2212 AC_ARG_WITH(alfresco-cloud-client-secret,
2213     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2214         [Provides the client secret of the application for OAuth2
2215         authentication on Alfresco Cloud. If either this or
2216         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2219 AC_ARG_WITH(onedrive-client-id,
2220     AS_HELP_STRING([--with-onedrive-client-id],
2221         [Provides the client id of the application for OAuth2 authentication
2222         on OneDrive. If either this or --with-onedrive-client-secret is
2223         empty, the feature will be disabled]),
2226 AC_ARG_WITH(onedrive-client-secret,
2227     AS_HELP_STRING([--with-onedrive-client-secret],
2228         [Provides the client secret of the application for OAuth2
2229         authentication on OneDrive. If either this or
2230         --with-onedrive-client-id is empty, the feature will be disabled]),
2232 dnl ===================================================================
2233 dnl Do we want to use pre-build binary tarball for recompile
2234 dnl ===================================================================
2236 if test "$enable_library_bin_tar" = "yes" ; then
2237     USE_LIBRARY_BIN_TAR=TRUE
2238 else
2239     USE_LIBRARY_BIN_TAR=
2241 AC_SUBST(USE_LIBRARY_BIN_TAR)
2243 dnl ===================================================================
2244 dnl Test whether build target is Release Build
2245 dnl ===================================================================
2246 AC_MSG_CHECKING([whether build target is Release Build])
2247 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2248     AC_MSG_RESULT([no])
2249     ENABLE_RELEASE_BUILD=
2250 else
2251     AC_MSG_RESULT([yes])
2252     ENABLE_RELEASE_BUILD=TRUE
2254 AC_SUBST(ENABLE_RELEASE_BUILD)
2256 dnl ===================================================================
2257 dnl Test whether to sign Windows Build
2258 dnl ===================================================================
2259 AC_MSG_CHECKING([whether to sign windows build])
2260 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2261     AC_MSG_RESULT([yes])
2262     WINDOWS_BUILD_SIGNING="TRUE"
2263 else
2264     AC_MSG_RESULT([no])
2265     WINDOWS_BUILD_SIGNING="FALSE"
2267 AC_SUBST(WINDOWS_BUILD_SIGNING)
2269 dnl ===================================================================
2270 dnl MacOSX build and runtime environment options
2271 dnl ===================================================================
2273 AC_ARG_WITH(macosx-sdk,
2274     AS_HELP_STRING([--with-macosx-sdk=<version>],
2275         [Prefer a specific SDK for building.])
2276     [
2277                           If the requested SDK is not available, a search for the oldest one will be done.
2278                           With current Xcode versions, only the latest SDK is included, so this option is
2279                           not terribly useful. It works fine to build with a new SDK and run the result
2280                           on an older OS.
2282                           e. g.: --with-macosx-sdk=10.9
2284                           there are 3 options to control the MacOSX build:
2285                           --with-macosx-sdk (referred as 'sdk' below)
2286                           --with-macosx-version-min-required (referred as 'min' below)
2287                           --with-macosx-version-max-allowed (referred as 'max' below)
2289                           the connection between these value and the default they take is as follow:
2290                           ( ? means not specified on the command line, s means the SDK version found,
2291                           constraint: 8 <= x <= y <= z)
2293                           ==========================================
2294                            command line      || config result
2295                           ==========================================
2296                           min  | max  | sdk  || min  | max  | sdk  |
2297                           ?    | ?    | ?    || 10.9 | 10.s | 10.s |
2298                           ?    | ?    | 10.x || 10.9 | 10.x | 10.x |
2299                           ?    | 10.x | ?    || 10.9 | 10.s | 10.s |
2300                           ?    | 10.x | 10.y || 10.9 | 10.x | 10.y |
2301                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2302                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2303                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2304                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2307                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2308                           for a detailed technical explanation of these variables
2310                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2311     ],
2314 AC_ARG_WITH(macosx-version-min-required,
2315     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2316         [set the minimum OS version needed to run the built LibreOffice])
2317     [
2318                           e. g.: --with-macos-version-min-required=10.9
2319                           see --with-macosx-sdk for more info
2320     ],
2323 AC_ARG_WITH(macosx-version-max-allowed,
2324     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2325         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2326     [
2327                           e. g.: --with-macos-version-max-allowed=10.9
2328                           see --with-macosx-sdk for more info
2329     ],
2333 dnl ===================================================================
2334 dnl options for stuff used during cross-compilation build
2335 dnl Not quite superseded by --with-build-platform-configure-options.
2336 dnl TODO: check, if the "force" option is still needed anywhere.
2337 dnl ===================================================================
2339 AC_ARG_WITH(system-icu-for-build,
2340     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2341         [Use icu already on system for build tools (cross-compilation only).]))
2344 dnl ===================================================================
2345 dnl Check for incompatible options set by fuzzing, and reset those
2346 dnl automatically to working combinations
2347 dnl ===================================================================
2349 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2350         "$enable_dbus" != "$enable_avahi"; then
2351     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2352     enable_avahi=$enable_dbus
2355 dnl ===================================================================
2356 dnl check for required programs (grep, awk, sed, bash)
2357 dnl ===================================================================
2359 pathmunge ()
2361     if test -n "$1"; then
2362         if test "$build_os" = "cygwin"; then
2363             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2364                 PathFormat "$1"
2365                 new_path=`cygpath -sm "$formatted_path"`
2366             else
2367                 PathFormat "$1"
2368                 new_path=`cygpath -u "$formatted_path"`
2369             fi
2370         else
2371             new_path="$1"
2372         fi
2373         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2374             if test "$2" = "after"; then
2375                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2376             else
2377                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2378             fi
2379         fi
2380         unset new_path
2381     fi
2384 AC_PROG_AWK
2385 AC_PATH_PROG( AWK, $AWK)
2386 if test -z "$AWK"; then
2387     AC_MSG_ERROR([install awk to run this script])
2390 AC_PATH_PROG(BASH, bash)
2391 if test -z "$BASH"; then
2392     AC_MSG_ERROR([bash not found in \$PATH])
2394 AC_SUBST(BASH)
2396 AC_MSG_CHECKING([for GNU or BSD tar])
2397 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2398     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2399     if test $? -eq 0;  then
2400         GNUTAR=$a
2401         break
2402     fi
2403 done
2404 AC_MSG_RESULT($GNUTAR)
2405 if test -z "$GNUTAR"; then
2406     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2408 AC_SUBST(GNUTAR)
2410 AC_MSG_CHECKING([for tar's option to strip components])
2411 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2412 if test $? -eq 0; then
2413     STRIP_COMPONENTS="--strip-components"
2414 else
2415     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2416     if test $? -eq 0; then
2417         STRIP_COMPONENTS="--strip-path"
2418     else
2419         STRIP_COMPONENTS="unsupported"
2420     fi
2422 AC_MSG_RESULT($STRIP_COMPONENTS)
2423 if test x$STRIP_COMPONENTS = xunsupported; then
2424     AC_MSG_ERROR([you need a tar that is able to strip components.])
2426 AC_SUBST(STRIP_COMPONENTS)
2428 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2429 dnl desktop OSes from "mobile" ones.
2431 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2432 dnl In other words, that when building for an OS that is not a
2433 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2435 dnl Note the direction of the implication; there is no assumption that
2436 dnl cross-compiling would imply a non-desktop OS.
2438 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2439     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2440     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2441     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2444 # Whether to build "avmedia" functionality or not.
2446 if test -z "$enable_avmedia"; then
2447     enable_avmedia=yes
2450 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2451 if test "$enable_avmedia" = yes; then
2452     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2453 else
2454     USE_AVMEDIA_DUMMY='TRUE'
2456 AC_SUBST(USE_AVMEDIA_DUMMY)
2458 # Decide whether to build database connectivity stuff (including
2459 # Base) or not. We probably don't want to on non-desktop OSes.
2460 if test -z "$enable_database_connectivity"; then
2461     # --disable-database-connectivity is unfinished work in progress
2462     # and the iOS test app doesn't link if we actually try to use it.
2463     # if test $_os != iOS -a $_os != Android; then
2464     if test $_os != iOS; then
2465         enable_database_connectivity=yes
2466     fi
2469 if test "$enable_database_connectivity" = yes; then
2470     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2471     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2474 if test -z "$enable_extensions"; then
2475     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2476     if test $_os != iOS -a $_os != Android; then
2477         enable_extensions=yes
2478     fi
2481 if test "$enable_extensions" = yes; then
2482     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2483     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2486 if test -z "$enable_scripting"; then
2487     # Disable scripting for iOS unless specifically overridden
2488     # with --enable-scripting.
2489     if test $_os != iOS; then
2490         enable_scripting=yes
2491     fi
2494 DISABLE_SCRIPTING=''
2495 if test "$enable_scripting" = yes; then
2496     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2497     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2498 else
2499     DISABLE_SCRIPTING='TRUE'
2500     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2503 if test $_os = iOS -o $_os = Android; then
2504     # Disable dynamic_loading always for iOS and Android
2505     enable_dynamic_loading=no
2506 elif test -z "$enable_dynamic_loading"; then
2507     # Otherwise enable it unless speficically disabled
2508     enable_dynamic_loading=yes
2511 DISABLE_DYNLOADING=''
2512 if test "$enable_dynamic_loading" = yes; then
2513     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2514 else
2515     DISABLE_DYNLOADING='TRUE'
2517 AC_SUBST(DISABLE_DYNLOADING)
2519 # remenber SYSBASE value
2520 AC_SUBST(SYSBASE)
2522 dnl ===================================================================
2523 dnl  Sort out various gallery compilation options
2524 dnl ===================================================================
2525 AC_MSG_CHECKING([how to build and package galleries])
2526 if test -n "${with_galleries}"; then
2527     if test "$with_galleries" = "build"; then
2528         WITH_GALLERY_BUILD=TRUE
2529         AC_MSG_RESULT([build from source images internally])
2530     elif test "$with_galleries" = "no"; then
2531         WITH_GALLERY_BUILD=
2532         AC_MSG_RESULT([disable non-internal gallery build])
2533     else
2534         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2535     fi
2536 else
2537     if test $_os != iOS -a $_os != Android; then
2538         WITH_GALLERY_BUILD=TRUE
2539         AC_MSG_RESULT([internal src images for desktop])
2540     else
2541         WITH_GALLERY_BUILD=
2542         AC_MSG_RESULT([disable src image build])
2543     fi
2545 AC_SUBST(WITH_GALLERY_BUILD)
2547 dnl ===================================================================
2548 dnl  Checks if ccache is available
2549 dnl ===================================================================
2550 if test "$_os" = "WINNT"; then
2551     # on windows/VC build do not use ccache
2552     CCACHE=""
2553 elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2554     case "%$CC%$CXX%" in
2555     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2556     # assume that's good then
2557     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2558         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2559         ;;
2560     *)
2561         AC_PATH_PROG([CCACHE],[ccache],[not found])
2562         if test "$CCACHE" = "not found"; then
2563             CCACHE=""
2564         else
2565             # Need to check for ccache version: otherwise prevents
2566             # caching of the results (like "-x objective-c++" for Mac)
2567             if test $_os = Darwin -o $_os = iOS; then
2568                 # Check ccache version
2569                 AC_MSG_CHECKING([whether version of ccache is suitable])
2570                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2571                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2572                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2573                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2574                 else
2575                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2576                     CCACHE=""
2577                 fi
2578             fi
2579         fi
2580         ;;
2581     esac
2582 else
2583     CCACHE=""
2586 if test "$CCACHE" != ""; then
2587     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2588     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2589     if test "$ccache_size" = ""; then
2590         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2591         if test "$ccache_size" = ""; then
2592             ccache_size=0
2593         fi
2594         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2595         if test $ccache_size -lt 1024; then
2596             CCACHE=""
2597             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2598             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2599         else
2600             # warn that ccache may be too small for debug build
2601             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2602             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2603         fi
2604     else
2605         if test $ccache_size -lt 5; then
2606             #warn that ccache may be too small for debug build
2607             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2608             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2609         fi
2610     fi
2613 dnl ===================================================================
2614 dnl  Checks for C compiler,
2615 dnl  The check for the C++ compiler is later on.
2616 dnl ===================================================================
2617 if test "$_os" != "WINNT"; then
2618     GCC_HOME_SET="true"
2619     AC_MSG_CHECKING([gcc home])
2620     if test -z "$with_gcc_home"; then
2621         if test "$enable_icecream" = "yes"; then
2622             if test -d "/usr/lib/icecc/bin"; then
2623                 GCC_HOME="/usr/lib/icecc/"
2624             elif test -d "/usr/libexec/icecc/bin"; then
2625                 GCC_HOME="/usr/libexec/icecc/"
2626             elif test -d "/opt/icecream/bin"; then
2627                 GCC_HOME="/opt/icecream/"
2628             else
2629                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2631             fi
2632         else
2633             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2634             GCC_HOME_SET="false"
2635         fi
2636     else
2637         GCC_HOME="$with_gcc_home"
2638     fi
2639     AC_MSG_RESULT($GCC_HOME)
2640     AC_SUBST(GCC_HOME)
2642     if test "$GCC_HOME_SET" = "true"; then
2643         if test -z "$CC"; then
2644             CC="$GCC_HOME/bin/gcc"
2645         fi
2646         if test -z "$CXX"; then
2647             CXX="$GCC_HOME/bin/g++"
2648         fi
2649     fi
2652 COMPATH=`dirname "$CC"`
2653 if test "$COMPATH" = "."; then
2654     AC_PATH_PROGS(COMPATH, $CC)
2655     dnl double square bracket to get single because of M4 quote...
2656     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2658 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2660 dnl ===================================================================
2661 dnl Java support
2662 dnl ===================================================================
2663 AC_MSG_CHECKING([whether to build with Java support])
2664 if test "$with_java" != "no"; then
2665     if test "$DISABLE_SCRIPTING" = TRUE; then
2666         AC_MSG_RESULT([no, overridden by --disable-scripting])
2667         ENABLE_JAVA=""
2668         with_java=no
2669     else
2670         AC_MSG_RESULT([yes])
2671         ENABLE_JAVA="TRUE"
2672         AC_DEFINE(HAVE_FEATURE_JAVA)
2673     fi
2674 else
2675     AC_MSG_RESULT([no])
2676     ENABLE_JAVA=""
2679 AC_SUBST(ENABLE_JAVA)
2681 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2683 dnl ENABLE_JAVA="" indicate no Java support at all
2685 dnl ===================================================================
2686 dnl Check OS X SDK and compiler
2687 dnl ===================================================================
2689 if test $_os = Darwin -o $_os = iOS; then
2691     # If no --with-macosx-sdk option is given, look for one
2693     # The intent is that for "most" Mac-based developers, a suitable
2694     # SDK will be found automatically without any configure options.
2696     # For developers with a current Xcode, the lowest-numbered SDK
2697     # higher than or equal to the minimum required should be found.
2699     AC_MSG_CHECKING([what Mac OS X SDK to use])
2700     for _macosx_sdk in $with_macosx_sdk 10.14 10.13 10.12; do
2701         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2702         if test -d "$MACOSX_SDK_PATH"; then
2703             with_macosx_sdk="${_macosx_sdk}"
2704             break
2705         else
2706             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2707             if test -d "$MACOSX_SDK_PATH"; then
2708                 with_macosx_sdk="${_macosx_sdk}"
2709                 break
2710             fi
2711         fi
2712     done
2713     if test ! -d "$MACOSX_SDK_PATH"; then
2714         AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2715     fi
2717     if test $_os = iOS; then
2718         if test "$enable_ios_simulator" = "yes"; then
2719             useos=iphonesimulator
2720         else
2721             useos=iphoneos
2722         fi
2723         MACOSX_SDK_PATH=`xcrun --sdk ${useos} --show-sdk-path 2> /dev/null`
2724     fi
2725     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2728     case $with_macosx_sdk in
2729     10.9)
2730         MACOSX_SDK_VERSION=1090
2731         ;;
2732     10.10)
2733         MACOSX_SDK_VERSION=101000
2734         ;;
2735     10.11)
2736         MACOSX_SDK_VERSION=101100
2737         ;;
2738     10.12)
2739         MACOSX_SDK_VERSION=101200
2740         ;;
2741     10.13)
2742         MACOSX_SDK_VERSION=101300
2743         ;;
2744     10.14)
2745         MACOSX_SDK_VERSION=101400
2746         ;;
2747     *)
2748         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.9--13])
2749         ;;
2750     esac
2752     if test "$with_macosx_version_min_required" = "" ; then
2753         with_macosx_version_min_required="10.9";
2754     fi
2756     if test "$with_macosx_version_max_allowed" = "" ; then
2757         with_macosx_version_max_allowed="$with_macosx_sdk"
2758     fi
2760     # export this so that "xcrun" invocations later return matching values
2761     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2762     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2763     export DEVELOPER_DIR
2764     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2765     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2767     case "$with_macosx_version_min_required" in
2768     10.9)
2769         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2770         ;;
2771     10.10)
2772         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2773         ;;
2774     10.11)
2775         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2776         ;;
2777     10.12)
2778         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2779         ;;
2780     10.13)
2781         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2782         ;;
2783     10.14)
2784         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2785         ;;
2786     *)
2787         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.9--13])
2788         ;;
2789     esac
2790     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2792     LIBTOOL=/usr/bin/libtool
2793     INSTALL_NAME_TOOL=install_name_tool
2794     if test -z "$save_CC"; then
2795         AC_MSG_CHECKING([what compiler to use])
2796         stdlib=-stdlib=libc++
2797         if test "$ENABLE_LTO" = TRUE; then
2798             lto=-flto
2799         fi
2800         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2801         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2802         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2803         AR=`xcrun -find ar`
2804         NM=`xcrun -find nm`
2805         STRIP=`xcrun -find strip`
2806         LIBTOOL=`xcrun -find libtool`
2807         RANLIB=`xcrun -find ranlib`
2808         AC_MSG_RESULT([$CC and $CXX])
2809     fi
2811     case "$with_macosx_version_max_allowed" in
2812     10.9)
2813         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2814         ;;
2815     10.10)
2816         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2817         ;;
2818     10.11)
2819         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2820         ;;
2821     10.12)
2822         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2823         ;;
2824     10.13)
2825         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2826         ;;
2827     10.14)
2828         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2829         ;;
2830     *)
2831         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.9--13])
2832         ;;
2833     esac
2835     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2836     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2837         AC_MSG_RESULT([$MAC_OS_X_VERSION_MIN_REQUIRED])
2838         AC_MSG_RESULT([$MAC_OS_X_VERSION_MAX_REQUIRED])
2839         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2840     else
2841         AC_MSG_RESULT([ok])
2842     fi
2844     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2845     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2846         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2847     else
2848         AC_MSG_RESULT([ok])
2849     fi
2850     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2851     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2853     AC_MSG_CHECKING([whether to do code signing])
2855     if test "$enable_macosx_code_signing" = yes; then
2856         # By default use the first suitable certificate (?).
2858         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2859         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2860         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2861         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2862         # "Developer ID Application" one.
2864         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2865         if test -n "$identity"; then
2866             MACOSX_CODESIGNING_IDENTITY=$identity
2867             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2868             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2869         else
2870             AC_MSG_ERROR([cannot determine identity to use])
2871         fi
2872     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2873         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2874         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2875         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2876     else
2877         AC_MSG_RESULT([no])
2878     fi
2880     AC_MSG_CHECKING([whether to create a Mac App Store package])
2882     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2883         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2884     elif test "$enable_macosx_package_signing" = yes; then
2885         # By default use the first suitable certificate.
2886         # It should be a "3rd Party Mac Developer Installer" one
2888         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2889         if test -n "$identity"; then
2890             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2891             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2892             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2893         else
2894             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2895         fi
2896     elif test -n "$enable_macosx_package_signing"; then
2897         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2898         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2899         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2900     else
2901         AC_MSG_RESULT([no])
2902     fi
2904     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2905         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2906     fi
2908     AC_MSG_CHECKING([whether to sandbox the application])
2910     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2911         AC_MSG_ERROR([OS X sandboxing requires code signing])
2912     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2913         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2914     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2915         ENABLE_MACOSX_SANDBOX=TRUE
2916         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2917         AC_MSG_RESULT([yes])
2918     else
2919         AC_MSG_RESULT([no])
2920     fi
2922     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2923     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2924     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2926 AC_SUBST(MACOSX_SDK_PATH)
2927 AC_SUBST(MACOSX_SDK_VERSION)
2928 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2929 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2930 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
2931 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2932 AC_SUBST(INSTALL_NAME_TOOL)
2933 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2934 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2935 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2936 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2937 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2939 dnl ===================================================================
2940 dnl Check iOS SDK and compiler
2941 dnl ===================================================================
2943 if test $_os = iOS; then
2944     AC_MSG_CHECKING([what iOS SDK to use])
2945     current_sdk_ver=11.3
2946     if test "$enable_ios_simulator" = "yes"; then
2947         platform=iPhoneSimulator
2948         versionmin=-mios-simulator-version-min=$current_sdk_ver
2949     else
2950         platform=iPhoneOS
2951         versionmin=-miphoneos-version-min=$current_sdk_ver
2952     fi
2953     xcode_developer=`xcode-select -print-path`
2955     for sdkver in $current_sdk_ver; do
2956         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2957         if test -d $t; then
2958             ios_sdk=$sdkver
2959             sysroot=$t
2960             break
2961         fi
2962     done
2964     if test -z "$sysroot"; then
2965         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
2966     fi
2968     AC_MSG_RESULT($sysroot)
2970     IOS_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
2971     IOS_DEPLOYMENT_VERSION=$current_sdk_ver
2973     # LTO is not really recommended for iOS builds,
2974     # the link time will be astronomical
2975     if test "$ENABLE_LTO" = TRUE; then
2976         lto=-flto
2977     fi
2979     stdlib="-stdlib=libc++"
2981     CC="`xcrun -find clang` -arch $host_cpu -isysroot $sysroot $lto $versionmin"
2982     CXX="`xcrun -find clang++` -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
2984     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2985     AR=`xcrun -find ar`
2986     NM=`xcrun -find nm`
2987     STRIP=`xcrun -find strip`
2988     LIBTOOL=`xcrun -find libtool`
2989     RANLIB=`xcrun -find ranlib`
2992 AC_SUBST(IOS_SDK)
2993 AC_SUBST(IOS_DEPLOYMENT_VERSION)
2995 AC_MSG_CHECKING([whether to treat the installation as read-only])
2997 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
2998         "$enable_extensions" != yes; then
2999     enable_readonly_installset=yes
3001 if test "$enable_readonly_installset" = yes; then
3002     AC_MSG_RESULT([yes])
3003     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3004 else
3005     AC_MSG_RESULT([no])
3008 dnl ===================================================================
3009 dnl Structure of install set
3010 dnl ===================================================================
3012 if test $_os = Darwin; then
3013     LIBO_BIN_FOLDER=MacOS
3014     LIBO_ETC_FOLDER=Resources
3015     LIBO_LIBEXEC_FOLDER=MacOS
3016     LIBO_LIB_FOLDER=Frameworks
3017     LIBO_LIB_PYUNO_FOLDER=Resources
3018     LIBO_SHARE_FOLDER=Resources
3019     LIBO_SHARE_HELP_FOLDER=Resources/help
3020     LIBO_SHARE_JAVA_FOLDER=Resources/java
3021     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3022     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3023     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3024     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3025     LIBO_URE_BIN_FOLDER=MacOS
3026     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3027     LIBO_URE_LIB_FOLDER=Frameworks
3028     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3029     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3030 elif test $_os = WINNT; then
3031     LIBO_BIN_FOLDER=program
3032     LIBO_ETC_FOLDER=program
3033     LIBO_LIBEXEC_FOLDER=program
3034     LIBO_LIB_FOLDER=program
3035     LIBO_LIB_PYUNO_FOLDER=program
3036     LIBO_SHARE_FOLDER=share
3037     LIBO_SHARE_HELP_FOLDER=help
3038     LIBO_SHARE_JAVA_FOLDER=program/classes
3039     LIBO_SHARE_PRESETS_FOLDER=presets
3040     LIBO_SHARE_READMES_FOLDER=readmes
3041     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3042     LIBO_SHARE_SHELL_FOLDER=program/shell
3043     LIBO_URE_BIN_FOLDER=program
3044     LIBO_URE_ETC_FOLDER=program
3045     LIBO_URE_LIB_FOLDER=program
3046     LIBO_URE_MISC_FOLDER=program
3047     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3048 else
3049     LIBO_BIN_FOLDER=program
3050     LIBO_ETC_FOLDER=program
3051     LIBO_LIBEXEC_FOLDER=program
3052     LIBO_LIB_FOLDER=program
3053     LIBO_LIB_PYUNO_FOLDER=program
3054     LIBO_SHARE_FOLDER=share
3055     LIBO_SHARE_HELP_FOLDER=help
3056     LIBO_SHARE_JAVA_FOLDER=program/classes
3057     LIBO_SHARE_PRESETS_FOLDER=presets
3058     LIBO_SHARE_READMES_FOLDER=readmes
3059     if test "$enable_fuzzers" != yes; then
3060         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3061     else
3062         LIBO_SHARE_RESOURCE_FOLDER=resource
3063     fi
3064     LIBO_SHARE_SHELL_FOLDER=program/shell
3065     LIBO_URE_BIN_FOLDER=program
3066     LIBO_URE_ETC_FOLDER=program
3067     LIBO_URE_LIB_FOLDER=program
3068     LIBO_URE_MISC_FOLDER=program
3069     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3071 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3072 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3073 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3074 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3075 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3076 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3077 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3078 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3079 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3080 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3081 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3082 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3083 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3084 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3085 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3086 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3088 # Not all of them needed in config_host.mk, add more if need arises
3089 AC_SUBST(LIBO_BIN_FOLDER)
3090 AC_SUBST(LIBO_ETC_FOLDER)
3091 AC_SUBST(LIBO_LIB_FOLDER)
3092 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3093 AC_SUBST(LIBO_SHARE_FOLDER)
3094 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3095 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3096 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3097 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3098 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3099 AC_SUBST(LIBO_URE_BIN_FOLDER)
3100 AC_SUBST(LIBO_URE_ETC_FOLDER)
3101 AC_SUBST(LIBO_URE_LIB_FOLDER)
3102 AC_SUBST(LIBO_URE_MISC_FOLDER)
3103 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3105 dnl ===================================================================
3106 dnl Windows specific tests and stuff
3107 dnl ===================================================================
3109 reg_get_value()
3111     # Return value: $regvalue
3112     unset regvalue
3114     local _regentry="/proc/registry${1}/${2}"
3115     if test -f "$_regentry"; then
3116         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3117         # Registry keys read via /proc/registry* are always \0 terminated!
3118         local _regvalue=$(tr -d '\0' < "$_regentry")
3119         if test $? -eq 0; then
3120             regvalue=$_regvalue
3121         fi
3122     fi
3125 # Get a value from the 32-bit side of the Registry
3126 reg_get_value_32()
3128     reg_get_value "32" "$1"
3131 # Get a value from the 64-bit side of the Registry
3132 reg_get_value_64()
3134     reg_get_value "64" "$1"
3137 if test "$_os" = "WINNT"; then
3138     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3139     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3140         AC_MSG_RESULT([no])
3141         WINDOWS_SDK_ARCH="x86"
3142     else
3143         AC_MSG_RESULT([yes])
3144         WINDOWS_SDK_ARCH="x64"
3145         BITNESS_OVERRIDE=64
3146     fi
3148 if test "$_os" = "iOS"; then
3149     cross_compiling="yes"
3152 if test "$cross_compiling" = "yes"; then
3153     export CROSS_COMPILING=TRUE
3154 else
3155     CROSS_COMPILING=
3156     BUILD_TYPE="$BUILD_TYPE NATIVE"
3158 AC_SUBST(CROSS_COMPILING)
3160 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3161 if test "$GCC" = "yes"; then
3162     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
3163     bsymbolic_functions_ldflags_save=$LDFLAGS
3164     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3165     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3166 #include <stdio.h>
3167         ],[
3168 printf ("hello world\n");
3169         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3170     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3171         AC_MSG_RESULT( found )
3172     else
3173         AC_MSG_RESULT( not found )
3174     fi
3175     LDFLAGS=$bsymbolic_functions_ldflags_save
3177 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3179 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3180 # NOTE: must _not_ be used for bundled external libraries!
3181 ISYSTEM=
3182 if test "$GCC" = "yes"; then
3183     AC_MSG_CHECKING( for -isystem )
3184     save_CFLAGS=$CFLAGS
3185     CFLAGS="$CFLAGS -Werror"
3186     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3187     CFLAGS=$save_CFLAGS
3188     if test -n "$ISYSTEM"; then
3189         AC_MSG_RESULT(yes)
3190     else
3191         AC_MSG_RESULT(no)
3192     fi
3194 if test -z "$ISYSTEM"; then
3195     # fall back to using -I
3196     ISYSTEM=-I
3198 AC_SUBST(ISYSTEM)
3200 dnl ===================================================================
3201 dnl  Check which Visual Studio compiler is used
3202 dnl ===================================================================
3204 map_vs_year_to_version()
3206     # Return value: $vsversion
3208     unset vsversion
3210     case $1 in
3211     2015)
3212         vsversion=14.0;;
3213     2017)
3214         vsversion=15.0;;
3215     *)
3216         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3217     esac
3220 vs_versions_to_check()
3222     # Args: $1 (optional) : versions to check, in the order of preference
3223     # Return value: $vsversions
3225     unset vsversions
3227     if test -n "$1"; then
3228         map_vs_year_to_version "$1"
3229         vsversions=$vsversion
3230     else
3231         # By default we prefer 2015/2017, in this order
3232         vsversions="14.0 15.0"
3233     fi
3236 win_get_env_from_vsvars32bat()
3238     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3239     if test $vcnum = "150"; then
3240       # Also seems to be located in another directory under the same name: vsvars32.bat
3241       # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3242       printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3243     else
3244       printf '@call "%s/../Common7/Tools/vsvars32.bat"\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3245     fi
3246     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3247     chmod +x $WRAPPERBATCHFILEPATH
3248     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3249     rm -f $WRAPPERBATCHFILEPATH
3250     printf '%s' "$_win_get_env_from_vsvars32bat"
3253 find_ucrt()
3255     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3256     if test -n "$regvalue"; then
3257         PathFormat "$regvalue"
3258         UCRTSDKDIR=$formatted_path
3259         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3260         UCRTVERSION=$regvalue
3261         # Rest if not exist
3262         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3263           UCRTSDKDIR=
3264         fi
3265     fi
3266     if test -z "$UCRTSDKDIR"; then
3267         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3268         if test "$vcnum" = "150"; then
3269           ide_env_file="${ide_env_dir}VsDevCmd.bat"
3270         else
3271           ide_env_file="${ide_env_dir}/vsvars32.bat"
3272         fi
3273         if test -f "$ide_env_file"; then
3274             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3275             UCRTSDKDIR=$formatted_path
3276             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3277             dnl Hack needed at least by tml:
3278             if test "$UCRTVERSION" = 10.0.15063.0 \
3279                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3280                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3281             then
3282                 UCRTVERSION=10.0.14393.0
3283             fi
3284         else
3285           AC_MSG_ERROR([No UCRT found])
3286         fi
3287     fi
3290 find_msvc()
3292     # Find Visual C++ 2015/2017
3293     # Args: $1 (optional) : The VS version year
3294     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3296     unset vctest vcnum vcnumwithdot vcbuildnumber
3298     vs_versions_to_check "$1"
3300     for ver in $vsversions; do
3301         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3302         if test -n "$regvalue"; then
3303             vctest=$regvalue
3304             break
3305         fi
3306         # As always MSVC 15.0 is special here
3307         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver
3308         if test -n "$regvalue"; then
3309             AC_MSG_RESULT([found: $regvalue])
3310             PathFormat "$regvalue"
3311             vctest=$formatted_path
3312             break
3313         fi
3314     done
3315     if test -n "$vctest"; then
3316         vcnumwithdot=$ver
3317         case "$vcnumwithdot" in
3318         14.0)
3319             vcyear=2015
3320             vcnum=140
3321             ;;
3322         15.0)
3323             vcyear=2017
3324             vcnum=150
3325             vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3326             ;;
3327         esac
3328     fi
3331 SOLARINC=
3332 MSBUILD_PATH=
3333 DEVENV=
3334 if test "$_os" = "WINNT"; then
3335     AC_MSG_CHECKING([Visual C++])
3337     find_msvc "$with_visual_studio"
3338     if test -z "$vctest"; then
3339         if test -n "$with_visual_studio"; then
3340             AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3341         else
3342             AC_MSG_ERROR([No Visual Studio 2015/2017 installation found])
3343         fi
3344     fi
3346     if test "$BITNESS_OVERRIDE" = ""; then
3347         if test -f "$vctest/bin/cl.exe"; then
3348             VC_PRODUCT_DIR=$vctest
3349         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3350             VC_PRODUCT_DIR=$vctest/VC
3351         else
3352             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3353         fi
3354     else
3355         if test -f "$vctest/bin/amd64/cl.exe"; then
3356             VC_PRODUCT_DIR=$vctest
3357         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3358             VC_PRODUCT_DIR=$vctest/VC
3359         else
3360             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])
3361         fi
3362     fi
3364     AC_MSG_CHECKING([for short pathname of VC product directory])
3365     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3366     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3368     UCRTSDKDIR=
3369     UCRTVERSION=
3371     AC_MSG_CHECKING([for UCRT location])
3372     find_ucrt
3373     # find_ucrt errors out if it doesn't find it
3374     AC_MSG_RESULT([found])
3375     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3376     ucrtincpath_formatted=$formatted_path
3377     # SOLARINC is used for external modules and must be set too.
3378     # And no, it's not sufficient to set SOLARINC only, as configure
3379     # itself doesn't honour it.
3380     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3381     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3382     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3383     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3385     AC_SUBST(UCRTSDKDIR)
3386     AC_SUBST(UCRTVERSION)
3388     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3389     # Find the proper version of MSBuild.exe to use based on the VS version
3390     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3391     if test -n "$regvalue" ; then
3392         AC_MSG_RESULT([found: $regvalue])
3393         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3394     else
3395         if test $vcnum = "150"; then
3396             if test "$BITNESS_OVERRIDE" = ""; then
3397                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3398             else
3399                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3400             fi
3401             MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3402         elif test $vcnum = "140"; then
3403             if test "$BITNESS_OVERRIDE" = ""; then
3404                 regvalue="$VC_PRODUCT_DIR/../MSBuild/15.0/Bin"
3405             else
3406                 regvalue="$VC_PRODUCT_DIR/../MSBuild/15.0/Bin/amd64"
3407             fi
3408             MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3409         else
3410             AC_MSG_ERROR([No msbuild found, Visual Studio installation broken?])
3411         fi
3412         AC_MSG_RESULT([$regvalue])
3413     fi
3415     # Find the version of devenv.exe
3416     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3417     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3418     if test ! -e "$DEVENV"; then
3419         AC_MSG_WARN([No devenv.exe found, Visual Studio installation broken?])
3420     fi
3422     dnl ===========================================================
3423     dnl  Check for the corresponding mspdb*.dll
3424     dnl ===========================================================
3426     MSPDB_PATH=
3427     CL_DIR=
3428     CL_LIB=
3430     if test "$BITNESS_OVERRIDE" = ""; then
3431         if test "$vcnum" = "150"; then
3432             MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86"
3433             CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX86/x86
3434         else
3435             MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3436             CL_DIR=bin
3437         fi
3438     else
3439         if test "$vcnum" = "150"; then
3440             MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64"
3441             CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX64/x64
3442         else
3443             MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3444             CL_DIR=bin/amd64
3445         fi
3446     fi
3448     # MSVC 15.0 has libraries from 14.0?
3449     if test  "$vcnum" = "150"; then
3450         mspdbnum="140"
3451     else
3452         mspdbnum=$vcnum
3453     fi
3455     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3456         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3457     fi
3459     MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3460     MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3462     dnl The path needs to be added before cl is called
3463     PATH="$MSPDB_PATH:$PATH"
3465     AC_MSG_CHECKING([cl.exe])
3467     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3468     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3469     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3470     # is not enough?
3472     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3473     dnl needed when building CLR code:
3474     if test -z "$MSVC_CXX"; then
3475         if test "$BITNESS_OVERRIDE" = ""; then
3476             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3477                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3478             fi
3479         else
3480             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3481                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3482             fi
3483         fi
3485         # This gives us a posix path with 8.3 filename restrictions
3486         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3487     fi
3489     if test -z "$CC"; then
3490         CC=$MSVC_CXX
3491     fi
3492     if test "$BITNESS_OVERRIDE" = ""; then
3493         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3494         MSVC_CXX="$MSVC_CXX -arch:SSE"
3495     fi
3497     if test -n "$CC"; then
3498         # Remove /cl.exe from CC case insensitive
3499         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3500         if test "$BITNESS_OVERRIDE" = ""; then
3501            if test "$vcnum" = "150"; then
3502                COMPATH="$VC_PRODUCT_DIR"
3503            else
3504                COMPATH=`echo "$CC" | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3505            fi
3506         else
3507             if test -n "$VC_PRODUCT_DIR"; then
3508                 COMPATH=$VC_PRODUCT_DIR
3509             fi
3510         fi
3511         if test "$BITNESS_OVERRIDE" = ""; then
3512             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3513             CC="$CC -arch:SSE"
3514         fi
3516         if test "$vcnum" = "150"; then
3517             COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3518         fi
3520         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3522         PathFormat "$COMPATH"
3523         COMPATH="$formatted_path"
3525         VCVER=$vcnum
3526         MSVSVER=$vcyear
3528         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3529         # are always "better", we list them in reverse chronological order.
3531         case $vcnum in
3532         140)
3533             COMEX=19
3534             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3535             ;;
3536         150)
3537             COMEX=19
3538             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3539             ;;
3540         esac
3542         # The expectation is that --with-windows-sdk should not need to be used
3543         if test -n "$with_windows_sdk"; then
3544             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3545             *" "$with_windows_sdk" "*)
3546                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3547                 ;;
3548             *)
3549                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3550                 ;;
3551             esac
3552         fi
3554         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3555         ac_objext=obj
3556         ac_exeext=exe
3558     else
3559         AC_MSG_ERROR([Visual C++ not found after all, huh])
3560     fi
3562     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3563     # version of the Explorer extension (and maybe other small
3564     # bits, too) needed when installing a 32-bit LibreOffice on a
3565     # 64-bit OS. The 64-bit Explorer extension is a feature that
3566     # has been present since long in OOo. Don't confuse it with
3567     # building LibreOffice itself as 64-bit code.
3569     BUILD_X64=
3570     CXX_X64_BINARY=
3571     LINK_X64_BINARY=
3573     if test "$BITNESS_OVERRIDE" = ""; then
3574         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3575         if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3576             # Prefer native x64 compiler to cross-compiler, in case we are running
3577             # the build on a 64-bit OS.
3578             if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3579                 BUILD_X64=TRUE
3580                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3581                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3582             elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3583                 BUILD_X64=TRUE
3584                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3585                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3586             fi
3587         elif test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib"; then
3588             # nobody uses 32-bit OS to build, just pick the 64-bit compiler
3589             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3590                 BUILD_X64=TRUE
3591                 CXX_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"
3592                 LINK_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/link.exe"
3593             fi
3594         fi
3595         if test "$BUILD_X64" = TRUE; then
3596             AC_MSG_RESULT([found])
3597         else
3598             AC_MSG_RESULT([not found])
3599             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3600         fi
3601     fi
3602     AC_SUBST(BUILD_X64)
3604     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3605     AC_SUBST(CXX_X64_BINARY)
3606     AC_SUBST(LINK_X64_BINARY)
3608 AC_SUBST(VCVER)
3609 AC_SUBST(DEVENV)
3610 PathFormat "$MSPDB_PATH"
3611 MSPDB_PATH="$formatted_path"
3612 AC_SUBST(MSVC_CXX)
3615 # unowinreg.dll
3617 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3618 AC_SUBST(UNOWINREG_DLL)
3620 COM_IS_CLANG=
3621 AC_MSG_CHECKING([whether the compiler is actually Clang])
3622 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3623     #ifndef __clang__
3624     you lose
3625     #endif
3626     int foo=42;
3627     ]])],
3628     [AC_MSG_RESULT([yes])
3629      COM_IS_CLANG=TRUE],
3630     [AC_MSG_RESULT([no])])
3632 CC_PLAIN=$CC
3633 if test "$COM_IS_CLANG" = TRUE; then
3634     AC_MSG_CHECKING([the Clang version])
3635     if test "$_os" = WINNT; then
3636         dnl In which case, assume clang-cl:
3637         my_args="/EP /TC"
3638         dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3639         dnl clang-cl:
3640         CC_PLAIN=
3641         for i in $CC; do
3642             case $i in
3643             -FIIntrin.h)
3644                 ;;
3645             *)
3646                 CC_PLAIN="$CC_PLAIN $i"
3647                 ;;
3648             esac
3649         done
3650     else
3651         my_args="-E -P"
3652     fi
3653     clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args -`
3654     CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3655     CLANGVER=`echo $clang_version \
3656         | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3657     AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3658     AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3659     AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3661 AC_SUBST(COM_IS_CLANG)
3662 AC_SUBST(CLANGVER)
3664 SHOWINCLUDES_PREFIX=
3665 if test "$_os" = WINNT; then
3666     dnl We need to guess the prefix of the -showIncludes output, it can be
3667     dnl localized
3668     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3669     echo "#include <stdlib.h>" > conftest.c
3670     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3671         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3672     rm -f conftest.c conftest.obj
3673     if test -z "$SHOWINCLUDES_PREFIX"; then
3674         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3675     else
3676         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3677     fi
3679 AC_SUBST(SHOWINCLUDES_PREFIX)
3682 # prefix C with ccache if needed
3684 if test "$CCACHE" != ""; then
3685     AC_MSG_CHECKING([whether $CC is already ccached])
3687     AC_LANG_PUSH([C])
3688     save_CFLAGS=$CFLAGS
3689     CFLAGS="$CFLAGS --ccache-skip -O2"
3690     dnl an empty program will do, we're checking the compiler flags
3691     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3692                       [use_ccache=yes], [use_ccache=no])
3693     if test $use_ccache = yes; then
3694         AC_MSG_RESULT([yes])
3695     else
3696         CC="$CCACHE $CC"
3697         AC_MSG_RESULT([no])
3698     fi
3699     CFLAGS=$save_CFLAGS
3700     AC_LANG_POP([C])
3703 # ===================================================================
3704 # check various GCC options that Clang does not support now but maybe
3705 # will somewhen in the future, check them even for GCC, so that the
3706 # flags are set
3707 # ===================================================================
3709 HAVE_GCC_GGDB2=
3710 HAVE_GCC_FINLINE_LIMIT=
3711 HAVE_GCC_FNO_INLINE=
3712 if test "$GCC" = "yes"; then
3713     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3714     save_CFLAGS=$CFLAGS
3715     CFLAGS="$CFLAGS -Werror -ggdb2"
3716     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3717     CFLAGS=$save_CFLAGS
3718     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3719         AC_MSG_RESULT([yes])
3720     else
3721         AC_MSG_RESULT([no])
3722     fi
3724     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3725     save_CFLAGS=$CFLAGS
3726     CFLAGS="$CFLAGS -Werror -finline-limit=0"
3727     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3728     CFLAGS=$save_CFLAGS
3729     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3730         AC_MSG_RESULT([yes])
3731     else
3732         AC_MSG_RESULT([no])
3733     fi
3735     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3736     save_CFLAGS=$CFLAGS
3737     CFLAGS="$CFLAGS -Werror -fno-inline"
3738     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3739     CFLAGS=$save_CFLAGS
3740     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3741         AC_MSG_RESULT([yes])
3742     else
3743         AC_MSG_RESULT([no])
3744     fi
3746     if test "$host_cpu" = "m68k"; then
3747         AC_MSG_CHECKING([whether $CC supports -mlong-jump-table-offsets])
3748         save_CFLAGS=$CFLAGS
3749         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3750         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3751         CFLAGS=$save_CFLAGS
3752         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3753             AC_MSG_RESULT([yes])
3754         else
3755             AC_MSG_ERROR([no])
3756         fi
3757     fi
3759 AC_SUBST(HAVE_GCC_GGDB2)
3760 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3761 AC_SUBST(HAVE_GCC_FNO_INLINE)
3763 dnl ===================================================================
3764 dnl  Test the gcc version
3765 dnl ===================================================================
3766 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3767     AC_MSG_CHECKING([the GCC version])
3768     _gcc_version=`$CC -dumpversion`
3769     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3770         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3771     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3773     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3775     if test "$gcc_full_version" -lt 40801; then
3776         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.8.1])
3777     fi
3778 else
3779     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3780     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3781     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3782     # (which reports itself as GCC 4.2.1).
3783     GCC_VERSION=
3785 AC_SUBST(GCC_VERSION)
3787 dnl Set the ENABLE_DBGUTIL variable
3788 dnl ===================================================================
3789 AC_MSG_CHECKING([whether to build with additional debug utilities])
3790 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3791     ENABLE_DBGUTIL="TRUE"
3792     # this is an extra var so it can have different default on different MSVC
3793     # versions (in case there are version specific problems with it)
3794     MSVC_USE_DEBUG_RUNTIME="TRUE"
3796     AC_MSG_RESULT([yes])
3797     # cppunit and graphite expose STL in public headers
3798     if test "$with_system_cppunit" = "yes"; then
3799         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3800     else
3801         with_system_cppunit=no
3802     fi
3803     if test "$with_system_graphite" = "yes"; then
3804         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3805     else
3806         with_system_graphite=no
3807     fi
3808     if test "$with_system_mysql_cppconn" = "yes"; then
3809         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3810     else
3811         with_system_mysql_cppconn=no
3812     fi
3813     if test "$with_system_orcus" = "yes"; then
3814         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3815     else
3816         with_system_orcus=no
3817     fi
3818     if test "$with_system_libcmis" = "yes"; then
3819         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3820     else
3821         with_system_libcmis=no
3822     fi
3823     if test "$with_system_hunspell" = "yes"; then
3824         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3825     else
3826         with_system_hunspell=no
3827     fi
3828     if test "$with_system_gpgmepp" = "yes"; then
3829         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3830     else
3831         with_system_gpgmepp=no
3832     fi
3833     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3834     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3835     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3836     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3837     # of those two is using the system variant:
3838     if test "$with_system_libnumbertext" = "yes"; then
3839         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3840     else
3841         with_system_libnumbertext=no
3842     fi
3843     if test "$with_system_libwps" = "yes"; then
3844         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3845     else
3846         with_system_libwps=no
3847     fi
3848 else
3849     ENABLE_DBGUTIL=""
3850     MSVC_USE_DEBUG_RUNTIME=""
3851     AC_MSG_RESULT([no])
3853 AC_SUBST(ENABLE_DBGUTIL)
3854 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3856 dnl Set the ENABLE_DEBUG variable.
3857 dnl ===================================================================
3858 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3859     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3861 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3862     if test -z "$libo_fuzzed_enable_debug"; then
3863         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3864     else
3865         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3866         enable_debug=yes
3867     fi
3870 AC_MSG_CHECKING([whether to do a debug build])
3871 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3872     ENABLE_DEBUG="TRUE"
3873     if test -n "$ENABLE_DBGUTIL" ; then
3874         AC_MSG_RESULT([yes (dbgutil)])
3875     else
3876         AC_MSG_RESULT([yes])
3877     fi
3878 else
3879     ENABLE_DEBUG=""
3880     AC_MSG_RESULT([no])
3882 AC_SUBST(ENABLE_DEBUG)
3884 if test "$enable_sal_log" = yes; then
3885     ENABLE_SAL_LOG=TRUE
3887 AC_SUBST(ENABLE_SAL_LOG)
3889 dnl Selective debuginfo
3890 ENABLE_DEBUGINFO_FOR=
3891 if test -n "$ENABLE_DEBUG"; then
3892     AC_MSG_CHECKING([whether to use selective debuginfo])
3893     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3894         if test "$enable_selective_debuginfo" = "yes"; then
3895             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3896         fi
3897         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3898         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3899     else
3900         ENABLE_DEBUGINFO_FOR=all
3901         AC_MSG_RESULT([no, for all])
3902     fi
3903 else
3904     if test -n "$enable_selective_debuginfo"; then
3905         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
3906     fi
3908 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3910 dnl Check for enable symbols option
3911 dnl ===================================================================
3912 AC_MSG_CHECKING([whether to generate debug information])
3913 if test -z "$enable_symbols"; then
3914     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3915         enable_symbols=yes
3916     else
3917         enable_symbols=no
3918     fi
3920 if test "$enable_symbols" != no; then
3921     ENABLE_SYMBOLS=TRUE
3922     AC_MSG_RESULT([yes])
3923 else
3924     ENABLE_SYMBOLS=
3925     AC_MSG_RESULT([no])
3927 AC_SUBST(ENABLE_SYMBOLS)
3929 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
3930     # Building on Android with full symbols: without enough memory the linker never finishes currently.
3931     AC_MSG_CHECKING([whether enough memory is available for linking])
3932     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
3933     # Check for 15GB, as Linux reports a bit less than the physical memory size.
3934     if test -n "$mem_size" -a $mem_size -lt 15728640; then
3935         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
3936     else
3937         AC_MSG_RESULT([yes])
3938     fi
3941 AC_MSG_CHECKING([whether to compile with optimization flags])
3942 if test -z "$enable_optimized"; then
3943     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3944         enable_optimized=no
3945     else
3946         enable_optimized=yes
3947     fi
3949 if test "$enable_optimized" != no; then
3950     ENABLE_OPTIMIZED=TRUE
3951     AC_MSG_RESULT([yes])
3952 else
3953     ENABLE_OPTIMIZED=
3954     AC_MSG_RESULT([no])
3956 AC_SUBST(ENABLE_OPTIMIZED)
3959 # determine CPUNAME, OS, ...
3960 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
3962 case "$host_os" in
3964 aix*)
3965     COM=GCC
3966     CPUNAME=POWERPC
3967     USING_X11=TRUE
3968     OS=AIX
3969     RTL_OS=AIX
3970     RTL_ARCH=PowerPC
3971     PLATFORMID=aix_powerpc
3972     P_SEP=:
3973     ;;
3975 cygwin*)
3976     COM=MSC
3977     USING_X11=
3978     OS=WNT
3979     RTL_OS=Windows
3980     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3981         P_SEP=";"
3982     else
3983         P_SEP=:
3984     fi
3985     case "$host_cpu" in
3986     i*86|x86_64)
3987         if test "$BITNESS_OVERRIDE" = 64; then
3988             CPUNAME=X86_64
3989             RTL_ARCH=X86_64
3990             PLATFORMID=windows_x86_64
3991             WINDOWS_X64=1
3992             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
3993         else
3994             CPUNAME=INTEL
3995             RTL_ARCH=x86
3996             PLATFORMID=windows_x86
3997         fi
3998         ;;
3999     *)
4000         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4001         ;;
4002     esac
4003     SCPDEFS="$SCPDEFS -D_MSC_VER"
4004     ;;
4006 darwin*)
4007     COM=GCC
4008     USING_X11=
4009     OS=MACOSX
4010     RTL_OS=MacOSX
4011     P_SEP=:
4013     case "$host_cpu" in
4014     arm)
4015         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4016         ;;
4017     arm64)
4018         OS=IOS
4019         if test "$enable_ios_simulator" = "yes"; then
4020             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4021         else
4022             CPUNAME=ARM64
4023             RTL_ARCH=ARM_EABI
4024             PLATFORMID=ios_arm64
4025         fi
4026         ;;
4027     i*86)
4028         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4029         ;;
4030     x86_64)
4031         if test "$enable_ios_simulator" = "yes"; then
4032             OS=IOS
4033         fi
4034         CPUNAME=X86_64
4035         RTL_ARCH=X86_64
4036         PLATFORMID=macosx_x86_64
4037         ;;
4038     *)
4039         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4040         ;;
4041     esac
4042     ;;
4044 dragonfly*)
4045     COM=GCC
4046     USING_X11=TRUE
4047     OS=DRAGONFLY
4048     RTL_OS=DragonFly
4049     P_SEP=:
4051     case "$host_cpu" in
4052     i*86)
4053         CPUNAME=INTEL
4054         RTL_ARCH=x86
4055         PLATFORMID=dragonfly_x86
4056         ;;
4057     x86_64)
4058         CPUNAME=X86_64
4059         RTL_ARCH=X86_64
4060         PLATFORMID=dragonfly_x86_64
4061         ;;
4062     *)
4063         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4064         ;;
4065     esac
4066     ;;
4068 freebsd*)
4069     COM=GCC
4070     USING_X11=TRUE
4071     RTL_OS=FreeBSD
4072     OS=FREEBSD
4073     P_SEP=:
4075     case "$host_cpu" in
4076     i*86)
4077         CPUNAME=INTEL
4078         RTL_ARCH=x86
4079         PLATFORMID=freebsd_x86
4080         ;;
4081     x86_64|amd64)
4082         CPUNAME=X86_64
4083         RTL_ARCH=X86_64
4084         PLATFORMID=freebsd_x86_64
4085         ;;
4086     *)
4087         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4088         ;;
4089     esac
4090     ;;
4092 haiku*)
4093     COM=GCC
4094     USING_X11=
4095     GUIBASE=haiku
4096     RTL_OS=Haiku
4097     OS=HAIKU
4098     P_SEP=:
4100     case "$host_cpu" in
4101     i*86)
4102         CPUNAME=INTEL
4103         RTL_ARCH=x86
4104         PLATFORMID=haiku_x86
4105         ;;
4106     x86_64|amd64)
4107         CPUNAME=X86_64
4108         RTL_ARCH=X86_64
4109         PLATFORMID=haiku_x86_64
4110         ;;
4111     *)
4112         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4113         ;;
4114     esac
4115     ;;
4117 kfreebsd*)
4118     COM=GCC
4119     USING_X11=TRUE
4120     OS=LINUX
4121     RTL_OS=kFreeBSD
4122     P_SEP=:
4124     case "$host_cpu" in
4126     i*86)
4127         CPUNAME=INTEL
4128         RTL_ARCH=x86
4129         PLATFORMID=kfreebsd_x86
4130         ;;
4131     x86_64)
4132         CPUNAME=X86_64
4133         RTL_ARCH=X86_64
4134         PLATFORMID=kfreebsd_x86_64
4135         ;;
4136     *)
4137         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4138         ;;
4139     esac
4140     ;;
4142 linux-gnu*)
4143     COM=GCC
4144     USING_X11=TRUE
4145     OS=LINUX
4146     RTL_OS=Linux
4147     P_SEP=:
4149     case "$host_cpu" in
4151     aarch64)
4152         CPUNAME=AARCH64
4153         PLATFORMID=linux_aarch64
4154         RTL_ARCH=AARCH64
4155         ;;
4156     alpha)
4157         CPUNAME=AXP
4158         RTL_ARCH=ALPHA
4159         PLATFORMID=linux_alpha
4160         ;;
4161     arm*)
4162         CPUNAME=ARM
4163         EPM_FLAGS="-a arm"
4164         RTL_ARCH=ARM_EABI
4165         PLATFORMID=linux_arm_eabi
4166         case "$host_cpu" in
4167         arm*-linux)
4168             RTL_ARCH=ARM_OABI
4169             PLATFORMID=linux_arm_oabi
4170             ;;
4171         esac
4172         ;;
4173     hppa)
4174         CPUNAME=HPPA
4175         RTL_ARCH=HPPA
4176         EPM_FLAGS="-a hppa"
4177         PLATFORMID=linux_hppa
4178         ;;
4179     i*86)
4180         CPUNAME=INTEL
4181         RTL_ARCH=x86
4182         PLATFORMID=linux_x86
4183         ;;
4184     ia64)
4185         CPUNAME=IA64
4186         RTL_ARCH=IA64
4187         PLATFORMID=linux_ia64
4188         ;;
4189     mips)
4190         CPUNAME=GODSON
4191         RTL_ARCH=MIPS_EB
4192         EPM_FLAGS="-a mips"
4193         PLATFORMID=linux_mips_eb
4194         ;;
4195     mips64)
4196         CPUNAME=GODSON64
4197         RTL_ARCH=MIPS64_EB
4198         EPM_FLAGS="-a mips64"
4199         PLATFORMID=linux_mips64_eb
4200         ;;
4201     mips64el)
4202         CPUNAME=GODSON64
4203         RTL_ARCH=MIPS64_EL
4204         EPM_FLAGS="-a mips64el"
4205         PLATFORMID=linux_mips64_el
4206         ;;
4207     mipsel)
4208         CPUNAME=GODSON
4209         RTL_ARCH=MIPS_EL
4210         EPM_FLAGS="-a mipsel"
4211         PLATFORMID=linux_mips_el
4212         ;;
4213     m68k)
4214         CPUNAME=M68K
4215         RTL_ARCH=M68K
4216         PLATFORMID=linux_m68k
4217         ;;
4218     powerpc)
4219         CPUNAME=POWERPC
4220         RTL_ARCH=PowerPC
4221         PLATFORMID=linux_powerpc
4222         ;;
4223     powerpc64)
4224         CPUNAME=POWERPC64
4225         RTL_ARCH=PowerPC_64
4226         PLATFORMID=linux_powerpc64
4227         ;;
4228     powerpc64le)
4229         CPUNAME=POWERPC64
4230         RTL_ARCH=PowerPC_64_LE
4231         PLATFORMID=linux_powerpc64_le
4232         ;;
4233     sparc)
4234         CPUNAME=SPARC
4235         RTL_ARCH=SPARC
4236         PLATFORMID=linux_sparc
4237         ;;
4238     sparc64)
4239         CPUNAME=SPARC64
4240         RTL_ARCH=SPARC64
4241         PLATFORMID=linux_sparc64
4242         ;;
4243     s390)
4244         CPUNAME=S390
4245         RTL_ARCH=S390
4246         PLATFORMID=linux_s390
4247         ;;
4248     s390x)
4249         CPUNAME=S390X
4250         RTL_ARCH=S390x
4251         PLATFORMID=linux_s390x
4252         ;;
4253     x86_64)
4254         CPUNAME=X86_64
4255         RTL_ARCH=X86_64
4256         PLATFORMID=linux_x86_64
4257         ;;
4258     *)
4259         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4260         ;;
4261     esac
4262     ;;
4264 linux-android*)
4265     COM=GCC
4266     USING_X11=
4267     OS=ANDROID
4268     RTL_OS=Android
4269     P_SEP=:
4271     case "$host_cpu" in
4273     arm|armel)
4274         CPUNAME=ARM
4275         RTL_ARCH=ARM_EABI
4276         PLATFORMID=android_arm_eabi
4277         ;;
4278     aarch64)
4279         CPUNAME=AARCH64
4280         RTL_ARCH=AARCH64
4281         PLATFORMID=android_aarch64
4282         ;;
4283     mips|mipsel)
4284         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4285         RTL_ARCH=MIPS_EL
4286         PLATFORMID=android_mips_el
4287         ;;
4288     i*86)
4289         CPUNAME=INTEL
4290         RTL_ARCH=x86
4291         PLATFORMID=android_x86
4292         ;;
4293     *)
4294         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4295         ;;
4296     esac
4297     ;;
4299 *netbsd*)
4300     COM=GCC
4301     USING_X11=TRUE
4302     OS=NETBSD
4303     RTL_OS=NetBSD
4304     P_SEP=:
4306     case "$host_cpu" in
4307     i*86)
4308         CPUNAME=INTEL
4309         RTL_ARCH=x86
4310         PLATFORMID=netbsd_x86
4311         ;;
4312     powerpc)
4313         CPUNAME=POWERPC
4314         RTL_ARCH=PowerPC
4315         PLATFORMID=netbsd_powerpc
4316         ;;
4317     sparc)
4318         CPUNAME=SPARC
4319         RTL_ARCH=SPARC
4320         PLATFORMID=netbsd_sparc
4321         ;;
4322     x86_64)
4323         CPUNAME=X86_64
4324         RTL_ARCH=X86_64
4325         PLATFORMID=netbsd_x86_64
4326         ;;
4327     *)
4328         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4329         ;;
4330     esac
4331     ;;
4333 openbsd*)
4334     COM=GCC
4335     USING_X11=TRUE
4336     OS=OPENBSD
4337     RTL_OS=OpenBSD
4338     P_SEP=:
4340     case "$host_cpu" in
4341     i*86)
4342         CPUNAME=INTEL
4343         RTL_ARCH=x86
4344         PLATFORMID=openbsd_x86
4345         ;;
4346     x86_64)
4347         CPUNAME=X86_64
4348         RTL_ARCH=X86_64
4349         PLATFORMID=openbsd_x86_64
4350         ;;
4351     *)
4352         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4353         ;;
4354     esac
4355     SOLARINC="$SOLARINC -I/usr/local/include"
4356     ;;
4358 solaris*)
4359     COM=GCC
4360     USING_X11=TRUE
4361     OS=SOLARIS
4362     RTL_OS=Solaris
4363     P_SEP=:
4365     case "$host_cpu" in
4366     i*86)
4367         CPUNAME=INTEL
4368         RTL_ARCH=x86
4369         PLATFORMID=solaris_x86
4370         ;;
4371     sparc)
4372         CPUNAME=SPARC
4373         RTL_ARCH=SPARC
4374         PLATFORMID=solaris_sparc
4375         ;;
4376     sparc64)
4377         CPUNAME=SPARC64
4378         RTL_ARCH=SPARC64
4379         PLATFORMID=solaris_sparc64
4380         ;;
4381     *)
4382         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4383         ;;
4384     esac
4385     SOLARINC="$SOLARINC -I/usr/local/include"
4386     ;;
4389     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4390     ;;
4391 esac
4393 if test "$with_x" = "no"; then
4394     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4397 ENABLE_HEADLESS=""
4398 if test "$enable_gui" = "no"; then
4399     if test "$USING_X11" != TRUE; then
4400         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4401     fi
4402     USING_X11=
4403     ENABLE_HEADLESS=TRUE
4404     AC_DEFINE(HAVE_FEATURE_UI,0)
4405     test_cairo=yes
4407 AC_SUBST(ENABLE_HEADLESS)
4409 WORKDIR="${BUILDDIR}/workdir"
4410 INSTDIR="${BUILDDIR}/instdir"
4411 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4412 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4413 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4414 AC_SUBST(COM)
4415 AC_SUBST(CPUNAME)
4416 AC_SUBST(RTL_OS)
4417 AC_SUBST(RTL_ARCH)
4418 AC_SUBST(EPM_FLAGS)
4419 AC_SUBST(USING_X11)
4420 AC_SUBST([INSTDIR])
4421 AC_SUBST([INSTROOT])
4422 AC_SUBST([INSTROOTBASE])
4423 AC_SUBST(OS)
4424 AC_SUBST(P_SEP)
4425 AC_SUBST(WORKDIR)
4426 AC_SUBST(PLATFORMID)
4427 AC_SUBST(WINDOWS_X64)
4428 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4430 dnl ===================================================================
4431 dnl Test which package format to use
4432 dnl ===================================================================
4433 AC_MSG_CHECKING([which package format to use])
4434 if test -n "$with_package_format" -a "$with_package_format" != no; then
4435     for i in $with_package_format; do
4436         case "$i" in
4437         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4438             ;;
4439         *)
4440             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4441 aix - AIX software distribution
4442 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4443 deb - Debian software distribution
4444 pkg - Solaris software distribution
4445 rpm - RedHat software distribution
4447 LibreOffice additionally supports:
4448 archive - .tar.gz or .zip
4449 dmg - Mac OS X .dmg
4450 installed - installation tree
4451 msi - Windows .msi
4452         ])
4453             ;;
4454         esac
4455     done
4456     # fakeroot is needed to ensure correct file ownerships/permissions
4457     # inside deb packages and tar archives created on Linux and Solaris.
4458     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4459         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4460         if test "$FAKEROOT" = "no"; then
4461             AC_MSG_ERROR(
4462                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4463         fi
4464     fi
4465     PKGFORMAT="$with_package_format"
4466     AC_MSG_RESULT([$PKGFORMAT])
4467 else
4468     PKGFORMAT=
4469     AC_MSG_RESULT([none])
4471 AC_SUBST(PKGFORMAT)
4473 dnl ===================================================================
4474 dnl Set up a different compiler to produce tools to run on the build
4475 dnl machine when doing cross-compilation
4476 dnl ===================================================================
4478 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4479 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4480 if test "$cross_compiling" = "yes"; then
4481     AC_MSG_CHECKING([for BUILD platform configuration])
4482     echo
4483     rm -rf CONF-FOR-BUILD config_build.mk
4484     mkdir CONF-FOR-BUILD
4485     # Here must be listed all files needed when running the configure script. In particular, also
4486     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4487     # keep them in the same order as there.
4488     (cd $SRC_ROOT && tar cf - \
4489         config.guess \
4490         bin/get_config_variables \
4491         solenv/bin/getcompver.awk \
4492         solenv/inc/langlist.mk \
4493         download.lst \
4494         config_host.mk.in \
4495         config_host_lang.mk.in \
4496         Makefile.in \
4497         lo.xcent.in \
4498         bin/bffvalidator.sh.in \
4499         bin/odfvalidator.sh.in \
4500         bin/officeotron.sh.in \
4501         instsetoo_native/util/openoffice.lst.in \
4502         config_host/*.in \
4503         sysui/desktop/macosx/Info.plist.in) \
4504     | (cd CONF-FOR-BUILD && tar xf -)
4505     cp configure CONF-FOR-BUILD
4506     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4507     (
4508     unset COM USING_X11 OS CPUNAME
4509     unset CC CXX SYSBASE CFLAGS
4510     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4511     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4512     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4513     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4514     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4515     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4516     cd CONF-FOR-BUILD
4517     sub_conf_opts=""
4518     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4519     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4520     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4521     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4522     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4523     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4524     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4525     # Don't bother having configure look for stuff not needed for the build platform anyway
4526     ./configure \
4527         --disable-cups \
4528         --disable-gtk3 \
4529         --disable-pdfimport \
4530         --disable-postgresql-sdbc \
4531         --with-parallelism="$with_parallelism" \
4532         --without-doxygen \
4533         --without-java \
4534         $sub_conf_opts \
4535         --srcdir=$srcdir \
4536         2>&1 | sed -e 's/^/    /'
4537     test -f ./config_host.mk 2>/dev/null || exit
4538     cp config_host.mk ../config_build.mk
4539     cp config_host_lang.mk ../config_build_lang.mk
4540     mv config.log ../config.Build.log
4541     mkdir -p ../config_build
4542     mv config_host/*.h ../config_build
4543     . ./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
4545     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
4546         VV='$'$V
4547         VV=`eval "echo $VV"`
4548         if test -n "$VV"; then
4549             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4550             echo "$line" >>build-config
4551         fi
4552     done
4554     for V in INSTDIR INSTROOT WORKDIR; do
4555         VV='$'$V
4556         VV=`eval "echo $VV"`
4557         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4558         if test -n "$VV"; then
4559             line="${V}_FOR_BUILD='$VV'"
4560             echo "$line" >>build-config
4561         fi
4562     done
4564     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4565     echo "$line" >>build-config
4567     )
4568     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4569     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])
4570     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4571              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4573     eval `cat CONF-FOR-BUILD/build-config`
4575     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4577     rm -rf CONF-FOR-BUILD
4578 else
4579     OS_FOR_BUILD="$OS"
4580     CC_FOR_BUILD="$CC"
4581     CXX_FOR_BUILD="$CXX"
4582     INSTDIR_FOR_BUILD="$INSTDIR"
4583     INSTROOT_FOR_BUILD="$INSTROOT"
4584     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4585     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4586     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4587     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4588     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4589     WORKDIR_FOR_BUILD="$WORKDIR"
4591 AC_SUBST(OS_FOR_BUILD)
4592 AC_SUBST(INSTDIR_FOR_BUILD)
4593 AC_SUBST(INSTROOT_FOR_BUILD)
4594 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4595 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4596 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4597 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4598 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4599 AC_SUBST(WORKDIR_FOR_BUILD)
4601 dnl ===================================================================
4602 dnl Check for syslog header
4603 dnl ===================================================================
4604 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4606 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4607 dnl ===================================================================
4608 AC_MSG_CHECKING([whether to turn warnings to errors])
4609 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4610     ENABLE_WERROR="TRUE"
4611     AC_MSG_RESULT([yes])
4612 else
4613     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4614         ENABLE_WERROR="TRUE"
4615         AC_MSG_RESULT([yes])
4616     else
4617         AC_MSG_RESULT([no])
4618     fi
4620 AC_SUBST(ENABLE_WERROR)
4622 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4623 dnl ===================================================================
4624 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4625 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4626     ASSERT_ALWAYS_ABORT="TRUE"
4627     AC_MSG_RESULT([yes])
4628 else
4629     ASSERT_ALWAYS_ABORT="FALSE"
4630     AC_MSG_RESULT([no])
4632 AC_SUBST(ASSERT_ALWAYS_ABORT)
4634 # Determine whether to use ooenv for the instdir installation
4635 # ===================================================================
4636 if test $_os != "WINNT" -a $_os != "Darwin"; then
4637     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4638     if test "$enable_ooenv" = "no"; then
4639         AC_MSG_RESULT([no])
4640     else
4641         ENABLE_OOENV="TRUE"
4642         AC_MSG_RESULT([yes])
4643     fi
4645 AC_SUBST(ENABLE_OOENV)
4647 if test "$USING_X11" != TRUE; then
4648     # be sure to do not mess with unneeded stuff
4649     test_randr=no
4650     test_xrender=no
4651     test_cups=no
4652     test_dbus=no
4653     test_gtk=no
4654     build_gstreamer_1_0=no
4655     build_gstreamer_0_10=no
4656     test_kde4=no
4657     test_kde5=no
4658     test_qt5=no
4659     test_gtk3_kde5=no
4660     enable_cairo_canvas=no
4663 if test "$OS" = "HAIKU"; then
4664     enable_cairo_canvas=yes
4665     test_qt5=yes
4668 dnl ===================================================================
4669 dnl check for cups support
4670 dnl ===================================================================
4671 ENABLE_CUPS=""
4673 if test "$enable_cups" = "no"; then
4674     test_cups=no
4677 AC_MSG_CHECKING([whether to enable CUPS support])
4678 if test "$test_cups" = "yes"; then
4679     ENABLE_CUPS="TRUE"
4680     AC_MSG_RESULT([yes])
4682     AC_MSG_CHECKING([whether cups support is present])
4683     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4684     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4685     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4686         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4687     fi
4689 else
4690     AC_MSG_RESULT([no])
4693 AC_SUBST(ENABLE_CUPS)
4695 # fontconfig checks
4696 if test "$test_fontconfig" = "yes"; then
4697     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4698     SYSTEM_FONTCONFIG=TRUE
4699     FilterLibs "${FONTCONFIG_LIBS}"
4700     FONTCONFIG_LIBS="${filteredlibs}"
4702 AC_SUBST(FONTCONFIG_CFLAGS)
4703 AC_SUBST(FONTCONFIG_LIBS)
4704 AC_SUBST([SYSTEM_FONTCONFIG])
4706 dnl whether to find & fetch external tarballs?
4707 dnl ===================================================================
4708 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4709    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4710        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4711    else
4712        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4713    fi
4715 if test -z "$TARFILE_LOCATION"; then
4716     if test -d "$SRC_ROOT/src" ; then
4717         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4718         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4719     fi
4720     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4721 else
4722     AbsolutePath "$TARFILE_LOCATION"
4723     PathFormat "${absolute_path}"
4724     TARFILE_LOCATION="${formatted_path}"
4726 AC_SUBST(TARFILE_LOCATION)
4728 AC_MSG_CHECKING([whether we want to fetch tarballs])
4729 if test "$enable_fetch_external" != "no"; then
4730     if test "$with_all_tarballs" = "yes"; then
4731         AC_MSG_RESULT([yes, all of them])
4732         DO_FETCH_TARBALLS="ALL"
4733     else
4734         AC_MSG_RESULT([yes, if we use them])
4735         DO_FETCH_TARBALLS="TRUE"
4736     fi
4737 else
4738     AC_MSG_RESULT([no])
4739     DO_FETCH_TARBALLS=
4741 AC_SUBST(DO_FETCH_TARBALLS)
4743 AC_MSG_CHECKING([whether to build help])
4744 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4745     BUILD_TYPE="$BUILD_TYPE HELP"
4746     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4747     case "$with_help" in
4748     "html")
4749         ENABLE_HTMLHELP=TRUE
4750         SCPDEFS="$SCPDEFS -DWITH_HELP"
4751         AC_MSG_RESULT([HTML])
4752         ;;
4753     "online")
4754         ENABLE_HTMLHELP=TRUE
4755         HELP_ONLINE=TRUE
4756         AC_MSG_RESULT([HTML])
4757         ;;
4758     yes)
4759         SCPDEFS="$SCPDEFS -DWITH_HELP"
4760         AC_MSG_RESULT([yes])
4761         ;;
4762     *)
4763         AC_MSG_ERROR([Unknown --with-help=$with_help])
4764         ;;
4765     esac
4766 else
4767     AC_MSG_RESULT([no])
4769 AC_SUBST([ENABLE_HTMLHELP])
4770 AC_SUBST([HELP_ONLINE])
4772 dnl Test whether to include MySpell dictionaries
4773 dnl ===================================================================
4774 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4775 if test "$with_myspell_dicts" = "yes"; then
4776     AC_MSG_RESULT([yes])
4777     WITH_MYSPELL_DICTS=TRUE
4778     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4779     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4780 else
4781     AC_MSG_RESULT([no])
4782     WITH_MYSPELL_DICTS=
4784 AC_SUBST(WITH_MYSPELL_DICTS)
4786 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4787 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4788     if test "$with_system_dicts" = yes; then
4789         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4790     fi
4791     with_system_dicts=no
4794 AC_MSG_CHECKING([whether to use dicts from external paths])
4795 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4796     AC_MSG_RESULT([yes])
4797     SYSTEM_DICTS=TRUE
4798     AC_MSG_CHECKING([for spelling dictionary directory])
4799     if test -n "$with_external_dict_dir"; then
4800         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4801     else
4802         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4803         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4804             DICT_SYSTEM_DIR=file:///usr/share/myspell
4805         fi
4806     fi
4807     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4808     AC_MSG_CHECKING([for hyphenation patterns directory])
4809     if test -n "$with_external_hyph_dir"; then
4810         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4811     else
4812         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4813     fi
4814     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4815     AC_MSG_CHECKING([for thesaurus directory])
4816     if test -n "$with_external_thes_dir"; then
4817         THES_SYSTEM_DIR=file://$with_external_thes_dir
4818     else
4819         THES_SYSTEM_DIR=file:///usr/share/mythes
4820     fi
4821     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4822 else
4823     AC_MSG_RESULT([no])
4824     SYSTEM_DICTS=
4826 AC_SUBST(SYSTEM_DICTS)
4827 AC_SUBST(DICT_SYSTEM_DIR)
4828 AC_SUBST(HYPH_SYSTEM_DIR)
4829 AC_SUBST(THES_SYSTEM_DIR)
4831 dnl ===================================================================
4832 dnl enable pch by default on windows
4833 dnl enable it explicitly otherwise
4834 ENABLE_PCH=""
4835 if test "$enable_pch" = yes -a "$enable_compiler_plugins" = yes; then
4836     if test -z "$libo_fuzzed_enable_pch"; then
4837         AC_MSG_ERROR([--enable-pch cannot be used with --enable-compiler-plugins])
4838     else
4839         AC_MSG_NOTICE([Resetting --enable-pch=no])
4840         enable_pch=no
4841     fi
4844 AC_MSG_CHECKING([whether to enable pch feature])
4845 if test "$enable_pch" != "no"; then
4846     if test "$_os" = "WINNT"; then
4847         ENABLE_PCH="TRUE"
4848         AC_MSG_RESULT([yes])
4849     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4850         ENABLE_PCH="TRUE"
4851         AC_MSG_RESULT([yes])
4852     elif test -n "$enable_pch"; then
4853         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4854     else
4855         AC_MSG_RESULT([no])
4856     fi
4857 else
4858     AC_MSG_RESULT([no])
4860 AC_SUBST(ENABLE_PCH)
4862 TAB=`printf '\t'`
4864 AC_MSG_CHECKING([the GNU Make version])
4865 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4866 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4867 if test "$_make_longver" -ge "038200"; then
4868     AC_MSG_RESULT([$GNUMAKE $_make_version])
4870 elif test "$_make_longver" -ge "038100"; then
4871     if test "$build_os" = "cygwin"; then
4872         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4873     fi
4874     AC_MSG_RESULT([$GNUMAKE $_make_version])
4876     dnl ===================================================================
4877     dnl Search all the common names for sha1sum
4878     dnl ===================================================================
4879     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4880     if test -z "$SHA1SUM"; then
4881         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
4882     elif test "$SHA1SUM" = "openssl"; then
4883         SHA1SUM="openssl sha1"
4884     fi
4885     AC_MSG_CHECKING([for GNU Make bug 20033])
4886     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4887     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4888 A := \$(wildcard *.a)
4890 .PHONY: all
4891 all: \$(A:.a=.b)
4892 <TAB>@echo survived bug20033.
4894 .PHONY: setup
4895 setup:
4896 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4898 define d1
4899 @echo lala \$(1)
4900 @sleep 1
4901 endef
4903 define d2
4904 @echo tyty \$(1)
4905 @sleep 1
4906 endef
4908 %.b : %.a
4909 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4910 <TAB>\$(call d1,\$(CHECKSUM)),\
4911 <TAB>\$(call d2,\$(CHECKSUM)))
4913     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4914         no_parallelism_make="YES"
4915         AC_MSG_RESULT([yes, disable parallelism])
4916     else
4917         AC_MSG_RESULT([no, keep parallelism enabled])
4918     fi
4919     rm -rf $TESTGMAKEBUG20033
4920 else
4921     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4924 # find if gnumake support file function
4925 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
4926 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4927 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4928     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
4930 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4931 \$(file >test.txt,Success )
4933 .PHONY: all
4934 all:
4935 <TAB>@cat test.txt
4938 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4939 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4940     HAVE_GNUMAKE_FILE_FUNC=TRUE
4941     AC_MSG_RESULT([yes])
4942 else
4943     AC_MSG_RESULT([no])
4945 rm -rf $TESTGMAKEFILEFUNC
4946 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4947 AC_SUBST(GNUMAKE_WIN_NATIVE)
4949 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
4950 STALE_MAKE=
4951 if test "$_make_ver_check" = ""; then
4952    STALE_MAKE=TRUE
4955 HAVE_LD_HASH_STYLE=FALSE
4956 WITH_LINKER_HASH_STYLE=
4957 AC_MSG_CHECKING([for --hash-style gcc linker support])
4958 if test "$GCC" = "yes"; then
4959     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4960         hash_styles="gnu sysv"
4961     elif test "$with_linker_hash_style" = "no"; then
4962         hash_styles=
4963     else
4964         hash_styles="$with_linker_hash_style"
4965     fi
4967     for hash_style in $hash_styles; do
4968         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4969         hash_style_ldflags_save=$LDFLAGS
4970         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
4972         AC_RUN_IFELSE([AC_LANG_PROGRAM(
4973             [
4974 #include <stdio.h>
4975             ],[
4976 printf ("");
4977             ])],
4978             [
4979                   HAVE_LD_HASH_STYLE=TRUE
4980                   WITH_LINKER_HASH_STYLE=$hash_style
4981             ],
4982             [HAVE_LD_HASH_STYLE=FALSE],
4983             [HAVE_LD_HASH_STYLE=FALSE])
4984         LDFLAGS=$hash_style_ldflags_save
4985     done
4987     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
4988         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
4989     else
4990         AC_MSG_RESULT( no )
4991     fi
4992     LDFLAGS=$hash_style_ldflags_save
4993 else
4994     AC_MSG_RESULT( no )
4996 AC_SUBST(HAVE_LD_HASH_STYLE)
4997 AC_SUBST(WITH_LINKER_HASH_STYLE)
4999 dnl ===================================================================
5000 dnl Check whether there's a Perl version available.
5001 dnl ===================================================================
5002 if test -z "$with_perl_home"; then
5003     AC_PATH_PROG(PERL, perl)
5004 else
5005     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5006     _perl_path="$with_perl_home/bin/perl"
5007     if test -x "$_perl_path"; then
5008         PERL=$_perl_path
5009     else
5010         AC_MSG_ERROR([$_perl_path not found])
5011     fi
5014 dnl ===================================================================
5015 dnl Testing for Perl version 5 or greater.
5016 dnl $] is the Perl version variable, it is returned as an integer
5017 dnl ===================================================================
5018 if test "$PERL"; then
5019     AC_MSG_CHECKING([the Perl version])
5020     ${PERL} -e "exit($]);"
5021     _perl_version=$?
5022     if test "$_perl_version" -lt 5; then
5023         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5024     fi
5025     AC_MSG_RESULT([Perl $_perl_version])
5026 else
5027     AC_MSG_ERROR([Perl not found, install Perl 5])
5030 dnl ===================================================================
5031 dnl Testing for required Perl modules
5032 dnl ===================================================================
5034 AC_MSG_CHECKING([for required Perl modules])
5035 perl_use_string="use Cwd ; use Digest::MD5"
5036 if test "$_os" = "WINNT"; then
5037     if test -n "$PKGFORMAT"; then
5038         for i in $PKGFORMAT; do
5039             case "$i" in
5040             msi)
5041                 # for getting fonts versions to use in MSI
5042                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5043                 ;;
5044             esac
5045         done
5046     fi
5048 if test "$with_system_hsqldb" = "yes"; then
5049         perl_use_string="$perl_use_string ; use Archive::Zip"
5051 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5052     AC_MSG_RESULT([all modules found])
5053 else
5054     AC_MSG_RESULT([failed to find some modules])
5055     # Find out which modules are missing.
5056     for i in $perl_use_string; do
5057         if test "$i" != "use" -a "$i" != ";"; then
5058             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5059                 missing_perl_modules="$missing_perl_modules $i"
5060             fi
5061         fi
5062     done
5063     AC_MSG_ERROR([
5064     The missing Perl modules are: $missing_perl_modules
5065     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5068 dnl ===================================================================
5069 dnl Check for pkg-config
5070 dnl ===================================================================
5071 if test "$_os" != "WINNT"; then
5072     PKG_PROG_PKG_CONFIG
5075 if test "$_os" != "WINNT"; then
5077     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5078     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5079     # explicitly. Or put /path/to/compiler in PATH yourself.
5081     # Use wrappers for LTO
5082     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5083         AC_CHECK_TOOL(AR,gcc-ar)
5084         AC_CHECK_TOOL(NM,gcc-nm)
5085         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5086     else
5087         AC_CHECK_TOOL(AR,ar)
5088         AC_CHECK_TOOL(NM,nm)
5089         AC_CHECK_TOOL(RANLIB,ranlib)
5090     fi
5091     AC_CHECK_TOOL(OBJDUMP,objdump)
5092     AC_CHECK_TOOL(READELF,readelf)
5093     AC_CHECK_TOOL(STRIP,strip)
5094     if test "$_os" = "WINNT"; then
5095         AC_CHECK_TOOL(DLLTOOL,dlltool)
5096         AC_CHECK_TOOL(WINDRES,windres)
5097     fi
5099 AC_SUBST(AR)
5100 AC_SUBST(DLLTOOL)
5101 AC_SUBST(NM)
5102 AC_SUBST(OBJDUMP)
5103 AC_SUBST(PKG_CONFIG)
5104 AC_SUBST(RANLIB)
5105 AC_SUBST(READELF)
5106 AC_SUBST(STRIP)
5107 AC_SUBST(WINDRES)
5109 dnl ===================================================================
5110 dnl pkg-config checks on Mac OS X
5111 dnl ===================================================================
5113 if test $_os = Darwin; then
5114     AC_MSG_CHECKING([for bogus pkg-config])
5115     if test -n "$PKG_CONFIG"; then
5116         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5117             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5118         else
5119             if test "$enable_bogus_pkg_config" = "yes"; then
5120                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5121             else
5122                 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.])
5123             fi
5124         fi
5125     else
5126         AC_MSG_RESULT([no, good])
5127     fi
5130 find_csc()
5132     # Return value: $csctest
5134     unset csctest
5136     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5137     if test -n "$regvalue"; then
5138         csctest=$regvalue
5139         return
5140     fi
5143 find_al()
5145     # Return value: $altest
5147     unset altest
5149     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5150         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5151         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5152             altest=$regvalue
5153             return
5154         fi
5155     done
5157     # We need this additional check to detect 4.6.1 or above.
5158     for ver in 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5159         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5160         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5161             altest=$regvalue
5162             return
5163         fi
5165         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/WOW6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools"
5166         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5167             altest=$regvalue
5168             return
5169         fi
5170     done
5173 find_dotnetsdk46()
5175     unset frametest
5177     for ver in 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5178         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5179         if test -n "$regvalue"; then
5180             frametest=$regvalue
5181             return
5182         fi
5183         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5184         if test -n "$regvalue"; then
5185             frametest=$regvalue
5186             return
5187         fi
5188     done
5191 find_winsdk_version()
5193     # Args: $1 : SDK version as in "8.0", "8.1A" etc
5194     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5196     unset winsdktest winsdkbinsubdir winsdklibsubdir
5198     case "$1" in
5199     8.0|8.0A)
5200         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5201         if test -n "$regvalue"; then
5202             winsdktest=$regvalue
5203             winsdklibsubdir=win8
5204             return
5205         fi
5206         ;;
5207     8.1|8.1A)
5208         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5209         if test -n "$regvalue"; then
5210             winsdktest=$regvalue
5211             winsdklibsubdir=winv6.3
5212             return
5213         fi
5214         ;;
5215     10.0)
5216         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5217         if test -n "$regvalue"; then
5218             winsdktest=$regvalue
5219             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5220             if test -n "$regvalue"; then
5221                 winsdkbinsubdir="$regvalue".0
5222                 winsdklibsubdir=$winsdkbinsubdir
5223                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5224                 # test exist the SDK path
5225                 if test -d "$tmppath"; then
5226                    # when path is convertable to a short path then path is okay
5227                    if ! cygpath -d "$tmppath"; then
5228                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5229                    fi
5230                 else
5231                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5232                 fi
5233             fi
5234             return
5235         fi
5236         ;;
5237     esac
5240 find_winsdk()
5242     # Return value: From find_winsdk_version
5244     unset winsdktest
5246     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5247         find_winsdk_version $ver
5248         if test -n "$winsdktest"; then
5249             return
5250         fi
5251     done
5254 find_msms()
5256     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5257     if test $VCVER = 150; then
5258         my_msm_files="Microsoft_VC141_CRT_x86.msm ${my_msm_files}"
5259     fi
5260     AC_MSG_CHECKING([for ${my_msm_files}])
5261     msmdir=
5262     for ver in 14.0 15.0; do
5263         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5264         if test -n "$regvalue"; then
5265             for f in ${my_msm_files}; do
5266                 if test -e "$regvalue/${f}"; then
5267                     msmdir=$regvalue
5268                     break
5269                 fi
5270             done
5271         fi
5272     done
5273     dnl Is the following fallback really necessary, or was it added in response
5274     dnl to never having started Visual Studio on a given machine, so the
5275     dnl registry keys checked above had presumably not yet been created?
5276     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5277     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5278     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5279     dnl expanding to "C:\Program Files\Common Files"), which would need
5280     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5281     dnl obtain its value from cygwin:
5282     if test -z "$msmdir"; then
5283         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5284         for f in ${my_msm_files}; do
5285             if test -e "$my_msm_dir/${f}"; then
5286                 msmdir=$my_msm_dir
5287             fi
5288         done
5289     fi
5291     dnl Starting from MSVC 15.0, merge modules are located in different directory
5292     if test $VCVER = 150; then
5293         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5294             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])
5295             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5296             for f in ${my_msm_files}; do
5297                 if test -e "$my_msm_dir/${f}"; then
5298                     msmdir=$my_msm_dir
5299                     break
5300                 fi
5301             done
5302         done
5303     fi
5305     if test -n "$msmdir"; then
5306         msmdir=`cygpath -m "$msmdir"`
5307         AC_MSG_RESULT([$msmdir])
5308     else
5309         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5310             AC_MSG_ERROR([not found])
5311         else
5312             AC_MSG_WARN([not found])
5313             add_warning "MSM none of ${my_msm_files} found"
5314         fi
5315     fi
5318 find_msvc_x64_dlls()
5320     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5321     if test "$VCVER" = 150; then
5322         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5323             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT])
5324             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5325                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5326                 break
5327             fi
5328             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5329                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5330                 break
5331             fi
5332         done
5333     fi
5334     msvcdlls="msvcp140.dll vcruntime140.dll"
5335     for dll in $msvcdlls; do
5336         if ! test -f "$msvcdllpath/$dll"; then
5337             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5338         fi
5339     done
5342 dnl =========================================
5343 dnl Check for the Windows  SDK.
5344 dnl =========================================
5345 if test "$_os" = "WINNT"; then
5346     AC_MSG_CHECKING([for Windows SDK])
5347     if test "$build_os" = "cygwin"; then
5348         find_winsdk
5349         WINDOWS_SDK_HOME=$winsdktest
5351         # normalize if found
5352         if test -n "$WINDOWS_SDK_HOME"; then
5353             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5354             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5355         fi
5357         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5358     fi
5360     if test -n "$WINDOWS_SDK_HOME"; then
5361         # Remove a possible trailing backslash
5362         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5364         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5365              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5366              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5367             have_windows_sdk_headers=yes
5368         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5369              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5370              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5371             have_windows_sdk_headers=yes
5372         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5373              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5374              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5375             have_windows_sdk_headers=yes
5376         else
5377             have_windows_sdk_headers=no
5378         fi
5380         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5381             have_windows_sdk_libs=yes
5382         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5383             have_windows_sdk_libs=yes
5384         else
5385             have_windows_sdk_libs=no
5386         fi
5388         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5389             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5390 the  Windows SDK are installed.])
5391         fi
5392     fi
5394     if test -z "$WINDOWS_SDK_HOME"; then
5395         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5396     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5397         WINDOWS_SDK_VERSION=80
5398         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5399     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5400         WINDOWS_SDK_VERSION=81
5401         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5402     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5403         WINDOWS_SDK_VERSION=10
5404         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5405     else
5406         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5407     fi
5408     PathFormat "$WINDOWS_SDK_HOME"
5409     WINDOWS_SDK_HOME="$formatted_path"
5410     if test "$build_os" = "cygwin"; then
5411         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5412         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5413             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5414         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5415             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5416         fi
5417     fi
5419     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5420     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5421     dnl but not in v8.0), so allow this to be overridden with a
5422     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5423     dnl and configuration error if no WiLangId.vbs is found would arguably be
5424     dnl better, but I do not know under which conditions exactly it is needed by
5425     dnl msiglobal.pm:
5426     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5427         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5428         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5429             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5430         fi
5431         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5432             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5433         fi
5434         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5435             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5436         fi
5437     fi
5438     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5439         if test -n "$with_package_format" -a "$with_package_format" != no; then
5440             for i in "$with_package_format"; do
5441                 if test "$i" = "msi"; then
5442                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5443                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5444                     fi
5445                 fi
5446             done
5447         fi
5448     fi
5450 AC_SUBST(WINDOWS_SDK_HOME)
5451 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5452 AC_SUBST(WINDOWS_SDK_VERSION)
5453 AC_SUBST(WINDOWS_SDK_WILANGID)
5455 if test "$build_os" = "cygwin"; then
5456     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5457     dnl dir, it also determines that dir's path w/o an arch segment if any,
5458     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5459     AC_MSG_CHECKING([for midl.exe])
5461     find_winsdk
5462     if test -n "$winsdkbinsubdir" \
5463         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5464     then
5465         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5466         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5467     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5468         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5469         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5470     elif test -f "$winsdktest/Bin/midl.exe"; then
5471         MIDL_PATH=$winsdktest/Bin
5472         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5473     fi
5474     if test ! -f "$MIDL_PATH/midl.exe"; then
5475         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5476     else
5477         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5478     fi
5480     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5481     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5483     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5484          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5485          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5486          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5487     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5488          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5489          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5490          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5491     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5492          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5493          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5494          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5495     else
5496         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5497     fi
5499     dnl Check csc.exe
5500     AC_MSG_CHECKING([for csc.exe])
5501     find_csc
5502     if test -f "$csctest/csc.exe"; then
5503         CSC_PATH="$csctest"
5504     fi
5505     if test ! -f "$CSC_PATH/csc.exe"; then
5506         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5507     else
5508         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5509     fi
5511     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5513     dnl Check al.exe
5514     AC_MSG_CHECKING([for al.exe])
5515     find_winsdk
5516     if test -n "$winsdkbinsubdir" \
5517         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5518     then
5519         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5520     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5521         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5522     elif test -f "$winsdktest/Bin/al.exe"; then
5523         AL_PATH="$winsdktest/Bin"
5524     fi
5526     if test -z "$AL_PATH"; then
5527         find_al
5528         if test -f "$altest/bin/al.exe"; then
5529             AL_PATH="$altest/bin"
5530         elif test -f "$altest/al.exe"; then
5531             AL_PATH="$altest"
5532         fi
5533     fi
5534     if test ! -f "$AL_PATH/al.exe"; then
5535         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5536     else
5537         AC_MSG_RESULT([$AL_PATH/al.exe])
5538     fi
5540     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5542     dnl Check mscoree.lib / .NET Framework dir
5543     AC_MSG_CHECKING(.NET Framework)
5544     find_dotnetsdk46
5545     PathFormat "$frametest"
5546     frametest="$formatted_path"
5547     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5548         DOTNET_FRAMEWORK_HOME="$frametest"
5549     else
5550         find_winsdk
5551         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5552             DOTNET_FRAMEWORK_HOME="$winsdktest"
5553         fi
5554     fi
5555     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
5556         AC_MSG_ERROR([mscoree.lib not found])
5557     fi
5558     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5560     PathFormat "$MIDL_PATH"
5561     MIDL_PATH="$formatted_path"
5563     PathFormat "$AL_PATH"
5564     AL_PATH="$formatted_path"
5566     PathFormat "$DOTNET_FRAMEWORK_HOME"
5567     DOTNET_FRAMEWORK_HOME="$formatted_path"
5569     PathFormat "$CSC_PATH"
5570     CSC_PATH="$formatted_path"
5573 dnl ===================================================================
5574 dnl Check if stdc headers are available excluding MSVC.
5575 dnl ===================================================================
5576 if test "$_os" != "WINNT"; then
5577     AC_HEADER_STDC
5580 dnl ===================================================================
5581 dnl Testing for C++ compiler and version...
5582 dnl ===================================================================
5584 if test "$_os" != "WINNT"; then
5585     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5586     save_CXXFLAGS=$CXXFLAGS
5587     AC_PROG_CXX
5588     CXXFLAGS=$save_CXXFLAGS
5589 else
5590     if test -n "$CC" -a -z "$CXX"; then
5591         CXX="$CC"
5592     fi
5595 dnl At least MSVC 2015 Update 1 is known to sporadically emit warning C4592
5596 dnl ("implementation limitation" when defining OUStringLiteral variables in
5597 dnl vcl/source/app/IconThemeInfo.cxx), while Update 3 is known good, and it is
5598 dnl probably a good idea to require that anyway.  A reliable way to check for
5599 dnl MSVC 2015 Update 3 appears to be to check for support of C++17 nested
5600 dnl namespace definitions (which requires /std:c++latest to be enabled):
5601 if test "$COM" = MSC -a "$VCVER" = 140; then
5602     AC_MSG_CHECKING([whether MSVC 2015 compiler $MSVC_CXX is at least Update 3])
5603     save_CXX=$CXX
5604     save_CXXFLAGS=$CXXFLAGS
5605     CXX=$MSVC_CXX
5606     CXXFLAGS="$CXXFLAGS /std:c++latest"
5607     AC_LANG_PUSH([C++])
5608     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5609         namespace A::B {}
5610     ]])], [good=yes], [good=no])
5611     AC_LANG_POP([C++])
5612     CXX=$save_CXX
5613     CXXFLAGS=$save_CXXFLAGS
5614     AC_MSG_RESULT([$good])
5615     if test "$good" = no; then
5616         AC_MSG_ERROR([When using MSVC 2015, at least Update 3 must be installed])
5617     fi
5620 dnl check for GNU C++ compiler version
5621 if test "$GXX" = "yes"; then
5622     AC_MSG_CHECKING([the GNU C++ compiler version])
5624     _gpp_version=`$CXX -dumpversion`
5625     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5627     if test "$_gpp_majmin" -lt "401"; then
5628         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5629     else
5630         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5631     fi
5633     dnl see https://code.google.com/p/android/issues/detail?id=41770
5634     if test "$_gpp_majmin" -ge "401"; then
5635         glibcxx_threads=no
5636         AC_LANG_PUSH([C++])
5637         AC_REQUIRE_CPP
5638         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5639         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5640             #include <bits/c++config.h>]],[[
5641             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5642             && !defined(_GLIBCXX__PTHREADS) \
5643             && !defined(_GLIBCXX_HAS_GTHREADS)
5644             choke me
5645             #endif
5646         ]])],[AC_MSG_RESULT([yes])
5647         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5648         AC_LANG_POP([C++])
5649         if test $glibcxx_threads = yes; then
5650             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5651         fi
5652      fi
5654 AC_SUBST(BOOST_CXXFLAGS)
5657 # prefx CXX with ccache if needed
5659 if test "$CCACHE" != ""; then
5660     AC_MSG_CHECKING([whether $CXX is already ccached])
5661     AC_LANG_PUSH([C++])
5662     save_CXXFLAGS=$CXXFLAGS
5663     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5664     dnl an empty program will do, we're checking the compiler flags
5665     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5666                       [use_ccache=yes], [use_ccache=no])
5667     if test $use_ccache = yes; then
5668         AC_MSG_RESULT([yes])
5669     else
5670         CXX="$CCACHE $CXX"
5671         AC_MSG_RESULT([no])
5672     fi
5673     CXXFLAGS=$save_CXXFLAGS
5674     AC_LANG_POP([C++])
5677 dnl ===================================================================
5678 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5679 dnl ===================================================================
5681 if test "$_os" != "WINNT"; then
5682     AC_PROG_CXXCPP
5684     dnl Check whether there's a C pre-processor.
5685     AC_PROG_CPP
5689 dnl ===================================================================
5690 dnl Find integral type sizes and alignments
5691 dnl ===================================================================
5693 if test "$_os" != "WINNT"; then
5695 if test "$_os" == "iOS"; then
5696     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5697     ac_cv_sizeof_long=8
5698     ac_cv_sizeof_short=2
5699     ac_cv_sizeof_int=4
5700     ac_cv_sizeof_long_long=8
5701     ac_cv_sizeof_double=8
5702     ac_cv_sizeof_voidp=8
5703 else
5704     AC_CHECK_SIZEOF(long)
5705     AC_CHECK_SIZEOF(short)
5706     AC_CHECK_SIZEOF(int)
5707     AC_CHECK_SIZEOF(long long)
5708     AC_CHECK_SIZEOF(double)
5709     AC_CHECK_SIZEOF(void*)
5712     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5713     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5714     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5715     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5716     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5718     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5719     m4_pattern_allow([AC_CHECK_ALIGNOF])
5720     m4_ifdef([AC_CHECK_ALIGNOF],
5721         [
5722             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5723             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5724             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5725             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5726         ],
5727         [
5728             case "$_os-$host_cpu" in
5729             Linux-i686)
5730                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5731                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5732                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5733                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5734                 ;;
5735             Linux-x86_64)
5736                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5737                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5738                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5739                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5740                 ;;
5741             *)
5742                 if test -z "$ac_cv_alignof_short" -o \
5743                         -z "$ac_cv_alignof_int" -o \
5744                         -z "$ac_cv_alignof_long" -o \
5745                         -z "$ac_cv_alignof_double"; then
5746                    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.])
5747                 fi
5748                 ;;
5749             esac
5750         ])
5752     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5753     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5754     if test $ac_cv_sizeof_long -eq 8; then
5755         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5756     elif test $ac_cv_sizeof_double -eq 8; then
5757         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5758     else
5759         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5760     fi
5762     dnl Check for large file support
5763     AC_SYS_LARGEFILE
5764     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5765         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5766     fi
5767     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5768         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5769     fi
5770 else
5771     # Hardcode for MSVC
5772     SAL_TYPES_SIZEOFSHORT=2
5773     SAL_TYPES_SIZEOFINT=4
5774     SAL_TYPES_SIZEOFLONG=4
5775     SAL_TYPES_SIZEOFLONGLONG=8
5776     if test "$BITNESS_OVERRIDE" = ""; then
5777         SAL_TYPES_SIZEOFPOINTER=4
5778     else
5779         SAL_TYPES_SIZEOFPOINTER=8
5780     fi
5781     SAL_TYPES_ALIGNMENT2=2
5782     SAL_TYPES_ALIGNMENT4=4
5783     SAL_TYPES_ALIGNMENT8=8
5784     LFS_CFLAGS=''
5786 AC_SUBST(LFS_CFLAGS)
5788 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5789 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5790 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5791 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5792 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5793 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5794 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5795 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5797 dnl ===================================================================
5798 dnl Check whether to enable runtime optimizations
5799 dnl ===================================================================
5800 ENABLE_RUNTIME_OPTIMIZATIONS=
5801 AC_MSG_CHECKING([whether to enable runtime optimizations])
5802 if test -z "$enable_runtime_optimizations"; then
5803     for i in $CC; do
5804         case $i in
5805         -fsanitize=*)
5806             enable_runtime_optimizations=no
5807             break
5808             ;;
5809         esac
5810     done
5812 if test "$enable_runtime_optimizations" != no; then
5813     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5814     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5815     AC_MSG_RESULT([yes])
5816 else
5817     AC_MSG_RESULT([no])
5819 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5821 dnl ===================================================================
5822 dnl Check if valgrind headers are available
5823 dnl ===================================================================
5824 ENABLE_VALGRIND=
5825 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
5826     prev_cppflags=$CPPFLAGS
5827     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5828     # or where does it come from?
5829     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5830     AC_CHECK_HEADER([valgrind/valgrind.h],
5831         [ENABLE_VALGRIND=TRUE])
5832     CPPFLAGS=$prev_cppflags
5834 AC_SUBST([ENABLE_VALGRIND])
5835 if test -z "$ENABLE_VALGRIND"; then
5836     if test "$with_valgrind" = yes; then
5837         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
5838     fi
5839     VALGRIND_CFLAGS=
5841 AC_SUBST([VALGRIND_CFLAGS])
5844 dnl ===================================================================
5845 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5846 dnl ===================================================================
5848 # We need at least the sys/sdt.h include header.
5849 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5850 if test "$SDT_H_FOUND" = "TRUE"; then
5851     # Found sys/sdt.h header, now make sure the c++ compiler works.
5852     # Old g++ versions had problems with probes in constructors/destructors.
5853     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5854     AC_LANG_PUSH([C++])
5855     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5856     #include <sys/sdt.h>
5857     class ProbeClass
5858     {
5859     private:
5860       int& ref;
5861       const char *name;
5863     public:
5864       ProbeClass(int& v, const char *n) : ref(v), name(n)
5865       {
5866         DTRACE_PROBE2(_test_, cons, name, ref);
5867       }
5869       void method(int min)
5870       {
5871         DTRACE_PROBE3(_test_, meth, name, ref, min);
5872         ref -= min;
5873       }
5875       ~ProbeClass()
5876       {
5877         DTRACE_PROBE2(_test_, dest, name, ref);
5878       }
5879     };
5880     ]],[[
5881     int i = 64;
5882     DTRACE_PROBE1(_test_, call, i);
5883     ProbeClass inst = ProbeClass(i, "call");
5884     inst.method(24);
5885     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5886           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5887     AC_LANG_POP([C++])
5889 AC_CONFIG_HEADERS([config_host/config_probes.h])
5891 dnl ===================================================================
5892 dnl GCC features
5893 dnl ===================================================================
5894 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
5895     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5896     save_CFLAGS=$CFLAGS
5897     CFLAGS="$CFLAGS -Werror -mno-avx"
5898     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5899     CFLAGS=$save_CFLAGS
5900     if test "$HAVE_GCC_AVX" = "TRUE"; then
5901         AC_MSG_RESULT([yes])
5902     else
5903         AC_MSG_RESULT([no])
5904     fi
5906     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5907     save_CFLAGS=$CFLAGS
5908     CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
5909     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5910     CFLAGS=$save_CFLAGS
5911     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5912         AC_MSG_RESULT([yes])
5913     else
5914         AC_MSG_RESULT([no])
5915     fi
5917     AC_MSG_CHECKING([whether $CC supports atomic functions])
5918     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5919     int v = 0;
5920     if (__sync_add_and_fetch(&v, 1) != 1 ||
5921         __sync_sub_and_fetch(&v, 1) != 0)
5922         return 1;
5923     __sync_synchronize();
5924     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5925         v != 1)
5926         return 1;
5927     return 0;
5928 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5929     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5930         AC_MSG_RESULT([yes])
5931         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5932     else
5933         AC_MSG_RESULT([no])
5934     fi
5936     AC_MSG_CHECKING([whether $CC supports __builtin_ffs])
5937     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
5938     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
5939         AC_MSG_RESULT([yes])
5940         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
5941     else
5942         AC_MSG_RESULT([no])
5943     fi
5945     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5946     save_CFLAGS=$CFLAGS
5947     CFLAGS="$CFLAGS -Werror"
5948     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5949             __attribute__((deprecated("test"))) void f();
5950         ])], [
5951             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5952             AC_MSG_RESULT([yes])
5953         ], [AC_MSG_RESULT([no])])
5954     CFLAGS=$save_CFLAGS
5956     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
5957     AC_LANG_PUSH([C++])
5958     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5959             #include <cstddef>
5960             #include <cxxabi.h>
5961             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
5962         ])], [
5963             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
5964             AC_MSG_RESULT([yes])
5965         ], [AC_MSG_RESULT([no])])
5966     AC_LANG_POP([C++])
5968     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
5969     AC_LANG_PUSH([C++])
5970     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5971             #include <cstddef>
5972             #include <cxxabi.h>
5973             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
5974         ])], [
5975             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
5976             AC_MSG_RESULT([yes])
5977         ], [AC_MSG_RESULT([no])])
5978     AC_LANG_POP([C++])
5980     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
5981     AC_LANG_PUSH([C++])
5982     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5983             #include <cxxabi.h>
5984             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
5985         ])], [
5986             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
5987             AC_MSG_RESULT([yes])
5988         ], [AC_MSG_RESULT([no])])
5989     AC_LANG_POP([C++])
5991     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
5992     AC_LANG_PUSH([C++])
5993     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5994             #include <cstddef>
5995             #include <cxxabi.h>
5996             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
5997         ])], [
5998             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
5999             AC_MSG_RESULT([yes])
6000         ], [AC_MSG_RESULT([no])])
6001     AC_LANG_POP([C++])
6003     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
6004     AC_LANG_PUSH([C++])
6005     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6006             #include <cstddef>
6007             #include <cxxabi.h>
6008             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6009         ])], [
6010             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6011             AC_MSG_RESULT([yes])
6012         ], [AC_MSG_RESULT([no])])
6013     AC_LANG_POP([C++])
6015     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6016     AC_LANG_PUSH([C++])
6017     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6018             #include <cxxabi.h>
6019             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6020         ])], [
6021             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6022             AC_MSG_RESULT([yes])
6023         ], [AC_MSG_RESULT([no])])
6024     AC_LANG_POP([C++])
6026     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6027     AC_LANG_PUSH([C++])
6028     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6029             #include <cxxabi.h>
6030             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6031         ])], [
6032             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6033             AC_MSG_RESULT([yes])
6034         ], [AC_MSG_RESULT([no])])
6035     AC_LANG_POP([C++])
6037     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
6038     AC_LANG_PUSH([C++])
6039     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6040             #include <cstddef>
6041             #include <cxxabi.h>
6042             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6043         ])], [
6044             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6045             AC_MSG_RESULT([yes])
6046         ], [AC_MSG_RESULT([no])])
6047     AC_LANG_POP([C++])
6049     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
6050     AC_LANG_PUSH([C++])
6051     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6052             #include <cstddef>
6053             #include <cxxabi.h>
6054             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6055         ])], [
6056             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6057             AC_MSG_RESULT([yes])
6058         ], [AC_MSG_RESULT([no])])
6059     AC_LANG_POP([C++])
6061     dnl Available in GCC 4.9 and at least since Clang 3.4:
6062     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6063     AC_LANG_PUSH([C++])
6064     save_CXXFLAGS=$CXXFLAGS
6065     CXXFLAGS="$CXXFLAGS -Werror"
6066     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6067             struct __attribute__((warn_unused)) dummy {};
6068         ])], [
6069             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6070             AC_MSG_RESULT([yes])
6071         ], [AC_MSG_RESULT([no])])
6072     CXXFLAGS=$save_CXXFLAGS
6073 AC_LANG_POP([C++])
6076 AC_SUBST(HAVE_GCC_AVX)
6077 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6078 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6079 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6081 dnl ===================================================================
6082 dnl Identify the C++ library
6083 dnl ===================================================================
6085 AC_MSG_CHECKING([What the C++ library is])
6086 AC_LANG_PUSH([C++])
6087 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6088 #include <utility>
6089 #ifndef __GLIBCXX__
6090 foo bar
6091 #endif
6092 ]])],
6093     [CPP_LIBRARY=GLIBCXX
6094      cpp_library_name="GNU libstdc++"
6095     ],
6096     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6097 #include <utility>
6098 #ifndef _LIBCPP_VERSION
6099 foo bar
6100 #endif
6101 ]])],
6102     [CPP_LIBRARY=LIBCPP
6103      cpp_library_name="LLVM libc++"
6104      AC_DEFINE([HAVE_LIBCXX])
6105     ],
6106     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6107 #include <utility>
6108 #ifndef _MSC_VER
6109 foo bar
6110 #endif
6111 ]])],
6112     [CPP_LIBRARY=MSVCRT
6113      cpp_library_name="Microsoft"
6114     ],
6115     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6116 AC_MSG_RESULT([$cpp_library_name])
6117 AC_LANG_POP([C++])
6119 dnl ===================================================================
6120 dnl Check for gperf
6121 dnl ===================================================================
6122 AC_PATH_PROG(GPERF, gperf)
6123 if test -z "$GPERF"; then
6124     AC_MSG_ERROR([gperf not found but needed. Install it.])
6126 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6127     GPERF=`cygpath -m $GPERF`
6129 AC_MSG_CHECKING([gperf version])
6130 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
6131     AC_MSG_RESULT([OK])
6132 else
6133     AC_MSG_ERROR([too old, you need at least 3.0.0])
6135 AC_SUBST(GPERF)
6137 dnl ===================================================================
6138 dnl Check for system libcmis
6139 dnl ===================================================================
6140 # libcmis requires curl and we can't build curl for iOS
6141 if test $_os != iOS; then
6142     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.0])
6143     ENABLE_LIBCMIS=TRUE
6144 else
6145     ENABLE_LIBCMIS=
6147 AC_SUBST(ENABLE_LIBCMIS)
6149 dnl ===================================================================
6150 dnl C++11
6151 dnl ===================================================================
6153 my_cxx17switches=
6154 libo_FUZZ_ARG_ENABLE(c++17,
6155     AS_HELP_STRING([--disable-c++17],
6156         [Do not attempt to run GCC/Clang in C++17 mode (needed for Coverity).])
6159 CXXFLAGS_CXX11=
6160 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6161     AC_MSG_CHECKING([whether $CXX supports C++11])
6162     AC_MSG_RESULT(yes)
6163     # MSVC supports (a subset of) CXX11 without any switch
6164 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6165     HAVE_CXX11=
6166     AC_MSG_CHECKING([whether $CXX supports C++17, C++14, or C++11])
6167     dnl But only use C++17 if the gperf that is being used knows not to emit
6168     dnl "register" in C++ output:
6169     printf 'foo\n' | $GPERF -L C++ > conftest.inc
6170     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'
6171     if test "$enable_c__17" != no; then
6172         my_flags="-std=gnu++17 -std=gnu++1z -std=c++17 -std=c++1z $my_flags"
6173     fi
6174     for flag in $my_flags; do
6175         if test "$COM" = MSC; then
6176             flag="-Xclang $flag"
6177         fi
6178         save_CXXFLAGS=$CXXFLAGS
6179         CXXFLAGS="$CXXFLAGS $flag -Werror"
6180         if test "$SYSTEM_LIBCMIS" = TRUE; then
6181             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6182         fi
6183         AC_LANG_PUSH([C++])
6184         dnl Clang 3.9 supports __float128 since
6185         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6186         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6187         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6188         dnl $flag is supported below, so check this first):
6189         my_float128hack=
6190         my_float128hack_impl=-D__float128=void
6191         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6192             #include <vector>
6193             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6194             // (__float128)
6195             ]])
6196         ],,[
6197             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6198             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6199             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6200             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6201             dnl place where __float128 is used is in a template specialization, -D__float128=void
6202             dnl will avoid the problem there while still causing a problem if somebody actually uses
6203             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6204             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6205             dnl "fixed" with this hack):
6206             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6207             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6208                 #include <vector>
6209                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6210                 // (__float128)
6211                 ]])
6212             ],[my_float128hack=$my_float128hack_impl])
6213         ])
6214         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6215             #include <algorithm>
6216             #include <functional>
6217             #include <vector>
6219             #include <string.h>
6220             #pragma GCC diagnostic push
6221             #pragma GCC diagnostic ignored "-Wpragmas"
6222                 // make GCC not warn about next pragma
6223             #pragma GCC diagnostic ignored "-Wdeprecated-register"
6224                 // make Clang with -std < C++17 not even warn about register
6225             #include "conftest.inc"
6226             #pragma GCC diagnostic pop
6228             #if defined SYSTEM_LIBCMIS
6229             // See ucb/source/ucp/cmis/auth_provider.hxx:
6230             #if __GNUC__ >= 7
6231             #pragma GCC diagnostic push
6232             #pragma GCC diagnostic ignored "-Wdeprecated"
6233             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6234             #endif
6235             #include <libcmis/libcmis.hxx>
6236             #if __GNUC__ >= 7
6237             #pragma GCC diagnostic pop
6238             #endif
6239             #endif
6241             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6242                 std::sort(v.begin(), v.end(), fn);
6243             }
6244             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6245         AC_LANG_POP([C++])
6246         CXXFLAGS=$save_CXXFLAGS
6247         if test -n "$CXXFLAGS_CXX11"; then
6248             HAVE_CXX11=TRUE
6249             break
6250         fi
6251     done
6252     rm conftest.inc
6253     if test "$HAVE_CXX11" = TRUE; then
6254         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6255     else
6256         AC_MSG_ERROR(no)
6257     fi
6259 AC_SUBST(CXXFLAGS_CXX11)
6261 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6262 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6263 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6264 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6265 dnl again towards 4.7.2:
6266 if test $CPP_LIBRARY = GLIBCXX; then
6267     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6268     AC_LANG_PUSH([C++])
6269     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6270 #include <list>
6271 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6272     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6273     //   GCC 4.7.0: 20120322
6274     //   GCC 4.7.1: 20120614
6275     // and using a range check is not possible as the mapping between
6276     // __GLIBCXX__ values and GCC versions is not monotonic
6277 /* ok */
6278 #else
6279 abi broken
6280 #endif
6281         ]])], [AC_MSG_RESULT(no, ok)],
6282         [AC_MSG_ERROR(yes)])
6283     AC_LANG_POP([C++])
6286 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6287 save_CXXFLAGS=$CXXFLAGS
6288 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6289 AC_LANG_PUSH([C++])
6291 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6292 #include <stddef.h>
6294 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6296 namespace
6298         struct b
6299         {
6300                 int i;
6301                 int j;
6302         };
6304 ]], [[
6305 struct a
6307         int i;
6308         int j;
6310 a thinga[]={{0,0}, {1,1}};
6311 b thingb[]={{0,0}, {1,1}};
6312 size_t i = sizeof(sal_n_array_size(thinga));
6313 size_t j = sizeof(sal_n_array_size(thingb));
6314 return !(i != 0 && j != 0);
6316     ], [ AC_MSG_RESULT(yes) ],
6317     [ AC_MSG_ERROR(no)])
6318 AC_LANG_POP([C++])
6319 CXXFLAGS=$save_CXXFLAGS
6321 AC_MSG_CHECKING([whether $CXX supports C++14 constexpr])
6322 save_CXXFLAGS=$CXXFLAGS
6323 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6324 AC_LANG_PUSH([C++])
6325 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6326     // A somewhat over-complicated way of checking for
6327     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6328     // in constexpr function":
6329     #include <cassert>
6330     template<typename T> inline constexpr T f(T x) { return x; }
6331     template<typename T> inline constexpr T g(T x) {
6332         assert(f(static_cast<int>(x)));
6333         return x;
6334     }
6335     enum E { e };
6336     auto v = g(E::e);
6338     struct S {
6339         int n_;
6340         constexpr bool f() {
6341             int n = n_;
6342             int i = 0;
6343             while (n > 0) { --n; ++i; }
6344             assert(i >= 0);
6345             return i == 0;
6346         }
6347     };
6348     constexpr auto v2 = S{10}.f();
6349     ]])], [cxx14_constexpr=yes], [cxx14_constexpr=no])
6350 AC_LANG_POP([C++])
6351 CXXFLAGS=$save_CXXFLAGS
6352 AC_MSG_RESULT([$cxx14_constexpr])
6353 if test "$cxx14_constexpr" = yes; then
6354     AC_DEFINE([HAVE_CXX14_CONSTEXPR])
6357 dnl _Pragma support (may require C++11)
6358 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6359     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6360     AC_LANG_PUSH([C++])
6361     save_CXXFLAGS=$CXXFLAGS
6362     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6363     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6364             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6365         ])], [
6366             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6367             AC_MSG_RESULT([yes])
6368         ], [AC_MSG_RESULT([no])])
6369     AC_LANG_POP([C++])
6370     CXXFLAGS=$save_CXXFLAGS
6373 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6374 if test "$GCC" = yes; then
6375     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6376     AC_LANG_PUSH([C++])
6377     save_CXXFLAGS=$CXXFLAGS
6378     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6379     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6380     CXXFLAGS=$save_CXXFLAGS
6381     AC_LANG_POP([C++])
6382     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6383         AC_MSG_RESULT([yes])
6384     else
6385         AC_MSG_RESULT([no])
6386     fi
6388 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6390 dnl ===================================================================
6391 dnl system stl sanity tests
6392 dnl ===================================================================
6393 if test "$_os" != "WINNT"; then
6395     AC_LANG_PUSH([C++])
6397     save_CPPFLAGS="$CPPFLAGS"
6398     if test -n "$MACOSX_SDK_PATH"; then
6399         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6400     fi
6402     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6403     # only.
6404     if test "$CPP_LIBRARY" = GLIBCXX; then
6405         dnl gcc#19664, gcc#22482, rhbz#162935
6406         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6407         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6408         AC_MSG_RESULT([$stlvisok])
6409         if test "$stlvisok" = "no"; then
6410             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6411         fi
6412     fi
6414     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6415     # when we don't make any dynamic libraries?
6416     if test "$DISABLE_DYNLOADING" = ""; then
6417         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6418         cat > conftestlib1.cc <<_ACEOF
6419 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6420 struct S2: S1<int> { virtual ~S2(); };
6421 S2::~S2() {}
6422 _ACEOF
6423         cat > conftestlib2.cc <<_ACEOF
6424 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6425 struct S2: S1<int> { virtual ~S2(); };
6426 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6427 _ACEOF
6428         gccvisinlineshiddenok=yes
6429         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6430             gccvisinlineshiddenok=no
6431         else
6432             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6433             dnl known to not work with -z defs (unsetting which makes the test
6434             dnl moot, though):
6435             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6436             if test "$COM_IS_CLANG" = TRUE; then
6437                 for i in $CXX $CXXFLAGS; do
6438                     case $i in
6439                     -fsanitize=*)
6440                         my_linkflagsnoundefs=
6441                         break
6442                         ;;
6443                     esac
6444                 done
6445             fi
6446             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6447                 gccvisinlineshiddenok=no
6448             fi
6449         fi
6451         rm -fr libconftest*
6452         AC_MSG_RESULT([$gccvisinlineshiddenok])
6453         if test "$gccvisinlineshiddenok" = "no"; then
6454             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6455         fi
6456     fi
6458    AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6459     cat >visibility.cxx <<_ACEOF
6460 #pragma GCC visibility push(hidden)
6461 struct __attribute__ ((visibility ("default"))) TestStruct {
6462   static void Init();
6464 __attribute__ ((visibility ("default"))) void TestFunc() {
6465   TestStruct::Init();
6467 _ACEOF
6468     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6469         gccvisbroken=yes
6470     else
6471         case "$host_cpu" in
6472         i?86|x86_64)
6473             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6474                 gccvisbroken=no
6475             else
6476                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6477                     gccvisbroken=no
6478                 else
6479                     gccvisbroken=yes
6480                 fi
6481             fi
6482             ;;
6483         *)
6484             gccvisbroken=no
6485             ;;
6486         esac
6487     fi
6488     rm -f visibility.s visibility.cxx
6490     AC_MSG_RESULT([$gccvisbroken])
6491     if test "$gccvisbroken" = "yes"; then
6492         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6493     fi
6495     CPPFLAGS="$save_CPPFLAGS"
6497     AC_LANG_POP([C++])
6500 dnl ===================================================================
6501 dnl  Clang++ tests
6502 dnl ===================================================================
6504 HAVE_GCC_FNO_DEFAULT_INLINE=
6505 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6506 if test "$GCC" = "yes"; then
6507     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6508     AC_LANG_PUSH([C++])
6509     save_CXXFLAGS=$CXXFLAGS
6510     CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6511     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6512     CXXFLAGS=$save_CXXFLAGS
6513     AC_LANG_POP([C++])
6514     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6515         AC_MSG_RESULT([yes])
6516     else
6517         AC_MSG_RESULT([no])
6518     fi
6520     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6521     AC_LANG_PUSH([C++])
6522     save_CXXFLAGS=$CXXFLAGS
6523     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6524     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6525     CXXFLAGS=$save_CXXFLAGS
6526     AC_LANG_POP([C++])
6527     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6528         AC_MSG_RESULT([yes])
6529     else
6530         AC_MSG_RESULT([no])
6531     fi
6533 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6534 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6536 dnl ===================================================================
6537 dnl Compiler plugins
6538 dnl ===================================================================
6540 COMPILER_PLUGINS=
6541 # currently only Clang
6543 if test "$COM_IS_CLANG" != "TRUE"; then
6544     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6545         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6546         enable_compiler_plugins=no
6547     fi
6550 if test "$COM_IS_CLANG" = "TRUE"; then
6551     if test -n "$enable_compiler_plugins"; then
6552         compiler_plugins="$enable_compiler_plugins"
6553     elif test -n "$ENABLE_DBGUTIL"; then
6554         compiler_plugins=test
6555     else
6556         compiler_plugins=no
6557     fi
6558     if test "$compiler_plugins" != no -a "$CLANGVER" -lt 30800; then
6559         if test "$compiler_plugins" = yes; then
6560             AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 3.8.0.])
6561         else
6562             compiler_plugins=no
6563         fi
6564     fi
6565     if test "$compiler_plugins" != "no"; then
6566         dnl The prefix where Clang resides, override to where Clang resides if
6567         dnl using a source build:
6568         if test -z "$CLANGDIR"; then
6569             CLANGDIR=/usr
6570         fi
6571         AC_LANG_PUSH([C++])
6572         save_CPPFLAGS=$CPPFLAGS
6573         save_CXX=$CXX
6574         # compiler plugins must be built with "native" compiler that was used to build Clang itself:
6575         : "${COMPILER_PLUGINS_CXX=g++ -std=c++11}"
6576         CXX=$COMPILER_PLUGINS_CXX
6577         CPPFLAGS="$CPPFLAGS -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6578         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6579             [COMPILER_PLUGINS=TRUE],
6580             [
6581             if test "$compiler_plugins" = "yes"; then
6582                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6583             else
6584                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6585                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6586             fi
6587             ])
6588         CXX=$save_CXX
6589         CPPFLAGS=$save_CPPFLAGS
6590         AC_LANG_POP([C++])
6591     fi
6592 else
6593     if test "$enable_compiler_plugins" = "yes"; then
6594         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6595     fi
6597 AC_SUBST(COMPILER_PLUGINS)
6598 AC_SUBST(COMPILER_PLUGINS_CXX)
6599 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
6600 AC_SUBST(COMPILER_PLUGINS_DEBUG)
6601 AC_SUBST(CLANGDIR)
6602 AC_SUBST(CLANGLIBDIR)
6604 # Plugin to help linker.
6605 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6606 # This makes --enable-lto build with clang work.
6607 AC_SUBST(LD_PLUGIN)
6609 dnl ===================================================================
6610 dnl allocator
6611 dnl ===================================================================
6612 AC_MSG_CHECKING([which memory allocator to use])
6613 if test "$with_alloc" = "system"; then
6614     AC_MSG_RESULT([system])
6615     ALLOC="SYS_ALLOC"
6617 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6618     AC_MSG_RESULT([internal])
6620 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6621 AC_SUBST(HAVE_POSIX_FALLOCATE)
6622 AC_SUBST(ALLOC)
6624 dnl ===================================================================
6625 dnl Custom build version
6626 dnl ===================================================================
6628 AC_MSG_CHECKING([whether to add custom build version])
6629 if test "$with_build_version" != ""; then
6630     BUILD_VER_STRING=$with_build_version
6631     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6632 else
6633     BUILD_VER_STRING=
6634     AC_MSG_RESULT([no])
6636 AC_SUBST(BUILD_VER_STRING)
6638 JITC_PROCESSOR_TYPE=""
6639 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6640     # IBMs JDK needs this...
6641     JITC_PROCESSOR_TYPE=6
6642     export JITC_PROCESSOR_TYPE
6644 AC_SUBST([JITC_PROCESSOR_TYPE])
6646 # Misc Windows Stuff
6647 AC_ARG_WITH(ucrt-dir,
6648     AS_HELP_STRING([--with-ucrt-dir],
6649         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
6650         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
6651         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
6652             Windows6.1-KB2999226-x64.msu
6653             Windows6.1-KB2999226-x86.msu
6654             Windows8.1-KB2999226-x64.msu
6655             Windows8.1-KB2999226-x86.msu
6656             Windows8-RT-KB2999226-x64.msu
6657             Windows8-RT-KB2999226-x86.msu
6658         A zip archive including those files is available from Microsoft site:
6659         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
6661 UCRT_REDISTDIR="$with_ucrt_dir"
6662 if test $_os = "WINNT"; then
6663     find_msvc_x64_dlls
6664     find_msms
6665     MSVC_DLL_PATH="$msvcdllpath"
6666     MSVC_DLLS="$msvcdlls"
6667     MSM_PATH="$msmdir"
6668     # MSVC 15.3 changed it to VC141
6669     if echo "$MSVC_DLL_PATH" | grep -q "VC141.CRT$"; then
6670         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
6671     else
6672         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6673     fi
6674     if test "$UCRT_REDISTDIR" = "no"; then
6675         dnl explicitly disabled
6676         UCRT_REDISTDIR=""
6677     else
6678         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
6679                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
6680                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
6681                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
6682                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
6683                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
6684             UCRT_REDISTDIR=""
6685             if test -n "$PKGFORMAT"; then
6686                for i in $PKGFORMAT; do
6687                    case "$i" in
6688                    msi)
6689                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
6690                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
6691                        ;;
6692                    esac
6693                done
6694             fi
6695         fi
6696     fi
6699 AC_SUBST(UCRT_REDISTDIR)
6700 AC_SUBST(MSVC_DLL_PATH)
6701 AC_SUBST(MSVC_DLLS)
6702 AC_SUBST(MSM_PATH)
6704 dnl ===================================================================
6705 dnl Checks for Java
6706 dnl ===================================================================
6707 if test "$ENABLE_JAVA" != ""; then
6709     # Windows-specific tests
6710     if test "$build_os" = "cygwin"; then
6711         if test "$BITNESS_OVERRIDE" = 64; then
6712             bitness=64
6713         else
6714             bitness=32
6715         fi
6717         if test -z "$with_jdk_home"; then
6718             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
6719             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
6720             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
6721             if test -n "$regvalue"; then
6722                 ver=$regvalue
6723                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
6724                 _jdk_home=$regvalue
6725             fi
6726             if test -z "$with_jdk_home"; then
6727                 for ver in 1.8 1.7 1.6; do
6728                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6729                     if test -n "$regvalue"; then
6730                         _jdk_home=$regvalue
6731                         break
6732                     fi
6733                 done
6734             fi
6735             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6736                 with_jdk_home="$_jdk_home"
6737                 howfound="found automatically"
6738             else
6739                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6740             fi
6741         else
6742             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6743             howfound="you passed"
6744         fi
6745     fi
6747     # 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.
6748     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6749     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6750         with_jdk_home=`/usr/libexec/java_home`
6751     fi
6753     JAVA_HOME=; export JAVA_HOME
6754     if test -z "$with_jdk_home"; then
6755         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6756     else
6757         _java_path="$with_jdk_home/bin/$with_java"
6758         dnl Check if there is a Java interpreter at all.
6759         if test -x "$_java_path"; then
6760             JAVAINTERPRETER=$_java_path
6761         else
6762             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6763         fi
6764     fi
6766     dnl Check that the JDK found is correct architecture (at least 2 reasons to
6767     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
6768     dnl loaded by java to run JunitTests:
6769     if test "$build_os" = "cygwin"; then
6770         shortjdkhome=`cygpath -d "$with_jdk_home"`
6771         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
6772             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6773             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6774         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
6775             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6776             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6777         fi
6779         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6780             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6781         fi
6782         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6783     elif test "$cross_compiling" != "yes"; then
6784         case $CPUNAME in
6785             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
6786                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6787                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6788                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6789                 fi
6790                 ;;
6791             *) # assumption: everything else 32-bit
6792                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6793                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6794                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6795                 fi
6796                 ;;
6797         esac
6798     fi
6801 HAVE_JAVA9=
6802 dnl ===================================================================
6803 dnl Checks for JDK.
6804 dnl ===================================================================
6806 # Note that JAVA_HOME as for now always means the *build* platform's
6807 # JAVA_HOME. Whether all the complexity here actually is needed any
6808 # more or not, no idea.
6810 if test "$ENABLE_JAVA" != ""; then
6811     _gij_longver=0
6812     AC_MSG_CHECKING([the installed JDK])
6813     if test -n "$JAVAINTERPRETER"; then
6814         dnl java -version sends output to stderr!
6815         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6816             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6817         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6818             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6819         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6820             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6821         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6822             JDK=ibm
6824             dnl IBM JDK specific tests
6825             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6826             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6828             if test "$_jdk_ver" -lt 10600; then
6829                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
6830             fi
6832             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6834             if test "$with_jdk_home" = ""; then
6835                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6836 you must use the "--with-jdk-home" configure option explicitly])
6837             fi
6839             JAVA_HOME=$with_jdk_home
6840         else
6841             JDK=sun
6843             dnl Sun JDK specific tests
6844             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6845             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6847             if test "$_jdk_ver" -lt 10600; then
6848                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
6849             fi
6850             if test "$_jdk_ver" -gt 10600; then
6851                 JAVA_CLASSPATH_NOT_SET=TRUE
6852             fi
6853             if test "$_jdk_ver" -ge 10900; then
6854                 HAVE_JAVA9=TRUE
6855             fi
6857             AC_MSG_RESULT([checked (JDK $_jdk)])
6858             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6859             if test "$_os" = "WINNT"; then
6860                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6861             fi
6863             # set to limit VM usage for JunitTests
6864             JAVAIFLAGS=-Xmx64M
6865             # set to limit VM usage for javac
6866             JAVAFLAGS=-J-Xmx128M
6867         fi
6868     else
6869         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
6870     fi
6871 else
6872     dnl Java disabled
6873     JAVA_HOME=
6874     export JAVA_HOME
6877 dnl ===================================================================
6878 dnl Set target Java bytecode version
6879 dnl ===================================================================
6880 if test "$ENABLE_JAVA" != ""; then
6881     if test "$HAVE_JAVA9" = "TRUE"; then
6882         _java_target_ver="1.6"
6883     else
6884         _java_target_ver="1.5"
6885     fi
6886     JAVA_SOURCE_VER="$_java_target_ver"
6887     JAVA_TARGET_VER="$_java_target_ver"
6890 dnl ===================================================================
6891 dnl Checks for javac
6892 dnl ===================================================================
6893 if test "$ENABLE_JAVA" != ""; then
6894     javacompiler="javac"
6895     if test -z "$with_jdk_home"; then
6896         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6897     else
6898         _javac_path="$with_jdk_home/bin/$javacompiler"
6899         dnl Check if there is a Java compiler at all.
6900         if test -x "$_javac_path"; then
6901             JAVACOMPILER=$_javac_path
6902         fi
6903     fi
6904     if test -z "$JAVACOMPILER"; then
6905         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6906     fi
6907     if test "$build_os" = "cygwin"; then
6908         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6909             JAVACOMPILER="${JAVACOMPILER}.exe"
6910         fi
6911         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
6912     fi
6915 dnl ===================================================================
6916 dnl Checks for javadoc
6917 dnl ===================================================================
6918 if test "$ENABLE_JAVA" != ""; then
6919     if test -z "$with_jdk_home"; then
6920         AC_PATH_PROG(JAVADOC, javadoc)
6921     else
6922         _javadoc_path="$with_jdk_home/bin/javadoc"
6923         dnl Check if there is a javadoc at all.
6924         if test -x "$_javadoc_path"; then
6925             JAVADOC=$_javadoc_path
6926         else
6927             AC_PATH_PROG(JAVADOC, javadoc)
6928         fi
6929     fi
6930     if test -z "$JAVADOC"; then
6931         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6932     fi
6933     if test "$build_os" = "cygwin"; then
6934         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6935             JAVADOC="${JAVADOC}.exe"
6936         fi
6937         JAVADOC=`win_short_path_for_make "$JAVADOC"`
6938     fi
6940     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6941     JAVADOCISGJDOC="yes"
6942     fi
6944 AC_SUBST(JAVADOCISGJDOC)
6946 if test "$ENABLE_JAVA" != ""; then
6947     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
6948     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
6949         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
6950            # try to recover first by looking whether we have a alternatives
6951            # system as in Debian or newer SuSEs where following /usr/bin/javac
6952            # over /etc/alternatives/javac leads to the right bindir where we
6953            # just need to strip a bit away to get a valid JAVA_HOME
6954            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
6955         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
6956             # maybe only one level of symlink (e.g. on Mac)
6957             JAVA_HOME=$(readlink $JAVACOMPILER)
6958             if test "$(dirname $JAVA_HOME)" = "."; then
6959                 # we've got no path to trim back
6960                 JAVA_HOME=""
6961             fi
6962         else
6963             # else warn
6964             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
6965             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
6966             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
6967             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
6968         fi
6969         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
6970         if test "$JAVA_HOME" != "/usr"; then
6971             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6972                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
6973                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
6974                 dnl Tiger already returns a JDK path..
6975                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
6976             else
6977                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
6978                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
6979                 dnl that checks which version to run
6980                 if test -f "$JAVA_HOME"; then
6981                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
6982                 fi
6983             fi
6984         fi
6985     fi
6986     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
6988     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
6989     if test -z "$JAVA_HOME"; then
6990         if test "x$with_jdk_home" = "x"; then
6991             cat > findhome.java <<_ACEOF
6992 [import java.io.File;
6994 class findhome
6996     public static void main(String args[])
6997     {
6998         String jrelocation = System.getProperty("java.home");
6999         File jre = new File(jrelocation);
7000         System.out.println(jre.getParent());
7001     }
7003 _ACEOF
7004             AC_MSG_CHECKING([if javac works])
7005             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7006             AC_TRY_EVAL(javac_cmd)
7007             if test $? = 0 -a -f ./findhome.class; then
7008                 AC_MSG_RESULT([javac works])
7009             else
7010                 echo "configure: javac test failed" >&5
7011                 cat findhome.java >&5
7012                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7013             fi
7014             AC_MSG_CHECKING([if gij knows its java.home])
7015             JAVA_HOME=`$JAVAINTERPRETER findhome`
7016             if test $? = 0 -a "$JAVA_HOME" != ""; then
7017                 AC_MSG_RESULT([$JAVA_HOME])
7018             else
7019                 echo "configure: java test failed" >&5
7020                 cat findhome.java >&5
7021                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7022             fi
7023             # clean-up after ourselves
7024             rm -f ./findhome.java ./findhome.class
7025         else
7026             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7027         fi
7028     fi
7030     # now check if $JAVA_HOME is really valid
7031     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7032         case "${JAVA_HOME}" in
7033             /Library/Java/JavaVirtualMachines/*)
7034                 ;;
7035             *)
7036                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7037                 ;;
7038         esac
7039         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7040             JAVA_HOME_OK="NO"
7041         fi
7042     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7043         JAVA_HOME_OK="NO"
7044     fi
7045     if test "$JAVA_HOME_OK" = "NO"; then
7046         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7047         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7048         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
7049         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7050         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7051         add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
7052     fi
7053     PathFormat "$JAVA_HOME"
7054     JAVA_HOME="$formatted_path"
7057 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7058     "$_os" != Darwin
7059 then
7060     AC_MSG_CHECKING([for JAWT lib])
7061     if test "$_os" = WINNT; then
7062         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7063         JAWTLIB=jawt.lib
7064     else
7065         case "$host_cpu" in
7066         arm*)
7067             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7068             JAVA_ARCH=$my_java_arch
7069             ;;
7070         i*86)
7071             my_java_arch=i386
7072             ;;
7073         m68k)
7074             my_java_arch=m68k
7075             ;;
7076         powerpc)
7077             my_java_arch=ppc
7078             ;;
7079         powerpc64)
7080             my_java_arch=ppc64
7081             ;;
7082         powerpc64le)
7083             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7084             JAVA_ARCH=$my_java_arch
7085             ;;
7086         sparc64)
7087             my_java_arch=sparcv9
7088             ;;
7089         x86_64)
7090             my_java_arch=amd64
7091             ;;
7092         *)
7093             my_java_arch=$host_cpu
7094             ;;
7095         esac
7096         # This is where JDK9 puts the library
7097         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7098             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7099         else
7100             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7101         fi
7102         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7103     fi
7104     AC_MSG_RESULT([$JAWTLIB])
7106 AC_SUBST(JAWTLIB)
7108 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7109     case "$host_os" in
7111     aix*)
7112         JAVAINC="-I$JAVA_HOME/include"
7113         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7114         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7115         ;;
7117     cygwin*)
7118         JAVAINC="-I$JAVA_HOME/include/win32"
7119         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7120         ;;
7122     darwin*)
7123         if test -d "$JAVA_HOME/include/darwin"; then
7124             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7125         else
7126             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7127         fi
7128         ;;
7130     dragonfly*)
7131         JAVAINC="-I$JAVA_HOME/include"
7132         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7133         ;;
7135     freebsd*)
7136         JAVAINC="-I$JAVA_HOME/include"
7137         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7138         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7139         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7140         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7141         ;;
7143     k*bsd*-gnu*)
7144         JAVAINC="-I$JAVA_HOME/include"
7145         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7146         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7147         ;;
7149     linux-gnu*)
7150         JAVAINC="-I$JAVA_HOME/include"
7151         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7152         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7153         ;;
7155     *netbsd*)
7156         JAVAINC="-I$JAVA_HOME/include"
7157         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7158         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7159        ;;
7161     openbsd*)
7162         JAVAINC="-I$JAVA_HOME/include"
7163         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7164         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7165         ;;
7167     solaris*)
7168         JAVAINC="-I$JAVA_HOME/include"
7169         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7170         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7171         ;;
7172     esac
7174 SOLARINC="$SOLARINC $JAVAINC"
7176 AC_SUBST(JAVACOMPILER)
7177 AC_SUBST(JAVADOC)
7178 AC_SUBST(JAVAINTERPRETER)
7179 AC_SUBST(JAVAIFLAGS)
7180 AC_SUBST(JAVAFLAGS)
7181 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7182 AC_SUBST(JAVA_HOME)
7183 AC_SUBST(JAVA_SOURCE_VER)
7184 AC_SUBST(JAVA_TARGET_VER)
7185 AC_SUBST(JDK)
7188 dnl ===================================================================
7189 dnl Export file validation
7190 dnl ===================================================================
7191 AC_MSG_CHECKING([whether to enable export file validation])
7192 if test "$with_export_validation" != "no"; then
7193     if test -z "$ENABLE_JAVA"; then
7194         if test "$with_export_validation" = "yes"; then
7195             AC_MSG_ERROR([requested, but Java is disabled])
7196         else
7197             AC_MSG_RESULT([no, as Java is disabled])
7198         fi
7199     elif test "$_jdk_ver" -lt 10800; then
7200         if test "$with_export_validation" = "yes"; then
7201             AC_MSG_ERROR([requested, but Java is too old, need Java 8])
7202         else
7203             AC_MSG_RESULT([no, as Java is too old, need Java 8])
7204         fi
7205     else
7206         AC_MSG_RESULT([yes])
7207         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7209         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7210         if test -z "$ODFVALIDATOR"; then
7211             # remember to download the ODF toolkit with validator later
7212             AC_MSG_NOTICE([no odfvalidator found, will download it])
7213             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7214             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7216             # and fetch name of odfvalidator jar name from download.lst
7217             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7218             AC_SUBST(ODFVALIDATOR_JAR)
7220             if test -z "$ODFVALIDATOR_JAR"; then
7221                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7222             fi
7223         fi
7224         if test "$build_os" = "cygwin"; then
7225             # In case of Cygwin it will be executed from Windows,
7226             # so we need to run bash and absolute path to validator
7227             # so instead of "odfvalidator" it will be
7228             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7229             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7230         else
7231             ODFVALIDATOR="sh $ODFVALIDATOR"
7232         fi
7233         AC_SUBST(ODFVALIDATOR)
7236         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7237         if test -z "$OFFICEOTRON"; then
7238             # remember to download the officeotron with validator later
7239             AC_MSG_NOTICE([no officeotron found, will download it])
7240             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7241             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7243             # and fetch name of officeotron jar name from download.lst
7244             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7245             AC_SUBST(OFFICEOTRON_JAR)
7247             if test -z "$OFFICEOTRON_JAR"; then
7248                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7249             fi
7250         else
7251             # check version of existing officeotron
7252             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7253             if test 0"$OFFICEOTRON_VER" -lt 704; then
7254                 AC_MSG_ERROR([officeotron too old])
7255             fi
7256         fi
7257         if test "$build_os" = "cygwin"; then
7258             # In case of Cygwin it will be executed from Windows,
7259             # so we need to run bash and absolute path to validator
7260             # so instead of "odfvalidator" it will be
7261             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7262             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7263         else
7264             OFFICEOTRON="sh $OFFICEOTRON"
7265         fi
7266     fi
7267     AC_SUBST(OFFICEOTRON)
7268 else
7269     AC_MSG_RESULT([no])
7272 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7273 if test "$with_bffvalidator" != "no"; then
7274     AC_DEFINE(HAVE_BFFVALIDATOR)
7276     if test "$with_export_validation" = "no"; then
7277         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7278     fi
7280     if test "$with_bffvalidator" = "yes"; then
7281         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7282     else
7283         BFFVALIDATOR="$with_bffvalidator"
7284     fi
7286     if test "$build_os" = "cygwin"; then
7287         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7288             AC_MSG_RESULT($BFFVALIDATOR)
7289         else
7290             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7291         fi
7292     elif test -n "$BFFVALIDATOR"; then
7293         # We are not in Cygwin but need to run Windows binary with wine
7294         AC_PATH_PROGS(WINE, wine)
7296         # so swap in a shell wrapper that converts paths transparently
7297         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7298         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7299         AC_SUBST(BFFVALIDATOR_EXE)
7300         AC_MSG_RESULT($BFFVALIDATOR)
7301     else
7302         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7303     fi
7304     AC_SUBST(BFFVALIDATOR)
7305 else
7306     AC_MSG_RESULT([no])
7309 dnl ===================================================================
7310 dnl Check for C preprocessor to use
7311 dnl ===================================================================
7312 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7313 if test -n "$with_idlc_cpp"; then
7314     AC_MSG_RESULT([$with_idlc_cpp])
7315     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7316 else
7317     AC_MSG_RESULT([ucpp])
7318     AC_MSG_CHECKING([which ucpp tp use])
7319     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7320         AC_MSG_RESULT([external])
7321         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7322     else
7323         AC_MSG_RESULT([internal])
7324         BUILD_TYPE="$BUILD_TYPE UCPP"
7325     fi
7327 AC_SUBST(SYSTEM_UCPP)
7329 dnl ===================================================================
7330 dnl Check for epm (not needed for Windows)
7331 dnl ===================================================================
7332 AC_MSG_CHECKING([whether to enable EPM for packing])
7333 if test "$enable_epm" = "yes"; then
7334     AC_MSG_RESULT([yes])
7335     if test "$_os" != "WINNT"; then
7336         if test $_os = Darwin; then
7337             EPM=internal
7338         elif test -n "$with_epm"; then
7339             EPM=$with_epm
7340         else
7341             AC_PATH_PROG(EPM, epm, no)
7342         fi
7343         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7344             AC_MSG_NOTICE([EPM will be built.])
7345             BUILD_TYPE="$BUILD_TYPE EPM"
7346             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7347         else
7348             # Gentoo has some epm which is something different...
7349             AC_MSG_CHECKING([whether the found epm is the right epm])
7350             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7351                 AC_MSG_RESULT([yes])
7352             else
7353                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7354             fi
7355             AC_MSG_CHECKING([epm version])
7356             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7357             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7358                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7359                 AC_MSG_RESULT([OK, >= 3.7])
7360             else
7361                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7362                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7363             fi
7364         fi
7365     fi
7367     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7368         AC_MSG_CHECKING([for rpm])
7369         for a in "$RPM" rpmbuild rpm; do
7370             $a --usage >/dev/null 2> /dev/null
7371             if test $? -eq 0; then
7372                 RPM=$a
7373                 break
7374             else
7375                 $a --version >/dev/null 2> /dev/null
7376                 if test $? -eq 0; then
7377                     RPM=$a
7378                     break
7379                 fi
7380             fi
7381         done
7382         if test -z "$RPM"; then
7383             AC_MSG_ERROR([not found])
7384         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7385             RPM_PATH=`which $RPM`
7386             AC_MSG_RESULT([$RPM_PATH])
7387             SCPDEFS="$SCPDEFS -DWITH_RPM"
7388         else
7389             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7390         fi
7391     fi
7392     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7393         AC_PATH_PROG(DPKG, dpkg, no)
7394         if test "$DPKG" = "no"; then
7395             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7396         fi
7397     fi
7398     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7399        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7400         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7401             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7402                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7403                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7404                     AC_MSG_RESULT([yes])
7405                 else
7406                     AC_MSG_RESULT([no])
7407                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7408                         _pt="rpm"
7409                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7410                         add_warning "the rpms will need to be installed with --nodeps"
7411                     else
7412                         _pt="pkg"
7413                     fi
7414                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7415                     add_warning "the ${_pt}s will not be relocatable"
7416                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7417                                  relocation will work, you need to patch your epm with the
7418                                  patch in epm/epm-3.7.patch or build with
7419                                  --with-epm=internal which will build a suitable epm])
7420                 fi
7421             fi
7422         fi
7423     fi
7424     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7425         AC_PATH_PROG(PKGMK, pkgmk, no)
7426         if test "$PKGMK" = "no"; then
7427             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7428         fi
7429     fi
7430     AC_SUBST(RPM)
7431     AC_SUBST(DPKG)
7432     AC_SUBST(PKGMK)
7433 else
7434     for i in $PKGFORMAT; do
7435         case "$i" in
7436         aix | bsd | deb | pkg | rpm | native | portable)
7437             AC_MSG_ERROR(
7438                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7439             ;;
7440         esac
7441     done
7442     AC_MSG_RESULT([no])
7443     EPM=NO
7445 AC_SUBST(EPM)
7447 ENABLE_LWP=
7448 if test "$enable_lotuswordpro" = "yes"; then
7449     ENABLE_LWP="TRUE"
7451 AC_SUBST(ENABLE_LWP)
7453 dnl ===================================================================
7454 dnl Check for building ODK
7455 dnl ===================================================================
7456 if test "$enable_odk" = no; then
7457     unset DOXYGEN
7458 else
7459     if test "$with_doxygen" = no; then
7460         AC_MSG_CHECKING([for doxygen])
7461         unset DOXYGEN
7462         AC_MSG_RESULT([no])
7463     else
7464         if test "$with_doxygen" = yes; then
7465             AC_PATH_PROG([DOXYGEN], [doxygen])
7466             if test -z "$DOXYGEN"; then
7467                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7468             fi
7469             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
7470                 if ! dot -V 2>/dev/null; then
7471                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
7472                 fi
7473             fi
7474         else
7475             AC_MSG_CHECKING([for doxygen])
7476             DOXYGEN=$with_doxygen
7477             AC_MSG_RESULT([$DOXYGEN])
7478         fi
7479         if test -n "$DOXYGEN"; then
7480             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7481             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7482             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7483                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7484             fi
7485         fi
7486     fi
7488 AC_SUBST([DOXYGEN])
7490 AC_MSG_CHECKING([whether to build the ODK])
7491 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7492     AC_MSG_RESULT([yes])
7494     if test "$with_java" != "no"; then
7495         AC_MSG_CHECKING([whether to build unowinreg.dll])
7496         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7497             # build on Win by default
7498             enable_build_unowinreg=yes
7499         fi
7500         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7501             AC_MSG_RESULT([no])
7502             BUILD_UNOWINREG=
7503         else
7504             AC_MSG_RESULT([yes])
7505             BUILD_UNOWINREG=TRUE
7506         fi
7507         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7508             if test -z "$with_mingw_cross_compiler"; then
7509                 dnl Guess...
7510                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7511             elif test -x "$with_mingw_cross_compiler"; then
7512                  MINGWCXX="$with_mingw_cross_compiler"
7513             else
7514                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7515             fi
7517             if test "$MINGWCXX" = "false"; then
7518                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7519             fi
7521             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7522             if test -x "$mingwstrip_test"; then
7523                 MINGWSTRIP="$mingwstrip_test"
7524             else
7525                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7526             fi
7528             if test "$MINGWSTRIP" = "false"; then
7529                 AC_MSG_ERROR(MinGW32 binutils not found.)
7530             fi
7531         fi
7532     fi
7533     BUILD_TYPE="$BUILD_TYPE ODK"
7534 else
7535     AC_MSG_RESULT([no])
7536     BUILD_UNOWINREG=
7538 AC_SUBST(BUILD_UNOWINREG)
7539 AC_SUBST(MINGWCXX)
7540 AC_SUBST(MINGWSTRIP)
7542 dnl ===================================================================
7543 dnl Check for system zlib
7544 dnl ===================================================================
7545 if test "$with_system_zlib" = "auto"; then
7546     case "$_os" in
7547     WINNT)
7548         with_system_zlib="$with_system_libs"
7549         ;;
7550     *)
7551         if test "$enable_fuzzers" != "yes"; then
7552             with_system_zlib=yes
7553         else
7554             with_system_zlib=no
7555         fi
7556         ;;
7557     esac
7560 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7561 dnl and has no pkg-config for it at least on some tinderboxes,
7562 dnl so leaving that out for now
7563 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7564 AC_MSG_CHECKING([which zlib to use])
7565 if test "$with_system_zlib" = "yes"; then
7566     AC_MSG_RESULT([external])
7567     SYSTEM_ZLIB=TRUE
7568     AC_CHECK_HEADER(zlib.h, [],
7569         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7570     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7571         [AC_MSG_ERROR(zlib not found or functional)], [])
7572 else
7573     AC_MSG_RESULT([internal])
7574     SYSTEM_ZLIB=
7575     BUILD_TYPE="$BUILD_TYPE ZLIB"
7576     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7577     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7579 AC_SUBST(ZLIB_CFLAGS)
7580 AC_SUBST(ZLIB_LIBS)
7581 AC_SUBST(SYSTEM_ZLIB)
7583 dnl ===================================================================
7584 dnl Check for system jpeg
7585 dnl ===================================================================
7586 AC_MSG_CHECKING([which libjpeg to use])
7587 if test "$with_system_jpeg" = "yes"; then
7588     AC_MSG_RESULT([external])
7589     SYSTEM_LIBJPEG=TRUE
7590     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7591         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7592     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7593         [AC_MSG_ERROR(jpeg library not found or fuctional)], [])
7594 else
7595     SYSTEM_LIBJPEG=
7596     AC_MSG_RESULT([internal, libjpeg-turbo])
7597     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
7598     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
7599     if test "$COM" = "MSC"; then
7600         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
7601     else
7602         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
7603     fi
7605     case "$host_cpu" in
7606     x86_64 | amd64 | i*86 | x86 | ia32)
7607         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7608         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7609             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7610                 NASM="$LODE_HOME/opt/bin/nasm"
7611             elif test -x "/opt/lo/bin/nasm"; then
7612                 NASM="/opt/lo/bin/nasm"
7613             fi
7614         fi
7616         if test -n "$NASM"; then
7617             AC_MSG_CHECKING([for object file format of host system])
7618             case "$host_os" in
7619               cygwin* | mingw* | pw32* | interix*)
7620                 case "$host_cpu" in
7621                   x86_64)
7622                     objfmt='Win64-COFF'
7623                     ;;
7624                   *)
7625                     objfmt='Win32-COFF'
7626                     ;;
7627                 esac
7628               ;;
7629               msdosdjgpp* | go32*)
7630                 objfmt='COFF'
7631               ;;
7632               os2-emx*)                 # not tested
7633                 objfmt='MSOMF'          # obj
7634               ;;
7635               linux*coff* | linux*oldld*)
7636                 objfmt='COFF'           # ???
7637               ;;
7638               linux*aout*)
7639                 objfmt='a.out'
7640               ;;
7641               linux*)
7642                 case "$host_cpu" in
7643                   x86_64)
7644                     objfmt='ELF64'
7645                     ;;
7646                   *)
7647                     objfmt='ELF'
7648                     ;;
7649                 esac
7650               ;;
7651               kfreebsd* | freebsd* | netbsd* | openbsd*)
7652                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
7653                   objfmt='BSD-a.out'
7654                 else
7655                   case "$host_cpu" in
7656                     x86_64 | amd64)
7657                       objfmt='ELF64'
7658                       ;;
7659                     *)
7660                       objfmt='ELF'
7661                       ;;
7662                   esac
7663                 fi
7664               ;;
7665               solaris* | sunos* | sysv* | sco*)
7666                 case "$host_cpu" in
7667                   x86_64)
7668                     objfmt='ELF64'
7669                     ;;
7670                   *)
7671                     objfmt='ELF'
7672                     ;;
7673                 esac
7674               ;;
7675               darwin* | rhapsody* | nextstep* | openstep* | macos*)
7676                 case "$host_cpu" in
7677                   x86_64)
7678                     objfmt='Mach-O64'
7679                     ;;
7680                   *)
7681                     objfmt='Mach-O'
7682                     ;;
7683                 esac
7684               ;;
7685               *)
7686                 objfmt='ELF ?'
7687               ;;
7688             esac
7690             AC_MSG_RESULT([$objfmt])
7691             if test "$objfmt" = 'ELF ?'; then
7692               objfmt='ELF'
7693               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
7694             fi
7696             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
7697             case "$objfmt" in
7698               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
7699               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
7700               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
7701               COFF)       NAFLAGS='-fcoff -DCOFF';;
7702               a.out)      NAFLAGS='-faout -DAOUT';;
7703               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
7704               ELF)        NAFLAGS='-felf -DELF';;
7705               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
7706               RDF)        NAFLAGS='-frdf -DRDF';;
7707               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
7708               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
7709             esac
7710             AC_MSG_RESULT([$NAFLAGS])
7712             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
7713             cat > conftest.asm << EOF
7714             [%line __oline__ "configure"
7715                     section .text
7716                     global  _main,main
7717             _main:
7718             main:   xor     eax,eax
7719                     ret
7720             ]
7722             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
7723             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
7724               AC_MSG_RESULT(yes)
7725             else
7726               echo "configure: failed program was:" >&AC_FD_CC
7727               cat conftest.asm >&AC_FD_CC
7728               rm -rf conftest*
7729               AC_MSG_RESULT(no)
7730               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
7731               NASM=""
7732             fi
7734         fi
7736         if test -z "$NASM"; then
7737 cat << _EOS
7738 ****************************************************************************
7739 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
7740 To get one please:
7742 _EOS
7743             if test "$build_os" = "cygwin"; then
7744 cat << _EOS
7745 install a pre-compiled binary for Win32
7747 mkdir -p /opt/lo/bin
7748 cd /opt/lo/bin
7749 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7750 chmod +x nasm
7752 or get and install one from http://www.nasm.us/
7754 Then re-run autogen.sh
7756 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7757 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7759 _EOS
7760             else
7761 cat << _EOS
7762 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
7764 _EOS
7765             fi
7766             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
7767             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
7768         fi
7769       ;;
7770     esac
7773 AC_SUBST(NASM)
7774 AC_SUBST(LIBJPEG_CFLAGS)
7775 AC_SUBST(LIBJPEG_LIBS)
7776 AC_SUBST(SYSTEM_LIBJPEG)
7778 dnl ===================================================================
7779 dnl Check for system clucene
7780 dnl ===================================================================
7781 dnl we should rather be using
7782 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7783 dnl but the contribs-lib check seems tricky
7784 AC_MSG_CHECKING([which clucene to use])
7785 if test "$with_system_clucene" = "yes"; then
7786     AC_MSG_RESULT([external])
7787     SYSTEM_CLUCENE=TRUE
7788     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7789     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7790     FilterLibs "${CLUCENE_LIBS}"
7791     CLUCENE_LIBS="${filteredlibs}"
7792     AC_LANG_PUSH([C++])
7793     save_CXXFLAGS=$CXXFLAGS
7794     save_CPPFLAGS=$CPPFLAGS
7795     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7796     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7797     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7798     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7799     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7800                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7801     CXXFLAGS=$save_CXXFLAGS
7802     CPPFLAGS=$save_CPPFLAGS
7803     AC_LANG_POP([C++])
7805     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7806 else
7807     AC_MSG_RESULT([internal])
7808     SYSTEM_CLUCENE=
7809     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7811 AC_SUBST(SYSTEM_CLUCENE)
7812 AC_SUBST(CLUCENE_CFLAGS)
7813 AC_SUBST(CLUCENE_LIBS)
7815 dnl ===================================================================
7816 dnl Check for system expat
7817 dnl ===================================================================
7818 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
7820 dnl ===================================================================
7821 dnl Check for system xmlsec
7822 dnl ===================================================================
7823 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24])
7825 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7826 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7827     ENABLE_EOT="TRUE"
7828     AC_DEFINE([ENABLE_EOT])
7829     AC_MSG_RESULT([yes])
7831     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7832 else
7833     ENABLE_EOT=
7834     AC_MSG_RESULT([no])
7836 AC_SUBST([ENABLE_EOT])
7838 dnl ===================================================================
7839 dnl Check for DLP libs
7840 dnl ===================================================================
7841 AS_IF([test "$COM" = "MSC"],
7842       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7843       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7845 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7847 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7849 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
7851 AS_IF([test "$COM" = "MSC"],
7852       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7853       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7855 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7857 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7859 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7860 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.9])
7862 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7864 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7866 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7868 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
7869 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.16])
7871 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
7872 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
7874 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7876 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
7877 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
7879 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7881 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7883 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
7885 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
7887 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
7888 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
7890 dnl ===================================================================
7891 dnl Check for system lcms2
7892 dnl ===================================================================
7893 if test "$with_system_lcms2" != "yes"; then
7894     SYSTEM_LCMS2=
7896 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7897 if test "$GCC" = "yes"; then
7898     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7900 if test "$COM" = "MSC"; then # override the above
7901     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7904 dnl ===================================================================
7905 dnl Check for system cppunit
7906 dnl ===================================================================
7907 if test "$cross_compiling" != "yes"; then
7908     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
7911 dnl ===================================================================
7912 dnl Check whether freetype is available
7913 dnl ===================================================================
7914 if test  "$test_freetype" = "yes"; then
7915     AC_MSG_CHECKING([whether freetype is available])
7916     # FreeType has 3 different kinds of versions
7917     # * release, like 2.4.10
7918     # * libtool, like 13.0.7 (this what pkg-config returns)
7919     # * soname
7920     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7921     #
7922     # 9.9.3 is 2.2.0
7923     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7924     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7925     FilterLibs "${FREETYPE_LIBS}"
7926     FREETYPE_LIBS="${filteredlibs}"
7927     SYSTEM_FREETYPE=TRUE
7928 else
7929     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
7930     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
7932 AC_SUBST(FREETYPE_CFLAGS)
7933 AC_SUBST(FREETYPE_LIBS)
7934 AC_SUBST([SYSTEM_FREETYPE])
7936 # ===================================================================
7937 # Check for system libxslt
7938 # to prevent incompatibilities between internal libxml2 and external libxslt,
7939 # or vice versa, use with_system_libxml here
7940 # ===================================================================
7941 if test "$with_system_libxml" = "auto"; then
7942     case "$_os" in
7943     WINNT|iOS|Android)
7944         with_system_libxml="$with_system_libs"
7945         ;;
7946     *)
7947         if test "$enable_fuzzers" != "yes"; then
7948             with_system_libxml=yes
7949         else
7950             with_system_libxml=no
7951         fi
7952         ;;
7953     esac
7956 AC_MSG_CHECKING([which libxslt to use])
7957 if test "$with_system_libxml" = "yes"; then
7958     AC_MSG_RESULT([external])
7959     SYSTEM_LIBXSLT=TRUE
7960     if test "$_os" = "Darwin"; then
7961         dnl make sure to use SDK path
7962         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7963         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7964         dnl omit -L/usr/lib
7965         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7966         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7967     else
7968         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7969         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7970         FilterLibs "${LIBXSLT_LIBS}"
7971         LIBXSLT_LIBS="${filteredlibs}"
7972         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7973         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7974         FilterLibs "${LIBEXSLT_LIBS}"
7975         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
7976     fi
7978     dnl Check for xsltproc
7979     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7980     if test "$XSLTPROC" = "no"; then
7981         AC_MSG_ERROR([xsltproc is required])
7982     fi
7983 else
7984     AC_MSG_RESULT([internal])
7985     SYSTEM_LIBXSLT=
7986     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
7988     if test "$cross_compiling" = "yes"; then
7989         AC_PATH_PROG(XSLTPROC, xsltproc, no)
7990         if test "$XSLTPROC" = "no"; then
7991             AC_MSG_ERROR([xsltproc is required])
7992         fi
7993     fi
7995 AC_SUBST(SYSTEM_LIBXSLT)
7996 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
7997     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
7999 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8001 AC_SUBST(LIBEXSLT_CFLAGS)
8002 AC_SUBST(LIBEXSLT_LIBS)
8003 AC_SUBST(LIBXSLT_CFLAGS)
8004 AC_SUBST(LIBXSLT_LIBS)
8005 AC_SUBST(XSLTPROC)
8007 # ===================================================================
8008 # Check for system libxml
8009 # ===================================================================
8010 AC_MSG_CHECKING([which libxml to use])
8011 if test "$with_system_libxml" = "yes"; then
8012     AC_MSG_RESULT([external])
8013     SYSTEM_LIBXML=TRUE
8014     if test "$_os" = "Darwin"; then
8015         dnl make sure to use SDK path
8016         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8017         dnl omit -L/usr/lib
8018         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8019     elif test $_os = iOS; then
8020         dnl make sure to use SDK path
8021         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8022         LIBXML_CFLAGS="-I$usr/include/libxml2"
8023         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8024     else
8025         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8026         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8027         FilterLibs "${LIBXML_LIBS}"
8028         LIBXML_LIBS="${filteredlibs}"
8029     fi
8031     dnl Check for xmllint
8032     AC_PATH_PROG(XMLLINT, xmllint, no)
8033     if test "$XMLLINT" = "no"; then
8034         AC_MSG_ERROR([xmllint is required])
8035     fi
8036 else
8037     AC_MSG_RESULT([internal])
8038     SYSTEM_LIBXML=
8039     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8040     if test "$COM" = "MSC"; then
8041         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8042     fi
8043     if test "$COM" = "MSC"; then
8044         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8045     else
8046         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8047     fi
8048     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8050 AC_SUBST(SYSTEM_LIBXML)
8051 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8052     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8054 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8055 AC_SUBST(LIBXML_CFLAGS)
8056 AC_SUBST(LIBXML_LIBS)
8057 AC_SUBST(XMLLINT)
8059 # =====================================================================
8060 # Checking for a Python interpreter with version >= 2.7.
8061 # Build and runtime requires Python 3 compatible version (>= 2.7).
8062 # Optionally user can pass an option to configure, i. e.
8063 # ./configure PYTHON=/usr/bin/python
8064 # =====================================================================
8065 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8066     # This allows a lack of system python with no error, we use internal one in that case.
8067     AM_PATH_PYTHON([2.7],, [:])
8068     # Clean PYTHON_VERSION checked below if cross-compiling
8069     PYTHON_VERSION=""
8070     if test "$PYTHON" != ":"; then
8071         PYTHON_FOR_BUILD=$PYTHON
8072     fi
8074 AC_SUBST(PYTHON_FOR_BUILD)
8076 # Checks for Python to use for Pyuno
8077 AC_MSG_CHECKING([which Python to use for Pyuno])
8078 case "$enable_python" in
8079 no|disable)
8080     if test -z $PYTHON_FOR_BUILD; then
8081         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8082         # requirement from the choice whether to include Python stuff in the installer, but why
8083         # bother?
8084         AC_MSG_ERROR([Python is required at build time.])
8085     fi
8086     enable_python=no
8087     AC_MSG_RESULT([none])
8088     ;;
8089 ""|yes|auto)
8090     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8091         AC_MSG_RESULT([no, overridden by --disable-scripting])
8092         enable_python=no
8093     elif test $build_os = cygwin; then
8094         dnl When building on Windows we don't attempt to use any installed
8095         dnl "system"  Python.
8096         AC_MSG_RESULT([fully internal])
8097         enable_python=internal
8098     elif test "$cross_compiling" = yes; then
8099         AC_MSG_RESULT([system])
8100         enable_python=system
8101     else
8102         if test -z "$PYTHON_FOR_BUILD"; then
8103             AC_MSG_RESULT([fully internal])
8104         else
8105             AC_MSG_RESULT([internal])
8106         fi
8107         enable_python=internal
8108     fi
8109     ;;
8110 internal)
8111     AC_MSG_RESULT([internal])
8112     ;;
8113 fully-internal)
8114     AC_MSG_RESULT([fully internal])
8115     enable_python=internal
8116     ;;
8117 system)
8118     AC_MSG_RESULT([system])
8119     ;;
8121     AC_MSG_ERROR([Incorrect --enable-python option])
8122     ;;
8123 esac
8125 if test $enable_python != no; then
8126     BUILD_TYPE="$BUILD_TYPE PYUNO"
8129 if test $enable_python = system; then
8130     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8131         python_version=2.7
8132         PYTHON=python$python_version
8133         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
8134             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
8135             PYTHON_LIBS="-framework Python"
8136         else
8137             PYTHON_CFLAGS="`$PYTHON-config --includes`"
8138             PYTHON_LIBS="`$PYTHON-config --libs`"
8139         fi
8140     fi
8141     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8142         # Fallback: Accept these in the environment, or as set above
8143         # for MacOSX.
8144         :
8145     elif test "$cross_compiling" != yes; then
8146         # Unset variables set by the above AM_PATH_PYTHON so that
8147         # we actually do check anew.
8148         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
8149         # This causes an error if no python command is found
8150         AM_PATH_PYTHON([3.3])
8151         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8152         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8153         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8154         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8155         if test -z "$PKG_CONFIG"; then
8156             PYTHON_CFLAGS="-I$python_include"
8157             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8158         elif $PKG_CONFIG --exists python-$python_version; then
8159             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8160             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8161         else
8162             PYTHON_CFLAGS="-I$python_include"
8163             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8164         fi
8165         FilterLibs "${PYTHON_LIBS}"
8166         PYTHON_LIBS="${filteredlibs}"
8167     else
8168         dnl How to find out the cross-compilation Python installation path?
8169         AC_MSG_CHECKING([for python version])
8170         AS_IF([test -n "$PYTHON_VERSION"],
8171               [AC_MSG_RESULT([$PYTHON_VERSION])],
8172               [AC_MSG_RESULT([not found])
8173                AC_MSG_ERROR([no usable python found])])
8174         test -n "$PYTHON_CFLAGS" && break
8175     fi
8177     dnl Check if the headers really work
8178     save_CPPFLAGS="$CPPFLAGS"
8179     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8180     AC_CHECK_HEADER(Python.h)
8181     CPPFLAGS="$save_CPPFLAGS"
8183     # let the PYTHON_FOR_BUILD match the same python installation that
8184     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8185     # better for PythonTests.
8186     PYTHON_FOR_BUILD=$PYTHON
8189 if test "$with_lxml" != no; then
8190     if test -z "$PYTHON_FOR_BUILD"; then
8191         case $build_os in
8192             cygwin)
8193                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8194                 ;;
8195             *)
8196                 if test "$cross_compiling" != yes ; then
8197                     BUILD_TYPE="$BUILD_TYPE LXML"
8198                 fi
8199                 ;;
8200         esac
8201     else
8202         AC_MSG_CHECKING([for python lxml])
8203         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8204             AC_MSG_RESULT([yes])
8205         else
8206             case $build_os in
8207                 cygwin)
8208                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8209                     ;;
8210                 *)
8211                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8212                         BUILD_TYPE="$BUILD_TYPE LXML"
8213                         AC_MSG_RESULT([no, using internal lxml])
8214                     else
8215                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8216                     fi
8217                     ;;
8218             esac
8219         fi
8220     fi
8223 dnl By now enable_python should be "system", "internal" or "no"
8224 case $enable_python in
8225 system)
8226     SYSTEM_PYTHON=TRUE
8228     if test "x$ac_cv_header_Python_h" != "xyes"; then
8229        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8230     fi
8232     AC_LANG_PUSH(C)
8233     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8234     AC_MSG_CHECKING([for correct python library version])
8235        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8236 #include <Python.h>
8238 int main(int argc, char **argv) {
8239    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8240        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8241    else return 1;
8243        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3, or Python >= 2.7 when building with Python 2])],[AC_MSG_RESULT([skipped; cross-compiling])])
8244     CFLAGS=$save_CFLAGS
8245     AC_LANG_POP(C)
8247     dnl FIXME Check if the Python library can be linked with, too?
8248     ;;
8250 internal)
8251     SYSTEM_PYTHON=
8252     PYTHON_VERSION_MAJOR=3
8253     PYTHON_VERSION_MINOR=5
8254     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.9
8255     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8256         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8257     fi
8258     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8259     BUILD_TYPE="$BUILD_TYPE PYTHON"
8260     # Embedded Python dies without Home set
8261     if test "$HOME" = ""; then
8262         export HOME=""
8263     fi
8264     ;;
8266     DISABLE_PYTHON=TRUE
8267     SYSTEM_PYTHON=
8268     ;;
8270     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8271     ;;
8272 esac
8274 AC_SUBST(DISABLE_PYTHON)
8275 AC_SUBST(SYSTEM_PYTHON)
8276 AC_SUBST(PYTHON_CFLAGS)
8277 AC_SUBST(PYTHON_LIBS)
8278 AC_SUBST(PYTHON_VERSION)
8279 AC_SUBST(PYTHON_VERSION_MAJOR)
8280 AC_SUBST(PYTHON_VERSION_MINOR)
8282 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8283 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8284     AC_MSG_RESULT([yes])
8285     ENABLE_MARIADBC=TRUE
8286     MARIADBC_MAJOR=1
8287     MARIADBC_MINOR=0
8288     MARIADBC_MICRO=2
8289     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8290 else
8291     AC_MSG_RESULT([no])
8292     ENABLE_MARIADBC=
8294 AC_SUBST(ENABLE_MARIADBC)
8295 AC_SUBST(MARIADBC_MAJOR)
8296 AC_SUBST(MARIADBC_MINOR)
8297 AC_SUBST(MARIADBC_MICRO)
8299 if test "$ENABLE_MARIADBC" = "TRUE"; then
8301     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8303     dnl ===================================================================
8304     dnl Check for system MariaDB
8305     dnl ===================================================================
8306     AC_MSG_CHECKING([which MariaDB to use])
8307     if test "$with_system_mariadb" = "yes"; then
8308         AC_MSG_RESULT([external])
8309         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8310         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8311         if test -z "$MARIADBCONFIG"; then
8312             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8313             if test -z "$MARIADBCONFIG"; then
8314                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8315                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8316             fi
8317         fi
8318         AC_MSG_CHECKING([MariaDB version])
8319         MARIADB_VERSION=`$MARIADBCONFIG --version`
8320         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8321         if test "$MARIADB_MAJOR" -ge "5"; then
8322             AC_MSG_RESULT([OK])
8323         else
8324             AC_MSG_ERROR([too old, use 5.0.x or later])
8325         fi
8326         AC_MSG_CHECKING([for MariaDB Client library])
8327         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8328         if test "$COM_IS_CLANG" = TRUE; then
8329             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8330         fi
8331         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8332         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8333         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8334         dnl linux32:
8335         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8336             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8337             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8338                 | sed -e 's|/lib64/|/lib/|')
8339         fi
8340         FilterLibs "${MARIADB_LIBS}"
8341         MARIADB_LIBS="${filteredlibs}"
8342         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8343         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8344         if test "$enable_bundle_mariadb" = "yes"; then
8345             AC_MSG_RESULT([yes])
8346             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8347             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8349 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8351 /g' | grep -E '(mysqlclient|mariadb)')
8352             if test "$_os" = "Darwin"; then
8353                 LIBMARIADB=${LIBMARIADB}.dylib
8354             elif test "$_os" = "WINNT"; then
8355                 LIBMARIADB=${LIBMARIADB}.dll
8356             else
8357                 LIBMARIADB=${LIBMARIADB}.so
8358             fi
8359             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8360             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8361             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8362                 AC_MSG_RESULT([found.])
8363                 PathFormat "$LIBMARIADB_PATH"
8364                 LIBMARIADB_PATH="$formatted_path"
8365             else
8366                 AC_MSG_ERROR([not found.])
8367             fi
8368         else
8369             AC_MSG_RESULT([no])
8370             BUNDLE_MARIADB_CONNECTOR_C=
8371         fi
8372     else
8373         AC_MSG_RESULT([internal])
8374         SYSTEM_MARIADB_CONNECTOR_C=
8375         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8376         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8377         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8378     fi
8380     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8381     AC_SUBST(MARIADB_CFLAGS)
8382     AC_SUBST(MARIADB_LIBS)
8383     AC_SUBST(LIBMARIADB)
8384     AC_SUBST(LIBMARIADB_PATH)
8385     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8387     AC_LANG_PUSH([C++])
8388     dnl ===================================================================
8389     dnl Check for system MySQL C++ Connector
8390     dnl ===================================================================
8391     # FIXME!
8392     # who thought this too-generic cppconn dir was a good idea?
8393     AC_MSG_CHECKING([MySQL Connector/C++])
8394     if test "$with_system_mysql_cppconn" = "yes"; then
8395         AC_MSG_RESULT([external])
8396         SYSTEM_MYSQL_CONNECTOR_CPP=TRUE
8397         AC_LANG_PUSH([C++])
8398         AC_CHECK_HEADER(mysql_driver.h, [],
8399                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8400         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8401                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8402         save_LIBS=$LIBS
8403         LIBS="$LIBS -lmysqlcppconn"
8404         AC_MSG_CHECKING([version])
8405         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8406 #include <mysql_driver.h>
8408 int main(int argc, char **argv) {
8409     sql::Driver *driver;
8410     driver = get_driver_instance();
8411     if (driver->getMajorVersion() > 1 || \
8412        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8413        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8414         return 0;
8415       else
8416         return 1;
8418       ]])],[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])])
8420         AC_LANG_POP([C++])
8421         LIBS=$save_LIBS
8422     else
8423         AC_MSG_RESULT([internal])
8424         BUILD_TYPE="$BUILD_TYPE MYSQL_CONNECTOR_CPP"
8425         SYSTEM_MYSQL_CONNECTOR_CPP=
8426     fi
8427     AC_LANG_POP([C++])
8429 AC_SUBST(SYSTEM_MYSQL_CONNECTOR_CPP)
8431 dnl ===================================================================
8432 dnl Check for system hsqldb
8433 dnl ===================================================================
8434 if test "$with_java" != "no"; then
8435     HSQLDB_USE_JDBC_4_1=
8436     AC_MSG_CHECKING([which hsqldb to use])
8437     if test "$with_system_hsqldb" = "yes"; then
8438         AC_MSG_RESULT([external])
8439         SYSTEM_HSQLDB=TRUE
8440         if test -z $HSQLDB_JAR; then
8441             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8442         fi
8443         if ! test -f $HSQLDB_JAR; then
8444                AC_MSG_ERROR(hsqldb.jar not found.)
8445         fi
8446         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8447         export HSQLDB_JAR
8448         if $PERL -e \
8449            'use Archive::Zip;
8450             my $file = "$ENV{'HSQLDB_JAR'}";
8451             my $zip = Archive::Zip->new( $file );
8452             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8453             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8454             {
8455                 push @l, split(/\n/, $mf);
8456                 foreach my $line (@l)
8457                 {
8458                     if ($line =~ m/Specification-Version:/)
8459                     {
8460                         ($t, $version) = split (/:/,$line);
8461                         $version =~ s/^\s//;
8462                         ($a, $b, $c, $d) = split (/\./,$version);
8463                         if ($c == "0" && $d > "8")
8464                         {
8465                             exit 0;
8466                         }
8467                         else
8468                         {
8469                             exit 1;
8470                         }
8471                     }
8472                 }
8473             }
8474             else
8475             {
8476                 exit 1;
8477             }'; then
8478             AC_MSG_RESULT([yes])
8479         else
8480             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8481         fi
8482     else
8483         AC_MSG_RESULT([internal])
8484         SYSTEM_HSQLDB=
8485         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8486         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8487         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8488         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8489             AC_MSG_RESULT([yes])
8490             HSQLDB_USE_JDBC_4_1=TRUE
8491         else
8492             AC_MSG_RESULT([no])
8493         fi
8494     fi
8495     AC_SUBST(SYSTEM_HSQLDB)
8496     AC_SUBST(HSQLDB_JAR)
8497     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8500 dnl ===================================================================
8501 dnl Check for PostgreSQL stuff
8502 dnl ===================================================================
8503 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
8504 if test "x$enable_postgresql_sdbc" != "xno"; then
8505     AC_MSG_RESULT([yes])
8506     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8508     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8509         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8510     fi
8511     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8512         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8513     fi
8515     postgres_interface=""
8516     if test "$with_system_postgresql" = "yes"; then
8517         postgres_interface="external PostgreSQL"
8518         SYSTEM_POSTGRESQL=TRUE
8519         if test "$_os" = Darwin; then
8520             supp_path=''
8521             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8522                 pg_supp_path="$P_SEP$d$pg_supp_path"
8523             done
8524         fi
8525         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8526         if test -z "$PGCONFIG"; then
8527             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8528         fi
8529         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8530         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8531         FilterLibs "${POSTGRESQL_LIB}"
8532         POSTGRESQL_LIB="${filteredlibs}"
8533     else
8534         # if/when anything else than PostgreSQL uses Kerberos,
8535         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8536         WITH_KRB5=
8537         WITH_GSSAPI=
8538         case "$_os" in
8539         Darwin)
8540             # MacOS X has system MIT Kerberos 5 since 10.4
8541             if test "$with_krb5" != "no"; then
8542                 WITH_KRB5=TRUE
8543                 save_LIBS=$LIBS
8544                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8545                 # that the libraries where these functions are located on macOS will change, is it?
8546                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8547                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8548                 KRB5_LIBS=$LIBS
8549                 LIBS=$save_LIBS
8550                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8551                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8552                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8553                 LIBS=$save_LIBS
8554             fi
8555             if test "$with_gssapi" != "no"; then
8556                 WITH_GSSAPI=TRUE
8557                 save_LIBS=$LIBS
8558                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8559                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8560                 GSSAPI_LIBS=$LIBS
8561                 LIBS=$save_LIBS
8562             fi
8563             ;;
8564         WINNT)
8565             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8566                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8567             fi
8568             ;;
8569         Linux|GNU|*BSD|DragonFly)
8570             if test "$with_krb5" != "no"; then
8571                 WITH_KRB5=TRUE
8572                 save_LIBS=$LIBS
8573                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8574                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8575                 KRB5_LIBS=$LIBS
8576                 LIBS=$save_LIBS
8577                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8578                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8579                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8580                 LIBS=$save_LIBS
8581             fi
8582             if test "$with_gssapi" != "no"; then
8583                 WITH_GSSAPI=TRUE
8584                 save_LIBS=$LIBS
8585                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8586                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8587                 GSSAPI_LIBS=$LIBS
8588                 LIBS=$save_LIBS
8589             fi
8590             ;;
8591         *)
8592             if test "$with_krb5" = "yes"; then
8593                 WITH_KRB5=TRUE
8594                 save_LIBS=$LIBS
8595                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8596                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8597                 KRB5_LIBS=$LIBS
8598                 LIBS=$save_LIBS
8599                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8600                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8601                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8602                 LIBS=$save_LIBS
8603             fi
8604             if test "$with_gssapi" = "yes"; then
8605                 WITH_GSSAPI=TRUE
8606                 save_LIBS=$LIBS
8607                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8608                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8609                 LIBS=$save_LIBS
8610                 GSSAPI_LIBS=$LIBS
8611             fi
8612         esac
8614         if test -n "$with_libpq_path"; then
8615             SYSTEM_POSTGRESQL=TRUE
8616             postgres_interface="external libpq"
8617             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8618             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8619         else
8620             SYSTEM_POSTGRESQL=
8621             postgres_interface="internal"
8622             POSTGRESQL_LIB=""
8623             POSTGRESQL_INC="%OVERRIDE_ME%"
8624             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8625         fi
8626     fi
8628     AC_MSG_CHECKING([PostgreSQL C interface])
8629     AC_MSG_RESULT([$postgres_interface])
8631     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8632         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8633         save_CFLAGS=$CFLAGS
8634         save_CPPFLAGS=$CPPFLAGS
8635         save_LIBS=$LIBS
8636         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8637         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8638         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8639         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8640             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8641         CFLAGS=$save_CFLAGS
8642         CPPFLAGS=$save_CPPFLAGS
8643         LIBS=$save_LIBS
8644     fi
8645     BUILD_POSTGRESQL_SDBC=TRUE
8646 else
8647     AC_MSG_RESULT([no])
8649 AC_SUBST(WITH_KRB5)
8650 AC_SUBST(WITH_GSSAPI)
8651 AC_SUBST(GSSAPI_LIBS)
8652 AC_SUBST(KRB5_LIBS)
8653 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8654 AC_SUBST(SYSTEM_POSTGRESQL)
8655 AC_SUBST(POSTGRESQL_INC)
8656 AC_SUBST(POSTGRESQL_LIB)
8658 dnl ===================================================================
8659 dnl Check for Firebird stuff
8660 dnl ===================================================================
8661 ENABLE_FIREBIRD_SDBC=
8662 if test "$enable_firebird_sdbc" = "yes" ; then
8663     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8665     dnl ===================================================================
8666     dnl Check for system Firebird
8667     dnl ===================================================================
8668     AC_MSG_CHECKING([which Firebird to use])
8669     if test "$with_system_firebird" = "yes"; then
8670         AC_MSG_RESULT([external])
8671         SYSTEM_FIREBIRD=TRUE
8672         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8673         if test -z "$FIREBIRDCONFIG"; then
8674             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8675             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8676                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8677             ])
8678             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8679         else
8680             AC_MSG_NOTICE([fb_config found])
8681             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8682             AC_MSG_CHECKING([for Firebird Client library])
8683             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8684             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8685             FilterLibs "${FIREBIRD_LIBS}"
8686             FIREBIRD_LIBS="${filteredlibs}"
8687         fi
8688         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8689         AC_MSG_CHECKING([Firebird version])
8690         if test -n "${FIREBIRD_VERSION}"; then
8691             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8692             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8693             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8694                 AC_MSG_RESULT([OK])
8695             else
8696                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
8697             fi
8698         else
8699             __save_CFLAGS="${CFLAGS}"
8700             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8701             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8702 #if defined(FB_API_VER) && FB_API_VER == 30
8703 int fb_api_is_30(void) { return 0; }
8704 #else
8705 #error "Wrong Firebird API version"
8706 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
8707             CFLAGS="${__save_CFLAGS}"
8708         fi
8709         ENABLE_FIREBIRD_SDBC=TRUE
8710         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
8711     elif test "$enable_database_connectivity" != yes; then
8712         AC_MSG_RESULT([none])
8713     elif test "$cross_compiling" = "yes"; then
8714         AC_MSG_RESULT([none])
8715     else
8716         dnl Embedded Firebird has version 3.0
8717         AC_DEFINE(HAVE_FIREBIRD_30, 1)
8718         dnl We need libatomic-ops for any non X86/X64 system
8719         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8720             dnl ===================================================================
8721             dnl Check for system libatomic-ops
8722             dnl ===================================================================
8723             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8724             if test "$with_system_libatomic_ops" = "yes"; then
8725                 SYSTEM_LIBATOMIC_OPS=TRUE
8726                 AC_CHECK_HEADERS(atomic_ops.h, [],
8727                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8728             else
8729                 SYSTEM_LIBATOMIC_OPS=
8730                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8731                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8732                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8733             fi
8734         fi
8736         AC_MSG_RESULT([internal])
8737         SYSTEM_FIREBIRD=
8738         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
8739         FIREBIRD_LIBS="-lfbclient"
8741         if test "$with_system_libtommath" = "yes"; then
8742             SYSTEM_LIBTOMMATH=TRUE
8743             dnl check for tommath presence
8744             save_LIBS=$LIBS
8745             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
8746             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
8747             LIBS=$save_LIBS
8748         else
8749             SYSTEM_LIBTOMMATH=
8750             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
8751             LIBTOMMATH_LIBS="-ltommath"
8752             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
8753         fi
8755         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8756         ENABLE_FIREBIRD_SDBC=TRUE
8757         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
8758     fi
8760 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8761 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8762 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8763 AC_SUBST(LIBATOMIC_OPS_LIBS)
8764 AC_SUBST(SYSTEM_FIREBIRD)
8765 AC_SUBST(FIREBIRD_CFLAGS)
8766 AC_SUBST(FIREBIRD_LIBS)
8767 AC_SUBST([TOMMATH_CFLAGS])
8768 AC_SUBST([TOMMATH_LIBS])
8770 dnl ===================================================================
8771 dnl Check for system curl
8772 dnl ===================================================================
8773 AC_MSG_CHECKING([which libcurl to use])
8774 if test "$with_system_curl" = "auto"; then
8775     with_system_curl="$with_system_libs"
8778 if test "$with_system_curl" = "yes"; then
8779     AC_MSG_RESULT([external])
8780     SYSTEM_CURL=TRUE
8782     # First try PKGCONFIG and then fall back
8783     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8785     if test -n "$CURL_PKG_ERRORS"; then
8786         AC_PATH_PROG(CURLCONFIG, curl-config)
8787         if test -z "$CURLCONFIG"; then
8788             AC_MSG_ERROR([curl development files not found])
8789         fi
8790         CURL_LIBS=`$CURLCONFIG --libs`
8791         FilterLibs "${CURL_LIBS}"
8792         CURL_LIBS="${filteredlibs}"
8793         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8794         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8796         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8797         case $curl_version in
8798         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8799         dnl so they need to be doubled to end up in the configure script
8800         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8801             AC_MSG_RESULT([yes])
8802             ;;
8803         *)
8804             AC_MSG_ERROR([no, you have $curl_version])
8805             ;;
8806         esac
8807     fi
8809     ENABLE_CURL=TRUE
8810 elif test $_os = iOS; then
8811     # Let's see if we need curl, I think not?
8812     AC_MSG_RESULT([none])
8813     ENABLE_CURL=
8814 else
8815     AC_MSG_RESULT([internal])
8816     SYSTEM_CURL=
8817     BUILD_TYPE="$BUILD_TYPE CURL"
8818     ENABLE_CURL=TRUE
8820 AC_SUBST(SYSTEM_CURL)
8821 AC_SUBST(CURL_CFLAGS)
8822 AC_SUBST(CURL_LIBS)
8823 AC_SUBST(ENABLE_CURL)
8825 dnl ===================================================================
8826 dnl Check for system boost
8827 dnl ===================================================================
8828 AC_MSG_CHECKING([which boost to use])
8829 if test "$with_system_boost" = "yes"; then
8830     AC_MSG_RESULT([external])
8831     SYSTEM_BOOST=TRUE
8832     AX_BOOST_BASE(1.47)
8833     AX_BOOST_DATE_TIME
8834     AX_BOOST_FILESYSTEM
8835     AX_BOOST_IOSTREAMS
8836     AX_BOOST_LOCALE
8837     AC_LANG_PUSH([C++])
8838     save_CXXFLAGS=$CXXFLAGS
8839     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8840     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8841        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8842     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8843        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8844     CXXFLAGS=$save_CXXFLAGS
8845     AC_LANG_POP([C++])
8846     # this is in m4/ax_boost_base.m4
8847     FilterLibs "${BOOST_LDFLAGS}"
8848     BOOST_LDFLAGS="${filteredlibs}"
8849 else
8850     AC_MSG_RESULT([internal])
8851     BUILD_TYPE="$BUILD_TYPE BOOST"
8852     SYSTEM_BOOST=
8853     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
8854         # use warning-suppressing wrapper headers
8855         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
8856     else
8857         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
8858     fi
8860 AC_SUBST(SYSTEM_BOOST)
8862 dnl ===================================================================
8863 dnl Check for system mdds
8864 dnl ===================================================================
8865 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.2 >= 1.2.3], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8867 dnl ===================================================================
8868 dnl Check for system glm
8869 dnl ===================================================================
8870 AC_MSG_CHECKING([which glm to use])
8871 if test "$with_system_glm" = "yes"; then
8872     AC_MSG_RESULT([external])
8873     SYSTEM_GLM=TRUE
8874     AC_LANG_PUSH([C++])
8875     AC_CHECK_HEADER([glm/glm.hpp], [],
8876        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8877     AC_LANG_POP([C++])
8878 else
8879     AC_MSG_RESULT([internal])
8880     BUILD_TYPE="$BUILD_TYPE GLM"
8881     SYSTEM_GLM=
8882     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8884 AC_SUBST([GLM_CFLAGS])
8885 AC_SUBST([SYSTEM_GLM])
8887 dnl ===================================================================
8888 dnl Check for system odbc
8889 dnl ===================================================================
8890 AC_MSG_CHECKING([which odbc headers to use])
8891 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
8892     AC_MSG_RESULT([external])
8893     SYSTEM_ODBC_HEADERS=TRUE
8895     if test "$build_os" = "cygwin"; then
8896         save_CPPFLAGS=$CPPFLAGS
8897         find_winsdk
8898         PathFormat "$winsdktest"
8899         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"
8900         AC_CHECK_HEADER(sqlext.h, [],
8901             [AC_MSG_ERROR(odbc not found. install odbc)],
8902             [#include <windows.h>])
8903         CPPFLAGS=$save_CPPFLAGS
8904     else
8905         AC_CHECK_HEADER(sqlext.h, [],
8906             [AC_MSG_ERROR(odbc not found. install odbc)],[])
8907     fi
8908 elif test "$enable_database_connectivity" != yes; then
8909     AC_MSG_RESULT([none])
8910 else
8911     AC_MSG_RESULT([internal])
8912     SYSTEM_ODBC_HEADERS=
8914 AC_SUBST(SYSTEM_ODBC_HEADERS)
8917 dnl ===================================================================
8918 dnl Check for system openldap
8919 dnl ===================================================================
8921 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8922 AC_MSG_CHECKING([which openldap library to use])
8923 if test "$with_system_openldap" = "yes"; then
8924     AC_MSG_RESULT([external])
8925     SYSTEM_OPENLDAP=TRUE
8926     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8927     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8928     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8929 else
8930     AC_MSG_RESULT([internal])
8931     SYSTEM_OPENLDAP=
8932     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8935 AC_SUBST(SYSTEM_OPENLDAP)
8937 dnl ===================================================================
8938 dnl Check for system NSS
8939 dnl ===================================================================
8940 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
8941     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8942     AC_DEFINE(HAVE_FEATURE_NSS)
8943     ENABLE_NSS="TRUE"
8944     AC_DEFINE(ENABLE_NSS)
8945 elif test $_os != iOS ; then
8946     with_tls=openssl
8948 AC_SUBST(ENABLE_NSS)
8950 dnl ===================================================================
8951 dnl Check for TLS/SSL and cryptographic implementation to use
8952 dnl ===================================================================
8953 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8954 if test -n "$with_tls"; then
8955     case $with_tls in
8956     openssl)
8957         AC_DEFINE(USE_TLS_OPENSSL)
8958         TLS=OPENSSL
8960         if test "$enable_openssl" != "yes"; then
8961             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8962         fi
8964         # warn that OpenSSL has been selected but not all TLS code has this option
8965         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
8966         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
8967         ;;
8968     nss)
8969         AC_DEFINE(USE_TLS_NSS)
8970         TLS=NSS
8971         ;;
8972     no)
8973         AC_MSG_WARN([Skipping TLS/SSL])
8974         ;;
8975     *)
8976         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8977 openssl - OpenSSL
8978 nss - Mozilla's Network Security Services (NSS)
8979     ])
8980         ;;
8981     esac
8982 else
8983     # default to using NSS, it results in smaller oox lib
8984     AC_DEFINE(USE_TLS_NSS)
8985     TLS=NSS
8987 AC_MSG_RESULT([$TLS])
8988 AC_SUBST(TLS)
8990 dnl ===================================================================
8991 dnl Check for system sane
8992 dnl ===================================================================
8993 AC_MSG_CHECKING([which sane header to use])
8994 if test "$with_system_sane" = "yes"; then
8995     AC_MSG_RESULT([external])
8996     AC_CHECK_HEADER(sane/sane.h, [],
8997       [AC_MSG_ERROR(sane not found. install sane)], [])
8998 else
8999     AC_MSG_RESULT([internal])
9000     BUILD_TYPE="$BUILD_TYPE SANE"
9003 dnl ===================================================================
9004 dnl Check for system icu
9005 dnl ===================================================================
9006 SYSTEM_GENBRK=
9007 SYSTEM_GENCCODE=
9008 SYSTEM_GENCMN=
9010 ICU_MAJOR=61
9011 ICU_MINOR=1
9012 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9013 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9014 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9015 AC_MSG_CHECKING([which icu to use])
9016 if test "$with_system_icu" = "yes"; then
9017     AC_MSG_RESULT([external])
9018     SYSTEM_ICU=TRUE
9019     AC_LANG_PUSH([C++])
9020     AC_MSG_CHECKING([for unicode/rbbi.h])
9021     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9022     AC_LANG_POP([C++])
9024     if test "$cross_compiling" != "yes"; then
9025         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9026         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9027         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9028         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9029     fi
9031     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9032         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9033         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9034         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9035         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9036         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9037             AC_MSG_RESULT([yes])
9038         else
9039             AC_MSG_RESULT([no])
9040             if test "$with_system_icu_for_build" != "force"; then
9041                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9042 You can use --with-system-icu-for-build=force to use it anyway.])
9043             fi
9044         fi
9045     fi
9047     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9048         # using the system icu tools can lead to version confusion, use the
9049         # ones from the build environment when cross-compiling
9050         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9051         if test -z "$SYSTEM_GENBRK"; then
9052             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9053         fi
9054         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9055         if test -z "$SYSTEM_GENCCODE"; then
9056             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9057         fi
9058         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9059         if test -z "$SYSTEM_GENCMN"; then
9060             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9061         fi
9062         if test "$ICU_MAJOR" -ge "49"; then
9063             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9064             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9065             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9066         else
9067             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9068             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9069             ICU_RECLASSIFIED_HEBREW_LETTER=
9070         fi
9071     fi
9073     if test "$cross_compiling" = "yes"; then
9074         if test "$ICU_MAJOR" -ge "50"; then
9075             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9076             ICU_MINOR=""
9077         fi
9078     fi
9079 else
9080     AC_MSG_RESULT([internal])
9081     SYSTEM_ICU=
9082     BUILD_TYPE="$BUILD_TYPE ICU"
9083     # surprisingly set these only for "internal" (to be used by various other
9084     # external libs): the system icu-config is quite unhelpful and spits out
9085     # dozens of weird flags and also default path -I/usr/include
9086     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9087     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9089 if test "$ICU_MAJOR" -ge "59"; then
9090     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9091     # with -std=c++11 but not all external libraries can be built with that,
9092     # for those use a bit-compatible typedef uint16_t UChar; see
9093     # icu/source/common/unicode/umachine.h
9094     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9095 else
9096     ICU_UCHAR_TYPE=""
9098 AC_SUBST(SYSTEM_ICU)
9099 AC_SUBST(SYSTEM_GENBRK)
9100 AC_SUBST(SYSTEM_GENCCODE)
9101 AC_SUBST(SYSTEM_GENCMN)
9102 AC_SUBST(ICU_MAJOR)
9103 AC_SUBST(ICU_MINOR)
9104 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9105 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9106 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9107 AC_SUBST(ICU_CFLAGS)
9108 AC_SUBST(ICU_LIBS)
9109 AC_SUBST(ICU_UCHAR_TYPE)
9111 dnl ==================================================================
9112 dnl Breakpad
9113 dnl ==================================================================
9114 DEFAULT_CRASHDUMP_VALUE="true"
9115 AC_MSG_CHECKING([whether to enable breakpad])
9116 if test "$enable_breakpad" != yes; then
9117     AC_MSG_RESULT([no])
9118 else
9119     AC_MSG_RESULT([yes])
9120     ENABLE_BREAKPAD="TRUE"
9121     AC_DEFINE(ENABLE_BREAKPAD)
9122     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9123     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9125     AC_MSG_CHECKING([for disable crash dump])
9126     if test "$enable_crashdump" = no; then
9127         DEFAULT_CRASHDUMP_VALUE="false"
9128         AC_MSG_RESULT([yes])
9129     else
9130        AC_MSG_RESULT([no])
9131     fi
9133     AC_MSG_CHECKING([for crashreport config])
9134     if test "$with_symbol_config" = "no"; then
9135         BREAKPAD_SYMBOL_CONFIG="invalid"
9136         AC_MSG_RESULT([no])
9137     else
9138         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9139         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9140         AC_MSG_RESULT([yes])
9141     fi
9142     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9144 AC_SUBST(ENABLE_BREAKPAD)
9145 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
9147 dnl ==================================================================
9148 dnl libfuzzer
9149 dnl ==================================================================
9150 AC_MSG_CHECKING([whether to enable fuzzers])
9151 if test "$enable_fuzzers" != yes; then
9152     AC_MSG_RESULT([no])
9153 else
9154     AC_MSG_RESULT([yes])
9155     ENABLE_FUZZERS="TRUE"
9156     AC_DEFINE(ENABLE_FUZZERS)
9157     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9159 AC_SUBST(ENABLE_FUZZERS)
9161 dnl ===================================================================
9162 dnl Orcus
9163 dnl ===================================================================
9164 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.13 >= 0.13.3])
9165 if test "$with_system_orcus" != "yes"; then
9166     if test "$SYSTEM_BOOST" = "TRUE"; then
9167         # ===========================================================
9168         # Determine if we are going to need to link with Boost.System
9169         # ===========================================================
9170         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9171         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9172         dnl in documentation has no effect.
9173         AC_MSG_CHECKING([if we need to link with Boost.System])
9174         AC_LANG_PUSH([C++])
9175         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9176                 @%:@include <boost/version.hpp>
9177             ]],[[
9178                 #if BOOST_VERSION >= 105000
9179                 #   error yes, we need to link with Boost.System
9180                 #endif
9181             ]])],[
9182                 AC_MSG_RESULT([no])
9183             ],[
9184                 AC_MSG_RESULT([yes])
9185                 AX_BOOST_SYSTEM
9186         ])
9187         AC_LANG_POP([C++])
9188     fi
9190 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9191 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9192 AC_SUBST([BOOST_SYSTEM_LIB])
9193 AC_SUBST(SYSTEM_LIBORCUS)
9195 dnl ===================================================================
9196 dnl HarfBuzz
9197 dnl ===================================================================
9198 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9199                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9200                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9202 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9203                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9204                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9206 if test "$COM" = "MSC"; then # override the above
9207     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9208     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9211 if test "$with_system_harfbuzz" = "yes"; then
9212     if test "$with_system_graphite" = "no"; then
9213         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9214     fi
9215     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9216     _save_libs="$LIBS"
9217     _save_cflags="$CFLAGS"
9218     LIBS="$LIBS $HARFBUZZ_LIBS"
9219     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9220     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9221     LIBS="$_save_libs"
9222     CFLAGS="$_save_cflags"
9223 else
9224     if test "$with_system_graphite" = "yes"; then
9225         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9226     fi
9229 AC_MSG_CHECKING([whether to use X11])
9230 dnl ***************************************
9231 dnl testing for X libraries and includes...
9232 dnl ***************************************
9233 if test "$USING_X11" = TRUE; then
9234     AC_DEFINE(HAVE_FEATURE_X11)
9236 AC_MSG_RESULT([$USING_X11])
9238 if test "$USING_X11" = TRUE; then
9239     AC_PATH_X
9240     AC_PATH_XTRA
9241     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9243     if test -z "$x_includes"; then
9244         x_includes="default_x_includes"
9245     fi
9246     if test -z "$x_libraries"; then
9247         x_libraries="default_x_libraries"
9248     fi
9249     CFLAGS="$CFLAGS $X_CFLAGS"
9250     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9251     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9252 else
9253     x_includes="no_x_includes"
9254     x_libraries="no_x_libraries"
9257 if test "$USING_X11" = TRUE; then
9258     dnl ===================================================================
9259     dnl Check for extension headers
9260     dnl ===================================================================
9261     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9262      [#include <X11/extensions/shape.h>])
9264     # vcl needs ICE and SM
9265     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9266     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9267         [AC_MSG_ERROR(ICE library not found)])
9268     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9269     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9270         [AC_MSG_ERROR(SM library not found)])
9272     # bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c needs Xt
9273     AC_CHECK_HEADERS(X11/Intrinsic.h,[],[AC_MSG_ERROR([libXt headers not found])])
9276 dnl ===================================================================
9277 dnl Check for system Xrender
9278 dnl ===================================================================
9279 AC_MSG_CHECKING([whether to use Xrender])
9280 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9281     AC_MSG_RESULT([yes])
9282     PKG_CHECK_MODULES(XRENDER, xrender)
9283     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9284     FilterLibs "${XRENDER_LIBS}"
9285     XRENDER_LIBS="${filteredlibs}"
9286     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9287       [AC_MSG_ERROR(libXrender not found or functional)], [])
9288     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9289       [AC_MSG_ERROR(Xrender not found. install X)], [])
9290 else
9291     AC_MSG_RESULT([no])
9293 AC_SUBST(XRENDER_CFLAGS)
9294 AC_SUBST(XRENDER_LIBS)
9296 dnl ===================================================================
9297 dnl Check for XRandr
9298 dnl ===================================================================
9299 AC_MSG_CHECKING([whether to enable RandR support])
9300 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9301     AC_MSG_RESULT([yes])
9302     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9303     if test "$ENABLE_RANDR" != "TRUE"; then
9304         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9305                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9306         XRANDR_CFLAGS=" "
9307         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9308           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9309         XRANDR_LIBS="-lXrandr "
9310         ENABLE_RANDR="TRUE"
9311     fi
9312     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9313     FilterLibs "${XRANDR_LIBS}"
9314     XRANDR_LIBS="${filteredlibs}"
9315 else
9316     ENABLE_RANDR=""
9317     AC_MSG_RESULT([no])
9319 AC_SUBST(XRANDR_CFLAGS)
9320 AC_SUBST(XRANDR_LIBS)
9321 AC_SUBST(ENABLE_RANDR)
9323 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9324     WITH_WEBDAV="serf"
9326 if test $_os = iOS -o $_os = Android; then
9327     WITH_WEBDAV="no"
9329 AC_MSG_CHECKING([for webdav library])
9330 case "$WITH_WEBDAV" in
9331 serf)
9332     AC_MSG_RESULT([serf])
9333     # Check for system apr-util
9334     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9335                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9336                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9337     if test "$COM" = "MSC"; then
9338         APR_LIB_DIR="LibR"
9339         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9340         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9341     fi
9343     # Check for system serf
9344     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9345                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9346     if test "$COM" = "MSC"; then
9347         SERF_LIB_DIR="Release"
9348         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9349         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9350     fi
9351     ;;
9352 neon)
9353     AC_MSG_RESULT([neon])
9354     # Check for system neon
9355     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9356     if test "$with_system_neon" = "yes"; then
9357         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9358     else
9359         NEON_VERSION=0295
9360     fi
9361     AC_SUBST(NEON_VERSION)
9362     ;;
9364     AC_MSG_RESULT([none, disabled])
9365     WITH_WEBDAV=""
9366     ;;
9367 esac
9368 AC_SUBST(WITH_WEBDAV)
9370 dnl ===================================================================
9371 dnl Check for disabling cve_tests
9372 dnl ===================================================================
9373 AC_MSG_CHECKING([whether to execute CVE tests])
9374 # If not explicitly enabled or disabled, default
9375 if test -z "$enable_cve_tests"; then
9376     case "$OS" in
9377     WNT)
9378         # Default cves off for windows with its wild and wonderful
9379         # varienty of AV software kicking in and panicking
9380         enable_cve_tests=no
9381         ;;
9382     *)
9383         # otherwise yes
9384         enable_cve_tests=yes
9385         ;;
9386     esac
9388 if test "$enable_cve_tests" = "no"; then
9389     AC_MSG_RESULT([no])
9390     DISABLE_CVE_TESTS=TRUE
9391     AC_SUBST(DISABLE_CVE_TESTS)
9392 else
9393     AC_MSG_RESULT([yes])
9396 dnl ===================================================================
9397 dnl Check for enabling chart XShape tests
9398 dnl ===================================================================
9399 AC_MSG_CHECKING([whether to execute chart XShape tests])
9400 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9401     AC_MSG_RESULT([yes])
9402     ENABLE_CHART_TESTS=TRUE
9403     AC_SUBST(ENABLE_CHART_TESTS)
9404 else
9405     AC_MSG_RESULT([no])
9408 dnl ===================================================================
9409 dnl Check for system openssl
9410 dnl ===================================================================
9411 DISABLE_OPENSSL=
9412 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9413 if test "$enable_openssl" = "yes"; then
9414     AC_MSG_RESULT([no])
9415     if test "$_os" = Darwin ; then
9416         # OpenSSL is deprecated when building for 10.7 or later.
9417         #
9418         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9419         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9421         with_system_openssl=no
9422         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9423     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9424             && test "$with_system_openssl" != "no"; then
9425         with_system_openssl=yes
9426         SYSTEM_OPENSSL=TRUE
9427         OPENSSL_CFLAGS=
9428         OPENSSL_LIBS="-lssl -lcrypto"
9429     else
9430         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9431     fi
9432     if test "$with_system_openssl" = "yes"; then
9433         AC_MSG_CHECKING([whether openssl supports SHA512])
9434         AC_LANG_PUSH([C])
9435         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9436             SHA512_CTX context;
9437 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9438         AC_LANG_POP(C)
9439     fi
9440 else
9441     AC_MSG_RESULT([yes])
9442     DISABLE_OPENSSL=TRUE
9444     # warn that although OpenSSL is disabled, system libraries may depend on it
9445     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9446     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9449 AC_SUBST([DISABLE_OPENSSL])
9451 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
9452     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
9453         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
9454         enable_cipher_openssl_backend=no
9455     else
9456         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
9457     fi
9459 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
9460 ENABLE_CIPHER_OPENSSL_BACKEND=
9461 if test "$enable_cipher_openssl_backend" = yes; then
9462     AC_MSG_RESULT([yes])
9463     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
9464 else
9465     AC_MSG_RESULT([no])
9467 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
9469 dnl ===================================================================
9470 dnl Check for building gnutls
9471 dnl ===================================================================
9472 AC_MSG_CHECKING([whether to use gnutls])
9473 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9474     AC_MSG_RESULT([yes])
9475     AM_PATH_LIBGCRYPT()
9476     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9477         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9478                       available in the system to use as replacement.]]))
9479     FilterLibs "${LIBGCRYPT_LIBS}"
9480     LIBGCRYPT_LIBS="${filteredlibs}"
9481 else
9482     AC_MSG_RESULT([no])
9485 AC_SUBST([LIBGCRYPT_CFLAGS])
9486 AC_SUBST([LIBGCRYPT_LIBS])
9488 dnl ===================================================================
9489 dnl Check for system redland
9490 dnl ===================================================================
9491 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9492 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9493 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9494 if test "$with_system_redland" = "yes"; then
9495     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9496             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9497 else
9498     RAPTOR_MAJOR="0"
9499     RASQAL_MAJOR="3"
9500     REDLAND_MAJOR="0"
9502 AC_SUBST(RAPTOR_MAJOR)
9503 AC_SUBST(RASQAL_MAJOR)
9504 AC_SUBST(REDLAND_MAJOR)
9506 dnl ===================================================================
9507 dnl Check for system hunspell
9508 dnl ===================================================================
9509 AC_MSG_CHECKING([which libhunspell to use])
9510 if test "$with_system_hunspell" = "yes"; then
9511     AC_MSG_RESULT([external])
9512     SYSTEM_HUNSPELL=TRUE
9513     AC_LANG_PUSH([C++])
9514     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9515     if test "$HUNSPELL_PC" != "TRUE"; then
9516         AC_CHECK_HEADER(hunspell.hxx, [],
9517             [
9518             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9519             [AC_MSG_ERROR(hunspell headers not found.)], [])
9520             ], [])
9521         AC_CHECK_LIB([hunspell], [main], [:],
9522            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9523         HUNSPELL_LIBS=-lhunspell
9524     fi
9525     AC_LANG_POP([C++])
9526     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9527     FilterLibs "${HUNSPELL_LIBS}"
9528     HUNSPELL_LIBS="${filteredlibs}"
9529 else
9530     AC_MSG_RESULT([internal])
9531     SYSTEM_HUNSPELL=
9532     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9533     if test "$COM" = "MSC"; then
9534         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9535     else
9536         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.6"
9537     fi
9538     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9540 AC_SUBST(SYSTEM_HUNSPELL)
9541 AC_SUBST(HUNSPELL_CFLAGS)
9542 AC_SUBST(HUNSPELL_LIBS)
9544 dnl ===================================================================
9545 dnl Checking for altlinuxhyph
9546 dnl ===================================================================
9547 AC_MSG_CHECKING([which altlinuxhyph to use])
9548 if test "$with_system_altlinuxhyph" = "yes"; then
9549     AC_MSG_RESULT([external])
9550     SYSTEM_HYPH=TRUE
9551     AC_CHECK_HEADER(hyphen.h, [],
9552        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9553     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9554        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9555        [#include <hyphen.h>])
9556     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9557         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9558     if test -z "$HYPHEN_LIB"; then
9559         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9560            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9561     fi
9562     if test -z "$HYPHEN_LIB"; then
9563         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9564            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9565     fi
9566 else
9567     AC_MSG_RESULT([internal])
9568     SYSTEM_HYPH=
9569     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9570     if test "$COM" = "MSC"; then
9571         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9572     else
9573         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9574     fi
9576 AC_SUBST(SYSTEM_HYPH)
9577 AC_SUBST(HYPHEN_LIB)
9579 dnl ===================================================================
9580 dnl Checking for mythes
9581 dnl ===================================================================
9582 AC_MSG_CHECKING([which mythes to use])
9583 if test "$with_system_mythes" = "yes"; then
9584     AC_MSG_RESULT([external])
9585     SYSTEM_MYTHES=TRUE
9586     AC_LANG_PUSH([C++])
9587     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9588     if test "$MYTHES_PKGCONFIG" = "no"; then
9589         AC_CHECK_HEADER(mythes.hxx, [],
9590             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9591         AC_CHECK_LIB([mythes-1.2], [main], [:],
9592             [ MYTHES_FOUND=no], [])
9593     if test "$MYTHES_FOUND" = "no"; then
9594         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9595                 [ MYTHES_FOUND=no], [])
9596     fi
9597     if test "$MYTHES_FOUND" = "no"; then
9598         AC_MSG_ERROR([mythes library not found!.])
9599     fi
9600     fi
9601     AC_LANG_POP([C++])
9602     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9603     FilterLibs "${MYTHES_LIBS}"
9604     MYTHES_LIBS="${filteredlibs}"
9605 else
9606     AC_MSG_RESULT([internal])
9607     SYSTEM_MYTHES=
9608     BUILD_TYPE="$BUILD_TYPE MYTHES"
9609     if test "$COM" = "MSC"; then
9610         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9611     else
9612         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9613     fi
9615 AC_SUBST(SYSTEM_MYTHES)
9616 AC_SUBST(MYTHES_CFLAGS)
9617 AC_SUBST(MYTHES_LIBS)
9619 dnl ===================================================================
9620 dnl How should we build the linear programming solver ?
9621 dnl ===================================================================
9623 ENABLE_COINMP=
9624 AC_MSG_CHECKING([whether to build with CoinMP])
9625 if test "$enable_coinmp" != "no"; then
9626     ENABLE_COINMP=TRUE
9627     AC_MSG_RESULT([yes])
9628     if test "$with_system_coinmp" = "yes"; then
9629         SYSTEM_COINMP=TRUE
9630         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9631         FilterLibs "${COINMP_LIBS}"
9632         COINMP_LIBS="${filteredlibs}"
9633     else
9634         BUILD_TYPE="$BUILD_TYPE COINMP"
9635     fi
9636 else
9637     AC_MSG_RESULT([no])
9639 AC_SUBST(ENABLE_COINMP)
9640 AC_SUBST(SYSTEM_COINMP)
9641 AC_SUBST(COINMP_CFLAGS)
9642 AC_SUBST(COINMP_LIBS)
9644 ENABLE_LPSOLVE=
9645 AC_MSG_CHECKING([whether to build with lpsolve])
9646 if test "$enable_lpsolve" != "no"; then
9647     ENABLE_LPSOLVE=TRUE
9648     AC_MSG_RESULT([yes])
9649 else
9650     AC_MSG_RESULT([no])
9652 AC_SUBST(ENABLE_LPSOLVE)
9654 if test "$ENABLE_LPSOLVE" = TRUE; then
9655     AC_MSG_CHECKING([which lpsolve to use])
9656     if test "$with_system_lpsolve" = "yes"; then
9657         AC_MSG_RESULT([external])
9658         SYSTEM_LPSOLVE=TRUE
9659         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9660            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9661         save_LIBS=$LIBS
9662         # some systems need this. Like Ubuntu....
9663         AC_CHECK_LIB(m, floor)
9664         AC_CHECK_LIB(dl, dlopen)
9665         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9666             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9667         LIBS=$save_LIBS
9668     else
9669         AC_MSG_RESULT([internal])
9670         SYSTEM_LPSOLVE=
9671         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9672     fi
9674 AC_SUBST(SYSTEM_LPSOLVE)
9676 dnl ===================================================================
9677 dnl Checking for libexttextcat
9678 dnl ===================================================================
9679 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9680 if test "$with_system_libexttextcat" = "yes"; then
9681     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9683 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9685 dnl ===================================================================
9686 dnl Checking for libnumbertext
9687 dnl ===================================================================
9688 AC_MSG_CHECKING([whether to use libnumbertext])
9689 if test "$enable_libnumbertext" = "no"; then
9690     AC_MSG_RESULT([no])
9691     ENABLE_LIBNUMBERTEXT=
9692     SYSTEM_LIBNUMBERTEXT=
9693 else
9694     AC_MSG_RESULT([yes])
9695     ENABLE_LIBNUMBERTEXT=TRUE
9696     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
9697     if test "$with_system_libnumbertext" = "yes"; then
9698         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
9699         SYSTEM_LIBNUMBERTEXT=YES
9700     else
9701         SYSTEM_LIBNUMBERTEXT=
9702         AC_LANG_PUSH([C++])
9703         save_CXXFLAGS=$CXXFLAGS
9704         CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
9705         AC_CHECK_HEADERS([codecvt regex])
9706         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
9707                 [ ENABLE_LIBNUMBERTEXT=''
9708                   LIBNUMBERTEXT_CFLAGS=''
9709                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
9710                                Enable libnumbertext fallback (missing number to number name conversion).])
9711                 ])
9712         CXXFLAGS=$save_CXXFLAGS
9713         AC_LANG_POP([C++])
9714     fi
9715     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
9716         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
9717     fi
9719 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
9720 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
9721 AC_SUBST(ENABLE_LIBNUMBERTEXT)
9722 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
9724 dnl ***************************************
9725 dnl testing libc version for Linux...
9726 dnl ***************************************
9727 if test "$_os" = "Linux"; then
9728     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9729     exec 6>/dev/null # no output
9730     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9731     exec 6>&1 # output on again
9732     if test "$HAVE_LIBC"; then
9733         AC_MSG_RESULT([yes])
9734     else
9735         AC_MSG_ERROR([no, upgrade libc])
9736     fi
9739 dnl =========================================
9740 dnl Check for uuidgen
9741 dnl =========================================
9742 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9743     # presence is already tested above in the WINDOWS_SDK_HOME check
9744     UUIDGEN=uuidgen.exe
9745     AC_SUBST(UUIDGEN)
9746 else
9747     AC_PATH_PROG([UUIDGEN], [uuidgen])
9748     if test -z "$UUIDGEN"; then
9749         AC_MSG_WARN([uuid is needed for building installation sets])
9750     fi
9753 dnl ***************************************
9754 dnl Checking for bison and flex
9755 dnl ***************************************
9756 AC_PATH_PROG(BISON, bison)
9757 if test -z "$BISON"; then
9758     AC_MSG_ERROR([no bison found in \$PATH, install it])
9759 else
9760     AC_MSG_CHECKING([the bison version])
9761     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9762     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9763     # Accept newer than 2.0
9764     if test "$_bison_longver" -lt 2000; then
9765         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9766     fi
9769 AC_PATH_PROG(FLEX, flex)
9770 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9771     FLEX=`cygpath -m $FLEX`
9773 if test -z "$FLEX"; then
9774     AC_MSG_ERROR([no flex found in \$PATH, install it])
9775 else
9776     AC_MSG_CHECKING([the flex version])
9777     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9778     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9779         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9780     fi
9782 AC_SUBST([FLEX])
9783 dnl ***************************************
9784 dnl Checking for patch
9785 dnl ***************************************
9786 AC_PATH_PROG(PATCH, patch)
9787 if test -z "$PATCH"; then
9788     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9791 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9792 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9793     if test -z "$with_gnu_patch"; then
9794         GNUPATCH=$PATCH
9795     else
9796         if test -x "$with_gnu_patch"; then
9797             GNUPATCH=$with_gnu_patch
9798         else
9799             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9800         fi
9801     fi
9803     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9804     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9805         AC_MSG_RESULT([yes])
9806     else
9807         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9808     fi
9809 else
9810     GNUPATCH=$PATCH
9813 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9814     GNUPATCH=`cygpath -m $GNUPATCH`
9817 dnl We also need to check for --with-gnu-cp
9819 if test -z "$with_gnu_cp"; then
9820     # check the place where the good stuff is hidden on Solaris...
9821     if test -x /usr/gnu/bin/cp; then
9822         GNUCP=/usr/gnu/bin/cp
9823     else
9824         AC_PATH_PROGS(GNUCP, gnucp cp)
9825     fi
9826     if test -z $GNUCP; then
9827         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9828     fi
9829 else
9830     if test -x "$with_gnu_cp"; then
9831         GNUCP=$with_gnu_cp
9832     else
9833         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9834     fi
9837 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9838     GNUCP=`cygpath -m $GNUCP`
9841 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9842 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9843     AC_MSG_RESULT([yes])
9844 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9845     AC_MSG_RESULT([yes])
9846 else
9847     case "$build_os" in
9848     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9849         x_GNUCP=[\#]
9850         GNUCP=''
9851         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9852         ;;
9853     *)
9854         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9855         ;;
9856     esac
9859 AC_SUBST(GNUPATCH)
9860 AC_SUBST(GNUCP)
9861 AC_SUBST(x_GNUCP)
9863 dnl ***************************************
9864 dnl testing assembler path
9865 dnl ***************************************
9866 ML_EXE=""
9867 if test "$_os" = "WINNT"; then
9868     if test "$BITNESS_OVERRIDE" = ""; then
9869         assembler=ml.exe
9870         assembler_bin=$CL_DIR
9871     else
9872         assembler=ml64.exe
9873         assembler_bin=$CL_DIR
9874     fi
9876     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9877     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9878         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9879         AC_MSG_RESULT([found])
9880         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9881     else
9882         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9883     fi
9885     PathFormat "$ASM_HOME"
9886     ASM_HOME="$formatted_path"
9887 else
9888     ASM_HOME=""
9891 AC_SUBST(ML_EXE)
9893 dnl ===================================================================
9894 dnl We need zip and unzip
9895 dnl ===================================================================
9896 AC_PATH_PROG(ZIP, zip)
9897 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9898 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9899     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],,)
9902 AC_PATH_PROG(UNZIP, unzip)
9903 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9905 dnl ===================================================================
9906 dnl Zip must be a specific type for different build types.
9907 dnl ===================================================================
9908 if test $build_os = cygwin; then
9909     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9910         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9911     fi
9914 dnl ===================================================================
9915 dnl We need touch with -h option support.
9916 dnl ===================================================================
9917 AC_PATH_PROG(TOUCH, touch)
9918 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
9919 touch warn
9920 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
9921     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],,)
9924 dnl ===================================================================
9925 dnl Check for system epoxy
9926 dnl ===================================================================
9927 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
9929 dnl ===================================================================
9930 dnl Set vcl option: coordinate device in double or sal_Int32
9931 dnl ===================================================================
9933 dnl disabled for now, we don't want subtle differences between OSs
9934 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
9935 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
9936 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
9937 dnl     AC_MSG_RESULT([double])
9938 dnl else
9939 dnl     AC_MSG_RESULT([sal_Int32])
9940 dnl fi
9942 dnl ===================================================================
9943 dnl Test which vclplugs have to be built.
9944 dnl ===================================================================
9945 R=""
9946 if test "$USING_X11" != TRUE; then
9947     enable_gtk=no
9948     enable_gtk3=no
9950 GTK3_CFLAGS=""
9951 GTK3_LIBS=""
9952 ENABLE_GTK3=""
9953 if test "x$enable_gtk3" = "xyes"; then
9954     if test "$with_system_cairo" = no; then
9955         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
9956     fi
9957     : ${with_system_cairo:=yes}
9958     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="")
9959     if test "x$ENABLE_GTK3" = "xTRUE"; then
9960         R="gtk3"
9961         GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
9962     else
9963         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
9964     fi
9965     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9966     FilterLibs "${GTK3_LIBS}"
9967     GTK3_LIBS="${filteredlibs}"
9969     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
9970     if test "$with_system_epoxy" != "yes"; then
9971         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
9972         AC_CHECK_HEADER(EGL/eglplatform.h, [],
9973                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
9974     fi
9976 AC_SUBST(GTK3_LIBS)
9977 AC_SUBST(GTK3_CFLAGS)
9978 AC_SUBST(ENABLE_GTK3)
9980 ENABLE_GTK=""
9981 if test "x$enable_gtk" = "xyes"; then
9982     if test "$with_system_cairo" = no; then
9983         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
9984     fi
9985     : ${with_system_cairo:=yes}
9986     ENABLE_GTK="TRUE"
9987     AC_DEFINE(ENABLE_GTK)
9988     R="gtk $R"
9990 AC_SUBST(ENABLE_GTK)
9992 ENABLE_KDE4=""
9993 if test "x$enable_kde4" = "xyes"; then
9994     ENABLE_KDE4="TRUE"
9995     AC_DEFINE(ENABLE_KDE4)
9996     R="$R kde4"
9998 AC_SUBST(ENABLE_KDE4)
10000 ENABLE_QT5=""
10001 if test "x$enable_qt5" = "xyes"; then
10002     ENABLE_QT5="TRUE"
10003     AC_DEFINE(ENABLE_QT5)
10004     R="$R qt5"
10006 AC_SUBST(ENABLE_QT5)
10008 ENABLE_KDE5=""
10009 if test "x$enable_kde5" = "xyes"; then
10010     ENABLE_KDE5="TRUE"
10011     AC_DEFINE(ENABLE_KDE5)
10012     R="$R kde5"
10014 AC_SUBST(ENABLE_KDE5)
10016 ENABLE_GTK3_KDE5=""
10017 if test "x$enable_gtk3_kde5" = "xyes"; then
10018     ENABLE_GTK3_KDE5="TRUE"
10019     AC_DEFINE(ENABLE_GTK3_KDE5)
10020     R="$R gtk3_kde5"
10022 AC_SUBST(ENABLE_GTK3_KDE5)
10024 build_vcl_plugins="$R"
10025 if test -z "$build_vcl_plugins"; then
10026     build_vcl_plugins="none"
10028 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10030 dnl ===================================================================
10031 dnl check for dbus support
10032 dnl ===================================================================
10033 ENABLE_DBUS=""
10034 DBUS_CFLAGS=""
10035 DBUS_LIBS=""
10037 if test "$enable_dbus" = "no"; then
10038     test_dbus=no
10041 AC_MSG_CHECKING([whether to enable DBUS support])
10042 if test "$test_dbus" = "yes"; then
10043     ENABLE_DBUS="TRUE"
10044     AC_MSG_RESULT([yes])
10045     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
10046     AC_DEFINE(ENABLE_DBUS)
10047     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10048     FilterLibs "${DBUS_LIBS}"
10049     DBUS_LIBS="${filteredlibs}"
10050 else
10051     AC_MSG_RESULT([no])
10054 AC_SUBST(ENABLE_DBUS)
10055 AC_SUBST(DBUS_CFLAGS)
10056 AC_SUBST(DBUS_LIBS)
10058 AC_MSG_CHECKING([whether to enable Impress remote control])
10059 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10060     AC_MSG_RESULT([yes])
10061     ENABLE_SDREMOTE=TRUE
10062     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10064     # If not explicitly enabled or disabled, default
10065     if test -z "$enable_sdremote_bluetooth"; then
10066         case "$OS" in
10067         LINUX|MACOSX|WNT)
10068             # Default to yes for these
10069             enable_sdremote_bluetooth=yes
10070             ;;
10071         *)
10072             # otherwise no
10073             enable_sdremote_bluetooth=no
10074             ;;
10075         esac
10076     fi
10077     # $enable_sdremote_bluetooth is guaranteed non-empty now
10079     if test "$enable_sdremote_bluetooth" != "no"; then
10080         if test "$OS" = "LINUX"; then
10081             if test "$ENABLE_DBUS" = "TRUE"; then
10082                 AC_MSG_RESULT([yes])
10083                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10084                 dnl ===================================================================
10085                 dnl Check for system bluez
10086                 dnl ===================================================================
10087                 AC_MSG_CHECKING([which Bluetooth header to use])
10088                 if test "$with_system_bluez" = "yes"; then
10089                     AC_MSG_RESULT([external])
10090                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10091                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10092                     SYSTEM_BLUEZ=TRUE
10093                 else
10094                     AC_MSG_RESULT([internal])
10095                     SYSTEM_BLUEZ=
10096                 fi
10097             else
10098                 AC_MSG_RESULT([no, dbus disabled])
10099                 ENABLE_SDREMOTE_BLUETOOTH=
10100                 SYSTEM_BLUEZ=
10101             fi
10102         else
10103             AC_MSG_RESULT([yes])
10104             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10105             SYSTEM_BLUEZ=
10106         fi
10107     else
10108         AC_MSG_RESULT([no])
10109         ENABLE_SDREMOTE_BLUETOOTH=
10110         SYSTEM_BLUEZ=
10111     fi
10112 else
10113     ENABLE_SDREMOTE=
10114     SYSTEM_BLUEZ=
10115     AC_MSG_RESULT([no])
10117 AC_SUBST(ENABLE_SDREMOTE)
10118 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10119 AC_SUBST(SYSTEM_BLUEZ)
10121 dnl ===================================================================
10122 dnl Check whether the gtk 2.0 libraries are available.
10123 dnl ===================================================================
10125 GTK_CFLAGS=""
10126 GTK_LIBS=""
10127 if test  "$test_gtk" = "yes"; then
10129     if test "$ENABLE_GTK" = "TRUE"; then
10130         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]))
10131         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10132         FilterLibs "${GTK_LIBS}"
10133         GTK_LIBS="${filteredlibs}"
10134         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]))
10135         BUILD_TYPE="$BUILD_TYPE GTK"
10136         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10137         FilterLibs "${GTHREAD_LIBS}"
10138         GTHREAD_LIBS="${filteredlibs}"
10140         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10141         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10142                           [ENABLE_GTK_PRINT="TRUE"],
10143                           [ENABLE_GTK_PRINT=""])
10144         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10145         FilterLibs "${GTK_PRINT_LIBS}"
10146         GTK_PRINT_LIBS="${filteredlibs}"
10147     fi
10149     if test "$ENABLE_GTK" = "TRUE" || test "$ENABLE_GTK3" = "TRUE"; then
10150         AC_MSG_CHECKING([whether to enable GIO support])
10151         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10152             dnl Need at least 2.26 for the dbus support.
10153             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10154                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10155             if test "$ENABLE_GIO" = "TRUE"; then
10156                 AC_DEFINE(ENABLE_GIO)
10157                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10158                 FilterLibs "${GIO_LIBS}"
10159                 GIO_LIBS="${filteredlibs}"
10160             fi
10161         else
10162             AC_MSG_RESULT([no])
10163         fi
10164     fi
10166 AC_SUBST(ENABLE_GIO)
10167 AC_SUBST(GIO_CFLAGS)
10168 AC_SUBST(GIO_LIBS)
10169 AC_SUBST(GTK_CFLAGS)
10170 AC_SUBST(GTK_LIBS)
10171 AC_SUBST(GTHREAD_CFLAGS)
10172 AC_SUBST(GTHREAD_LIBS)
10173 AC_SUBST([ENABLE_GTK_PRINT])
10174 AC_SUBST([GTK_PRINT_CFLAGS])
10175 AC_SUBST([GTK_PRINT_LIBS])
10178 dnl ===================================================================
10180 SPLIT_APP_MODULES=""
10181 if test "$enable_split_app_modules" = "yes"; then
10182     SPLIT_APP_MODULES="TRUE"
10184 AC_SUBST(SPLIT_APP_MODULES)
10186 SPLIT_OPT_FEATURES=""
10187 if test "$enable_split_opt_features" = "yes"; then
10188     SPLIT_OPT_FEATURES="TRUE"
10190 AC_SUBST(SPLIT_OPT_FEATURES)
10192 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10193     if test "$enable_cairo_canvas" = yes; then
10194         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10195     fi
10196     enable_cairo_canvas=no
10197 elif test -z "$enable_cairo_canvas"; then
10198     enable_cairo_canvas=yes
10201 ENABLE_CAIRO_CANVAS=""
10202 if test "$enable_cairo_canvas" = "yes"; then
10203     test_cairo=yes
10204     ENABLE_CAIRO_CANVAS="TRUE"
10205     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10207 AC_SUBST(ENABLE_CAIRO_CANVAS)
10209 dnl ===================================================================
10210 dnl Check whether the GStreamer libraries are available.
10211 dnl It's possible to build avmedia with both GStreamer backends!
10212 dnl ===================================================================
10214 ENABLE_GSTREAMER_1_0=""
10216 if test "$build_gstreamer_1_0" = "yes"; then
10218     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10219     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10220         ENABLE_GSTREAMER_1_0="TRUE"
10221         AC_MSG_RESULT([yes])
10222         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10223         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10224         FilterLibs "${GSTREAMER_1_0_LIBS}"
10225         GSTREAMER_1_0_LIBS="${filteredlibs}"
10226     else
10227         AC_MSG_RESULT([no])
10228     fi
10230 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10231 AC_SUBST(GSTREAMER_1_0_LIBS)
10232 AC_SUBST(ENABLE_GSTREAMER_1_0)
10235 ENABLE_GSTREAMER_0_10=""
10236 if test "$build_gstreamer_0_10" = "yes"; then
10238     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10239     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10240         ENABLE_GSTREAMER_0_10="TRUE"
10241         AC_MSG_RESULT([yes])
10242         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10243             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10244         ])
10245         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10246         FilterLibs "${GSTREAMER_0_10_LIBS}"
10247         GSTREAMER_0_10_LIBS="${filteredlibs}"
10248     else
10249         AC_MSG_RESULT([no])
10250     fi
10253 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10254 AC_SUBST(GSTREAMER_0_10_LIBS)
10255 AC_SUBST(ENABLE_GSTREAMER_0_10)
10257 dnl ===================================================================
10258 dnl Check whether to build the VLC avmedia backend
10259 dnl ===================================================================
10261 ENABLE_VLC=""
10263 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10264 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10265     ENABLE_VLC="TRUE"
10266     AC_MSG_RESULT([yes])
10267 else
10268     AC_MSG_RESULT([no])
10270 AC_SUBST(ENABLE_VLC)
10272 ENABLE_OPENGL_TRANSITIONS=
10273 ENABLE_OPENGL_CANVAS=
10274 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10275    : # disable
10276 elif test "$_os" = "Darwin"; then
10277     # We use frameworks on Mac OS X, no need for detail checks
10278     ENABLE_OPENGL_TRANSITIONS=TRUE
10279     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10280     ENABLE_OPENGL_CANVAS=TRUE
10281 elif test $_os = WINNT; then
10282     ENABLE_OPENGL_TRANSITIONS=TRUE
10283     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10284     ENABLE_OPENGL_CANVAS=TRUE
10285 else
10286     if test "$USING_X11" = TRUE; then
10287         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10288         ENABLE_OPENGL_TRANSITIONS=TRUE
10289         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10290         ENABLE_OPENGL_CANVAS=TRUE
10291     fi
10294 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10295 AC_SUBST(ENABLE_OPENGL_CANVAS)
10297 dnl =================================================
10298 dnl Check whether to build with OpenCL support.
10299 dnl =================================================
10301 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10302     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10303     # platform (optional at run-time, used through clew).
10304     BUILD_TYPE="$BUILD_TYPE OPENCL"
10305     AC_DEFINE(HAVE_FEATURE_OPENCL)
10308 dnl =================================================
10309 dnl Check whether to build with dconf support.
10310 dnl =================================================
10312 if test "$enable_dconf" != no; then
10313     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10314         if test "$enable_dconf" = yes; then
10315             AC_MSG_ERROR([dconf not found])
10316         else
10317             enable_dconf=no
10318         fi])
10320 AC_MSG_CHECKING([whether to enable dconf])
10321 if test "$enable_dconf" = no; then
10322     DCONF_CFLAGS=
10323     DCONF_LIBS=
10324     ENABLE_DCONF=
10325     AC_MSG_RESULT([no])
10326 else
10327     ENABLE_DCONF=TRUE
10328     AC_DEFINE(ENABLE_DCONF)
10329     AC_MSG_RESULT([yes])
10331 AC_SUBST([DCONF_CFLAGS])
10332 AC_SUBST([DCONF_LIBS])
10333 AC_SUBST([ENABLE_DCONF])
10335 # pdf import?
10336 AC_MSG_CHECKING([whether to build the PDF import feature])
10337 ENABLE_PDFIMPORT=
10338 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10339     AC_MSG_RESULT([yes])
10340     ENABLE_PDFIMPORT=TRUE
10341     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10343     dnl ===================================================================
10344     dnl Check for system poppler
10345     dnl ===================================================================
10346     AC_MSG_CHECKING([which PDF import backend to use])
10347     if test "$with_system_poppler" = "yes"; then
10348         AC_MSG_RESULT([external])
10349         SYSTEM_POPPLER=TRUE
10350         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10351         AC_LANG_PUSH([C++])
10352         save_CXXFLAGS=$CXXFLAGS
10353         save_CPPFLAGS=$CPPFLAGS
10354         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10355         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10356         AC_CHECK_HEADER([cpp/poppler-version.h],
10357             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10358             [])
10359         CXXFLAGS=$save_CXXFLAGS
10360         CPPFLAGS=$save_CPPFLAGS
10361         AC_LANG_POP([C++])
10362         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10364         FilterLibs "${POPPLER_LIBS}"
10365         POPPLER_LIBS="${filteredlibs}"
10366     else
10367         AC_MSG_RESULT([internal])
10368         SYSTEM_POPPLER=
10369         BUILD_TYPE="$BUILD_TYPE POPPLER"
10370         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10371     fi
10372     AC_DEFINE([ENABLE_PDFIMPORT],1)
10373 else
10374     AC_MSG_RESULT([no])
10376 AC_SUBST(ENABLE_PDFIMPORT)
10377 AC_SUBST(SYSTEM_POPPLER)
10378 AC_SUBST(POPPLER_CFLAGS)
10379 AC_SUBST(POPPLER_LIBS)
10381 # pdf import?
10382 AC_MSG_CHECKING([whether to build PDFium])
10383 ENABLE_PDFIUM=
10384 if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then
10385     AC_MSG_RESULT([yes])
10386     ENABLE_PDFIUM=TRUE
10387     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10388     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10389 else
10390     AC_MSG_RESULT([no])
10392 AC_SUBST(ENABLE_PDFIUM)
10394 SYSTEM_GPGMEPP=
10396 if test "$build_for_ios" = "YES"; then
10397     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10398     AC_MSG_RESULT([yes])
10399 elif test "$enable_mpl_subset" = "yes"; then
10400     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10401     AC_MSG_RESULT([yes])
10402 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10403     dnl ===================================================================
10404     dnl Check for system gpgme
10405     dnl ===================================================================
10406     AC_MSG_CHECKING([which gpgmepp to use])
10407     if test "$with_system_gpgmepp" = "yes"; then
10408         AC_MSG_RESULT([external])
10409         SYSTEM_GPGMEPP=TRUE
10411         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10412         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10413             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10414         # progress_callback is the only func with plain C linkage
10415         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10416         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10417             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10418         AC_CHECK_HEADER(gpgme.h, [],
10419             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10420     else
10421         AC_MSG_RESULT([internal])
10422         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10423         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10425         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10426         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10427         if test "$_os" != "WINNT"; then
10428             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10429             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10430         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10431             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10432         fi
10433     fi
10434     ENABLE_GPGMEPP=TRUE
10435     AC_DEFINE([HAVE_FEATURE_GPGME])
10436     AC_PATH_PROG(GPG, gpg)
10437     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10438     # so let's exclude that manually for the moment
10439     if test -n "$GPG" -a "$_os" != "WINNT"; then
10440         # make sure we not only have a working gpgme, but a full working
10441         # gpg installation to run OpenPGP signature verification
10442         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10443     fi
10444     if test "$_os" = "Linux"; then
10445       uid=`id -u`
10446       AC_MSG_CHECKING([for /run/user/$uid])
10447       if test -d /run/user/$uid; then
10448         AC_MSG_RESULT([yes])
10449         AC_PATH_PROG(GPGCONF, gpgconf)
10450         AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10451         if $GPGCONF --dump-options > /dev/null ; then
10452           if $GPGCONF --dump-options | grep -q create-socketdir ; then
10453             AC_MSG_RESULT([yes])
10454             AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10455           else
10456             AC_MSG_RESULT([no])
10457           fi
10458         else
10459           AC_MSG_RESULT([no. missing or broken gpgconf?])
10460         fi
10461       else
10462         AC_MSG_RESULT([no])
10463      fi
10464    fi
10466 AC_SUBST(ENABLE_GPGMEPP)
10467 AC_SUBST(SYSTEM_GPGMEPP)
10468 AC_SUBST(GPG_ERROR_CFLAGS)
10469 AC_SUBST(GPG_ERROR_LIBS)
10470 AC_SUBST(LIBASSUAN_CFLAGS)
10471 AC_SUBST(LIBASSUAN_LIBS)
10472 AC_SUBST(GPGMEPP_CFLAGS)
10473 AC_SUBST(GPGMEPP_LIBS)
10474 AC_SUBST(GPGCONF)
10475 AC_SUBST(HAVE_GPGCONF_SOCKETDIR)
10477 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10478 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10479     AC_MSG_RESULT([yes])
10480     ENABLE_MEDIAWIKI=TRUE
10481     BUILD_TYPE="$BUILD_TYPE XSLTML"
10482     if test  "x$with_java" = "xno"; then
10483         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10484     fi
10485 else
10486     AC_MSG_RESULT([no])
10487     ENABLE_MEDIAWIKI=
10488     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10490 AC_SUBST(ENABLE_MEDIAWIKI)
10492 AC_MSG_CHECKING([whether to build the Report Builder])
10493 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10494     AC_MSG_RESULT([yes])
10495     ENABLE_REPORTBUILDER=TRUE
10496     AC_MSG_CHECKING([which jfreereport libs to use])
10497     if test "$with_system_jfreereport" = "yes"; then
10498         SYSTEM_JFREEREPORT=TRUE
10499         AC_MSG_RESULT([external])
10500         if test -z $SAC_JAR; then
10501             SAC_JAR=/usr/share/java/sac.jar
10502         fi
10503         if ! test -f $SAC_JAR; then
10504              AC_MSG_ERROR(sac.jar not found.)
10505         fi
10507         if test -z $LIBXML_JAR; then
10508             if test -f /usr/share/java/libxml-1.0.0.jar; then
10509                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10510             elif test -f /usr/share/java/libxml.jar; then
10511                 LIBXML_JAR=/usr/share/java/libxml.jar
10512             else
10513                 AC_MSG_ERROR(libxml.jar replacement not found.)
10514             fi
10515         elif ! test -f $LIBXML_JAR; then
10516             AC_MSG_ERROR(libxml.jar not found.)
10517         fi
10519         if test -z $FLUTE_JAR; then
10520             if test -f/usr/share/java/flute-1.3.0.jar; then
10521                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10522             elif test -f /usr/share/java/flute.jar; then
10523                 FLUTE_JAR=/usr/share/java/flute.jar
10524             else
10525                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10526             fi
10527         elif ! test -f $FLUTE_JAR; then
10528             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10529         fi
10531         if test -z $JFREEREPORT_JAR; then
10532             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10533                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10534             elif test -f /usr/share/java/flow-engine.jar; then
10535                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10536             else
10537                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10538             fi
10539         elif ! test -f  $JFREEREPORT_JAR; then
10540                 AC_MSG_ERROR(jfreereport.jar not found.)
10541         fi
10543         if test -z $LIBLAYOUT_JAR; then
10544             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10545                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10546             elif test -f /usr/share/java/liblayout.jar; then
10547                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10548             else
10549                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10550             fi
10551         elif ! test -f $LIBLAYOUT_JAR; then
10552                 AC_MSG_ERROR(liblayout.jar not found.)
10553         fi
10555         if test -z $LIBLOADER_JAR; then
10556             if test -f /usr/share/java/libloader-1.0.0.jar; then
10557                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10558             elif test -f /usr/share/java/libloader.jar; then
10559                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10560             else
10561                 AC_MSG_ERROR(libloader.jar replacement not found.)
10562             fi
10563         elif ! test -f  $LIBLOADER_JAR; then
10564             AC_MSG_ERROR(libloader.jar not found.)
10565         fi
10567         if test -z $LIBFORMULA_JAR; then
10568             if test -f /usr/share/java/libformula-0.2.0.jar; then
10569                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10570             elif test -f /usr/share/java/libformula.jar; then
10571                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10572             else
10573                 AC_MSG_ERROR(libformula.jar replacement not found.)
10574             fi
10575         elif ! test -f $LIBFORMULA_JAR; then
10576                 AC_MSG_ERROR(libformula.jar not found.)
10577         fi
10579         if test -z $LIBREPOSITORY_JAR; then
10580             if test -f /usr/share/java/librepository-1.0.0.jar; then
10581                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10582             elif test -f /usr/share/java/librepository.jar; then
10583                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10584             else
10585                 AC_MSG_ERROR(librepository.jar replacement not found.)
10586             fi
10587         elif ! test -f $LIBREPOSITORY_JAR; then
10588             AC_MSG_ERROR(librepository.jar not found.)
10589         fi
10591         if test -z $LIBFONTS_JAR; then
10592             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10593                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10594             elif test -f /usr/share/java/libfonts.jar; then
10595                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10596             else
10597                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10598             fi
10599         elif ! test -f $LIBFONTS_JAR; then
10600                 AC_MSG_ERROR(libfonts.jar not found.)
10601         fi
10603         if test -z $LIBSERIALIZER_JAR; then
10604             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10605                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10606             elif test -f /usr/share/java/libserializer.jar; then
10607                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10608             else
10609                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10610             fi
10611         elif ! test -f $LIBSERIALIZER_JAR; then
10612                 AC_MSG_ERROR(libserializer.jar not found.)
10613         fi
10615         if test -z $LIBBASE_JAR; then
10616             if test -f /usr/share/java/libbase-1.0.0.jar; then
10617                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10618             elif test -f /usr/share/java/libbase.jar; then
10619                 LIBBASE_JAR=/usr/share/java/libbase.jar
10620             else
10621                 AC_MSG_ERROR(libbase.jar replacement not found.)
10622             fi
10623         elif ! test -f $LIBBASE_JAR; then
10624             AC_MSG_ERROR(libbase.jar not found.)
10625         fi
10627     else
10628         AC_MSG_RESULT([internal])
10629         SYSTEM_JFREEREPORT=
10630         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10631     fi
10632 else
10633     AC_MSG_RESULT([no])
10634     ENABLE_REPORTBUILDER=
10635     SYSTEM_JFREEREPORT=
10637 AC_SUBST(ENABLE_REPORTBUILDER)
10638 AC_SUBST(SYSTEM_JFREEREPORT)
10639 AC_SUBST(SAC_JAR)
10640 AC_SUBST(LIBXML_JAR)
10641 AC_SUBST(FLUTE_JAR)
10642 AC_SUBST(JFREEREPORT_JAR)
10643 AC_SUBST(LIBBASE_JAR)
10644 AC_SUBST(LIBLAYOUT_JAR)
10645 AC_SUBST(LIBLOADER_JAR)
10646 AC_SUBST(LIBFORMULA_JAR)
10647 AC_SUBST(LIBREPOSITORY_JAR)
10648 AC_SUBST(LIBFONTS_JAR)
10649 AC_SUBST(LIBSERIALIZER_JAR)
10651 # scripting provider for BeanShell?
10652 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10653 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10654     AC_MSG_RESULT([yes])
10655     ENABLE_SCRIPTING_BEANSHELL=TRUE
10657     dnl ===================================================================
10658     dnl Check for system beanshell
10659     dnl ===================================================================
10660     AC_MSG_CHECKING([which beanshell to use])
10661     if test "$with_system_beanshell" = "yes"; then
10662         AC_MSG_RESULT([external])
10663         SYSTEM_BSH=TRUE
10664         if test -z $BSH_JAR; then
10665             BSH_JAR=/usr/share/java/bsh.jar
10666         fi
10667         if ! test -f $BSH_JAR; then
10668             AC_MSG_ERROR(bsh.jar not found.)
10669         fi
10670     else
10671         AC_MSG_RESULT([internal])
10672         SYSTEM_BSH=
10673         BUILD_TYPE="$BUILD_TYPE BSH"
10674     fi
10675 else
10676     AC_MSG_RESULT([no])
10677     ENABLE_SCRIPTING_BEANSHELL=
10678     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10680 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10681 AC_SUBST(SYSTEM_BSH)
10682 AC_SUBST(BSH_JAR)
10684 # scripting provider for JavaScript?
10685 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10686 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10687     AC_MSG_RESULT([yes])
10688     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10690     dnl ===================================================================
10691     dnl Check for system rhino
10692     dnl ===================================================================
10693     AC_MSG_CHECKING([which rhino to use])
10694     if test "$with_system_rhino" = "yes"; then
10695         AC_MSG_RESULT([external])
10696         SYSTEM_RHINO=TRUE
10697         if test -z $RHINO_JAR; then
10698             RHINO_JAR=/usr/share/java/js.jar
10699         fi
10700         if ! test -f $RHINO_JAR; then
10701             AC_MSG_ERROR(js.jar not found.)
10702         fi
10703     else
10704         AC_MSG_RESULT([internal])
10705         SYSTEM_RHINO=
10706         BUILD_TYPE="$BUILD_TYPE RHINO"
10707     fi
10708 else
10709     AC_MSG_RESULT([no])
10710     ENABLE_SCRIPTING_JAVASCRIPT=
10711     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10713 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10714 AC_SUBST(SYSTEM_RHINO)
10715 AC_SUBST(RHINO_JAR)
10717 # This is only used in KDE3/KDE4 checks to determine if /usr/lib64
10718 # paths should be added to library search path. So lets put all 64-bit
10719 # platforms there.
10720 supports_multilib=
10721 case "$host_cpu" in
10722 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
10723     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10724         supports_multilib="yes"
10725     fi
10726     ;;
10728     ;;
10729 esac
10731 dnl ===================================================================
10732 dnl KDE4 Integration
10733 dnl ===================================================================
10735 KDE4_CFLAGS=""
10736 KDE4_LIBS=""
10737 QMAKE4="qmake"
10738 MOC4="moc"
10739 KDE4_GLIB_CFLAGS=""
10740 KDE4_GLIB_LIBS=""
10741 KDE4_HAVE_GLIB=""
10742 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
10743     qt4_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
10744     qt4_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
10746     kde4_incdirs="/usr/include /usr/include/kde4 $x_includes"
10747     kde4_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
10749     if test -n "$supports_multilib"; then
10750         qt4_libdirs="/usr/lib64/qt4 /usr/lib64/qt /usr/lib64 $qt4_libdirs"
10751         kde4_libdirs="/usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel $kde4_libdirs"
10752     fi
10754     if test -n "$QTDIR"; then
10755         qt4_incdirs="$QTDIR/include $qt4_incdirs"
10756         if test -z "$supports_multilib"; then
10757             qt4_libdirs="$QTDIR/lib $qt4_libdirs"
10758         else
10759             qt4_libdirs="$QTDIR/lib64 $QTDIR/lib $qt4_libdirs"
10760         fi
10761     fi
10762     if test -n "$QT4DIR"; then
10763         qt4_incdirs="$QT4DIR/include $qt4_incdirs"
10764         if test -z "$supports_multilib"; then
10765             qt4_libdirs="$QT4DIR/lib $qt4_libdirs"
10766         else
10767             qt4_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt4_libdirs"
10768         fi
10769     fi
10771     if test -n "$KDEDIR"; then
10772         kde4_incdirs="$KDEDIR/include $kde4_incdirs"
10773         if test -z "$supports_multilib"; then
10774             kde4_libdirs="$KDEDIR/lib $kde4_libdirs"
10775         else
10776             kde4_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde4_libdirs"
10777         fi
10778     fi
10779     if test -n "$KDE4DIR"; then
10780         kde4_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde4_incdirs"
10781         if test -z "$supports_multilib"; then
10782             kde4_libdirs="$KDE4DIR/lib $kde4_libdirs"
10783         else
10784             kde4_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde4_libdirs"
10785         fi
10786     fi
10788     qt4_test_include="Qt/qobject.h"
10789     qt4_test_library="libQtNetwork.so"
10790     kde4_test_include="kwindowsystem.h"
10791     kde4_test_library="libsolid.so"
10793     AC_MSG_CHECKING([for Qt4 headers])
10794     qt4_header_dir="no"
10795     for inc_dir in $qt4_incdirs; do
10796         if test -r "$inc_dir/$qt4_test_include"; then
10797             qt4_header_dir="$inc_dir"
10798             break
10799         fi
10800     done
10802     AC_MSG_RESULT([$qt4_header_dir])
10803     if test "x$qt4_header_dir" = "xno"; then
10804         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10805     fi
10807     dnl Check for qmake
10808     AC_PATH_PROGS( QMAKE4, [qmake-qt4 qmake], no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
10809     if test "$QMAKE4" = "no"; then
10810         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10811     else
10812         qmake4_test_ver="`$QMAKE4 -v 2>&1 | sed -n -e '/^Using Qt version 4\./p'`"
10813         if test -z "$qmake4_test_ver"; then
10814             AC_MSG_ERROR([Wrong qmake for Qt4 found. Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
10815         fi
10816     fi
10818     qt4_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt4_libdirs"
10819     AC_MSG_CHECKING([for Qt4 libraries])
10820     qt4_lib_dir="no"
10821     for lib_dir in $qt4_libdirs; do
10822         if test -r "$lib_dir/$qt4_test_library"; then
10823             qt4_lib_dir="$lib_dir"
10824             PKG_CONFIG_PATH="$qt4_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
10825             break
10826         fi
10827     done
10829     AC_MSG_RESULT([$qt4_lib_dir])
10831     if test "x$qt4_lib_dir" = "xno"; then
10832         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10833     fi
10835     dnl Check for Meta Object Compiler
10837     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10838     MOC4="$MOCQT4"
10839     if test "$MOC4" = "no"; then
10840         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10841         if test "$MOC4" = "no"; then
10842             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10843 the root of your Qt installation by exporting QT4DIR before running "configure".])
10844         fi
10845     fi
10847     dnl Check for KDE4 headers
10848     AC_MSG_CHECKING([for KDE4 headers])
10849     kde4_incdir="no"
10850     for kde4_check in $kde4_incdirs; do
10851         if test -r "$kde4_check/$kde4_test_include"; then
10852             kde4_incdir="$kde4_check"
10853             break
10854         fi
10855     done
10856     AC_MSG_RESULT([$kde4_incdir])
10857     if test "x$kde4_incdir" = "xno"; then
10858         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10859     fi
10860     if test "$kde4_incdir" = "/usr/include"; then kde4_incdir=; fi
10862     dnl Check for KDE4 libraries
10863     AC_MSG_CHECKING([for KDE4 libraries])
10864     kde4_libdir="no"
10865     for kde4_check in $kde4_libdirs; do
10866         if test -r "$kde4_check/$kde4_test_library"; then
10867             kde4_libdir="$kde4_check"
10868             break
10869         fi
10870     done
10872     AC_MSG_RESULT([$kde4_libdir])
10873     if test "x$kde4_libdir" = "xno"; then
10874         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10875     fi
10877     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
10878     if ! test -z "$kde4_incdir"; then
10879         KDE4_CFLAGS="-I$kde4_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10880     else
10881         KDE4_CFLAGS="$QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10882     fi
10884     KDE4_LIBS="-L$kde4_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt4_lib_dir $QT4_LIBS"
10885     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10886     FilterLibs "$KDE4_LIBS"
10887     KDE4_LIBS="$filteredlibs"
10889     AC_LANG_PUSH([C++])
10890     save_CXXFLAGS=$CXXFLAGS
10891     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10892     AC_MSG_CHECKING([whether KDE is >= 4.2])
10893        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10894 #include <kdeversion.h>
10896 int main(int argc, char **argv) {
10897        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
10898        else return 1;
10900 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[AC_MSG_ERROR([KDE support not tested with cross-compilation])])
10901     CXXFLAGS=$save_CXXFLAGS
10902     AC_LANG_POP([C++])
10904     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
10905     # Sets also KDE4_GLIB_CFLAGS/KDE4_GLIB_LIBS if successful.
10906     PKG_CHECK_MODULES(KDE4_GLIB,[glib-2.0 >= 2.4],
10907         [
10908             KDE4_HAVE_GLIB=TRUE
10909             AC_DEFINE(KDE4_HAVE_GLIB,1)
10910             KDE4_GLIB_CFLAGS=$(printf '%s' "$KDE4_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10911             FilterLibs "${KDE4_GLIB_LIBS}"
10912             KDE4_GLIB_LIBS="${filteredlibs}"
10914             qt4_fix_warning=
10916             AC_LANG_PUSH([C++])
10917             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
10918             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
10919             #  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
10920             #               ^~~~~~~~~~~~~~~~~~~~~~~
10921             #               vptr for 'QObjectPrivate'
10922             # so temporarily ignore here whichever way would be used to make such errors fatal
10923             # (-fno-sanitize-recover=... or UBSAN_OPTIONS halt_on_error=1):
10924             save_CXX=$CXX
10925             CXX=$(printf %s "$CXX" \
10926                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
10927             save_UBSAN_OPTIONS=$UBSAN_OPTIONS
10928             UBSAN_OPTIONS=$UBSAN_OPTIONS:halt_on_error=0
10929             save_CXXFLAGS=$CXXFLAGS
10930             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10931             save_LIBS=$LIBS
10932             LIBS="$LIBS $KDE4_LIBS"
10933             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
10935             # Prepare meta object data
10936             TSTBASE="tst_exclude_socket_notifiers"
10937             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
10938             ln -fs "${TSTMOC}.hxx"
10939             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10941             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10942 #include <cstdlib>
10943 #include "tst_exclude_socket_notifiers.moc"
10945 int main(int argc, char *argv[])
10947     QCoreApplication app(argc, argv);
10948     exit(tst_processEventsExcludeSocket());
10949     return 0;
10951             ]])],[
10952                 AC_MSG_RESULT([yes])
10953             ],[
10954                 AC_MSG_RESULT([no])
10955                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
10956                 if test -z "$qt4_fix_warning"; then
10957                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
10958                 fi
10959                 qt4_fix_warning=1
10960                 add_warning "  https://bugreports.qt.io/browse/QTBUG-37380 (needed)"
10961                 ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
10963             # Remove meta object data
10964             rm -f "${TSTBASE}."*
10966             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
10968             # Prepare meta object data
10969             TSTBASE="tst_exclude_posted_events"
10970             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
10971             ln -fs "${TSTMOC}.hxx"
10972             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10974             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10975 #include <cstdlib>
10976 #include "tst_exclude_posted_events.moc"
10978 int main(int argc, char *argv[])
10980     QCoreApplication app(argc, argv);
10981     exit(tst_excludePostedEvents());
10982     return 0;
10984             ]])],[
10985                 AC_MSG_RESULT([yes])
10986             ],[
10987                 AC_MSG_RESULT([no])
10988                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
10989                 if test -z "$qt4_fix_warning"; then
10990                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
10991                 fi
10992                 qt4_fix_warning=1
10993                 add_warning "  https://bugreports.qt.io/browse/QTBUG-34614 (needed)"
10994             ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
10996             # Remove meta object data
10997             rm -f "${TSTBASE}."*
10999             if test -n "$qt4_fix_warning"; then
11000                 add_warning "  https://bugreports.qt.io/browse/QTBUG-38585 (recommended)"
11001             fi
11003             LIBS=$save_LIBS
11004             CXXFLAGS=$save_CXXFLAGS
11005             UBSAN_OPTIONS=$save_UBSAN_OPTIONS
11006             CXX=$save_CXX
11007             AC_LANG_POP([C++])
11008         ],
11009         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11011 AC_SUBST(KDE4_CFLAGS)
11012 AC_SUBST(KDE4_LIBS)
11013 AC_SUBST(MOC4)
11014 AC_SUBST(KDE4_GLIB_CFLAGS)
11015 AC_SUBST(KDE4_GLIB_LIBS)
11016 AC_SUBST(KDE4_HAVE_GLIB)
11018 dnl ===================================================================
11019 dnl QT5 Integration
11020 dnl ===================================================================
11022 QT5_CFLAGS=""
11023 QT5_LIBS=""
11024 QMAKE5="qmake"
11025 MOC5="moc"
11026 QT5_GLIB_CFLAGS=""
11027 QT5_GLIB_LIBS=""
11028 QT5_HAVE_GLIB=""
11029 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11030         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11031         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11032 then
11033     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11034     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11036     if test -n "$supports_multilib"; then
11037         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11038     fi
11040     qt5_test_include="QtWidgets/qapplication.h"
11041     qt5_test_library="libQt5Widgets.so"
11043     dnl Check for qmake5
11044     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
11045     if test "$QMAKE5" = "no"; then
11046         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11047     else
11048         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11049         if test -z "$qmake5_test_ver"; then
11050             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11051         fi
11052         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11053         qt5_minimal_minor="6"
11054         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11055             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11056         else
11057             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11058         fi
11059     fi
11061     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11062     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11064     AC_MSG_CHECKING([for Qt5 headers])
11065     qt5_incdir="no"
11066     for inc_dir in $qt5_incdirs; do
11067         if test -r "$inc_dir/$qt5_test_include"; then
11068             qt5_incdir="$inc_dir"
11069             break
11070         fi
11071     done
11072     AC_MSG_RESULT([$qt5_incdir])
11073     if test "x$qt5_incdir" = "xno"; then
11074         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11075     fi
11077     AC_MSG_CHECKING([for Qt5 libraries])
11078     qt5_libdir="no"
11079     for lib_dir in $qt5_libdirs; do
11080         if test -r "$lib_dir/$qt5_test_library"; then
11081             qt5_libdir="$lib_dir"
11082             break
11083         fi
11084     done
11085     AC_MSG_RESULT([$qt5_libdir])
11086     if test "x$qt5_libdir" = "xno"; then
11087         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11088     fi
11090     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11091     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11093     dnl Check for Meta Object Compiler
11095     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
11096     if test "$MOC5" = "no"; then
11097         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11098 the root of your Qt installation by exporting QT5DIR before running "configure".])
11099     fi
11101     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11102     # Sets also QT5_GLIB_CFLAGS/QT5_GLIB_LIBS if successful.
11103     PKG_CHECK_MODULES(QT5_GLIB,[glib-2.0 >= 2.4],
11104         [
11105             QT5_HAVE_GLIB=1
11106             AC_DEFINE(QT5_HAVE_GLIB,1)
11107         ],
11108         AC_MSG_WARN([[No Glib found, Qt5 support will not use native file pickers!]])
11109     )
11111 AC_SUBST(QT5_CFLAGS)
11112 AC_SUBST(QT5_LIBS)
11113 AC_SUBST(MOC5)
11114 AC_SUBST(QT5_GLIB_CFLAGS)
11115 AC_SUBST(QT5_GLIB_LIBS)
11116 AC_SUBST(QT5_HAVE_GLIB)
11118 dnl ===================================================================
11119 dnl KDE5 Integration
11120 dnl ===================================================================
11122 KF5_CFLAGS=""
11123 KF5_LIBS=""
11124 KF5_CONFIG="kf5-config"
11125 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11126         \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11127         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11128 then
11129     kf5_incdirs="$KF5INC /usr/include/ $x_includes"
11130     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $x_libraries"
11131     if test -n "$supports_multilib"; then
11132         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11133     fi
11135     kf5_test_include="KF5/kcoreaddons_version.h"
11136     kf5_test_library="libKF5CoreAddons.so"
11137     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11139     dnl kf5 KDE4 support compatibility installed
11140     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11141     if test "$KF5_CONFIG" != "no"; then
11142         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11143         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11144     fi
11146     dnl Check for KF5 headers
11147     AC_MSG_CHECKING([for KF5 headers])
11148     kf5_incdir="no"
11149     for kf5_check in $kf5_incdirs; do
11150         if test -r "$kf5_check/$kf5_test_include"; then
11151             kf5_incdir="$kf5_check/KF5"
11152             break
11153         fi
11154     done
11155     AC_MSG_RESULT([$kf5_incdir])
11156     if test "x$kf5_incdir" = "xno"; then
11157         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11158     fi
11160     dnl Check for KF5 libraries
11161     AC_MSG_CHECKING([for KF5 libraries])
11162     kf5_libdir="no"
11163     for kf5_check in $kf5_libdirs; do
11164         if test -r "$kf5_check/$kf5_test_library"; then
11165             kf5_libdir="$kf5_check"
11166             break
11167         fi
11168     done
11170     AC_MSG_RESULT([$kf5_libdir])
11171     if test "x$kf5_libdir" = "xno"; then
11172         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11173     fi
11175     PKG_CHECK_MODULES(KF5_XCB,[xcb],,[AC_MSG_ERROR([XCB not installed])])
11177     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"
11178     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network -lQt5X11Extras $KF5_XCB_LIBS"
11179     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11181     AC_LANG_PUSH([C++])
11182     save_CXXFLAGS=$CXXFLAGS
11183     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11184     AC_MSG_CHECKING([whether KDE is >= 5.0])
11185        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11186 #include <kcoreaddons_version.h>
11188 int main(int argc, char **argv) {
11189        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11190        else return 1;
11192        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11193     CXXFLAGS=$save_CXXFLAGS
11194     AC_LANG_POP([C++])
11196 AC_SUBST(KF5_CFLAGS)
11197 AC_SUBST(KF5_LIBS)
11199 dnl ===================================================================
11200 dnl Test whether to include Evolution 2 support
11201 dnl ===================================================================
11202 AC_MSG_CHECKING([whether to enable evolution 2 support])
11203 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11204     AC_MSG_RESULT([yes])
11205     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11206     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11207     FilterLibs "${GOBJECT_LIBS}"
11208     GOBJECT_LIBS="${filteredlibs}"
11209     ENABLE_EVOAB2="TRUE"
11210 else
11211     ENABLE_EVOAB2=""
11212     AC_MSG_RESULT([no])
11214 AC_SUBST(ENABLE_EVOAB2)
11215 AC_SUBST(GOBJECT_CFLAGS)
11216 AC_SUBST(GOBJECT_LIBS)
11218 dnl ===================================================================
11219 dnl Test which themes to include
11220 dnl ===================================================================
11221 AC_MSG_CHECKING([which themes to include])
11222 # if none given use default subset of available themes
11223 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11224     with_theme="breeze breeze_dark cib colibre elementary karasa_jaga sifr sifr_dark tango"
11227 WITH_THEMES=""
11228 if test "x$with_theme" != "xno"; then
11229     for theme in $with_theme; do
11230         case $theme in
11231         breeze|breeze_dark|colibre|elementary|karasa_jaga|sifr|sifr_dark|tango|cib) real_theme="$theme" ;;
11232         default) real_theme=colibre ;;
11233         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11234         esac
11235         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11236     done
11238 AC_MSG_RESULT([$WITH_THEMES])
11239 AC_SUBST([WITH_THEMES])
11240 # FIXME: remove this, and the convenience default->colibre remapping after a crace period
11241 for theme in $with_theme; do
11242     case $theme in
11243     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11244     *) ;;
11245     esac
11246 done
11248 dnl ===================================================================
11249 dnl Test whether to integrate helppacks into the product's installer
11250 dnl ===================================================================
11251 AC_MSG_CHECKING([for helppack integration])
11252 if test "$with_helppack_integration" = "no"; then
11253     WITH_HELPPACK_INTEGRATION=
11254     AC_MSG_RESULT([no integration])
11255 else
11256     WITH_HELPPACK_INTEGRATION=TRUE
11257     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11258     AC_MSG_RESULT([integration])
11260 AC_SUBST(WITH_HELPPACK_INTEGRATION)
11262 ###############################################################################
11263 # Extensions checking
11264 ###############################################################################
11265 AC_MSG_CHECKING([for extensions integration])
11266 if test "x$enable_extension_integration" != "xno"; then
11267     WITH_EXTENSION_INTEGRATION=TRUE
11268     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11269     AC_MSG_RESULT([yes, use integration])
11270 else
11271     WITH_EXTENSION_INTEGRATION=
11272     AC_MSG_RESULT([no, do not integrate])
11274 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11276 dnl Should any extra extensions be included?
11277 dnl There are standalone tests for each of these below.
11278 WITH_EXTRA_EXTENSIONS=
11279 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11281 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11282 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11283 if test "x$with_java" != "xno"; then
11284     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11285     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11288 TEST_FONTS_MISSING=0
11290 # $1  = font family
11291 # $2+ = accepted font mappings
11292 test_font_map()
11294     FONT="$1" ; shift
11295     AC_MSG_CHECKING([font mapping for '$FONT'])
11296     FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
11297     FONTFILE_LOWER="$(echo $FONTFILE | $AWK '{print tolower($0)}')"
11299     TESTEXPR="'${FONTFILE_LOWER}' = '$(echo $FONT | $AWK '{print tolower($0)}').ttf'"
11300     while test "$#" -ge 1 ; do
11301         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
11302         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
11303     done
11304     if test $TESTEXPR
11305     then
11306         AC_MSG_RESULT([ok])
11307     else
11308         AC_MSG_WARN([unknown ($FONTFILE)])
11309         add_warning "unknown ($FONTFILE)"
11310         TEST_FONTS_MISSING=1
11311     fi
11314 dnl ===================================================================
11315 dnl Test whether to include fonts
11316 dnl ===================================================================
11317 AC_MSG_CHECKING([whether to include third-party fonts])
11318 if test "$with_fonts" != "no"; then
11319     AC_MSG_RESULT([yes])
11320     WITH_FONTS=TRUE
11321     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11322     AC_DEFINE(HAVE_MORE_FONTS)
11323 else
11324     AC_MSG_RESULT([no])
11325     WITH_FONTS=
11326     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11327     if test "$test_fontconfig" = "yes"; then
11328         AC_PATH_PROG([FCMATCH], [fc-match])
11329         if test -z "$FCMATCH"; then
11330             AC_MSG_WARN([Unable to query installed fonts - unit tests disabled.])
11331             TEST_FONTS_MISSING=1
11332         else
11333             test_font_map 'Calibri' 'Carlito'
11334             test_font_map 'DejaVuSans' 'DejaVuSans'
11335             if test ${TEST_FONTS_MISSING} -eq 1
11336             then
11337                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
11338                 add_warning "Unknown font mappings - unit tests disabled."
11339             fi
11340         fi
11341     else
11342         TEST_FONTS_MISSING=1
11343     fi
11345 AC_SUBST(WITH_FONTS)
11346 AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
11349 dnl ===================================================================
11350 dnl Test whether to enable online update service
11351 dnl ===================================================================
11352 AC_MSG_CHECKING([whether to enable online update])
11353 ENABLE_ONLINE_UPDATE=
11354 ENABLE_ONLINE_UPDATE_MAR=
11355 UPDATE_CONFIG=
11356 if test "$enable_online_update" = ""; then
11357     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11358         AC_MSG_RESULT([yes])
11359         ENABLE_ONLINE_UPDATE="TRUE"
11360     else
11361         AC_MSG_RESULT([no])
11362     fi
11363 else
11364     if test "$enable_online_update" = "mar"; then
11365         AC_MSG_RESULT([yes - MAR-based online update])
11366         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11367         if test "$with_update_config" = ""; then
11368             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11369         fi
11370         UPDATE_CONFIG="$with_update_config"
11371         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11372     elif test "$enable_online_update" = "yes"; then
11373         AC_MSG_RESULT([yes])
11374         ENABLE_ONLINE_UPDATE="TRUE"
11375     else
11376         AC_MSG_RESULT([no])
11377     fi
11379 AC_SUBST(ENABLE_ONLINE_UPDATE)
11380 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11381 AC_SUBST(UPDATE_CONFIG)
11383 dnl ===================================================================
11384 dnl Test whether we need bzip2
11385 dnl ===================================================================
11386 SYSTEM_BZIP2=
11387 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11388     AC_MSG_CHECKING([whether to use system bzip2])
11389     if test "$with_system_bzip2" = yes; then
11390         SYSTEM_BZIP2=TRUE
11391         AC_MSG_RESULT([yes])
11392         PKG_CHECK_MODULES(BZIP2, bzip2)
11393         FilterLibs "${BZIP2_LIBS}"
11394         BZIP2_LIBS="${filteredlibs}"
11395     else
11396         AC_MSG_RESULT([no])
11397         BUILD_TYPE="$BUILD_TYPE BZIP2"
11398     fi
11400 AC_SUBST(SYSTEM_BZIP2)
11401 AC_SUBST(BZIP2_CFLAGS)
11402 AC_SUBST(BZIP2_LIBS)
11404 dnl ===================================================================
11405 dnl Test whether to enable extension update
11406 dnl ===================================================================
11407 AC_MSG_CHECKING([whether to enable extension update])
11408 ENABLE_EXTENSION_UPDATE=
11409 if test "x$enable_extension_update" = "xno"; then
11410     AC_MSG_RESULT([no])
11411 else
11412     AC_MSG_RESULT([yes])
11413     ENABLE_EXTENSION_UPDATE="TRUE"
11414     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11415     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11417 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11420 dnl ===================================================================
11421 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11422 dnl ===================================================================
11423 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11424 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11425     AC_MSG_RESULT([no])
11426     ENABLE_SILENT_MSI=
11427 else
11428     AC_MSG_RESULT([yes])
11429     ENABLE_SILENT_MSI=TRUE
11430     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11432 AC_SUBST(ENABLE_SILENT_MSI)
11434 AC_MSG_CHECKING([whether and how to use Xinerama])
11435 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11436     if test "$x_libraries" = "default_x_libraries"; then
11437         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11438         if test "x$XINERAMALIB" = x; then
11439            XINERAMALIB="/usr/lib"
11440         fi
11441     else
11442         XINERAMALIB="$x_libraries"
11443     fi
11444     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11445         # we have both versions, let the user decide but use the dynamic one
11446         # per default
11447         USE_XINERAMA=TRUE
11448         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11449             XINERAMA_LINK=dynamic
11450         else
11451             XINERAMA_LINK=static
11452         fi
11453     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11454         # we have only the dynamic version
11455         USE_XINERAMA=TRUE
11456         XINERAMA_LINK=dynamic
11457     elif test -e "$XINERAMALIB/libXinerama.a"; then
11458         # static version
11459         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11460             USE_XINERAMA=TRUE
11461             XINERAMA_LINK=static
11462         else
11463             USE_XINERAMA=
11464             XINERAMA_LINK=none
11465         fi
11466     else
11467         # no Xinerama
11468         USE_XINERAMA=
11469         XINERAMA_LINK=none
11470     fi
11471     if test "$USE_XINERAMA" = "TRUE"; then
11472         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11473         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11474             [AC_MSG_ERROR(Xinerama header not found.)], [])
11475         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11476         if test "x$XEXTLIB" = x; then
11477            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11478         fi
11479         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11480         if test "$_os" = "FreeBSD"; then
11481             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11482         fi
11483         if test "$_os" = "Linux"; then
11484             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11485         fi
11486         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11487             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11488     else
11489         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11490     fi
11491 else
11492     USE_XINERAMA=
11493     XINERAMA_LINK=none
11494     AC_MSG_RESULT([no])
11496 AC_SUBST(USE_XINERAMA)
11497 AC_SUBST(XINERAMA_LINK)
11499 dnl ===================================================================
11500 dnl Test whether to build cairo or rely on the system version
11501 dnl ===================================================================
11503 if test "$USING_X11" = TRUE; then
11504     # Used in vcl/Library_vclplug_gen.mk
11505     test_cairo=yes
11508 if test "$test_cairo" = "yes"; then
11509     AC_MSG_CHECKING([whether to use the system cairo])
11511     : ${with_system_cairo:=$with_system_libs}
11512     if test "$with_system_cairo" = "yes"; then
11513         SYSTEM_CAIRO=TRUE
11514         AC_MSG_RESULT([yes])
11516         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11517         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11518         FilterLibs "${CAIRO_LIBS}"
11519         CAIRO_LIBS="${filteredlibs}"
11521         if test "$test_xrender" = "yes"; then
11522             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11523             AC_LANG_PUSH([C])
11524             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11525 #ifdef PictStandardA8
11526 #else
11527       return fail;
11528 #endif
11529 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11531             AC_LANG_POP([C])
11532         fi
11533     else
11534         SYSTEM_CAIRO=
11535         AC_MSG_RESULT([no])
11537         BUILD_TYPE="$BUILD_TYPE CAIRO"
11538     fi
11541 AC_SUBST(SYSTEM_CAIRO)
11542 AC_SUBST(CAIRO_CFLAGS)
11543 AC_SUBST(CAIRO_LIBS)
11545 dnl ===================================================================
11546 dnl Test whether to use avahi
11547 dnl ===================================================================
11548 if test "$_os" = "WINNT"; then
11549     # Windows uses bundled mDNSResponder
11550     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11551 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11552     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11553                       [ENABLE_AVAHI="TRUE"])
11554     AC_DEFINE(HAVE_FEATURE_AVAHI)
11555     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11556     FilterLibs "${AVAHI_LIBS}"
11557     AVAHI_LIBS="${filteredlibs}"
11560 AC_SUBST(ENABLE_AVAHI)
11561 AC_SUBST(AVAHI_CFLAGS)
11562 AC_SUBST(AVAHI_LIBS)
11564 dnl ===================================================================
11565 dnl Test whether to use liblangtag
11566 dnl ===================================================================
11567 SYSTEM_LIBLANGTAG=
11568 AC_MSG_CHECKING([whether to use system liblangtag])
11569 if test "$with_system_liblangtag" = yes; then
11570     SYSTEM_LIBLANGTAG=TRUE
11571     AC_MSG_RESULT([yes])
11572     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11573     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11574     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11575     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11576     FilterLibs "${LIBLANGTAG_LIBS}"
11577     LIBLANGTAG_LIBS="${filteredlibs}"
11578 else
11579     SYSTEM_LIBLANGTAG=
11580     AC_MSG_RESULT([no])
11581     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11582     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11583     if test "$COM" = "MSC"; then
11584         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11585     else
11586         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11587     fi
11589 AC_SUBST(SYSTEM_LIBLANGTAG)
11590 AC_SUBST(LIBLANGTAG_CFLAGS)
11591 AC_SUBST(LIBLANGTAG_LIBS)
11593 dnl ===================================================================
11594 dnl Test whether to build libpng or rely on the system version
11595 dnl ===================================================================
11597 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11599 dnl ===================================================================
11600 dnl Check for runtime JVM search path
11601 dnl ===================================================================
11602 if test "$ENABLE_JAVA" != ""; then
11603     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11604     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11605         AC_MSG_RESULT([yes])
11606         if ! test -d "$with_jvm_path"; then
11607             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11608         fi
11609         if ! test -d "$with_jvm_path"jvm; then
11610             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11611         fi
11612         JVM_ONE_PATH_CHECK="$with_jvm_path"
11613         AC_SUBST(JVM_ONE_PATH_CHECK)
11614     else
11615         AC_MSG_RESULT([no])
11616     fi
11619 dnl ===================================================================
11620 dnl Test for the presence of Ant and that it works
11621 dnl ===================================================================
11623 if test "$ENABLE_JAVA" != ""; then
11624     ANT_HOME=; export ANT_HOME
11625     WITH_ANT_HOME=; export WITH_ANT_HOME
11626     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11627         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11628             if test "$_os" = "WINNT"; then
11629                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11630             else
11631                 with_ant_home="$LODE_HOME/opt/ant"
11632             fi
11633         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11634             with_ant_home="$LODE_HOME/opt/ant"
11635         fi
11636     fi
11637     if test -z "$with_ant_home"; then
11638         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11639     else
11640         if test "$_os" = "WINNT"; then
11641             # AC_PATH_PROGS needs unix path
11642             with_ant_home=`cygpath -u "$with_ant_home"`
11643         fi
11644         AbsolutePath "$with_ant_home"
11645         with_ant_home=$absolute_path
11646         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11647         WITH_ANT_HOME=$with_ant_home
11648         ANT_HOME=$with_ant_home
11649     fi
11651     if test -z "$ANT"; then
11652         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11653     else
11654         # resolve relative or absolute symlink
11655         while test -h "$ANT"; do
11656             a_cwd=`pwd`
11657             a_basename=`basename "$ANT"`
11658             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11659             cd "`dirname "$ANT"`"
11660             cd "`dirname "$a_script"`"
11661             ANT="`pwd`"/"`basename "$a_script"`"
11662             cd "$a_cwd"
11663         done
11665         AC_MSG_CHECKING([if $ANT works])
11666         cat > conftest.java << EOF
11667         public class conftest {
11668             int testmethod(int a, int b) {
11669                     return a + b;
11670             }
11671         }
11674         cat > conftest.xml << EOF
11675         <project name="conftest" default="conftest">
11676         <target name="conftest">
11677             <javac srcdir="." includes="conftest.java">
11678             </javac>
11679         </target>
11680         </project>
11683         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11684         if test $? = 0 -a -f ./conftest.class; then
11685             AC_MSG_RESULT([Ant works])
11686             if test -z "$WITH_ANT_HOME"; then
11687                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11688                 if test -z "$ANT_HOME"; then
11689                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11690                 fi
11691             else
11692                 ANT_HOME="$WITH_ANT_HOME"
11693             fi
11694         else
11695             echo "configure: Ant test failed" >&5
11696             cat conftest.java >&5
11697             cat conftest.xml >&5
11698             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11699         fi
11700         rm -f conftest* core core.* *.core
11701     fi
11702     if test -z "$ANT_HOME"; then
11703         ANT_HOME="NO_ANT_HOME"
11704     else
11705         PathFormat "$ANT_HOME"
11706         ANT_HOME="$formatted_path"
11707         PathFormat "$ANT"
11708         ANT="$formatted_path"
11709     fi
11710     AC_SUBST(ANT_HOME)
11711     AC_SUBST(ANT)
11713     dnl Checking for ant.jar
11714     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11715         AC_MSG_CHECKING([Ant lib directory])
11716         if test -f $ANT_HOME/lib/ant.jar; then
11717             ANT_LIB="$ANT_HOME/lib"
11718         else
11719             if test -f $ANT_HOME/ant.jar; then
11720                 ANT_LIB="$ANT_HOME"
11721             else
11722                 if test -f /usr/share/java/ant.jar; then
11723                     ANT_LIB=/usr/share/java
11724                 else
11725                     if test -f /usr/share/ant-core/lib/ant.jar; then
11726                         ANT_LIB=/usr/share/ant-core/lib
11727                     else
11728                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11729                             ANT_LIB="$ANT_HOME/lib/ant"
11730                         else
11731                             if test -f /usr/share/lib/ant/ant.jar; then
11732                                 ANT_LIB=/usr/share/lib/ant
11733                             else
11734                                 AC_MSG_ERROR([Ant libraries not found!])
11735                             fi
11736                         fi
11737                     fi
11738                 fi
11739             fi
11740         fi
11741         PathFormat "$ANT_LIB"
11742         ANT_LIB="$formatted_path"
11743         AC_MSG_RESULT([Ant lib directory found.])
11744     fi
11745     AC_SUBST(ANT_LIB)
11747     ant_minver=1.6.0
11748     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11750     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11751     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11752     ant_version_major=`echo $ant_version | cut -d. -f1`
11753     ant_version_minor=`echo $ant_version | cut -d. -f2`
11754     echo "configure: ant_version $ant_version " >&5
11755     echo "configure: ant_version_major $ant_version_major " >&5
11756     echo "configure: ant_version_minor $ant_version_minor " >&5
11757     if test "$ant_version_major" -ge "2"; then
11758         AC_MSG_RESULT([yes, $ant_version])
11759     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11760         AC_MSG_RESULT([yes, $ant_version])
11761     else
11762         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11763     fi
11765     rm -f conftest* core core.* *.core
11768 OOO_JUNIT_JAR=
11769 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11770     AC_MSG_CHECKING([for JUnit 4])
11771     if test "$with_junit" = "yes"; then
11772         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
11773             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
11774         elif test -e /usr/share/java/junit4.jar; then
11775             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11776         else
11777            if test -e /usr/share/lib/java/junit.jar; then
11778               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11779            else
11780               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11781            fi
11782         fi
11783     else
11784         OOO_JUNIT_JAR=$with_junit
11785     fi
11786     if test "$_os" = "WINNT"; then
11787         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11788     fi
11789     printf 'import org.junit.Before;' > conftest.java
11790     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11791         AC_MSG_RESULT([$OOO_JUNIT_JAR])
11792     else
11793         AC_MSG_ERROR(
11794 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
11795  specify its pathname via --with-junit=..., or disable it via --without-junit])
11796     fi
11797     rm -f conftest.class conftest.java
11798     if test $OOO_JUNIT_JAR != ""; then
11799     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11800     fi
11802 AC_SUBST(OOO_JUNIT_JAR)
11804 HAMCREST_JAR=
11805 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11806     AC_MSG_CHECKING([for included Hamcrest])
11807     printf 'import org.hamcrest.BaseDescription;' > conftest.java
11808     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11809         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
11810     else
11811         AC_MSG_RESULT([Not included])
11812         AC_MSG_CHECKING([for standalone hamcrest jar.])
11813         if test "$with_hamcrest" = "yes"; then
11814             if test -e /usr/share/lib/java/hamcrest.jar; then
11815                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
11816             elif test -e /usr/share/java/hamcrest/core.jar; then
11817                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
11818             else
11819                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
11820             fi
11821         else
11822             HAMCREST_JAR=$with_hamcrest
11823         fi
11824         if test "$_os" = "WINNT"; then
11825             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
11826         fi
11827         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
11828             AC_MSG_RESULT([$HAMCREST_JAR])
11829         else
11830             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),
11831                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
11832         fi
11833     fi
11834     rm -f conftest.class conftest.java
11836 AC_SUBST(HAMCREST_JAR)
11839 AC_SUBST(SCPDEFS)
11842 # check for wget and curl
11844 WGET=
11845 CURL=
11847 if test "$enable_fetch_external" != "no"; then
11849 CURL=`which curl 2>/dev/null`
11851 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
11852     # wget new enough?
11853     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
11854     if test $? -eq 0; then
11855         WGET=$i
11856         break
11857     fi
11858 done
11860 if test -z "$WGET" -a -z "$CURL"; then
11861     AC_MSG_ERROR([neither wget nor curl found!])
11866 AC_SUBST(WGET)
11867 AC_SUBST(CURL)
11870 # check for sha256sum
11872 SHA256SUM=
11874 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
11875     eval "$i -a 256 --version" > /dev/null 2>&1
11876     ret=$?
11877     if test $ret -eq 0; then
11878         SHA256SUM="$i -a 256"
11879         break
11880     fi
11881 done
11883 if test -z "$SHA256SUM"; then
11884     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
11885         eval "$i --version" > /dev/null 2>&1
11886         ret=$?
11887         if test $ret -eq 0; then
11888             SHA256SUM=$i
11889             break
11890         fi
11891     done
11894 if test -z "$SHA256SUM"; then
11895     AC_MSG_ERROR([no sha256sum found!])
11898 AC_SUBST(SHA256SUM)
11900 dnl ===================================================================
11901 dnl Dealing with l10n options
11902 dnl ===================================================================
11903 AC_MSG_CHECKING([which languages to be built])
11904 # get list of all languages
11905 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
11906 # the sed command does the following:
11907 #   + if a line ends with a backslash, append the next line to it
11908 #   + adds " on the beginning of the value (after =)
11909 #   + adds " at the end of the value
11910 #   + removes en-US; we want to put it on the beginning
11911 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
11912 [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)]
11913 ALL_LANGS="en-US $completelangiso"
11914 # check the configured localizations
11915 WITH_LANG="$with_lang"
11916 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
11917     AC_MSG_RESULT([en-US])
11918 else
11919     AC_MSG_RESULT([$WITH_LANG])
11920     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
11921     if test -z "$MSGFMT"; then
11922         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
11923             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
11924         elif test -x "/opt/lo/bin/msgfmt"; then
11925             MSGFMT="/opt/lo/bin/msgfmt"
11926         else
11927             AC_CHECK_PROGS(MSGFMT, [msgfmt])
11928             if test -z "$MSGFMT"; then
11929                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
11930             fi
11931         fi
11932     fi
11933     if test -z "$MSGUNIQ"; then
11934         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
11935             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
11936         elif test -x "/opt/lo/bin/msguniq"; then
11937             MSGUNIQ="/opt/lo/bin/msguniq"
11938         else
11939             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
11940             if test -z "$MSGUNIQ"; then
11941                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
11942             fi
11943         fi
11944     fi
11946 AC_SUBST(MSGFMT)
11947 AC_SUBST(MSGUNIQ)
11948 # check that the list is valid
11949 for lang in $WITH_LANG; do
11950     test "$lang" = "ALL" && continue
11951     # need to check for the exact string, so add space before and after the list of all languages
11952     for vl in $ALL_LANGS; do
11953         if test "$vl" = "$lang"; then
11954            break
11955         fi
11956     done
11957     if test "$vl" != "$lang"; then
11958         # if you're reading this - you prolly quoted your languages remove the quotes ...
11959         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
11960     fi
11961 done
11962 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
11963     echo $WITH_LANG | grep -q en-US
11964     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
11966 # list with substituted ALL
11967 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
11968 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
11969 test "$WITH_LANG" = "en-US" && WITH_LANG=
11970 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
11971     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
11972     ALL_LANGS=`echo $ALL_LANGS qtz`
11974 AC_SUBST(ALL_LANGS)
11975 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
11976 AC_SUBST(WITH_LANG)
11977 AC_SUBST(WITH_LANG_LIST)
11978 AC_SUBST(GIT_NEEDED_SUBMODULES)
11980 WITH_POOR_HELP_LOCALIZATIONS=
11981 if test -d "$SRC_ROOT/translations/source"; then
11982     for l in `ls -1 $SRC_ROOT/translations/source`; do
11983         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
11984             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
11985         fi
11986     done
11988 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
11990 if test -n "$with_locales"; then
11991     WITH_LOCALES="$with_locales"
11993     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
11994     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
11995     # config_host/config_locales.h.in
11996     for locale in $WITH_LOCALES; do
11997         lang=${locale%_*}
11999         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12001         case $lang in
12002         hi|mr*ne)
12003             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12004             ;;
12005         bg|ru)
12006             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12007             ;;
12008         esac
12009     done
12010 else
12011     AC_DEFINE(WITH_LOCALE_ALL)
12013 AC_SUBST(WITH_LOCALES)
12015 dnl git submodule update --reference
12016 dnl ===================================================================
12017 if test -n "${GIT_REFERENCE_SRC}"; then
12018     for repo in ${GIT_NEEDED_SUBMODULES}; do
12019         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12020             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12021         fi
12022     done
12024 AC_SUBST(GIT_REFERENCE_SRC)
12026 dnl git submodules linked dirs
12027 dnl ===================================================================
12028 if test -n "${GIT_LINK_SRC}"; then
12029     for repo in ${GIT_NEEDED_SUBMODULES}; do
12030         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12031             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12032         fi
12033     done
12035 AC_SUBST(GIT_LINK_SRC)
12037 dnl branding
12038 dnl ===================================================================
12039 AC_MSG_CHECKING([for alternative branding images directory])
12040 # initialize mapped arrays
12041 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12042 brand_files="$BRAND_INTRO_IMAGES about.svg"
12044 if test -z "$with_branding" -o "$with_branding" = "no"; then
12045     AC_MSG_RESULT([none])
12046     DEFAULT_BRAND_IMAGES="$brand_files"
12047 else
12048     if ! test -d $with_branding ; then
12049         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12050     else
12051         AC_MSG_RESULT([$with_branding])
12052         CUSTOM_BRAND_DIR="$with_branding"
12053         for lfile in $brand_files
12054         do
12055             if ! test -f $with_branding/$lfile ; then
12056                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12057                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12058             else
12059                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12060             fi
12061         done
12062         check_for_progress="yes"
12063     fi
12065 AC_SUBST([BRAND_INTRO_IMAGES])
12066 AC_SUBST([CUSTOM_BRAND_DIR])
12067 AC_SUBST([CUSTOM_BRAND_IMAGES])
12068 AC_SUBST([DEFAULT_BRAND_IMAGES])
12071 AC_MSG_CHECKING([for 'intro' progress settings])
12072 PROGRESSBARCOLOR=
12073 PROGRESSSIZE=
12074 PROGRESSPOSITION=
12075 PROGRESSFRAMECOLOR=
12076 PROGRESSTEXTCOLOR=
12077 PROGRESSTEXTBASELINE=
12079 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12080     source "$with_branding/progress.conf"
12081     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12082 else
12083     AC_MSG_RESULT([none])
12086 AC_SUBST(PROGRESSBARCOLOR)
12087 AC_SUBST(PROGRESSSIZE)
12088 AC_SUBST(PROGRESSPOSITION)
12089 AC_SUBST(PROGRESSFRAMECOLOR)
12090 AC_SUBST(PROGRESSTEXTCOLOR)
12091 AC_SUBST(PROGRESSTEXTBASELINE)
12094 AC_MSG_CHECKING([for extra build ID])
12095 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12096     EXTRA_BUILDID="$with_extra_buildid"
12098 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12099 if test -n "$EXTRA_BUILDID" ; then
12100     AC_MSG_RESULT([$EXTRA_BUILDID])
12101 else
12102     AC_MSG_RESULT([not set])
12104 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12106 OOO_VENDOR=
12107 AC_MSG_CHECKING([for vendor])
12108 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12109     OOO_VENDOR="$USERNAME"
12111     if test -z "$OOO_VENDOR"; then
12112         OOO_VENDOR="$USER"
12113     fi
12115     if test -z "$OOO_VENDOR"; then
12116         OOO_VENDOR="`id -u -n`"
12117     fi
12119     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12120 else
12121     OOO_VENDOR="$with_vendor"
12122     AC_MSG_RESULT([$OOO_VENDOR])
12124 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12125 AC_SUBST(OOO_VENDOR)
12127 if test "$_os" = "Android" ; then
12128     ANDROID_PACKAGE_NAME=
12129     AC_MSG_CHECKING([for Android package name])
12130     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12131         if test -n "$ENABLE_DEBUG"; then
12132             # Default to the package name that makes ndk-gdb happy.
12133             ANDROID_PACKAGE_NAME="org.libreoffice"
12134         else
12135             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12136         fi
12138         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12139     else
12140         ANDROID_PACKAGE_NAME="$with_android_package_name"
12141         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12142     fi
12143     AC_SUBST(ANDROID_PACKAGE_NAME)
12146 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12147 if test "$with_compat_oowrappers" = "yes"; then
12148     WITH_COMPAT_OOWRAPPERS=TRUE
12149     AC_MSG_RESULT(yes)
12150 else
12151     WITH_COMPAT_OOWRAPPERS=
12152     AC_MSG_RESULT(no)
12154 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12156 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12157 AC_MSG_CHECKING([for install dirname])
12158 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12159     INSTALLDIRNAME="$with_install_dirname"
12161 AC_MSG_RESULT([$INSTALLDIRNAME])
12162 AC_SUBST(INSTALLDIRNAME)
12164 AC_MSG_CHECKING([for prefix])
12165 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12166 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12167 PREFIXDIR="$prefix"
12168 AC_MSG_RESULT([$PREFIXDIR])
12169 AC_SUBST(PREFIXDIR)
12171 LIBDIR=[$(eval echo $(eval echo $libdir))]
12172 AC_SUBST(LIBDIR)
12174 DATADIR=[$(eval echo $(eval echo $datadir))]
12175 AC_SUBST(DATADIR)
12177 MANDIR=[$(eval echo $(eval echo $mandir))]
12178 AC_SUBST(MANDIR)
12180 DOCDIR=[$(eval echo $(eval echo $docdir))]
12181 AC_SUBST(DOCDIR)
12183 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12184 AC_SUBST(INSTALLDIR)
12186 TESTINSTALLDIR="${BUILDDIR}/test-install"
12187 AC_SUBST(TESTINSTALLDIR)
12190 # ===================================================================
12191 # OAuth2 id and secrets
12192 # ===================================================================
12194 AC_MSG_CHECKING([for Google Drive client id and secret])
12195 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12196     AC_MSG_RESULT([not set])
12197     GDRIVE_CLIENT_ID="\"\""
12198     GDRIVE_CLIENT_SECRET="\"\""
12199 else
12200     AC_MSG_RESULT([set])
12201     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12202     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12204 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12205 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12207 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12208 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12209     AC_MSG_RESULT([not set])
12210     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12211     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12212 else
12213     AC_MSG_RESULT([set])
12214     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12215     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12217 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12218 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12220 AC_MSG_CHECKING([for OneDrive client id and secret])
12221 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12222     AC_MSG_RESULT([not set])
12223     ONEDRIVE_CLIENT_ID="\"\""
12224     ONEDRIVE_CLIENT_SECRET="\"\""
12225 else
12226     AC_MSG_RESULT([set])
12227     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12228     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12230 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12231 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12234 dnl ===================================================================
12235 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12236 dnl --enable-dependency-tracking configure option
12237 dnl ===================================================================
12238 AC_MSG_CHECKING([whether to enable dependency tracking])
12239 if test "$enable_dependency_tracking" = "no"; then
12240     nodep=TRUE
12241     AC_MSG_RESULT([no])
12242 else
12243     AC_MSG_RESULT([yes])
12245 AC_SUBST(nodep)
12247 dnl ===================================================================
12248 dnl Number of CPUs to use during the build
12249 dnl ===================================================================
12250 AC_MSG_CHECKING([for number of processors to use])
12251 # plain --with-parallelism is just the default
12252 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12253     if test "$with_parallelism" = "no"; then
12254         PARALLELISM=0
12255     else
12256         PARALLELISM=$with_parallelism
12257     fi
12258 else
12259     if test "$enable_icecream" = "yes"; then
12260         PARALLELISM="10"
12261     else
12262         case `uname -s` in
12264         Darwin|FreeBSD|NetBSD|OpenBSD)
12265             PARALLELISM=`sysctl -n hw.ncpu`
12266             ;;
12268         Linux)
12269             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12270         ;;
12271         # what else than above does profit here *and* has /proc?
12272         *)
12273             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12274             ;;
12275         esac
12277         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12278         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12279     fi
12282 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12283     if test -z "$with_parallelism"; then
12284             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12285             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12286             PARALLELISM="1"
12287     else
12288         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."
12289     fi
12292 if test $PARALLELISM -eq 0; then
12293     AC_MSG_RESULT([explicit make -j option needed])
12294 else
12295     AC_MSG_RESULT([$PARALLELISM])
12297 AC_SUBST(PARALLELISM)
12299 IWYU_PATH="$with_iwyu"
12300 AC_SUBST(IWYU_PATH)
12301 if test ! -z "$IWYU_PATH"; then
12302     if test ! -f "$IWYU_PATH"; then
12303         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12304     fi
12308 # Set up ILIB for MSVC build
12310 ILIB1=
12311 if test "$build_os" = "cygwin"; then
12312     ILIB="."
12313     if test -n "$JAVA_HOME"; then
12314         ILIB="$ILIB;$JAVA_HOME/lib"
12315     fi
12316     ILIB1=-link
12317     if test "$BITNESS_OVERRIDE" = 64; then
12318         if test $vcnum = "150"; then
12319             ILIB="$ILIB;$COMPATH/lib/x64"
12320             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12321         else
12322             ILIB="$ILIB;$COMPATH/lib/amd64"
12323             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/amd64"
12324         fi
12325         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12326         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12327         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12328             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12329             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12330         fi
12331         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12332         ucrtlibpath_formatted=$formatted_path
12333         ILIB="$ILIB;$ucrtlibpath_formatted"
12334         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12335     else
12336         if test $vcnum = "150"; then
12337             ILIB="$ILIB;$COMPATH/lib/x86"
12338             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12339         else
12340             ILIB="$ILIB;$COMPATH/lib"
12341             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib"
12342         fi
12343         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12344         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12345         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12346             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12347             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12348         fi
12349         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12350         ucrtlibpath_formatted=$formatted_path
12351         ILIB="$ILIB;$ucrtlibpath_formatted"
12352         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12353     fi
12354     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12355         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12356     else
12357         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12358     fi
12360     AC_SUBST(ILIB)
12363 dnl We should be able to drop the below check when bumping the GCC baseline to
12364 dnl 4.9, as <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54577>
12365 dnl "deque<T>::erase() still takes iterator instead of const_iterator" should be
12366 dnl fixed there with <https://gcc.gnu.org/git/?p=gcc.git;a=commit;
12367 dnl h=6b0e18ca48bb4b4c01e7b5be2b98849943fdcf91>:
12368 AC_MSG_CHECKING(
12369     [whether C++11 use of const_iterator in standard containers is broken])
12370 save_CXXFLAGS=$CXXFLAGS
12371 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12372 AC_LANG_PUSH([C++])
12373 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12374     #include <list>
12375     ]],[[
12376         std::list<int> l;
12377         l.erase(l.cbegin());
12378     ]])],
12379     [broken=no], [broken=yes])
12380 AC_LANG_POP([C++])
12381 CXXFLAGS=$save_CXXFLAGS
12382 AC_MSG_RESULT([$broken])
12383 if test "$broken" = yes; then
12384     AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
12388 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12389 save_CXXFLAGS=$CXXFLAGS
12390 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12391 save_LIBS=$LIBS
12392 if test -n "$ILIB1"; then
12393     LIBS="$LIBS $ILIB1"
12395 AC_LANG_PUSH([C++])
12396 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12397     // Exit with failure if the static initializer_list is stored on the
12398     // stack (as done by Clang < 3.4):
12399     #include <initializer_list>
12400     struct S {};
12401     bool g(void const * p1, void const * p2) {
12402         int n;
12403         return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12404     }
12405     bool f(void const * p1) {
12406         static std::initializer_list<S> s { S() };
12407         return g(p1, s.begin());
12408     }
12409     ]],[[
12410         int n;
12411         return f(&n) ? 0 : 1;
12412     ]])], [broken=no], [broken=yes],[broken='assuming not (cross-compiling)'])
12413 AC_LANG_POP([C++])
12414 LIBS=$save_LIBS
12415 CXXFLAGS=$save_CXXFLAGS
12416 AC_MSG_RESULT([$broken])
12417 if test "$broken" = yes -a "$_os" != "iOS"; then
12418     AC_MSG_ERROR([working support for static initializer_list needed])
12422 # ===================================================================
12423 # Creating bigger shared library to link against
12424 # ===================================================================
12425 AC_MSG_CHECKING([whether to create huge library])
12426 MERGELIBS=
12428 if test $_os = iOS -o $_os = Android; then
12429     # Never any point in mergelibs for these as we build just static
12430     # libraries anyway...
12431     enable_mergelibs=no
12434 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12435     if test $_os != Linux -a $_os != WINNT; then
12436         add_warning "--enable-mergelibs is not tested for this platform"
12437     fi
12438     MERGELIBS="TRUE"
12439     AC_MSG_RESULT([yes])
12440 else
12441     AC_MSG_RESULT([no])
12443 AC_SUBST([MERGELIBS])
12445 dnl ===================================================================
12446 dnl icerun is a wrapper that stops us spawning tens of processes
12447 dnl locally - for tools that can't be executed on the compile cluster
12448 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12449 dnl ===================================================================
12450 AC_MSG_CHECKING([whether to use icerun wrapper])
12451 ICECREAM_RUN=
12452 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12453     ICECREAM_RUN=icerun
12454     AC_MSG_RESULT([yes])
12455 else
12456     AC_MSG_RESULT([no])
12458 AC_SUBST(ICECREAM_RUN)
12460 dnl ===================================================================
12461 dnl Setup the ICECC_VERSION for the build the same way it was set for
12462 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12463 dnl ===================================================================
12464 x_ICECC_VERSION=[\#]
12465 if test -n "$ICECC_VERSION" ; then
12466     x_ICECC_VERSION=
12468 AC_SUBST(x_ICECC_VERSION)
12469 AC_SUBST(ICECC_VERSION)
12471 dnl ===================================================================
12473 AC_MSG_CHECKING([MPL subset])
12474 MPL_SUBSET=
12476 if test "$enable_mpl_subset" = "yes"; then
12477     warn_report=false
12478     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12479         warn_report=true
12480     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12481         warn_report=true
12482     fi
12483     if test "$warn_report" = "true"; then
12484         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12485     fi
12486     if test "x$enable_postgresql_sdbc" != "xno"; then
12487         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12488     fi
12489     if test "$enable_lotuswordpro" = "yes"; then
12490         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12491     fi
12492     if test "$WITH_WEBDAV" = "neon"; then
12493         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12494     fi
12495     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12496         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12497     fi
12498     if test -n "$ENABLE_PDFIMPORT"; then
12499         if test "x$SYSTEM_POPPLER" = "x"; then
12500             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12501         fi
12502     fi
12503     # cf. m4/libo_check_extension.m4
12504     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12505         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12506     fi
12507     for theme in $WITH_THEMES; do
12508         case $theme in
12509         breeze|breeze_dark|sifr|sifr_dark|elementary|karasa_jaga) #blacklist of icon themes under GPL or LGPL
12510             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12511         *) : ;;
12512         esac
12513     done
12515     ENABLE_OPENGL_TRANSITIONS=
12517     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12518         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12519     fi
12521     MPL_SUBSET="TRUE"
12522     AC_DEFINE(MPL_HAVE_SUBSET)
12523     AC_MSG_RESULT([only])
12524 else
12525     AC_MSG_RESULT([no restrictions])
12527 AC_SUBST(MPL_SUBSET)
12529 dnl ===================================================================
12531 AC_MSG_CHECKING([formula logger])
12532 ENABLE_FORMULA_LOGGER=
12534 if test "x$enable_formula_logger" = "xyes"; then
12535     AC_MSG_RESULT([yes])
12536     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12537     ENABLE_FORMULA_LOGGER=TRUE
12538 elif test -n "$ENABLE_DBGUTIL" ; then
12539     AC_MSG_RESULT([yes])
12540     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12541     ENABLE_FORMULA_LOGGER=TRUE
12542 else
12543     AC_MSG_RESULT([no])
12546 AC_SUBST(ENABLE_FORMULA_LOGGER)
12548 dnl ===================================================================
12549 dnl Setting up the environment.
12550 dnl ===================================================================
12551 AC_MSG_NOTICE([setting up the build environment variables...])
12553 AC_SUBST(COMPATH)
12555 if test "$build_os" = "cygwin"; then
12556     if test -d "$COMPATH/atlmfc/lib"; then
12557         ATL_LIB="$COMPATH/atlmfc/lib"
12558         ATL_INCLUDE="$COMPATH/atlmfc/include"
12559     else
12560         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12561         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12562     fi
12563     if test "$BITNESS_OVERRIDE" = 64; then
12564         if test $VCVER = "150"; then
12565             ATL_LIB="$ATL_LIB/x64"
12566         else
12567             ATL_LIB="$ATL_LIB/amd64"
12568         fi
12569     else
12570         if test $VCVER = "150"; then
12571             ATL_LIB="$ATL_LIB/x86"
12572         fi
12573     fi
12574     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12575     PathFormat "/usr/bin/find.exe"
12576     FIND="$formatted_path"
12577     PathFormat "/usr/bin/sort.exe"
12578     SORT="$formatted_path"
12579     PathFormat "/usr/bin/grep.exe"
12580     WIN_GREP="$formatted_path"
12581     PathFormat "/usr/bin/ls.exe"
12582     WIN_LS="$formatted_path"
12583     PathFormat "/usr/bin/touch.exe"
12584     WIN_TOUCH="$formatted_path"
12585 else
12586     FIND=find
12587     SORT=sort
12590 AC_SUBST(ATL_INCLUDE)
12591 AC_SUBST(ATL_LIB)
12592 AC_SUBST(FIND)
12593 AC_SUBST(SORT)
12594 AC_SUBST(WIN_GREP)
12595 AC_SUBST(WIN_LS)
12596 AC_SUBST(WIN_TOUCH)
12598 AC_SUBST(BUILD_TYPE)
12600 AC_SUBST(SOLARINC)
12602 PathFormat "$PERL"
12603 PERL="$formatted_path"
12604 AC_SUBST(PERL)
12606 if test -n "$TMPDIR"; then
12607     TEMP_DIRECTORY="$TMPDIR"
12608 else
12609     TEMP_DIRECTORY="/tmp"
12611 if test "$build_os" = "cygwin"; then
12612     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12614 AC_SUBST(TEMP_DIRECTORY)
12616 # setup the PATH for the environment
12617 if test -n "$LO_PATH_FOR_BUILD"; then
12618     LO_PATH="$LO_PATH_FOR_BUILD"
12619 else
12620     LO_PATH="$PATH"
12622     case "$host_os" in
12624     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12625         if test "$ENABLE_JAVA" != ""; then
12626             pathmunge "$JAVA_HOME/bin" "after"
12627         fi
12628         ;;
12630     cygwin*)
12631         # Win32 make needs native paths
12632         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12633             LO_PATH=`cygpath -p -m "$PATH"`
12634         fi
12635         if test "$BITNESS_OVERRIDE" = 64; then
12636             # needed for msi packaging
12637             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12638         fi
12639         # .NET 4.6 and higher don't have bin directory
12640         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12641             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12642         fi
12643         pathmunge "$ASM_HOME" "before"
12644         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12645         pathmunge "$CSC_PATH" "before"
12646         pathmunge "$MIDL_PATH" "before"
12647         pathmunge "$AL_PATH" "before"
12648         pathmunge "$MSPDB_PATH" "before"
12649         if test -n "$MSBUILD_PATH" ; then
12650             pathmunge "$MSBUILD_PATH" "before"
12651         fi
12652         if test "$BITNESS_OVERRIDE" = 64; then
12653             pathmunge "$COMPATH/bin/amd64" "before"
12654             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12655         else
12656             pathmunge "$COMPATH/bin" "before"
12657             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12658         fi
12659         if test "$ENABLE_JAVA" != ""; then
12660             if test -d "$JAVA_HOME/jre/bin/client"; then
12661                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12662             fi
12663             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12664                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12665             fi
12666             pathmunge "$JAVA_HOME/bin" "before"
12667         fi
12668         ;;
12670     solaris*)
12671         pathmunge "/usr/css/bin" "before"
12672         if test "$ENABLE_JAVA" != ""; then
12673             pathmunge "$JAVA_HOME/bin" "after"
12674         fi
12675         ;;
12676     esac
12679 AC_SUBST(LO_PATH)
12681 libo_FUZZ_SUMMARY
12683 # Generate a configuration sha256 we can use for deps
12684 if test -f config_host.mk; then
12685     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12687 if test -f config_host_lang.mk; then
12688     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12691 CFLAGS=$my_original_CFLAGS
12692 CXXFLAGS=$my_original_CXXFLAGS
12693 CPPFLAGS=$my_original_CPPFLAGS
12695 AC_CONFIG_FILES([config_host.mk
12696                  config_host_lang.mk
12697                  Makefile
12698                  lo.xcent
12699                  bin/bffvalidator.sh
12700                  bin/odfvalidator.sh
12701                  bin/officeotron.sh
12702                  instsetoo_native/util/openoffice.lst
12703                  sysui/desktop/macosx/Info.plist])
12704 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12705 AC_CONFIG_HEADERS([config_host/config_clang.h])
12706 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12707 AC_CONFIG_HEADERS([config_host/config_eot.h])
12708 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12709 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12710 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12711 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12712 AC_CONFIG_HEADERS([config_host/config_features.h])
12713 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12714 AC_CONFIG_HEADERS([config_host/config_folders.h])
12715 AC_CONFIG_HEADERS([config_host/config_gio.h])
12716 AC_CONFIG_HEADERS([config_host/config_global.h])
12717 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12718 AC_CONFIG_HEADERS([config_host/config_java.h])
12719 AC_CONFIG_HEADERS([config_host/config_langs.h])
12720 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12721 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12722 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12723 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
12724 AC_CONFIG_HEADERS([config_host/config_locales.h])
12725 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12726 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12727 AC_CONFIG_HEADERS([config_host/config_qt5.h])
12728 AC_CONFIG_HEADERS([config_host/config_kde5.h])
12729 AC_CONFIG_HEADERS([config_host/config_gtk3_kde5.h])
12730 AC_CONFIG_HEADERS([config_host/config_oox.h])
12731 AC_CONFIG_HEADERS([config_host/config_options.h])
12732 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12733 AC_CONFIG_HEADERS([config_host/config_test.h])
12734 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12735 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12736 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12737 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12738 AC_CONFIG_HEADERS([config_host/config_version.h])
12739 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12740 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12741 AC_CONFIG_HEADERS([config_host/config_python.h])
12742 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12743 AC_OUTPUT
12745 if test "$CROSS_COMPILING" = TRUE; then
12746     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12749 # touch the config timestamp file
12750 if test ! -f config_host.mk.stamp; then
12751     echo > config_host.mk.stamp
12752 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12753     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12754 else
12755     echo > config_host.mk.stamp
12758 # touch the config lang timestamp file
12759 if test ! -f config_host_lang.mk.stamp; then
12760     echo > config_host_lang.mk.stamp
12761 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12762     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12763 else
12764     echo > config_host_lang.mk.stamp
12768 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12770 cat << _EOS
12771 ****************************************************************************
12772 WARNING:
12773 Your make version is known to be horribly slow, and hard to debug
12774 problems with. To get a reasonably functional make please do:
12776 to install a pre-compiled binary make for Win32
12778  mkdir -p /opt/lo/bin
12779  cd /opt/lo/bin
12780  wget https://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
12781  cp make-85047eb-msvc.exe make
12782  chmod +x make
12784 to install from source:
12785 place yourself in a working directory of you choice.
12787  git clone git://git.savannah.gnu.org/make.git
12789  [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"]
12790  set PATH=%PATH%;C:\Cygwin\bin
12791  [or Cygwin64, if that is what you have]
12792  cd path-to-make-repo-you-cloned-above
12793  build_w32.bat --without-guile
12795 should result in a WinRel/gnumake.exe.
12796 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12798 Then re-run autogen.sh
12800 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12801 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12803 _EOS
12806 cat << _EOF
12807 ****************************************************************************
12809 To build, run:
12810 $GNUMAKE
12812 To view some help, run:
12813 $GNUMAKE help
12815 _EOF
12817 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12818     cat << _EOF
12819 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12820 _EOF
12822     if test $_os = Darwin; then
12823         echo open instdir/$PRODUCTNAME.app
12824     else
12825         echo instdir/program/soffice
12826     fi
12827     cat << _EOF
12829 If you want to run the smoketest, run:
12830 $GNUMAKE check
12832 _EOF
12835 if test -f warn; then
12836     cat warn
12837     rm warn
12840 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: