sd: import PDFs as images using Pdfium new SdPdfFilter
[LibreOffice.git] / configure.ac
blobc045e6fb73406796c79475580d7c93fafd765676
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     fi
87 AbsolutePath()
89     # There appears to be no simple and portable method to get an absolute and
90     # canonical path, so we try creating the directory if does not exist and
91     # utilizing the shell and pwd.
92     rel="$1"
93     absolute_path=""
94     test ! -e "$rel" && mkdir -p "$rel"
95     if test -d "$rel" ; then
96         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
97         absolute_path="$(pwd)"
98         cd - > /dev/null
99     else
100         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
101     fi
104 rm -f warn
105 have_WARNINGS="no"
106 add_warning()
108     if test "$have_WARNINGS" = "no"; then
109         echo "*************************************" > warn
110         have_WARNINGS="yes"
111         if which tput >/dev/null 2>/dev/null && test `tput colors` -ge 8; then
112             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
113             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
114         else
115             COLORWARN="* WARNING :"
116         fi
117     fi
118     echo "$COLORWARN $@" >> warn
121 dnl Some Mac User have the bad habbit of letting a lot fo crap
122 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
123 dnl that confuse the build.
124 dnl For the ones that use LODE, let's be nice and protect them
125 dnl from themselves
127 mac_sanitize_path()
129     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
130 dnl a common but nevertheless necessary thing that may be in a fancy
131 dnl path location is git, so make sure we have it
132     mac_git_path=`which git 2>/dev/null`
133     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
134         mac_path="$mac_path:`dirname $mac_git_path`"
135     fi
136 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
137 dnl path location is gpg, so make sure we find it
138     mac_gpg_path=`which gpg 2>/dev/null`
139     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
140         mac_path="$mac_path:`dirname $mac_gpg_path`"
141     fi
142     PATH="$mac_path"
143     unset mac_path
144     unset mac_git_path
145     unset mac_gpg_path
148 echo "********************************************************************"
149 echo "*"
150 echo "*   Running ${PACKAGE_NAME} build configuration."
151 echo "*"
152 echo "********************************************************************"
153 echo ""
155 dnl ===================================================================
156 dnl checks build and host OSes
157 dnl do this before argument processing to allow for platform dependent defaults
158 dnl ===================================================================
159 AC_CANONICAL_HOST
161 AC_MSG_CHECKING([for product name])
162 PRODUCTNAME="AC_PACKAGE_NAME"
163 if test -n "$with_product_name" -a "$with_product_name" != no; then
164     PRODUCTNAME="$with_product_name"
166 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
167     PRODUCTNAME="${PRODUCTNAME}Dev"
169 AC_MSG_RESULT([$PRODUCTNAME])
170 AC_SUBST(PRODUCTNAME)
171 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
172 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
174 dnl ===================================================================
175 dnl Our version is defined by the AC_INIT() at the top of this script.
176 dnl ===================================================================
178 AC_MSG_CHECKING([for package version])
179 if test -n "$with_package_version" -a "$with_package_version" != no; then
180     PACKAGE_VERSION="$with_package_version"
182 AC_MSG_RESULT([$PACKAGE_VERSION])
184 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
186 LIBO_VERSION_MAJOR=$1
187 LIBO_VERSION_MINOR=$2
188 LIBO_VERSION_MICRO=$3
189 LIBO_VERSION_PATCH=$4
191 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
192 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
193 # no way to encode that into an integer in general.
194 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
196 LIBO_VERSION_SUFFIX=$5
197 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
198 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
199 # they get undoubled before actually passed to sed.
200 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
201 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
202 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
203 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
205 AC_SUBST(LIBO_VERSION_MAJOR)
206 AC_SUBST(LIBO_VERSION_MINOR)
207 AC_SUBST(LIBO_VERSION_MICRO)
208 AC_SUBST(LIBO_VERSION_PATCH)
209 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
210 AC_SUBST(LIBO_VERSION_SUFFIX)
211 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
213 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
214 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
215 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
216 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
218 LIBO_THIS_YEAR=`date +%Y`
219 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
221 dnl ===================================================================
222 dnl Product version
223 dnl ===================================================================
224 AC_MSG_CHECKING([for product version])
225 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
226 AC_MSG_RESULT([$PRODUCTVERSION])
227 AC_SUBST(PRODUCTVERSION)
229 AC_PROG_EGREP
230 # AC_PROG_EGREP doesn't set GREP on all systems as well
231 AC_PATH_PROG(GREP, grep)
233 BUILDDIR=`pwd`
234 cd $srcdir
235 SRC_ROOT=`pwd`
236 cd $BUILDDIR
237 x_Cygwin=[\#]
239 dnl ======================================
240 dnl Required GObject introspection version
241 dnl ======================================
242 INTROSPECTION_REQUIRED_VERSION=1.32.0
244 dnl ===================================================================
245 dnl Search all the common names for GNU Make
246 dnl ===================================================================
247 AC_MSG_CHECKING([for GNU Make])
249 # try to use our own make if it is available and GNUMAKE was not already defined
250 if test -z "$GNUMAKE"; then
251     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
252         GNUMAKE="$LODE_HOME/opt/bin/make"
253     elif test -x "/opt/lo/bin/make"; then
254         GNUMAKE="/opt/lo/bin/make"
255     fi
258 GNUMAKE_WIN_NATIVE=
259 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
260     if test -n "$a"; then
261         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
262         if test $? -eq 0;  then
263             if test "$build_os" = "cygwin"; then
264                 if test -n "$($a -v | grep 'Built for Windows')" ; then
265                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
266                     GNUMAKE_WIN_NATIVE="TRUE"
267                 else
268                     GNUMAKE=`which $a`
269                 fi
270             else
271                 GNUMAKE=`which $a`
272             fi
273             break
274         fi
275     fi
276 done
277 AC_MSG_RESULT($GNUMAKE)
278 if test -z "$GNUMAKE"; then
279     AC_MSG_ERROR([not found. install GNU Make.])
280 else
281     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
282         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
283     fi
286 win_short_path_for_make()
288     local_short_path="$1"
289     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
290         cygpath -sm "$local_short_path"
291     else
292         cygpath -u "$(cygpath -d "$local_short_path")"
293     fi
297 if test "$build_os" = "cygwin"; then
298     PathFormat "$SRC_ROOT"
299     SRC_ROOT="$formatted_path"
300     PathFormat "$BUILDDIR"
301     BUILDDIR="$formatted_path"
302     x_Cygwin=
303     AC_MSG_CHECKING(for explicit COMSPEC)
304     if test -z "$COMSPEC"; then
305         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
306     else
307         AC_MSG_RESULT([found: $COMSPEC])
308     fi
311 AC_SUBST(SRC_ROOT)
312 AC_SUBST(BUILDDIR)
313 AC_SUBST(x_Cygwin)
314 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
315 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
317 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
318     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
321 # need sed in os checks...
322 AC_PATH_PROGS(SED, sed)
323 if test -z "$SED"; then
324     AC_MSG_ERROR([install sed to run this script])
327 # Set the ENABLE_LTO variable
328 # ===================================================================
329 AC_MSG_CHECKING([whether to use link-time optimization])
330 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
331     ENABLE_LTO="TRUE"
332     AC_MSG_RESULT([yes])
333     AC_DEFINE(STATIC_LINKING)
334 else
335     ENABLE_LTO=""
336     AC_MSG_RESULT([no])
338 AC_SUBST(ENABLE_LTO)
340 AC_ARG_ENABLE(fuzz-options,
341     AS_HELP_STRING([--enable-fuzz-options],
342         [Randomly enable or disable each of those configurable options
343          that are supposed to be freely selectable without interdependencies,
344          or where bad interaction from interdependencies is automatically avoided.])
347 dnl ===================================================================
348 dnl When building for Android, --with-android-ndk,
349 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
350 dnl mandatory
351 dnl ===================================================================
353 AC_ARG_WITH(android-ndk,
354     AS_HELP_STRING([--with-android-ndk],
355         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
358 AC_ARG_WITH(android-ndk-toolchain-version,
359     AS_HELP_STRING([--with-android-ndk-toolchain-version],
360         [Specify which toolchain version to use, of those present in the
361         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
362         with_android_ndk_toolchain_version=clang5.0)
364 AC_ARG_WITH(android-sdk,
365     AS_HELP_STRING([--with-android-sdk],
366         [Specify location of the Android SDK. Mandatory when building for Android.]),
369 ANDROID_NDK_HOME=
370 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
371     with_android_ndk="$SRC_ROOT/external/android-ndk"
373 if test -n "$with_android_ndk"; then
374     ANDROID_NDK_HOME=$with_android_ndk
376     # Set up a lot of pre-canned defaults
378     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
379         if test ! -f $ANDROID_NDK_HOME/source.properties; then
380             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
381         fi
382         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
383     else
384         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
385     fi
386     if test -z "$ANDROID_NDK_VERSION";  then
387         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
388     fi
389     case $ANDROID_NDK_VERSION in
390     r9*|r10*)
391         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
392         ;;
393     11.1.*|12.1.*|13.1.*|14.1.*)
394         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
395         ;;
396     16.*)
397         ;;
398     *)
399         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk.])
400         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk."
401         ;;
402     esac
404     ANDROID_API_LEVEL=14
405     android_cpu=$host_cpu
406     ANDROID_ARCH=$android_cpu
407     if test $host_cpu = arm; then
408         android_platform_prefix=$android_cpu-linux-androideabi
409         android_gnu_prefix=$android_platform_prefix
410         LLVM_TRIPLE=armv7-none-linux-androideabi
411         ANDROID_APP_ABI=armeabi-v7a
412         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
413     elif test $host_cpu = aarch64; then
414         android_platform_prefix=$android_cpu-linux-android
415         android_gnu_prefix=$android_platform_prefix
416         LLVM_TRIPLE=aarch64-none-linux-android
417         # minimum android version that supports aarch64
418         ANDROID_API_LEVEL=21
419         ANDROID_APP_ABI=arm64-v8a
420         ANDROID_ARCH=arm64
421     elif test $host_cpu = mips; then
422         android_platform_prefix=mipsel-linux-android
423         android_gnu_prefix=$android_platform_prefix
424         LLVM_TRIPLE=mipsel-none-linux-android
425         ANDROID_APP_ABI=mips
426     else
427         # host_cpu is something like "i386" or "i686" I guess, NDK uses
428         # "x86" in some contexts
429         android_cpu=x86
430         android_platform_prefix=$android_cpu
431         android_gnu_prefix=i686-linux-android
432         LLVM_TRIPLE=i686-none-linux-android
433         ANDROID_APP_ABI=x86
434         ANDROID_ARCH=$android_cpu
435         ANDROIDCFLAGS="-march=atom"
436     fi
438     case "$with_android_ndk_toolchain_version" in
439     clang5.0)
440         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
441         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION
442         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm
443         ;;
444     *)
445         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
446     esac
448     if test ! -d $ANDROID_BINUTILS_DIR; then
449         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
450     elif test ! -d $ANDROID_COMPILER_DIR; then
451         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
452     fi
454     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
455     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
456     # manage to link the (app-specific) single huge .so that is built for the app in
457     # android/source/ if there is debug information in a significant part of the object files.
458     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
459     # all objects have been built with debug information.)
460     case $build_os in
461     linux-gnu*)
462         ndk_build_os=linux
463         ;;
464     darwin*)
465         ndk_build_os=darwin
466         ;;
467     *)
468         AC_MSG_ERROR([We only support building for Android from Linux or OS X])
469         ;;
470     esac
471     ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
472     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
473     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
475     test -z "$SYSBASE" && SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
476     test -z "$AR" && AR=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ar
477     test -z "$NM" && NM=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-nm
478     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-objdump
479     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ranlib
480     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-strip
482     ANDROIDCFLAGS="$ANDROIDCFLAGS -gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT -target $LLVM_TRIPLE$ANDROID_API_LEVEL -no-canonical-prefixes"
483     # android is using different sysroots for compilation and linking, but as
484     # there is no full separation in configure and elsewhere, use isystem for
485     # compilation stuff and sysroot for linking
486     ANDROIDCFLAGS="$ANDROIDCFLAGS -D__ANDROID_API__=$ANDROID_API_LEVEL -isystem $ANDROID_NDK_HOME/sysroot/usr/include"
487     ANDROIDCFLAGS="$ANDROIDCFLAGS -isystem $ANDROID_NDK_HOME/sysroot/usr/include/$android_gnu_prefix"
488     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$SYSBASE -ffunction-sections -fdata-sections -Qunused-arguments"
489     if test "$ANDROID_APP_ABI" = "armeabi-v7a"; then
490     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/libs/$ANDROID_APP_ABI -D_GTHREAD_USE_MUTEX_INIT_FUNC=1"
491     else
492     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/libs/$ANDROID_APP_ABI"
493     fi
494     if test "$ENABLE_LTO" = TRUE; then
495         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
496         # $CC and $CXX when building external libraries
497         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
498     fi
500     if test "$ANDROID_APP_ABI" = "armeabi-v7a"; then
501     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/libs/$ANDROID_APP_ABI/include -std=c++11"
502     else
503     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/include -I$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++abi/include -I$ANDROID_NDK_HOME/sources/android/support/include -std=c++11"
504     fi
506     if test -z "$CC"; then
507         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
508     fi
509     if test -z "$CXX"; then
510         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
511     fi
513     # remember to download the ownCloud Android library later
514     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
516 AC_SUBST(ANDROID_NDK_HOME)
517 AC_SUBST(ANDROID_APP_ABI)
518 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
520 dnl ===================================================================
521 dnl --with-android-sdk
522 dnl ===================================================================
523 ANDROID_SDK_HOME=
524 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
525     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
527 if test -n "$with_android_sdk"; then
528     ANDROID_SDK_HOME=$with_android_sdk
529     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
531 AC_SUBST(ANDROID_SDK_HOME)
533 dnl ===================================================================
534 dnl The following is a list of supported systems.
535 dnl Sequential to keep the logic very simple
536 dnl These values may be checked and reset later.
537 dnl ===================================================================
538 #defaults unless the os test overrides this:
539 test_randr=yes
540 test_xrender=yes
541 test_cups=yes
542 test_dbus=yes
543 test_fontconfig=yes
544 test_cairo=no
546 # Default values, as such probably valid just for Linux, set
547 # differently below just for Mac OSX,but at least better than
548 # hardcoding these as we used to do. Much of this is duplicated also
549 # in solenv for old build system and for gbuild, ideally we should
550 # perhaps define stuff like this only here in configure.ac?
552 LINKFLAGSSHL="-shared"
553 PICSWITCH="-fpic"
554 DLLPOST=".so"
556 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
558 INSTROOTBASESUFFIX=
559 INSTROOTCONTENTSUFFIX=
560 SDKDIRNAME=sdk
562 case "$host_os" in
564 solaris*)
565     test_gtk=yes
566     build_gstreamer_1_0=yes
567     build_gstreamer_0_10=yes
568     test_freetype=yes
569     _os=SunOS
571     dnl ===========================================================
572     dnl Check whether we're using Solaris 10 - SPARC or Intel.
573     dnl ===========================================================
574     AC_MSG_CHECKING([the Solaris operating system release])
575     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
576     if test "$_os_release" -lt "10"; then
577         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
578     else
579         AC_MSG_RESULT([ok ($_os_release)])
580     fi
582     dnl Check whether we're using a SPARC or i386 processor
583     AC_MSG_CHECKING([the processor type])
584     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
585         AC_MSG_RESULT([ok ($host_cpu)])
586     else
587         AC_MSG_ERROR([only SPARC and i386 processors are supported])
588     fi
589     ;;
591 linux-gnu*|k*bsd*-gnu*)
592     test_gtk=yes
593     build_gstreamer_1_0=yes
594     build_gstreamer_0_10=yes
595     test_kde4=yes
596     test_kde5=yes
597     test_qt5=yes
598     test_gtk3_kde5=yes
599     if test "$enable_fuzzers" != yes; then
600         test_freetype=yes
601         test_fontconfig=yes
602     else
603         test_freetype=no
604         test_fontconfig=no
605         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
606     fi
607     _os=Linux
608     ;;
610 gnu)
611     test_randr=no
612     test_xrender=no
613     _os=GNU
614      ;;
616 cygwin*|interix*)
618     # When building on Windows normally with MSVC under Cygwin,
619     # configure thinks that the host platform (the platform the
620     # built code will run on) is Cygwin, even if it obviously is
621     # Windows, which in Autoconf terminology is called
622     # "mingw32". (Which is misleading as MinGW is the name of the
623     # tool-chain, not an operating system.)
625     # Somewhat confusing, yes. But this configure script doesn't
626     # look at $host etc that much, it mostly uses its own $_os
627     # variable, set here in this case statement.
629     test_cups=no
630     test_dbus=no
631     test_randr=no
632     test_xrender=no
633     test_freetype=no
634     test_fontconfig=no
635     _os=WINNT
637     DLLPOST=".dll"
638     LINKFLAGSNOUNDEFS=
639     ;;
641 darwin*) # Mac OS X or iOS
642     test_gtk=yes
643     test_randr=no
644     test_xrender=no
645     test_freetype=no
646     test_fontconfig=no
647     test_dbus=no
648     if test -n "$LODE_HOME" ; then
649         mac_sanitize_path
650         AC_MSG_NOTICE([sanitized the PATH to $PATH])
651     fi
652     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
653         build_for_ios=YES
654         _os=iOS
655         test_gtk=no
656         test_cups=no
657         enable_mpl_subset=yes
658         enable_lotuswordpro=no
659         enable_coinmp=no
660         enable_lpsolve=no
661         enable_postgresql_sdbc=no
662         enable_extension_integration=no
663         enable_report_builder=no
664         with_theme="tango"
665         with_ppds=no
666         if test "$enable_ios_simulator" = "yes"; then
667             host=x86_64-apple-darwin
668         fi
669     else
670         _os=Darwin
671         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
672         INSTROOTCONTENTSUFFIX=/Contents
673         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
674     fi
675     # See comment above the case "$host_os"
676     LINKFLAGSSHL="-dynamiclib -single_module"
678     # -fPIC is default
679     PICSWITCH=""
681     DLLPOST=".dylib"
683     # -undefined error is the default
684     LINKFLAGSNOUNDEFS=""
687 freebsd*)
688     test_gtk=yes
689     build_gstreamer_1_0=yes
690     build_gstreamer_0_10=yes
691     test_kde4=yes
692     test_kde5=yes
693     test_qt5=yes
694     test_gtk3_kde5=yes
695     test_freetype=yes
696     AC_MSG_CHECKING([the FreeBSD operating system release])
697     if test -n "$with_os_version"; then
698         OSVERSION="$with_os_version"
699     else
700         OSVERSION=`/sbin/sysctl -n kern.osreldate`
701     fi
702     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
703     AC_MSG_CHECKING([which thread library to use])
704     if test "$OSVERSION" -lt "500016"; then
705         PTHREAD_CFLAGS="-D_THREAD_SAFE"
706         PTHREAD_LIBS="-pthread"
707     elif test "$OSVERSION" -lt "502102"; then
708         PTHREAD_CFLAGS="-D_THREAD_SAFE"
709         PTHREAD_LIBS="-lc_r"
710     else
711         PTHREAD_CFLAGS=""
712         PTHREAD_LIBS="-pthread"
713     fi
714     AC_MSG_RESULT([$PTHREAD_LIBS])
715     _os=FreeBSD
716     ;;
718 *netbsd*)
719     test_gtk=yes
720     build_gstreamer_1_0=yes
721     build_gstreamer_0_10=yes
722     test_kde4=yes
723     test_kde5=yes
724     test_qt5=yes
725     test_gtk3_kde5=yes
726     test_freetype=yes
727     PTHREAD_LIBS="-pthread -lpthread"
728     _os=NetBSD
729     ;;
731 aix*)
732     test_randr=no
733     test_freetype=yes
734     PTHREAD_LIBS=-pthread
735     _os=AIX
736     ;;
738 openbsd*)
739     test_gtk=yes
740     test_freetype=yes
741     PTHREAD_CFLAGS="-D_THREAD_SAFE"
742     PTHREAD_LIBS="-pthread"
743     _os=OpenBSD
744     ;;
746 dragonfly*)
747     test_gtk=yes
748     build_gstreamer_1_0=yes
749     build_gstreamer_0_10=yes
750     test_kde4=yes
751     test_kde5=yes
752     test_qt5=yes
753     test_gtk3_kde5=yes
754     test_freetype=yes
755     PTHREAD_LIBS="-pthread"
756     _os=DragonFly
757     ;;
759 linux-android*)
760     build_gstreamer_1_0=no
761     build_gstreamer_0_10=no
762     enable_lotuswordpro=no
763     enable_mpl_subset=yes
764     enable_coinmp=yes
765     enable_lpsolve=no
766     enable_report_builder=no
767     enable_odk=no
768     enable_postgresql_sdbc=no
769     enable_python=no
770     with_theme="tango"
771     test_cups=no
772     test_dbus=no
773     test_fontconfig=no
774     test_freetype=no
775     test_gtk=no
776     test_kde4=no
777     test_kde5=no
778     test_qt5=no
779     test_gtk3_kde5=no
780     test_randr=no
781     test_xrender=no
782     _os=Android
784     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
785     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
786     ;;
788 haiku*)
789     test_cups=no
790     test_dbus=no
791     test_randr=no
792     test_xrender=no
793     test_freetype=yes
794     enable_java=no
795     enable_opengl=no
796     enable_odk=no
797     enable_gconf=no
798     enable_gnome_vfs=no
799     enable_gstreamer=no
800     enable_vlc=no
801     enable_gltf=no
802     enable_collada=no
803     enable_coinmp=no
804     enable_pdfium=no
805     enable_postgresql_sdbc=no
806     enable_firebird_sdbc=no
807     _os=Haiku
808     ;;
811     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
812     ;;
813 esac
815 if test "$_os" = "Android" ; then
816     # Verify that the NDK and SDK options are proper
817     if test -z "$with_android_ndk"; then
818         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
819     elif test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
820         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
821     fi
823     if test -z "$ANDROID_SDK_HOME"; then
824         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
825     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
826         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
827     fi
829     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
830     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
831         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
832                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
833                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
834         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
835         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
836         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
837     fi
838     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
839         AC_MSG_WARN([android support repository not found - install with
840                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
841                      to allow the build to download the specified version of the android support libraries])
842         add_warning "android support repository not found - install with"
843         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
844         add_warning "to allow the build to download the specified version of the android support libraries"
845     fi
848 if test "$_os" = "AIX"; then
849     AC_PATH_PROG(GAWK, gawk)
850     if test -z "$GAWK"; then
851         AC_MSG_ERROR([gawk not found in \$PATH])
852     fi
855 AC_SUBST(SDKDIRNAME)
857 AC_SUBST(PTHREAD_CFLAGS)
858 AC_SUBST(PTHREAD_LIBS)
860 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
861 # By default use the ones specified by our build system,
862 # but explicit override is possible.
863 AC_MSG_CHECKING(for explicit AFLAGS)
864 if test -n "$AFLAGS"; then
865     AC_MSG_RESULT([$AFLAGS])
866     x_AFLAGS=
867 else
868     AC_MSG_RESULT(no)
869     x_AFLAGS=[\#]
871 AC_MSG_CHECKING(for explicit CFLAGS)
872 if test -n "$CFLAGS"; then
873     AC_MSG_RESULT([$CFLAGS])
874     x_CFLAGS=
875 else
876     AC_MSG_RESULT(no)
877     x_CFLAGS=[\#]
879 AC_MSG_CHECKING(for explicit CXXFLAGS)
880 if test -n "$CXXFLAGS"; then
881     AC_MSG_RESULT([$CXXFLAGS])
882     x_CXXFLAGS=
883 else
884     AC_MSG_RESULT(no)
885     x_CXXFLAGS=[\#]
887 AC_MSG_CHECKING(for explicit OBJCFLAGS)
888 if test -n "$OBJCFLAGS"; then
889     AC_MSG_RESULT([$OBJCFLAGS])
890     x_OBJCFLAGS=
891 else
892     AC_MSG_RESULT(no)
893     x_OBJCFLAGS=[\#]
895 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
896 if test -n "$OBJCXXFLAGS"; then
897     AC_MSG_RESULT([$OBJCXXFLAGS])
898     x_OBJCXXFLAGS=
899 else
900     AC_MSG_RESULT(no)
901     x_OBJCXXFLAGS=[\#]
903 AC_MSG_CHECKING(for explicit LDFLAGS)
904 if test -n "$LDFLAGS"; then
905     AC_MSG_RESULT([$LDFLAGS])
906     x_LDFLAGS=
907 else
908     AC_MSG_RESULT(no)
909     x_LDFLAGS=[\#]
911 AC_SUBST(AFLAGS)
912 AC_SUBST(CFLAGS)
913 AC_SUBST(CXXFLAGS)
914 AC_SUBST(OBJCFLAGS)
915 AC_SUBST(OBJCXXFLAGS)
916 AC_SUBST(LDFLAGS)
917 AC_SUBST(x_AFLAGS)
918 AC_SUBST(x_CFLAGS)
919 AC_SUBST(x_CXXFLAGS)
920 AC_SUBST(x_OBJCFLAGS)
921 AC_SUBST(x_OBJCXXFLAGS)
922 AC_SUBST(x_LDFLAGS)
924 dnl These are potentially set for MSVC, in the code checking for UCRT below:
925 my_original_CFLAGS=$CFLAGS
926 my_original_CXXFLAGS=$CXXFLAGS
927 my_original_CPPFLAGS=$CPPFLAGS
929 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
930 dnl Needs to precede the AC_SEARCH_LIBS call below, which apparently calls
931 dnl AC_PROG_CC internally.
932 if test "$_os" != "WINNT"; then
933     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
934     save_CFLAGS=$CFLAGS
935     AC_PROG_CC
936     CFLAGS=$save_CFLAGS
939 if test $_os != "WINNT"; then
940     save_LIBS="$LIBS"
941     AC_SEARCH_LIBS([dlsym], [dl],
942         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
943         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
944     LIBS="$save_LIBS"
946 AC_SUBST(DLOPEN_LIBS)
948 ###############################################################################
949 # Extensions switches --enable/--disable
950 ###############################################################################
951 # By default these should be enabled unless having extra dependencies.
952 # If there is extra dependency over configure options then the enable should
953 # be automagic based on whether the requiring feature is enabled or not.
954 # All this options change anything only with --enable-extension-integration.
956 # The name of this option and its help string makes it sound as if
957 # extensions are built anyway, just not integrated in the installer,
958 # if you use --disable-extension-integration. Is that really the
959 # case?
961 AC_ARG_ENABLE(ios-simulator,
962     AS_HELP_STRING([--enable-ios-simulator],
963         [build i386 or x86_64 for ios simulator])
966 libo_FUZZ_ARG_ENABLE(extension-integration,
967     AS_HELP_STRING([--disable-extension-integration],
968         [Disable integration of the built extensions in the installer of the
969          product. Use this switch to disable the integration.])
972 AC_ARG_ENABLE(avmedia,
973     AS_HELP_STRING([--disable-avmedia],
974         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
977 AC_ARG_ENABLE(database-connectivity,
978     AS_HELP_STRING([--disable-database-connectivity],
979         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
982 # This doesn't mean not building (or "integrating") extensions
983 # (although it probably should; i.e. it should imply
984 # --disable-extension-integration I guess), it means not supporting
985 # any extension mechanism at all
986 libo_FUZZ_ARG_ENABLE(extensions,
987     AS_HELP_STRING([--disable-extensions],
988         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
991 AC_ARG_ENABLE(scripting,
992     AS_HELP_STRING([--disable-scripting],
993         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
996 # This is mainly for Android and iOS, but could potentially be used in some
997 # special case otherwise, too, so factored out as a separate setting
999 AC_ARG_ENABLE(dynamic-loading,
1000     AS_HELP_STRING([--disable-dynamic-loading],
1001         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1004 libo_FUZZ_ARG_ENABLE(ext-mariadb-connector,
1005     AS_HELP_STRING([--enable-ext-mariadb-connector],
1006         [Enable the build of the MariaDB/MySQL Connector extension.])
1009 libo_FUZZ_ARG_ENABLE(report-builder,
1010     AS_HELP_STRING([--disable-report-builder],
1011         [Disable the Report Builder.])
1014 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1015     AS_HELP_STRING([--enable-ext-wiki-publisher],
1016         [Enable the Wiki Publisher extension.])
1019 libo_FUZZ_ARG_ENABLE(lpsolve,
1020     AS_HELP_STRING([--disable-lpsolve],
1021         [Disable compilation of the lp solve solver ])
1023 libo_FUZZ_ARG_ENABLE(coinmp,
1024     AS_HELP_STRING([--disable-coinmp],
1025         [Disable compilation of the CoinMP solver ])
1028 libo_FUZZ_ARG_ENABLE(pdfimport,
1029     AS_HELP_STRING([--disable-pdfimport],
1030         [Disable building the PDF import feature.])
1033 libo_FUZZ_ARG_ENABLE(pdfium,
1034     AS_HELP_STRING([--disable-pdfium],
1035         [Disable building PDFium.])
1038 ###############################################################################
1040 dnl ---------- *** ----------
1042 libo_FUZZ_ARG_ENABLE(mergelibs,
1043     AS_HELP_STRING([--enable-mergelibs],
1044         [Merge several of the smaller libraries into one big, "merged", one.])
1047 libo_FUZZ_ARG_ENABLE(breakpad,
1048     AS_HELP_STRING([--enable-breakpad],
1049         [Enables breakpad for crash reporting.])
1052 AC_ARG_ENABLE(fetch-external,
1053     AS_HELP_STRING([--disable-fetch-external],
1054         [Disables fetching external tarballs from web sources.])
1057 AC_ARG_ENABLE(fuzzers,
1058     AS_HELP_STRING([--enable-fuzzers],
1059         [Enables building libfuzzer targets for fuzz testing.])
1062 libo_FUZZ_ARG_ENABLE(pch,
1063     AS_HELP_STRING([--enable-pch],
1064         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1067 libo_FUZZ_ARG_ENABLE(epm,
1068     AS_HELP_STRING([--enable-epm],
1069         [LibreOffice includes self-packaging code, that requires epm, however epm is
1070          useless for large scale package building.])
1073 libo_FUZZ_ARG_ENABLE(odk,
1074     AS_HELP_STRING([--disable-odk],
1075         [LibreOffice includes an ODK, office development kit which some packagers may
1076          wish to build without.])
1079 AC_ARG_ENABLE(mpl-subset,
1080     AS_HELP_STRING([--enable-mpl-subset],
1081         [Don't compile any pieces which are not MPL or more liberally licensed])
1084 libo_FUZZ_ARG_ENABLE(evolution2,
1085     AS_HELP_STRING([--enable-evolution2],
1086         [Allows the built-in evolution 2 addressbook connectivity build to be
1087          enabled.])
1090 AC_ARG_ENABLE(avahi,
1091     AS_HELP_STRING([--enable-avahi],
1092         [Determines whether to use Avahi to advertise Impress to remote controls.])
1095 libo_FUZZ_ARG_ENABLE(werror,
1096     AS_HELP_STRING([--enable-werror],
1097         [Turn warnings to errors. (Has no effect in modules where the treating
1098          of warnings as errors is disabled explicitly.)]),
1101 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1102     AS_HELP_STRING([--enable-assert-always-abort],
1103         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1106 libo_FUZZ_ARG_ENABLE(dbgutil,
1107     AS_HELP_STRING([--enable-dbgutil],
1108         [Provide debugging support from --enable-debug and include additional debugging
1109          utilities such as object counting or more expensive checks.
1110          This is the recommended option for developers.
1111          Note that this makes the build ABI incompatible, it is not possible to mix object
1112          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1114 libo_FUZZ_ARG_ENABLE(debug,
1115     AS_HELP_STRING([--enable-debug],
1116         [Include debugging information, disable compiler optimization and inlining plus
1117          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1119 libo_FUZZ_ARG_ENABLE(sal-log,
1120     AS_HELP_STRING([--enable-sal-log],
1121         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1123 AC_ARG_ENABLE(selective-debuginfo,
1124     AS_HELP_STRING([--enable-selective-debuginfo],
1125         [If --enable-debug or --enable-dbgutil is used, build debugging information
1126          (-g compiler flag) only for the specified gbuild build targets
1127          (where all means everything, - prepended means not to enable, / appended means
1128          everything in the directory; there is no ordering, more specific overrides
1129          more general, and disabling takes precedence).
1130          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1132 libo_FUZZ_ARG_ENABLE(symbols,
1133     AS_HELP_STRING([--enable-symbols],
1134         [Generate debug information.
1135          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1136          otherwise.]))
1138 libo_FUZZ_ARG_ENABLE(optimized,
1139     AS_HELP_STRING([--disable-optimized],
1140         [Whether to compile with optimization flags.
1141          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1142          otherwise.]))
1144 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1145     AS_HELP_STRING([--disable-runtime-optimizations],
1146         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1147          JVM JIT) that are known to interact badly with certain dynamic analysis
1148          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1149          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1150          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1152 AC_ARG_WITH(valgrind,
1153     AS_HELP_STRING([--with-valgrind],
1154         [Make availability of Valgrind headers a hard requirement.]))
1156 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1157     AS_HELP_STRING([--enable-compiler-plugins],
1158         [Enable compiler plugins that will perform additional checks during
1159          building. Enabled automatically by --enable-dbgutil.
1160          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1161 COMPILER_PLUGINS_DEBUG=
1162 if test "$enable_compiler_plugins" = debug; then
1163     enable_compiler_plugins=yes
1164     COMPILER_PLUGINS_DEBUG=TRUE
1167 libo_FUZZ_ARG_ENABLE(ooenv,
1168     AS_HELP_STRING([--disable-ooenv],
1169         [Disable ooenv for the instdir installation.]))
1171 libo_FUZZ_ARG_ENABLE(libnumbertext,
1172     AS_HELP_STRING([--disable-libnumbertext],
1173         [Disable use of numbertext external library.]))
1175 AC_ARG_ENABLE(lto,
1176     AS_HELP_STRING([--enable-lto],
1177         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1178          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1179          linker. For MSVC, this option is broken at the moment. This is experimental work
1180          in progress that shouldn't be used unless you are working on it.)]))
1182 AC_ARG_ENABLE(python,
1183     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1184         [Enables or disables Python support at run-time.
1185          Also specifies what Python to use. 'auto' is the default.
1186          'fully-internal' even forces the internal version for uses of Python
1187          during the build.]))
1189 libo_FUZZ_ARG_ENABLE(gtk,
1190     AS_HELP_STRING([--disable-gtk],
1191         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1192 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1194 libo_FUZZ_ARG_ENABLE(gtk3,
1195     AS_HELP_STRING([--disable-gtk3],
1196         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1197 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1199 AC_ARG_ENABLE(split-app-modules,
1200     AS_HELP_STRING([--enable-split-app-modules],
1201         [Split file lists for app modules, e.g. base, calc.
1202          Has effect only with make distro-pack-install]),
1205 AC_ARG_ENABLE(split-opt-features,
1206     AS_HELP_STRING([--enable-split-opt-features],
1207         [Split file lists for some optional features, e.g. pyuno, testtool.
1208          Has effect only with make distro-pack-install]),
1211 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1212     AS_HELP_STRING([--disable-cairo-canvas],
1213         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1216 libo_FUZZ_ARG_ENABLE(dbus,
1217     AS_HELP_STRING([--disable-dbus],
1218         [Determines whether to enable features that depend on dbus.
1219          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1220 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1222 libo_FUZZ_ARG_ENABLE(sdremote,
1223     AS_HELP_STRING([--disable-sdremote],
1224         [Determines whether to enable Impress remote control (i.e. the server component).]),
1225 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1227 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1228     AS_HELP_STRING([--disable-sdremote-bluetooth],
1229         [Determines whether to build sdremote with bluetooth support.
1230          Requires dbus on Linux.]))
1232 libo_FUZZ_ARG_ENABLE(gio,
1233     AS_HELP_STRING([--disable-gio],
1234         [Determines whether to use the GIO support.]),
1235 ,test "${enable_gio+set}" = set || enable_gio=yes)
1237 AC_ARG_ENABLE(kde4,
1238     AS_HELP_STRING([--enable-kde4],
1239         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1240          KDE4 are available.]),
1243 AC_ARG_ENABLE(qt5,
1244     AS_HELP_STRING([--enable-qt5],
1245         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1246          available.]),
1249 AC_ARG_ENABLE(kde5,
1250     AS_HELP_STRING([--enable-kde5],
1251         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1252          KF5 are available.]),
1255 AC_ARG_ENABLE(gtk3_kde5,
1256     AS_HELP_STRING([--enable-gtk3-kde5],
1257         [Determines whether to use Gtk3 vclplug with KDE file dialogs on
1258          platforms where Gtk3, Qt5 and Plasma is available.]),
1261 libo_FUZZ_ARG_ENABLE(gui,
1262     AS_HELP_STRING([--disable-gui],
1263         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1264          command-line option. Not related to LibreOffice Online functionality. Don't use
1265          unless you are certain you need to. Nobody will help you if you insist on trying
1266          this and run into problems.]),
1267 ,test "${enable_gui+set}" = set || enable_gui=yes)
1269 libo_FUZZ_ARG_ENABLE(randr,
1270     AS_HELP_STRING([--disable-randr],
1271         [Disable RandR support in the vcl project.]),
1272 ,test "${enable_randr+set}" = set || enable_randr=yes)
1274 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1275     AS_HELP_STRING([--disable-gstreamer-1-0],
1276         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1277 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1279 AC_ARG_ENABLE(gstreamer-0-10,
1280     AS_HELP_STRING([--enable-gstreamer-0-10],
1281         [Enable building with the gstreamer 0.10 avmedia backend.]),
1282 ,enable_gstreamer_0_10=no)
1284 libo_FUZZ_ARG_ENABLE(vlc,
1285     AS_HELP_STRING([--enable-vlc],
1286         [Enable building with the (experimental) VLC avmedia backend.]),
1287 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1289 libo_FUZZ_ARG_ENABLE(neon,
1290     AS_HELP_STRING([--disable-neon],
1291         [Disable neon and the compilation of webdav binding.]),
1294 libo_FUZZ_ARG_ENABLE([eot],
1295     [AS_HELP_STRING([--enable-eot],
1296         [Enable support for Embedded OpenType fonts.])],
1297 ,test "${enable_eot+set}" = set || enable_eot=no)
1299 libo_FUZZ_ARG_ENABLE(cve-tests,
1300     AS_HELP_STRING([--disable-cve-tests],
1301         [Prevent CVE tests to be executed]),
1304 libo_FUZZ_ARG_ENABLE(chart-tests,
1305     AS_HELP_STRING([--enable-chart-tests],
1306         [Executes chart XShape tests. In a perfect world these tests would be
1307          stable and everyone could run them, in reality it is best to run them
1308          only on a few machines that are known to work and maintained by people
1309          who can judge if a test failure is a regression or not.]),
1312 AC_ARG_ENABLE(build-unowinreg,
1313     AS_HELP_STRING([--enable-build-unowinreg],
1314         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1315          compiler is needed on Linux.]),
1318 AC_ARG_ENABLE(build-opensymbol,
1319     AS_HELP_STRING([--enable-build-opensymbol],
1320         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1321          fontforge installed.]),
1324 AC_ARG_ENABLE(dependency-tracking,
1325     AS_HELP_STRING([--enable-dependency-tracking],
1326         [Do not reject slow dependency extractors.])[
1327   --disable-dependency-tracking
1328                           Disables generation of dependency information.
1329                           Speed up one-time builds.],
1332 AC_ARG_ENABLE(icecream,
1333     AS_HELP_STRING([--enable-icecream],
1334         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1335          It defaults to /opt/icecream for the location of the icecream gcc/g++
1336          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1339 libo_FUZZ_ARG_ENABLE(cups,
1340     AS_HELP_STRING([--disable-cups],
1341         [Do not build cups support.])
1344 AC_ARG_ENABLE(ccache,
1345     AS_HELP_STRING([--disable-ccache],
1346         [Do not try to use ccache automatically.
1347          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1348          CC/CXX are not yet set, and --enable-icecream is not given, we
1349          attempt to use ccache. --disable-ccache disables ccache completely.
1353 AC_ARG_ENABLE(64-bit,
1354     AS_HELP_STRING([--enable-64-bit],
1355         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1356          At the moment meaningful only for Windows.]), ,)
1358 libo_FUZZ_ARG_ENABLE(online-update,
1359     AS_HELP_STRING([--enable-online-update],
1360         [Enable the online update service that will check for new versions of
1361          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1362          If the value is "mar", the experimental Mozilla-like update will be
1363          enabled instead of the traditional update mechanism.]),
1366 AC_ARG_WITH(update-config,
1367     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1368                    [Path to the update config ini file]))
1370 libo_FUZZ_ARG_ENABLE(extension-update,
1371     AS_HELP_STRING([--disable-extension-update],
1372         [Disable possibility to update installed extensions.]),
1375 libo_FUZZ_ARG_ENABLE(release-build,
1376     AS_HELP_STRING([--enable-release-build],
1377         [Enable release build. Note that the "release build" choice is orthogonal to
1378          whether symbols are present, debug info is generated, or optimization
1379          is done.
1380          See http://wiki.documentfoundation.org/Development/DevBuild]),
1383 AC_ARG_ENABLE(windows-build-signing,
1384     AS_HELP_STRING([--enable-windows-build-signing],
1385         [Enable signing of windows binaries (*.exe, *.dll)]),
1388 AC_ARG_ENABLE(silent-msi,
1389     AS_HELP_STRING([--enable-silent-msi],
1390         [Enable MSI with LIMITUI=1 (silent install).]),
1393 AC_ARG_ENABLE(macosx-code-signing,
1394     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1395         [Sign executables, dylibs, frameworks and the app bundle. If you
1396          don't provide an identity the first suitable certificate
1397          in your keychain is used.]),
1400 AC_ARG_ENABLE(macosx-package-signing,
1401     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1402         [Create a .pkg suitable for uploading to the Mac App Store and sign
1403          it. If you don't provide an identity the first suitable certificate
1404          in your keychain is used.]),
1407 AC_ARG_ENABLE(macosx-sandbox,
1408     AS_HELP_STRING([--enable-macosx-sandbox],
1409         [Make the app bundle run in a sandbox. Requires code signing.
1410          Is required by apps distributed in the Mac App Store, and implies
1411          adherence to App Store rules.]),
1414 AC_ARG_WITH(macosx-bundle-identifier,
1415     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1416         [Define the OS X bundle identifier. Default is the somewhat weird
1417          org.libreoffice.script ("script", huh?).]),
1418 ,with_macosx_bundle_identifier=org.libreoffice.script)
1420 AC_ARG_WITH(product-name,
1421     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1422         [Define the product name. Default is AC_PACKAGE_NAME.]),
1423 ,with_product_name=$PRODUCTNAME)
1425 AC_ARG_WITH(package-version,
1426     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1427         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1430 libo_FUZZ_ARG_ENABLE(readonly-installset,
1431     AS_HELP_STRING([--enable-readonly-installset],
1432         [Prevents any attempts by LibreOffice to write into its installation. That means
1433          at least that no "system-wide" extensions can be added. Partly experimental work in
1434          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1437 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1438     AS_HELP_STRING([--disable-postgresql-sdbc],
1439         [Disable the build of the PostgreSQL-SDBC driver.])
1442 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1443     AS_HELP_STRING([--disable-lotuswordpro],
1444         [Disable the build of the Lotus Word Pro filter.]),
1445 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1447 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1448     AS_HELP_STRING([--disable-firebird-sdbc],
1449         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1450 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1452 AC_ARG_ENABLE(bogus-pkg-config,
1453     AS_HELP_STRING([--enable-bogus-pkg-config],
1454         [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.]),
1457 AC_ARG_ENABLE(openssl,
1458     AS_HELP_STRING([--disable-openssl],
1459         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1460          components will either use GNUTLS or NSS. Work in progress,
1461          use only if you are hacking on it.]),
1462 ,enable_openssl=yes)
1464 AC_ARG_ENABLE(library-bin-tar,
1465     AS_HELP_STRING([--enable-library-bin-tar],
1466         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1467         Some libraries can save their build result in a tarball
1468         stored in TARFILE_LOCATION. That binary tarball is
1469         uniquely identified by the source tarball,
1470         the content of the config_host.mk file and the content
1471         of the top-level directory in core for that library
1472         If this option is enabled, then if such a tarfile exist, it will be untarred
1473         instead of the source tarfile, and the build step will be skipped for that
1474         library.
1475         If a proper tarfile does not exist, then the normal source-based
1476         build is done for that library and a proper binary tarfile is created
1477         for the next time.]),
1480 AC_ARG_ENABLE(dconf,
1481     AS_HELP_STRING([--disable-dconf],
1482         [Disable the dconf configuration backend (enabled by default where
1483          available).]))
1485 libo_FUZZ_ARG_ENABLE(formula-logger,
1486     AS_HELP_STRING(
1487         [--enable-formula-logger],
1488         [Enable formula logger for logging formula calculation flow in Calc.]
1489     )
1492 dnl ===================================================================
1493 dnl Optional Packages (--with/without-)
1494 dnl ===================================================================
1496 AC_ARG_WITH(gcc-home,
1497     AS_HELP_STRING([--with-gcc-home],
1498         [Specify the location of gcc/g++ manually. This can be used in conjunction
1499          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1500          non-default path.]),
1503 AC_ARG_WITH(gnu-patch,
1504     AS_HELP_STRING([--with-gnu-patch],
1505         [Specify location of GNU patch on Solaris or FreeBSD.]),
1508 AC_ARG_WITH(build-platform-configure-options,
1509     AS_HELP_STRING([--with-build-platform-configure-options],
1510         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1513 AC_ARG_WITH(gnu-cp,
1514     AS_HELP_STRING([--with-gnu-cp],
1515         [Specify location of GNU cp on Solaris or FreeBSD.]),
1518 AC_ARG_WITH(external-tar,
1519     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1520         [Specify an absolute path of where to find (and store) tarfiles.]),
1521     TARFILE_LOCATION=$withval ,
1524 AC_ARG_WITH(referenced-git,
1525     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1526         [Specify another checkout directory to reference. This makes use of
1527                  git submodule update --reference, and saves a lot of diskspace
1528                  when having multiple trees side-by-side.]),
1529     GIT_REFERENCE_SRC=$withval ,
1532 AC_ARG_WITH(linked-git,
1533     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1534         [Specify a directory where the repositories of submodules are located.
1535          This uses a method similar to git-new-workdir to get submodules.]),
1536     GIT_LINK_SRC=$withval ,
1539 AC_ARG_WITH(galleries,
1540     AS_HELP_STRING([--with-galleries],
1541         [Specify how galleries should be built. It is possible either to
1542          build these internally from source ("build"),
1543          or to disable them ("no")]),
1546 AC_ARG_WITH(theme,
1547     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1548         [Choose which themes to include. By default those themes with an '*' are included.
1549          Possible choices: *breeze, *breeze_dark, *colibre, *elementary, *karasa_jaga, *sifr, *sifr_dark, *tango.]),
1552 libo_FUZZ_ARG_WITH(helppack-integration,
1553     AS_HELP_STRING([--without-helppack-integration],
1554         [It will not integrate the helppacks to the installer
1555          of the product. Please use this switch to use the online help
1556          or separate help packages.]),
1559 libo_FUZZ_ARG_WITH(fonts,
1560     AS_HELP_STRING([--without-fonts],
1561         [LibreOffice includes some third-party fonts to provide a reliable basis for
1562          help content, templates, samples, etc. When these fonts are already
1563          known to be available on the system then you should use this option.]),
1566 AC_ARG_WITH(epm,
1567     AS_HELP_STRING([--with-epm],
1568         [Decides which epm to use. Default is to use the one from the system if
1569          one is built. When either this is not there or you say =internal epm
1570          will be built.]),
1573 AC_ARG_WITH(package-format,
1574     AS_HELP_STRING([--with-package-format],
1575         [Specify package format(s) for LibreOffice installation sets. The
1576          implicit --without-package-format leads to no installation sets being
1577          generated. Possible values: aix, archive, bsd, deb, dmg,
1578          installed, msi, pkg, and rpm.
1579          Example: --with-package-format='deb rpm']),
1582 AC_ARG_WITH(tls,
1583     AS_HELP_STRING([--with-tls],
1584         [Decides which TLS/SSL and cryptographic implementations to use for
1585          LibreOffice's code. Notice that this doesn't apply for depending
1586          libraries like "neon", for example. Default is to use OpenSSL
1587          although NSS is also possible. Notice that selecting NSS restricts
1588          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1589          restrict by now the usage of NSS in LO's code. Possible values:
1590          openssl, nss. Example: --with-tls="nss"]),
1593 AC_ARG_WITH(system-libs,
1594     AS_HELP_STRING([--with-system-libs],
1595         [Use libraries already on system -- enables all --with-system-* flags.]),
1598 AC_ARG_WITH(system-bzip2,
1599     AS_HELP_STRING([--with-system-bzip2],
1600         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1601     [with_system_bzip2="$with_system_libs"])
1603 AC_ARG_WITH(system-headers,
1604     AS_HELP_STRING([--with-system-headers],
1605         [Use headers already on system -- enables all --with-system-* flags for
1606          external packages whose headers are the only entities used i.e.
1607          boost/odbc/sane-header(s).]),,
1608     [with_system_headers="$with_system_libs"])
1610 AC_ARG_WITH(system-jars,
1611     AS_HELP_STRING([--without-system-jars],
1612         [When building with --with-system-libs, also the needed jars are expected
1613          on the system. Use this to disable that]),,
1614     [with_system_jars="$with_system_libs"])
1616 AC_ARG_WITH(system-cairo,
1617     AS_HELP_STRING([--with-system-cairo],
1618         [Use cairo libraries already on system.  Happens automatically for
1619          (implicit) --enable-gtk and for --enable-gtk3.]))
1621 AC_ARG_WITH(system-epoxy,
1622     AS_HELP_STRING([--with-system-epoxy],
1623         [Use epoxy libraries already on system.  Happens automatically for
1624          --enable-gtk3.]),,
1625        [with_system_epoxy="$with_system_libs"])
1627 AC_ARG_WITH(myspell-dicts,
1628     AS_HELP_STRING([--with-myspell-dicts],
1629         [Adds myspell dictionaries to the LibreOffice installation set]),
1632 AC_ARG_WITH(system-dicts,
1633     AS_HELP_STRING([--without-system-dicts],
1634         [Do not use dictionaries from system paths.]),
1637 AC_ARG_WITH(external-dict-dir,
1638     AS_HELP_STRING([--with-external-dict-dir],
1639         [Specify external dictionary dir.]),
1642 AC_ARG_WITH(external-hyph-dir,
1643     AS_HELP_STRING([--with-external-hyph-dir],
1644         [Specify external hyphenation pattern dir.]),
1647 AC_ARG_WITH(external-thes-dir,
1648     AS_HELP_STRING([--with-external-thes-dir],
1649         [Specify external thesaurus dir.]),
1652 AC_ARG_WITH(system-zlib,
1653     AS_HELP_STRING([--with-system-zlib],
1654         [Use zlib already on system.]),,
1655     [with_system_zlib=auto])
1657 AC_ARG_WITH(system-jpeg,
1658     AS_HELP_STRING([--with-system-jpeg],
1659         [Use jpeg already on system.]),,
1660     [with_system_jpeg="$with_system_libs"])
1662 AC_ARG_WITH(system-clucene,
1663     AS_HELP_STRING([--with-system-clucene],
1664         [Use clucene already on system.]),,
1665     [with_system_clucene="$with_system_libs"])
1667 AC_ARG_WITH(system-expat,
1668     AS_HELP_STRING([--with-system-expat],
1669         [Use expat already on system.]),,
1670     [with_system_expat="$with_system_libs"])
1672 AC_ARG_WITH(system-libxml,
1673     AS_HELP_STRING([--with-system-libxml],
1674         [Use libxml/libxslt already on system.]),,
1675     [with_system_libxml=auto])
1677 AC_ARG_WITH(system-icu,
1678     AS_HELP_STRING([--with-system-icu],
1679         [Use icu already on system.]),,
1680     [with_system_icu="$with_system_libs"])
1682 AC_ARG_WITH(system-ucpp,
1683     AS_HELP_STRING([--with-system-ucpp],
1684         [Use ucpp already on system.]),,
1685     [])
1687 AC_ARG_WITH(system-openldap,
1688     AS_HELP_STRING([--with-system-openldap],
1689         [Use the OpenLDAP LDAP SDK already on system.]),,
1690     [with_system_openldap="$with_system_libs"])
1692 AC_ARG_WITH(system-poppler,
1693     AS_HELP_STRING([--with-system-poppler],
1694         [Use system poppler (only needed for PDF import).]),,
1695     [with_system_poppler="$with_system_libs"])
1697 AC_ARG_WITH(system-gpgmepp,
1698     AS_HELP_STRING([--with-system-gpgmepp],
1699         [Use gpgmepp already on system]),,
1700     [with_system_gpgmepp="$with_system_libs"])
1702 AC_ARG_WITH(system-apache-commons,
1703     AS_HELP_STRING([--with-system-apache-commons],
1704         [Use Apache commons libraries already on system.]),,
1705     [with_system_apache_commons="$with_system_jars"])
1707 AC_ARG_WITH(system-mariadb,
1708     AS_HELP_STRING([--with-system-mariadb],
1709         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1710          extension.]),,
1711     [with_system_mariadb="$with_system_libs"])
1713 AC_ARG_ENABLE(bundle-mariadb,
1714     AS_HELP_STRING([--enable-bundle-mariadb],
1715         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1718 AC_ARG_WITH(system-mysql-cppconn,
1719     AS_HELP_STRING([--with-system-mysql-cppconn],
1720         [Use MySQL C++ Connector libraries already on system.]),,
1721     [with_system_mysql_cppconn="$with_system_libs"])
1723 AC_ARG_WITH(system-postgresql,
1724     AS_HELP_STRING([--with-system-postgresql],
1725         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1726          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1727     [with_system_postgresql="$with_system_libs"])
1729 AC_ARG_WITH(libpq-path,
1730     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1731         [Use this PostgreSQL C interface (libpq) installation for building
1732          the PostgreSQL-SDBC extension.]),
1735 AC_ARG_WITH(system-firebird,
1736     AS_HELP_STRING([--with-system-firebird],
1737         [Use Firebird libraries already on system, for building the Firebird-SDBC
1738          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1739     [with_system_firebird="$with_system_libs"])
1741 AC_ARG_WITH(system-libtommath,
1742             AS_HELP_STRING([--with-system-libtommath],
1743                            [Use libtommath already on system]),,
1744             [with_system_libtommath="$with_system_libs"])
1746 AC_ARG_WITH(system-hsqldb,
1747     AS_HELP_STRING([--with-system-hsqldb],
1748         [Use hsqldb already on system.]))
1750 AC_ARG_WITH(hsqldb-jar,
1751     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1752         [Specify path to jarfile manually.]),
1753     HSQLDB_JAR=$withval)
1755 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1756     AS_HELP_STRING([--disable-scripting-beanshell],
1757         [Disable support for scripts in BeanShell.]),
1761 AC_ARG_WITH(system-beanshell,
1762     AS_HELP_STRING([--with-system-beanshell],
1763         [Use beanshell already on system.]),,
1764     [with_system_beanshell="$with_system_jars"])
1766 AC_ARG_WITH(beanshell-jar,
1767     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1768         [Specify path to jarfile manually.]),
1769     BSH_JAR=$withval)
1771 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1772     AS_HELP_STRING([--disable-scripting-javascript],
1773         [Disable support for scripts in JavaScript.]),
1777 AC_ARG_WITH(system-rhino,
1778     AS_HELP_STRING([--with-system-rhino],
1779         [Use rhino already on system.]),,)
1780 #    [with_system_rhino="$with_system_jars"])
1781 # Above is not used as we have different debug interface
1782 # patched into internal rhino. This code needs to be fixed
1783 # before we can enable it by default.
1785 AC_ARG_WITH(rhino-jar,
1786     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1787         [Specify path to jarfile manually.]),
1788     RHINO_JAR=$withval)
1790 AC_ARG_WITH(commons-logging-jar,
1791     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1792         [Specify path to jarfile manually.]),
1793     COMMONS_LOGGING_JAR=$withval)
1795 AC_ARG_WITH(system-jfreereport,
1796     AS_HELP_STRING([--with-system-jfreereport],
1797         [Use JFreeReport already on system.]),,
1798     [with_system_jfreereport="$with_system_jars"])
1800 AC_ARG_WITH(sac-jar,
1801     AS_HELP_STRING([--with-sac-jar=JARFILE],
1802         [Specify path to jarfile manually.]),
1803     SAC_JAR=$withval)
1805 AC_ARG_WITH(libxml-jar,
1806     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1807         [Specify path to jarfile manually.]),
1808     LIBXML_JAR=$withval)
1810 AC_ARG_WITH(flute-jar,
1811     AS_HELP_STRING([--with-flute-jar=JARFILE],
1812         [Specify path to jarfile manually.]),
1813     FLUTE_JAR=$withval)
1815 AC_ARG_WITH(jfreereport-jar,
1816     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1817         [Specify path to jarfile manually.]),
1818     JFREEREPORT_JAR=$withval)
1820 AC_ARG_WITH(liblayout-jar,
1821     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1822         [Specify path to jarfile manually.]),
1823     LIBLAYOUT_JAR=$withval)
1825 AC_ARG_WITH(libloader-jar,
1826     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1827         [Specify path to jarfile manually.]),
1828     LIBLOADER_JAR=$withval)
1830 AC_ARG_WITH(libformula-jar,
1831     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1832         [Specify path to jarfile manually.]),
1833     LIBFORMULA_JAR=$withval)
1835 AC_ARG_WITH(librepository-jar,
1836     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1837         [Specify path to jarfile manually.]),
1838     LIBREPOSITORY_JAR=$withval)
1840 AC_ARG_WITH(libfonts-jar,
1841     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1842         [Specify path to jarfile manually.]),
1843     LIBFONTS_JAR=$withval)
1845 AC_ARG_WITH(libserializer-jar,
1846     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1847         [Specify path to jarfile manually.]),
1848     LIBSERIALIZER_JAR=$withval)
1850 AC_ARG_WITH(libbase-jar,
1851     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1852         [Specify path to jarfile manually.]),
1853     LIBBASE_JAR=$withval)
1855 AC_ARG_WITH(system-odbc,
1856     AS_HELP_STRING([--with-system-odbc],
1857         [Use the odbc headers already on system.]),,
1858     [with_system_odbc="auto"])
1860 AC_ARG_WITH(system-sane,
1861     AS_HELP_STRING([--with-system-sane],
1862         [Use sane.h already on system.]),,
1863     [with_system_sane="$with_system_headers"])
1865 AC_ARG_WITH(system-bluez,
1866     AS_HELP_STRING([--with-system-bluez],
1867         [Use bluetooth.h already on system.]),,
1868     [with_system_bluez="$with_system_headers"])
1870 AC_ARG_WITH(system-curl,
1871     AS_HELP_STRING([--with-system-curl],
1872         [Use curl already on system.]),,
1873     [with_system_curl=auto])
1875 AC_ARG_WITH(system-boost,
1876     AS_HELP_STRING([--with-system-boost],
1877         [Use boost already on system.]),,
1878     [with_system_boost="$with_system_headers"])
1880 AC_ARG_WITH(system-glm,
1881     AS_HELP_STRING([--with-system-glm],
1882         [Use glm already on system.]),,
1883     [with_system_glm="$with_system_headers"])
1885 AC_ARG_WITH(system-hunspell,
1886     AS_HELP_STRING([--with-system-hunspell],
1887         [Use libhunspell already on system.]),,
1888     [with_system_hunspell="$with_system_libs"])
1890 AC_ARG_WITH(system-mythes,
1891     AS_HELP_STRING([--with-system-mythes],
1892         [Use mythes already on system.]),,
1893     [with_system_mythes="$with_system_libs"])
1895 AC_ARG_WITH(system-altlinuxhyph,
1896     AS_HELP_STRING([--with-system-altlinuxhyph],
1897         [Use ALTLinuxhyph already on system.]),,
1898     [with_system_altlinuxhyph="$with_system_libs"])
1900 AC_ARG_WITH(system-lpsolve,
1901     AS_HELP_STRING([--with-system-lpsolve],
1902         [Use lpsolve already on system.]),,
1903     [with_system_lpsolve="$with_system_libs"])
1905 AC_ARG_WITH(system-coinmp,
1906     AS_HELP_STRING([--with-system-coinmp],
1907         [Use CoinMP already on system.]),,
1908     [with_system_coinmp="$with_system_libs"])
1910 AC_ARG_WITH(system-liblangtag,
1911     AS_HELP_STRING([--with-system-liblangtag],
1912         [Use liblangtag library already on system.]),,
1913     [with_system_liblangtag="$with_system_libs"])
1915 AC_ARG_WITH(webdav,
1916     AS_HELP_STRING([--with-webdav],
1917         [Specify which library to use for webdav implementation.
1918          Possible values: "neon", "serf", "no". The default value is "neon".
1919          Example: --with-webdav="serf"]),
1920     WITH_WEBDAV=$withval,
1921     WITH_WEBDAV="neon")
1923 AC_ARG_WITH(linker-hash-style,
1924     AS_HELP_STRING([--with-linker-hash-style],
1925         [Use linker with --hash-style=<style> when linking shared objects.
1926          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1927          if supported on the build system, and "sysv" otherwise.]))
1929 AC_ARG_WITH(jdk-home,
1930     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1931         [If you have installed JDK 1.6 or later on your system please supply the
1932          path here. Note that this is not the location of the java command but the
1933          location of the entire distribution.]),
1936 AC_ARG_WITH(help,
1937     AS_HELP_STRING([--with-help],
1938         [Enable the build of help. There is a special parameter "common" that
1939          can be used to bundle only the common part, .e.g help-specific icons.
1940          This is useful when you build the helpcontent separately.])
1941     [
1942                           Usage:     --with-help    build the old local help
1943                                  --without-help     no local help (default)
1944                                  --with-help=html   build the new HTML local help
1945                                  --with-help=online build the new HTML online help
1946     ],
1949 libo_FUZZ_ARG_WITH(java,
1950     AS_HELP_STRING([--with-java=<java command>],
1951         [Specify the name of the Java interpreter command. Typically "java"
1952          which is the default.
1954          To build without support for Java components, applets, accessibility
1955          or the XML filters written in Java, use --without-java or --with-java=no.]),
1956     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1957     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
1960 AC_ARG_WITH(jvm-path,
1961     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
1962         [Use a specific JVM search path at runtime.
1963          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
1966 AC_ARG_WITH(ant-home,
1967     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
1968         [If you have installed Jakarta Ant on your system, please supply the path here.
1969          Note that this is not the location of the Ant binary but the location
1970          of the entire distribution.]),
1973 AC_ARG_WITH(symbol-config,
1974     AS_HELP_STRING([--with-symbol-config],
1975         [Configuration for the crashreport symbol upload]),
1976         [],
1977         [with_symbol_config=no])
1979 AC_ARG_WITH(export-validation,
1980     AS_HELP_STRING([--without-export-validation],
1981         [Disable validating OOXML and ODF files as exported from in-tree tests.
1982          Use this option e.g. if your system only provides Java 5.]),
1983 ,with_export_validation=auto)
1985 AC_ARG_WITH(bffvalidator,
1986     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
1987         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
1988          Requires installed Microsoft Office Binary File Format Validator.
1989          Note: export-validation (--with-export-validation) is required to be turned on.
1990          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
1991 ,with_bffvalidator=no)
1993 libo_FUZZ_ARG_WITH(junit,
1994     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
1995         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
1996          --without-junit disables those tests. Not relevant in the --without-java case.]),
1997 ,with_junit=yes)
1999 AC_ARG_WITH(hamcrest,
2000     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2001         [Specifies the hamcrest jar file to use for JUnit-based tests.
2002          --without-junit disables those tests. Not relevant in the --without-java case.]),
2003 ,with_hamcrest=yes)
2005 AC_ARG_WITH(perl-home,
2006     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2007         [If you have installed Perl 5 Distribution, on your system, please
2008          supply the path here. Note that this is not the location of the Perl
2009          binary but the location of the entire distribution.]),
2012 libo_FUZZ_ARG_WITH(doxygen,
2013     AS_HELP_STRING(
2014         [--with-doxygen=<absolute path to doxygen executable>],
2015         [Specifies the doxygen executable to use when generating ODK C/C++
2016          documentation. --without-doxygen disables generation of ODK C/C++
2017          documentation. Not relevant in the --disable-odk case.]),
2018 ,with_doxygen=yes)
2020 AC_ARG_WITH(visual-studio,
2021     AS_HELP_STRING([--with-visual-studio=<2015/2017>],
2022         [Specify which Visual Studio version to use in case several are
2023          installed. If not specified, defaults to 2015.]),
2026 AC_ARG_WITH(windows-sdk,
2027     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
2028         [Specify which Windows SDK, or "Windows Kit", version to use
2029          in case the one that came with the selected Visual Studio
2030          is not what you want for some reason. Note that not all compiler/SDK
2031          combinations are supported. The intent is that this option should not
2032          be needed.]),
2035 AC_ARG_WITH(lang,
2036     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2037         [Use this option to build LibreOffice with additional UI language support.
2038          English (US) is always included by default.
2039          Separate multiple languages with space.
2040          For all languages, use --with-lang=ALL.]),
2043 AC_ARG_WITH(locales,
2044     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2045         [Use this option to limit the locale information built in.
2046          Separate multiple locales with space.
2047          Very experimental and might well break stuff.
2048          Just a desperate measure to shrink code and data size.
2049          By default all the locales available is included.
2050          This option is completely unrelated to --with-lang.])
2051     [
2052                           Affects also our character encoding conversion
2053                           tables for encodings mainly targeted for a
2054                           particular locale, like EUC-CN and EUC-TW for
2055                           zh, ISO-2022-JP for ja.
2057                           Affects also our add-on break iterator data for
2058                           some languages.
2060                           For the default, all locales, don't use this switch at all.
2061                           Specifying just the language part of a locale means all matching
2062                           locales will be included.
2063     ],
2066 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2067 libo_FUZZ_ARG_WITH(krb5,
2068     AS_HELP_STRING([--with-krb5],
2069         [Enable MIT Kerberos 5 support in modules that support it.
2070          By default automatically enabled on platforms
2071          where a good system Kerberos 5 is available.]),
2074 libo_FUZZ_ARG_WITH(gssapi,
2075     AS_HELP_STRING([--with-gssapi],
2076         [Enable GSSAPI support in modules that support it.
2077          By default automatically enabled on platforms
2078          where a good system GSSAPI is available.]),
2081 AC_ARG_WITH(iwyu,
2082     AS_HELP_STRING([--with-iwyu],
2083         [Use given IWYU binary path to check unneeded includes instead of building.
2084          Use only if you are hacking on it.]),
2087 libo_FUZZ_ARG_WITH(lxml,
2088     AS_HELP_STRING([--without-lxml],
2089         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2090          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2091          report widget classes and ids.]),
2094 dnl ===================================================================
2095 dnl Branding
2096 dnl ===================================================================
2098 AC_ARG_WITH(branding,
2099     AS_HELP_STRING([--with-branding=/path/to/images],
2100         [Use given path to retrieve branding images set.])
2101     [
2102                           Search for intro.png about.svg and flat_logo.svg.
2103                           If any is missing, default ones will be used instead.
2105                           Search also progress.conf for progress
2106                           settings on intro screen :
2108                           PROGRESSBARCOLOR="255,255,255" Set color of
2109                           progress bar. Comma separated RGB decimal values.
2110                           PROGRESSSIZE="407,6" Set size of progress bar.
2111                           Comma separated decimal values (width, height).
2112                           PROGRESSPOSITION="61,317" Set position of progress
2113                           bar from left,top. Comma separated decimal values.
2114                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2115                           bar frame. Comma separated RGB decimal values.
2116                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2117                           bar text. Comma separated RGB decimal values.
2118                           PROGRESSTEXTBASELINE="287" Set vertical position of
2119                           progress bar text from top. Decimal value.
2121                           Default values will be used if not found.
2122     ],
2126 AC_ARG_WITH(extra-buildid,
2127     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2128         [Show addition build identification in about dialog.]),
2132 AC_ARG_WITH(vendor,
2133     AS_HELP_STRING([--with-vendor="John the Builder"],
2134         [Set vendor of the build.]),
2137 AC_ARG_WITH(android-package-name,
2138     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2139         [Set Android package name of the build.]),
2142 AC_ARG_WITH(compat-oowrappers,
2143     AS_HELP_STRING([--with-compat-oowrappers],
2144         [Install oo* wrappers in parallel with
2145          lo* ones to keep backward compatibility.
2146          Has effect only with make distro-pack-install]),
2149 AC_ARG_WITH(os-version,
2150     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2151         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2154 AC_ARG_WITH(mingw-cross-compiler,
2155     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2156         [Specify the MinGW cross-compiler to use.
2157          When building on the ODK on Unix and building unowinreg.dll,
2158          specify the MinGW C++ cross-compiler.]),
2161 AC_ARG_WITH(idlc-cpp,
2162     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2163         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2166 AC_ARG_WITH(build-version,
2167     AS_HELP_STRING([--with-build-version="Built by Jim"],
2168         [Allows the builder to add a custom version tag that will appear in the
2169          Help/About box for QA purposes.]),
2170 with_build_version=$withval,
2173 AC_ARG_WITH(alloc,
2174     AS_HELP_STRING([--with-alloc],
2175         [Define which allocator to build with (choices are internal, system).]),
2178 AC_ARG_WITH(parallelism,
2179     AS_HELP_STRING([--with-parallelism],
2180         [Number of jobs to run simultaneously during build. Parallel builds can
2181         save a lot of time on multi-cpu machines. Defaults to the number of
2182         CPUs on the machine, unless you configure --enable-icecream - then to
2183         10.]),
2186 AC_ARG_WITH(all-tarballs,
2187     AS_HELP_STRING([--with-all-tarballs],
2188         [Download all external tarballs unconditionally]))
2190 AC_ARG_WITH(gdrive-client-id,
2191     AS_HELP_STRING([--with-gdrive-client-id],
2192         [Provides the client id of the application for OAuth2 authentication
2193         on Google Drive. If either this or --with-gdrive-client-secret is
2194         empty, the feature will be disabled]),
2197 AC_ARG_WITH(gdrive-client-secret,
2198     AS_HELP_STRING([--with-gdrive-client-secret],
2199         [Provides the client secret of the application for OAuth2
2200         authentication on Google Drive. If either this or
2201         --with-gdrive-client-id is empty, the feature will be disabled]),
2204 AC_ARG_WITH(alfresco-cloud-client-id,
2205     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2206         [Provides the client id of the application for OAuth2 authentication
2207         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2208         empty, the feature will be disabled]),
2211 AC_ARG_WITH(alfresco-cloud-client-secret,
2212     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2213         [Provides the client secret of the application for OAuth2
2214         authentication on Alfresco Cloud. If either this or
2215         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2218 AC_ARG_WITH(onedrive-client-id,
2219     AS_HELP_STRING([--with-onedrive-client-id],
2220         [Provides the client id of the application for OAuth2 authentication
2221         on OneDrive. If either this or --with-onedrive-client-secret is
2222         empty, the feature will be disabled]),
2225 AC_ARG_WITH(onedrive-client-secret,
2226     AS_HELP_STRING([--with-onedrive-client-secret],
2227         [Provides the client secret of the application for OAuth2
2228         authentication on OneDrive. If either this or
2229         --with-onedrive-client-id is empty, the feature will be disabled]),
2231 dnl ===================================================================
2232 dnl Do we want to use pre-build binary tarball for recompile
2233 dnl ===================================================================
2235 if test "$enable_library_bin_tar" = "yes" ; then
2236     USE_LIBRARY_BIN_TAR=TRUE
2237 else
2238     USE_LIBRARY_BIN_TAR=
2240 AC_SUBST(USE_LIBRARY_BIN_TAR)
2242 dnl ===================================================================
2243 dnl Test whether build target is Release Build
2244 dnl ===================================================================
2245 AC_MSG_CHECKING([whether build target is Release Build])
2246 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2247     AC_MSG_RESULT([no])
2248     ENABLE_RELEASE_BUILD=
2249 else
2250     AC_MSG_RESULT([yes])
2251     ENABLE_RELEASE_BUILD=TRUE
2253 AC_SUBST(ENABLE_RELEASE_BUILD)
2255 dnl ===================================================================
2256 dnl Test whether to sign Windows Build
2257 dnl ===================================================================
2258 AC_MSG_CHECKING([whether to sign windows build])
2259 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2260     AC_MSG_RESULT([yes])
2261     WINDOWS_BUILD_SIGNING="TRUE"
2262 else
2263     AC_MSG_RESULT([no])
2264     WINDOWS_BUILD_SIGNING="FALSE"
2266 AC_SUBST(WINDOWS_BUILD_SIGNING)
2268 dnl ===================================================================
2269 dnl MacOSX build and runtime environment options
2270 dnl ===================================================================
2272 AC_ARG_WITH(macosx-sdk,
2273     AS_HELP_STRING([--with-macosx-sdk=<version>],
2274         [Prefer a specific SDK for building.])
2275     [
2276                           If the requested SDK is not available, a search for the oldest one will be done.
2277                           With current Xcode versions, only the latest SDK is included, so this option is
2278                           not terribly useful. It works fine to build with a new SDK and run the result
2279                           on an older OS.
2281                           e. g.: --with-macosx-sdk=10.9
2283                           there are 3 options to control the MacOSX build:
2284                           --with-macosx-sdk (referred as 'sdk' below)
2285                           --with-macosx-version-min-required (referred as 'min' below)
2286                           --with-macosx-version-max-allowed (referred as 'max' below)
2288                           the connection between these value and the default they take is as follow:
2289                           ( ? means not specified on the command line, s means the SDK version found,
2290                           constraint: 8 <= x <= y <= z)
2292                           ==========================================
2293                            command line      || config result
2294                           ==========================================
2295                           min  | max  | sdk  || min  | max  | sdk  |
2296                           ?    | ?    | ?    || 10.9 | 10.s | 10.s |
2297                           ?    | ?    | 10.x || 10.9 | 10.x | 10.x |
2298                           ?    | 10.x | ?    || 10.9 | 10.s | 10.s |
2299                           ?    | 10.x | 10.y || 10.9 | 10.x | 10.y |
2300                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2301                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2302                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2303                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2306                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2307                           for a detailed technical explanation of these variables
2309                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2310     ],
2313 AC_ARG_WITH(macosx-version-min-required,
2314     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2315         [set the minimum OS version needed to run the built LibreOffice])
2316     [
2317                           e. g.: --with-macos-version-min-required=10.9
2318                           see --with-macosx-sdk for more info
2319     ],
2322 AC_ARG_WITH(macosx-version-max-allowed,
2323     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2324         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2325     [
2326                           e. g.: --with-macos-version-max-allowed=10.9
2327                           see --with-macosx-sdk for more info
2328     ],
2332 dnl ===================================================================
2333 dnl options for stuff used during cross-compilation build
2334 dnl Not quite superseded by --with-build-platform-configure-options.
2335 dnl TODO: check, if the "force" option is still needed anywhere.
2336 dnl ===================================================================
2338 AC_ARG_WITH(system-icu-for-build,
2339     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2340         [Use icu already on system for build tools (cross-compilation only).]))
2343 dnl ===================================================================
2344 dnl Check for incompatible options set by fuzzing, and reset those
2345 dnl automatically to working combinations
2346 dnl ===================================================================
2348 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2349         "$enable_dbus" != "$enable_avahi"; then
2350     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2351     enable_avahi=$enable_dbus
2354 dnl ===================================================================
2355 dnl check for required programs (grep, awk, sed, bash)
2356 dnl ===================================================================
2358 pathmunge ()
2360     if test -n "$1"; then
2361         if test "$build_os" = "cygwin"; then
2362             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2363                 PathFormat "$1"
2364                 new_path=`cygpath -sm "$formatted_path"`
2365             else
2366                 PathFormat "$1"
2367                 new_path=`cygpath -u "$formatted_path"`
2368             fi
2369         else
2370             new_path="$1"
2371         fi
2372         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2373             if test "$2" = "after"; then
2374                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2375             else
2376                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2377             fi
2378         fi
2379         unset new_path
2380     fi
2383 AC_PROG_AWK
2384 AC_PATH_PROG( AWK, $AWK)
2385 if test -z "$AWK"; then
2386     AC_MSG_ERROR([install awk to run this script])
2389 AC_PATH_PROG(BASH, bash)
2390 if test -z "$BASH"; then
2391     AC_MSG_ERROR([bash not found in \$PATH])
2393 AC_SUBST(BASH)
2395 AC_MSG_CHECKING([for GNU or BSD tar])
2396 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2397     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2398     if test $? -eq 0;  then
2399         GNUTAR=$a
2400         break
2401     fi
2402 done
2403 AC_MSG_RESULT($GNUTAR)
2404 if test -z "$GNUTAR"; then
2405     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2407 AC_SUBST(GNUTAR)
2409 AC_MSG_CHECKING([for tar's option to strip components])
2410 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2411 if test $? -eq 0; then
2412     STRIP_COMPONENTS="--strip-components"
2413 else
2414     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2415     if test $? -eq 0; then
2416         STRIP_COMPONENTS="--strip-path"
2417     else
2418         STRIP_COMPONENTS="unsupported"
2419     fi
2421 AC_MSG_RESULT($STRIP_COMPONENTS)
2422 if test x$STRIP_COMPONENTS = xunsupported; then
2423     AC_MSG_ERROR([you need a tar that is able to strip components.])
2425 AC_SUBST(STRIP_COMPONENTS)
2427 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2428 dnl desktop OSes from "mobile" ones.
2430 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2431 dnl In other words, that when building for an OS that is not a
2432 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2434 dnl Note the direction of the implication; there is no assumption that
2435 dnl cross-compiling would imply a non-desktop OS.
2437 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2438     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2439     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2440     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2443 # Whether to build "avmedia" functionality or not.
2445 if test -z "$enable_avmedia"; then
2446     enable_avmedia=yes
2449 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2450 if test "$enable_avmedia" = yes; then
2451     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2452 else
2453     USE_AVMEDIA_DUMMY='TRUE'
2455 AC_SUBST(USE_AVMEDIA_DUMMY)
2457 # Decide whether to build database connectivity stuff (including
2458 # Base) or not. We probably don't want to on non-desktop OSes.
2459 if test -z "$enable_database_connectivity"; then
2460     # --disable-database-connectivity is unfinished work in progress
2461     # and the iOS test app doesn't link if we actually try to use it.
2462     # if test $_os != iOS -a $_os != Android; then
2463     if test $_os != iOS; then
2464         enable_database_connectivity=yes
2465     fi
2468 if test "$enable_database_connectivity" = yes; then
2469     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2470     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2473 if test -z "$enable_extensions"; then
2474     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2475     if test $_os != iOS -a $_os != Android; then
2476         enable_extensions=yes
2477     fi
2480 if test "$enable_extensions" = yes; then
2481     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2482     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2485 if test -z "$enable_scripting"; then
2486     # Disable scripting for iOS unless specifically overridden
2487     # with --enable-scripting.
2488     if test $_os != iOS; then
2489         enable_scripting=yes
2490     fi
2493 DISABLE_SCRIPTING=''
2494 if test "$enable_scripting" = yes; then
2495     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2496     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2497 else
2498     DISABLE_SCRIPTING='TRUE'
2499     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2502 if test $_os = iOS -o $_os = Android; then
2503     # Disable dynamic_loading always for iOS and Android
2504     enable_dynamic_loading=no
2505 elif test -z "$enable_dynamic_loading"; then
2506     # Otherwise enable it unless speficically disabled
2507     enable_dynamic_loading=yes
2510 DISABLE_DYNLOADING=''
2511 if test "$enable_dynamic_loading" = yes; then
2512     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2513 else
2514     DISABLE_DYNLOADING='TRUE'
2516 AC_SUBST(DISABLE_DYNLOADING)
2518 # remenber SYSBASE value
2519 AC_SUBST(SYSBASE)
2521 dnl ===================================================================
2522 dnl  Sort out various gallery compilation options
2523 dnl ===================================================================
2524 AC_MSG_CHECKING([how to build and package galleries])
2525 if test -n "${with_galleries}"; then
2526     if test "$with_galleries" = "build"; then
2527         WITH_GALLERY_BUILD=TRUE
2528         AC_MSG_RESULT([build from source images internally])
2529     elif test "$with_galleries" = "no"; then
2530         WITH_GALLERY_BUILD=
2531         AC_MSG_RESULT([disable non-internal gallery build])
2532     else
2533         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2534     fi
2535 else
2536     if test $_os != iOS -a $_os != Android; then
2537         WITH_GALLERY_BUILD=TRUE
2538         AC_MSG_RESULT([internal src images for desktop])
2539     else
2540         WITH_GALLERY_BUILD=
2541         AC_MSG_RESULT([disable src image build])
2542     fi
2544 AC_SUBST(WITH_GALLERY_BUILD)
2546 dnl ===================================================================
2547 dnl  Checks if ccache is available
2548 dnl ===================================================================
2549 if test "$_os" = "WINNT"; then
2550     # on windows/VC build do not use ccache
2551     CCACHE=""
2552 elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2553     case "%$CC%$CXX%" in
2554     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2555     # assume that's good then
2556     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2557         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2558         ;;
2559     *)
2560         AC_PATH_PROG([CCACHE],[ccache],[not found])
2561         if test "$CCACHE" = "not found"; then
2562             CCACHE=""
2563         else
2564             # Need to check for ccache version: otherwise prevents
2565             # caching of the results (like "-x objective-c++" for Mac)
2566             if test $_os = Darwin -o $_os = iOS; then
2567                 # Check ccache version
2568                 AC_MSG_CHECKING([whether version of ccache is suitable])
2569                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2570                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2571                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2572                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2573                 else
2574                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2575                     CCACHE=""
2576                 fi
2577             fi
2578         fi
2579         ;;
2580     esac
2581 else
2582     CCACHE=""
2585 if test "$CCACHE" != ""; then
2586     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2587     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2588     if test "$ccache_size" = ""; then
2589         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2590         if test "$ccache_size" = ""; then
2591             ccache_size=0
2592         fi
2593         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2594         if test $ccache_size -lt 1024; then
2595             CCACHE=""
2596             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2597             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2598         else
2599             # warn that ccache may be too small for debug build
2600             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2601             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2602         fi
2603     else
2604         if test $ccache_size -lt 5; then
2605             #warn that ccache may be too small for debug build
2606             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2607             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2608         fi
2609     fi
2612 dnl ===================================================================
2613 dnl  Checks for C compiler,
2614 dnl  The check for the C++ compiler is later on.
2615 dnl ===================================================================
2616 if test "$_os" != "WINNT"; then
2617     GCC_HOME_SET="true"
2618     AC_MSG_CHECKING([gcc home])
2619     if test -z "$with_gcc_home"; then
2620         if test "$enable_icecream" = "yes"; then
2621             if test -d "/usr/lib/icecc/bin"; then
2622                 GCC_HOME="/usr/lib/icecc/"
2623             elif test -d "/usr/libexec/icecc/bin"; then
2624                 GCC_HOME="/usr/libexec/icecc/"
2625             elif test -d "/opt/icecream/bin"; then
2626                 GCC_HOME="/opt/icecream/"
2627             else
2628                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2630             fi
2631         else
2632             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2633             GCC_HOME_SET="false"
2634         fi
2635     else
2636         GCC_HOME="$with_gcc_home"
2637     fi
2638     AC_MSG_RESULT($GCC_HOME)
2639     AC_SUBST(GCC_HOME)
2641     if test "$GCC_HOME_SET" = "true"; then
2642         if test -z "$CC"; then
2643             CC="$GCC_HOME/bin/gcc"
2644         fi
2645         if test -z "$CXX"; then
2646             CXX="$GCC_HOME/bin/g++"
2647         fi
2648     fi
2651 COMPATH=`dirname "$CC"`
2652 if test "$COMPATH" = "."; then
2653     AC_PATH_PROGS(COMPATH, $CC)
2654     dnl double square bracket to get single because of M4 quote...
2655     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2657 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2659 dnl ===================================================================
2660 dnl Java support
2661 dnl ===================================================================
2662 AC_MSG_CHECKING([whether to build with Java support])
2663 if test "$with_java" != "no"; then
2664     if test "$DISABLE_SCRIPTING" = TRUE; then
2665         AC_MSG_RESULT([no, overridden by --disable-scripting])
2666         ENABLE_JAVA=""
2667         with_java=no
2668     else
2669         AC_MSG_RESULT([yes])
2670         ENABLE_JAVA="TRUE"
2671         AC_DEFINE(HAVE_FEATURE_JAVA)
2672     fi
2673 else
2674     AC_MSG_RESULT([no])
2675     ENABLE_JAVA=""
2678 AC_SUBST(ENABLE_JAVA)
2680 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2682 dnl ENABLE_JAVA="" indicate no Java support at all
2684 dnl ===================================================================
2685 dnl Check OS X SDK and compiler
2686 dnl ===================================================================
2688 if test $_os = Darwin -o $_os = iOS; then
2690     # If no --with-macosx-sdk option is given, look for one
2692     # The intent is that for "most" Mac-based developers, a suitable
2693     # SDK will be found automatically without any configure options.
2695     # For developers with a current Xcode, the lowest-numbered SDK
2696     # higher than or equal to the minimum required should be found.
2698     AC_MSG_CHECKING([what Mac OS X SDK to use])
2699     for _macosx_sdk in $with_macosx_sdk 10.13 10.12; do
2700         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2701         if test -d "$MACOSX_SDK_PATH"; then
2702             with_macosx_sdk="${_macosx_sdk}"
2703             break
2704         else
2705             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2706             if test -d "$MACOSX_SDK_PATH"; then
2707                 with_macosx_sdk="${_macosx_sdk}"
2708                 break
2709             fi
2710         fi
2711     done
2712     if test ! -d "$MACOSX_SDK_PATH"; then
2713         AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2714     fi
2716     if test $_os = iOS; then
2717         if test "$enable_ios_simulator" = "yes"; then
2718             useos=iphonesimulator
2719         else
2720             useos=iphoneos
2721         fi
2722         MACOSX_SDK_PATH=`xcrun --sdk ${useos} --show-sdk-path 2> /dev/null`
2723     fi
2724     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2727     case $with_macosx_sdk in
2728     10.9)
2729         MACOSX_SDK_VERSION=1090
2730         ;;
2731     10.10)
2732         MACOSX_SDK_VERSION=101000
2733         ;;
2734     10.11)
2735         MACOSX_SDK_VERSION=101100
2736         ;;
2737     10.12)
2738         MACOSX_SDK_VERSION=101200
2739         ;;
2740     10.13)
2741         MACOSX_SDK_VERSION=101300
2742         ;;
2743     *)
2744         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.9--13])
2745         ;;
2746     esac
2748     if test "$with_macosx_version_min_required" = "" ; then
2749         with_macosx_version_min_required="10.9";
2750     fi
2752     if test "$with_macosx_version_max_allowed" = "" ; then
2753         with_macosx_version_max_allowed="$with_macosx_sdk"
2754     fi
2756     # export this so that "xcrun" invocations later return matching values
2757     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2758     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2759     export DEVELOPER_DIR
2760     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2761     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2763     case "$with_macosx_version_min_required" in
2764     10.9)
2765         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2766         ;;
2767     10.10)
2768         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2769         ;;
2770     10.11)
2771         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2772         ;;
2773     10.12)
2774         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2775         ;;
2776     10.13)
2777         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2778         ;;
2779     *)
2780         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.9--13])
2781         ;;
2782     esac
2783     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2785     LIBTOOL=/usr/bin/libtool
2786     INSTALL_NAME_TOOL=install_name_tool
2787     if test -z "$save_CC"; then
2788         AC_MSG_CHECKING([what compiler to use])
2789         stdlib=-stdlib=libc++
2790         if test "$ENABLE_LTO" = TRUE; then
2791             lto=-flto
2792         fi
2793         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2794         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2795         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2796         AR=`xcrun -find ar`
2797         NM=`xcrun -find nm`
2798         STRIP=`xcrun -find strip`
2799         LIBTOOL=`xcrun -find libtool`
2800         RANLIB=`xcrun -find ranlib`
2801         AC_MSG_RESULT([$CC and $CXX])
2802     fi
2804     case "$with_macosx_version_max_allowed" in
2805     10.9)
2806         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2807         ;;
2808     10.10)
2809         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2810         ;;
2811     10.11)
2812         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2813         ;;
2814     10.12)
2815         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2816         ;;
2817     10.13)
2818         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2819         ;;
2820     *)
2821         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.9--13])
2822         ;;
2823     esac
2825     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2826     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2827         AC_MSG_RESULT([$MAC_OS_X_VERSION_MIN_REQUIRED])
2828         AC_MSG_RESULT([$MAC_OS_X_VERSION_MAX_REQUIRED])
2829         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2830     else
2831         AC_MSG_RESULT([ok])
2832     fi
2834     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2835     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2836         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2837     else
2838         AC_MSG_RESULT([ok])
2839     fi
2840     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2841     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2843     AC_MSG_CHECKING([whether to do code signing])
2845     if test "$enable_macosx_code_signing" = yes; then
2846         # By default use the first suitable certificate (?).
2848         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2849         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2850         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2851         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2852         # "Developer ID Application" one.
2854         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2855         if test -n "$identity"; then
2856             MACOSX_CODESIGNING_IDENTITY=$identity
2857             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2858             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2859         else
2860             AC_MSG_ERROR([cannot determine identity to use])
2861         fi
2862     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2863         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2864         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2865         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2866     else
2867         AC_MSG_RESULT([no])
2868     fi
2870     AC_MSG_CHECKING([whether to create a Mac App Store package])
2872     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2873         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2874     elif test "$enable_macosx_package_signing" = yes; then
2875         # By default use the first suitable certificate.
2876         # It should be a "3rd Party Mac Developer Installer" one
2878         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2879         if test -n "$identity"; then
2880             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2881             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2882             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2883         else
2884             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2885         fi
2886     elif test -n "$enable_macosx_package_signing"; then
2887         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2888         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2889         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2890     else
2891         AC_MSG_RESULT([no])
2892     fi
2894     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2895         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2896     fi
2898     AC_MSG_CHECKING([whether to sandbox the application])
2900     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2901         AC_MSG_ERROR([OS X sandboxing requires code signing])
2902     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2903         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2904     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2905         ENABLE_MACOSX_SANDBOX=TRUE
2906         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2907         AC_MSG_RESULT([yes])
2908     else
2909         AC_MSG_RESULT([no])
2910     fi
2912     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2913     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2914     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2916 AC_SUBST(MACOSX_SDK_PATH)
2917 AC_SUBST(MACOSX_SDK_VERSION)
2918 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2919 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2920 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
2921 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2922 AC_SUBST(INSTALL_NAME_TOOL)
2923 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2924 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2925 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2926 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2927 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2929 dnl ===================================================================
2930 dnl Check iOS SDK and compiler
2931 dnl ===================================================================
2933 if test $_os = iOS; then
2934     AC_MSG_CHECKING([what iOS SDK to use])
2935     current_sdk_ver=11.3
2936     if test "$enable_ios_simulator" = "yes"; then
2937         platform=iPhoneSimulator
2938         versionmin=-mios-simulator-version-min=$current_sdk_ver
2939     else
2940         platform=iPhoneOS
2941         versionmin=-miphoneos-version-min=$current_sdk_ver
2942     fi
2943     xcode_developer=`xcode-select -print-path`
2945     for sdkver in $current_sdk_ver; do
2946         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2947         if test -d $t; then
2948             ios_sdk=$sdkver
2949             sysroot=$t
2950             break
2951         fi
2952     done
2954     if test -z "$sysroot"; then
2955         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
2956     fi
2958     AC_MSG_RESULT($sysroot)
2960     IOS_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
2961     IOS_DEPLOYMENT_VERSION=$current_sdk_ver
2963     # LTO is not really recommended for iOS builds,
2964     # the link time will be astronomical
2965     if test "$ENABLE_LTO" = TRUE; then
2966         lto=-flto
2967     fi
2969     stdlib="-stdlib=libc++"
2971     CC="`xcrun -find clang` -arch $host_cpu -isysroot $sysroot $lto $versionmin"
2972     CXX="`xcrun -find clang++` -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
2974     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2975     AR=`xcrun -find ar`
2976     NM=`xcrun -find nm`
2977     STRIP=`xcrun -find strip`
2978     LIBTOOL=`xcrun -find libtool`
2979     RANLIB=`xcrun -find ranlib`
2982 AC_SUBST(IOS_SDK)
2983 AC_SUBST(IOS_DEPLOYMENT_VERSION)
2985 AC_MSG_CHECKING([whether to treat the installation as read-only])
2987 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
2988         "$enable_extensions" != yes; then
2989     enable_readonly_installset=yes
2991 if test "$enable_readonly_installset" = yes; then
2992     AC_MSG_RESULT([yes])
2993     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
2994 else
2995     AC_MSG_RESULT([no])
2998 dnl ===================================================================
2999 dnl Structure of install set
3000 dnl ===================================================================
3002 if test $_os = Darwin; then
3003     LIBO_BIN_FOLDER=MacOS
3004     LIBO_ETC_FOLDER=Resources
3005     LIBO_LIBEXEC_FOLDER=MacOS
3006     LIBO_LIB_FOLDER=Frameworks
3007     LIBO_LIB_PYUNO_FOLDER=Resources
3008     LIBO_SHARE_FOLDER=Resources
3009     LIBO_SHARE_HELP_FOLDER=Resources/help
3010     LIBO_SHARE_JAVA_FOLDER=Resources/java
3011     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3012     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3013     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3014     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3015     LIBO_URE_BIN_FOLDER=MacOS
3016     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3017     LIBO_URE_LIB_FOLDER=Frameworks
3018     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3019     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3020 elif test $_os = WINNT; then
3021     LIBO_BIN_FOLDER=program
3022     LIBO_ETC_FOLDER=program
3023     LIBO_LIBEXEC_FOLDER=program
3024     LIBO_LIB_FOLDER=program
3025     LIBO_LIB_PYUNO_FOLDER=program
3026     LIBO_SHARE_FOLDER=share
3027     LIBO_SHARE_HELP_FOLDER=help
3028     LIBO_SHARE_JAVA_FOLDER=program/classes
3029     LIBO_SHARE_PRESETS_FOLDER=presets
3030     LIBO_SHARE_READMES_FOLDER=readmes
3031     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3032     LIBO_SHARE_SHELL_FOLDER=program/shell
3033     LIBO_URE_BIN_FOLDER=program
3034     LIBO_URE_ETC_FOLDER=program
3035     LIBO_URE_LIB_FOLDER=program
3036     LIBO_URE_MISC_FOLDER=program
3037     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3038 else
3039     LIBO_BIN_FOLDER=program
3040     LIBO_ETC_FOLDER=program
3041     LIBO_LIBEXEC_FOLDER=program
3042     LIBO_LIB_FOLDER=program
3043     LIBO_LIB_PYUNO_FOLDER=program
3044     LIBO_SHARE_FOLDER=share
3045     LIBO_SHARE_HELP_FOLDER=help
3046     LIBO_SHARE_JAVA_FOLDER=program/classes
3047     LIBO_SHARE_PRESETS_FOLDER=presets
3048     LIBO_SHARE_READMES_FOLDER=readmes
3049     if test "$enable_fuzzers" != yes; then
3050         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3051     else
3052         LIBO_SHARE_RESOURCE_FOLDER=resource
3053     fi
3054     LIBO_SHARE_SHELL_FOLDER=program/shell
3055     LIBO_URE_BIN_FOLDER=program
3056     LIBO_URE_ETC_FOLDER=program
3057     LIBO_URE_LIB_FOLDER=program
3058     LIBO_URE_MISC_FOLDER=program
3059     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3061 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3062 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3063 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3064 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3065 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3066 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3067 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3068 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3069 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3070 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3071 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3072 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3073 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3074 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3075 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3076 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3078 # Not all of them needed in config_host.mk, add more if need arises
3079 AC_SUBST(LIBO_BIN_FOLDER)
3080 AC_SUBST(LIBO_ETC_FOLDER)
3081 AC_SUBST(LIBO_LIB_FOLDER)
3082 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3083 AC_SUBST(LIBO_SHARE_FOLDER)
3084 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3085 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3086 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3087 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3088 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3089 AC_SUBST(LIBO_URE_BIN_FOLDER)
3090 AC_SUBST(LIBO_URE_ETC_FOLDER)
3091 AC_SUBST(LIBO_URE_LIB_FOLDER)
3092 AC_SUBST(LIBO_URE_MISC_FOLDER)
3093 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3095 dnl ===================================================================
3096 dnl Windows specific tests and stuff
3097 dnl ===================================================================
3099 reg_get_value()
3101     # Return value: $regvalue
3102     unset regvalue
3104     local _regentry="/proc/registry${1}/${2}"
3105     if test -f "$_regentry"; then
3106         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3107         # Registry keys read via /proc/registry* are always \0 terminated!
3108         local _regvalue=$(tr -d '\0' < "$_regentry")
3109         if test $? -eq 0; then
3110             regvalue=$_regvalue
3111         fi
3112     fi
3115 # Get a value from the 32-bit side of the Registry
3116 reg_get_value_32()
3118     reg_get_value "32" "$1"
3121 # Get a value from the 64-bit side of the Registry
3122 reg_get_value_64()
3124     reg_get_value "64" "$1"
3127 if test "$_os" = "WINNT"; then
3128     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3129     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3130         AC_MSG_RESULT([no])
3131         WINDOWS_SDK_ARCH="x86"
3132     else
3133         AC_MSG_RESULT([yes])
3134         WINDOWS_SDK_ARCH="x64"
3135         BITNESS_OVERRIDE=64
3136     fi
3138 if test "$_os" = "iOS"; then
3139     cross_compiling="yes"
3142 if test "$cross_compiling" = "yes"; then
3143     export CROSS_COMPILING=TRUE
3144 else
3145     CROSS_COMPILING=
3146     BUILD_TYPE="$BUILD_TYPE NATIVE"
3148 AC_SUBST(CROSS_COMPILING)
3150 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3151 if test "$GCC" = "yes"; then
3152     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
3153     bsymbolic_functions_ldflags_save=$LDFLAGS
3154     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3155     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3156 #include <stdio.h>
3157         ],[
3158 printf ("hello world\n");
3159         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3160     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3161         AC_MSG_RESULT( found )
3162     else
3163         AC_MSG_RESULT( not found )
3164     fi
3165     LDFLAGS=$bsymbolic_functions_ldflags_save
3167 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3169 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3170 # NOTE: must _not_ be used for bundled external libraries!
3171 ISYSTEM=
3172 if test "$GCC" = "yes"; then
3173     AC_MSG_CHECKING( for -isystem )
3174     save_CFLAGS=$CFLAGS
3175     CFLAGS="$CFLAGS -Werror"
3176     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3177     CFLAGS=$save_CFLAGS
3178     if test -n "$ISYSTEM"; then
3179         AC_MSG_RESULT(yes)
3180     else
3181         AC_MSG_RESULT(no)
3182     fi
3184 if test -z "$ISYSTEM"; then
3185     # fall back to using -I
3186     ISYSTEM=-I
3188 AC_SUBST(ISYSTEM)
3190 dnl ===================================================================
3191 dnl  Check which Visual Studio compiler is used
3192 dnl ===================================================================
3194 map_vs_year_to_version()
3196     # Return value: $vsversion
3198     unset vsversion
3200     case $1 in
3201     2015)
3202         vsversion=14.0;;
3203     2017)
3204         vsversion=15.0;;
3205     *)
3206         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3207     esac
3210 vs_versions_to_check()
3212     # Args: $1 (optional) : versions to check, in the order of preference
3213     # Return value: $vsversions
3215     unset vsversions
3217     if test -n "$1"; then
3218         map_vs_year_to_version "$1"
3219         vsversions=$vsversion
3220     else
3221         # By default we prefer 2015/2017, in this order
3222         vsversions="14.0 15.0"
3223     fi
3226 win_get_env_from_vsvars32bat()
3228     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3229     if test $vcnum = "150"; then
3230       # Also seems to be located in another directory under the same name: vsvars32.bat
3231       # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3232       printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3233     else
3234       printf '@call "%s/../Common7/Tools/vsvars32.bat"\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3235     fi
3236     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3237     chmod +x $WRAPPERBATCHFILEPATH
3238     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3239     rm -f $WRAPPERBATCHFILEPATH
3240     printf '%s' "$_win_get_env_from_vsvars32bat"
3243 find_ucrt()
3245     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3246     if test -n "$regvalue"; then
3247         PathFormat "$regvalue"
3248         UCRTSDKDIR=$formatted_path
3249         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3250         UCRTVERSION=$regvalue
3251         # Rest if not exist
3252         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3253           UCRTSDKDIR=
3254         fi
3255     fi
3256     if test -z "$UCRTSDKDIR"; then
3257         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3258         if test "$vcnum" = "150"; then
3259           ide_env_file="${ide_env_dir}VsDevCmd.bat"
3260         else
3261           ide_env_file="${ide_env_dir}/vsvars32.bat"
3262         fi
3263         if test -f "$ide_env_file"; then
3264             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3265             UCRTSDKDIR=$formatted_path
3266             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3267             dnl Hack needed at least by tml:
3268             if test "$UCRTVERSION" = 10.0.15063.0 \
3269                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3270                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3271             then
3272                 UCRTVERSION=10.0.14393.0
3273             fi
3274         else
3275           AC_MSG_ERROR([No UCRT found])
3276         fi
3277     fi
3280 find_msvc()
3282     # Find Visual C++ 2015/2017
3283     # Args: $1 (optional) : The VS version year
3284     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3286     unset vctest vcnum vcnumwithdot vcbuildnumber
3288     vs_versions_to_check "$1"
3290     for ver in $vsversions; do
3291         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3292         if test -n "$regvalue"; then
3293             vctest=$regvalue
3294             break
3295         fi
3296         # As always MSVC 15.0 is special here
3297         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver
3298         if test -n "$regvalue"; then
3299             AC_MSG_RESULT([found: $regvalue])
3300             PathFormat "$regvalue"
3301             vctest=$formatted_path
3302             break
3303         fi
3304     done
3305     if test -n "$vctest"; then
3306         vcnumwithdot=$ver
3307         case "$vcnumwithdot" in
3308         14.0)
3309             vcyear=2015
3310             vcnum=140
3311             ;;
3312         15.0)
3313             vcyear=2017
3314             vcnum=150
3315             vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3316             ;;
3317         esac
3318     fi
3321 SOLARINC=
3322 MSBUILD_PATH=
3323 DEVENV=
3324 if test "$_os" = "WINNT"; then
3325     AC_MSG_CHECKING([Visual C++])
3327     find_msvc "$with_visual_studio"
3328     if test -z "$vctest"; then
3329         if test -n "$with_visual_studio"; then
3330             AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3331         else
3332             AC_MSG_ERROR([No Visual Studio 2015/2017 installation found])
3333         fi
3334     fi
3336     if test "$BITNESS_OVERRIDE" = ""; then
3337         if test -f "$vctest/bin/cl.exe"; then
3338             VC_PRODUCT_DIR=$vctest
3339         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3340             VC_PRODUCT_DIR=$vctest/VC
3341         else
3342             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3343         fi
3344     else
3345         if test -f "$vctest/bin/amd64/cl.exe"; then
3346             VC_PRODUCT_DIR=$vctest
3347         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3348             VC_PRODUCT_DIR=$vctest/VC
3349         else
3350             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])
3351         fi
3352     fi
3354     AC_MSG_CHECKING([for short pathname of VC product directory])
3355     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3356     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3358     UCRTSDKDIR=
3359     UCRTVERSION=
3361     AC_MSG_CHECKING([for UCRT location])
3362     find_ucrt
3363     # find_ucrt errors out if it doesn't find it
3364     AC_MSG_RESULT([found])
3365     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3366     ucrtincpath_formatted=$formatted_path
3367     # SOLARINC is used for external modules and must be set too.
3368     # And no, it's not sufficient to set SOLARINC only, as configure
3369     # itself doesn't honour it.
3370     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3371     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3372     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3373     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3375     AC_SUBST(UCRTSDKDIR)
3376     AC_SUBST(UCRTVERSION)
3378     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3379     # Find the proper version of MSBuild.exe to use based on the VS version
3380     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3381     if test -n "$regvalue" ; then
3382         AC_MSG_RESULT([found: $regvalue])
3383         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3384     else
3385         if test $vcnum = "150"; then
3386             if test "$BITNESS_OVERRIDE" = ""; then
3387                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3388             else
3389                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3390             fi
3391             MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3392         else
3393             AC_MSG_ERROR([No msbuild found, Visual Studio installation broken?])
3394         fi
3395         AC_MSG_RESULT([$regvalue])
3396     fi
3398     # Find the version of devenv.exe
3399     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3400     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3401     if test ! -e "$DEVENV"; then
3402         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3403     fi
3405     dnl ===========================================================
3406     dnl  Check for the corresponding mspdb*.dll
3407     dnl ===========================================================
3409     MSPDB_PATH=
3410     CL_DIR=
3411     CL_LIB=
3413     if test "$BITNESS_OVERRIDE" = ""; then
3414         if test "$vcnum" = "150"; then
3415             MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86"
3416             CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX86/x86
3417         else
3418             MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3419             CL_DIR=bin
3420         fi
3421     else
3422         if test "$vcnum" = "150"; then
3423             MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64"
3424             CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX64/x64
3425         else
3426             MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3427             CL_DIR=bin/amd64
3428         fi
3429     fi
3431     # MSVC 15.0 has libraries from 14.0?
3432     if test  "$vcnum" = "150"; then
3433         mspdbnum="140"
3434     else
3435         mspdbnum=$vcnum
3436     fi
3438     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3439         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3440     fi
3442     MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3443     MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3445     dnl The path needs to be added before cl is called
3446     PATH="$MSPDB_PATH:$PATH"
3448     AC_MSG_CHECKING([cl.exe])
3450     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3451     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3452     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3453     # is not enough?
3455     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3456     dnl needed when building CLR code:
3457     if test -z "$MSVC_CXX"; then
3458         if test "$BITNESS_OVERRIDE" = ""; then
3459             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3460                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3461             fi
3462         else
3463             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3464                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3465             fi
3466         fi
3468         # This gives us a posix path with 8.3 filename restrictions
3469         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3470     fi
3472     if test -z "$CC"; then
3473         CC=$MSVC_CXX
3474     fi
3475     if test "$BITNESS_OVERRIDE" = ""; then
3476         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3477         MSVC_CXX="$MSVC_CXX -arch:SSE"
3478     fi
3480     if test -n "$CC"; then
3481         # Remove /cl.exe from CC case insensitive
3482         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3483         if test "$BITNESS_OVERRIDE" = ""; then
3484            if test "$vcnum" = "150"; then
3485                COMPATH="$VC_PRODUCT_DIR"
3486            else
3487                COMPATH=`echo "$CC" | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3488            fi
3489         else
3490             if test -n "$VC_PRODUCT_DIR"; then
3491                 COMPATH=$VC_PRODUCT_DIR
3492             fi
3493         fi
3494         if test "$BITNESS_OVERRIDE" = ""; then
3495             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3496             CC="$CC -arch:SSE"
3497         fi
3499         if test "$vcnum" = "150"; then
3500             COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3501         fi
3503         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3505         PathFormat "$COMPATH"
3506         COMPATH="$formatted_path"
3508         VCVER=$vcnum
3509         MSVSVER=$vcyear
3511         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3512         # are always "better", we list them in reverse chronological order.
3514         case $vcnum in
3515         140)
3516             COMEX=19
3517             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3518             ;;
3519         150)
3520             COMEX=19
3521             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3522             ;;
3523         esac
3525         # The expectation is that --with-windows-sdk should not need to be used
3526         if test -n "$with_windows_sdk"; then
3527             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3528             *" "$with_windows_sdk" "*)
3529                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3530                 ;;
3531             *)
3532                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3533                 ;;
3534             esac
3535         fi
3537         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3538         ac_objext=obj
3539         ac_exeext=exe
3541     else
3542         AC_MSG_ERROR([Visual C++ not found after all, huh])
3543     fi
3545     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3546     # version of the Explorer extension (and maybe other small
3547     # bits, too) needed when installing a 32-bit LibreOffice on a
3548     # 64-bit OS. The 64-bit Explorer extension is a feature that
3549     # has been present since long in OOo. Don't confuse it with
3550     # building LibreOffice itself as 64-bit code.
3552     BUILD_X64=
3553     CXX_X64_BINARY=
3554     LINK_X64_BINARY=
3556     if test "$BITNESS_OVERRIDE" = ""; then
3557         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3558         if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3559             # Prefer native x64 compiler to cross-compiler, in case we are running
3560             # the build on a 64-bit OS.
3561             if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3562                 BUILD_X64=TRUE
3563                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3564                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3565             elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3566                 BUILD_X64=TRUE
3567                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3568                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3569             fi
3570         elif test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib"; then
3571             # nobody uses 32-bit OS to build, just pick the 64-bit compiler
3572             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3573                 BUILD_X64=TRUE
3574                 CXX_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"
3575                 LINK_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/link.exe"
3576             fi
3577         fi
3578         if test "$BUILD_X64" = TRUE; then
3579             AC_MSG_RESULT([found])
3580         else
3581             AC_MSG_RESULT([not found])
3582             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3583         fi
3584     fi
3585     AC_SUBST(BUILD_X64)
3587     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3588     AC_SUBST(CXX_X64_BINARY)
3589     AC_SUBST(LINK_X64_BINARY)
3591 AC_SUBST(VCVER)
3592 AC_SUBST(DEVENV)
3593 PathFormat "$MSPDB_PATH"
3594 MSPDB_PATH="$formatted_path"
3595 AC_SUBST(MSVC_CXX)
3598 # unowinreg.dll
3600 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3601 AC_SUBST(UNOWINREG_DLL)
3603 COM_IS_CLANG=
3604 AC_MSG_CHECKING([whether the compiler is actually Clang])
3605 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3606     #ifndef __clang__
3607     you lose
3608     #endif
3609     int foo=42;
3610     ]])],
3611     [AC_MSG_RESULT([yes])
3612      COM_IS_CLANG=TRUE],
3613     [AC_MSG_RESULT([no])])
3615 CC_PLAIN=$CC
3616 if test "$COM_IS_CLANG" = TRUE; then
3617     AC_MSG_CHECKING([the Clang version])
3618     if test "$_os" = WINNT; then
3619         dnl In which case, assume clang-cl:
3620         my_args="/EP /TC"
3621         dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3622         dnl clang-cl:
3623         CC_PLAIN=
3624         for i in $CC; do
3625             case $i in
3626             -FIIntrin.h)
3627                 ;;
3628             *)
3629                 CC_PLAIN="$CC_PLAIN $i"
3630                 ;;
3631             esac
3632         done
3633     else
3634         my_args="-E -P"
3635     fi
3636     clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args -`
3637     CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3638     CLANGVER=`echo $clang_version \
3639         | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3640     AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3641     AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3642     AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3644 AC_SUBST(COM_IS_CLANG)
3645 AC_SUBST(CLANGVER)
3647 SHOWINCLUDES_PREFIX=
3648 if test "$_os" = WINNT; then
3649     dnl We need to guess the prefix of the -showIncludes output, it can be
3650     dnl localized
3651     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3652     echo "#include <stdlib.h>" > conftest.c
3653     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3654         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3655     rm -f conftest.c conftest.obj
3656     if test -z "$SHOWINCLUDES_PREFIX"; then
3657         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3658     else
3659         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3660     fi
3662 AC_SUBST(SHOWINCLUDES_PREFIX)
3665 # prefix C with ccache if needed
3667 if test "$CCACHE" != ""; then
3668     AC_MSG_CHECKING([whether $CC is already ccached])
3670     AC_LANG_PUSH([C])
3671     save_CFLAGS=$CFLAGS
3672     CFLAGS="$CFLAGS --ccache-skip -O2"
3673     dnl an empty program will do, we're checking the compiler flags
3674     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3675                       [use_ccache=yes], [use_ccache=no])
3676     if test $use_ccache = yes; then
3677         AC_MSG_RESULT([yes])
3678     else
3679         CC="$CCACHE $CC"
3680         AC_MSG_RESULT([no])
3681     fi
3682     CFLAGS=$save_CFLAGS
3683     AC_LANG_POP([C])
3686 # ===================================================================
3687 # check various GCC options that Clang does not support now but maybe
3688 # will somewhen in the future, check them even for GCC, so that the
3689 # flags are set
3690 # ===================================================================
3692 HAVE_GCC_GGDB2=
3693 HAVE_GCC_FINLINE_LIMIT=
3694 HAVE_GCC_FNO_INLINE=
3695 if test "$GCC" = "yes"; then
3696     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3697     save_CFLAGS=$CFLAGS
3698     CFLAGS="$CFLAGS -Werror -ggdb2"
3699     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3700     CFLAGS=$save_CFLAGS
3701     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3702         AC_MSG_RESULT([yes])
3703     else
3704         AC_MSG_RESULT([no])
3705     fi
3707     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3708     save_CFLAGS=$CFLAGS
3709     CFLAGS="$CFLAGS -Werror -finline-limit=0"
3710     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3711     CFLAGS=$save_CFLAGS
3712     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3713         AC_MSG_RESULT([yes])
3714     else
3715         AC_MSG_RESULT([no])
3716     fi
3718     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3719     save_CFLAGS=$CFLAGS
3720     CFLAGS="$CFLAGS -Werror -fno-inline"
3721     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3722     CFLAGS=$save_CFLAGS
3723     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3724         AC_MSG_RESULT([yes])
3725     else
3726         AC_MSG_RESULT([no])
3727     fi
3729     if test "$host_cpu" = "m68k"; then
3730         AC_MSG_CHECKING([whether $CC supports -mlong-jump-table-offsets])
3731         save_CFLAGS=$CFLAGS
3732         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3733         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3734         CFLAGS=$save_CFLAGS
3735         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3736             AC_MSG_RESULT([yes])
3737         else
3738             AC_MSG_ERROR([no])
3739         fi
3740     fi
3742 AC_SUBST(HAVE_GCC_GGDB2)
3743 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3744 AC_SUBST(HAVE_GCC_FNO_INLINE)
3746 dnl ===================================================================
3747 dnl  Test the gcc version
3748 dnl ===================================================================
3749 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3750     AC_MSG_CHECKING([the GCC version])
3751     _gcc_version=`$CC -dumpversion`
3752     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3753         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3754     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3756     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3758     if test "$gcc_full_version" -lt 40801; then
3759         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.8.1])
3760     fi
3761 else
3762     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3763     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3764     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3765     # (which reports itself as GCC 4.2.1).
3766     GCC_VERSION=
3768 AC_SUBST(GCC_VERSION)
3770 dnl Set the ENABLE_DBGUTIL variable
3771 dnl ===================================================================
3772 AC_MSG_CHECKING([whether to build with additional debug utilities])
3773 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3774     ENABLE_DBGUTIL="TRUE"
3775     # this is an extra var so it can have different default on different MSVC
3776     # versions (in case there are version specific problems with it)
3777     MSVC_USE_DEBUG_RUNTIME="TRUE"
3779     AC_MSG_RESULT([yes])
3780     # cppunit and graphite expose STL in public headers
3781     if test "$with_system_cppunit" = "yes"; then
3782         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3783     else
3784         with_system_cppunit=no
3785     fi
3786     if test "$with_system_graphite" = "yes"; then
3787         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3788     else
3789         with_system_graphite=no
3790     fi
3791     if test "$with_system_mysql_cppconn" = "yes"; then
3792         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3793     else
3794         with_system_mysql_cppconn=no
3795     fi
3796     if test "$with_system_orcus" = "yes"; then
3797         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3798     else
3799         with_system_orcus=no
3800     fi
3801     if test "$with_system_libcmis" = "yes"; then
3802         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3803     else
3804         with_system_libcmis=no
3805     fi
3806     if test "$with_system_hunspell" = "yes"; then
3807         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3808     else
3809         with_system_hunspell=no
3810     fi
3811     if test "$with_system_gpgmepp" = "yes"; then
3812         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3813     else
3814         with_system_gpgmepp=no
3815     fi
3816     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3817     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3818     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3819     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3820     # of those two is using the system variant:
3821     if test "$with_system_libnumbertext" = "yes"; then
3822         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3823     else
3824         with_system_libnumbertext=no
3825     fi
3826     if test "$with_system_libwps" = "yes"; then
3827         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3828     else
3829         with_system_libwps=no
3830     fi
3831 else
3832     ENABLE_DBGUTIL=""
3833     MSVC_USE_DEBUG_RUNTIME=""
3834     AC_MSG_RESULT([no])
3836 AC_SUBST(ENABLE_DBGUTIL)
3837 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3839 dnl Set the ENABLE_DEBUG variable.
3840 dnl ===================================================================
3841 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3842     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3844 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3845     if test -z "$libo_fuzzed_enable_debug"; then
3846         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3847     else
3848         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3849         enable_debug=yes
3850     fi
3853 AC_MSG_CHECKING([whether to do a debug build])
3854 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3855     ENABLE_DEBUG="TRUE"
3856     if test -n "$ENABLE_DBGUTIL" ; then
3857         AC_MSG_RESULT([yes (dbgutil)])
3858     else
3859         AC_MSG_RESULT([yes])
3860     fi
3861 else
3862     ENABLE_DEBUG=""
3863     AC_MSG_RESULT([no])
3865 AC_SUBST(ENABLE_DEBUG)
3867 if test "$enable_sal_log" = yes; then
3868     ENABLE_SAL_LOG=TRUE
3870 AC_SUBST(ENABLE_SAL_LOG)
3872 dnl Selective debuginfo
3873 ENABLE_DEBUGINFO_FOR=
3874 if test -n "$ENABLE_DEBUG"; then
3875     AC_MSG_CHECKING([whether to use selective debuginfo])
3876     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3877         if test "$enable_selective_debuginfo" = "yes"; then
3878             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3879         fi
3880         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3881         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3882     else
3883         ENABLE_DEBUGINFO_FOR=all
3884         AC_MSG_RESULT([no, for all])
3885     fi
3886 else
3887     if test -n "$enable_selective_debuginfo"; then
3888         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
3889     fi
3891 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3893 dnl Check for enable symbols option
3894 dnl ===================================================================
3895 AC_MSG_CHECKING([whether to generate debug information])
3896 if test -z "$enable_symbols"; then
3897     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3898         enable_symbols=yes
3899     else
3900         enable_symbols=no
3901     fi
3903 if test "$enable_symbols" != no; then
3904     ENABLE_SYMBOLS=TRUE
3905     AC_MSG_RESULT([yes])
3906 else
3907     ENABLE_SYMBOLS=
3908     AC_MSG_RESULT([no])
3910 AC_SUBST(ENABLE_SYMBOLS)
3912 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
3913     # Building on Android with full symbols: without enough memory the linker never finishes currently.
3914     AC_MSG_CHECKING([whether enough memory is available for linking])
3915     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
3916     # Check for 15GB, as Linux reports a bit less than the physical memory size.
3917     if test -n "$mem_size" -a $mem_size -lt 15728640; then
3918         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
3919     else
3920         AC_MSG_RESULT([yes])
3921     fi
3924 AC_MSG_CHECKING([whether to compile with optimization flags])
3925 if test -z "$enable_optimized"; then
3926     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3927         enable_optimized=no
3928     else
3929         enable_optimized=yes
3930     fi
3932 if test "$enable_optimized" != no; then
3933     ENABLE_OPTIMIZED=TRUE
3934     AC_MSG_RESULT([yes])
3935 else
3936     ENABLE_OPTIMIZED=
3937     AC_MSG_RESULT([no])
3939 AC_SUBST(ENABLE_OPTIMIZED)
3942 # determine CPUNAME, OS, ...
3943 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
3945 case "$host_os" in
3947 aix*)
3948     COM=GCC
3949     CPUNAME=POWERPC
3950     USING_X11=TRUE
3951     OS=AIX
3952     RTL_OS=AIX
3953     RTL_ARCH=PowerPC
3954     PLATFORMID=aix_powerpc
3955     P_SEP=:
3956     ;;
3958 cygwin*)
3959     COM=MSC
3960     USING_X11=
3961     OS=WNT
3962     RTL_OS=Windows
3963     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3964         P_SEP=";"
3965     else
3966         P_SEP=:
3967     fi
3968     case "$host_cpu" in
3969     i*86|x86_64)
3970         if test "$BITNESS_OVERRIDE" = 64; then
3971             CPUNAME=X86_64
3972             RTL_ARCH=X86_64
3973             PLATFORMID=windows_x86_64
3974             WINDOWS_X64=1
3975             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
3976         else
3977             CPUNAME=INTEL
3978             RTL_ARCH=x86
3979             PLATFORMID=windows_x86
3980         fi
3981         ;;
3982     *)
3983         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3984         ;;
3985     esac
3986     SCPDEFS="$SCPDEFS -D_MSC_VER"
3987     ;;
3989 darwin*)
3990     COM=GCC
3991     USING_X11=
3992     OS=MACOSX
3993     RTL_OS=MacOSX
3994     P_SEP=:
3996     case "$host_cpu" in
3997     arm)
3998         AC_MSG_ERROR([Can't build 32-bit code for iOS])
3999         ;;
4000     arm64)
4001         OS=IOS
4002         if test "$enable_ios_simulator" = "yes"; then
4003             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4004         else
4005             CPUNAME=ARM64
4006             RTL_ARCH=ARM_EABI
4007             PLATFORMID=ios_arm64
4008         fi
4009         ;;
4010     i*86)
4011         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4012         ;;
4013     x86_64)
4014         if test "$enable_ios_simulator" = "yes"; then
4015             OS=IOS
4016         fi
4017         CPUNAME=X86_64
4018         RTL_ARCH=X86_64
4019         PLATFORMID=macosx_x86_64
4020         ;;
4021     *)
4022         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4023         ;;
4024     esac
4025     ;;
4027 dragonfly*)
4028     COM=GCC
4029     USING_X11=TRUE
4030     OS=DRAGONFLY
4031     RTL_OS=DragonFly
4032     P_SEP=:
4034     case "$host_cpu" in
4035     i*86)
4036         CPUNAME=INTEL
4037         RTL_ARCH=x86
4038         PLATFORMID=dragonfly_x86
4039         ;;
4040     x86_64)
4041         CPUNAME=X86_64
4042         RTL_ARCH=X86_64
4043         PLATFORMID=dragonfly_x86_64
4044         ;;
4045     *)
4046         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4047         ;;
4048     esac
4049     ;;
4051 freebsd*)
4052     COM=GCC
4053     USING_X11=TRUE
4054     RTL_OS=FreeBSD
4055     OS=FREEBSD
4056     P_SEP=:
4058     case "$host_cpu" in
4059     i*86)
4060         CPUNAME=INTEL
4061         RTL_ARCH=x86
4062         PLATFORMID=freebsd_x86
4063         ;;
4064     x86_64|amd64)
4065         CPUNAME=X86_64
4066         RTL_ARCH=X86_64
4067         PLATFORMID=freebsd_x86_64
4068         ;;
4069     *)
4070         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4071         ;;
4072     esac
4073     ;;
4075 haiku*)
4076     COM=GCC
4077     USING_X11=
4078     GUIBASE=haiku
4079     RTL_OS=Haiku
4080     OS=HAIKU
4081     P_SEP=:
4083     case "$host_cpu" in
4084     i*86)
4085         CPUNAME=INTEL
4086         RTL_ARCH=x86
4087         PLATFORMID=haiku_x86
4088         ;;
4089     x86_64|amd64)
4090         CPUNAME=X86_64
4091         RTL_ARCH=X86_64
4092         PLATFORMID=haiku_x86_64
4093         ;;
4094     *)
4095         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4096         ;;
4097     esac
4098     ;;
4100 kfreebsd*)
4101     COM=GCC
4102     USING_X11=TRUE
4103     OS=LINUX
4104     RTL_OS=kFreeBSD
4105     P_SEP=:
4107     case "$host_cpu" in
4109     i*86)
4110         CPUNAME=INTEL
4111         RTL_ARCH=x86
4112         PLATFORMID=kfreebsd_x86
4113         ;;
4114     x86_64)
4115         CPUNAME=X86_64
4116         RTL_ARCH=X86_64
4117         PLATFORMID=kfreebsd_x86_64
4118         ;;
4119     *)
4120         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4121         ;;
4122     esac
4123     ;;
4125 linux-gnu*)
4126     COM=GCC
4127     USING_X11=TRUE
4128     OS=LINUX
4129     RTL_OS=Linux
4130     P_SEP=:
4132     case "$host_cpu" in
4134     aarch64)
4135         CPUNAME=AARCH64
4136         PLATFORMID=linux_aarch64
4137         RTL_ARCH=AARCH64
4138         ;;
4139     alpha)
4140         CPUNAME=AXP
4141         RTL_ARCH=ALPHA
4142         PLATFORMID=linux_alpha
4143         ;;
4144     arm*)
4145         CPUNAME=ARM
4146         EPM_FLAGS="-a arm"
4147         RTL_ARCH=ARM_EABI
4148         PLATFORMID=linux_arm_eabi
4149         case "$host_cpu" in
4150         arm*-linux)
4151             RTL_ARCH=ARM_OABI
4152             PLATFORMID=linux_arm_oabi
4153             ;;
4154         esac
4155         ;;
4156     hppa)
4157         CPUNAME=HPPA
4158         RTL_ARCH=HPPA
4159         EPM_FLAGS="-a hppa"
4160         PLATFORMID=linux_hppa
4161         ;;
4162     i*86)
4163         CPUNAME=INTEL
4164         RTL_ARCH=x86
4165         PLATFORMID=linux_x86
4166         ;;
4167     ia64)
4168         CPUNAME=IA64
4169         RTL_ARCH=IA64
4170         PLATFORMID=linux_ia64
4171         ;;
4172     mips)
4173         CPUNAME=GODSON
4174         RTL_ARCH=MIPS_EB
4175         EPM_FLAGS="-a mips"
4176         PLATFORMID=linux_mips_eb
4177         ;;
4178     mips64)
4179         CPUNAME=GODSON64
4180         RTL_ARCH=MIPS64_EB
4181         EPM_FLAGS="-a mips64"
4182         PLATFORMID=linux_mips64_eb
4183         ;;
4184     mips64el)
4185         CPUNAME=GODSON64
4186         RTL_ARCH=MIPS64_EL
4187         EPM_FLAGS="-a mips64el"
4188         PLATFORMID=linux_mips64_el
4189         ;;
4190     mipsel)
4191         CPUNAME=GODSON
4192         RTL_ARCH=MIPS_EL
4193         EPM_FLAGS="-a mipsel"
4194         PLATFORMID=linux_mips_el
4195         ;;
4196     m68k)
4197         CPUNAME=M68K
4198         RTL_ARCH=M68K
4199         PLATFORMID=linux_m68k
4200         ;;
4201     powerpc)
4202         CPUNAME=POWERPC
4203         RTL_ARCH=PowerPC
4204         PLATFORMID=linux_powerpc
4205         ;;
4206     powerpc64)
4207         CPUNAME=POWERPC64
4208         RTL_ARCH=PowerPC_64
4209         PLATFORMID=linux_powerpc64
4210         ;;
4211     powerpc64le)
4212         CPUNAME=POWERPC64
4213         RTL_ARCH=PowerPC_64_LE
4214         PLATFORMID=linux_powerpc64_le
4215         ;;
4216     sparc)
4217         CPUNAME=SPARC
4218         RTL_ARCH=SPARC
4219         PLATFORMID=linux_sparc
4220         ;;
4221     sparc64)
4222         CPUNAME=SPARC64
4223         RTL_ARCH=SPARC64
4224         PLATFORMID=linux_sparc64
4225         ;;
4226     s390)
4227         CPUNAME=S390
4228         RTL_ARCH=S390
4229         PLATFORMID=linux_s390
4230         ;;
4231     s390x)
4232         CPUNAME=S390X
4233         RTL_ARCH=S390x
4234         PLATFORMID=linux_s390x
4235         ;;
4236     x86_64)
4237         CPUNAME=X86_64
4238         RTL_ARCH=X86_64
4239         PLATFORMID=linux_x86_64
4240         ;;
4241     *)
4242         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4243         ;;
4244     esac
4245     ;;
4247 linux-android*)
4248     COM=GCC
4249     USING_X11=
4250     OS=ANDROID
4251     RTL_OS=Android
4252     P_SEP=:
4254     case "$host_cpu" in
4256     arm|armel)
4257         CPUNAME=ARM
4258         RTL_ARCH=ARM_EABI
4259         PLATFORMID=android_arm_eabi
4260         ;;
4261     aarch64)
4262         CPUNAME=AARCH64
4263         RTL_ARCH=AARCH64
4264         PLATFORMID=android_aarch64
4265         ;;
4266     mips|mipsel)
4267         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4268         RTL_ARCH=MIPS_EL
4269         PLATFORMID=android_mips_el
4270         ;;
4271     i*86)
4272         CPUNAME=INTEL
4273         RTL_ARCH=x86
4274         PLATFORMID=android_x86
4275         ;;
4276     *)
4277         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4278         ;;
4279     esac
4280     ;;
4282 *netbsd*)
4283     COM=GCC
4284     USING_X11=TRUE
4285     OS=NETBSD
4286     RTL_OS=NetBSD
4287     P_SEP=:
4289     case "$host_cpu" in
4290     i*86)
4291         CPUNAME=INTEL
4292         RTL_ARCH=x86
4293         PLATFORMID=netbsd_x86
4294         ;;
4295     powerpc)
4296         CPUNAME=POWERPC
4297         RTL_ARCH=PowerPC
4298         PLATFORMID=netbsd_powerpc
4299         ;;
4300     sparc)
4301         CPUNAME=SPARC
4302         RTL_ARCH=SPARC
4303         PLATFORMID=netbsd_sparc
4304         ;;
4305     x86_64)
4306         CPUNAME=X86_64
4307         RTL_ARCH=X86_64
4308         PLATFORMID=netbsd_x86_64
4309         ;;
4310     *)
4311         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4312         ;;
4313     esac
4314     ;;
4316 openbsd*)
4317     COM=GCC
4318     USING_X11=TRUE
4319     OS=OPENBSD
4320     RTL_OS=OpenBSD
4321     P_SEP=:
4323     case "$host_cpu" in
4324     i*86)
4325         CPUNAME=INTEL
4326         RTL_ARCH=x86
4327         PLATFORMID=openbsd_x86
4328         ;;
4329     x86_64)
4330         CPUNAME=X86_64
4331         RTL_ARCH=X86_64
4332         PLATFORMID=openbsd_x86_64
4333         ;;
4334     *)
4335         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4336         ;;
4337     esac
4338     SOLARINC="$SOLARINC -I/usr/local/include"
4339     ;;
4341 solaris*)
4342     COM=GCC
4343     USING_X11=TRUE
4344     OS=SOLARIS
4345     RTL_OS=Solaris
4346     P_SEP=:
4348     case "$host_cpu" in
4349     i*86)
4350         CPUNAME=INTEL
4351         RTL_ARCH=x86
4352         PLATFORMID=solaris_x86
4353         ;;
4354     sparc)
4355         CPUNAME=SPARC
4356         RTL_ARCH=SPARC
4357         PLATFORMID=solaris_sparc
4358         ;;
4359     sparc64)
4360         CPUNAME=SPARC64
4361         RTL_ARCH=SPARC64
4362         PLATFORMID=solaris_sparc64
4363         ;;
4364     *)
4365         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4366         ;;
4367     esac
4368     SOLARINC="$SOLARINC -I/usr/local/include"
4369     ;;
4372     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4373     ;;
4374 esac
4376 if test "$with_x" = "no"; then
4377     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4380 ENABLE_HEADLESS=""
4381 if test "$enable_gui" = "no"; then
4382     if test "$USING_X11" != TRUE; then
4383         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4384     fi
4385     USING_X11=
4386     ENABLE_HEADLESS=TRUE
4387     AC_DEFINE(HAVE_FEATURE_UI,0)
4388     test_cairo=yes
4390 AC_SUBST(ENABLE_HEADLESS)
4392 WORKDIR="${BUILDDIR}/workdir"
4393 INSTDIR="${BUILDDIR}/instdir"
4394 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4395 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4396 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4397 AC_SUBST(COM)
4398 AC_SUBST(CPUNAME)
4399 AC_SUBST(RTL_OS)
4400 AC_SUBST(RTL_ARCH)
4401 AC_SUBST(EPM_FLAGS)
4402 AC_SUBST(USING_X11)
4403 AC_SUBST([INSTDIR])
4404 AC_SUBST([INSTROOT])
4405 AC_SUBST([INSTROOTBASE])
4406 AC_SUBST(OS)
4407 AC_SUBST(P_SEP)
4408 AC_SUBST(WORKDIR)
4409 AC_SUBST(PLATFORMID)
4410 AC_SUBST(WINDOWS_X64)
4411 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4413 dnl ===================================================================
4414 dnl Test which package format to use
4415 dnl ===================================================================
4416 AC_MSG_CHECKING([which package format to use])
4417 if test -n "$with_package_format" -a "$with_package_format" != no; then
4418     for i in $with_package_format; do
4419         case "$i" in
4420         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4421             ;;
4422         *)
4423             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4424 aix - AIX software distribution
4425 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4426 deb - Debian software distribution
4427 pkg - Solaris software distribution
4428 rpm - RedHat software distribution
4430 LibreOffice additionally supports:
4431 archive - .tar.gz or .zip
4432 dmg - Mac OS X .dmg
4433 installed - installation tree
4434 msi - Windows .msi
4435         ])
4436             ;;
4437         esac
4438     done
4439     # fakeroot is needed to ensure correct file ownerships/permissions
4440     # inside deb packages and tar archives created on Linux and Solaris.
4441     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4442         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4443         if test "$FAKEROOT" = "no"; then
4444             AC_MSG_ERROR(
4445                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4446         fi
4447     fi
4448     PKGFORMAT="$with_package_format"
4449     AC_MSG_RESULT([$PKGFORMAT])
4450 else
4451     PKGFORMAT=
4452     AC_MSG_RESULT([none])
4454 AC_SUBST(PKGFORMAT)
4456 dnl ===================================================================
4457 dnl Set up a different compiler to produce tools to run on the build
4458 dnl machine when doing cross-compilation
4459 dnl ===================================================================
4461 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4462 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4463 if test "$cross_compiling" = "yes"; then
4464     AC_MSG_CHECKING([for BUILD platform configuration])
4465     echo
4466     rm -rf CONF-FOR-BUILD config_build.mk
4467     mkdir CONF-FOR-BUILD
4468     # Here must be listed all files needed when running the configure script. In particular, also
4469     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4470     # keep them in the same order as there.
4471     (cd $SRC_ROOT && tar cf - \
4472         config.guess \
4473         bin/get_config_variables \
4474         solenv/bin/getcompver.awk \
4475         solenv/inc/langlist.mk \
4476         download.lst \
4477         config_host.mk.in \
4478         config_host_lang.mk.in \
4479         Makefile.in \
4480         lo.xcent.in \
4481         bin/bffvalidator.sh.in \
4482         bin/odfvalidator.sh.in \
4483         bin/officeotron.sh.in \
4484         instsetoo_native/util/openoffice.lst.in \
4485         config_host/*.in \
4486         sysui/desktop/macosx/Info.plist.in) \
4487     | (cd CONF-FOR-BUILD && tar xf -)
4488     cp configure CONF-FOR-BUILD
4489     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4490     (
4491     unset COM USING_X11 OS CPUNAME
4492     unset CC CXX SYSBASE CFLAGS
4493     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4494     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4495     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4496     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4497     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4498     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4499     cd CONF-FOR-BUILD
4500     sub_conf_opts=""
4501     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4502     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4503     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4504     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4505     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4506     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4507     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4508     # Don't bother having configure look for stuff not needed for the build platform anyway
4509     ./configure \
4510         --disable-cups \
4511         --disable-gtk3 \
4512         --disable-pdfimport \
4513         --disable-postgresql-sdbc \
4514         --with-parallelism="$with_parallelism" \
4515         --without-doxygen \
4516         --without-java \
4517         $sub_conf_opts \
4518         --srcdir=$srcdir \
4519         2>&1 | sed -e 's/^/    /'
4520     test -f ./config_host.mk 2>/dev/null || exit
4521     cp config_host.mk ../config_build.mk
4522     cp config_host_lang.mk ../config_build_lang.mk
4523     mv config.log ../config.Build.log
4524     mkdir -p ../config_build
4525     mv config_host/*.h ../config_build
4526     . ./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
4528     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
4529         VV='$'$V
4530         VV=`eval "echo $VV"`
4531         if test -n "$VV"; then
4532             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4533             echo "$line" >>build-config
4534         fi
4535     done
4537     for V in INSTDIR INSTROOT WORKDIR; do
4538         VV='$'$V
4539         VV=`eval "echo $VV"`
4540         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4541         if test -n "$VV"; then
4542             line="${V}_FOR_BUILD='$VV'"
4543             echo "$line" >>build-config
4544         fi
4545     done
4547     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4548     echo "$line" >>build-config
4550     )
4551     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4552     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])
4553     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4554              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4556     eval `cat CONF-FOR-BUILD/build-config`
4558     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4560     rm -rf CONF-FOR-BUILD
4561 else
4562     OS_FOR_BUILD="$OS"
4563     CC_FOR_BUILD="$CC"
4564     CXX_FOR_BUILD="$CXX"
4565     INSTDIR_FOR_BUILD="$INSTDIR"
4566     INSTROOT_FOR_BUILD="$INSTROOT"
4567     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4568     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4569     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4570     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4571     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4572     WORKDIR_FOR_BUILD="$WORKDIR"
4574 AC_SUBST(OS_FOR_BUILD)
4575 AC_SUBST(INSTDIR_FOR_BUILD)
4576 AC_SUBST(INSTROOT_FOR_BUILD)
4577 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4578 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4579 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4580 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4581 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4582 AC_SUBST(WORKDIR_FOR_BUILD)
4584 dnl ===================================================================
4585 dnl Check for syslog header
4586 dnl ===================================================================
4587 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4589 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4590 dnl ===================================================================
4591 AC_MSG_CHECKING([whether to turn warnings to errors])
4592 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4593     ENABLE_WERROR="TRUE"
4594     AC_MSG_RESULT([yes])
4595 else
4596     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4597         ENABLE_WERROR="TRUE"
4598         AC_MSG_RESULT([yes])
4599     else
4600         AC_MSG_RESULT([no])
4601     fi
4603 AC_SUBST(ENABLE_WERROR)
4605 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4606 dnl ===================================================================
4607 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4608 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4609     ASSERT_ALWAYS_ABORT="TRUE"
4610     AC_MSG_RESULT([yes])
4611 else
4612     ASSERT_ALWAYS_ABORT="FALSE"
4613     AC_MSG_RESULT([no])
4615 AC_SUBST(ASSERT_ALWAYS_ABORT)
4617 # Determine whether to use ooenv for the instdir installation
4618 # ===================================================================
4619 if test $_os != "WINNT" -a $_os != "Darwin"; then
4620     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4621     if test "$enable_ooenv" = "no"; then
4622         AC_MSG_RESULT([no])
4623     else
4624         ENABLE_OOENV="TRUE"
4625         AC_MSG_RESULT([yes])
4626     fi
4628 AC_SUBST(ENABLE_OOENV)
4630 if test "$USING_X11" != TRUE; then
4631     # be sure to do not mess with unneeded stuff
4632     test_randr=no
4633     test_xrender=no
4634     test_cups=no
4635     test_dbus=no
4636     test_gtk=no
4637     build_gstreamer_1_0=no
4638     build_gstreamer_0_10=no
4639     test_kde4=no
4640     test_kde5=no
4641     test_qt5=no
4642     test_gtk3_kde5=no
4643     enable_cairo_canvas=no
4646 if test "$OS" = "HAIKU"; then
4647     enable_cairo_canvas=yes
4648     test_qt5=yes
4651 dnl ===================================================================
4652 dnl check for cups support
4653 dnl ===================================================================
4654 ENABLE_CUPS=""
4656 if test "$enable_cups" = "no"; then
4657     test_cups=no
4660 AC_MSG_CHECKING([whether to enable CUPS support])
4661 if test "$test_cups" = "yes"; then
4662     ENABLE_CUPS="TRUE"
4663     AC_MSG_RESULT([yes])
4665     AC_MSG_CHECKING([whether cups support is present])
4666     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4667     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4668     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4669         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4670     fi
4672 else
4673     AC_MSG_RESULT([no])
4676 AC_SUBST(ENABLE_CUPS)
4678 # fontconfig checks
4679 if test "$test_fontconfig" = "yes"; then
4680     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4681     SYSTEM_FONTCONFIG=TRUE
4682     FilterLibs "${FONTCONFIG_LIBS}"
4683     FONTCONFIG_LIBS="${filteredlibs}"
4685 AC_SUBST(FONTCONFIG_CFLAGS)
4686 AC_SUBST(FONTCONFIG_LIBS)
4687 AC_SUBST([SYSTEM_FONTCONFIG])
4689 dnl whether to find & fetch external tarballs?
4690 dnl ===================================================================
4691 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4692    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4693        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4694    else
4695        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4696    fi
4698 if test -z "$TARFILE_LOCATION"; then
4699     if test -d "$SRC_ROOT/src" ; then
4700         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4701         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4702     fi
4703     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4704 else
4705     AbsolutePath "$TARFILE_LOCATION"
4706     PathFormat "${absolute_path}"
4707     TARFILE_LOCATION="${formatted_path}"
4709 AC_SUBST(TARFILE_LOCATION)
4711 AC_MSG_CHECKING([whether we want to fetch tarballs])
4712 if test "$enable_fetch_external" != "no"; then
4713     if test "$with_all_tarballs" = "yes"; then
4714         AC_MSG_RESULT([yes, all of them])
4715         DO_FETCH_TARBALLS="ALL"
4716     else
4717         AC_MSG_RESULT([yes, if we use them])
4718         DO_FETCH_TARBALLS="TRUE"
4719     fi
4720 else
4721     AC_MSG_RESULT([no])
4722     DO_FETCH_TARBALLS=
4724 AC_SUBST(DO_FETCH_TARBALLS)
4726 AC_MSG_CHECKING([whether to build help])
4727 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4728     BUILD_TYPE="$BUILD_TYPE HELP"
4729     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4730     case "$with_help" in
4731     "html")
4732         ENABLE_HTMLHELP=TRUE
4733         SCPDEFS="$SCPDEFS -DWITH_HELP"
4734         AC_MSG_RESULT([HTML])
4735         ;;
4736     "online")
4737         ENABLE_HTMLHELP=TRUE
4738         HELP_ONLINE=TRUE
4739         AC_MSG_RESULT([HTML])
4740         ;;
4741     yes)
4742         SCPDEFS="$SCPDEFS -DWITH_HELP"
4743         AC_MSG_RESULT([yes])
4744         ;;
4745     *)
4746         AC_MSG_ERROR([Unknown --with-help=$with_help])
4747         ;;
4748     esac
4749 else
4750     AC_MSG_RESULT([no])
4752 AC_SUBST([ENABLE_HTMLHELP])
4753 AC_SUBST([HELP_ONLINE])
4755 dnl Test whether to include MySpell dictionaries
4756 dnl ===================================================================
4757 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4758 if test "$with_myspell_dicts" = "yes"; then
4759     AC_MSG_RESULT([yes])
4760     WITH_MYSPELL_DICTS=TRUE
4761     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4762     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4763 else
4764     AC_MSG_RESULT([no])
4765     WITH_MYSPELL_DICTS=
4767 AC_SUBST(WITH_MYSPELL_DICTS)
4769 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4770 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4771     if test "$with_system_dicts" = yes; then
4772         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4773     fi
4774     with_system_dicts=no
4777 AC_MSG_CHECKING([whether to use dicts from external paths])
4778 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4779     AC_MSG_RESULT([yes])
4780     SYSTEM_DICTS=TRUE
4781     AC_MSG_CHECKING([for spelling dictionary directory])
4782     if test -n "$with_external_dict_dir"; then
4783         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4784     else
4785         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4786         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4787             DICT_SYSTEM_DIR=file:///usr/share/myspell
4788         fi
4789     fi
4790     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4791     AC_MSG_CHECKING([for hyphenation patterns directory])
4792     if test -n "$with_external_hyph_dir"; then
4793         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4794     else
4795         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4796     fi
4797     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4798     AC_MSG_CHECKING([for thesaurus directory])
4799     if test -n "$with_external_thes_dir"; then
4800         THES_SYSTEM_DIR=file://$with_external_thes_dir
4801     else
4802         THES_SYSTEM_DIR=file:///usr/share/mythes
4803     fi
4804     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4805 else
4806     AC_MSG_RESULT([no])
4807     SYSTEM_DICTS=
4809 AC_SUBST(SYSTEM_DICTS)
4810 AC_SUBST(DICT_SYSTEM_DIR)
4811 AC_SUBST(HYPH_SYSTEM_DIR)
4812 AC_SUBST(THES_SYSTEM_DIR)
4814 dnl ===================================================================
4815 dnl enable pch by default on windows
4816 dnl enable it explicitly otherwise
4817 ENABLE_PCH=""
4818 if test "$enable_pch" = yes -a "$enable_compiler_plugins" = yes; then
4819     if test -z "$libo_fuzzed_enable_pch"; then
4820         AC_MSG_ERROR([--enable-pch cannot be used with --enable-compiler-plugins])
4821     else
4822         AC_MSG_NOTICE([Resetting --enable-pch=no])
4823         enable_pch=no
4824     fi
4827 AC_MSG_CHECKING([whether to enable pch feature])
4828 if test "$enable_pch" != "no"; then
4829     if test "$_os" = "WINNT"; then
4830         ENABLE_PCH="TRUE"
4831         AC_MSG_RESULT([yes])
4832     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4833         ENABLE_PCH="TRUE"
4834         AC_MSG_RESULT([yes])
4835     elif test -n "$enable_pch"; then
4836         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4837     else
4838         AC_MSG_RESULT([no])
4839     fi
4840 else
4841     AC_MSG_RESULT([no])
4843 AC_SUBST(ENABLE_PCH)
4845 TAB=`printf '\t'`
4847 AC_MSG_CHECKING([the GNU Make version])
4848 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4849 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4850 if test "$_make_longver" -ge "038200"; then
4851     AC_MSG_RESULT([$GNUMAKE $_make_version])
4853 elif test "$_make_longver" -ge "038100"; then
4854     if test "$build_os" = "cygwin"; then
4855         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4856     fi
4857     AC_MSG_RESULT([$GNUMAKE $_make_version])
4859     dnl ===================================================================
4860     dnl Search all the common names for sha1sum
4861     dnl ===================================================================
4862     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4863     if test -z "$SHA1SUM"; then
4864         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
4865     elif test "$SHA1SUM" = "openssl"; then
4866         SHA1SUM="openssl sha1"
4867     fi
4868     AC_MSG_CHECKING([for GNU Make bug 20033])
4869     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4870     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4871 A := \$(wildcard *.a)
4873 .PHONY: all
4874 all: \$(A:.a=.b)
4875 <TAB>@echo survived bug20033.
4877 .PHONY: setup
4878 setup:
4879 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4881 define d1
4882 @echo lala \$(1)
4883 @sleep 1
4884 endef
4886 define d2
4887 @echo tyty \$(1)
4888 @sleep 1
4889 endef
4891 %.b : %.a
4892 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4893 <TAB>\$(call d1,\$(CHECKSUM)),\
4894 <TAB>\$(call d2,\$(CHECKSUM)))
4896     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4897         no_parallelism_make="YES"
4898         AC_MSG_RESULT([yes, disable parallelism])
4899     else
4900         AC_MSG_RESULT([no, keep parallelism enabled])
4901     fi
4902     rm -rf $TESTGMAKEBUG20033
4903 else
4904     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4907 # find if gnumake support file function
4908 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
4909 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4910 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4911     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
4913 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4914 \$(file >test.txt,Success )
4916 .PHONY: all
4917 all:
4918 <TAB>@cat test.txt
4921 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4922 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4923     HAVE_GNUMAKE_FILE_FUNC=TRUE
4924     AC_MSG_RESULT([yes])
4925 else
4926     AC_MSG_RESULT([no])
4928 rm -rf $TESTGMAKEFILEFUNC
4929 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4930 AC_SUBST(GNUMAKE_WIN_NATIVE)
4932 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
4933 STALE_MAKE=
4934 if test "$_make_ver_check" = ""; then
4935    STALE_MAKE=TRUE
4938 HAVE_LD_HASH_STYLE=FALSE
4939 WITH_LINKER_HASH_STYLE=
4940 AC_MSG_CHECKING([for --hash-style gcc linker support])
4941 if test "$GCC" = "yes"; then
4942     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4943         hash_styles="gnu sysv"
4944     elif test "$with_linker_hash_style" = "no"; then
4945         hash_styles=
4946     else
4947         hash_styles="$with_linker_hash_style"
4948     fi
4950     for hash_style in $hash_styles; do
4951         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4952         hash_style_ldflags_save=$LDFLAGS
4953         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
4955         AC_RUN_IFELSE([AC_LANG_PROGRAM(
4956             [
4957 #include <stdio.h>
4958             ],[
4959 printf ("");
4960             ])],
4961             [
4962                   HAVE_LD_HASH_STYLE=TRUE
4963                   WITH_LINKER_HASH_STYLE=$hash_style
4964             ],
4965             [HAVE_LD_HASH_STYLE=FALSE],
4966             [HAVE_LD_HASH_STYLE=FALSE])
4967         LDFLAGS=$hash_style_ldflags_save
4968     done
4970     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
4971         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
4972     else
4973         AC_MSG_RESULT( no )
4974     fi
4975     LDFLAGS=$hash_style_ldflags_save
4976 else
4977     AC_MSG_RESULT( no )
4979 AC_SUBST(HAVE_LD_HASH_STYLE)
4980 AC_SUBST(WITH_LINKER_HASH_STYLE)
4982 dnl ===================================================================
4983 dnl Check whether there's a Perl version available.
4984 dnl ===================================================================
4985 if test -z "$with_perl_home"; then
4986     AC_PATH_PROG(PERL, perl)
4987 else
4988     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
4989     _perl_path="$with_perl_home/bin/perl"
4990     if test -x "$_perl_path"; then
4991         PERL=$_perl_path
4992     else
4993         AC_MSG_ERROR([$_perl_path not found])
4994     fi
4997 dnl ===================================================================
4998 dnl Testing for Perl version 5 or greater.
4999 dnl $] is the Perl version variable, it is returned as an integer
5000 dnl ===================================================================
5001 if test "$PERL"; then
5002     AC_MSG_CHECKING([the Perl version])
5003     ${PERL} -e "exit($]);"
5004     _perl_version=$?
5005     if test "$_perl_version" -lt 5; then
5006         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5007     fi
5008     AC_MSG_RESULT([Perl $_perl_version])
5009 else
5010     AC_MSG_ERROR([Perl not found, install Perl 5])
5013 dnl ===================================================================
5014 dnl Testing for required Perl modules
5015 dnl ===================================================================
5017 AC_MSG_CHECKING([for required Perl modules])
5018 perl_use_string="use Cwd ; use Digest::MD5"
5019 if test "$_os" = "WINNT"; then
5020     if test -n "$PKGFORMAT"; then
5021         for i in $PKGFORMAT; do
5022             case "$i" in
5023             msi)
5024                 # for getting fonts versions to use in MSI
5025                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5026                 ;;
5027             esac
5028         done
5029     fi
5031 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5032     AC_MSG_RESULT([all modules found])
5033 else
5034     AC_MSG_RESULT([failed to find some modules])
5035     # Find out which modules are missing.
5036     for i in $perl_use_string; do
5037         if test "$i" != "use" -a "$i" != ";"; then
5038             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5039                 missing_perl_modules="$missing_perl_modules $i"
5040             fi
5041         fi
5042     done
5043     AC_MSG_ERROR([
5044     The missing Perl modules are: $missing_perl_modules
5045     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5048 dnl ===================================================================
5049 dnl Check for pkg-config
5050 dnl ===================================================================
5051 if test "$_os" != "WINNT"; then
5052     PKG_PROG_PKG_CONFIG
5055 if test "$_os" != "WINNT"; then
5057     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5058     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5059     # explicitly. Or put /path/to/compiler in PATH yourself.
5061     # Use wrappers for LTO
5062     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5063         AC_CHECK_TOOL(AR,gcc-ar)
5064         AC_CHECK_TOOL(NM,gcc-nm)
5065         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5066     else
5067         AC_CHECK_TOOL(AR,ar)
5068         AC_CHECK_TOOL(NM,nm)
5069         AC_CHECK_TOOL(RANLIB,ranlib)
5070     fi
5071     AC_CHECK_TOOL(OBJDUMP,objdump)
5072     AC_CHECK_TOOL(READELF,readelf)
5073     AC_CHECK_TOOL(STRIP,strip)
5074     if test "$_os" = "WINNT"; then
5075         AC_CHECK_TOOL(DLLTOOL,dlltool)
5076         AC_CHECK_TOOL(WINDRES,windres)
5077     fi
5079 AC_SUBST(AR)
5080 AC_SUBST(DLLTOOL)
5081 AC_SUBST(NM)
5082 AC_SUBST(OBJDUMP)
5083 AC_SUBST(PKG_CONFIG)
5084 AC_SUBST(RANLIB)
5085 AC_SUBST(READELF)
5086 AC_SUBST(STRIP)
5087 AC_SUBST(WINDRES)
5089 dnl ===================================================================
5090 dnl pkg-config checks on Mac OS X
5091 dnl ===================================================================
5093 if test $_os = Darwin; then
5094     AC_MSG_CHECKING([for bogus pkg-config])
5095     if test -n "$PKG_CONFIG"; then
5096         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5097             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5098         else
5099             if test "$enable_bogus_pkg_config" = "yes"; then
5100                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5101             else
5102                 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.])
5103             fi
5104         fi
5105     else
5106         AC_MSG_RESULT([no, good])
5107     fi
5110 find_csc()
5112     # Return value: $csctest
5114     unset csctest
5116     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5117     if test -n "$regvalue"; then
5118         csctest=$regvalue
5119         return
5120     fi
5123 find_al()
5125     # Return value: $altest
5127     unset altest
5129     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5130         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5131         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5132             altest=$regvalue
5133             return
5134         fi
5135     done
5137     # We need this additional check to detect 4.6.1 or above.
5138     for ver in 4.7.1 4.7 4.6.2 4.6.1; do
5139         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5140         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5141             altest=$regvalue
5142             return
5143         fi
5145         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/WOW6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools"
5146         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5147             altest=$regvalue
5148             return
5149         fi
5150     done
5153 find_dotnetsdk()
5155     # Return value: $frametest (that's a silly name...)
5157     unset frametest
5159     for ver in 1.1 2.0; do
5160         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
5161         if test -n "$regvalue"; then
5162             frametest=$regvalue
5163             return
5164         fi
5165     done
5168 find_dotnetsdk46()
5170     unset frametest
5172     for ver in 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5173         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5174         if test -n "$regvalue"; then
5175             frametest=$regvalue
5176             return
5177         fi
5178         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5179         if test -n "$regvalue"; then
5180             frametest=$regvalue
5181             return
5182         fi
5183     done
5186 find_winsdk_version()
5188     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5189     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5191     unset winsdktest winsdkbinsubdir winsdklibsubdir
5193     case "$1" in
5194     7.*)
5195         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5196         if test -n "$regvalue"; then
5197             winsdktest=$regvalue
5198             winsdklibsubdir=.
5199             return
5200         fi
5201         ;;
5202     8.0|8.0A)
5203         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5204         if test -n "$regvalue"; then
5205             winsdktest=$regvalue
5206             winsdklibsubdir=win8
5207             return
5208         fi
5209         ;;
5210     8.1|8.1A)
5211         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5212         if test -n "$regvalue"; then
5213             winsdktest=$regvalue
5214             winsdklibsubdir=winv6.3
5215             return
5216         fi
5217         ;;
5218     10.0)
5219         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5220         if test -n "$regvalue"; then
5221             winsdktest=$regvalue
5222             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5223             if test -n "$regvalue"; then
5224                 winsdkbinsubdir="$regvalue".0
5225             fi
5226             winsdklibsubdir=$regvalue
5227             if test "$regvalue" = "10.0.14393"; then
5228                 winsdklibsubdir="10.0.14393.0"
5229             elif test "$regvalue" = "10.0.16299"; then
5230                 winsdklibsubdir="10.0.16299.0"
5231             elif test "$regvalue" = "10.0.15063"; then
5232                 winsdklibsubdir="10.0.15063.0"
5233             elif test "$regvalue" = "10.0.17134"; then
5234                 winsdklibsubdir="$regvalue.0"
5235             fi
5236             return
5237         fi
5238         ;;
5239     esac
5242 find_winsdk()
5244     # Return value: From find_winsdk_version
5246     unset winsdktest
5248     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5249         find_winsdk_version $ver
5250         if test -n "$winsdktest"; then
5251             return
5252         fi
5253     done
5256 find_msms()
5258     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5259     if test $VCVER = 150; then
5260         my_msm_files="Microsoft_VC141_CRT_x86.msm ${my_msm_files}"
5261     fi
5262     AC_MSG_CHECKING([for ${my_msm_files}])
5263     msmdir=
5264     for ver in 14.0 15.0; do
5265         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5266         if test -n "$regvalue"; then
5267             for f in ${my_msm_files}; do
5268                 if test -e "$regvalue/${f}"; then
5269                     msmdir=$regvalue
5270                     break
5271                 fi
5272             done
5273         fi
5274     done
5275     dnl Is the following fallback really necessary, or was it added in response
5276     dnl to never having started Visual Studio on a given machine, so the
5277     dnl registry keys checked above had presumably not yet been created?
5278     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5279     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5280     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5281     dnl expanding to "C:\Program Files\Common Files"), which would need
5282     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5283     dnl obtain its value from cygwin:
5284     if test -z "$msmdir"; then
5285         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5286         for f in ${my_msm_files}; do
5287             if test -e "$my_msm_dir/${f}"; then
5288                 msmdir=$my_msm_dir
5289             fi
5290         done
5291     fi
5293     dnl Starting from MSVC 15.0, merge modules are located in different directory
5294     if test $VCVER = 150; then
5295         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5296             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])
5297             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5298             for f in ${my_msm_files}; do
5299                 if test -e "$my_msm_dir/${f}"; then
5300                     msmdir=$my_msm_dir
5301                     break
5302                 fi
5303             done
5304         done
5305     fi
5307     if test -n "$msmdir"; then
5308         msmdir=`cygpath -m "$msmdir"`
5309         AC_MSG_RESULT([$msmdir])
5310     else
5311         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5312             AC_MSG_ERROR([not found])
5313         else
5314             AC_MSG_WARN([not found])
5315             add_warning "MSM none of ${my_msm_files} found"
5316         fi
5317     fi
5320 find_msvc_x64_dlls()
5322     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5323     if test "$VCVER" = 150; then
5324         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5325             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT])
5326             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5327                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5328                 break
5329             fi
5330             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5331                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5332                 break
5333             fi
5334         done
5335     fi
5336     msvcdlls="msvcp140.dll vcruntime140.dll"
5337     for dll in $msvcdlls; do
5338         if ! test -f "$msvcdllpath/$dll"; then
5339             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5340         fi
5341     done
5344 dnl =========================================
5345 dnl Check for the Windows  SDK.
5346 dnl =========================================
5347 if test "$_os" = "WINNT"; then
5348     AC_MSG_CHECKING([for Windows SDK])
5349     if test "$build_os" = "cygwin"; then
5350         find_winsdk
5351         WINDOWS_SDK_HOME=$winsdktest
5353         # normalize if found
5354         if test -n "$WINDOWS_SDK_HOME"; then
5355             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5356             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5357         fi
5359         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5360     fi
5362     if test -n "$WINDOWS_SDK_HOME"; then
5363         # Remove a possible trailing backslash
5364         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5366         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5367              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5368              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5369             have_windows_sdk_headers=yes
5370         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5371              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5372              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5373             have_windows_sdk_headers=yes
5374         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5375              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5376              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5377             have_windows_sdk_headers=yes
5378         else
5379             have_windows_sdk_headers=no
5380         fi
5382         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5383             have_windows_sdk_libs=yes
5384         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5385             have_windows_sdk_libs=yes
5386         else
5387             have_windows_sdk_libs=no
5388         fi
5390         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5391             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5392 the  Windows SDK are installed.])
5393         fi
5394     fi
5396     if test -z "$WINDOWS_SDK_HOME"; then
5397         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5398     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
5399         WINDOWS_SDK_VERSION=70
5400         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
5401     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5402         WINDOWS_SDK_VERSION=80
5403         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5404     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5405         WINDOWS_SDK_VERSION=81
5406         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5407     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5408         WINDOWS_SDK_VERSION=10
5409         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5410     else
5411         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5412     fi
5413     PathFormat "$WINDOWS_SDK_HOME"
5414     WINDOWS_SDK_HOME="$formatted_path"
5415     if test "$build_os" = "cygwin"; then
5416         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5417         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5418             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5419         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5420             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5421         fi
5422     fi
5424     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5425     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5426     dnl but not in v8.0), so allow this to be overridden with a
5427     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5428     dnl and configuration error if no WiLangId.vbs is found would arguably be
5429     dnl better, but I do not know under which conditions exactly it is needed by
5430     dnl msiglobal.pm:
5431     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5432         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5433         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5434             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5435         fi
5436         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5437             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5438         fi
5439         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5440             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5441         fi
5442     fi
5443     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5444         if test -n "$with_package_format" -a "$with_package_format" != no; then
5445             for i in "$with_package_format"; do
5446                 if test "$i" = "msi"; then
5447                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5448                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5449                     fi
5450                 fi
5451             done
5452         fi
5453     fi
5455 AC_SUBST(WINDOWS_SDK_HOME)
5456 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5457 AC_SUBST(WINDOWS_SDK_VERSION)
5458 AC_SUBST(WINDOWS_SDK_WILANGID)
5460 if test "$build_os" = "cygwin"; then
5461     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5462     dnl dir, it also determines that dir's path w/o an arch segment if any,
5463     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5464     AC_MSG_CHECKING([for midl.exe])
5466     find_winsdk
5467     if test -n "$winsdkbinsubdir" \
5468         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5469     then
5470         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5471         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5472     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5473         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5474         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5475     elif test -f "$winsdktest/Bin/midl.exe"; then
5476         MIDL_PATH=$winsdktest/Bin
5477         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5478     fi
5479     if test ! -f "$MIDL_PATH/midl.exe"; then
5480         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5481     else
5482         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5483     fi
5485     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5486     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5488     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5489          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5490          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5491          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5492     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5493          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5494          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5495          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5496     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5497          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5498          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5499          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5500     else
5501         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5502     fi
5504     dnl Check csc.exe
5505     AC_MSG_CHECKING([for csc.exe])
5506     find_csc
5507     if test -f "$csctest/csc.exe"; then
5508         CSC_PATH="$csctest"
5509     fi
5510     if test ! -f "$CSC_PATH/csc.exe"; then
5511         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5512     else
5513         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5514     fi
5516     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5518     dnl Check al.exe
5519     AC_MSG_CHECKING([for al.exe])
5520     find_winsdk
5521     if test -n "$winsdkbinsubdir" \
5522         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5523     then
5524         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5525     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5526         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5527     elif test -f "$winsdktest/Bin/al.exe"; then
5528         AL_PATH="$winsdktest/Bin"
5529     fi
5531     if test -z "$AL_PATH"; then
5532         find_al
5533         if test -f "$altest/bin/al.exe"; then
5534             AL_PATH="$altest/bin"
5535         elif test -f "$altest/al.exe"; then
5536             AL_PATH="$altest"
5537         fi
5538     fi
5539     if test ! -f "$AL_PATH/al.exe"; then
5540         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5541     else
5542         AC_MSG_RESULT([$AL_PATH/al.exe])
5543     fi
5545     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5547     dnl Check mscoree.lib / .NET Framework dir
5548     AC_MSG_CHECKING(.NET Framework)
5549     find_dotnetsdk
5550     if test -f "$frametest/lib/mscoree.lib"; then
5551         DOTNET_FRAMEWORK_HOME="$frametest"
5552     else
5553         find_winsdk
5554         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5555             DOTNET_FRAMEWORK_HOME="$winsdktest"
5556         else
5557             find_dotnetsdk46
5558             PathFormat "$frametest"
5559             frametest="$formatted_path"
5560             if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5561                  DOTNET_FRAMEWORK_HOME="$frametest"
5562             fi
5563         fi
5564     fi
5566     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
5567         AC_MSG_ERROR([mscoree.lib not found])
5568     fi
5569     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5571     PathFormat "$MIDL_PATH"
5572     MIDL_PATH="$formatted_path"
5574     PathFormat "$AL_PATH"
5575     AL_PATH="$formatted_path"
5577     PathFormat "$DOTNET_FRAMEWORK_HOME"
5578     DOTNET_FRAMEWORK_HOME="$formatted_path"
5580     PathFormat "$CSC_PATH"
5581     CSC_PATH="$formatted_path"
5584 dnl ===================================================================
5585 dnl Check if stdc headers are available excluding MSVC.
5586 dnl ===================================================================
5587 if test "$_os" != "WINNT"; then
5588     AC_HEADER_STDC
5591 dnl ===================================================================
5592 dnl Testing for C++ compiler and version...
5593 dnl ===================================================================
5595 if test "$_os" != "WINNT"; then
5596     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5597     save_CXXFLAGS=$CXXFLAGS
5598     AC_PROG_CXX
5599     CXXFLAGS=$save_CXXFLAGS
5600 else
5601     if test -n "$CC" -a -z "$CXX"; then
5602         CXX="$CC"
5603     fi
5606 dnl At least MSVC 2015 Update 1 is known to sporadically emit warning C4592
5607 dnl ("implementation limitation" when defining OUStringLiteral variables in
5608 dnl vcl/source/app/IconThemeInfo.cxx), while Update 3 is known good, and it is
5609 dnl probably a good idea to require that anyway.  A reliable way to check for
5610 dnl MSVC 2015 Update 3 appears to be to check for support of C++17 nested
5611 dnl namespace definitions (which requires /std:c++latest to be enabled):
5612 if test "$COM" = MSC -a "$VCVER" = 140; then
5613     AC_MSG_CHECKING([whether MSVC 2015 compiler $MSVC_CXX is at least Update 3])
5614     save_CXX=$CXX
5615     save_CXXFLAGS=$CXXFLAGS
5616     CXX=$MSVC_CXX
5617     CXXFLAGS="$CXXFLAGS /std:c++latest"
5618     AC_LANG_PUSH([C++])
5619     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5620         namespace A::B {}
5621     ]])], [good=yes], [good=no])
5622     AC_LANG_POP([C++])
5623     CXX=$save_CXX
5624     CXXFLAGS=$save_CXXFLAGS
5625     AC_MSG_RESULT([$good])
5626     if test "$good" = no; then
5627         AC_MSG_ERROR([When using MSVC 2015, at least Update 3 must be installed])
5628     fi
5631 dnl check for GNU C++ compiler version
5632 if test "$GXX" = "yes"; then
5633     AC_MSG_CHECKING([the GNU C++ compiler version])
5635     _gpp_version=`$CXX -dumpversion`
5636     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5638     if test "$_gpp_majmin" -lt "401"; then
5639         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5640     else
5641         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5642     fi
5644     dnl see https://code.google.com/p/android/issues/detail?id=41770
5645     if test "$_gpp_majmin" -ge "401"; then
5646         glibcxx_threads=no
5647         AC_LANG_PUSH([C++])
5648         AC_REQUIRE_CPP
5649         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5650         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5651             #include <bits/c++config.h>]],[[
5652             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5653             && !defined(_GLIBCXX__PTHREADS) \
5654             && !defined(_GLIBCXX_HAS_GTHREADS)
5655             choke me
5656             #endif
5657         ]])],[AC_MSG_RESULT([yes])
5658         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5659         AC_LANG_POP([C++])
5660         if test $glibcxx_threads = yes; then
5661             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5662         fi
5663      fi
5665 AC_SUBST(BOOST_CXXFLAGS)
5668 # prefx CXX with ccache if needed
5670 if test "$CCACHE" != ""; then
5671     AC_MSG_CHECKING([whether $CXX is already ccached])
5672     AC_LANG_PUSH([C++])
5673     save_CXXFLAGS=$CXXFLAGS
5674     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5675     dnl an empty program will do, we're checking the compiler flags
5676     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5677                       [use_ccache=yes], [use_ccache=no])
5678     if test $use_ccache = yes; then
5679         AC_MSG_RESULT([yes])
5680     else
5681         CXX="$CCACHE $CXX"
5682         AC_MSG_RESULT([no])
5683     fi
5684     CXXFLAGS=$save_CXXFLAGS
5685     AC_LANG_POP([C++])
5688 dnl ===================================================================
5689 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5690 dnl ===================================================================
5692 if test "$_os" != "WINNT"; then
5693     AC_PROG_CXXCPP
5695     dnl Check whether there's a C pre-processor.
5696     AC_PROG_CPP
5700 dnl ===================================================================
5701 dnl Find integral type sizes and alignments
5702 dnl ===================================================================
5704 if test "$_os" != "WINNT"; then
5706 if test "$_os" == "iOS"; then
5707     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5708     ac_cv_sizeof_long=8
5709     ac_cv_sizeof_short=2
5710     ac_cv_sizeof_int=4
5711     ac_cv_sizeof_long_long=8
5712     ac_cv_sizeof_double=8
5713     ac_cv_sizeof_voidp=8
5714 else
5715     AC_CHECK_SIZEOF(long)
5716     AC_CHECK_SIZEOF(short)
5717     AC_CHECK_SIZEOF(int)
5718     AC_CHECK_SIZEOF(long long)
5719     AC_CHECK_SIZEOF(double)
5720     AC_CHECK_SIZEOF(void*)
5723     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5724     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5725     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5726     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5727     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5729     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5730     m4_pattern_allow([AC_CHECK_ALIGNOF])
5731     m4_ifdef([AC_CHECK_ALIGNOF],
5732         [
5733             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5734             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5735             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5736             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5737         ],
5738         [
5739             case "$_os-$host_cpu" in
5740             Linux-i686)
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=4
5744                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5745                 ;;
5746             Linux-x86_64)
5747                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5748                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5749                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5750                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5751                 ;;
5752             *)
5753                 if test -z "$ac_cv_alignof_short" -o \
5754                         -z "$ac_cv_alignof_int" -o \
5755                         -z "$ac_cv_alignof_long" -o \
5756                         -z "$ac_cv_alignof_double"; then
5757                    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.])
5758                 fi
5759                 ;;
5760             esac
5761         ])
5763     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5764     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5765     if test $ac_cv_sizeof_long -eq 8; then
5766         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5767     elif test $ac_cv_sizeof_double -eq 8; then
5768         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5769     else
5770         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5771     fi
5773     dnl Check for large file support
5774     AC_SYS_LARGEFILE
5775     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5776         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5777     fi
5778     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5779         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5780     fi
5781 else
5782     # Hardcode for MSVC
5783     SAL_TYPES_SIZEOFSHORT=2
5784     SAL_TYPES_SIZEOFINT=4
5785     SAL_TYPES_SIZEOFLONG=4
5786     SAL_TYPES_SIZEOFLONGLONG=8
5787     if test "$BITNESS_OVERRIDE" = ""; then
5788         SAL_TYPES_SIZEOFPOINTER=4
5789     else
5790         SAL_TYPES_SIZEOFPOINTER=8
5791     fi
5792     SAL_TYPES_ALIGNMENT2=2
5793     SAL_TYPES_ALIGNMENT4=4
5794     SAL_TYPES_ALIGNMENT8=8
5795     LFS_CFLAGS=''
5797 AC_SUBST(LFS_CFLAGS)
5799 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5800 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5801 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5802 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5803 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5804 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5805 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5806 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5808 dnl ===================================================================
5809 dnl Check whether to enable runtime optimizations
5810 dnl ===================================================================
5811 ENABLE_RUNTIME_OPTIMIZATIONS=
5812 AC_MSG_CHECKING([whether to enable runtime optimizations])
5813 if test -z "$enable_runtime_optimizations"; then
5814     for i in $CC; do
5815         case $i in
5816         -fsanitize=*)
5817             enable_runtime_optimizations=no
5818             break
5819             ;;
5820         esac
5821     done
5823 if test "$enable_runtime_optimizations" != no; then
5824     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5825     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5826     AC_MSG_RESULT([yes])
5827 else
5828     AC_MSG_RESULT([no])
5830 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5832 dnl ===================================================================
5833 dnl Check if valgrind headers are available
5834 dnl ===================================================================
5835 ENABLE_VALGRIND=
5836 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
5837     prev_cppflags=$CPPFLAGS
5838     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5839     # or where does it come from?
5840     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5841     AC_CHECK_HEADER([valgrind/valgrind.h],
5842         [ENABLE_VALGRIND=TRUE])
5843     CPPFLAGS=$prev_cppflags
5845 AC_SUBST([ENABLE_VALGRIND])
5846 if test -z "$ENABLE_VALGRIND"; then
5847     if test "$with_valgrind" = yes; then
5848         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
5849     fi
5850     VALGRIND_CFLAGS=
5852 AC_SUBST([VALGRIND_CFLAGS])
5855 dnl ===================================================================
5856 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5857 dnl ===================================================================
5859 # We need at least the sys/sdt.h include header.
5860 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5861 if test "$SDT_H_FOUND" = "TRUE"; then
5862     # Found sys/sdt.h header, now make sure the c++ compiler works.
5863     # Old g++ versions had problems with probes in constructors/destructors.
5864     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5865     AC_LANG_PUSH([C++])
5866     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5867     #include <sys/sdt.h>
5868     class ProbeClass
5869     {
5870     private:
5871       int& ref;
5872       const char *name;
5874     public:
5875       ProbeClass(int& v, const char *n) : ref(v), name(n)
5876       {
5877         DTRACE_PROBE2(_test_, cons, name, ref);
5878       }
5880       void method(int min)
5881       {
5882         DTRACE_PROBE3(_test_, meth, name, ref, min);
5883         ref -= min;
5884       }
5886       ~ProbeClass()
5887       {
5888         DTRACE_PROBE2(_test_, dest, name, ref);
5889       }
5890     };
5891     ]],[[
5892     int i = 64;
5893     DTRACE_PROBE1(_test_, call, i);
5894     ProbeClass inst = ProbeClass(i, "call");
5895     inst.method(24);
5896     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5897           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5898     AC_LANG_POP([C++])
5900 AC_CONFIG_HEADERS([config_host/config_probes.h])
5902 dnl ===================================================================
5903 dnl GCC features
5904 dnl ===================================================================
5905 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
5906     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5907     save_CFLAGS=$CFLAGS
5908     CFLAGS="$CFLAGS -Werror -mno-avx"
5909     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5910     CFLAGS=$save_CFLAGS
5911     if test "$HAVE_GCC_AVX" = "TRUE"; then
5912         AC_MSG_RESULT([yes])
5913     else
5914         AC_MSG_RESULT([no])
5915     fi
5917     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5918     save_CFLAGS=$CFLAGS
5919     CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
5920     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5921     CFLAGS=$save_CFLAGS
5922     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5923         AC_MSG_RESULT([yes])
5924     else
5925         AC_MSG_RESULT([no])
5926     fi
5928     AC_MSG_CHECKING([whether $CC supports atomic functions])
5929     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5930     int v = 0;
5931     if (__sync_add_and_fetch(&v, 1) != 1 ||
5932         __sync_sub_and_fetch(&v, 1) != 0)
5933         return 1;
5934     __sync_synchronize();
5935     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5936         v != 1)
5937         return 1;
5938     return 0;
5939 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5940     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5941         AC_MSG_RESULT([yes])
5942         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5943     else
5944         AC_MSG_RESULT([no])
5945     fi
5947     AC_MSG_CHECKING([whether $CC supports __builtin_ffs])
5948     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
5949     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
5950         AC_MSG_RESULT([yes])
5951         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
5952     else
5953         AC_MSG_RESULT([no])
5954     fi
5956     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5957     save_CFLAGS=$CFLAGS
5958     CFLAGS="$CFLAGS -Werror"
5959     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5960             __attribute__((deprecated("test"))) void f();
5961         ])], [
5962             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5963             AC_MSG_RESULT([yes])
5964         ], [AC_MSG_RESULT([no])])
5965     CFLAGS=$save_CFLAGS
5967     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
5968     AC_LANG_PUSH([C++])
5969     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5970             #include <cstddef>
5971             #include <cxxabi.h>
5972             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
5973         ])], [
5974             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
5975             AC_MSG_RESULT([yes])
5976         ], [AC_MSG_RESULT([no])])
5977     AC_LANG_POP([C++])
5979     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
5980     AC_LANG_PUSH([C++])
5981     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5982             #include <cstddef>
5983             #include <cxxabi.h>
5984             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
5985         ])], [
5986             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
5987             AC_MSG_RESULT([yes])
5988         ], [AC_MSG_RESULT([no])])
5989     AC_LANG_POP([C++])
5991     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
5992     AC_LANG_PUSH([C++])
5993     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5994             #include <cxxabi.h>
5995             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
5996         ])], [
5997             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
5998             AC_MSG_RESULT([yes])
5999         ], [AC_MSG_RESULT([no])])
6000     AC_LANG_POP([C++])
6002     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
6003     AC_LANG_PUSH([C++])
6004     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6005             #include <cstddef>
6006             #include <cxxabi.h>
6007             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6008         ])], [
6009             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6010             AC_MSG_RESULT([yes])
6011         ], [AC_MSG_RESULT([no])])
6012     AC_LANG_POP([C++])
6014     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
6015     AC_LANG_PUSH([C++])
6016     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6017             #include <cstddef>
6018             #include <cxxabi.h>
6019             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6020         ])], [
6021             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6022             AC_MSG_RESULT([yes])
6023         ], [AC_MSG_RESULT([no])])
6024     AC_LANG_POP([C++])
6026     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6027     AC_LANG_PUSH([C++])
6028     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6029             #include <cxxabi.h>
6030             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6031         ])], [
6032             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6033             AC_MSG_RESULT([yes])
6034         ], [AC_MSG_RESULT([no])])
6035     AC_LANG_POP([C++])
6037     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6038     AC_LANG_PUSH([C++])
6039     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6040             #include <cxxabi.h>
6041             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6042         ])], [
6043             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6044             AC_MSG_RESULT([yes])
6045         ], [AC_MSG_RESULT([no])])
6046     AC_LANG_POP([C++])
6048     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
6049     AC_LANG_PUSH([C++])
6050     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6051             #include <cstddef>
6052             #include <cxxabi.h>
6053             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6054         ])], [
6055             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6056             AC_MSG_RESULT([yes])
6057         ], [AC_MSG_RESULT([no])])
6058     AC_LANG_POP([C++])
6060     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
6061     AC_LANG_PUSH([C++])
6062     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6063             #include <cstddef>
6064             #include <cxxabi.h>
6065             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6066         ])], [
6067             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6068             AC_MSG_RESULT([yes])
6069         ], [AC_MSG_RESULT([no])])
6070     AC_LANG_POP([C++])
6072     dnl Available in GCC 4.9 and at least since Clang 3.4:
6073     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6074     AC_LANG_PUSH([C++])
6075     save_CXXFLAGS=$CXXFLAGS
6076     CXXFLAGS="$CXXFLAGS -Werror"
6077     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6078             struct __attribute__((warn_unused)) dummy {};
6079         ])], [
6080             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6081             AC_MSG_RESULT([yes])
6082         ], [AC_MSG_RESULT([no])])
6083     CXXFLAGS=$save_CXXFLAGS
6084 AC_LANG_POP([C++])
6087 AC_SUBST(HAVE_GCC_AVX)
6088 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6089 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6090 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6092 dnl ===================================================================
6093 dnl Identify the C++ library
6094 dnl ===================================================================
6096 AC_MSG_CHECKING([What the C++ library is])
6097 AC_LANG_PUSH([C++])
6098 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6099 #include <utility>
6100 #ifndef __GLIBCXX__
6101 foo bar
6102 #endif
6103 ]])],
6104     [CPP_LIBRARY=GLIBCXX
6105      cpp_library_name="GNU libstdc++"
6106     ],
6107     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6108 #include <utility>
6109 #ifndef _LIBCPP_VERSION
6110 foo bar
6111 #endif
6112 ]])],
6113     [CPP_LIBRARY=LIBCPP
6114      cpp_library_name="LLVM libc++"
6115      AC_DEFINE([HAVE_LIBCXX])
6116     ],
6117     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6118 #include <utility>
6119 #ifndef _MSC_VER
6120 foo bar
6121 #endif
6122 ]])],
6123     [CPP_LIBRARY=MSVCRT
6124      cpp_library_name="Microsoft"
6125     ],
6126     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6127 AC_MSG_RESULT([$cpp_library_name])
6128 AC_LANG_POP([C++])
6130 dnl ===================================================================
6131 dnl Check for gperf
6132 dnl ===================================================================
6133 AC_PATH_PROG(GPERF, gperf)
6134 if test -z "$GPERF"; then
6135     AC_MSG_ERROR([gperf not found but needed. Install it.])
6137 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6138     GPERF=`cygpath -m $GPERF`
6140 AC_MSG_CHECKING([gperf version])
6141 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
6142     AC_MSG_RESULT([OK])
6143 else
6144     AC_MSG_ERROR([too old, you need at least 3.0.0])
6146 AC_SUBST(GPERF)
6148 dnl ===================================================================
6149 dnl Check for system libcmis
6150 dnl ===================================================================
6151 # libcmis requires curl and we can't build curl for iOS
6152 if test $_os != iOS; then
6153     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.0])
6154     ENABLE_LIBCMIS=TRUE
6155 else
6156     ENABLE_LIBCMIS=
6158 AC_SUBST(ENABLE_LIBCMIS)
6160 dnl ===================================================================
6161 dnl C++11
6162 dnl ===================================================================
6164 my_cxx17switches=
6165 libo_FUZZ_ARG_ENABLE(c++17,
6166     AS_HELP_STRING([--disable-c++17],
6167         [Do not attempt to run GCC/Clang in C++17 mode (needed for Coverity).])
6170 CXXFLAGS_CXX11=
6171 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6172     AC_MSG_CHECKING([whether $CXX supports C++11])
6173     AC_MSG_RESULT(yes)
6174     # MSVC supports (a subset of) CXX11 without any switch
6175 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6176     HAVE_CXX11=
6177     AC_MSG_CHECKING([whether $CXX supports C++17, C++14, or C++11])
6178     dnl But only use C++17 if the gperf that is being used knows not to emit
6179     dnl "register" in C++ output:
6180     printf 'foo\n' | $GPERF -L C++ > conftest.inc
6181     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'
6182     if test "$enable_c__17" != no; then
6183         my_flags="-std=gnu++17 -std=gnu++1z -std=c++17 -std=c++1z $my_flags"
6184     fi
6185     for flag in $my_flags; do
6186         if test "$COM" = MSC; then
6187             flag="-Xclang $flag"
6188         fi
6189         save_CXXFLAGS=$CXXFLAGS
6190         CXXFLAGS="$CXXFLAGS $flag -Werror"
6191         if test "$SYSTEM_LIBCMIS" = TRUE; then
6192             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6193         fi
6194         AC_LANG_PUSH([C++])
6195         dnl Clang 3.9 supports __float128 since
6196         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6197         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6198         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6199         dnl $flag is supported below, so check this first):
6200         my_float128hack=
6201         my_float128hack_impl=-D__float128=void
6202         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6203             #include <vector>
6204             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6205             // (__float128)
6206             ]])
6207         ],,[
6208             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6209             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6210             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6211             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6212             dnl place where __float128 is used is in a template specialization, -D__float128=void
6213             dnl will avoid the problem there while still causing a problem if somebody actually uses
6214             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6215             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6216             dnl "fixed" with this hack):
6217             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6218             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6219                 #include <vector>
6220                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6221                 // (__float128)
6222                 ]])
6223             ],[my_float128hack=$my_float128hack_impl])
6224         ])
6225         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6226             #include <algorithm>
6227             #include <functional>
6228             #include <vector>
6230             #include <string.h>
6231             #pragma GCC diagnostic push
6232             #pragma GCC diagnostic ignored "-Wpragmas"
6233                 // make GCC not warn about next pragma
6234             #pragma GCC diagnostic ignored "-Wdeprecated-register"
6235                 // make Clang with -std < C++17 not even warn about register
6236             #include "conftest.inc"
6237             #pragma GCC diagnostic pop
6239             #if defined SYSTEM_LIBCMIS
6240             // See ucb/source/ucp/cmis/auth_provider.hxx:
6241             #if __GNUC__ >= 7
6242             #pragma GCC diagnostic push
6243             #pragma GCC diagnostic ignored "-Wdeprecated"
6244             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6245             #endif
6246             #include <libcmis/libcmis.hxx>
6247             #if __GNUC__ >= 7
6248             #pragma GCC diagnostic pop
6249             #endif
6250             #endif
6252             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6253                 std::sort(v.begin(), v.end(), fn);
6254             }
6255             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6256         AC_LANG_POP([C++])
6257         CXXFLAGS=$save_CXXFLAGS
6258         if test -n "$CXXFLAGS_CXX11"; then
6259             HAVE_CXX11=TRUE
6260             break
6261         fi
6262     done
6263     rm conftest.inc
6264     if test "$HAVE_CXX11" = TRUE; then
6265         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6266     else
6267         AC_MSG_ERROR(no)
6268     fi
6270 AC_SUBST(CXXFLAGS_CXX11)
6272 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6273 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6274 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6275 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6276 dnl again towards 4.7.2:
6277 if test $CPP_LIBRARY = GLIBCXX; then
6278     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6279     AC_LANG_PUSH([C++])
6280     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6281 #include <list>
6282 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6283     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6284     //   GCC 4.7.0: 20120322
6285     //   GCC 4.7.1: 20120614
6286     // and using a range check is not possible as the mapping between
6287     // __GLIBCXX__ values and GCC versions is not monotonic
6288 /* ok */
6289 #else
6290 abi broken
6291 #endif
6292         ]])], [AC_MSG_RESULT(no, ok)],
6293         [AC_MSG_ERROR(yes)])
6294     AC_LANG_POP([C++])
6297 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6298 save_CXXFLAGS=$CXXFLAGS
6299 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6300 AC_LANG_PUSH([C++])
6302 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6303 #include <stddef.h>
6305 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6307 namespace
6309         struct b
6310         {
6311                 int i;
6312                 int j;
6313         };
6315 ]], [[
6316 struct a
6318         int i;
6319         int j;
6321 a thinga[]={{0,0}, {1,1}};
6322 b thingb[]={{0,0}, {1,1}};
6323 size_t i = sizeof(sal_n_array_size(thinga));
6324 size_t j = sizeof(sal_n_array_size(thingb));
6325 return !(i != 0 && j != 0);
6327     ], [ AC_MSG_RESULT(yes) ],
6328     [ AC_MSG_ERROR(no)])
6329 AC_LANG_POP([C++])
6330 CXXFLAGS=$save_CXXFLAGS
6332 AC_MSG_CHECKING([whether $CXX supports C++14 constexpr])
6333 save_CXXFLAGS=$CXXFLAGS
6334 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6335 AC_LANG_PUSH([C++])
6336 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6337     // A somewhat over-complicated way of checking for
6338     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6339     // in constexpr function":
6340     #include <cassert>
6341     template<typename T> inline constexpr T f(T x) { return x; }
6342     template<typename T> inline constexpr T g(T x) {
6343         assert(f(static_cast<int>(x)));
6344         return x;
6345     }
6346     enum E { e };
6347     auto v = g(E::e);
6349     struct S {
6350         int n_;
6351         constexpr bool f() {
6352             int n = n_;
6353             int i = 0;
6354             while (n > 0) { --n; ++i; }
6355             assert(i >= 0);
6356             return i == 0;
6357         }
6358     };
6359     constexpr auto v2 = S{10}.f();
6360     ]])], [cxx14_constexpr=yes], [cxx14_constexpr=no])
6361 AC_LANG_POP([C++])
6362 CXXFLAGS=$save_CXXFLAGS
6363 AC_MSG_RESULT([$cxx14_constexpr])
6364 if test "$cxx14_constexpr" = yes; then
6365     AC_DEFINE([HAVE_CXX14_CONSTEXPR])
6368 dnl _Pragma support (may require C++11)
6369 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6370     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6371     AC_LANG_PUSH([C++])
6372     save_CXXFLAGS=$CXXFLAGS
6373     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6374     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6375             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6376         ])], [
6377             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6378             AC_MSG_RESULT([yes])
6379         ], [AC_MSG_RESULT([no])])
6380     AC_LANG_POP([C++])
6381     CXXFLAGS=$save_CXXFLAGS
6384 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6385 if test "$GCC" = yes; then
6386     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6387     AC_LANG_PUSH([C++])
6388     save_CXXFLAGS=$CXXFLAGS
6389     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6390     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6391     CXXFLAGS=$save_CXXFLAGS
6392     AC_LANG_POP([C++])
6393     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6394         AC_MSG_RESULT([yes])
6395     else
6396         AC_MSG_RESULT([no])
6397     fi
6399 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6401 dnl ===================================================================
6402 dnl system stl sanity tests
6403 dnl ===================================================================
6404 if test "$_os" != "WINNT"; then
6406     AC_LANG_PUSH([C++])
6408     save_CPPFLAGS="$CPPFLAGS"
6409     if test -n "$MACOSX_SDK_PATH"; then
6410         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6411     fi
6413     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6414     # only.
6415     if test "$CPP_LIBRARY" = GLIBCXX; then
6416         dnl gcc#19664, gcc#22482, rhbz#162935
6417         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6418         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6419         AC_MSG_RESULT([$stlvisok])
6420         if test "$stlvisok" = "no"; then
6421             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6422         fi
6423     fi
6425     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6426     # when we don't make any dynamic libraries?
6427     if test "$DISABLE_DYNLOADING" = ""; then
6428         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6429         cat > conftestlib1.cc <<_ACEOF
6430 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6431 struct S2: S1<int> { virtual ~S2(); };
6432 S2::~S2() {}
6433 _ACEOF
6434         cat > conftestlib2.cc <<_ACEOF
6435 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6436 struct S2: S1<int> { virtual ~S2(); };
6437 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6438 _ACEOF
6439         gccvisinlineshiddenok=yes
6440         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6441             gccvisinlineshiddenok=no
6442         else
6443             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6444             dnl known to not work with -z defs (unsetting which makes the test
6445             dnl moot, though):
6446             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6447             if test "$COM_IS_CLANG" = TRUE; then
6448                 for i in $CXX $CXXFLAGS; do
6449                     case $i in
6450                     -fsanitize=*)
6451                         my_linkflagsnoundefs=
6452                         break
6453                         ;;
6454                     esac
6455                 done
6456             fi
6457             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6458                 gccvisinlineshiddenok=no
6459             fi
6460         fi
6462         rm -fr libconftest*
6463         AC_MSG_RESULT([$gccvisinlineshiddenok])
6464         if test "$gccvisinlineshiddenok" = "no"; then
6465             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6466         fi
6467     fi
6469    AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6470     cat >visibility.cxx <<_ACEOF
6471 #pragma GCC visibility push(hidden)
6472 struct __attribute__ ((visibility ("default"))) TestStruct {
6473   static void Init();
6475 __attribute__ ((visibility ("default"))) void TestFunc() {
6476   TestStruct::Init();
6478 _ACEOF
6479     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6480         gccvisbroken=yes
6481     else
6482         case "$host_cpu" in
6483         i?86|x86_64)
6484             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6485                 gccvisbroken=no
6486             else
6487                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6488                     gccvisbroken=no
6489                 else
6490                     gccvisbroken=yes
6491                 fi
6492             fi
6493             ;;
6494         *)
6495             gccvisbroken=no
6496             ;;
6497         esac
6498     fi
6499     rm -f visibility.s visibility.cxx
6501     AC_MSG_RESULT([$gccvisbroken])
6502     if test "$gccvisbroken" = "yes"; then
6503         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6504     fi
6506     CPPFLAGS="$save_CPPFLAGS"
6508     AC_LANG_POP([C++])
6511 dnl ===================================================================
6512 dnl  Clang++ tests
6513 dnl ===================================================================
6515 HAVE_GCC_FNO_DEFAULT_INLINE=
6516 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6517 if test "$GCC" = "yes"; then
6518     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6519     AC_LANG_PUSH([C++])
6520     save_CXXFLAGS=$CXXFLAGS
6521     CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6522     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6523     CXXFLAGS=$save_CXXFLAGS
6524     AC_LANG_POP([C++])
6525     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6526         AC_MSG_RESULT([yes])
6527     else
6528         AC_MSG_RESULT([no])
6529     fi
6531     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6532     AC_LANG_PUSH([C++])
6533     save_CXXFLAGS=$CXXFLAGS
6534     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6535     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6536     CXXFLAGS=$save_CXXFLAGS
6537     AC_LANG_POP([C++])
6538     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6539         AC_MSG_RESULT([yes])
6540     else
6541         AC_MSG_RESULT([no])
6542     fi
6544 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6545 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6547 dnl ===================================================================
6548 dnl Compiler plugins
6549 dnl ===================================================================
6551 COMPILER_PLUGINS=
6552 # currently only Clang
6554 if test "$COM_IS_CLANG" != "TRUE"; then
6555     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6556         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6557         enable_compiler_plugins=no
6558     fi
6561 if test "$COM_IS_CLANG" = "TRUE"; then
6562     if test -n "$enable_compiler_plugins"; then
6563         compiler_plugins="$enable_compiler_plugins"
6564     elif test -n "$ENABLE_DBGUTIL"; then
6565         compiler_plugins=test
6566     else
6567         compiler_plugins=no
6568     fi
6569     if test "$compiler_plugins" != no -a "$CLANGVER" -lt 30800; then
6570         if test "$compiler_plugins" = yes; then
6571             AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 3.8.0.])
6572         else
6573             compiler_plugins=no
6574         fi
6575     fi
6576     if test "$compiler_plugins" != "no"; then
6577         dnl The prefix where Clang resides, override to where Clang resides if
6578         dnl using a source build:
6579         if test -z "$CLANGDIR"; then
6580             CLANGDIR=/usr
6581         fi
6582         AC_LANG_PUSH([C++])
6583         save_CPPFLAGS=$CPPFLAGS
6584         save_CXX=$CXX
6585         # compiler plugins must be built with "native" compiler that was used to build Clang itself:
6586         : "${COMPILER_PLUGINS_CXX=g++}"
6587         CXX=$COMPILER_PLUGINS_CXX
6588         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6589         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6590             [COMPILER_PLUGINS=TRUE],
6591             [
6592             if test "$compiler_plugins" = "yes"; then
6593                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6594             else
6595                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6596                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6597             fi
6598             ])
6599         CXX=$save_CXX
6600         CPPFLAGS=$save_CPPFLAGS
6601         AC_LANG_POP([C++])
6602     fi
6603 else
6604     if test "$enable_compiler_plugins" = "yes"; then
6605         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6606     fi
6608 AC_SUBST(COMPILER_PLUGINS)
6609 AC_SUBST(COMPILER_PLUGINS_CXX)
6610 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
6611 AC_SUBST(COMPILER_PLUGINS_DEBUG)
6612 AC_SUBST(CLANGDIR)
6613 AC_SUBST(CLANGLIBDIR)
6615 # Plugin to help linker.
6616 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6617 # This makes --enable-lto build with clang work.
6618 AC_SUBST(LD_PLUGIN)
6620 dnl ===================================================================
6621 dnl allocator
6622 dnl ===================================================================
6623 AC_MSG_CHECKING([which memory allocator to use])
6624 if test "$with_alloc" = "system"; then
6625     AC_MSG_RESULT([system])
6626     ALLOC="SYS_ALLOC"
6628 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6629     AC_MSG_RESULT([internal])
6631 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6632 AC_SUBST(HAVE_POSIX_FALLOCATE)
6633 AC_SUBST(ALLOC)
6635 dnl ===================================================================
6636 dnl Custom build version
6637 dnl ===================================================================
6639 AC_MSG_CHECKING([whether to add custom build version])
6640 if test "$with_build_version" != ""; then
6641     BUILD_VER_STRING=$with_build_version
6642     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6643 else
6644     BUILD_VER_STRING=
6645     AC_MSG_RESULT([no])
6647 AC_SUBST(BUILD_VER_STRING)
6649 JITC_PROCESSOR_TYPE=""
6650 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6651     # IBMs JDK needs this...
6652     JITC_PROCESSOR_TYPE=6
6653     export JITC_PROCESSOR_TYPE
6655 AC_SUBST([JITC_PROCESSOR_TYPE])
6657 # Misc Windows Stuff
6658 AC_ARG_WITH(ucrt-dir,
6659     AS_HELP_STRING([--with-ucrt-dir],
6660         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
6661         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
6662         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
6663             Windows6.1-KB2999226-x64.msu
6664             Windows6.1-KB2999226-x86.msu
6665             Windows8.1-KB2999226-x64.msu
6666             Windows8.1-KB2999226-x86.msu
6667             Windows8-RT-KB2999226-x64.msu
6668             Windows8-RT-KB2999226-x86.msu
6669         A zip archive including those files is available from Microsoft site:
6670         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
6672 UCRT_REDISTDIR="$with_ucrt_dir"
6673 if test $_os = "WINNT"; then
6674     find_msvc_x64_dlls
6675     find_msms
6676     MSVC_DLL_PATH="$msvcdllpath"
6677     MSVC_DLLS="$msvcdlls"
6678     MSM_PATH="$msmdir"
6679     # MSVC 15.3 changed it to VC141
6680     if echo "$MSVC_DLL_PATH" | grep -q "VC141.CRT$"; then
6681         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
6682     else
6683         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6684     fi
6685     if test "$UCRT_REDISTDIR" = "no"; then
6686         dnl explicitly disabled
6687         UCRT_REDISTDIR=""
6688     else
6689         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
6690                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
6691                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
6692                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
6693                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
6694                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
6695             UCRT_REDISTDIR=""
6696             if test -n "$PKGFORMAT"; then
6697                for i in $PKGFORMAT; do
6698                    case "$i" in
6699                    msi)
6700                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
6701                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
6702                        ;;
6703                    esac
6704                done
6705             fi
6706         fi
6707     fi
6710 AC_SUBST(UCRT_REDISTDIR)
6711 AC_SUBST(MSVC_DLL_PATH)
6712 AC_SUBST(MSVC_DLLS)
6713 AC_SUBST(MSM_PATH)
6715 dnl ===================================================================
6716 dnl Checks for Java
6717 dnl ===================================================================
6718 if test "$ENABLE_JAVA" != ""; then
6720     # Windows-specific tests
6721     if test "$build_os" = "cygwin"; then
6722         if test "$BITNESS_OVERRIDE" = 64; then
6723             bitness=64
6724         else
6725             bitness=32
6726         fi
6728         if test -z "$with_jdk_home"; then
6729             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
6730             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
6731             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
6732             if test -n "$regvalue"; then
6733                 ver=$regvalue
6734                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
6735                 _jdk_home=$regvalue
6736             fi
6737             if test -z "$with_jdk_home"; then
6738                 for ver in 1.8 1.7 1.6; do
6739                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6740                     if test -n "$regvalue"; then
6741                         _jdk_home=$regvalue
6742                         break
6743                     fi
6744                 done
6745             fi
6746             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6747                 with_jdk_home="$_jdk_home"
6748                 howfound="found automatically"
6749             else
6750                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6751             fi
6752         else
6753             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6754             howfound="you passed"
6755         fi
6756     fi
6758     # 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.
6759     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6760     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6761         with_jdk_home=`/usr/libexec/java_home`
6762     fi
6764     JAVA_HOME=; export JAVA_HOME
6765     if test -z "$with_jdk_home"; then
6766         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6767     else
6768         _java_path="$with_jdk_home/bin/$with_java"
6769         dnl Check if there is a Java interpreter at all.
6770         if test -x "$_java_path"; then
6771             JAVAINTERPRETER=$_java_path
6772         else
6773             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6774         fi
6775     fi
6777     dnl Check that the JDK found is correct architecture (at least 2 reasons to
6778     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
6779     dnl loaded by java to run JunitTests:
6780     if test "$build_os" = "cygwin"; then
6781         shortjdkhome=`cygpath -d "$with_jdk_home"`
6782         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
6783             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6784             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6785         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
6786             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6787             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6788         fi
6790         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6791             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6792         fi
6793         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6794     elif test "$cross_compiling" != "yes"; then
6795         case $CPUNAME in
6796             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
6797                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6798                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6799                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6800                 fi
6801                 ;;
6802             *) # assumption: everything else 32-bit
6803                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6804                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6805                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6806                 fi
6807                 ;;
6808         esac
6809     fi
6812 HAVE_JAVA9=
6813 dnl ===================================================================
6814 dnl Checks for JDK.
6815 dnl ===================================================================
6817 # Note that JAVA_HOME as for now always means the *build* platform's
6818 # JAVA_HOME. Whether all the complexity here actually is needed any
6819 # more or not, no idea.
6821 if test "$ENABLE_JAVA" != ""; then
6822     _gij_longver=0
6823     AC_MSG_CHECKING([the installed JDK])
6824     if test -n "$JAVAINTERPRETER"; then
6825         dnl java -version sends output to stderr!
6826         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6827             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6828         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6829             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6830         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6831             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6832         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6833             JDK=ibm
6835             dnl IBM JDK specific tests
6836             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6837             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6839             if test "$_jdk_ver" -lt 10600; then
6840                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
6841             fi
6843             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6845             if test "$with_jdk_home" = ""; then
6846                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6847 you must use the "--with-jdk-home" configure option explicitly])
6848             fi
6850             JAVA_HOME=$with_jdk_home
6851         else
6852             JDK=sun
6854             dnl Sun JDK specific tests
6855             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6856             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6858             if test "$_jdk_ver" -lt 10600; then
6859                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
6860             fi
6861             if test "$_jdk_ver" -gt 10600; then
6862                 JAVA_CLASSPATH_NOT_SET=TRUE
6863             fi
6864             if test "$_jdk_ver" -ge 10900; then
6865                 HAVE_JAVA9=TRUE
6866             fi
6868             AC_MSG_RESULT([checked (JDK $_jdk)])
6869             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6870             if test "$_os" = "WINNT"; then
6871                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6872             fi
6874             # set to limit VM usage for JunitTests
6875             JAVAIFLAGS=-Xmx64M
6876             # set to limit VM usage for javac
6877             JAVAFLAGS=-J-Xmx128M
6878         fi
6879     else
6880         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
6881     fi
6882 else
6883     dnl Java disabled
6884     JAVA_HOME=
6885     export JAVA_HOME
6888 dnl ===================================================================
6889 dnl Set target Java bytecode version
6890 dnl ===================================================================
6891 if test "$ENABLE_JAVA" != ""; then
6892     if test "$HAVE_JAVA9" = "TRUE"; then
6893         _java_target_ver="1.6"
6894     else
6895         _java_target_ver="1.5"
6896     fi
6897     JAVA_SOURCE_VER="$_java_target_ver"
6898     JAVA_TARGET_VER="$_java_target_ver"
6901 dnl ===================================================================
6902 dnl Checks for javac
6903 dnl ===================================================================
6904 if test "$ENABLE_JAVA" != ""; then
6905     javacompiler="javac"
6906     if test -z "$with_jdk_home"; then
6907         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6908     else
6909         _javac_path="$with_jdk_home/bin/$javacompiler"
6910         dnl Check if there is a Java compiler at all.
6911         if test -x "$_javac_path"; then
6912             JAVACOMPILER=$_javac_path
6913         fi
6914     fi
6915     if test -z "$JAVACOMPILER"; then
6916         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6917     fi
6918     if test "$build_os" = "cygwin"; then
6919         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6920             JAVACOMPILER="${JAVACOMPILER}.exe"
6921         fi
6922         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
6923     fi
6926 dnl ===================================================================
6927 dnl Checks for javadoc
6928 dnl ===================================================================
6929 if test "$ENABLE_JAVA" != ""; then
6930     if test -z "$with_jdk_home"; then
6931         AC_PATH_PROG(JAVADOC, javadoc)
6932     else
6933         _javadoc_path="$with_jdk_home/bin/javadoc"
6934         dnl Check if there is a javadoc at all.
6935         if test -x "$_javadoc_path"; then
6936             JAVADOC=$_javadoc_path
6937         else
6938             AC_PATH_PROG(JAVADOC, javadoc)
6939         fi
6940     fi
6941     if test -z "$JAVADOC"; then
6942         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6943     fi
6944     if test "$build_os" = "cygwin"; then
6945         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6946             JAVADOC="${JAVADOC}.exe"
6947         fi
6948         JAVADOC=`win_short_path_for_make "$JAVADOC"`
6949     fi
6951     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6952     JAVADOCISGJDOC="yes"
6953     fi
6955 AC_SUBST(JAVADOCISGJDOC)
6957 if test "$ENABLE_JAVA" != ""; then
6958     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
6959     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
6960         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
6961            # try to recover first by looking whether we have a alternatives
6962            # system as in Debian or newer SuSEs where following /usr/bin/javac
6963            # over /etc/alternatives/javac leads to the right bindir where we
6964            # just need to strip a bit away to get a valid JAVA_HOME
6965            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
6966         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
6967             # maybe only one level of symlink (e.g. on Mac)
6968             JAVA_HOME=$(readlink $JAVACOMPILER)
6969             if test "$(dirname $JAVA_HOME)" = "."; then
6970                 # we've got no path to trim back
6971                 JAVA_HOME=""
6972             fi
6973         else
6974             # else warn
6975             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
6976             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
6977             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
6978             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
6979         fi
6980         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
6981         if test "$JAVA_HOME" != "/usr"; then
6982             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6983                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
6984                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
6985                 dnl Tiger already returns a JDK path..
6986                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
6987             else
6988                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
6989                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
6990                 dnl that checks which version to run
6991                 if test -f "$JAVA_HOME"; then
6992                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
6993                 fi
6994             fi
6995         fi
6996     fi
6997     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
6999     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7000     if test -z "$JAVA_HOME"; then
7001         if test "x$with_jdk_home" = "x"; then
7002             cat > findhome.java <<_ACEOF
7003 [import java.io.File;
7005 class findhome
7007     public static void main(String args[])
7008     {
7009         String jrelocation = System.getProperty("java.home");
7010         File jre = new File(jrelocation);
7011         System.out.println(jre.getParent());
7012     }
7014 _ACEOF
7015             AC_MSG_CHECKING([if javac works])
7016             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7017             AC_TRY_EVAL(javac_cmd)
7018             if test $? = 0 -a -f ./findhome.class; then
7019                 AC_MSG_RESULT([javac works])
7020             else
7021                 echo "configure: javac test failed" >&5
7022                 cat findhome.java >&5
7023                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7024             fi
7025             AC_MSG_CHECKING([if gij knows its java.home])
7026             JAVA_HOME=`$JAVAINTERPRETER findhome`
7027             if test $? = 0 -a "$JAVA_HOME" != ""; then
7028                 AC_MSG_RESULT([$JAVA_HOME])
7029             else
7030                 echo "configure: java test failed" >&5
7031                 cat findhome.java >&5
7032                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7033             fi
7034             # clean-up after ourselves
7035             rm -f ./findhome.java ./findhome.class
7036         else
7037             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7038         fi
7039     fi
7041     # now check if $JAVA_HOME is really valid
7042     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7043         case "${JAVA_HOME}" in
7044             /Library/Java/JavaVirtualMachines/*)
7045                 ;;
7046             *)
7047                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7048                 ;;
7049         esac
7050         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7051             JAVA_HOME_OK="NO"
7052         fi
7053     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7054         JAVA_HOME_OK="NO"
7055     fi
7056     if test "$JAVA_HOME_OK" = "NO"; then
7057         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7058         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7059         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7060         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7061         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7062         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7063     fi
7064     PathFormat "$JAVA_HOME"
7065     JAVA_HOME="$formatted_path"
7068 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7069     "$_os" != Darwin
7070 then
7071     AC_MSG_CHECKING([for JAWT lib])
7072     if test "$_os" = WINNT; then
7073         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7074         JAWTLIB=jawt.lib
7075     else
7076         case "$host_cpu" in
7077         arm*)
7078             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7079             JAVA_ARCH=$my_java_arch
7080             ;;
7081         i*86)
7082             my_java_arch=i386
7083             ;;
7084         m68k)
7085             my_java_arch=m68k
7086             ;;
7087         powerpc)
7088             my_java_arch=ppc
7089             ;;
7090         powerpc64)
7091             my_java_arch=ppc64
7092             ;;
7093         powerpc64le)
7094             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7095             JAVA_ARCH=$my_java_arch
7096             ;;
7097         sparc64)
7098             my_java_arch=sparcv9
7099             ;;
7100         x86_64)
7101             my_java_arch=amd64
7102             ;;
7103         *)
7104             my_java_arch=$host_cpu
7105             ;;
7106         esac
7107         # This is where JDK9 puts the library
7108         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7109             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7110         else
7111             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7112         fi
7113         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7114     fi
7115     AC_MSG_RESULT([$JAWTLIB])
7117 AC_SUBST(JAWTLIB)
7119 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7120     case "$host_os" in
7122     aix*)
7123         JAVAINC="-I$JAVA_HOME/include"
7124         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7125         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7126         ;;
7128     cygwin*)
7129         JAVAINC="-I$JAVA_HOME/include/win32"
7130         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7131         ;;
7133     darwin*)
7134         if test -d "$JAVA_HOME/include/darwin"; then
7135             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7136         else
7137             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7138         fi
7139         ;;
7141     dragonfly*)
7142         JAVAINC="-I$JAVA_HOME/include"
7143         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7144         ;;
7146     freebsd*)
7147         JAVAINC="-I$JAVA_HOME/include"
7148         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7149         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7150         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7151         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7152         ;;
7154     k*bsd*-gnu*)
7155         JAVAINC="-I$JAVA_HOME/include"
7156         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7157         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7158         ;;
7160     linux-gnu*)
7161         JAVAINC="-I$JAVA_HOME/include"
7162         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7163         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7164         ;;
7166     *netbsd*)
7167         JAVAINC="-I$JAVA_HOME/include"
7168         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7169         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7170        ;;
7172     openbsd*)
7173         JAVAINC="-I$JAVA_HOME/include"
7174         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7175         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7176         ;;
7178     solaris*)
7179         JAVAINC="-I$JAVA_HOME/include"
7180         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7181         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7182         ;;
7183     esac
7185 SOLARINC="$SOLARINC $JAVAINC"
7187 AC_SUBST(JAVACOMPILER)
7188 AC_SUBST(JAVADOC)
7189 AC_SUBST(JAVAINTERPRETER)
7190 AC_SUBST(JAVAIFLAGS)
7191 AC_SUBST(JAVAFLAGS)
7192 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7193 AC_SUBST(JAVA_HOME)
7194 AC_SUBST(JAVA_SOURCE_VER)
7195 AC_SUBST(JAVA_TARGET_VER)
7196 AC_SUBST(JDK)
7199 dnl ===================================================================
7200 dnl Export file validation
7201 dnl ===================================================================
7202 AC_MSG_CHECKING([whether to enable export file validation])
7203 if test "$with_export_validation" != "no"; then
7204     if test -z "$ENABLE_JAVA"; then
7205         if test "$with_export_validation" = "yes"; then
7206             AC_MSG_ERROR([requested, but Java is disabled])
7207         else
7208             AC_MSG_RESULT([no, as Java is disabled])
7209         fi
7210     elif test "$_jdk_ver" -lt 10800; then
7211         if test "$with_export_validation" = "yes"; then
7212             AC_MSG_ERROR([requested, but Java is too old, need Java 8])
7213         else
7214             AC_MSG_RESULT([no, as Java is too old, need Java 8])
7215         fi
7216     else
7217         AC_MSG_RESULT([yes])
7218         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7220         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7221         if test -z "$ODFVALIDATOR"; then
7222             # remember to download the ODF toolkit with validator later
7223             AC_MSG_NOTICE([no odfvalidator found, will download it])
7224             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7225             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7227             # and fetch name of odfvalidator jar name from download.lst
7228             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7229             AC_SUBST(ODFVALIDATOR_JAR)
7231             if test -z "$ODFVALIDATOR_JAR"; then
7232                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7233             fi
7234         fi
7235         if test "$build_os" = "cygwin"; then
7236             # In case of Cygwin it will be executed from Windows,
7237             # so we need to run bash and absolute path to validator
7238             # so instead of "odfvalidator" it will be
7239             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7240             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7241         else
7242             ODFVALIDATOR="sh $ODFVALIDATOR"
7243         fi
7244         AC_SUBST(ODFVALIDATOR)
7247         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7248         if test -z "$OFFICEOTRON"; then
7249             # remember to download the officeotron with validator later
7250             AC_MSG_NOTICE([no officeotron found, will download it])
7251             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7252             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7254             # and fetch name of officeotron jar name from download.lst
7255             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7256             AC_SUBST(OFFICEOTRON_JAR)
7258             if test -z "$OFFICEOTRON_JAR"; then
7259                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7260             fi
7261         else
7262             # check version of existing officeotron
7263             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7264             if test 0"$OFFICEOTRON_VER" -lt 704; then
7265                 AC_MSG_ERROR([officeotron too old])
7266             fi
7267         fi
7268         if test "$build_os" = "cygwin"; then
7269             # In case of Cygwin it will be executed from Windows,
7270             # so we need to run bash and absolute path to validator
7271             # so instead of "odfvalidator" it will be
7272             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7273             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7274         else
7275             OFFICEOTRON="sh $OFFICEOTRON"
7276         fi
7277     fi
7278     AC_SUBST(OFFICEOTRON)
7279 else
7280     AC_MSG_RESULT([no])
7283 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7284 if test "$with_bffvalidator" != "no"; then
7285     AC_DEFINE(HAVE_BFFVALIDATOR)
7287     if test "$with_export_validation" = "no"; then
7288         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7289     fi
7291     if test "$with_bffvalidator" = "yes"; then
7292         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7293     else
7294         BFFVALIDATOR="$with_bffvalidator"
7295     fi
7297     if test "$build_os" = "cygwin"; then
7298         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7299             AC_MSG_RESULT($BFFVALIDATOR)
7300         else
7301             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7302         fi
7303     elif test -n "$BFFVALIDATOR"; then
7304         # We are not in Cygwin but need to run Windows binary with wine
7305         AC_PATH_PROGS(WINE, wine)
7307         # so swap in a shell wrapper that converts paths transparently
7308         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7309         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7310         AC_SUBST(BFFVALIDATOR_EXE)
7311         AC_MSG_RESULT($BFFVALIDATOR)
7312     else
7313         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7314     fi
7315     AC_SUBST(BFFVALIDATOR)
7316 else
7317     AC_MSG_RESULT([no])
7320 dnl ===================================================================
7321 dnl Check for C preprocessor to use
7322 dnl ===================================================================
7323 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7324 if test -n "$with_idlc_cpp"; then
7325     AC_MSG_RESULT([$with_idlc_cpp])
7326     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7327 else
7328     AC_MSG_RESULT([ucpp])
7329     AC_MSG_CHECKING([which ucpp tp use])
7330     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7331         AC_MSG_RESULT([external])
7332         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7333     else
7334         AC_MSG_RESULT([internal])
7335         BUILD_TYPE="$BUILD_TYPE UCPP"
7336     fi
7338 AC_SUBST(SYSTEM_UCPP)
7340 dnl ===================================================================
7341 dnl Check for epm (not needed for Windows)
7342 dnl ===================================================================
7343 AC_MSG_CHECKING([whether to enable EPM for packing])
7344 if test "$enable_epm" = "yes"; then
7345     AC_MSG_RESULT([yes])
7346     if test "$_os" != "WINNT"; then
7347         if test $_os = Darwin; then
7348             EPM=internal
7349         elif test -n "$with_epm"; then
7350             EPM=$with_epm
7351         else
7352             AC_PATH_PROG(EPM, epm, no)
7353         fi
7354         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7355             AC_MSG_NOTICE([EPM will be built.])
7356             BUILD_TYPE="$BUILD_TYPE EPM"
7357             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7358         else
7359             # Gentoo has some epm which is something different...
7360             AC_MSG_CHECKING([whether the found epm is the right epm])
7361             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7362                 AC_MSG_RESULT([yes])
7363             else
7364                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7365             fi
7366             AC_MSG_CHECKING([epm version])
7367             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7368             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7369                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7370                 AC_MSG_RESULT([OK, >= 3.7])
7371             else
7372                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7373                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7374             fi
7375         fi
7376     fi
7378     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7379         AC_MSG_CHECKING([for rpm])
7380         for a in "$RPM" rpmbuild rpm; do
7381             $a --usage >/dev/null 2> /dev/null
7382             if test $? -eq 0; then
7383                 RPM=$a
7384                 break
7385             else
7386                 $a --version >/dev/null 2> /dev/null
7387                 if test $? -eq 0; then
7388                     RPM=$a
7389                     break
7390                 fi
7391             fi
7392         done
7393         if test -z "$RPM"; then
7394             AC_MSG_ERROR([not found])
7395         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7396             RPM_PATH=`which $RPM`
7397             AC_MSG_RESULT([$RPM_PATH])
7398             SCPDEFS="$SCPDEFS -DWITH_RPM"
7399         else
7400             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7401         fi
7402     fi
7403     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7404         AC_PATH_PROG(DPKG, dpkg, no)
7405         if test "$DPKG" = "no"; then
7406             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7407         fi
7408     fi
7409     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7410        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7411         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7412             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7413                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7414                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7415                     AC_MSG_RESULT([yes])
7416                 else
7417                     AC_MSG_RESULT([no])
7418                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7419                         _pt="rpm"
7420                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7421                         add_warning "the rpms will need to be installed with --nodeps"
7422                     else
7423                         _pt="pkg"
7424                     fi
7425                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7426                     add_warning "the ${_pt}s will not be relocatable"
7427                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7428                                  relocation will work, you need to patch your epm with the
7429                                  patch in epm/epm-3.7.patch or build with
7430                                  --with-epm=internal which will build a suitable epm])
7431                 fi
7432             fi
7433         fi
7434     fi
7435     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7436         AC_PATH_PROG(PKGMK, pkgmk, no)
7437         if test "$PKGMK" = "no"; then
7438             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7439         fi
7440     fi
7441     AC_SUBST(RPM)
7442     AC_SUBST(DPKG)
7443     AC_SUBST(PKGMK)
7444 else
7445     for i in $PKGFORMAT; do
7446         case "$i" in
7447         aix | bsd | deb | pkg | rpm | native | portable)
7448             AC_MSG_ERROR(
7449                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7450             ;;
7451         esac
7452     done
7453     AC_MSG_RESULT([no])
7454     EPM=NO
7456 AC_SUBST(EPM)
7458 ENABLE_LWP=
7459 if test "$enable_lotuswordpro" = "yes"; then
7460     ENABLE_LWP="TRUE"
7462 AC_SUBST(ENABLE_LWP)
7464 dnl ===================================================================
7465 dnl Check for building ODK
7466 dnl ===================================================================
7467 if test "$enable_odk" = no; then
7468     unset DOXYGEN
7469 else
7470     if test "$with_doxygen" = no; then
7471         AC_MSG_CHECKING([for doxygen])
7472         unset DOXYGEN
7473         AC_MSG_RESULT([no])
7474     else
7475         if test "$with_doxygen" = yes; then
7476             AC_PATH_PROG([DOXYGEN], [doxygen])
7477             if test -z "$DOXYGEN"; then
7478                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7479             fi
7480             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
7481                 if ! dot -V 2>/dev/null; then
7482                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
7483                 fi
7484             fi
7485         else
7486             AC_MSG_CHECKING([for doxygen])
7487             DOXYGEN=$with_doxygen
7488             AC_MSG_RESULT([$DOXYGEN])
7489         fi
7490         if test -n "$DOXYGEN"; then
7491             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7492             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7493             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7494                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7495             fi
7496         fi
7497     fi
7499 AC_SUBST([DOXYGEN])
7501 AC_MSG_CHECKING([whether to build the ODK])
7502 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7503     AC_MSG_RESULT([yes])
7505     if test "$with_java" != "no"; then
7506         AC_MSG_CHECKING([whether to build unowinreg.dll])
7507         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7508             # build on Win by default
7509             enable_build_unowinreg=yes
7510         fi
7511         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7512             AC_MSG_RESULT([no])
7513             BUILD_UNOWINREG=
7514         else
7515             AC_MSG_RESULT([yes])
7516             BUILD_UNOWINREG=TRUE
7517         fi
7518         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7519             if test -z "$with_mingw_cross_compiler"; then
7520                 dnl Guess...
7521                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7522             elif test -x "$with_mingw_cross_compiler"; then
7523                  MINGWCXX="$with_mingw_cross_compiler"
7524             else
7525                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7526             fi
7528             if test "$MINGWCXX" = "false"; then
7529                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7530             fi
7532             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7533             if test -x "$mingwstrip_test"; then
7534                 MINGWSTRIP="$mingwstrip_test"
7535             else
7536                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7537             fi
7539             if test "$MINGWSTRIP" = "false"; then
7540                 AC_MSG_ERROR(MinGW32 binutils not found.)
7541             fi
7542         fi
7543     fi
7544     BUILD_TYPE="$BUILD_TYPE ODK"
7545 else
7546     AC_MSG_RESULT([no])
7547     BUILD_UNOWINREG=
7549 AC_SUBST(BUILD_UNOWINREG)
7550 AC_SUBST(MINGWCXX)
7551 AC_SUBST(MINGWSTRIP)
7553 dnl ===================================================================
7554 dnl Check for system zlib
7555 dnl ===================================================================
7556 if test "$with_system_zlib" = "auto"; then
7557     case "$_os" in
7558     WINNT)
7559         with_system_zlib="$with_system_libs"
7560         ;;
7561     *)
7562         if test "$enable_fuzzers" != "yes"; then
7563             with_system_zlib=yes
7564         else
7565             with_system_zlib=no
7566         fi
7567         ;;
7568     esac
7571 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7572 dnl and has no pkg-config for it at least on some tinderboxes,
7573 dnl so leaving that out for now
7574 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7575 AC_MSG_CHECKING([which zlib to use])
7576 if test "$with_system_zlib" = "yes"; then
7577     AC_MSG_RESULT([external])
7578     SYSTEM_ZLIB=TRUE
7579     AC_CHECK_HEADER(zlib.h, [],
7580         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7581     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7582         [AC_MSG_ERROR(zlib not found or functional)], [])
7583 else
7584     AC_MSG_RESULT([internal])
7585     SYSTEM_ZLIB=
7586     BUILD_TYPE="$BUILD_TYPE ZLIB"
7587     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7588     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7590 AC_SUBST(ZLIB_CFLAGS)
7591 AC_SUBST(ZLIB_LIBS)
7592 AC_SUBST(SYSTEM_ZLIB)
7594 dnl ===================================================================
7595 dnl Check for system jpeg
7596 dnl ===================================================================
7597 AC_MSG_CHECKING([which libjpeg to use])
7598 if test "$with_system_jpeg" = "yes"; then
7599     AC_MSG_RESULT([external])
7600     SYSTEM_LIBJPEG=TRUE
7601     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7602         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7603     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7604         [AC_MSG_ERROR(jpeg library not found or fuctional)], [])
7605 else
7606     SYSTEM_LIBJPEG=
7607     AC_MSG_RESULT([internal, libjpeg-turbo])
7608     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
7609     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
7610     if test "$COM" = "MSC"; then
7611         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
7612     else
7613         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
7614     fi
7616     case "$host_cpu" in
7617     x86_64 | amd64 | i*86 | x86 | ia32)
7618         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7619         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7620             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7621                 NASM="$LODE_HOME/opt/bin/nasm"
7622             elif test -x "/opt/lo/bin/nasm"; then
7623                 NASM="/opt/lo/bin/nasm"
7624             fi
7625         fi
7627         if test -n "$NASM"; then
7628             AC_MSG_CHECKING([for object file format of host system])
7629             case "$host_os" in
7630               cygwin* | mingw* | pw32* | interix*)
7631                 case "$host_cpu" in
7632                   x86_64)
7633                     objfmt='Win64-COFF'
7634                     ;;
7635                   *)
7636                     objfmt='Win32-COFF'
7637                     ;;
7638                 esac
7639               ;;
7640               msdosdjgpp* | go32*)
7641                 objfmt='COFF'
7642               ;;
7643               os2-emx*)                 # not tested
7644                 objfmt='MSOMF'          # obj
7645               ;;
7646               linux*coff* | linux*oldld*)
7647                 objfmt='COFF'           # ???
7648               ;;
7649               linux*aout*)
7650                 objfmt='a.out'
7651               ;;
7652               linux*)
7653                 case "$host_cpu" in
7654                   x86_64)
7655                     objfmt='ELF64'
7656                     ;;
7657                   *)
7658                     objfmt='ELF'
7659                     ;;
7660                 esac
7661               ;;
7662               kfreebsd* | freebsd* | netbsd* | openbsd*)
7663                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
7664                   objfmt='BSD-a.out'
7665                 else
7666                   case "$host_cpu" in
7667                     x86_64 | amd64)
7668                       objfmt='ELF64'
7669                       ;;
7670                     *)
7671                       objfmt='ELF'
7672                       ;;
7673                   esac
7674                 fi
7675               ;;
7676               solaris* | sunos* | sysv* | sco*)
7677                 case "$host_cpu" in
7678                   x86_64)
7679                     objfmt='ELF64'
7680                     ;;
7681                   *)
7682                     objfmt='ELF'
7683                     ;;
7684                 esac
7685               ;;
7686               darwin* | rhapsody* | nextstep* | openstep* | macos*)
7687                 case "$host_cpu" in
7688                   x86_64)
7689                     objfmt='Mach-O64'
7690                     ;;
7691                   *)
7692                     objfmt='Mach-O'
7693                     ;;
7694                 esac
7695               ;;
7696               *)
7697                 objfmt='ELF ?'
7698               ;;
7699             esac
7701             AC_MSG_RESULT([$objfmt])
7702             if test "$objfmt" = 'ELF ?'; then
7703               objfmt='ELF'
7704               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
7705             fi
7707             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
7708             case "$objfmt" in
7709               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
7710               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
7711               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
7712               COFF)       NAFLAGS='-fcoff -DCOFF';;
7713               a.out)      NAFLAGS='-faout -DAOUT';;
7714               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
7715               ELF)        NAFLAGS='-felf -DELF';;
7716               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
7717               RDF)        NAFLAGS='-frdf -DRDF';;
7718               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
7719               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
7720             esac
7721             AC_MSG_RESULT([$NAFLAGS])
7723             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
7724             cat > conftest.asm << EOF
7725             [%line __oline__ "configure"
7726                     section .text
7727                     global  _main,main
7728             _main:
7729             main:   xor     eax,eax
7730                     ret
7731             ]
7733             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
7734             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
7735               AC_MSG_RESULT(yes)
7736             else
7737               echo "configure: failed program was:" >&AC_FD_CC
7738               cat conftest.asm >&AC_FD_CC
7739               rm -rf conftest*
7740               AC_MSG_RESULT(no)
7741               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
7742               NASM=""
7743             fi
7745         fi
7747         if test -z "$NASM"; then
7748 cat << _EOS
7749 ****************************************************************************
7750 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
7751 To get one please:
7753 _EOS
7754             if test "$build_os" = "cygwin"; then
7755 cat << _EOS
7756 install a pre-compiled binary for Win32
7758 mkdir -p /opt/lo/bin
7759 cd /opt/lo/bin
7760 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7761 chmod +x nasm
7763 or get and install one from http://www.nasm.us/
7765 Then re-run autogen.sh
7767 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7768 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7770 _EOS
7771             else
7772 cat << _EOS
7773 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
7775 _EOS
7776             fi
7777             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
7778             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
7779         fi
7780       ;;
7781     esac
7784 AC_SUBST(NASM)
7785 AC_SUBST(LIBJPEG_CFLAGS)
7786 AC_SUBST(LIBJPEG_LIBS)
7787 AC_SUBST(SYSTEM_LIBJPEG)
7789 dnl ===================================================================
7790 dnl Check for system clucene
7791 dnl ===================================================================
7792 dnl we should rather be using
7793 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7794 dnl but the contribs-lib check seems tricky
7795 AC_MSG_CHECKING([which clucene to use])
7796 if test "$with_system_clucene" = "yes"; then
7797     AC_MSG_RESULT([external])
7798     SYSTEM_CLUCENE=TRUE
7799     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7800     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7801     FilterLibs "${CLUCENE_LIBS}"
7802     CLUCENE_LIBS="${filteredlibs}"
7803     AC_LANG_PUSH([C++])
7804     save_CXXFLAGS=$CXXFLAGS
7805     save_CPPFLAGS=$CPPFLAGS
7806     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7807     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7808     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7809     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7810     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7811                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7812     CXXFLAGS=$save_CXXFLAGS
7813     CPPFLAGS=$save_CPPFLAGS
7814     AC_LANG_POP([C++])
7816     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7817 else
7818     AC_MSG_RESULT([internal])
7819     SYSTEM_CLUCENE=
7820     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7822 AC_SUBST(SYSTEM_CLUCENE)
7823 AC_SUBST(CLUCENE_CFLAGS)
7824 AC_SUBST(CLUCENE_LIBS)
7826 dnl ===================================================================
7827 dnl Check for system expat
7828 dnl ===================================================================
7829 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
7831 dnl ===================================================================
7832 dnl Check for system xmlsec
7833 dnl ===================================================================
7834 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24])
7836 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7837 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7838     ENABLE_EOT="TRUE"
7839     AC_DEFINE([ENABLE_EOT])
7840     AC_MSG_RESULT([yes])
7842     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7843 else
7844     ENABLE_EOT=
7845     AC_MSG_RESULT([no])
7847 AC_SUBST([ENABLE_EOT])
7849 dnl ===================================================================
7850 dnl Check for DLP libs
7851 dnl ===================================================================
7852 AS_IF([test "$COM" = "MSC"],
7853       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7854       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7856 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7858 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7860 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
7862 AS_IF([test "$COM" = "MSC"],
7863       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7864       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7866 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7868 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7870 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7871 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.9])
7873 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7875 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7877 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7879 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
7880 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.14])
7882 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
7883 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
7885 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7887 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
7888 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
7890 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7892 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7894 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
7896 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
7898 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
7899 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
7901 dnl ===================================================================
7902 dnl Check for system lcms2
7903 dnl ===================================================================
7904 if test "$with_system_lcms2" != "yes"; then
7905     SYSTEM_LCMS2=
7907 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7908 if test "$GCC" = "yes"; then
7909     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7911 if test "$COM" = "MSC"; then # override the above
7912     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7915 dnl ===================================================================
7916 dnl Check for system cppunit
7917 dnl ===================================================================
7918 if test "$cross_compiling" != "yes"; then
7919     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
7922 dnl ===================================================================
7923 dnl Check whether freetype is available
7924 dnl ===================================================================
7925 if test  "$test_freetype" = "yes"; then
7926     AC_MSG_CHECKING([whether freetype is available])
7927     # FreeType has 3 different kinds of versions
7928     # * release, like 2.4.10
7929     # * libtool, like 13.0.7 (this what pkg-config returns)
7930     # * soname
7931     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7932     #
7933     # 9.9.3 is 2.2.0
7934     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7935     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7936     FilterLibs "${FREETYPE_LIBS}"
7937     FREETYPE_LIBS="${filteredlibs}"
7938     SYSTEM_FREETYPE=TRUE
7939 else
7940     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
7941     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
7943 AC_SUBST(FREETYPE_CFLAGS)
7944 AC_SUBST(FREETYPE_LIBS)
7945 AC_SUBST([SYSTEM_FREETYPE])
7947 # ===================================================================
7948 # Check for system libxslt
7949 # to prevent incompatibilities between internal libxml2 and external libxslt,
7950 # or vice versa, use with_system_libxml here
7951 # ===================================================================
7952 if test "$with_system_libxml" = "auto"; then
7953     case "$_os" in
7954     WINNT|iOS|Android)
7955         with_system_libxml="$with_system_libs"
7956         ;;
7957     *)
7958         if test "$enable_fuzzers" != "yes"; then
7959             with_system_libxml=yes
7960         else
7961             with_system_libxml=no
7962         fi
7963         ;;
7964     esac
7967 AC_MSG_CHECKING([which libxslt to use])
7968 if test "$with_system_libxml" = "yes"; then
7969     AC_MSG_RESULT([external])
7970     SYSTEM_LIBXSLT=TRUE
7971     if test "$_os" = "Darwin"; then
7972         dnl make sure to use SDK path
7973         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7974         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7975         dnl omit -L/usr/lib
7976         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7977         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7978     else
7979         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7980         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7981         FilterLibs "${LIBXSLT_LIBS}"
7982         LIBXSLT_LIBS="${filteredlibs}"
7983         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7984         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7985         FilterLibs "${LIBEXSLT_LIBS}"
7986         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
7987     fi
7989     dnl Check for xsltproc
7990     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7991     if test "$XSLTPROC" = "no"; then
7992         AC_MSG_ERROR([xsltproc is required])
7993     fi
7994 else
7995     AC_MSG_RESULT([internal])
7996     SYSTEM_LIBXSLT=
7997     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
7999     if test "$cross_compiling" = "yes"; then
8000         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8001         if test "$XSLTPROC" = "no"; then
8002             AC_MSG_ERROR([xsltproc is required])
8003         fi
8004     fi
8006 AC_SUBST(SYSTEM_LIBXSLT)
8007 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8008     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8010 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8012 AC_SUBST(LIBEXSLT_CFLAGS)
8013 AC_SUBST(LIBEXSLT_LIBS)
8014 AC_SUBST(LIBXSLT_CFLAGS)
8015 AC_SUBST(LIBXSLT_LIBS)
8016 AC_SUBST(XSLTPROC)
8018 # ===================================================================
8019 # Check for system libxml
8020 # ===================================================================
8021 AC_MSG_CHECKING([which libxml to use])
8022 if test "$with_system_libxml" = "yes"; then
8023     AC_MSG_RESULT([external])
8024     SYSTEM_LIBXML=TRUE
8025     if test "$_os" = "Darwin"; then
8026         dnl make sure to use SDK path
8027         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8028         dnl omit -L/usr/lib
8029         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8030     elif test $_os = iOS; then
8031         dnl make sure to use SDK path
8032         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8033         LIBXML_CFLAGS="-I$usr/include/libxml2"
8034         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8035     else
8036         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8037         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8038         FilterLibs "${LIBXML_LIBS}"
8039         LIBXML_LIBS="${filteredlibs}"
8040     fi
8042     dnl Check for xmllint
8043     AC_PATH_PROG(XMLLINT, xmllint, no)
8044     if test "$XMLLINT" = "no"; then
8045         AC_MSG_ERROR([xmllint is required])
8046     fi
8047 else
8048     AC_MSG_RESULT([internal])
8049     SYSTEM_LIBXML=
8050     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8051     if test "$COM" = "MSC"; then
8052         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8053     fi
8054     if test "$COM" = "MSC"; then
8055         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8056     else
8057         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8058     fi
8059     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8061 AC_SUBST(SYSTEM_LIBXML)
8062 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8063     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8065 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8066 AC_SUBST(LIBXML_CFLAGS)
8067 AC_SUBST(LIBXML_LIBS)
8068 AC_SUBST(XMLLINT)
8070 # =====================================================================
8071 # Checking for a Python interpreter with version >= 2.7.
8072 # Build and runtime requires Python 3 compatible version (>= 2.7).
8073 # Optionally user can pass an option to configure, i. e.
8074 # ./configure PYTHON=/usr/bin/python
8075 # =====================================================================
8076 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8077     # This allows a lack of system python with no error, we use internal one in that case.
8078     AM_PATH_PYTHON([2.7],, [:])
8079     # Clean PYTHON_VERSION checked below if cross-compiling
8080     PYTHON_VERSION=""
8081     if test "$PYTHON" != ":"; then
8082         PYTHON_FOR_BUILD=$PYTHON
8083     fi
8085 AC_SUBST(PYTHON_FOR_BUILD)
8087 # Checks for Python to use for Pyuno
8088 AC_MSG_CHECKING([which Python to use for Pyuno])
8089 case "$enable_python" in
8090 no|disable)
8091     if test -z $PYTHON_FOR_BUILD; then
8092         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8093         # requirement from the choice whether to include Python stuff in the installer, but why
8094         # bother?
8095         AC_MSG_ERROR([Python is required at build time.])
8096     fi
8097     enable_python=no
8098     AC_MSG_RESULT([none])
8099     ;;
8100 ""|yes|auto)
8101     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8102         AC_MSG_RESULT([no, overridden by --disable-scripting])
8103         enable_python=no
8104     elif test $build_os = cygwin; then
8105         dnl When building on Windows we don't attempt to use any installed
8106         dnl "system"  Python.
8107         AC_MSG_RESULT([fully internal])
8108         enable_python=internal
8109     elif test "$cross_compiling" = yes; then
8110         AC_MSG_RESULT([system])
8111         enable_python=system
8112     else
8113         # Unset variables set by the above AM_PATH_PYTHON so that
8114         # we actually do check anew.
8115         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
8116         AM_PATH_PYTHON([3.3],, [:])
8117         if test "$PYTHON" = ":"; then
8118             if test -z "$PYTHON_FOR_BUILD"; then
8119                 AC_MSG_RESULT([fully internal])
8120             else
8121                 AC_MSG_RESULT([internal])
8122             fi
8123             enable_python=internal
8124         else
8125             AC_MSG_RESULT([system])
8126             enable_python=system
8127         fi
8128     fi
8129     ;;
8130 internal)
8131     AC_MSG_RESULT([internal])
8132     ;;
8133 fully-internal)
8134     AC_MSG_RESULT([fully internal])
8135     enable_python=internal
8136     ;;
8137 system)
8138     AC_MSG_RESULT([system])
8139     ;;
8141     AC_MSG_ERROR([Incorrect --enable-python option])
8142     ;;
8143 esac
8145 if test $enable_python != no; then
8146     BUILD_TYPE="$BUILD_TYPE PYUNO"
8149 if test $enable_python = system; then
8150     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8151         python_version=2.7
8152         PYTHON=python$python_version
8153         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
8154             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
8155             PYTHON_LIBS="-framework Python"
8156         else
8157             PYTHON_CFLAGS="`$PYTHON-config --includes`"
8158             PYTHON_LIBS="`$PYTHON-config --libs`"
8159         fi
8160     fi
8161     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8162         # Fallback: Accept these in the environment, or as set above
8163         # for MacOSX.
8164         :
8165     elif test "$cross_compiling" != yes; then
8166         # Unset variables set by the above AM_PATH_PYTHON so that
8167         # we actually do check anew.
8168         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
8169         # This causes an error if no python command is found
8170         AM_PATH_PYTHON([3.3])
8171         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8172         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8173         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8174         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8175         if test -z "$PKG_CONFIG"; then
8176             PYTHON_CFLAGS="-I$python_include"
8177             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8178         elif $PKG_CONFIG --exists python-$python_version; then
8179             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8180             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8181         else
8182             PYTHON_CFLAGS="-I$python_include"
8183             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8184         fi
8185         FilterLibs "${PYTHON_LIBS}"
8186         PYTHON_LIBS="${filteredlibs}"
8187     else
8188         dnl How to find out the cross-compilation Python installation path?
8189         AC_MSG_CHECKING([for python version])
8190         AS_IF([test -n "$PYTHON_VERSION"],
8191               [AC_MSG_RESULT([$PYTHON_VERSION])],
8192               [AC_MSG_RESULT([not found])
8193                AC_MSG_ERROR([no usable python found])])
8194         test -n "$PYTHON_CFLAGS" && break
8195     fi
8197     dnl Check if the headers really work
8198     save_CPPFLAGS="$CPPFLAGS"
8199     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8200     AC_CHECK_HEADER(Python.h)
8201     CPPFLAGS="$save_CPPFLAGS"
8203     # let the PYTHON_FOR_BUILD match the same python installation that
8204     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8205     # better for PythonTests.
8206     PYTHON_FOR_BUILD=$PYTHON
8209 if test "$with_lxml" != no; then
8210     if test -z "$PYTHON_FOR_BUILD"; then
8211         case $build_os in
8212             cygwin)
8213                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8214                 ;;
8215             *)
8216                 if test "$cross_compiling" != yes ; then
8217                     BUILD_TYPE="$BUILD_TYPE LXML"
8218                 fi
8219                 ;;
8220         esac
8221     else
8222         AC_MSG_CHECKING([for python lxml])
8223         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8224             AC_MSG_RESULT([yes])
8225         else
8226             case $build_os in
8227                 cygwin)
8228                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8229                     ;;
8230                 *)
8231                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8232                         BUILD_TYPE="$BUILD_TYPE LXML"
8233                         AC_MSG_RESULT([no, using internal lxml])
8234                     else
8235                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8236                     fi
8237                     ;;
8238             esac
8239         fi
8240     fi
8243 dnl By now enable_python should be "system", "internal" or "no"
8244 case $enable_python in
8245 system)
8246     SYSTEM_PYTHON=TRUE
8248     if test "x$ac_cv_header_Python_h" != "xyes"; then
8249        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8250     fi
8252     AC_LANG_PUSH(C)
8253     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8254     AC_MSG_CHECKING([for correct python library version])
8255        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8256 #include <Python.h>
8258 int main(int argc, char **argv) {
8259    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8260        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8261    else return 1;
8263        ]])],[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])])
8264     CFLAGS=$save_CFLAGS
8265     AC_LANG_POP(C)
8267     dnl FIXME Check if the Python library can be linked with, too?
8268     ;;
8270 internal)
8271     SYSTEM_PYTHON=
8272     PYTHON_VERSION_MAJOR=3
8273     PYTHON_VERSION_MINOR=5
8274     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.4
8275     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8276         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8277     fi
8278     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8279     BUILD_TYPE="$BUILD_TYPE PYTHON"
8280     # Embedded Python dies without Home set
8281     if test "$HOME" = ""; then
8282         export HOME=""
8283     fi
8284     ;;
8286     DISABLE_PYTHON=TRUE
8287     SYSTEM_PYTHON=
8288     ;;
8290     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8291     ;;
8292 esac
8294 AC_SUBST(DISABLE_PYTHON)
8295 AC_SUBST(SYSTEM_PYTHON)
8296 AC_SUBST(PYTHON_CFLAGS)
8297 AC_SUBST(PYTHON_LIBS)
8298 AC_SUBST(PYTHON_VERSION)
8299 AC_SUBST(PYTHON_VERSION_MAJOR)
8300 AC_SUBST(PYTHON_VERSION_MINOR)
8302 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8303 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8304     AC_MSG_RESULT([yes])
8305     ENABLE_MARIADBC=TRUE
8306     MARIADBC_MAJOR=1
8307     MARIADBC_MINOR=0
8308     MARIADBC_MICRO=2
8309     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8310 else
8311     AC_MSG_RESULT([no])
8312     ENABLE_MARIADBC=
8314 AC_SUBST(ENABLE_MARIADBC)
8315 AC_SUBST(MARIADBC_MAJOR)
8316 AC_SUBST(MARIADBC_MINOR)
8317 AC_SUBST(MARIADBC_MICRO)
8319 if test "$ENABLE_MARIADBC" = "TRUE"; then
8321     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8323     dnl ===================================================================
8324     dnl Check for system MariaDB
8325     dnl ===================================================================
8326     AC_MSG_CHECKING([which MariaDB to use])
8327     if test "$with_system_mariadb" = "yes"; then
8328         AC_MSG_RESULT([external])
8329         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8330         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8331         if test -z "$MARIADBCONFIG"; then
8332             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8333             if test -z "$MARIADBCONFIG"; then
8334                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8335                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8336             fi
8337         fi
8338         AC_MSG_CHECKING([MariaDB version])
8339         MARIADB_VERSION=`$MARIADBCONFIG --version`
8340         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8341         if test "$MARIADB_MAJOR" -ge "5"; then
8342             AC_MSG_RESULT([OK])
8343         else
8344             AC_MSG_ERROR([too old, use 5.0.x or later])
8345         fi
8346         AC_MSG_CHECKING([for MariaDB Client library])
8347         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8348         if test "$COM_IS_CLANG" = TRUE; then
8349             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8350         fi
8351         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8352         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8353         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8354         dnl linux32:
8355         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8356             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8357             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8358                 | sed -e 's|/lib64/|/lib/|')
8359         fi
8360         FilterLibs "${MARIADB_LIBS}"
8361         MARIADB_LIBS="${filteredlibs}"
8362         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8363         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8364         if test "$enable_bundle_mariadb" = "yes"; then
8365             AC_MSG_RESULT([yes])
8366             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8367             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8369 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8371 /g' | grep -E '(mysqlclient|mariadb)')
8372             if test "$_os" = "Darwin"; then
8373                 LIBMARIADB=${LIBMARIADB}.dylib
8374             elif test "$_os" = "WINNT"; then
8375                 LIBMARIADB=${LIBMARIADB}.dll
8376             else
8377                 LIBMARIADB=${LIBMARIADB}.so
8378             fi
8379             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8380             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8381             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8382                 AC_MSG_RESULT([found.])
8383                 PathFormat "$LIBMARIADB_PATH"
8384                 LIBMARIADB_PATH="$formatted_path"
8385             else
8386                 AC_MSG_ERROR([not found.])
8387             fi
8388         else
8389             AC_MSG_RESULT([no])
8390             BUNDLE_MARIADB_CONNECTOR_C=
8391         fi
8392     else
8393         AC_MSG_RESULT([internal])
8394         SYSTEM_MARIADB_CONNECTOR_C=
8395         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8396         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8397         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8398     fi
8400     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8401     AC_SUBST(MARIADB_CFLAGS)
8402     AC_SUBST(MARIADB_LIBS)
8403     AC_SUBST(LIBMARIADB)
8404     AC_SUBST(LIBMARIADB_PATH)
8405     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8407     AC_LANG_PUSH([C++])
8408     dnl ===================================================================
8409     dnl Check for system MySQL C++ Connector
8410     dnl ===================================================================
8411     # FIXME!
8412     # who thought this too-generic cppconn dir was a good idea?
8413     AC_MSG_CHECKING([MySQL Connector/C++])
8414     if test "$with_system_mysql_cppconn" = "yes"; then
8415         AC_MSG_RESULT([external])
8416         SYSTEM_MYSQL_CONNECTOR_CPP=TRUE
8417         AC_LANG_PUSH([C++])
8418         AC_CHECK_HEADER(mysql_driver.h, [],
8419                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8420         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8421                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8422         save_LIBS=$LIBS
8423         LIBS="$LIBS -lmysqlcppconn"
8424         AC_MSG_CHECKING([version])
8425         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8426 #include <mysql_driver.h>
8428 int main(int argc, char **argv) {
8429     sql::Driver *driver;
8430     driver = get_driver_instance();
8431     if (driver->getMajorVersion() > 1 || \
8432        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8433        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8434         return 0;
8435       else
8436         return 1;
8438       ]])],[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])])
8440         AC_LANG_POP([C++])
8441         LIBS=$save_LIBS
8442     else
8443         AC_MSG_RESULT([internal])
8444         BUILD_TYPE="$BUILD_TYPE MYSQL_CONNECTOR_CPP"
8445         SYSTEM_MYSQL_CONNECTOR_CPP=
8446     fi
8447     AC_LANG_POP([C++])
8449 AC_SUBST(SYSTEM_MYSQL_CONNECTOR_CPP)
8451 dnl ===================================================================
8452 dnl Check for system hsqldb
8453 dnl ===================================================================
8454 if test "$with_java" != "no"; then
8455     HSQLDB_USE_JDBC_4_1=
8456     AC_MSG_CHECKING([which hsqldb to use])
8457     if test "$with_system_hsqldb" = "yes"; then
8458         AC_MSG_RESULT([external])
8459         SYSTEM_HSQLDB=TRUE
8460         if test -z $HSQLDB_JAR; then
8461             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8462         fi
8463         if ! test -f $HSQLDB_JAR; then
8464                AC_MSG_ERROR(hsqldb.jar not found.)
8465         fi
8466         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8467         export HSQLDB_JAR
8468         if $PERL -e \
8469            'use Archive::Zip;
8470             my $file = "$ENV{'HSQLDB_JAR'}";
8471             my $zip = Archive::Zip->new( $file );
8472             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8473             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8474             {
8475                 push @l, split(/\n/, $mf);
8476                 foreach my $line (@l)
8477                 {
8478                     if ($line =~ m/Specification-Version:/)
8479                     {
8480                         ($t, $version) = split (/:/,$line);
8481                         $version =~ s/^\s//;
8482                         ($a, $b, $c, $d) = split (/\./,$version);
8483                         if ($c == "0" && $d > "8")
8484                         {
8485                             exit 0;
8486                         }
8487                         else
8488                         {
8489                             exit 1;
8490                         }
8491                     }
8492                 }
8493             }
8494             else
8495             {
8496                 exit 1;
8497             }'; then
8498             AC_MSG_RESULT([yes])
8499         else
8500             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8501         fi
8502     else
8503         AC_MSG_RESULT([internal])
8504         SYSTEM_HSQLDB=
8505         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8506         NEED_ANT=TRUE
8507         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8508         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8509         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8510             AC_MSG_RESULT([yes])
8511             HSQLDB_USE_JDBC_4_1=TRUE
8512         else
8513             AC_MSG_RESULT([no])
8514         fi
8515     fi
8516     AC_SUBST(SYSTEM_HSQLDB)
8517     AC_SUBST(HSQLDB_JAR)
8518     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8521 dnl ===================================================================
8522 dnl Check for PostgreSQL stuff
8523 dnl ===================================================================
8524 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
8525 if test "x$enable_postgresql_sdbc" != "xno"; then
8526     AC_MSG_RESULT([yes])
8527     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8529     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8530         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8531     fi
8532     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8533         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8534     fi
8536     postgres_interface=""
8537     if test "$with_system_postgresql" = "yes"; then
8538         postgres_interface="external PostgreSQL"
8539         SYSTEM_POSTGRESQL=TRUE
8540         if test "$_os" = Darwin; then
8541             supp_path=''
8542             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8543                 pg_supp_path="$P_SEP$d$pg_supp_path"
8544             done
8545         fi
8546         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8547         if test -z "$PGCONFIG"; then
8548             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8549         fi
8550         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8551         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8552         FilterLibs "${POSTGRESQL_LIB}"
8553         POSTGRESQL_LIB="${filteredlibs}"
8554     else
8555         # if/when anything else than PostgreSQL uses Kerberos,
8556         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8557         WITH_KRB5=
8558         WITH_GSSAPI=
8559         case "$_os" in
8560         Darwin)
8561             # MacOS X has system MIT Kerberos 5 since 10.4
8562             if test "$with_krb5" != "no"; then
8563                 WITH_KRB5=TRUE
8564                 save_LIBS=$LIBS
8565                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8566                 # that the libraries where these functions are located on macOS will change, is it?
8567                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8568                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8569                 KRB5_LIBS=$LIBS
8570                 LIBS=$save_LIBS
8571                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8572                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8573                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8574                 LIBS=$save_LIBS
8575             fi
8576             if test "$with_gssapi" != "no"; then
8577                 WITH_GSSAPI=TRUE
8578                 save_LIBS=$LIBS
8579                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8580                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8581                 GSSAPI_LIBS=$LIBS
8582                 LIBS=$save_LIBS
8583             fi
8584             ;;
8585         WINNT)
8586             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8587                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8588             fi
8589             ;;
8590         Linux|GNU|*BSD|DragonFly)
8591             if test "$with_krb5" != "no"; then
8592                 WITH_KRB5=TRUE
8593                 save_LIBS=$LIBS
8594                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8595                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8596                 KRB5_LIBS=$LIBS
8597                 LIBS=$save_LIBS
8598                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8599                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8600                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8601                 LIBS=$save_LIBS
8602             fi
8603             if test "$with_gssapi" != "no"; then
8604                 WITH_GSSAPI=TRUE
8605                 save_LIBS=$LIBS
8606                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8607                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8608                 GSSAPI_LIBS=$LIBS
8609                 LIBS=$save_LIBS
8610             fi
8611             ;;
8612         *)
8613             if test "$with_krb5" = "yes"; then
8614                 WITH_KRB5=TRUE
8615                 save_LIBS=$LIBS
8616                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8617                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8618                 KRB5_LIBS=$LIBS
8619                 LIBS=$save_LIBS
8620                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8621                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8622                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8623                 LIBS=$save_LIBS
8624             fi
8625             if test "$with_gssapi" = "yes"; then
8626                 WITH_GSSAPI=TRUE
8627                 save_LIBS=$LIBS
8628                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8629                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8630                 LIBS=$save_LIBS
8631                 GSSAPI_LIBS=$LIBS
8632             fi
8633         esac
8635         if test -n "$with_libpq_path"; then
8636             SYSTEM_POSTGRESQL=TRUE
8637             postgres_interface="external libpq"
8638             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8639             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8640         else
8641             SYSTEM_POSTGRESQL=
8642             postgres_interface="internal"
8643             POSTGRESQL_LIB=""
8644             POSTGRESQL_INC="%OVERRIDE_ME%"
8645             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8646         fi
8647     fi
8649     AC_MSG_CHECKING([PostgreSQL C interface])
8650     AC_MSG_RESULT([$postgres_interface])
8652     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8653         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8654         save_CFLAGS=$CFLAGS
8655         save_CPPFLAGS=$CPPFLAGS
8656         save_LIBS=$LIBS
8657         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8658         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8659         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8660         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8661             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8662         CFLAGS=$save_CFLAGS
8663         CPPFLAGS=$save_CPPFLAGS
8664         LIBS=$save_LIBS
8665     fi
8666     BUILD_POSTGRESQL_SDBC=TRUE
8667 else
8668     AC_MSG_RESULT([no])
8670 AC_SUBST(WITH_KRB5)
8671 AC_SUBST(WITH_GSSAPI)
8672 AC_SUBST(GSSAPI_LIBS)
8673 AC_SUBST(KRB5_LIBS)
8674 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8675 AC_SUBST(SYSTEM_POSTGRESQL)
8676 AC_SUBST(POSTGRESQL_INC)
8677 AC_SUBST(POSTGRESQL_LIB)
8679 dnl ===================================================================
8680 dnl Check for Firebird stuff
8681 dnl ===================================================================
8682 ENABLE_FIREBIRD_SDBC=""
8683 if test "$enable_firebird_sdbc" = "yes" ; then
8684     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8686     dnl ===================================================================
8687     dnl Check for system Firebird
8688     dnl ===================================================================
8689     AC_MSG_CHECKING([which Firebird to use])
8690     if test "$with_system_firebird" = "yes"; then
8691         AC_MSG_RESULT([external])
8692         SYSTEM_FIREBIRD=TRUE
8693         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8694         if test -z "$FIREBIRDCONFIG"; then
8695             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8696             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8697                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8698             ])
8699             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8700         else
8701             AC_MSG_NOTICE([fb_config found])
8702             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8703             AC_MSG_CHECKING([for Firebird Client library])
8704             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8705             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8706             FilterLibs "${FIREBIRD_LIBS}"
8707             FIREBIRD_LIBS="${filteredlibs}"
8708         fi
8709         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8710         AC_MSG_CHECKING([Firebird version])
8711         if test -n "${FIREBIRD_VERSION}"; then
8712             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8713             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8714             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8715                 AC_MSG_RESULT([OK])
8716             else
8717                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
8718             fi
8719         else
8720             __save_CFLAGS="${CFLAGS}"
8721             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8722             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8723 #if defined(FB_API_VER) && FB_API_VER == 30
8724 int fb_api_is_30(void) { return 0; }
8725 #else
8726 #error "Wrong Firebird API version"
8727 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
8728             CFLAGS="${__save_CFLAGS}"
8729         fi
8730         ENABLE_FIREBIRD_SDBC="TRUE"
8731     elif test "$enable_database_connectivity" != yes; then
8732         AC_MSG_RESULT([none])
8733     elif test "$cross_compiling" = "yes"; then
8734         AC_MSG_RESULT([none])
8735     else
8736         dnl Embedded Firebird has version 3.0
8737         AC_DEFINE(HAVE_FIREBIRD_30, 1)
8738         dnl We need libatomic-ops for any non X86/X64 system
8739         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8740             dnl ===================================================================
8741             dnl Check for system libatomic-ops
8742             dnl ===================================================================
8743             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8744             if test "$with_system_libatomic_ops" = "yes"; then
8745                 SYSTEM_LIBATOMIC_OPS=TRUE
8746                 AC_CHECK_HEADERS(atomic_ops.h, [],
8747                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8748             else
8749                 SYSTEM_LIBATOMIC_OPS=
8750                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8751                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8752                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8753             fi
8754         fi
8756         AC_MSG_RESULT([internal])
8757         SYSTEM_FIREBIRD=
8758         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
8759         FIREBIRD_LIBS="-lfbclient"
8761         if test "$with_system_libtommath" = "yes"; then
8762             SYSTEM_LIBTOMMATH=TRUE
8763             dnl check for tommath presence
8764             save_LIBS=$LIBS
8765             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
8766             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
8767             LIBS=$save_LIBS
8768         else
8769             SYSTEM_LIBTOMMATH=
8770             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
8771             LIBTOMMATH_LIBS="-ltommath"
8772             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
8773         fi
8775         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8776         ENABLE_FIREBIRD_SDBC="TRUE"
8777         AC_DEFINE(ENABLE_FIREBIRD_SDBC)
8778     fi
8780 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8781 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8782 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8783 AC_SUBST(LIBATOMIC_OPS_LIBS)
8784 AC_SUBST(SYSTEM_FIREBIRD)
8785 AC_SUBST(FIREBIRD_CFLAGS)
8786 AC_SUBST(FIREBIRD_LIBS)
8787 AC_SUBST([TOMMATH_CFLAGS])
8788 AC_SUBST([TOMMATH_LIBS])
8790 dnl ===================================================================
8791 dnl Check for system curl
8792 dnl ===================================================================
8793 AC_MSG_CHECKING([which libcurl to use])
8794 if test "$with_system_curl" = "auto"; then
8795     with_system_curl="$with_system_libs"
8798 if test "$with_system_curl" = "yes"; then
8799     AC_MSG_RESULT([external])
8800     SYSTEM_CURL=TRUE
8802     # First try PKGCONFIG and then fall back
8803     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8805     if test -n "$CURL_PKG_ERRORS"; then
8806         AC_PATH_PROG(CURLCONFIG, curl-config)
8807         if test -z "$CURLCONFIG"; then
8808             AC_MSG_ERROR([curl development files not found])
8809         fi
8810         CURL_LIBS=`$CURLCONFIG --libs`
8811         FilterLibs "${CURL_LIBS}"
8812         CURL_LIBS="${filteredlibs}"
8813         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8814         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8816         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8817         case $curl_version in
8818         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8819         dnl so they need to be doubled to end up in the configure script
8820         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8821             AC_MSG_RESULT([yes])
8822             ;;
8823         *)
8824             AC_MSG_ERROR([no, you have $curl_version])
8825             ;;
8826         esac
8827     fi
8829     ENABLE_CURL=TRUE
8830 elif test $_os = iOS; then
8831     # Let's see if we need curl, I think not?
8832     AC_MSG_RESULT([none])
8833     ENABLE_CURL=
8834 else
8835     AC_MSG_RESULT([internal])
8836     SYSTEM_CURL=
8837     BUILD_TYPE="$BUILD_TYPE CURL"
8838     ENABLE_CURL=TRUE
8840 AC_SUBST(SYSTEM_CURL)
8841 AC_SUBST(CURL_CFLAGS)
8842 AC_SUBST(CURL_LIBS)
8843 AC_SUBST(ENABLE_CURL)
8845 dnl ===================================================================
8846 dnl Check for system boost
8847 dnl ===================================================================
8848 AC_MSG_CHECKING([which boost to use])
8849 if test "$with_system_boost" = "yes"; then
8850     AC_MSG_RESULT([external])
8851     SYSTEM_BOOST=TRUE
8852     AX_BOOST_BASE(1.47)
8853     AX_BOOST_DATE_TIME
8854     AX_BOOST_FILESYSTEM
8855     AX_BOOST_IOSTREAMS
8856     AX_BOOST_LOCALE
8857     AC_LANG_PUSH([C++])
8858     save_CXXFLAGS=$CXXFLAGS
8859     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8860     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8861        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8862     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8863        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8864     CXXFLAGS=$save_CXXFLAGS
8865     AC_LANG_POP([C++])
8866     # this is in m4/ax_boost_base.m4
8867     FilterLibs "${BOOST_LDFLAGS}"
8868     BOOST_LDFLAGS="${filteredlibs}"
8869 else
8870     AC_MSG_RESULT([internal])
8871     BUILD_TYPE="$BUILD_TYPE BOOST"
8872     SYSTEM_BOOST=
8873     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
8874         # use warning-suppressing wrapper headers
8875         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
8876     else
8877         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
8878     fi
8880 AC_SUBST(SYSTEM_BOOST)
8882 dnl ===================================================================
8883 dnl Check for system mdds
8884 dnl ===================================================================
8885 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.2 >= 1.2.3], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8887 dnl ===================================================================
8888 dnl Check for system glm
8889 dnl ===================================================================
8890 AC_MSG_CHECKING([which glm to use])
8891 if test "$with_system_glm" = "yes"; then
8892     AC_MSG_RESULT([external])
8893     SYSTEM_GLM=TRUE
8894     AC_LANG_PUSH([C++])
8895     AC_CHECK_HEADER([glm/glm.hpp], [],
8896        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8897     AC_LANG_POP([C++])
8898 else
8899     AC_MSG_RESULT([internal])
8900     BUILD_TYPE="$BUILD_TYPE GLM"
8901     SYSTEM_GLM=
8902     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8904 AC_SUBST([GLM_CFLAGS])
8905 AC_SUBST([SYSTEM_GLM])
8907 dnl ===================================================================
8908 dnl Check for system odbc
8909 dnl ===================================================================
8910 AC_MSG_CHECKING([which odbc headers to use])
8911 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
8912     AC_MSG_RESULT([external])
8913     SYSTEM_ODBC_HEADERS=TRUE
8915     if test "$build_os" = "cygwin"; then
8916         save_CPPFLAGS=$CPPFLAGS
8917         find_winsdk
8918         PathFormat "$winsdktest"
8919         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"
8920         AC_CHECK_HEADER(sqlext.h, [],
8921             [AC_MSG_ERROR(odbc not found. install odbc)],
8922             [#include <windows.h>])
8923         CPPFLAGS=$save_CPPFLAGS
8924     else
8925         AC_CHECK_HEADER(sqlext.h, [],
8926             [AC_MSG_ERROR(odbc not found. install odbc)],[])
8927     fi
8928 elif test "$enable_database_connectivity" != yes; then
8929     AC_MSG_RESULT([none])
8930 else
8931     AC_MSG_RESULT([internal])
8932     SYSTEM_ODBC_HEADERS=
8934 AC_SUBST(SYSTEM_ODBC_HEADERS)
8937 dnl ===================================================================
8938 dnl Check for system openldap
8939 dnl ===================================================================
8941 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8942 AC_MSG_CHECKING([which openldap library to use])
8943 if test "$with_system_openldap" = "yes"; then
8944     AC_MSG_RESULT([external])
8945     SYSTEM_OPENLDAP=TRUE
8946     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8947     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8948     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8949 else
8950     AC_MSG_RESULT([internal])
8951     SYSTEM_OPENLDAP=
8952     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8955 AC_SUBST(SYSTEM_OPENLDAP)
8957 dnl ===================================================================
8958 dnl Check for system NSS
8959 dnl ===================================================================
8960 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
8961     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8962     AC_DEFINE(HAVE_FEATURE_NSS)
8963     ENABLE_NSS="TRUE"
8964     AC_DEFINE(ENABLE_NSS)
8965 elif test $_os != iOS ; then
8966     with_tls=openssl
8968 AC_SUBST(ENABLE_NSS)
8970 dnl ===================================================================
8971 dnl Check for TLS/SSL and cryptographic implementation to use
8972 dnl ===================================================================
8973 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8974 if test -n "$with_tls"; then
8975     case $with_tls in
8976     openssl)
8977         AC_DEFINE(USE_TLS_OPENSSL)
8978         TLS=OPENSSL
8980         if test "$enable_openssl" != "yes"; then
8981             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8982         fi
8984         # warn that OpenSSL has been selected but not all TLS code has this option
8985         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
8986         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
8987         ;;
8988     nss)
8989         AC_DEFINE(USE_TLS_NSS)
8990         TLS=NSS
8991         ;;
8992     no)
8993         AC_MSG_WARN([Skipping TLS/SSL])
8994         ;;
8995     *)
8996         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8997 openssl - OpenSSL
8998 nss - Mozilla's Network Security Services (NSS)
8999     ])
9000         ;;
9001     esac
9002 else
9003     # default to using NSS, it results in smaller oox lib
9004     AC_DEFINE(USE_TLS_NSS)
9005     TLS=NSS
9007 AC_MSG_RESULT([$TLS])
9008 AC_SUBST(TLS)
9010 dnl ===================================================================
9011 dnl Check for system sane
9012 dnl ===================================================================
9013 AC_MSG_CHECKING([which sane header to use])
9014 if test "$with_system_sane" = "yes"; then
9015     AC_MSG_RESULT([external])
9016     AC_CHECK_HEADER(sane/sane.h, [],
9017       [AC_MSG_ERROR(sane not found. install sane)], [])
9018 else
9019     AC_MSG_RESULT([internal])
9020     BUILD_TYPE="$BUILD_TYPE SANE"
9023 dnl ===================================================================
9024 dnl Check for system icu
9025 dnl ===================================================================
9026 SYSTEM_GENBRK=
9027 SYSTEM_GENCCODE=
9028 SYSTEM_GENCMN=
9030 ICU_MAJOR=61
9031 ICU_MINOR=1
9032 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9033 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9034 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9035 AC_MSG_CHECKING([which icu to use])
9036 if test "$with_system_icu" = "yes"; then
9037     AC_MSG_RESULT([external])
9038     SYSTEM_ICU=TRUE
9039     AC_LANG_PUSH([C++])
9040     AC_MSG_CHECKING([for unicode/rbbi.h])
9041     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9042     AC_LANG_POP([C++])
9044     if test "$cross_compiling" != "yes"; then
9045         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9046         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9047         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9048         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9049     fi
9051     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9052         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9053         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9054         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9055         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9056         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9057             AC_MSG_RESULT([yes])
9058         else
9059             AC_MSG_RESULT([no])
9060             if test "$with_system_icu_for_build" != "force"; then
9061                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9062 You can use --with-system-icu-for-build=force to use it anyway.])
9063             fi
9064         fi
9065     fi
9067     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9068         # using the system icu tools can lead to version confusion, use the
9069         # ones from the build environment when cross-compiling
9070         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9071         if test -z "$SYSTEM_GENBRK"; then
9072             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9073         fi
9074         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9075         if test -z "$SYSTEM_GENCCODE"; then
9076             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9077         fi
9078         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9079         if test -z "$SYSTEM_GENCMN"; then
9080             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9081         fi
9082         if test "$ICU_MAJOR" -ge "49"; then
9083             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9084             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9085             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9086         else
9087             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9088             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9089             ICU_RECLASSIFIED_HEBREW_LETTER=
9090         fi
9091     fi
9093     if test "$cross_compiling" = "yes"; then
9094         if test "$ICU_MAJOR" -ge "50"; then
9095             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9096             ICU_MINOR=""
9097         fi
9098     fi
9099 else
9100     AC_MSG_RESULT([internal])
9101     SYSTEM_ICU=
9102     BUILD_TYPE="$BUILD_TYPE ICU"
9103     # surprisingly set these only for "internal" (to be used by various other
9104     # external libs): the system icu-config is quite unhelpful and spits out
9105     # dozens of weird flags and also default path -I/usr/include
9106     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9107     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9109 if test "$ICU_MAJOR" -ge "59"; then
9110     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9111     # with -std=c++11 but not all external libraries can be built with that,
9112     # for those use a bit-compatible typedef uint16_t UChar; see
9113     # icu/source/common/unicode/umachine.h
9114     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9115 else
9116     ICU_UCHAR_TYPE=""
9118 AC_SUBST(SYSTEM_ICU)
9119 AC_SUBST(SYSTEM_GENBRK)
9120 AC_SUBST(SYSTEM_GENCCODE)
9121 AC_SUBST(SYSTEM_GENCMN)
9122 AC_SUBST(ICU_MAJOR)
9123 AC_SUBST(ICU_MINOR)
9124 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9125 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9126 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9127 AC_SUBST(ICU_CFLAGS)
9128 AC_SUBST(ICU_LIBS)
9129 AC_SUBST(ICU_UCHAR_TYPE)
9131 dnl ==================================================================
9132 dnl Breakpad
9133 dnl ==================================================================
9134 AC_MSG_CHECKING([whether to enable breakpad])
9135 if test "$enable_breakpad" != yes; then
9136     AC_MSG_RESULT([no])
9137 else
9138     AC_MSG_RESULT([yes])
9139     ENABLE_BREAKPAD="TRUE"
9140     AC_DEFINE(ENABLE_BREAKPAD)
9141     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9142     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9144     AC_MSG_CHECKING([for crashreport config])
9145     if test "$with_symbol_config" = "no"; then
9146         BREAKPAD_SYMBOL_CONFIG="invalid"
9147         AC_MSG_RESULT([no])
9148     else
9149         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9150         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9151         AC_MSG_RESULT([yes])
9152     fi
9153     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9155 AC_SUBST(ENABLE_BREAKPAD)
9157 dnl ==================================================================
9158 dnl libfuzzer
9159 dnl ==================================================================
9160 AC_MSG_CHECKING([whether to enable fuzzers])
9161 if test "$enable_fuzzers" != yes; then
9162     AC_MSG_RESULT([no])
9163 else
9164     AC_MSG_RESULT([yes])
9165     ENABLE_FUZZERS="TRUE"
9166     AC_DEFINE(ENABLE_FUZZERS)
9167     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9169 AC_SUBST(ENABLE_FUZZERS)
9171 dnl ===================================================================
9172 dnl Orcus
9173 dnl ===================================================================
9174 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.13 >= 0.13.3])
9175 if test "$with_system_orcus" != "yes"; then
9176     if test "$SYSTEM_BOOST" = "TRUE"; then
9177         # ===========================================================
9178         # Determine if we are going to need to link with Boost.System
9179         # ===========================================================
9180         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9181         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9182         dnl in documentation has no effect.
9183         AC_MSG_CHECKING([if we need to link with Boost.System])
9184         AC_LANG_PUSH([C++])
9185         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9186                 @%:@include <boost/version.hpp>
9187             ]],[[
9188                 #if BOOST_VERSION >= 105000
9189                 #   error yes, we need to link with Boost.System
9190                 #endif
9191             ]])],[
9192                 AC_MSG_RESULT([no])
9193             ],[
9194                 AC_MSG_RESULT([yes])
9195                 AX_BOOST_SYSTEM
9196         ])
9197         AC_LANG_POP([C++])
9198     fi
9200 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9201 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9202 AC_SUBST([BOOST_SYSTEM_LIB])
9203 AC_SUBST(SYSTEM_LIBORCUS)
9205 dnl ===================================================================
9206 dnl HarfBuzz
9207 dnl ===================================================================
9208 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9209                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9210                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9212 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9213                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9214                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9216 if test "$COM" = "MSC"; then # override the above
9217     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9218     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9221 if test "$with_system_harfbuzz" = "yes"; then
9222     if test "$with_system_graphite" = "no"; then
9223         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9224     fi
9225     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9226     _save_libs="$LIBS"
9227     _save_cflags="$CFLAGS"
9228     LIBS="$LIBS $HARFBUZZ_LIBS"
9229     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9230     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9231     LIBS="$_save_libs"
9232     CFLAGS="$_save_cflags"
9233 else
9234     if test "$with_system_graphite" = "yes"; then
9235         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9236     fi
9239 AC_MSG_CHECKING([whether to use X11])
9240 dnl ***************************************
9241 dnl testing for X libraries and includes...
9242 dnl ***************************************
9243 if test "$USING_X11" = TRUE; then
9244     AC_DEFINE(HAVE_FEATURE_X11)
9246 AC_MSG_RESULT([$USING_X11])
9248 if test "$USING_X11" = TRUE; then
9249     AC_PATH_X
9250     AC_PATH_XTRA
9251     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9253     if test -z "$x_includes"; then
9254         x_includes="default_x_includes"
9255     fi
9256     if test -z "$x_libraries"; then
9257         x_libraries="default_x_libraries"
9258     fi
9259     CFLAGS="$CFLAGS $X_CFLAGS"
9260     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9261     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9262 else
9263     x_includes="no_x_includes"
9264     x_libraries="no_x_libraries"
9267 if test "$USING_X11" = TRUE; then
9268     dnl ===================================================================
9269     dnl Check for extension headers
9270     dnl ===================================================================
9271     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9272      [#include <X11/extensions/shape.h>])
9274     # vcl needs ICE and SM
9275     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9276     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9277         [AC_MSG_ERROR(ICE library not found)])
9278     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9279     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9280         [AC_MSG_ERROR(SM library not found)])
9283 dnl ===================================================================
9284 dnl Check for system Xrender
9285 dnl ===================================================================
9286 AC_MSG_CHECKING([whether to use Xrender])
9287 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9288     AC_MSG_RESULT([yes])
9289     PKG_CHECK_MODULES(XRENDER, xrender)
9290     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9291     FilterLibs "${XRENDER_LIBS}"
9292     XRENDER_LIBS="${filteredlibs}"
9293     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9294       [AC_MSG_ERROR(libXrender not found or functional)], [])
9295     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9296       [AC_MSG_ERROR(Xrender not found. install X)], [])
9297 else
9298     AC_MSG_RESULT([no])
9300 AC_SUBST(XRENDER_CFLAGS)
9301 AC_SUBST(XRENDER_LIBS)
9303 dnl ===================================================================
9304 dnl Check for XRandr
9305 dnl ===================================================================
9306 AC_MSG_CHECKING([whether to enable RandR support])
9307 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9308     AC_MSG_RESULT([yes])
9309     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9310     if test "$ENABLE_RANDR" != "TRUE"; then
9311         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9312                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9313         XRANDR_CFLAGS=" "
9314         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9315           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9316         XRANDR_LIBS="-lXrandr "
9317         ENABLE_RANDR="TRUE"
9318     fi
9319     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9320     FilterLibs "${XRANDR_LIBS}"
9321     XRANDR_LIBS="${filteredlibs}"
9322 else
9323     ENABLE_RANDR=""
9324     AC_MSG_RESULT([no])
9326 AC_SUBST(XRANDR_CFLAGS)
9327 AC_SUBST(XRANDR_LIBS)
9328 AC_SUBST(ENABLE_RANDR)
9330 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9331     WITH_WEBDAV="serf"
9333 if test $_os = iOS -o $_os = Android; then
9334     WITH_WEBDAV="no"
9336 AC_MSG_CHECKING([for webdav library])
9337 case "$WITH_WEBDAV" in
9338 serf)
9339     AC_MSG_RESULT([serf])
9340     # Check for system apr-util
9341     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9342                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9343                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9344     if test "$COM" = "MSC"; then
9345         APR_LIB_DIR="LibR"
9346         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9347         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9348     fi
9350     # Check for system serf
9351     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9352                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9353     if test "$COM" = "MSC"; then
9354         SERF_LIB_DIR="Release"
9355         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9356         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9357     fi
9358     ;;
9359 neon)
9360     AC_MSG_RESULT([neon])
9361     # Check for system neon
9362     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9363     if test "$with_system_neon" = "yes"; then
9364         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9365     else
9366         NEON_VERSION=0295
9367     fi
9368     AC_SUBST(NEON_VERSION)
9369     ;;
9371     AC_MSG_RESULT([none, disabled])
9372     WITH_WEBDAV=""
9373     ;;
9374 esac
9375 AC_SUBST(WITH_WEBDAV)
9377 dnl ===================================================================
9378 dnl Check for disabling cve_tests
9379 dnl ===================================================================
9380 AC_MSG_CHECKING([whether to execute CVE tests])
9381 # If not explicitly enabled or disabled, default
9382 if test -z "$enable_cve_tests"; then
9383     case "$OS" in
9384     WNT)
9385         # Default cves off for windows with its wild and wonderful
9386         # varienty of AV software kicking in and panicking
9387         enable_cve_tests=no
9388         ;;
9389     *)
9390         # otherwise yes
9391         enable_cve_tests=yes
9392         ;;
9393     esac
9395 if test "$enable_cve_tests" = "no"; then
9396     AC_MSG_RESULT([no])
9397     DISABLE_CVE_TESTS=TRUE
9398     AC_SUBST(DISABLE_CVE_TESTS)
9399 else
9400     AC_MSG_RESULT([yes])
9403 dnl ===================================================================
9404 dnl Check for enabling chart XShape tests
9405 dnl ===================================================================
9406 AC_MSG_CHECKING([whether to execute chart XShape tests])
9407 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9408     AC_MSG_RESULT([yes])
9409     ENABLE_CHART_TESTS=TRUE
9410     AC_SUBST(ENABLE_CHART_TESTS)
9411 else
9412     AC_MSG_RESULT([no])
9415 dnl ===================================================================
9416 dnl Check for system openssl
9417 dnl ===================================================================
9418 DISABLE_OPENSSL=
9419 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9420 if test "$enable_openssl" = "yes"; then
9421     AC_MSG_RESULT([no])
9422     if test "$_os" = Darwin ; then
9423         # OpenSSL is deprecated when building for 10.7 or later.
9424         #
9425         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9426         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9428         with_system_openssl=no
9429         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9430     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9431             && test "$with_system_openssl" != "no"; then
9432         with_system_openssl=yes
9433         SYSTEM_OPENSSL=TRUE
9434         OPENSSL_CFLAGS=
9435         OPENSSL_LIBS="-lssl -lcrypto"
9436     else
9437         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9438     fi
9439     if test "$with_system_openssl" = "yes"; then
9440         AC_MSG_CHECKING([whether openssl supports SHA512])
9441         AC_LANG_PUSH([C])
9442         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9443             SHA512_CTX context;
9444 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9445         AC_LANG_POP(C)
9446     fi
9447 else
9448     AC_MSG_RESULT([yes])
9449     DISABLE_OPENSSL=TRUE
9451     # warn that although OpenSSL is disabled, system libraries may depend on it
9452     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9453     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9456 AC_SUBST([DISABLE_OPENSSL])
9458 dnl ===================================================================
9459 dnl Check for building gnutls
9460 dnl ===================================================================
9461 AC_MSG_CHECKING([whether to use gnutls])
9462 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9463     AC_MSG_RESULT([yes])
9464     AM_PATH_LIBGCRYPT()
9465     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9466         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9467                       available in the system to use as replacement.]]))
9468     FilterLibs "${LIBGCRYPT_LIBS}"
9469     LIBGCRYPT_LIBS="${filteredlibs}"
9470 else
9471     AC_MSG_RESULT([no])
9474 AC_SUBST([LIBGCRYPT_CFLAGS])
9475 AC_SUBST([LIBGCRYPT_LIBS])
9477 dnl ===================================================================
9478 dnl Check for system redland
9479 dnl ===================================================================
9480 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9481 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9482 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9483 if test "$with_system_redland" = "yes"; then
9484     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9485             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9486 else
9487     RAPTOR_MAJOR="0"
9488     RASQAL_MAJOR="3"
9489     REDLAND_MAJOR="0"
9491 AC_SUBST(RAPTOR_MAJOR)
9492 AC_SUBST(RASQAL_MAJOR)
9493 AC_SUBST(REDLAND_MAJOR)
9495 dnl ===================================================================
9496 dnl Check for system hunspell
9497 dnl ===================================================================
9498 AC_MSG_CHECKING([which libhunspell to use])
9499 if test "$with_system_hunspell" = "yes"; then
9500     AC_MSG_RESULT([external])
9501     SYSTEM_HUNSPELL=TRUE
9502     AC_LANG_PUSH([C++])
9503     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9504     if test "$HUNSPELL_PC" != "TRUE"; then
9505         AC_CHECK_HEADER(hunspell.hxx, [],
9506             [
9507             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9508             [AC_MSG_ERROR(hunspell headers not found.)], [])
9509             ], [])
9510         AC_CHECK_LIB([hunspell], [main], [:],
9511            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9512         HUNSPELL_LIBS=-lhunspell
9513     fi
9514     AC_LANG_POP([C++])
9515     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9516     FilterLibs "${HUNSPELL_LIBS}"
9517     HUNSPELL_LIBS="${filteredlibs}"
9518 else
9519     AC_MSG_RESULT([internal])
9520     SYSTEM_HUNSPELL=
9521     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9522     if test "$COM" = "MSC"; then
9523         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9524     else
9525         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.6"
9526     fi
9527     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9529 AC_SUBST(SYSTEM_HUNSPELL)
9530 AC_SUBST(HUNSPELL_CFLAGS)
9531 AC_SUBST(HUNSPELL_LIBS)
9533 dnl ===================================================================
9534 dnl Checking for altlinuxhyph
9535 dnl ===================================================================
9536 AC_MSG_CHECKING([which altlinuxhyph to use])
9537 if test "$with_system_altlinuxhyph" = "yes"; then
9538     AC_MSG_RESULT([external])
9539     SYSTEM_HYPH=TRUE
9540     AC_CHECK_HEADER(hyphen.h, [],
9541        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9542     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9543        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9544        [#include <hyphen.h>])
9545     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9546         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9547     if test -z "$HYPHEN_LIB"; then
9548         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9549            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9550     fi
9551     if test -z "$HYPHEN_LIB"; then
9552         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9553            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9554     fi
9555 else
9556     AC_MSG_RESULT([internal])
9557     SYSTEM_HYPH=
9558     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9559     if test "$COM" = "MSC"; then
9560         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9561     else
9562         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9563     fi
9565 AC_SUBST(SYSTEM_HYPH)
9566 AC_SUBST(HYPHEN_LIB)
9568 dnl ===================================================================
9569 dnl Checking for mythes
9570 dnl ===================================================================
9571 AC_MSG_CHECKING([which mythes to use])
9572 if test "$with_system_mythes" = "yes"; then
9573     AC_MSG_RESULT([external])
9574     SYSTEM_MYTHES=TRUE
9575     AC_LANG_PUSH([C++])
9576     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9577     if test "$MYTHES_PKGCONFIG" = "no"; then
9578         AC_CHECK_HEADER(mythes.hxx, [],
9579             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9580         AC_CHECK_LIB([mythes-1.2], [main], [:],
9581             [ MYTHES_FOUND=no], [])
9582     if test "$MYTHES_FOUND" = "no"; then
9583         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9584                 [ MYTHES_FOUND=no], [])
9585     fi
9586     if test "$MYTHES_FOUND" = "no"; then
9587         AC_MSG_ERROR([mythes library not found!.])
9588     fi
9589     fi
9590     AC_LANG_POP([C++])
9591     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9592     FilterLibs "${MYTHES_LIBS}"
9593     MYTHES_LIBS="${filteredlibs}"
9594 else
9595     AC_MSG_RESULT([internal])
9596     SYSTEM_MYTHES=
9597     BUILD_TYPE="$BUILD_TYPE MYTHES"
9598     if test "$COM" = "MSC"; then
9599         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9600     else
9601         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9602     fi
9604 AC_SUBST(SYSTEM_MYTHES)
9605 AC_SUBST(MYTHES_CFLAGS)
9606 AC_SUBST(MYTHES_LIBS)
9608 dnl ===================================================================
9609 dnl How should we build the linear programming solver ?
9610 dnl ===================================================================
9612 ENABLE_COINMP=
9613 AC_MSG_CHECKING([whether to build with CoinMP])
9614 if test "$enable_coinmp" != "no"; then
9615     ENABLE_COINMP=TRUE
9616     AC_MSG_RESULT([yes])
9617     if test "$with_system_coinmp" = "yes"; then
9618         SYSTEM_COINMP=TRUE
9619         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9620         FilterLibs "${COINMP_LIBS}"
9621         COINMP_LIBS="${filteredlibs}"
9622     else
9623         BUILD_TYPE="$BUILD_TYPE COINMP"
9624     fi
9625 else
9626     AC_MSG_RESULT([no])
9628 AC_SUBST(ENABLE_COINMP)
9629 AC_SUBST(SYSTEM_COINMP)
9630 AC_SUBST(COINMP_CFLAGS)
9631 AC_SUBST(COINMP_LIBS)
9633 ENABLE_LPSOLVE=
9634 AC_MSG_CHECKING([whether to build with lpsolve])
9635 if test "$enable_lpsolve" != "no"; then
9636     ENABLE_LPSOLVE=TRUE
9637     AC_MSG_RESULT([yes])
9638 else
9639     AC_MSG_RESULT([no])
9641 AC_SUBST(ENABLE_LPSOLVE)
9643 if test "$ENABLE_LPSOLVE" = TRUE; then
9644     AC_MSG_CHECKING([which lpsolve to use])
9645     if test "$with_system_lpsolve" = "yes"; then
9646         AC_MSG_RESULT([external])
9647         SYSTEM_LPSOLVE=TRUE
9648         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9649            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9650         save_LIBS=$LIBS
9651         # some systems need this. Like Ubuntu....
9652         AC_CHECK_LIB(m, floor)
9653         AC_CHECK_LIB(dl, dlopen)
9654         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9655             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9656         LIBS=$save_LIBS
9657     else
9658         AC_MSG_RESULT([internal])
9659         SYSTEM_LPSOLVE=
9660         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9661     fi
9663 AC_SUBST(SYSTEM_LPSOLVE)
9665 dnl ===================================================================
9666 dnl Checking for libexttextcat
9667 dnl ===================================================================
9668 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9669 if test "$with_system_libexttextcat" = "yes"; then
9670     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9672 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9674 dnl ===================================================================
9675 dnl Checking for libnumbertext
9676 dnl ===================================================================
9677 AC_MSG_CHECKING([whether to use libnumbertext])
9678 if test "$enable_libnumbertext" = "no"; then
9679     AC_MSG_RESULT([no])
9680     ENABLE_LIBNUMBERTEXT=
9681     SYSTEM_LIBNUMBERTEXT=
9682 else
9683     AC_MSG_RESULT([yes])
9684     ENABLE_LIBNUMBERTEXT=TRUE
9685     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
9686     if test "$with_system_libnumbertext" = "yes"; then
9687         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
9688         SYSTEM_LIBNUMBERTEXT=YES
9689     else
9690         SYSTEM_LIBNUMBERTEXT=
9691         AC_LANG_PUSH([C++])
9692         save_CPPFLAGS=$CPPFLAGS
9693         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
9694         AC_CHECK_HEADERS([codecvt regex])
9695         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
9696                 [ ENABLE_LIBNUMBERTEXT=''
9697                   LIBNUMBERTEXT_CFLAGS=''
9698                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
9699                                Enable libnumbertext fallback (missing number to number name conversion).])
9700                 ])
9701         CPPFLAGS=$save_CPPFLAGS
9702         AC_LANG_POP([C++])
9703     fi
9704     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
9705         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
9706     fi
9708 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
9709 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
9710 AC_SUBST(ENABLE_LIBNUMBERTEXT)
9711 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
9713 dnl ***************************************
9714 dnl testing libc version for Linux...
9715 dnl ***************************************
9716 if test "$_os" = "Linux"; then
9717     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9718     exec 6>/dev/null # no output
9719     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9720     exec 6>&1 # output on again
9721     if test "$HAVE_LIBC"; then
9722         AC_MSG_RESULT([yes])
9723     else
9724         AC_MSG_ERROR([no, upgrade libc])
9725     fi
9728 dnl =========================================
9729 dnl Check for uuidgen
9730 dnl =========================================
9731 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9732     # presence is already tested above in the WINDOWS_SDK_HOME check
9733     UUIDGEN=uuidgen.exe
9734     AC_SUBST(UUIDGEN)
9735 else
9736     AC_PATH_PROG([UUIDGEN], [uuidgen])
9737     if test -z "$UUIDGEN"; then
9738         AC_MSG_WARN([uuid is needed for building installation sets])
9739     fi
9742 dnl ***************************************
9743 dnl Checking for bison and flex
9744 dnl ***************************************
9745 AC_PATH_PROG(BISON, bison)
9746 if test -z "$BISON"; then
9747     AC_MSG_ERROR([no bison found in \$PATH, install it])
9748 else
9749     AC_MSG_CHECKING([the bison version])
9750     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9751     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9752     # Accept newer than 2.0
9753     if test "$_bison_longver" -lt 2000; then
9754         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9755     fi
9758 AC_PATH_PROG(FLEX, flex)
9759 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9760     FLEX=`cygpath -m $FLEX`
9762 if test -z "$FLEX"; then
9763     AC_MSG_ERROR([no flex found in \$PATH, install it])
9764 else
9765     AC_MSG_CHECKING([the flex version])
9766     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9767     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9768         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9769     fi
9771 AC_SUBST([FLEX])
9772 dnl ***************************************
9773 dnl Checking for patch
9774 dnl ***************************************
9775 AC_PATH_PROG(PATCH, patch)
9776 if test -z "$PATCH"; then
9777     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9780 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9781 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9782     if test -z "$with_gnu_patch"; then
9783         GNUPATCH=$PATCH
9784     else
9785         if test -x "$with_gnu_patch"; then
9786             GNUPATCH=$with_gnu_patch
9787         else
9788             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9789         fi
9790     fi
9792     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9793     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9794         AC_MSG_RESULT([yes])
9795     else
9796         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9797     fi
9798 else
9799     GNUPATCH=$PATCH
9802 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9803     GNUPATCH=`cygpath -m $GNUPATCH`
9806 dnl We also need to check for --with-gnu-cp
9808 if test -z "$with_gnu_cp"; then
9809     # check the place where the good stuff is hidden on Solaris...
9810     if test -x /usr/gnu/bin/cp; then
9811         GNUCP=/usr/gnu/bin/cp
9812     else
9813         AC_PATH_PROGS(GNUCP, gnucp cp)
9814     fi
9815     if test -z $GNUCP; then
9816         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9817     fi
9818 else
9819     if test -x "$with_gnu_cp"; then
9820         GNUCP=$with_gnu_cp
9821     else
9822         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9823     fi
9826 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9827     GNUCP=`cygpath -m $GNUCP`
9830 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9831 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9832     AC_MSG_RESULT([yes])
9833 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9834     AC_MSG_RESULT([yes])
9835 else
9836     case "$build_os" in
9837     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9838         x_GNUCP=[\#]
9839         GNUCP=''
9840         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9841         ;;
9842     *)
9843         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9844         ;;
9845     esac
9848 AC_SUBST(GNUPATCH)
9849 AC_SUBST(GNUCP)
9850 AC_SUBST(x_GNUCP)
9852 dnl ***************************************
9853 dnl testing assembler path
9854 dnl ***************************************
9855 ML_EXE=""
9856 if test "$_os" = "WINNT"; then
9857     if test "$BITNESS_OVERRIDE" = ""; then
9858         assembler=ml.exe
9859         assembler_bin=$CL_DIR
9860     else
9861         assembler=ml64.exe
9862         assembler_bin=$CL_DIR
9863     fi
9865     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9866     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9867         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9868         AC_MSG_RESULT([found])
9869         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9870     else
9871         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9872     fi
9874     PathFormat "$ASM_HOME"
9875     ASM_HOME="$formatted_path"
9876 else
9877     ASM_HOME=""
9880 AC_SUBST(ML_EXE)
9882 dnl ===================================================================
9883 dnl We need zip and unzip
9884 dnl ===================================================================
9885 AC_PATH_PROG(ZIP, zip)
9886 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9887 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9888     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],,)
9891 AC_PATH_PROG(UNZIP, unzip)
9892 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9894 dnl ===================================================================
9895 dnl Zip must be a specific type for different build types.
9896 dnl ===================================================================
9897 if test $build_os = cygwin; then
9898     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9899         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9900     fi
9903 dnl ===================================================================
9904 dnl We need touch with -h option support.
9905 dnl ===================================================================
9906 AC_PATH_PROG(TOUCH, touch)
9907 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
9908 touch warn
9909 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
9910     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],,)
9913 dnl ===================================================================
9914 dnl Check for system epoxy
9915 dnl ===================================================================
9916 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
9918 dnl ===================================================================
9919 dnl Set vcl option: coordinate device in double or sal_Int32
9920 dnl ===================================================================
9922 dnl disabled for now, we don't want subtle differences between OSs
9923 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
9924 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
9925 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
9926 dnl     AC_MSG_RESULT([double])
9927 dnl else
9928 dnl     AC_MSG_RESULT([sal_Int32])
9929 dnl fi
9931 dnl ===================================================================
9932 dnl Test which vclplugs have to be built.
9933 dnl ===================================================================
9934 R=""
9935 if test "$USING_X11" != TRUE; then
9936     enable_gtk=no
9937     enable_gtk3=no
9939 GTK3_CFLAGS=""
9940 GTK3_LIBS=""
9941 ENABLE_GTK3=""
9942 if test "x$enable_gtk3" = "xyes"; then
9943     if test "$with_system_cairo" = no; then
9944         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
9945     fi
9946     : ${with_system_cairo:=yes}
9947     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="")
9948     if test "x$ENABLE_GTK3" = "xTRUE"; then
9949         R="gtk3"
9950         dnl Avoid installed by unpackaged files for now.
9951         if test -z "$PKGFORMAT"; then
9952             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
9953         fi
9954     else
9955         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
9956     fi
9957     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9958     FilterLibs "${GTK3_LIBS}"
9959     GTK3_LIBS="${filteredlibs}"
9961     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
9962     if test "$with_system_epoxy" != "yes"; then
9963         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
9964         AC_CHECK_HEADER(EGL/eglplatform.h, [],
9965                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
9966     fi
9968 AC_SUBST(GTK3_LIBS)
9969 AC_SUBST(GTK3_CFLAGS)
9970 AC_SUBST(ENABLE_GTK3)
9972 ENABLE_GTK=""
9973 if test "x$enable_gtk" = "xyes"; then
9974     if test "$with_system_cairo" = no; then
9975         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
9976     fi
9977     : ${with_system_cairo:=yes}
9978     ENABLE_GTK="TRUE"
9979     AC_DEFINE(ENABLE_GTK)
9980     R="gtk $R"
9982 AC_SUBST(ENABLE_GTK)
9984 ENABLE_KDE4=""
9985 if test "x$enable_kde4" = "xyes"; then
9986     ENABLE_KDE4="TRUE"
9987     AC_DEFINE(ENABLE_KDE4)
9988     R="$R kde4"
9990 AC_SUBST(ENABLE_KDE4)
9992 ENABLE_QT5=""
9993 if test "x$enable_qt5" = "xyes"; then
9994     ENABLE_QT5="TRUE"
9995     AC_DEFINE(ENABLE_QT5)
9996     R="$R qt5"
9998 AC_SUBST(ENABLE_QT5)
10000 ENABLE_KDE5=""
10001 if test "x$enable_kde5" = "xyes"; then
10002     ENABLE_KDE5="TRUE"
10003     AC_DEFINE(ENABLE_KDE5)
10004     R="$R kde5"
10006 AC_SUBST(ENABLE_KDE5)
10008 ENABLE_GTK3_KDE5=""
10009 if test "x$enable_gtk3_kde5" = "xyes"; then
10010     ENABLE_GTK3_KDE5="TRUE"
10011     AC_DEFINE(ENABLE_GTK3_KDE5)
10012     R="$R gtk3_kde5"
10014 AC_SUBST(ENABLE_GTK3_KDE5)
10016 build_vcl_plugins="$R"
10017 if test -z "$build_vcl_plugins"; then
10018     build_vcl_plugins="none"
10020 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10022 dnl ===================================================================
10023 dnl check for dbus support
10024 dnl ===================================================================
10025 ENABLE_DBUS=""
10026 DBUS_CFLAGS=""
10027 DBUS_LIBS=""
10029 if test "$enable_dbus" = "no"; then
10030     test_dbus=no
10033 AC_MSG_CHECKING([whether to enable DBUS support])
10034 if test "$test_dbus" = "yes"; then
10035     ENABLE_DBUS="TRUE"
10036     AC_MSG_RESULT([yes])
10037     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
10038     AC_DEFINE(ENABLE_DBUS)
10039     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10040     FilterLibs "${DBUS_LIBS}"
10041     DBUS_LIBS="${filteredlibs}"
10042 else
10043     AC_MSG_RESULT([no])
10046 AC_SUBST(ENABLE_DBUS)
10047 AC_SUBST(DBUS_CFLAGS)
10048 AC_SUBST(DBUS_LIBS)
10050 AC_MSG_CHECKING([whether to enable Impress remote control])
10051 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10052     AC_MSG_RESULT([yes])
10053     ENABLE_SDREMOTE=TRUE
10054     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10056     # If not explicitly enabled or disabled, default
10057     if test -z "$enable_sdremote_bluetooth"; then
10058         case "$OS" in
10059         LINUX|MACOSX|WNT)
10060             # Default to yes for these
10061             enable_sdremote_bluetooth=yes
10062             ;;
10063         *)
10064             # otherwise no
10065             enable_sdremote_bluetooth=no
10066             ;;
10067         esac
10068     fi
10069     # $enable_sdremote_bluetooth is guaranteed non-empty now
10071     if test "$enable_sdremote_bluetooth" != "no"; then
10072         if test "$OS" = "LINUX"; then
10073             if test "$ENABLE_DBUS" = "TRUE"; then
10074                 AC_MSG_RESULT([yes])
10075                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10076                 dnl ===================================================================
10077                 dnl Check for system bluez
10078                 dnl ===================================================================
10079                 AC_MSG_CHECKING([which Bluetooth header to use])
10080                 if test "$with_system_bluez" = "yes"; then
10081                     AC_MSG_RESULT([external])
10082                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10083                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10084                     SYSTEM_BLUEZ=TRUE
10085                 else
10086                     AC_MSG_RESULT([internal])
10087                     SYSTEM_BLUEZ=
10088                 fi
10089             else
10090                 AC_MSG_RESULT([no, dbus disabled])
10091                 ENABLE_SDREMOTE_BLUETOOTH=
10092                 SYSTEM_BLUEZ=
10093             fi
10094         else
10095             AC_MSG_RESULT([yes])
10096             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10097             SYSTEM_BLUEZ=
10098         fi
10099     else
10100         AC_MSG_RESULT([no])
10101         ENABLE_SDREMOTE_BLUETOOTH=
10102         SYSTEM_BLUEZ=
10103     fi
10104 else
10105     ENABLE_SDREMOTE=
10106     SYSTEM_BLUEZ=
10107     AC_MSG_RESULT([no])
10109 AC_SUBST(ENABLE_SDREMOTE)
10110 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10111 AC_SUBST(SYSTEM_BLUEZ)
10113 dnl ===================================================================
10114 dnl Check whether the gtk 2.0 libraries are available.
10115 dnl ===================================================================
10117 GTK_CFLAGS=""
10118 GTK_LIBS=""
10119 if test  "$test_gtk" = "yes"; then
10121     if test "$ENABLE_GTK" = "TRUE"; then
10122         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]))
10123         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10124         FilterLibs "${GTK_LIBS}"
10125         GTK_LIBS="${filteredlibs}"
10126         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]))
10127         BUILD_TYPE="$BUILD_TYPE GTK"
10128         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10129         FilterLibs "${GTHREAD_LIBS}"
10130         GTHREAD_LIBS="${filteredlibs}"
10132         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10133         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10134                           [ENABLE_GTK_PRINT="TRUE"],
10135                           [ENABLE_GTK_PRINT=""])
10136         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10137         FilterLibs "${GTK_PRINT_LIBS}"
10138         GTK_PRINT_LIBS="${filteredlibs}"
10139     fi
10141     if test "$ENABLE_GTK" = "TRUE" || test "$ENABLE_GTK3" = "TRUE"; then
10142         AC_MSG_CHECKING([whether to enable GIO support])
10143         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10144             dnl Need at least 2.26 for the dbus support.
10145             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10146                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10147             if test "$ENABLE_GIO" = "TRUE"; then
10148                 AC_DEFINE(ENABLE_GIO)
10149                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10150                 FilterLibs "${GIO_LIBS}"
10151                 GIO_LIBS="${filteredlibs}"
10152             fi
10153         else
10154             AC_MSG_RESULT([no])
10155         fi
10156     fi
10158 AC_SUBST(ENABLE_GIO)
10159 AC_SUBST(GIO_CFLAGS)
10160 AC_SUBST(GIO_LIBS)
10161 AC_SUBST(GTK_CFLAGS)
10162 AC_SUBST(GTK_LIBS)
10163 AC_SUBST(GTHREAD_CFLAGS)
10164 AC_SUBST(GTHREAD_LIBS)
10165 AC_SUBST([ENABLE_GTK_PRINT])
10166 AC_SUBST([GTK_PRINT_CFLAGS])
10167 AC_SUBST([GTK_PRINT_LIBS])
10170 dnl ===================================================================
10172 SPLIT_APP_MODULES=""
10173 if test "$enable_split_app_modules" = "yes"; then
10174     SPLIT_APP_MODULES="TRUE"
10176 AC_SUBST(SPLIT_APP_MODULES)
10178 SPLIT_OPT_FEATURES=""
10179 if test "$enable_split_opt_features" = "yes"; then
10180     SPLIT_OPT_FEATURES="TRUE"
10182 AC_SUBST(SPLIT_OPT_FEATURES)
10184 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10185     if test "$enable_cairo_canvas" = yes; then
10186         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10187     fi
10188     enable_cairo_canvas=no
10189 elif test -z "$enable_cairo_canvas"; then
10190     enable_cairo_canvas=yes
10193 ENABLE_CAIRO_CANVAS=""
10194 if test "$enable_cairo_canvas" = "yes"; then
10195     test_cairo=yes
10196     ENABLE_CAIRO_CANVAS="TRUE"
10197     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10199 AC_SUBST(ENABLE_CAIRO_CANVAS)
10201 dnl ===================================================================
10202 dnl Check whether the GStreamer libraries are available.
10203 dnl It's possible to build avmedia with both GStreamer backends!
10204 dnl ===================================================================
10206 ENABLE_GSTREAMER_1_0=""
10208 if test "$build_gstreamer_1_0" = "yes"; then
10210     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10211     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10212         ENABLE_GSTREAMER_1_0="TRUE"
10213         AC_MSG_RESULT([yes])
10214         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10215         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10216         FilterLibs "${GSTREAMER_1_0_LIBS}"
10217         GSTREAMER_1_0_LIBS="${filteredlibs}"
10218     else
10219         AC_MSG_RESULT([no])
10220     fi
10222 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10223 AC_SUBST(GSTREAMER_1_0_LIBS)
10224 AC_SUBST(ENABLE_GSTREAMER_1_0)
10227 ENABLE_GSTREAMER_0_10=""
10228 if test "$build_gstreamer_0_10" = "yes"; then
10230     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10231     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10232         ENABLE_GSTREAMER_0_10="TRUE"
10233         AC_MSG_RESULT([yes])
10234         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10235             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10236         ])
10237         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10238         FilterLibs "${GSTREAMER_0_10_LIBS}"
10239         GSTREAMER_0_10_LIBS="${filteredlibs}"
10240     else
10241         AC_MSG_RESULT([no])
10242     fi
10245 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10246 AC_SUBST(GSTREAMER_0_10_LIBS)
10247 AC_SUBST(ENABLE_GSTREAMER_0_10)
10249 dnl ===================================================================
10250 dnl Check whether to build the VLC avmedia backend
10251 dnl ===================================================================
10253 ENABLE_VLC=""
10255 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10256 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10257     ENABLE_VLC="TRUE"
10258     AC_MSG_RESULT([yes])
10259 else
10260     AC_MSG_RESULT([no])
10262 AC_SUBST(ENABLE_VLC)
10264 ENABLE_OPENGL_TRANSITIONS=
10265 ENABLE_OPENGL_CANVAS=
10266 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10267    : # disable
10268 elif test "$_os" = "Darwin"; then
10269     # We use frameworks on Mac OS X, no need for detail checks
10270     ENABLE_OPENGL_TRANSITIONS=TRUE
10271     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10272     ENABLE_OPENGL_CANVAS=TRUE
10273 elif test $_os = WINNT; then
10274     ENABLE_OPENGL_TRANSITIONS=TRUE
10275     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10276     ENABLE_OPENGL_CANVAS=TRUE
10277 else
10278     if test "$USING_X11" = TRUE; then
10279         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10280         ENABLE_OPENGL_TRANSITIONS=TRUE
10281         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10282         ENABLE_OPENGL_CANVAS=TRUE
10283     fi
10286 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10287 AC_SUBST(ENABLE_OPENGL_CANVAS)
10289 dnl =================================================
10290 dnl Check whether to build with OpenCL support.
10291 dnl =================================================
10293 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10294     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10295     # platform (optional at run-time, used through clew).
10296     BUILD_TYPE="$BUILD_TYPE OPENCL"
10297     AC_DEFINE(HAVE_FEATURE_OPENCL)
10300 dnl =================================================
10301 dnl Check whether to build with dconf support.
10302 dnl =================================================
10304 if test "$enable_dconf" != no; then
10305     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10306         if test "$enable_dconf" = yes; then
10307             AC_MSG_ERROR([dconf not found])
10308         else
10309             enable_dconf=no
10310         fi])
10312 AC_MSG_CHECKING([whether to enable dconf])
10313 if test "$enable_dconf" = no; then
10314     DCONF_CFLAGS=
10315     DCONF_LIBS=
10316     ENABLE_DCONF=
10317     AC_MSG_RESULT([no])
10318 else
10319     ENABLE_DCONF=TRUE
10320     AC_DEFINE(ENABLE_DCONF)
10321     AC_MSG_RESULT([yes])
10323 AC_SUBST([DCONF_CFLAGS])
10324 AC_SUBST([DCONF_LIBS])
10325 AC_SUBST([ENABLE_DCONF])
10327 # pdf import?
10328 AC_MSG_CHECKING([whether to build the PDF import feature])
10329 ENABLE_PDFIMPORT=
10330 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10331     AC_MSG_RESULT([yes])
10332     ENABLE_PDFIMPORT=TRUE
10333     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10335     dnl ===================================================================
10336     dnl Check for system poppler
10337     dnl ===================================================================
10338     AC_MSG_CHECKING([which PDF import backend to use])
10339     if test "$with_system_poppler" = "yes"; then
10340         AC_MSG_RESULT([external])
10341         SYSTEM_POPPLER=TRUE
10342         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10343         AC_LANG_PUSH([C++])
10344         save_CXXFLAGS=$CXXFLAGS
10345         save_CPPFLAGS=$CPPFLAGS
10346         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10347         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10348         AC_CHECK_HEADER([cpp/poppler-version.h],
10349             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10350             [])
10351         CXXFLAGS=$save_CXXFLAGS
10352         CPPFLAGS=$save_CPPFLAGS
10353         AC_LANG_POP([C++])
10354         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10356         FilterLibs "${POPPLER_LIBS}"
10357         POPPLER_LIBS="${filteredlibs}"
10358     else
10359         AC_MSG_RESULT([internal])
10360         SYSTEM_POPPLER=
10361         BUILD_TYPE="$BUILD_TYPE POPPLER"
10362         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10363     fi
10364     AC_DEFINE([ENABLE_PDFIMPORT],1)
10365 else
10366     AC_MSG_RESULT([no])
10368 AC_SUBST(ENABLE_PDFIMPORT)
10369 AC_SUBST(SYSTEM_POPPLER)
10370 AC_SUBST(POPPLER_CFLAGS)
10371 AC_SUBST(POPPLER_LIBS)
10373 # pdf import?
10374 AC_MSG_CHECKING([whether to build PDFium])
10375 ENABLE_PDFIUM=
10376 if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then
10377     AC_MSG_RESULT([yes])
10378     ENABLE_PDFIUM=TRUE
10379     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10380     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10381 else
10382     AC_MSG_RESULT([no])
10384 AC_SUBST(ENABLE_PDFIUM)
10386 SYSTEM_GPGMEPP=
10388 if test "$build_for_ios" = "YES"; then
10389     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10390     AC_MSG_RESULT([yes])
10391 elif test "$enable_mpl_subset" = "yes"; then
10392     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10393     AC_MSG_RESULT([yes])
10394 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10395     dnl ===================================================================
10396     dnl Check for system gpgme
10397     dnl ===================================================================
10398     AC_MSG_CHECKING([which gpgmepp to use])
10399     if test "$with_system_gpgmepp" = "yes"; then
10400         AC_MSG_RESULT([external])
10401         SYSTEM_GPGMEPP=TRUE
10403         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10404         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10405             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10406         # progress_callback is the only func with plain C linkage
10407         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10408         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10409             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10410         AC_CHECK_HEADER(gpgme.h, [],
10411             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10412     else
10413         AC_MSG_RESULT([internal])
10414         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10415         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10417         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10418         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10419         if test "$_os" != "WINNT"; then
10420             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10421             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10422         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10423             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10424         fi
10425     fi
10426     ENABLE_GPGMEPP=TRUE
10427     AC_DEFINE([HAVE_FEATURE_GPGME])
10428     AC_PATH_PROG(GPG, gpg)
10429     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10430     # so let's exclude that manually for the moment
10431     if test -n "$GPG" -a "$_os" != "WINNT"; then
10432         # make sure we not only have a working gpgme, but a full working
10433         # gpg installation to run OpenPGP signature verification
10434         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10435     fi
10436     if test "$_os" = "Linux"; then
10437       uid=`id -u`
10438       AC_MSG_CHECKING([for /run/user/$uid])
10439       if test -d /run/user/$uid; then
10440         AC_MSG_RESULT([yes])
10441         AC_PATH_PROG(GPGCONF, gpgconf)
10442         AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10443         if $GPGCONF --dump-options > /dev/null ; then
10444           if $GPGCONF --dump-options | grep -q create-socketdir ; then
10445             AC_MSG_RESULT([yes])
10446             AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10447           else
10448             AC_MSG_RESULT([no])
10449           fi
10450         else
10451           AC_MSG_RESULT([no. missing or broken gpgconf?])
10452         fi
10453       else
10454         AC_MSG_RESULT([no])
10455      fi
10456    fi
10458 AC_SUBST(ENABLE_GPGMEPP)
10459 AC_SUBST(SYSTEM_GPGMEPP)
10460 AC_SUBST(GPG_ERROR_CFLAGS)
10461 AC_SUBST(GPG_ERROR_LIBS)
10462 AC_SUBST(LIBASSUAN_CFLAGS)
10463 AC_SUBST(LIBASSUAN_LIBS)
10464 AC_SUBST(GPGMEPP_CFLAGS)
10465 AC_SUBST(GPGMEPP_LIBS)
10466 AC_SUBST(GPGCONF)
10467 AC_SUBST(HAVE_GPGCONF_SOCKETDIR)
10469 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10470 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10471     AC_MSG_RESULT([yes])
10472     ENABLE_MEDIAWIKI=TRUE
10473     BUILD_TYPE="$BUILD_TYPE XSLTML"
10474     if test  "x$with_java" = "xno"; then
10475         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10476     fi
10477 else
10478     AC_MSG_RESULT([no])
10479     ENABLE_MEDIAWIKI=
10480     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10482 AC_SUBST(ENABLE_MEDIAWIKI)
10484 AC_MSG_CHECKING([whether to build the Report Builder])
10485 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10486     AC_MSG_RESULT([yes])
10487     ENABLE_REPORTBUILDER=TRUE
10488     AC_MSG_CHECKING([which jfreereport libs to use])
10489     if test "$with_system_jfreereport" = "yes"; then
10490         SYSTEM_JFREEREPORT=TRUE
10491         AC_MSG_RESULT([external])
10492         if test -z $SAC_JAR; then
10493             SAC_JAR=/usr/share/java/sac.jar
10494         fi
10495         if ! test -f $SAC_JAR; then
10496              AC_MSG_ERROR(sac.jar not found.)
10497         fi
10499         if test -z $LIBXML_JAR; then
10500             if test -f /usr/share/java/libxml-1.0.0.jar; then
10501                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10502             elif test -f /usr/share/java/libxml.jar; then
10503                 LIBXML_JAR=/usr/share/java/libxml.jar
10504             else
10505                 AC_MSG_ERROR(libxml.jar replacement not found.)
10506             fi
10507         elif ! test -f $LIBXML_JAR; then
10508             AC_MSG_ERROR(libxml.jar not found.)
10509         fi
10511         if test -z $FLUTE_JAR; then
10512             if test -f/usr/share/java/flute-1.3.0.jar; then
10513                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10514             elif test -f /usr/share/java/flute.jar; then
10515                 FLUTE_JAR=/usr/share/java/flute.jar
10516             else
10517                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10518             fi
10519         elif ! test -f $FLUTE_JAR; then
10520             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10521         fi
10523         if test -z $JFREEREPORT_JAR; then
10524             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10525                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10526             elif test -f /usr/share/java/flow-engine.jar; then
10527                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10528             else
10529                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10530             fi
10531         elif ! test -f  $JFREEREPORT_JAR; then
10532                 AC_MSG_ERROR(jfreereport.jar not found.)
10533         fi
10535         if test -z $LIBLAYOUT_JAR; then
10536             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10537                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10538             elif test -f /usr/share/java/liblayout.jar; then
10539                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10540             else
10541                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10542             fi
10543         elif ! test -f $LIBLAYOUT_JAR; then
10544                 AC_MSG_ERROR(liblayout.jar not found.)
10545         fi
10547         if test -z $LIBLOADER_JAR; then
10548             if test -f /usr/share/java/libloader-1.0.0.jar; then
10549                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10550             elif test -f /usr/share/java/libloader.jar; then
10551                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10552             else
10553                 AC_MSG_ERROR(libloader.jar replacement not found.)
10554             fi
10555         elif ! test -f  $LIBLOADER_JAR; then
10556             AC_MSG_ERROR(libloader.jar not found.)
10557         fi
10559         if test -z $LIBFORMULA_JAR; then
10560             if test -f /usr/share/java/libformula-0.2.0.jar; then
10561                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10562             elif test -f /usr/share/java/libformula.jar; then
10563                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10564             else
10565                 AC_MSG_ERROR(libformula.jar replacement not found.)
10566             fi
10567         elif ! test -f $LIBFORMULA_JAR; then
10568                 AC_MSG_ERROR(libformula.jar not found.)
10569         fi
10571         if test -z $LIBREPOSITORY_JAR; then
10572             if test -f /usr/share/java/librepository-1.0.0.jar; then
10573                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10574             elif test -f /usr/share/java/librepository.jar; then
10575                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10576             else
10577                 AC_MSG_ERROR(librepository.jar replacement not found.)
10578             fi
10579         elif ! test -f $LIBREPOSITORY_JAR; then
10580             AC_MSG_ERROR(librepository.jar not found.)
10581         fi
10583         if test -z $LIBFONTS_JAR; then
10584             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10585                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10586             elif test -f /usr/share/java/libfonts.jar; then
10587                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10588             else
10589                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10590             fi
10591         elif ! test -f $LIBFONTS_JAR; then
10592                 AC_MSG_ERROR(libfonts.jar not found.)
10593         fi
10595         if test -z $LIBSERIALIZER_JAR; then
10596             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10597                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10598             elif test -f /usr/share/java/libserializer.jar; then
10599                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10600             else
10601                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10602             fi
10603         elif ! test -f $LIBSERIALIZER_JAR; then
10604                 AC_MSG_ERROR(libserializer.jar not found.)
10605         fi
10607         if test -z $LIBBASE_JAR; then
10608             if test -f /usr/share/java/libbase-1.0.0.jar; then
10609                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10610             elif test -f /usr/share/java/libbase.jar; then
10611                 LIBBASE_JAR=/usr/share/java/libbase.jar
10612             else
10613                 AC_MSG_ERROR(libbase.jar replacement not found.)
10614             fi
10615         elif ! test -f $LIBBASE_JAR; then
10616             AC_MSG_ERROR(libbase.jar not found.)
10617         fi
10619     else
10620         AC_MSG_RESULT([internal])
10621         SYSTEM_JFREEREPORT=
10622         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10623         NEED_ANT=TRUE
10624     fi
10625 else
10626     AC_MSG_RESULT([no])
10627     ENABLE_REPORTBUILDER=
10628     SYSTEM_JFREEREPORT=
10630 AC_SUBST(ENABLE_REPORTBUILDER)
10631 AC_SUBST(SYSTEM_JFREEREPORT)
10632 AC_SUBST(SAC_JAR)
10633 AC_SUBST(LIBXML_JAR)
10634 AC_SUBST(FLUTE_JAR)
10635 AC_SUBST(JFREEREPORT_JAR)
10636 AC_SUBST(LIBBASE_JAR)
10637 AC_SUBST(LIBLAYOUT_JAR)
10638 AC_SUBST(LIBLOADER_JAR)
10639 AC_SUBST(LIBFORMULA_JAR)
10640 AC_SUBST(LIBREPOSITORY_JAR)
10641 AC_SUBST(LIBFONTS_JAR)
10642 AC_SUBST(LIBSERIALIZER_JAR)
10644 # this has to be here because both the Wiki Publisher and the SRB use
10645 # commons-logging
10646 COMMONS_LOGGING_VERSION=1.2
10647 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10648     AC_MSG_CHECKING([which Apache commons-* libs to use])
10649     if test "$with_system_apache_commons" = "yes"; then
10650         SYSTEM_APACHE_COMMONS=TRUE
10651         AC_MSG_RESULT([external])
10652         if test -z $COMMONS_LOGGING_JAR; then
10653             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10654                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10655            elif test -f /usr/share/java/commons-logging.jar; then
10656                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
10657             else
10658                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
10659             fi
10660         elif ! test -f $COMMONS_LOGGING_JAR; then
10661             AC_MSG_ERROR(commons-logging.jar not found.)
10662         fi
10663     else
10664         AC_MSG_RESULT([internal])
10665         SYSTEM_APACHE_COMMONS=
10666         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
10667         NEED_ANT=TRUE
10668     fi
10670 AC_SUBST(SYSTEM_APACHE_COMMONS)
10671 AC_SUBST(COMMONS_LOGGING_JAR)
10672 AC_SUBST(COMMONS_LOGGING_VERSION)
10674 # scripting provider for BeanShell?
10675 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10676 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10677     AC_MSG_RESULT([yes])
10678     ENABLE_SCRIPTING_BEANSHELL=TRUE
10680     dnl ===================================================================
10681     dnl Check for system beanshell
10682     dnl ===================================================================
10683     AC_MSG_CHECKING([which beanshell to use])
10684     if test "$with_system_beanshell" = "yes"; then
10685         AC_MSG_RESULT([external])
10686         SYSTEM_BSH=TRUE
10687         if test -z $BSH_JAR; then
10688             BSH_JAR=/usr/share/java/bsh.jar
10689         fi
10690         if ! test -f $BSH_JAR; then
10691             AC_MSG_ERROR(bsh.jar not found.)
10692         fi
10693     else
10694         AC_MSG_RESULT([internal])
10695         SYSTEM_BSH=
10696         BUILD_TYPE="$BUILD_TYPE BSH"
10697     fi
10698 else
10699     AC_MSG_RESULT([no])
10700     ENABLE_SCRIPTING_BEANSHELL=
10701     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10703 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10704 AC_SUBST(SYSTEM_BSH)
10705 AC_SUBST(BSH_JAR)
10707 # scripting provider for JavaScript?
10708 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10709 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10710     AC_MSG_RESULT([yes])
10711     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10713     dnl ===================================================================
10714     dnl Check for system rhino
10715     dnl ===================================================================
10716     AC_MSG_CHECKING([which rhino to use])
10717     if test "$with_system_rhino" = "yes"; then
10718         AC_MSG_RESULT([external])
10719         SYSTEM_RHINO=TRUE
10720         if test -z $RHINO_JAR; then
10721             RHINO_JAR=/usr/share/java/js.jar
10722         fi
10723         if ! test -f $RHINO_JAR; then
10724             AC_MSG_ERROR(js.jar not found.)
10725         fi
10726     else
10727         AC_MSG_RESULT([internal])
10728         SYSTEM_RHINO=
10729         BUILD_TYPE="$BUILD_TYPE RHINO"
10730         NEED_ANT=TRUE
10731     fi
10732 else
10733     AC_MSG_RESULT([no])
10734     ENABLE_SCRIPTING_JAVASCRIPT=
10735     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10737 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10738 AC_SUBST(SYSTEM_RHINO)
10739 AC_SUBST(RHINO_JAR)
10741 # This is only used in KDE3/KDE4 checks to determine if /usr/lib64
10742 # paths should be added to library search path. So lets put all 64-bit
10743 # platforms there.
10744 supports_multilib=
10745 case "$host_cpu" in
10746 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
10747     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10748         supports_multilib="yes"
10749     fi
10750     ;;
10752     ;;
10753 esac
10755 dnl ===================================================================
10756 dnl KDE4 Integration
10757 dnl ===================================================================
10759 KDE4_CFLAGS=""
10760 KDE4_LIBS=""
10761 QMAKE4="qmake"
10762 MOC4="moc"
10763 KDE4_GLIB_CFLAGS=""
10764 KDE4_GLIB_LIBS=""
10765 KDE4_HAVE_GLIB=""
10766 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
10767     qt4_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
10768     qt4_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
10770     kde4_incdirs="/usr/include /usr/include/kde4 $x_includes"
10771     kde4_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
10773     if test -n "$supports_multilib"; then
10774         qt4_libdirs="$qt4_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
10775         kde4_libdirs="$kde4_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
10776     fi
10778     if test -n "$QTDIR"; then
10779         qt4_incdirs="$QTDIR/include $qt4_incdirs"
10780         if test -z "$supports_multilib"; then
10781             qt4_libdirs="$QTDIR/lib $qt4_libdirs"
10782         else
10783             qt4_libdirs="$QTDIR/lib64 $QTDIR/lib $qt4_libdirs"
10784         fi
10785     fi
10786     if test -n "$QT4DIR"; then
10787         qt4_incdirs="$QT4DIR/include $qt4_incdirs"
10788         if test -z "$supports_multilib"; then
10789             qt4_libdirs="$QT4DIR/lib $qt4_libdirs"
10790         else
10791             qt4_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt4_libdirs"
10792         fi
10793     fi
10795     if test -n "$KDEDIR"; then
10796         kde4_incdirs="$KDEDIR/include $kde4_incdirs"
10797         if test -z "$supports_multilib"; then
10798             kde4_libdirs="$KDEDIR/lib $kde4_libdirs"
10799         else
10800             kde4_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde4_libdirs"
10801         fi
10802     fi
10803     if test -n "$KDE4DIR"; then
10804         kde4_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde4_incdirs"
10805         if test -z "$supports_multilib"; then
10806             kde4_libdirs="$KDE4DIR/lib $kde4_libdirs"
10807         else
10808             kde4_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde4_libdirs"
10809         fi
10810     fi
10812     qt4_test_include="Qt/qobject.h"
10813     qt4_test_library="libQtNetwork.so"
10814     kde4_test_include="kwindowsystem.h"
10815     kde4_test_library="libsolid.so"
10817     AC_MSG_CHECKING([for Qt4 headers])
10818     qt4_header_dir="no"
10819     for inc_dir in $qt4_incdirs; do
10820         if test -r "$inc_dir/$qt4_test_include"; then
10821             qt4_header_dir="$inc_dir"
10822             break
10823         fi
10824     done
10826     AC_MSG_RESULT([$qt4_header_dir])
10827     if test "x$qt4_header_dir" = "xno"; then
10828         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10829     fi
10831     dnl Check for qmake
10832     AC_PATH_PROGS( QMAKE4, [qmake-qt4 qmake], no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
10833     if test "$QMAKE4" = "no"; then
10834         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10835     else
10836         qmake4_test_ver="`$QMAKE4 -v 2>&1 | sed -n -e '/^Using Qt version 4\./p'`"
10837         if test -z "$qmake4_test_ver"; then
10838             AC_MSG_ERROR([Wrong qmake for Qt4 found. Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
10839         fi
10840     fi
10842     qt4_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt4_libdirs"
10843     AC_MSG_CHECKING([for Qt4 libraries])
10844     qt4_lib_dir="no"
10845     for lib_dir in $qt4_libdirs; do
10846         if test -r "$lib_dir/$qt4_test_library"; then
10847             qt4_lib_dir="$lib_dir"
10848             PKG_CONFIG_PATH="$qt4_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
10849             break
10850         fi
10851     done
10853     AC_MSG_RESULT([$qt4_lib_dir])
10855     if test "x$qt4_lib_dir" = "xno"; then
10856         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10857     fi
10859     dnl Check for Meta Object Compiler
10861     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10862     MOC4="$MOCQT4"
10863     if test "$MOC4" = "no"; then
10864         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10865         if test "$MOC4" = "no"; then
10866             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10867 the root of your Qt installation by exporting QT4DIR before running "configure".])
10868         fi
10869     fi
10871     dnl Check for KDE4 headers
10872     AC_MSG_CHECKING([for KDE4 headers])
10873     kde4_incdir="no"
10874     for kde4_check in $kde4_incdirs; do
10875         if test -r "$kde4_check/$kde4_test_include"; then
10876             kde4_incdir="$kde4_check"
10877             break
10878         fi
10879     done
10880     AC_MSG_RESULT([$kde4_incdir])
10881     if test "x$kde4_incdir" = "xno"; then
10882         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10883     fi
10884     if test "$kde4_incdir" = "/usr/include"; then kde4_incdir=; fi
10886     dnl Check for KDE4 libraries
10887     AC_MSG_CHECKING([for KDE4 libraries])
10888     kde4_libdir="no"
10889     for kde4_check in $kde4_libdirs; do
10890         if test -r "$kde4_check/$kde4_test_library"; then
10891             kde4_libdir="$kde4_check"
10892             break
10893         fi
10894     done
10896     AC_MSG_RESULT([$kde4_libdir])
10897     if test "x$kde4_libdir" = "xno"; then
10898         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10899     fi
10901     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
10902     if ! test -z "$kde4_incdir"; then
10903         KDE4_CFLAGS="-I$kde4_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10904     else
10905         KDE4_CFLAGS="$QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10906     fi
10908     KDE4_LIBS="-L$kde4_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt4_lib_dir $QT4_LIBS"
10909     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10910     FilterLibs "$KDE4_LIBS"
10911     KDE4_LIBS="$filteredlibs"
10913     AC_LANG_PUSH([C++])
10914     save_CXXFLAGS=$CXXFLAGS
10915     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10916     AC_MSG_CHECKING([whether KDE is >= 4.2])
10917        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10918 #include <kdeversion.h>
10920 int main(int argc, char **argv) {
10921        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
10922        else return 1;
10924 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[AC_MSG_ERROR([KDE support not tested with cross-compilation])])
10925     CXXFLAGS=$save_CXXFLAGS
10926     AC_LANG_POP([C++])
10928     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
10929     # Sets also KDE4_GLIB_CFLAGS/KDE4_GLIB_LIBS if successful.
10930     PKG_CHECK_MODULES(KDE4_GLIB,[glib-2.0 >= 2.4],
10931         [
10932             KDE4_HAVE_GLIB=TRUE
10933             AC_DEFINE(KDE4_HAVE_GLIB,1)
10934             KDE4_GLIB_CFLAGS=$(printf '%s' "$KDE4_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10935             FilterLibs "${KDE4_GLIB_LIBS}"
10936             KDE4_GLIB_LIBS="${filteredlibs}"
10938             qt4_fix_warning=
10940             AC_LANG_PUSH([C++])
10941             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
10942             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
10943             #  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
10944             #               ^~~~~~~~~~~~~~~~~~~~~~~
10945             #               vptr for 'QObjectPrivate'
10946             # so temporarily ignore here whichever way would be used to make such errors fatal
10947             # (-fno-sanitize-recover=... or UBSAN_OPTIONS halt_on_error=1):
10948             save_CXX=$CXX
10949             CXX=$(printf %s "$CXX" \
10950                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
10951             save_UBSAN_OPTIONS=$UBSAN_OPTIONS
10952             UBSAN_OPTIONS=$UBSAN_OPTIONS:halt_on_error=0
10953             save_CXXFLAGS=$CXXFLAGS
10954             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10955             save_LIBS=$LIBS
10956             LIBS="$LIBS $KDE4_LIBS"
10957             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
10959             # Prepare meta object data
10960             TSTBASE="tst_exclude_socket_notifiers"
10961             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
10962             ln -fs "${TSTMOC}.hxx"
10963             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10965             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10966 #include <cstdlib>
10967 #include "tst_exclude_socket_notifiers.moc"
10969 int main(int argc, char *argv[])
10971     QCoreApplication app(argc, argv);
10972     exit(tst_processEventsExcludeSocket());
10973     return 0;
10975             ]])],[
10976                 AC_MSG_RESULT([yes])
10977             ],[
10978                 AC_MSG_RESULT([no])
10979                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
10980                 if test -z "$qt4_fix_warning"; then
10981                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
10982                 fi
10983                 qt4_fix_warning=1
10984                 add_warning "  https://bugreports.qt.io/browse/QTBUG-37380 (needed)"
10985                 ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
10987             # Remove meta object data
10988             rm -f "${TSTBASE}."*
10990             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
10992             # Prepare meta object data
10993             TSTBASE="tst_exclude_posted_events"
10994             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
10995             ln -fs "${TSTMOC}.hxx"
10996             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10998             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10999 #include <cstdlib>
11000 #include "tst_exclude_posted_events.moc"
11002 int main(int argc, char *argv[])
11004     QCoreApplication app(argc, argv);
11005     exit(tst_excludePostedEvents());
11006     return 0;
11008             ]])],[
11009                 AC_MSG_RESULT([yes])
11010             ],[
11011                 AC_MSG_RESULT([no])
11012                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11013                 if test -z "$qt4_fix_warning"; then
11014                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11015                 fi
11016                 qt4_fix_warning=1
11017                 add_warning "  https://bugreports.qt.io/browse/QTBUG-34614 (needed)"
11018             ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11020             # Remove meta object data
11021             rm -f "${TSTBASE}."*
11023             if test -n "$qt4_fix_warning"; then
11024                 add_warning "  https://bugreports.qt.io/browse/QTBUG-38585 (recommended)"
11025             fi
11027             LIBS=$save_LIBS
11028             CXXFLAGS=$save_CXXFLAGS
11029             UBSAN_OPTIONS=$save_UBSAN_OPTIONS
11030             CXX=$save_CXX
11031             AC_LANG_POP([C++])
11032         ],
11033         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11035 AC_SUBST(KDE4_CFLAGS)
11036 AC_SUBST(KDE4_LIBS)
11037 AC_SUBST(MOC4)
11038 AC_SUBST(KDE4_GLIB_CFLAGS)
11039 AC_SUBST(KDE4_GLIB_LIBS)
11040 AC_SUBST(KDE4_HAVE_GLIB)
11042 dnl ===================================================================
11043 dnl QT5 Integration
11044 dnl ===================================================================
11046 QT5_CFLAGS=""
11047 QT5_LIBS=""
11048 QMAKE5="qmake"
11049 MOC5="moc"
11050 QT5_GLIB_CFLAGS=""
11051 QT5_GLIB_LIBS=""
11052 QT5_HAVE_GLIB=""
11053 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11054         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11055         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11056 then
11057     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11058     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11060     if test -n "$supports_multilib"; then
11061         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11062     fi
11064     qt5_test_include="QtWidgets/qapplication.h"
11065     qt5_test_library="libQt5Widgets.so"
11067     dnl Check for qmake5
11068     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
11069     if test "$QMAKE5" = "no"; then
11070         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11071     else
11072         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11073         if test -z "$qmake5_test_ver"; then
11074             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11075         fi
11076         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11077         qt5_minimal_minor="6"
11078         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11079             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11080         else
11081             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11082         fi
11083     fi
11085     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11086     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11088     AC_MSG_CHECKING([for Qt5 headers])
11089     qt5_incdir="no"
11090     for inc_dir in $qt5_incdirs; do
11091         if test -r "$inc_dir/$qt5_test_include"; then
11092             qt5_incdir="$inc_dir"
11093             break
11094         fi
11095     done
11096     AC_MSG_RESULT([$qt5_incdir])
11097     if test "x$qt5_incdir" = "xno"; then
11098         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11099     fi
11101     AC_MSG_CHECKING([for Qt5 libraries])
11102     qt5_libdir="no"
11103     for lib_dir in $qt5_libdirs; do
11104         if test -r "$lib_dir/$qt5_test_library"; then
11105             qt5_libdir="$lib_dir"
11106             break
11107         fi
11108     done
11109     AC_MSG_RESULT([$qt5_libdir])
11110     if test "x$qt5_libdir" = "xno"; then
11111         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11112     fi
11114     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11115     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11117     dnl Check for Meta Object Compiler
11119     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
11120     if test "$MOC5" = "no"; then
11121         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11122 the root of your Qt installation by exporting QT5DIR before running "configure".])
11123     fi
11125     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11126     # Sets also QT5_GLIB_CFLAGS/QT5_GLIB_LIBS if successful.
11127     PKG_CHECK_MODULES(QT5_GLIB,[glib-2.0 >= 2.4],
11128         [
11129             QT5_HAVE_GLIB=1
11130             AC_DEFINE(QT5_HAVE_GLIB,1)
11131         ],
11132         AC_MSG_WARN([[No Glib found, Qt5 support will not use native file pickers!]])
11133     )
11135 AC_SUBST(QT5_CFLAGS)
11136 AC_SUBST(QT5_LIBS)
11137 AC_SUBST(MOC5)
11138 AC_SUBST(QT5_GLIB_CFLAGS)
11139 AC_SUBST(QT5_GLIB_LIBS)
11140 AC_SUBST(QT5_HAVE_GLIB)
11142 dnl ===================================================================
11143 dnl KDE5 Integration
11144 dnl ===================================================================
11146 KF5_CFLAGS=""
11147 KF5_LIBS=""
11148 KF5_CONFIG="kf5-config"
11149 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11150         \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11151         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11152 then
11153     kf5_incdirs="$KF5INC /usr/include/ $x_includes"
11154     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $x_libraries"
11155     if test -n "$supports_multilib"; then
11156         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11157     fi
11159     kf5_test_include="KF5/kcoreaddons_version.h"
11160     kf5_test_library="libKF5CoreAddons.so"
11161     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11163     dnl kf5 KDE4 support compatibility installed
11164     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11165     if test "$KF5_CONFIG" != "no"; then
11166         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11167         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11168     fi
11170     dnl Check for KF5 headers
11171     AC_MSG_CHECKING([for KF5 headers])
11172     kf5_incdir="no"
11173     for kf5_check in $kf5_incdirs; do
11174         if test -r "$kf5_check/$kf5_test_include"; then
11175             kf5_incdir="$kf5_check/KF5"
11176             break
11177         fi
11178     done
11179     AC_MSG_RESULT([$kf5_incdir])
11180     if test "x$kf5_incdir" = "xno"; then
11181         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11182     fi
11184     dnl Check for KF5 libraries
11185     AC_MSG_CHECKING([for KF5 libraries])
11186     kf5_libdir="no"
11187     for kf5_check in $kf5_libdirs; do
11188         if test -r "$kf5_check/$kf5_test_library"; then
11189             kf5_libdir="$kf5_check"
11190             break
11191         fi
11192     done
11194     AC_MSG_RESULT([$kf5_libdir])
11195     if test "x$kf5_libdir" = "xno"; then
11196         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11197     fi
11199     PKG_CHECK_MODULES(KF5_XCB,[xcb],,[AC_MSG_ERROR([XCB not installed])])
11201     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"
11202     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network -lQt5X11Extras $KF5_XCB_LIBS"
11203     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11205     AC_LANG_PUSH([C++])
11206     save_CXXFLAGS=$CXXFLAGS
11207     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11208     AC_MSG_CHECKING([whether KDE is >= 5.0])
11209        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11210 #include <kcoreaddons_version.h>
11212 int main(int argc, char **argv) {
11213        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11214        else return 1;
11216        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11217     CXXFLAGS=$save_CXXFLAGS
11218     AC_LANG_POP([C++])
11220 AC_SUBST(KF5_CFLAGS)
11221 AC_SUBST(KF5_LIBS)
11223 dnl ===================================================================
11224 dnl Test whether to include Evolution 2 support
11225 dnl ===================================================================
11226 AC_MSG_CHECKING([whether to enable evolution 2 support])
11227 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11228     AC_MSG_RESULT([yes])
11229     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11230     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11231     FilterLibs "${GOBJECT_LIBS}"
11232     GOBJECT_LIBS="${filteredlibs}"
11233     ENABLE_EVOAB2="TRUE"
11234 else
11235     ENABLE_EVOAB2=""
11236     AC_MSG_RESULT([no])
11238 AC_SUBST(ENABLE_EVOAB2)
11239 AC_SUBST(GOBJECT_CFLAGS)
11240 AC_SUBST(GOBJECT_LIBS)
11242 dnl ===================================================================
11243 dnl Test which themes to include
11244 dnl ===================================================================
11245 AC_MSG_CHECKING([which themes to include])
11246 # if none given use default subset of available themes
11247 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11248     with_theme="breeze breeze_dark colibre elementary karasa_jaga sifr sifr_dark tango"
11251 WITH_THEMES=""
11252 if test "x$with_theme" != "xno"; then
11253     for theme in $with_theme; do
11254         case $theme in
11255         breeze|breeze_dark|colibre|elementary|karasa_jaga|sifr|sifr_dark|tango) real_theme="$theme" ;;
11256         default) real_theme=colibre ;;
11257         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11258         esac
11259         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11260     done
11262 AC_MSG_RESULT([$WITH_THEMES])
11263 AC_SUBST([WITH_THEMES])
11264 # FIXME: remove this, and the convenience default->colibre remapping after a crace period
11265 for theme in $with_theme; do
11266     case $theme in
11267     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11268     *) ;;
11269     esac
11270 done
11272 dnl ===================================================================
11273 dnl Test whether to integrate helppacks into the product's installer
11274 dnl ===================================================================
11275 AC_MSG_CHECKING([for helppack integration])
11276 if test "$with_helppack_integration" = "no"; then
11277     AC_MSG_RESULT([no integration])
11278 else
11279     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11280     AC_MSG_RESULT([integration])
11283 ###############################################################################
11284 # Extensions checking
11285 ###############################################################################
11286 AC_MSG_CHECKING([for extensions integration])
11287 if test "x$enable_extension_integration" != "xno"; then
11288     WITH_EXTENSION_INTEGRATION=TRUE
11289     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11290     AC_MSG_RESULT([yes, use integration])
11291 else
11292     WITH_EXTENSION_INTEGRATION=
11293     AC_MSG_RESULT([no, do not integrate])
11295 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11297 dnl Should any extra extensions be included?
11298 dnl There are standalone tests for each of these below.
11299 WITH_EXTRA_EXTENSIONS=
11300 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11302 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11303 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11304 if test "x$with_java" != "xno"; then
11305     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11306     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11309 AC_MSG_CHECKING([whether to build opens___.ttf])
11310 if test "$enable_build_opensymbol" = "yes"; then
11311     AC_MSG_RESULT([yes])
11312     AC_PATH_PROG(FONTFORGE, fontforge)
11313     if test -z "$FONTFORGE"; then
11314         AC_MSG_ERROR([fontforge not installed])
11315     fi
11316 else
11317     AC_MSG_RESULT([no])
11318     OPENSYMBOL_TTF=49a64f3bcf20a7909ba2751349231d6652ded9cd2840e961b5164d09de3ffa63-opens___.ttf
11319     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11321 AC_SUBST(OPENSYMBOL_TTF)
11322 AC_SUBST(FONTFORGE)
11324 TEST_FONTS_MISSING=0
11326 # $1  = font family
11327 # $2+ = accepted font mappings
11328 test_font_map()
11330     FONT="$1" ; shift
11331     AC_MSG_CHECKING([font mapping for '$FONT'])
11332     FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
11333     FONTFILE_LOWER="$(echo $FONTFILE | $AWK '{print tolower($0)}')"
11335     TESTEXPR="'${FONTFILE_LOWER}' = '$(echo $FONT | $AWK '{print tolower($0)}').ttf'"
11336     while test "$#" -ge 1 ; do
11337         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
11338         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
11339     done
11340     if test $TESTEXPR
11341     then
11342         AC_MSG_RESULT([ok])
11343     else
11344         AC_MSG_WARN([unknown ($FONTFILE)])
11345         add_warning "unknown ($FONTFILE)"
11346         TEST_FONTS_MISSING=1
11347     fi
11350 dnl ===================================================================
11351 dnl Test whether to include fonts
11352 dnl ===================================================================
11353 AC_MSG_CHECKING([whether to include third-party fonts])
11354 if test "$with_fonts" != "no"; then
11355     AC_MSG_RESULT([yes])
11356     WITH_FONTS=TRUE
11357     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11358     AC_DEFINE(HAVE_MORE_FONTS)
11359 else
11360     AC_MSG_RESULT([no])
11361     WITH_FONTS=
11362     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11363     if test "$test_fontconfig" = "yes"; then
11364         AC_PATH_PROG([FCMATCH], [fc-match])
11365         if test -z "$FCMATCH"; then
11366             AC_MSG_WARN([Unable to query installed fonts - unit tests disabled.])
11367             TEST_FONTS_MISSING=1
11368         else
11369             test_font_map 'Calibri' 'Carlito'
11370             test_font_map 'DejaVuSans' 'DejaVuSans'
11371             if test ${TEST_FONTS_MISSING} -eq 1
11372             then
11373                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
11374                 add_warning "Unknown font mappings - unit tests disabled."
11375             fi
11376         fi
11377     else
11378         TEST_FONTS_MISSING=1
11379     fi
11381 AC_SUBST(WITH_FONTS)
11382 AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
11385 dnl ===================================================================
11386 dnl Test whether to enable online update service
11387 dnl ===================================================================
11388 AC_MSG_CHECKING([whether to enable online update])
11389 ENABLE_ONLINE_UPDATE=
11390 ENABLE_ONLINE_UPDATE_MAR=
11391 UPDATE_CONFIG=
11392 if test "$enable_online_update" = ""; then
11393     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11394         AC_MSG_RESULT([yes])
11395         ENABLE_ONLINE_UPDATE="TRUE"
11396     else
11397         AC_MSG_RESULT([no])
11398     fi
11399 else
11400     if test "$enable_online_update" = "mar"; then
11401         AC_MSG_RESULT([yes - MAR-based online update])
11402         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11403         if test "$with_update_config" = ""; then
11404             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11405         fi
11406         UPDATE_CONFIG="$with_update_config"
11407         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11408     elif test "$enable_online_update" = "yes"; then
11409         AC_MSG_RESULT([yes])
11410         ENABLE_ONLINE_UPDATE="TRUE"
11411     else
11412         AC_MSG_RESULT([no])
11413     fi
11415 AC_SUBST(ENABLE_ONLINE_UPDATE)
11416 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11417 AC_SUBST(UPDATE_CONFIG)
11419 dnl ===================================================================
11420 dnl Test whether we need bzip2
11421 dnl ===================================================================
11422 SYSTEM_BZIP2=
11423 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11424     AC_MSG_CHECKING([whether to use system bzip2])
11425     if test "$with_system_bzip2" = yes; then
11426         SYSTEM_BZIP2=TRUE
11427         AC_MSG_RESULT([yes])
11428         PKG_CHECK_MODULES(BZIP2, bzip2)
11429         FilterLibs "${BZIP2_LIBS}"
11430         BZIP2_LIBS="${filteredlibs}"
11431     else
11432         AC_MSG_RESULT([no])
11433         BUILD_TYPE="$BUILD_TYPE BZIP2"
11434     fi
11436 AC_SUBST(SYSTEM_BZIP2)
11437 AC_SUBST(BZIP2_CFLAGS)
11438 AC_SUBST(BZIP2_LIBS)
11440 dnl ===================================================================
11441 dnl Test whether to enable extension update
11442 dnl ===================================================================
11443 AC_MSG_CHECKING([whether to enable extension update])
11444 ENABLE_EXTENSION_UPDATE=
11445 if test "x$enable_extension_update" = "xno"; then
11446     AC_MSG_RESULT([no])
11447 else
11448     AC_MSG_RESULT([yes])
11449     ENABLE_EXTENSION_UPDATE="TRUE"
11450     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11451     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11453 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11456 dnl ===================================================================
11457 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11458 dnl ===================================================================
11459 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11460 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11461     AC_MSG_RESULT([no])
11462     ENABLE_SILENT_MSI=
11463 else
11464     AC_MSG_RESULT([yes])
11465     ENABLE_SILENT_MSI=TRUE
11466     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11468 AC_SUBST(ENABLE_SILENT_MSI)
11470 AC_MSG_CHECKING([whether and how to use Xinerama])
11471 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11472     if test "$x_libraries" = "default_x_libraries"; then
11473         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11474         if test "x$XINERAMALIB" = x; then
11475            XINERAMALIB="/usr/lib"
11476         fi
11477     else
11478         XINERAMALIB="$x_libraries"
11479     fi
11480     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11481         # we have both versions, let the user decide but use the dynamic one
11482         # per default
11483         USE_XINERAMA=TRUE
11484         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11485             XINERAMA_LINK=dynamic
11486         else
11487             XINERAMA_LINK=static
11488         fi
11489     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11490         # we have only the dynamic version
11491         USE_XINERAMA=TRUE
11492         XINERAMA_LINK=dynamic
11493     elif test -e "$XINERAMALIB/libXinerama.a"; then
11494         # static version
11495         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11496             USE_XINERAMA=TRUE
11497             XINERAMA_LINK=static
11498         else
11499             USE_XINERAMA=
11500             XINERAMA_LINK=none
11501         fi
11502     else
11503         # no Xinerama
11504         USE_XINERAMA=
11505         XINERAMA_LINK=none
11506     fi
11507     if test "$USE_XINERAMA" = "TRUE"; then
11508         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11509         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11510             [AC_MSG_ERROR(Xinerama header not found.)], [])
11511         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11512         if test "x$XEXTLIB" = x; then
11513            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11514         fi
11515         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11516         if test "$_os" = "FreeBSD"; then
11517             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11518         fi
11519         if test "$_os" = "Linux"; then
11520             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11521         fi
11522         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11523             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11524     else
11525         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11526     fi
11527 else
11528     USE_XINERAMA=
11529     XINERAMA_LINK=none
11530     AC_MSG_RESULT([no])
11532 AC_SUBST(USE_XINERAMA)
11533 AC_SUBST(XINERAMA_LINK)
11535 dnl ===================================================================
11536 dnl Test whether to build cairo or rely on the system version
11537 dnl ===================================================================
11539 if test "$USING_X11" = TRUE; then
11540     # Used in vcl/Library_vclplug_gen.mk
11541     test_cairo=yes
11544 if test "$test_cairo" = "yes"; then
11545     AC_MSG_CHECKING([whether to use the system cairo])
11547     : ${with_system_cairo:=$with_system_libs}
11548     if test "$with_system_cairo" = "yes"; then
11549         SYSTEM_CAIRO=TRUE
11550         AC_MSG_RESULT([yes])
11552         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11553         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11554         FilterLibs "${CAIRO_LIBS}"
11555         CAIRO_LIBS="${filteredlibs}"
11557         if test "$test_xrender" = "yes"; then
11558             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11559             AC_LANG_PUSH([C])
11560             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11561 #ifdef PictStandardA8
11562 #else
11563       return fail;
11564 #endif
11565 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11567             AC_LANG_POP([C])
11568         fi
11569     else
11570         SYSTEM_CAIRO=
11571         AC_MSG_RESULT([no])
11573         BUILD_TYPE="$BUILD_TYPE CAIRO"
11574     fi
11577 AC_SUBST(SYSTEM_CAIRO)
11578 AC_SUBST(CAIRO_CFLAGS)
11579 AC_SUBST(CAIRO_LIBS)
11581 dnl ===================================================================
11582 dnl Test whether to use avahi
11583 dnl ===================================================================
11584 if test "$_os" = "WINNT"; then
11585     # Windows uses bundled mDNSResponder
11586     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11587 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11588     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11589                       [ENABLE_AVAHI="TRUE"])
11590     AC_DEFINE(HAVE_FEATURE_AVAHI)
11591     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11592     FilterLibs "${AVAHI_LIBS}"
11593     AVAHI_LIBS="${filteredlibs}"
11596 AC_SUBST(ENABLE_AVAHI)
11597 AC_SUBST(AVAHI_CFLAGS)
11598 AC_SUBST(AVAHI_LIBS)
11600 dnl ===================================================================
11601 dnl Test whether to use liblangtag
11602 dnl ===================================================================
11603 SYSTEM_LIBLANGTAG=
11604 AC_MSG_CHECKING([whether to use system liblangtag])
11605 if test "$with_system_liblangtag" = yes; then
11606     SYSTEM_LIBLANGTAG=TRUE
11607     AC_MSG_RESULT([yes])
11608     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11609     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11610     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11611     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11612     FilterLibs "${LIBLANGTAG_LIBS}"
11613     LIBLANGTAG_LIBS="${filteredlibs}"
11614 else
11615     SYSTEM_LIBLANGTAG=
11616     AC_MSG_RESULT([no])
11617     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11618     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11619     if test "$COM" = "MSC"; then
11620         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11621     else
11622         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11623     fi
11625 AC_SUBST(SYSTEM_LIBLANGTAG)
11626 AC_SUBST(LIBLANGTAG_CFLAGS)
11627 AC_SUBST(LIBLANGTAG_LIBS)
11629 dnl ===================================================================
11630 dnl Test whether to build libpng or rely on the system version
11631 dnl ===================================================================
11633 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11635 dnl ===================================================================
11636 dnl Check for runtime JVM search path
11637 dnl ===================================================================
11638 if test "$ENABLE_JAVA" != ""; then
11639     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11640     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11641         AC_MSG_RESULT([yes])
11642         if ! test -d "$with_jvm_path"; then
11643             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11644         fi
11645         if ! test -d "$with_jvm_path"jvm; then
11646             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11647         fi
11648         JVM_ONE_PATH_CHECK="$with_jvm_path"
11649         AC_SUBST(JVM_ONE_PATH_CHECK)
11650     else
11651         AC_MSG_RESULT([no])
11652     fi
11655 dnl ===================================================================
11656 dnl Test for the presence of Ant and that it works
11657 dnl ===================================================================
11659 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
11660     ANT_HOME=; export ANT_HOME
11661     WITH_ANT_HOME=; export WITH_ANT_HOME
11662     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11663         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11664             if test "$_os" = "WINNT"; then
11665                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11666             else
11667                 with_ant_home="$LODE_HOME/opt/ant"
11668             fi
11669         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11670             with_ant_home="$LODE_HOME/opt/ant"
11671         fi
11672     fi
11673     if test -z "$with_ant_home"; then
11674         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11675     else
11676         if test "$_os" = "WINNT"; then
11677             # AC_PATH_PROGS needs unix path
11678             with_ant_home=`cygpath -u "$with_ant_home"`
11679         fi
11680         AbsolutePath "$with_ant_home"
11681         with_ant_home=$absolute_path
11682         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11683         WITH_ANT_HOME=$with_ant_home
11684         ANT_HOME=$with_ant_home
11685     fi
11687     if test -z "$ANT"; then
11688         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11689     else
11690         # resolve relative or absolute symlink
11691         while test -h "$ANT"; do
11692             a_cwd=`pwd`
11693             a_basename=`basename "$ANT"`
11694             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11695             cd "`dirname "$ANT"`"
11696             cd "`dirname "$a_script"`"
11697             ANT="`pwd`"/"`basename "$a_script"`"
11698             cd "$a_cwd"
11699         done
11701         AC_MSG_CHECKING([if $ANT works])
11702         cat > conftest.java << EOF
11703         public class conftest {
11704             int testmethod(int a, int b) {
11705                     return a + b;
11706             }
11707         }
11710         cat > conftest.xml << EOF
11711         <project name="conftest" default="conftest">
11712         <target name="conftest">
11713             <javac srcdir="." includes="conftest.java">
11714             </javac>
11715         </target>
11716         </project>
11719         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11720         if test $? = 0 -a -f ./conftest.class; then
11721             AC_MSG_RESULT([Ant works])
11722             if test -z "$WITH_ANT_HOME"; then
11723                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11724                 if test -z "$ANT_HOME"; then
11725                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11726                 fi
11727             else
11728                 ANT_HOME="$WITH_ANT_HOME"
11729             fi
11730         else
11731             echo "configure: Ant test failed" >&5
11732             cat conftest.java >&5
11733             cat conftest.xml >&5
11734             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11735         fi
11736         rm -f conftest* core core.* *.core
11737     fi
11738     if test -z "$ANT_HOME"; then
11739         ANT_HOME="NO_ANT_HOME"
11740     else
11741         PathFormat "$ANT_HOME"
11742         ANT_HOME="$formatted_path"
11743         PathFormat "$ANT"
11744         ANT="$formatted_path"
11745     fi
11746     AC_SUBST(ANT_HOME)
11747     AC_SUBST(ANT)
11749     dnl Checking for ant.jar
11750     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11751         AC_MSG_CHECKING([Ant lib directory])
11752         if test -f $ANT_HOME/lib/ant.jar; then
11753             ANT_LIB="$ANT_HOME/lib"
11754         else
11755             if test -f $ANT_HOME/ant.jar; then
11756                 ANT_LIB="$ANT_HOME"
11757             else
11758                 if test -f /usr/share/java/ant.jar; then
11759                     ANT_LIB=/usr/share/java
11760                 else
11761                     if test -f /usr/share/ant-core/lib/ant.jar; then
11762                         ANT_LIB=/usr/share/ant-core/lib
11763                     else
11764                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11765                             ANT_LIB="$ANT_HOME/lib/ant"
11766                         else
11767                             if test -f /usr/share/lib/ant/ant.jar; then
11768                                 ANT_LIB=/usr/share/lib/ant
11769                             else
11770                                 AC_MSG_ERROR([Ant libraries not found!])
11771                             fi
11772                         fi
11773                     fi
11774                 fi
11775             fi
11776         fi
11777         PathFormat "$ANT_LIB"
11778         ANT_LIB="$formatted_path"
11779         AC_MSG_RESULT([Ant lib directory found.])
11780     fi
11781     AC_SUBST(ANT_LIB)
11783     ant_minver=1.6.0
11784     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11786     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11787     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11788     ant_version_major=`echo $ant_version | cut -d. -f1`
11789     ant_version_minor=`echo $ant_version | cut -d. -f2`
11790     echo "configure: ant_version $ant_version " >&5
11791     echo "configure: ant_version_major $ant_version_major " >&5
11792     echo "configure: ant_version_minor $ant_version_minor " >&5
11793     if test "$ant_version_major" -ge "2"; then
11794         AC_MSG_RESULT([yes, $ant_version])
11795     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11796         AC_MSG_RESULT([yes, $ant_version])
11797     else
11798         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11799     fi
11801     rm -f conftest* core core.* *.core
11804 OOO_JUNIT_JAR=
11805 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11806     AC_MSG_CHECKING([for JUnit 4])
11807     if test "$with_junit" = "yes"; then
11808         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
11809             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
11810         elif test -e /usr/share/java/junit4.jar; then
11811             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11812         else
11813            if test -e /usr/share/lib/java/junit.jar; then
11814               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11815            else
11816               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11817            fi
11818         fi
11819     else
11820         OOO_JUNIT_JAR=$with_junit
11821     fi
11822     if test "$_os" = "WINNT"; then
11823         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11824     fi
11825     printf 'import org.junit.Before;' > conftest.java
11826     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11827         AC_MSG_RESULT([$OOO_JUNIT_JAR])
11828     else
11829         AC_MSG_ERROR(
11830 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
11831  specify its pathname via --with-junit=..., or disable it via --without-junit])
11832     fi
11833     rm -f conftest.class conftest.java
11834     if test $OOO_JUNIT_JAR != ""; then
11835     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11836     fi
11838 AC_SUBST(OOO_JUNIT_JAR)
11840 HAMCREST_JAR=
11841 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11842     AC_MSG_CHECKING([for included Hamcrest])
11843     printf 'import org.hamcrest.BaseDescription;' > conftest.java
11844     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11845         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
11846     else
11847         AC_MSG_RESULT([Not included])
11848         AC_MSG_CHECKING([for standalone hamcrest jar.])
11849         if test "$with_hamcrest" = "yes"; then
11850             if test -e /usr/share/lib/java/hamcrest.jar; then
11851                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
11852             elif test -e /usr/share/java/hamcrest/core.jar; then
11853                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
11854             else
11855                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
11856             fi
11857         else
11858             HAMCREST_JAR=$with_hamcrest
11859         fi
11860         if test "$_os" = "WINNT"; then
11861             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
11862         fi
11863         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
11864             AC_MSG_RESULT([$HAMCREST_JAR])
11865         else
11866             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),
11867                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
11868         fi
11869     fi
11870     rm -f conftest.class conftest.java
11872 AC_SUBST(HAMCREST_JAR)
11875 AC_SUBST(SCPDEFS)
11878 # check for wget and curl
11880 WGET=
11881 CURL=
11883 if test "$enable_fetch_external" != "no"; then
11885 CURL=`which curl 2>/dev/null`
11887 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
11888     # wget new enough?
11889     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
11890     if test $? -eq 0; then
11891         WGET=$i
11892         break
11893     fi
11894 done
11896 if test -z "$WGET" -a -z "$CURL"; then
11897     AC_MSG_ERROR([neither wget nor curl found!])
11902 AC_SUBST(WGET)
11903 AC_SUBST(CURL)
11906 # check for sha256sum
11908 SHA256SUM=
11910 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
11911     eval "$i -a 256 --version" > /dev/null 2>&1
11912     ret=$?
11913     if test $ret -eq 0; then
11914         SHA256SUM="$i -a 256"
11915         break
11916     fi
11917 done
11919 if test -z "$SHA256SUM"; then
11920     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
11921         eval "$i --version" > /dev/null 2>&1
11922         ret=$?
11923         if test $ret -eq 0; then
11924             SHA256SUM=$i
11925             break
11926         fi
11927     done
11930 if test -z "$SHA256SUM"; then
11931     AC_MSG_ERROR([no sha256sum found!])
11934 AC_SUBST(SHA256SUM)
11936 dnl ===================================================================
11937 dnl Dealing with l10n options
11938 dnl ===================================================================
11939 AC_MSG_CHECKING([which languages to be built])
11940 # get list of all languages
11941 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
11942 # the sed command does the following:
11943 #   + if a line ends with a backslash, append the next line to it
11944 #   + adds " on the beginning of the value (after =)
11945 #   + adds " at the end of the value
11946 #   + removes en-US; we want to put it on the beginning
11947 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
11948 [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)]
11949 ALL_LANGS="en-US $completelangiso"
11950 # check the configured localizations
11951 WITH_LANG="$with_lang"
11952 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
11953     AC_MSG_RESULT([en-US])
11954 else
11955     AC_MSG_RESULT([$WITH_LANG])
11956     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
11957     if test -z "$MSGFMT"; then
11958         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
11959             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
11960         elif test -x "/opt/lo/bin/msgfmt"; then
11961             MSGFMT="/opt/lo/bin/msgfmt"
11962         else
11963             AC_CHECK_PROGS(MSGFMT, [msgfmt])
11964             if test -z "$MSGFMT"; then
11965                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
11966             fi
11967         fi
11968     fi
11969     if test -z "$MSGUNIQ"; then
11970         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
11971             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
11972         elif test -x "/opt/lo/bin/msguniq"; then
11973             MSGUNIQ="/opt/lo/bin/msguniq"
11974         else
11975             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
11976             if test -z "$MSGUNIQ"; then
11977                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
11978             fi
11979         fi
11980     fi
11982 AC_SUBST(MSGFMT)
11983 AC_SUBST(MSGUNIQ)
11984 # check that the list is valid
11985 for lang in $WITH_LANG; do
11986     test "$lang" = "ALL" && continue
11987     # need to check for the exact string, so add space before and after the list of all languages
11988     for vl in $ALL_LANGS; do
11989         if test "$vl" = "$lang"; then
11990            break
11991         fi
11992     done
11993     if test "$vl" != "$lang"; then
11994         # if you're reading this - you prolly quoted your languages remove the quotes ...
11995         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
11996     fi
11997 done
11998 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
11999     echo $WITH_LANG | grep -q en-US
12000     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12002 # list with substituted ALL
12003 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12004 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12005 test "$WITH_LANG" = "en-US" && WITH_LANG=
12006 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12007     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12008     ALL_LANGS=`echo $ALL_LANGS qtz`
12010 AC_SUBST(ALL_LANGS)
12011 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12012 AC_SUBST(WITH_LANG)
12013 AC_SUBST(WITH_LANG_LIST)
12014 AC_SUBST(GIT_NEEDED_SUBMODULES)
12016 WITH_POOR_HELP_LOCALIZATIONS=
12017 if test -d "$SRC_ROOT/translations/source"; then
12018     for l in `ls -1 $SRC_ROOT/translations/source`; do
12019         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12020             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12021         fi
12022     done
12024 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12026 if test -n "$with_locales"; then
12027     WITH_LOCALES="$with_locales"
12029     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12030     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12031     # config_host/config_locales.h.in
12032     for locale in $WITH_LOCALES; do
12033         lang=${locale%_*}
12035         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12037         case $lang in
12038         hi|mr*ne)
12039             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12040             ;;
12041         bg|ru)
12042             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12043             ;;
12044         esac
12045     done
12046 else
12047     AC_DEFINE(WITH_LOCALE_ALL)
12049 AC_SUBST(WITH_LOCALES)
12051 dnl git submodule update --reference
12052 dnl ===================================================================
12053 if test -n "${GIT_REFERENCE_SRC}"; then
12054     for repo in ${GIT_NEEDED_SUBMODULES}; do
12055         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12056             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12057         fi
12058     done
12060 AC_SUBST(GIT_REFERENCE_SRC)
12062 dnl git submodules linked dirs
12063 dnl ===================================================================
12064 if test -n "${GIT_LINK_SRC}"; then
12065     for repo in ${GIT_NEEDED_SUBMODULES}; do
12066         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12067             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12068         fi
12069     done
12071 AC_SUBST(GIT_LINK_SRC)
12073 dnl branding
12074 dnl ===================================================================
12075 AC_MSG_CHECKING([for alternative branding images directory])
12076 # initialize mapped arrays
12077 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12078 brand_files="$BRAND_INTRO_IMAGES about.svg"
12080 if test -z "$with_branding" -o "$with_branding" = "no"; then
12081     AC_MSG_RESULT([none])
12082     DEFAULT_BRAND_IMAGES="$brand_files"
12083 else
12084     if ! test -d $with_branding ; then
12085         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12086     else
12087         AC_MSG_RESULT([$with_branding])
12088         CUSTOM_BRAND_DIR="$with_branding"
12089         for lfile in $brand_files
12090         do
12091             if ! test -f $with_branding/$lfile ; then
12092                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12093                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12094             else
12095                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12096             fi
12097         done
12098         check_for_progress="yes"
12099     fi
12101 AC_SUBST([BRAND_INTRO_IMAGES])
12102 AC_SUBST([CUSTOM_BRAND_DIR])
12103 AC_SUBST([CUSTOM_BRAND_IMAGES])
12104 AC_SUBST([DEFAULT_BRAND_IMAGES])
12107 AC_MSG_CHECKING([for 'intro' progress settings])
12108 PROGRESSBARCOLOR=
12109 PROGRESSSIZE=
12110 PROGRESSPOSITION=
12111 PROGRESSFRAMECOLOR=
12112 PROGRESSTEXTCOLOR=
12113 PROGRESSTEXTBASELINE=
12115 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12116     source "$with_branding/progress.conf"
12117     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12118 else
12119     AC_MSG_RESULT([none])
12122 AC_SUBST(PROGRESSBARCOLOR)
12123 AC_SUBST(PROGRESSSIZE)
12124 AC_SUBST(PROGRESSPOSITION)
12125 AC_SUBST(PROGRESSFRAMECOLOR)
12126 AC_SUBST(PROGRESSTEXTCOLOR)
12127 AC_SUBST(PROGRESSTEXTBASELINE)
12130 AC_MSG_CHECKING([for extra build ID])
12131 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12132     EXTRA_BUILDID="$with_extra_buildid"
12134 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12135 if test -n "$EXTRA_BUILDID" ; then
12136     AC_MSG_RESULT([$EXTRA_BUILDID])
12137 else
12138     AC_MSG_RESULT([not set])
12140 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12142 OOO_VENDOR=
12143 AC_MSG_CHECKING([for vendor])
12144 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12145     OOO_VENDOR="$USERNAME"
12147     if test -z "$OOO_VENDOR"; then
12148         OOO_VENDOR="$USER"
12149     fi
12151     if test -z "$OOO_VENDOR"; then
12152         OOO_VENDOR="`id -u -n`"
12153     fi
12155     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12156 else
12157     OOO_VENDOR="$with_vendor"
12158     AC_MSG_RESULT([$OOO_VENDOR])
12160 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12161 AC_SUBST(OOO_VENDOR)
12163 if test "$_os" = "Android" ; then
12164     ANDROID_PACKAGE_NAME=
12165     AC_MSG_CHECKING([for Android package name])
12166     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12167         if test -n "$ENABLE_DEBUG"; then
12168             # Default to the package name that makes ndk-gdb happy.
12169             ANDROID_PACKAGE_NAME="org.libreoffice"
12170         else
12171             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12172         fi
12174         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12175     else
12176         ANDROID_PACKAGE_NAME="$with_android_package_name"
12177         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12178     fi
12179     AC_SUBST(ANDROID_PACKAGE_NAME)
12182 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12183 if test "$with_compat_oowrappers" = "yes"; then
12184     WITH_COMPAT_OOWRAPPERS=TRUE
12185     AC_MSG_RESULT(yes)
12186 else
12187     WITH_COMPAT_OOWRAPPERS=
12188     AC_MSG_RESULT(no)
12190 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12192 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12193 AC_MSG_CHECKING([for install dirname])
12194 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12195     INSTALLDIRNAME="$with_install_dirname"
12197 AC_MSG_RESULT([$INSTALLDIRNAME])
12198 AC_SUBST(INSTALLDIRNAME)
12200 AC_MSG_CHECKING([for prefix])
12201 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12202 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12203 PREFIXDIR="$prefix"
12204 AC_MSG_RESULT([$PREFIXDIR])
12205 AC_SUBST(PREFIXDIR)
12207 LIBDIR=[$(eval echo $(eval echo $libdir))]
12208 AC_SUBST(LIBDIR)
12210 DATADIR=[$(eval echo $(eval echo $datadir))]
12211 AC_SUBST(DATADIR)
12213 MANDIR=[$(eval echo $(eval echo $mandir))]
12214 AC_SUBST(MANDIR)
12216 DOCDIR=[$(eval echo $(eval echo $docdir))]
12217 AC_SUBST(DOCDIR)
12219 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12220 AC_SUBST(INSTALLDIR)
12222 TESTINSTALLDIR="${BUILDDIR}/test-install"
12223 AC_SUBST(TESTINSTALLDIR)
12226 # ===================================================================
12227 # OAuth2 id and secrets
12228 # ===================================================================
12230 AC_MSG_CHECKING([for Google Drive client id and secret])
12231 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12232     AC_MSG_RESULT([not set])
12233     GDRIVE_CLIENT_ID="\"\""
12234     GDRIVE_CLIENT_SECRET="\"\""
12235 else
12236     AC_MSG_RESULT([set])
12237     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12238     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12240 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12241 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12243 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12244 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12245     AC_MSG_RESULT([not set])
12246     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12247     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12248 else
12249     AC_MSG_RESULT([set])
12250     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12251     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12253 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12254 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12256 AC_MSG_CHECKING([for OneDrive client id and secret])
12257 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12258     AC_MSG_RESULT([not set])
12259     ONEDRIVE_CLIENT_ID="\"\""
12260     ONEDRIVE_CLIENT_SECRET="\"\""
12261 else
12262     AC_MSG_RESULT([set])
12263     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12264     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12266 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12267 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12270 dnl ===================================================================
12271 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12272 dnl --enable-dependency-tracking configure option
12273 dnl ===================================================================
12274 AC_MSG_CHECKING([whether to enable dependency tracking])
12275 if test "$enable_dependency_tracking" = "no"; then
12276     nodep=TRUE
12277     AC_MSG_RESULT([no])
12278 else
12279     AC_MSG_RESULT([yes])
12281 AC_SUBST(nodep)
12283 dnl ===================================================================
12284 dnl Number of CPUs to use during the build
12285 dnl ===================================================================
12286 AC_MSG_CHECKING([for number of processors to use])
12287 # plain --with-parallelism is just the default
12288 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12289     if test "$with_parallelism" = "no"; then
12290         PARALLELISM=0
12291     else
12292         PARALLELISM=$with_parallelism
12293     fi
12294 else
12295     if test "$enable_icecream" = "yes"; then
12296         PARALLELISM="10"
12297     else
12298         case `uname -s` in
12300         Darwin|FreeBSD|NetBSD|OpenBSD)
12301             PARALLELISM=`sysctl -n hw.ncpu`
12302             ;;
12304         Linux)
12305             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12306         ;;
12307         # what else than above does profit here *and* has /proc?
12308         *)
12309             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12310             ;;
12311         esac
12313         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12314         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12315     fi
12318 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12319     if test -z "$with_parallelism"; then
12320             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12321             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12322             PARALLELISM="1"
12323     else
12324         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."
12325     fi
12328 if test $PARALLELISM -eq 0; then
12329     AC_MSG_RESULT([explicit make -j option needed])
12330 else
12331     AC_MSG_RESULT([$PARALLELISM])
12333 AC_SUBST(PARALLELISM)
12335 IWYU_PATH="$with_iwyu"
12336 AC_SUBST(IWYU_PATH)
12337 if test ! -z "$IWYU_PATH"; then
12338     if test ! -f "$IWYU_PATH"; then
12339         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12340     fi
12344 # Set up ILIB for MSVC build
12346 ILIB1=
12347 if test "$build_os" = "cygwin"; then
12348     ILIB="."
12349     if test -n "$JAVA_HOME"; then
12350         ILIB="$ILIB;$JAVA_HOME/lib"
12351     fi
12352     ILIB1=-link
12353     if test "$BITNESS_OVERRIDE" = 64; then
12354         if test $vcnum = "150"; then
12355             ILIB="$ILIB;$COMPATH/lib/x64"
12356             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12357         else
12358             ILIB="$ILIB;$COMPATH/lib/amd64"
12359             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/amd64"
12360         fi
12361         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12362         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12363         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12364             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12365             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12366         fi
12367         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12368         ucrtlibpath_formatted=$formatted_path
12369         ILIB="$ILIB;$ucrtlibpath_formatted"
12370         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12371     else
12372         if test $vcnum = "150"; then
12373             ILIB="$ILIB;$COMPATH/lib/x86"
12374             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12375         else
12376             ILIB="$ILIB;$COMPATH/lib"
12377             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib"
12378         fi
12379         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12380         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12381         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12382             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12383             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12384         fi
12385         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12386         ucrtlibpath_formatted=$formatted_path
12387         ILIB="$ILIB;$ucrtlibpath_formatted"
12388         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12389     fi
12390     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12391         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12392     else
12393         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12394     fi
12396     AC_SUBST(ILIB)
12399 dnl We should be able to drop the below check when bumping the GCC baseline to
12400 dnl 4.9, as <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54577>
12401 dnl "deque<T>::erase() still takes iterator instead of const_iterator" should be
12402 dnl fixed there with <https://gcc.gnu.org/git/?p=gcc.git;a=commit;
12403 dnl h=6b0e18ca48bb4b4c01e7b5be2b98849943fdcf91>:
12404 AC_MSG_CHECKING(
12405     [whether C++11 use of const_iterator in standard containers is broken])
12406 save_CXXFLAGS=$CXXFLAGS
12407 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12408 AC_LANG_PUSH([C++])
12409 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12410     #include <list>
12411     ]],[[
12412         std::list<int> l;
12413         l.erase(l.cbegin());
12414     ]])],
12415     [broken=no], [broken=yes])
12416 AC_LANG_POP([C++])
12417 CXXFLAGS=$save_CXXFLAGS
12418 AC_MSG_RESULT([$broken])
12419 if test "$broken" = yes; then
12420     AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
12424 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12425 save_CXXFLAGS=$CXXFLAGS
12426 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12427 save_LIBS=$LIBS
12428 if test -n "$ILIB1"; then
12429     LIBS="$LIBS $ILIB1"
12431 AC_LANG_PUSH([C++])
12432 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12433     // Exit with failure if the static initializer_list is stored on the
12434     // stack (as done by Clang < 3.4):
12435     #include <initializer_list>
12436     struct S {};
12437     bool g(void const * p1, void const * p2) {
12438         int n;
12439         return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12440     }
12441     bool f(void const * p1) {
12442         static std::initializer_list<S> s { S() };
12443         return g(p1, s.begin());
12444     }
12445     ]],[[
12446         int n;
12447         return f(&n) ? 0 : 1;
12448     ]])], [broken=no], [broken=yes],[broken='assuming not (cross-compiling)'])
12449 AC_LANG_POP([C++])
12450 LIBS=$save_LIBS
12451 CXXFLAGS=$save_CXXFLAGS
12452 AC_MSG_RESULT([$broken])
12453 if test "$broken" = yes -a "$_os" != "iOS"; then
12454     AC_MSG_ERROR([working support for static initializer_list needed])
12458 # ===================================================================
12459 # Creating bigger shared library to link against
12460 # ===================================================================
12461 AC_MSG_CHECKING([whether to create huge library])
12462 MERGELIBS=
12464 if test $_os = iOS -o $_os = Android; then
12465     # Never any point in mergelibs for these as we build just static
12466     # libraries anyway...
12467     enable_mergelibs=no
12470 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12471     if test $_os != Linux -a $_os != WINNT; then
12472         add_warning "--enable-mergelibs is not tested for this platform"
12473     fi
12474     MERGELIBS="TRUE"
12475     AC_MSG_RESULT([yes])
12476 else
12477     AC_MSG_RESULT([no])
12479 AC_SUBST([MERGELIBS])
12481 dnl ===================================================================
12482 dnl icerun is a wrapper that stops us spawning tens of processes
12483 dnl locally - for tools that can't be executed on the compile cluster
12484 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12485 dnl ===================================================================
12486 AC_MSG_CHECKING([whether to use icerun wrapper])
12487 ICECREAM_RUN=
12488 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12489     ICECREAM_RUN=icerun
12490     AC_MSG_RESULT([yes])
12491 else
12492     AC_MSG_RESULT([no])
12494 AC_SUBST(ICECREAM_RUN)
12496 dnl ===================================================================
12497 dnl Setup the ICECC_VERSION for the build the same way it was set for
12498 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12499 dnl ===================================================================
12500 x_ICECC_VERSION=[\#]
12501 if test -n "$ICECC_VERSION" ; then
12502     x_ICECC_VERSION=
12504 AC_SUBST(x_ICECC_VERSION)
12505 AC_SUBST(ICECC_VERSION)
12507 dnl ===================================================================
12509 AC_MSG_CHECKING([MPL subset])
12510 MPL_SUBSET=
12512 if test "$enable_mpl_subset" = "yes"; then
12513     warn_report=false
12514     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12515         warn_report=true
12516     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12517         warn_report=true
12518     fi
12519     if test "$warn_report" = "true"; then
12520         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12521     fi
12522     if test "x$enable_postgresql_sdbc" != "xno"; then
12523         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12524     fi
12525     if test "$enable_lotuswordpro" = "yes"; then
12526         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12527     fi
12528     if test "$WITH_WEBDAV" = "neon"; then
12529         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12530     fi
12531     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12532         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12533     fi
12534     if test -n "$ENABLE_PDFIMPORT"; then
12535         if test "x$SYSTEM_POPPLER" = "x"; then
12536             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12537         fi
12538     fi
12539     # cf. m4/libo_check_extension.m4
12540     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12541         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12542     fi
12543     for theme in $WITH_THEMES; do
12544         case $theme in
12545         breeze|breeze_dark|sifr|sifr_dark|elementary|karasa_jaga) #blacklist of icon themes under GPL or LGPL
12546             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12547         *) : ;;
12548         esac
12549     done
12551     ENABLE_OPENGL_TRANSITIONS=
12553     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12554         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12555     fi
12557     MPL_SUBSET="TRUE"
12558     AC_DEFINE(MPL_HAVE_SUBSET)
12559     AC_MSG_RESULT([only])
12560 else
12561     AC_MSG_RESULT([no restrictions])
12563 AC_SUBST(MPL_SUBSET)
12565 dnl ===================================================================
12567 AC_MSG_CHECKING([formula logger])
12568 ENABLE_FORMULA_LOGGER=
12570 if test "x$enable_formula_logger" = "xyes"; then
12571     AC_MSG_RESULT([yes])
12572     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12573     ENABLE_FORMULA_LOGGER=TRUE
12574 elif test -n "$ENABLE_DBGUTIL" ; then
12575     AC_MSG_RESULT([yes])
12576     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12577     ENABLE_FORMULA_LOGGER=TRUE
12578 else
12579     AC_MSG_RESULT([no])
12582 AC_SUBST(ENABLE_FORMULA_LOGGER)
12584 dnl ===================================================================
12585 dnl Setting up the environment.
12586 dnl ===================================================================
12587 AC_MSG_NOTICE([setting up the build environment variables...])
12589 AC_SUBST(COMPATH)
12591 if test "$build_os" = "cygwin"; then
12592     if test -d "$COMPATH/atlmfc/lib"; then
12593         ATL_LIB="$COMPATH/atlmfc/lib"
12594         ATL_INCLUDE="$COMPATH/atlmfc/include"
12595     else
12596         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12597         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12598     fi
12599     if test "$BITNESS_OVERRIDE" = 64; then
12600         if test $VCVER = "150"; then
12601             ATL_LIB="$ATL_LIB/x64"
12602         else
12603             ATL_LIB="$ATL_LIB/amd64"
12604         fi
12605     else
12606         if test $VCVER = "150"; then
12607             ATL_LIB="$ATL_LIB/x86"
12608         fi
12609     fi
12610     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12611     PathFormat "/usr/bin/find.exe"
12612     FIND="$formatted_path"
12613     PathFormat "/usr/bin/sort.exe"
12614     SORT="$formatted_path"
12615     PathFormat "/usr/bin/grep.exe"
12616     WIN_GREP="$formatted_path"
12617     PathFormat "/usr/bin/ls.exe"
12618     WIN_LS="$formatted_path"
12619     PathFormat "/usr/bin/touch.exe"
12620     WIN_TOUCH="$formatted_path"
12621 else
12622     FIND=find
12623     SORT=sort
12626 AC_SUBST(ATL_INCLUDE)
12627 AC_SUBST(ATL_LIB)
12628 AC_SUBST(FIND)
12629 AC_SUBST(SORT)
12630 AC_SUBST(WIN_GREP)
12631 AC_SUBST(WIN_LS)
12632 AC_SUBST(WIN_TOUCH)
12634 AC_SUBST(BUILD_TYPE)
12636 AC_SUBST(SOLARINC)
12638 PathFormat "$PERL"
12639 PERL="$formatted_path"
12640 AC_SUBST(PERL)
12642 if test -n "$TMPDIR"; then
12643     TEMP_DIRECTORY="$TMPDIR"
12644 else
12645     TEMP_DIRECTORY="/tmp"
12647 if test "$build_os" = "cygwin"; then
12648     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12650 AC_SUBST(TEMP_DIRECTORY)
12652 # setup the PATH for the environment
12653 if test -n "$LO_PATH_FOR_BUILD"; then
12654     LO_PATH="$LO_PATH_FOR_BUILD"
12655 else
12656     LO_PATH="$PATH"
12658     case "$host_os" in
12660     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12661         if test "$ENABLE_JAVA" != ""; then
12662             pathmunge "$JAVA_HOME/bin" "after"
12663         fi
12664         ;;
12666     cygwin*)
12667         # Win32 make needs native paths
12668         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12669             LO_PATH=`cygpath -p -m "$PATH"`
12670         fi
12671         if test "$BITNESS_OVERRIDE" = 64; then
12672             # needed for msi packaging
12673             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12674         fi
12675         # .NET 4.6 and higher don't have bin directory
12676         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12677             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12678         fi
12679         pathmunge "$ASM_HOME" "before"
12680         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12681         pathmunge "$CSC_PATH" "before"
12682         pathmunge "$MIDL_PATH" "before"
12683         pathmunge "$AL_PATH" "before"
12684         pathmunge "$MSPDB_PATH" "before"
12685         if test -n "$MSBUILD_PATH" ; then
12686             pathmunge "$MSBUILD_PATH" "before"
12687         fi
12688         if test "$BITNESS_OVERRIDE" = 64; then
12689             pathmunge "$COMPATH/bin/amd64" "before"
12690             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12691         else
12692             pathmunge "$COMPATH/bin" "before"
12693             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12694         fi
12695         if test "$ENABLE_JAVA" != ""; then
12696             if test -d "$JAVA_HOME/jre/bin/client"; then
12697                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12698             fi
12699             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12700                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12701             fi
12702             pathmunge "$JAVA_HOME/bin" "before"
12703         fi
12704         ;;
12706     solaris*)
12707         pathmunge "/usr/css/bin" "before"
12708         if test "$ENABLE_JAVA" != ""; then
12709             pathmunge "$JAVA_HOME/bin" "after"
12710         fi
12711         ;;
12712     esac
12715 AC_SUBST(LO_PATH)
12717 libo_FUZZ_SUMMARY
12719 # Generate a configuration sha256 we can use for deps
12720 if test -f config_host.mk; then
12721     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12723 if test -f config_host_lang.mk; then
12724     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12727 CFLAGS=$my_original_CFLAGS
12728 CXXFLAGS=$my_original_CXXFLAGS
12729 CPPFLAGS=$my_original_CPPFLAGS
12731 AC_CONFIG_FILES([config_host.mk
12732                  config_host_lang.mk
12733                  Makefile
12734                  lo.xcent
12735                  bin/bffvalidator.sh
12736                  bin/odfvalidator.sh
12737                  bin/officeotron.sh
12738                  instsetoo_native/util/openoffice.lst
12739                  sysui/desktop/macosx/Info.plist])
12740 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12741 AC_CONFIG_HEADERS([config_host/config_clang.h])
12742 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12743 AC_CONFIG_HEADERS([config_host/config_eot.h])
12744 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12745 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12746 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12747 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12748 AC_CONFIG_HEADERS([config_host/config_features.h])
12749 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12750 AC_CONFIG_HEADERS([config_host/config_folders.h])
12751 AC_CONFIG_HEADERS([config_host/config_gio.h])
12752 AC_CONFIG_HEADERS([config_host/config_global.h])
12753 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12754 AC_CONFIG_HEADERS([config_host/config_java.h])
12755 AC_CONFIG_HEADERS([config_host/config_langs.h])
12756 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12757 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12758 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12759 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
12760 AC_CONFIG_HEADERS([config_host/config_locales.h])
12761 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12762 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12763 AC_CONFIG_HEADERS([config_host/config_qt5.h])
12764 AC_CONFIG_HEADERS([config_host/config_kde5.h])
12765 AC_CONFIG_HEADERS([config_host/config_gtk3_kde5.h])
12766 AC_CONFIG_HEADERS([config_host/config_oox.h])
12767 AC_CONFIG_HEADERS([config_host/config_options.h])
12768 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12769 AC_CONFIG_HEADERS([config_host/config_test.h])
12770 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12771 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12772 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12773 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12774 AC_CONFIG_HEADERS([config_host/config_version.h])
12775 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12776 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12777 AC_CONFIG_HEADERS([config_host/config_python.h])
12778 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12779 AC_OUTPUT
12781 if test "$CROSS_COMPILING" = TRUE; then
12782     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12785 # touch the config timestamp file
12786 if test ! -f config_host.mk.stamp; then
12787     echo > config_host.mk.stamp
12788 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12789     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12790 else
12791     echo > config_host.mk.stamp
12794 # touch the config lang timestamp file
12795 if test ! -f config_host_lang.mk.stamp; then
12796     echo > config_host_lang.mk.stamp
12797 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12798     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12799 else
12800     echo > config_host_lang.mk.stamp
12804 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12806 cat << _EOS
12807 ****************************************************************************
12808 WARNING:
12809 Your make version is known to be horribly slow, and hard to debug
12810 problems with. To get a reasonably functional make please do:
12812 to install a pre-compiled binary make for Win32
12814  mkdir -p /opt/lo/bin
12815  cd /opt/lo/bin
12816  wget https://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
12817  cp make-85047eb-msvc.exe make
12818  chmod +x make
12820 to install from source:
12821 place yourself in a working directory of you choice.
12823  git clone git://git.savannah.gnu.org/make.git
12825  [go to Start menu, click "All Programs", click "Visual Studio 2015", click "Visual Studio Tools", double-click "VS2015 x86 Native Tools Command Prompt" or "VS2015 x64 Native Tools Command Prompt"]
12826  set PATH=%PATH%;C:\Cygwin\bin
12827  [or Cygwin64, if that is what you have]
12828  cd path-to-make-repo-you-cloned-above
12829  build_w32.bat --without-guile
12831 should result in a WinRel/gnumake.exe.
12832 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12834 Then re-run autogen.sh
12836 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12837 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12839 _EOS
12842 cat << _EOF
12843 ****************************************************************************
12845 To build, run:
12846 $GNUMAKE
12848 To view some help, run:
12849 $GNUMAKE help
12851 _EOF
12853 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12854     cat << _EOF
12855 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12856 _EOF
12858     if test $_os = Darwin; then
12859         echo open instdir/$PRODUCTNAME.app
12860     else
12861         echo instdir/program/soffice
12862     fi
12863     cat << _EOF
12865 If you want to run the smoketest, run:
12866 $GNUMAKE check
12868 _EOF
12871 if test -f warn; then
12872     cat warn
12873     rm warn
12876 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: