tdf#119052: hide edit style button in character style
[LibreOffice.git] / configure.ac
blob9a0c2c3083e385b73efa9789d59778988a9e1de8
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 102 -*-
2 dnl configure.ac serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 # The version number in the second argument to AC_INIT should be four numbers separated by
6 # periods. Some parts of the code requires the first one to be less than 128 and the others to be less
7 # than 256. The four numbers can optionally be followed by a period and a free-form string containing
8 # no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
9 # several non-alphanumeric characters, those are split off and used only for the
10 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
12 AC_INIT([LibreOffice],[6.2.0.0.alpha0+],[],[],[http://documentfoundation.org/])
14 AC_PREREQ([2.59])
16 if test -n "$BUILD_TYPE"; then
17     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
20 save_CC=$CC
21 save_CXX=$CXX
23 BUILD_TYPE="LibO"
24 SCPDEFS=""
25 GIT_NEEDED_SUBMODULES=""
26 LO_PATH= # used by path_munge to construct a PATH variable
28 FilterLibs()
30     filteredlibs=
31     for f in $1; do
32         case "$f" in
33             # let's start with Fedora's paths for now
34             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
35                 # ignore it: on UNIXoids it is searched by default anyway
36                 # but if it's given explicitly then it may override other paths
37                 # (on Mac OS X it would be an error to use it instead of SDK)
38                 ;;
39             *)
40                 filteredlibs="$filteredlibs $f"
41                 ;;
42         esac
43     done
46 PathFormat()
48     formatted_path="$1"
49     if test "$build_os" = "cygwin"; then
50         pf_conv_to_dos=
51         # spaces,parentheses,brackets,braces are problematic in pathname
52         # so are backslashes
53         case "$formatted_path" in
54             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
55                 pf_conv_to_dos="yes"
56             ;;
57         esac
58         if test "$pf_conv_to_dos" = "yes"; then
59             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
60                 formatted_path=`cygpath -sm "$formatted_path"`
61             else
62                 formatted_path=`cygpath -d "$formatted_path"`
63             fi
64             if test $? -ne 0;  then
65                 AC_MSG_ERROR([path conversion failed for "$1".])
66             fi
67         fi
68         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
69         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
70         if test "$fp_count_slash$fp_count_colon" != "00"; then
71             if test "$fp_count_colon" = "0"; then
72                 new_formatted_path=`realpath "$formatted_path"`
73                 if test $? -ne 0;  then
74                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
75                 else
76                     formatted_path="$new_formatted_path"
77                 fi
78             fi
79             formatted_path=`cygpath -m "$formatted_path"`
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
85         if test "$fp_count_space" != "0"; then
86             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
87         fi
88     fi
91 AbsolutePath()
93     # There appears to be no simple and portable method to get an absolute and
94     # canonical path, so we try creating the directory if does not exist and
95     # utilizing the shell and pwd.
96     rel="$1"
97     absolute_path=""
98     test ! -e "$rel" && mkdir -p "$rel"
99     if test -d "$rel" ; then
100         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
101         absolute_path="$(pwd)"
102         cd - > /dev/null
103     else
104         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
105     fi
108 rm -f warn
109 have_WARNINGS="no"
110 add_warning()
112     if test "$have_WARNINGS" = "no"; then
113         echo "*************************************" > warn
114         have_WARNINGS="yes"
115         if which tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
116             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
117             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
118         else
119             COLORWARN="* WARNING :"
120         fi
121     fi
122     echo "$COLORWARN $@" >> warn
125 dnl Some Mac User have the bad habbit of letting a lot fo crap
126 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
127 dnl that confuse the build.
128 dnl For the ones that use LODE, let's be nice and protect them
129 dnl from themselves
131 mac_sanitize_path()
133     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
134 dnl a common but nevertheless necessary thing that may be in a fancy
135 dnl path location is git, so make sure we have it
136     mac_git_path=`which git 2>/dev/null`
137     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
138         mac_path="$mac_path:`dirname $mac_git_path`"
139     fi
140 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
141 dnl path location is gpg, so make sure we find it
142     mac_gpg_path=`which gpg 2>/dev/null`
143     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
144         mac_path="$mac_path:`dirname $mac_gpg_path`"
145     fi
146     PATH="$mac_path"
147     unset mac_path
148     unset mac_git_path
149     unset mac_gpg_path
152 echo "********************************************************************"
153 echo "*"
154 echo "*   Running ${PACKAGE_NAME} build configuration."
155 echo "*"
156 echo "********************************************************************"
157 echo ""
159 dnl ===================================================================
160 dnl checks build and host OSes
161 dnl do this before argument processing to allow for platform dependent defaults
162 dnl ===================================================================
163 AC_CANONICAL_HOST
165 AC_MSG_CHECKING([for product name])
166 PRODUCTNAME="AC_PACKAGE_NAME"
167 if test -n "$with_product_name" -a "$with_product_name" != no; then
168     PRODUCTNAME="$with_product_name"
170 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
171     PRODUCTNAME="${PRODUCTNAME}Dev"
173 AC_MSG_RESULT([$PRODUCTNAME])
174 AC_SUBST(PRODUCTNAME)
175 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
176 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
178 dnl ===================================================================
179 dnl Our version is defined by the AC_INIT() at the top of this script.
180 dnl ===================================================================
182 AC_MSG_CHECKING([for package version])
183 if test -n "$with_package_version" -a "$with_package_version" != no; then
184     PACKAGE_VERSION="$with_package_version"
186 AC_MSG_RESULT([$PACKAGE_VERSION])
188 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
190 LIBO_VERSION_MAJOR=$1
191 LIBO_VERSION_MINOR=$2
192 LIBO_VERSION_MICRO=$3
193 LIBO_VERSION_PATCH=$4
195 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
196 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
197 # no way to encode that into an integer in general.
198 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
200 LIBO_VERSION_SUFFIX=$5
201 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
202 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
203 # they get undoubled before actually passed to sed.
204 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
205 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
206 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
207 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
209 AC_SUBST(LIBO_VERSION_MAJOR)
210 AC_SUBST(LIBO_VERSION_MINOR)
211 AC_SUBST(LIBO_VERSION_MICRO)
212 AC_SUBST(LIBO_VERSION_PATCH)
213 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
214 AC_SUBST(LIBO_VERSION_SUFFIX)
215 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
217 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
218 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
219 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
220 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
222 LIBO_THIS_YEAR=`date +%Y`
223 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
225 dnl ===================================================================
226 dnl Product version
227 dnl ===================================================================
228 AC_MSG_CHECKING([for product version])
229 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
230 AC_MSG_RESULT([$PRODUCTVERSION])
231 AC_SUBST(PRODUCTVERSION)
233 AC_PROG_EGREP
234 # AC_PROG_EGREP doesn't set GREP on all systems as well
235 AC_PATH_PROG(GREP, grep)
237 BUILDDIR=`pwd`
238 cd $srcdir
239 SRC_ROOT=`pwd`
240 cd $BUILDDIR
241 x_Cygwin=[\#]
243 dnl ======================================
244 dnl Required GObject introspection version
245 dnl ======================================
246 INTROSPECTION_REQUIRED_VERSION=1.32.0
248 dnl ===================================================================
249 dnl Search all the common names for GNU Make
250 dnl ===================================================================
251 AC_MSG_CHECKING([for GNU Make])
253 # try to use our own make if it is available and GNUMAKE was not already defined
254 if test -z "$GNUMAKE"; then
255     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
256         GNUMAKE="$LODE_HOME/opt/bin/make"
257     elif test -x "/opt/lo/bin/make"; then
258         GNUMAKE="/opt/lo/bin/make"
259     fi
262 GNUMAKE_WIN_NATIVE=
263 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
264     if test -n "$a"; then
265         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
266         if test $? -eq 0;  then
267             if test "$build_os" = "cygwin"; then
268                 if test -n "$($a -v | grep 'Built for Windows')" ; then
269                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
270                     GNUMAKE_WIN_NATIVE="TRUE"
271                 else
272                     GNUMAKE=`which $a`
273                 fi
274             else
275                 GNUMAKE=`which $a`
276             fi
277             break
278         fi
279     fi
280 done
281 AC_MSG_RESULT($GNUMAKE)
282 if test -z "$GNUMAKE"; then
283     AC_MSG_ERROR([not found. install GNU Make.])
284 else
285     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
286         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
287     fi
290 win_short_path_for_make()
292     local_short_path="$1"
293     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
294         cygpath -sm "$local_short_path"
295     else
296         cygpath -u "$(cygpath -d "$local_short_path")"
297     fi
301 if test "$build_os" = "cygwin"; then
302     PathFormat "$SRC_ROOT"
303     SRC_ROOT="$formatted_path"
304     PathFormat "$BUILDDIR"
305     BUILDDIR="$formatted_path"
306     x_Cygwin=
307     AC_MSG_CHECKING(for explicit COMSPEC)
308     if test -z "$COMSPEC"; then
309         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
310     else
311         AC_MSG_RESULT([found: $COMSPEC])
312     fi
315 AC_SUBST(SRC_ROOT)
316 AC_SUBST(BUILDDIR)
317 AC_SUBST(x_Cygwin)
318 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
319 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
321 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
322     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
325 # need sed in os checks...
326 AC_PATH_PROGS(SED, sed)
327 if test -z "$SED"; then
328     AC_MSG_ERROR([install sed to run this script])
331 # Set the ENABLE_LTO variable
332 # ===================================================================
333 AC_MSG_CHECKING([whether to use link-time optimization])
334 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
335     ENABLE_LTO="TRUE"
336     AC_MSG_RESULT([yes])
337     AC_DEFINE(STATIC_LINKING)
338 else
339     ENABLE_LTO=""
340     AC_MSG_RESULT([no])
342 AC_SUBST(ENABLE_LTO)
344 AC_ARG_ENABLE(fuzz-options,
345     AS_HELP_STRING([--enable-fuzz-options],
346         [Randomly enable or disable each of those configurable options
347          that are supposed to be freely selectable without interdependencies,
348          or where bad interaction from interdependencies is automatically avoided.])
351 dnl ===================================================================
352 dnl When building for Android, --with-android-ndk,
353 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
354 dnl mandatory
355 dnl ===================================================================
357 AC_ARG_WITH(android-ndk,
358     AS_HELP_STRING([--with-android-ndk],
359         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
362 AC_ARG_WITH(android-ndk-toolchain-version,
363     AS_HELP_STRING([--with-android-ndk-toolchain-version],
364         [Specify which toolchain version to use, of those present in the
365         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
366         with_android_ndk_toolchain_version=clang5.0)
368 AC_ARG_WITH(android-sdk,
369     AS_HELP_STRING([--with-android-sdk],
370         [Specify location of the Android SDK. Mandatory when building for Android.]),
373 ANDROID_NDK_HOME=
374 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
375     with_android_ndk="$SRC_ROOT/external/android-ndk"
377 if test -n "$with_android_ndk"; then
378     ANDROID_NDK_HOME=$with_android_ndk
380     # Set up a lot of pre-canned defaults
382     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
383         if test ! -f $ANDROID_NDK_HOME/source.properties; then
384             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
385         fi
386         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
387     else
388         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
389     fi
390     if test -z "$ANDROID_NDK_VERSION";  then
391         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
392     fi
393     case $ANDROID_NDK_VERSION in
394     r9*|r10*)
395         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
396         ;;
397     11.1.*|12.1.*|13.1.*|14.1.*)
398         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
399         ;;
400     16.*)
401         ;;
402     *)
403         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk.])
404         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk."
405         ;;
406     esac
408     ANDROID_API_LEVEL=14
409     android_cpu=$host_cpu
410     ANDROID_ARCH=$android_cpu
411     if test $host_cpu = arm; then
412         android_platform_prefix=$android_cpu-linux-androideabi
413         android_gnu_prefix=$android_platform_prefix
414         LLVM_TRIPLE=armv7-none-linux-androideabi
415         ANDROID_APP_ABI=armeabi-v7a
416         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
417     elif test $host_cpu = aarch64; then
418         android_platform_prefix=$android_cpu-linux-android
419         android_gnu_prefix=$android_platform_prefix
420         LLVM_TRIPLE=aarch64-none-linux-android
421         # minimum android version that supports aarch64
422         ANDROID_API_LEVEL=21
423         ANDROID_APP_ABI=arm64-v8a
424         ANDROID_ARCH=arm64
425     elif test $host_cpu = mips; then
426         android_platform_prefix=mipsel-linux-android
427         android_gnu_prefix=$android_platform_prefix
428         LLVM_TRIPLE=mipsel-none-linux-android
429         ANDROID_APP_ABI=mips
430     else
431         # host_cpu is something like "i386" or "i686" I guess, NDK uses
432         # "x86" in some contexts
433         android_cpu=x86
434         android_platform_prefix=$android_cpu
435         android_gnu_prefix=i686-linux-android
436         LLVM_TRIPLE=i686-none-linux-android
437         ANDROID_APP_ABI=x86
438         ANDROID_ARCH=$android_cpu
439         ANDROIDCFLAGS="-march=atom"
440     fi
442     case "$with_android_ndk_toolchain_version" in
443     clang5.0)
444         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
445         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION
446         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm
447         ;;
448     *)
449         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
450     esac
452     if test ! -d $ANDROID_BINUTILS_DIR; then
453         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
454     elif test ! -d $ANDROID_COMPILER_DIR; then
455         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
456     fi
458     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
459     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
460     # manage to link the (app-specific) single huge .so that is built for the app in
461     # android/source/ if there is debug information in a significant part of the object files.
462     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
463     # all objects have been built with debug information.)
464     case $build_os in
465     linux-gnu*)
466         ndk_build_os=linux
467         ;;
468     darwin*)
469         ndk_build_os=darwin
470         ;;
471     *)
472         AC_MSG_ERROR([We only support building for Android from Linux or OS X])
473         ;;
474     esac
475     ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
476     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
477     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
479     test -z "$SYSBASE" && SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
480     test -z "$AR" && AR=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ar
481     test -z "$NM" && NM=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-nm
482     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-objdump
483     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ranlib
484     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-strip
486     ANDROIDCFLAGS="$ANDROIDCFLAGS -gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT -target $LLVM_TRIPLE$ANDROID_API_LEVEL -no-canonical-prefixes"
487     # android is using different sysroots for compilation and linking, but as
488     # there is no full separation in configure and elsewhere, use isystem for
489     # compilation stuff and sysroot for linking
490     ANDROIDCFLAGS="$ANDROIDCFLAGS -D__ANDROID_API__=$ANDROID_API_LEVEL -isystem $ANDROID_NDK_HOME/sysroot/usr/include"
491     ANDROIDCFLAGS="$ANDROIDCFLAGS -isystem $ANDROID_NDK_HOME/sysroot/usr/include/$android_gnu_prefix"
492     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$SYSBASE -ffunction-sections -fdata-sections -Qunused-arguments"
493     if test "$ANDROID_APP_ABI" = "armeabi-v7a"; then
494     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/libs/$ANDROID_APP_ABI -D_GTHREAD_USE_MUTEX_INIT_FUNC=1"
495     else
496     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/libs/$ANDROID_APP_ABI"
497     fi
498     if test "$ENABLE_LTO" = TRUE; then
499         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
500         # $CC and $CXX when building external libraries
501         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
502     fi
504     if test "$ANDROID_APP_ABI" = "armeabi-v7a"; then
505     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"
506     else
507     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"
508     fi
510     if test -z "$CC"; then
511         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
512     fi
513     if test -z "$CXX"; then
514         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
515     fi
517     # remember to download the ownCloud Android library later
518     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
520 AC_SUBST(ANDROID_NDK_HOME)
521 AC_SUBST(ANDROID_APP_ABI)
522 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
524 dnl ===================================================================
525 dnl --with-android-sdk
526 dnl ===================================================================
527 ANDROID_SDK_HOME=
528 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
529     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
531 if test -n "$with_android_sdk"; then
532     ANDROID_SDK_HOME=$with_android_sdk
533     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
535 AC_SUBST(ANDROID_SDK_HOME)
537 dnl ===================================================================
538 dnl The following is a list of supported systems.
539 dnl Sequential to keep the logic very simple
540 dnl These values may be checked and reset later.
541 dnl ===================================================================
542 #defaults unless the os test overrides this:
543 test_randr=yes
544 test_xrender=yes
545 test_cups=yes
546 test_dbus=yes
547 test_fontconfig=yes
548 test_cairo=no
550 # Default values, as such probably valid just for Linux, set
551 # differently below just for Mac OSX,but at least better than
552 # hardcoding these as we used to do. Much of this is duplicated also
553 # in solenv for old build system and for gbuild, ideally we should
554 # perhaps define stuff like this only here in configure.ac?
556 LINKFLAGSSHL="-shared"
557 PICSWITCH="-fpic"
558 DLLPOST=".so"
560 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
562 INSTROOTBASESUFFIX=
563 INSTROOTCONTENTSUFFIX=
564 SDKDIRNAME=sdk
566 case "$host_os" in
568 solaris*)
569     test_gtk=yes
570     build_gstreamer_1_0=yes
571     build_gstreamer_0_10=yes
572     test_freetype=yes
573     _os=SunOS
575     dnl ===========================================================
576     dnl Check whether we're using Solaris 10 - SPARC or Intel.
577     dnl ===========================================================
578     AC_MSG_CHECKING([the Solaris operating system release])
579     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
580     if test "$_os_release" -lt "10"; then
581         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
582     else
583         AC_MSG_RESULT([ok ($_os_release)])
584     fi
586     dnl Check whether we're using a SPARC or i386 processor
587     AC_MSG_CHECKING([the processor type])
588     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
589         AC_MSG_RESULT([ok ($host_cpu)])
590     else
591         AC_MSG_ERROR([only SPARC and i386 processors are supported])
592     fi
593     ;;
595 linux-gnu*|k*bsd*-gnu*)
596     test_gtk=yes
597     build_gstreamer_1_0=yes
598     build_gstreamer_0_10=yes
599     test_kde4=yes
600     test_kde5=yes
601     test_qt5=yes
602     test_gtk3_kde5=yes
603     if test "$enable_fuzzers" != yes; then
604         test_freetype=yes
605         test_fontconfig=yes
606     else
607         test_freetype=no
608         test_fontconfig=no
609         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
610     fi
611     _os=Linux
612     ;;
614 gnu)
615     test_randr=no
616     test_xrender=no
617     _os=GNU
618      ;;
620 cygwin*|interix*)
622     # When building on Windows normally with MSVC under Cygwin,
623     # configure thinks that the host platform (the platform the
624     # built code will run on) is Cygwin, even if it obviously is
625     # Windows, which in Autoconf terminology is called
626     # "mingw32". (Which is misleading as MinGW is the name of the
627     # tool-chain, not an operating system.)
629     # Somewhat confusing, yes. But this configure script doesn't
630     # look at $host etc that much, it mostly uses its own $_os
631     # variable, set here in this case statement.
633     test_cups=no
634     test_dbus=no
635     test_randr=no
636     test_xrender=no
637     test_freetype=no
638     test_fontconfig=no
639     _os=WINNT
641     DLLPOST=".dll"
642     LINKFLAGSNOUNDEFS=
643     ;;
645 darwin*) # Mac OS X or iOS
646     test_gtk=yes
647     test_randr=no
648     test_xrender=no
649     test_freetype=no
650     test_fontconfig=no
651     test_dbus=no
652     if test -n "$LODE_HOME" ; then
653         mac_sanitize_path
654         AC_MSG_NOTICE([sanitized the PATH to $PATH])
655     fi
656     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
657         build_for_ios=YES
658         _os=iOS
659         test_gtk=no
660         test_cups=no
661         enable_mpl_subset=yes
662         enable_lotuswordpro=no
663         enable_coinmp=no
664         enable_lpsolve=no
665         enable_postgresql_sdbc=no
666         enable_extension_integration=no
667         enable_report_builder=no
668         with_theme="tango"
669         with_ppds=no
670         if test "$enable_ios_simulator" = "yes"; then
671             host=x86_64-apple-darwin
672         fi
673     else
674         _os=Darwin
675         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
676         INSTROOTCONTENTSUFFIX=/Contents
677         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
678     fi
679     # See comment above the case "$host_os"
680     LINKFLAGSSHL="-dynamiclib -single_module"
682     # -fPIC is default
683     PICSWITCH=""
685     DLLPOST=".dylib"
687     # -undefined error is the default
688     LINKFLAGSNOUNDEFS=""
691 freebsd*)
692     test_gtk=yes
693     build_gstreamer_1_0=yes
694     build_gstreamer_0_10=yes
695     test_kde4=yes
696     test_kde5=yes
697     test_qt5=yes
698     test_gtk3_kde5=yes
699     test_freetype=yes
700     AC_MSG_CHECKING([the FreeBSD operating system release])
701     if test -n "$with_os_version"; then
702         OSVERSION="$with_os_version"
703     else
704         OSVERSION=`/sbin/sysctl -n kern.osreldate`
705     fi
706     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
707     AC_MSG_CHECKING([which thread library to use])
708     if test "$OSVERSION" -lt "500016"; then
709         PTHREAD_CFLAGS="-D_THREAD_SAFE"
710         PTHREAD_LIBS="-pthread"
711     elif test "$OSVERSION" -lt "502102"; then
712         PTHREAD_CFLAGS="-D_THREAD_SAFE"
713         PTHREAD_LIBS="-lc_r"
714     else
715         PTHREAD_CFLAGS=""
716         PTHREAD_LIBS="-pthread"
717     fi
718     AC_MSG_RESULT([$PTHREAD_LIBS])
719     _os=FreeBSD
720     ;;
722 *netbsd*)
723     test_gtk=yes
724     build_gstreamer_1_0=yes
725     build_gstreamer_0_10=yes
726     test_kde4=yes
727     test_kde5=yes
728     test_qt5=yes
729     test_gtk3_kde5=yes
730     test_freetype=yes
731     PTHREAD_LIBS="-pthread -lpthread"
732     _os=NetBSD
733     ;;
735 aix*)
736     test_randr=no
737     test_freetype=yes
738     PTHREAD_LIBS=-pthread
739     _os=AIX
740     ;;
742 openbsd*)
743     test_gtk=yes
744     test_freetype=yes
745     PTHREAD_CFLAGS="-D_THREAD_SAFE"
746     PTHREAD_LIBS="-pthread"
747     _os=OpenBSD
748     ;;
750 dragonfly*)
751     test_gtk=yes
752     build_gstreamer_1_0=yes
753     build_gstreamer_0_10=yes
754     test_kde4=yes
755     test_kde5=yes
756     test_qt5=yes
757     test_gtk3_kde5=yes
758     test_freetype=yes
759     PTHREAD_LIBS="-pthread"
760     _os=DragonFly
761     ;;
763 linux-android*)
764     build_gstreamer_1_0=no
765     build_gstreamer_0_10=no
766     enable_lotuswordpro=no
767     enable_mpl_subset=yes
768     enable_coinmp=yes
769     enable_lpsolve=no
770     enable_report_builder=no
771     enable_odk=no
772     enable_postgresql_sdbc=no
773     enable_python=no
774     with_theme="tango"
775     test_cups=no
776     test_dbus=no
777     test_fontconfig=no
778     test_freetype=no
779     test_gtk=no
780     test_kde4=no
781     test_kde5=no
782     test_qt5=no
783     test_gtk3_kde5=no
784     test_randr=no
785     test_xrender=no
786     _os=Android
788     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
789     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
790     ;;
792 haiku*)
793     test_cups=no
794     test_dbus=no
795     test_randr=no
796     test_xrender=no
797     test_freetype=yes
798     enable_java=no
799     enable_opengl=no
800     enable_odk=no
801     enable_gconf=no
802     enable_gnome_vfs=no
803     enable_gstreamer=no
804     enable_vlc=no
805     enable_gltf=no
806     enable_collada=no
807     enable_coinmp=no
808     enable_pdfium=no
809     enable_postgresql_sdbc=no
810     enable_firebird_sdbc=no
811     _os=Haiku
812     ;;
815     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
816     ;;
817 esac
819 if test "$_os" = "Android" ; then
820     # Verify that the NDK and SDK options are proper
821     if test -z "$with_android_ndk"; then
822         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
823     elif test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
824         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
825     fi
827     if test -z "$ANDROID_SDK_HOME"; then
828         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
829     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
830         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
831     fi
833     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
834     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
835         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
836                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
837                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
838         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
839         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
840         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
841     fi
842     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
843         AC_MSG_WARN([android support repository not found - install with
844                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
845                      to allow the build to download the specified version of the android support libraries])
846         add_warning "android support repository not found - install with"
847         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
848         add_warning "to allow the build to download the specified version of the android support libraries"
849     fi
852 if test "$_os" = "AIX"; then
853     AC_PATH_PROG(GAWK, gawk)
854     if test -z "$GAWK"; then
855         AC_MSG_ERROR([gawk not found in \$PATH])
856     fi
859 AC_SUBST(SDKDIRNAME)
861 AC_SUBST(PTHREAD_CFLAGS)
862 AC_SUBST(PTHREAD_LIBS)
864 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
865 # By default use the ones specified by our build system,
866 # but explicit override is possible.
867 AC_MSG_CHECKING(for explicit AFLAGS)
868 if test -n "$AFLAGS"; then
869     AC_MSG_RESULT([$AFLAGS])
870     x_AFLAGS=
871 else
872     AC_MSG_RESULT(no)
873     x_AFLAGS=[\#]
875 AC_MSG_CHECKING(for explicit CFLAGS)
876 if test -n "$CFLAGS"; then
877     AC_MSG_RESULT([$CFLAGS])
878     x_CFLAGS=
879 else
880     AC_MSG_RESULT(no)
881     x_CFLAGS=[\#]
883 AC_MSG_CHECKING(for explicit CXXFLAGS)
884 if test -n "$CXXFLAGS"; then
885     AC_MSG_RESULT([$CXXFLAGS])
886     x_CXXFLAGS=
887 else
888     AC_MSG_RESULT(no)
889     x_CXXFLAGS=[\#]
891 AC_MSG_CHECKING(for explicit OBJCFLAGS)
892 if test -n "$OBJCFLAGS"; then
893     AC_MSG_RESULT([$OBJCFLAGS])
894     x_OBJCFLAGS=
895 else
896     AC_MSG_RESULT(no)
897     x_OBJCFLAGS=[\#]
899 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
900 if test -n "$OBJCXXFLAGS"; then
901     AC_MSG_RESULT([$OBJCXXFLAGS])
902     x_OBJCXXFLAGS=
903 else
904     AC_MSG_RESULT(no)
905     x_OBJCXXFLAGS=[\#]
907 AC_MSG_CHECKING(for explicit LDFLAGS)
908 if test -n "$LDFLAGS"; then
909     AC_MSG_RESULT([$LDFLAGS])
910     x_LDFLAGS=
911 else
912     AC_MSG_RESULT(no)
913     x_LDFLAGS=[\#]
915 AC_SUBST(AFLAGS)
916 AC_SUBST(CFLAGS)
917 AC_SUBST(CXXFLAGS)
918 AC_SUBST(OBJCFLAGS)
919 AC_SUBST(OBJCXXFLAGS)
920 AC_SUBST(LDFLAGS)
921 AC_SUBST(x_AFLAGS)
922 AC_SUBST(x_CFLAGS)
923 AC_SUBST(x_CXXFLAGS)
924 AC_SUBST(x_OBJCFLAGS)
925 AC_SUBST(x_OBJCXXFLAGS)
926 AC_SUBST(x_LDFLAGS)
928 dnl These are potentially set for MSVC, in the code checking for UCRT below:
929 my_original_CFLAGS=$CFLAGS
930 my_original_CXXFLAGS=$CXXFLAGS
931 my_original_CPPFLAGS=$CPPFLAGS
933 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
934 dnl Needs to precede the AC_SEARCH_LIBS call below, which apparently calls
935 dnl AC_PROG_CC internally.
936 if test "$_os" != "WINNT"; then
937     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
938     save_CFLAGS=$CFLAGS
939     AC_PROG_CC
940     CFLAGS=$save_CFLAGS
943 if test $_os != "WINNT"; then
944     save_LIBS="$LIBS"
945     AC_SEARCH_LIBS([dlsym], [dl],
946         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
947         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
948     LIBS="$save_LIBS"
950 AC_SUBST(DLOPEN_LIBS)
952 ###############################################################################
953 # Extensions switches --enable/--disable
954 ###############################################################################
955 # By default these should be enabled unless having extra dependencies.
956 # If there is extra dependency over configure options then the enable should
957 # be automagic based on whether the requiring feature is enabled or not.
958 # All this options change anything only with --enable-extension-integration.
960 # The name of this option and its help string makes it sound as if
961 # extensions are built anyway, just not integrated in the installer,
962 # if you use --disable-extension-integration. Is that really the
963 # case?
965 AC_ARG_ENABLE(ios-simulator,
966     AS_HELP_STRING([--enable-ios-simulator],
967         [build i386 or x86_64 for ios simulator])
970 libo_FUZZ_ARG_ENABLE(extension-integration,
971     AS_HELP_STRING([--disable-extension-integration],
972         [Disable integration of the built extensions in the installer of the
973          product. Use this switch to disable the integration.])
976 AC_ARG_ENABLE(avmedia,
977     AS_HELP_STRING([--disable-avmedia],
978         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
981 AC_ARG_ENABLE(database-connectivity,
982     AS_HELP_STRING([--disable-database-connectivity],
983         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
986 # This doesn't mean not building (or "integrating") extensions
987 # (although it probably should; i.e. it should imply
988 # --disable-extension-integration I guess), it means not supporting
989 # any extension mechanism at all
990 libo_FUZZ_ARG_ENABLE(extensions,
991     AS_HELP_STRING([--disable-extensions],
992         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
995 AC_ARG_ENABLE(scripting,
996     AS_HELP_STRING([--disable-scripting],
997         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1000 # This is mainly for Android and iOS, but could potentially be used in some
1001 # special case otherwise, too, so factored out as a separate setting
1003 AC_ARG_ENABLE(dynamic-loading,
1004     AS_HELP_STRING([--disable-dynamic-loading],
1005         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1008 libo_FUZZ_ARG_ENABLE(ext-mariadb-connector,
1009     AS_HELP_STRING([--enable-ext-mariadb-connector],
1010         [Enable the build of the MariaDB/MySQL Connector extension.])
1013 libo_FUZZ_ARG_ENABLE(report-builder,
1014     AS_HELP_STRING([--disable-report-builder],
1015         [Disable the Report Builder.])
1018 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1019     AS_HELP_STRING([--enable-ext-wiki-publisher],
1020         [Enable the Wiki Publisher extension.])
1023 libo_FUZZ_ARG_ENABLE(lpsolve,
1024     AS_HELP_STRING([--disable-lpsolve],
1025         [Disable compilation of the lp solve solver ])
1027 libo_FUZZ_ARG_ENABLE(coinmp,
1028     AS_HELP_STRING([--disable-coinmp],
1029         [Disable compilation of the CoinMP solver ])
1032 libo_FUZZ_ARG_ENABLE(pdfimport,
1033     AS_HELP_STRING([--disable-pdfimport],
1034         [Disable building the PDF import feature.])
1037 libo_FUZZ_ARG_ENABLE(pdfium,
1038     AS_HELP_STRING([--disable-pdfium],
1039         [Disable building PDFium.])
1042 ###############################################################################
1044 dnl ---------- *** ----------
1046 libo_FUZZ_ARG_ENABLE(mergelibs,
1047     AS_HELP_STRING([--enable-mergelibs],
1048         [Merge several of the smaller libraries into one big, "merged", one.])
1051 libo_FUZZ_ARG_ENABLE(breakpad,
1052     AS_HELP_STRING([--enable-breakpad],
1053         [Enables breakpad for crash reporting.])
1056 AC_ARG_ENABLE(fetch-external,
1057     AS_HELP_STRING([--disable-fetch-external],
1058         [Disables fetching external tarballs from web sources.])
1061 AC_ARG_ENABLE(fuzzers,
1062     AS_HELP_STRING([--enable-fuzzers],
1063         [Enables building libfuzzer targets for fuzz testing.])
1066 libo_FUZZ_ARG_ENABLE(pch,
1067     AS_HELP_STRING([--enable-pch],
1068         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1071 libo_FUZZ_ARG_ENABLE(epm,
1072     AS_HELP_STRING([--enable-epm],
1073         [LibreOffice includes self-packaging code, that requires epm, however epm is
1074          useless for large scale package building.])
1077 libo_FUZZ_ARG_ENABLE(odk,
1078     AS_HELP_STRING([--disable-odk],
1079         [LibreOffice includes an ODK, office development kit which some packagers may
1080          wish to build without.])
1083 AC_ARG_ENABLE(mpl-subset,
1084     AS_HELP_STRING([--enable-mpl-subset],
1085         [Don't compile any pieces which are not MPL or more liberally licensed])
1088 libo_FUZZ_ARG_ENABLE(evolution2,
1089     AS_HELP_STRING([--enable-evolution2],
1090         [Allows the built-in evolution 2 addressbook connectivity build to be
1091          enabled.])
1094 AC_ARG_ENABLE(avahi,
1095     AS_HELP_STRING([--enable-avahi],
1096         [Determines whether to use Avahi to advertise Impress to remote controls.])
1099 libo_FUZZ_ARG_ENABLE(werror,
1100     AS_HELP_STRING([--enable-werror],
1101         [Turn warnings to errors. (Has no effect in modules where the treating
1102          of warnings as errors is disabled explicitly.)]),
1105 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1106     AS_HELP_STRING([--enable-assert-always-abort],
1107         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1110 libo_FUZZ_ARG_ENABLE(dbgutil,
1111     AS_HELP_STRING([--enable-dbgutil],
1112         [Provide debugging support from --enable-debug and include additional debugging
1113          utilities such as object counting or more expensive checks.
1114          This is the recommended option for developers.
1115          Note that this makes the build ABI incompatible, it is not possible to mix object
1116          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1118 libo_FUZZ_ARG_ENABLE(debug,
1119     AS_HELP_STRING([--enable-debug],
1120         [Include debugging information, disable compiler optimization and inlining plus
1121          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1123 libo_FUZZ_ARG_ENABLE(split-debug,
1124     AS_HELP_STRING([--enable-split-debug],
1125         [Uses split debug information (-gsplit-dwarf compile flag). Saves disk space and build time,
1126          but requires tools that support it (both build tools and debuggers).]))
1128 libo_FUZZ_ARG_ENABLE(gdb-index,
1129     AS_HELP_STRING([--enable-gdb-index],
1130         [Creates debug information in the gdb index format, which makes gdb start faster.
1131          Requires the gold or lld linker.]))
1133 libo_FUZZ_ARG_ENABLE(sal-log,
1134     AS_HELP_STRING([--enable-sal-log],
1135         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1137 AC_ARG_ENABLE(selective-debuginfo,
1138     AS_HELP_STRING([--enable-selective-debuginfo],
1139         [If --enable-debug or --enable-dbgutil is used, build debugging information
1140          (-g compiler flag) only for the specified gbuild build targets
1141          (where all means everything, - prepended means not to enable, / appended means
1142          everything in the directory; there is no ordering, more specific overrides
1143          more general, and disabling takes precedence).
1144          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1146 libo_FUZZ_ARG_ENABLE(symbols,
1147     AS_HELP_STRING([--enable-symbols],
1148         [Generate debug information.
1149          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1150          otherwise.]))
1152 libo_FUZZ_ARG_ENABLE(optimized,
1153     AS_HELP_STRING([--disable-optimized],
1154         [Whether to compile with optimization flags.
1155          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1156          otherwise.]))
1158 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1159     AS_HELP_STRING([--disable-runtime-optimizations],
1160         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1161          JVM JIT) that are known to interact badly with certain dynamic analysis
1162          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1163          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1164          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1166 AC_ARG_WITH(valgrind,
1167     AS_HELP_STRING([--with-valgrind],
1168         [Make availability of Valgrind headers a hard requirement.]))
1170 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1171     AS_HELP_STRING([--enable-compiler-plugins],
1172         [Enable compiler plugins that will perform additional checks during
1173          building. Enabled automatically by --enable-dbgutil.
1174          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1175 COMPILER_PLUGINS_DEBUG=
1176 if test "$enable_compiler_plugins" = debug; then
1177     enable_compiler_plugins=yes
1178     COMPILER_PLUGINS_DEBUG=TRUE
1181 libo_FUZZ_ARG_ENABLE(ooenv,
1182     AS_HELP_STRING([--disable-ooenv],
1183         [Disable ooenv for the instdir installation.]))
1185 libo_FUZZ_ARG_ENABLE(libnumbertext,
1186     AS_HELP_STRING([--disable-libnumbertext],
1187         [Disable use of numbertext external library.]))
1189 AC_ARG_ENABLE(lto,
1190     AS_HELP_STRING([--enable-lto],
1191         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1192          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1193          linker. For MSVC, this option is broken at the moment. This is experimental work
1194          in progress that shouldn't be used unless you are working on it.)]))
1196 AC_ARG_ENABLE(python,
1197     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1198         [Enables or disables Python support at run-time.
1199          Also specifies what Python to use. 'auto' is the default.
1200          'fully-internal' even forces the internal version for uses of Python
1201          during the build.]))
1203 libo_FUZZ_ARG_ENABLE(gtk,
1204     AS_HELP_STRING([--disable-gtk],
1205         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1206 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1208 libo_FUZZ_ARG_ENABLE(gtk3,
1209     AS_HELP_STRING([--disable-gtk3],
1210         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1211 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1213 AC_ARG_ENABLE(split-app-modules,
1214     AS_HELP_STRING([--enable-split-app-modules],
1215         [Split file lists for app modules, e.g. base, calc.
1216          Has effect only with make distro-pack-install]),
1219 AC_ARG_ENABLE(split-opt-features,
1220     AS_HELP_STRING([--enable-split-opt-features],
1221         [Split file lists for some optional features, e.g. pyuno, testtool.
1222          Has effect only with make distro-pack-install]),
1225 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1226     AS_HELP_STRING([--disable-cairo-canvas],
1227         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1230 libo_FUZZ_ARG_ENABLE(dbus,
1231     AS_HELP_STRING([--disable-dbus],
1232         [Determines whether to enable features that depend on dbus.
1233          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1234 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1236 libo_FUZZ_ARG_ENABLE(sdremote,
1237     AS_HELP_STRING([--disable-sdremote],
1238         [Determines whether to enable Impress remote control (i.e. the server component).]),
1239 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1241 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1242     AS_HELP_STRING([--disable-sdremote-bluetooth],
1243         [Determines whether to build sdremote with bluetooth support.
1244          Requires dbus on Linux.]))
1246 libo_FUZZ_ARG_ENABLE(gio,
1247     AS_HELP_STRING([--disable-gio],
1248         [Determines whether to use the GIO support.]),
1249 ,test "${enable_gio+set}" = set || enable_gio=yes)
1251 AC_ARG_ENABLE(kde4,
1252     AS_HELP_STRING([--enable-kde4],
1253         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1254          KDE4 are available.]),
1257 AC_ARG_ENABLE(qt5,
1258     AS_HELP_STRING([--enable-qt5],
1259         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1260          available.]),
1263 AC_ARG_ENABLE(kde5,
1264     AS_HELP_STRING([--enable-kde5],
1265         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1266          KF5 are available.]),
1269 AC_ARG_ENABLE(gtk3_kde5,
1270     AS_HELP_STRING([--enable-gtk3-kde5],
1271         [Determines whether to use Gtk3 vclplug with KDE file dialogs on
1272          platforms where Gtk3, Qt5 and Plasma is available.]),
1275 libo_FUZZ_ARG_ENABLE(gui,
1276     AS_HELP_STRING([--disable-gui],
1277         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1278          command-line option. Not related to LibreOffice Online functionality. Don't use
1279          unless you are certain you need to. Nobody will help you if you insist on trying
1280          this and run into problems.]),
1281 ,test "${enable_gui+set}" = set || enable_gui=yes)
1283 libo_FUZZ_ARG_ENABLE(randr,
1284     AS_HELP_STRING([--disable-randr],
1285         [Disable RandR support in the vcl project.]),
1286 ,test "${enable_randr+set}" = set || enable_randr=yes)
1288 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1289     AS_HELP_STRING([--disable-gstreamer-1-0],
1290         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1291 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1293 AC_ARG_ENABLE(gstreamer-0-10,
1294     AS_HELP_STRING([--enable-gstreamer-0-10],
1295         [Enable building with the gstreamer 0.10 avmedia backend.]),
1296 ,enable_gstreamer_0_10=no)
1298 libo_FUZZ_ARG_ENABLE(vlc,
1299     AS_HELP_STRING([--enable-vlc],
1300         [Enable building with the (experimental) VLC avmedia backend.]),
1301 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1303 libo_FUZZ_ARG_ENABLE(neon,
1304     AS_HELP_STRING([--disable-neon],
1305         [Disable neon and the compilation of webdav binding.]),
1308 libo_FUZZ_ARG_ENABLE([eot],
1309     [AS_HELP_STRING([--enable-eot],
1310         [Enable support for Embedded OpenType fonts.])],
1311 ,test "${enable_eot+set}" = set || enable_eot=no)
1313 libo_FUZZ_ARG_ENABLE(cve-tests,
1314     AS_HELP_STRING([--disable-cve-tests],
1315         [Prevent CVE tests to be executed]),
1318 libo_FUZZ_ARG_ENABLE(chart-tests,
1319     AS_HELP_STRING([--enable-chart-tests],
1320         [Executes chart XShape tests. In a perfect world these tests would be
1321          stable and everyone could run them, in reality it is best to run them
1322          only on a few machines that are known to work and maintained by people
1323          who can judge if a test failure is a regression or not.]),
1326 AC_ARG_ENABLE(build-unowinreg,
1327     AS_HELP_STRING([--enable-build-unowinreg],
1328         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1329          compiler is needed on Linux.]),
1332 AC_ARG_ENABLE(build-opensymbol,
1333     AS_HELP_STRING([--enable-build-opensymbol],
1334         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1335          fontforge installed.]),
1338 AC_ARG_ENABLE(dependency-tracking,
1339     AS_HELP_STRING([--enable-dependency-tracking],
1340         [Do not reject slow dependency extractors.])[
1341   --disable-dependency-tracking
1342                           Disables generation of dependency information.
1343                           Speed up one-time builds.],
1346 AC_ARG_ENABLE(icecream,
1347     AS_HELP_STRING([--enable-icecream],
1348         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1349          It defaults to /opt/icecream for the location of the icecream gcc/g++
1350          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1353 AC_ARG_ENABLE(ld,
1354     AS_HELP_STRING([--enable-ld=<linker>],
1355         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.]),
1358 libo_FUZZ_ARG_ENABLE(cups,
1359     AS_HELP_STRING([--disable-cups],
1360         [Do not build cups support.])
1363 AC_ARG_ENABLE(ccache,
1364     AS_HELP_STRING([--disable-ccache],
1365         [Do not try to use ccache automatically.
1366          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1367          CC/CXX are not yet set, and --enable-icecream is not given, we
1368          attempt to use ccache. --disable-ccache disables ccache completely.
1372 AC_ARG_ENABLE(64-bit,
1373     AS_HELP_STRING([--enable-64-bit],
1374         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1375          At the moment meaningful only for Windows.]), ,)
1377 libo_FUZZ_ARG_ENABLE(online-update,
1378     AS_HELP_STRING([--enable-online-update],
1379         [Enable the online update service that will check for new versions of
1380          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1381          If the value is "mar", the experimental Mozilla-like update will be
1382          enabled instead of the traditional update mechanism.]),
1385 AC_ARG_WITH(update-config,
1386     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1387                    [Path to the update config ini file]))
1389 libo_FUZZ_ARG_ENABLE(extension-update,
1390     AS_HELP_STRING([--disable-extension-update],
1391         [Disable possibility to update installed extensions.]),
1394 libo_FUZZ_ARG_ENABLE(release-build,
1395     AS_HELP_STRING([--enable-release-build],
1396         [Enable release build. Note that the "release build" choice is orthogonal to
1397          whether symbols are present, debug info is generated, or optimization
1398          is done.
1399          See http://wiki.documentfoundation.org/Development/DevBuild]),
1402 AC_ARG_ENABLE(windows-build-signing,
1403     AS_HELP_STRING([--enable-windows-build-signing],
1404         [Enable signing of windows binaries (*.exe, *.dll)]),
1407 AC_ARG_ENABLE(silent-msi,
1408     AS_HELP_STRING([--enable-silent-msi],
1409         [Enable MSI with LIMITUI=1 (silent install).]),
1412 AC_ARG_ENABLE(macosx-code-signing,
1413     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1414         [Sign executables, dylibs, frameworks and the app bundle. If you
1415          don't provide an identity the first suitable certificate
1416          in your keychain is used.]),
1419 AC_ARG_ENABLE(macosx-package-signing,
1420     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1421         [Create a .pkg suitable for uploading to the Mac App Store and sign
1422          it. If you don't provide an identity the first suitable certificate
1423          in your keychain is used.]),
1426 AC_ARG_ENABLE(macosx-sandbox,
1427     AS_HELP_STRING([--enable-macosx-sandbox],
1428         [Make the app bundle run in a sandbox. Requires code signing.
1429          Is required by apps distributed in the Mac App Store, and implies
1430          adherence to App Store rules.]),
1433 AC_ARG_WITH(macosx-bundle-identifier,
1434     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1435         [Define the OS X bundle identifier. Default is the somewhat weird
1436          org.libreoffice.script ("script", huh?).]),
1437 ,with_macosx_bundle_identifier=org.libreoffice.script)
1439 AC_ARG_WITH(product-name,
1440     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1441         [Define the product name. Default is AC_PACKAGE_NAME.]),
1442 ,with_product_name=$PRODUCTNAME)
1444 AC_ARG_WITH(package-version,
1445     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1446         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1449 libo_FUZZ_ARG_ENABLE(readonly-installset,
1450     AS_HELP_STRING([--enable-readonly-installset],
1451         [Prevents any attempts by LibreOffice to write into its installation. That means
1452          at least that no "system-wide" extensions can be added. Partly experimental work in
1453          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1456 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1457     AS_HELP_STRING([--disable-postgresql-sdbc],
1458         [Disable the build of the PostgreSQL-SDBC driver.])
1461 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1462     AS_HELP_STRING([--disable-lotuswordpro],
1463         [Disable the build of the Lotus Word Pro filter.]),
1464 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1466 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1467     AS_HELP_STRING([--disable-firebird-sdbc],
1468         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1469 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1471 AC_ARG_ENABLE(bogus-pkg-config,
1472     AS_HELP_STRING([--enable-bogus-pkg-config],
1473         [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.]),
1476 AC_ARG_ENABLE(openssl,
1477     AS_HELP_STRING([--disable-openssl],
1478         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1479          components will either use GNUTLS or NSS. Work in progress,
1480          use only if you are hacking on it.]),
1481 ,enable_openssl=yes)
1483 AC_ARG_ENABLE(library-bin-tar,
1484     AS_HELP_STRING([--enable-library-bin-tar],
1485         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1486         Some libraries can save their build result in a tarball
1487         stored in TARFILE_LOCATION. That binary tarball is
1488         uniquely identified by the source tarball,
1489         the content of the config_host.mk file and the content
1490         of the top-level directory in core for that library
1491         If this option is enabled, then if such a tarfile exist, it will be untarred
1492         instead of the source tarfile, and the build step will be skipped for that
1493         library.
1494         If a proper tarfile does not exist, then the normal source-based
1495         build is done for that library and a proper binary tarfile is created
1496         for the next time.]),
1499 AC_ARG_ENABLE(dconf,
1500     AS_HELP_STRING([--disable-dconf],
1501         [Disable the dconf configuration backend (enabled by default where
1502          available).]))
1504 libo_FUZZ_ARG_ENABLE(formula-logger,
1505     AS_HELP_STRING(
1506         [--enable-formula-logger],
1507         [Enable formula logger for logging formula calculation flow in Calc.]
1508     )
1511 dnl ===================================================================
1512 dnl Optional Packages (--with/without-)
1513 dnl ===================================================================
1515 AC_ARG_WITH(gcc-home,
1516     AS_HELP_STRING([--with-gcc-home],
1517         [Specify the location of gcc/g++ manually. This can be used in conjunction
1518          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1519          non-default path.]),
1522 AC_ARG_WITH(gnu-patch,
1523     AS_HELP_STRING([--with-gnu-patch],
1524         [Specify location of GNU patch on Solaris or FreeBSD.]),
1527 AC_ARG_WITH(build-platform-configure-options,
1528     AS_HELP_STRING([--with-build-platform-configure-options],
1529         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1532 AC_ARG_WITH(gnu-cp,
1533     AS_HELP_STRING([--with-gnu-cp],
1534         [Specify location of GNU cp on Solaris or FreeBSD.]),
1537 AC_ARG_WITH(external-tar,
1538     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1539         [Specify an absolute path of where to find (and store) tarfiles.]),
1540     TARFILE_LOCATION=$withval ,
1543 AC_ARG_WITH(referenced-git,
1544     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1545         [Specify another checkout directory to reference. This makes use of
1546                  git submodule update --reference, and saves a lot of diskspace
1547                  when having multiple trees side-by-side.]),
1548     GIT_REFERENCE_SRC=$withval ,
1551 AC_ARG_WITH(linked-git,
1552     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1553         [Specify a directory where the repositories of submodules are located.
1554          This uses a method similar to git-new-workdir to get submodules.]),
1555     GIT_LINK_SRC=$withval ,
1558 AC_ARG_WITH(galleries,
1559     AS_HELP_STRING([--with-galleries],
1560         [Specify how galleries should be built. It is possible either to
1561          build these internally from source ("build"),
1562          or to disable them ("no")]),
1565 AC_ARG_WITH(theme,
1566     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1567         [Choose which themes to include. By default those themes with an '*' are included.
1568          Possible choices: *breeze, *breeze_dark, *colibre, *elementary, *karasa_jaga, *sifr, *sifr_dark, *tango.]),
1571 libo_FUZZ_ARG_WITH(helppack-integration,
1572     AS_HELP_STRING([--without-helppack-integration],
1573         [It will not integrate the helppacks to the installer
1574          of the product. Please use this switch to use the online help
1575          or separate help packages.]),
1578 libo_FUZZ_ARG_WITH(fonts,
1579     AS_HELP_STRING([--without-fonts],
1580         [LibreOffice includes some third-party fonts to provide a reliable basis for
1581          help content, templates, samples, etc. When these fonts are already
1582          known to be available on the system then you should use this option.]),
1585 AC_ARG_WITH(epm,
1586     AS_HELP_STRING([--with-epm],
1587         [Decides which epm to use. Default is to use the one from the system if
1588          one is built. When either this is not there or you say =internal epm
1589          will be built.]),
1592 AC_ARG_WITH(package-format,
1593     AS_HELP_STRING([--with-package-format],
1594         [Specify package format(s) for LibreOffice installation sets. The
1595          implicit --without-package-format leads to no installation sets being
1596          generated. Possible values: aix, archive, bsd, deb, dmg,
1597          installed, msi, pkg, and rpm.
1598          Example: --with-package-format='deb rpm']),
1601 AC_ARG_WITH(tls,
1602     AS_HELP_STRING([--with-tls],
1603         [Decides which TLS/SSL and cryptographic implementations to use for
1604          LibreOffice's code. Notice that this doesn't apply for depending
1605          libraries like "neon", for example. Default is to use OpenSSL
1606          although NSS is also possible. Notice that selecting NSS restricts
1607          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1608          restrict by now the usage of NSS in LO's code. Possible values:
1609          openssl, nss. Example: --with-tls="nss"]),
1612 AC_ARG_WITH(system-libs,
1613     AS_HELP_STRING([--with-system-libs],
1614         [Use libraries already on system -- enables all --with-system-* flags.]),
1617 AC_ARG_WITH(system-bzip2,
1618     AS_HELP_STRING([--with-system-bzip2],
1619         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1620     [with_system_bzip2="$with_system_libs"])
1622 AC_ARG_WITH(system-headers,
1623     AS_HELP_STRING([--with-system-headers],
1624         [Use headers already on system -- enables all --with-system-* flags for
1625          external packages whose headers are the only entities used i.e.
1626          boost/odbc/sane-header(s).]),,
1627     [with_system_headers="$with_system_libs"])
1629 AC_ARG_WITH(system-jars,
1630     AS_HELP_STRING([--without-system-jars],
1631         [When building with --with-system-libs, also the needed jars are expected
1632          on the system. Use this to disable that]),,
1633     [with_system_jars="$with_system_libs"])
1635 AC_ARG_WITH(system-cairo,
1636     AS_HELP_STRING([--with-system-cairo],
1637         [Use cairo libraries already on system.  Happens automatically for
1638          (implicit) --enable-gtk and for --enable-gtk3.]))
1640 AC_ARG_WITH(system-epoxy,
1641     AS_HELP_STRING([--with-system-epoxy],
1642         [Use epoxy libraries already on system.  Happens automatically for
1643          --enable-gtk3.]),,
1644        [with_system_epoxy="$with_system_libs"])
1646 AC_ARG_WITH(myspell-dicts,
1647     AS_HELP_STRING([--with-myspell-dicts],
1648         [Adds myspell dictionaries to the LibreOffice installation set]),
1651 AC_ARG_WITH(system-dicts,
1652     AS_HELP_STRING([--without-system-dicts],
1653         [Do not use dictionaries from system paths.]),
1656 AC_ARG_WITH(external-dict-dir,
1657     AS_HELP_STRING([--with-external-dict-dir],
1658         [Specify external dictionary dir.]),
1661 AC_ARG_WITH(external-hyph-dir,
1662     AS_HELP_STRING([--with-external-hyph-dir],
1663         [Specify external hyphenation pattern dir.]),
1666 AC_ARG_WITH(external-thes-dir,
1667     AS_HELP_STRING([--with-external-thes-dir],
1668         [Specify external thesaurus dir.]),
1671 AC_ARG_WITH(system-zlib,
1672     AS_HELP_STRING([--with-system-zlib],
1673         [Use zlib already on system.]),,
1674     [with_system_zlib=auto])
1676 AC_ARG_WITH(system-jpeg,
1677     AS_HELP_STRING([--with-system-jpeg],
1678         [Use jpeg already on system.]),,
1679     [with_system_jpeg="$with_system_libs"])
1681 AC_ARG_WITH(system-clucene,
1682     AS_HELP_STRING([--with-system-clucene],
1683         [Use clucene already on system.]),,
1684     [with_system_clucene="$with_system_libs"])
1686 AC_ARG_WITH(system-expat,
1687     AS_HELP_STRING([--with-system-expat],
1688         [Use expat already on system.]),,
1689     [with_system_expat="$with_system_libs"])
1691 AC_ARG_WITH(system-libxml,
1692     AS_HELP_STRING([--with-system-libxml],
1693         [Use libxml/libxslt already on system.]),,
1694     [with_system_libxml=auto])
1696 AC_ARG_WITH(system-icu,
1697     AS_HELP_STRING([--with-system-icu],
1698         [Use icu already on system.]),,
1699     [with_system_icu="$with_system_libs"])
1701 AC_ARG_WITH(system-ucpp,
1702     AS_HELP_STRING([--with-system-ucpp],
1703         [Use ucpp already on system.]),,
1704     [])
1706 AC_ARG_WITH(system-openldap,
1707     AS_HELP_STRING([--with-system-openldap],
1708         [Use the OpenLDAP LDAP SDK already on system.]),,
1709     [with_system_openldap="$with_system_libs"])
1711 AC_ARG_WITH(system-poppler,
1712     AS_HELP_STRING([--with-system-poppler],
1713         [Use system poppler (only needed for PDF import).]),,
1714     [with_system_poppler="$with_system_libs"])
1716 AC_ARG_WITH(system-gpgmepp,
1717     AS_HELP_STRING([--with-system-gpgmepp],
1718         [Use gpgmepp already on system]),,
1719     [with_system_gpgmepp="$with_system_libs"])
1721 AC_ARG_WITH(system-apache-commons,
1722     AS_HELP_STRING([--with-system-apache-commons],
1723         [Use Apache commons libraries already on system.]),,
1724     [with_system_apache_commons="$with_system_jars"])
1726 AC_ARG_WITH(system-mariadb,
1727     AS_HELP_STRING([--with-system-mariadb],
1728         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1729          extension.]),,
1730     [with_system_mariadb="$with_system_libs"])
1732 AC_ARG_ENABLE(bundle-mariadb,
1733     AS_HELP_STRING([--enable-bundle-mariadb],
1734         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1737 AC_ARG_WITH(system-mysql-cppconn,
1738     AS_HELP_STRING([--with-system-mysql-cppconn],
1739         [Use MySQL C++ Connector libraries already on system.]),,
1740     [with_system_mysql_cppconn="$with_system_libs"])
1742 AC_ARG_WITH(system-postgresql,
1743     AS_HELP_STRING([--with-system-postgresql],
1744         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1745          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1746     [with_system_postgresql="$with_system_libs"])
1748 AC_ARG_WITH(libpq-path,
1749     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1750         [Use this PostgreSQL C interface (libpq) installation for building
1751          the PostgreSQL-SDBC extension.]),
1754 AC_ARG_WITH(system-firebird,
1755     AS_HELP_STRING([--with-system-firebird],
1756         [Use Firebird libraries already on system, for building the Firebird-SDBC
1757          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1758     [with_system_firebird="$with_system_libs"])
1760 AC_ARG_WITH(system-libtommath,
1761             AS_HELP_STRING([--with-system-libtommath],
1762                            [Use libtommath already on system]),,
1763             [with_system_libtommath="$with_system_libs"])
1765 AC_ARG_WITH(system-hsqldb,
1766     AS_HELP_STRING([--with-system-hsqldb],
1767         [Use hsqldb already on system.]))
1769 AC_ARG_WITH(hsqldb-jar,
1770     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1771         [Specify path to jarfile manually.]),
1772     HSQLDB_JAR=$withval)
1774 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1775     AS_HELP_STRING([--disable-scripting-beanshell],
1776         [Disable support for scripts in BeanShell.]),
1780 AC_ARG_WITH(system-beanshell,
1781     AS_HELP_STRING([--with-system-beanshell],
1782         [Use beanshell already on system.]),,
1783     [with_system_beanshell="$with_system_jars"])
1785 AC_ARG_WITH(beanshell-jar,
1786     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1787         [Specify path to jarfile manually.]),
1788     BSH_JAR=$withval)
1790 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1791     AS_HELP_STRING([--disable-scripting-javascript],
1792         [Disable support for scripts in JavaScript.]),
1796 AC_ARG_WITH(system-rhino,
1797     AS_HELP_STRING([--with-system-rhino],
1798         [Use rhino already on system.]),,)
1799 #    [with_system_rhino="$with_system_jars"])
1800 # Above is not used as we have different debug interface
1801 # patched into internal rhino. This code needs to be fixed
1802 # before we can enable it by default.
1804 AC_ARG_WITH(rhino-jar,
1805     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1806         [Specify path to jarfile manually.]),
1807     RHINO_JAR=$withval)
1809 AC_ARG_WITH(commons-logging-jar,
1810     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1811         [Specify path to jarfile manually.]),
1812     COMMONS_LOGGING_JAR=$withval)
1814 AC_ARG_WITH(system-jfreereport,
1815     AS_HELP_STRING([--with-system-jfreereport],
1816         [Use JFreeReport already on system.]),,
1817     [with_system_jfreereport="$with_system_jars"])
1819 AC_ARG_WITH(sac-jar,
1820     AS_HELP_STRING([--with-sac-jar=JARFILE],
1821         [Specify path to jarfile manually.]),
1822     SAC_JAR=$withval)
1824 AC_ARG_WITH(libxml-jar,
1825     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1826         [Specify path to jarfile manually.]),
1827     LIBXML_JAR=$withval)
1829 AC_ARG_WITH(flute-jar,
1830     AS_HELP_STRING([--with-flute-jar=JARFILE],
1831         [Specify path to jarfile manually.]),
1832     FLUTE_JAR=$withval)
1834 AC_ARG_WITH(jfreereport-jar,
1835     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1836         [Specify path to jarfile manually.]),
1837     JFREEREPORT_JAR=$withval)
1839 AC_ARG_WITH(liblayout-jar,
1840     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1841         [Specify path to jarfile manually.]),
1842     LIBLAYOUT_JAR=$withval)
1844 AC_ARG_WITH(libloader-jar,
1845     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1846         [Specify path to jarfile manually.]),
1847     LIBLOADER_JAR=$withval)
1849 AC_ARG_WITH(libformula-jar,
1850     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1851         [Specify path to jarfile manually.]),
1852     LIBFORMULA_JAR=$withval)
1854 AC_ARG_WITH(librepository-jar,
1855     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1856         [Specify path to jarfile manually.]),
1857     LIBREPOSITORY_JAR=$withval)
1859 AC_ARG_WITH(libfonts-jar,
1860     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1861         [Specify path to jarfile manually.]),
1862     LIBFONTS_JAR=$withval)
1864 AC_ARG_WITH(libserializer-jar,
1865     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1866         [Specify path to jarfile manually.]),
1867     LIBSERIALIZER_JAR=$withval)
1869 AC_ARG_WITH(libbase-jar,
1870     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1871         [Specify path to jarfile manually.]),
1872     LIBBASE_JAR=$withval)
1874 AC_ARG_WITH(system-odbc,
1875     AS_HELP_STRING([--with-system-odbc],
1876         [Use the odbc headers already on system.]),,
1877     [with_system_odbc="auto"])
1879 AC_ARG_WITH(system-sane,
1880     AS_HELP_STRING([--with-system-sane],
1881         [Use sane.h already on system.]),,
1882     [with_system_sane="$with_system_headers"])
1884 AC_ARG_WITH(system-bluez,
1885     AS_HELP_STRING([--with-system-bluez],
1886         [Use bluetooth.h already on system.]),,
1887     [with_system_bluez="$with_system_headers"])
1889 AC_ARG_WITH(system-curl,
1890     AS_HELP_STRING([--with-system-curl],
1891         [Use curl already on system.]),,
1892     [with_system_curl=auto])
1894 AC_ARG_WITH(system-boost,
1895     AS_HELP_STRING([--with-system-boost],
1896         [Use boost already on system.]),,
1897     [with_system_boost="$with_system_headers"])
1899 AC_ARG_WITH(system-glm,
1900     AS_HELP_STRING([--with-system-glm],
1901         [Use glm already on system.]),,
1902     [with_system_glm="$with_system_headers"])
1904 AC_ARG_WITH(system-hunspell,
1905     AS_HELP_STRING([--with-system-hunspell],
1906         [Use libhunspell already on system.]),,
1907     [with_system_hunspell="$with_system_libs"])
1909 AC_ARG_WITH(system-mythes,
1910     AS_HELP_STRING([--with-system-mythes],
1911         [Use mythes already on system.]),,
1912     [with_system_mythes="$with_system_libs"])
1914 AC_ARG_WITH(system-altlinuxhyph,
1915     AS_HELP_STRING([--with-system-altlinuxhyph],
1916         [Use ALTLinuxhyph already on system.]),,
1917     [with_system_altlinuxhyph="$with_system_libs"])
1919 AC_ARG_WITH(system-lpsolve,
1920     AS_HELP_STRING([--with-system-lpsolve],
1921         [Use lpsolve already on system.]),,
1922     [with_system_lpsolve="$with_system_libs"])
1924 AC_ARG_WITH(system-coinmp,
1925     AS_HELP_STRING([--with-system-coinmp],
1926         [Use CoinMP already on system.]),,
1927     [with_system_coinmp="$with_system_libs"])
1929 AC_ARG_WITH(system-liblangtag,
1930     AS_HELP_STRING([--with-system-liblangtag],
1931         [Use liblangtag library already on system.]),,
1932     [with_system_liblangtag="$with_system_libs"])
1934 AC_ARG_WITH(webdav,
1935     AS_HELP_STRING([--with-webdav],
1936         [Specify which library to use for webdav implementation.
1937          Possible values: "neon", "serf", "no". The default value is "neon".
1938          Example: --with-webdav="serf"]),
1939     WITH_WEBDAV=$withval,
1940     WITH_WEBDAV="neon")
1942 AC_ARG_WITH(linker-hash-style,
1943     AS_HELP_STRING([--with-linker-hash-style],
1944         [Use linker with --hash-style=<style> when linking shared objects.
1945          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1946          if supported on the build system, and "sysv" otherwise.]))
1948 AC_ARG_WITH(jdk-home,
1949     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1950         [If you have installed JDK 1.6 or later on your system please supply the
1951          path here. Note that this is not the location of the java command but the
1952          location of the entire distribution.]),
1955 AC_ARG_WITH(help,
1956     AS_HELP_STRING([--with-help],
1957         [Enable the build of help. There is a special parameter "common" that
1958          can be used to bundle only the common part, .e.g help-specific icons.
1959          This is useful when you build the helpcontent separately.])
1960     [
1961                           Usage:     --with-help    build the old local help
1962                                  --without-help     no local help (default)
1963                                  --with-help=html   build the new HTML local help
1964                                  --with-help=online build the new HTML online help
1965     ],
1968 libo_FUZZ_ARG_WITH(java,
1969     AS_HELP_STRING([--with-java=<java command>],
1970         [Specify the name of the Java interpreter command. Typically "java"
1971          which is the default.
1973          To build without support for Java components, applets, accessibility
1974          or the XML filters written in Java, use --without-java or --with-java=no.]),
1975     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1976     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
1979 AC_ARG_WITH(jvm-path,
1980     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
1981         [Use a specific JVM search path at runtime.
1982          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
1985 AC_ARG_WITH(ant-home,
1986     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
1987         [If you have installed Jakarta Ant on your system, please supply the path here.
1988          Note that this is not the location of the Ant binary but the location
1989          of the entire distribution.]),
1992 AC_ARG_WITH(symbol-config,
1993     AS_HELP_STRING([--with-symbol-config],
1994         [Configuration for the crashreport symbol upload]),
1995         [],
1996         [with_symbol_config=no])
1998 AC_ARG_WITH(export-validation,
1999     AS_HELP_STRING([--without-export-validation],
2000         [Disable validating OOXML and ODF files as exported from in-tree tests.
2001          Use this option e.g. if your system only provides Java 5.]),
2002 ,with_export_validation=auto)
2004 AC_ARG_WITH(bffvalidator,
2005     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2006         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2007          Requires installed Microsoft Office Binary File Format Validator.
2008          Note: export-validation (--with-export-validation) is required to be turned on.
2009          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2010 ,with_bffvalidator=no)
2012 libo_FUZZ_ARG_WITH(junit,
2013     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2014         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2015          --without-junit disables those tests. Not relevant in the --without-java case.]),
2016 ,with_junit=yes)
2018 AC_ARG_WITH(hamcrest,
2019     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2020         [Specifies the hamcrest jar file to use for JUnit-based tests.
2021          --without-junit disables those tests. Not relevant in the --without-java case.]),
2022 ,with_hamcrest=yes)
2024 AC_ARG_WITH(perl-home,
2025     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2026         [If you have installed Perl 5 Distribution, on your system, please
2027          supply the path here. Note that this is not the location of the Perl
2028          binary but the location of the entire distribution.]),
2031 libo_FUZZ_ARG_WITH(doxygen,
2032     AS_HELP_STRING(
2033         [--with-doxygen=<absolute path to doxygen executable>],
2034         [Specifies the doxygen executable to use when generating ODK C/C++
2035          documentation. --without-doxygen disables generation of ODK C/C++
2036          documentation. Not relevant in the --disable-odk case.]),
2037 ,with_doxygen=yes)
2039 AC_ARG_WITH(visual-studio,
2040     AS_HELP_STRING([--with-visual-studio=<2017>],
2041         [Specify which Visual Studio version to use in case several are
2042          installed. Currently only 2017 is supported.]),
2045 AC_ARG_WITH(windows-sdk,
2046     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
2047         [Specify which Windows SDK, or "Windows Kit", version to use
2048          in case the one that came with the selected Visual Studio
2049          is not what you want for some reason. Note that not all compiler/SDK
2050          combinations are supported. The intent is that this option should not
2051          be needed.]),
2054 AC_ARG_WITH(lang,
2055     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2056         [Use this option to build LibreOffice with additional UI language support.
2057          English (US) is always included by default.
2058          Separate multiple languages with space.
2059          For all languages, use --with-lang=ALL.]),
2062 AC_ARG_WITH(locales,
2063     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2064         [Use this option to limit the locale information built in.
2065          Separate multiple locales with space.
2066          Very experimental and might well break stuff.
2067          Just a desperate measure to shrink code and data size.
2068          By default all the locales available is included.
2069          This option is completely unrelated to --with-lang.])
2070     [
2071                           Affects also our character encoding conversion
2072                           tables for encodings mainly targeted for a
2073                           particular locale, like EUC-CN and EUC-TW for
2074                           zh, ISO-2022-JP for ja.
2076                           Affects also our add-on break iterator data for
2077                           some languages.
2079                           For the default, all locales, don't use this switch at all.
2080                           Specifying just the language part of a locale means all matching
2081                           locales will be included.
2082     ],
2085 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2086 libo_FUZZ_ARG_WITH(krb5,
2087     AS_HELP_STRING([--with-krb5],
2088         [Enable MIT Kerberos 5 support in modules that support it.
2089          By default automatically enabled on platforms
2090          where a good system Kerberos 5 is available.]),
2093 libo_FUZZ_ARG_WITH(gssapi,
2094     AS_HELP_STRING([--with-gssapi],
2095         [Enable GSSAPI support in modules that support it.
2096          By default automatically enabled on platforms
2097          where a good system GSSAPI is available.]),
2100 AC_ARG_WITH(iwyu,
2101     AS_HELP_STRING([--with-iwyu],
2102         [Use given IWYU binary path to check unneeded includes instead of building.
2103          Use only if you are hacking on it.]),
2106 libo_FUZZ_ARG_WITH(lxml,
2107     AS_HELP_STRING([--without-lxml],
2108         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2109          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2110          report widget classes and ids.]),
2113 dnl ===================================================================
2114 dnl Branding
2115 dnl ===================================================================
2117 AC_ARG_WITH(branding,
2118     AS_HELP_STRING([--with-branding=/path/to/images],
2119         [Use given path to retrieve branding images set.])
2120     [
2121                           Search for intro.png about.svg and flat_logo.svg.
2122                           If any is missing, default ones will be used instead.
2124                           Search also progress.conf for progress
2125                           settings on intro screen :
2127                           PROGRESSBARCOLOR="255,255,255" Set color of
2128                           progress bar. Comma separated RGB decimal values.
2129                           PROGRESSSIZE="407,6" Set size of progress bar.
2130                           Comma separated decimal values (width, height).
2131                           PROGRESSPOSITION="61,317" Set position of progress
2132                           bar from left,top. Comma separated decimal values.
2133                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2134                           bar frame. Comma separated RGB decimal values.
2135                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2136                           bar text. Comma separated RGB decimal values.
2137                           PROGRESSTEXTBASELINE="287" Set vertical position of
2138                           progress bar text from top. Decimal value.
2140                           Default values will be used if not found.
2141     ],
2145 AC_ARG_WITH(extra-buildid,
2146     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2147         [Show addition build identification in about dialog.]),
2151 AC_ARG_WITH(vendor,
2152     AS_HELP_STRING([--with-vendor="John the Builder"],
2153         [Set vendor of the build.]),
2156 AC_ARG_WITH(android-package-name,
2157     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2158         [Set Android package name of the build.]),
2161 AC_ARG_WITH(compat-oowrappers,
2162     AS_HELP_STRING([--with-compat-oowrappers],
2163         [Install oo* wrappers in parallel with
2164          lo* ones to keep backward compatibility.
2165          Has effect only with make distro-pack-install]),
2168 AC_ARG_WITH(os-version,
2169     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2170         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2173 AC_ARG_WITH(mingw-cross-compiler,
2174     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2175         [Specify the MinGW cross-compiler to use.
2176          When building on the ODK on Unix and building unowinreg.dll,
2177          specify the MinGW C++ cross-compiler.]),
2180 AC_ARG_WITH(idlc-cpp,
2181     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2182         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2185 AC_ARG_WITH(build-version,
2186     AS_HELP_STRING([--with-build-version="Built by Jim"],
2187         [Allows the builder to add a custom version tag that will appear in the
2188          Help/About box for QA purposes.]),
2189 with_build_version=$withval,
2192 AC_ARG_WITH(parallelism,
2193     AS_HELP_STRING([--with-parallelism],
2194         [Number of jobs to run simultaneously during build. Parallel builds can
2195         save a lot of time on multi-cpu machines. Defaults to the number of
2196         CPUs on the machine, unless you configure --enable-icecream - then to
2197         10.]),
2200 AC_ARG_WITH(all-tarballs,
2201     AS_HELP_STRING([--with-all-tarballs],
2202         [Download all external tarballs unconditionally]))
2204 AC_ARG_WITH(gdrive-client-id,
2205     AS_HELP_STRING([--with-gdrive-client-id],
2206         [Provides the client id of the application for OAuth2 authentication
2207         on Google Drive. If either this or --with-gdrive-client-secret is
2208         empty, the feature will be disabled]),
2211 AC_ARG_WITH(gdrive-client-secret,
2212     AS_HELP_STRING([--with-gdrive-client-secret],
2213         [Provides the client secret of the application for OAuth2
2214         authentication on Google Drive. If either this or
2215         --with-gdrive-client-id is empty, the feature will be disabled]),
2218 AC_ARG_WITH(alfresco-cloud-client-id,
2219     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2220         [Provides the client id of the application for OAuth2 authentication
2221         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2222         empty, the feature will be disabled]),
2225 AC_ARG_WITH(alfresco-cloud-client-secret,
2226     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2227         [Provides the client secret of the application for OAuth2
2228         authentication on Alfresco Cloud. If either this or
2229         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2232 AC_ARG_WITH(onedrive-client-id,
2233     AS_HELP_STRING([--with-onedrive-client-id],
2234         [Provides the client id of the application for OAuth2 authentication
2235         on OneDrive. If either this or --with-onedrive-client-secret is
2236         empty, the feature will be disabled]),
2239 AC_ARG_WITH(onedrive-client-secret,
2240     AS_HELP_STRING([--with-onedrive-client-secret],
2241         [Provides the client secret of the application for OAuth2
2242         authentication on OneDrive. If either this or
2243         --with-onedrive-client-id is empty, the feature will be disabled]),
2245 dnl ===================================================================
2246 dnl Do we want to use pre-build binary tarball for recompile
2247 dnl ===================================================================
2249 if test "$enable_library_bin_tar" = "yes" ; then
2250     USE_LIBRARY_BIN_TAR=TRUE
2251 else
2252     USE_LIBRARY_BIN_TAR=
2254 AC_SUBST(USE_LIBRARY_BIN_TAR)
2256 dnl ===================================================================
2257 dnl Test whether build target is Release Build
2258 dnl ===================================================================
2259 AC_MSG_CHECKING([whether build target is Release Build])
2260 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2261     AC_MSG_RESULT([no])
2262     ENABLE_RELEASE_BUILD=
2263 else
2264     AC_MSG_RESULT([yes])
2265     ENABLE_RELEASE_BUILD=TRUE
2267 AC_SUBST(ENABLE_RELEASE_BUILD)
2269 dnl ===================================================================
2270 dnl Test whether to sign Windows Build
2271 dnl ===================================================================
2272 AC_MSG_CHECKING([whether to sign windows build])
2273 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2274     AC_MSG_RESULT([yes])
2275     WINDOWS_BUILD_SIGNING="TRUE"
2276 else
2277     AC_MSG_RESULT([no])
2278     WINDOWS_BUILD_SIGNING="FALSE"
2280 AC_SUBST(WINDOWS_BUILD_SIGNING)
2282 dnl ===================================================================
2283 dnl MacOSX build and runtime environment options
2284 dnl ===================================================================
2286 AC_ARG_WITH(macosx-sdk,
2287     AS_HELP_STRING([--with-macosx-sdk=<version>],
2288         [Prefer a specific SDK for building.])
2289     [
2290                           If the requested SDK is not available, a search for the oldest one will be done.
2291                           With current Xcode versions, only the latest SDK is included, so this option is
2292                           not terribly useful. It works fine to build with a new SDK and run the result
2293                           on an older OS.
2295                           e. g.: --with-macosx-sdk=10.9
2297                           there are 3 options to control the MacOSX build:
2298                           --with-macosx-sdk (referred as 'sdk' below)
2299                           --with-macosx-version-min-required (referred as 'min' below)
2300                           --with-macosx-version-max-allowed (referred as 'max' below)
2302                           the connection between these value and the default they take is as follow:
2303                           ( ? means not specified on the command line, s means the SDK version found,
2304                           constraint: 8 <= x <= y <= z)
2306                           ==========================================
2307                            command line      || config result
2308                           ==========================================
2309                           min  | max  | sdk  || min  | max  | sdk  |
2310                           ?    | ?    | ?    || 10.9 | 10.s | 10.s |
2311                           ?    | ?    | 10.x || 10.9 | 10.x | 10.x |
2312                           ?    | 10.x | ?    || 10.9 | 10.s | 10.s |
2313                           ?    | 10.x | 10.y || 10.9 | 10.x | 10.y |
2314                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2315                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2316                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2317                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2320                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2321                           for a detailed technical explanation of these variables
2323                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2324     ],
2327 AC_ARG_WITH(macosx-version-min-required,
2328     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2329         [set the minimum OS version needed to run the built LibreOffice])
2330     [
2331                           e. g.: --with-macos-version-min-required=10.9
2332                           see --with-macosx-sdk for more info
2333     ],
2336 AC_ARG_WITH(macosx-version-max-allowed,
2337     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2338         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2339     [
2340                           e. g.: --with-macos-version-max-allowed=10.9
2341                           see --with-macosx-sdk for more info
2342     ],
2346 dnl ===================================================================
2347 dnl options for stuff used during cross-compilation build
2348 dnl Not quite superseded by --with-build-platform-configure-options.
2349 dnl TODO: check, if the "force" option is still needed anywhere.
2350 dnl ===================================================================
2352 AC_ARG_WITH(system-icu-for-build,
2353     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2354         [Use icu already on system for build tools (cross-compilation only).]))
2357 dnl ===================================================================
2358 dnl Check for incompatible options set by fuzzing, and reset those
2359 dnl automatically to working combinations
2360 dnl ===================================================================
2362 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2363         "$enable_dbus" != "$enable_avahi"; then
2364     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2365     enable_avahi=$enable_dbus
2368 dnl ===================================================================
2369 dnl check for required programs (grep, awk, sed, bash)
2370 dnl ===================================================================
2372 pathmunge ()
2374     if test -n "$1"; then
2375         if test "$build_os" = "cygwin"; then
2376             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2377                 PathFormat "$1"
2378                 new_path=`cygpath -sm "$formatted_path"`
2379             else
2380                 PathFormat "$1"
2381                 new_path=`cygpath -u "$formatted_path"`
2382             fi
2383         else
2384             new_path="$1"
2385         fi
2386         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2387             if test "$2" = "after"; then
2388                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2389             else
2390                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2391             fi
2392         fi
2393         unset new_path
2394     fi
2397 AC_PROG_AWK
2398 AC_PATH_PROG( AWK, $AWK)
2399 if test -z "$AWK"; then
2400     AC_MSG_ERROR([install awk to run this script])
2403 AC_PATH_PROG(BASH, bash)
2404 if test -z "$BASH"; then
2405     AC_MSG_ERROR([bash not found in \$PATH])
2407 AC_SUBST(BASH)
2409 AC_MSG_CHECKING([for GNU or BSD tar])
2410 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2411     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2412     if test $? -eq 0;  then
2413         GNUTAR=$a
2414         break
2415     fi
2416 done
2417 AC_MSG_RESULT($GNUTAR)
2418 if test -z "$GNUTAR"; then
2419     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2421 AC_SUBST(GNUTAR)
2423 AC_MSG_CHECKING([for tar's option to strip components])
2424 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2425 if test $? -eq 0; then
2426     STRIP_COMPONENTS="--strip-components"
2427 else
2428     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2429     if test $? -eq 0; then
2430         STRIP_COMPONENTS="--strip-path"
2431     else
2432         STRIP_COMPONENTS="unsupported"
2433     fi
2435 AC_MSG_RESULT($STRIP_COMPONENTS)
2436 if test x$STRIP_COMPONENTS = xunsupported; then
2437     AC_MSG_ERROR([you need a tar that is able to strip components.])
2439 AC_SUBST(STRIP_COMPONENTS)
2441 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2442 dnl desktop OSes from "mobile" ones.
2444 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2445 dnl In other words, that when building for an OS that is not a
2446 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2448 dnl Note the direction of the implication; there is no assumption that
2449 dnl cross-compiling would imply a non-desktop OS.
2451 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2452     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2453     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2454     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2457 # Whether to build "avmedia" functionality or not.
2459 if test -z "$enable_avmedia"; then
2460     enable_avmedia=yes
2463 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2464 if test "$enable_avmedia" = yes; then
2465     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2466 else
2467     USE_AVMEDIA_DUMMY='TRUE'
2469 AC_SUBST(USE_AVMEDIA_DUMMY)
2471 # Decide whether to build database connectivity stuff (including
2472 # Base) or not. We probably don't want to on non-desktop OSes.
2473 if test -z "$enable_database_connectivity"; then
2474     # --disable-database-connectivity is unfinished work in progress
2475     # and the iOS test app doesn't link if we actually try to use it.
2476     # if test $_os != iOS -a $_os != Android; then
2477     if test $_os != iOS; then
2478         enable_database_connectivity=yes
2479     fi
2482 if test "$enable_database_connectivity" = yes; then
2483     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2484     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2487 if test -z "$enable_extensions"; then
2488     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2489     if test $_os != iOS -a $_os != Android; then
2490         enable_extensions=yes
2491     fi
2494 if test "$enable_extensions" = yes; then
2495     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2496     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2499 if test -z "$enable_scripting"; then
2500     # Disable scripting for iOS unless specifically overridden
2501     # with --enable-scripting.
2502     if test $_os != iOS; then
2503         enable_scripting=yes
2504     fi
2507 DISABLE_SCRIPTING=''
2508 if test "$enable_scripting" = yes; then
2509     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2510     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2511 else
2512     DISABLE_SCRIPTING='TRUE'
2513     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2516 if test $_os = iOS -o $_os = Android; then
2517     # Disable dynamic_loading always for iOS and Android
2518     enable_dynamic_loading=no
2519 elif test -z "$enable_dynamic_loading"; then
2520     # Otherwise enable it unless speficically disabled
2521     enable_dynamic_loading=yes
2524 DISABLE_DYNLOADING=''
2525 if test "$enable_dynamic_loading" = yes; then
2526     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2527 else
2528     DISABLE_DYNLOADING='TRUE'
2530 AC_SUBST(DISABLE_DYNLOADING)
2532 # remenber SYSBASE value
2533 AC_SUBST(SYSBASE)
2535 dnl ===================================================================
2536 dnl  Sort out various gallery compilation options
2537 dnl ===================================================================
2538 AC_MSG_CHECKING([how to build and package galleries])
2539 if test -n "${with_galleries}"; then
2540     if test "$with_galleries" = "build"; then
2541         WITH_GALLERY_BUILD=TRUE
2542         AC_MSG_RESULT([build from source images internally])
2543     elif test "$with_galleries" = "no"; then
2544         WITH_GALLERY_BUILD=
2545         AC_MSG_RESULT([disable non-internal gallery build])
2546     else
2547         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2548     fi
2549 else
2550     if test $_os != iOS -a $_os != Android; then
2551         WITH_GALLERY_BUILD=TRUE
2552         AC_MSG_RESULT([internal src images for desktop])
2553     else
2554         WITH_GALLERY_BUILD=
2555         AC_MSG_RESULT([disable src image build])
2556     fi
2558 AC_SUBST(WITH_GALLERY_BUILD)
2560 dnl ===================================================================
2561 dnl  Checks if ccache is available
2562 dnl ===================================================================
2563 if test "$_os" = "WINNT"; then
2564     # on windows/VC build do not use ccache
2565     CCACHE=""
2566 elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2567     case "%$CC%$CXX%" in
2568     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2569     # assume that's good then
2570     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2571         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2572         ;;
2573     *)
2574         AC_PATH_PROG([CCACHE],[ccache],[not found])
2575         if test "$CCACHE" = "not found"; then
2576             CCACHE=""
2577         else
2578             # Need to check for ccache version: otherwise prevents
2579             # caching of the results (like "-x objective-c++" for Mac)
2580             if test $_os = Darwin -o $_os = iOS; then
2581                 # Check ccache version
2582                 AC_MSG_CHECKING([whether version of ccache is suitable])
2583                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2584                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2585                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2586                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2587                 else
2588                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2589                     CCACHE=""
2590                 fi
2591             fi
2592         fi
2593         ;;
2594     esac
2595 else
2596     CCACHE=""
2599 if test "$CCACHE" != ""; then
2600     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2601     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2602     if test "$ccache_size" = ""; then
2603         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2604         if test "$ccache_size" = ""; then
2605             ccache_size=0
2606         fi
2607         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2608         if test $ccache_size -lt 1024; then
2609             CCACHE=""
2610             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2611             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2612         else
2613             # warn that ccache may be too small for debug build
2614             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2615             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2616         fi
2617     else
2618         if test $ccache_size -lt 5; then
2619             #warn that ccache may be too small for debug build
2620             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2621             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2622         fi
2623     fi
2626 dnl ===================================================================
2627 dnl  Checks for C compiler,
2628 dnl  The check for the C++ compiler is later on.
2629 dnl ===================================================================
2630 if test "$_os" != "WINNT"; then
2631     GCC_HOME_SET="true"
2632     AC_MSG_CHECKING([gcc home])
2633     if test -z "$with_gcc_home"; then
2634         if test "$enable_icecream" = "yes"; then
2635             if test -d "/usr/lib/icecc/bin"; then
2636                 GCC_HOME="/usr/lib/icecc/"
2637             elif test -d "/usr/libexec/icecc/bin"; then
2638                 GCC_HOME="/usr/libexec/icecc/"
2639             elif test -d "/opt/icecream/bin"; then
2640                 GCC_HOME="/opt/icecream/"
2641             else
2642                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2644             fi
2645         else
2646             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2647             GCC_HOME_SET="false"
2648         fi
2649     else
2650         GCC_HOME="$with_gcc_home"
2651     fi
2652     AC_MSG_RESULT($GCC_HOME)
2653     AC_SUBST(GCC_HOME)
2655     if test "$GCC_HOME_SET" = "true"; then
2656         if test -z "$CC"; then
2657             CC="$GCC_HOME/bin/gcc"
2658         fi
2659         if test -z "$CXX"; then
2660             CXX="$GCC_HOME/bin/g++"
2661         fi
2662     fi
2665 COMPATH=`dirname "$CC"`
2666 if test "$COMPATH" = "."; then
2667     AC_PATH_PROGS(COMPATH, $CC)
2668     dnl double square bracket to get single because of M4 quote...
2669     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2671 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2673 dnl ===================================================================
2674 dnl Java support
2675 dnl ===================================================================
2676 AC_MSG_CHECKING([whether to build with Java support])
2677 if test "$with_java" != "no"; then
2678     if test "$DISABLE_SCRIPTING" = TRUE; then
2679         AC_MSG_RESULT([no, overridden by --disable-scripting])
2680         ENABLE_JAVA=""
2681         with_java=no
2682     else
2683         AC_MSG_RESULT([yes])
2684         ENABLE_JAVA="TRUE"
2685         AC_DEFINE(HAVE_FEATURE_JAVA)
2686     fi
2687 else
2688     AC_MSG_RESULT([no])
2689     ENABLE_JAVA=""
2692 AC_SUBST(ENABLE_JAVA)
2694 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2696 dnl ENABLE_JAVA="" indicate no Java support at all
2698 dnl ===================================================================
2699 dnl Check OS X SDK and compiler
2700 dnl ===================================================================
2702 if test $_os = Darwin -o $_os = iOS; then
2704     # If no --with-macosx-sdk option is given, look for one
2706     # The intent is that for "most" Mac-based developers, a suitable
2707     # SDK will be found automatically without any configure options.
2709     # For developers with a current Xcode, the lowest-numbered SDK
2710     # higher than or equal to the minimum required should be found.
2712     AC_MSG_CHECKING([what Mac OS X SDK to use])
2713     for _macosx_sdk in $with_macosx_sdk 10.13 10.12; do
2714         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2715         if test -d "$MACOSX_SDK_PATH"; then
2716             with_macosx_sdk="${_macosx_sdk}"
2717             break
2718         else
2719             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2720             if test -d "$MACOSX_SDK_PATH"; then
2721                 with_macosx_sdk="${_macosx_sdk}"
2722                 break
2723             fi
2724         fi
2725     done
2726     if test ! -d "$MACOSX_SDK_PATH"; then
2727         AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2728     fi
2730     if test $_os = iOS; then
2731         if test "$enable_ios_simulator" = "yes"; then
2732             useos=iphonesimulator
2733         else
2734             useos=iphoneos
2735         fi
2736         MACOSX_SDK_PATH=`xcrun --sdk ${useos} --show-sdk-path 2> /dev/null`
2737     fi
2738     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2741     case $with_macosx_sdk in
2742     10.9)
2743         MACOSX_SDK_VERSION=1090
2744         ;;
2745     10.10)
2746         MACOSX_SDK_VERSION=101000
2747         ;;
2748     10.11)
2749         MACOSX_SDK_VERSION=101100
2750         ;;
2751     10.12)
2752         MACOSX_SDK_VERSION=101200
2753         ;;
2754     10.13)
2755         MACOSX_SDK_VERSION=101300
2756         ;;
2757     *)
2758         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.9--13])
2759         ;;
2760     esac
2762     if test "$with_macosx_version_min_required" = "" ; then
2763         with_macosx_version_min_required="10.9";
2764     fi
2766     if test "$with_macosx_version_max_allowed" = "" ; then
2767         with_macosx_version_max_allowed="$with_macosx_sdk"
2768     fi
2770     # export this so that "xcrun" invocations later return matching values
2771     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2772     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2773     export DEVELOPER_DIR
2774     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2775     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2777     case "$with_macosx_version_min_required" in
2778     10.9)
2779         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2780         ;;
2781     10.10)
2782         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2783         ;;
2784     10.11)
2785         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2786         ;;
2787     10.12)
2788         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2789         ;;
2790     10.13)
2791         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2792         ;;
2793     *)
2794         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.9--13])
2795         ;;
2796     esac
2797     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2799     LIBTOOL=/usr/bin/libtool
2800     INSTALL_NAME_TOOL=install_name_tool
2801     if test -z "$save_CC"; then
2802         AC_MSG_CHECKING([what compiler to use])
2803         stdlib=-stdlib=libc++
2804         if test "$ENABLE_LTO" = TRUE; then
2805             lto=-flto
2806         fi
2807         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2808         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2809         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2810         AR=`xcrun -find ar`
2811         NM=`xcrun -find nm`
2812         STRIP=`xcrun -find strip`
2813         LIBTOOL=`xcrun -find libtool`
2814         RANLIB=`xcrun -find ranlib`
2815         AC_MSG_RESULT([$CC and $CXX])
2816     fi
2818     case "$with_macosx_version_max_allowed" in
2819     10.9)
2820         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2821         ;;
2822     10.10)
2823         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2824         ;;
2825     10.11)
2826         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2827         ;;
2828     10.12)
2829         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2830         ;;
2831     10.13)
2832         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2833         ;;
2834     *)
2835         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.9--13])
2836         ;;
2837     esac
2839     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2840     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2841         AC_MSG_RESULT([$MAC_OS_X_VERSION_MIN_REQUIRED])
2842         AC_MSG_RESULT([$MAC_OS_X_VERSION_MAX_REQUIRED])
2843         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2844     else
2845         AC_MSG_RESULT([ok])
2846     fi
2848     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2849     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2850         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2851     else
2852         AC_MSG_RESULT([ok])
2853     fi
2854     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2855     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2857     AC_MSG_CHECKING([whether to do code signing])
2859     if test "$enable_macosx_code_signing" = yes; then
2860         # By default use the first suitable certificate (?).
2862         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2863         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2864         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2865         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2866         # "Developer ID Application" one.
2868         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2869         if test -n "$identity"; then
2870             MACOSX_CODESIGNING_IDENTITY=$identity
2871             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2872             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2873         else
2874             AC_MSG_ERROR([cannot determine identity to use])
2875         fi
2876     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2877         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2878         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2879         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2880     else
2881         AC_MSG_RESULT([no])
2882     fi
2884     AC_MSG_CHECKING([whether to create a Mac App Store package])
2886     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2887         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2888     elif test "$enable_macosx_package_signing" = yes; then
2889         # By default use the first suitable certificate.
2890         # It should be a "3rd Party Mac Developer Installer" one
2892         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2893         if test -n "$identity"; then
2894             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2895             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2896             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2897         else
2898             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2899         fi
2900     elif test -n "$enable_macosx_package_signing"; then
2901         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2902         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2903         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2904     else
2905         AC_MSG_RESULT([no])
2906     fi
2908     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2909         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2910     fi
2912     AC_MSG_CHECKING([whether to sandbox the application])
2914     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2915         AC_MSG_ERROR([OS X sandboxing requires code signing])
2916     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2917         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2918     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2919         ENABLE_MACOSX_SANDBOX=TRUE
2920         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2921         AC_MSG_RESULT([yes])
2922     else
2923         AC_MSG_RESULT([no])
2924     fi
2926     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2927     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2928     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2930 AC_SUBST(MACOSX_SDK_PATH)
2931 AC_SUBST(MACOSX_SDK_VERSION)
2932 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2933 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2934 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
2935 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2936 AC_SUBST(INSTALL_NAME_TOOL)
2937 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2938 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2939 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2940 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2941 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2943 dnl ===================================================================
2944 dnl Check iOS SDK and compiler
2945 dnl ===================================================================
2947 if test $_os = iOS; then
2948     AC_MSG_CHECKING([what iOS SDK to use])
2949     current_sdk_ver=11.4
2950     if test "$enable_ios_simulator" = "yes"; then
2951         platform=iPhoneSimulator
2952         versionmin=-mios-simulator-version-min=$current_sdk_ver
2953     else
2954         platform=iPhoneOS
2955         versionmin=-miphoneos-version-min=$current_sdk_ver
2956     fi
2957     xcode_developer=`xcode-select -print-path`
2959     for sdkver in $current_sdk_ver; do
2960         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2961         if test -d $t; then
2962             ios_sdk=$sdkver
2963             sysroot=$t
2964             break
2965         fi
2966     done
2968     if test -z "$sysroot"; then
2969         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
2970     fi
2972     AC_MSG_RESULT($sysroot)
2974     IOS_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
2975     IOS_DEPLOYMENT_VERSION=$current_sdk_ver
2977     # LTO is not really recommended for iOS builds,
2978     # the link time will be astronomical
2979     if test "$ENABLE_LTO" = TRUE; then
2980         lto=-flto
2981     fi
2983     stdlib="-stdlib=libc++"
2985     CC="`xcrun -find clang` -arch $host_cpu -isysroot $sysroot $lto $versionmin"
2986     CXX="`xcrun -find clang++` -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
2988     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2989     AR=`xcrun -find ar`
2990     NM=`xcrun -find nm`
2991     STRIP=`xcrun -find strip`
2992     LIBTOOL=`xcrun -find libtool`
2993     RANLIB=`xcrun -find ranlib`
2996 AC_SUBST(IOS_SDK)
2997 AC_SUBST(IOS_DEPLOYMENT_VERSION)
2999 AC_MSG_CHECKING([whether to treat the installation as read-only])
3001 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3002         "$enable_extensions" != yes; then
3003     enable_readonly_installset=yes
3005 if test "$enable_readonly_installset" = yes; then
3006     AC_MSG_RESULT([yes])
3007     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3008 else
3009     AC_MSG_RESULT([no])
3012 dnl ===================================================================
3013 dnl Structure of install set
3014 dnl ===================================================================
3016 if test $_os = Darwin; then
3017     LIBO_BIN_FOLDER=MacOS
3018     LIBO_ETC_FOLDER=Resources
3019     LIBO_LIBEXEC_FOLDER=MacOS
3020     LIBO_LIB_FOLDER=Frameworks
3021     LIBO_LIB_PYUNO_FOLDER=Resources
3022     LIBO_SHARE_FOLDER=Resources
3023     LIBO_SHARE_HELP_FOLDER=Resources/help
3024     LIBO_SHARE_JAVA_FOLDER=Resources/java
3025     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3026     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3027     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3028     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3029     LIBO_URE_BIN_FOLDER=MacOS
3030     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3031     LIBO_URE_LIB_FOLDER=Frameworks
3032     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3033     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3034 elif test $_os = WINNT; then
3035     LIBO_BIN_FOLDER=program
3036     LIBO_ETC_FOLDER=program
3037     LIBO_LIBEXEC_FOLDER=program
3038     LIBO_LIB_FOLDER=program
3039     LIBO_LIB_PYUNO_FOLDER=program
3040     LIBO_SHARE_FOLDER=share
3041     LIBO_SHARE_HELP_FOLDER=help
3042     LIBO_SHARE_JAVA_FOLDER=program/classes
3043     LIBO_SHARE_PRESETS_FOLDER=presets
3044     LIBO_SHARE_READMES_FOLDER=readmes
3045     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3046     LIBO_SHARE_SHELL_FOLDER=program/shell
3047     LIBO_URE_BIN_FOLDER=program
3048     LIBO_URE_ETC_FOLDER=program
3049     LIBO_URE_LIB_FOLDER=program
3050     LIBO_URE_MISC_FOLDER=program
3051     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3052 else
3053     LIBO_BIN_FOLDER=program
3054     LIBO_ETC_FOLDER=program
3055     LIBO_LIBEXEC_FOLDER=program
3056     LIBO_LIB_FOLDER=program
3057     LIBO_LIB_PYUNO_FOLDER=program
3058     LIBO_SHARE_FOLDER=share
3059     LIBO_SHARE_HELP_FOLDER=help
3060     LIBO_SHARE_JAVA_FOLDER=program/classes
3061     LIBO_SHARE_PRESETS_FOLDER=presets
3062     LIBO_SHARE_READMES_FOLDER=readmes
3063     if test "$enable_fuzzers" != yes; then
3064         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3065     else
3066         LIBO_SHARE_RESOURCE_FOLDER=resource
3067     fi
3068     LIBO_SHARE_SHELL_FOLDER=program/shell
3069     LIBO_URE_BIN_FOLDER=program
3070     LIBO_URE_ETC_FOLDER=program
3071     LIBO_URE_LIB_FOLDER=program
3072     LIBO_URE_MISC_FOLDER=program
3073     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3075 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3076 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3077 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3078 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3079 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3080 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3081 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3082 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3083 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3084 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3085 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3086 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3087 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3088 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3089 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3090 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3092 # Not all of them needed in config_host.mk, add more if need arises
3093 AC_SUBST(LIBO_BIN_FOLDER)
3094 AC_SUBST(LIBO_ETC_FOLDER)
3095 AC_SUBST(LIBO_LIB_FOLDER)
3096 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3097 AC_SUBST(LIBO_SHARE_FOLDER)
3098 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3099 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3100 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3101 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3102 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3103 AC_SUBST(LIBO_URE_BIN_FOLDER)
3104 AC_SUBST(LIBO_URE_ETC_FOLDER)
3105 AC_SUBST(LIBO_URE_LIB_FOLDER)
3106 AC_SUBST(LIBO_URE_MISC_FOLDER)
3107 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3109 dnl ===================================================================
3110 dnl Windows specific tests and stuff
3111 dnl ===================================================================
3113 reg_get_value()
3115     # Return value: $regvalue
3116     unset regvalue
3118     local _regentry="/proc/registry${1}/${2}"
3119     if test -f "$_regentry"; then
3120         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3121         # Registry keys read via /proc/registry* are always \0 terminated!
3122         local _regvalue=$(tr -d '\0' < "$_regentry")
3123         if test $? -eq 0; then
3124             regvalue=$_regvalue
3125         fi
3126     fi
3129 # Get a value from the 32-bit side of the Registry
3130 reg_get_value_32()
3132     reg_get_value "32" "$1"
3135 # Get a value from the 64-bit side of the Registry
3136 reg_get_value_64()
3138     reg_get_value "64" "$1"
3141 if test "$_os" = "WINNT"; then
3142     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3143     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3144         AC_MSG_RESULT([no])
3145         WINDOWS_SDK_ARCH="x86"
3146     else
3147         AC_MSG_RESULT([yes])
3148         WINDOWS_SDK_ARCH="x64"
3149         BITNESS_OVERRIDE=64
3150     fi
3152 if test "$_os" = "iOS"; then
3153     cross_compiling="yes"
3156 if test "$cross_compiling" = "yes"; then
3157     export CROSS_COMPILING=TRUE
3158 else
3159     CROSS_COMPILING=
3160     BUILD_TYPE="$BUILD_TYPE NATIVE"
3162 AC_SUBST(CROSS_COMPILING)
3164 USE_LD=
3165 if test -n "$enable_ld" -a "$enable_ld" != "no"; then
3166     AC_MSG_CHECKING([for -fuse-ld=$enable_ld linker support])
3167     if test "$GCC" = "yes"; then
3168         ldflags_save=$LDFLAGS
3169         LDFLAGS="$LDFLAGS -fuse-ld=$enable_ld"
3170         AC_LINK_IFELSE([AC_LANG_PROGRAM([
3171 #include <stdio.h>
3172             ],[
3173 printf ("hello world\n");
3174             ])], USE_LD=$enable_ld, [])
3175         if test -n "$USE_LD"; then
3176             AC_MSG_RESULT( yes )
3177             LDFLAGS="$ldflags_save -fuse-ld=$enable_ld"
3178         else
3179             AC_MSG_ERROR( no )
3180         fi
3181     else
3182         AC_MSG_ERROR( not supported )
3183     fi
3185 AC_SUBST(USE_LD)
3187 ENABLE_GDB_INDEX=
3188 if test "$enable_gdb_index" = "yes"; then
3189     AC_MSG_CHECKING([whether $CC supports -ggnu-pubnames])
3190     save_CFLAGS=$CFLAGS
3191     CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
3192     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ AC_MSG_RESULT( yes )],[ AC_MSG_ERROR( no )])
3194     AC_MSG_CHECKING([whether $CC supports -Wl,--gdb-index])
3195     ldflags_save=$LDFLAGS
3196     LDFLAGS="$LDFLAGS -Wl,--gdb-index"
3197     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3198 #include <stdio.h>
3199         ],[
3200 printf ("hello world\n");
3201         ])], ENABLE_GDB_INDEX=TRUE, [])
3202     if test "$ENABLE_GDB_INDEX" = "TRUE"; then
3203         AC_MSG_RESULT( yes )
3204     else
3205         AC_MSG_ERROR( no )
3206     fi
3207     CFLAGS=$save_CFLAGS
3208     LDFLAGS=$ldflags_save
3210 AC_SUBST(ENABLE_GDB_INDEX)
3212 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3213 if test "$GCC" = "yes"; then
3214     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
3215     bsymbolic_functions_ldflags_save=$LDFLAGS
3216     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
3217     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3218 #include <stdio.h>
3219         ],[
3220 printf ("hello world\n");
3221         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3222     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3223         AC_MSG_RESULT( found )
3224     else
3225         AC_MSG_RESULT( not found )
3226     fi
3227     LDFLAGS=$bsymbolic_functions_ldflags_save
3229 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3231 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3232 # NOTE: must _not_ be used for bundled external libraries!
3233 ISYSTEM=
3234 if test "$GCC" = "yes"; then
3235     AC_MSG_CHECKING( for -isystem )
3236     save_CFLAGS=$CFLAGS
3237     CFLAGS="$CFLAGS -Werror"
3238     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3239     CFLAGS=$save_CFLAGS
3240     if test -n "$ISYSTEM"; then
3241         AC_MSG_RESULT(yes)
3242     else
3243         AC_MSG_RESULT(no)
3244     fi
3246 if test -z "$ISYSTEM"; then
3247     # fall back to using -I
3248     ISYSTEM=-I
3250 AC_SUBST(ISYSTEM)
3252 dnl ===================================================================
3253 dnl  Check which Visual Studio compiler is used
3254 dnl ===================================================================
3256 map_vs_year_to_version()
3258     # Return value: $vsversion
3260     unset vsversion
3262     case $1 in
3263     2017)
3264         vsversion=15.0;;
3265     *)
3266         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3267     esac
3270 vs_versions_to_check()
3272     # Args: $1 (optional) : versions to check, in the order of preference
3273     # Return value: $vsversions
3275     unset vsversions
3277     if test -n "$1"; then
3278         map_vs_year_to_version "$1"
3279         vsversions=$vsversion
3280     else
3281         # We accept only 2017
3282         vsversions="15.0"
3283     fi
3286 win_get_env_from_vsvars32bat()
3288     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3289     # Also seems to be located in another directory under the same name: vsvars32.bat
3290     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3291     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3292     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3293     chmod +x $WRAPPERBATCHFILEPATH
3294     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3295     rm -f $WRAPPERBATCHFILEPATH
3296     printf '%s' "$_win_get_env_from_vsvars32bat"
3299 find_ucrt()
3301     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3302     if test -n "$regvalue"; then
3303         PathFormat "$regvalue"
3304         UCRTSDKDIR=$formatted_path
3305         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3306         UCRTVERSION=$regvalue
3307         # Rest if not exist
3308         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3309           UCRTSDKDIR=
3310         fi
3311     fi
3312     if test -z "$UCRTSDKDIR"; then
3313         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3314         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3315         if test -f "$ide_env_file"; then
3316             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3317             UCRTSDKDIR=$formatted_path
3318             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3319             dnl Hack needed at least by tml:
3320             if test "$UCRTVERSION" = 10.0.15063.0 \
3321                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3322                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3323             then
3324                 UCRTVERSION=10.0.14393.0
3325             fi
3326         else
3327           AC_MSG_ERROR([No UCRT found])
3328         fi
3329     fi
3332 find_msvc()
3334     # Find Visual C++ 2017
3335     # Args: $1 (optional) : The VS version year
3336     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3338     unset vctest vcnum vcnumwithdot vcbuildnumber
3340     vs_versions_to_check "$1"
3342     for ver in $vsversions; do
3343         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3344         if test -n "$regvalue"; then
3345             vctest=$regvalue
3346             break
3347         fi
3348         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver
3349         if test -n "$regvalue"; then
3350             AC_MSG_RESULT([found: $regvalue])
3351             PathFormat "$regvalue"
3352             vctest=$formatted_path
3353             break
3354         fi
3355     done
3356     if test -n "$vctest"; then
3357         vcnumwithdot=$ver
3358         case "$vcnumwithdot" in
3359         15.0)
3360             vcyear=2017
3361             vcnum=150
3362             vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3363             ;;
3364         esac
3365     fi
3368 SOLARINC=
3369 MSBUILD_PATH=
3370 DEVENV=
3371 if test "$_os" = "WINNT"; then
3372     AC_MSG_CHECKING([Visual C++])
3374     find_msvc "$with_visual_studio"
3375     if test -z "$vctest"; then
3376         if test -n "$with_visual_studio"; then
3377             AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3378         else
3379             AC_MSG_ERROR([No Visual Studio 2017 installation found])
3380         fi
3381     fi
3383     if test "$BITNESS_OVERRIDE" = ""; then
3384         if test -f "$vctest/bin/cl.exe"; then
3385             VC_PRODUCT_DIR=$vctest
3386         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3387             VC_PRODUCT_DIR=$vctest/VC
3388         else
3389             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3390         fi
3391     else
3392         if test -f "$vctest/bin/amd64/cl.exe"; then
3393             VC_PRODUCT_DIR=$vctest
3394         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3395             VC_PRODUCT_DIR=$vctest/VC
3396         else
3397             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])
3398         fi
3399     fi
3401     AC_MSG_CHECKING([for short pathname of VC product directory])
3402     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3403     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3405     UCRTSDKDIR=
3406     UCRTVERSION=
3408     AC_MSG_CHECKING([for UCRT location])
3409     find_ucrt
3410     # find_ucrt errors out if it doesn't find it
3411     AC_MSG_RESULT([found])
3412     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3413     ucrtincpath_formatted=$formatted_path
3414     # SOLARINC is used for external modules and must be set too.
3415     # And no, it's not sufficient to set SOLARINC only, as configure
3416     # itself doesn't honour it.
3417     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3418     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3419     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3420     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3422     AC_SUBST(UCRTSDKDIR)
3423     AC_SUBST(UCRTVERSION)
3425     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3426     # Find the proper version of MSBuild.exe to use based on the VS version
3427     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3428     if test -n "$regvalue" ; then
3429         AC_MSG_RESULT([found: $regvalue])
3430         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3431     else
3432         if test "$BITNESS_OVERRIDE" = ""; then
3433             regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3434         else
3435             regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3436         fi
3437         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3438         AC_MSG_RESULT([$regvalue])
3439     fi
3441     # Find the version of devenv.exe
3442     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3443     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3444     if test ! -e "$DEVENV"; then
3445         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3446     fi
3448     dnl ===========================================================
3449     dnl  Check for the corresponding mspdb*.dll
3450     dnl ===========================================================
3452     MSPDB_PATH=
3453     CL_DIR=
3454     CL_LIB=
3456     if test "$BITNESS_OVERRIDE" = ""; then
3457         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86"
3458         CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX86/x86
3459     else
3460         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64"
3461         CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX64/x64
3462     fi
3464     # MSVC 15.0 has libraries from 14.0?
3465     mspdbnum="140"
3467     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3468         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3469     fi
3471     MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3472     MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3474     dnl The path needs to be added before cl is called
3475     PATH="$MSPDB_PATH:$PATH"
3477     AC_MSG_CHECKING([cl.exe])
3479     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3480     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3481     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3482     # is not enough?
3484     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3485     dnl needed when building CLR code:
3486     if test -z "$MSVC_CXX"; then
3487         if test "$BITNESS_OVERRIDE" = ""; then
3488             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3489                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3490             fi
3491         else
3492             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3493                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3494             fi
3495         fi
3497         # This gives us a posix path with 8.3 filename restrictions
3498         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3499     fi
3501     if test -z "$CC"; then
3502         CC=$MSVC_CXX
3503     fi
3504     if test "$BITNESS_OVERRIDE" = ""; then
3505         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3506         MSVC_CXX="$MSVC_CXX -arch:SSE"
3507     fi
3509     if test -n "$CC"; then
3510         # Remove /cl.exe from CC case insensitive
3511         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3512         if test "$BITNESS_OVERRIDE" = ""; then
3513            COMPATH="$VC_PRODUCT_DIR"
3514         else
3515             if test -n "$VC_PRODUCT_DIR"; then
3516                 COMPATH=$VC_PRODUCT_DIR
3517             fi
3518         fi
3519         if test "$BITNESS_OVERRIDE" = ""; then
3520             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3521             CC="$CC -arch:SSE"
3522         fi
3524         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3526         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3528         PathFormat "$COMPATH"
3529         COMPATH="$formatted_path"
3531         VCVER=$vcnum
3532         MSVSVER=$vcyear
3534         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3535         # are always "better", we list them in reverse chronological order.
3537         case $vcnum in
3538         150)
3539             COMEX=19
3540             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3541             ;;
3542         esac
3544         # The expectation is that --with-windows-sdk should not need to be used
3545         if test -n "$with_windows_sdk"; then
3546             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3547             *" "$with_windows_sdk" "*)
3548                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3549                 ;;
3550             *)
3551                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3552                 ;;
3553             esac
3554         fi
3556         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3557         ac_objext=obj
3558         ac_exeext=exe
3560     else
3561         AC_MSG_ERROR([Visual C++ not found after all, huh])
3562     fi
3564     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3565     # version of the Explorer extension (and maybe other small
3566     # bits, too) needed when installing a 32-bit LibreOffice on a
3567     # 64-bit OS. The 64-bit Explorer extension is a feature that
3568     # has been present since long in OOo. Don't confuse it with
3569     # building LibreOffice itself as 64-bit code.
3571     BUILD_X64=
3572     CXX_X64_BINARY=
3573     LINK_X64_BINARY=
3575     if test "$BITNESS_OVERRIDE" = ""; then
3576         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3577         if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3578             # Prefer native x64 compiler to cross-compiler, in case we are running
3579             # the build on a 64-bit OS.
3580             if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3581                 BUILD_X64=TRUE
3582                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3583                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3584             elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3585                 BUILD_X64=TRUE
3586                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3587                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3588             fi
3589         elif test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib"; then
3590             # nobody uses 32-bit OS to build, just pick the 64-bit compiler
3591             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3592                 BUILD_X64=TRUE
3593                 CXX_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"
3594                 LINK_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/link.exe"
3595             fi
3596         fi
3597         if test "$BUILD_X64" = TRUE; then
3598             AC_MSG_RESULT([found])
3599         else
3600             AC_MSG_RESULT([not found])
3601             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3602         fi
3603     fi
3604     AC_SUBST(BUILD_X64)
3606     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3607     AC_SUBST(CXX_X64_BINARY)
3608     AC_SUBST(LINK_X64_BINARY)
3610 AC_SUBST(VCVER)
3611 AC_SUBST(DEVENV)
3612 PathFormat "$MSPDB_PATH"
3613 MSPDB_PATH="$formatted_path"
3614 AC_SUBST(MSVC_CXX)
3617 # unowinreg.dll
3619 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3620 AC_SUBST(UNOWINREG_DLL)
3622 COM_IS_CLANG=
3623 AC_MSG_CHECKING([whether the compiler is actually Clang])
3624 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3625     #ifndef __clang__
3626     you lose
3627     #endif
3628     int foo=42;
3629     ]])],
3630     [AC_MSG_RESULT([yes])
3631      COM_IS_CLANG=TRUE],
3632     [AC_MSG_RESULT([no])])
3634 CC_PLAIN=$CC
3635 if test "$COM_IS_CLANG" = TRUE; then
3636     AC_MSG_CHECKING([the Clang version])
3637     if test "$_os" = WINNT; then
3638         dnl In which case, assume clang-cl:
3639         my_args="/EP /TC"
3640         dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3641         dnl clang-cl:
3642         CC_PLAIN=
3643         for i in $CC; do
3644             case $i in
3645             -FIIntrin.h)
3646                 ;;
3647             *)
3648                 CC_PLAIN="$CC_PLAIN $i"
3649                 ;;
3650             esac
3651         done
3652     else
3653         my_args="-E -P"
3654     fi
3655     clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args -`
3656     CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3657     CLANGVER=`echo $clang_version \
3658         | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3659     AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3660     AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3661     AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3663 AC_SUBST(COM_IS_CLANG)
3664 AC_SUBST(CLANGVER)
3666 SHOWINCLUDES_PREFIX=
3667 if test "$_os" = WINNT; then
3668     dnl We need to guess the prefix of the -showIncludes output, it can be
3669     dnl localized
3670     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3671     echo "#include <stdlib.h>" > conftest.c
3672     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3673         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3674     rm -f conftest.c conftest.obj
3675     if test -z "$SHOWINCLUDES_PREFIX"; then
3676         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3677     else
3678         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3679     fi
3681 AC_SUBST(SHOWINCLUDES_PREFIX)
3684 # prefix C with ccache if needed
3686 if test "$CCACHE" != ""; then
3687     AC_MSG_CHECKING([whether $CC is already ccached])
3689     AC_LANG_PUSH([C])
3690     save_CFLAGS=$CFLAGS
3691     CFLAGS="$CFLAGS --ccache-skip -O2"
3692     dnl an empty program will do, we're checking the compiler flags
3693     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3694                       [use_ccache=yes], [use_ccache=no])
3695     if test $use_ccache = yes; then
3696         AC_MSG_RESULT([yes])
3697     else
3698         CC="$CCACHE $CC"
3699         AC_MSG_RESULT([no])
3700     fi
3701     CFLAGS=$save_CFLAGS
3702     AC_LANG_POP([C])
3705 # ===================================================================
3706 # check various GCC options that Clang does not support now but maybe
3707 # will somewhen in the future, check them even for GCC, so that the
3708 # flags are set
3709 # ===================================================================
3711 HAVE_GCC_GGDB2=
3712 HAVE_GCC_FINLINE_LIMIT=
3713 HAVE_GCC_FNO_INLINE=
3714 if test "$GCC" = "yes"; then
3715     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3716     save_CFLAGS=$CFLAGS
3717     CFLAGS="$CFLAGS -Werror -ggdb2"
3718     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3719     CFLAGS=$save_CFLAGS
3720     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3721         AC_MSG_RESULT([yes])
3722     else
3723         AC_MSG_RESULT([no])
3724     fi
3726     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3727     save_CFLAGS=$CFLAGS
3728     CFLAGS="$CFLAGS -Werror -finline-limit=0"
3729     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3730     CFLAGS=$save_CFLAGS
3731     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3732         AC_MSG_RESULT([yes])
3733     else
3734         AC_MSG_RESULT([no])
3735     fi
3737     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3738     save_CFLAGS=$CFLAGS
3739     CFLAGS="$CFLAGS -Werror -fno-inline"
3740     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3741     CFLAGS=$save_CFLAGS
3742     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3743         AC_MSG_RESULT([yes])
3744     else
3745         AC_MSG_RESULT([no])
3746     fi
3748     if test "$host_cpu" = "m68k"; then
3749         AC_MSG_CHECKING([whether $CC supports -mlong-jump-table-offsets])
3750         save_CFLAGS=$CFLAGS
3751         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3752         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3753         CFLAGS=$save_CFLAGS
3754         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3755             AC_MSG_RESULT([yes])
3756         else
3757             AC_MSG_ERROR([no])
3758         fi
3759     fi
3761 AC_SUBST(HAVE_GCC_GGDB2)
3762 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3763 AC_SUBST(HAVE_GCC_FNO_INLINE)
3765 dnl ===================================================================
3766 dnl  Test the gcc version
3767 dnl ===================================================================
3768 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3769     AC_MSG_CHECKING([the GCC version])
3770     _gcc_version=`$CC -dumpversion`
3771     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3772         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3773     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3775     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3777     if test "$gcc_full_version" -lt 40801; then
3778         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.8.1])
3779     fi
3780 else
3781     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3782     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3783     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3784     # (which reports itself as GCC 4.2.1).
3785     GCC_VERSION=
3787 AC_SUBST(GCC_VERSION)
3789 dnl Set the ENABLE_DBGUTIL variable
3790 dnl ===================================================================
3791 AC_MSG_CHECKING([whether to build with additional debug utilities])
3792 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3793     ENABLE_DBGUTIL="TRUE"
3794     # this is an extra var so it can have different default on different MSVC
3795     # versions (in case there are version specific problems with it)
3796     MSVC_USE_DEBUG_RUNTIME="TRUE"
3798     AC_MSG_RESULT([yes])
3799     # cppunit and graphite expose STL in public headers
3800     if test "$with_system_cppunit" = "yes"; then
3801         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3802     else
3803         with_system_cppunit=no
3804     fi
3805     if test "$with_system_graphite" = "yes"; then
3806         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3807     else
3808         with_system_graphite=no
3809     fi
3810     if test "$with_system_mysql_cppconn" = "yes"; then
3811         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3812     else
3813         with_system_mysql_cppconn=no
3814     fi
3815     if test "$with_system_orcus" = "yes"; then
3816         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3817     else
3818         with_system_orcus=no
3819     fi
3820     if test "$with_system_libcmis" = "yes"; then
3821         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3822     else
3823         with_system_libcmis=no
3824     fi
3825     if test "$with_system_hunspell" = "yes"; then
3826         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3827     else
3828         with_system_hunspell=no
3829     fi
3830     if test "$with_system_gpgmepp" = "yes"; then
3831         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3832     else
3833         with_system_gpgmepp=no
3834     fi
3835     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3836     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3837     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3838     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3839     # of those two is using the system variant:
3840     if test "$with_system_libnumbertext" = "yes"; then
3841         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3842     else
3843         with_system_libnumbertext=no
3844     fi
3845     if test "$with_system_libwps" = "yes"; then
3846         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3847     else
3848         with_system_libwps=no
3849     fi
3850 else
3851     ENABLE_DBGUTIL=""
3852     MSVC_USE_DEBUG_RUNTIME=""
3853     AC_MSG_RESULT([no])
3855 AC_SUBST(ENABLE_DBGUTIL)
3856 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3858 dnl Set the ENABLE_DEBUG variable.
3859 dnl ===================================================================
3860 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3861     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3863 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3864     if test -z "$libo_fuzzed_enable_debug"; then
3865         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3866     else
3867         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3868         enable_debug=yes
3869     fi
3872 AC_MSG_CHECKING([whether to do a debug build])
3873 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3874     ENABLE_DEBUG="TRUE"
3875     if test -n "$ENABLE_DBGUTIL" ; then
3876         AC_MSG_RESULT([yes (dbgutil)])
3877     else
3878         AC_MSG_RESULT([yes])
3879     fi
3880 else
3881     ENABLE_DEBUG=""
3882     AC_MSG_RESULT([no])
3884 AC_SUBST(ENABLE_DEBUG)
3886 if test "$enable_split_debug" = yes; then
3887     HAVE_GSPLIT_DWARF=
3888     if test "$GCC" = "yes"; then
3889         AC_MSG_CHECKING([whether $CC supports -gsplit-dwarf])
3890         save_CFLAGS=$CFLAGS
3891         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
3892         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
3893         CFLAGS=$save_CFLAGS
3894         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
3895             AC_MSG_RESULT([yes])
3896         else
3897             AC_MSG_RESULT([no])
3898         fi
3899     fi
3900     AC_SUBST(HAVE_GCC_SPLIT_DWARF)
3903 if test "$enable_sal_log" = yes; then
3904     ENABLE_SAL_LOG=TRUE
3906 AC_SUBST(ENABLE_SAL_LOG)
3908 dnl Selective debuginfo
3909 ENABLE_DEBUGINFO_FOR=
3910 if test -n "$ENABLE_DEBUG"; then
3911     AC_MSG_CHECKING([whether to use selective debuginfo])
3912     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3913         if test "$enable_selective_debuginfo" = "yes"; then
3914             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3915         fi
3916         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3917         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3918     else
3919         ENABLE_DEBUGINFO_FOR=all
3920         AC_MSG_RESULT([no, for all])
3921     fi
3922 else
3923     if test -n "$enable_selective_debuginfo"; then
3924         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
3925     fi
3927 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3929 dnl Check for enable symbols option
3930 dnl ===================================================================
3931 AC_MSG_CHECKING([whether to generate debug information])
3932 if test -z "$enable_symbols"; then
3933     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3934         enable_symbols=yes
3935     else
3936         enable_symbols=no
3937     fi
3939 if test "$enable_symbols" != no; then
3940     ENABLE_SYMBOLS=TRUE
3941     AC_MSG_RESULT([yes])
3942 else
3943     ENABLE_SYMBOLS=
3944     AC_MSG_RESULT([no])
3946 AC_SUBST(ENABLE_SYMBOLS)
3948 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
3949     # Building on Android with full symbols: without enough memory the linker never finishes currently.
3950     AC_MSG_CHECKING([whether enough memory is available for linking])
3951     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
3952     # Check for 15GB, as Linux reports a bit less than the physical memory size.
3953     if test -n "$mem_size" -a $mem_size -lt 15728640; then
3954         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
3955     else
3956         AC_MSG_RESULT([yes])
3957     fi
3960 AC_MSG_CHECKING([whether to compile with optimization flags])
3961 if test -z "$enable_optimized"; then
3962     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3963         enable_optimized=no
3964     else
3965         enable_optimized=yes
3966     fi
3968 if test "$enable_optimized" != no; then
3969     ENABLE_OPTIMIZED=TRUE
3970     AC_MSG_RESULT([yes])
3971 else
3972     ENABLE_OPTIMIZED=
3973     AC_MSG_RESULT([no])
3975 AC_SUBST(ENABLE_OPTIMIZED)
3978 # determine CPUNAME, OS, ...
3979 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
3981 case "$host_os" in
3983 aix*)
3984     COM=GCC
3985     CPUNAME=POWERPC
3986     USING_X11=TRUE
3987     OS=AIX
3988     RTL_OS=AIX
3989     RTL_ARCH=PowerPC
3990     PLATFORMID=aix_powerpc
3991     P_SEP=:
3992     ;;
3994 cygwin*)
3995     COM=MSC
3996     USING_X11=
3997     OS=WNT
3998     RTL_OS=Windows
3999     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4000         P_SEP=";"
4001     else
4002         P_SEP=:
4003     fi
4004     case "$host_cpu" in
4005     i*86|x86_64)
4006         if test "$BITNESS_OVERRIDE" = 64; then
4007             CPUNAME=X86_64
4008             RTL_ARCH=X86_64
4009             PLATFORMID=windows_x86_64
4010             WINDOWS_X64=1
4011             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4012         else
4013             CPUNAME=INTEL
4014             RTL_ARCH=x86
4015             PLATFORMID=windows_x86
4016         fi
4017         ;;
4018     *)
4019         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4020         ;;
4021     esac
4022     SCPDEFS="$SCPDEFS -D_MSC_VER"
4023     ;;
4025 darwin*)
4026     COM=GCC
4027     USING_X11=
4028     OS=MACOSX
4029     RTL_OS=MacOSX
4030     P_SEP=:
4032     case "$host_cpu" in
4033     arm)
4034         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4035         ;;
4036     arm64)
4037         OS=IOS
4038         if test "$enable_ios_simulator" = "yes"; then
4039             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4040         else
4041             CPUNAME=ARM64
4042             RTL_ARCH=ARM_EABI
4043             PLATFORMID=ios_arm64
4044         fi
4045         ;;
4046     i*86)
4047         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4048         ;;
4049     x86_64)
4050         if test "$enable_ios_simulator" = "yes"; then
4051             OS=IOS
4052         fi
4053         CPUNAME=X86_64
4054         RTL_ARCH=X86_64
4055         PLATFORMID=macosx_x86_64
4056         ;;
4057     *)
4058         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4059         ;;
4060     esac
4061     ;;
4063 dragonfly*)
4064     COM=GCC
4065     USING_X11=TRUE
4066     OS=DRAGONFLY
4067     RTL_OS=DragonFly
4068     P_SEP=:
4070     case "$host_cpu" in
4071     i*86)
4072         CPUNAME=INTEL
4073         RTL_ARCH=x86
4074         PLATFORMID=dragonfly_x86
4075         ;;
4076     x86_64)
4077         CPUNAME=X86_64
4078         RTL_ARCH=X86_64
4079         PLATFORMID=dragonfly_x86_64
4080         ;;
4081     *)
4082         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4083         ;;
4084     esac
4085     ;;
4087 freebsd*)
4088     COM=GCC
4089     USING_X11=TRUE
4090     RTL_OS=FreeBSD
4091     OS=FREEBSD
4092     P_SEP=:
4094     case "$host_cpu" in
4095     i*86)
4096         CPUNAME=INTEL
4097         RTL_ARCH=x86
4098         PLATFORMID=freebsd_x86
4099         ;;
4100     x86_64|amd64)
4101         CPUNAME=X86_64
4102         RTL_ARCH=X86_64
4103         PLATFORMID=freebsd_x86_64
4104         ;;
4105     *)
4106         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4107         ;;
4108     esac
4109     ;;
4111 haiku*)
4112     COM=GCC
4113     USING_X11=
4114     GUIBASE=haiku
4115     RTL_OS=Haiku
4116     OS=HAIKU
4117     P_SEP=:
4119     case "$host_cpu" in
4120     i*86)
4121         CPUNAME=INTEL
4122         RTL_ARCH=x86
4123         PLATFORMID=haiku_x86
4124         ;;
4125     x86_64|amd64)
4126         CPUNAME=X86_64
4127         RTL_ARCH=X86_64
4128         PLATFORMID=haiku_x86_64
4129         ;;
4130     *)
4131         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4132         ;;
4133     esac
4134     ;;
4136 kfreebsd*)
4137     COM=GCC
4138     USING_X11=TRUE
4139     OS=LINUX
4140     RTL_OS=kFreeBSD
4141     P_SEP=:
4143     case "$host_cpu" in
4145     i*86)
4146         CPUNAME=INTEL
4147         RTL_ARCH=x86
4148         PLATFORMID=kfreebsd_x86
4149         ;;
4150     x86_64)
4151         CPUNAME=X86_64
4152         RTL_ARCH=X86_64
4153         PLATFORMID=kfreebsd_x86_64
4154         ;;
4155     *)
4156         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4157         ;;
4158     esac
4159     ;;
4161 linux-gnu*)
4162     COM=GCC
4163     USING_X11=TRUE
4164     OS=LINUX
4165     RTL_OS=Linux
4166     P_SEP=:
4168     case "$host_cpu" in
4170     aarch64)
4171         CPUNAME=AARCH64
4172         PLATFORMID=linux_aarch64
4173         RTL_ARCH=AARCH64
4174         ;;
4175     alpha)
4176         CPUNAME=AXP
4177         RTL_ARCH=ALPHA
4178         PLATFORMID=linux_alpha
4179         ;;
4180     arm*)
4181         CPUNAME=ARM
4182         EPM_FLAGS="-a arm"
4183         RTL_ARCH=ARM_EABI
4184         PLATFORMID=linux_arm_eabi
4185         case "$host_cpu" in
4186         arm*-linux)
4187             RTL_ARCH=ARM_OABI
4188             PLATFORMID=linux_arm_oabi
4189             ;;
4190         esac
4191         ;;
4192     hppa)
4193         CPUNAME=HPPA
4194         RTL_ARCH=HPPA
4195         EPM_FLAGS="-a hppa"
4196         PLATFORMID=linux_hppa
4197         ;;
4198     i*86)
4199         CPUNAME=INTEL
4200         RTL_ARCH=x86
4201         PLATFORMID=linux_x86
4202         ;;
4203     ia64)
4204         CPUNAME=IA64
4205         RTL_ARCH=IA64
4206         PLATFORMID=linux_ia64
4207         ;;
4208     mips)
4209         CPUNAME=GODSON
4210         RTL_ARCH=MIPS_EB
4211         EPM_FLAGS="-a mips"
4212         PLATFORMID=linux_mips_eb
4213         ;;
4214     mips64)
4215         CPUNAME=GODSON64
4216         RTL_ARCH=MIPS64_EB
4217         EPM_FLAGS="-a mips64"
4218         PLATFORMID=linux_mips64_eb
4219         ;;
4220     mips64el)
4221         CPUNAME=GODSON64
4222         RTL_ARCH=MIPS64_EL
4223         EPM_FLAGS="-a mips64el"
4224         PLATFORMID=linux_mips64_el
4225         ;;
4226     mipsel)
4227         CPUNAME=GODSON
4228         RTL_ARCH=MIPS_EL
4229         EPM_FLAGS="-a mipsel"
4230         PLATFORMID=linux_mips_el
4231         ;;
4232     m68k)
4233         CPUNAME=M68K
4234         RTL_ARCH=M68K
4235         PLATFORMID=linux_m68k
4236         ;;
4237     powerpc)
4238         CPUNAME=POWERPC
4239         RTL_ARCH=PowerPC
4240         PLATFORMID=linux_powerpc
4241         ;;
4242     powerpc64)
4243         CPUNAME=POWERPC64
4244         RTL_ARCH=PowerPC_64
4245         PLATFORMID=linux_powerpc64
4246         ;;
4247     powerpc64le)
4248         CPUNAME=POWERPC64
4249         RTL_ARCH=PowerPC_64_LE
4250         PLATFORMID=linux_powerpc64_le
4251         ;;
4252     sparc)
4253         CPUNAME=SPARC
4254         RTL_ARCH=SPARC
4255         PLATFORMID=linux_sparc
4256         ;;
4257     sparc64)
4258         CPUNAME=SPARC64
4259         RTL_ARCH=SPARC64
4260         PLATFORMID=linux_sparc64
4261         ;;
4262     s390)
4263         CPUNAME=S390
4264         RTL_ARCH=S390
4265         PLATFORMID=linux_s390
4266         ;;
4267     s390x)
4268         CPUNAME=S390X
4269         RTL_ARCH=S390x
4270         PLATFORMID=linux_s390x
4271         ;;
4272     x86_64)
4273         CPUNAME=X86_64
4274         RTL_ARCH=X86_64
4275         PLATFORMID=linux_x86_64
4276         ;;
4277     *)
4278         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4279         ;;
4280     esac
4281     ;;
4283 linux-android*)
4284     COM=GCC
4285     USING_X11=
4286     OS=ANDROID
4287     RTL_OS=Android
4288     P_SEP=:
4290     case "$host_cpu" in
4292     arm|armel)
4293         CPUNAME=ARM
4294         RTL_ARCH=ARM_EABI
4295         PLATFORMID=android_arm_eabi
4296         ;;
4297     aarch64)
4298         CPUNAME=AARCH64
4299         RTL_ARCH=AARCH64
4300         PLATFORMID=android_aarch64
4301         ;;
4302     mips|mipsel)
4303         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4304         RTL_ARCH=MIPS_EL
4305         PLATFORMID=android_mips_el
4306         ;;
4307     i*86)
4308         CPUNAME=INTEL
4309         RTL_ARCH=x86
4310         PLATFORMID=android_x86
4311         ;;
4312     *)
4313         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4314         ;;
4315     esac
4316     ;;
4318 *netbsd*)
4319     COM=GCC
4320     USING_X11=TRUE
4321     OS=NETBSD
4322     RTL_OS=NetBSD
4323     P_SEP=:
4325     case "$host_cpu" in
4326     i*86)
4327         CPUNAME=INTEL
4328         RTL_ARCH=x86
4329         PLATFORMID=netbsd_x86
4330         ;;
4331     powerpc)
4332         CPUNAME=POWERPC
4333         RTL_ARCH=PowerPC
4334         PLATFORMID=netbsd_powerpc
4335         ;;
4336     sparc)
4337         CPUNAME=SPARC
4338         RTL_ARCH=SPARC
4339         PLATFORMID=netbsd_sparc
4340         ;;
4341     x86_64)
4342         CPUNAME=X86_64
4343         RTL_ARCH=X86_64
4344         PLATFORMID=netbsd_x86_64
4345         ;;
4346     *)
4347         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4348         ;;
4349     esac
4350     ;;
4352 openbsd*)
4353     COM=GCC
4354     USING_X11=TRUE
4355     OS=OPENBSD
4356     RTL_OS=OpenBSD
4357     P_SEP=:
4359     case "$host_cpu" in
4360     i*86)
4361         CPUNAME=INTEL
4362         RTL_ARCH=x86
4363         PLATFORMID=openbsd_x86
4364         ;;
4365     x86_64)
4366         CPUNAME=X86_64
4367         RTL_ARCH=X86_64
4368         PLATFORMID=openbsd_x86_64
4369         ;;
4370     *)
4371         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4372         ;;
4373     esac
4374     SOLARINC="$SOLARINC -I/usr/local/include"
4375     ;;
4377 solaris*)
4378     COM=GCC
4379     USING_X11=TRUE
4380     OS=SOLARIS
4381     RTL_OS=Solaris
4382     P_SEP=:
4384     case "$host_cpu" in
4385     i*86)
4386         CPUNAME=INTEL
4387         RTL_ARCH=x86
4388         PLATFORMID=solaris_x86
4389         ;;
4390     sparc)
4391         CPUNAME=SPARC
4392         RTL_ARCH=SPARC
4393         PLATFORMID=solaris_sparc
4394         ;;
4395     sparc64)
4396         CPUNAME=SPARC64
4397         RTL_ARCH=SPARC64
4398         PLATFORMID=solaris_sparc64
4399         ;;
4400     *)
4401         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4402         ;;
4403     esac
4404     SOLARINC="$SOLARINC -I/usr/local/include"
4405     ;;
4408     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4409     ;;
4410 esac
4412 if test "$with_x" = "no"; then
4413     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4416 ENABLE_HEADLESS=""
4417 if test "$enable_gui" = "no"; then
4418     if test "$USING_X11" != TRUE; then
4419         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4420     fi
4421     USING_X11=
4422     ENABLE_HEADLESS=TRUE
4423     AC_DEFINE(HAVE_FEATURE_UI,0)
4424     test_cairo=yes
4426 AC_SUBST(ENABLE_HEADLESS)
4428 WORKDIR="${BUILDDIR}/workdir"
4429 INSTDIR="${BUILDDIR}/instdir"
4430 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4431 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4432 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4433 AC_SUBST(COM)
4434 AC_SUBST(CPUNAME)
4435 AC_SUBST(RTL_OS)
4436 AC_SUBST(RTL_ARCH)
4437 AC_SUBST(EPM_FLAGS)
4438 AC_SUBST(USING_X11)
4439 AC_SUBST([INSTDIR])
4440 AC_SUBST([INSTROOT])
4441 AC_SUBST([INSTROOTBASE])
4442 AC_SUBST(OS)
4443 AC_SUBST(P_SEP)
4444 AC_SUBST(WORKDIR)
4445 AC_SUBST(PLATFORMID)
4446 AC_SUBST(WINDOWS_X64)
4447 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4449 dnl ===================================================================
4450 dnl Test which package format to use
4451 dnl ===================================================================
4452 AC_MSG_CHECKING([which package format to use])
4453 if test -n "$with_package_format" -a "$with_package_format" != no; then
4454     for i in $with_package_format; do
4455         case "$i" in
4456         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4457             ;;
4458         *)
4459             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4460 aix - AIX software distribution
4461 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4462 deb - Debian software distribution
4463 pkg - Solaris software distribution
4464 rpm - RedHat software distribution
4466 LibreOffice additionally supports:
4467 archive - .tar.gz or .zip
4468 dmg - Mac OS X .dmg
4469 installed - installation tree
4470 msi - Windows .msi
4471         ])
4472             ;;
4473         esac
4474     done
4475     # fakeroot is needed to ensure correct file ownerships/permissions
4476     # inside deb packages and tar archives created on Linux and Solaris.
4477     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4478         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4479         if test "$FAKEROOT" = "no"; then
4480             AC_MSG_ERROR(
4481                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4482         fi
4483     fi
4484     PKGFORMAT="$with_package_format"
4485     AC_MSG_RESULT([$PKGFORMAT])
4486 else
4487     PKGFORMAT=
4488     AC_MSG_RESULT([none])
4490 AC_SUBST(PKGFORMAT)
4492 dnl ===================================================================
4493 dnl Set up a different compiler to produce tools to run on the build
4494 dnl machine when doing cross-compilation
4495 dnl ===================================================================
4497 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4498 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4499 if test "$cross_compiling" = "yes"; then
4500     AC_MSG_CHECKING([for BUILD platform configuration])
4501     echo
4502     rm -rf CONF-FOR-BUILD config_build.mk
4503     mkdir CONF-FOR-BUILD
4504     # Here must be listed all files needed when running the configure script. In particular, also
4505     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4506     # keep them in the same order as there.
4507     (cd $SRC_ROOT && tar cf - \
4508         config.guess \
4509         bin/get_config_variables \
4510         solenv/bin/getcompver.awk \
4511         solenv/inc/langlist.mk \
4512         download.lst \
4513         config_host.mk.in \
4514         config_host_lang.mk.in \
4515         Makefile.in \
4516         lo.xcent.in \
4517         bin/bffvalidator.sh.in \
4518         bin/odfvalidator.sh.in \
4519         bin/officeotron.sh.in \
4520         instsetoo_native/util/openoffice.lst.in \
4521         config_host/*.in \
4522         sysui/desktop/macosx/Info.plist.in) \
4523     | (cd CONF-FOR-BUILD && tar xf -)
4524     cp configure CONF-FOR-BUILD
4525     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4526     (
4527     unset COM USING_X11 OS CPUNAME
4528     unset CC CXX SYSBASE CFLAGS
4529     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4530     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4531     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4532     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4533     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4534     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4535     cd CONF-FOR-BUILD
4536     sub_conf_opts=""
4537     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4538     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4539     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4540     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4541     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4542     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4543     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4544     # Don't bother having configure look for stuff not needed for the build platform anyway
4545     ./configure \
4546         --disable-cups \
4547         --disable-gtk3 \
4548         --disable-pdfimport \
4549         --disable-postgresql-sdbc \
4550         --with-parallelism="$with_parallelism" \
4551         --without-doxygen \
4552         --without-java \
4553         $sub_conf_opts \
4554         --srcdir=$srcdir \
4555         2>&1 | sed -e 's/^/    /'
4556     test -f ./config_host.mk 2>/dev/null || exit
4557     cp config_host.mk ../config_build.mk
4558     cp config_host_lang.mk ../config_build_lang.mk
4559     mv config.log ../config.Build.log
4560     mkdir -p ../config_build
4561     mv config_host/*.h ../config_build
4562     . ./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
4564     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
4565         VV='$'$V
4566         VV=`eval "echo $VV"`
4567         if test -n "$VV"; then
4568             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4569             echo "$line" >>build-config
4570         fi
4571     done
4573     for V in INSTDIR INSTROOT WORKDIR; do
4574         VV='$'$V
4575         VV=`eval "echo $VV"`
4576         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4577         if test -n "$VV"; then
4578             line="${V}_FOR_BUILD='$VV'"
4579             echo "$line" >>build-config
4580         fi
4581     done
4583     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4584     echo "$line" >>build-config
4586     )
4587     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4588     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])
4589     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4590              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4592     eval `cat CONF-FOR-BUILD/build-config`
4594     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4596     rm -rf CONF-FOR-BUILD
4597 else
4598     OS_FOR_BUILD="$OS"
4599     CC_FOR_BUILD="$CC"
4600     CXX_FOR_BUILD="$CXX"
4601     INSTDIR_FOR_BUILD="$INSTDIR"
4602     INSTROOT_FOR_BUILD="$INSTROOT"
4603     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4604     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4605     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4606     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4607     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4608     WORKDIR_FOR_BUILD="$WORKDIR"
4610 AC_SUBST(OS_FOR_BUILD)
4611 AC_SUBST(INSTDIR_FOR_BUILD)
4612 AC_SUBST(INSTROOT_FOR_BUILD)
4613 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4614 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4615 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4616 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4617 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4618 AC_SUBST(WORKDIR_FOR_BUILD)
4620 dnl ===================================================================
4621 dnl Check for syslog header
4622 dnl ===================================================================
4623 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4625 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4626 dnl ===================================================================
4627 AC_MSG_CHECKING([whether to turn warnings to errors])
4628 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4629     ENABLE_WERROR="TRUE"
4630     AC_MSG_RESULT([yes])
4631 else
4632     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4633         ENABLE_WERROR="TRUE"
4634         AC_MSG_RESULT([yes])
4635     else
4636         AC_MSG_RESULT([no])
4637     fi
4639 AC_SUBST(ENABLE_WERROR)
4641 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4642 dnl ===================================================================
4643 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4644 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4645     ASSERT_ALWAYS_ABORT="TRUE"
4646     AC_MSG_RESULT([yes])
4647 else
4648     ASSERT_ALWAYS_ABORT="FALSE"
4649     AC_MSG_RESULT([no])
4651 AC_SUBST(ASSERT_ALWAYS_ABORT)
4653 # Determine whether to use ooenv for the instdir installation
4654 # ===================================================================
4655 if test $_os != "WINNT" -a $_os != "Darwin"; then
4656     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4657     if test "$enable_ooenv" = "no"; then
4658         AC_MSG_RESULT([no])
4659     else
4660         ENABLE_OOENV="TRUE"
4661         AC_MSG_RESULT([yes])
4662     fi
4664 AC_SUBST(ENABLE_OOENV)
4666 if test "$USING_X11" != TRUE; then
4667     # be sure to do not mess with unneeded stuff
4668     test_randr=no
4669     test_xrender=no
4670     test_cups=no
4671     test_dbus=no
4672     test_gtk=no
4673     build_gstreamer_1_0=no
4674     build_gstreamer_0_10=no
4675     test_kde4=no
4676     test_kde5=no
4677     test_qt5=no
4678     test_gtk3_kde5=no
4679     enable_cairo_canvas=no
4682 if test "$OS" = "HAIKU"; then
4683     enable_cairo_canvas=yes
4684     test_qt5=yes
4685     test_kde5=yes
4688 dnl ===================================================================
4689 dnl check for cups support
4690 dnl ===================================================================
4691 ENABLE_CUPS=""
4693 if test "$enable_cups" = "no"; then
4694     test_cups=no
4697 AC_MSG_CHECKING([whether to enable CUPS support])
4698 if test "$test_cups" = "yes"; then
4699     ENABLE_CUPS="TRUE"
4700     AC_MSG_RESULT([yes])
4702     AC_MSG_CHECKING([whether cups support is present])
4703     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4704     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4705     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4706         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4707     fi
4709 else
4710     AC_MSG_RESULT([no])
4713 AC_SUBST(ENABLE_CUPS)
4715 # fontconfig checks
4716 if test "$test_fontconfig" = "yes"; then
4717     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4718     SYSTEM_FONTCONFIG=TRUE
4719     FilterLibs "${FONTCONFIG_LIBS}"
4720     FONTCONFIG_LIBS="${filteredlibs}"
4722 AC_SUBST(FONTCONFIG_CFLAGS)
4723 AC_SUBST(FONTCONFIG_LIBS)
4724 AC_SUBST([SYSTEM_FONTCONFIG])
4726 dnl whether to find & fetch external tarballs?
4727 dnl ===================================================================
4728 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4729    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4730        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4731    else
4732        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4733    fi
4735 if test -z "$TARFILE_LOCATION"; then
4736     if test -d "$SRC_ROOT/src" ; then
4737         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4738         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4739     fi
4740     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4741 else
4742     AbsolutePath "$TARFILE_LOCATION"
4743     PathFormat "${absolute_path}"
4744     TARFILE_LOCATION="${formatted_path}"
4746 AC_SUBST(TARFILE_LOCATION)
4748 AC_MSG_CHECKING([whether we want to fetch tarballs])
4749 if test "$enable_fetch_external" != "no"; then
4750     if test "$with_all_tarballs" = "yes"; then
4751         AC_MSG_RESULT([yes, all of them])
4752         DO_FETCH_TARBALLS="ALL"
4753     else
4754         AC_MSG_RESULT([yes, if we use them])
4755         DO_FETCH_TARBALLS="TRUE"
4756     fi
4757 else
4758     AC_MSG_RESULT([no])
4759     DO_FETCH_TARBALLS=
4761 AC_SUBST(DO_FETCH_TARBALLS)
4763 AC_MSG_CHECKING([whether to build help])
4764 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4765     BUILD_TYPE="$BUILD_TYPE HELP"
4766     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4767     case "$with_help" in
4768     "html")
4769         ENABLE_HTMLHELP=TRUE
4770         SCPDEFS="$SCPDEFS -DWITH_HELP"
4771         AC_MSG_RESULT([HTML])
4772         ;;
4773     "online")
4774         ENABLE_HTMLHELP=TRUE
4775         HELP_ONLINE=TRUE
4776         AC_MSG_RESULT([HTML])
4777         ;;
4778     yes)
4779         SCPDEFS="$SCPDEFS -DWITH_HELP"
4780         AC_MSG_RESULT([yes])
4781         ;;
4782     *)
4783         AC_MSG_ERROR([Unknown --with-help=$with_help])
4784         ;;
4785     esac
4786 else
4787     AC_MSG_RESULT([no])
4789 AC_SUBST([ENABLE_HTMLHELP])
4790 AC_SUBST([HELP_ONLINE])
4792 dnl Test whether to include MySpell dictionaries
4793 dnl ===================================================================
4794 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4795 if test "$with_myspell_dicts" = "yes"; then
4796     AC_MSG_RESULT([yes])
4797     WITH_MYSPELL_DICTS=TRUE
4798     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4799     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4800 else
4801     AC_MSG_RESULT([no])
4802     WITH_MYSPELL_DICTS=
4804 AC_SUBST(WITH_MYSPELL_DICTS)
4806 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4807 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4808     if test "$with_system_dicts" = yes; then
4809         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4810     fi
4811     with_system_dicts=no
4814 AC_MSG_CHECKING([whether to use dicts from external paths])
4815 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4816     AC_MSG_RESULT([yes])
4817     SYSTEM_DICTS=TRUE
4818     AC_MSG_CHECKING([for spelling dictionary directory])
4819     if test -n "$with_external_dict_dir"; then
4820         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4821     else
4822         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4823         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4824             DICT_SYSTEM_DIR=file:///usr/share/myspell
4825         fi
4826     fi
4827     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4828     AC_MSG_CHECKING([for hyphenation patterns directory])
4829     if test -n "$with_external_hyph_dir"; then
4830         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4831     else
4832         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4833     fi
4834     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4835     AC_MSG_CHECKING([for thesaurus directory])
4836     if test -n "$with_external_thes_dir"; then
4837         THES_SYSTEM_DIR=file://$with_external_thes_dir
4838     else
4839         THES_SYSTEM_DIR=file:///usr/share/mythes
4840     fi
4841     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4842 else
4843     AC_MSG_RESULT([no])
4844     SYSTEM_DICTS=
4846 AC_SUBST(SYSTEM_DICTS)
4847 AC_SUBST(DICT_SYSTEM_DIR)
4848 AC_SUBST(HYPH_SYSTEM_DIR)
4849 AC_SUBST(THES_SYSTEM_DIR)
4851 dnl ===================================================================
4852 dnl enable pch by default on windows
4853 dnl enable it explicitly otherwise
4854 ENABLE_PCH=""
4855 if test "$enable_pch" = yes -a "$enable_compiler_plugins" = yes; then
4856     if test -z "$libo_fuzzed_enable_pch"; then
4857         AC_MSG_ERROR([--enable-pch cannot be used with --enable-compiler-plugins])
4858     else
4859         AC_MSG_NOTICE([Resetting --enable-pch=no])
4860         enable_pch=no
4861     fi
4864 AC_MSG_CHECKING([whether to enable pch feature])
4865 if test "$enable_pch" != "no"; then
4866     if test "$_os" = "WINNT"; then
4867         ENABLE_PCH="TRUE"
4868         AC_MSG_RESULT([yes])
4869     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4870         ENABLE_PCH="TRUE"
4871         AC_MSG_RESULT([yes])
4872     elif test -n "$enable_pch"; then
4873         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4874     else
4875         AC_MSG_RESULT([no])
4876     fi
4877 else
4878     AC_MSG_RESULT([no])
4880 AC_SUBST(ENABLE_PCH)
4882 TAB=`printf '\t'`
4884 AC_MSG_CHECKING([the GNU Make version])
4885 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4886 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4887 if test "$_make_longver" -ge "038200"; then
4888     AC_MSG_RESULT([$GNUMAKE $_make_version])
4890 elif test "$_make_longver" -ge "038100"; then
4891     if test "$build_os" = "cygwin"; then
4892         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4893     fi
4894     AC_MSG_RESULT([$GNUMAKE $_make_version])
4896     dnl ===================================================================
4897     dnl Search all the common names for sha1sum
4898     dnl ===================================================================
4899     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4900     if test -z "$SHA1SUM"; then
4901         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
4902     elif test "$SHA1SUM" = "openssl"; then
4903         SHA1SUM="openssl sha1"
4904     fi
4905     AC_MSG_CHECKING([for GNU Make bug 20033])
4906     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4907     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4908 A := \$(wildcard *.a)
4910 .PHONY: all
4911 all: \$(A:.a=.b)
4912 <TAB>@echo survived bug20033.
4914 .PHONY: setup
4915 setup:
4916 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4918 define d1
4919 @echo lala \$(1)
4920 @sleep 1
4921 endef
4923 define d2
4924 @echo tyty \$(1)
4925 @sleep 1
4926 endef
4928 %.b : %.a
4929 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4930 <TAB>\$(call d1,\$(CHECKSUM)),\
4931 <TAB>\$(call d2,\$(CHECKSUM)))
4933     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4934         no_parallelism_make="YES"
4935         AC_MSG_RESULT([yes, disable parallelism])
4936     else
4937         AC_MSG_RESULT([no, keep parallelism enabled])
4938     fi
4939     rm -rf $TESTGMAKEBUG20033
4940 else
4941     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4944 # find if gnumake support file function
4945 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
4946 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4947 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4948     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
4950 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4951 \$(file >test.txt,Success )
4953 .PHONY: all
4954 all:
4955 <TAB>@cat test.txt
4958 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4959 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4960     HAVE_GNUMAKE_FILE_FUNC=TRUE
4961     AC_MSG_RESULT([yes])
4962 else
4963     AC_MSG_RESULT([no])
4965 rm -rf $TESTGMAKEFILEFUNC
4966 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4967 AC_SUBST(GNUMAKE_WIN_NATIVE)
4969 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
4970 STALE_MAKE=
4971 if test "$_make_ver_check" = ""; then
4972    STALE_MAKE=TRUE
4975 HAVE_LD_HASH_STYLE=FALSE
4976 WITH_LINKER_HASH_STYLE=
4977 AC_MSG_CHECKING([for --hash-style gcc linker support])
4978 if test "$GCC" = "yes"; then
4979     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4980         hash_styles="gnu sysv"
4981     elif test "$with_linker_hash_style" = "no"; then
4982         hash_styles=
4983     else
4984         hash_styles="$with_linker_hash_style"
4985     fi
4987     for hash_style in $hash_styles; do
4988         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4989         hash_style_ldflags_save=$LDFLAGS
4990         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
4992         AC_RUN_IFELSE([AC_LANG_PROGRAM(
4993             [
4994 #include <stdio.h>
4995             ],[
4996 printf ("");
4997             ])],
4998             [
4999                   HAVE_LD_HASH_STYLE=TRUE
5000                   WITH_LINKER_HASH_STYLE=$hash_style
5001             ],
5002             [HAVE_LD_HASH_STYLE=FALSE],
5003             [HAVE_LD_HASH_STYLE=FALSE])
5004         LDFLAGS=$hash_style_ldflags_save
5005     done
5007     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5008         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5009     else
5010         AC_MSG_RESULT( no )
5011     fi
5012     LDFLAGS=$hash_style_ldflags_save
5013 else
5014     AC_MSG_RESULT( no )
5016 AC_SUBST(HAVE_LD_HASH_STYLE)
5017 AC_SUBST(WITH_LINKER_HASH_STYLE)
5019 dnl ===================================================================
5020 dnl Check whether there's a Perl version available.
5021 dnl ===================================================================
5022 if test -z "$with_perl_home"; then
5023     AC_PATH_PROG(PERL, perl)
5024 else
5025     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5026     _perl_path="$with_perl_home/bin/perl"
5027     if test -x "$_perl_path"; then
5028         PERL=$_perl_path
5029     else
5030         AC_MSG_ERROR([$_perl_path not found])
5031     fi
5034 dnl ===================================================================
5035 dnl Testing for Perl version 5 or greater.
5036 dnl $] is the Perl version variable, it is returned as an integer
5037 dnl ===================================================================
5038 if test "$PERL"; then
5039     AC_MSG_CHECKING([the Perl version])
5040     ${PERL} -e "exit($]);"
5041     _perl_version=$?
5042     if test "$_perl_version" -lt 5; then
5043         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5044     fi
5045     AC_MSG_RESULT([Perl $_perl_version])
5046 else
5047     AC_MSG_ERROR([Perl not found, install Perl 5])
5050 dnl ===================================================================
5051 dnl Testing for required Perl modules
5052 dnl ===================================================================
5054 AC_MSG_CHECKING([for required Perl modules])
5055 perl_use_string="use Cwd ; use Digest::MD5"
5056 if test "$_os" = "WINNT"; then
5057     if test -n "$PKGFORMAT"; then
5058         for i in $PKGFORMAT; do
5059             case "$i" in
5060             msi)
5061                 # for getting fonts versions to use in MSI
5062                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5063                 ;;
5064             esac
5065         done
5066     fi
5068 if test "$with_system_hsqldb" = "yes"; then
5069         perl_use_string="$perl_use_string ; use Archive::Zip"
5071 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5072     AC_MSG_RESULT([all modules found])
5073 else
5074     AC_MSG_RESULT([failed to find some modules])
5075     # Find out which modules are missing.
5076     for i in $perl_use_string; do
5077         if test "$i" != "use" -a "$i" != ";"; then
5078             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5079                 missing_perl_modules="$missing_perl_modules $i"
5080             fi
5081         fi
5082     done
5083     AC_MSG_ERROR([
5084     The missing Perl modules are: $missing_perl_modules
5085     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5088 dnl ===================================================================
5089 dnl Check for pkg-config
5090 dnl ===================================================================
5091 if test "$_os" != "WINNT"; then
5092     PKG_PROG_PKG_CONFIG
5095 if test "$_os" != "WINNT"; then
5097     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5098     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5099     # explicitly. Or put /path/to/compiler in PATH yourself.
5101     # Use wrappers for LTO
5102     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5103         AC_CHECK_TOOL(AR,gcc-ar)
5104         AC_CHECK_TOOL(NM,gcc-nm)
5105         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5106     else
5107         AC_CHECK_TOOL(AR,ar)
5108         AC_CHECK_TOOL(NM,nm)
5109         AC_CHECK_TOOL(RANLIB,ranlib)
5110     fi
5111     AC_CHECK_TOOL(OBJDUMP,objdump)
5112     AC_CHECK_TOOL(READELF,readelf)
5113     AC_CHECK_TOOL(STRIP,strip)
5114     if test "$_os" = "WINNT"; then
5115         AC_CHECK_TOOL(DLLTOOL,dlltool)
5116         AC_CHECK_TOOL(WINDRES,windres)
5117     fi
5119 AC_SUBST(AR)
5120 AC_SUBST(DLLTOOL)
5121 AC_SUBST(NM)
5122 AC_SUBST(OBJDUMP)
5123 AC_SUBST(PKG_CONFIG)
5124 AC_SUBST(RANLIB)
5125 AC_SUBST(READELF)
5126 AC_SUBST(STRIP)
5127 AC_SUBST(WINDRES)
5129 dnl ===================================================================
5130 dnl pkg-config checks on Mac OS X
5131 dnl ===================================================================
5133 if test $_os = Darwin; then
5134     AC_MSG_CHECKING([for bogus pkg-config])
5135     if test -n "$PKG_CONFIG"; then
5136         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5137             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5138         else
5139             if test "$enable_bogus_pkg_config" = "yes"; then
5140                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5141             else
5142                 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.])
5143             fi
5144         fi
5145     else
5146         AC_MSG_RESULT([no, good])
5147     fi
5150 find_csc()
5152     # Return value: $csctest
5154     unset csctest
5156     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5157     if test -n "$regvalue"; then
5158         csctest=$regvalue
5159         return
5160     fi
5163 find_al()
5165     # Return value: $altest
5167     unset altest
5169     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5170         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5171         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5172             altest=$regvalue
5173             return
5174         fi
5175     done
5177     # We need this additional check to detect 4.6.1 or above.
5178     for ver in 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5179         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5180         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5181             altest=$regvalue
5182             return
5183         fi
5185         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/WOW6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools"
5186         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5187             altest=$regvalue
5188             return
5189         fi
5190     done
5193 find_dotnetsdk46()
5195     unset frametest
5197     for ver in 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5198         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5199         if test -n "$regvalue"; then
5200             frametest=$regvalue
5201             return
5202         fi
5203         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5204         if test -n "$regvalue"; then
5205             frametest=$regvalue
5206             return
5207         fi
5208     done
5211 find_winsdk_version()
5213     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5214     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5216     unset winsdktest winsdkbinsubdir winsdklibsubdir
5218     case "$1" in
5219     7.*)
5220         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5221         if test -n "$regvalue"; then
5222             winsdktest=$regvalue
5223             winsdklibsubdir=.
5224             return
5225         fi
5226         ;;
5227     8.0|8.0A)
5228         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5229         if test -n "$regvalue"; then
5230             winsdktest=$regvalue
5231             winsdklibsubdir=win8
5232             return
5233         fi
5234         ;;
5235     8.1|8.1A)
5236         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5237         if test -n "$regvalue"; then
5238             winsdktest=$regvalue
5239             winsdklibsubdir=winv6.3
5240             return
5241         fi
5242         ;;
5243     10.0)
5244         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5245         if test -n "$regvalue"; then
5246             winsdktest=$regvalue
5247             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5248             if test -n "$regvalue"; then
5249                 winsdkbinsubdir="$regvalue".0
5250             fi
5251             winsdklibsubdir=$regvalue
5252             if test "$regvalue" = "10.0.14393"; then
5253                 winsdklibsubdir="10.0.14393.0"
5254             elif test "$regvalue" = "10.0.16299"; then
5255                 winsdklibsubdir="10.0.16299.0"
5256             elif test "$regvalue" = "10.0.15063"; then
5257                 winsdklibsubdir="10.0.15063.0"
5258             elif test "$regvalue" = "10.0.17134"; then
5259                 winsdklibsubdir="$regvalue.0"
5260             fi
5261             return
5262         fi
5263         ;;
5264     esac
5267 find_winsdk()
5269     # Return value: From find_winsdk_version
5271     unset winsdktest
5273     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5274         find_winsdk_version $ver
5275         if test -n "$winsdktest"; then
5276             return
5277         fi
5278     done
5281 find_msms()
5283     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5284     if test $VCVER = 150; then
5285         my_msm_files="Microsoft_VC141_CRT_x86.msm ${my_msm_files}"
5286     fi
5287     AC_MSG_CHECKING([for ${my_msm_files}])
5288     msmdir=
5289     for ver in 14.0 15.0; do
5290         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5291         if test -n "$regvalue"; then
5292             for f in ${my_msm_files}; do
5293                 if test -e "$regvalue/${f}"; then
5294                     msmdir=$regvalue
5295                     break
5296                 fi
5297             done
5298         fi
5299     done
5300     dnl Is the following fallback really necessary, or was it added in response
5301     dnl to never having started Visual Studio on a given machine, so the
5302     dnl registry keys checked above had presumably not yet been created?
5303     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5304     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5305     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5306     dnl expanding to "C:\Program Files\Common Files"), which would need
5307     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5308     dnl obtain its value from cygwin:
5309     if test -z "$msmdir"; then
5310         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5311         for f in ${my_msm_files}; do
5312             if test -e "$my_msm_dir/${f}"; then
5313                 msmdir=$my_msm_dir
5314             fi
5315         done
5316     fi
5318     dnl Starting from MSVC 15.0, merge modules are located in different directory
5319     if test $VCVER = 150; then
5320         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5321             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])
5322             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5323             for f in ${my_msm_files}; do
5324                 if test -e "$my_msm_dir/${f}"; then
5325                     msmdir=$my_msm_dir
5326                     break
5327                 fi
5328             done
5329         done
5330     fi
5332     if test -n "$msmdir"; then
5333         msmdir=`cygpath -m "$msmdir"`
5334         AC_MSG_RESULT([$msmdir])
5335     else
5336         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5337             AC_MSG_ERROR([not found])
5338         else
5339             AC_MSG_WARN([not found])
5340             add_warning "MSM none of ${my_msm_files} found"
5341         fi
5342     fi
5345 find_msvc_x64_dlls()
5347     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5348     if test "$VCVER" = 150; then
5349         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5350             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT])
5351             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5352                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5353                 break
5354             fi
5355             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5356                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5357                 break
5358             fi
5359         done
5360     fi
5361     msvcdlls="msvcp140.dll vcruntime140.dll"
5362     for dll in $msvcdlls; do
5363         if ! test -f "$msvcdllpath/$dll"; then
5364             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5365         fi
5366     done
5369 dnl =========================================
5370 dnl Check for the Windows  SDK.
5371 dnl =========================================
5372 if test "$_os" = "WINNT"; then
5373     AC_MSG_CHECKING([for Windows SDK])
5374     if test "$build_os" = "cygwin"; then
5375         find_winsdk
5376         WINDOWS_SDK_HOME=$winsdktest
5378         # normalize if found
5379         if test -n "$WINDOWS_SDK_HOME"; then
5380             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5381             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5382         fi
5384         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5385     fi
5387     if test -n "$WINDOWS_SDK_HOME"; then
5388         # Remove a possible trailing backslash
5389         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5391         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5392              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5393              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5394             have_windows_sdk_headers=yes
5395         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5396              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5397              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5398             have_windows_sdk_headers=yes
5399         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5400              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5401              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5402             have_windows_sdk_headers=yes
5403         else
5404             have_windows_sdk_headers=no
5405         fi
5407         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5408             have_windows_sdk_libs=yes
5409         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5410             have_windows_sdk_libs=yes
5411         else
5412             have_windows_sdk_libs=no
5413         fi
5415         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5416             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5417 the  Windows SDK are installed.])
5418         fi
5419     fi
5421     if test -z "$WINDOWS_SDK_HOME"; then
5422         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5423     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
5424         WINDOWS_SDK_VERSION=70
5425         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
5426     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5427         WINDOWS_SDK_VERSION=80
5428         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5429     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5430         WINDOWS_SDK_VERSION=81
5431         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5432     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5433         WINDOWS_SDK_VERSION=10
5434         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5435     else
5436         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5437     fi
5438     PathFormat "$WINDOWS_SDK_HOME"
5439     WINDOWS_SDK_HOME="$formatted_path"
5440     if test "$build_os" = "cygwin"; then
5441         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5442         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5443             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5444         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5445             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5446         fi
5447     fi
5449     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5450     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5451     dnl but not in v8.0), so allow this to be overridden with a
5452     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5453     dnl and configuration error if no WiLangId.vbs is found would arguably be
5454     dnl better, but I do not know under which conditions exactly it is needed by
5455     dnl msiglobal.pm:
5456     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5457         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5458         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5459             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5460         fi
5461         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5462             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5463         fi
5464         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5465             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5466         fi
5467     fi
5468     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5469         if test -n "$with_package_format" -a "$with_package_format" != no; then
5470             for i in "$with_package_format"; do
5471                 if test "$i" = "msi"; then
5472                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5473                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5474                     fi
5475                 fi
5476             done
5477         fi
5478     fi
5480 AC_SUBST(WINDOWS_SDK_HOME)
5481 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5482 AC_SUBST(WINDOWS_SDK_VERSION)
5483 AC_SUBST(WINDOWS_SDK_WILANGID)
5485 if test "$build_os" = "cygwin"; then
5486     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5487     dnl dir, it also determines that dir's path w/o an arch segment if any,
5488     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5489     AC_MSG_CHECKING([for midl.exe])
5491     find_winsdk
5492     if test -n "$winsdkbinsubdir" \
5493         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5494     then
5495         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5496         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5497     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5498         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5499         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5500     elif test -f "$winsdktest/Bin/midl.exe"; then
5501         MIDL_PATH=$winsdktest/Bin
5502         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5503     fi
5504     if test ! -f "$MIDL_PATH/midl.exe"; then
5505         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5506     else
5507         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5508     fi
5510     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5511     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5513     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5514          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5515          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5516          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5517     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5518          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5519          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5520          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5521     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5522          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5523          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5524          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5525     else
5526         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5527     fi
5529     dnl Check csc.exe
5530     AC_MSG_CHECKING([for csc.exe])
5531     find_csc
5532     if test -f "$csctest/csc.exe"; then
5533         CSC_PATH="$csctest"
5534     fi
5535     if test ! -f "$CSC_PATH/csc.exe"; then
5536         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5537     else
5538         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5539     fi
5541     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5543     dnl Check al.exe
5544     AC_MSG_CHECKING([for al.exe])
5545     find_winsdk
5546     if test -n "$winsdkbinsubdir" \
5547         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5548     then
5549         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5550     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5551         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5552     elif test -f "$winsdktest/Bin/al.exe"; then
5553         AL_PATH="$winsdktest/Bin"
5554     fi
5556     if test -z "$AL_PATH"; then
5557         find_al
5558         if test -f "$altest/bin/al.exe"; then
5559             AL_PATH="$altest/bin"
5560         elif test -f "$altest/al.exe"; then
5561             AL_PATH="$altest"
5562         fi
5563     fi
5564     if test ! -f "$AL_PATH/al.exe"; then
5565         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5566     else
5567         AC_MSG_RESULT([$AL_PATH/al.exe])
5568     fi
5570     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5572     dnl Check mscoree.lib / .NET Framework dir
5573     AC_MSG_CHECKING(.NET Framework)
5574     find_dotnetsdk46
5575     PathFormat "$frametest"
5576     frametest="$formatted_path"
5577     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5578         DOTNET_FRAMEWORK_HOME="$frametest"
5579     else
5580         find_winsdk
5581         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5582             DOTNET_FRAMEWORK_HOME="$winsdktest"
5583         fi
5584     fi
5585     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
5586         AC_MSG_ERROR([mscoree.lib not found])
5587     fi
5588     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5590     PathFormat "$MIDL_PATH"
5591     MIDL_PATH="$formatted_path"
5593     PathFormat "$AL_PATH"
5594     AL_PATH="$formatted_path"
5596     PathFormat "$DOTNET_FRAMEWORK_HOME"
5597     DOTNET_FRAMEWORK_HOME="$formatted_path"
5599     PathFormat "$CSC_PATH"
5600     CSC_PATH="$formatted_path"
5603 dnl ===================================================================
5604 dnl Check if stdc headers are available excluding MSVC.
5605 dnl ===================================================================
5606 if test "$_os" != "WINNT"; then
5607     AC_HEADER_STDC
5610 dnl ===================================================================
5611 dnl Testing for C++ compiler and version...
5612 dnl ===================================================================
5614 if test "$_os" != "WINNT"; then
5615     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5616     save_CXXFLAGS=$CXXFLAGS
5617     AC_PROG_CXX
5618     CXXFLAGS=$save_CXXFLAGS
5619 else
5620     if test -n "$CC" -a -z "$CXX"; then
5621         CXX="$CC"
5622     fi
5625 dnl check for GNU C++ compiler version
5626 if test "$GXX" = "yes"; then
5627     AC_MSG_CHECKING([the GNU C++ compiler version])
5629     _gpp_version=`$CXX -dumpversion`
5630     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5632     if test "$_gpp_majmin" -lt "401"; then
5633         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5634     else
5635         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5636     fi
5638     dnl see https://code.google.com/p/android/issues/detail?id=41770
5639     if test "$_gpp_majmin" -ge "401"; then
5640         glibcxx_threads=no
5641         AC_LANG_PUSH([C++])
5642         AC_REQUIRE_CPP
5643         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5644         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5645             #include <bits/c++config.h>]],[[
5646             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5647             && !defined(_GLIBCXX__PTHREADS) \
5648             && !defined(_GLIBCXX_HAS_GTHREADS)
5649             choke me
5650             #endif
5651         ]])],[AC_MSG_RESULT([yes])
5652         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5653         AC_LANG_POP([C++])
5654         if test $glibcxx_threads = yes; then
5655             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5656         fi
5657      fi
5659 AC_SUBST(BOOST_CXXFLAGS)
5662 # prefx CXX with ccache if needed
5664 if test "$CCACHE" != ""; then
5665     AC_MSG_CHECKING([whether $CXX is already ccached])
5666     AC_LANG_PUSH([C++])
5667     save_CXXFLAGS=$CXXFLAGS
5668     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5669     dnl an empty program will do, we're checking the compiler flags
5670     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5671                       [use_ccache=yes], [use_ccache=no])
5672     if test $use_ccache = yes; then
5673         AC_MSG_RESULT([yes])
5674     else
5675         CXX="$CCACHE $CXX"
5676         AC_MSG_RESULT([no])
5677     fi
5678     CXXFLAGS=$save_CXXFLAGS
5679     AC_LANG_POP([C++])
5682 dnl ===================================================================
5683 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5684 dnl ===================================================================
5686 if test "$_os" != "WINNT"; then
5687     AC_PROG_CXXCPP
5689     dnl Check whether there's a C pre-processor.
5690     AC_PROG_CPP
5694 dnl ===================================================================
5695 dnl Find integral type sizes and alignments
5696 dnl ===================================================================
5698 if test "$_os" != "WINNT"; then
5700 if test "$_os" == "iOS"; then
5701     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5702     ac_cv_sizeof_long=8
5703     ac_cv_sizeof_short=2
5704     ac_cv_sizeof_int=4
5705     ac_cv_sizeof_long_long=8
5706     ac_cv_sizeof_double=8
5707     ac_cv_sizeof_voidp=8
5708 else
5709     AC_CHECK_SIZEOF(long)
5710     AC_CHECK_SIZEOF(short)
5711     AC_CHECK_SIZEOF(int)
5712     AC_CHECK_SIZEOF(long long)
5713     AC_CHECK_SIZEOF(double)
5714     AC_CHECK_SIZEOF(void*)
5717     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5718     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5719     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5720     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5721     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5723     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5724     m4_pattern_allow([AC_CHECK_ALIGNOF])
5725     m4_ifdef([AC_CHECK_ALIGNOF],
5726         [
5727             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5728             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5729             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5730             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5731         ],
5732         [
5733             case "$_os-$host_cpu" in
5734             Linux-i686)
5735                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5736                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5737                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5738                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5739                 ;;
5740             Linux-x86_64)
5741                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5742                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5743                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5744                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5745                 ;;
5746             *)
5747                 if test -z "$ac_cv_alignof_short" -o \
5748                         -z "$ac_cv_alignof_int" -o \
5749                         -z "$ac_cv_alignof_long" -o \
5750                         -z "$ac_cv_alignof_double"; then
5751                    AC_MSG_ERROR([Your Autoconf doesn't have [AC_][CHECK_ALIGNOF]. You need to set the environment variables ac_cv_alignof_short, ac_cv_alignof_int, ac_cv_alignof_long and ac_cv_alignof_double.])
5752                 fi
5753                 ;;
5754             esac
5755         ])
5757     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5758     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5759     if test $ac_cv_sizeof_long -eq 8; then
5760         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5761     elif test $ac_cv_sizeof_double -eq 8; then
5762         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5763     else
5764         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5765     fi
5767     dnl Check for large file support
5768     AC_SYS_LARGEFILE
5769     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5770         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5771     fi
5772     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5773         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5774     fi
5775 else
5776     # Hardcode for MSVC
5777     SAL_TYPES_SIZEOFSHORT=2
5778     SAL_TYPES_SIZEOFINT=4
5779     SAL_TYPES_SIZEOFLONG=4
5780     SAL_TYPES_SIZEOFLONGLONG=8
5781     if test "$BITNESS_OVERRIDE" = ""; then
5782         SAL_TYPES_SIZEOFPOINTER=4
5783     else
5784         SAL_TYPES_SIZEOFPOINTER=8
5785     fi
5786     SAL_TYPES_ALIGNMENT2=2
5787     SAL_TYPES_ALIGNMENT4=4
5788     SAL_TYPES_ALIGNMENT8=8
5789     LFS_CFLAGS=''
5791 AC_SUBST(LFS_CFLAGS)
5793 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5794 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5795 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5796 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5797 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5798 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5799 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5800 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5802 dnl ===================================================================
5803 dnl Check whether to enable runtime optimizations
5804 dnl ===================================================================
5805 ENABLE_RUNTIME_OPTIMIZATIONS=
5806 AC_MSG_CHECKING([whether to enable runtime optimizations])
5807 if test -z "$enable_runtime_optimizations"; then
5808     for i in $CC; do
5809         case $i in
5810         -fsanitize=*)
5811             enable_runtime_optimizations=no
5812             break
5813             ;;
5814         esac
5815     done
5817 if test "$enable_runtime_optimizations" != no; then
5818     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5819     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5820     AC_MSG_RESULT([yes])
5821 else
5822     AC_MSG_RESULT([no])
5824 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5826 dnl ===================================================================
5827 dnl Check if valgrind headers are available
5828 dnl ===================================================================
5829 ENABLE_VALGRIND=
5830 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
5831     prev_cppflags=$CPPFLAGS
5832     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5833     # or where does it come from?
5834     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5835     AC_CHECK_HEADER([valgrind/valgrind.h],
5836         [ENABLE_VALGRIND=TRUE])
5837     CPPFLAGS=$prev_cppflags
5839 AC_SUBST([ENABLE_VALGRIND])
5840 if test -z "$ENABLE_VALGRIND"; then
5841     if test "$with_valgrind" = yes; then
5842         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
5843     fi
5844     VALGRIND_CFLAGS=
5846 AC_SUBST([VALGRIND_CFLAGS])
5849 dnl ===================================================================
5850 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5851 dnl ===================================================================
5853 # We need at least the sys/sdt.h include header.
5854 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5855 if test "$SDT_H_FOUND" = "TRUE"; then
5856     # Found sys/sdt.h header, now make sure the c++ compiler works.
5857     # Old g++ versions had problems with probes in constructors/destructors.
5858     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5859     AC_LANG_PUSH([C++])
5860     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5861     #include <sys/sdt.h>
5862     class ProbeClass
5863     {
5864     private:
5865       int& ref;
5866       const char *name;
5868     public:
5869       ProbeClass(int& v, const char *n) : ref(v), name(n)
5870       {
5871         DTRACE_PROBE2(_test_, cons, name, ref);
5872       }
5874       void method(int min)
5875       {
5876         DTRACE_PROBE3(_test_, meth, name, ref, min);
5877         ref -= min;
5878       }
5880       ~ProbeClass()
5881       {
5882         DTRACE_PROBE2(_test_, dest, name, ref);
5883       }
5884     };
5885     ]],[[
5886     int i = 64;
5887     DTRACE_PROBE1(_test_, call, i);
5888     ProbeClass inst = ProbeClass(i, "call");
5889     inst.method(24);
5890     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5891           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5892     AC_LANG_POP([C++])
5894 AC_CONFIG_HEADERS([config_host/config_probes.h])
5896 dnl ===================================================================
5897 dnl GCC features
5898 dnl ===================================================================
5899 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
5900     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5901     save_CFLAGS=$CFLAGS
5902     CFLAGS="$CFLAGS -Werror -mno-avx"
5903     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5904     CFLAGS=$save_CFLAGS
5905     if test "$HAVE_GCC_AVX" = "TRUE"; then
5906         AC_MSG_RESULT([yes])
5907     else
5908         AC_MSG_RESULT([no])
5909     fi
5911     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5912     save_CFLAGS=$CFLAGS
5913     CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
5914     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5915     CFLAGS=$save_CFLAGS
5916     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5917         AC_MSG_RESULT([yes])
5918     else
5919         AC_MSG_RESULT([no])
5920     fi
5922     AC_MSG_CHECKING([whether $CC supports atomic functions])
5923     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5924     int v = 0;
5925     if (__sync_add_and_fetch(&v, 1) != 1 ||
5926         __sync_sub_and_fetch(&v, 1) != 0)
5927         return 1;
5928     __sync_synchronize();
5929     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5930         v != 1)
5931         return 1;
5932     return 0;
5933 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5934     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5935         AC_MSG_RESULT([yes])
5936         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5937     else
5938         AC_MSG_RESULT([no])
5939     fi
5941     AC_MSG_CHECKING([whether $CC supports __builtin_ffs])
5942     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
5943     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
5944         AC_MSG_RESULT([yes])
5945         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
5946     else
5947         AC_MSG_RESULT([no])
5948     fi
5950     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5951     save_CFLAGS=$CFLAGS
5952     CFLAGS="$CFLAGS -Werror"
5953     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5954             __attribute__((deprecated("test"))) void f();
5955         ])], [
5956             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5957             AC_MSG_RESULT([yes])
5958         ], [AC_MSG_RESULT([no])])
5959     CFLAGS=$save_CFLAGS
5961     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
5962     AC_LANG_PUSH([C++])
5963     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5964             #include <cstddef>
5965             #include <cxxabi.h>
5966             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
5967         ])], [
5968             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
5969             AC_MSG_RESULT([yes])
5970         ], [AC_MSG_RESULT([no])])
5971     AC_LANG_POP([C++])
5973     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
5974     AC_LANG_PUSH([C++])
5975     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5976             #include <cstddef>
5977             #include <cxxabi.h>
5978             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
5979         ])], [
5980             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
5981             AC_MSG_RESULT([yes])
5982         ], [AC_MSG_RESULT([no])])
5983     AC_LANG_POP([C++])
5985     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
5986     AC_LANG_PUSH([C++])
5987     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5988             #include <cxxabi.h>
5989             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
5990         ])], [
5991             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
5992             AC_MSG_RESULT([yes])
5993         ], [AC_MSG_RESULT([no])])
5994     AC_LANG_POP([C++])
5996     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
5997     AC_LANG_PUSH([C++])
5998     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5999             #include <cstddef>
6000             #include <cxxabi.h>
6001             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6002         ])], [
6003             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6004             AC_MSG_RESULT([yes])
6005         ], [AC_MSG_RESULT([no])])
6006     AC_LANG_POP([C++])
6008     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
6009     AC_LANG_PUSH([C++])
6010     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6011             #include <cstddef>
6012             #include <cxxabi.h>
6013             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6014         ])], [
6015             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6016             AC_MSG_RESULT([yes])
6017         ], [AC_MSG_RESULT([no])])
6018     AC_LANG_POP([C++])
6020     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6021     AC_LANG_PUSH([C++])
6022     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6023             #include <cxxabi.h>
6024             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6025         ])], [
6026             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6027             AC_MSG_RESULT([yes])
6028         ], [AC_MSG_RESULT([no])])
6029     AC_LANG_POP([C++])
6031     AC_MSG_CHECKING([whether $CXX declares __cxa_current_exception_type in cxxabi.h])
6032     AC_LANG_PUSH([C++])
6033     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6034             #include <cxxabi.h>
6035             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6036         ])], [
6037             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6038             AC_MSG_RESULT([yes])
6039         ], [AC_MSG_RESULT([no])])
6040     AC_LANG_POP([C++])
6042     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6043     AC_LANG_PUSH([C++])
6044     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6045             #include <cxxabi.h>
6046             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6047         ])], [
6048             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6049             AC_MSG_RESULT([yes])
6050         ], [AC_MSG_RESULT([no])])
6051     AC_LANG_POP([C++])
6053     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
6054     AC_LANG_PUSH([C++])
6055     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6056             #include <cstddef>
6057             #include <cxxabi.h>
6058             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6059         ])], [
6060             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6061             AC_MSG_RESULT([yes])
6062         ], [AC_MSG_RESULT([no])])
6063     AC_LANG_POP([C++])
6065     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
6066     AC_LANG_PUSH([C++])
6067     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6068             #include <cstddef>
6069             #include <cxxabi.h>
6070             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6071         ])], [
6072             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6073             AC_MSG_RESULT([yes])
6074         ], [AC_MSG_RESULT([no])])
6075     AC_LANG_POP([C++])
6077     dnl Available in GCC 4.9 and at least since Clang 3.4:
6078     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6079     AC_LANG_PUSH([C++])
6080     save_CXXFLAGS=$CXXFLAGS
6081     CXXFLAGS="$CXXFLAGS -Werror"
6082     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6083             struct __attribute__((warn_unused)) dummy {};
6084         ])], [
6085             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6086             AC_MSG_RESULT([yes])
6087         ], [AC_MSG_RESULT([no])])
6088     CXXFLAGS=$save_CXXFLAGS
6089 AC_LANG_POP([C++])
6092 AC_SUBST(HAVE_GCC_AVX)
6093 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6094 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6095 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6097 dnl ===================================================================
6098 dnl Identify the C++ library
6099 dnl ===================================================================
6101 AC_MSG_CHECKING([What the C++ library is])
6102 AC_LANG_PUSH([C++])
6103 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6104 #include <utility>
6105 #ifndef __GLIBCXX__
6106 foo bar
6107 #endif
6108 ]])],
6109     [CPP_LIBRARY=GLIBCXX
6110      cpp_library_name="GNU libstdc++"
6111     ],
6112     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6113 #include <utility>
6114 #ifndef _LIBCPP_VERSION
6115 foo bar
6116 #endif
6117 ]])],
6118     [CPP_LIBRARY=LIBCPP
6119      cpp_library_name="LLVM libc++"
6120      AC_DEFINE([HAVE_LIBCXX])
6121     ],
6122     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6123 #include <utility>
6124 #ifndef _MSC_VER
6125 foo bar
6126 #endif
6127 ]])],
6128     [CPP_LIBRARY=MSVCRT
6129      cpp_library_name="Microsoft"
6130     ],
6131     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6132 AC_MSG_RESULT([$cpp_library_name])
6133 AC_LANG_POP([C++])
6135 dnl ===================================================================
6136 dnl Check for gperf
6137 dnl ===================================================================
6138 AC_PATH_PROG(GPERF, gperf)
6139 if test -z "$GPERF"; then
6140     AC_MSG_ERROR([gperf not found but needed. Install it.])
6142 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6143     GPERF=`cygpath -m $GPERF`
6145 AC_MSG_CHECKING([gperf version])
6146 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
6147     AC_MSG_RESULT([OK])
6148 else
6149     AC_MSG_ERROR([too old, you need at least 3.0.0])
6151 AC_SUBST(GPERF)
6153 dnl ===================================================================
6154 dnl Check for system libcmis
6155 dnl ===================================================================
6156 # libcmis requires curl and we can't build curl for iOS
6157 if test $_os != iOS; then
6158     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.0])
6159     ENABLE_LIBCMIS=TRUE
6160 else
6161     ENABLE_LIBCMIS=
6163 AC_SUBST(ENABLE_LIBCMIS)
6165 dnl ===================================================================
6166 dnl C++11
6167 dnl ===================================================================
6169 my_cxx17switches=
6170 libo_FUZZ_ARG_ENABLE(c++17,
6171     AS_HELP_STRING([--disable-c++17],
6172         [Do not attempt to run GCC/Clang in C++17 mode (needed for Coverity).])
6175 CXXFLAGS_CXX11=
6176 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6177     AC_MSG_CHECKING([whether $CXX supports C++11])
6178     AC_MSG_RESULT(yes)
6179     # MSVC supports (a subset of) CXX11 without any switch
6180 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6181     HAVE_CXX11=
6182     AC_MSG_CHECKING([whether $CXX supports C++17, C++14, or C++11])
6183     dnl But only use C++17 if the gperf that is being used knows not to emit
6184     dnl "register" in C++ output:
6185     printf 'foo\n' | $GPERF -L C++ > conftest.inc
6186     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'
6187     if test "$enable_c__17" != no; then
6188         my_flags="-std=gnu++17 -std=gnu++1z -std=c++17 -std=c++1z $my_flags"
6189     fi
6190     for flag in $my_flags; do
6191         if test "$COM" = MSC; then
6192             flag="-Xclang $flag"
6193         fi
6194         save_CXXFLAGS=$CXXFLAGS
6195         CXXFLAGS="$CXXFLAGS $flag -Werror"
6196         if test "$SYSTEM_LIBCMIS" = TRUE; then
6197             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6198         fi
6199         AC_LANG_PUSH([C++])
6200         dnl Clang 3.9 supports __float128 since
6201         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6202         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6203         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6204         dnl $flag is supported below, so check this first):
6205         my_float128hack=
6206         my_float128hack_impl=-D__float128=void
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         ],,[
6213             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6214             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6215             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6216             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6217             dnl place where __float128 is used is in a template specialization, -D__float128=void
6218             dnl will avoid the problem there while still causing a problem if somebody actually uses
6219             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6220             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6221             dnl "fixed" with this hack):
6222             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6223             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6224                 #include <vector>
6225                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6226                 // (__float128)
6227                 ]])
6228             ],[my_float128hack=$my_float128hack_impl])
6229         ])
6230         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6231             #include <algorithm>
6232             #include <functional>
6233             #include <vector>
6235             #include <string.h>
6236             #pragma GCC diagnostic push
6237             #pragma GCC diagnostic ignored "-Wpragmas"
6238                 // make GCC not warn about next pragma
6239             #pragma GCC diagnostic ignored "-Wdeprecated-register"
6240                 // make Clang with -std < C++17 not even warn about register
6241             #include "conftest.inc"
6242             #pragma GCC diagnostic pop
6244             #if defined SYSTEM_LIBCMIS
6245             // See ucb/source/ucp/cmis/auth_provider.hxx:
6246             #if __GNUC__ >= 7
6247             #pragma GCC diagnostic push
6248             #pragma GCC diagnostic ignored "-Wdeprecated"
6249             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6250             #endif
6251             #include <libcmis/libcmis.hxx>
6252             #if __GNUC__ >= 7
6253             #pragma GCC diagnostic pop
6254             #endif
6255             #endif
6257             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6258                 std::sort(v.begin(), v.end(), fn);
6259             }
6260             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6261         AC_LANG_POP([C++])
6262         CXXFLAGS=$save_CXXFLAGS
6263         if test -n "$CXXFLAGS_CXX11"; then
6264             HAVE_CXX11=TRUE
6265             break
6266         fi
6267     done
6268     rm conftest.inc
6269     if test "$HAVE_CXX11" = TRUE; then
6270         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6271     else
6272         AC_MSG_ERROR(no)
6273     fi
6275 AC_SUBST(CXXFLAGS_CXX11)
6277 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6278 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6279 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6280 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6281 dnl again towards 4.7.2:
6282 if test $CPP_LIBRARY = GLIBCXX; then
6283     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6284     AC_LANG_PUSH([C++])
6285     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6286 #include <list>
6287 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6288     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6289     //   GCC 4.7.0: 20120322
6290     //   GCC 4.7.1: 20120614
6291     // and using a range check is not possible as the mapping between
6292     // __GLIBCXX__ values and GCC versions is not monotonic
6293 /* ok */
6294 #else
6295 abi broken
6296 #endif
6297         ]])], [AC_MSG_RESULT(no, ok)],
6298         [AC_MSG_ERROR(yes)])
6299     AC_LANG_POP([C++])
6302 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6303 save_CXXFLAGS=$CXXFLAGS
6304 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6305 AC_LANG_PUSH([C++])
6307 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6308 #include <stddef.h>
6310 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6312 namespace
6314         struct b
6315         {
6316                 int i;
6317                 int j;
6318         };
6320 ]], [[
6321 struct a
6323         int i;
6324         int j;
6326 a thinga[]={{0,0}, {1,1}};
6327 b thingb[]={{0,0}, {1,1}};
6328 size_t i = sizeof(sal_n_array_size(thinga));
6329 size_t j = sizeof(sal_n_array_size(thingb));
6330 return !(i != 0 && j != 0);
6332     ], [ AC_MSG_RESULT(yes) ],
6333     [ AC_MSG_ERROR(no)])
6334 AC_LANG_POP([C++])
6335 CXXFLAGS=$save_CXXFLAGS
6337 AC_MSG_CHECKING([whether $CXX supports C++14 constexpr])
6338 save_CXXFLAGS=$CXXFLAGS
6339 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6340 AC_LANG_PUSH([C++])
6341 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6342     // A somewhat over-complicated way of checking for
6343     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6344     // in constexpr function":
6345     #include <cassert>
6346     template<typename T> inline constexpr T f(T x) { return x; }
6347     template<typename T> inline constexpr T g(T x) {
6348         assert(f(static_cast<int>(x)));
6349         return x;
6350     }
6351     enum E { e };
6352     auto v = g(E::e);
6354     struct S {
6355         int n_;
6356         constexpr bool f() {
6357             int n = n_;
6358             int i = 0;
6359             while (n > 0) { --n; ++i; }
6360             assert(i >= 0);
6361             return i == 0;
6362         }
6363     };
6364     constexpr auto v2 = S{10}.f();
6365     ]])], [cxx14_constexpr=yes], [cxx14_constexpr=no])
6366 AC_LANG_POP([C++])
6367 CXXFLAGS=$save_CXXFLAGS
6368 AC_MSG_RESULT([$cxx14_constexpr])
6369 if test "$cxx14_constexpr" = yes; then
6370     AC_DEFINE([HAVE_CXX14_CONSTEXPR])
6373 dnl _Pragma support (may require C++11)
6374 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6375     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6376     AC_LANG_PUSH([C++])
6377     save_CXXFLAGS=$CXXFLAGS
6378     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6379     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6380             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6381         ])], [
6382             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6383             AC_MSG_RESULT([yes])
6384         ], [AC_MSG_RESULT([no])])
6385     AC_LANG_POP([C++])
6386     CXXFLAGS=$save_CXXFLAGS
6389 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6390 if test "$GCC" = yes; then
6391     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6392     AC_LANG_PUSH([C++])
6393     save_CXXFLAGS=$CXXFLAGS
6394     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6395     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6396     CXXFLAGS=$save_CXXFLAGS
6397     AC_LANG_POP([C++])
6398     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6399         AC_MSG_RESULT([yes])
6400     else
6401         AC_MSG_RESULT([no])
6402     fi
6404 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6406 HAVE_CPP_GUARANTEED_COPY_ELISION=
6407 AC_MSG_CHECKING([whether $CXX supports guaranteed copy elision])
6408 AC_LANG_PUSH([C++])
6409 save_CXXFLAGS=$CXXFLAGS
6410 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6411 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6412         #if !defined __cpp_guaranteed_copy_elision
6413         struct S {
6414         private:
6415             S(S const &);
6416         public:
6417             S copy() const { return *this; }
6418         };
6419         void f(S & s) { S c(s.copy()); }
6420         #endif
6421     ])], [
6422         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6423         AC_MSG_RESULT([yes])
6424     ], [AC_MSG_RESULT([no])])
6425 CXXFLAGS=$save_CXXFLAGS
6426 AC_LANG_POP([C++])
6427 AC_SUBST([HAVE_CPP_GUARANTEED_COPY_ELISION])
6429 dnl ===================================================================
6430 dnl system stl sanity tests
6431 dnl ===================================================================
6432 if test "$_os" != "WINNT"; then
6434     AC_LANG_PUSH([C++])
6436     save_CPPFLAGS="$CPPFLAGS"
6437     if test -n "$MACOSX_SDK_PATH"; then
6438         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6439     fi
6441     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6442     # only.
6443     if test "$CPP_LIBRARY" = GLIBCXX; then
6444         dnl gcc#19664, gcc#22482, rhbz#162935
6445         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6446         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6447         AC_MSG_RESULT([$stlvisok])
6448         if test "$stlvisok" = "no"; then
6449             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6450         fi
6451     fi
6453     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6454     # when we don't make any dynamic libraries?
6455     if test "$DISABLE_DYNLOADING" = ""; then
6456         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6457         cat > conftestlib1.cc <<_ACEOF
6458 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6459 struct S2: S1<int> { virtual ~S2(); };
6460 S2::~S2() {}
6461 _ACEOF
6462         cat > conftestlib2.cc <<_ACEOF
6463 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6464 struct S2: S1<int> { virtual ~S2(); };
6465 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6466 _ACEOF
6467         gccvisinlineshiddenok=yes
6468         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6469             gccvisinlineshiddenok=no
6470         else
6471             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6472             dnl known to not work with -z defs (unsetting which makes the test
6473             dnl moot, though):
6474             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6475             if test "$COM_IS_CLANG" = TRUE; then
6476                 for i in $CXX $CXXFLAGS; do
6477                     case $i in
6478                     -fsanitize=*)
6479                         my_linkflagsnoundefs=
6480                         break
6481                         ;;
6482                     esac
6483                 done
6484             fi
6485             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6486                 gccvisinlineshiddenok=no
6487             fi
6488         fi
6490         rm -fr libconftest*
6491         AC_MSG_RESULT([$gccvisinlineshiddenok])
6492         if test "$gccvisinlineshiddenok" = "no"; then
6493             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6494         fi
6495     fi
6497    AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6498     cat >visibility.cxx <<_ACEOF
6499 #pragma GCC visibility push(hidden)
6500 struct __attribute__ ((visibility ("default"))) TestStruct {
6501   static void Init();
6503 __attribute__ ((visibility ("default"))) void TestFunc() {
6504   TestStruct::Init();
6506 _ACEOF
6507     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6508         gccvisbroken=yes
6509     else
6510         case "$host_cpu" in
6511         i?86|x86_64)
6512             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6513                 gccvisbroken=no
6514             else
6515                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6516                     gccvisbroken=no
6517                 else
6518                     gccvisbroken=yes
6519                 fi
6520             fi
6521             ;;
6522         *)
6523             gccvisbroken=no
6524             ;;
6525         esac
6526     fi
6527     rm -f visibility.s visibility.cxx
6529     AC_MSG_RESULT([$gccvisbroken])
6530     if test "$gccvisbroken" = "yes"; then
6531         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6532     fi
6534     CPPFLAGS="$save_CPPFLAGS"
6536     AC_LANG_POP([C++])
6539 dnl ===================================================================
6540 dnl  Clang++ tests
6541 dnl ===================================================================
6543 HAVE_GCC_FNO_DEFAULT_INLINE=
6544 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6545 if test "$GCC" = "yes"; then
6546     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6547     AC_LANG_PUSH([C++])
6548     save_CXXFLAGS=$CXXFLAGS
6549     CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6550     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6551     CXXFLAGS=$save_CXXFLAGS
6552     AC_LANG_POP([C++])
6553     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6554         AC_MSG_RESULT([yes])
6555     else
6556         AC_MSG_RESULT([no])
6557     fi
6559     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6560     AC_LANG_PUSH([C++])
6561     save_CXXFLAGS=$CXXFLAGS
6562     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6563     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6564     CXXFLAGS=$save_CXXFLAGS
6565     AC_LANG_POP([C++])
6566     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6567         AC_MSG_RESULT([yes])
6568     else
6569         AC_MSG_RESULT([no])
6570     fi
6572 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6573 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6575 dnl ===================================================================
6576 dnl Compiler plugins
6577 dnl ===================================================================
6579 COMPILER_PLUGINS=
6580 # currently only Clang
6582 if test "$COM_IS_CLANG" != "TRUE"; then
6583     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6584         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6585         enable_compiler_plugins=no
6586     fi
6589 if test "$COM_IS_CLANG" = "TRUE"; then
6590     if test -n "$enable_compiler_plugins"; then
6591         compiler_plugins="$enable_compiler_plugins"
6592     elif test -n "$ENABLE_DBGUTIL"; then
6593         compiler_plugins=test
6594     else
6595         compiler_plugins=no
6596     fi
6597     if test "$compiler_plugins" != no -a "$CLANGVER" -lt 30800; then
6598         if test "$compiler_plugins" = yes; then
6599             AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 3.8.0.])
6600         else
6601             compiler_plugins=no
6602         fi
6603     fi
6604     if test "$compiler_plugins" != "no"; then
6605         dnl The prefix where Clang resides, override to where Clang resides if
6606         dnl using a source build:
6607         if test -z "$CLANGDIR"; then
6608             CLANGDIR=/usr
6609         fi
6610         AC_LANG_PUSH([C++])
6611         save_CPPFLAGS=$CPPFLAGS
6612         save_CXX=$CXX
6613         # compiler plugins must be built with "native" compiler that was used to build Clang itself:
6614         : "${COMPILER_PLUGINS_CXX=g++}"
6615         CXX=$COMPILER_PLUGINS_CXX
6616         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6617         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6618             [COMPILER_PLUGINS=TRUE],
6619             [
6620             if test "$compiler_plugins" = "yes"; then
6621                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6622             else
6623                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6624                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6625             fi
6626             ])
6627         CXX=$save_CXX
6628         CPPFLAGS=$save_CPPFLAGS
6629         AC_LANG_POP([C++])
6630     fi
6631 else
6632     if test "$enable_compiler_plugins" = "yes"; then
6633         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6634     fi
6636 AC_SUBST(COMPILER_PLUGINS)
6637 AC_SUBST(COMPILER_PLUGINS_CXX)
6638 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
6639 AC_SUBST(COMPILER_PLUGINS_DEBUG)
6640 AC_SUBST(CLANGDIR)
6641 AC_SUBST(CLANGLIBDIR)
6643 # Plugin to help linker.
6644 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6645 # This makes --enable-lto build with clang work.
6646 AC_SUBST(LD_PLUGIN)
6648 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6649 AC_SUBST(HAVE_POSIX_FALLOCATE)
6651 dnl ===================================================================
6652 dnl Custom build version
6653 dnl ===================================================================
6655 AC_MSG_CHECKING([whether to add custom build version])
6656 if test "$with_build_version" != ""; then
6657     BUILD_VER_STRING=$with_build_version
6658     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6659 else
6660     BUILD_VER_STRING=
6661     AC_MSG_RESULT([no])
6663 AC_SUBST(BUILD_VER_STRING)
6665 JITC_PROCESSOR_TYPE=""
6666 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6667     # IBMs JDK needs this...
6668     JITC_PROCESSOR_TYPE=6
6669     export JITC_PROCESSOR_TYPE
6671 AC_SUBST([JITC_PROCESSOR_TYPE])
6673 # Misc Windows Stuff
6674 AC_ARG_WITH(ucrt-dir,
6675     AS_HELP_STRING([--with-ucrt-dir],
6676         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
6677         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
6678         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
6679             Windows6.1-KB2999226-x64.msu
6680             Windows6.1-KB2999226-x86.msu
6681             Windows8.1-KB2999226-x64.msu
6682             Windows8.1-KB2999226-x86.msu
6683             Windows8-RT-KB2999226-x64.msu
6684             Windows8-RT-KB2999226-x86.msu
6685         A zip archive including those files is available from Microsoft site:
6686         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
6688 UCRT_REDISTDIR="$with_ucrt_dir"
6689 if test $_os = "WINNT"; then
6690     find_msvc_x64_dlls
6691     find_msms
6692     MSVC_DLL_PATH="$msvcdllpath"
6693     MSVC_DLLS="$msvcdlls"
6694     MSM_PATH="$msmdir"
6695     # MSVC 15.3 changed it to VC141
6696     if echo "$MSVC_DLL_PATH" | grep -q "VC141.CRT$"; then
6697         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
6698     else
6699         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6700     fi
6701     if test "$UCRT_REDISTDIR" = "no"; then
6702         dnl explicitly disabled
6703         UCRT_REDISTDIR=""
6704     else
6705         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
6706                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
6707                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
6708                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
6709                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
6710                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
6711             UCRT_REDISTDIR=""
6712             if test -n "$PKGFORMAT"; then
6713                for i in $PKGFORMAT; do
6714                    case "$i" in
6715                    msi)
6716                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
6717                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
6718                        ;;
6719                    esac
6720                done
6721             fi
6722         fi
6723     fi
6726 AC_SUBST(UCRT_REDISTDIR)
6727 AC_SUBST(MSVC_DLL_PATH)
6728 AC_SUBST(MSVC_DLLS)
6729 AC_SUBST(MSM_PATH)
6731 dnl ===================================================================
6732 dnl Checks for Java
6733 dnl ===================================================================
6734 if test "$ENABLE_JAVA" != ""; then
6736     # Windows-specific tests
6737     if test "$build_os" = "cygwin"; then
6738         if test "$BITNESS_OVERRIDE" = 64; then
6739             bitness=64
6740         else
6741             bitness=32
6742         fi
6744         if test -z "$with_jdk_home"; then
6745             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
6746             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
6747             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
6748             if test -n "$regvalue"; then
6749                 ver=$regvalue
6750                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
6751                 _jdk_home=$regvalue
6752             fi
6753             if test -z "$with_jdk_home"; then
6754                 for ver in 1.8 1.7 1.6; do
6755                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6756                     if test -n "$regvalue"; then
6757                         _jdk_home=$regvalue
6758                         break
6759                     fi
6760                 done
6761             fi
6762             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6763                 with_jdk_home="$_jdk_home"
6764                 howfound="found automatically"
6765             else
6766                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6767             fi
6768         else
6769             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6770             howfound="you passed"
6771         fi
6772     fi
6774     # 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.
6775     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6776     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6777         with_jdk_home=`/usr/libexec/java_home`
6778     fi
6780     JAVA_HOME=; export JAVA_HOME
6781     if test -z "$with_jdk_home"; then
6782         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6783     else
6784         _java_path="$with_jdk_home/bin/$with_java"
6785         dnl Check if there is a Java interpreter at all.
6786         if test -x "$_java_path"; then
6787             JAVAINTERPRETER=$_java_path
6788         else
6789             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6790         fi
6791     fi
6793     dnl Check that the JDK found is correct architecture (at least 2 reasons to
6794     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
6795     dnl loaded by java to run JunitTests:
6796     if test "$build_os" = "cygwin"; then
6797         shortjdkhome=`cygpath -d "$with_jdk_home"`
6798         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
6799             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6800             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6801         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
6802             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6803             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6804         fi
6806         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6807             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6808         fi
6809         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6810     elif test "$cross_compiling" != "yes"; then
6811         case $CPUNAME in
6812             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
6813                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6814                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6815                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6816                 fi
6817                 ;;
6818             *) # assumption: everything else 32-bit
6819                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6820                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6821                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6822                 fi
6823                 ;;
6824         esac
6825     fi
6828 HAVE_JAVA9=
6829 dnl ===================================================================
6830 dnl Checks for JDK.
6831 dnl ===================================================================
6833 # Note that JAVA_HOME as for now always means the *build* platform's
6834 # JAVA_HOME. Whether all the complexity here actually is needed any
6835 # more or not, no idea.
6837 if test "$ENABLE_JAVA" != ""; then
6838     _gij_longver=0
6839     AC_MSG_CHECKING([the installed JDK])
6840     if test -n "$JAVAINTERPRETER"; then
6841         dnl java -version sends output to stderr!
6842         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6843             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6844         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6845             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6846         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6847             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6848         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6849             JDK=ibm
6851             dnl IBM JDK specific tests
6852             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6853             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6855             if test "$_jdk_ver" -lt 10600; then
6856                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
6857             fi
6859             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6861             if test "$with_jdk_home" = ""; then
6862                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6863 you must use the "--with-jdk-home" configure option explicitly])
6864             fi
6866             JAVA_HOME=$with_jdk_home
6867         else
6868             JDK=sun
6870             dnl Sun JDK specific tests
6871             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
6872             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6874             if test "$_jdk_ver" -lt 10600; then
6875                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
6876             fi
6877             if test "$_jdk_ver" -gt 10600; then
6878                 JAVA_CLASSPATH_NOT_SET=TRUE
6879             fi
6880             if test "$_jdk_ver" -ge 10900; then
6881                 HAVE_JAVA9=TRUE
6882             fi
6884             AC_MSG_RESULT([checked (JDK $_jdk)])
6885             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6886             if test "$_os" = "WINNT"; then
6887                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6888             fi
6890             # set to limit VM usage for JunitTests
6891             JAVAIFLAGS=-Xmx64M
6892             # set to limit VM usage for javac
6893             JAVAFLAGS=-J-Xmx128M
6894         fi
6895     else
6896         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
6897     fi
6898 else
6899     dnl Java disabled
6900     JAVA_HOME=
6901     export JAVA_HOME
6904 dnl ===================================================================
6905 dnl Set target Java bytecode version
6906 dnl ===================================================================
6907 if test "$ENABLE_JAVA" != ""; then
6908     if test "$HAVE_JAVA9" = "TRUE"; then
6909         _java_target_ver="1.6"
6910     else
6911         _java_target_ver="1.5"
6912     fi
6913     JAVA_SOURCE_VER="$_java_target_ver"
6914     JAVA_TARGET_VER="$_java_target_ver"
6917 dnl ===================================================================
6918 dnl Checks for javac
6919 dnl ===================================================================
6920 if test "$ENABLE_JAVA" != ""; then
6921     javacompiler="javac"
6922     if test -z "$with_jdk_home"; then
6923         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6924     else
6925         _javac_path="$with_jdk_home/bin/$javacompiler"
6926         dnl Check if there is a Java compiler at all.
6927         if test -x "$_javac_path"; then
6928             JAVACOMPILER=$_javac_path
6929         fi
6930     fi
6931     if test -z "$JAVACOMPILER"; then
6932         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6933     fi
6934     if test "$build_os" = "cygwin"; then
6935         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6936             JAVACOMPILER="${JAVACOMPILER}.exe"
6937         fi
6938         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
6939     fi
6942 dnl ===================================================================
6943 dnl Checks for javadoc
6944 dnl ===================================================================
6945 if test "$ENABLE_JAVA" != ""; then
6946     if test -z "$with_jdk_home"; then
6947         AC_PATH_PROG(JAVADOC, javadoc)
6948     else
6949         _javadoc_path="$with_jdk_home/bin/javadoc"
6950         dnl Check if there is a javadoc at all.
6951         if test -x "$_javadoc_path"; then
6952             JAVADOC=$_javadoc_path
6953         else
6954             AC_PATH_PROG(JAVADOC, javadoc)
6955         fi
6956     fi
6957     if test -z "$JAVADOC"; then
6958         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6959     fi
6960     if test "$build_os" = "cygwin"; then
6961         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6962             JAVADOC="${JAVADOC}.exe"
6963         fi
6964         JAVADOC=`win_short_path_for_make "$JAVADOC"`
6965     fi
6967     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6968     JAVADOCISGJDOC="yes"
6969     fi
6971 AC_SUBST(JAVADOCISGJDOC)
6973 if test "$ENABLE_JAVA" != ""; then
6974     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
6975     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
6976         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
6977            # try to recover first by looking whether we have a alternatives
6978            # system as in Debian or newer SuSEs where following /usr/bin/javac
6979            # over /etc/alternatives/javac leads to the right bindir where we
6980            # just need to strip a bit away to get a valid JAVA_HOME
6981            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
6982         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
6983             # maybe only one level of symlink (e.g. on Mac)
6984             JAVA_HOME=$(readlink $JAVACOMPILER)
6985             if test "$(dirname $JAVA_HOME)" = "."; then
6986                 # we've got no path to trim back
6987                 JAVA_HOME=""
6988             fi
6989         else
6990             # else warn
6991             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
6992             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
6993             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
6994             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
6995         fi
6996         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
6997         if test "$JAVA_HOME" != "/usr"; then
6998             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6999                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7000                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7001                 dnl Tiger already returns a JDK path..
7002                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7003             else
7004                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7005                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7006                 dnl that checks which version to run
7007                 if test -f "$JAVA_HOME"; then
7008                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7009                 fi
7010             fi
7011         fi
7012     fi
7013     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7015     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7016     if test -z "$JAVA_HOME"; then
7017         if test "x$with_jdk_home" = "x"; then
7018             cat > findhome.java <<_ACEOF
7019 [import java.io.File;
7021 class findhome
7023     public static void main(String args[])
7024     {
7025         String jrelocation = System.getProperty("java.home");
7026         File jre = new File(jrelocation);
7027         System.out.println(jre.getParent());
7028     }
7030 _ACEOF
7031             AC_MSG_CHECKING([if javac works])
7032             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7033             AC_TRY_EVAL(javac_cmd)
7034             if test $? = 0 -a -f ./findhome.class; then
7035                 AC_MSG_RESULT([javac works])
7036             else
7037                 echo "configure: javac test failed" >&5
7038                 cat findhome.java >&5
7039                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7040             fi
7041             AC_MSG_CHECKING([if gij knows its java.home])
7042             JAVA_HOME=`$JAVAINTERPRETER findhome`
7043             if test $? = 0 -a "$JAVA_HOME" != ""; then
7044                 AC_MSG_RESULT([$JAVA_HOME])
7045             else
7046                 echo "configure: java test failed" >&5
7047                 cat findhome.java >&5
7048                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7049             fi
7050             # clean-up after ourselves
7051             rm -f ./findhome.java ./findhome.class
7052         else
7053             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7054         fi
7055     fi
7057     # now check if $JAVA_HOME is really valid
7058     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7059         case "${JAVA_HOME}" in
7060             /Library/Java/JavaVirtualMachines/*)
7061                 ;;
7062             *)
7063                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7064                 ;;
7065         esac
7066         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7067             JAVA_HOME_OK="NO"
7068         fi
7069     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7070         JAVA_HOME_OK="NO"
7071     fi
7072     if test "$JAVA_HOME_OK" = "NO"; then
7073         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7074         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7075         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7076         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7077         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7078         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7079     fi
7080     PathFormat "$JAVA_HOME"
7081     JAVA_HOME="$formatted_path"
7084 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7085     "$_os" != Darwin
7086 then
7087     AC_MSG_CHECKING([for JAWT lib])
7088     if test "$_os" = WINNT; then
7089         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7090         JAWTLIB=jawt.lib
7091     else
7092         case "$host_cpu" in
7093         arm*)
7094             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7095             JAVA_ARCH=$my_java_arch
7096             ;;
7097         i*86)
7098             my_java_arch=i386
7099             ;;
7100         m68k)
7101             my_java_arch=m68k
7102             ;;
7103         powerpc)
7104             my_java_arch=ppc
7105             ;;
7106         powerpc64)
7107             my_java_arch=ppc64
7108             ;;
7109         powerpc64le)
7110             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7111             JAVA_ARCH=$my_java_arch
7112             ;;
7113         sparc64)
7114             my_java_arch=sparcv9
7115             ;;
7116         x86_64)
7117             my_java_arch=amd64
7118             ;;
7119         *)
7120             my_java_arch=$host_cpu
7121             ;;
7122         esac
7123         # This is where JDK9 puts the library
7124         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7125             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7126         else
7127             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7128         fi
7129         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7130     fi
7131     AC_MSG_RESULT([$JAWTLIB])
7133 AC_SUBST(JAWTLIB)
7135 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7136     case "$host_os" in
7138     aix*)
7139         JAVAINC="-I$JAVA_HOME/include"
7140         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7141         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7142         ;;
7144     cygwin*)
7145         JAVAINC="-I$JAVA_HOME/include/win32"
7146         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7147         ;;
7149     darwin*)
7150         if test -d "$JAVA_HOME/include/darwin"; then
7151             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7152         else
7153             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7154         fi
7155         ;;
7157     dragonfly*)
7158         JAVAINC="-I$JAVA_HOME/include"
7159         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7160         ;;
7162     freebsd*)
7163         JAVAINC="-I$JAVA_HOME/include"
7164         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7165         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7166         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7167         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7168         ;;
7170     k*bsd*-gnu*)
7171         JAVAINC="-I$JAVA_HOME/include"
7172         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7173         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7174         ;;
7176     linux-gnu*)
7177         JAVAINC="-I$JAVA_HOME/include"
7178         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7179         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7180         ;;
7182     *netbsd*)
7183         JAVAINC="-I$JAVA_HOME/include"
7184         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7185         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7186        ;;
7188     openbsd*)
7189         JAVAINC="-I$JAVA_HOME/include"
7190         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7191         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7192         ;;
7194     solaris*)
7195         JAVAINC="-I$JAVA_HOME/include"
7196         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7197         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7198         ;;
7199     esac
7201 SOLARINC="$SOLARINC $JAVAINC"
7203 AC_SUBST(JAVACOMPILER)
7204 AC_SUBST(JAVADOC)
7205 AC_SUBST(JAVAINTERPRETER)
7206 AC_SUBST(JAVAIFLAGS)
7207 AC_SUBST(JAVAFLAGS)
7208 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7209 AC_SUBST(JAVA_HOME)
7210 AC_SUBST(JAVA_SOURCE_VER)
7211 AC_SUBST(JAVA_TARGET_VER)
7212 AC_SUBST(JDK)
7215 dnl ===================================================================
7216 dnl Export file validation
7217 dnl ===================================================================
7218 AC_MSG_CHECKING([whether to enable export file validation])
7219 if test "$with_export_validation" != "no"; then
7220     if test -z "$ENABLE_JAVA"; then
7221         if test "$with_export_validation" = "yes"; then
7222             AC_MSG_ERROR([requested, but Java is disabled])
7223         else
7224             AC_MSG_RESULT([no, as Java is disabled])
7225         fi
7226     elif test "$_jdk_ver" -lt 10800; then
7227         if test "$with_export_validation" = "yes"; then
7228             AC_MSG_ERROR([requested, but Java is too old, need Java 8])
7229         else
7230             AC_MSG_RESULT([no, as Java is too old, need Java 8])
7231         fi
7232     else
7233         AC_MSG_RESULT([yes])
7234         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7236         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7237         if test -z "$ODFVALIDATOR"; then
7238             # remember to download the ODF toolkit with validator later
7239             AC_MSG_NOTICE([no odfvalidator found, will download it])
7240             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7241             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7243             # and fetch name of odfvalidator jar name from download.lst
7244             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7245             AC_SUBST(ODFVALIDATOR_JAR)
7247             if test -z "$ODFVALIDATOR_JAR"; then
7248                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7249             fi
7250         fi
7251         if test "$build_os" = "cygwin"; then
7252             # In case of Cygwin it will be executed from Windows,
7253             # so we need to run bash and absolute path to validator
7254             # so instead of "odfvalidator" it will be
7255             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7256             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7257         else
7258             ODFVALIDATOR="sh $ODFVALIDATOR"
7259         fi
7260         AC_SUBST(ODFVALIDATOR)
7263         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7264         if test -z "$OFFICEOTRON"; then
7265             # remember to download the officeotron with validator later
7266             AC_MSG_NOTICE([no officeotron found, will download it])
7267             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7268             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7270             # and fetch name of officeotron jar name from download.lst
7271             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7272             AC_SUBST(OFFICEOTRON_JAR)
7274             if test -z "$OFFICEOTRON_JAR"; then
7275                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7276             fi
7277         else
7278             # check version of existing officeotron
7279             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7280             if test 0"$OFFICEOTRON_VER" -lt 704; then
7281                 AC_MSG_ERROR([officeotron too old])
7282             fi
7283         fi
7284         if test "$build_os" = "cygwin"; then
7285             # In case of Cygwin it will be executed from Windows,
7286             # so we need to run bash and absolute path to validator
7287             # so instead of "odfvalidator" it will be
7288             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7289             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7290         else
7291             OFFICEOTRON="sh $OFFICEOTRON"
7292         fi
7293     fi
7294     AC_SUBST(OFFICEOTRON)
7295 else
7296     AC_MSG_RESULT([no])
7299 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7300 if test "$with_bffvalidator" != "no"; then
7301     AC_DEFINE(HAVE_BFFVALIDATOR)
7303     if test "$with_export_validation" = "no"; then
7304         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7305     fi
7307     if test "$with_bffvalidator" = "yes"; then
7308         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7309     else
7310         BFFVALIDATOR="$with_bffvalidator"
7311     fi
7313     if test "$build_os" = "cygwin"; then
7314         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7315             AC_MSG_RESULT($BFFVALIDATOR)
7316         else
7317             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7318         fi
7319     elif test -n "$BFFVALIDATOR"; then
7320         # We are not in Cygwin but need to run Windows binary with wine
7321         AC_PATH_PROGS(WINE, wine)
7323         # so swap in a shell wrapper that converts paths transparently
7324         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7325         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7326         AC_SUBST(BFFVALIDATOR_EXE)
7327         AC_MSG_RESULT($BFFVALIDATOR)
7328     else
7329         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7330     fi
7331     AC_SUBST(BFFVALIDATOR)
7332 else
7333     AC_MSG_RESULT([no])
7336 dnl ===================================================================
7337 dnl Check for C preprocessor to use
7338 dnl ===================================================================
7339 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7340 if test -n "$with_idlc_cpp"; then
7341     AC_MSG_RESULT([$with_idlc_cpp])
7342     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7343 else
7344     AC_MSG_RESULT([ucpp])
7345     AC_MSG_CHECKING([which ucpp tp use])
7346     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7347         AC_MSG_RESULT([external])
7348         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7349     else
7350         AC_MSG_RESULT([internal])
7351         BUILD_TYPE="$BUILD_TYPE UCPP"
7352     fi
7354 AC_SUBST(SYSTEM_UCPP)
7356 dnl ===================================================================
7357 dnl Check for epm (not needed for Windows)
7358 dnl ===================================================================
7359 AC_MSG_CHECKING([whether to enable EPM for packing])
7360 if test "$enable_epm" = "yes"; then
7361     AC_MSG_RESULT([yes])
7362     if test "$_os" != "WINNT"; then
7363         if test $_os = Darwin; then
7364             EPM=internal
7365         elif test -n "$with_epm"; then
7366             EPM=$with_epm
7367         else
7368             AC_PATH_PROG(EPM, epm, no)
7369         fi
7370         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7371             AC_MSG_NOTICE([EPM will be built.])
7372             BUILD_TYPE="$BUILD_TYPE EPM"
7373             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7374         else
7375             # Gentoo has some epm which is something different...
7376             AC_MSG_CHECKING([whether the found epm is the right epm])
7377             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7378                 AC_MSG_RESULT([yes])
7379             else
7380                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7381             fi
7382             AC_MSG_CHECKING([epm version])
7383             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7384             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7385                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7386                 AC_MSG_RESULT([OK, >= 3.7])
7387             else
7388                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7389                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7390             fi
7391         fi
7392     fi
7394     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7395         AC_MSG_CHECKING([for rpm])
7396         for a in "$RPM" rpmbuild rpm; do
7397             $a --usage >/dev/null 2> /dev/null
7398             if test $? -eq 0; then
7399                 RPM=$a
7400                 break
7401             else
7402                 $a --version >/dev/null 2> /dev/null
7403                 if test $? -eq 0; then
7404                     RPM=$a
7405                     break
7406                 fi
7407             fi
7408         done
7409         if test -z "$RPM"; then
7410             AC_MSG_ERROR([not found])
7411         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7412             RPM_PATH=`which $RPM`
7413             AC_MSG_RESULT([$RPM_PATH])
7414             SCPDEFS="$SCPDEFS -DWITH_RPM"
7415         else
7416             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7417         fi
7418     fi
7419     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7420         AC_PATH_PROG(DPKG, dpkg, no)
7421         if test "$DPKG" = "no"; then
7422             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7423         fi
7424     fi
7425     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7426        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7427         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7428             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7429                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7430                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7431                     AC_MSG_RESULT([yes])
7432                 else
7433                     AC_MSG_RESULT([no])
7434                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7435                         _pt="rpm"
7436                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7437                         add_warning "the rpms will need to be installed with --nodeps"
7438                     else
7439                         _pt="pkg"
7440                     fi
7441                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7442                     add_warning "the ${_pt}s will not be relocatable"
7443                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7444                                  relocation will work, you need to patch your epm with the
7445                                  patch in epm/epm-3.7.patch or build with
7446                                  --with-epm=internal which will build a suitable epm])
7447                 fi
7448             fi
7449         fi
7450     fi
7451     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7452         AC_PATH_PROG(PKGMK, pkgmk, no)
7453         if test "$PKGMK" = "no"; then
7454             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7455         fi
7456     fi
7457     AC_SUBST(RPM)
7458     AC_SUBST(DPKG)
7459     AC_SUBST(PKGMK)
7460 else
7461     for i in $PKGFORMAT; do
7462         case "$i" in
7463         aix | bsd | deb | pkg | rpm | native | portable)
7464             AC_MSG_ERROR(
7465                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7466             ;;
7467         esac
7468     done
7469     AC_MSG_RESULT([no])
7470     EPM=NO
7472 AC_SUBST(EPM)
7474 ENABLE_LWP=
7475 if test "$enable_lotuswordpro" = "yes"; then
7476     ENABLE_LWP="TRUE"
7478 AC_SUBST(ENABLE_LWP)
7480 dnl ===================================================================
7481 dnl Check for building ODK
7482 dnl ===================================================================
7483 if test "$enable_odk" = no; then
7484     unset DOXYGEN
7485 else
7486     if test "$with_doxygen" = no; then
7487         AC_MSG_CHECKING([for doxygen])
7488         unset DOXYGEN
7489         AC_MSG_RESULT([no])
7490     else
7491         if test "$with_doxygen" = yes; then
7492             AC_PATH_PROG([DOXYGEN], [doxygen])
7493             if test -z "$DOXYGEN"; then
7494                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7495             fi
7496             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
7497                 if ! dot -V 2>/dev/null; then
7498                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
7499                 fi
7500             fi
7501         else
7502             AC_MSG_CHECKING([for doxygen])
7503             DOXYGEN=$with_doxygen
7504             AC_MSG_RESULT([$DOXYGEN])
7505         fi
7506         if test -n "$DOXYGEN"; then
7507             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7508             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7509             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7510                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7511             fi
7512         fi
7513     fi
7515 AC_SUBST([DOXYGEN])
7517 AC_MSG_CHECKING([whether to build the ODK])
7518 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7519     AC_MSG_RESULT([yes])
7521     if test "$with_java" != "no"; then
7522         AC_MSG_CHECKING([whether to build unowinreg.dll])
7523         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7524             # build on Win by default
7525             enable_build_unowinreg=yes
7526         fi
7527         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7528             AC_MSG_RESULT([no])
7529             BUILD_UNOWINREG=
7530         else
7531             AC_MSG_RESULT([yes])
7532             BUILD_UNOWINREG=TRUE
7533         fi
7534         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7535             if test -z "$with_mingw_cross_compiler"; then
7536                 dnl Guess...
7537                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7538             elif test -x "$with_mingw_cross_compiler"; then
7539                  MINGWCXX="$with_mingw_cross_compiler"
7540             else
7541                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7542             fi
7544             if test "$MINGWCXX" = "false"; then
7545                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7546             fi
7548             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7549             if test -x "$mingwstrip_test"; then
7550                 MINGWSTRIP="$mingwstrip_test"
7551             else
7552                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7553             fi
7555             if test "$MINGWSTRIP" = "false"; then
7556                 AC_MSG_ERROR(MinGW32 binutils not found.)
7557             fi
7558         fi
7559     fi
7560     BUILD_TYPE="$BUILD_TYPE ODK"
7561 else
7562     AC_MSG_RESULT([no])
7563     BUILD_UNOWINREG=
7565 AC_SUBST(BUILD_UNOWINREG)
7566 AC_SUBST(MINGWCXX)
7567 AC_SUBST(MINGWSTRIP)
7569 dnl ===================================================================
7570 dnl Check for system zlib
7571 dnl ===================================================================
7572 if test "$with_system_zlib" = "auto"; then
7573     case "$_os" in
7574     WINNT)
7575         with_system_zlib="$with_system_libs"
7576         ;;
7577     *)
7578         if test "$enable_fuzzers" != "yes"; then
7579             with_system_zlib=yes
7580         else
7581             with_system_zlib=no
7582         fi
7583         ;;
7584     esac
7587 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7588 dnl and has no pkg-config for it at least on some tinderboxes,
7589 dnl so leaving that out for now
7590 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7591 AC_MSG_CHECKING([which zlib to use])
7592 if test "$with_system_zlib" = "yes"; then
7593     AC_MSG_RESULT([external])
7594     SYSTEM_ZLIB=TRUE
7595     AC_CHECK_HEADER(zlib.h, [],
7596         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7597     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7598         [AC_MSG_ERROR(zlib not found or functional)], [])
7599 else
7600     AC_MSG_RESULT([internal])
7601     SYSTEM_ZLIB=
7602     BUILD_TYPE="$BUILD_TYPE ZLIB"
7603     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7604     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7606 AC_SUBST(ZLIB_CFLAGS)
7607 AC_SUBST(ZLIB_LIBS)
7608 AC_SUBST(SYSTEM_ZLIB)
7610 dnl ===================================================================
7611 dnl Check for system jpeg
7612 dnl ===================================================================
7613 AC_MSG_CHECKING([which libjpeg to use])
7614 if test "$with_system_jpeg" = "yes"; then
7615     AC_MSG_RESULT([external])
7616     SYSTEM_LIBJPEG=TRUE
7617     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7618         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7619     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7620         [AC_MSG_ERROR(jpeg library not found or fuctional)], [])
7621 else
7622     SYSTEM_LIBJPEG=
7623     AC_MSG_RESULT([internal, libjpeg-turbo])
7624     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
7625     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
7626     if test "$COM" = "MSC"; then
7627         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
7628     else
7629         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
7630     fi
7632     case "$host_cpu" in
7633     x86_64 | amd64 | i*86 | x86 | ia32)
7634         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7635         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7636             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7637                 NASM="$LODE_HOME/opt/bin/nasm"
7638             elif test -x "/opt/lo/bin/nasm"; then
7639                 NASM="/opt/lo/bin/nasm"
7640             fi
7641         fi
7643         if test -n "$NASM"; then
7644             AC_MSG_CHECKING([for object file format of host system])
7645             case "$host_os" in
7646               cygwin* | mingw* | pw32* | interix*)
7647                 case "$host_cpu" in
7648                   x86_64)
7649                     objfmt='Win64-COFF'
7650                     ;;
7651                   *)
7652                     objfmt='Win32-COFF'
7653                     ;;
7654                 esac
7655               ;;
7656               msdosdjgpp* | go32*)
7657                 objfmt='COFF'
7658               ;;
7659               os2-emx*)                 # not tested
7660                 objfmt='MSOMF'          # obj
7661               ;;
7662               linux*coff* | linux*oldld*)
7663                 objfmt='COFF'           # ???
7664               ;;
7665               linux*aout*)
7666                 objfmt='a.out'
7667               ;;
7668               linux*)
7669                 case "$host_cpu" in
7670                   x86_64)
7671                     objfmt='ELF64'
7672                     ;;
7673                   *)
7674                     objfmt='ELF'
7675                     ;;
7676                 esac
7677               ;;
7678               kfreebsd* | freebsd* | netbsd* | openbsd*)
7679                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
7680                   objfmt='BSD-a.out'
7681                 else
7682                   case "$host_cpu" in
7683                     x86_64 | amd64)
7684                       objfmt='ELF64'
7685                       ;;
7686                     *)
7687                       objfmt='ELF'
7688                       ;;
7689                   esac
7690                 fi
7691               ;;
7692               solaris* | sunos* | sysv* | sco*)
7693                 case "$host_cpu" in
7694                   x86_64)
7695                     objfmt='ELF64'
7696                     ;;
7697                   *)
7698                     objfmt='ELF'
7699                     ;;
7700                 esac
7701               ;;
7702               darwin* | rhapsody* | nextstep* | openstep* | macos*)
7703                 case "$host_cpu" in
7704                   x86_64)
7705                     objfmt='Mach-O64'
7706                     ;;
7707                   *)
7708                     objfmt='Mach-O'
7709                     ;;
7710                 esac
7711               ;;
7712               *)
7713                 objfmt='ELF ?'
7714               ;;
7715             esac
7717             AC_MSG_RESULT([$objfmt])
7718             if test "$objfmt" = 'ELF ?'; then
7719               objfmt='ELF'
7720               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
7721             fi
7723             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
7724             case "$objfmt" in
7725               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
7726               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
7727               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
7728               COFF)       NAFLAGS='-fcoff -DCOFF';;
7729               a.out)      NAFLAGS='-faout -DAOUT';;
7730               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
7731               ELF)        NAFLAGS='-felf -DELF';;
7732               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
7733               RDF)        NAFLAGS='-frdf -DRDF';;
7734               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
7735               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
7736             esac
7737             AC_MSG_RESULT([$NAFLAGS])
7739             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
7740             cat > conftest.asm << EOF
7741             [%line __oline__ "configure"
7742                     section .text
7743                     global  _main,main
7744             _main:
7745             main:   xor     eax,eax
7746                     ret
7747             ]
7749             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
7750             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
7751               AC_MSG_RESULT(yes)
7752             else
7753               echo "configure: failed program was:" >&AC_FD_CC
7754               cat conftest.asm >&AC_FD_CC
7755               rm -rf conftest*
7756               AC_MSG_RESULT(no)
7757               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
7758               NASM=""
7759             fi
7761         fi
7763         if test -z "$NASM"; then
7764 cat << _EOS
7765 ****************************************************************************
7766 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
7767 To get one please:
7769 _EOS
7770             if test "$build_os" = "cygwin"; then
7771 cat << _EOS
7772 install a pre-compiled binary for Win32
7774 mkdir -p /opt/lo/bin
7775 cd /opt/lo/bin
7776 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7777 chmod +x nasm
7779 or get and install one from http://www.nasm.us/
7781 Then re-run autogen.sh
7783 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7784 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7786 _EOS
7787             else
7788 cat << _EOS
7789 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
7791 _EOS
7792             fi
7793             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
7794             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
7795         fi
7796       ;;
7797     esac
7800 AC_SUBST(NASM)
7801 AC_SUBST(LIBJPEG_CFLAGS)
7802 AC_SUBST(LIBJPEG_LIBS)
7803 AC_SUBST(SYSTEM_LIBJPEG)
7805 dnl ===================================================================
7806 dnl Check for system clucene
7807 dnl ===================================================================
7808 dnl we should rather be using
7809 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7810 dnl but the contribs-lib check seems tricky
7811 AC_MSG_CHECKING([which clucene to use])
7812 if test "$with_system_clucene" = "yes"; then
7813     AC_MSG_RESULT([external])
7814     SYSTEM_CLUCENE=TRUE
7815     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7816     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7817     FilterLibs "${CLUCENE_LIBS}"
7818     CLUCENE_LIBS="${filteredlibs}"
7819     AC_LANG_PUSH([C++])
7820     save_CXXFLAGS=$CXXFLAGS
7821     save_CPPFLAGS=$CPPFLAGS
7822     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7823     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7824     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7825     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7826     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7827                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7828     CXXFLAGS=$save_CXXFLAGS
7829     CPPFLAGS=$save_CPPFLAGS
7830     AC_LANG_POP([C++])
7832     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7833 else
7834     AC_MSG_RESULT([internal])
7835     SYSTEM_CLUCENE=
7836     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7838 AC_SUBST(SYSTEM_CLUCENE)
7839 AC_SUBST(CLUCENE_CFLAGS)
7840 AC_SUBST(CLUCENE_LIBS)
7842 dnl ===================================================================
7843 dnl Check for system expat
7844 dnl ===================================================================
7845 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
7847 dnl ===================================================================
7848 dnl Check for system xmlsec
7849 dnl ===================================================================
7850 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24])
7852 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7853 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7854     ENABLE_EOT="TRUE"
7855     AC_DEFINE([ENABLE_EOT])
7856     AC_MSG_RESULT([yes])
7858     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7859 else
7860     ENABLE_EOT=
7861     AC_MSG_RESULT([no])
7863 AC_SUBST([ENABLE_EOT])
7865 dnl ===================================================================
7866 dnl Check for DLP libs
7867 dnl ===================================================================
7868 AS_IF([test "$COM" = "MSC"],
7869       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7870       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7872 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7874 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7876 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
7878 AS_IF([test "$COM" = "MSC"],
7879       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7880       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7882 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7884 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7886 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7887 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.9])
7889 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7891 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7893 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7895 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
7896 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.14])
7898 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
7899 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
7901 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7903 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
7904 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
7906 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7908 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7910 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
7912 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
7914 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
7915 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
7917 dnl ===================================================================
7918 dnl Check for system lcms2
7919 dnl ===================================================================
7920 if test "$with_system_lcms2" != "yes"; then
7921     SYSTEM_LCMS2=
7923 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7924 if test "$GCC" = "yes"; then
7925     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7927 if test "$COM" = "MSC"; then # override the above
7928     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7931 dnl ===================================================================
7932 dnl Check for system cppunit
7933 dnl ===================================================================
7934 if test "$cross_compiling" != "yes"; then
7935     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
7938 dnl ===================================================================
7939 dnl Check whether freetype is available
7940 dnl ===================================================================
7941 if test  "$test_freetype" = "yes"; then
7942     AC_MSG_CHECKING([whether freetype is available])
7943     # FreeType has 3 different kinds of versions
7944     # * release, like 2.4.10
7945     # * libtool, like 13.0.7 (this what pkg-config returns)
7946     # * soname
7947     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7948     #
7949     # 9.9.3 is 2.2.0
7950     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7951     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7952     FilterLibs "${FREETYPE_LIBS}"
7953     FREETYPE_LIBS="${filteredlibs}"
7954     SYSTEM_FREETYPE=TRUE
7955 else
7956     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
7957     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
7959 AC_SUBST(FREETYPE_CFLAGS)
7960 AC_SUBST(FREETYPE_LIBS)
7961 AC_SUBST([SYSTEM_FREETYPE])
7963 # ===================================================================
7964 # Check for system libxslt
7965 # to prevent incompatibilities between internal libxml2 and external libxslt,
7966 # or vice versa, use with_system_libxml here
7967 # ===================================================================
7968 if test "$with_system_libxml" = "auto"; then
7969     case "$_os" in
7970     WINNT|iOS|Android)
7971         with_system_libxml="$with_system_libs"
7972         ;;
7973     *)
7974         if test "$enable_fuzzers" != "yes"; then
7975             with_system_libxml=yes
7976         else
7977             with_system_libxml=no
7978         fi
7979         ;;
7980     esac
7983 AC_MSG_CHECKING([which libxslt to use])
7984 if test "$with_system_libxml" = "yes"; then
7985     AC_MSG_RESULT([external])
7986     SYSTEM_LIBXSLT=TRUE
7987     if test "$_os" = "Darwin"; then
7988         dnl make sure to use SDK path
7989         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7990         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7991         dnl omit -L/usr/lib
7992         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7993         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7994     else
7995         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7996         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7997         FilterLibs "${LIBXSLT_LIBS}"
7998         LIBXSLT_LIBS="${filteredlibs}"
7999         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8000         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8001         FilterLibs "${LIBEXSLT_LIBS}"
8002         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8003     fi
8005     dnl Check for xsltproc
8006     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8007     if test "$XSLTPROC" = "no"; then
8008         AC_MSG_ERROR([xsltproc is required])
8009     fi
8010 else
8011     AC_MSG_RESULT([internal])
8012     SYSTEM_LIBXSLT=
8013     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8015     if test "$cross_compiling" = "yes"; then
8016         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8017         if test "$XSLTPROC" = "no"; then
8018             AC_MSG_ERROR([xsltproc is required])
8019         fi
8020     fi
8022 AC_SUBST(SYSTEM_LIBXSLT)
8023 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8024     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8026 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8028 AC_SUBST(LIBEXSLT_CFLAGS)
8029 AC_SUBST(LIBEXSLT_LIBS)
8030 AC_SUBST(LIBXSLT_CFLAGS)
8031 AC_SUBST(LIBXSLT_LIBS)
8032 AC_SUBST(XSLTPROC)
8034 # ===================================================================
8035 # Check for system libxml
8036 # ===================================================================
8037 AC_MSG_CHECKING([which libxml to use])
8038 if test "$with_system_libxml" = "yes"; then
8039     AC_MSG_RESULT([external])
8040     SYSTEM_LIBXML=TRUE
8041     if test "$_os" = "Darwin"; then
8042         dnl make sure to use SDK path
8043         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8044         dnl omit -L/usr/lib
8045         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8046     elif test $_os = iOS; then
8047         dnl make sure to use SDK path
8048         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8049         LIBXML_CFLAGS="-I$usr/include/libxml2"
8050         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8051     else
8052         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8053         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8054         FilterLibs "${LIBXML_LIBS}"
8055         LIBXML_LIBS="${filteredlibs}"
8056     fi
8058     dnl Check for xmllint
8059     AC_PATH_PROG(XMLLINT, xmllint, no)
8060     if test "$XMLLINT" = "no"; then
8061         AC_MSG_ERROR([xmllint is required])
8062     fi
8063 else
8064     AC_MSG_RESULT([internal])
8065     SYSTEM_LIBXML=
8066     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8067     if test "$COM" = "MSC"; then
8068         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8069     fi
8070     if test "$COM" = "MSC"; then
8071         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8072     else
8073         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8074     fi
8075     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8077 AC_SUBST(SYSTEM_LIBXML)
8078 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8079     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8081 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8082 AC_SUBST(LIBXML_CFLAGS)
8083 AC_SUBST(LIBXML_LIBS)
8084 AC_SUBST(XMLLINT)
8086 # =====================================================================
8087 # Checking for a Python interpreter with version >= 2.7.
8088 # Build and runtime requires Python 3 compatible version (>= 2.7).
8089 # Optionally user can pass an option to configure, i. e.
8090 # ./configure PYTHON=/usr/bin/python
8091 # =====================================================================
8092 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8093     # This allows a lack of system python with no error, we use internal one in that case.
8094     AM_PATH_PYTHON([2.7],, [:])
8095     # Clean PYTHON_VERSION checked below if cross-compiling
8096     PYTHON_VERSION=""
8097     if test "$PYTHON" != ":"; then
8098         PYTHON_FOR_BUILD=$PYTHON
8099     fi
8101 AC_SUBST(PYTHON_FOR_BUILD)
8103 # Checks for Python to use for Pyuno
8104 AC_MSG_CHECKING([which Python to use for Pyuno])
8105 case "$enable_python" in
8106 no|disable)
8107     if test -z $PYTHON_FOR_BUILD; then
8108         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8109         # requirement from the choice whether to include Python stuff in the installer, but why
8110         # bother?
8111         AC_MSG_ERROR([Python is required at build time.])
8112     fi
8113     enable_python=no
8114     AC_MSG_RESULT([none])
8115     ;;
8116 ""|yes|auto)
8117     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8118         AC_MSG_RESULT([no, overridden by --disable-scripting])
8119         enable_python=no
8120     elif test $build_os = cygwin; then
8121         dnl When building on Windows we don't attempt to use any installed
8122         dnl "system"  Python.
8123         AC_MSG_RESULT([fully internal])
8124         enable_python=internal
8125     elif test "$cross_compiling" = yes; then
8126         AC_MSG_RESULT([system])
8127         enable_python=system
8128     else
8129         # Unset variables set by the above AM_PATH_PYTHON so that
8130         # we actually do check anew.
8131         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
8132         AM_PATH_PYTHON([3.3],, [:])
8133         if test "$PYTHON" = ":"; then
8134             if test -z "$PYTHON_FOR_BUILD"; then
8135                 AC_MSG_RESULT([fully internal])
8136             else
8137                 AC_MSG_RESULT([internal])
8138             fi
8139             enable_python=internal
8140         else
8141             AC_MSG_RESULT([system])
8142             enable_python=system
8143         fi
8144     fi
8145     ;;
8146 internal)
8147     AC_MSG_RESULT([internal])
8148     ;;
8149 fully-internal)
8150     AC_MSG_RESULT([fully internal])
8151     enable_python=internal
8152     ;;
8153 system)
8154     AC_MSG_RESULT([system])
8155     ;;
8157     AC_MSG_ERROR([Incorrect --enable-python option])
8158     ;;
8159 esac
8161 if test $enable_python != no; then
8162     BUILD_TYPE="$BUILD_TYPE PYUNO"
8165 if test $enable_python = system; then
8166     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8167         python_version=2.7
8168         PYTHON=python$python_version
8169         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
8170             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
8171             PYTHON_LIBS="-framework Python"
8172         else
8173             PYTHON_CFLAGS="`$PYTHON-config --includes`"
8174             PYTHON_LIBS="`$PYTHON-config --libs`"
8175         fi
8176     fi
8177     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8178         # Fallback: Accept these in the environment, or as set above
8179         # for MacOSX.
8180         :
8181     elif test "$cross_compiling" != yes; then
8182         # Unset variables set by the above AM_PATH_PYTHON so that
8183         # we actually do check anew.
8184         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
8185         # This causes an error if no python command is found
8186         AM_PATH_PYTHON([3.3])
8187         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8188         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8189         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8190         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8191         if test -z "$PKG_CONFIG"; then
8192             PYTHON_CFLAGS="-I$python_include"
8193             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8194         elif $PKG_CONFIG --exists python-$python_version; then
8195             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8196             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8197         else
8198             PYTHON_CFLAGS="-I$python_include"
8199             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8200         fi
8201         FilterLibs "${PYTHON_LIBS}"
8202         PYTHON_LIBS="${filteredlibs}"
8203     else
8204         dnl How to find out the cross-compilation Python installation path?
8205         AC_MSG_CHECKING([for python version])
8206         AS_IF([test -n "$PYTHON_VERSION"],
8207               [AC_MSG_RESULT([$PYTHON_VERSION])],
8208               [AC_MSG_RESULT([not found])
8209                AC_MSG_ERROR([no usable python found])])
8210         test -n "$PYTHON_CFLAGS" && break
8211     fi
8213     dnl Check if the headers really work
8214     save_CPPFLAGS="$CPPFLAGS"
8215     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8216     AC_CHECK_HEADER(Python.h)
8217     CPPFLAGS="$save_CPPFLAGS"
8219     # let the PYTHON_FOR_BUILD match the same python installation that
8220     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8221     # better for PythonTests.
8222     PYTHON_FOR_BUILD=$PYTHON
8225 if test "$with_lxml" != no; then
8226     if test -z "$PYTHON_FOR_BUILD"; then
8227         case $build_os in
8228             cygwin)
8229                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8230                 ;;
8231             *)
8232                 if test "$cross_compiling" != yes ; then
8233                     BUILD_TYPE="$BUILD_TYPE LXML"
8234                 fi
8235                 ;;
8236         esac
8237     else
8238         AC_MSG_CHECKING([for python lxml])
8239         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8240             AC_MSG_RESULT([yes])
8241         else
8242             case $build_os in
8243                 cygwin)
8244                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8245                     ;;
8246                 *)
8247                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8248                         BUILD_TYPE="$BUILD_TYPE LXML"
8249                         AC_MSG_RESULT([no, using internal lxml])
8250                     else
8251                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8252                     fi
8253                     ;;
8254             esac
8255         fi
8256     fi
8259 dnl By now enable_python should be "system", "internal" or "no"
8260 case $enable_python in
8261 system)
8262     SYSTEM_PYTHON=TRUE
8264     if test "x$ac_cv_header_Python_h" != "xyes"; then
8265        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8266     fi
8268     AC_LANG_PUSH(C)
8269     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8270     AC_MSG_CHECKING([for correct python library version])
8271        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8272 #include <Python.h>
8274 int main(int argc, char **argv) {
8275    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8276        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8277    else return 1;
8279        ]])],[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])])
8280     CFLAGS=$save_CFLAGS
8281     AC_LANG_POP(C)
8283     dnl FIXME Check if the Python library can be linked with, too?
8284     ;;
8286 internal)
8287     SYSTEM_PYTHON=
8288     PYTHON_VERSION_MAJOR=3
8289     PYTHON_VERSION_MINOR=5
8290     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.5
8291     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8292         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8293     fi
8294     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8295     BUILD_TYPE="$BUILD_TYPE PYTHON"
8296     # Embedded Python dies without Home set
8297     if test "$HOME" = ""; then
8298         export HOME=""
8299     fi
8300     ;;
8302     DISABLE_PYTHON=TRUE
8303     SYSTEM_PYTHON=
8304     ;;
8306     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8307     ;;
8308 esac
8310 AC_SUBST(DISABLE_PYTHON)
8311 AC_SUBST(SYSTEM_PYTHON)
8312 AC_SUBST(PYTHON_CFLAGS)
8313 AC_SUBST(PYTHON_LIBS)
8314 AC_SUBST(PYTHON_VERSION)
8315 AC_SUBST(PYTHON_VERSION_MAJOR)
8316 AC_SUBST(PYTHON_VERSION_MINOR)
8318 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8319 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8320     AC_MSG_RESULT([yes])
8321     ENABLE_MARIADBC=TRUE
8322     MARIADBC_MAJOR=1
8323     MARIADBC_MINOR=0
8324     MARIADBC_MICRO=2
8325     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8326 else
8327     AC_MSG_RESULT([no])
8328     ENABLE_MARIADBC=
8330 AC_SUBST(ENABLE_MARIADBC)
8331 AC_SUBST(MARIADBC_MAJOR)
8332 AC_SUBST(MARIADBC_MINOR)
8333 AC_SUBST(MARIADBC_MICRO)
8335 if test "$ENABLE_MARIADBC" = "TRUE"; then
8337     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8339     dnl ===================================================================
8340     dnl Check for system MariaDB
8341     dnl ===================================================================
8342     AC_MSG_CHECKING([which MariaDB to use])
8343     if test "$with_system_mariadb" = "yes"; then
8344         AC_MSG_RESULT([external])
8345         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8346         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8347         if test -z "$MARIADBCONFIG"; then
8348             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8349             if test -z "$MARIADBCONFIG"; then
8350                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8351                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8352             fi
8353         fi
8354         AC_MSG_CHECKING([MariaDB version])
8355         MARIADB_VERSION=`$MARIADBCONFIG --version`
8356         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8357         if test "$MARIADB_MAJOR" -ge "5"; then
8358             AC_MSG_RESULT([OK])
8359         else
8360             AC_MSG_ERROR([too old, use 5.0.x or later])
8361         fi
8362         AC_MSG_CHECKING([for MariaDB Client library])
8363         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8364         if test "$COM_IS_CLANG" = TRUE; then
8365             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8366         fi
8367         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8368         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8369         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8370         dnl linux32:
8371         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8372             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8373             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8374                 | sed -e 's|/lib64/|/lib/|')
8375         fi
8376         FilterLibs "${MARIADB_LIBS}"
8377         MARIADB_LIBS="${filteredlibs}"
8378         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8379         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8380         if test "$enable_bundle_mariadb" = "yes"; then
8381             AC_MSG_RESULT([yes])
8382             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8383             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8385 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8387 /g' | grep -E '(mysqlclient|mariadb)')
8388             if test "$_os" = "Darwin"; then
8389                 LIBMARIADB=${LIBMARIADB}.dylib
8390             elif test "$_os" = "WINNT"; then
8391                 LIBMARIADB=${LIBMARIADB}.dll
8392             else
8393                 LIBMARIADB=${LIBMARIADB}.so
8394             fi
8395             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8396             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8397             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8398                 AC_MSG_RESULT([found.])
8399                 PathFormat "$LIBMARIADB_PATH"
8400                 LIBMARIADB_PATH="$formatted_path"
8401             else
8402                 AC_MSG_ERROR([not found.])
8403             fi
8404         else
8405             AC_MSG_RESULT([no])
8406             BUNDLE_MARIADB_CONNECTOR_C=
8407         fi
8408     else
8409         AC_MSG_RESULT([internal])
8410         SYSTEM_MARIADB_CONNECTOR_C=
8411         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8412         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8413         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8414     fi
8416     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8417     AC_SUBST(MARIADB_CFLAGS)
8418     AC_SUBST(MARIADB_LIBS)
8419     AC_SUBST(LIBMARIADB)
8420     AC_SUBST(LIBMARIADB_PATH)
8421     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8423     AC_LANG_PUSH([C++])
8424     dnl ===================================================================
8425     dnl Check for system MySQL C++ Connector
8426     dnl ===================================================================
8427     # FIXME!
8428     # who thought this too-generic cppconn dir was a good idea?
8429     AC_MSG_CHECKING([MySQL Connector/C++])
8430     if test "$with_system_mysql_cppconn" = "yes"; then
8431         AC_MSG_RESULT([external])
8432         SYSTEM_MYSQL_CONNECTOR_CPP=TRUE
8433         AC_LANG_PUSH([C++])
8434         AC_CHECK_HEADER(mysql_driver.h, [],
8435                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8436         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8437                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8438         save_LIBS=$LIBS
8439         LIBS="$LIBS -lmysqlcppconn"
8440         AC_MSG_CHECKING([version])
8441         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8442 #include <mysql_driver.h>
8444 int main(int argc, char **argv) {
8445     sql::Driver *driver;
8446     driver = get_driver_instance();
8447     if (driver->getMajorVersion() > 1 || \
8448        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8449        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8450         return 0;
8451       else
8452         return 1;
8454       ]])],[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])])
8456         AC_LANG_POP([C++])
8457         LIBS=$save_LIBS
8458     else
8459         AC_MSG_RESULT([internal])
8460         BUILD_TYPE="$BUILD_TYPE MYSQL_CONNECTOR_CPP"
8461         SYSTEM_MYSQL_CONNECTOR_CPP=
8462     fi
8463     AC_LANG_POP([C++])
8465 AC_SUBST(SYSTEM_MYSQL_CONNECTOR_CPP)
8467 dnl ===================================================================
8468 dnl Check for system hsqldb
8469 dnl ===================================================================
8470 if test "$with_java" != "no"; then
8471     HSQLDB_USE_JDBC_4_1=
8472     AC_MSG_CHECKING([which hsqldb to use])
8473     if test "$with_system_hsqldb" = "yes"; then
8474         AC_MSG_RESULT([external])
8475         SYSTEM_HSQLDB=TRUE
8476         if test -z $HSQLDB_JAR; then
8477             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8478         fi
8479         if ! test -f $HSQLDB_JAR; then
8480                AC_MSG_ERROR(hsqldb.jar not found.)
8481         fi
8482         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8483         export HSQLDB_JAR
8484         if $PERL -e \
8485            'use Archive::Zip;
8486             my $file = "$ENV{'HSQLDB_JAR'}";
8487             my $zip = Archive::Zip->new( $file );
8488             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8489             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8490             {
8491                 push @l, split(/\n/, $mf);
8492                 foreach my $line (@l)
8493                 {
8494                     if ($line =~ m/Specification-Version:/)
8495                     {
8496                         ($t, $version) = split (/:/,$line);
8497                         $version =~ s/^\s//;
8498                         ($a, $b, $c, $d) = split (/\./,$version);
8499                         if ($c == "0" && $d > "8")
8500                         {
8501                             exit 0;
8502                         }
8503                         else
8504                         {
8505                             exit 1;
8506                         }
8507                     }
8508                 }
8509             }
8510             else
8511             {
8512                 exit 1;
8513             }'; then
8514             AC_MSG_RESULT([yes])
8515         else
8516             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8517         fi
8518     else
8519         AC_MSG_RESULT([internal])
8520         SYSTEM_HSQLDB=
8521         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8522         NEED_ANT=TRUE
8523         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8524         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8525         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8526             AC_MSG_RESULT([yes])
8527             HSQLDB_USE_JDBC_4_1=TRUE
8528         else
8529             AC_MSG_RESULT([no])
8530         fi
8531     fi
8532     AC_SUBST(SYSTEM_HSQLDB)
8533     AC_SUBST(HSQLDB_JAR)
8534     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8537 dnl ===================================================================
8538 dnl Check for PostgreSQL stuff
8539 dnl ===================================================================
8540 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
8541 if test "x$enable_postgresql_sdbc" != "xno"; then
8542     AC_MSG_RESULT([yes])
8543     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8545     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8546         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8547     fi
8548     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8549         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8550     fi
8552     postgres_interface=""
8553     if test "$with_system_postgresql" = "yes"; then
8554         postgres_interface="external PostgreSQL"
8555         SYSTEM_POSTGRESQL=TRUE
8556         if test "$_os" = Darwin; then
8557             supp_path=''
8558             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8559                 pg_supp_path="$P_SEP$d$pg_supp_path"
8560             done
8561         fi
8562         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8563         if test -z "$PGCONFIG"; then
8564             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8565         fi
8566         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8567         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8568         FilterLibs "${POSTGRESQL_LIB}"
8569         POSTGRESQL_LIB="${filteredlibs}"
8570     else
8571         # if/when anything else than PostgreSQL uses Kerberos,
8572         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8573         WITH_KRB5=
8574         WITH_GSSAPI=
8575         case "$_os" in
8576         Darwin)
8577             # MacOS X has system MIT Kerberos 5 since 10.4
8578             if test "$with_krb5" != "no"; then
8579                 WITH_KRB5=TRUE
8580                 save_LIBS=$LIBS
8581                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8582                 # that the libraries where these functions are located on macOS will change, is it?
8583                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8584                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8585                 KRB5_LIBS=$LIBS
8586                 LIBS=$save_LIBS
8587                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8588                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8589                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8590                 LIBS=$save_LIBS
8591             fi
8592             if test "$with_gssapi" != "no"; then
8593                 WITH_GSSAPI=TRUE
8594                 save_LIBS=$LIBS
8595                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8596                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8597                 GSSAPI_LIBS=$LIBS
8598                 LIBS=$save_LIBS
8599             fi
8600             ;;
8601         WINNT)
8602             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8603                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8604             fi
8605             ;;
8606         Linux|GNU|*BSD|DragonFly)
8607             if test "$with_krb5" != "no"; then
8608                 WITH_KRB5=TRUE
8609                 save_LIBS=$LIBS
8610                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8611                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8612                 KRB5_LIBS=$LIBS
8613                 LIBS=$save_LIBS
8614                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8615                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8616                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8617                 LIBS=$save_LIBS
8618             fi
8619             if test "$with_gssapi" != "no"; then
8620                 WITH_GSSAPI=TRUE
8621                 save_LIBS=$LIBS
8622                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8623                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8624                 GSSAPI_LIBS=$LIBS
8625                 LIBS=$save_LIBS
8626             fi
8627             ;;
8628         *)
8629             if test "$with_krb5" = "yes"; then
8630                 WITH_KRB5=TRUE
8631                 save_LIBS=$LIBS
8632                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8633                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8634                 KRB5_LIBS=$LIBS
8635                 LIBS=$save_LIBS
8636                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8637                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8638                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8639                 LIBS=$save_LIBS
8640             fi
8641             if test "$with_gssapi" = "yes"; then
8642                 WITH_GSSAPI=TRUE
8643                 save_LIBS=$LIBS
8644                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8645                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8646                 LIBS=$save_LIBS
8647                 GSSAPI_LIBS=$LIBS
8648             fi
8649         esac
8651         if test -n "$with_libpq_path"; then
8652             SYSTEM_POSTGRESQL=TRUE
8653             postgres_interface="external libpq"
8654             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8655             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8656         else
8657             SYSTEM_POSTGRESQL=
8658             postgres_interface="internal"
8659             POSTGRESQL_LIB=""
8660             POSTGRESQL_INC="%OVERRIDE_ME%"
8661             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8662         fi
8663     fi
8665     AC_MSG_CHECKING([PostgreSQL C interface])
8666     AC_MSG_RESULT([$postgres_interface])
8668     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8669         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8670         save_CFLAGS=$CFLAGS
8671         save_CPPFLAGS=$CPPFLAGS
8672         save_LIBS=$LIBS
8673         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8674         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8675         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8676         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8677             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8678         CFLAGS=$save_CFLAGS
8679         CPPFLAGS=$save_CPPFLAGS
8680         LIBS=$save_LIBS
8681     fi
8682     BUILD_POSTGRESQL_SDBC=TRUE
8683 else
8684     AC_MSG_RESULT([no])
8686 AC_SUBST(WITH_KRB5)
8687 AC_SUBST(WITH_GSSAPI)
8688 AC_SUBST(GSSAPI_LIBS)
8689 AC_SUBST(KRB5_LIBS)
8690 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8691 AC_SUBST(SYSTEM_POSTGRESQL)
8692 AC_SUBST(POSTGRESQL_INC)
8693 AC_SUBST(POSTGRESQL_LIB)
8695 dnl ===================================================================
8696 dnl Check for Firebird stuff
8697 dnl ===================================================================
8698 ENABLE_FIREBIRD_SDBC=""
8699 if test "$enable_firebird_sdbc" = "yes" ; then
8700     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8702     dnl ===================================================================
8703     dnl Check for system Firebird
8704     dnl ===================================================================
8705     AC_MSG_CHECKING([which Firebird to use])
8706     if test "$with_system_firebird" = "yes"; then
8707         AC_MSG_RESULT([external])
8708         SYSTEM_FIREBIRD=TRUE
8709         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8710         if test -z "$FIREBIRDCONFIG"; then
8711             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8712             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8713                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8714             ])
8715             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8716         else
8717             AC_MSG_NOTICE([fb_config found])
8718             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8719             AC_MSG_CHECKING([for Firebird Client library])
8720             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8721             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8722             FilterLibs "${FIREBIRD_LIBS}"
8723             FIREBIRD_LIBS="${filteredlibs}"
8724         fi
8725         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8726         AC_MSG_CHECKING([Firebird version])
8727         if test -n "${FIREBIRD_VERSION}"; then
8728             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8729             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8730             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8731                 AC_MSG_RESULT([OK])
8732             else
8733                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
8734             fi
8735         else
8736             __save_CFLAGS="${CFLAGS}"
8737             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8738             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8739 #if defined(FB_API_VER) && FB_API_VER == 30
8740 int fb_api_is_30(void) { return 0; }
8741 #else
8742 #error "Wrong Firebird API version"
8743 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
8744             CFLAGS="${__save_CFLAGS}"
8745         fi
8746         ENABLE_FIREBIRD_SDBC="TRUE"
8747     elif test "$enable_database_connectivity" != yes; then
8748         AC_MSG_RESULT([none])
8749     elif test "$cross_compiling" = "yes"; then
8750         AC_MSG_RESULT([none])
8751     else
8752         dnl Embedded Firebird has version 3.0
8753         AC_DEFINE(HAVE_FIREBIRD_30, 1)
8754         dnl We need libatomic-ops for any non X86/X64 system
8755         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8756             dnl ===================================================================
8757             dnl Check for system libatomic-ops
8758             dnl ===================================================================
8759             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8760             if test "$with_system_libatomic_ops" = "yes"; then
8761                 SYSTEM_LIBATOMIC_OPS=TRUE
8762                 AC_CHECK_HEADERS(atomic_ops.h, [],
8763                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8764             else
8765                 SYSTEM_LIBATOMIC_OPS=
8766                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8767                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8768                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8769             fi
8770         fi
8772         AC_MSG_RESULT([internal])
8773         SYSTEM_FIREBIRD=
8774         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
8775         FIREBIRD_LIBS="-lfbclient"
8777         if test "$with_system_libtommath" = "yes"; then
8778             SYSTEM_LIBTOMMATH=TRUE
8779             dnl check for tommath presence
8780             save_LIBS=$LIBS
8781             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
8782             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
8783             LIBS=$save_LIBS
8784         else
8785             SYSTEM_LIBTOMMATH=
8786             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
8787             LIBTOMMATH_LIBS="-ltommath"
8788             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
8789         fi
8791         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8792         ENABLE_FIREBIRD_SDBC="TRUE"
8793         AC_DEFINE(ENABLE_FIREBIRD_SDBC)
8794     fi
8796 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8797 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8798 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8799 AC_SUBST(LIBATOMIC_OPS_LIBS)
8800 AC_SUBST(SYSTEM_FIREBIRD)
8801 AC_SUBST(FIREBIRD_CFLAGS)
8802 AC_SUBST(FIREBIRD_LIBS)
8803 AC_SUBST([TOMMATH_CFLAGS])
8804 AC_SUBST([TOMMATH_LIBS])
8806 dnl ===================================================================
8807 dnl Check for system curl
8808 dnl ===================================================================
8809 AC_MSG_CHECKING([which libcurl to use])
8810 if test "$with_system_curl" = "auto"; then
8811     with_system_curl="$with_system_libs"
8814 if test "$with_system_curl" = "yes"; then
8815     AC_MSG_RESULT([external])
8816     SYSTEM_CURL=TRUE
8818     # First try PKGCONFIG and then fall back
8819     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8821     if test -n "$CURL_PKG_ERRORS"; then
8822         AC_PATH_PROG(CURLCONFIG, curl-config)
8823         if test -z "$CURLCONFIG"; then
8824             AC_MSG_ERROR([curl development files not found])
8825         fi
8826         CURL_LIBS=`$CURLCONFIG --libs`
8827         FilterLibs "${CURL_LIBS}"
8828         CURL_LIBS="${filteredlibs}"
8829         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8830         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8832         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8833         case $curl_version in
8834         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8835         dnl so they need to be doubled to end up in the configure script
8836         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8837             AC_MSG_RESULT([yes])
8838             ;;
8839         *)
8840             AC_MSG_ERROR([no, you have $curl_version])
8841             ;;
8842         esac
8843     fi
8845     ENABLE_CURL=TRUE
8846 elif test $_os = iOS; then
8847     # Let's see if we need curl, I think not?
8848     AC_MSG_RESULT([none])
8849     ENABLE_CURL=
8850 else
8851     AC_MSG_RESULT([internal])
8852     SYSTEM_CURL=
8853     BUILD_TYPE="$BUILD_TYPE CURL"
8854     ENABLE_CURL=TRUE
8856 AC_SUBST(SYSTEM_CURL)
8857 AC_SUBST(CURL_CFLAGS)
8858 AC_SUBST(CURL_LIBS)
8859 AC_SUBST(ENABLE_CURL)
8861 dnl ===================================================================
8862 dnl Check for system boost
8863 dnl ===================================================================
8864 AC_MSG_CHECKING([which boost to use])
8865 if test "$with_system_boost" = "yes"; then
8866     AC_MSG_RESULT([external])
8867     SYSTEM_BOOST=TRUE
8868     AX_BOOST_BASE(1.47)
8869     AX_BOOST_DATE_TIME
8870     AX_BOOST_FILESYSTEM
8871     AX_BOOST_IOSTREAMS
8872     AX_BOOST_LOCALE
8873     AC_LANG_PUSH([C++])
8874     save_CXXFLAGS=$CXXFLAGS
8875     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8876     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8877        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8878     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8879        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8880     CXXFLAGS=$save_CXXFLAGS
8881     AC_LANG_POP([C++])
8882     # this is in m4/ax_boost_base.m4
8883     FilterLibs "${BOOST_LDFLAGS}"
8884     BOOST_LDFLAGS="${filteredlibs}"
8885 else
8886     AC_MSG_RESULT([internal])
8887     BUILD_TYPE="$BUILD_TYPE BOOST"
8888     SYSTEM_BOOST=
8889     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
8890         # use warning-suppressing wrapper headers
8891         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
8892     else
8893         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
8894     fi
8896 AC_SUBST(SYSTEM_BOOST)
8898 dnl ===================================================================
8899 dnl Check for system mdds
8900 dnl ===================================================================
8901 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.2 >= 1.2.3], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8903 dnl ===================================================================
8904 dnl Check for system glm
8905 dnl ===================================================================
8906 AC_MSG_CHECKING([which glm to use])
8907 if test "$with_system_glm" = "yes"; then
8908     AC_MSG_RESULT([external])
8909     SYSTEM_GLM=TRUE
8910     AC_LANG_PUSH([C++])
8911     AC_CHECK_HEADER([glm/glm.hpp], [],
8912        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8913     AC_LANG_POP([C++])
8914 else
8915     AC_MSG_RESULT([internal])
8916     BUILD_TYPE="$BUILD_TYPE GLM"
8917     SYSTEM_GLM=
8918     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8920 AC_SUBST([GLM_CFLAGS])
8921 AC_SUBST([SYSTEM_GLM])
8923 dnl ===================================================================
8924 dnl Check for system odbc
8925 dnl ===================================================================
8926 AC_MSG_CHECKING([which odbc headers to use])
8927 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
8928     AC_MSG_RESULT([external])
8929     SYSTEM_ODBC_HEADERS=TRUE
8931     if test "$build_os" = "cygwin"; then
8932         save_CPPFLAGS=$CPPFLAGS
8933         find_winsdk
8934         PathFormat "$winsdktest"
8935         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"
8936         AC_CHECK_HEADER(sqlext.h, [],
8937             [AC_MSG_ERROR(odbc not found. install odbc)],
8938             [#include <windows.h>])
8939         CPPFLAGS=$save_CPPFLAGS
8940     else
8941         AC_CHECK_HEADER(sqlext.h, [],
8942             [AC_MSG_ERROR(odbc not found. install odbc)],[])
8943     fi
8944 elif test "$enable_database_connectivity" != yes; then
8945     AC_MSG_RESULT([none])
8946 else
8947     AC_MSG_RESULT([internal])
8948     SYSTEM_ODBC_HEADERS=
8950 AC_SUBST(SYSTEM_ODBC_HEADERS)
8953 dnl ===================================================================
8954 dnl Check for system openldap
8955 dnl ===================================================================
8957 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8958 AC_MSG_CHECKING([which openldap library to use])
8959 if test "$with_system_openldap" = "yes"; then
8960     AC_MSG_RESULT([external])
8961     SYSTEM_OPENLDAP=TRUE
8962     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8963     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8964     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8965 else
8966     AC_MSG_RESULT([internal])
8967     SYSTEM_OPENLDAP=
8968     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8971 AC_SUBST(SYSTEM_OPENLDAP)
8973 dnl ===================================================================
8974 dnl Check for system NSS
8975 dnl ===================================================================
8976 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
8977     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8978     AC_DEFINE(HAVE_FEATURE_NSS)
8979     ENABLE_NSS="TRUE"
8980     AC_DEFINE(ENABLE_NSS)
8981 elif test $_os != iOS ; then
8982     with_tls=openssl
8984 AC_SUBST(ENABLE_NSS)
8986 dnl ===================================================================
8987 dnl Check for TLS/SSL and cryptographic implementation to use
8988 dnl ===================================================================
8989 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8990 if test -n "$with_tls"; then
8991     case $with_tls in
8992     openssl)
8993         AC_DEFINE(USE_TLS_OPENSSL)
8994         TLS=OPENSSL
8996         if test "$enable_openssl" != "yes"; then
8997             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8998         fi
9000         # warn that OpenSSL has been selected but not all TLS code has this option
9001         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9002         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9003         ;;
9004     nss)
9005         AC_DEFINE(USE_TLS_NSS)
9006         TLS=NSS
9007         ;;
9008     no)
9009         AC_MSG_WARN([Skipping TLS/SSL])
9010         ;;
9011     *)
9012         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9013 openssl - OpenSSL
9014 nss - Mozilla's Network Security Services (NSS)
9015     ])
9016         ;;
9017     esac
9018 else
9019     # default to using NSS, it results in smaller oox lib
9020     AC_DEFINE(USE_TLS_NSS)
9021     TLS=NSS
9023 AC_MSG_RESULT([$TLS])
9024 AC_SUBST(TLS)
9026 dnl ===================================================================
9027 dnl Check for system sane
9028 dnl ===================================================================
9029 AC_MSG_CHECKING([which sane header to use])
9030 if test "$with_system_sane" = "yes"; then
9031     AC_MSG_RESULT([external])
9032     AC_CHECK_HEADER(sane/sane.h, [],
9033       [AC_MSG_ERROR(sane not found. install sane)], [])
9034 else
9035     AC_MSG_RESULT([internal])
9036     BUILD_TYPE="$BUILD_TYPE SANE"
9039 dnl ===================================================================
9040 dnl Check for system icu
9041 dnl ===================================================================
9042 SYSTEM_GENBRK=
9043 SYSTEM_GENCCODE=
9044 SYSTEM_GENCMN=
9046 ICU_MAJOR=62
9047 ICU_MINOR=1
9048 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9049 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9050 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9051 AC_MSG_CHECKING([which icu to use])
9052 if test "$with_system_icu" = "yes"; then
9053     AC_MSG_RESULT([external])
9054     SYSTEM_ICU=TRUE
9055     AC_LANG_PUSH([C++])
9056     AC_MSG_CHECKING([for unicode/rbbi.h])
9057     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9058     AC_LANG_POP([C++])
9060     if test "$cross_compiling" != "yes"; then
9061         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9062         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9063         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9064         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9065     fi
9067     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9068         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9069         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9070         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9071         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9072         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9073             AC_MSG_RESULT([yes])
9074         else
9075             AC_MSG_RESULT([no])
9076             if test "$with_system_icu_for_build" != "force"; then
9077                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9078 You can use --with-system-icu-for-build=force to use it anyway.])
9079             fi
9080         fi
9081     fi
9083     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9084         # using the system icu tools can lead to version confusion, use the
9085         # ones from the build environment when cross-compiling
9086         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9087         if test -z "$SYSTEM_GENBRK"; then
9088             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9089         fi
9090         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9091         if test -z "$SYSTEM_GENCCODE"; then
9092             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9093         fi
9094         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9095         if test -z "$SYSTEM_GENCMN"; then
9096             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9097         fi
9098         if test "$ICU_MAJOR" -ge "49"; then
9099             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9100             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9101             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9102         else
9103             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9104             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9105             ICU_RECLASSIFIED_HEBREW_LETTER=
9106         fi
9107     fi
9109     if test "$cross_compiling" = "yes"; then
9110         if test "$ICU_MAJOR" -ge "50"; then
9111             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9112             ICU_MINOR=""
9113         fi
9114     fi
9115 else
9116     AC_MSG_RESULT([internal])
9117     SYSTEM_ICU=
9118     BUILD_TYPE="$BUILD_TYPE ICU"
9119     # surprisingly set these only for "internal" (to be used by various other
9120     # external libs): the system icu-config is quite unhelpful and spits out
9121     # dozens of weird flags and also default path -I/usr/include
9122     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9123     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9125 if test "$ICU_MAJOR" -ge "59"; then
9126     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9127     # with -std=c++11 but not all external libraries can be built with that,
9128     # for those use a bit-compatible typedef uint16_t UChar; see
9129     # icu/source/common/unicode/umachine.h
9130     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9131 else
9132     ICU_UCHAR_TYPE=""
9134 AC_SUBST(SYSTEM_ICU)
9135 AC_SUBST(SYSTEM_GENBRK)
9136 AC_SUBST(SYSTEM_GENCCODE)
9137 AC_SUBST(SYSTEM_GENCMN)
9138 AC_SUBST(ICU_MAJOR)
9139 AC_SUBST(ICU_MINOR)
9140 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9141 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9142 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9143 AC_SUBST(ICU_CFLAGS)
9144 AC_SUBST(ICU_LIBS)
9145 AC_SUBST(ICU_UCHAR_TYPE)
9147 dnl ==================================================================
9148 dnl Breakpad
9149 dnl ==================================================================
9150 AC_MSG_CHECKING([whether to enable breakpad])
9151 if test "$enable_breakpad" != yes; then
9152     AC_MSG_RESULT([no])
9153 else
9154     AC_MSG_RESULT([yes])
9155     ENABLE_BREAKPAD="TRUE"
9156     AC_DEFINE(ENABLE_BREAKPAD)
9157     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9158     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9160     AC_MSG_CHECKING([for crashreport config])
9161     if test "$with_symbol_config" = "no"; then
9162         BREAKPAD_SYMBOL_CONFIG="invalid"
9163         AC_MSG_RESULT([no])
9164     else
9165         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9166         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9167         AC_MSG_RESULT([yes])
9168     fi
9169     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9171 AC_SUBST(ENABLE_BREAKPAD)
9173 dnl ==================================================================
9174 dnl libfuzzer
9175 dnl ==================================================================
9176 AC_MSG_CHECKING([whether to enable fuzzers])
9177 if test "$enable_fuzzers" != yes; then
9178     AC_MSG_RESULT([no])
9179 else
9180     AC_MSG_RESULT([yes])
9181     ENABLE_FUZZERS="TRUE"
9182     AC_DEFINE(ENABLE_FUZZERS)
9183     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9185 AC_SUBST(ENABLE_FUZZERS)
9187 dnl ===================================================================
9188 dnl Orcus
9189 dnl ===================================================================
9190 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.13 >= 0.13.3])
9191 if test "$with_system_orcus" != "yes"; then
9192     if test "$SYSTEM_BOOST" = "TRUE"; then
9193         # ===========================================================
9194         # Determine if we are going to need to link with Boost.System
9195         # ===========================================================
9196         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9197         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9198         dnl in documentation has no effect.
9199         AC_MSG_CHECKING([if we need to link with Boost.System])
9200         AC_LANG_PUSH([C++])
9201         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9202                 @%:@include <boost/version.hpp>
9203             ]],[[
9204                 #if BOOST_VERSION >= 105000
9205                 #   error yes, we need to link with Boost.System
9206                 #endif
9207             ]])],[
9208                 AC_MSG_RESULT([no])
9209             ],[
9210                 AC_MSG_RESULT([yes])
9211                 AX_BOOST_SYSTEM
9212         ])
9213         AC_LANG_POP([C++])
9214     fi
9216 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9217 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9218 AC_SUBST([BOOST_SYSTEM_LIB])
9219 AC_SUBST(SYSTEM_LIBORCUS)
9221 dnl ===================================================================
9222 dnl HarfBuzz
9223 dnl ===================================================================
9224 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9225                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9226                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9228 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9229                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9230                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9232 if test "$COM" = "MSC"; then # override the above
9233     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9234     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9237 if test "$with_system_harfbuzz" = "yes"; then
9238     if test "$with_system_graphite" = "no"; then
9239         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9240     fi
9241     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9242     _save_libs="$LIBS"
9243     _save_cflags="$CFLAGS"
9244     LIBS="$LIBS $HARFBUZZ_LIBS"
9245     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9246     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9247     LIBS="$_save_libs"
9248     CFLAGS="$_save_cflags"
9249 else
9250     if test "$with_system_graphite" = "yes"; then
9251         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9252     fi
9255 AC_MSG_CHECKING([whether to use X11])
9256 dnl ***************************************
9257 dnl testing for X libraries and includes...
9258 dnl ***************************************
9259 if test "$USING_X11" = TRUE; then
9260     AC_DEFINE(HAVE_FEATURE_X11)
9262 AC_MSG_RESULT([$USING_X11])
9264 if test "$USING_X11" = TRUE; then
9265     AC_PATH_X
9266     AC_PATH_XTRA
9267     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9269     if test -z "$x_includes"; then
9270         x_includes="default_x_includes"
9271     fi
9272     if test -z "$x_libraries"; then
9273         x_libraries="default_x_libraries"
9274     fi
9275     CFLAGS="$CFLAGS $X_CFLAGS"
9276     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9277     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9278 else
9279     x_includes="no_x_includes"
9280     x_libraries="no_x_libraries"
9283 if test "$USING_X11" = TRUE; then
9284     dnl ===================================================================
9285     dnl Check for extension headers
9286     dnl ===================================================================
9287     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9288      [#include <X11/extensions/shape.h>])
9290     # vcl needs ICE and SM
9291     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9292     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9293         [AC_MSG_ERROR(ICE library not found)])
9294     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9295     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9296         [AC_MSG_ERROR(SM library not found)])
9299 dnl ===================================================================
9300 dnl Check for system Xrender
9301 dnl ===================================================================
9302 AC_MSG_CHECKING([whether to use Xrender])
9303 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9304     AC_MSG_RESULT([yes])
9305     PKG_CHECK_MODULES(XRENDER, xrender)
9306     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9307     FilterLibs "${XRENDER_LIBS}"
9308     XRENDER_LIBS="${filteredlibs}"
9309     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9310       [AC_MSG_ERROR(libXrender not found or functional)], [])
9311     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9312       [AC_MSG_ERROR(Xrender not found. install X)], [])
9313 else
9314     AC_MSG_RESULT([no])
9316 AC_SUBST(XRENDER_CFLAGS)
9317 AC_SUBST(XRENDER_LIBS)
9319 dnl ===================================================================
9320 dnl Check for XRandr
9321 dnl ===================================================================
9322 AC_MSG_CHECKING([whether to enable RandR support])
9323 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9324     AC_MSG_RESULT([yes])
9325     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9326     if test "$ENABLE_RANDR" != "TRUE"; then
9327         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9328                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9329         XRANDR_CFLAGS=" "
9330         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9331           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9332         XRANDR_LIBS="-lXrandr "
9333         ENABLE_RANDR="TRUE"
9334     fi
9335     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9336     FilterLibs "${XRANDR_LIBS}"
9337     XRANDR_LIBS="${filteredlibs}"
9338 else
9339     ENABLE_RANDR=""
9340     AC_MSG_RESULT([no])
9342 AC_SUBST(XRANDR_CFLAGS)
9343 AC_SUBST(XRANDR_LIBS)
9344 AC_SUBST(ENABLE_RANDR)
9346 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9347     WITH_WEBDAV="serf"
9349 if test $_os = iOS -o $_os = Android; then
9350     WITH_WEBDAV="no"
9352 AC_MSG_CHECKING([for webdav library])
9353 case "$WITH_WEBDAV" in
9354 serf)
9355     AC_MSG_RESULT([serf])
9356     # Check for system apr-util
9357     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9358                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9359                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9360     if test "$COM" = "MSC"; then
9361         APR_LIB_DIR="LibR"
9362         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9363         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9364     fi
9366     # Check for system serf
9367     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9368                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9369     if test "$COM" = "MSC"; then
9370         SERF_LIB_DIR="Release"
9371         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9372         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9373     fi
9374     ;;
9375 neon)
9376     AC_MSG_RESULT([neon])
9377     # Check for system neon
9378     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9379     if test "$with_system_neon" = "yes"; then
9380         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9381     else
9382         NEON_VERSION=0295
9383     fi
9384     AC_SUBST(NEON_VERSION)
9385     ;;
9387     AC_MSG_RESULT([none, disabled])
9388     WITH_WEBDAV=""
9389     ;;
9390 esac
9391 AC_SUBST(WITH_WEBDAV)
9393 dnl ===================================================================
9394 dnl Check for disabling cve_tests
9395 dnl ===================================================================
9396 AC_MSG_CHECKING([whether to execute CVE tests])
9397 # If not explicitly enabled or disabled, default
9398 if test -z "$enable_cve_tests"; then
9399     case "$OS" in
9400     WNT)
9401         # Default cves off for windows with its wild and wonderful
9402         # varienty of AV software kicking in and panicking
9403         enable_cve_tests=no
9404         ;;
9405     *)
9406         # otherwise yes
9407         enable_cve_tests=yes
9408         ;;
9409     esac
9411 if test "$enable_cve_tests" = "no"; then
9412     AC_MSG_RESULT([no])
9413     DISABLE_CVE_TESTS=TRUE
9414     AC_SUBST(DISABLE_CVE_TESTS)
9415 else
9416     AC_MSG_RESULT([yes])
9419 dnl ===================================================================
9420 dnl Check for enabling chart XShape tests
9421 dnl ===================================================================
9422 AC_MSG_CHECKING([whether to execute chart XShape tests])
9423 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9424     AC_MSG_RESULT([yes])
9425     ENABLE_CHART_TESTS=TRUE
9426     AC_SUBST(ENABLE_CHART_TESTS)
9427 else
9428     AC_MSG_RESULT([no])
9431 dnl ===================================================================
9432 dnl Check for system openssl
9433 dnl ===================================================================
9434 DISABLE_OPENSSL=
9435 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9436 if test "$enable_openssl" = "yes"; then
9437     AC_MSG_RESULT([no])
9438     if test "$_os" = Darwin ; then
9439         # OpenSSL is deprecated when building for 10.7 or later.
9440         #
9441         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9442         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9444         with_system_openssl=no
9445         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9446     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9447             && test "$with_system_openssl" != "no"; then
9448         with_system_openssl=yes
9449         SYSTEM_OPENSSL=TRUE
9450         OPENSSL_CFLAGS=
9451         OPENSSL_LIBS="-lssl -lcrypto"
9452     else
9453         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9454     fi
9455     if test "$with_system_openssl" = "yes"; then
9456         AC_MSG_CHECKING([whether openssl supports SHA512])
9457         AC_LANG_PUSH([C])
9458         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9459             SHA512_CTX context;
9460 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9461         AC_LANG_POP(C)
9462     fi
9463 else
9464     AC_MSG_RESULT([yes])
9465     DISABLE_OPENSSL=TRUE
9467     # warn that although OpenSSL is disabled, system libraries may depend on it
9468     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9469     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9472 AC_SUBST([DISABLE_OPENSSL])
9474 dnl ===================================================================
9475 dnl Check for building gnutls
9476 dnl ===================================================================
9477 AC_MSG_CHECKING([whether to use gnutls])
9478 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9479     AC_MSG_RESULT([yes])
9480     AM_PATH_LIBGCRYPT()
9481     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9482         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9483                       available in the system to use as replacement.]]))
9484     FilterLibs "${LIBGCRYPT_LIBS}"
9485     LIBGCRYPT_LIBS="${filteredlibs}"
9486 else
9487     AC_MSG_RESULT([no])
9490 AC_SUBST([LIBGCRYPT_CFLAGS])
9491 AC_SUBST([LIBGCRYPT_LIBS])
9493 dnl ===================================================================
9494 dnl Check for system redland
9495 dnl ===================================================================
9496 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9497 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9498 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9499 if test "$with_system_redland" = "yes"; then
9500     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9501             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9502 else
9503     RAPTOR_MAJOR="0"
9504     RASQAL_MAJOR="3"
9505     REDLAND_MAJOR="0"
9507 AC_SUBST(RAPTOR_MAJOR)
9508 AC_SUBST(RASQAL_MAJOR)
9509 AC_SUBST(REDLAND_MAJOR)
9511 dnl ===================================================================
9512 dnl Check for system hunspell
9513 dnl ===================================================================
9514 AC_MSG_CHECKING([which libhunspell to use])
9515 if test "$with_system_hunspell" = "yes"; then
9516     AC_MSG_RESULT([external])
9517     SYSTEM_HUNSPELL=TRUE
9518     AC_LANG_PUSH([C++])
9519     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9520     if test "$HUNSPELL_PC" != "TRUE"; then
9521         AC_CHECK_HEADER(hunspell.hxx, [],
9522             [
9523             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9524             [AC_MSG_ERROR(hunspell headers not found.)], [])
9525             ], [])
9526         AC_CHECK_LIB([hunspell], [main], [:],
9527            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9528         HUNSPELL_LIBS=-lhunspell
9529     fi
9530     AC_LANG_POP([C++])
9531     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9532     FilterLibs "${HUNSPELL_LIBS}"
9533     HUNSPELL_LIBS="${filteredlibs}"
9534 else
9535     AC_MSG_RESULT([internal])
9536     SYSTEM_HUNSPELL=
9537     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9538     if test "$COM" = "MSC"; then
9539         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9540     else
9541         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.6"
9542     fi
9543     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9545 AC_SUBST(SYSTEM_HUNSPELL)
9546 AC_SUBST(HUNSPELL_CFLAGS)
9547 AC_SUBST(HUNSPELL_LIBS)
9549 dnl ===================================================================
9550 dnl Checking for altlinuxhyph
9551 dnl ===================================================================
9552 AC_MSG_CHECKING([which altlinuxhyph to use])
9553 if test "$with_system_altlinuxhyph" = "yes"; then
9554     AC_MSG_RESULT([external])
9555     SYSTEM_HYPH=TRUE
9556     AC_CHECK_HEADER(hyphen.h, [],
9557        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9558     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9559        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9560        [#include <hyphen.h>])
9561     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9562         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9563     if test -z "$HYPHEN_LIB"; then
9564         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9565            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9566     fi
9567     if test -z "$HYPHEN_LIB"; then
9568         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9569            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9570     fi
9571 else
9572     AC_MSG_RESULT([internal])
9573     SYSTEM_HYPH=
9574     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9575     if test "$COM" = "MSC"; then
9576         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9577     else
9578         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9579     fi
9581 AC_SUBST(SYSTEM_HYPH)
9582 AC_SUBST(HYPHEN_LIB)
9584 dnl ===================================================================
9585 dnl Checking for mythes
9586 dnl ===================================================================
9587 AC_MSG_CHECKING([which mythes to use])
9588 if test "$with_system_mythes" = "yes"; then
9589     AC_MSG_RESULT([external])
9590     SYSTEM_MYTHES=TRUE
9591     AC_LANG_PUSH([C++])
9592     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9593     if test "$MYTHES_PKGCONFIG" = "no"; then
9594         AC_CHECK_HEADER(mythes.hxx, [],
9595             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9596         AC_CHECK_LIB([mythes-1.2], [main], [:],
9597             [ MYTHES_FOUND=no], [])
9598     if test "$MYTHES_FOUND" = "no"; then
9599         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9600                 [ MYTHES_FOUND=no], [])
9601     fi
9602     if test "$MYTHES_FOUND" = "no"; then
9603         AC_MSG_ERROR([mythes library not found!.])
9604     fi
9605     fi
9606     AC_LANG_POP([C++])
9607     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9608     FilterLibs "${MYTHES_LIBS}"
9609     MYTHES_LIBS="${filteredlibs}"
9610 else
9611     AC_MSG_RESULT([internal])
9612     SYSTEM_MYTHES=
9613     BUILD_TYPE="$BUILD_TYPE MYTHES"
9614     if test "$COM" = "MSC"; then
9615         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9616     else
9617         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9618     fi
9620 AC_SUBST(SYSTEM_MYTHES)
9621 AC_SUBST(MYTHES_CFLAGS)
9622 AC_SUBST(MYTHES_LIBS)
9624 dnl ===================================================================
9625 dnl How should we build the linear programming solver ?
9626 dnl ===================================================================
9628 ENABLE_COINMP=
9629 AC_MSG_CHECKING([whether to build with CoinMP])
9630 if test "$enable_coinmp" != "no"; then
9631     ENABLE_COINMP=TRUE
9632     AC_MSG_RESULT([yes])
9633     if test "$with_system_coinmp" = "yes"; then
9634         SYSTEM_COINMP=TRUE
9635         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9636         FilterLibs "${COINMP_LIBS}"
9637         COINMP_LIBS="${filteredlibs}"
9638     else
9639         BUILD_TYPE="$BUILD_TYPE COINMP"
9640     fi
9641 else
9642     AC_MSG_RESULT([no])
9644 AC_SUBST(ENABLE_COINMP)
9645 AC_SUBST(SYSTEM_COINMP)
9646 AC_SUBST(COINMP_CFLAGS)
9647 AC_SUBST(COINMP_LIBS)
9649 ENABLE_LPSOLVE=
9650 AC_MSG_CHECKING([whether to build with lpsolve])
9651 if test "$enable_lpsolve" != "no"; then
9652     ENABLE_LPSOLVE=TRUE
9653     AC_MSG_RESULT([yes])
9654 else
9655     AC_MSG_RESULT([no])
9657 AC_SUBST(ENABLE_LPSOLVE)
9659 if test "$ENABLE_LPSOLVE" = TRUE; then
9660     AC_MSG_CHECKING([which lpsolve to use])
9661     if test "$with_system_lpsolve" = "yes"; then
9662         AC_MSG_RESULT([external])
9663         SYSTEM_LPSOLVE=TRUE
9664         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9665            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9666         save_LIBS=$LIBS
9667         # some systems need this. Like Ubuntu....
9668         AC_CHECK_LIB(m, floor)
9669         AC_CHECK_LIB(dl, dlopen)
9670         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9671             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9672         LIBS=$save_LIBS
9673     else
9674         AC_MSG_RESULT([internal])
9675         SYSTEM_LPSOLVE=
9676         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9677     fi
9679 AC_SUBST(SYSTEM_LPSOLVE)
9681 dnl ===================================================================
9682 dnl Checking for libexttextcat
9683 dnl ===================================================================
9684 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9685 if test "$with_system_libexttextcat" = "yes"; then
9686     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9688 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9690 dnl ===================================================================
9691 dnl Checking for libnumbertext
9692 dnl ===================================================================
9693 AC_MSG_CHECKING([whether to use libnumbertext])
9694 if test "$enable_libnumbertext" = "no"; then
9695     AC_MSG_RESULT([no])
9696     ENABLE_LIBNUMBERTEXT=
9697     SYSTEM_LIBNUMBERTEXT=
9698 else
9699     AC_MSG_RESULT([yes])
9700     ENABLE_LIBNUMBERTEXT=TRUE
9701     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
9702     if test "$with_system_libnumbertext" = "yes"; then
9703         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
9704         SYSTEM_LIBNUMBERTEXT=YES
9705     else
9706         SYSTEM_LIBNUMBERTEXT=
9707         AC_LANG_PUSH([C++])
9708         save_CPPFLAGS=$CPPFLAGS
9709         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
9710         AC_CHECK_HEADERS([codecvt regex])
9711         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
9712                 [ ENABLE_LIBNUMBERTEXT=''
9713                   LIBNUMBERTEXT_CFLAGS=''
9714                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
9715                                Enable libnumbertext fallback (missing number to number name conversion).])
9716                 ])
9717         CPPFLAGS=$save_CPPFLAGS
9718         AC_LANG_POP([C++])
9719     fi
9720     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
9721         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
9722     fi
9724 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
9725 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
9726 AC_SUBST(ENABLE_LIBNUMBERTEXT)
9727 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
9729 dnl ***************************************
9730 dnl testing libc version for Linux...
9731 dnl ***************************************
9732 if test "$_os" = "Linux"; then
9733     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9734     exec 6>/dev/null # no output
9735     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9736     exec 6>&1 # output on again
9737     if test "$HAVE_LIBC"; then
9738         AC_MSG_RESULT([yes])
9739     else
9740         AC_MSG_ERROR([no, upgrade libc])
9741     fi
9744 dnl =========================================
9745 dnl Check for uuidgen
9746 dnl =========================================
9747 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9748     # presence is already tested above in the WINDOWS_SDK_HOME check
9749     UUIDGEN=uuidgen.exe
9750     AC_SUBST(UUIDGEN)
9751 else
9752     AC_PATH_PROG([UUIDGEN], [uuidgen])
9753     if test -z "$UUIDGEN"; then
9754         AC_MSG_WARN([uuid is needed for building installation sets])
9755     fi
9758 dnl ***************************************
9759 dnl Checking for bison and flex
9760 dnl ***************************************
9761 AC_PATH_PROG(BISON, bison)
9762 if test -z "$BISON"; then
9763     AC_MSG_ERROR([no bison found in \$PATH, install it])
9764 else
9765     AC_MSG_CHECKING([the bison version])
9766     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9767     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9768     # Accept newer than 2.0
9769     if test "$_bison_longver" -lt 2000; then
9770         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9771     fi
9774 AC_PATH_PROG(FLEX, flex)
9775 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9776     FLEX=`cygpath -m $FLEX`
9778 if test -z "$FLEX"; then
9779     AC_MSG_ERROR([no flex found in \$PATH, install it])
9780 else
9781     AC_MSG_CHECKING([the flex version])
9782     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9783     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9784         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9785     fi
9787 AC_SUBST([FLEX])
9788 dnl ***************************************
9789 dnl Checking for patch
9790 dnl ***************************************
9791 AC_PATH_PROG(PATCH, patch)
9792 if test -z "$PATCH"; then
9793     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9796 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9797 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9798     if test -z "$with_gnu_patch"; then
9799         GNUPATCH=$PATCH
9800     else
9801         if test -x "$with_gnu_patch"; then
9802             GNUPATCH=$with_gnu_patch
9803         else
9804             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9805         fi
9806     fi
9808     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9809     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9810         AC_MSG_RESULT([yes])
9811     else
9812         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9813     fi
9814 else
9815     GNUPATCH=$PATCH
9818 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9819     GNUPATCH=`cygpath -m $GNUPATCH`
9822 dnl We also need to check for --with-gnu-cp
9824 if test -z "$with_gnu_cp"; then
9825     # check the place where the good stuff is hidden on Solaris...
9826     if test -x /usr/gnu/bin/cp; then
9827         GNUCP=/usr/gnu/bin/cp
9828     else
9829         AC_PATH_PROGS(GNUCP, gnucp cp)
9830     fi
9831     if test -z $GNUCP; then
9832         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9833     fi
9834 else
9835     if test -x "$with_gnu_cp"; then
9836         GNUCP=$with_gnu_cp
9837     else
9838         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9839     fi
9842 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9843     GNUCP=`cygpath -m $GNUCP`
9846 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9847 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9848     AC_MSG_RESULT([yes])
9849 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9850     AC_MSG_RESULT([yes])
9851 else
9852     case "$build_os" in
9853     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9854         x_GNUCP=[\#]
9855         GNUCP=''
9856         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9857         ;;
9858     *)
9859         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9860         ;;
9861     esac
9864 AC_SUBST(GNUPATCH)
9865 AC_SUBST(GNUCP)
9866 AC_SUBST(x_GNUCP)
9868 dnl ***************************************
9869 dnl testing assembler path
9870 dnl ***************************************
9871 ML_EXE=""
9872 if test "$_os" = "WINNT"; then
9873     if test "$BITNESS_OVERRIDE" = ""; then
9874         assembler=ml.exe
9875         assembler_bin=$CL_DIR
9876     else
9877         assembler=ml64.exe
9878         assembler_bin=$CL_DIR
9879     fi
9881     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9882     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9883         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9884         AC_MSG_RESULT([found])
9885         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9886     else
9887         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9888     fi
9890     PathFormat "$ASM_HOME"
9891     ASM_HOME="$formatted_path"
9892 else
9893     ASM_HOME=""
9896 AC_SUBST(ML_EXE)
9898 dnl ===================================================================
9899 dnl We need zip and unzip
9900 dnl ===================================================================
9901 AC_PATH_PROG(ZIP, zip)
9902 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9903 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9904     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],,)
9907 AC_PATH_PROG(UNZIP, unzip)
9908 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9910 dnl ===================================================================
9911 dnl Zip must be a specific type for different build types.
9912 dnl ===================================================================
9913 if test $build_os = cygwin; then
9914     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9915         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9916     fi
9919 dnl ===================================================================
9920 dnl We need touch with -h option support.
9921 dnl ===================================================================
9922 AC_PATH_PROG(TOUCH, touch)
9923 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
9924 touch warn
9925 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
9926     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],,)
9929 dnl ===================================================================
9930 dnl Check for system epoxy
9931 dnl ===================================================================
9932 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
9934 dnl ===================================================================
9935 dnl Set vcl option: coordinate device in double or sal_Int32
9936 dnl ===================================================================
9938 dnl disabled for now, we don't want subtle differences between OSs
9939 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
9940 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
9941 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
9942 dnl     AC_MSG_RESULT([double])
9943 dnl else
9944 dnl     AC_MSG_RESULT([sal_Int32])
9945 dnl fi
9947 dnl ===================================================================
9948 dnl Test which vclplugs have to be built.
9949 dnl ===================================================================
9950 R=""
9951 if test "$USING_X11" != TRUE; then
9952     enable_gtk=no
9953     enable_gtk3=no
9955 GTK3_CFLAGS=""
9956 GTK3_LIBS=""
9957 ENABLE_GTK3=""
9958 if test "x$enable_gtk3" = "xyes"; then
9959     if test "$with_system_cairo" = no; then
9960         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
9961     fi
9962     : ${with_system_cairo:=yes}
9963     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="")
9964     if test "x$ENABLE_GTK3" = "xTRUE"; then
9965         R="gtk3"
9966         dnl Avoid installed by unpackaged files for now.
9967         if test -z "$PKGFORMAT"; then
9968             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
9969         fi
9970     else
9971         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
9972     fi
9973     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9974     FilterLibs "${GTK3_LIBS}"
9975     GTK3_LIBS="${filteredlibs}"
9977     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
9978     if test "$with_system_epoxy" != "yes"; then
9979         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
9980         AC_CHECK_HEADER(EGL/eglplatform.h, [],
9981                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
9982     fi
9984 AC_SUBST(GTK3_LIBS)
9985 AC_SUBST(GTK3_CFLAGS)
9986 AC_SUBST(ENABLE_GTK3)
9988 ENABLE_GTK=""
9989 if test "x$enable_gtk" = "xyes"; then
9990     if test "$with_system_cairo" = no; then
9991         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
9992     fi
9993     : ${with_system_cairo:=yes}
9994     ENABLE_GTK="TRUE"
9995     AC_DEFINE(ENABLE_GTK)
9996     R="gtk $R"
9998 AC_SUBST(ENABLE_GTK)
10000 ENABLE_KDE4=""
10001 if test "x$enable_kde4" = "xyes"; then
10002     ENABLE_KDE4="TRUE"
10003     AC_DEFINE(ENABLE_KDE4)
10004     R="$R kde4"
10006 AC_SUBST(ENABLE_KDE4)
10008 ENABLE_QT5=""
10009 if test "x$enable_qt5" = "xyes"; then
10010     ENABLE_QT5="TRUE"
10011     AC_DEFINE(ENABLE_QT5)
10012     R="$R qt5"
10014 AC_SUBST(ENABLE_QT5)
10016 ENABLE_KDE5=""
10017 if test "x$enable_kde5" = "xyes"; then
10018     ENABLE_KDE5="TRUE"
10019     AC_DEFINE(ENABLE_KDE5)
10020     R="$R kde5"
10022 AC_SUBST(ENABLE_KDE5)
10024 ENABLE_GTK3_KDE5=""
10025 if test "x$enable_gtk3_kde5" = "xyes"; then
10026     ENABLE_GTK3_KDE5="TRUE"
10027     AC_DEFINE(ENABLE_GTK3_KDE5)
10028     R="$R gtk3_kde5"
10030 AC_SUBST(ENABLE_GTK3_KDE5)
10032 build_vcl_plugins="$R"
10033 if test -z "$build_vcl_plugins"; then
10034     build_vcl_plugins="none"
10036 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10038 dnl ===================================================================
10039 dnl check for dbus support
10040 dnl ===================================================================
10041 ENABLE_DBUS=""
10042 DBUS_CFLAGS=""
10043 DBUS_LIBS=""
10045 if test "$enable_dbus" = "no"; then
10046     test_dbus=no
10049 AC_MSG_CHECKING([whether to enable DBUS support])
10050 if test "$test_dbus" = "yes"; then
10051     ENABLE_DBUS="TRUE"
10052     AC_MSG_RESULT([yes])
10053     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
10054     AC_DEFINE(ENABLE_DBUS)
10055     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10056     FilterLibs "${DBUS_LIBS}"
10057     DBUS_LIBS="${filteredlibs}"
10058 else
10059     AC_MSG_RESULT([no])
10062 AC_SUBST(ENABLE_DBUS)
10063 AC_SUBST(DBUS_CFLAGS)
10064 AC_SUBST(DBUS_LIBS)
10066 AC_MSG_CHECKING([whether to enable Impress remote control])
10067 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10068     AC_MSG_RESULT([yes])
10069     ENABLE_SDREMOTE=TRUE
10070     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10072     # If not explicitly enabled or disabled, default
10073     if test -z "$enable_sdremote_bluetooth"; then
10074         case "$OS" in
10075         LINUX|MACOSX|WNT)
10076             # Default to yes for these
10077             enable_sdremote_bluetooth=yes
10078             ;;
10079         *)
10080             # otherwise no
10081             enable_sdremote_bluetooth=no
10082             ;;
10083         esac
10084     fi
10085     # $enable_sdremote_bluetooth is guaranteed non-empty now
10087     if test "$enable_sdremote_bluetooth" != "no"; then
10088         if test "$OS" = "LINUX"; then
10089             if test "$ENABLE_DBUS" = "TRUE"; then
10090                 AC_MSG_RESULT([yes])
10091                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10092                 dnl ===================================================================
10093                 dnl Check for system bluez
10094                 dnl ===================================================================
10095                 AC_MSG_CHECKING([which Bluetooth header to use])
10096                 if test "$with_system_bluez" = "yes"; then
10097                     AC_MSG_RESULT([external])
10098                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10099                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10100                     SYSTEM_BLUEZ=TRUE
10101                 else
10102                     AC_MSG_RESULT([internal])
10103                     SYSTEM_BLUEZ=
10104                 fi
10105             else
10106                 AC_MSG_RESULT([no, dbus disabled])
10107                 ENABLE_SDREMOTE_BLUETOOTH=
10108                 SYSTEM_BLUEZ=
10109             fi
10110         else
10111             AC_MSG_RESULT([yes])
10112             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10113             SYSTEM_BLUEZ=
10114         fi
10115     else
10116         AC_MSG_RESULT([no])
10117         ENABLE_SDREMOTE_BLUETOOTH=
10118         SYSTEM_BLUEZ=
10119     fi
10120 else
10121     ENABLE_SDREMOTE=
10122     SYSTEM_BLUEZ=
10123     AC_MSG_RESULT([no])
10125 AC_SUBST(ENABLE_SDREMOTE)
10126 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10127 AC_SUBST(SYSTEM_BLUEZ)
10129 dnl ===================================================================
10130 dnl Check whether the gtk 2.0 libraries are available.
10131 dnl ===================================================================
10133 GTK_CFLAGS=""
10134 GTK_LIBS=""
10135 if test  "$test_gtk" = "yes"; then
10137     if test "$ENABLE_GTK" = "TRUE"; then
10138         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]))
10139         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10140         FilterLibs "${GTK_LIBS}"
10141         GTK_LIBS="${filteredlibs}"
10142         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]))
10143         BUILD_TYPE="$BUILD_TYPE GTK"
10144         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10145         FilterLibs "${GTHREAD_LIBS}"
10146         GTHREAD_LIBS="${filteredlibs}"
10148         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10149         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10150                           [ENABLE_GTK_PRINT="TRUE"],
10151                           [ENABLE_GTK_PRINT=""])
10152         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10153         FilterLibs "${GTK_PRINT_LIBS}"
10154         GTK_PRINT_LIBS="${filteredlibs}"
10155     fi
10157     if test "$ENABLE_GTK" = "TRUE" || test "$ENABLE_GTK3" = "TRUE"; then
10158         AC_MSG_CHECKING([whether to enable GIO support])
10159         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10160             dnl Need at least 2.26 for the dbus support.
10161             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10162                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10163             if test "$ENABLE_GIO" = "TRUE"; then
10164                 AC_DEFINE(ENABLE_GIO)
10165                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10166                 FilterLibs "${GIO_LIBS}"
10167                 GIO_LIBS="${filteredlibs}"
10168             fi
10169         else
10170             AC_MSG_RESULT([no])
10171         fi
10172     fi
10174 AC_SUBST(ENABLE_GIO)
10175 AC_SUBST(GIO_CFLAGS)
10176 AC_SUBST(GIO_LIBS)
10177 AC_SUBST(GTK_CFLAGS)
10178 AC_SUBST(GTK_LIBS)
10179 AC_SUBST(GTHREAD_CFLAGS)
10180 AC_SUBST(GTHREAD_LIBS)
10181 AC_SUBST([ENABLE_GTK_PRINT])
10182 AC_SUBST([GTK_PRINT_CFLAGS])
10183 AC_SUBST([GTK_PRINT_LIBS])
10186 dnl ===================================================================
10188 SPLIT_APP_MODULES=""
10189 if test "$enable_split_app_modules" = "yes"; then
10190     SPLIT_APP_MODULES="TRUE"
10192 AC_SUBST(SPLIT_APP_MODULES)
10194 SPLIT_OPT_FEATURES=""
10195 if test "$enable_split_opt_features" = "yes"; then
10196     SPLIT_OPT_FEATURES="TRUE"
10198 AC_SUBST(SPLIT_OPT_FEATURES)
10200 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10201     if test "$enable_cairo_canvas" = yes; then
10202         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10203     fi
10204     enable_cairo_canvas=no
10205 elif test -z "$enable_cairo_canvas"; then
10206     enable_cairo_canvas=yes
10209 ENABLE_CAIRO_CANVAS=""
10210 if test "$enable_cairo_canvas" = "yes"; then
10211     test_cairo=yes
10212     ENABLE_CAIRO_CANVAS="TRUE"
10213     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10215 AC_SUBST(ENABLE_CAIRO_CANVAS)
10217 dnl ===================================================================
10218 dnl Check whether the GStreamer libraries are available.
10219 dnl It's possible to build avmedia with both GStreamer backends!
10220 dnl ===================================================================
10222 ENABLE_GSTREAMER_1_0=""
10224 if test "$build_gstreamer_1_0" = "yes"; then
10226     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10227     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10228         ENABLE_GSTREAMER_1_0="TRUE"
10229         AC_MSG_RESULT([yes])
10230         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10231         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10232         FilterLibs "${GSTREAMER_1_0_LIBS}"
10233         GSTREAMER_1_0_LIBS="${filteredlibs}"
10234     else
10235         AC_MSG_RESULT([no])
10236     fi
10238 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10239 AC_SUBST(GSTREAMER_1_0_LIBS)
10240 AC_SUBST(ENABLE_GSTREAMER_1_0)
10243 ENABLE_GSTREAMER_0_10=""
10244 if test "$build_gstreamer_0_10" = "yes"; then
10246     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10247     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10248         ENABLE_GSTREAMER_0_10="TRUE"
10249         AC_MSG_RESULT([yes])
10250         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10251             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10252         ])
10253         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10254         FilterLibs "${GSTREAMER_0_10_LIBS}"
10255         GSTREAMER_0_10_LIBS="${filteredlibs}"
10256     else
10257         AC_MSG_RESULT([no])
10258     fi
10261 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10262 AC_SUBST(GSTREAMER_0_10_LIBS)
10263 AC_SUBST(ENABLE_GSTREAMER_0_10)
10265 dnl ===================================================================
10266 dnl Check whether to build the VLC avmedia backend
10267 dnl ===================================================================
10269 ENABLE_VLC=""
10271 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10272 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10273     ENABLE_VLC="TRUE"
10274     AC_MSG_RESULT([yes])
10275 else
10276     AC_MSG_RESULT([no])
10278 AC_SUBST(ENABLE_VLC)
10280 ENABLE_OPENGL_TRANSITIONS=
10281 ENABLE_OPENGL_CANVAS=
10282 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10283    : # disable
10284 elif test "$_os" = "Darwin"; then
10285     # We use frameworks on Mac OS X, no need for detail checks
10286     ENABLE_OPENGL_TRANSITIONS=TRUE
10287     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10288     ENABLE_OPENGL_CANVAS=TRUE
10289 elif test $_os = WINNT; then
10290     ENABLE_OPENGL_TRANSITIONS=TRUE
10291     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10292     ENABLE_OPENGL_CANVAS=TRUE
10293 else
10294     if test "$USING_X11" = TRUE; then
10295         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10296         ENABLE_OPENGL_TRANSITIONS=TRUE
10297         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10298         ENABLE_OPENGL_CANVAS=TRUE
10299     fi
10302 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10303 AC_SUBST(ENABLE_OPENGL_CANVAS)
10305 dnl =================================================
10306 dnl Check whether to build with OpenCL support.
10307 dnl =================================================
10309 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10310     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10311     # platform (optional at run-time, used through clew).
10312     BUILD_TYPE="$BUILD_TYPE OPENCL"
10313     AC_DEFINE(HAVE_FEATURE_OPENCL)
10316 dnl =================================================
10317 dnl Check whether to build with dconf support.
10318 dnl =================================================
10320 if test "$enable_dconf" != no; then
10321     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10322         if test "$enable_dconf" = yes; then
10323             AC_MSG_ERROR([dconf not found])
10324         else
10325             enable_dconf=no
10326         fi])
10328 AC_MSG_CHECKING([whether to enable dconf])
10329 if test "$enable_dconf" = no; then
10330     DCONF_CFLAGS=
10331     DCONF_LIBS=
10332     ENABLE_DCONF=
10333     AC_MSG_RESULT([no])
10334 else
10335     ENABLE_DCONF=TRUE
10336     AC_DEFINE(ENABLE_DCONF)
10337     AC_MSG_RESULT([yes])
10339 AC_SUBST([DCONF_CFLAGS])
10340 AC_SUBST([DCONF_LIBS])
10341 AC_SUBST([ENABLE_DCONF])
10343 # pdf import?
10344 AC_MSG_CHECKING([whether to build the PDF import feature])
10345 ENABLE_PDFIMPORT=
10346 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10347     AC_MSG_RESULT([yes])
10348     ENABLE_PDFIMPORT=TRUE
10349     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10351     dnl ===================================================================
10352     dnl Check for system poppler
10353     dnl ===================================================================
10354     AC_MSG_CHECKING([which PDF import backend to use])
10355     if test "$with_system_poppler" = "yes"; then
10356         AC_MSG_RESULT([external])
10357         SYSTEM_POPPLER=TRUE
10358         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10359         AC_LANG_PUSH([C++])
10360         save_CXXFLAGS=$CXXFLAGS
10361         save_CPPFLAGS=$CPPFLAGS
10362         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10363         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10364         AC_CHECK_HEADER([cpp/poppler-version.h],
10365             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10366             [])
10367         CXXFLAGS=$save_CXXFLAGS
10368         CPPFLAGS=$save_CPPFLAGS
10369         AC_LANG_POP([C++])
10370         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10372         FilterLibs "${POPPLER_LIBS}"
10373         POPPLER_LIBS="${filteredlibs}"
10374     else
10375         AC_MSG_RESULT([internal])
10376         SYSTEM_POPPLER=
10377         BUILD_TYPE="$BUILD_TYPE POPPLER"
10378         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10379     fi
10380     AC_DEFINE([ENABLE_PDFIMPORT],1)
10381 else
10382     AC_MSG_RESULT([no])
10384 AC_SUBST(ENABLE_PDFIMPORT)
10385 AC_SUBST(SYSTEM_POPPLER)
10386 AC_SUBST(POPPLER_CFLAGS)
10387 AC_SUBST(POPPLER_LIBS)
10389 # pdf import?
10390 AC_MSG_CHECKING([whether to build PDFium])
10391 ENABLE_PDFIUM=
10392 if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then
10393     AC_MSG_RESULT([yes])
10394     ENABLE_PDFIUM=TRUE
10395     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10396     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10397 else
10398     AC_MSG_RESULT([no])
10400 AC_SUBST(ENABLE_PDFIUM)
10402 SYSTEM_GPGMEPP=
10404 if test "$build_for_ios" = "YES"; then
10405     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10406     AC_MSG_RESULT([yes])
10407 elif test "$enable_mpl_subset" = "yes"; then
10408     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10409     AC_MSG_RESULT([yes])
10410 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10411     dnl ===================================================================
10412     dnl Check for system gpgme
10413     dnl ===================================================================
10414     AC_MSG_CHECKING([which gpgmepp to use])
10415     if test "$with_system_gpgmepp" = "yes"; then
10416         AC_MSG_RESULT([external])
10417         SYSTEM_GPGMEPP=TRUE
10419         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10420         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10421             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10422         # progress_callback is the only func with plain C linkage
10423         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10424         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10425             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10426         AC_CHECK_HEADER(gpgme.h, [],
10427             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10428     else
10429         AC_MSG_RESULT([internal])
10430         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10431         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10433         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10434         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10435         if test "$_os" != "WINNT"; then
10436             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10437             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10438         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10439             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10440         fi
10441     fi
10442     ENABLE_GPGMEPP=TRUE
10443     AC_DEFINE([HAVE_FEATURE_GPGME])
10444     AC_PATH_PROG(GPG, gpg)
10445     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10446     # so let's exclude that manually for the moment
10447     if test -n "$GPG" -a "$_os" != "WINNT"; then
10448         # make sure we not only have a working gpgme, but a full working
10449         # gpg installation to run OpenPGP signature verification
10450         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10451     fi
10452     if test "$_os" = "Linux"; then
10453       uid=`id -u`
10454       AC_MSG_CHECKING([for /run/user/$uid])
10455       if test -d /run/user/$uid; then
10456         AC_MSG_RESULT([yes])
10457         AC_PATH_PROG(GPGCONF, gpgconf)
10458         AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10459         if $GPGCONF --dump-options > /dev/null ; then
10460           if $GPGCONF --dump-options | grep -q create-socketdir ; then
10461             AC_MSG_RESULT([yes])
10462             AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10463           else
10464             AC_MSG_RESULT([no])
10465           fi
10466         else
10467           AC_MSG_RESULT([no. missing or broken gpgconf?])
10468         fi
10469       else
10470         AC_MSG_RESULT([no])
10471      fi
10472    fi
10474 AC_SUBST(ENABLE_GPGMEPP)
10475 AC_SUBST(SYSTEM_GPGMEPP)
10476 AC_SUBST(GPG_ERROR_CFLAGS)
10477 AC_SUBST(GPG_ERROR_LIBS)
10478 AC_SUBST(LIBASSUAN_CFLAGS)
10479 AC_SUBST(LIBASSUAN_LIBS)
10480 AC_SUBST(GPGMEPP_CFLAGS)
10481 AC_SUBST(GPGMEPP_LIBS)
10482 AC_SUBST(GPGCONF)
10483 AC_SUBST(HAVE_GPGCONF_SOCKETDIR)
10485 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10486 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10487     AC_MSG_RESULT([yes])
10488     ENABLE_MEDIAWIKI=TRUE
10489     BUILD_TYPE="$BUILD_TYPE XSLTML"
10490     if test  "x$with_java" = "xno"; then
10491         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10492     fi
10493 else
10494     AC_MSG_RESULT([no])
10495     ENABLE_MEDIAWIKI=
10496     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10498 AC_SUBST(ENABLE_MEDIAWIKI)
10500 AC_MSG_CHECKING([whether to build the Report Builder])
10501 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10502     AC_MSG_RESULT([yes])
10503     ENABLE_REPORTBUILDER=TRUE
10504     AC_MSG_CHECKING([which jfreereport libs to use])
10505     if test "$with_system_jfreereport" = "yes"; then
10506         SYSTEM_JFREEREPORT=TRUE
10507         AC_MSG_RESULT([external])
10508         if test -z $SAC_JAR; then
10509             SAC_JAR=/usr/share/java/sac.jar
10510         fi
10511         if ! test -f $SAC_JAR; then
10512              AC_MSG_ERROR(sac.jar not found.)
10513         fi
10515         if test -z $LIBXML_JAR; then
10516             if test -f /usr/share/java/libxml-1.0.0.jar; then
10517                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10518             elif test -f /usr/share/java/libxml.jar; then
10519                 LIBXML_JAR=/usr/share/java/libxml.jar
10520             else
10521                 AC_MSG_ERROR(libxml.jar replacement not found.)
10522             fi
10523         elif ! test -f $LIBXML_JAR; then
10524             AC_MSG_ERROR(libxml.jar not found.)
10525         fi
10527         if test -z $FLUTE_JAR; then
10528             if test -f/usr/share/java/flute-1.3.0.jar; then
10529                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10530             elif test -f /usr/share/java/flute.jar; then
10531                 FLUTE_JAR=/usr/share/java/flute.jar
10532             else
10533                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10534             fi
10535         elif ! test -f $FLUTE_JAR; then
10536             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10537         fi
10539         if test -z $JFREEREPORT_JAR; then
10540             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10541                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10542             elif test -f /usr/share/java/flow-engine.jar; then
10543                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10544             else
10545                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10546             fi
10547         elif ! test -f  $JFREEREPORT_JAR; then
10548                 AC_MSG_ERROR(jfreereport.jar not found.)
10549         fi
10551         if test -z $LIBLAYOUT_JAR; then
10552             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10553                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10554             elif test -f /usr/share/java/liblayout.jar; then
10555                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10556             else
10557                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10558             fi
10559         elif ! test -f $LIBLAYOUT_JAR; then
10560                 AC_MSG_ERROR(liblayout.jar not found.)
10561         fi
10563         if test -z $LIBLOADER_JAR; then
10564             if test -f /usr/share/java/libloader-1.0.0.jar; then
10565                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10566             elif test -f /usr/share/java/libloader.jar; then
10567                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10568             else
10569                 AC_MSG_ERROR(libloader.jar replacement not found.)
10570             fi
10571         elif ! test -f  $LIBLOADER_JAR; then
10572             AC_MSG_ERROR(libloader.jar not found.)
10573         fi
10575         if test -z $LIBFORMULA_JAR; then
10576             if test -f /usr/share/java/libformula-0.2.0.jar; then
10577                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10578             elif test -f /usr/share/java/libformula.jar; then
10579                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10580             else
10581                 AC_MSG_ERROR(libformula.jar replacement not found.)
10582             fi
10583         elif ! test -f $LIBFORMULA_JAR; then
10584                 AC_MSG_ERROR(libformula.jar not found.)
10585         fi
10587         if test -z $LIBREPOSITORY_JAR; then
10588             if test -f /usr/share/java/librepository-1.0.0.jar; then
10589                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10590             elif test -f /usr/share/java/librepository.jar; then
10591                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10592             else
10593                 AC_MSG_ERROR(librepository.jar replacement not found.)
10594             fi
10595         elif ! test -f $LIBREPOSITORY_JAR; then
10596             AC_MSG_ERROR(librepository.jar not found.)
10597         fi
10599         if test -z $LIBFONTS_JAR; then
10600             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10601                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10602             elif test -f /usr/share/java/libfonts.jar; then
10603                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10604             else
10605                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10606             fi
10607         elif ! test -f $LIBFONTS_JAR; then
10608                 AC_MSG_ERROR(libfonts.jar not found.)
10609         fi
10611         if test -z $LIBSERIALIZER_JAR; then
10612             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10613                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10614             elif test -f /usr/share/java/libserializer.jar; then
10615                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10616             else
10617                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10618             fi
10619         elif ! test -f $LIBSERIALIZER_JAR; then
10620                 AC_MSG_ERROR(libserializer.jar not found.)
10621         fi
10623         if test -z $LIBBASE_JAR; then
10624             if test -f /usr/share/java/libbase-1.0.0.jar; then
10625                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10626             elif test -f /usr/share/java/libbase.jar; then
10627                 LIBBASE_JAR=/usr/share/java/libbase.jar
10628             else
10629                 AC_MSG_ERROR(libbase.jar replacement not found.)
10630             fi
10631         elif ! test -f $LIBBASE_JAR; then
10632             AC_MSG_ERROR(libbase.jar not found.)
10633         fi
10635     else
10636         AC_MSG_RESULT([internal])
10637         SYSTEM_JFREEREPORT=
10638         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10639         NEED_ANT=TRUE
10640     fi
10641 else
10642     AC_MSG_RESULT([no])
10643     ENABLE_REPORTBUILDER=
10644     SYSTEM_JFREEREPORT=
10646 AC_SUBST(ENABLE_REPORTBUILDER)
10647 AC_SUBST(SYSTEM_JFREEREPORT)
10648 AC_SUBST(SAC_JAR)
10649 AC_SUBST(LIBXML_JAR)
10650 AC_SUBST(FLUTE_JAR)
10651 AC_SUBST(JFREEREPORT_JAR)
10652 AC_SUBST(LIBBASE_JAR)
10653 AC_SUBST(LIBLAYOUT_JAR)
10654 AC_SUBST(LIBLOADER_JAR)
10655 AC_SUBST(LIBFORMULA_JAR)
10656 AC_SUBST(LIBREPOSITORY_JAR)
10657 AC_SUBST(LIBFONTS_JAR)
10658 AC_SUBST(LIBSERIALIZER_JAR)
10660 # this has to be here because both the Wiki Publisher and the SRB use
10661 # commons-logging
10662 COMMONS_LOGGING_VERSION=1.2
10663 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10664     AC_MSG_CHECKING([which Apache commons-* libs to use])
10665     if test "$with_system_apache_commons" = "yes"; then
10666         SYSTEM_APACHE_COMMONS=TRUE
10667         AC_MSG_RESULT([external])
10668         if test -z $COMMONS_LOGGING_JAR; then
10669             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10670                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10671            elif test -f /usr/share/java/commons-logging.jar; then
10672                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
10673             else
10674                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
10675             fi
10676         elif ! test -f $COMMONS_LOGGING_JAR; then
10677             AC_MSG_ERROR(commons-logging.jar not found.)
10678         fi
10679     else
10680         AC_MSG_RESULT([internal])
10681         SYSTEM_APACHE_COMMONS=
10682         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
10683         NEED_ANT=TRUE
10684     fi
10686 AC_SUBST(SYSTEM_APACHE_COMMONS)
10687 AC_SUBST(COMMONS_LOGGING_JAR)
10688 AC_SUBST(COMMONS_LOGGING_VERSION)
10690 # scripting provider for BeanShell?
10691 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10692 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10693     AC_MSG_RESULT([yes])
10694     ENABLE_SCRIPTING_BEANSHELL=TRUE
10696     dnl ===================================================================
10697     dnl Check for system beanshell
10698     dnl ===================================================================
10699     AC_MSG_CHECKING([which beanshell to use])
10700     if test "$with_system_beanshell" = "yes"; then
10701         AC_MSG_RESULT([external])
10702         SYSTEM_BSH=TRUE
10703         if test -z $BSH_JAR; then
10704             BSH_JAR=/usr/share/java/bsh.jar
10705         fi
10706         if ! test -f $BSH_JAR; then
10707             AC_MSG_ERROR(bsh.jar not found.)
10708         fi
10709     else
10710         AC_MSG_RESULT([internal])
10711         SYSTEM_BSH=
10712         BUILD_TYPE="$BUILD_TYPE BSH"
10713     fi
10714 else
10715     AC_MSG_RESULT([no])
10716     ENABLE_SCRIPTING_BEANSHELL=
10717     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10719 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10720 AC_SUBST(SYSTEM_BSH)
10721 AC_SUBST(BSH_JAR)
10723 # scripting provider for JavaScript?
10724 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10725 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10726     AC_MSG_RESULT([yes])
10727     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10729     dnl ===================================================================
10730     dnl Check for system rhino
10731     dnl ===================================================================
10732     AC_MSG_CHECKING([which rhino to use])
10733     if test "$with_system_rhino" = "yes"; then
10734         AC_MSG_RESULT([external])
10735         SYSTEM_RHINO=TRUE
10736         if test -z $RHINO_JAR; then
10737             RHINO_JAR=/usr/share/java/js.jar
10738         fi
10739         if ! test -f $RHINO_JAR; then
10740             AC_MSG_ERROR(js.jar not found.)
10741         fi
10742     else
10743         AC_MSG_RESULT([internal])
10744         SYSTEM_RHINO=
10745         BUILD_TYPE="$BUILD_TYPE RHINO"
10746         NEED_ANT=TRUE
10747     fi
10748 else
10749     AC_MSG_RESULT([no])
10750     ENABLE_SCRIPTING_JAVASCRIPT=
10751     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10753 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10754 AC_SUBST(SYSTEM_RHINO)
10755 AC_SUBST(RHINO_JAR)
10757 # This is only used in KDE3/KDE4 checks to determine if /usr/lib64
10758 # paths should be added to library search path. So lets put all 64-bit
10759 # platforms there.
10760 supports_multilib=
10761 case "$host_cpu" in
10762 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
10763     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10764         supports_multilib="yes"
10765     fi
10766     ;;
10768     ;;
10769 esac
10771 dnl ===================================================================
10772 dnl KDE4 Integration
10773 dnl ===================================================================
10775 KDE4_CFLAGS=""
10776 KDE4_LIBS=""
10777 QMAKE4="qmake"
10778 MOC4="moc"
10779 KDE4_GLIB_CFLAGS=""
10780 KDE4_GLIB_LIBS=""
10781 KDE4_HAVE_GLIB=""
10782 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
10783     qt4_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
10784     qt4_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
10786     kde4_incdirs="/usr/include /usr/include/kde4 $x_includes"
10787     kde4_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
10789     if test -n "$supports_multilib"; then
10790         qt4_libdirs="$qt4_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
10791         kde4_libdirs="$kde4_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
10792     fi
10794     if test -n "$QTDIR"; then
10795         qt4_incdirs="$QTDIR/include $qt4_incdirs"
10796         if test -z "$supports_multilib"; then
10797             qt4_libdirs="$QTDIR/lib $qt4_libdirs"
10798         else
10799             qt4_libdirs="$QTDIR/lib64 $QTDIR/lib $qt4_libdirs"
10800         fi
10801     fi
10802     if test -n "$QT4DIR"; then
10803         qt4_incdirs="$QT4DIR/include $qt4_incdirs"
10804         if test -z "$supports_multilib"; then
10805             qt4_libdirs="$QT4DIR/lib $qt4_libdirs"
10806         else
10807             qt4_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt4_libdirs"
10808         fi
10809     fi
10811     if test -n "$KDEDIR"; then
10812         kde4_incdirs="$KDEDIR/include $kde4_incdirs"
10813         if test -z "$supports_multilib"; then
10814             kde4_libdirs="$KDEDIR/lib $kde4_libdirs"
10815         else
10816             kde4_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde4_libdirs"
10817         fi
10818     fi
10819     if test -n "$KDE4DIR"; then
10820         kde4_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde4_incdirs"
10821         if test -z "$supports_multilib"; then
10822             kde4_libdirs="$KDE4DIR/lib $kde4_libdirs"
10823         else
10824             kde4_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde4_libdirs"
10825         fi
10826     fi
10828     qt4_test_include="Qt/qobject.h"
10829     qt4_test_library="libQtNetwork.so"
10830     kde4_test_include="kwindowsystem.h"
10831     kde4_test_library="libsolid.so"
10833     AC_MSG_CHECKING([for Qt4 headers])
10834     qt4_header_dir="no"
10835     for inc_dir in $qt4_incdirs; do
10836         if test -r "$inc_dir/$qt4_test_include"; then
10837             qt4_header_dir="$inc_dir"
10838             break
10839         fi
10840     done
10842     AC_MSG_RESULT([$qt4_header_dir])
10843     if test "x$qt4_header_dir" = "xno"; then
10844         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10845     fi
10847     dnl Check for qmake
10848     AC_PATH_PROGS( QMAKE4, [qmake-qt4 qmake], no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
10849     if test "$QMAKE4" = "no"; then
10850         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10851     else
10852         qmake4_test_ver="`$QMAKE4 -v 2>&1 | sed -n -e '/^Using Qt version 4\./p'`"
10853         if test -z "$qmake4_test_ver"; then
10854             AC_MSG_ERROR([Wrong qmake for Qt4 found. Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
10855         fi
10856     fi
10858     qt4_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt4_libdirs"
10859     AC_MSG_CHECKING([for Qt4 libraries])
10860     qt4_lib_dir="no"
10861     for lib_dir in $qt4_libdirs; do
10862         if test -r "$lib_dir/$qt4_test_library"; then
10863             qt4_lib_dir="$lib_dir"
10864             PKG_CONFIG_PATH="$qt4_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
10865             break
10866         fi
10867     done
10869     AC_MSG_RESULT([$qt4_lib_dir])
10871     if test "x$qt4_lib_dir" = "xno"; then
10872         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10873     fi
10875     dnl Check for Meta Object Compiler
10877     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10878     MOC4="$MOCQT4"
10879     if test "$MOC4" = "no"; then
10880         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10881         if test "$MOC4" = "no"; then
10882             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10883 the root of your Qt installation by exporting QT4DIR before running "configure".])
10884         fi
10885     fi
10887     dnl Check for KDE4 headers
10888     AC_MSG_CHECKING([for KDE4 headers])
10889     kde4_incdir="no"
10890     for kde4_check in $kde4_incdirs; do
10891         if test -r "$kde4_check/$kde4_test_include"; then
10892             kde4_incdir="$kde4_check"
10893             break
10894         fi
10895     done
10896     AC_MSG_RESULT([$kde4_incdir])
10897     if test "x$kde4_incdir" = "xno"; then
10898         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10899     fi
10900     if test "$kde4_incdir" = "/usr/include"; then kde4_incdir=; fi
10902     dnl Check for KDE4 libraries
10903     AC_MSG_CHECKING([for KDE4 libraries])
10904     kde4_libdir="no"
10905     for kde4_check in $kde4_libdirs; do
10906         if test -r "$kde4_check/$kde4_test_library"; then
10907             kde4_libdir="$kde4_check"
10908             break
10909         fi
10910     done
10912     AC_MSG_RESULT([$kde4_libdir])
10913     if test "x$kde4_libdir" = "xno"; then
10914         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10915     fi
10917     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
10918     if ! test -z "$kde4_incdir"; then
10919         KDE4_CFLAGS="-I$kde4_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10920     else
10921         KDE4_CFLAGS="$QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10922     fi
10924     KDE4_LIBS="-L$kde4_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt4_lib_dir $QT4_LIBS"
10925     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10926     FilterLibs "$KDE4_LIBS"
10927     KDE4_LIBS="$filteredlibs"
10929     AC_LANG_PUSH([C++])
10930     save_CXXFLAGS=$CXXFLAGS
10931     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10932     AC_MSG_CHECKING([whether KDE is >= 4.2])
10933        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10934 #include <kdeversion.h>
10936 int main(int argc, char **argv) {
10937        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
10938        else return 1;
10940 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[AC_MSG_ERROR([KDE support not tested with cross-compilation])])
10941     CXXFLAGS=$save_CXXFLAGS
10942     AC_LANG_POP([C++])
10944     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
10945     # Sets also KDE4_GLIB_CFLAGS/KDE4_GLIB_LIBS if successful.
10946     PKG_CHECK_MODULES(KDE4_GLIB,[glib-2.0 >= 2.4],
10947         [
10948             KDE4_HAVE_GLIB=TRUE
10949             AC_DEFINE(KDE4_HAVE_GLIB,1)
10950             KDE4_GLIB_CFLAGS=$(printf '%s' "$KDE4_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10951             FilterLibs "${KDE4_GLIB_LIBS}"
10952             KDE4_GLIB_LIBS="${filteredlibs}"
10954             qt4_fix_warning=
10956             AC_LANG_PUSH([C++])
10957             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
10958             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
10959             #  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
10960             #               ^~~~~~~~~~~~~~~~~~~~~~~
10961             #               vptr for 'QObjectPrivate'
10962             # so temporarily ignore here whichever way would be used to make such errors fatal
10963             # (-fno-sanitize-recover=... or UBSAN_OPTIONS halt_on_error=1):
10964             save_CXX=$CXX
10965             CXX=$(printf %s "$CXX" \
10966                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
10967             save_UBSAN_OPTIONS=$UBSAN_OPTIONS
10968             UBSAN_OPTIONS=$UBSAN_OPTIONS:halt_on_error=0
10969             save_CXXFLAGS=$CXXFLAGS
10970             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10971             save_LIBS=$LIBS
10972             LIBS="$LIBS $KDE4_LIBS"
10973             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
10975             # Prepare meta object data
10976             TSTBASE="tst_exclude_socket_notifiers"
10977             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
10978             ln -fs "${TSTMOC}.hxx"
10979             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10981             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10982 #include <cstdlib>
10983 #include "tst_exclude_socket_notifiers.moc"
10985 int main(int argc, char *argv[])
10987     QCoreApplication app(argc, argv);
10988     exit(tst_processEventsExcludeSocket());
10989     return 0;
10991             ]])],[
10992                 AC_MSG_RESULT([yes])
10993             ],[
10994                 AC_MSG_RESULT([no])
10995                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
10996                 if test -z "$qt4_fix_warning"; then
10997                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
10998                 fi
10999                 qt4_fix_warning=1
11000                 add_warning "  https://bugreports.qt.io/browse/QTBUG-37380 (needed)"
11001                 ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11003             # Remove meta object data
11004             rm -f "${TSTBASE}."*
11006             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
11008             # Prepare meta object data
11009             TSTBASE="tst_exclude_posted_events"
11010             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11011             ln -fs "${TSTMOC}.hxx"
11012             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11014             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11015 #include <cstdlib>
11016 #include "tst_exclude_posted_events.moc"
11018 int main(int argc, char *argv[])
11020     QCoreApplication app(argc, argv);
11021     exit(tst_excludePostedEvents());
11022     return 0;
11024             ]])],[
11025                 AC_MSG_RESULT([yes])
11026             ],[
11027                 AC_MSG_RESULT([no])
11028                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11029                 if test -z "$qt4_fix_warning"; then
11030                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11031                 fi
11032                 qt4_fix_warning=1
11033                 add_warning "  https://bugreports.qt.io/browse/QTBUG-34614 (needed)"
11034             ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11036             # Remove meta object data
11037             rm -f "${TSTBASE}."*
11039             if test -n "$qt4_fix_warning"; then
11040                 add_warning "  https://bugreports.qt.io/browse/QTBUG-38585 (recommended)"
11041             fi
11043             LIBS=$save_LIBS
11044             CXXFLAGS=$save_CXXFLAGS
11045             UBSAN_OPTIONS=$save_UBSAN_OPTIONS
11046             CXX=$save_CXX
11047             AC_LANG_POP([C++])
11048         ],
11049         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11051 AC_SUBST(KDE4_CFLAGS)
11052 AC_SUBST(KDE4_LIBS)
11053 AC_SUBST(MOC4)
11054 AC_SUBST(KDE4_GLIB_CFLAGS)
11055 AC_SUBST(KDE4_GLIB_LIBS)
11056 AC_SUBST(KDE4_HAVE_GLIB)
11058 dnl ===================================================================
11059 dnl QT5 Integration
11060 dnl ===================================================================
11062 QT5_CFLAGS=""
11063 QT5_LIBS=""
11064 QMAKE5="qmake"
11065 MOC5="moc"
11066 QT5_GLIB_CFLAGS=""
11067 QT5_GLIB_LIBS=""
11068 QT5_HAVE_GLIB=""
11069 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11070         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11071         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11072 then
11073     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11074     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11076     if test -n "$supports_multilib"; then
11077         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11078     fi
11080     qt5_test_include="QtWidgets/qapplication.h"
11081     qt5_test_library="libQt5Widgets.so"
11083     dnl Check for qmake5
11084     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
11085     if test "$QMAKE5" = "no"; then
11086         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11087     else
11088         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11089         if test -z "$qmake5_test_ver"; then
11090             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11091         fi
11092         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11093         qt5_minimal_minor="6"
11094         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11095             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11096         else
11097             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11098         fi
11099     fi
11101     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11102     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11104     AC_MSG_CHECKING([for Qt5 headers])
11105     qt5_incdir="no"
11106     for inc_dir in $qt5_incdirs; do
11107         if test -r "$inc_dir/$qt5_test_include"; then
11108             qt5_incdir="$inc_dir"
11109             break
11110         fi
11111     done
11112     AC_MSG_RESULT([$qt5_incdir])
11113     if test "x$qt5_incdir" = "xno"; then
11114         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11115     fi
11117     AC_MSG_CHECKING([for Qt5 libraries])
11118     qt5_libdir="no"
11119     for lib_dir in $qt5_libdirs; do
11120         if test -r "$lib_dir/$qt5_test_library"; then
11121             qt5_libdir="$lib_dir"
11122             break
11123         fi
11124     done
11125     AC_MSG_RESULT([$qt5_libdir])
11126     if test "x$qt5_libdir" = "xno"; then
11127         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11128     fi
11130     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11131     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11132     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11134     dnl Check for Meta Object Compiler
11136     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
11137     if test "$MOC5" = "no"; then
11138         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11139 the root of your Qt installation by exporting QT5DIR before running "configure".])
11140     fi
11142     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11143     # Sets also QT5_GLIB_CFLAGS/QT5_GLIB_LIBS if successful.
11144     PKG_CHECK_MODULES(QT5_GLIB,[glib-2.0 >= 2.4],
11145         [
11146             QT5_HAVE_GLIB=1
11147             AC_DEFINE(QT5_HAVE_GLIB,1)
11148         ],
11149         AC_MSG_WARN([[No Glib found, Qt5 support will not use native file pickers!]])
11150     )
11152 AC_SUBST(QT5_CFLAGS)
11153 AC_SUBST(QT5_LIBS)
11154 AC_SUBST(MOC5)
11155 AC_SUBST(QT5_GLIB_CFLAGS)
11156 AC_SUBST(QT5_GLIB_LIBS)
11157 AC_SUBST(QT5_HAVE_GLIB)
11159 dnl ===================================================================
11160 dnl KDE5 Integration
11161 dnl ===================================================================
11163 KF5_CFLAGS=""
11164 KF5_LIBS=""
11165 KF5_CONFIG="kf5-config"
11166 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11167         \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11168         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11169 then
11170     if test "$OS" = "HAIKU"; then
11171         haiku_arch="`echo $RTL_ARCH | tr X x`"
11172         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11173         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11174     fi
11176     kf5_incdirs="$KF5INC /usr/include/ $kf5_haiku_incdirs $x_includes"
11177     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11178     if test -n "$supports_multilib"; then
11179         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11180     fi
11182     kf5_test_include="KF5/kcoreaddons_version.h"
11183     kf5_test_library="libKF5CoreAddons.so"
11184     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11186     dnl kf5 KDE4 support compatibility installed
11187     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11188     if test "$KF5_CONFIG" != "no"; then
11189         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11190         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11191     fi
11193     dnl Check for KF5 headers
11194     AC_MSG_CHECKING([for KF5 headers])
11195     kf5_incdir="no"
11196     for kf5_check in $kf5_incdirs; do
11197         if test -r "$kf5_check/$kf5_test_include"; then
11198             kf5_incdir="$kf5_check/KF5"
11199             break
11200         fi
11201     done
11202     AC_MSG_RESULT([$kf5_incdir])
11203     if test "x$kf5_incdir" = "xno"; then
11204         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11205     fi
11207     dnl Check for KF5 libraries
11208     AC_MSG_CHECKING([for KF5 libraries])
11209     kf5_libdir="no"
11210     for kf5_check in $kf5_libdirs; do
11211         if test -r "$kf5_check/$kf5_test_library"; then
11212             kf5_libdir="$kf5_check"
11213             break
11214         fi
11215     done
11217     AC_MSG_RESULT([$kf5_libdir])
11218     if test "x$kf5_libdir" = "xno"; then
11219         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11220     fi
11222     PKG_CHECK_MODULES(KF5_XCB,[xcb],,[AC_MSG_ERROR([XCB not installed])])
11224     KF5_CFLAGS="-I$kf5_incdir -I$kf5_incdir/KCoreAddons -I$kf5_incdir/KI18n -I$kf5_incdir/KConfigCore -I$kf5_incdir/KWindowSystem -I$kf5_incdir/KIOCore -I$kf5_incdir/KIOWidgets -I$kf5_incdir/KIOFileWidgets -I$qt5_incdir -I$qt5_incdir/QtCore -I$qt5_incdir/QtGui -I$qt5_incdir/QtWidgets -I$qt5_incdir/QtNetwork -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT $KF5_XCB_CFLAGS"
11225     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network $KF5_XCB_LIBS"
11226     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11228     AC_LANG_PUSH([C++])
11229     save_CXXFLAGS=$CXXFLAGS
11230     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11231     AC_MSG_CHECKING([whether KDE is >= 5.0])
11232        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11233 #include <kcoreaddons_version.h>
11235 int main(int argc, char **argv) {
11236        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11237        else return 1;
11239        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11240     CXXFLAGS=$save_CXXFLAGS
11241     AC_LANG_POP([C++])
11243 AC_SUBST(KF5_CFLAGS)
11244 AC_SUBST(KF5_LIBS)
11246 dnl ===================================================================
11247 dnl Test whether to include Evolution 2 support
11248 dnl ===================================================================
11249 AC_MSG_CHECKING([whether to enable evolution 2 support])
11250 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11251     AC_MSG_RESULT([yes])
11252     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11253     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11254     FilterLibs "${GOBJECT_LIBS}"
11255     GOBJECT_LIBS="${filteredlibs}"
11256     ENABLE_EVOAB2="TRUE"
11257 else
11258     ENABLE_EVOAB2=""
11259     AC_MSG_RESULT([no])
11261 AC_SUBST(ENABLE_EVOAB2)
11262 AC_SUBST(GOBJECT_CFLAGS)
11263 AC_SUBST(GOBJECT_LIBS)
11265 dnl ===================================================================
11266 dnl Test which themes to include
11267 dnl ===================================================================
11268 AC_MSG_CHECKING([which themes to include])
11269 # if none given use default subset of available themes
11270 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11271     with_theme="breeze breeze_dark colibre elementary karasa_jaga sifr sifr_dark tango"
11274 WITH_THEMES=""
11275 if test "x$with_theme" != "xno"; then
11276     for theme in $with_theme; do
11277         case $theme in
11278         breeze|breeze_dark|colibre|elementary|karasa_jaga|sifr|sifr_dark|tango) real_theme="$theme" ;;
11279         default) real_theme=colibre ;;
11280         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11281         esac
11282         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11283     done
11285 AC_MSG_RESULT([$WITH_THEMES])
11286 AC_SUBST([WITH_THEMES])
11287 # FIXME: remove this, and the convenience default->colibre remapping after a crace period
11288 for theme in $with_theme; do
11289     case $theme in
11290     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11291     *) ;;
11292     esac
11293 done
11295 dnl ===================================================================
11296 dnl Test whether to integrate helppacks into the product's installer
11297 dnl ===================================================================
11298 AC_MSG_CHECKING([for helppack integration])
11299 if test "$with_helppack_integration" = "no"; then
11300     AC_MSG_RESULT([no integration])
11301 else
11302     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11303     AC_MSG_RESULT([integration])
11306 ###############################################################################
11307 # Extensions checking
11308 ###############################################################################
11309 AC_MSG_CHECKING([for extensions integration])
11310 if test "x$enable_extension_integration" != "xno"; then
11311     WITH_EXTENSION_INTEGRATION=TRUE
11312     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11313     AC_MSG_RESULT([yes, use integration])
11314 else
11315     WITH_EXTENSION_INTEGRATION=
11316     AC_MSG_RESULT([no, do not integrate])
11318 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11320 dnl Should any extra extensions be included?
11321 dnl There are standalone tests for each of these below.
11322 WITH_EXTRA_EXTENSIONS=
11323 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11325 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11326 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11327 if test "x$with_java" != "xno"; then
11328     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11329     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11332 AC_MSG_CHECKING([whether to build opens___.ttf])
11333 if test "$enable_build_opensymbol" = "yes"; then
11334     AC_MSG_RESULT([yes])
11335     AC_PATH_PROG(FONTFORGE, fontforge)
11336     if test -z "$FONTFORGE"; then
11337         AC_MSG_ERROR([fontforge not installed])
11338     fi
11339 else
11340     AC_MSG_RESULT([no])
11341     OPENSYMBOL_TTF=49a64f3bcf20a7909ba2751349231d6652ded9cd2840e961b5164d09de3ffa63-opens___.ttf
11342     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11344 AC_SUBST(OPENSYMBOL_TTF)
11345 AC_SUBST(FONTFORGE)
11347 dnl ===================================================================
11348 dnl Test whether to include fonts
11349 dnl ===================================================================
11350 AC_MSG_CHECKING([whether to include third-party fonts])
11351 if test "$with_fonts" != "no"; then
11352     AC_MSG_RESULT([yes])
11353     WITH_FONTS=TRUE
11354     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11355     AC_DEFINE(HAVE_MORE_FONTS)
11356 else
11357     AC_MSG_RESULT([no])
11358     WITH_FONTS=
11359     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11361 AC_SUBST(WITH_FONTS)
11364 dnl ===================================================================
11365 dnl Test whether to enable online update service
11366 dnl ===================================================================
11367 AC_MSG_CHECKING([whether to enable online update])
11368 ENABLE_ONLINE_UPDATE=
11369 ENABLE_ONLINE_UPDATE_MAR=
11370 UPDATE_CONFIG=
11371 if test "$enable_online_update" = ""; then
11372     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11373         AC_MSG_RESULT([yes])
11374         ENABLE_ONLINE_UPDATE="TRUE"
11375     else
11376         AC_MSG_RESULT([no])
11377     fi
11378 else
11379     if test "$enable_online_update" = "mar"; then
11380         AC_MSG_RESULT([yes - MAR-based online update])
11381         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11382         if test "$with_update_config" = ""; then
11383             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11384         fi
11385         UPDATE_CONFIG="$with_update_config"
11386         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11387     elif test "$enable_online_update" = "yes"; then
11388         AC_MSG_RESULT([yes])
11389         ENABLE_ONLINE_UPDATE="TRUE"
11390     else
11391         AC_MSG_RESULT([no])
11392     fi
11394 AC_SUBST(ENABLE_ONLINE_UPDATE)
11395 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11396 AC_SUBST(UPDATE_CONFIG)
11398 dnl ===================================================================
11399 dnl Test whether we need bzip2
11400 dnl ===================================================================
11401 SYSTEM_BZIP2=
11402 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11403     AC_MSG_CHECKING([whether to use system bzip2])
11404     if test "$with_system_bzip2" = yes; then
11405         SYSTEM_BZIP2=TRUE
11406         AC_MSG_RESULT([yes])
11407         PKG_CHECK_MODULES(BZIP2, bzip2)
11408         FilterLibs "${BZIP2_LIBS}"
11409         BZIP2_LIBS="${filteredlibs}"
11410     else
11411         AC_MSG_RESULT([no])
11412         BUILD_TYPE="$BUILD_TYPE BZIP2"
11413     fi
11415 AC_SUBST(SYSTEM_BZIP2)
11416 AC_SUBST(BZIP2_CFLAGS)
11417 AC_SUBST(BZIP2_LIBS)
11419 dnl ===================================================================
11420 dnl Test whether to enable extension update
11421 dnl ===================================================================
11422 AC_MSG_CHECKING([whether to enable extension update])
11423 ENABLE_EXTENSION_UPDATE=
11424 if test "x$enable_extension_update" = "xno"; then
11425     AC_MSG_RESULT([no])
11426 else
11427     AC_MSG_RESULT([yes])
11428     ENABLE_EXTENSION_UPDATE="TRUE"
11429     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11430     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11432 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11435 dnl ===================================================================
11436 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11437 dnl ===================================================================
11438 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11439 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11440     AC_MSG_RESULT([no])
11441     ENABLE_SILENT_MSI=
11442 else
11443     AC_MSG_RESULT([yes])
11444     ENABLE_SILENT_MSI=TRUE
11445     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11447 AC_SUBST(ENABLE_SILENT_MSI)
11449 AC_MSG_CHECKING([whether and how to use Xinerama])
11450 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11451     if test "$x_libraries" = "default_x_libraries"; then
11452         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11453         if test "x$XINERAMALIB" = x; then
11454            XINERAMALIB="/usr/lib"
11455         fi
11456     else
11457         XINERAMALIB="$x_libraries"
11458     fi
11459     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11460         # we have both versions, let the user decide but use the dynamic one
11461         # per default
11462         USE_XINERAMA=TRUE
11463         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11464             XINERAMA_LINK=dynamic
11465         else
11466             XINERAMA_LINK=static
11467         fi
11468     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11469         # we have only the dynamic version
11470         USE_XINERAMA=TRUE
11471         XINERAMA_LINK=dynamic
11472     elif test -e "$XINERAMALIB/libXinerama.a"; then
11473         # static version
11474         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11475             USE_XINERAMA=TRUE
11476             XINERAMA_LINK=static
11477         else
11478             USE_XINERAMA=
11479             XINERAMA_LINK=none
11480         fi
11481     else
11482         # no Xinerama
11483         USE_XINERAMA=
11484         XINERAMA_LINK=none
11485     fi
11486     if test "$USE_XINERAMA" = "TRUE"; then
11487         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11488         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11489             [AC_MSG_ERROR(Xinerama header not found.)], [])
11490         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11491         if test "x$XEXTLIB" = x; then
11492            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11493         fi
11494         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11495         if test "$_os" = "FreeBSD"; then
11496             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11497         fi
11498         if test "$_os" = "Linux"; then
11499             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11500         fi
11501         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11502             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11503     else
11504         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11505     fi
11506 else
11507     USE_XINERAMA=
11508     XINERAMA_LINK=none
11509     AC_MSG_RESULT([no])
11511 AC_SUBST(USE_XINERAMA)
11512 AC_SUBST(XINERAMA_LINK)
11514 dnl ===================================================================
11515 dnl Test whether to build cairo or rely on the system version
11516 dnl ===================================================================
11518 if test "$USING_X11" = TRUE; then
11519     # Used in vcl/Library_vclplug_gen.mk
11520     test_cairo=yes
11523 if test "$test_cairo" = "yes"; then
11524     AC_MSG_CHECKING([whether to use the system cairo])
11526     : ${with_system_cairo:=$with_system_libs}
11527     if test "$with_system_cairo" = "yes"; then
11528         SYSTEM_CAIRO=TRUE
11529         AC_MSG_RESULT([yes])
11531         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11532         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11533         FilterLibs "${CAIRO_LIBS}"
11534         CAIRO_LIBS="${filteredlibs}"
11536         if test "$test_xrender" = "yes"; then
11537             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11538             AC_LANG_PUSH([C])
11539             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11540 #ifdef PictStandardA8
11541 #else
11542       return fail;
11543 #endif
11544 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11546             AC_LANG_POP([C])
11547         fi
11548     else
11549         SYSTEM_CAIRO=
11550         AC_MSG_RESULT([no])
11552         BUILD_TYPE="$BUILD_TYPE CAIRO"
11553     fi
11556 AC_SUBST(SYSTEM_CAIRO)
11557 AC_SUBST(CAIRO_CFLAGS)
11558 AC_SUBST(CAIRO_LIBS)
11560 dnl ===================================================================
11561 dnl Test whether to use avahi
11562 dnl ===================================================================
11563 if test "$_os" = "WINNT"; then
11564     # Windows uses bundled mDNSResponder
11565     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11566 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11567     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11568                       [ENABLE_AVAHI="TRUE"])
11569     AC_DEFINE(HAVE_FEATURE_AVAHI)
11570     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11571     FilterLibs "${AVAHI_LIBS}"
11572     AVAHI_LIBS="${filteredlibs}"
11575 AC_SUBST(ENABLE_AVAHI)
11576 AC_SUBST(AVAHI_CFLAGS)
11577 AC_SUBST(AVAHI_LIBS)
11579 dnl ===================================================================
11580 dnl Test whether to use liblangtag
11581 dnl ===================================================================
11582 SYSTEM_LIBLANGTAG=
11583 AC_MSG_CHECKING([whether to use system liblangtag])
11584 if test "$with_system_liblangtag" = yes; then
11585     SYSTEM_LIBLANGTAG=TRUE
11586     AC_MSG_RESULT([yes])
11587     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11588     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11589     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11590     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11591     FilterLibs "${LIBLANGTAG_LIBS}"
11592     LIBLANGTAG_LIBS="${filteredlibs}"
11593 else
11594     SYSTEM_LIBLANGTAG=
11595     AC_MSG_RESULT([no])
11596     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11597     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11598     if test "$COM" = "MSC"; then
11599         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11600     else
11601         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11602     fi
11604 AC_SUBST(SYSTEM_LIBLANGTAG)
11605 AC_SUBST(LIBLANGTAG_CFLAGS)
11606 AC_SUBST(LIBLANGTAG_LIBS)
11608 dnl ===================================================================
11609 dnl Test whether to build libpng or rely on the system version
11610 dnl ===================================================================
11612 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11614 dnl ===================================================================
11615 dnl Check for runtime JVM search path
11616 dnl ===================================================================
11617 if test "$ENABLE_JAVA" != ""; then
11618     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11619     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11620         AC_MSG_RESULT([yes])
11621         if ! test -d "$with_jvm_path"; then
11622             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11623         fi
11624         if ! test -d "$with_jvm_path"jvm; then
11625             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11626         fi
11627         JVM_ONE_PATH_CHECK="$with_jvm_path"
11628         AC_SUBST(JVM_ONE_PATH_CHECK)
11629     else
11630         AC_MSG_RESULT([no])
11631     fi
11634 dnl ===================================================================
11635 dnl Test for the presence of Ant and that it works
11636 dnl ===================================================================
11638 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
11639     ANT_HOME=; export ANT_HOME
11640     WITH_ANT_HOME=; export WITH_ANT_HOME
11641     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11642         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11643             if test "$_os" = "WINNT"; then
11644                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11645             else
11646                 with_ant_home="$LODE_HOME/opt/ant"
11647             fi
11648         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11649             with_ant_home="$LODE_HOME/opt/ant"
11650         fi
11651     fi
11652     if test -z "$with_ant_home"; then
11653         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11654     else
11655         if test "$_os" = "WINNT"; then
11656             # AC_PATH_PROGS needs unix path
11657             with_ant_home=`cygpath -u "$with_ant_home"`
11658         fi
11659         AbsolutePath "$with_ant_home"
11660         with_ant_home=$absolute_path
11661         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11662         WITH_ANT_HOME=$with_ant_home
11663         ANT_HOME=$with_ant_home
11664     fi
11666     if test -z "$ANT"; then
11667         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11668     else
11669         # resolve relative or absolute symlink
11670         while test -h "$ANT"; do
11671             a_cwd=`pwd`
11672             a_basename=`basename "$ANT"`
11673             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11674             cd "`dirname "$ANT"`"
11675             cd "`dirname "$a_script"`"
11676             ANT="`pwd`"/"`basename "$a_script"`"
11677             cd "$a_cwd"
11678         done
11680         AC_MSG_CHECKING([if $ANT works])
11681         mkdir -p conftest.dir
11682         a_cwd=$(pwd)
11683         cd conftest.dir
11684         cat > conftest.java << EOF
11685         public class conftest {
11686             int testmethod(int a, int b) {
11687                     return a + b;
11688             }
11689         }
11692         cat > conftest.xml << EOF
11693         <project name="conftest" default="conftest">
11694         <target name="conftest">
11695             <javac srcdir="." includes="conftest.java">
11696             </javac>
11697         </target>
11698         </project>
11701         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11702         if test $? = 0 -a -f ./conftest.class; then
11703             AC_MSG_RESULT([Ant works])
11704             if test -z "$WITH_ANT_HOME"; then
11705                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11706                 if test -z "$ANT_HOME"; then
11707                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11708                 fi
11709             else
11710                 ANT_HOME="$WITH_ANT_HOME"
11711             fi
11712         else
11713             echo "configure: Ant test failed" >&5
11714             cat conftest.java >&5
11715             cat conftest.xml >&5
11716             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11717         fi
11718         cd "$a_cwd"
11719         rm -fr conftest.dir
11720     fi
11721     if test -z "$ANT_HOME"; then
11722         ANT_HOME="NO_ANT_HOME"
11723     else
11724         PathFormat "$ANT_HOME"
11725         ANT_HOME="$formatted_path"
11726         PathFormat "$ANT"
11727         ANT="$formatted_path"
11728     fi
11729     AC_SUBST(ANT_HOME)
11730     AC_SUBST(ANT)
11732     dnl Checking for ant.jar
11733     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11734         AC_MSG_CHECKING([Ant lib directory])
11735         if test -f $ANT_HOME/lib/ant.jar; then
11736             ANT_LIB="$ANT_HOME/lib"
11737         else
11738             if test -f $ANT_HOME/ant.jar; then
11739                 ANT_LIB="$ANT_HOME"
11740             else
11741                 if test -f /usr/share/java/ant.jar; then
11742                     ANT_LIB=/usr/share/java
11743                 else
11744                     if test -f /usr/share/ant-core/lib/ant.jar; then
11745                         ANT_LIB=/usr/share/ant-core/lib
11746                     else
11747                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11748                             ANT_LIB="$ANT_HOME/lib/ant"
11749                         else
11750                             if test -f /usr/share/lib/ant/ant.jar; then
11751                                 ANT_LIB=/usr/share/lib/ant
11752                             else
11753                                 AC_MSG_ERROR([Ant libraries not found!])
11754                             fi
11755                         fi
11756                     fi
11757                 fi
11758             fi
11759         fi
11760         PathFormat "$ANT_LIB"
11761         ANT_LIB="$formatted_path"
11762         AC_MSG_RESULT([Ant lib directory found.])
11763     fi
11764     AC_SUBST(ANT_LIB)
11766     ant_minver=1.6.0
11767     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11769     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11770     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11771     ant_version_major=`echo $ant_version | cut -d. -f1`
11772     ant_version_minor=`echo $ant_version | cut -d. -f2`
11773     echo "configure: ant_version $ant_version " >&5
11774     echo "configure: ant_version_major $ant_version_major " >&5
11775     echo "configure: ant_version_minor $ant_version_minor " >&5
11776     if test "$ant_version_major" -ge "2"; then
11777         AC_MSG_RESULT([yes, $ant_version])
11778     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11779         AC_MSG_RESULT([yes, $ant_version])
11780     else
11781         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11782     fi
11784     rm -f conftest* core core.* *.core
11787 OOO_JUNIT_JAR=
11788 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11789     AC_MSG_CHECKING([for JUnit 4])
11790     if test "$with_junit" = "yes"; then
11791         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
11792             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
11793         elif test -e /usr/share/java/junit4.jar; then
11794             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11795         else
11796            if test -e /usr/share/lib/java/junit.jar; then
11797               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11798            else
11799               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11800            fi
11801         fi
11802     else
11803         OOO_JUNIT_JAR=$with_junit
11804     fi
11805     if test "$_os" = "WINNT"; then
11806         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11807     fi
11808     printf 'import org.junit.Before;' > conftest.java
11809     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11810         AC_MSG_RESULT([$OOO_JUNIT_JAR])
11811     else
11812         AC_MSG_ERROR(
11813 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
11814  specify its pathname via --with-junit=..., or disable it via --without-junit])
11815     fi
11816     rm -f conftest.class conftest.java
11817     if test $OOO_JUNIT_JAR != ""; then
11818     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11819     fi
11821 AC_SUBST(OOO_JUNIT_JAR)
11823 HAMCREST_JAR=
11824 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11825     AC_MSG_CHECKING([for included Hamcrest])
11826     printf 'import org.hamcrest.BaseDescription;' > conftest.java
11827     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11828         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
11829     else
11830         AC_MSG_RESULT([Not included])
11831         AC_MSG_CHECKING([for standalone hamcrest jar.])
11832         if test "$with_hamcrest" = "yes"; then
11833             if test -e /usr/share/lib/java/hamcrest.jar; then
11834                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
11835             elif test -e /usr/share/java/hamcrest/core.jar; then
11836                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
11837             else
11838                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
11839             fi
11840         else
11841             HAMCREST_JAR=$with_hamcrest
11842         fi
11843         if test "$_os" = "WINNT"; then
11844             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
11845         fi
11846         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
11847             AC_MSG_RESULT([$HAMCREST_JAR])
11848         else
11849             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),
11850                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
11851         fi
11852     fi
11853     rm -f conftest.class conftest.java
11855 AC_SUBST(HAMCREST_JAR)
11858 AC_SUBST(SCPDEFS)
11861 # check for wget and curl
11863 WGET=
11864 CURL=
11866 if test "$enable_fetch_external" != "no"; then
11868 CURL=`which curl 2>/dev/null`
11870 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
11871     # wget new enough?
11872     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
11873     if test $? -eq 0; then
11874         WGET=$i
11875         break
11876     fi
11877 done
11879 if test -z "$WGET" -a -z "$CURL"; then
11880     AC_MSG_ERROR([neither wget nor curl found!])
11885 AC_SUBST(WGET)
11886 AC_SUBST(CURL)
11889 # check for sha256sum
11891 SHA256SUM=
11893 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
11894     eval "$i -a 256 --version" > /dev/null 2>&1
11895     ret=$?
11896     if test $ret -eq 0; then
11897         SHA256SUM="$i -a 256"
11898         break
11899     fi
11900 done
11902 if test -z "$SHA256SUM"; then
11903     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
11904         eval "$i --version" > /dev/null 2>&1
11905         ret=$?
11906         if test $ret -eq 0; then
11907             SHA256SUM=$i
11908             break
11909         fi
11910     done
11913 if test -z "$SHA256SUM"; then
11914     AC_MSG_ERROR([no sha256sum found!])
11917 AC_SUBST(SHA256SUM)
11919 dnl ===================================================================
11920 dnl Dealing with l10n options
11921 dnl ===================================================================
11922 AC_MSG_CHECKING([which languages to be built])
11923 # get list of all languages
11924 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
11925 # the sed command does the following:
11926 #   + if a line ends with a backslash, append the next line to it
11927 #   + adds " on the beginning of the value (after =)
11928 #   + adds " at the end of the value
11929 #   + removes en-US; we want to put it on the beginning
11930 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
11931 [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)]
11932 ALL_LANGS="en-US $completelangiso"
11933 # check the configured localizations
11934 WITH_LANG="$with_lang"
11936 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
11937 # (Norwegian is "nb" and "nn".)
11938 if test "$WITH_LANG" = "no"; then
11939     WITH_LANG=
11942 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
11943     AC_MSG_RESULT([en-US])
11944 else
11945     AC_MSG_RESULT([$WITH_LANG])
11946     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
11947     if test -z "$MSGFMT"; then
11948         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
11949             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
11950         elif test -x "/opt/lo/bin/msgfmt"; then
11951             MSGFMT="/opt/lo/bin/msgfmt"
11952         else
11953             AC_CHECK_PROGS(MSGFMT, [msgfmt])
11954             if test -z "$MSGFMT"; then
11955                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
11956             fi
11957         fi
11958     fi
11959     if test -z "$MSGUNIQ"; then
11960         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
11961             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
11962         elif test -x "/opt/lo/bin/msguniq"; then
11963             MSGUNIQ="/opt/lo/bin/msguniq"
11964         else
11965             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
11966             if test -z "$MSGUNIQ"; then
11967                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
11968             fi
11969         fi
11970     fi
11972 AC_SUBST(MSGFMT)
11973 AC_SUBST(MSGUNIQ)
11974 # check that the list is valid
11975 for lang in $WITH_LANG; do
11976     test "$lang" = "ALL" && continue
11977     # need to check for the exact string, so add space before and after the list of all languages
11978     for vl in $ALL_LANGS; do
11979         if test "$vl" = "$lang"; then
11980            break
11981         fi
11982     done
11983     if test "$vl" != "$lang"; then
11984         # if you're reading this - you prolly quoted your languages remove the quotes ...
11985         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
11986     fi
11987 done
11988 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
11989     echo $WITH_LANG | grep -q en-US
11990     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
11992 # list with substituted ALL
11993 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
11994 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
11995 test "$WITH_LANG" = "en-US" && WITH_LANG=
11996 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
11997     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
11998     ALL_LANGS=`echo $ALL_LANGS qtz`
12000 AC_SUBST(ALL_LANGS)
12001 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12002 AC_SUBST(WITH_LANG)
12003 AC_SUBST(WITH_LANG_LIST)
12004 AC_SUBST(GIT_NEEDED_SUBMODULES)
12006 WITH_POOR_HELP_LOCALIZATIONS=
12007 if test -d "$SRC_ROOT/translations/source"; then
12008     for l in `ls -1 $SRC_ROOT/translations/source`; do
12009         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12010             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12011         fi
12012     done
12014 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12016 if test -n "$with_locales"; then
12017     WITH_LOCALES="$with_locales"
12019     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12020     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12021     # config_host/config_locales.h.in
12022     for locale in $WITH_LOCALES; do
12023         lang=${locale%_*}
12025         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12027         case $lang in
12028         hi|mr*ne)
12029             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12030             ;;
12031         bg|ru)
12032             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12033             ;;
12034         esac
12035     done
12036 else
12037     AC_DEFINE(WITH_LOCALE_ALL)
12039 AC_SUBST(WITH_LOCALES)
12041 dnl git submodule update --reference
12042 dnl ===================================================================
12043 if test -n "${GIT_REFERENCE_SRC}"; then
12044     for repo in ${GIT_NEEDED_SUBMODULES}; do
12045         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12046             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12047         fi
12048     done
12050 AC_SUBST(GIT_REFERENCE_SRC)
12052 dnl git submodules linked dirs
12053 dnl ===================================================================
12054 if test -n "${GIT_LINK_SRC}"; then
12055     for repo in ${GIT_NEEDED_SUBMODULES}; do
12056         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12057             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12058         fi
12059     done
12061 AC_SUBST(GIT_LINK_SRC)
12063 dnl branding
12064 dnl ===================================================================
12065 AC_MSG_CHECKING([for alternative branding images directory])
12066 # initialize mapped arrays
12067 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12068 brand_files="$BRAND_INTRO_IMAGES about.svg"
12070 if test -z "$with_branding" -o "$with_branding" = "no"; then
12071     AC_MSG_RESULT([none])
12072     DEFAULT_BRAND_IMAGES="$brand_files"
12073 else
12074     if ! test -d $with_branding ; then
12075         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12076     else
12077         AC_MSG_RESULT([$with_branding])
12078         CUSTOM_BRAND_DIR="$with_branding"
12079         for lfile in $brand_files
12080         do
12081             if ! test -f $with_branding/$lfile ; then
12082                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12083                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12084             else
12085                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12086             fi
12087         done
12088         check_for_progress="yes"
12089     fi
12091 AC_SUBST([BRAND_INTRO_IMAGES])
12092 AC_SUBST([CUSTOM_BRAND_DIR])
12093 AC_SUBST([CUSTOM_BRAND_IMAGES])
12094 AC_SUBST([DEFAULT_BRAND_IMAGES])
12097 AC_MSG_CHECKING([for 'intro' progress settings])
12098 PROGRESSBARCOLOR=
12099 PROGRESSSIZE=
12100 PROGRESSPOSITION=
12101 PROGRESSFRAMECOLOR=
12102 PROGRESSTEXTCOLOR=
12103 PROGRESSTEXTBASELINE=
12105 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12106     source "$with_branding/progress.conf"
12107     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12108 else
12109     AC_MSG_RESULT([none])
12112 AC_SUBST(PROGRESSBARCOLOR)
12113 AC_SUBST(PROGRESSSIZE)
12114 AC_SUBST(PROGRESSPOSITION)
12115 AC_SUBST(PROGRESSFRAMECOLOR)
12116 AC_SUBST(PROGRESSTEXTCOLOR)
12117 AC_SUBST(PROGRESSTEXTBASELINE)
12120 AC_MSG_CHECKING([for extra build ID])
12121 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12122     EXTRA_BUILDID="$with_extra_buildid"
12124 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12125 if test -n "$EXTRA_BUILDID" ; then
12126     AC_MSG_RESULT([$EXTRA_BUILDID])
12127 else
12128     AC_MSG_RESULT([not set])
12130 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12132 OOO_VENDOR=
12133 AC_MSG_CHECKING([for vendor])
12134 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12135     OOO_VENDOR="$USERNAME"
12137     if test -z "$OOO_VENDOR"; then
12138         OOO_VENDOR="$USER"
12139     fi
12141     if test -z "$OOO_VENDOR"; then
12142         OOO_VENDOR="`id -u -n`"
12143     fi
12145     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12146 else
12147     OOO_VENDOR="$with_vendor"
12148     AC_MSG_RESULT([$OOO_VENDOR])
12150 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12151 AC_SUBST(OOO_VENDOR)
12153 if test "$_os" = "Android" ; then
12154     ANDROID_PACKAGE_NAME=
12155     AC_MSG_CHECKING([for Android package name])
12156     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12157         if test -n "$ENABLE_DEBUG"; then
12158             # Default to the package name that makes ndk-gdb happy.
12159             ANDROID_PACKAGE_NAME="org.libreoffice"
12160         else
12161             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12162         fi
12164         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12165     else
12166         ANDROID_PACKAGE_NAME="$with_android_package_name"
12167         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12168     fi
12169     AC_SUBST(ANDROID_PACKAGE_NAME)
12172 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12173 if test "$with_compat_oowrappers" = "yes"; then
12174     WITH_COMPAT_OOWRAPPERS=TRUE
12175     AC_MSG_RESULT(yes)
12176 else
12177     WITH_COMPAT_OOWRAPPERS=
12178     AC_MSG_RESULT(no)
12180 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12182 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12183 AC_MSG_CHECKING([for install dirname])
12184 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12185     INSTALLDIRNAME="$with_install_dirname"
12187 AC_MSG_RESULT([$INSTALLDIRNAME])
12188 AC_SUBST(INSTALLDIRNAME)
12190 AC_MSG_CHECKING([for prefix])
12191 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12192 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12193 PREFIXDIR="$prefix"
12194 AC_MSG_RESULT([$PREFIXDIR])
12195 AC_SUBST(PREFIXDIR)
12197 LIBDIR=[$(eval echo $(eval echo $libdir))]
12198 AC_SUBST(LIBDIR)
12200 DATADIR=[$(eval echo $(eval echo $datadir))]
12201 AC_SUBST(DATADIR)
12203 MANDIR=[$(eval echo $(eval echo $mandir))]
12204 AC_SUBST(MANDIR)
12206 DOCDIR=[$(eval echo $(eval echo $docdir))]
12207 AC_SUBST(DOCDIR)
12209 BINDIR=[$(eval echo $(eval echo $bindir))]
12210 AC_SUBST(BINDIR)
12212 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12213 AC_SUBST(INSTALLDIR)
12215 TESTINSTALLDIR="${BUILDDIR}/test-install"
12216 AC_SUBST(TESTINSTALLDIR)
12219 # ===================================================================
12220 # OAuth2 id and secrets
12221 # ===================================================================
12223 AC_MSG_CHECKING([for Google Drive client id and secret])
12224 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12225     AC_MSG_RESULT([not set])
12226     GDRIVE_CLIENT_ID="\"\""
12227     GDRIVE_CLIENT_SECRET="\"\""
12228 else
12229     AC_MSG_RESULT([set])
12230     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12231     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12233 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12234 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12236 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12237 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12238     AC_MSG_RESULT([not set])
12239     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12240     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12241 else
12242     AC_MSG_RESULT([set])
12243     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12244     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12246 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12247 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12249 AC_MSG_CHECKING([for OneDrive client id and secret])
12250 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12251     AC_MSG_RESULT([not set])
12252     ONEDRIVE_CLIENT_ID="\"\""
12253     ONEDRIVE_CLIENT_SECRET="\"\""
12254 else
12255     AC_MSG_RESULT([set])
12256     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12257     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12259 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12260 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12263 dnl ===================================================================
12264 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12265 dnl --enable-dependency-tracking configure option
12266 dnl ===================================================================
12267 AC_MSG_CHECKING([whether to enable dependency tracking])
12268 if test "$enable_dependency_tracking" = "no"; then
12269     nodep=TRUE
12270     AC_MSG_RESULT([no])
12271 else
12272     AC_MSG_RESULT([yes])
12274 AC_SUBST(nodep)
12276 dnl ===================================================================
12277 dnl Number of CPUs to use during the build
12278 dnl ===================================================================
12279 AC_MSG_CHECKING([for number of processors to use])
12280 # plain --with-parallelism is just the default
12281 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12282     if test "$with_parallelism" = "no"; then
12283         PARALLELISM=0
12284     else
12285         PARALLELISM=$with_parallelism
12286     fi
12287 else
12288     if test "$enable_icecream" = "yes"; then
12289         PARALLELISM="10"
12290     else
12291         case `uname -s` in
12293         Darwin|FreeBSD|NetBSD|OpenBSD)
12294             PARALLELISM=`sysctl -n hw.ncpu`
12295             ;;
12297         Linux)
12298             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12299         ;;
12300         # what else than above does profit here *and* has /proc?
12301         *)
12302             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12303             ;;
12304         esac
12306         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12307         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12308     fi
12311 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12312     if test -z "$with_parallelism"; then
12313             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12314             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12315             PARALLELISM="1"
12316     else
12317         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."
12318     fi
12321 if test $PARALLELISM -eq 0; then
12322     AC_MSG_RESULT([explicit make -j option needed])
12323 else
12324     AC_MSG_RESULT([$PARALLELISM])
12326 AC_SUBST(PARALLELISM)
12328 IWYU_PATH="$with_iwyu"
12329 AC_SUBST(IWYU_PATH)
12330 if test ! -z "$IWYU_PATH"; then
12331     if test ! -f "$IWYU_PATH"; then
12332         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12333     fi
12337 # Set up ILIB for MSVC build
12339 ILIB1=
12340 if test "$build_os" = "cygwin"; then
12341     ILIB="."
12342     if test -n "$JAVA_HOME"; then
12343         ILIB="$ILIB;$JAVA_HOME/lib"
12344     fi
12345     ILIB1=-link
12346     if test "$BITNESS_OVERRIDE" = 64; then
12347         ILIB="$ILIB;$COMPATH/lib/x64"
12348         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12349         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12350         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12351         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12352             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12353             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12354         fi
12355         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12356         ucrtlibpath_formatted=$formatted_path
12357         ILIB="$ILIB;$ucrtlibpath_formatted"
12358         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12359     else
12360         ILIB="$ILIB;$COMPATH/lib/x86"
12361         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12362         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12363         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12364         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12365             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12366             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12367         fi
12368         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12369         ucrtlibpath_formatted=$formatted_path
12370         ILIB="$ILIB;$ucrtlibpath_formatted"
12371         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12372     fi
12373     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12374         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12375     else
12376         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12377     fi
12379     AC_SUBST(ILIB)
12382 dnl We should be able to drop the below check when bumping the GCC baseline to
12383 dnl 4.9, as <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54577>
12384 dnl "deque<T>::erase() still takes iterator instead of const_iterator" should be
12385 dnl fixed there with <https://gcc.gnu.org/git/?p=gcc.git;a=commit;
12386 dnl h=6b0e18ca48bb4b4c01e7b5be2b98849943fdcf91>:
12387 AC_MSG_CHECKING(
12388     [whether C++11 use of const_iterator in standard containers is broken])
12389 save_CXXFLAGS=$CXXFLAGS
12390 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12391 AC_LANG_PUSH([C++])
12392 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12393     #include <list>
12394     ]],[[
12395         std::list<int> l;
12396         l.erase(l.cbegin());
12397     ]])],
12398     [broken=no], [broken=yes])
12399 AC_LANG_POP([C++])
12400 CXXFLAGS=$save_CXXFLAGS
12401 AC_MSG_RESULT([$broken])
12402 if test "$broken" = yes; then
12403     AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
12407 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12408 save_CXXFLAGS=$CXXFLAGS
12409 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12410 save_LIBS=$LIBS
12411 if test -n "$ILIB1"; then
12412     LIBS="$LIBS $ILIB1"
12414 AC_LANG_PUSH([C++])
12415 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12416     // Exit with failure if the static initializer_list is stored on the
12417     // stack (as done by Clang < 3.4):
12418     #include <initializer_list>
12419     struct S {};
12420     bool g(void const * p1, void const * p2) {
12421         int n;
12422         return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12423     }
12424     bool f(void const * p1) {
12425         static std::initializer_list<S> s { S() };
12426         return g(p1, s.begin());
12427     }
12428     ]],[[
12429         int n;
12430         return f(&n) ? 0 : 1;
12431     ]])], [broken=no], [broken=yes],[broken='assuming not (cross-compiling)'])
12432 AC_LANG_POP([C++])
12433 LIBS=$save_LIBS
12434 CXXFLAGS=$save_CXXFLAGS
12435 AC_MSG_RESULT([$broken])
12436 if test "$broken" = yes -a "$_os" != "iOS"; then
12437     AC_MSG_ERROR([working support for static initializer_list needed])
12441 # ===================================================================
12442 # Creating bigger shared library to link against
12443 # ===================================================================
12444 AC_MSG_CHECKING([whether to create huge library])
12445 MERGELIBS=
12447 if test $_os = iOS -o $_os = Android; then
12448     # Never any point in mergelibs for these as we build just static
12449     # libraries anyway...
12450     enable_mergelibs=no
12453 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12454     if test $_os != Linux -a $_os != WINNT; then
12455         add_warning "--enable-mergelibs is not tested for this platform"
12456     fi
12457     MERGELIBS="TRUE"
12458     AC_MSG_RESULT([yes])
12459 else
12460     AC_MSG_RESULT([no])
12462 AC_SUBST([MERGELIBS])
12464 dnl ===================================================================
12465 dnl icerun is a wrapper that stops us spawning tens of processes
12466 dnl locally - for tools that can't be executed on the compile cluster
12467 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12468 dnl ===================================================================
12469 AC_MSG_CHECKING([whether to use icerun wrapper])
12470 ICECREAM_RUN=
12471 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12472     ICECREAM_RUN=icerun
12473     AC_MSG_RESULT([yes])
12474 else
12475     AC_MSG_RESULT([no])
12477 AC_SUBST(ICECREAM_RUN)
12479 dnl ===================================================================
12480 dnl Setup the ICECC_VERSION for the build the same way it was set for
12481 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12482 dnl ===================================================================
12483 x_ICECC_VERSION=[\#]
12484 if test -n "$ICECC_VERSION" ; then
12485     x_ICECC_VERSION=
12487 AC_SUBST(x_ICECC_VERSION)
12488 AC_SUBST(ICECC_VERSION)
12490 dnl ===================================================================
12492 AC_MSG_CHECKING([MPL subset])
12493 MPL_SUBSET=
12495 if test "$enable_mpl_subset" = "yes"; then
12496     warn_report=false
12497     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12498         warn_report=true
12499     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12500         warn_report=true
12501     fi
12502     if test "$warn_report" = "true"; then
12503         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12504     fi
12505     if test "x$enable_postgresql_sdbc" != "xno"; then
12506         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12507     fi
12508     if test "$enable_lotuswordpro" = "yes"; then
12509         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12510     fi
12511     if test "$WITH_WEBDAV" = "neon"; then
12512         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12513     fi
12514     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12515         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12516     fi
12517     if test -n "$ENABLE_PDFIMPORT"; then
12518         if test "x$SYSTEM_POPPLER" = "x"; then
12519             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12520         fi
12521     fi
12522     # cf. m4/libo_check_extension.m4
12523     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12524         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12525     fi
12526     for theme in $WITH_THEMES; do
12527         case $theme in
12528         breeze|breeze_dark|sifr|sifr_dark|elementary|karasa_jaga) #blacklist of icon themes under GPL or LGPL
12529             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12530         *) : ;;
12531         esac
12532     done
12534     ENABLE_OPENGL_TRANSITIONS=
12536     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12537         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12538     fi
12540     MPL_SUBSET="TRUE"
12541     AC_DEFINE(MPL_HAVE_SUBSET)
12542     AC_MSG_RESULT([only])
12543 else
12544     AC_MSG_RESULT([no restrictions])
12546 AC_SUBST(MPL_SUBSET)
12548 dnl ===================================================================
12550 AC_MSG_CHECKING([formula logger])
12551 ENABLE_FORMULA_LOGGER=
12553 if test "x$enable_formula_logger" = "xyes"; then
12554     AC_MSG_RESULT([yes])
12555     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12556     ENABLE_FORMULA_LOGGER=TRUE
12557 elif test -n "$ENABLE_DBGUTIL" ; then
12558     AC_MSG_RESULT([yes])
12559     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12560     ENABLE_FORMULA_LOGGER=TRUE
12561 else
12562     AC_MSG_RESULT([no])
12565 AC_SUBST(ENABLE_FORMULA_LOGGER)
12567 dnl ===================================================================
12568 dnl Setting up the environment.
12569 dnl ===================================================================
12570 AC_MSG_NOTICE([setting up the build environment variables...])
12572 AC_SUBST(COMPATH)
12574 if test "$build_os" = "cygwin"; then
12575     if test -d "$COMPATH/atlmfc/lib"; then
12576         ATL_LIB="$COMPATH/atlmfc/lib"
12577         ATL_INCLUDE="$COMPATH/atlmfc/include"
12578     else
12579         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12580         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12581     fi
12582     if test "$BITNESS_OVERRIDE" = 64; then
12583         if test $VCVER = "150"; then
12584             ATL_LIB="$ATL_LIB/x64"
12585         else
12586             ATL_LIB="$ATL_LIB/amd64"
12587         fi
12588     else
12589         if test $VCVER = "150"; then
12590             ATL_LIB="$ATL_LIB/x86"
12591         fi
12592     fi
12593     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12594     PathFormat "/usr/bin/find.exe"
12595     FIND="$formatted_path"
12596     PathFormat "/usr/bin/sort.exe"
12597     SORT="$formatted_path"
12598     PathFormat "/usr/bin/grep.exe"
12599     WIN_GREP="$formatted_path"
12600     PathFormat "/usr/bin/ls.exe"
12601     WIN_LS="$formatted_path"
12602     PathFormat "/usr/bin/touch.exe"
12603     WIN_TOUCH="$formatted_path"
12604 else
12605     FIND=find
12606     SORT=sort
12609 AC_SUBST(ATL_INCLUDE)
12610 AC_SUBST(ATL_LIB)
12611 AC_SUBST(FIND)
12612 AC_SUBST(SORT)
12613 AC_SUBST(WIN_GREP)
12614 AC_SUBST(WIN_LS)
12615 AC_SUBST(WIN_TOUCH)
12617 AC_SUBST(BUILD_TYPE)
12619 AC_SUBST(SOLARINC)
12621 PathFormat "$PERL"
12622 PERL="$formatted_path"
12623 AC_SUBST(PERL)
12625 if test -n "$TMPDIR"; then
12626     TEMP_DIRECTORY="$TMPDIR"
12627 else
12628     TEMP_DIRECTORY="/tmp"
12630 if test "$build_os" = "cygwin"; then
12631     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12633 AC_SUBST(TEMP_DIRECTORY)
12635 # setup the PATH for the environment
12636 if test -n "$LO_PATH_FOR_BUILD"; then
12637     LO_PATH="$LO_PATH_FOR_BUILD"
12638 else
12639     LO_PATH="$PATH"
12641     case "$host_os" in
12643     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12644         if test "$ENABLE_JAVA" != ""; then
12645             pathmunge "$JAVA_HOME/bin" "after"
12646         fi
12647         ;;
12649     cygwin*)
12650         # Win32 make needs native paths
12651         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12652             LO_PATH=`cygpath -p -m "$PATH"`
12653         fi
12654         if test "$BITNESS_OVERRIDE" = 64; then
12655             # needed for msi packaging
12656             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12657         fi
12658         # .NET 4.6 and higher don't have bin directory
12659         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12660             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12661         fi
12662         pathmunge "$ASM_HOME" "before"
12663         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12664         pathmunge "$CSC_PATH" "before"
12665         pathmunge "$MIDL_PATH" "before"
12666         pathmunge "$AL_PATH" "before"
12667         pathmunge "$MSPDB_PATH" "before"
12668         if test -n "$MSBUILD_PATH" ; then
12669             pathmunge "$MSBUILD_PATH" "before"
12670         fi
12671         if test "$BITNESS_OVERRIDE" = 64; then
12672             pathmunge "$COMPATH/bin/amd64" "before"
12673             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12674         else
12675             pathmunge "$COMPATH/bin" "before"
12676             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12677         fi
12678         if test "$ENABLE_JAVA" != ""; then
12679             if test -d "$JAVA_HOME/jre/bin/client"; then
12680                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12681             fi
12682             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12683                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12684             fi
12685             pathmunge "$JAVA_HOME/bin" "before"
12686         fi
12687         ;;
12689     solaris*)
12690         pathmunge "/usr/css/bin" "before"
12691         if test "$ENABLE_JAVA" != ""; then
12692             pathmunge "$JAVA_HOME/bin" "after"
12693         fi
12694         ;;
12695     esac
12698 AC_SUBST(LO_PATH)
12700 libo_FUZZ_SUMMARY
12702 # Generate a configuration sha256 we can use for deps
12703 if test -f config_host.mk; then
12704     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12706 if test -f config_host_lang.mk; then
12707     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12710 CFLAGS=$my_original_CFLAGS
12711 CXXFLAGS=$my_original_CXXFLAGS
12712 CPPFLAGS=$my_original_CPPFLAGS
12714 AC_CONFIG_FILES([config_host.mk
12715                  config_host_lang.mk
12716                  Makefile
12717                  lo.xcent
12718                  bin/bffvalidator.sh
12719                  bin/odfvalidator.sh
12720                  bin/officeotron.sh
12721                  instsetoo_native/util/openoffice.lst
12722                  sysui/desktop/macosx/Info.plist])
12723 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12724 AC_CONFIG_HEADERS([config_host/config_clang.h])
12725 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12726 AC_CONFIG_HEADERS([config_host/config_eot.h])
12727 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12728 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12729 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12730 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12731 AC_CONFIG_HEADERS([config_host/config_features.h])
12732 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12733 AC_CONFIG_HEADERS([config_host/config_folders.h])
12734 AC_CONFIG_HEADERS([config_host/config_gio.h])
12735 AC_CONFIG_HEADERS([config_host/config_global.h])
12736 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12737 AC_CONFIG_HEADERS([config_host/config_java.h])
12738 AC_CONFIG_HEADERS([config_host/config_langs.h])
12739 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12740 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12741 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12742 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
12743 AC_CONFIG_HEADERS([config_host/config_locales.h])
12744 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12745 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12746 AC_CONFIG_HEADERS([config_host/config_qt5.h])
12747 AC_CONFIG_HEADERS([config_host/config_kde5.h])
12748 AC_CONFIG_HEADERS([config_host/config_gtk3_kde5.h])
12749 AC_CONFIG_HEADERS([config_host/config_oox.h])
12750 AC_CONFIG_HEADERS([config_host/config_options.h])
12751 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12752 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12753 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12754 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12755 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12756 AC_CONFIG_HEADERS([config_host/config_version.h])
12757 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12758 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12759 AC_CONFIG_HEADERS([config_host/config_python.h])
12760 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12761 AC_OUTPUT
12763 if test "$CROSS_COMPILING" = TRUE; then
12764     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12767 # touch the config timestamp file
12768 if test ! -f config_host.mk.stamp; then
12769     echo > config_host.mk.stamp
12770 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12771     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12772 else
12773     echo > config_host.mk.stamp
12776 # touch the config lang timestamp file
12777 if test ! -f config_host_lang.mk.stamp; then
12778     echo > config_host_lang.mk.stamp
12779 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12780     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12781 else
12782     echo > config_host_lang.mk.stamp
12786 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12788 cat << _EOS
12789 ****************************************************************************
12790 WARNING:
12791 Your make version is known to be horribly slow, and hard to debug
12792 problems with. To get a reasonably functional make please do:
12794 to install a pre-compiled binary make for Win32
12796  mkdir -p /opt/lo/bin
12797  cd /opt/lo/bin
12798  wget https://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
12799  cp make-85047eb-msvc.exe make
12800  chmod +x make
12802 to install from source:
12803 place yourself in a working directory of you choice.
12805  git clone git://git.savannah.gnu.org/make.git
12807  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
12808  set PATH=%PATH%;C:\Cygwin\bin
12809  [or Cygwin64, if that is what you have]
12810  cd path-to-make-repo-you-cloned-above
12811  build_w32.bat --without-guile
12813 should result in a WinRel/gnumake.exe.
12814 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12816 Then re-run autogen.sh
12818 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12819 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12821 _EOS
12824 cat << _EOF
12825 ****************************************************************************
12827 To build, run:
12828 $GNUMAKE
12830 To view some help, run:
12831 $GNUMAKE help
12833 _EOF
12835 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12836     cat << _EOF
12837 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12838 _EOF
12840     if test $_os = Darwin; then
12841         echo open instdir/$PRODUCTNAME.app
12842     else
12843         echo instdir/program/soffice
12844     fi
12845     cat << _EOF
12847 If you want to run the smoketest, run:
12848 $GNUMAKE check
12850 _EOF
12853 if test -f warn; then
12854     cat warn
12855     rm warn
12858 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: