lokdialog: Convert the Format -> Paragraph... dialog to async exec.
[LibreOffice.git] / configure.ac
blob26dbf1004f2aaea903c7326cf90b934da5a99ee0
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 102 -*-
2 dnl configure.ac serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 # The version number in the second argument to AC_INIT should be four numbers separated by
6 # periods. Some parts of the code requires the first one to be less than 128 and the others to be less
7 # than 256. The four numbers can optionally be followed by a period and a free-form string containing
8 # no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
9 # several non-alphanumeric characters, those are split off and used only for the
10 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
12 AC_INIT([LibreOffice],[6.1.0.0.alpha0+],[],[],[http://documentfoundation.org/])
14 AC_PREREQ([2.59])
16 if test -n "$BUILD_TYPE"; then
17     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
20 save_CC=$CC
21 save_CXX=$CXX
23 BUILD_TYPE="LibO"
24 SCPDEFS=""
25 GIT_NEEDED_SUBMODULES=""
26 LO_PATH= # used by path_munge to construct a PATH variable
28 FilterLibs()
30     filteredlibs=
31     for f in $1; do
32         case "$f" in
33             # let's start with Fedora's paths for now
34             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
35                 # ignore it: on UNIXoids it is searched by default anyway
36                 # but if it's given explicitly then it may override other paths
37                 # (on Mac OS X it would be an error to use it instead of SDK)
38                 ;;
39             *)
40                 filteredlibs="$filteredlibs $f"
41                 ;;
42         esac
43     done
46 PathFormat()
48     formatted_path="$1"
49     if test "$build_os" = "cygwin"; then
50         pf_conv_to_dos=
51         # spaces,parentheses,brackets,braces are problematic in pathname
52         # so are backslashes
53         case "$formatted_path" in
54             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
55                 pf_conv_to_dos="yes"
56             ;;
57         esac
58         if test "$pf_conv_to_dos" = "yes"; then
59             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
60                 formatted_path=`cygpath -sm "$formatted_path"`
61             else
62                 formatted_path=`cygpath -d "$formatted_path"`
63             fi
64             if test $? -ne 0;  then
65                 AC_MSG_ERROR([path conversion failed for "$1".])
66             fi
67         fi
68         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
69         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
70         if test "$fp_count_slash$fp_count_colon" != "00"; then
71             if test "$fp_count_colon" = "0"; then
72                 new_formatted_path=`realpath "$formatted_path"`
73                 if test $? -ne 0;  then
74                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
75                 else
76                     formatted_path="$new_formatted_path"
77                 fi
78             fi
79             formatted_path=`cygpath -m "$formatted_path"`
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84     fi
87 AbsolutePath()
89     # There appears to be no simple and portable method to get an absolute and
90     # canonical path, so we try creating the directory if does not exist and
91     # utilizing the shell and pwd.
92     rel="$1"
93     absolute_path=""
94     test ! -e "$rel" && mkdir -p "$rel"
95     if test -d "$rel" ; then
96         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
97         absolute_path="$(pwd)"
98         cd - > /dev/null
99     else
100         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
101     fi
104 rm -f warn
105 have_WARNINGS="no"
106 add_warning()
108     if test "$have_WARNINGS" = "no"; then
109         echo "*************************************" > warn
110         have_WARNINGS="yes"
111         if which tput >/dev/null 2>/dev/null && test `tput colors` -ge 8; then
112             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
113             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
114         else
115             COLORWARN="* WARNING :"
116         fi
117     fi
118     echo "$COLORWARN $@" >> warn
121 dnl Some Mac User have the bad habbit of letting a lot fo crap
122 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
123 dnl that confuse the build.
124 dnl For the ones that use LODE, let's be nice and protect them
125 dnl from themselves
127 mac_sanitize_path()
129     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
130 dnl a common but nevertheless necessary thing that may be in a fancy
131 dnl path location is git, so make sure we have it
132     mac_git_path=`which git 2>/dev/null`
133     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
134         mac_path="$mac_path:`dirname $mac_git_path`"
135     fi
136 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
137 dnl path location is gpg, so make sure we find it
138     mac_gpg_path=`which gpg 2>/dev/null`
139     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
140         mac_path="$mac_path:`dirname $mac_gpg_path`"
141     fi
142     PATH="$mac_path"
143     unset mac_path
144     unset mac_git_path
145     unset mac_gpg_path
148 echo "********************************************************************"
149 echo "*"
150 echo "*   Running ${PACKAGE_NAME} build configuration."
151 echo "*"
152 echo "********************************************************************"
153 echo ""
155 dnl ===================================================================
156 dnl checks build and host OSes
157 dnl do this before argument processing to allow for platform dependent defaults
158 dnl ===================================================================
159 AC_CANONICAL_HOST
161 AC_MSG_CHECKING([for product name])
162 PRODUCTNAME="AC_PACKAGE_NAME"
163 if test -n "$with_product_name" -a "$with_product_name" != no; then
164     PRODUCTNAME="$with_product_name"
166 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
167     PRODUCTNAME="${PRODUCTNAME}Dev"
169 AC_MSG_RESULT([$PRODUCTNAME])
170 AC_SUBST(PRODUCTNAME)
171 PRODUCTNAME_WITHOUT_SPACES=${PRODUCTNAME// /}
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 15.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 15.x.*])
395         ;;
396     15.0.*|15.1.*)
397         ;;
398     *)
399         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only version 15.0.* and 15.1.* have been used successfully. Proceed at your own risk.])
400         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only version 15.0.* and 15.1.* 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         ANDROIDCFLAGS="-march=atom"
435     fi
437     case "$with_android_ndk_toolchain_version" in
438     clang5.0)
439         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
440         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION
441         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm
442         ;;
443     *)
444         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
445     esac
447     if test ! -d $ANDROID_BINUTILS_DIR; then
448         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
449     elif test ! -d $ANDROID_COMPILER_DIR; then
450         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
451     fi
453     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
454     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
455     # manage to link the (app-specific) single huge .so that is built for the app in
456     # android/source/ if there is debug information in a significant part of the object files.
457     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
458     # all objects have been built with debug information.)
459     case $build_os in
460     linux-gnu*)
461         ndk_build_os=linux
462         ;;
463     darwin*)
464         ndk_build_os=darwin
465         ;;
466     *)
467         AC_MSG_ERROR([We only support building for Android from Linux or OS X])
468         ;;
469     esac
470     ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
471     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
473     test -z "$SYSBASE" && SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
474     test -z "$AR" && AR=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ar
475     test -z "$NM" && NM=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-nm
476     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-objdump
477     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ranlib
478     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-strip
480     ANDROIDCFLAGS="$ANDROIDCFLAGS -gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT -target $LLVM_TRIPLE -no-canonical-prefixes"
481     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$SYSBASE -ffunction-sections -fdata-sections -Qunused-arguments"
482     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/$ANDROID_GCC_TOOLCHAIN_VERSION/libs/$ANDROID_APP_ABI"
483     if test "$ENABLE_LTO" = TRUE; then
484         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
485         # $CC and $CXX when building external libraries
486         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
487     fi
489     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/$ANDROID_GCC_TOOLCHAIN_VERSION/include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/$ANDROID_GCC_TOOLCHAIN_VERSION/libs/$ANDROID_APP_ABI/include -I$ANDROID_NDK_HOME/sources/cxx-stl/gabi++/include"
491     if test -z "$CC"; then
492         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
493     fi
494     if test -z "$CXX"; then
495         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
496     fi
498     # remember to download the ownCloud Android library later
499     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
501 AC_SUBST(ANDROID_NDK_HOME)
502 AC_SUBST(ANDROID_APP_ABI)
503 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
505 dnl ===================================================================
506 dnl --with-android-sdk
507 dnl ===================================================================
508 ANDROID_SDK_HOME=
509 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
510     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
512 if test -n "$with_android_sdk"; then
513     ANDROID_SDK_HOME=$with_android_sdk
514     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
516 AC_SUBST(ANDROID_SDK_HOME)
518 dnl ===================================================================
519 dnl The following is a list of supported systems.
520 dnl Sequential to keep the logic very simple
521 dnl These values may be checked and reset later.
522 dnl ===================================================================
523 #defaults unless the os test overrides this:
524 test_randr=yes
525 test_xrender=yes
526 test_cups=yes
527 test_dbus=yes
528 test_fontconfig=yes
529 test_cairo=no
531 # Default values, as such probably valid just for Linux, set
532 # differently below just for Mac OSX,but at least better than
533 # hardcoding these as we used to do. Much of this is duplicated also
534 # in solenv for old build system and for gbuild, ideally we should
535 # perhaps define stuff like this only here in configure.ac?
537 LINKFLAGSSHL="-shared"
538 PICSWITCH="-fpic"
539 DLLPOST=".so"
541 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
543 INSTROOTBASESUFFIX=
544 INSTROOTCONTENTSUFFIX=
545 SDKDIRNAME=sdk
547 case "$host_os" in
549 solaris*)
550     test_gtk=yes
551     build_gstreamer_1_0=yes
552     build_gstreamer_0_10=yes
553     test_freetype=yes
554     _os=SunOS
556     dnl ===========================================================
557     dnl Check whether we're using Solaris 10 - SPARC or Intel.
558     dnl ===========================================================
559     AC_MSG_CHECKING([the Solaris operating system release])
560     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
561     if test "$_os_release" -lt "10"; then
562         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
563     else
564         AC_MSG_RESULT([ok ($_os_release)])
565     fi
567     dnl Check whether we're using a SPARC or i386 processor
568     AC_MSG_CHECKING([the processor type])
569     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
570         AC_MSG_RESULT([ok ($host_cpu)])
571     else
572         AC_MSG_ERROR([only SPARC and i386 processors are supported])
573     fi
574     ;;
576 linux-gnu*|k*bsd*-gnu*)
577     test_gtk=yes
578     build_gstreamer_1_0=yes
579     build_gstreamer_0_10=yes
580     test_kde4=yes
581     test_qt5=yes
582     if test "$enable_fuzzers" != yes; then
583         test_freetype=yes
584         test_fontconfig=yes
585     else
586         test_freetype=no
587         test_fontconfig=no
588         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
589     fi
590     _os=Linux
591     ;;
593 gnu)
594     test_randr=no
595     test_xrender=no
596     _os=GNU
597      ;;
599 cygwin*|interix*)
601     # When building on Windows normally with MSVC under Cygwin,
602     # configure thinks that the host platform (the platform the
603     # built code will run on) is Cygwin, even if it obviously is
604     # Windows, which in Autoconf terminology is called
605     # "mingw32". (Which is misleading as MinGW is the name of the
606     # tool-chain, not an operating system.)
608     # Somewhat confusing, yes. But this configure script doesn't
609     # look at $host etc that much, it mostly uses its own $_os
610     # variable, set here in this case statement.
612     test_cups=no
613     test_dbus=no
614     test_randr=no
615     test_xrender=no
616     test_freetype=no
617     test_fontconfig=no
618     _os=WINNT
620     DLLPOST=".dll"
621     LINKFLAGSNOUNDEFS=
622     ;;
624 darwin*) # Mac OS X or iOS
625     test_gtk=yes
626     test_randr=no
627     test_xrender=no
628     test_freetype=no
629     test_fontconfig=no
630     test_dbus=no
631     if test -n "$LODE_HOME" ; then
632         mac_sanitize_path
633         AC_MSG_NOTICE([sanitized the PATH to $PATH])
634     fi
635     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
636         build_for_ios=YES
637         _os=iOS
638         test_gtk=no
639         test_cups=no
640         enable_mpl_subset=yes
641         enable_lotuswordpro=no
642         enable_coinmp=no
643         enable_lpsolve=no
644         enable_postgresql_sdbc=no
645         enable_extension_integration=no
646         enable_report_builder=no
647         with_theme="tango"
648         with_ppds=no
649         if test "$enable_ios_simulator" = "yes"; then
650             host=x86_64-apple-darwin
651         fi
652     else
653         _os=Darwin
654         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
655         INSTROOTCONTENTSUFFIX=/Contents
656         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
657     fi
658     enable_systray=no
659     # See comment above the case "$host_os"
660     LINKFLAGSSHL="-dynamiclib -single_module"
662     # -fPIC is default
663     PICSWITCH=""
665     DLLPOST=".dylib"
667     # -undefined error is the default
668     LINKFLAGSNOUNDEFS=""
671 freebsd*)
672     test_gtk=yes
673     build_gstreamer_1_0=yes
674     build_gstreamer_0_10=yes
675     test_kde4=yes
676     test_qt5=yes
677     test_freetype=yes
678     AC_MSG_CHECKING([the FreeBSD operating system release])
679     if test -n "$with_os_version"; then
680         OSVERSION="$with_os_version"
681     else
682         OSVERSION=`/sbin/sysctl -n kern.osreldate`
683     fi
684     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
685     AC_MSG_CHECKING([which thread library to use])
686     if test "$OSVERSION" -lt "500016"; then
687         PTHREAD_CFLAGS="-D_THREAD_SAFE"
688         PTHREAD_LIBS="-pthread"
689     elif test "$OSVERSION" -lt "502102"; then
690         PTHREAD_CFLAGS="-D_THREAD_SAFE"
691         PTHREAD_LIBS="-lc_r"
692     else
693         PTHREAD_CFLAGS=""
694         PTHREAD_LIBS="-pthread"
695     fi
696     AC_MSG_RESULT([$PTHREAD_LIBS])
697     _os=FreeBSD
698     ;;
700 *netbsd*)
701     test_gtk=yes
702     build_gstreamer_1_0=yes
703     build_gstreamer_0_10=yes
704     test_kde4=yes
705     test_qt5=yes
706     test_freetype=yes
707     PTHREAD_LIBS="-pthread -lpthread"
708     _os=NetBSD
709     ;;
711 aix*)
712     test_randr=no
713     test_freetype=yes
714     PTHREAD_LIBS=-pthread
715     _os=AIX
716     ;;
718 openbsd*)
719     test_gtk=yes
720     test_freetype=yes
721     PTHREAD_CFLAGS="-D_THREAD_SAFE"
722     PTHREAD_LIBS="-pthread"
723     _os=OpenBSD
724     ;;
726 dragonfly*)
727     test_gtk=yes
728     build_gstreamer_1_0=yes
729     build_gstreamer_0_10=yes
730     test_kde4=yes
731     test_qt5=yes
732     test_freetype=yes
733     PTHREAD_LIBS="-pthread"
734     _os=DragonFly
735     ;;
737 linux-android*)
738     build_gstreamer_1_0=no
739     build_gstreamer_0_10=no
740     enable_lotuswordpro=no
741     enable_mpl_subset=yes
742     enable_coinmp=yes
743     enable_lpsolve=no
744     enable_report_builder=no
745     enable_odk=no
746     enable_postgresql_sdbc=no
747     enable_python=no
748     with_theme="tango"
749     test_cups=no
750     test_dbus=no
751     test_fontconfig=no
752     test_freetype=no
753     test_gtk=no
754     test_kde4=no
755     test_qt5=no
756     test_randr=no
757     test_xrender=no
758     _os=Android
760     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
761     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
762     ;;
765     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
766     ;;
767 esac
769 if test "$_os" = "Android" ; then
770     # Verify that the NDK and SDK options are proper
771     if test -z "$with_android_ndk"; then
772         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
773     elif test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
774         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
775     fi
777     if test -z "$ANDROID_SDK_HOME"; then
778         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
779     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
780         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
781     fi
783     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
784     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
785         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
786                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
787                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
788         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
789         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
790         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
791     fi
792     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
793         AC_MSG_WARN([android support repository not found - install with
794                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
795                      to allow the build to download the specified version of the android support libraries])
796         add_warning "android support repository not found - install with"
797         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
798         add_warning "to allow the build to download the specified version of the android support libraries"
799     fi
802 if test "$_os" = "AIX"; then
803     AC_PATH_PROG(GAWK, gawk)
804     if test -z "$GAWK"; then
805         AC_MSG_ERROR([gawk not found in \$PATH])
806     fi
809 AC_SUBST(SDKDIRNAME)
811 AC_SUBST(PTHREAD_CFLAGS)
812 AC_SUBST(PTHREAD_LIBS)
814 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
815 # By default use the ones specified by our build system,
816 # but explicit override is possible.
817 AC_MSG_CHECKING(for explicit AFLAGS)
818 if test -n "$AFLAGS"; then
819     AC_MSG_RESULT([$AFLAGS])
820     x_AFLAGS=
821 else
822     AC_MSG_RESULT(no)
823     x_AFLAGS=[\#]
825 AC_MSG_CHECKING(for explicit CFLAGS)
826 if test -n "$CFLAGS"; then
827     AC_MSG_RESULT([$CFLAGS])
828     x_CFLAGS=
829 else
830     AC_MSG_RESULT(no)
831     x_CFLAGS=[\#]
833 AC_MSG_CHECKING(for explicit CXXFLAGS)
834 if test -n "$CXXFLAGS"; then
835     AC_MSG_RESULT([$CXXFLAGS])
836     x_CXXFLAGS=
837 else
838     AC_MSG_RESULT(no)
839     x_CXXFLAGS=[\#]
841 AC_MSG_CHECKING(for explicit OBJCFLAGS)
842 if test -n "$OBJCFLAGS"; then
843     AC_MSG_RESULT([$OBJCFLAGS])
844     x_OBJCFLAGS=
845 else
846     AC_MSG_RESULT(no)
847     x_OBJCFLAGS=[\#]
849 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
850 if test -n "$OBJCXXFLAGS"; then
851     AC_MSG_RESULT([$OBJCXXFLAGS])
852     x_OBJCXXFLAGS=
853 else
854     AC_MSG_RESULT(no)
855     x_OBJCXXFLAGS=[\#]
857 AC_MSG_CHECKING(for explicit LDFLAGS)
858 if test -n "$LDFLAGS"; then
859     AC_MSG_RESULT([$LDFLAGS])
860     x_LDFLAGS=
861 else
862     AC_MSG_RESULT(no)
863     x_LDFLAGS=[\#]
865 AC_SUBST(AFLAGS)
866 AC_SUBST(CFLAGS)
867 AC_SUBST(CXXFLAGS)
868 AC_SUBST(OBJCFLAGS)
869 AC_SUBST(OBJCXXFLAGS)
870 AC_SUBST(LDFLAGS)
871 AC_SUBST(x_AFLAGS)
872 AC_SUBST(x_CFLAGS)
873 AC_SUBST(x_CXXFLAGS)
874 AC_SUBST(x_OBJCFLAGS)
875 AC_SUBST(x_OBJCXXFLAGS)
876 AC_SUBST(x_LDFLAGS)
878 dnl These are potentially set for MSVC, in the code checking for UCRT below:
879 my_original_CFLAGS=$CFLAGS
880 my_original_CXXFLAGS=$CXXFLAGS
881 my_original_CPPFLAGS=$CPPFLAGS
883 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
884 dnl Needs to precede the AC_SEARCH_LIBS call below, which apparently calls
885 dnl AC_PROG_CC internally.
886 if test "$_os" != "WINNT"; then
887     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
888     save_CFLAGS=$CFLAGS
889     AC_PROG_CC
890     CFLAGS=$save_CFLAGS
893 if test $_os != "WINNT"; then
894     save_LIBS="$LIBS"
895     AC_SEARCH_LIBS([dlsym], [dl],
896         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
897         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
898     LIBS="$save_LIBS"
900 AC_SUBST(DLOPEN_LIBS)
902 ###############################################################################
903 # Extensions switches --enable/--disable
904 ###############################################################################
905 # By default these should be enabled unless having extra dependencies.
906 # If there is extra dependency over configure options then the enable should
907 # be automagic based on whether the requiring feature is enabled or not.
908 # All this options change anything only with --enable-extension-integration.
910 # The name of this option and its help string makes it sound as if
911 # extensions are built anyway, just not integrated in the installer,
912 # if you use --disable-extension-integration. Is that really the
913 # case?
915 AC_ARG_ENABLE(ios-simulator,
916     AS_HELP_STRING([--enable-ios-simulator],
917         [build i386 or x86_64 for ios simulator])
920 libo_FUZZ_ARG_ENABLE(extension-integration,
921     AS_HELP_STRING([--disable-extension-integration],
922         [Disable integration of the built extensions in the installer of the
923          product. Use this switch to disable the integration.])
926 AC_ARG_ENABLE(avmedia,
927     AS_HELP_STRING([--disable-avmedia],
928         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
931 AC_ARG_ENABLE(database-connectivity,
932     AS_HELP_STRING([--disable-database-connectivity],
933         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
936 # This doesn't mean not building (or "integrating") extensions
937 # (although it probably should; i.e. it should imply
938 # --disable-extension-integration I guess), it means not supporting
939 # any extension mechanism at all
940 libo_FUZZ_ARG_ENABLE(extensions,
941     AS_HELP_STRING([--disable-extensions],
942         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
945 AC_ARG_ENABLE(scripting,
946     AS_HELP_STRING([--disable-scripting],
947         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
950 # This is mainly for Android and iOS, but could potentially be used in some
951 # special case otherwise, too, so factored out as a separate setting
953 AC_ARG_ENABLE(dynamic-loading,
954     AS_HELP_STRING([--disable-dynamic-loading],
955         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
958 libo_FUZZ_ARG_ENABLE(ext-mariadb-connector,
959     AS_HELP_STRING([--enable-ext-mariadb-connector],
960         [Enable the build of the MariaDB/MySQL Connector extension.])
963 libo_FUZZ_ARG_ENABLE(report-builder,
964     AS_HELP_STRING([--disable-report-builder],
965         [Disable the Report Builder.])
968 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
969     AS_HELP_STRING([--enable-ext-wiki-publisher],
970         [Enable the Wiki Publisher extension.])
973 libo_FUZZ_ARG_ENABLE(lpsolve,
974     AS_HELP_STRING([--disable-lpsolve],
975         [Disable compilation of the lp solve solver ])
977 libo_FUZZ_ARG_ENABLE(coinmp,
978     AS_HELP_STRING([--disable-coinmp],
979         [Disable compilation of the CoinMP solver ])
982 libo_FUZZ_ARG_ENABLE(pdfimport,
983     AS_HELP_STRING([--disable-pdfimport],
984         [Disable building the PDF import feature.])
987 libo_FUZZ_ARG_ENABLE(pdfium,
988     AS_HELP_STRING([--disable-pdfium],
989         [Disable building PDFium.])
992 ###############################################################################
994 dnl ---------- *** ----------
996 libo_FUZZ_ARG_ENABLE(mergelibs,
997     AS_HELP_STRING([--enable-mergelibs],
998         [Merge several of the smaller libraries into one big, "merged", one.])
1001 libo_FUZZ_ARG_ENABLE(breakpad,
1002     AS_HELP_STRING([--enable-breakpad],
1003         [Enables breakpad for crash reporting.])
1006 AC_ARG_ENABLE(fetch-external,
1007     AS_HELP_STRING([--disable-fetch-external],
1008         [Disables fetching external tarballs from web sources.])
1011 AC_ARG_ENABLE(fuzzers,
1012     AS_HELP_STRING([--enable-fuzzers],
1013         [Enables building libfuzzer targets for fuzz testing.])
1016 libo_FUZZ_ARG_ENABLE(pch,
1017     AS_HELP_STRING([--enable-pch],
1018         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1021 libo_FUZZ_ARG_ENABLE(epm,
1022     AS_HELP_STRING([--enable-epm],
1023         [LibreOffice includes self-packaging code, that requires epm, however epm is
1024          useless for large scale package building.])
1027 libo_FUZZ_ARG_ENABLE(odk,
1028     AS_HELP_STRING([--disable-odk],
1029         [LibreOffice includes an ODK, office development kit which some packagers may
1030          wish to build without.])
1033 AC_ARG_ENABLE(mpl-subset,
1034     AS_HELP_STRING([--enable-mpl-subset],
1035         [Don't compile any pieces which are not MPL or more liberally licensed])
1038 libo_FUZZ_ARG_ENABLE(evolution2,
1039     AS_HELP_STRING([--enable-evolution2],
1040         [Allows the built-in evolution 2 addressbook connectivity build to be
1041          enabled.])
1044 AC_ARG_ENABLE(avahi,
1045     AS_HELP_STRING([--enable-avahi],
1046         [Determines whether to use Avahi to advertise Impress to remote controls.])
1049 libo_FUZZ_ARG_ENABLE(werror,
1050     AS_HELP_STRING([--enable-werror],
1051         [Turn warnings to errors. (Has no effect in modules where the treating
1052          of warnings as errors is disabled explicitly.)]),
1055 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1056     AS_HELP_STRING([--enable-assert-always-abort],
1057         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1060 libo_FUZZ_ARG_ENABLE(dbgutil,
1061     AS_HELP_STRING([--enable-dbgutil],
1062         [Provide debugging support from --enable-debug and include additional debugging
1063          utilities such as object counting or more expensive checks.
1064          This is the recommended option for developers.
1065          Note that this makes the build ABI incompatible, it is not possible to mix object
1066          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1068 libo_FUZZ_ARG_ENABLE(debug,
1069     AS_HELP_STRING([--enable-debug],
1070         [Include debugging information, disable compiler optimization and inlining plus
1071          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1073 libo_FUZZ_ARG_ENABLE(sal-log,
1074     AS_HELP_STRING([--enable-sal-log],
1075         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1077 AC_ARG_ENABLE(selective-debuginfo,
1078     AS_HELP_STRING([--enable-selective-debuginfo],
1079         [If --enable-debug or --enable-dbgutil is used, build debugging information
1080          (-g compiler flag) only for the specified gbuild build targets
1081          (where all means everything, - prepended means not to enable, / appended means
1082          everything in the directory; there is no ordering, more specific overrides
1083          more general, and disabling takes precedence).
1084          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1086 libo_FUZZ_ARG_ENABLE(symbols,
1087     AS_HELP_STRING([--enable-symbols],
1088         [Generate debug information.
1089          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1090          otherwise.]))
1092 libo_FUZZ_ARG_ENABLE(optimized,
1093     AS_HELP_STRING([--disable-optimized],
1094         [Whether to compile with optimization flags.
1095          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1096          otherwise.]))
1098 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1099     AS_HELP_STRING([--disable-runtime-optimizations],
1100         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1101          JVM JIT) that are known to interact badly with certain dynamic analysis
1102          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1103          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1104          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1106 AC_ARG_WITH(valgrind,
1107     AS_HELP_STRING([--with-valgrind],
1108         [Make availability of Valgrind headers a hard requirement.]))
1110 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1111     AS_HELP_STRING([--enable-compiler-plugins],
1112         [Enable compiler plugins that will perform additional checks during
1113          building. Enabled automatically by --enable-dbgutil.
1114          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1115 COMPILER_PLUGINS_DEBUG=
1116 if test "$enable_compiler_plugins" = debug; then
1117     enable_compiler_plugins=yes
1118     COMPILER_PLUGINS_DEBUG=TRUE
1121 libo_FUZZ_ARG_ENABLE(ooenv,
1122     AS_HELP_STRING([--disable-ooenv],
1123         [Disable ooenv for the instdir installation.]))
1125 AC_ARG_ENABLE(lto,
1126     AS_HELP_STRING([--enable-lto],
1127         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1128          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1129          linker. For MSVC, this option is broken at the moment. This is experimental work
1130          in progress that shouldn't be used unless you are working on it.)]))
1132 AC_ARG_ENABLE(python,
1133     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1134         [Enables or disables Python support at run-time and build-time.
1135          Also specifies what Python to use. 'auto' is the default.
1136          'fully-internal' even forces the internal version for uses of Python
1137          during the build.]))
1139 libo_FUZZ_ARG_ENABLE(gtk,
1140     AS_HELP_STRING([--disable-gtk],
1141         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1142 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1144 libo_FUZZ_ARG_ENABLE(gtk3,
1145     AS_HELP_STRING([--disable-gtk3],
1146         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1147 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1149 libo_FUZZ_ARG_ENABLE(systray,
1150     AS_HELP_STRING([--disable-systray],
1151         [Determines whether to build the systray quickstarter.]),
1152 ,test "${enable_systray+set}" = set || enable_systray=yes)
1154 AC_ARG_ENABLE(split-app-modules,
1155     AS_HELP_STRING([--enable-split-app-modules],
1156         [Split file lists for app modules, e.g. base, calc.
1157          Has effect only with make distro-pack-install]),
1160 AC_ARG_ENABLE(split-opt-features,
1161     AS_HELP_STRING([--enable-split-opt-features],
1162         [Split file lists for some optional features, e.g. pyuno, testtool.
1163          Has effect only with make distro-pack-install]),
1166 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1167     AS_HELP_STRING([--disable-cairo-canvas],
1168         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1171 libo_FUZZ_ARG_ENABLE(dbus,
1172     AS_HELP_STRING([--disable-dbus],
1173         [Determines whether to enable features that depend on dbus.
1174          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1175 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1177 libo_FUZZ_ARG_ENABLE(sdremote,
1178     AS_HELP_STRING([--disable-sdremote],
1179         [Determines whether to enable Impress remote control (i.e. the server component).]),
1180 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1182 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1183     AS_HELP_STRING([--disable-sdremote-bluetooth],
1184         [Determines whether to build sdremote with bluetooth support.
1185          Requires dbus on Linux.]))
1187 libo_FUZZ_ARG_ENABLE(gio,
1188     AS_HELP_STRING([--disable-gio],
1189         [Determines whether to use the GIO support.]),
1190 ,test "${enable_gio+set}" = set || enable_gio=yes)
1192 AC_ARG_ENABLE(kde4,
1193     AS_HELP_STRING([--enable-kde4],
1194         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1195          KDE4 are available.]),
1198 AC_ARG_ENABLE(qt5,
1199     AS_HELP_STRING([--enable-qt5],
1200         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1201          available.]),
1204 libo_FUZZ_ARG_ENABLE(gui,
1205     AS_HELP_STRING([--disable-gui],
1206         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1207          command-line option. Not related to LibreOffice Online functionality. Don't use
1208          unless you are certain you need to. Nobody will help you if you insist on trying
1209          this and run into problems.]),
1210 ,test "${enable_gui+set}" = set || enable_gui=yes)
1212 libo_FUZZ_ARG_ENABLE(randr,
1213     AS_HELP_STRING([--disable-randr],
1214         [Disable RandR support in the vcl project.]),
1215 ,test "${enable_randr+set}" = set || enable_randr=yes)
1217 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1218     AS_HELP_STRING([--disable-gstreamer-1-0],
1219         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1220 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1222 AC_ARG_ENABLE(gstreamer-0-10,
1223     AS_HELP_STRING([--enable-gstreamer-0-10],
1224         [Enable building with the gstreamer 0.10 avmedia backend.]),
1225 ,enable_gstreamer_0_10=no)
1227 libo_FUZZ_ARG_ENABLE(vlc,
1228     AS_HELP_STRING([--enable-vlc],
1229         [Enable building with the (experimental) VLC avmedia backend.]),
1230 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1232 libo_FUZZ_ARG_ENABLE(neon,
1233     AS_HELP_STRING([--disable-neon],
1234         [Disable neon and the compilation of webdav binding.]),
1237 libo_FUZZ_ARG_ENABLE([eot],
1238     [AS_HELP_STRING([--enable-eot],
1239         [Enable support for Embedded OpenType fonts.])],
1240 ,test "${enable_eot+set}" = set || enable_eot=no)
1242 libo_FUZZ_ARG_ENABLE(cve-tests,
1243     AS_HELP_STRING([--disable-cve-tests],
1244         [Prevent CVE tests to be executed]),
1247 libo_FUZZ_ARG_ENABLE(chart-tests,
1248     AS_HELP_STRING([--enable-chart-tests],
1249         [Executes chart XShape tests. In a perfect world these tests would be
1250          stable and everyone could run them, in reality it is best to run them
1251          only on a few machines that are known to work and maintained by people
1252          who can judge if a test failure is a regression or not.]),
1255 AC_ARG_ENABLE(build-unowinreg,
1256     AS_HELP_STRING([--enable-build-unowinreg],
1257         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1258          compiler is needed on Linux.]),
1261 AC_ARG_ENABLE(dependency-tracking,
1262     AS_HELP_STRING([--enable-dependency-tracking],
1263         [Do not reject slow dependency extractors.])[
1264   --disable-dependency-tracking
1265                           Disables generation of dependency information.
1266                           Speed up one-time builds.],
1269 AC_ARG_ENABLE(icecream,
1270     AS_HELP_STRING([--enable-icecream],
1271         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1272          It defaults to /opt/icecream for the location of the icecream gcc/g++
1273          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1276 libo_FUZZ_ARG_ENABLE(cups,
1277     AS_HELP_STRING([--disable-cups],
1278         [Do not build cups support.])
1281 AC_ARG_ENABLE(ccache,
1282     AS_HELP_STRING([--disable-ccache],
1283         [Do not try to use ccache automatically.
1284          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1285          CC/CXX are not yet set, and --enable-icecream is not given, we
1286          attempt to use ccache. --disable-ccache disables ccache completely.
1290 AC_ARG_ENABLE(64-bit,
1291     AS_HELP_STRING([--enable-64-bit],
1292         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1293          At the moment meaningful only for Windows.]), ,)
1295 libo_FUZZ_ARG_ENABLE(online-update,
1296     AS_HELP_STRING([--enable-online-update],
1297         [Enable the online update service that will check for new versions of
1298          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1299          If the value is "mar", the experimental Mozilla-like update will be
1300          enabled instead of the traditional update mechanism.]),
1303 AC_ARG_WITH(update-config,
1304     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1305                    [Path to the update config ini file]))
1307 libo_FUZZ_ARG_ENABLE(extension-update,
1308     AS_HELP_STRING([--disable-extension-update],
1309         [Disable possibility to update installed extensions.]),
1312 libo_FUZZ_ARG_ENABLE(release-build,
1313     AS_HELP_STRING([--enable-release-build],
1314         [Enable release build. Note that the "release build" choice is orthogonal to
1315          whether symbols are present, debug info is generated, or optimization
1316          is done.
1317          See http://wiki.documentfoundation.org/Development/DevBuild]),
1320 AC_ARG_ENABLE(windows-build-signing,
1321     AS_HELP_STRING([--enable-windows-build-signing],
1322         [Enable signing of windows binaries (*.exe, *.dll)]),
1325 AC_ARG_ENABLE(silent-msi,
1326     AS_HELP_STRING([--enable-silent-msi],
1327         [Enable MSI with LIMITUI=1 (silent install).]),
1330 AC_ARG_ENABLE(macosx-code-signing,
1331     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1332         [Sign executables, dylibs, frameworks and the app bundle. If you
1333          don't provide an identity the first suitable certificate
1334          in your keychain is used.]),
1337 AC_ARG_ENABLE(macosx-package-signing,
1338     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1339         [Create a .pkg suitable for uploading to the Mac App Store and sign
1340          it. If you don't provide an identity the first suitable certificate
1341          in your keychain is used.]),
1344 AC_ARG_ENABLE(macosx-sandbox,
1345     AS_HELP_STRING([--enable-macosx-sandbox],
1346         [Make the app bundle run in a sandbox. Requires code signing.
1347          Is required by apps distributed in the Mac App Store, and implies
1348          adherence to App Store rules.]),
1351 AC_ARG_WITH(macosx-bundle-identifier,
1352     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1353         [Define the OS X bundle identifier. Default is the somewhat weird
1354          org.libreoffice.script ("script", huh?).]),
1355 ,with_macosx_bundle_identifier=org.libreoffice.script)
1357 AC_ARG_WITH(product-name,
1358     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1359         [Define the product name. Default is AC_PACKAGE_NAME.]),
1360 ,with_product_name=$PRODUCTNAME)
1362 AC_ARG_WITH(package-version,
1363     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1364         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1367 libo_FUZZ_ARG_ENABLE(readonly-installset,
1368     AS_HELP_STRING([--enable-readonly-installset],
1369         [Prevents any attempts by LibreOffice to write into its installation. That means
1370          at least that no "system-wide" extensions can be added. Experimental work in
1371          progress.]),
1374 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1375     AS_HELP_STRING([--disable-postgresql-sdbc],
1376         [Disable the build of the PostgreSQL-SDBC driver.])
1379 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1380     AS_HELP_STRING([--disable-lotuswordpro],
1381         [Disable the build of the Lotus Word Pro filter.]),
1382 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1384 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1385     AS_HELP_STRING([--disable-firebird-sdbc],
1386         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1387 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1389 AC_ARG_ENABLE(bogus-pkg-config,
1390     AS_HELP_STRING([--enable-bogus-pkg-config],
1391         [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.]),
1394 AC_ARG_ENABLE(openssl,
1395     AS_HELP_STRING([--disable-openssl],
1396         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1397          components will either use GNUTLS or NSS. Work in progress,
1398          use only if you are hacking on it.]),
1399 ,enable_openssl=yes)
1401 AC_ARG_ENABLE(library-bin-tar,
1402     AS_HELP_STRING([--enable-library-bin-tar],
1403         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1404         Some libraries can save their build result in a tarball
1405         stored in TARFILE_LOCATION. That binary tarball is
1406         uniquely identified by the source tarball,
1407         the content of the config_host.mk file and the content
1408         of the top-level directory in core for that library
1409         If this option is enabled, then if such a tarfile exist, it will be untarred
1410         instead of the source tarfile, and the build step will be skipped for that
1411         library.
1412         If a proper tarfile does not exist, then the normal source-based
1413         build is done for that library and a proper binary tarfile is created
1414         for the next time.]),
1417 AC_ARG_ENABLE(dconf,
1418     AS_HELP_STRING([--disable-dconf],
1419         [Disable the dconf configuration backend (enabled by default where
1420          available).]))
1422 libo_FUZZ_ARG_ENABLE(formula-logger,
1423     AS_HELP_STRING(
1424         [--enable-formula-logger],
1425         [Enable formula logger for logging formula calculation flow in Calc.]
1426     )
1429 dnl ===================================================================
1430 dnl Optional Packages (--with/without-)
1431 dnl ===================================================================
1433 AC_ARG_WITH(gcc-home,
1434     AS_HELP_STRING([--with-gcc-home],
1435         [Specify the location of gcc/g++ manually. This can be used in conjunction
1436          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1437          non-default path.]),
1440 AC_ARG_WITH(gnu-patch,
1441     AS_HELP_STRING([--with-gnu-patch],
1442         [Specify location of GNU patch on Solaris or FreeBSD.]),
1445 AC_ARG_WITH(build-platform-configure-options,
1446     AS_HELP_STRING([--with-build-platform-configure-options],
1447         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1450 AC_ARG_WITH(gnu-cp,
1451     AS_HELP_STRING([--with-gnu-cp],
1452         [Specify location of GNU cp on Solaris or FreeBSD.]),
1455 AC_ARG_WITH(external-tar,
1456     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1457         [Specify an absolute path of where to find (and store) tarfiles.]),
1458     TARFILE_LOCATION=$withval ,
1461 AC_ARG_WITH(referenced-git,
1462     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1463         [Specify another checkout directory to reference. This makes use of
1464                  git submodule update --reference, and saves a lot of diskspace
1465                  when having multiple trees side-by-side.]),
1466     GIT_REFERENCE_SRC=$withval ,
1469 AC_ARG_WITH(linked-git,
1470     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1471         [Specify a directory where the repositories of submodules are located.
1472          This uses a method similar to git-new-workdir to get submodules.]),
1473     GIT_LINK_SRC=$withval ,
1476 AC_ARG_WITH(galleries,
1477     AS_HELP_STRING([--with-galleries],
1478         [Specify how galleries should be built. It is possible either to
1479          build these internally from source ("build"),
1480          or to disable them ("no")]),
1483 AC_ARG_WITH(theme,
1484     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1485         [Choose which themes to include. By default those themes with an '*' are included.
1486          Possible choices: *breeze, *breeze_dark, crystal, *elementary, *galaxy, *hicontrast, oxygen, *sifr, *sifr_dark, *tango, tango_testing.]),
1489 libo_FUZZ_ARG_WITH(helppack-integration,
1490     AS_HELP_STRING([--without-helppack-integration],
1491         [It will not integrate the helppacks to the installer
1492          of the product. Please use this switch to use the online help
1493          or separate help packages.]),
1496 libo_FUZZ_ARG_WITH(fonts,
1497     AS_HELP_STRING([--without-fonts],
1498         [LibreOffice includes some third-party fonts to provide a reliable basis for
1499          help content, templates, samples, etc. When these fonts are already
1500          known to be available on the system then you should use this option.]),
1503 AC_ARG_WITH(epm,
1504     AS_HELP_STRING([--with-epm],
1505         [Decides which epm to use. Default is to use the one from the system if
1506          one is built. When either this is not there or you say =internal epm
1507          will be built.]),
1510 AC_ARG_WITH(package-format,
1511     AS_HELP_STRING([--with-package-format],
1512         [Specify package format(s) for LibreOffice installation sets. The
1513          implicit --without-package-format leads to no installation sets being
1514          generated. Possible values: aix, archive, bsd, deb, dmg,
1515          installed, msi, pkg, and rpm.
1516          Example: --with-package-format='deb rpm']),
1519 AC_ARG_WITH(tls,
1520     AS_HELP_STRING([--with-tls],
1521         [Decides which TLS/SSL and cryptographic implementations to use for
1522          LibreOffice's code. Notice that this doesn't apply for depending
1523          libraries like "neon", for example. Default is to use OpenSSL
1524          although NSS is also possible. Notice that selecting NSS restricts
1525          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1526          restrict by now the usage of NSS in LO's code. Possible values:
1527          openssl, nss. Example: --with-tls="nss"]),
1530 AC_ARG_WITH(system-libs,
1531     AS_HELP_STRING([--with-system-libs],
1532         [Use libraries already on system -- enables all --with-system-* flags.]),
1535 AC_ARG_WITH(system-bzip2,
1536     AS_HELP_STRING([--with-system-bzip2],
1537         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1538     [with_system_bzip2="$with_system_libs"])
1540 AC_ARG_WITH(system-headers,
1541     AS_HELP_STRING([--with-system-headers],
1542         [Use headers already on system -- enables all --with-system-* flags for
1543          external packages whose headers are the only entities used i.e.
1544          boost/odbc/sane-header(s).]),,
1545     [with_system_headers="$with_system_libs"])
1547 AC_ARG_WITH(system-jars,
1548     AS_HELP_STRING([--without-system-jars],
1549         [When building with --with-system-libs, also the needed jars are expected
1550          on the system. Use this to disable that]),,
1551     [with_system_jars="$with_system_libs"])
1553 AC_ARG_WITH(system-cairo,
1554     AS_HELP_STRING([--with-system-cairo],
1555         [Use cairo libraries already on system.  Happens automatically for
1556          (implicit) --enable-gtk and for --enable-gtk3.]))
1558 AC_ARG_WITH(system-epoxy,
1559     AS_HELP_STRING([--with-system-epoxy],
1560         [Use epoxy libraries already on system.  Happens automatically for
1561          --enable-gtk3.]),,
1562        [with_system_epoxy="$with_system_libs"])
1564 AC_ARG_WITH(myspell-dicts,
1565     AS_HELP_STRING([--with-myspell-dicts],
1566         [Adds myspell dictionaries to the LibreOffice installation set]),
1569 AC_ARG_WITH(system-dicts,
1570     AS_HELP_STRING([--without-system-dicts],
1571         [Do not use dictionaries from system paths.]),
1574 AC_ARG_WITH(external-dict-dir,
1575     AS_HELP_STRING([--with-external-dict-dir],
1576         [Specify external dictionary dir.]),
1579 AC_ARG_WITH(external-hyph-dir,
1580     AS_HELP_STRING([--with-external-hyph-dir],
1581         [Specify external hyphenation pattern dir.]),
1584 AC_ARG_WITH(external-thes-dir,
1585     AS_HELP_STRING([--with-external-thes-dir],
1586         [Specify external thesaurus dir.]),
1589 AC_ARG_WITH(system-zlib,
1590     AS_HELP_STRING([--with-system-zlib],
1591         [Use zlib already on system.]),,
1592     [with_system_zlib=auto])
1594 AC_ARG_WITH(system-jpeg,
1595     AS_HELP_STRING([--with-system-jpeg],
1596         [Use jpeg already on system.]),,
1597     [with_system_jpeg="$with_system_libs"])
1599 AC_ARG_WITH(system-clucene,
1600     AS_HELP_STRING([--with-system-clucene],
1601         [Use clucene already on system.]),,
1602     [with_system_clucene="$with_system_libs"])
1604 AC_ARG_WITH(system-expat,
1605     AS_HELP_STRING([--with-system-expat],
1606         [Use expat already on system.]),,
1607     [with_system_expat="$with_system_libs"])
1609 AC_ARG_WITH(system-libxml,
1610     AS_HELP_STRING([--with-system-libxml],
1611         [Use libxml/libxslt already on system.]),,
1612     [with_system_libxml=auto])
1614 AC_ARG_WITH(system-icu,
1615     AS_HELP_STRING([--with-system-icu],
1616         [Use icu already on system.]),,
1617     [with_system_icu="$with_system_libs"])
1619 AC_ARG_WITH(system-ucpp,
1620     AS_HELP_STRING([--with-system-ucpp],
1621         [Use ucpp already on system.]),,
1622     [])
1624 AC_ARG_WITH(system-openldap,
1625     AS_HELP_STRING([--with-system-openldap],
1626         [Use the OpenLDAP LDAP SDK already on system.]),,
1627     [with_system_openldap="$with_system_libs"])
1629 AC_ARG_WITH(system-poppler,
1630     AS_HELP_STRING([--with-system-poppler],
1631         [Use system poppler (only needed for PDF import).]),,
1632     [with_system_poppler="$with_system_libs"])
1634 AC_ARG_WITH(system-gpgmepp,
1635     AS_HELP_STRING([--with-system-gpgmepp],
1636         [Use gpgmepp already on system]),,
1637     [with_system_gpgmepp="$with_system_libs"])
1639 AC_ARG_WITH(system-apache-commons,
1640     AS_HELP_STRING([--with-system-apache-commons],
1641         [Use Apache commons libraries already on system.]),,
1642     [with_system_apache_commons="$with_system_jars"])
1644 AC_ARG_WITH(system-mariadb,
1645     AS_HELP_STRING([--with-system-mariadb],
1646         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1647          extension.]),,
1648     [with_system_mariadb="$with_system_libs"])
1650 AC_ARG_ENABLE(bundle-mariadb,
1651     AS_HELP_STRING([--enable-bundle-mariadb],
1652         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1655 AC_ARG_WITH(system-mysql-cppconn,
1656     AS_HELP_STRING([--with-system-mysql-cppconn],
1657         [Use MySQL C++ Connector libraries already on system.]),,
1658     [with_system_mysql_cppconn="$with_system_libs"])
1660 AC_ARG_WITH(system-postgresql,
1661     AS_HELP_STRING([--with-system-postgresql],
1662         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1663          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1664     [with_system_postgresql="$with_system_libs"])
1666 AC_ARG_WITH(libpq-path,
1667     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1668         [Use this PostgreSQL C interface (libpq) installation for building
1669          the PostgreSQL-SDBC extension.]),
1672 AC_ARG_WITH(system-firebird,
1673     AS_HELP_STRING([--with-system-firebird],
1674         [Use Firebird libraries already on system, for building the Firebird-SDBC
1675          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1676     [with_system_firebird="$with_system_libs"])
1678 AC_ARG_WITH(system-libtommath,
1679             AS_HELP_STRING([--with-system-libtommath],
1680                            [Use libtommath already on system]),,
1681             [with_system_libtommath="$with_system_libs"])
1683 AC_ARG_WITH(system-hsqldb,
1684     AS_HELP_STRING([--with-system-hsqldb],
1685         [Use hsqldb already on system.]))
1687 AC_ARG_WITH(hsqldb-jar,
1688     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1689         [Specify path to jarfile manually.]),
1690     HSQLDB_JAR=$withval)
1692 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1693     AS_HELP_STRING([--disable-scripting-beanshell],
1694         [Disable support for scripts in BeanShell.]),
1698 AC_ARG_WITH(system-beanshell,
1699     AS_HELP_STRING([--with-system-beanshell],
1700         [Use beanshell already on system.]),,
1701     [with_system_beanshell="$with_system_jars"])
1703 AC_ARG_WITH(beanshell-jar,
1704     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1705         [Specify path to jarfile manually.]),
1706     BSH_JAR=$withval)
1708 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1709     AS_HELP_STRING([--disable-scripting-javascript],
1710         [Disable support for scripts in JavaScript.]),
1714 AC_ARG_WITH(system-rhino,
1715     AS_HELP_STRING([--with-system-rhino],
1716         [Use rhino already on system.]),,)
1717 #    [with_system_rhino="$with_system_jars"])
1718 # Above is not used as we have different debug interface
1719 # patched into internal rhino. This code needs to be fixed
1720 # before we can enable it by default.
1722 AC_ARG_WITH(rhino-jar,
1723     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1724         [Specify path to jarfile manually.]),
1725     RHINO_JAR=$withval)
1727 AC_ARG_WITH(commons-logging-jar,
1728     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1729         [Specify path to jarfile manually.]),
1730     COMMONS_LOGGING_JAR=$withval)
1732 AC_ARG_WITH(system-jfreereport,
1733     AS_HELP_STRING([--with-system-jfreereport],
1734         [Use JFreeReport already on system.]),,
1735     [with_system_jfreereport="$with_system_jars"])
1737 AC_ARG_WITH(sac-jar,
1738     AS_HELP_STRING([--with-sac-jar=JARFILE],
1739         [Specify path to jarfile manually.]),
1740     SAC_JAR=$withval)
1742 AC_ARG_WITH(libxml-jar,
1743     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1744         [Specify path to jarfile manually.]),
1745     LIBXML_JAR=$withval)
1747 AC_ARG_WITH(flute-jar,
1748     AS_HELP_STRING([--with-flute-jar=JARFILE],
1749         [Specify path to jarfile manually.]),
1750     FLUTE_JAR=$withval)
1752 AC_ARG_WITH(jfreereport-jar,
1753     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1754         [Specify path to jarfile manually.]),
1755     JFREEREPORT_JAR=$withval)
1757 AC_ARG_WITH(liblayout-jar,
1758     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1759         [Specify path to jarfile manually.]),
1760     LIBLAYOUT_JAR=$withval)
1762 AC_ARG_WITH(libloader-jar,
1763     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1764         [Specify path to jarfile manually.]),
1765     LIBLOADER_JAR=$withval)
1767 AC_ARG_WITH(libformula-jar,
1768     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1769         [Specify path to jarfile manually.]),
1770     LIBFORMULA_JAR=$withval)
1772 AC_ARG_WITH(librepository-jar,
1773     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1774         [Specify path to jarfile manually.]),
1775     LIBREPOSITORY_JAR=$withval)
1777 AC_ARG_WITH(libfonts-jar,
1778     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1779         [Specify path to jarfile manually.]),
1780     LIBFONTS_JAR=$withval)
1782 AC_ARG_WITH(libserializer-jar,
1783     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1784         [Specify path to jarfile manually.]),
1785     LIBSERIALIZER_JAR=$withval)
1787 AC_ARG_WITH(libbase-jar,
1788     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1789         [Specify path to jarfile manually.]),
1790     LIBBASE_JAR=$withval)
1792 AC_ARG_WITH(system-odbc,
1793     AS_HELP_STRING([--with-system-odbc],
1794         [Use the odbc headers already on system.]),,
1795     [with_system_odbc="auto"])
1797 AC_ARG_WITH(system-sane,
1798     AS_HELP_STRING([--with-system-sane],
1799         [Use sane.h already on system.]),,
1800     [with_system_sane="$with_system_headers"])
1802 AC_ARG_WITH(system-bluez,
1803     AS_HELP_STRING([--with-system-bluez],
1804         [Use bluetooth.h already on system.]),,
1805     [with_system_bluez="$with_system_headers"])
1807 AC_ARG_WITH(system-curl,
1808     AS_HELP_STRING([--with-system-curl],
1809         [Use curl already on system.]),,
1810     [with_system_curl=auto])
1812 AC_ARG_WITH(system-boost,
1813     AS_HELP_STRING([--with-system-boost],
1814         [Use boost already on system.]),,
1815     [with_system_boost="$with_system_headers"])
1817 AC_ARG_WITH(system-glm,
1818     AS_HELP_STRING([--with-system-glm],
1819         [Use glm already on system.]),,
1820     [with_system_glm="$with_system_headers"])
1822 AC_ARG_WITH(system-hunspell,
1823     AS_HELP_STRING([--with-system-hunspell],
1824         [Use libhunspell already on system.]),,
1825     [with_system_hunspell="$with_system_libs"])
1827 AC_ARG_WITH(system-mythes,
1828     AS_HELP_STRING([--with-system-mythes],
1829         [Use mythes already on system.]),,
1830     [with_system_mythes="$with_system_libs"])
1832 AC_ARG_WITH(system-altlinuxhyph,
1833     AS_HELP_STRING([--with-system-altlinuxhyph],
1834         [Use ALTLinuxhyph already on system.]),,
1835     [with_system_altlinuxhyph="$with_system_libs"])
1837 AC_ARG_WITH(system-lpsolve,
1838     AS_HELP_STRING([--with-system-lpsolve],
1839         [Use lpsolve already on system.]),,
1840     [with_system_lpsolve="$with_system_libs"])
1842 AC_ARG_WITH(system-coinmp,
1843     AS_HELP_STRING([--with-system-coinmp],
1844         [Use CoinMP already on system.]),,
1845     [with_system_coinmp="$with_system_libs"])
1847 AC_ARG_WITH(system-liblangtag,
1848     AS_HELP_STRING([--with-system-liblangtag],
1849         [Use liblangtag library already on system.]),,
1850     [with_system_liblangtag="$with_system_libs"])
1852 AC_ARG_WITH(webdav,
1853     AS_HELP_STRING([--with-webdav],
1854         [Specify which library to use for webdav implementation.
1855          Possible values: "neon", "serf", "no". The default value is "neon".
1856          Example: --with-webdav="serf"]),
1857     WITH_WEBDAV=$withval,
1858     WITH_WEBDAV="neon")
1860 AC_ARG_WITH(linker-hash-style,
1861     AS_HELP_STRING([--with-linker-hash-style],
1862         [Use linker with --hash-style=<style> when linking shared objects.
1863          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1864          if supported on the build system, and "sysv" otherwise.]))
1866 AC_ARG_WITH(jdk-home,
1867     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1868         [If you have installed JDK 1.6 or later on your system please supply the
1869          path here. Note that this is not the location of the java command but the
1870          location of the entire distribution.]),
1873 AC_ARG_WITH(help,
1874     AS_HELP_STRING([--with-help],
1875         [Enable the build of help. There is a special parameter "common" that
1876          can be used to bundle only the common part, .e.g help-specific icons.
1877          This is useful when you build the helpcontent separately.])
1878     [
1879                           Usage:     --with-help    build the old local help
1880                                  --without-help     no local help (default)
1881                                  --with-help=html   build the new HTML local help
1882                                  --with-help=online build the new HTML online help
1883                                  --with-help=common bundle common files for the local
1884                                                     help but do not build the whole help
1885     ],
1888 libo_FUZZ_ARG_WITH(java,
1889     AS_HELP_STRING([--with-java=<java command>],
1890         [Specify the name of the Java interpreter command. Typically "java"
1891          which is the default.
1893          To build without support for Java components, applets, accessibility
1894          or the XML filters written in Java, use --without-java or --with-java=no.]),
1895     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1896     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
1899 AC_ARG_WITH(jvm-path,
1900     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
1901         [Use a specific JVM search path at runtime.
1902          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
1905 AC_ARG_WITH(ant-home,
1906     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
1907         [If you have installed Jakarta Ant on your system, please supply the path here.
1908          Note that this is not the location of the Ant binary but the location
1909          of the entire distribution.]),
1912 AC_ARG_WITH(symbol-config,
1913     AS_HELP_STRING([--with-symbol-config],
1914         [Configuration for the crashreport symbol upload]),
1915         [],
1916         [with_symbol_config=no])
1918 AC_ARG_WITH(export-validation,
1919     AS_HELP_STRING([--without-export-validation],
1920         [Disable validating OOXML and ODF files as exported from in-tree tests.
1921          Use this option e.g. if your system only provides Java 5.]),
1922 ,with_export_validation=auto)
1924 AC_ARG_WITH(bffvalidator,
1925     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
1926         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
1927          Requires installed Microsoft Office Binary File Format Validator.
1928          Note: export-validation (--with-export-validation) is required to be turned on.
1929          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
1930 ,with_bffvalidator=no)
1932 libo_FUZZ_ARG_WITH(junit,
1933     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
1934         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
1935          --without-junit disables those tests. Not relevant in the --without-java case.]),
1936 ,with_junit=yes)
1938 AC_ARG_WITH(hamcrest,
1939     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
1940         [Specifies the hamcrest jar file to use for JUnit-based tests.
1941          --without-junit disables those tests. Not relevant in the --without-java case.]),
1942 ,with_hamcrest=yes)
1944 AC_ARG_WITH(perl-home,
1945     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
1946         [If you have installed Perl 5 Distribution, on your system, please
1947          supply the path here. Note that this is not the location of the Perl
1948          binary but the location of the entire distribution.]),
1951 libo_FUZZ_ARG_WITH(doxygen,
1952     AS_HELP_STRING(
1953         [--with-doxygen=<absolute path to doxygen executable>],
1954         [Specifies the doxygen executable to use when generating ODK C/C++
1955          documentation. --without-doxygen disables generation of ODK C/C++
1956          documentation. Not relevant in the --disable-odk case.]),
1957 ,with_doxygen=yes)
1959 AC_ARG_WITH(visual-studio,
1960     AS_HELP_STRING([--with-visual-studio=<2015/2017>],
1961         [Specify which Visual Studio version to use in case several are
1962          installed. If not specified, defaults to 2015.]),
1965 AC_ARG_WITH(windows-sdk,
1966     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
1967         [Specify which Windows SDK, or "Windows Kit", version to use
1968          in case the one that came with the selected Visual Studio
1969          is not what you want for some reason. Note that not all compiler/SDK
1970          combinations are supported. The intent is that this option should not
1971          be needed.]),
1974 AC_ARG_WITH(lang,
1975     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
1976         [Use this option to build LibreOffice with additional UI language support.
1977          English (US) is always included by default.
1978          Separate multiple languages with space.
1979          For all languages, use --with-lang=ALL.]),
1982 AC_ARG_WITH(locales,
1983     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
1984         [Use this option to limit the locale information built in.
1985          Separate multiple locales with space.
1986          Very experimental and might well break stuff.
1987          Just a desperate measure to shrink code and data size.
1988          By default all the locales available is included.
1989          This option is completely unrelated to --with-lang.])
1990     [
1991                           Affects also our character encoding conversion
1992                           tables for encodings mainly targeted for a
1993                           particular locale, like EUC-CN and EUC-TW for
1994                           zh, ISO-2022-JP for ja.
1996                           Affects also our add-on break iterator data for
1997                           some languages.
1999                           For the default, all locales, don't use this switch at all.
2000                           Specifying just the language part of a locale means all matching
2001                           locales will be included.
2002     ],
2005 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2006 libo_FUZZ_ARG_WITH(krb5,
2007     AS_HELP_STRING([--with-krb5],
2008         [Enable MIT Kerberos 5 support in modules that support it.
2009          By default automatically enabled on platforms
2010          where a good system Kerberos 5 is available.]),
2013 libo_FUZZ_ARG_WITH(gssapi,
2014     AS_HELP_STRING([--with-gssapi],
2015         [Enable GSSAPI support in modules that support it.
2016          By default automatically enabled on platforms
2017          where a good system GSSAPI is available.]),
2020 AC_ARG_WITH(iwyu,
2021     AS_HELP_STRING([--with-iwyu],
2022         [Use given IWYU binary path to check unneeded includes instead of building.
2023          Use only if you are hacking on it.]),
2026 dnl ===================================================================
2027 dnl Branding
2028 dnl ===================================================================
2030 AC_ARG_WITH(branding,
2031     AS_HELP_STRING([--with-branding=/path/to/images],
2032         [Use given path to retrieve branding images set.])
2033     [
2034                           Search for intro.png about.svg and flat_logo.svg.
2035                           If any is missing, default ones will be used instead.
2037                           Search also progress.conf for progress
2038                           settings on intro screen :
2040                           PROGRESSBARCOLOR="255,255,255" Set color of
2041                           progress bar. Comma separated RGB decimal values.
2042                           PROGRESSSIZE="407,6" Set size of progress bar.
2043                           Comma separated decimal values (width, height).
2044                           PROGRESSPOSITION="61,317" Set position of progress
2045                           bar from left,top. Comma separated decimal values.
2046                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2047                           bar frame. Comma separated RGB decimal values.
2048                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2049                           bar text. Comma separated RGB decimal values.
2050                           PROGRESSTEXTBASELINE="287" Set vertical position of
2051                           progress bar text from top. Decimal value.
2053                           Default values will be used if not found.
2054     ],
2058 AC_ARG_WITH(extra-buildid,
2059     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2060         [Show addition build identification in about dialog.]),
2064 AC_ARG_WITH(vendor,
2065     AS_HELP_STRING([--with-vendor="John the Builder"],
2066         [Set vendor of the build.]),
2069 AC_ARG_WITH(android-package-name,
2070     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2071         [Set Android package name of the build.]),
2074 AC_ARG_WITH(compat-oowrappers,
2075     AS_HELP_STRING([--with-compat-oowrappers],
2076         [Install oo* wrappers in parallel with
2077          lo* ones to keep backward compatibility.
2078          Has effect only with make distro-pack-install]),
2081 AC_ARG_WITH(os-version,
2082     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2083         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2086 AC_ARG_WITH(mingw-cross-compiler,
2087     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2088         [Specify the MinGW cross-compiler to use.
2089          When building on the ODK on Unix and building unowinreg.dll,
2090          specify the MinGW C++ cross-compiler.]),
2093 AC_ARG_WITH(idlc-cpp,
2094     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2095         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2098 AC_ARG_WITH(build-version,
2099     AS_HELP_STRING([--with-build-version="Built by Jim"],
2100         [Allows the builder to add a custom version tag that will appear in the
2101          Help/About box for QA purposes.]),
2102 with_build_version=$withval,
2105 AC_ARG_WITH(alloc,
2106     AS_HELP_STRING([--with-alloc],
2107         [Define which allocator to build with (choices are internal, system).]),
2110 AC_ARG_WITH(parallelism,
2111     AS_HELP_STRING([--with-parallelism],
2112         [Number of jobs to run simultaneously during build. Parallel builds can
2113         save a lot of time on multi-cpu machines. Defaults to the number of
2114         CPUs on the machine, unless you configure --enable-icecream - then to
2115         10.]),
2118 AC_ARG_WITH(all-tarballs,
2119     AS_HELP_STRING([--with-all-tarballs],
2120         [Download all external tarballs unconditionally]))
2122 AC_ARG_WITH(gdrive-client-id,
2123     AS_HELP_STRING([--with-gdrive-client-id],
2124         [Provides the client id of the application for OAuth2 authentication
2125         on Google Drive. If either this or --with-gdrive-client-secret is
2126         empty, the feature will be disabled]),
2129 AC_ARG_WITH(gdrive-client-secret,
2130     AS_HELP_STRING([--with-gdrive-client-secret],
2131         [Provides the client secret of the application for OAuth2
2132         authentication on Google Drive. If either this or
2133         --with-gdrive-client-id is empty, the feature will be disabled]),
2136 AC_ARG_WITH(alfresco-cloud-client-id,
2137     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2138         [Provides the client id of the application for OAuth2 authentication
2139         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2140         empty, the feature will be disabled]),
2143 AC_ARG_WITH(alfresco-cloud-client-secret,
2144     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2145         [Provides the client secret of the application for OAuth2
2146         authentication on Alfresco Cloud. If either this or
2147         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2150 AC_ARG_WITH(onedrive-client-id,
2151     AS_HELP_STRING([--with-onedrive-client-id],
2152         [Provides the client id of the application for OAuth2 authentication
2153         on OneDrive. If either this or --with-onedrive-client-secret is
2154         empty, the feature will be disabled]),
2157 AC_ARG_WITH(onedrive-client-secret,
2158     AS_HELP_STRING([--with-onedrive-client-secret],
2159         [Provides the client secret of the application for OAuth2
2160         authentication on OneDrive. If either this or
2161         --with-onedrive-client-id is empty, the feature will be disabled]),
2163 dnl ===================================================================
2164 dnl Do we want to use pre-build binary tarball for recompile
2165 dnl ===================================================================
2167 if test "$enable_library_bin_tar" = "yes" ; then
2168     USE_LIBRARY_BIN_TAR=TRUE
2169 else
2170     USE_LIBRARY_BIN_TAR=
2172 AC_SUBST(USE_LIBRARY_BIN_TAR)
2174 dnl ===================================================================
2175 dnl Test whether build target is Release Build
2176 dnl ===================================================================
2177 AC_MSG_CHECKING([whether build target is Release Build])
2178 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2179     AC_MSG_RESULT([no])
2180     ENABLE_RELEASE_BUILD=
2181 else
2182     AC_MSG_RESULT([yes])
2183     ENABLE_RELEASE_BUILD=TRUE
2185 AC_SUBST(ENABLE_RELEASE_BUILD)
2187 dnl ===================================================================
2188 dnl Test whether to sign Windows Build
2189 dnl ===================================================================
2190 AC_MSG_CHECKING([whether to sign windows build])
2191 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2192     AC_MSG_RESULT([yes])
2193     WINDOWS_BUILD_SIGNING="TRUE"
2194 else
2195     AC_MSG_RESULT([no])
2196     WINDOWS_BUILD_SIGNING="FALSE"
2198 AC_SUBST(WINDOWS_BUILD_SIGNING)
2200 dnl ===================================================================
2201 dnl MacOSX build and runtime environment options
2202 dnl ===================================================================
2204 AC_ARG_WITH(macosx-sdk,
2205     AS_HELP_STRING([--with-macosx-sdk=<version>],
2206         [Prefer a specific SDK for building.])
2207     [
2208                           If the requested SDK is not available, a search for the oldest one will be done.
2209                           With current Xcode versions, only the latest SDK is included, so this option is
2210                           not terribly useful. It works fine to build with a new SDK and run the result
2211                           on an older OS.
2213                           e. g.: --with-macosx-sdk=10.9
2215                           there are 3 options to control the MacOSX build:
2216                           --with-macosx-sdk (referred as 'sdk' below)
2217                           --with-macosx-version-min-required (referred as 'min' below)
2218                           --with-macosx-version-max-allowed (referred as 'max' below)
2220                           the connection between these value and the default they take is as follow:
2221                           ( ? means not specified on the command line, s means the SDK version found,
2222                           constraint: 8 <= x <= y <= z)
2224                           ==========================================
2225                            command line      || config result
2226                           ==========================================
2227                           min  | max  | sdk  || min  | max  | sdk  |
2228                           ?    | ?    | ?    || 10.9 | 10.s | 10.s |
2229                           ?    | ?    | 10.x || 10.9 | 10.x | 10.x |
2230                           ?    | 10.x | ?    || 10.9 | 10.s | 10.s |
2231                           ?    | 10.x | 10.y || 10.9 | 10.x | 10.y |
2232                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2233                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2234                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2235                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2238                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2239                           for a detailed technical explanation of these variables
2241                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2242     ],
2245 AC_ARG_WITH(macosx-version-min-required,
2246     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2247         [set the minimum OS version needed to run the built LibreOffice])
2248     [
2249                           e. g.: --with-macos-version-min-required=10.9
2250                           see --with-macosx-sdk for more info
2251     ],
2254 AC_ARG_WITH(macosx-version-max-allowed,
2255     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2256         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2257     [
2258                           e. g.: --with-macos-version-max-allowed=10.9
2259                           see --with-macosx-sdk for more info
2260     ],
2264 dnl ===================================================================
2265 dnl options for stuff used during cross-compilation build
2266 dnl Not quite superseded by --with-build-platform-configure-options.
2267 dnl TODO: check, if the "force" option is still needed anywhere.
2268 dnl ===================================================================
2270 AC_ARG_WITH(system-icu-for-build,
2271     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2272         [Use icu already on system for build tools (cross-compilation only).]))
2275 dnl ===================================================================
2276 dnl Check for incompatible options set by fuzzing, and reset those
2277 dnl automatically to working combinations
2278 dnl ===================================================================
2280 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2281         "$enable_dbus" != "$enable_avahi"; then
2282     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2283     enable_avahi=$enable_dbus
2286 dnl ===================================================================
2287 dnl check for required programs (grep, awk, sed, bash)
2288 dnl ===================================================================
2290 pathmunge ()
2292     if test -n "$1"; then
2293         if test "$build_os" = "cygwin"; then
2294             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2295                 PathFormat "$1"
2296                 new_path=`cygpath -sm "$formatted_path"`
2297             else
2298                 PathFormat "$1"
2299                 new_path=`cygpath -u "$formatted_path"`
2300             fi
2301         else
2302             new_path="$1"
2303         fi
2304         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2305             if test "$2" = "after"; then
2306                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2307             else
2308                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2309             fi
2310         fi
2311         unset new_path
2312     fi
2315 AC_PROG_AWK
2316 AC_PATH_PROG( AWK, $AWK)
2317 if test -z "$AWK"; then
2318     AC_MSG_ERROR([install awk to run this script])
2321 AC_PATH_PROG(BASH, bash)
2322 if test -z "$BASH"; then
2323     AC_MSG_ERROR([bash not found in \$PATH])
2325 AC_SUBST(BASH)
2327 AC_MSG_CHECKING([for GNU or BSD tar])
2328 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2329     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2330     if test $? -eq 0;  then
2331         GNUTAR=$a
2332         break
2333     fi
2334 done
2335 AC_MSG_RESULT($GNUTAR)
2336 if test -z "$GNUTAR"; then
2337     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2339 AC_SUBST(GNUTAR)
2341 AC_MSG_CHECKING([for tar's option to strip components])
2342 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2343 if test $? -eq 0; then
2344     STRIP_COMPONENTS="--strip-components"
2345 else
2346     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2347     if test $? -eq 0; then
2348         STRIP_COMPONENTS="--strip-path"
2349     else
2350         STRIP_COMPONENTS="unsupported"
2351     fi
2353 AC_MSG_RESULT($STRIP_COMPONENTS)
2354 if test x$STRIP_COMPONENTS = xunsupported; then
2355     AC_MSG_ERROR([you need a tar that is able to strip components.])
2357 AC_SUBST(STRIP_COMPONENTS)
2359 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2360 dnl desktop OSes from "mobile" ones.
2362 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2363 dnl In other words, that when building for an OS that is not a
2364 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2366 dnl Note the direction of the implication; there is no assumption that
2367 dnl cross-compiling would imply a non-desktop OS.
2369 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2370     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2371     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2372     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2375 # Whether to build "avmedia" functionality or not.
2377 if test -z "$enable_avmedia"; then
2378     enable_avmedia=yes
2381 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2382 if test "$enable_avmedia" = yes; then
2383     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2384 else
2385     USE_AVMEDIA_DUMMY='TRUE'
2387 AC_SUBST(USE_AVMEDIA_DUMMY)
2389 # Decide whether to build database connectivity stuff (including
2390 # Base) or not. We probably don't want to on non-desktop OSes.
2391 if test -z "$enable_database_connectivity"; then
2392     # --disable-database-connectivity is unfinished work in progress
2393     # and the iOS test app doesn't link if we actually try to use it.
2394     # if test $_os != iOS -a $_os != Android; then
2395     if test $_os != iOS; then
2396         enable_database_connectivity=yes
2397     fi
2400 if test "$enable_database_connectivity" = yes; then
2401     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2402     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2405 if test -z "$enable_extensions"; then
2406     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2407     if test $_os != iOS -a $_os != Android; then
2408         enable_extensions=yes
2409     fi
2412 if test "$enable_extensions" = yes; then
2413     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2414     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2417 if test -z "$enable_scripting"; then
2418     # Disable scripting for iOS unless specifically overridden
2419     # with --enable-scripting.
2420     if test $_os != iOS; then
2421         enable_scripting=yes
2422     fi
2425 DISABLE_SCRIPTING=''
2426 if test "$enable_scripting" = yes; then
2427     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2428     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2429 else
2430     DISABLE_SCRIPTING='TRUE'
2431     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2434 if test $_os = iOS -o $_os = Android; then
2435     # Disable dynamic_loading always for iOS and Android
2436     enable_dynamic_loading=no
2437 elif test -z "$enable_dynamic_loading"; then
2438     # Otherwise enable it unless speficically disabled
2439     enable_dynamic_loading=yes
2442 DISABLE_DYNLOADING=''
2443 if test "$enable_dynamic_loading" = yes; then
2444     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2445 else
2446     DISABLE_DYNLOADING='TRUE'
2448 AC_SUBST(DISABLE_DYNLOADING)
2450 # remenber SYSBASE value
2451 AC_SUBST(SYSBASE)
2453 dnl ===================================================================
2454 dnl  Sort out various gallery compilation options
2455 dnl ===================================================================
2456 AC_MSG_CHECKING([how to build and package galleries])
2457 if test -n "${with_galleries}"; then
2458     if test "$with_galleries" = "build"; then
2459         WITH_GALLERY_BUILD=TRUE
2460         AC_MSG_RESULT([build from source images internally])
2461     elif test "$with_galleries" = "no"; then
2462         WITH_GALLERY_BUILD=
2463         AC_MSG_RESULT([disable non-internal gallery build])
2464     else
2465         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2466     fi
2467 else
2468     if test $_os != iOS -a $_os != Android; then
2469         WITH_GALLERY_BUILD=TRUE
2470         AC_MSG_RESULT([internal src images for desktop])
2471     else
2472         WITH_GALLERY_BUILD=
2473         AC_MSG_RESULT([disable src image build])
2474     fi
2476 AC_SUBST(WITH_GALLERY_BUILD)
2478 dnl ===================================================================
2479 dnl  Checks if ccache is available
2480 dnl ===================================================================
2481 if test "$_os" = "WINNT"; then
2482     # on windows/VC build do not use ccache
2483     CCACHE=""
2484 elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2485     case "%$CC%$CXX%" in
2486     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2487     # assume that's good then
2488     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2489         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2490         ;;
2491     *)
2492         AC_PATH_PROG([CCACHE],[ccache],[not found])
2493         if test "$CCACHE" = "not found"; then
2494             CCACHE=""
2495         else
2496             # Need to check for ccache version: otherwise prevents
2497             # caching of the results (like "-x objective-c++" for Mac)
2498             if test $_os = Darwin -o $_os = iOS; then
2499                 # Check ccache version
2500                 AC_MSG_CHECKING([whether version of ccache is suitable])
2501                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2502                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2503                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2504                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2505                 else
2506                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2507                     CCACHE=""
2508                 fi
2509             fi
2510         fi
2511         ;;
2512     esac
2513 else
2514     CCACHE=""
2517 if test "$CCACHE" != ""; then
2518     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2519     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2520     if test "$ccache_size" = ""; then
2521         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2522         if test "$ccache_size" = ""; then
2523             ccache_size=0
2524         fi
2525         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2526         if test $ccache_size -lt 1024; then
2527             CCACHE=""
2528             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2529             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2530         else
2531             # warn that ccache may be too small for debug build
2532             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2533             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2534         fi
2535     else
2536         if test $ccache_size -lt 5; then
2537             #warn that ccache may be too small for debug build
2538             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2539             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2540         fi
2541     fi
2544 dnl ===================================================================
2545 dnl  Checks for C compiler,
2546 dnl  The check for the C++ compiler is later on.
2547 dnl ===================================================================
2548 if test "$_os" != "WINNT"; then
2549     GCC_HOME_SET="true"
2550     AC_MSG_CHECKING([gcc home])
2551     if test -z "$with_gcc_home"; then
2552         if test "$enable_icecream" = "yes"; then
2553             if test -d "/usr/lib/icecc/bin"; then
2554                 GCC_HOME="/usr/lib/icecc/"
2555             else
2556                 GCC_HOME="/opt/icecream/"
2557             fi
2558         else
2559             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2560             GCC_HOME_SET="false"
2561         fi
2562     else
2563         GCC_HOME="$with_gcc_home"
2564     fi
2565     AC_MSG_RESULT($GCC_HOME)
2566     AC_SUBST(GCC_HOME)
2568     if test "$GCC_HOME_SET" = "true"; then
2569         if test -z "$CC"; then
2570             CC="$GCC_HOME/bin/gcc"
2571         fi
2572         if test -z "$CXX"; then
2573             CXX="$GCC_HOME/bin/g++"
2574         fi
2575     fi
2578 COMPATH=`dirname "$CC"`
2579 if test "$COMPATH" = "."; then
2580     AC_PATH_PROGS(COMPATH, $CC)
2581     dnl double square bracket to get single because of M4 quote...
2582     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2584 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2586 dnl ===================================================================
2587 dnl Java support
2588 dnl ===================================================================
2589 AC_MSG_CHECKING([whether to build with Java support])
2590 if test "$with_java" != "no"; then
2591     if test "$DISABLE_SCRIPTING" = TRUE; then
2592         AC_MSG_RESULT([no, overridden by --disable-scripting])
2593         ENABLE_JAVA=""
2594         with_java=no
2595     else
2596         AC_MSG_RESULT([yes])
2597         ENABLE_JAVA="TRUE"
2598         AC_DEFINE(HAVE_FEATURE_JAVA)
2599     fi
2600 else
2601     AC_MSG_RESULT([no])
2602     ENABLE_JAVA=""
2605 AC_SUBST(ENABLE_JAVA)
2607 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2609 dnl ENABLE_JAVA="" indicate no Java support at all
2611 dnl ===================================================================
2612 dnl Check OS X SDK and compiler
2613 dnl ===================================================================
2615 if test $_os = Darwin -o $_os = iOS; then
2617     # If no --with-macosx-sdk option is given, look for one
2619     # The intent is that for "most" Mac-based developers, a suitable
2620     # SDK will be found automatically without any configure options.
2622     # For developers with a current Xcode, the lowest-numbered SDK
2623     # higher than or equal to the minimum required should be found.
2625     AC_MSG_CHECKING([what Mac OS X SDK to use])
2626     for _macosx_sdk in $with_macosx_sdk 10.13 10.12; do
2627         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2628         if test -d "$MACOSX_SDK_PATH"; then
2629             with_macosx_sdk="${_macosx_sdk}"
2630             break
2631         else
2632             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2633             if test -d "$MACOSX_SDK_PATH"; then
2634                 with_macosx_sdk="${_macosx_sdk}"
2635                 break
2636             fi
2637         fi
2638     done
2639     if test ! -d "$MACOSX_SDK_PATH"; then
2640         AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2641     fi
2643     if test $_os = iOS; then
2644         if test "$enable_ios_simulator" = "yes"; then
2645             useos=iphonesimulator
2646         else
2647             useos=iphoneos
2648         fi
2649         MACOSX_SDK_PATH=`xcrun --sdk ${useos} --show-sdk-path 2> /dev/null`
2650     fi
2651     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2654     case $with_macosx_sdk in
2655     10.9)
2656         MACOSX_SDK_VERSION=1090
2657         ;;
2658     10.10)
2659         MACOSX_SDK_VERSION=101000
2660         ;;
2661     10.11)
2662         MACOSX_SDK_VERSION=101100
2663         ;;
2664     10.12)
2665         MACOSX_SDK_VERSION=101200
2666         ;;
2667     10.13)
2668         MACOSX_SDK_VERSION=101300
2669         ;;
2670     *)
2671         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.9--13])
2672         ;;
2673     esac
2675     if test "$with_macosx_version_min_required" = "" ; then
2676         with_macosx_version_min_required="10.9";
2677     fi
2679     if test "$with_macosx_version_max_allowed" = "" ; then
2680         with_macosx_version_max_allowed="$with_macosx_sdk"
2681     fi
2683     # export this so that "xcrun" invocations later return matching values
2684     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2685     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2686     export DEVELOPER_DIR
2687     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2688     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2690     case "$with_macosx_version_min_required" in
2691     10.9)
2692         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2693         ;;
2694     10.10)
2695         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2696         ;;
2697     10.11)
2698         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2699         ;;
2700     10.12)
2701         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2702         ;;
2703     10.13)
2704         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2705         ;;
2706     *)
2707         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.9--13])
2708         ;;
2709     esac
2710     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2712     LIBTOOL=/usr/bin/libtool
2713     INSTALL_NAME_TOOL=install_name_tool
2714     if test -z "$save_CC"; then
2715         AC_MSG_CHECKING([what compiler to use])
2716         stdlib=-stdlib=libc++
2717         if test "$ENABLE_LTO" = TRUE; then
2718             lto=-flto
2719         fi
2720         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2721         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2722         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2723         AR=`xcrun -find ar`
2724         NM=`xcrun -find nm`
2725         STRIP=`xcrun -find strip`
2726         LIBTOOL=`xcrun -find libtool`
2727         RANLIB=`xcrun -find ranlib`
2728         AC_MSG_RESULT([$CC and $CXX])
2729     fi
2731     case "$with_macosx_version_max_allowed" in
2732     10.9)
2733         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2734         ;;
2735     10.10)
2736         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2737         ;;
2738     10.11)
2739         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2740         ;;
2741     10.12)
2742         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2743         ;;
2744     10.13)
2745         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2746         ;;
2747     *)
2748         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.9--13])
2749         ;;
2750     esac
2752     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2753     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2754         AC_MSG_RESULT([$MAC_OS_X_VERSION_MIN_REQUIRED])
2755         AC_MSG_RESULT([$MAC_OS_X_VERSION_MAX_REQUIRED])
2756         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2757     else
2758         AC_MSG_RESULT([ok])
2759     fi
2761     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2762     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2763         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2764     else
2765         AC_MSG_RESULT([ok])
2766     fi
2767     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2768     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2770     AC_MSG_CHECKING([whether to do code signing])
2772     if test "$enable_macosx_code_signing" = yes; then
2773         # By default use the first suitable certificate (?).
2775         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2776         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2777         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2778         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2779         # "Developer ID Application" one.
2781         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2782         if test -n "$identity"; then
2783             MACOSX_CODESIGNING_IDENTITY=$identity
2784             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2785             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2786         else
2787             AC_MSG_ERROR([cannot determine identity to use])
2788         fi
2789     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2790         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2791         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2792         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2793     else
2794         AC_MSG_RESULT([no])
2795     fi
2797     AC_MSG_CHECKING([whether to create a Mac App Store package])
2799     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2800         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2801     elif test "$enable_macosx_package_signing" = yes; then
2802         # By default use the first suitable certificate.
2803         # It should be a "3rd Party Mac Developer Installer" one
2805         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2806         if test -n "$identity"; then
2807             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2808             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2809             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2810         else
2811             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2812         fi
2813     elif test -n "$enable_macosx_package_signing"; then
2814         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2815         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2816         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2817     else
2818         AC_MSG_RESULT([no])
2819     fi
2821     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2822         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2823     fi
2825     AC_MSG_CHECKING([whether to sandbox the application])
2827     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2828         AC_MSG_ERROR([OS X sandboxing requires code signing])
2829     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2830         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2831     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2832         ENABLE_MACOSX_SANDBOX=TRUE
2833         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2834         AC_MSG_RESULT([yes])
2835     else
2836         AC_MSG_RESULT([no])
2837     fi
2839     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2840     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2841     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2843 AC_SUBST(MACOSX_SDK_PATH)
2844 AC_SUBST(MACOSX_SDK_VERSION)
2845 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2846 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2847 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
2848 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2849 AC_SUBST(INSTALL_NAME_TOOL)
2850 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2851 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2852 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2853 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2854 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2856 dnl ===================================================================
2857 dnl Check iOS SDK and compiler
2858 dnl ===================================================================
2860 if test $_os = iOS; then
2861     AC_MSG_CHECKING([what iOS SDK to use])
2862     current_sdk_ver=11.2
2863     if test "$enable_ios_simulator" = "yes"; then
2864         platform=iPhoneSimulator
2865         versionmin=-mios-simulator-version-min=$current_sdk_ver
2866     else
2867         platform=iPhoneOS
2868         versionmin=-miphoneos-version-min=$current_sdk_ver
2869     fi
2870     xcode_developer=`xcode-select -print-path`
2872     for sdkver in $current_sdk_ver; do
2873         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2874         if test -d $t; then
2875             ios_sdk=$sdkver
2876             sysroot=$t
2877             break
2878         fi
2879     done
2881     if test -z "$sysroot"; then
2882         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
2883     fi
2885     AC_MSG_RESULT($sysroot)
2887     IOS_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
2888     IOS_DEPLOYMENT_VERSION=$current_sdk_ver
2890     # LTO is not really recommended for iOS builds,
2891     # the link time will be astronomical
2892     if test "$ENABLE_LTO" = TRUE; then
2893         lto=-flto
2894     fi
2896     stdlib="-stdlib=libc++"
2898     CC="`xcrun -find clang` -arch $host_cpu -isysroot $sysroot $lto $versionmin"
2899     CXX="`xcrun -find clang++` -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
2901     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2902     AR=`xcrun -find ar`
2903     NM=`xcrun -find nm`
2904     STRIP=`xcrun -find strip`
2905     LIBTOOL=`xcrun -find libtool`
2906     RANLIB=`xcrun -find ranlib`
2909 AC_SUBST(IOS_SDK)
2910 AC_SUBST(IOS_DEPLOYMENT_VERSION)
2912 AC_MSG_CHECKING([whether to treat the installation as read-only])
2914 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
2915         "$enable_extensions" != yes; then
2916     enable_readonly_installset=yes
2918 if test "$enable_readonly_installset" = yes; then
2919     AC_MSG_RESULT([yes])
2920     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
2921 else
2922     AC_MSG_RESULT([no])
2925 dnl ===================================================================
2926 dnl Structure of install set
2927 dnl ===================================================================
2929 if test $_os = Darwin; then
2930     LIBO_BIN_FOLDER=MacOS
2931     LIBO_ETC_FOLDER=Resources
2932     LIBO_LIBEXEC_FOLDER=MacOS
2933     LIBO_LIB_FOLDER=Frameworks
2934     LIBO_LIB_PYUNO_FOLDER=Resources
2935     LIBO_SHARE_FOLDER=Resources
2936     LIBO_SHARE_HELP_FOLDER=Resources/help
2937     LIBO_SHARE_JAVA_FOLDER=Resources/java
2938     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
2939     LIBO_SHARE_READMES_FOLDER=Resources/readmes
2940     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
2941     LIBO_SHARE_SHELL_FOLDER=Resources/shell
2942     LIBO_URE_BIN_FOLDER=MacOS
2943     LIBO_URE_ETC_FOLDER=Resources/ure/etc
2944     LIBO_URE_LIB_FOLDER=Frameworks
2945     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
2946     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
2947 elif test $_os = WINNT; then
2948     LIBO_BIN_FOLDER=program
2949     LIBO_ETC_FOLDER=program
2950     LIBO_LIBEXEC_FOLDER=program
2951     LIBO_LIB_FOLDER=program
2952     LIBO_LIB_PYUNO_FOLDER=program
2953     LIBO_SHARE_FOLDER=share
2954     LIBO_SHARE_HELP_FOLDER=help
2955     LIBO_SHARE_JAVA_FOLDER=program/classes
2956     LIBO_SHARE_PRESETS_FOLDER=presets
2957     LIBO_SHARE_READMES_FOLDER=readmes
2958     LIBO_SHARE_RESOURCE_FOLDER=program/resource
2959     LIBO_SHARE_SHELL_FOLDER=program/shell
2960     LIBO_URE_BIN_FOLDER=program
2961     LIBO_URE_ETC_FOLDER=program
2962     LIBO_URE_LIB_FOLDER=program
2963     LIBO_URE_MISC_FOLDER=program
2964     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
2965 else
2966     LIBO_BIN_FOLDER=program
2967     LIBO_ETC_FOLDER=program
2968     LIBO_LIBEXEC_FOLDER=program
2969     LIBO_LIB_FOLDER=program
2970     LIBO_LIB_PYUNO_FOLDER=program
2971     LIBO_SHARE_FOLDER=share
2972     LIBO_SHARE_HELP_FOLDER=help
2973     LIBO_SHARE_JAVA_FOLDER=program/classes
2974     LIBO_SHARE_PRESETS_FOLDER=presets
2975     LIBO_SHARE_READMES_FOLDER=readmes
2976     if test "$enable_fuzzers" != yes; then
2977         LIBO_SHARE_RESOURCE_FOLDER=program/resource
2978     else
2979         LIBO_SHARE_RESOURCE_FOLDER=resource
2980     fi
2981     LIBO_SHARE_SHELL_FOLDER=program/shell
2982     LIBO_URE_BIN_FOLDER=program
2983     LIBO_URE_ETC_FOLDER=program
2984     LIBO_URE_LIB_FOLDER=program
2985     LIBO_URE_MISC_FOLDER=program
2986     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
2988 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
2989 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
2990 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
2991 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
2992 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
2993 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
2994 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
2995 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
2996 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
2997 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
2998 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
2999 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3000 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3001 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3002 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3003 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3005 # Not all of them needed in config_host.mk, add more if need arises
3006 AC_SUBST(LIBO_BIN_FOLDER)
3007 AC_SUBST(LIBO_ETC_FOLDER)
3008 AC_SUBST(LIBO_LIB_FOLDER)
3009 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3010 AC_SUBST(LIBO_SHARE_FOLDER)
3011 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3012 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3013 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3014 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3015 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3016 AC_SUBST(LIBO_URE_BIN_FOLDER)
3017 AC_SUBST(LIBO_URE_ETC_FOLDER)
3018 AC_SUBST(LIBO_URE_LIB_FOLDER)
3019 AC_SUBST(LIBO_URE_MISC_FOLDER)
3020 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3022 dnl ===================================================================
3023 dnl Windows specific tests and stuff
3024 dnl ===================================================================
3026 reg_get_value()
3028     # Return value: $regvalue
3029     unset regvalue
3031     local _regentry="/proc/registry${1}/${2}"
3032     if test -f "$_regentry"; then
3033         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3034         # Registry keys read via /proc/registry* are always \0 terminated!
3035         local _regvalue=$(tr -d '\0' < "$_regentry")
3036         if test $? -eq 0; then
3037             regvalue=$_regvalue
3038         fi
3039     fi
3042 # Get a value from the 32-bit side of the Registry
3043 reg_get_value_32()
3045     reg_get_value "32" "$1"
3048 # Get a value from the 64-bit side of the Registry
3049 reg_get_value_64()
3051     reg_get_value "64" "$1"
3054 if test "$_os" = "WINNT"; then
3055     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3056     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3057         AC_MSG_RESULT([no])
3058         WINDOWS_SDK_ARCH="x86"
3059     else
3060         AC_MSG_RESULT([yes])
3061         WINDOWS_SDK_ARCH="x64"
3062         BITNESS_OVERRIDE=64
3063     fi
3065 if test "$_os" = "iOS"; then
3066     cross_compiling="yes"
3069 if test "$cross_compiling" = "yes"; then
3070     export CROSS_COMPILING=TRUE
3071 else
3072     CROSS_COMPILING=
3073     BUILD_TYPE="$BUILD_TYPE NATIVE"
3075 AC_SUBST(CROSS_COMPILING)
3077 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3078 if test "$GCC" = "yes"; then
3079     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
3080     bsymbolic_functions_ldflags_save=$LDFLAGS
3081     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3082     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3083 #include <stdio.h>
3084         ],[
3085 printf ("hello world\n");
3086         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3087     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3088         AC_MSG_RESULT( found )
3089     else
3090         AC_MSG_RESULT( not found )
3091     fi
3092     LDFLAGS=$bsymbolic_functions_ldflags_save
3094 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3096 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3097 # NOTE: must _not_ be used for bundled external libraries!
3098 ISYSTEM=
3099 if test "$GCC" = "yes"; then
3100     AC_MSG_CHECKING( for -isystem )
3101     save_CFLAGS=$CFLAGS
3102     CFLAGS="$CFLAGS -Werror"
3103     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3104     CFLAGS=$save_CFLAGS
3105     if test -n "$ISYSTEM"; then
3106         AC_MSG_RESULT(yes)
3107     else
3108         AC_MSG_RESULT(no)
3109     fi
3111 if test -z "$ISYSTEM"; then
3112     # fall back to using -I
3113     ISYSTEM=-I
3115 AC_SUBST(ISYSTEM)
3117 dnl ===================================================================
3118 dnl  Check which Visual Studio compiler is used
3119 dnl ===================================================================
3121 map_vs_year_to_version()
3123     # Return value: $vsversion
3125     unset vsversion
3127     case $1 in
3128     2015)
3129         vsversion=14.0;;
3130     2017)
3131         vsversion=15.0;;
3132     *)
3133         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3134     esac
3137 vs_versions_to_check()
3139     # Args: $1 (optional) : versions to check, in the order of preference
3140     # Return value: $vsversions
3142     unset vsversions
3144     if test -n "$1"; then
3145         map_vs_year_to_version "$1"
3146         vsversions=$vsversion
3147     else
3148         # By default we prefer 2015/2017, in this order
3149         vsversions="14.0 15.0"
3150     fi
3153 win_get_env_from_vsvars32bat()
3155     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3156     if test $vcnum = "150"; then
3157       # Also seems to be located in another directory under the same name: vsvars32.bat
3158       # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3159       printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3160     else
3161       printf '@call "%s/../Common7/Tools/vsvars32.bat"\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3162     fi
3163     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3164     chmod +x $WRAPPERBATCHFILEPATH
3165     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3166     rm -f $WRAPPERBATCHFILEPATH
3167     printf '%s' "$_win_get_env_from_vsvars32bat"
3170 find_ucrt()
3172     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3173     if test -n "$regvalue"; then
3174         PathFormat "$regvalue"
3175         UCRTSDKDIR=$formatted_path
3176         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3177         UCRTVERSION=$regvalue
3178         # Rest if not exist
3179         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3180           UCRTSDKDIR=
3181         fi
3182     fi
3183     if test -z "$UCRTSDKDIR"; then
3184         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3185         if test "$vcnum" = "150"; then
3186           ide_env_file="${ide_env_dir}VsDevCmd.bat"
3187         else
3188           ide_env_file="${ide_env_dir}/vsvars32.bat"
3189         fi
3190         if test -f "$ide_env_file"; then
3191             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3192             UCRTSDKDIR=$formatted_path
3193             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3194             dnl Hack needed at least by tml:
3195             if test "$UCRTVERSION" = 10.0.15063.0 \
3196                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3197                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3198             then
3199                 UCRTVERSION=10.0.14393.0
3200             fi
3201         else
3202           AC_MSG_ERROR([No UCRT found])
3203         fi
3204     fi
3207 find_msvc()
3209     # Find Visual C++ 2015/2017
3210     # Args: $1 (optional) : The VS version year
3211     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3213     unset vctest vcnum vcnumwithdot vcbuildnumber
3215     vs_versions_to_check "$1"
3217     for ver in $vsversions; do
3218         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3219         if test -n "$regvalue"; then
3220             vctest=$regvalue
3221             break
3222         fi
3223         # As always MSVC 15.0 is special here
3224         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver
3225         if test -n "$regvalue"; then
3226             AC_MSG_RESULT([found: $regvalue])
3227             PathFormat "$regvalue"
3228             vctest=$formatted_path
3229             break
3230         fi
3231     done
3232     if test -n "$vctest"; then
3233         vcnumwithdot=$ver
3234         case "$vcnumwithdot" in
3235         14.0)
3236             vcyear=2015
3237             vcnum=140
3238             ;;
3239         15.0)
3240             vcyear=2017
3241             vcnum=150
3242             vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3243             ;;
3244         esac
3245     fi
3248 SOLARINC=
3249 MSBUILD_PATH=
3250 DEVENV=
3251 if test "$_os" = "WINNT"; then
3252     AC_MSG_CHECKING([Visual C++])
3254     find_msvc "$with_visual_studio"
3255     if test -z "$vctest"; then
3256         if test -n "$with_visual_studio"; then
3257             AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3258         else
3259             AC_MSG_ERROR([No Visual Studio 2015/2017 installation found])
3260         fi
3261     fi
3263     if test "$BITNESS_OVERRIDE" = ""; then
3264         if test -f "$vctest/bin/cl.exe"; then
3265             VC_PRODUCT_DIR=$vctest
3266         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3267             VC_PRODUCT_DIR=$vctest/VC
3268         else
3269             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3270         fi
3271     else
3272         if test -f "$vctest/bin/amd64/cl.exe"; then
3273             VC_PRODUCT_DIR=$vctest
3274         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3275             VC_PRODUCT_DIR=$vctest/VC
3276         else
3277             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])
3278         fi
3279     fi
3281     AC_MSG_CHECKING([for short pathname of VC product directory])
3282     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3283     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3285     UCRTSDKDIR=
3286     UCRTVERSION=
3288     AC_MSG_CHECKING([for UCRT location])
3289     find_ucrt
3290     # find_ucrt errors out if it doesn't find it
3291     AC_MSG_RESULT([found])
3292     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3293     ucrtincpath_formatted=$formatted_path
3294     # SOLARINC is used for external modules and must be set too.
3295     # And no, it's not sufficient to set SOLARINC only, as configure
3296     # itself doesn't honour it.
3297     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3298     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3299     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3300     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3302     AC_SUBST(UCRTSDKDIR)
3303     AC_SUBST(UCRTVERSION)
3305     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3306     # Find the proper version of MSBuild.exe to use based on the VS version
3307     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3308     if test -n "$regvalue" ; then
3309         AC_MSG_RESULT([found: $regvalue])
3310         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3311     else
3312         if test $vcnum = "150"; then
3313             if test "$BITNESS_OVERRIDE" = ""; then
3314                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3315             else
3316                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3317             fi
3318             MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3319         else
3320             AC_MSG_ERROR([No msbuild found, Visual Studio installation broken?])
3321         fi
3322         AC_MSG_RESULT([$regvalue])
3323     fi
3325     # Find the version of devenv.exe
3326     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3327     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3328     if test ! -e "$DEVENV"; then
3329         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3330     fi
3332     dnl ===========================================================
3333     dnl  Check for the corresponding mspdb*.dll
3334     dnl ===========================================================
3336     MSPDB_PATH=
3337     CL_DIR=
3338     CL_LIB=
3340     if test "$BITNESS_OVERRIDE" = ""; then
3341         if test "$vcnum" = "150"; then
3342             MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86"
3343             CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX86/x86
3344         else
3345             MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3346             CL_DIR=bin
3347         fi
3348     else
3349         if test "$vcnum" = "150"; then
3350             MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64"
3351             CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX64/x64
3352         else
3353             MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3354             CL_DIR=bin/amd64
3355         fi
3356     fi
3358     # MSVC 15.0 has libraries from 14.0?
3359     if test  "$vcnum" = "150"; then
3360         mspdbnum="140"
3361     else
3362         mspdbnum=$vcnum
3363     fi
3365     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3366         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3367     fi
3369     MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3370     MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3372     dnl The path needs to be added before cl is called
3373     PATH="$MSPDB_PATH:$PATH"
3375     AC_MSG_CHECKING([cl.exe])
3377     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3378     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3379     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3380     # is not enough?
3382     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3383     dnl needed when building CLR code:
3384     if test -z "$MSVC_CXX"; then
3385         if test "$BITNESS_OVERRIDE" = ""; then
3386             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3387                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3388             fi
3389         else
3390             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3391                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3392             fi
3393         fi
3395         # This gives us a posix path with 8.3 filename restrictions
3396         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3397     fi
3399     if test -z "$CC"; then
3400         CC=$MSVC_CXX
3401     fi
3402     if test "$BITNESS_OVERRIDE" = ""; then
3403         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3404         MSVC_CXX="$MSVC_CXX -arch:SSE"
3405     fi
3407     if test -n "$CC"; then
3408         # Remove /cl.exe from CC case insensitive
3409         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3410         if test "$BITNESS_OVERRIDE" = ""; then
3411            if test "$vcnum" = "150"; then
3412                COMPATH="$VC_PRODUCT_DIR"
3413            else
3414                COMPATH=`echo "$CC" | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3415            fi
3416         else
3417             if test -n "$VC_PRODUCT_DIR"; then
3418                 COMPATH=$VC_PRODUCT_DIR
3419             fi
3420         fi
3421         if test "$BITNESS_OVERRIDE" = ""; then
3422             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3423             CC="$CC -arch:SSE"
3424         fi
3426         if test "$vcnum" = "150"; then
3427             COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3428         fi
3430         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3432         PathFormat "$COMPATH"
3433         COMPATH="$formatted_path"
3435         VCVER=$vcnum
3436         MSVSVER=$vcyear
3438         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3439         # are always "better", we list them in reverse chronological order.
3441         case $vcnum in
3442         140)
3443             COMEX=19
3444             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3445             ;;
3446         150)
3447             COMEX=19
3448             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3449             ;;
3450         esac
3452         # The expectation is that --with-windows-sdk should not need to be used
3453         if test -n "$with_windows_sdk"; then
3454             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3455             *" "$with_windows_sdk" "*)
3456                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3457                 ;;
3458             *)
3459                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3460                 ;;
3461             esac
3462         fi
3464         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3465         ac_objext=obj
3466         ac_exeext=exe
3468     else
3469         AC_MSG_ERROR([Visual C++ not found after all, huh])
3470     fi
3472     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3473     # version of the Explorer extension (and maybe other small
3474     # bits, too) needed when installing a 32-bit LibreOffice on a
3475     # 64-bit OS. The 64-bit Explorer extension is a feature that
3476     # has been present since long in OOo. Don't confuse it with
3477     # building LibreOffice itself as 64-bit code.
3479     BUILD_X64=
3480     CXX_X64_BINARY=
3481     LINK_X64_BINARY=
3483     if test "$BITNESS_OVERRIDE" = ""; then
3484         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3485         if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3486             # Prefer native x64 compiler to cross-compiler, in case we are running
3487             # the build on a 64-bit OS.
3488             if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3489                 BUILD_X64=TRUE
3490                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3491                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3492             elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3493                 BUILD_X64=TRUE
3494                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3495                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3496             fi
3497         elif test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib"; then
3498             # nobody uses 32-bit OS to build, just pick the 64-bit compiler
3499             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3500                 BUILD_X64=TRUE
3501                 CXX_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"
3502                 LINK_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/link.exe"
3503             fi
3504         fi
3505         if test "$BUILD_X64" = TRUE; then
3506             AC_MSG_RESULT([found])
3507         else
3508             AC_MSG_RESULT([not found])
3509             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3510         fi
3511     fi
3512     AC_SUBST(BUILD_X64)
3514     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3515     AC_SUBST(CXX_X64_BINARY)
3516     AC_SUBST(LINK_X64_BINARY)
3518 AC_SUBST(VCVER)
3519 AC_SUBST(DEVENV)
3520 PathFormat "$MSPDB_PATH"
3521 MSPDB_PATH="$formatted_path"
3522 AC_SUBST(MSVC_CXX)
3525 # unowinreg.dll
3527 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3528 AC_SUBST(UNOWINREG_DLL)
3530 COM_IS_CLANG=
3531 AC_MSG_CHECKING([whether the compiler is actually Clang])
3532 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3533     #ifndef __clang__
3534     you lose
3535     #endif
3536     int foo=42;
3537     ]])],
3538     [AC_MSG_RESULT([yes])
3539      COM_IS_CLANG=TRUE],
3540     [AC_MSG_RESULT([no])])
3542 CC_PLAIN=$CC
3543 if test "$COM_IS_CLANG" = TRUE; then
3544     AC_MSG_CHECKING([the Clang version])
3545     if test "$_os" = WINNT; then
3546         dnl In which case, assume clang-cl:
3547         my_args="/EP /TC"
3548         dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3549         dnl clang-cl:
3550         CC_PLAIN=
3551         for i in $CC; do
3552             case $i in
3553             -FIIntrin.h)
3554                 ;;
3555             *)
3556                 CC_PLAIN="$CC_PLAIN $i"
3557                 ;;
3558             esac
3559         done
3560     else
3561         my_args="-E -P"
3562     fi
3563     clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args -`
3564     CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3565     CLANGVER=`echo $clang_version \
3566         | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3567     AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3568     AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3569     AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3571 AC_SUBST(COM_IS_CLANG)
3573 SHOWINCLUDES_PREFIX=
3574 if test "$_os" = WINNT; then
3575     dnl We need to guess the prefix of the -showIncludes output, it can be
3576     dnl localized
3577     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3578     echo "#include <stdlib.h>" > conftest.c
3579     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3580         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3581     rm -f conftest.c conftest.obj
3582     if test -z "$SHOWINCLUDES_PREFIX"; then
3583         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3584     else
3585         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3586     fi
3588 AC_SUBST(SHOWINCLUDES_PREFIX)
3591 # prefix C with ccache if needed
3593 if test "$CCACHE" != ""; then
3594     AC_MSG_CHECKING([whether $CC is already ccached])
3596     AC_LANG_PUSH([C])
3597     save_CFLAGS=$CFLAGS
3598     CFLAGS="$CFLAGS --ccache-skip -O2"
3599     dnl an empty program will do, we're checking the compiler flags
3600     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3601                       [use_ccache=yes], [use_ccache=no])
3602     if test $use_ccache = yes; then
3603         AC_MSG_RESULT([yes])
3604     else
3605         CC="$CCACHE $CC"
3606         AC_MSG_RESULT([no])
3607     fi
3608     CFLAGS=$save_CFLAGS
3609     AC_LANG_POP([C])
3612 # ===================================================================
3613 # check various GCC options that Clang does not support now but maybe
3614 # will somewhen in the future, check them even for GCC, so that the
3615 # flags are set
3616 # ===================================================================
3618 HAVE_GCC_GGDB2=
3619 HAVE_GCC_FINLINE_LIMIT=
3620 HAVE_GCC_FNO_INLINE=
3621 if test "$GCC" = "yes"; then
3622     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3623     save_CFLAGS=$CFLAGS
3624     CFLAGS="$CFLAGS -Werror -ggdb2"
3625     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3626     CFLAGS=$save_CFLAGS
3627     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3628         AC_MSG_RESULT([yes])
3629     else
3630         AC_MSG_RESULT([no])
3631     fi
3633     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3634     save_CFLAGS=$CFLAGS
3635     CFLAGS="$CFLAGS -Werror -finline-limit=0"
3636     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3637     CFLAGS=$save_CFLAGS
3638     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3639         AC_MSG_RESULT([yes])
3640     else
3641         AC_MSG_RESULT([no])
3642     fi
3644     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3645     save_CFLAGS=$CFLAGS
3646     CFLAGS="$CFLAGS -Werror -fno-inline"
3647     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3648     CFLAGS=$save_CFLAGS
3649     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3650         AC_MSG_RESULT([yes])
3651     else
3652         AC_MSG_RESULT([no])
3653     fi
3655     if test "$host_cpu" = "m68k"; then
3656         AC_MSG_CHECKING([whether $CC supports -mlong-jump-table-offsets])
3657         save_CFLAGS=$CFLAGS
3658         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3659         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3660         CFLAGS=$save_CFLAGS
3661         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3662             AC_MSG_RESULT([yes])
3663         else
3664             AC_MSG_ERROR([no])
3665         fi
3666     fi
3668 AC_SUBST(HAVE_GCC_GGDB2)
3669 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3670 AC_SUBST(HAVE_GCC_FNO_INLINE)
3672 dnl ===================================================================
3673 dnl  Test the gcc version
3674 dnl ===================================================================
3675 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3676     AC_MSG_CHECKING([the GCC version])
3677     _gcc_version=`$CC -dumpversion`
3678     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3679         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3680     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3682     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3684     if test "$gcc_full_version" -lt 40801; then
3685         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.8.1])
3686     fi
3687 else
3688     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3689     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3690     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3691     # (which reports itself as GCC 4.2.1).
3692     GCC_VERSION=
3694 AC_SUBST(GCC_VERSION)
3696 dnl Set the ENABLE_DBGUTIL variable
3697 dnl ===================================================================
3698 AC_MSG_CHECKING([whether to build with additional debug utilities])
3699 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3700     ENABLE_DBGUTIL="TRUE"
3701     # this is an extra var so it can have different default on different MSVC
3702     # versions (in case there are version specific problems with it)
3703     MSVC_USE_DEBUG_RUNTIME="TRUE"
3705     AC_MSG_RESULT([yes])
3706     # cppunit and graphite expose STL in public headers
3707     if test "$with_system_cppunit" = "yes"; then
3708         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3709     else
3710         with_system_cppunit=no
3711     fi
3712     if test "$with_system_graphite" = "yes"; then
3713         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3714     else
3715         with_system_graphite=no
3716     fi
3717     if test "$with_system_mysql_cppconn" = "yes"; then
3718         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3719     else
3720         with_system_mysql_cppconn=no
3721     fi
3722     if test "$with_system_orcus" = "yes"; then
3723         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3724     else
3725         with_system_orcus=no
3726     fi
3727     if test "$with_system_libcmis" = "yes"; then
3728         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3729     else
3730         with_system_libcmis=no
3731     fi
3732     if test "$with_system_hunspell" = "yes"; then
3733         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3734     else
3735         with_system_hunspell=no
3736     fi
3737     if test "$with_system_gpgmepp" = "yes"; then
3738         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3739     else
3740         with_system_gpgmepp=no
3741     fi
3742 else
3743     ENABLE_DBGUTIL=""
3744     MSVC_USE_DEBUG_RUNTIME=""
3745     AC_MSG_RESULT([no])
3747 AC_SUBST(ENABLE_DBGUTIL)
3748 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3750 dnl Set the ENABLE_DEBUG variable.
3751 dnl ===================================================================
3752 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3753     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3755 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3756     if test -z "$libo_fuzzed_enable_debug"; then
3757         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3758     else
3759         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3760         enable_debug=yes
3761     fi
3764 AC_MSG_CHECKING([whether to do a debug build])
3765 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3766     ENABLE_DEBUG="TRUE"
3767     if test -n "$ENABLE_DBGUTIL" ; then
3768         AC_MSG_RESULT([yes (dbgutil)])
3769     else
3770         AC_MSG_RESULT([yes])
3771     fi
3772 else
3773     ENABLE_DEBUG=""
3774     AC_MSG_RESULT([no])
3776 AC_SUBST(ENABLE_DEBUG)
3778 if test "$enable_sal_log" = yes; then
3779     ENABLE_SAL_LOG=TRUE
3781 AC_SUBST(ENABLE_SAL_LOG)
3783 dnl Selective debuginfo
3784 ENABLE_DEBUGINFO_FOR=
3785 if test -n "$ENABLE_DEBUG"; then
3786     AC_MSG_CHECKING([whether to use selective debuginfo])
3787     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3788         if test "$enable_selective_debuginfo" = "yes"; then
3789             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3790         fi
3791         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3792         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3793     else
3794         ENABLE_DEBUGINFO_FOR=all
3795         AC_MSG_RESULT([no, for all])
3796     fi
3797 else
3798     if test -n "$enable_selective_debuginfo"; then
3799         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
3800     fi
3802 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3804 dnl Check for enable symbols option
3805 dnl ===================================================================
3806 AC_MSG_CHECKING([whether to generate debug information])
3807 if test -z "$enable_symbols"; then
3808     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3809         enable_symbols=yes
3810     else
3811         enable_symbols=no
3812     fi
3814 if test "$enable_symbols" != no; then
3815     ENABLE_SYMBOLS=TRUE
3816     AC_MSG_RESULT([yes])
3817 else
3818     ENABLE_SYMBOLS=
3819     AC_MSG_RESULT([no])
3821 AC_SUBST(ENABLE_SYMBOLS)
3823 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
3824     # Building on Android with full symbols: without enough memory the linker never finishes currently.
3825     AC_MSG_CHECKING([whether enough memory is available for linking])
3826     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
3827     # Check for 15GB, as Linux reports a bit less than the physical memory size.
3828     if test -n "$mem_size" -a $mem_size -lt 15728640; then
3829         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
3830     else
3831         AC_MSG_RESULT([yes])
3832     fi
3835 AC_MSG_CHECKING([whether to compile with optimization flags])
3836 if test -z "$enable_optimized"; then
3837     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3838         enable_optimized=no
3839     else
3840         enable_optimized=yes
3841     fi
3843 if test "$enable_optimized" != no; then
3844     ENABLE_OPTIMIZED=TRUE
3845     AC_MSG_RESULT([yes])
3846 else
3847     ENABLE_OPTIMIZED=
3848     AC_MSG_RESULT([no])
3850 AC_SUBST(ENABLE_OPTIMIZED)
3853 # determine CPUNAME, OS, ...
3854 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
3856 case "$host_os" in
3858 aix*)
3859     COM=GCC
3860     CPUNAME=POWERPC
3861     USING_X11=TRUE
3862     OS=AIX
3863     RTL_OS=AIX
3864     RTL_ARCH=PowerPC
3865     PLATFORMID=aix_powerpc
3866     P_SEP=:
3867     ;;
3869 cygwin*)
3870     COM=MSC
3871     USING_X11=
3872     OS=WNT
3873     RTL_OS=Windows
3874     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3875         P_SEP=";"
3876     else
3877         P_SEP=:
3878     fi
3879     case "$host_cpu" in
3880     i*86|x86_64)
3881         if test "$BITNESS_OVERRIDE" = 64; then
3882             CPUNAME=X86_64
3883             RTL_ARCH=X86_64
3884             PLATFORMID=windows_x86_64
3885             WINDOWS_X64=1
3886             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
3887         else
3888             CPUNAME=INTEL
3889             RTL_ARCH=x86
3890             PLATFORMID=windows_x86
3891         fi
3892         ;;
3893     *)
3894         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3895         ;;
3896     esac
3897     SCPDEFS="$SCPDEFS -D_MSC_VER"
3898     ;;
3900 darwin*)
3901     COM=GCC
3902     USING_X11=
3903     OS=MACOSX
3904     RTL_OS=MacOSX
3905     P_SEP=:
3907     case "$host_cpu" in
3908     arm)
3909         AC_MSG_ERROR([Can't build 32-bit code for iOS])
3910         ;;
3911     arm64)
3912         OS=IOS
3913         if test "$enable_ios_simulator" = "yes"; then
3914             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
3915         else
3916             CPUNAME=ARM64
3917             RTL_ARCH=ARM_EABI
3918             PLATFORMID=ios_arm64
3919         fi
3920         ;;
3921     i*86)
3922         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
3923         ;;
3924     x86_64)
3925         if test "$enable_ios_simulator" = "yes"; then
3926             OS=IOS
3927         fi
3928         CPUNAME=X86_64
3929         RTL_ARCH=X86_64
3930         PLATFORMID=macosx_x86_64
3931         ;;
3932     *)
3933         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3934         ;;
3935     esac
3936     ;;
3938 dragonfly*)
3939     COM=GCC
3940     USING_X11=TRUE
3941     OS=DRAGONFLY
3942     RTL_OS=DragonFly
3943     P_SEP=:
3945     case "$host_cpu" in
3946     i*86)
3947         CPUNAME=INTEL
3948         RTL_ARCH=x86
3949         PLATFORMID=dragonfly_x86
3950         ;;
3951     x86_64)
3952         CPUNAME=X86_64
3953         RTL_ARCH=X86_64
3954         PLATFORMID=dragonfly_x86_64
3955         ;;
3956     *)
3957         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3958         ;;
3959     esac
3960     ;;
3962 freebsd*)
3963     COM=GCC
3964     USING_X11=TRUE
3965     RTL_OS=FreeBSD
3966     OS=FREEBSD
3967     P_SEP=:
3969     case "$host_cpu" in
3970     i*86)
3971         CPUNAME=INTEL
3972         RTL_ARCH=x86
3973         PLATFORMID=freebsd_x86
3974         ;;
3975     x86_64|amd64)
3976         CPUNAME=X86_64
3977         RTL_ARCH=X86_64
3978         PLATFORMID=freebsd_x86_64
3979         ;;
3980     *)
3981         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3982         ;;
3983     esac
3984     ;;
3986 kfreebsd*)
3987     COM=GCC
3988     USING_X11=TRUE
3989     OS=LINUX
3990     RTL_OS=kFreeBSD
3991     P_SEP=:
3993     case "$host_cpu" in
3995     i*86)
3996         CPUNAME=INTEL
3997         RTL_ARCH=x86
3998         PLATFORMID=kfreebsd_x86
3999         ;;
4000     x86_64)
4001         CPUNAME=X86_64
4002         RTL_ARCH=X86_64
4003         PLATFORMID=kfreebsd_x86_64
4004         ;;
4005     *)
4006         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4007         ;;
4008     esac
4009     ;;
4011 linux-gnu*)
4012     COM=GCC
4013     USING_X11=TRUE
4014     OS=LINUX
4015     RTL_OS=Linux
4016     P_SEP=:
4018     case "$host_cpu" in
4020     aarch64)
4021         CPUNAME=AARCH64
4022         PLATFORMID=linux_aarch64
4023         RTL_ARCH=AARCH64
4024         ;;
4025     alpha)
4026         CPUNAME=AXP
4027         RTL_ARCH=ALPHA
4028         PLATFORMID=linux_alpha
4029         ;;
4030     arm*)
4031         CPUNAME=ARM
4032         EPM_FLAGS="-a arm"
4033         RTL_ARCH=ARM_EABI
4034         PLATFORMID=linux_arm_eabi
4035         case "$host_cpu" in
4036         arm*-linux)
4037             RTL_ARCH=ARM_OABI
4038             PLATFORMID=linux_arm_oabi
4039             ;;
4040         esac
4041         ;;
4042     hppa)
4043         CPUNAME=HPPA
4044         RTL_ARCH=HPPA
4045         EPM_FLAGS="-a hppa"
4046         PLATFORMID=linux_hppa
4047         ;;
4048     i*86)
4049         CPUNAME=INTEL
4050         RTL_ARCH=x86
4051         PLATFORMID=linux_x86
4052         ;;
4053     ia64)
4054         CPUNAME=IA64
4055         RTL_ARCH=IA64
4056         PLATFORMID=linux_ia64
4057         ;;
4058     mips)
4059         CPUNAME=GODSON
4060         RTL_ARCH=MIPS_EB
4061         EPM_FLAGS="-a mips"
4062         PLATFORMID=linux_mips_eb
4063         ;;
4064     mips64)
4065         CPUNAME=GODSON64
4066         RTL_ARCH=MIPS64_EB
4067         EPM_FLAGS="-a mips64"
4068         PLATFORMID=linux_mips64_eb
4069         ;;
4070     mips64el)
4071         CPUNAME=GODSON64
4072         RTL_ARCH=MIPS64_EL
4073         EPM_FLAGS="-a mips64el"
4074         PLATFORMID=linux_mips64_el
4075         ;;
4076     mipsel)
4077         CPUNAME=GODSON
4078         RTL_ARCH=MIPS_EL
4079         EPM_FLAGS="-a mipsel"
4080         PLATFORMID=linux_mips_el
4081         ;;
4082     m68k)
4083         CPUNAME=M68K
4084         RTL_ARCH=M68K
4085         PLATFORMID=linux_m68k
4086         ;;
4087     powerpc)
4088         CPUNAME=POWERPC
4089         RTL_ARCH=PowerPC
4090         PLATFORMID=linux_powerpc
4091         ;;
4092     powerpc64)
4093         CPUNAME=POWERPC64
4094         RTL_ARCH=PowerPC_64
4095         PLATFORMID=linux_powerpc64
4096         ;;
4097     powerpc64le)
4098         CPUNAME=POWERPC64
4099         RTL_ARCH=PowerPC_64_LE
4100         PLATFORMID=linux_powerpc64_le
4101         ;;
4102     sparc)
4103         CPUNAME=SPARC
4104         RTL_ARCH=SPARC
4105         PLATFORMID=linux_sparc
4106         ;;
4107     sparc64)
4108         CPUNAME=SPARC64
4109         RTL_ARCH=SPARC64
4110         PLATFORMID=linux_sparc64
4111         ;;
4112     s390)
4113         CPUNAME=S390
4114         RTL_ARCH=S390
4115         PLATFORMID=linux_s390
4116         ;;
4117     s390x)
4118         CPUNAME=S390X
4119         RTL_ARCH=S390x
4120         PLATFORMID=linux_s390x
4121         ;;
4122     x86_64)
4123         CPUNAME=X86_64
4124         RTL_ARCH=X86_64
4125         PLATFORMID=linux_x86_64
4126         ;;
4127     *)
4128         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4129         ;;
4130     esac
4131     ;;
4133 linux-android*)
4134     COM=GCC
4135     USING_X11=
4136     OS=ANDROID
4137     RTL_OS=Android
4138     P_SEP=:
4140     case "$host_cpu" in
4142     arm|armel)
4143         CPUNAME=ARM
4144         RTL_ARCH=ARM_EABI
4145         PLATFORMID=android_arm_eabi
4146         ;;
4147     aarch64)
4148         CPUNAME=AARCH64
4149         RTL_ARCH=AARCH64
4150         PLATFORMID=android_aarch64
4151         ;;
4152     mips|mipsel)
4153         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4154         RTL_ARCH=MIPS_EL
4155         PLATFORMID=android_mips_el
4156         ;;
4157     i*86)
4158         CPUNAME=INTEL
4159         RTL_ARCH=x86
4160         PLATFORMID=android_x86
4161         ;;
4162     *)
4163         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4164         ;;
4165     esac
4166     ;;
4168 *netbsd*)
4169     COM=GCC
4170     USING_X11=TRUE
4171     OS=NETBSD
4172     RTL_OS=NetBSD
4173     P_SEP=:
4175     case "$host_cpu" in
4176     i*86)
4177         CPUNAME=INTEL
4178         RTL_ARCH=x86
4179         PLATFORMID=netbsd_x86
4180         ;;
4181     powerpc)
4182         CPUNAME=POWERPC
4183         RTL_ARCH=PowerPC
4184         PLATFORMID=netbsd_powerpc
4185         ;;
4186     sparc)
4187         CPUNAME=SPARC
4188         RTL_ARCH=SPARC
4189         PLATFORMID=netbsd_sparc
4190         ;;
4191     x86_64)
4192         CPUNAME=X86_64
4193         RTL_ARCH=X86_64
4194         PLATFORMID=netbsd_x86_64
4195         ;;
4196     *)
4197         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4198         ;;
4199     esac
4200     ;;
4202 openbsd*)
4203     COM=GCC
4204     USING_X11=TRUE
4205     OS=OPENBSD
4206     RTL_OS=OpenBSD
4207     P_SEP=:
4209     case "$host_cpu" in
4210     i*86)
4211         CPUNAME=INTEL
4212         RTL_ARCH=x86
4213         PLATFORMID=openbsd_x86
4214         ;;
4215     x86_64)
4216         CPUNAME=X86_64
4217         RTL_ARCH=X86_64
4218         PLATFORMID=openbsd_x86_64
4219         ;;
4220     *)
4221         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4222         ;;
4223     esac
4224     SOLARINC="$SOLARINC -I/usr/local/include"
4225     ;;
4227 solaris*)
4228     COM=GCC
4229     USING_X11=TRUE
4230     OS=SOLARIS
4231     RTL_OS=Solaris
4232     P_SEP=:
4234     case "$host_cpu" in
4235     i*86)
4236         CPUNAME=INTEL
4237         RTL_ARCH=x86
4238         PLATFORMID=solaris_x86
4239         ;;
4240     sparc)
4241         CPUNAME=SPARC
4242         RTL_ARCH=SPARC
4243         PLATFORMID=solaris_sparc
4244         ;;
4245     sparc64)
4246         CPUNAME=SPARC64
4247         RTL_ARCH=SPARC64
4248         PLATFORMID=solaris_sparc64
4249         ;;
4250     *)
4251         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4252         ;;
4253     esac
4254     SOLARINC="$SOLARINC -I/usr/local/include"
4255     ;;
4258     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4259     ;;
4260 esac
4262 if test "$with_x" = "no"; then
4263     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4266 ENABLE_HEADLESS=""
4267 if test "$enable_gui" = "no"; then
4268     if test "$USING_X11" != TRUE; then
4269         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4270     fi
4271     USING_X11=
4272     ENABLE_HEADLESS=TRUE
4273     AC_DEFINE(HAVE_FEATURE_UI,0)
4274     test_cairo=yes
4276 AC_SUBST(ENABLE_HEADLESS)
4278 WORKDIR="${BUILDDIR}/workdir"
4279 INSTDIR="${BUILDDIR}/instdir"
4280 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4281 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4282 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4283 AC_SUBST(COM)
4284 AC_SUBST(CPUNAME)
4285 AC_SUBST(RTL_OS)
4286 AC_SUBST(RTL_ARCH)
4287 AC_SUBST(EPM_FLAGS)
4288 AC_SUBST(USING_X11)
4289 AC_SUBST([INSTDIR])
4290 AC_SUBST([INSTROOT])
4291 AC_SUBST([INSTROOTBASE])
4292 AC_SUBST(OS)
4293 AC_SUBST(P_SEP)
4294 AC_SUBST(WORKDIR)
4295 AC_SUBST(PLATFORMID)
4296 AC_SUBST(WINDOWS_X64)
4297 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4299 dnl ===================================================================
4300 dnl Test which package format to use
4301 dnl ===================================================================
4302 AC_MSG_CHECKING([which package format to use])
4303 if test -n "$with_package_format" -a "$with_package_format" != no; then
4304     for i in $with_package_format; do
4305         case "$i" in
4306         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4307             ;;
4308         *)
4309             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4310 aix - AIX software distribution
4311 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4312 deb - Debian software distribution
4313 pkg - Solaris software distribution
4314 rpm - RedHat software distribution
4316 LibreOffice additionally supports:
4317 archive - .tar.gz or .zip
4318 dmg - Mac OS X .dmg
4319 installed - installation tree
4320 msi - Windows .msi
4321         ])
4322             ;;
4323         esac
4324     done
4325     PKGFORMAT="$with_package_format"
4326     AC_MSG_RESULT([$PKGFORMAT])
4327 else
4328     PKGFORMAT=
4329     AC_MSG_RESULT([none])
4331 AC_SUBST(PKGFORMAT)
4333 dnl ===================================================================
4334 dnl Set up a different compiler to produce tools to run on the build
4335 dnl machine when doing cross-compilation
4336 dnl ===================================================================
4338 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4339 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4340 if test "$cross_compiling" = "yes"; then
4341     AC_MSG_CHECKING([for BUILD platform configuration])
4342     echo
4343     rm -rf CONF-FOR-BUILD config_build.mk
4344     mkdir CONF-FOR-BUILD
4345     # Here must be listed all files needed when running the configure script. In particular, also
4346     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4347     # keep them in the same order as there.
4348     (cd $SRC_ROOT && tar cf - \
4349         config.guess \
4350         bin/get_config_variables \
4351         solenv/bin/getcompver.awk \
4352         solenv/inc/langlist.mk \
4353         download.lst \
4354         config_host.mk.in \
4355         config_host_lang.mk.in \
4356         Makefile.in \
4357         lo.xcent.in \
4358         bin/bffvalidator.sh.in \
4359         bin/odfvalidator.sh.in \
4360         bin/officeotron.sh.in \
4361         instsetoo_native/util/openoffice.lst.in \
4362         config_host/*.in \
4363         sysui/desktop/macosx/Info.plist.in) \
4364     | (cd CONF-FOR-BUILD && tar xf -)
4365     cp configure CONF-FOR-BUILD
4366     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4367     (
4368     unset COM USING_X11 OS CPUNAME
4369     unset CC CXX SYSBASE CFLAGS
4370     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4371     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4372     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4373     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4374     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4375     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4376     cd CONF-FOR-BUILD
4377     sub_conf_opts=""
4378     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4379     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4380     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4381     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4382     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4383     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4384     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4385     # Don't bother having configure look for stuff not needed for the build platform anyway
4386     ./configure \
4387         --disable-cups \
4388         --disable-gtk3 \
4389         --disable-pdfimport \
4390         --disable-postgresql-sdbc \
4391         --with-parallelism="$with_parallelism" \
4392         --without-doxygen \
4393         --without-java \
4394         $sub_conf_opts \
4395         --srcdir=$srcdir \
4396         2>&1 | sed -e 's/^/    /'
4397     test -f ./config_host.mk 2>/dev/null || exit
4398     cp config_host.mk ../config_build.mk
4399     cp config_host_lang.mk ../config_build_lang.mk
4400     mv config.log ../config.Build.log
4401     mkdir -p ../config_build
4402     mv config_host/*.h ../config_build
4403     . ./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
4405     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
4406         VV='$'$V
4407         VV=`eval "echo $VV"`
4408         if test -n "$VV"; then
4409             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4410             echo "$line" >>build-config
4411         fi
4412     done
4414     for V in INSTDIR INSTROOT WORKDIR; do
4415         VV='$'$V
4416         VV=`eval "echo $VV"`
4417         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4418         if test -n "$VV"; then
4419             line="${V}_FOR_BUILD='$VV'"
4420             echo "$line" >>build-config
4421         fi
4422     done
4424     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4425     echo "$line" >>build-config
4427     )
4428     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4429     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])
4430     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4431              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4433     eval `cat CONF-FOR-BUILD/build-config`
4435     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4437     rm -rf CONF-FOR-BUILD
4438 else
4439     OS_FOR_BUILD="$OS"
4440     CC_FOR_BUILD="$CC"
4441     CXX_FOR_BUILD="$CXX"
4442     INSTDIR_FOR_BUILD="$INSTDIR"
4443     INSTROOT_FOR_BUILD="$INSTROOT"
4444     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4445     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4446     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4447     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4448     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4449     WORKDIR_FOR_BUILD="$WORKDIR"
4451 AC_SUBST(OS_FOR_BUILD)
4452 AC_SUBST(INSTDIR_FOR_BUILD)
4453 AC_SUBST(INSTROOT_FOR_BUILD)
4454 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4455 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4456 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4457 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4458 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4459 AC_SUBST(WORKDIR_FOR_BUILD)
4461 dnl ===================================================================
4462 dnl Check for syslog header
4463 dnl ===================================================================
4464 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4466 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4467 dnl ===================================================================
4468 AC_MSG_CHECKING([whether to turn warnings to errors])
4469 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4470     ENABLE_WERROR="TRUE"
4471     AC_MSG_RESULT([yes])
4472 else
4473     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4474         ENABLE_WERROR="TRUE"
4475         AC_MSG_RESULT([yes])
4476     else
4477         AC_MSG_RESULT([no])
4478     fi
4480 AC_SUBST(ENABLE_WERROR)
4482 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4483 dnl ===================================================================
4484 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4485 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4486     ASSERT_ALWAYS_ABORT="TRUE"
4487     AC_MSG_RESULT([yes])
4488 else
4489     ASSERT_ALWAYS_ABORT="FALSE"
4490     AC_MSG_RESULT([no])
4492 AC_SUBST(ASSERT_ALWAYS_ABORT)
4494 # Determine whether to use ooenv for the instdir installation
4495 # ===================================================================
4496 if test $_os != "WINNT" -a $_os != "Darwin"; then
4497     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4498     if test "$enable_ooenv" = "no"; then
4499         AC_MSG_RESULT([no])
4500     else
4501         ENABLE_OOENV="TRUE"
4502         AC_MSG_RESULT([yes])
4503     fi
4505 AC_SUBST(ENABLE_OOENV)
4507 if test "$USING_X11" != TRUE; then
4508     # be sure to do not mess with unneeded stuff
4509     test_randr=no
4510     test_xrender=no
4511     test_cups=no
4512     test_dbus=no
4513     test_gtk=no
4514     build_gstreamer_1_0=no
4515     build_gstreamer_0_10=no
4516     test_kde4=no
4517     test_qt5=no
4518     enable_cairo_canvas=no
4521 dnl ===================================================================
4522 dnl check for cups support
4523 dnl ===================================================================
4524 ENABLE_CUPS=""
4526 if test "$enable_cups" = "no"; then
4527     test_cups=no
4530 AC_MSG_CHECKING([whether to enable CUPS support])
4531 if test "$test_cups" = "yes"; then
4532     ENABLE_CUPS="TRUE"
4533     AC_MSG_RESULT([yes])
4535     AC_MSG_CHECKING([whether cups support is present])
4536     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4537     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4538     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4539         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4540     fi
4542 else
4543     AC_MSG_RESULT([no])
4546 AC_SUBST(ENABLE_CUPS)
4548 # fontconfig checks
4549 if test "$test_fontconfig" = "yes"; then
4550     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4551     SYSTEM_FONTCONFIG=TRUE
4552     FilterLibs "${FONTCONFIG_LIBS}"
4553     FONTCONFIG_LIBS="${filteredlibs}"
4555 AC_SUBST(FONTCONFIG_CFLAGS)
4556 AC_SUBST(FONTCONFIG_LIBS)
4557 AC_SUBST([SYSTEM_FONTCONFIG])
4559 dnl whether to find & fetch external tarballs?
4560 dnl ===================================================================
4561 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4562    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4563        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4564    else
4565        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4566    fi
4568 if test -z "$TARFILE_LOCATION"; then
4569     if test -d "$SRC_ROOT/src" ; then
4570         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4571         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4572     fi
4573     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4574 else
4575     AbsolutePath "$TARFILE_LOCATION"
4576     PathFormat "${absolute_path}"
4577     TARFILE_LOCATION="${formatted_path}"
4579 AC_SUBST(TARFILE_LOCATION)
4581 AC_MSG_CHECKING([whether we want to fetch tarballs])
4582 if test "$enable_fetch_external" != "no"; then
4583     if test "$with_all_tarballs" = "yes"; then
4584         AC_MSG_RESULT([yes, all of them])
4585         DO_FETCH_TARBALLS="ALL"
4586     else
4587         AC_MSG_RESULT([yes, if we use them])
4588         DO_FETCH_TARBALLS="TRUE"
4589     fi
4590 else
4591     AC_MSG_RESULT([no])
4592     DO_FETCH_TARBALLS=
4594 AC_SUBST(DO_FETCH_TARBALLS)
4596 AC_MSG_CHECKING([whether to build help])
4597 HELP_COMMON_ONLY=FALSE
4598 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4599     BUILD_TYPE="$BUILD_TYPE HELP"
4600     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4601     case "$with_help" in
4602     "common")
4603         HELP_COMMON_ONLY=TRUE
4604         AC_MSG_RESULT([common only])
4605         ;;
4606     "html")
4607         ENABLE_HTMLHELP=TRUE
4608         AC_MSG_RESULT([HTML])
4609         ;;
4610     "online")
4611         ENABLE_HTMLHELP=TRUE
4612         HELP_ONLINE=TRUE
4613         AC_MSG_RESULT([HTML])
4614         ;;
4615     *)
4616         SCPDEFS="$SCPDEFS -DWITH_HELP"
4617         AC_MSG_RESULT([yes])
4618         ;;
4619     esac
4620 else
4621     AC_MSG_RESULT([no])
4623 AC_SUBST([ENABLE_HTMLHELP])
4624 AC_SUBST(HELP_COMMON_ONLY)
4625 AC_SUBST([HELP_ONLINE])
4627 dnl Test whether to include MySpell dictionaries
4628 dnl ===================================================================
4629 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4630 if test "$with_myspell_dicts" = "yes"; then
4631     AC_MSG_RESULT([yes])
4632     WITH_MYSPELL_DICTS=TRUE
4633     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4634     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4635 else
4636     AC_MSG_RESULT([no])
4637     WITH_MYSPELL_DICTS=
4639 AC_SUBST(WITH_MYSPELL_DICTS)
4641 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4642 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4643     if test "$with_system_dicts" = yes; then
4644         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4645     fi
4646     with_system_dicts=no
4649 AC_MSG_CHECKING([whether to use dicts from external paths])
4650 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4651     AC_MSG_RESULT([yes])
4652     SYSTEM_DICTS=TRUE
4653     AC_MSG_CHECKING([for spelling dictionary directory])
4654     if test -n "$with_external_dict_dir"; then
4655         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4656     else
4657         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4658         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4659             DICT_SYSTEM_DIR=file:///usr/share/myspell
4660         fi
4661     fi
4662     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4663     AC_MSG_CHECKING([for hyphenation patterns directory])
4664     if test -n "$with_external_hyph_dir"; then
4665         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4666     else
4667         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4668     fi
4669     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4670     AC_MSG_CHECKING([for thesaurus directory])
4671     if test -n "$with_external_thes_dir"; then
4672         THES_SYSTEM_DIR=file://$with_external_thes_dir
4673     else
4674         THES_SYSTEM_DIR=file:///usr/share/mythes
4675     fi
4676     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4677 else
4678     AC_MSG_RESULT([no])
4679     SYSTEM_DICTS=
4681 AC_SUBST(SYSTEM_DICTS)
4682 AC_SUBST(DICT_SYSTEM_DIR)
4683 AC_SUBST(HYPH_SYSTEM_DIR)
4684 AC_SUBST(THES_SYSTEM_DIR)
4686 dnl ===================================================================
4687 dnl enable pch by default on windows
4688 dnl enable it explicitly otherwise
4689 ENABLE_PCH=""
4690 if test "$enable_pch" = yes -a "$enable_compiler_plugins" = yes; then
4691     if test -z "$libo_fuzzed_enable_pch"; then
4692         AC_MSG_ERROR([--enable-pch cannot be used with --enable-compiler-plugins])
4693     else
4694         AC_MSG_NOTICE([Resetting --enable-pch=no])
4695         enable_pch=no
4696     fi
4699 AC_MSG_CHECKING([whether to enable pch feature])
4700 if test "$enable_pch" != "no"; then
4701     if test "$_os" = "WINNT"; then
4702         ENABLE_PCH="TRUE"
4703         AC_MSG_RESULT([yes])
4704     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4705         ENABLE_PCH="TRUE"
4706         AC_MSG_RESULT([yes])
4707     elif test -n "$enable_pch"; then
4708         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4709     else
4710         AC_MSG_RESULT([no])
4711     fi
4712 else
4713     AC_MSG_RESULT([no])
4715 AC_SUBST(ENABLE_PCH)
4717 TAB=`printf '\t'`
4719 AC_MSG_CHECKING([the GNU Make version])
4720 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4721 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4722 if test "$_make_longver" -ge "038200"; then
4723     AC_MSG_RESULT([$GNUMAKE $_make_version])
4725 elif test "$_make_longver" -ge "038100"; then
4726     if test "$build_os" = "cygwin"; then
4727         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4728     fi
4729     AC_MSG_RESULT([$GNUMAKE $_make_version])
4731     dnl ===================================================================
4732     dnl Search all the common names for sha1sum
4733     dnl ===================================================================
4734     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4735     if test -z "$SHA1SUM"; then
4736         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
4737     elif test "$SHA1SUM" = "openssl"; then
4738         SHA1SUM="openssl sha1"
4739     fi
4740     AC_MSG_CHECKING([for GNU Make bug 20033])
4741     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4742     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4743 A := \$(wildcard *.a)
4745 .PHONY: all
4746 all: \$(A:.a=.b)
4747 <TAB>@echo survived bug20033.
4749 .PHONY: setup
4750 setup:
4751 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4753 define d1
4754 @echo lala \$(1)
4755 @sleep 1
4756 endef
4758 define d2
4759 @echo tyty \$(1)
4760 @sleep 1
4761 endef
4763 %.b : %.a
4764 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4765 <TAB>\$(call d1,\$(CHECKSUM)),\
4766 <TAB>\$(call d2,\$(CHECKSUM)))
4768     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4769         no_parallelism_make="YES"
4770         AC_MSG_RESULT([yes, disable parallelism])
4771     else
4772         AC_MSG_RESULT([no, keep parallelism enabled])
4773     fi
4774     rm -rf $TESTGMAKEBUG20033
4775 else
4776     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4779 # find if gnumake support file function
4780 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
4781 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4782 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4783     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
4785 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4786 \$(file >test.txt,Success )
4788 .PHONY: all
4789 all:
4790 <TAB>@cat test.txt
4793 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4794 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4795     HAVE_GNUMAKE_FILE_FUNC=TRUE
4796     AC_MSG_RESULT([yes])
4797 else
4798     AC_MSG_RESULT([no])
4800 rm -rf $TESTGMAKEFILEFUNC
4801 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4802 AC_SUBST(GNUMAKE_WIN_NATIVE)
4804 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
4805 STALE_MAKE=
4806 if test "$_make_ver_check" = ""; then
4807    STALE_MAKE=TRUE
4810 HAVE_LD_HASH_STYLE=FALSE
4811 WITH_LINKER_HASH_STYLE=
4812 AC_MSG_CHECKING([for --hash-style gcc linker support])
4813 if test "$GCC" = "yes"; then
4814     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4815         hash_styles="gnu sysv"
4816     elif test "$with_linker_hash_style" = "no"; then
4817         hash_styles=
4818     else
4819         hash_styles="$with_linker_hash_style"
4820     fi
4822     for hash_style in $hash_styles; do
4823         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4824         hash_style_ldflags_save=$LDFLAGS
4825         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
4827         AC_RUN_IFELSE([AC_LANG_PROGRAM(
4828             [
4829 #include <stdio.h>
4830             ],[
4831 printf ("");
4832             ])],
4833             [
4834                   HAVE_LD_HASH_STYLE=TRUE
4835                   WITH_LINKER_HASH_STYLE=$hash_style
4836             ],
4837             [HAVE_LD_HASH_STYLE=FALSE],
4838             [HAVE_LD_HASH_STYLE=FALSE])
4839         LDFLAGS=$hash_style_ldflags_save
4840     done
4842     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
4843         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
4844     else
4845         AC_MSG_RESULT( no )
4846     fi
4847     LDFLAGS=$hash_style_ldflags_save
4848 else
4849     AC_MSG_RESULT( no )
4851 AC_SUBST(HAVE_LD_HASH_STYLE)
4852 AC_SUBST(WITH_LINKER_HASH_STYLE)
4854 dnl ===================================================================
4855 dnl Check whether there's a Perl version available.
4856 dnl ===================================================================
4857 if test -z "$with_perl_home"; then
4858     AC_PATH_PROG(PERL, perl)
4859 else
4860     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
4861     _perl_path="$with_perl_home/bin/perl"
4862     if test -x "$_perl_path"; then
4863         PERL=$_perl_path
4864     else
4865         AC_MSG_ERROR([$_perl_path not found])
4866     fi
4869 dnl ===================================================================
4870 dnl Testing for Perl version 5 or greater.
4871 dnl $] is the Perl version variable, it is returned as an integer
4872 dnl ===================================================================
4873 if test "$PERL"; then
4874     AC_MSG_CHECKING([the Perl version])
4875     ${PERL} -e "exit($]);"
4876     _perl_version=$?
4877     if test "$_perl_version" -lt 5; then
4878         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
4879     fi
4880     AC_MSG_RESULT([Perl $_perl_version])
4881 else
4882     AC_MSG_ERROR([Perl not found, install Perl 5])
4885 dnl ===================================================================
4886 dnl Testing for required Perl modules
4887 dnl ===================================================================
4889 AC_MSG_CHECKING([for required Perl modules])
4890 if `$PERL -e 'use Cwd; use Digest::MD5'>/dev/null 2>&1`; then
4891     AC_MSG_RESULT([all modules found])
4892 else
4893     AC_MSG_RESULT([failed to find some modules])
4894     # Find out which modules are missing.
4895     if ! `$PERL -e 'use Cwd;'>/dev/null 2>&1`; then
4896         missing_perl_modules="$missing_perl_modules Cwd"
4897     fi
4898     if ! `$PERL -e 'use Digest::MD5;'>/dev/null 2>&1`; then
4899         missing_perl_modules="$missing_perl_modules Digest::MD5"
4900     fi
4901        AC_MSG_ERROR([
4902     The missing Perl modules are: $missing_perl_modules
4903     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
4906 dnl ===================================================================
4907 dnl Check for pkg-config
4908 dnl ===================================================================
4909 if test "$_os" != "WINNT"; then
4910     PKG_PROG_PKG_CONFIG
4913 if test "$_os" != "WINNT"; then
4915     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
4916     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
4917     # explicitly. Or put /path/to/compiler in PATH yourself.
4919     # Use wrappers for LTO
4920     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
4921         AC_CHECK_TOOL(AR,gcc-ar)
4922         AC_CHECK_TOOL(NM,gcc-nm)
4923         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
4924     else
4925         AC_CHECK_TOOL(AR,ar)
4926         AC_CHECK_TOOL(NM,nm)
4927         AC_CHECK_TOOL(RANLIB,ranlib)
4928     fi
4929     AC_CHECK_TOOL(OBJDUMP,objdump)
4930     AC_CHECK_TOOL(READELF,readelf)
4931     AC_CHECK_TOOL(STRIP,strip)
4932     if test "$_os" = "WINNT"; then
4933         AC_CHECK_TOOL(DLLTOOL,dlltool)
4934         AC_CHECK_TOOL(WINDRES,windres)
4935     fi
4937 AC_SUBST(AR)
4938 AC_SUBST(DLLTOOL)
4939 AC_SUBST(NM)
4940 AC_SUBST(OBJDUMP)
4941 AC_SUBST(PKG_CONFIG)
4942 AC_SUBST(RANLIB)
4943 AC_SUBST(READELF)
4944 AC_SUBST(STRIP)
4945 AC_SUBST(WINDRES)
4947 dnl ===================================================================
4948 dnl pkg-config checks on Mac OS X
4949 dnl ===================================================================
4951 if test $_os = Darwin; then
4952     AC_MSG_CHECKING([for bogus pkg-config])
4953     if test -n "$PKG_CONFIG"; then
4954         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
4955             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
4956         else
4957             if test "$enable_bogus_pkg_config" = "yes"; then
4958                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
4959             else
4960                 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.])
4961             fi
4962         fi
4963     else
4964         AC_MSG_RESULT([no, good])
4965     fi
4968 find_csc()
4970     # Return value: $csctest
4972     unset csctest
4974     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
4975     if test -n "$regvalue"; then
4976         csctest=$regvalue
4977         return
4978     fi
4981 find_al()
4983     # Return value: $altest
4985     unset altest
4987     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
4988         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
4989         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
4990             altest=$regvalue
4991             return
4992         fi
4993     done
4995     # We need this additional check to detect 4.6.1 or above.
4996     for ver in 4.7 4.6.2 4.6.1; do
4997         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
4998         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
4999             altest=$regvalue
5000             return
5001         fi
5003         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/WOW6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools"
5004         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5005             altest=$regvalue
5006             return
5007         fi
5008     done
5011 find_dotnetsdk()
5013     # Return value: $frametest (that's a silly name...)
5015     unset frametest
5017     for ver in 1.1 2.0; do
5018         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
5019         if test -n "$regvalue"; then
5020             frametest=$regvalue
5021             return
5022         fi
5023     done
5026 find_dotnetsdk46()
5028     unset frametest
5030     for ver in 4.7 4.6.2 4.6.1 4.6; do
5031         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5032         if test -n "$regvalue"; then
5033             frametest=$regvalue
5034             return
5035         fi
5036         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5037         if test -n "$regvalue"; then
5038             frametest=$regvalue
5039             return
5040         fi
5041     done
5044 find_winsdk_version()
5046     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5047     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5049     unset winsdktest winsdkbinsubdir winsdklibsubdir
5051     case "$1" in
5052     7.*)
5053         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5054         if test -n "$regvalue"; then
5055             winsdktest=$regvalue
5056             winsdklibsubdir=.
5057             return
5058         fi
5059         ;;
5060     8.0|8.0A)
5061         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5062         if test -n "$regvalue"; then
5063             winsdktest=$regvalue
5064             winsdklibsubdir=win8
5065             return
5066         fi
5067         ;;
5068     8.1|8.1A)
5069         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5070         if test -n "$regvalue"; then
5071             winsdktest=$regvalue
5072             winsdklibsubdir=winv6.3
5073             return
5074         fi
5075         ;;
5076     10.0)
5077         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5078         if test -n "$regvalue"; then
5079             winsdktest=$regvalue
5080             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5081             if test -n "$regvalue"; then
5082                 winsdkbinsubdir="$regvalue".0
5083             fi
5084             winsdklibsubdir=$regvalue
5085             if test "$regvalue" = "10.0.14393"; then
5086                 winsdklibsubdir="10.0.14393.0"
5087             elif test "$regvalue" = "10.0.16299"; then
5088                 winsdklibsubdir="10.0.16299.0"
5089             elif test "$regvalue" = "10.0.15063"; then
5090                 winsdklibsubdir="10.0.15063.0"
5091                 dnl Hack needed at least by tml:
5092                 if test ! -f "${winsdktest}/Include/10.0.15063.0/um/sqlext.h" \
5093                     -a -f "${winsdktest}/Include/10.0.14393.0/um/sqlext.h"
5094                 then
5095                     winsdklibsubdir="10.0.14393.0"
5096                 fi
5097             fi
5098             return
5099         fi
5100         ;;
5101     esac
5104 find_winsdk()
5106     # Return value: From find_winsdk_version
5108     unset winsdktest
5110     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5111         find_winsdk_version $ver
5112         if test -n "$winsdktest"; then
5113             return
5114         fi
5115     done
5118 find_msms()
5120     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5121     if test $VCVER = 150; then
5122         my_msm_files="Microsoft_VC141_CRT_x86.msm ${my_msm_files}"
5123     fi
5124     AC_MSG_CHECKING([for ${my_msm_files}])
5125     msmdir=
5126     for ver in 14.0 15.0; do
5127         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5128         if test -n "$regvalue"; then
5129             for f in ${my_msm_files}; do
5130                 if test -e "$regvalue/${f}"; then
5131                     msmdir=$regvalue
5132                     break
5133                 fi
5134             done
5135         fi
5136     done
5137     dnl Is the following fallback really necessary, or was it added in response
5138     dnl to never having started Visual Studio on a given machine, so the
5139     dnl registry keys checked above had presumably not yet been created?
5140     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5141     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5142     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5143     dnl expanding to "C:\Program Files\Common Files"), which would need
5144     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5145     dnl obtain its value from cygwin:
5146     if test -z "$msmdir"; then
5147         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5148         for f in ${my_msm_files}; do
5149             if test -e "$my_msm_dir/${f}"; then
5150                 msmdir=$my_msm_dir
5151             fi
5152         done
5153     fi
5155     dnl Starting from MSVC 15.0, merge modules are located in different directory
5156     if test $VCVER = 150; then
5157         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5158             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])
5159             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5160             for f in ${my_msm_files}; do
5161                 if test -e "$my_msm_dir/${f}"; then
5162                     msmdir=$my_msm_dir
5163                     break
5164                 fi
5165             done
5166         done
5167     fi
5169     if test -n "$msmdir"; then
5170         msmdir=`cygpath -m "$msmdir"`
5171         AC_MSG_RESULT([$msmdir])
5172     else
5173         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5174             AC_MSG_ERROR([not found])
5175         else
5176             AC_MSG_WARN([not found])
5177             add_warning "MSM none of ${my_msm_files} found"
5178         fi
5179     fi
5182 find_msvc_x64_dlls()
5184     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5185     if test "$VCVER" = 150; then
5186         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5187             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT])
5188             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5189                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5190                 break
5191             fi
5192             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5193                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5194                 break
5195             fi
5196         done
5197     fi
5198     msvcdlls="msvcp140.dll vcruntime140.dll"
5199     for dll in $msvcdlls; do
5200         if ! test -f "$msvcdllpath/$dll"; then
5201             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5202         fi
5203     done
5206 dnl =========================================
5207 dnl Check for the Windows  SDK.
5208 dnl =========================================
5209 if test "$_os" = "WINNT"; then
5210     AC_MSG_CHECKING([for Windows SDK])
5211     if test "$build_os" = "cygwin"; then
5212         find_winsdk
5213         WINDOWS_SDK_HOME=$winsdktest
5215         # normalize if found
5216         if test -n "$WINDOWS_SDK_HOME"; then
5217             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5218             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5219         fi
5221         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5222     fi
5224     if test -n "$WINDOWS_SDK_HOME"; then
5225         # Remove a possible trailing backslash
5226         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5228         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5229              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5230              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5231             have_windows_sdk_headers=yes
5232         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5233              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5234              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5235             have_windows_sdk_headers=yes
5236         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5237              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5238              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5239             have_windows_sdk_headers=yes
5240         else
5241             have_windows_sdk_headers=no
5242         fi
5244         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5245             have_windows_sdk_libs=yes
5246         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5247             have_windows_sdk_libs=yes
5248         else
5249             have_windows_sdk_libs=no
5250         fi
5252         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5253             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5254 the  Windows SDK are installed.])
5255         fi
5256     fi
5258     if test -z "$WINDOWS_SDK_HOME"; then
5259         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5260     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
5261         WINDOWS_SDK_VERSION=70
5262         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
5263     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5264         WINDOWS_SDK_VERSION=80
5265         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5266     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5267         WINDOWS_SDK_VERSION=81
5268         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5269     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5270         WINDOWS_SDK_VERSION=10
5271         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5272     else
5273         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5274     fi
5275     PathFormat "$WINDOWS_SDK_HOME"
5276     WINDOWS_SDK_HOME="$formatted_path"
5277     if test "$build_os" = "cygwin"; then
5278         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5279         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5280             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5281         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5282             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5283         fi
5284     fi
5286     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5287     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5288     dnl but not in v8.0), so allow this to be overridden with a
5289     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5290     dnl and configuration error if no WiLangId.vbs is found would arguably be
5291     dnl better, but I do not know under which conditions exactly it is needed by
5292     dnl msiglobal.pm:
5293     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5294         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5295         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5296             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5297         fi
5298         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5299             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5300         fi
5301         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5302             AC_MSG_WARN([WiLangId.vbs not found - building translated packages will fail])
5303             add_warning "WiLangId.vbs not found - building translated packages will fail"
5304         fi
5305     fi
5307 AC_SUBST(WINDOWS_SDK_HOME)
5308 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5309 AC_SUBST(WINDOWS_SDK_VERSION)
5310 AC_SUBST(WINDOWS_SDK_WILANGID)
5312 if test "$build_os" = "cygwin"; then
5313     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5314     dnl dir, it also determines that dir's path w/o an arch segment if any,
5315     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5316     AC_MSG_CHECKING([for midl.exe])
5318     find_winsdk
5319     if test -n "$winsdkbinsubdir" \
5320         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5321     then
5322         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5323         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5324     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5325         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5326         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5327     elif test -f "$winsdktest/Bin/midl.exe"; then
5328         MIDL_PATH=$winsdktest/Bin
5329         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5330     fi
5331     if test ! -f "$MIDL_PATH/midl.exe"; then
5332         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5333     else
5334         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5335     fi
5337     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5338     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5340     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5341          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5342          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5343          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5344     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5345          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5346          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5347          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5348     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5349          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5350          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5351          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5352     else
5353         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5354     fi
5356     dnl Check csc.exe
5357     AC_MSG_CHECKING([for csc.exe])
5358     find_csc
5359     if test -f "$csctest/csc.exe"; then
5360         CSC_PATH="$csctest"
5361     fi
5362     if test ! -f "$CSC_PATH/csc.exe"; then
5363         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5364     else
5365         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5366     fi
5368     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5370     dnl Check al.exe
5371     AC_MSG_CHECKING([for al.exe])
5372     find_winsdk
5373     if test -n "$winsdkbinsubdir" \
5374         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5375     then
5376         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5377     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5378         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5379     elif test -f "$winsdktest/Bin/al.exe"; then
5380         AL_PATH="$winsdktest/Bin"
5381     fi
5383     if test -z "$AL_PATH"; then
5384         find_al
5385         if test -f "$altest/bin/al.exe"; then
5386             AL_PATH="$altest/bin"
5387         elif test -f "$altest/al.exe"; then
5388             AL_PATH="$altest"
5389         fi
5390     fi
5391     if test ! -f "$AL_PATH/al.exe"; then
5392         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5393     else
5394         AC_MSG_RESULT([$AL_PATH/al.exe])
5395     fi
5397     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5399     dnl Check mscoree.lib / .NET Framework dir
5400     AC_MSG_CHECKING(.NET Framework)
5401     find_dotnetsdk
5402     if test -f "$frametest/lib/mscoree.lib"; then
5403         DOTNET_FRAMEWORK_HOME="$frametest"
5404     else
5405         find_winsdk
5406         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5407             DOTNET_FRAMEWORK_HOME="$winsdktest"
5408         else
5409             find_dotnetsdk46
5410             PathFormat "$frametest"
5411             frametest="$formatted_path"
5412             if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5413                  DOTNET_FRAMEWORK_HOME="$frametest"
5414             fi
5415         fi
5416     fi
5418     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
5419         AC_MSG_ERROR([mscoree.lib not found])
5420     fi
5421     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5423     PathFormat "$MIDL_PATH"
5424     MIDL_PATH="$formatted_path"
5426     PathFormat "$AL_PATH"
5427     AL_PATH="$formatted_path"
5429     PathFormat "$DOTNET_FRAMEWORK_HOME"
5430     DOTNET_FRAMEWORK_HOME="$formatted_path"
5432     PathFormat "$CSC_PATH"
5433     CSC_PATH="$formatted_path"
5436 dnl ===================================================================
5437 dnl Check if stdc headers are available excluding MSVC.
5438 dnl ===================================================================
5439 if test "$_os" != "WINNT"; then
5440     AC_HEADER_STDC
5443 dnl ===================================================================
5444 dnl Testing for C++ compiler and version...
5445 dnl ===================================================================
5447 if test "$_os" != "WINNT"; then
5448     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5449     save_CXXFLAGS=$CXXFLAGS
5450     AC_PROG_CXX
5451     CXXFLAGS=$save_CXXFLAGS
5452 else
5453     if test -n "$CC" -a -z "$CXX"; then
5454         CXX="$CC"
5455     fi
5458 dnl At least MSVC 2015 Update 1 is known to sporadically emit warning C4592
5459 dnl ("implementation limitation" when defining OUStringLiteral variables in
5460 dnl vcl/source/app/IconThemeInfo.cxx), while Update 3 is known good, and it is
5461 dnl probably a good idea to require that anyway.  A reliable way to check for
5462 dnl MSVC 2015 Update 3 appears to be to check for support of C++17 nested
5463 dnl namespace definitions (which requires /std:c++latest to be enabled):
5464 if test "$COM" = MSC -a "$VCVER" = 140; then
5465     AC_MSG_CHECKING([whether MSVC 2015 compiler $MSVC_CXX is at least Update 3])
5466     save_CXX=$CXX
5467     save_CXXFLAGS=$CXXFLAGS
5468     CXX=$MSVC_CXX
5469     CXXFLAGS="$CXXFLAGS /std:c++latest"
5470     AC_LANG_PUSH([C++])
5471     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5472         namespace A::B {}
5473     ]])], [good=yes], [good=no])
5474     AC_LANG_POP([C++])
5475     CXX=$save_CXX
5476     CXXFLAGS=$save_CXXFLAGS
5477     AC_MSG_RESULT([$good])
5478     if test "$good" = no; then
5479         AC_MSG_ERROR([When using MSVC 2015, at least Update 3 must be installed])
5480     fi
5483 dnl check for GNU C++ compiler version
5484 if test "$GXX" = "yes"; then
5485     AC_MSG_CHECKING([the GNU C++ compiler version])
5487     _gpp_version=`$CXX -dumpversion`
5488     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5490     if test "$_gpp_majmin" -lt "401"; then
5491         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5492     else
5493         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5494     fi
5496     dnl see https://code.google.com/p/android/issues/detail?id=41770
5497     if test "$_gpp_majmin" -ge "401"; then
5498         glibcxx_threads=no
5499         AC_LANG_PUSH([C++])
5500         AC_REQUIRE_CPP
5501         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5502         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5503             #include <bits/c++config.h>]],[[
5504             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5505             && !defined(_GLIBCXX__PTHREADS) \
5506             && !defined(_GLIBCXX_HAS_GTHREADS)
5507             choke me
5508             #endif
5509         ]])],[AC_MSG_RESULT([yes])
5510         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5511         AC_LANG_POP([C++])
5512         if test $glibcxx_threads = yes; then
5513             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5514         fi
5515      fi
5517 AC_SUBST(BOOST_CXXFLAGS)
5520 # prefx CXX with ccache if needed
5522 if test "$CCACHE" != ""; then
5523     AC_MSG_CHECKING([whether $CXX is already ccached])
5524     AC_LANG_PUSH([C++])
5525     save_CXXFLAGS=$CXXFLAGS
5526     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5527     dnl an empty program will do, we're checking the compiler flags
5528     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5529                       [use_ccache=yes], [use_ccache=no])
5530     if test $use_ccache = yes; then
5531         AC_MSG_RESULT([yes])
5532     else
5533         CXX="$CCACHE $CXX"
5534         AC_MSG_RESULT([no])
5535     fi
5536     CXXFLAGS=$save_CXXFLAGS
5537     AC_LANG_POP([C++])
5540 dnl ===================================================================
5541 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5542 dnl ===================================================================
5544 if test "$_os" != "WINNT"; then
5545     AC_PROG_CXXCPP
5547     dnl Check whether there's a C pre-processor.
5548     AC_PROG_CPP
5552 dnl ===================================================================
5553 dnl Find integral type sizes and alignments
5554 dnl ===================================================================
5556 if test "$_os" != "WINNT"; then
5558 if test "$_os" == "iOS"; then
5559     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5560     ac_cv_sizeof_long=8
5561     ac_cv_sizeof_short=2
5562     ac_cv_sizeof_int=4
5563     ac_cv_sizeof_long_long=8
5564     ac_cv_sizeof_double=8
5565     ac_cv_sizeof_voidp=8
5566 else
5567     AC_CHECK_SIZEOF(long)
5568     AC_CHECK_SIZEOF(short)
5569     AC_CHECK_SIZEOF(int)
5570     AC_CHECK_SIZEOF(long long)
5571     AC_CHECK_SIZEOF(double)
5572     AC_CHECK_SIZEOF(void*)
5575     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5576     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5577     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5578     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5579     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5581     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5582     m4_pattern_allow([AC_CHECK_ALIGNOF])
5583     m4_ifdef([AC_CHECK_ALIGNOF],
5584         [
5585             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5586             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5587             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5588             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5589         ],
5590         [
5591             case "$_os-$host_cpu" in
5592             Linux-i686)
5593                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5594                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5595                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5596                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5597                 ;;
5598             Linux-x86_64)
5599                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5600                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5601                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5602                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5603                 ;;
5604             *)
5605                 if test -z "$ac_cv_alignof_short" -o \
5606                         -z "$ac_cv_alignof_int" -o \
5607                         -z "$ac_cv_alignof_long" -o \
5608                         -z "$ac_cv_alignof_double"; then
5609                    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.])
5610                 fi
5611                 ;;
5612             esac
5613         ])
5615     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5616     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5617     if test $ac_cv_sizeof_long -eq 8; then
5618         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5619     elif test $ac_cv_sizeof_double -eq 8; then
5620         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5621     else
5622         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5623     fi
5625     dnl Check for large file support
5626     AC_SYS_LARGEFILE
5627     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5628         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5629     fi
5630     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5631         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5632     fi
5633 else
5634     # Hardcode for MSVC
5635     SAL_TYPES_SIZEOFSHORT=2
5636     SAL_TYPES_SIZEOFINT=4
5637     SAL_TYPES_SIZEOFLONG=4
5638     SAL_TYPES_SIZEOFLONGLONG=8
5639     if test "$BITNESS_OVERRIDE" = ""; then
5640         SAL_TYPES_SIZEOFPOINTER=4
5641     else
5642         SAL_TYPES_SIZEOFPOINTER=8
5643     fi
5644     SAL_TYPES_ALIGNMENT2=2
5645     SAL_TYPES_ALIGNMENT4=4
5646     SAL_TYPES_ALIGNMENT8=8
5647     LFS_CFLAGS=''
5649 AC_SUBST(LFS_CFLAGS)
5651 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5652 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5653 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5654 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5655 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5656 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5657 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5658 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5660 dnl ===================================================================
5661 dnl Check whether to enable runtime optimizations
5662 dnl ===================================================================
5663 ENABLE_RUNTIME_OPTIMIZATIONS=
5664 AC_MSG_CHECKING([whether to enable runtime optimizations])
5665 if test -z "$enable_runtime_optimizations"; then
5666     for i in $CC; do
5667         case $i in
5668         -fsanitize=*)
5669             enable_runtime_optimizations=no
5670             break
5671             ;;
5672         esac
5673     done
5675 if test "$enable_runtime_optimizations" != no; then
5676     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5677     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5678     AC_MSG_RESULT([yes])
5679 else
5680     AC_MSG_RESULT([no])
5682 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5684 dnl ===================================================================
5685 dnl Check if valgrind headers are available
5686 dnl ===================================================================
5687 ENABLE_VALGRIND=
5688 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
5689     prev_cppflags=$CPPFLAGS
5690     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5691     # or where does it come from?
5692     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5693     AC_CHECK_HEADER([valgrind/valgrind.h],
5694         [ENABLE_VALGRIND=TRUE])
5695     CPPFLAGS=$prev_cppflags
5697 AC_SUBST([ENABLE_VALGRIND])
5698 if test -z "$ENABLE_VALGRIND"; then
5699     if test "$with_valgrind" = yes; then
5700         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
5701     fi
5702     VALGRIND_CFLAGS=
5704 AC_SUBST([VALGRIND_CFLAGS])
5707 dnl ===================================================================
5708 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5709 dnl ===================================================================
5711 # We need at least the sys/sdt.h include header.
5712 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5713 if test "$SDT_H_FOUND" = "TRUE"; then
5714     # Found sys/sdt.h header, now make sure the c++ compiler works.
5715     # Old g++ versions had problems with probes in constructors/destructors.
5716     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5717     AC_LANG_PUSH([C++])
5718     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5719     #include <sys/sdt.h>
5720     class ProbeClass
5721     {
5722     private:
5723       int& ref;
5724       const char *name;
5726     public:
5727       ProbeClass(int& v, const char *n) : ref(v), name(n)
5728       {
5729         DTRACE_PROBE2(_test_, cons, name, ref);
5730       }
5732       void method(int min)
5733       {
5734         DTRACE_PROBE3(_test_, meth, name, ref, min);
5735         ref -= min;
5736       }
5738       ~ProbeClass()
5739       {
5740         DTRACE_PROBE2(_test_, dest, name, ref);
5741       }
5742     };
5743     ]],[[
5744     int i = 64;
5745     DTRACE_PROBE1(_test_, call, i);
5746     ProbeClass inst = ProbeClass(i, "call");
5747     inst.method(24);
5748     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5749           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5750     AC_LANG_POP([C++])
5752 AC_CONFIG_HEADERS([config_host/config_probes.h])
5754 dnl ===================================================================
5755 dnl GCC features
5756 dnl ===================================================================
5757 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
5758     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5759     save_CFLAGS=$CFLAGS
5760     CFLAGS="$CFLAGS -Werror -mno-avx"
5761     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5762     CFLAGS=$save_CFLAGS
5763     if test "$HAVE_GCC_AVX" = "TRUE"; then
5764         AC_MSG_RESULT([yes])
5765     else
5766         AC_MSG_RESULT([no])
5767     fi
5769     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5770     save_CFLAGS=$CFLAGS
5771     CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
5772     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5773     CFLAGS=$save_CFLAGS
5774     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5775         AC_MSG_RESULT([yes])
5776     else
5777         AC_MSG_RESULT([no])
5778     fi
5780     AC_MSG_CHECKING([whether $CC supports atomic functions])
5781     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5782     int v = 0;
5783     if (__sync_add_and_fetch(&v, 1) != 1 ||
5784         __sync_sub_and_fetch(&v, 1) != 0)
5785         return 1;
5786     __sync_synchronize();
5787     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5788         v != 1)
5789         return 1;
5790     return 0;
5791 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5792     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5793         AC_MSG_RESULT([yes])
5794         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5795     else
5796         AC_MSG_RESULT([no])
5797     fi
5799     AC_MSG_CHECKING([whether $CC supports __builtin_ffs])
5800     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
5801     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
5802         AC_MSG_RESULT([yes])
5803         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
5804     else
5805         AC_MSG_RESULT([no])
5806     fi
5808     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5809     save_CFLAGS=$CFLAGS
5810     CFLAGS="$CFLAGS -Werror"
5811     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5812             __attribute__((deprecated("test"))) void f();
5813         ])], [
5814             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5815             AC_MSG_RESULT([yes])
5816         ], [AC_MSG_RESULT([no])])
5817     CFLAGS=$save_CFLAGS
5819     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
5820     AC_LANG_PUSH([C++])
5821     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5822             #include <cstddef>
5823             #include <cxxabi.h>
5824             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
5825         ])], [
5826             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
5827             AC_MSG_RESULT([yes])
5828         ], [AC_MSG_RESULT([no])])
5829     AC_LANG_POP([C++])
5831     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
5832     AC_LANG_PUSH([C++])
5833     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5834             #include <cstddef>
5835             #include <cxxabi.h>
5836             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
5837         ])], [
5838             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
5839             AC_MSG_RESULT([yes])
5840         ], [AC_MSG_RESULT([no])])
5841     AC_LANG_POP([C++])
5843     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
5844     AC_LANG_PUSH([C++])
5845     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5846             #include <cxxabi.h>
5847             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
5848         ])], [
5849             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
5850             AC_MSG_RESULT([yes])
5851         ], [AC_MSG_RESULT([no])])
5852     AC_LANG_POP([C++])
5854     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
5855     AC_LANG_PUSH([C++])
5856     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5857             #include <cstddef>
5858             #include <cxxabi.h>
5859             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
5860         ])], [
5861             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
5862             AC_MSG_RESULT([yes])
5863         ], [AC_MSG_RESULT([no])])
5864     AC_LANG_POP([C++])
5866     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
5867     AC_LANG_PUSH([C++])
5868     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5869             #include <cstddef>
5870             #include <cxxabi.h>
5871             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
5872         ])], [
5873             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
5874             AC_MSG_RESULT([yes])
5875         ], [AC_MSG_RESULT([no])])
5876     AC_LANG_POP([C++])
5878     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
5879     AC_LANG_PUSH([C++])
5880     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5881             #include <cxxabi.h>
5882             void * f() { return __cxxabiv1::__cxa_get_globals(); }
5883         ])], [
5884             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
5885             AC_MSG_RESULT([yes])
5886         ], [AC_MSG_RESULT([no])])
5887     AC_LANG_POP([C++])
5889     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
5890     AC_LANG_PUSH([C++])
5891     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5892             #include <cxxabi.h>
5893             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
5894         ])], [
5895             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
5896             AC_MSG_RESULT([yes])
5897         ], [AC_MSG_RESULT([no])])
5898     AC_LANG_POP([C++])
5900     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
5901     AC_LANG_PUSH([C++])
5902     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5903             #include <cstddef>
5904             #include <cxxabi.h>
5905             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
5906         ])], [
5907             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
5908             AC_MSG_RESULT([yes])
5909         ], [AC_MSG_RESULT([no])])
5910     AC_LANG_POP([C++])
5912     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
5913     AC_LANG_PUSH([C++])
5914     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5915             #include <cstddef>
5916             #include <cxxabi.h>
5917             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
5918         ])], [
5919             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
5920             AC_MSG_RESULT([yes])
5921         ], [AC_MSG_RESULT([no])])
5922     AC_LANG_POP([C++])
5924     dnl Available in GCC 4.9 and at least since Clang 3.4:
5925     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
5926     AC_LANG_PUSH([C++])
5927     save_CXXFLAGS=$CXXFLAGS
5928     CXXFLAGS="$CXXFLAGS -Werror"
5929     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5930             struct __attribute__((warn_unused)) dummy {};
5931         ])], [
5932             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
5933             AC_MSG_RESULT([yes])
5934         ], [AC_MSG_RESULT([no])])
5935     CXXFLAGS=$save_CXXFLAGS
5936 AC_LANG_POP([C++])
5939 AC_SUBST(HAVE_GCC_AVX)
5940 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
5941 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
5942 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
5944 dnl ===================================================================
5945 dnl Identify the C++ library
5946 dnl ===================================================================
5948 AC_MSG_CHECKING([What the C++ library is])
5949 AC_LANG_PUSH([C++])
5950 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5951 #include <utility>
5952 #ifndef __GLIBCXX__
5953 foo bar
5954 #endif
5955 ]])],
5956     [CPP_LIBRARY=GLIBCXX
5957      cpp_library_name="GNU libstdc++"
5958     ],
5959     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5960 #include <utility>
5961 #ifndef _LIBCPP_VERSION
5962 foo bar
5963 #endif
5964 ]])],
5965     [CPP_LIBRARY=LIBCPP
5966      cpp_library_name="LLVM libc++"
5967      AC_DEFINE([HAVE_LIBCXX])
5968     ],
5969     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5970 #include <utility>
5971 #ifndef _MSC_VER
5972 foo bar
5973 #endif
5974 ]])],
5975     [CPP_LIBRARY=MSVCRT
5976      cpp_library_name="Microsoft"
5977     ],
5978     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
5979 AC_MSG_RESULT([$cpp_library_name])
5980 AC_LANG_POP([C++])
5982 dnl ===================================================================
5983 dnl Check for gperf
5984 dnl ===================================================================
5985 AC_PATH_PROG(GPERF, gperf)
5986 if test -z "$GPERF"; then
5987     AC_MSG_ERROR([gperf not found but needed. Install it.])
5989 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5990     GPERF=`cygpath -m $GPERF`
5992 AC_MSG_CHECKING([gperf version])
5993 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
5994     AC_MSG_RESULT([OK])
5995 else
5996     AC_MSG_ERROR([too old, you need at least 3.0.0])
5998 AC_SUBST(GPERF)
6000 dnl ===================================================================
6001 dnl Check for system libcmis
6002 dnl ===================================================================
6003 # libcmis requires curl and we can't build curl for iOS
6004 if test $_os != iOS; then
6005     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.0])
6006     ENABLE_LIBCMIS=TRUE
6007 else
6008     ENABLE_LIBCMIS=
6010 AC_SUBST(ENABLE_LIBCMIS)
6012 dnl ===================================================================
6013 dnl C++11
6014 dnl ===================================================================
6016 my_cxx17switches=
6017 libo_FUZZ_ARG_ENABLE(c++17,
6018     AS_HELP_STRING([--disable-c++17],
6019         [Do not attempt to run GCC/Clang in C++17 mode (needed for Coverity).])
6022 CXXFLAGS_CXX11=
6023 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6024     AC_MSG_CHECKING([whether $CXX supports C++11])
6025     AC_MSG_RESULT(yes)
6026     # MSVC supports (a subset of) CXX11 without any switch
6027 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6028     HAVE_CXX11=
6029     AC_MSG_CHECKING([whether $CXX supports C++17, C++14, or C++11])
6030     dnl But only use C++17 if the gperf that is being used knows not to emit
6031     dnl "register" in C++ output:
6032     printf 'foo\n' | $GPERF -L C++ > conftest.inc
6033     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'
6034     if test "$enable_c__17" != no; then
6035         my_flags="-std=gnu++17 -std=gnu++1z -std=c++17 -std=c++1z $my_flags"
6036     fi
6037     for flag in $my_flags; do
6038         if test "$COM" = MSC; then
6039             flag="-Xclang $flag"
6040         fi
6041         save_CXXFLAGS=$CXXFLAGS
6042         CXXFLAGS="$CXXFLAGS $flag -Werror"
6043         if test "$SYSTEM_LIBCMIS" = TRUE; then
6044             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6045         fi
6046         AC_LANG_PUSH([C++])
6047         dnl Clang 3.9 supports __float128 since
6048         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6049         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6050         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6051         dnl $flag is supported below, so check this first):
6052         my_float128hack=
6053         my_float128hack_impl=-D__float128=void
6054         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6055             #include <vector>
6056             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6057             // (__float128)
6058             ]])
6059         ],,[
6060             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6061             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6062             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6063             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6064             dnl place where __float128 is used is in a template specialization, -D__float128=void
6065             dnl will avoid the problem there while still causing a problem if somebody actually uses
6066             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6067             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6068             dnl "fixed" with this hack):
6069             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6070             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6071                 #include <vector>
6072                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6073                 // (__float128)
6074                 ]])
6075             ],[my_float128hack=$my_float128hack_impl])
6076         ])
6077         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6078             #include <algorithm>
6079             #include <functional>
6080             #include <vector>
6082             #include <string.h>
6083             #pragma GCC diagnostic push
6084             #pragma GCC diagnostic ignored "-Wpragmas"
6085                 // make GCC not warn about next pragma
6086             #pragma GCC diagnostic ignored "-Wdeprecated-register"
6087                 // make Clang with -std < C++17 not even warn about register
6088             #include "conftest.inc"
6089             #pragma GCC diagnostic pop
6091             #if defined SYSTEM_LIBCMIS
6092             // See ucb/source/ucp/cmis/auth_provider.hxx:
6093             #if __GNUC__ >= 7
6094             #pragma GCC diagnostic push
6095             #pragma GCC diagnostic ignored "-Wdeprecated"
6096             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6097             #endif
6098             #include <libcmis/libcmis.hxx>
6099             #if __GNUC__ >= 7
6100             #pragma GCC diagnostic pop
6101             #endif
6102             #endif
6104             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6105                 std::sort(v.begin(), v.end(), fn);
6106             }
6107             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6108         AC_LANG_POP([C++])
6109         CXXFLAGS=$save_CXXFLAGS
6110         if test -n "$CXXFLAGS_CXX11"; then
6111             HAVE_CXX11=TRUE
6112             break
6113         fi
6114     done
6115     rm conftest.inc
6116     if test "$HAVE_CXX11" = TRUE; then
6117         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6118     else
6119         AC_MSG_ERROR(no)
6120     fi
6122 AC_SUBST(CXXFLAGS_CXX11)
6124 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6125 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6126 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6127 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6128 dnl again towards 4.7.2:
6129 if test $CPP_LIBRARY = GLIBCXX; then
6130     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6131     AC_LANG_PUSH([C++])
6132     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6133 #include <list>
6134 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6135     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6136     //   GCC 4.7.0: 20120322
6137     //   GCC 4.7.1: 20120614
6138     // and using a range check is not possible as the mapping between
6139     // __GLIBCXX__ values and GCC versions is not monotonic
6140 /* ok */
6141 #else
6142 abi broken
6143 #endif
6144         ]])], [AC_MSG_RESULT(no, ok)],
6145         [AC_MSG_ERROR(yes)])
6146     AC_LANG_POP([C++])
6149 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6150 save_CXXFLAGS=$CXXFLAGS
6151 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6152 AC_LANG_PUSH([C++])
6154 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6155 #include <stddef.h>
6157 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6159 namespace
6161         struct b
6162         {
6163                 int i;
6164                 int j;
6165         };
6167 ]], [[
6168 struct a
6170         int i;
6171         int j;
6173 a thinga[]={{0,0}, {1,1}};
6174 b thingb[]={{0,0}, {1,1}};
6175 size_t i = sizeof(sal_n_array_size(thinga));
6176 size_t j = sizeof(sal_n_array_size(thingb));
6177 return !(i != 0 && j != 0);
6179     ], [ AC_MSG_RESULT(yes) ],
6180     [ AC_MSG_ERROR(no)])
6181 AC_LANG_POP([C++])
6182 CXXFLAGS=$save_CXXFLAGS
6184 AC_MSG_CHECKING([whether $CXX supports C++14 constexpr])
6185 save_CXXFLAGS=$CXXFLAGS
6186 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6187 AC_LANG_PUSH([C++])
6188 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6189     // A somewhat over-complicated way of checking for
6190     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6191     // in constexpr function":
6192     #include <cassert>
6193     template<typename T> inline constexpr T f(T x) { return x; }
6194     template<typename T> inline constexpr T g(T x) {
6195         assert(f(static_cast<int>(x)));
6196         return x;
6197     }
6198     enum E { e };
6199     auto v = g(E::e);
6201     struct S {
6202         int n_;
6203         constexpr bool f() {
6204             int n = n_;
6205             int i = 0;
6206             while (n > 0) { --n; ++i; }
6207             assert(i >= 0);
6208             return i == 0;
6209         }
6210     };
6211     constexpr auto v2 = S{10}.f();
6212     ]])], [cxx14_constexpr=yes], [cxx14_constexpr=no])
6213 AC_LANG_POP([C++])
6214 CXXFLAGS=$save_CXXFLAGS
6215 AC_MSG_RESULT([$cxx14_constexpr])
6216 if test "$cxx14_constexpr" = yes; then
6217     AC_DEFINE([HAVE_CXX14_CONSTEXPR])
6220 dnl _Pragma support (may require C++11)
6221 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6222     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6223     AC_LANG_PUSH([C++])
6224     save_CXXFLAGS=$CXXFLAGS
6225     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6226     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6227             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6228         ])], [
6229             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6230             AC_MSG_RESULT([yes])
6231         ], [AC_MSG_RESULT([no])])
6232     AC_LANG_POP([C++])
6233     CXXFLAGS=$save_CXXFLAGS
6236 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6237 if test "$GCC" = yes; then
6238     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6239     AC_LANG_PUSH([C++])
6240     save_CXXFLAGS=$CXXFLAGS
6241     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6242     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6243     CXXFLAGS=$save_CXXFLAGS
6244     AC_LANG_POP([C++])
6245     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6246         AC_MSG_RESULT([yes])
6247     else
6248         AC_MSG_RESULT([no])
6249     fi
6251 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6253 dnl ===================================================================
6254 dnl system stl sanity tests
6255 dnl ===================================================================
6256 if test "$_os" != "WINNT"; then
6258     AC_LANG_PUSH([C++])
6260     save_CPPFLAGS="$CPPFLAGS"
6261     if test -n "$MACOSX_SDK_PATH"; then
6262         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6263     fi
6265     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6266     # only.
6267     if test "$CPP_LIBRARY" = GLIBCXX; then
6268         dnl gcc#19664, gcc#22482, rhbz#162935
6269         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6270         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6271         AC_MSG_RESULT([$stlvisok])
6272         if test "$stlvisok" = "no"; then
6273             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6274         fi
6275     fi
6277     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6278     # when we don't make any dynamic libraries?
6279     if test "$DISABLE_DYNLOADING" = ""; then
6280         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6281         cat > conftestlib1.cc <<_ACEOF
6282 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6283 struct S2: S1<int> { virtual ~S2(); };
6284 S2::~S2() {}
6285 _ACEOF
6286         cat > conftestlib2.cc <<_ACEOF
6287 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6288 struct S2: S1<int> { virtual ~S2(); };
6289 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6290 _ACEOF
6291         gccvisinlineshiddenok=yes
6292         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6293             gccvisinlineshiddenok=no
6294         else
6295             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6296             dnl known to not work with -z defs (unsetting which makes the test
6297             dnl moot, though):
6298             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6299             if test "$COM_IS_CLANG" = TRUE; then
6300                 for i in $CXX $CXXFLAGS; do
6301                     case $i in
6302                     -fsanitize=*)
6303                         my_linkflagsnoundefs=
6304                         break
6305                         ;;
6306                     esac
6307                 done
6308             fi
6309             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6310                 gccvisinlineshiddenok=no
6311             fi
6312         fi
6314         rm -fr libconftest*
6315         AC_MSG_RESULT([$gccvisinlineshiddenok])
6316         if test "$gccvisinlineshiddenok" = "no"; then
6317             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6318         fi
6319     fi
6321    AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6322     cat >visibility.cxx <<_ACEOF
6323 #pragma GCC visibility push(hidden)
6324 struct __attribute__ ((visibility ("default"))) TestStruct {
6325   static void Init();
6327 __attribute__ ((visibility ("default"))) void TestFunc() {
6328   TestStruct::Init();
6330 _ACEOF
6331     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6332         gccvisbroken=yes
6333     else
6334         case "$host_cpu" in
6335         i?86|x86_64)
6336             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6337                 gccvisbroken=no
6338             else
6339                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6340                     gccvisbroken=no
6341                 else
6342                     gccvisbroken=yes
6343                 fi
6344             fi
6345             ;;
6346         *)
6347             gccvisbroken=no
6348             ;;
6349         esac
6350     fi
6351     rm -f visibility.s visibility.cxx
6353     AC_MSG_RESULT([$gccvisbroken])
6354     if test "$gccvisbroken" = "yes"; then
6355         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6356     fi
6358     CPPFLAGS="$save_CPPFLAGS"
6360     AC_LANG_POP([C++])
6363 dnl ===================================================================
6364 dnl  Clang++ tests
6365 dnl ===================================================================
6367 HAVE_GCC_FNO_DEFAULT_INLINE=
6368 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6369 if test "$GCC" = "yes"; then
6370     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6371     AC_LANG_PUSH([C++])
6372     save_CXXFLAGS=$CXXFLAGS
6373     CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6374     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6375     CXXFLAGS=$save_CXXFLAGS
6376     AC_LANG_POP([C++])
6377     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6378         AC_MSG_RESULT([yes])
6379     else
6380         AC_MSG_RESULT([no])
6381     fi
6383     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6384     AC_LANG_PUSH([C++])
6385     save_CXXFLAGS=$CXXFLAGS
6386     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6387     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6388     CXXFLAGS=$save_CXXFLAGS
6389     AC_LANG_POP([C++])
6390     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6391         AC_MSG_RESULT([yes])
6392     else
6393         AC_MSG_RESULT([no])
6394     fi
6396 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6397 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6399 dnl ===================================================================
6400 dnl Compiler plugins
6401 dnl ===================================================================
6403 COMPILER_PLUGINS=
6404 # currently only Clang
6406 if test "$COM_IS_CLANG" != "TRUE"; then
6407     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6408         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6409         enable_compiler_plugins=no
6410     fi
6413 if test "$COM_IS_CLANG" = "TRUE"; then
6414     if test -n "$enable_compiler_plugins"; then
6415         compiler_plugins="$enable_compiler_plugins"
6416     elif test -n "$ENABLE_DBGUTIL"; then
6417         compiler_plugins=test
6418     else
6419         compiler_plugins=no
6420     fi
6421     if test "$compiler_plugins" != no -a "$CLANGVER" -lt 30800; then
6422         if test "$compiler_plugins" = yes; then
6423             AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 3.8.0.])
6424         else
6425             compiler_plugins=no
6426         fi
6427     fi
6428     if test "$compiler_plugins" != "no"; then
6429         dnl The prefix where Clang resides, override to where Clang resides if
6430         dnl using a source build:
6431         if test -z "$CLANGDIR"; then
6432             CLANGDIR=/usr
6433         fi
6434         AC_LANG_PUSH([C++])
6435         save_CPPFLAGS=$CPPFLAGS
6436         save_CXX=$CXX
6437         # compiler plugins must be built with "native" compiler that was used to build Clang itself:
6438         : "${COMPILER_PLUGINS_CXX=g++}"
6439         CXX=$COMPILER_PLUGINS_CXX
6440         CPPFLAGS="$CPPFLAGS -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6441         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6442             [COMPILER_PLUGINS=TRUE],
6443             [
6444             if test "$compiler_plugins" = "yes"; then
6445                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6446             else
6447                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6448                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6449             fi
6450             ])
6451         CXX=$save_CXX
6452         CPPFLAGS=$save_CPPFLAGS
6453         AC_LANG_POP([C++])
6454     fi
6455 else
6456     if test "$enable_compiler_plugins" = "yes"; then
6457         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6458     fi
6460 AC_SUBST(COMPILER_PLUGINS)
6461 AC_SUBST(COMPILER_PLUGINS_CXX)
6462 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
6463 AC_SUBST(COMPILER_PLUGINS_DEBUG)
6464 AC_SUBST(CLANGDIR)
6465 AC_SUBST(CLANGLIBDIR)
6467 # Plugin to help linker.
6468 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6469 # This makes --enable-lto build with clang work.
6470 AC_SUBST(LD_PLUGIN)
6472 dnl ===================================================================
6473 dnl allocator
6474 dnl ===================================================================
6475 AC_MSG_CHECKING([which memory allocator to use])
6476 if test "$with_alloc" = "system"; then
6477     AC_MSG_RESULT([system])
6478     ALLOC="SYS_ALLOC"
6480 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6481     AC_MSG_RESULT([internal])
6483 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6484 AC_SUBST(HAVE_POSIX_FALLOCATE)
6485 AC_SUBST(ALLOC)
6487 dnl ===================================================================
6488 dnl Custom build version
6489 dnl ===================================================================
6491 AC_MSG_CHECKING([whether to add custom build version])
6492 if test "$with_build_version" != ""; then
6493     BUILD_VER_STRING=$with_build_version
6494     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6495 else
6496     BUILD_VER_STRING=
6497     AC_MSG_RESULT([no])
6499 AC_SUBST(BUILD_VER_STRING)
6501 JITC_PROCESSOR_TYPE=""
6502 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6503     # IBMs JDK needs this...
6504     JITC_PROCESSOR_TYPE=6
6505     export JITC_PROCESSOR_TYPE
6507 AC_SUBST([JITC_PROCESSOR_TYPE])
6509 # Misc Windows Stuff
6510 AC_ARG_WITH(vcredist-dir,
6511     AS_HELP_STRING([--with-vcredist-dir],
6512         [path to the directory with the arch-specific executables (vc_redist.x64.exe, vc_redist.x86.exe)
6513         for packaging into the installsets (without those the target system needs to install
6514         the Visual C++ Runtimes manually)]),
6516 VCREDIST_DIR="$with_vcredist_dir"
6517 if test $_os = "WINNT"; then
6518     find_msvc_x64_dlls
6519     find_msms
6520     MSVC_DLL_PATH="$msvcdllpath"
6521     MSVC_DLLS="$msvcdlls"
6522     MSM_PATH="$msmdir"
6523     SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6524     if test "$VCREDIST_DIR" = "no"; then
6525         dnl explicitly disabled
6526         VCREDIST_DIR=""
6527     else
6528         if test -f "$VCREDIST_DIR/vc_redist.$WINDOWS_SDK_ARCH.exe"; then
6529             VCREDIST_EXE="vc_redist.$WINDOWS_SDK_ARCH.exe"
6530         else
6531             VCREDIST_DIR=""
6532             if test -n "$PKGFORMAT"; then
6533                for i in "$PKGFORMAT"; do
6534                    case "$i" in
6535                    msi)
6536                        AC_MSG_WARN([--without-vcredist-dir not specified or exe not found - installer will have runtime dependency])
6537                        add_warning "--without-vcredist-dir not specified or exe not found - installer will have runtime dependency"
6538                        ;;
6539                    esac
6540                done
6541             fi
6542         fi
6543     fi
6546 AC_SUBST(VCREDIST_DIR)
6547 AC_SUBST(VCREDIST_EXE)
6548 AC_SUBST(MSVC_DLL_PATH)
6549 AC_SUBST(MSVC_DLLS)
6550 AC_SUBST(MSM_PATH)
6552 dnl ===================================================================
6553 dnl Checks for Java
6554 dnl ===================================================================
6555 if test "$ENABLE_JAVA" != ""; then
6557     # Windows-specific tests
6558     if test "$build_os" = "cygwin"; then
6559         if test "$BITNESS_OVERRIDE" = 64; then
6560             bitness=64
6561         else
6562             bitness=32
6563         fi
6565         if test -z "$with_jdk_home"; then
6566             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
6567             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
6568             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
6569             if test -n "$regvalue"; then
6570                 ver=$regvalue
6571                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
6572                 _jdk_home=$regvalue
6573             fi
6574             if test -z "$with_jdk_home"; then
6575                 for ver in 1.8 1.7 1.6; do
6576                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6577                     if test -n "$regvalue"; then
6578                         _jdk_home=$regvalue
6579                         break
6580                     fi
6581                 done
6582             fi
6583             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6584                 with_jdk_home="$_jdk_home"
6585                 howfound="found automatically"
6586             else
6587                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6588             fi
6589         else
6590             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6591             howfound="you passed"
6592         fi
6593     fi
6595     # 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.
6596     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6597     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6598         with_jdk_home=`/usr/libexec/java_home`
6599     fi
6601     JAVA_HOME=; export JAVA_HOME
6602     if test -z "$with_jdk_home"; then
6603         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6604     else
6605         _java_path="$with_jdk_home/bin/$with_java"
6606         dnl Check if there is a Java interpreter at all.
6607         if test -x "$_java_path"; then
6608             JAVAINTERPRETER=$_java_path
6609         else
6610             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6611         fi
6612     fi
6614     dnl Check that the JDK found is correct architecture (at least 2 reasons to
6615     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
6616     dnl loaded by java to run JunitTests:
6617     if test "$build_os" = "cygwin"; then
6618         shortjdkhome=`cygpath -d "$with_jdk_home"`
6619         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
6620             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6621             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6622         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
6623             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6624             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6625         fi
6627         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6628             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6629         fi
6630         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6631     elif test "$cross_compiling" != "yes"; then
6632         case $CPUNAME in
6633             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
6634                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6635                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6636                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6637                 fi
6638                 ;;
6639             *) # assumption: everything else 32-bit
6640                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6641                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6642                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6643                 fi
6644                 ;;
6645         esac
6646     fi
6649 HAVE_JAVA9=
6650 dnl ===================================================================
6651 dnl Checks for JDK.
6652 dnl ===================================================================
6654 # Note that JAVA_HOME as for now always means the *build* platform's
6655 # JAVA_HOME. Whether all the complexity here actually is needed any
6656 # more or not, no idea.
6658 if test "$ENABLE_JAVA" != ""; then
6659     _gij_longver=0
6660     AC_MSG_CHECKING([the installed JDK])
6661     if test -n "$JAVAINTERPRETER"; then
6662         dnl java -version sends output to stderr!
6663         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6664             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6665         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6666             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6667         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6668             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6669         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6670             JDK=ibm
6672             dnl IBM JDK specific tests
6673             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6674             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6676             if test "$_jdk_ver" -lt 10600; then
6677                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
6678             fi
6680             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6682             if test "$with_jdk_home" = ""; then
6683                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6684 you must use the "--with-jdk-home" configure option explicitly])
6685             fi
6687             JAVA_HOME=$with_jdk_home
6688         else
6689             JDK=sun
6691             dnl Sun JDK specific tests
6692             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6693             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6695             if test "$_jdk_ver" -lt 10600; then
6696                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
6697             fi
6698             if test "$_jdk_ver" -gt 10600; then
6699                 JAVA_CLASSPATH_NOT_SET=TRUE
6700             fi
6701             if test "$_jdk_ver" -ge 10900; then
6702                 HAVE_JAVA9=TRUE
6703             fi
6705             AC_MSG_RESULT([checked (JDK $_jdk)])
6706             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6707             if test "$_os" = "WINNT"; then
6708                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6709             fi
6711             # set to limit VM usage for JunitTests
6712             JAVAIFLAGS=-Xmx64M
6713             # set to limit VM usage for javac
6714             JAVAFLAGS=-J-Xmx128M
6715         fi
6716     else
6717         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
6718     fi
6719 else
6720     dnl Java disabled
6721     JAVA_HOME=
6722     export JAVA_HOME
6725 dnl ===================================================================
6726 dnl Set target Java bytecode version
6727 dnl ===================================================================
6728 if test "$ENABLE_JAVA" != ""; then
6729     if test "$HAVE_JAVA9" = "TRUE"; then
6730         _java_target_ver="1.6"
6731     else
6732         _java_target_ver="1.5"
6733     fi
6734     JAVA_SOURCE_VER="$_java_target_ver"
6735     JAVA_TARGET_VER="$_java_target_ver"
6738 dnl ===================================================================
6739 dnl Checks for javac
6740 dnl ===================================================================
6741 if test "$ENABLE_JAVA" != ""; then
6742     javacompiler="javac"
6743     if test -z "$with_jdk_home"; then
6744         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6745     else
6746         _javac_path="$with_jdk_home/bin/$javacompiler"
6747         dnl Check if there is a Java compiler at all.
6748         if test -x "$_javac_path"; then
6749             JAVACOMPILER=$_javac_path
6750         fi
6751     fi
6752     if test -z "$JAVACOMPILER"; then
6753         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6754     fi
6755     if test "$build_os" = "cygwin"; then
6756         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6757             JAVACOMPILER="${JAVACOMPILER}.exe"
6758         fi
6759         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
6760     fi
6763 dnl ===================================================================
6764 dnl Checks for javadoc
6765 dnl ===================================================================
6766 if test "$ENABLE_JAVA" != ""; then
6767     if test -z "$with_jdk_home"; then
6768         AC_PATH_PROG(JAVADOC, javadoc)
6769     else
6770         _javadoc_path="$with_jdk_home/bin/javadoc"
6771         dnl Check if there is a javadoc at all.
6772         if test -x "$_javadoc_path"; then
6773             JAVADOC=$_javadoc_path
6774         else
6775             AC_PATH_PROG(JAVADOC, javadoc)
6776         fi
6777     fi
6778     if test -z "$JAVADOC"; then
6779         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6780     fi
6781     if test "$build_os" = "cygwin"; then
6782         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6783             JAVADOC="${JAVADOC}.exe"
6784         fi
6785         JAVADOC=`win_short_path_for_make "$JAVADOC"`
6786     fi
6788     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6789     JAVADOCISGJDOC="yes"
6790     fi
6792 AC_SUBST(JAVADOCISGJDOC)
6794 if test "$ENABLE_JAVA" != ""; then
6795     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
6796     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
6797         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
6798            # try to recover first by looking whether we have a alternatives
6799            # system as in Debian or newer SuSEs where following /usr/bin/javac
6800            # over /etc/alternatives/javac leads to the right bindir where we
6801            # just need to strip a bit away to get a valid JAVA_HOME
6802            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
6803         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
6804             # maybe only one level of symlink (e.g. on Mac)
6805             JAVA_HOME=$(readlink $JAVACOMPILER)
6806             if test "$(dirname $JAVA_HOME)" = "."; then
6807                 # we've got no path to trim back
6808                 JAVA_HOME=""
6809             fi
6810         else
6811             # else warn
6812             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
6813             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
6814             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
6815             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
6816         fi
6817         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
6818         if test "$JAVA_HOME" != "/usr"; then
6819             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6820                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
6821                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
6822                 dnl Tiger already returns a JDK path..
6823                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
6824             else
6825                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
6826                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
6827                 dnl that checks which version to run
6828                 if test -f "$JAVA_HOME"; then
6829                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
6830                 fi
6831             fi
6832         fi
6833     fi
6834     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
6836     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
6837     if test -z "$JAVA_HOME"; then
6838         if test "x$with_jdk_home" = "x"; then
6839             cat > findhome.java <<_ACEOF
6840 [import java.io.File;
6842 class findhome
6844     public static void main(String args[])
6845     {
6846         String jrelocation = System.getProperty("java.home");
6847         File jre = new File(jrelocation);
6848         System.out.println(jre.getParent());
6849     }
6851 _ACEOF
6852             AC_MSG_CHECKING([if javac works])
6853             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
6854             AC_TRY_EVAL(javac_cmd)
6855             if test $? = 0 -a -f ./findhome.class; then
6856                 AC_MSG_RESULT([javac works])
6857             else
6858                 echo "configure: javac test failed" >&5
6859                 cat findhome.java >&5
6860                 AC_MSG_ERROR([javac does not work - java projects will not build!])
6861             fi
6862             AC_MSG_CHECKING([if gij knows its java.home])
6863             JAVA_HOME=`$JAVAINTERPRETER findhome`
6864             if test $? = 0 -a "$JAVA_HOME" != ""; then
6865                 AC_MSG_RESULT([$JAVA_HOME])
6866             else
6867                 echo "configure: java test failed" >&5
6868                 cat findhome.java >&5
6869                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
6870             fi
6871             # clean-up after ourselves
6872             rm -f ./findhome.java ./findhome.class
6873         else
6874             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
6875         fi
6876     fi
6878     # now check if $JAVA_HOME is really valid
6879     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6880         case "${JAVA_HOME}" in
6881             /Library/Java/JavaVirtualMachines/*)
6882                 ;;
6883             *)
6884                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
6885                 ;;
6886         esac
6887         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
6888             JAVA_HOME_OK="NO"
6889         fi
6890     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
6891         JAVA_HOME_OK="NO"
6892     fi
6893     if test "$JAVA_HOME_OK" = "NO"; then
6894         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
6895         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
6896         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
6897         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
6898         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
6899         add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
6900     fi
6901     PathFormat "$JAVA_HOME"
6902     JAVA_HOME="$formatted_path"
6905 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
6906     "$_os" != Darwin
6907 then
6908     AC_MSG_CHECKING([for JAWT lib])
6909     if test "$_os" = WINNT; then
6910         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
6911         JAWTLIB=jawt.lib
6912     else
6913         case "$host_cpu" in
6914         arm*)
6915             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
6916             JAVA_ARCH=$my_java_arch
6917             ;;
6918         i*86)
6919             my_java_arch=i386
6920             ;;
6921         m68k)
6922             my_java_arch=m68k
6923             ;;
6924         powerpc)
6925             my_java_arch=ppc
6926             ;;
6927         powerpc64)
6928             my_java_arch=ppc64
6929             ;;
6930         powerpc64le)
6931             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
6932             JAVA_ARCH=$my_java_arch
6933             ;;
6934         sparc64)
6935             my_java_arch=sparcv9
6936             ;;
6937         x86_64)
6938             my_java_arch=amd64
6939             ;;
6940         *)
6941             my_java_arch=$host_cpu
6942             ;;
6943         esac
6944         # This is where JDK9 puts the library
6945         if test -e "$JAVA_HOME/lib/libjawt.so"; then
6946             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
6947         else
6948             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
6949         fi
6950         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
6951     fi
6952     AC_MSG_RESULT([$JAWTLIB])
6954 AC_SUBST(JAWTLIB)
6956 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
6957     case "$host_os" in
6959     aix*)
6960         JAVAINC="-I$JAVA_HOME/include"
6961         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
6962         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6963         ;;
6965     cygwin*)
6966         JAVAINC="-I$JAVA_HOME/include/win32"
6967         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
6968         ;;
6970     darwin*)
6971         if test -d "$JAVA_HOME/include/darwin"; then
6972             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
6973         else
6974             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
6975         fi
6976         ;;
6978     dragonfly*)
6979         JAVAINC="-I$JAVA_HOME/include"
6980         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6981         ;;
6983     freebsd*)
6984         JAVAINC="-I$JAVA_HOME/include"
6985         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
6986         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
6987         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
6988         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6989         ;;
6991     k*bsd*-gnu*)
6992         JAVAINC="-I$JAVA_HOME/include"
6993         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
6994         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6995         ;;
6997     linux-gnu*)
6998         JAVAINC="-I$JAVA_HOME/include"
6999         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7000         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7001         ;;
7003     *netbsd*)
7004         JAVAINC="-I$JAVA_HOME/include"
7005         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7006         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7007        ;;
7009     openbsd*)
7010         JAVAINC="-I$JAVA_HOME/include"
7011         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7012         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7013         ;;
7015     solaris*)
7016         JAVAINC="-I$JAVA_HOME/include"
7017         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7018         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7019         ;;
7020     esac
7022 SOLARINC="$SOLARINC $JAVAINC"
7024 AC_SUBST(JAVACOMPILER)
7025 AC_SUBST(JAVADOC)
7026 AC_SUBST(JAVAINTERPRETER)
7027 AC_SUBST(JAVAIFLAGS)
7028 AC_SUBST(JAVAFLAGS)
7029 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7030 AC_SUBST(JAVA_HOME)
7031 AC_SUBST(JAVA_SOURCE_VER)
7032 AC_SUBST(JAVA_TARGET_VER)
7033 AC_SUBST(JDK)
7036 dnl ===================================================================
7037 dnl Export file validation
7038 dnl ===================================================================
7039 AC_MSG_CHECKING([whether to enable export file validation])
7040 if test "$with_export_validation" != "no"; then
7041     if test -z "$ENABLE_JAVA"; then
7042         if test "$with_export_validation" = "yes"; then
7043             AC_MSG_ERROR([requested, but Java is disabled])
7044         else
7045             AC_MSG_RESULT([no, as Java is disabled])
7046         fi
7047     elif test "$_jdk_ver" -lt 10800; then
7048         if test "$with_export_validation" = "yes"; then
7049             AC_MSG_ERROR([requested, but Java is too old, need Java 8])
7050         else
7051             AC_MSG_RESULT([no, as Java is too old, need Java 8])
7052         fi
7053     else
7054         AC_MSG_RESULT([yes])
7055         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7057         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7058         if test -z "$ODFVALIDATOR"; then
7059             # remember to download the ODF toolkit with validator later
7060             AC_MSG_NOTICE([no odfvalidator found, will download it])
7061             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7062             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7064             # and fetch name of odfvalidator jar name from download.lst
7065             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7066             AC_SUBST(ODFVALIDATOR_JAR)
7068             if test -z "$ODFVALIDATOR_JAR"; then
7069                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7070             fi
7071         fi
7072         if test "$build_os" = "cygwin"; then
7073             # In case of Cygwin it will be executed from Windows,
7074             # so we need to run bash and absolute path to validator
7075             # so instead of "odfvalidator" it will be
7076             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7077             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7078         else
7079             ODFVALIDATOR="sh $ODFVALIDATOR"
7080         fi
7081         AC_SUBST(ODFVALIDATOR)
7084         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7085         if test -z "$OFFICEOTRON"; then
7086             # remember to download the officeotron with validator later
7087             AC_MSG_NOTICE([no officeotron found, will download it])
7088             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7089             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7091             # and fetch name of officeotron jar name from download.lst
7092             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7093             AC_SUBST(OFFICEOTRON_JAR)
7095             if test -z "$OFFICEOTRON_JAR"; then
7096                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7097             fi
7098         else
7099             # check version of existing officeotron
7100             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7101             if test 0"$OFFICEOTRON_VER" -lt 704; then
7102                 AC_MSG_ERROR([officeotron too old])
7103             fi
7104         fi
7105         if test "$build_os" = "cygwin"; then
7106             # In case of Cygwin it will be executed from Windows,
7107             # so we need to run bash and absolute path to validator
7108             # so instead of "odfvalidator" it will be
7109             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7110             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7111         else
7112             OFFICEOTRON="sh $OFFICEOTRON"
7113         fi
7114     fi
7115     AC_SUBST(OFFICEOTRON)
7116 else
7117     AC_MSG_RESULT([no])
7120 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7121 if test "$with_bffvalidator" != "no"; then
7122     AC_DEFINE(HAVE_BFFVALIDATOR)
7124     if test "$with_export_validation" = "no"; then
7125         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7126     fi
7128     if test "$with_bffvalidator" = "yes"; then
7129         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7130     else
7131         BFFVALIDATOR="$with_bffvalidator"
7132     fi
7134     if test "$build_os" = "cygwin"; then
7135         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7136             AC_MSG_RESULT($BFFVALIDATOR)
7137         else
7138             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7139         fi
7140     elif test -n "$BFFVALIDATOR"; then
7141         # We are not in Cygwin but need to run Windows binary with wine
7142         AC_PATH_PROGS(WINE, wine)
7144         # so swap in a shell wrapper that converts paths transparently
7145         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7146         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7147         AC_SUBST(BFFVALIDATOR_EXE)
7148         AC_MSG_RESULT($BFFVALIDATOR)
7149     else
7150         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7151     fi
7152     AC_SUBST(BFFVALIDATOR)
7153 else
7154     AC_MSG_RESULT([no])
7157 dnl ===================================================================
7158 dnl Check for C preprocessor to use
7159 dnl ===================================================================
7160 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7161 if test -n "$with_idlc_cpp"; then
7162     AC_MSG_RESULT([$with_idlc_cpp])
7163     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7164 else
7165     AC_MSG_RESULT([ucpp])
7166     AC_MSG_CHECKING([which ucpp tp use])
7167     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7168         AC_MSG_RESULT([external])
7169         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7170     else
7171         AC_MSG_RESULT([internal])
7172         BUILD_TYPE="$BUILD_TYPE UCPP"
7173     fi
7175 AC_SUBST(SYSTEM_UCPP)
7177 dnl ===================================================================
7178 dnl Check for epm (not needed for Windows)
7179 dnl ===================================================================
7180 AC_MSG_CHECKING([whether to enable EPM for packing])
7181 if test "$enable_epm" = "yes"; then
7182     AC_MSG_RESULT([yes])
7183     if test "$_os" != "WINNT"; then
7184         if test $_os = Darwin; then
7185             EPM=internal
7186         elif test -n "$with_epm"; then
7187             EPM=$with_epm
7188         else
7189             AC_PATH_PROG(EPM, epm, no)
7190         fi
7191         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7192             AC_MSG_NOTICE([EPM will be built.])
7193             BUILD_TYPE="$BUILD_TYPE EPM"
7194             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7195         else
7196             # Gentoo has some epm which is something different...
7197             AC_MSG_CHECKING([whether the found epm is the right epm])
7198             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7199                 AC_MSG_RESULT([yes])
7200             else
7201                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7202             fi
7203             AC_MSG_CHECKING([epm version])
7204             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7205             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7206                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7207                 AC_MSG_RESULT([OK, >= 3.7])
7208             else
7209                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7210                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7211             fi
7212         fi
7213     fi
7215     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7216         AC_MSG_CHECKING([for rpm])
7217         for a in "$RPM" rpmbuild rpm; do
7218             $a --usage >/dev/null 2> /dev/null
7219             if test $? -eq 0; then
7220                 RPM=$a
7221                 break
7222             else
7223                 $a --version >/dev/null 2> /dev/null
7224                 if test $? -eq 0; then
7225                     RPM=$a
7226                     break
7227                 fi
7228             fi
7229         done
7230         if test -z "$RPM"; then
7231             AC_MSG_ERROR([not found])
7232         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7233             RPM_PATH=`which $RPM`
7234             AC_MSG_RESULT([$RPM_PATH])
7235             SCPDEFS="$SCPDEFS -DWITH_RPM"
7236         else
7237             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7238         fi
7239     fi
7240     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7241         AC_PATH_PROG(DPKG, dpkg, no)
7242         if test "$DPKG" = "no"; then
7243             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7244         fi
7245     fi
7246     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7247        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7248         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7249             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7250                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7251                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7252                     AC_MSG_RESULT([yes])
7253                 else
7254                     AC_MSG_RESULT([no])
7255                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7256                         _pt="rpm"
7257                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7258                         add_warning "the rpms will need to be installed with --nodeps"
7259                     else
7260                         _pt="pkg"
7261                     fi
7262                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7263                     add_warning "the ${_pt}s will not be relocatable"
7264                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7265                                  relocation will work, you need to patch your epm with the
7266                                  patch in epm/epm-3.7.patch or build with
7267                                  --with-epm=internal which will build a suitable epm])
7268                 fi
7269             fi
7270         fi
7271     fi
7272     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7273         AC_PATH_PROG(PKGMK, pkgmk, no)
7274         if test "$PKGMK" = "no"; then
7275             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7276         fi
7277     fi
7278     AC_SUBST(RPM)
7279     AC_SUBST(DPKG)
7280     AC_SUBST(PKGMK)
7281 else
7282     for i in $PKGFORMAT; do
7283         case "$i" in
7284         aix | bsd | deb | pkg | rpm | native | portable)
7285             AC_MSG_ERROR(
7286                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7287             ;;
7288         esac
7289     done
7290     AC_MSG_RESULT([no])
7291     EPM=NO
7293 AC_SUBST(EPM)
7295 ENABLE_LWP=
7296 if test "$enable_lotuswordpro" = "yes"; then
7297     ENABLE_LWP="TRUE"
7299 AC_SUBST(ENABLE_LWP)
7301 dnl ===================================================================
7302 dnl Check for building ODK
7303 dnl ===================================================================
7304 if test "$enable_odk" = no; then
7305     unset DOXYGEN
7306 else
7307     if test "$with_doxygen" = no; then
7308         AC_MSG_CHECKING([for doxygen])
7309         unset DOXYGEN
7310         AC_MSG_RESULT([no])
7311     else
7312         if test "$with_doxygen" = yes; then
7313             AC_PATH_PROG([DOXYGEN], [doxygen])
7314             if test -z "$DOXYGEN"; then
7315                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7316             fi
7317             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
7318                 if ! dot -V 2>/dev/null; then
7319                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
7320                 fi
7321             fi
7322         else
7323             AC_MSG_CHECKING([for doxygen])
7324             DOXYGEN=$with_doxygen
7325             AC_MSG_RESULT([$DOXYGEN])
7326         fi
7327         if test -n "$DOXYGEN"; then
7328             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7329             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7330             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7331                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7332             fi
7333         fi
7334     fi
7336 AC_SUBST([DOXYGEN])
7338 AC_MSG_CHECKING([whether to build the ODK])
7339 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7340     AC_MSG_RESULT([yes])
7342     if test "$with_java" != "no"; then
7343         AC_MSG_CHECKING([whether to build unowinreg.dll])
7344         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7345             # build on Win by default
7346             enable_build_unowinreg=yes
7347         fi
7348         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7349             AC_MSG_RESULT([no])
7350             BUILD_UNOWINREG=
7351         else
7352             AC_MSG_RESULT([yes])
7353             BUILD_UNOWINREG=TRUE
7354         fi
7355         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7356             if test -z "$with_mingw_cross_compiler"; then
7357                 dnl Guess...
7358                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7359             elif test -x "$with_mingw_cross_compiler"; then
7360                  MINGWCXX="$with_mingw_cross_compiler"
7361             else
7362                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7363             fi
7365             if test "$MINGWCXX" = "false"; then
7366                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7367             fi
7369             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7370             if test -x "$mingwstrip_test"; then
7371                 MINGWSTRIP="$mingwstrip_test"
7372             else
7373                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7374             fi
7376             if test "$MINGWSTRIP" = "false"; then
7377                 AC_MSG_ERROR(MinGW32 binutils not found.)
7378             fi
7379         fi
7380     fi
7381     BUILD_TYPE="$BUILD_TYPE ODK"
7382 else
7383     AC_MSG_RESULT([no])
7384     BUILD_UNOWINREG=
7386 AC_SUBST(BUILD_UNOWINREG)
7387 AC_SUBST(MINGWCXX)
7388 AC_SUBST(MINGWSTRIP)
7390 dnl ===================================================================
7391 dnl Check for system zlib
7392 dnl ===================================================================
7393 if test "$with_system_zlib" = "auto"; then
7394     case "$_os" in
7395     WINNT)
7396         with_system_zlib="$with_system_libs"
7397         ;;
7398     *)
7399         if test "$enable_fuzzers" != "yes"; then
7400             with_system_zlib=yes
7401         else
7402             with_system_zlib=no
7403         fi
7404         ;;
7405     esac
7408 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7409 dnl and has no pkg-config for it at least on some tinderboxes,
7410 dnl so leaving that out for now
7411 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7412 AC_MSG_CHECKING([which zlib to use])
7413 if test "$with_system_zlib" = "yes"; then
7414     AC_MSG_RESULT([external])
7415     SYSTEM_ZLIB=TRUE
7416     AC_CHECK_HEADER(zlib.h, [],
7417         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7418     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7419         [AC_MSG_ERROR(zlib not found or functional)], [])
7420 else
7421     AC_MSG_RESULT([internal])
7422     SYSTEM_ZLIB=
7423     BUILD_TYPE="$BUILD_TYPE ZLIB"
7424     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7425     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7427 AC_SUBST(ZLIB_CFLAGS)
7428 AC_SUBST(ZLIB_LIBS)
7429 AC_SUBST(SYSTEM_ZLIB)
7431 dnl ===================================================================
7432 dnl Check for system jpeg
7433 dnl ===================================================================
7434 AC_MSG_CHECKING([which libjpeg to use])
7435 if test "$with_system_jpeg" = "yes"; then
7436     AC_MSG_RESULT([external])
7437     SYSTEM_LIBJPEG=TRUE
7438     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7439         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7440     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7441         [AC_MSG_ERROR(jpeg library not found or fuctional)], [])
7442 else
7443     SYSTEM_LIBJPEG=
7444     AC_MSG_RESULT([internal, libjpeg-turbo])
7445     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
7446     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
7447     if test "$COM" = "MSC"; then
7448         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
7449     else
7450         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
7451     fi
7453     case "$host_cpu" in
7454     x86_64 | amd64 | i*86 | x86 | ia32)
7455         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7456         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7457             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7458                 NASM="$LODE_HOME/opt/bin/nasm"
7459             elif test -x "/opt/lo/bin/nasm"; then
7460                 NASM="/opt/lo/bin/nasm"
7461             fi
7462         fi
7464         if test -n "$NASM"; then
7465             AC_MSG_CHECKING([for object file format of host system])
7466             case "$host_os" in
7467               cygwin* | mingw* | pw32* | interix*)
7468                 case "$host_cpu" in
7469                   x86_64)
7470                     objfmt='Win64-COFF'
7471                     ;;
7472                   *)
7473                     objfmt='Win32-COFF'
7474                     ;;
7475                 esac
7476               ;;
7477               msdosdjgpp* | go32*)
7478                 objfmt='COFF'
7479               ;;
7480               os2-emx*)                 # not tested
7481                 objfmt='MSOMF'          # obj
7482               ;;
7483               linux*coff* | linux*oldld*)
7484                 objfmt='COFF'           # ???
7485               ;;
7486               linux*aout*)
7487                 objfmt='a.out'
7488               ;;
7489               linux*)
7490                 case "$host_cpu" in
7491                   x86_64)
7492                     objfmt='ELF64'
7493                     ;;
7494                   *)
7495                     objfmt='ELF'
7496                     ;;
7497                 esac
7498               ;;
7499               kfreebsd* | freebsd* | netbsd* | openbsd*)
7500                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
7501                   objfmt='BSD-a.out'
7502                 else
7503                   case "$host_cpu" in
7504                     x86_64 | amd64)
7505                       objfmt='ELF64'
7506                       ;;
7507                     *)
7508                       objfmt='ELF'
7509                       ;;
7510                   esac
7511                 fi
7512               ;;
7513               solaris* | sunos* | sysv* | sco*)
7514                 case "$host_cpu" in
7515                   x86_64)
7516                     objfmt='ELF64'
7517                     ;;
7518                   *)
7519                     objfmt='ELF'
7520                     ;;
7521                 esac
7522               ;;
7523               darwin* | rhapsody* | nextstep* | openstep* | macos*)
7524                 case "$host_cpu" in
7525                   x86_64)
7526                     objfmt='Mach-O64'
7527                     ;;
7528                   *)
7529                     objfmt='Mach-O'
7530                     ;;
7531                 esac
7532               ;;
7533               *)
7534                 objfmt='ELF ?'
7535               ;;
7536             esac
7538             AC_MSG_RESULT([$objfmt])
7539             if test "$objfmt" = 'ELF ?'; then
7540               objfmt='ELF'
7541               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
7542             fi
7544             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
7545             case "$objfmt" in
7546               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
7547               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
7548               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
7549               COFF)       NAFLAGS='-fcoff -DCOFF';;
7550               a.out)      NAFLAGS='-faout -DAOUT';;
7551               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
7552               ELF)        NAFLAGS='-felf -DELF';;
7553               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
7554               RDF)        NAFLAGS='-frdf -DRDF';;
7555               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
7556               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
7557             esac
7558             AC_MSG_RESULT([$NAFLAGS])
7560             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
7561             cat > conftest.asm << EOF
7562             [%line __oline__ "configure"
7563                     section .text
7564                     global  _main,main
7565             _main:
7566             main:   xor     eax,eax
7567                     ret
7568             ]
7570             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
7571             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
7572               AC_MSG_RESULT(yes)
7573             else
7574               echo "configure: failed program was:" >&AC_FD_CC
7575               cat conftest.asm >&AC_FD_CC
7576               rm -rf conftest*
7577               AC_MSG_RESULT(no)
7578               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
7579               NASM=""
7580             fi
7582         fi
7584         if test -z "$NASM"; then
7585 cat << _EOS
7586 ****************************************************************************
7587 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
7588 To get one please:
7590 _EOS
7591             if test "$build_os" = "cygwin"; then
7592 cat << _EOS
7593 install a pre-compiled binary for Win32
7595 mkdir -p /opt/lo/bin
7596 cd /opt/lo/bin
7597 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7598 chmod +x nasm
7600 or get and install one from http://www.nasm.us/
7602 Then re-run autogen.sh
7604 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7605 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7607 _EOS
7608             else
7609 cat << _EOS
7610 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
7612 _EOS
7613             fi
7614             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
7615             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
7616         fi
7617       ;;
7618     esac
7621 AC_SUBST(NASM)
7622 AC_SUBST(LIBJPEG_CFLAGS)
7623 AC_SUBST(LIBJPEG_LIBS)
7624 AC_SUBST(SYSTEM_LIBJPEG)
7626 dnl ===================================================================
7627 dnl Check for system clucene
7628 dnl ===================================================================
7629 dnl we should rather be using
7630 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7631 dnl but the contribs-lib check seems tricky
7632 AC_MSG_CHECKING([which clucene to use])
7633 if test "$with_system_clucene" = "yes"; then
7634     AC_MSG_RESULT([external])
7635     SYSTEM_CLUCENE=TRUE
7636     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7637     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7638     FilterLibs "${CLUCENE_LIBS}"
7639     CLUCENE_LIBS="${filteredlibs}"
7640     AC_LANG_PUSH([C++])
7641     save_CXXFLAGS=$CXXFLAGS
7642     save_CPPFLAGS=$CPPFLAGS
7643     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7644     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7645     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7646     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7647     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7648                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7649     CXXFLAGS=$save_CXXFLAGS
7650     CPPFLAGS=$save_CPPFLAGS
7651     AC_LANG_POP([C++])
7653     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7654 else
7655     AC_MSG_RESULT([internal])
7656     SYSTEM_CLUCENE=
7657     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7659 AC_SUBST(SYSTEM_CLUCENE)
7660 AC_SUBST(CLUCENE_CFLAGS)
7661 AC_SUBST(CLUCENE_LIBS)
7663 dnl ===================================================================
7664 dnl Check for system expat
7665 dnl ===================================================================
7666 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
7668 dnl ===================================================================
7669 dnl Check for system xmlsec
7670 dnl ===================================================================
7671 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24])
7673 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7674 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7675     ENABLE_EOT="TRUE"
7676     AC_DEFINE([ENABLE_EOT])
7677     AC_MSG_RESULT([yes])
7679     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7680 else
7681     ENABLE_EOT=
7682     AC_MSG_RESULT([no])
7684 AC_SUBST([ENABLE_EOT])
7686 dnl ===================================================================
7687 dnl Check for DLP libs
7688 dnl ===================================================================
7689 AS_IF([test "$COM" = "MSC"],
7690       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7691       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7693 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7695 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7697 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
7699 AS_IF([test "$COM" = "MSC"],
7700       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7701       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7703 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7705 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7707 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7708 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.8])
7710 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7712 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7714 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7716 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
7717 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.13])
7719 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
7720 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.7])
7722 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7724 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
7725 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
7727 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7729 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7731 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
7733 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
7735 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
7736 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.4])
7738 dnl ===================================================================
7739 dnl Check for system lcms2
7740 dnl ===================================================================
7741 if test "$with_system_lcms2" != "yes"; then
7742     SYSTEM_LCMS2=
7744 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7745 if test "$GCC" = "yes"; then
7746     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7748 if test "$COM" = "MSC"; then # override the above
7749     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7752 dnl ===================================================================
7753 dnl Check for system cppunit
7754 dnl ===================================================================
7755 if test "$cross_compiling" != "yes"; then
7756     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
7759 dnl ===================================================================
7760 dnl Check whether freetype is available
7761 dnl ===================================================================
7762 if test  "$test_freetype" = "yes"; then
7763     AC_MSG_CHECKING([whether freetype is available])
7764     # FreeType has 3 different kinds of versions
7765     # * release, like 2.4.10
7766     # * libtool, like 13.0.7 (this what pkg-config returns)
7767     # * soname
7768     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7769     #
7770     # 9.9.3 is 2.2.0
7771     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7772     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7773     FilterLibs "${FREETYPE_LIBS}"
7774     FREETYPE_LIBS="${filteredlibs}"
7775     SYSTEM_FREETYPE=TRUE
7776 else
7777     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
7778     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
7780 AC_SUBST(FREETYPE_CFLAGS)
7781 AC_SUBST(FREETYPE_LIBS)
7782 AC_SUBST([SYSTEM_FREETYPE])
7784 # ===================================================================
7785 # Check for system libxslt
7786 # to prevent incompatibilities between internal libxml2 and external libxslt,
7787 # or vice versa, use with_system_libxml here
7788 # ===================================================================
7789 if test "$with_system_libxml" = "auto"; then
7790     case "$_os" in
7791     WINNT|iOS|Android)
7792         with_system_libxml="$with_system_libs"
7793         ;;
7794     *)
7795         if test "$enable_fuzzers" != "yes"; then
7796             with_system_libxml=yes
7797         else
7798             with_system_libxml=no
7799         fi
7800         ;;
7801     esac
7804 AC_MSG_CHECKING([which libxslt to use])
7805 if test "$with_system_libxml" = "yes"; then
7806     AC_MSG_RESULT([external])
7807     SYSTEM_LIBXSLT=TRUE
7808     if test "$_os" = "Darwin"; then
7809         dnl make sure to use SDK path
7810         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7811         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7812         dnl omit -L/usr/lib
7813         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7814         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7815     else
7816         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7817         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7818         FilterLibs "${LIBXSLT_LIBS}"
7819         LIBXSLT_LIBS="${filteredlibs}"
7820         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7821         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7822         FilterLibs "${LIBEXSLT_LIBS}"
7823         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
7824     fi
7826     dnl Check for xsltproc
7827     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7828     if test "$XSLTPROC" = "no"; then
7829         AC_MSG_ERROR([xsltproc is required])
7830     fi
7831 else
7832     AC_MSG_RESULT([internal])
7833     SYSTEM_LIBXSLT=
7834     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
7836     if test "$cross_compiling" = "yes"; then
7837         AC_PATH_PROG(XSLTPROC, xsltproc, no)
7838         if test "$XSLTPROC" = "no"; then
7839             AC_MSG_ERROR([xsltproc is required])
7840         fi
7841     fi
7843 AC_SUBST(SYSTEM_LIBXSLT)
7844 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
7845     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
7847 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
7849 AC_SUBST(LIBEXSLT_CFLAGS)
7850 AC_SUBST(LIBEXSLT_LIBS)
7851 AC_SUBST(LIBXSLT_CFLAGS)
7852 AC_SUBST(LIBXSLT_LIBS)
7853 AC_SUBST(XSLTPROC)
7855 # ===================================================================
7856 # Check for system libxml
7857 # ===================================================================
7858 AC_MSG_CHECKING([which libxml to use])
7859 if test "$with_system_libxml" = "yes"; then
7860     AC_MSG_RESULT([external])
7861     SYSTEM_LIBXML=TRUE
7862     if test "$_os" = "Darwin"; then
7863         dnl make sure to use SDK path
7864         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7865         dnl omit -L/usr/lib
7866         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
7867     elif test $_os = iOS; then
7868         dnl make sure to use SDK path
7869         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
7870         LIBXML_CFLAGS="-I$usr/include/libxml2"
7871         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
7872     else
7873         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
7874         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7875         FilterLibs "${LIBXML_LIBS}"
7876         LIBXML_LIBS="${filteredlibs}"
7877     fi
7879     dnl Check for xmllint
7880     AC_PATH_PROG(XMLLINT, xmllint, no)
7881     if test "$XMLLINT" = "no"; then
7882         AC_MSG_ERROR([xmllint is required])
7883     fi
7884 else
7885     AC_MSG_RESULT([internal])
7886     SYSTEM_LIBXML=
7887     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
7888     if test "$COM" = "MSC"; then
7889         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
7890     fi
7891     if test "$COM" = "MSC"; then
7892         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
7893     else
7894         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
7895     fi
7896     BUILD_TYPE="$BUILD_TYPE LIBXML2"
7898 AC_SUBST(SYSTEM_LIBXML)
7899 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
7900     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
7902 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
7903 AC_SUBST(LIBXML_CFLAGS)
7904 AC_SUBST(LIBXML_LIBS)
7905 AC_SUBST(XMLLINT)
7907 # =====================================================================
7908 # Checking for a Python interpreter with version >= 2.6.
7909 # Build and runtime requires Python 3 compatible version (>= 2.6).
7910 # Optionally user can pass an option to configure, i. e.
7911 # ./configure PYTHON=/usr/bin/python
7912 # =====================================================================
7913 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
7914     # This allows a lack of system python with no error, we use internal one in that case.
7915     AM_PATH_PYTHON([2.6],, [:])
7916     # Clean PYTHON_VERSION checked below if cross-compiling
7917     PYTHON_VERSION=""
7918     if test "$PYTHON" != ":"; then
7919         PYTHON_FOR_BUILD=$PYTHON
7920     fi
7922 AC_SUBST(PYTHON_FOR_BUILD)
7924 # Checks for Python to use for Pyuno
7925 AC_MSG_CHECKING([which Python to use for Pyuno])
7926 case "$enable_python" in
7927 no|disable)
7928     if test -z $PYTHON_FOR_BUILD; then
7929         # Python is required to build LibreOffice. In theory we could separate the build-time Python
7930         # requirement from the choice whether to include Python stuff in the installer, but why
7931         # bother?
7932         AC_MSG_ERROR([Python is required at build time.])
7933     fi
7934     enable_python=no
7935     AC_MSG_RESULT([none])
7936     ;;
7937 ""|yes|auto)
7938     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
7939         AC_MSG_RESULT([no, overridden by --disable-scripting])
7940         enable_python=no
7941     elif test $build_os = cygwin; then
7942         dnl When building on Windows we don't attempt to use any installed
7943         dnl "system"  Python.
7944         AC_MSG_RESULT([fully internal])
7945         enable_python=internal
7946     elif test "$cross_compiling" = yes; then
7947         AC_MSG_RESULT([system])
7948         enable_python=system
7949     else
7950         # Unset variables set by the above AM_PATH_PYTHON so that
7951         # we actually do check anew.
7952         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
7953         AM_PATH_PYTHON([3.3],, [:])
7954         if test "$PYTHON" = ":"; then
7955             if test -z "$PYTHON_FOR_BUILD"; then
7956                 AC_MSG_RESULT([fully internal])
7957             else
7958                 AC_MSG_RESULT([internal])
7959             fi
7960             enable_python=internal
7961         else
7962             AC_MSG_RESULT([system])
7963             enable_python=system
7964         fi
7965     fi
7966     ;;
7967 internal)
7968     AC_MSG_RESULT([internal])
7969     ;;
7970 fully-internal)
7971     AC_MSG_RESULT([fully internal])
7972     enable_python=internal
7973     ;;
7974 system)
7975     AC_MSG_RESULT([system])
7976     ;;
7978     AC_MSG_ERROR([Incorrect --enable-python option])
7979     ;;
7980 esac
7982 if test $enable_python != no; then
7983     BUILD_TYPE="$BUILD_TYPE PYUNO"
7986 if test $enable_python = system; then
7987     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
7988         python_version=2.7
7989         PYTHON=python$python_version
7990         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
7991             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
7992             PYTHON_LIBS="-framework Python"
7993         else
7994             PYTHON_CFLAGS="`$PYTHON-config --includes`"
7995             PYTHON_LIBS="`$PYTHON-config --libs`"
7996         fi
7997     fi
7998     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
7999         # Fallback: Accept these in the environment, or as set above
8000         # for MacOSX.
8001         :
8002     elif test "$cross_compiling" != yes; then
8003         # Unset variables set by the above AM_PATH_PYTHON so that
8004         # we actually do check anew.
8005         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
8006         # This causes an error if no python command is found
8007         AM_PATH_PYTHON([3.3])
8008         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8009         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8010         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8011         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8012         if test -z "$PKG_CONFIG"; then
8013             PYTHON_CFLAGS="-I$python_include"
8014             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8015         elif $PKG_CONFIG --exists python-$python_version; then
8016             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8017             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8018         else
8019             PYTHON_CFLAGS="-I$python_include"
8020             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8021         fi
8022         FilterLibs "${PYTHON_LIBS}"
8023         PYTHON_LIBS="${filteredlibs}"
8024     else
8025         dnl How to find out the cross-compilation Python installation path?
8026         AC_MSG_CHECKING([for python version])
8027         AS_IF([test -n "$PYTHON_VERSION"],
8028               [AC_MSG_RESULT([$PYTHON_VERSION])],
8029               [AC_MSG_RESULT([not found])
8030                AC_MSG_ERROR([no usable python found])])
8031         test -n "$PYTHON_CFLAGS" && break
8032     fi
8033     # let the PYTHON_FOR_BUILD match the same python installation that
8034     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8035     # better for PythonTests.
8036     PYTHON_FOR_BUILD=$PYTHON
8039 dnl By now enable_python should be "system", "internal" or "no"
8040 case $enable_python in
8041 system)
8042     SYSTEM_PYTHON=TRUE
8044     dnl Check if the headers really work
8045     save_CPPFLAGS="$CPPFLAGS"
8046     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8047     AC_CHECK_HEADER(Python.h, [],
8048        [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
8049        [])
8050     CPPFLAGS="$save_CPPFLAGS"
8052     AC_LANG_PUSH(C)
8053     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8054     AC_MSG_CHECKING([for correct python library version])
8055        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8056 #include <Python.h>
8058 int main(int argc, char **argv) {
8059    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
8060        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8061    else return 1;
8063        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3, or Python >= 2.6 when building with Python 2])],[AC_MSG_RESULT([skipped; cross-compiling])])
8064     CFLAGS=$save_CFLAGS
8065     AC_LANG_POP(C)
8067     dnl FIXME Check if the Python library can be linked with, too?
8068     ;;
8070 internal)
8071     SYSTEM_PYTHON=
8072     PYTHON_VERSION_MAJOR=3
8073     PYTHON_VERSION_MINOR=5
8074     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.4
8075     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8076         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8077     fi
8078     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8079     BUILD_TYPE="$BUILD_TYPE PYTHON"
8080     # Embedded Python dies without Home set
8081     if test "$HOME" = ""; then
8082         export HOME=""
8083     fi
8084     # bz2 tarball and bzip2 is not standard
8085     if test -z "$BZIP2"; then
8086         AC_PATH_PROG( BZIP2, bzip2)
8087         if test -z "$BZIP2"; then
8088             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
8089         fi
8090     fi
8091     ;;
8093     DISABLE_PYTHON=TRUE
8094     SYSTEM_PYTHON=
8095     ;;
8097     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8098     ;;
8099 esac
8101 AC_SUBST(DISABLE_PYTHON)
8102 AC_SUBST(SYSTEM_PYTHON)
8103 AC_SUBST(PYTHON_CFLAGS)
8104 AC_SUBST(PYTHON_LIBS)
8105 AC_SUBST(PYTHON_VERSION)
8106 AC_SUBST(PYTHON_VERSION_MAJOR)
8107 AC_SUBST(PYTHON_VERSION_MINOR)
8109 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8110 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8111     AC_MSG_RESULT([yes])
8112     ENABLE_MARIADBC=TRUE
8113     MARIADBC_MAJOR=1
8114     MARIADBC_MINOR=0
8115     MARIADBC_MICRO=2
8116     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8117 else
8118     AC_MSG_RESULT([no])
8119     ENABLE_MARIADBC=
8121 AC_SUBST(ENABLE_MARIADBC)
8122 AC_SUBST(MARIADBC_MAJOR)
8123 AC_SUBST(MARIADBC_MINOR)
8124 AC_SUBST(MARIADBC_MICRO)
8126 if test "$ENABLE_MARIADBC" = "TRUE"; then
8128     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8130     dnl ===================================================================
8131     dnl Check for system MariaDB
8132     dnl ===================================================================
8133     AC_MSG_CHECKING([which MariaDB to use])
8134     if test "$with_system_mariadb" = "yes"; then
8135         AC_MSG_RESULT([external])
8136         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8137         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8138         if test -z "$MARIADBCONFIG"; then
8139             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8140             if test -z "$MARIADBCONFIG"; then
8141                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8142                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8143             fi
8144         fi
8145         AC_MSG_CHECKING([MariaDB version])
8146         MARIADB_VERSION=`$MARIADBCONFIG --version`
8147         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8148         if test "$MARIADB_MAJOR" -ge "5"; then
8149             AC_MSG_RESULT([OK])
8150         else
8151             AC_MSG_ERROR([too old, use 5.0.x or later])
8152         fi
8153         AC_MSG_CHECKING([for MariaDB Client library])
8154         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8155         if test "$COM_IS_CLANG" = TRUE; then
8156             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8157         fi
8158         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8159         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8160         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8161         dnl linux32:
8162         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8163             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8164             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8165                 | sed -e 's|/lib64/|/lib/|')
8166         fi
8167         FilterLibs "${MARIADB_LIBS}"
8168         MARIADB_LIBS="${filteredlibs}"
8169         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8170         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8171         if test "$enable_bundle_mariadb" = "yes"; then
8172             AC_MSG_RESULT([yes])
8173             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8174             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8176 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8178 /g' | grep -E '(mysqlclient|mariadb)')
8179             if test "$_os" = "Darwin"; then
8180                 LIBMARIADB=${LIBMARIADB}.dylib
8181             elif test "$_os" = "WINNT"; then
8182                 LIBMARIADB=${LIBMARIADB}.dll
8183             else
8184                 LIBMARIADB=${LIBMARIADB}.so
8185             fi
8186             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8187             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8188             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8189                 AC_MSG_RESULT([found.])
8190                 PathFormat "$LIBMARIADB_PATH"
8191                 LIBMARIADB_PATH="$formatted_path"
8192             else
8193                 AC_MSG_ERROR([not found.])
8194             fi
8195         else
8196             AC_MSG_RESULT([no])
8197             BUNDLE_MARIADB_CONNECTOR_C=
8198         fi
8199     else
8200         AC_MSG_RESULT([internal])
8201         SYSTEM_MARIADB_CONNECTOR_C=
8202         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8203         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8204         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8205     fi
8207     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8208     AC_SUBST(MARIADB_CFLAGS)
8209     AC_SUBST(MARIADB_LIBS)
8210     AC_SUBST(LIBMARIADB)
8211     AC_SUBST(LIBMARIADB_PATH)
8212     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8214     AC_LANG_PUSH([C++])
8215     dnl ===================================================================
8216     dnl Check for system MySQL C++ Connector
8217     dnl ===================================================================
8218     # FIXME!
8219     # who thought this too-generic cppconn dir was a good idea?
8220     AC_MSG_CHECKING([MySQL Connector/C++])
8221     if test "$with_system_mysql_cppconn" = "yes"; then
8222         AC_MSG_RESULT([external])
8223         SYSTEM_MYSQL_CONNECTOR_CPP=TRUE
8224         AC_LANG_PUSH([C++])
8225         AC_CHECK_HEADER(mysql_driver.h, [],
8226                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8227         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8228                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8229         save_LIBS=$LIBS
8230         LIBS="$LIBS -lmysqlcppconn"
8231         AC_MSG_CHECKING([version])
8232         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8233 #include <mysql_driver.h>
8235 int main(int argc, char **argv) {
8236     sql::Driver *driver;
8237     driver = get_driver_instance();
8238     if (driver->getMajorVersion() > 1 || \
8239        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8240        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8241         return 0;
8242       else
8243         return 1;
8245       ]])],[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])])
8247         AC_LANG_POP([C++])
8248         LIBS=$save_LIBS
8249     else
8250         AC_MSG_RESULT([internal])
8251         BUILD_TYPE="$BUILD_TYPE MYSQL_CONNECTOR_CPP"
8252         SYSTEM_MYSQL_CONNECTOR_CPP=
8253     fi
8254     AC_LANG_POP([C++])
8256 AC_SUBST(SYSTEM_MYSQL_CONNECTOR_CPP)
8258 dnl ===================================================================
8259 dnl Check for system hsqldb
8260 dnl ===================================================================
8261 if test "$with_java" != "no"; then
8262     HSQLDB_USE_JDBC_4_1=
8263     AC_MSG_CHECKING([which hsqldb to use])
8264     if test "$with_system_hsqldb" = "yes"; then
8265         AC_MSG_RESULT([external])
8266         SYSTEM_HSQLDB=TRUE
8267         if test -z $HSQLDB_JAR; then
8268             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8269         fi
8270         if ! test -f $HSQLDB_JAR; then
8271                AC_MSG_ERROR(hsqldb.jar not found.)
8272         fi
8273         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8274         export HSQLDB_JAR
8275         if $PERL -e \
8276            'use Archive::Zip;
8277             my $file = "$ENV{'HSQLDB_JAR'}";
8278             my $zip = Archive::Zip->new( $file );
8279             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8280             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8281             {
8282                 push @l, split(/\n/, $mf);
8283                 foreach my $line (@l)
8284                 {
8285                     if ($line =~ m/Specification-Version:/)
8286                     {
8287                         ($t, $version) = split (/:/,$line);
8288                         $version =~ s/^\s//;
8289                         ($a, $b, $c, $d) = split (/\./,$version);
8290                         if ($c == "0" && $d > "8")
8291                         {
8292                             exit 0;
8293                         }
8294                         else
8295                         {
8296                             exit 1;
8297                         }
8298                     }
8299                 }
8300             }
8301             else
8302             {
8303                 exit 1;
8304             }'; then
8305             AC_MSG_RESULT([yes])
8306         else
8307             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8308         fi
8309     else
8310         AC_MSG_RESULT([internal])
8311         SYSTEM_HSQLDB=
8312         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8313         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8314         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8315         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8316             AC_MSG_RESULT([yes])
8317             HSQLDB_USE_JDBC_4_1=TRUE
8318         else
8319             AC_MSG_RESULT([no])
8320         fi
8321     fi
8322     AC_SUBST(SYSTEM_HSQLDB)
8323     AC_SUBST(HSQLDB_JAR)
8324     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8327 dnl ===================================================================
8328 dnl Check for PostgreSQL stuff
8329 dnl ===================================================================
8330 if test "x$enable_postgresql_sdbc" != "xno"; then
8331     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8333     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8334         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8335     fi
8336     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8337         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8338     fi
8340     postgres_interface=""
8341     if test "$with_system_postgresql" = "yes"; then
8342         postgres_interface="external PostgreSQL"
8343         SYSTEM_POSTGRESQL=TRUE
8344         if test "$_os" = Darwin; then
8345             supp_path=''
8346             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8347                 pg_supp_path="$P_SEP$d$pg_supp_path"
8348             done
8349         fi
8350         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8351         if test -z "$PGCONFIG"; then
8352             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8353         fi
8354         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8355         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8356         FilterLibs "${POSTGRESQL_LIB}"
8357         POSTGRESQL_LIB="${filteredlibs}"
8358     else
8359         # if/when anything else than PostgreSQL uses Kerberos,
8360         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8361         WITH_KRB5=
8362         WITH_GSSAPI=
8363         case "$_os" in
8364         Darwin)
8365             # MacOS X has system MIT Kerberos 5 since 10.4
8366             if test "$with_krb5" != "no"; then
8367                 WITH_KRB5=TRUE
8368                 save_LIBS=$LIBS
8369                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8370                 # that the libraries where these functions are located on macOS will change, is it?
8371                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8372                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8373                 KRB5_LIBS=$LIBS
8374                 LIBS=$save_LIBS
8375                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8376                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8377                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8378                 LIBS=$save_LIBS
8379             fi
8380             if test "$with_gssapi" != "no"; then
8381                 WITH_GSSAPI=TRUE
8382                 save_LIBS=$LIBS
8383                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8384                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8385                 GSSAPI_LIBS=$LIBS
8386                 LIBS=$save_LIBS
8387             fi
8388             ;;
8389         WINNT)
8390             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8391                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8392             fi
8393             ;;
8394         Linux|GNU|*BSD|DragonFly)
8395             if test "$with_krb5" != "no"; then
8396                 WITH_KRB5=TRUE
8397                 save_LIBS=$LIBS
8398                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8399                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8400                 KRB5_LIBS=$LIBS
8401                 LIBS=$save_LIBS
8402                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8403                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8404                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8405                 LIBS=$save_LIBS
8406             fi
8407             if test "$with_gssapi" != "no"; then
8408                 WITH_GSSAPI=TRUE
8409                 save_LIBS=$LIBS
8410                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8411                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8412                 GSSAPI_LIBS=$LIBS
8413                 LIBS=$save_LIBS
8414             fi
8415             ;;
8416         *)
8417             if test "$with_krb5" = "yes"; then
8418                 WITH_KRB5=TRUE
8419                 save_LIBS=$LIBS
8420                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8421                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8422                 KRB5_LIBS=$LIBS
8423                 LIBS=$save_LIBS
8424                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8425                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8426                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8427                 LIBS=$save_LIBS
8428             fi
8429             if test "$with_gssapi" = "yes"; then
8430                 WITH_GSSAPI=TRUE
8431                 save_LIBS=$LIBS
8432                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8433                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8434                 LIBS=$save_LIBS
8435                 GSSAPI_LIBS=$LIBS
8436             fi
8437         esac
8439         if test -n "$with_libpq_path"; then
8440             SYSTEM_POSTGRESQL=TRUE
8441             postgres_interface="external libpq"
8442             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8443             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8444         else
8445             SYSTEM_POSTGRESQL=
8446             postgres_interface="internal"
8447             POSTGRESQL_LIB=""
8448             POSTGRESQL_INC="%OVERRIDE_ME%"
8449             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8450         fi
8451     fi
8453     AC_MSG_CHECKING([PostgreSQL C interface])
8454     AC_MSG_RESULT([$postgres_interface])
8456     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8457         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8458         save_CFLAGS=$CFLAGS
8459         save_CPPFLAGS=$CPPFLAGS
8460         save_LIBS=$LIBS
8461         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8462         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8463         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8464         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8465             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8466         CFLAGS=$save_CFLAGS
8467         CPPFLAGS=$save_CPPFLAGS
8468         LIBS=$save_LIBS
8469     fi
8470     BUILD_POSTGRESQL_SDBC=TRUE
8472 AC_SUBST(WITH_KRB5)
8473 AC_SUBST(WITH_GSSAPI)
8474 AC_SUBST(GSSAPI_LIBS)
8475 AC_SUBST(KRB5_LIBS)
8476 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8477 AC_SUBST(SYSTEM_POSTGRESQL)
8478 AC_SUBST(POSTGRESQL_INC)
8479 AC_SUBST(POSTGRESQL_LIB)
8481 dnl ===================================================================
8482 dnl Check for Firebird stuff
8483 dnl ===================================================================
8484 ENABLE_FIREBIRD_SDBC=""
8485 if test "$enable_firebird_sdbc" = "yes" ; then
8486     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8488     dnl ===================================================================
8489     dnl Check for system Firebird
8490     dnl ===================================================================
8491     AC_MSG_CHECKING([which Firebird to use])
8492     if test "$with_system_firebird" = "yes"; then
8493         AC_MSG_RESULT([external])
8494         SYSTEM_FIREBIRD=TRUE
8495         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8496         if test -z "$FIREBIRDCONFIG"; then
8497             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8498             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8499                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8500             ])
8501             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8502         else
8503             AC_MSG_NOTICE([fb_config found])
8504             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8505             AC_MSG_CHECKING([for Firebird Client library])
8506             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8507             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8508             FilterLibs "${FIREBIRD_LIBS}"
8509             FIREBIRD_LIBS="${filteredlibs}"
8510         fi
8511         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8512         AC_MSG_CHECKING([Firebird version])
8513         if test -n "${FIREBIRD_VERSION}"; then
8514             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8515             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8516             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8517                 AC_MSG_RESULT([OK])
8518             else
8519                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
8520             fi
8521         else
8522             __save_CFLAGS="${CFLAGS}"
8523             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8524             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8525 #if defined(FB_API_VER) && FB_API_VER == 30
8526 int fb_api_is_30(void) { return 0; }
8527 #else
8528 #error "Wrong Firebird API version"
8529 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
8530             CFLAGS="${__save_CFLAGS}"
8531         fi
8532         ENABLE_FIREBIRD_SDBC="TRUE"
8533     elif test "$enable_database_connectivity" != yes; then
8534         AC_MSG_RESULT([none])
8535     elif test "$cross_compiling" = "yes"; then
8536         AC_MSG_RESULT([none])
8537     else
8538         dnl Embedded Firebird has version 3.0
8539         AC_DEFINE(HAVE_FIREBIRD_30, 1)
8540         dnl We need libatomic-ops for any non X86/X64 system
8541         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8542             dnl ===================================================================
8543             dnl Check for system libatomic-ops
8544             dnl ===================================================================
8545             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8546             if test "$with_system_libatomic_ops" = "yes"; then
8547                 SYSTEM_LIBATOMIC_OPS=TRUE
8548                 AC_CHECK_HEADERS(atomic_ops.h, [],
8549                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8550             else
8551                 SYSTEM_LIBATOMIC_OPS=
8552                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8553                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8554                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8555             fi
8556         fi
8558         AC_MSG_RESULT([internal])
8559         SYSTEM_FIREBIRD=
8560         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
8561         FIREBIRD_LIBS="-lfbclient"
8563         if test "$with_system_libtommath" = "yes"; then
8564             SYSTEM_LIBTOMMATH=TRUE
8565             dnl check for tommath presence
8566             save_LIBS=$LIBS
8567             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
8568             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
8569             LIBS=$save_LIBS
8570         else
8571             SYSTEM_LIBTOMMATH=
8572             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
8573             LIBTOMMATH_LIBS="-ltommath"
8574             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
8575         fi
8577         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8578         ENABLE_FIREBIRD_SDBC="TRUE"
8579     fi
8581 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8582 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8583 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8584 AC_SUBST(LIBATOMIC_OPS_LIBS)
8585 AC_SUBST(SYSTEM_FIREBIRD)
8586 AC_SUBST(FIREBIRD_CFLAGS)
8587 AC_SUBST(FIREBIRD_LIBS)
8588 AC_SUBST([TOMMATH_CFLAGS])
8589 AC_SUBST([TOMMATH_LIBS])
8591 dnl ===================================================================
8592 dnl Check for system curl
8593 dnl ===================================================================
8594 AC_MSG_CHECKING([which libcurl to use])
8595 if test "$with_system_curl" = "auto"; then
8596     with_system_curl="$with_system_libs"
8599 if test "$with_system_curl" = "yes"; then
8600     AC_MSG_RESULT([external])
8601     SYSTEM_CURL=TRUE
8603     # First try PKGCONFIG and then fall back
8604     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8606     if test -n "$CURL_PKG_ERRORS"; then
8607         AC_PATH_PROG(CURLCONFIG, curl-config)
8608         if test -z "$CURLCONFIG"; then
8609             AC_MSG_ERROR([curl development files not found])
8610         fi
8611         CURL_LIBS=`$CURLCONFIG --libs`
8612         FilterLibs "${CURL_LIBS}"
8613         CURL_LIBS="${filteredlibs}"
8614         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8615         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8617         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8618         case $curl_version in
8619         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8620         dnl so they need to be doubled to end up in the configure script
8621         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8622             AC_MSG_RESULT([yes])
8623             ;;
8624         *)
8625             AC_MSG_ERROR([no, you have $curl_version])
8626             ;;
8627         esac
8628     fi
8630     ENABLE_CURL=TRUE
8631 elif test $_os = iOS; then
8632     # Let's see if we need curl, I think not?
8633     AC_MSG_RESULT([none])
8634     ENABLE_CURL=
8635 else
8636     AC_MSG_RESULT([internal])
8637     SYSTEM_CURL=
8638     BUILD_TYPE="$BUILD_TYPE CURL"
8639     ENABLE_CURL=TRUE
8641 AC_SUBST(SYSTEM_CURL)
8642 AC_SUBST(CURL_CFLAGS)
8643 AC_SUBST(CURL_LIBS)
8644 AC_SUBST(ENABLE_CURL)
8646 dnl ===================================================================
8647 dnl Check for system boost
8648 dnl ===================================================================
8649 AC_MSG_CHECKING([which boost to use])
8650 if test "$with_system_boost" = "yes"; then
8651     AC_MSG_RESULT([external])
8652     SYSTEM_BOOST=TRUE
8653     AX_BOOST_BASE(1.47)
8654     AX_BOOST_DATE_TIME
8655     AX_BOOST_FILESYSTEM
8656     AX_BOOST_IOSTREAMS
8657     AX_BOOST_LOCALE
8658     AC_LANG_PUSH([C++])
8659     save_CXXFLAGS=$CXXFLAGS
8660     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8661     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8662        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8663     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8664        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8665     CXXFLAGS=$save_CXXFLAGS
8666     AC_LANG_POP([C++])
8667     # this is in m4/ax_boost_base.m4
8668     FilterLibs "${BOOST_LDFLAGS}"
8669     BOOST_LDFLAGS="${filteredlibs}"
8670 else
8671     AC_MSG_RESULT([internal])
8672     BUILD_TYPE="$BUILD_TYPE BOOST"
8673     SYSTEM_BOOST=
8674     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
8675         # use warning-suppressing wrapper headers
8676         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
8677     else
8678         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
8679     fi
8681 AC_SUBST(SYSTEM_BOOST)
8683 dnl ===================================================================
8684 dnl Check for system mdds
8685 dnl ===================================================================
8686 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.2 >= 1.2.3], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8688 dnl ===================================================================
8689 dnl Check for system glm
8690 dnl ===================================================================
8691 AC_MSG_CHECKING([which glm to use])
8692 if test "$with_system_glm" = "yes"; then
8693     AC_MSG_RESULT([external])
8694     SYSTEM_GLM=TRUE
8695     AC_LANG_PUSH([C++])
8696     AC_CHECK_HEADER([glm/glm.hpp], [],
8697        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8698     AC_LANG_POP([C++])
8699 else
8700     AC_MSG_RESULT([internal])
8701     BUILD_TYPE="$BUILD_TYPE GLM"
8702     SYSTEM_GLM=
8703     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8705 AC_SUBST([GLM_CFLAGS])
8706 AC_SUBST([SYSTEM_GLM])
8708 dnl ===================================================================
8709 dnl Check for system odbc
8710 dnl ===================================================================
8711 AC_MSG_CHECKING([which odbc headers to use])
8712 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
8713     AC_MSG_RESULT([external])
8714     SYSTEM_ODBC_HEADERS=TRUE
8716     if test "$build_os" = "cygwin"; then
8717         save_CPPFLAGS=$CPPFLAGS
8718         find_winsdk
8719         PathFormat "$winsdktest"
8720         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"
8721         AC_CHECK_HEADER(sqlext.h, [],
8722             [AC_MSG_ERROR(odbc not found. install odbc)],
8723             [#include <windows.h>])
8724         CPPFLAGS=$save_CPPFLAGS
8725     else
8726         AC_CHECK_HEADER(sqlext.h, [],
8727             [AC_MSG_ERROR(odbc not found. install odbc)],[])
8728     fi
8729 elif test "$enable_database_connectivity" != yes; then
8730     AC_MSG_RESULT([none])
8731 else
8732     AC_MSG_RESULT([internal])
8733     SYSTEM_ODBC_HEADERS=
8735 AC_SUBST(SYSTEM_ODBC_HEADERS)
8738 dnl ===================================================================
8739 dnl Check for system openldap
8740 dnl ===================================================================
8742 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8743 AC_MSG_CHECKING([which openldap library to use])
8744 if test "$with_system_openldap" = "yes"; then
8745     AC_MSG_RESULT([external])
8746     SYSTEM_OPENLDAP=TRUE
8747     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8748     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8749     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8750 else
8751     AC_MSG_RESULT([internal])
8752     SYSTEM_OPENLDAP=
8753     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8756 AC_SUBST(SYSTEM_OPENLDAP)
8758 dnl ===================================================================
8759 dnl Check for system NSS
8760 dnl ===================================================================
8761 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
8762     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8763     AC_DEFINE(HAVE_FEATURE_NSS)
8764     ENABLE_NSS="TRUE"
8765     AC_DEFINE(ENABLE_NSS)
8766 elif test $_os != iOS ; then
8767     with_tls=openssl
8769 AC_SUBST(ENABLE_NSS)
8771 dnl ===================================================================
8772 dnl Check for TLS/SSL and cryptographic implementation to use
8773 dnl ===================================================================
8774 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8775 if test -n "$with_tls"; then
8776     case $with_tls in
8777     openssl)
8778         AC_DEFINE(USE_TLS_OPENSSL)
8779         TLS=OPENSSL
8781         if test "$enable_openssl" != "yes"; then
8782             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8783         fi
8785         # warn that OpenSSL has been selected but not all TLS code has this option
8786         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
8787         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
8788         ;;
8789     nss)
8790         AC_DEFINE(USE_TLS_NSS)
8791         TLS=NSS
8792         ;;
8793     no)
8794         AC_MSG_WARN([Skipping TLS/SSL])
8795         ;;
8796     *)
8797         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8798 openssl - OpenSSL
8799 nss - Mozilla's Network Security Services (NSS)
8800     ])
8801         ;;
8802     esac
8803 else
8804     # default to using NSS, it results in smaller oox lib
8805     AC_DEFINE(USE_TLS_NSS)
8806     TLS=NSS
8808 AC_MSG_RESULT([$TLS])
8809 AC_SUBST(TLS)
8811 dnl ===================================================================
8812 dnl Check for system sane
8813 dnl ===================================================================
8814 AC_MSG_CHECKING([which sane header to use])
8815 if test "$with_system_sane" = "yes"; then
8816     AC_MSG_RESULT([external])
8817     AC_CHECK_HEADER(sane/sane.h, [],
8818       [AC_MSG_ERROR(sane not found. install sane)], [])
8819 else
8820     AC_MSG_RESULT([internal])
8821     BUILD_TYPE="$BUILD_TYPE SANE"
8824 dnl ===================================================================
8825 dnl Check for system icu
8826 dnl ===================================================================
8827 SYSTEM_GENBRK=
8828 SYSTEM_GENCCODE=
8829 SYSTEM_GENCMN=
8831 ICU_MAJOR=60
8832 ICU_MINOR=2
8833 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
8834 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
8835 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
8836 AC_MSG_CHECKING([which icu to use])
8837 if test "$with_system_icu" = "yes"; then
8838     AC_MSG_RESULT([external])
8839     SYSTEM_ICU=TRUE
8840     AC_LANG_PUSH([C++])
8841     AC_MSG_CHECKING([for unicode/rbbi.h])
8842     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
8843     AC_LANG_POP([C++])
8845     if test "$cross_compiling" != "yes"; then
8846         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
8847         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
8848         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
8849         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
8850     fi
8852     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
8853         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
8854         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
8855         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
8856         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
8857         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
8858             AC_MSG_RESULT([yes])
8859         else
8860             AC_MSG_RESULT([no])
8861             if test "$with_system_icu_for_build" != "force"; then
8862                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
8863 You can use --with-system-icu-for-build=force to use it anyway.])
8864             fi
8865         fi
8866     fi
8868     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
8869         # using the system icu tools can lead to version confusion, use the
8870         # ones from the build environment when cross-compiling
8871         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
8872         if test -z "$SYSTEM_GENBRK"; then
8873             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
8874         fi
8875         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8876         if test -z "$SYSTEM_GENCCODE"; then
8877             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
8878         fi
8879         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8880         if test -z "$SYSTEM_GENCMN"; then
8881             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
8882         fi
8883         if test "$ICU_MAJOR" -ge "49"; then
8884             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
8885             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
8886             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
8887         else
8888             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
8889             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
8890             ICU_RECLASSIFIED_HEBREW_LETTER=
8891         fi
8892     fi
8894     if test "$cross_compiling" = "yes"; then
8895         if test "$ICU_MAJOR" -ge "50"; then
8896             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
8897             ICU_MINOR=""
8898         fi
8899     fi
8900 else
8901     AC_MSG_RESULT([internal])
8902     SYSTEM_ICU=
8903     BUILD_TYPE="$BUILD_TYPE ICU"
8904     # surprisingly set these only for "internal" (to be used by various other
8905     # external libs): the system icu-config is quite unhelpful and spits out
8906     # dozens of weird flags and also default path -I/usr/include
8907     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8908     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
8910 if test "$ICU_MAJOR" -ge "59"; then
8911     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
8912     # with -std=c++11 but not all external libraries can be built with that,
8913     # for those use a bit-compatible typedef uint16_t UChar; see
8914     # icu/source/common/unicode/umachine.h
8915     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
8916 else
8917     ICU_UCHAR_TYPE=""
8919 AC_SUBST(SYSTEM_ICU)
8920 AC_SUBST(SYSTEM_GENBRK)
8921 AC_SUBST(SYSTEM_GENCCODE)
8922 AC_SUBST(SYSTEM_GENCMN)
8923 AC_SUBST(ICU_MAJOR)
8924 AC_SUBST(ICU_MINOR)
8925 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
8926 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
8927 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
8928 AC_SUBST(ICU_CFLAGS)
8929 AC_SUBST(ICU_LIBS)
8930 AC_SUBST(ICU_UCHAR_TYPE)
8932 dnl ==================================================================
8933 dnl Breakpad
8934 dnl ==================================================================
8935 AC_MSG_CHECKING([whether to enable breakpad])
8936 if test "$enable_breakpad" != yes; then
8937     AC_MSG_RESULT([no])
8938 else
8939     AC_MSG_RESULT([yes])
8940     ENABLE_BREAKPAD="TRUE"
8941     AC_DEFINE(ENABLE_BREAKPAD)
8942     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
8943     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
8945     AC_MSG_CHECKING([for crashreport config])
8946     if test "$with_symbol_config" = "no"; then
8947         BREAKPAD_SYMBOL_CONFIG="invalid"
8948         AC_MSG_RESULT([no])
8949     else
8950         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
8951         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
8952         AC_MSG_RESULT([yes])
8953     fi
8954     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
8956 AC_SUBST(ENABLE_BREAKPAD)
8958 dnl ==================================================================
8959 dnl libfuzzer
8960 dnl ==================================================================
8961 AC_MSG_CHECKING([whether to enable fuzzers])
8962 if test "$enable_fuzzers" != yes; then
8963     AC_MSG_RESULT([no])
8964 else
8965     AC_MSG_RESULT([yes])
8966     ENABLE_FUZZERS="TRUE"
8967     AC_DEFINE(ENABLE_FUZZERS)
8968     BUILD_TYPE="$BUILD_TYPE FUZZERS"
8970 AC_SUBST(ENABLE_FUZZERS)
8972 dnl ===================================================================
8973 dnl Orcus
8974 dnl ===================================================================
8975 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.13 >= 0.13.0])
8976 if test "$with_system_orcus" != "yes"; then
8977     if test "$SYSTEM_BOOST" = "TRUE"; then
8978         # ===========================================================
8979         # Determine if we are going to need to link with Boost.System
8980         # ===========================================================
8981         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
8982         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
8983         dnl in documentation has no effect.
8984         AC_MSG_CHECKING([if we need to link with Boost.System])
8985         AC_LANG_PUSH([C++])
8986         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
8987                 @%:@include <boost/version.hpp>
8988             ]],[[
8989                 #if BOOST_VERSION >= 105000
8990                 #   error yes, we need to link with Boost.System
8991                 #endif
8992             ]])],[
8993                 AC_MSG_RESULT([no])
8994             ],[
8995                 AC_MSG_RESULT([yes])
8996                 AX_BOOST_SYSTEM
8997         ])
8998         AC_LANG_POP([C++])
8999     fi
9001 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9002 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9003 AC_SUBST([BOOST_SYSTEM_LIB])
9004 AC_SUBST(SYSTEM_LIBORCUS)
9006 dnl ===================================================================
9007 dnl HarfBuzz
9008 dnl ===================================================================
9009 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9010                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9011                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9013 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9014                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9015                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9017 if test "$COM" = "MSC"; then # override the above
9018     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9019     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9022 if test "$with_system_harfbuzz" = "yes"; then
9023     if test "$with_system_graphite" = "no"; then
9024         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9025     fi
9026     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9027     _save_libs="$LIBS"
9028     _save_cflags="$CFLAGS"
9029     LIBS="$LIBS $HARFBUZZ_LIBS"
9030     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9031     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9032     LIBS="$_save_libs"
9033     CFLAGS="$_save_cflags"
9034 else
9035     if test "$with_system_graphite" = "yes"; then
9036         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9037     fi
9040 AC_MSG_CHECKING([whether to use X11])
9041 dnl ***************************************
9042 dnl testing for X libraries and includes...
9043 dnl ***************************************
9044 if test "$USING_X11" = TRUE; then
9045     AC_DEFINE(HAVE_FEATURE_X11)
9047 AC_MSG_RESULT([$USING_X11])
9049 if test "$USING_X11" = TRUE; then
9050     AC_PATH_X
9051     AC_PATH_XTRA
9052     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9054     if test -z "$x_includes"; then
9055         x_includes="default_x_includes"
9056     fi
9057     if test -z "$x_libraries"; then
9058         x_libraries="default_x_libraries"
9059     fi
9060     CFLAGS="$CFLAGS $X_CFLAGS"
9061     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9062     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9063 else
9064     x_includes="no_x_includes"
9065     x_libraries="no_x_libraries"
9068 if test "$USING_X11" = TRUE; then
9069     dnl ===================================================================
9070     dnl Check for extension headers
9071     dnl ===================================================================
9072     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9073      [#include <X11/extensions/shape.h>])
9075     # vcl needs ICE and SM
9076     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9077     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9078         [AC_MSG_ERROR(ICE library not found)])
9079     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9080     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9081         [AC_MSG_ERROR(SM library not found)])
9084 dnl ===================================================================
9085 dnl Check for system Xrender
9086 dnl ===================================================================
9087 AC_MSG_CHECKING([whether to use Xrender])
9088 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9089     AC_MSG_RESULT([yes])
9090     PKG_CHECK_MODULES(XRENDER, xrender)
9091     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9092     FilterLibs "${XRENDER_LIBS}"
9093     XRENDER_LIBS="${filteredlibs}"
9094     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9095       [AC_MSG_ERROR(libXrender not found or functional)], [])
9096     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9097       [AC_MSG_ERROR(Xrender not found. install X)], [])
9098 else
9099     AC_MSG_RESULT([no])
9101 AC_SUBST(XRENDER_CFLAGS)
9102 AC_SUBST(XRENDER_LIBS)
9104 dnl ===================================================================
9105 dnl Check for XRandr
9106 dnl ===================================================================
9107 AC_MSG_CHECKING([whether to enable RandR support])
9108 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9109     AC_MSG_RESULT([yes])
9110     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9111     if test "$ENABLE_RANDR" != "TRUE"; then
9112         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9113                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9114         XRANDR_CFLAGS=" "
9115         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9116           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9117         XRANDR_LIBS="-lXrandr "
9118         ENABLE_RANDR="TRUE"
9119     fi
9120     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9121     FilterLibs "${XRANDR_LIBS}"
9122     XRANDR_LIBS="${filteredlibs}"
9123 else
9124     ENABLE_RANDR=""
9125     AC_MSG_RESULT([no])
9127 AC_SUBST(XRANDR_CFLAGS)
9128 AC_SUBST(XRANDR_LIBS)
9129 AC_SUBST(ENABLE_RANDR)
9131 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9132     WITH_WEBDAV="serf"
9134 if test $_os = iOS -o $_os = Android; then
9135     WITH_WEBDAV="no"
9137 AC_MSG_CHECKING([for webdav library])
9138 case "$WITH_WEBDAV" in
9139 serf)
9140     AC_MSG_RESULT([serf])
9141     # Check for system apr-util
9142     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9143                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9144                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9145     if test "$COM" = "MSC"; then
9146         APR_LIB_DIR="LibR"
9147         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9148         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9149     fi
9151     # Check for system serf
9152     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9153                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9154     if test "$COM" = "MSC"; then
9155         SERF_LIB_DIR="Release"
9156         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9157         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9158     fi
9159     ;;
9160 neon)
9161     AC_MSG_RESULT([neon])
9162     # Check for system neon
9163     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9164     if test "$with_system_neon" = "yes"; then
9165         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9166     else
9167         NEON_VERSION=0295
9168     fi
9169     AC_SUBST(NEON_VERSION)
9170     ;;
9172     AC_MSG_RESULT([none, disabled])
9173     WITH_WEBDAV=""
9174     ;;
9175 esac
9176 AC_SUBST(WITH_WEBDAV)
9178 dnl ===================================================================
9179 dnl Check for disabling cve_tests
9180 dnl ===================================================================
9181 AC_MSG_CHECKING([whether to execute CVE tests])
9182 # If not explicitly enabled or disabled, default
9183 if test -z "$enable_cve_tests"; then
9184     case "$OS" in
9185     WNT)
9186         # Default cves off for windows with its wild and wonderful
9187         # varienty of AV software kicking in and panicking
9188         enable_cve_tests=no
9189         ;;
9190     *)
9191         # otherwise yes
9192         enable_cve_tests=yes
9193         ;;
9194     esac
9196 if test "$enable_cve_tests" = "no"; then
9197     AC_MSG_RESULT([no])
9198     DISABLE_CVE_TESTS=TRUE
9199     AC_SUBST(DISABLE_CVE_TESTS)
9200 else
9201     AC_MSG_RESULT([yes])
9204 dnl ===================================================================
9205 dnl Check for enabling chart XShape tests
9206 dnl ===================================================================
9207 AC_MSG_CHECKING([whether to execute chart XShape tests])
9208 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9209     AC_MSG_RESULT([yes])
9210     ENABLE_CHART_TESTS=TRUE
9211     AC_SUBST(ENABLE_CHART_TESTS)
9212 else
9213     AC_MSG_RESULT([no])
9216 dnl ===================================================================
9217 dnl Check for system openssl
9218 dnl ===================================================================
9219 DISABLE_OPENSSL=
9220 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9221 if test "$enable_openssl" = "yes"; then
9222     AC_MSG_RESULT([no])
9223     if test "$_os" = Darwin ; then
9224         # OpenSSL is deprecated when building for 10.7 or later.
9225         #
9226         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9227         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9229         with_system_openssl=no
9230         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9231     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9232             && test "$with_system_openssl" != "no"; then
9233         with_system_openssl=yes
9234         SYSTEM_OPENSSL=TRUE
9235         OPENSSL_CFLAGS=
9236         OPENSSL_LIBS="-lssl -lcrypto"
9237     else
9238         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9239     fi
9240     if test "$with_system_openssl" = "yes"; then
9241         AC_MSG_CHECKING([whether openssl supports SHA512])
9242         AC_LANG_PUSH([C])
9243         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9244             SHA512_CTX context;
9245 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9246         AC_LANG_POP(C)
9247     fi
9248 else
9249     AC_MSG_RESULT([yes])
9250     DISABLE_OPENSSL=TRUE
9252     # warn that although OpenSSL is disabled, system libraries may depend on it
9253     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9254     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9257 AC_SUBST([DISABLE_OPENSSL])
9259 dnl ===================================================================
9260 dnl Check for building gnutls
9261 dnl ===================================================================
9262 AC_MSG_CHECKING([whether to use gnutls])
9263 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9264     AC_MSG_RESULT([yes])
9265     AM_PATH_LIBGCRYPT()
9266     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9267         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9268                       available in the system to use as replacement.]]))
9269     FilterLibs "${LIBGCRYPT_LIBS}"
9270     LIBGCRYPT_LIBS="${filteredlibs}"
9271 else
9272     AC_MSG_RESULT([no])
9275 AC_SUBST([LIBGCRYPT_CFLAGS])
9276 AC_SUBST([LIBGCRYPT_LIBS])
9278 dnl ===================================================================
9279 dnl Check for system redland
9280 dnl ===================================================================
9281 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9282 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9283 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9284 if test "$with_system_redland" = "yes"; then
9285     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9286             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9287 else
9288     RAPTOR_MAJOR="0"
9289     RASQAL_MAJOR="3"
9290     REDLAND_MAJOR="0"
9292 AC_SUBST(RAPTOR_MAJOR)
9293 AC_SUBST(RASQAL_MAJOR)
9294 AC_SUBST(REDLAND_MAJOR)
9296 dnl ===================================================================
9297 dnl Check for system hunspell
9298 dnl ===================================================================
9299 AC_MSG_CHECKING([which libhunspell to use])
9300 if test "$with_system_hunspell" = "yes"; then
9301     AC_MSG_RESULT([external])
9302     SYSTEM_HUNSPELL=TRUE
9303     AC_LANG_PUSH([C++])
9304     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9305     if test "$HUNSPELL_PC" != "TRUE"; then
9306         AC_CHECK_HEADER(hunspell.hxx, [],
9307             [
9308             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9309             [AC_MSG_ERROR(hunspell headers not found.)], [])
9310             ], [])
9311         AC_CHECK_LIB([hunspell], [main], [:],
9312            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9313         HUNSPELL_LIBS=-lhunspell
9314     fi
9315     AC_LANG_POP([C++])
9316     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9317     FilterLibs "${HUNSPELL_LIBS}"
9318     HUNSPELL_LIBS="${filteredlibs}"
9319 else
9320     AC_MSG_RESULT([internal])
9321     SYSTEM_HUNSPELL=
9322     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9323     if test "$COM" = "MSC"; then
9324         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9325     else
9326         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.6"
9327     fi
9328     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9330 AC_SUBST(SYSTEM_HUNSPELL)
9331 AC_SUBST(HUNSPELL_CFLAGS)
9332 AC_SUBST(HUNSPELL_LIBS)
9334 dnl ===================================================================
9335 dnl Checking for altlinuxhyph
9336 dnl ===================================================================
9337 AC_MSG_CHECKING([which altlinuxhyph to use])
9338 if test "$with_system_altlinuxhyph" = "yes"; then
9339     AC_MSG_RESULT([external])
9340     SYSTEM_HYPH=TRUE
9341     AC_CHECK_HEADER(hyphen.h, [],
9342        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9343     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9344        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9345        [#include <hyphen.h>])
9346     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9347         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9348     if test -z "$HYPHEN_LIB"; then
9349         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9350            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9351     fi
9352     if test -z "$HYPHEN_LIB"; then
9353         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9354            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9355     fi
9356 else
9357     AC_MSG_RESULT([internal])
9358     SYSTEM_HYPH=
9359     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9360     if test "$COM" = "MSC"; then
9361         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9362     else
9363         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9364     fi
9366 AC_SUBST(SYSTEM_HYPH)
9367 AC_SUBST(HYPHEN_LIB)
9369 dnl ===================================================================
9370 dnl Checking for mythes
9371 dnl ===================================================================
9372 AC_MSG_CHECKING([which mythes to use])
9373 if test "$with_system_mythes" = "yes"; then
9374     AC_MSG_RESULT([external])
9375     SYSTEM_MYTHES=TRUE
9376     AC_LANG_PUSH([C++])
9377     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9378     if test "$MYTHES_PKGCONFIG" = "no"; then
9379         AC_CHECK_HEADER(mythes.hxx, [],
9380             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9381         AC_CHECK_LIB([mythes-1.2], [main], [:],
9382             [ MYTHES_FOUND=no], [])
9383     if test "$MYTHES_FOUND" = "no"; then
9384         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9385                 [ MYTHES_FOUND=no], [])
9386     fi
9387     if test "$MYTHES_FOUND" = "no"; then
9388         AC_MSG_ERROR([mythes library not found!.])
9389     fi
9390     fi
9391     AC_LANG_POP([C++])
9392     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9393     FilterLibs "${MYTHES_LIBS}"
9394     MYTHES_LIBS="${filteredlibs}"
9395 else
9396     AC_MSG_RESULT([internal])
9397     SYSTEM_MYTHES=
9398     BUILD_TYPE="$BUILD_TYPE MYTHES"
9399     if test "$COM" = "MSC"; then
9400         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9401     else
9402         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9403     fi
9405 AC_SUBST(SYSTEM_MYTHES)
9406 AC_SUBST(MYTHES_CFLAGS)
9407 AC_SUBST(MYTHES_LIBS)
9409 dnl ===================================================================
9410 dnl How should we build the linear programming solver ?
9411 dnl ===================================================================
9413 ENABLE_COINMP=
9414 AC_MSG_CHECKING([whether to build with CoinMP])
9415 if test "$enable_coinmp" != "no"; then
9416     ENABLE_COINMP=TRUE
9417     AC_MSG_RESULT([yes])
9418     if test "$with_system_coinmp" = "yes"; then
9419         SYSTEM_COINMP=TRUE
9420         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9421         FilterLibs "${COINMP_LIBS}"
9422         COINMP_LIBS="${filteredlibs}"
9423     else
9424         BUILD_TYPE="$BUILD_TYPE COINMP"
9425     fi
9426 else
9427     AC_MSG_RESULT([no])
9429 AC_SUBST(ENABLE_COINMP)
9430 AC_SUBST(SYSTEM_COINMP)
9431 AC_SUBST(COINMP_CFLAGS)
9432 AC_SUBST(COINMP_LIBS)
9434 ENABLE_LPSOLVE=
9435 AC_MSG_CHECKING([whether to build with lpsolve])
9436 if test "$enable_lpsolve" != "no"; then
9437     ENABLE_LPSOLVE=TRUE
9438     AC_MSG_RESULT([yes])
9439 else
9440     AC_MSG_RESULT([no])
9442 AC_SUBST(ENABLE_LPSOLVE)
9444 if test "$ENABLE_LPSOLVE" = TRUE; then
9445     AC_MSG_CHECKING([which lpsolve to use])
9446     if test "$with_system_lpsolve" = "yes"; then
9447         AC_MSG_RESULT([external])
9448         SYSTEM_LPSOLVE=TRUE
9449         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9450            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9451         save_LIBS=$LIBS
9452         # some systems need this. Like Ubuntu....
9453         AC_CHECK_LIB(m, floor)
9454         AC_CHECK_LIB(dl, dlopen)
9455         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9456             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9457         LIBS=$save_LIBS
9458     else
9459         AC_MSG_RESULT([internal])
9460         SYSTEM_LPSOLVE=
9461         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9462     fi
9464 AC_SUBST(SYSTEM_LPSOLVE)
9466 dnl ===================================================================
9467 dnl Checking for libexttextcat
9468 dnl ===================================================================
9469 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9470 if test "$with_system_libexttextcat" = "yes"; then
9471     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9473 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9475 dnl ***************************************
9476 dnl testing libc version for Linux...
9477 dnl ***************************************
9478 if test "$_os" = "Linux"; then
9479     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9480     exec 6>/dev/null # no output
9481     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9482     exec 6>&1 # output on again
9483     if test "$HAVE_LIBC"; then
9484         AC_MSG_RESULT([yes])
9485     else
9486         AC_MSG_ERROR([no, upgrade libc])
9487     fi
9490 dnl =========================================
9491 dnl Check for uuidgen
9492 dnl =========================================
9493 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9494     # presence is already tested above in the WINDOWS_SDK_HOME check
9495     UUIDGEN=uuidgen.exe
9496     AC_SUBST(UUIDGEN)
9497 else
9498     AC_PATH_PROG([UUIDGEN], [uuidgen])
9499     if test -z "$UUIDGEN"; then
9500         AC_MSG_WARN([uuid is needed for building installation sets])
9501     fi
9504 dnl ***************************************
9505 dnl Checking for bison and flex
9506 dnl ***************************************
9507 AC_PATH_PROG(BISON, bison)
9508 if test -z "$BISON"; then
9509     AC_MSG_ERROR([no bison found in \$PATH, install it])
9510 else
9511     AC_MSG_CHECKING([the bison version])
9512     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9513     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9514     # Accept newer than 2.0
9515     if test "$_bison_longver" -lt 2000; then
9516         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9517     fi
9520 AC_PATH_PROG(FLEX, flex)
9521 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9522     FLEX=`cygpath -m $FLEX`
9524 if test -z "$FLEX"; then
9525     AC_MSG_ERROR([no flex found in \$PATH, install it])
9526 else
9527     AC_MSG_CHECKING([the flex version])
9528     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9529     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9530         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9531     fi
9533 AC_SUBST([FLEX])
9534 dnl ***************************************
9535 dnl Checking for patch
9536 dnl ***************************************
9537 AC_PATH_PROG(PATCH, patch)
9538 if test -z "$PATCH"; then
9539     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9542 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9543 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9544     if test -z "$with_gnu_patch"; then
9545         GNUPATCH=$PATCH
9546     else
9547         if test -x "$with_gnu_patch"; then
9548             GNUPATCH=$with_gnu_patch
9549         else
9550             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9551         fi
9552     fi
9554     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9555     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9556         AC_MSG_RESULT([yes])
9557     else
9558         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9559     fi
9560 else
9561     GNUPATCH=$PATCH
9564 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9565     GNUPATCH=`cygpath -m $GNUPATCH`
9568 dnl We also need to check for --with-gnu-cp
9570 if test -z "$with_gnu_cp"; then
9571     # check the place where the good stuff is hidden on Solaris...
9572     if test -x /usr/gnu/bin/cp; then
9573         GNUCP=/usr/gnu/bin/cp
9574     else
9575         AC_PATH_PROGS(GNUCP, gnucp cp)
9576     fi
9577     if test -z $GNUCP; then
9578         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9579     fi
9580 else
9581     if test -x "$with_gnu_cp"; then
9582         GNUCP=$with_gnu_cp
9583     else
9584         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9585     fi
9588 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9589     GNUCP=`cygpath -m $GNUCP`
9592 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9593 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9594     AC_MSG_RESULT([yes])
9595 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9596     AC_MSG_RESULT([yes])
9597 else
9598     case "$build_os" in
9599     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9600         x_GNUCP=[\#]
9601         GNUCP=''
9602         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9603         ;;
9604     *)
9605         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9606         ;;
9607     esac
9610 AC_SUBST(GNUPATCH)
9611 AC_SUBST(GNUCP)
9612 AC_SUBST(x_GNUCP)
9614 dnl ***************************************
9615 dnl testing assembler path
9616 dnl ***************************************
9617 ML_EXE=""
9618 if test "$_os" = "WINNT"; then
9619     if test "$BITNESS_OVERRIDE" = ""; then
9620         assembler=ml.exe
9621         assembler_bin=$CL_DIR
9622     else
9623         assembler=ml64.exe
9624         assembler_bin=$CL_DIR
9625     fi
9627     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9628     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9629         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9630         AC_MSG_RESULT([found])
9631         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9632     else
9633         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9634     fi
9636     PathFormat "$ASM_HOME"
9637     ASM_HOME="$formatted_path"
9638 else
9639     ASM_HOME=""
9642 AC_SUBST(ML_EXE)
9644 dnl ===================================================================
9645 dnl We need zip and unzip
9646 dnl ===================================================================
9647 AC_PATH_PROG(ZIP, zip)
9648 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9649 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9650     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],,)
9653 AC_PATH_PROG(UNZIP, unzip)
9654 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9656 dnl ===================================================================
9657 dnl Zip must be a specific type for different build types.
9658 dnl ===================================================================
9659 if test $build_os = cygwin; then
9660     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9661         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9662     fi
9665 dnl ===================================================================
9666 dnl We need touch with -h option support.
9667 dnl ===================================================================
9668 AC_PATH_PROG(TOUCH, touch)
9669 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
9670 touch warn
9671 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
9672     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],,)
9675 dnl ===================================================================
9676 dnl Check for system epoxy
9677 dnl ===================================================================
9678 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
9680 dnl ===================================================================
9681 dnl Set vcl option: coordinate device in double or sal_Int32
9682 dnl ===================================================================
9684 dnl disabled for now, we don't want subtle differences between OSs
9685 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
9686 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
9687 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
9688 dnl     AC_MSG_RESULT([double])
9689 dnl else
9690 dnl     AC_MSG_RESULT([sal_Int32])
9691 dnl fi
9693 dnl ===================================================================
9694 dnl Test which vclplugs have to be built.
9695 dnl ===================================================================
9696 R=""
9697 if test "$USING_X11" != TRUE; then
9698     enable_gtk=no
9699     enable_gtk3=no
9701 GTK3_CFLAGS=""
9702 GTK3_LIBS=""
9703 ENABLE_GTK3=""
9704 if test "x$enable_gtk3" = "xyes"; then
9705     if test "$with_system_cairo" = no; then
9706         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
9707     fi
9708     : ${with_system_cairo:=yes}
9709     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="")
9710     if test "x$ENABLE_GTK3" = "xTRUE"; then
9711         R="gtk3"
9712         dnl Avoid installed by unpackaged files for now.
9713         if test -z "$PKGFORMAT"; then
9714             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
9715         fi
9716     else
9717         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
9718     fi
9719     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9720     FilterLibs "${GTK3_LIBS}"
9721     GTK3_LIBS="${filteredlibs}"
9723     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
9724     if test "$with_system_epoxy" != "yes"; then
9725         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
9726     fi
9728 AC_SUBST(GTK3_LIBS)
9729 AC_SUBST(GTK3_CFLAGS)
9730 AC_SUBST(ENABLE_GTK3)
9732 ENABLE_GTK=""
9733 if test "x$enable_gtk" = "xyes"; then
9734     if test "$with_system_cairo" = no; then
9735         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
9736     fi
9737     : ${with_system_cairo:=yes}
9738     ENABLE_GTK="TRUE"
9739     AC_DEFINE(ENABLE_GTK)
9740     R="gtk $R"
9742 AC_SUBST(ENABLE_GTK)
9744 ENABLE_KDE4=""
9745 if test "x$enable_kde4" = "xyes"; then
9746     ENABLE_KDE4="TRUE"
9747     AC_DEFINE(ENABLE_KDE4)
9748     R="$R kde4"
9750 AC_SUBST(ENABLE_KDE4)
9752 ENABLE_QT5=""
9753 if test "x$enable_qt5" = "xyes"; then
9754     ENABLE_QT5="TRUE"
9755     AC_DEFINE(ENABLE_QT5)
9756     R="$R qt5"
9758 AC_SUBST(ENABLE_QT5)
9760 build_vcl_plugins="$R"
9761 if test -z "$build_vcl_plugins"; then
9762     build_vcl_plugins="none"
9764 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
9766 dnl ===================================================================
9767 dnl check for dbus support
9768 dnl ===================================================================
9769 ENABLE_DBUS=""
9770 DBUS_CFLAGS=""
9771 DBUS_LIBS=""
9773 if test "$enable_dbus" = "no"; then
9774     test_dbus=no
9777 AC_MSG_CHECKING([whether to enable DBUS support])
9778 if test "$test_dbus" = "yes"; then
9779     ENABLE_DBUS="TRUE"
9780     AC_MSG_RESULT([yes])
9781     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
9782     AC_DEFINE(ENABLE_DBUS)
9783     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9784     FilterLibs "${DBUS_LIBS}"
9785     DBUS_LIBS="${filteredlibs}"
9786 else
9787     AC_MSG_RESULT([no])
9790 AC_SUBST(ENABLE_DBUS)
9791 AC_SUBST(DBUS_CFLAGS)
9792 AC_SUBST(DBUS_LIBS)
9794 AC_MSG_CHECKING([whether to enable Impress remote control])
9795 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
9796     AC_MSG_RESULT([yes])
9797     ENABLE_SDREMOTE=TRUE
9798     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
9800     # If not explicitly enabled or disabled, default
9801     if test -z "$enable_sdremote_bluetooth"; then
9802         case "$OS" in
9803         LINUX|MACOSX|WNT)
9804             # Default to yes for these
9805             enable_sdremote_bluetooth=yes
9806             ;;
9807         *)
9808             # otherwise no
9809             enable_sdremote_bluetooth=no
9810             ;;
9811         esac
9812     fi
9813     # $enable_sdremote_bluetooth is guaranteed non-empty now
9815     if test "$enable_sdremote_bluetooth" != "no"; then
9816         if test "$OS" = "LINUX"; then
9817             if test "$ENABLE_DBUS" = "TRUE"; then
9818                 AC_MSG_RESULT([yes])
9819                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
9820                 dnl ===================================================================
9821                 dnl Check for system bluez
9822                 dnl ===================================================================
9823                 AC_MSG_CHECKING([which Bluetooth header to use])
9824                 if test "$with_system_bluez" = "yes"; then
9825                     AC_MSG_RESULT([external])
9826                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
9827                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
9828                     SYSTEM_BLUEZ=TRUE
9829                 else
9830                     AC_MSG_RESULT([internal])
9831                     SYSTEM_BLUEZ=
9832                 fi
9833             else
9834                 AC_MSG_RESULT([no, dbus disabled])
9835                 ENABLE_SDREMOTE_BLUETOOTH=
9836                 SYSTEM_BLUEZ=
9837             fi
9838         else
9839             AC_MSG_RESULT([yes])
9840             ENABLE_SDREMOTE_BLUETOOTH=TRUE
9841             SYSTEM_BLUEZ=
9842         fi
9843     else
9844         AC_MSG_RESULT([no])
9845         ENABLE_SDREMOTE_BLUETOOTH=
9846         SYSTEM_BLUEZ=
9847     fi
9848 else
9849     ENABLE_SDREMOTE=
9850     SYSTEM_BLUEZ=
9851     AC_MSG_RESULT([no])
9853 AC_SUBST(ENABLE_SDREMOTE)
9854 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
9855 AC_SUBST(SYSTEM_BLUEZ)
9857 dnl ===================================================================
9858 dnl Check whether the gtk 2.0 libraries are available.
9859 dnl ===================================================================
9861 GTK_CFLAGS=""
9862 GTK_LIBS=""
9863 ENABLE_SYSTRAY_GTK=""
9864 if test  "$test_gtk" = "yes"; then
9866     if test "$ENABLE_GTK" = "TRUE"; then
9867         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]))
9868         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9869         FilterLibs "${GTK_LIBS}"
9870         GTK_LIBS="${filteredlibs}"
9871         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]))
9872         BUILD_TYPE="$BUILD_TYPE GTK"
9873         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9874         FilterLibs "${GTHREAD_LIBS}"
9875         GTHREAD_LIBS="${filteredlibs}"
9877         if test "x$enable_systray" = "xyes"; then
9878             ENABLE_SYSTRAY_GTK="TRUE"
9879         fi
9881         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
9882         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
9883                           [ENABLE_GTK_PRINT="TRUE"],
9884                           [ENABLE_GTK_PRINT=""])
9885         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9886         FilterLibs "${GTK_PRINT_LIBS}"
9887         GTK_PRINT_LIBS="${filteredlibs}"
9889         AC_MSG_CHECKING([whether to enable GIO support])
9890         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
9891             dnl Need at least 2.26 for the dbus support.
9892             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
9893                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
9894             if test "$ENABLE_GIO" = "TRUE"; then
9895                 AC_DEFINE(ENABLE_GIO)
9896                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9897                 FilterLibs "${GIO_LIBS}"
9898                 GIO_LIBS="${filteredlibs}"
9899             fi
9900         else
9901             AC_MSG_RESULT([no])
9902         fi
9903     fi
9905 AC_SUBST(ENABLE_GIO)
9906 AC_SUBST(GIO_CFLAGS)
9907 AC_SUBST(GIO_LIBS)
9908 AC_SUBST(ENABLE_SYSTRAY_GTK)
9909 AC_SUBST(GTK_CFLAGS)
9910 AC_SUBST(GTK_LIBS)
9911 AC_SUBST(GTHREAD_CFLAGS)
9912 AC_SUBST(GTHREAD_LIBS)
9913 AC_SUBST([ENABLE_GTK_PRINT])
9914 AC_SUBST([GTK_PRINT_CFLAGS])
9915 AC_SUBST([GTK_PRINT_LIBS])
9918 dnl ===================================================================
9920 SPLIT_APP_MODULES=""
9921 if test "$enable_split_app_modules" = "yes"; then
9922     SPLIT_APP_MODULES="TRUE"
9924 AC_SUBST(SPLIT_APP_MODULES)
9926 SPLIT_OPT_FEATURES=""
9927 if test "$enable_split_opt_features" = "yes"; then
9928     SPLIT_OPT_FEATURES="TRUE"
9930 AC_SUBST(SPLIT_OPT_FEATURES)
9932 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
9933     if test "$enable_cairo_canvas" = yes; then
9934         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
9935     fi
9936     enable_cairo_canvas=no
9937 elif test -z "$enable_cairo_canvas"; then
9938     enable_cairo_canvas=yes
9941 ENABLE_CAIRO_CANVAS=""
9942 if test "$enable_cairo_canvas" = "yes"; then
9943     test_cairo=yes
9944     ENABLE_CAIRO_CANVAS="TRUE"
9945     AC_DEFINE(ENABLE_CAIRO_CANVAS)
9947 AC_SUBST(ENABLE_CAIRO_CANVAS)
9949 dnl ===================================================================
9950 dnl Check whether the GStreamer libraries are available.
9951 dnl It's possible to build avmedia with both GStreamer backends!
9952 dnl ===================================================================
9954 ENABLE_GSTREAMER_1_0=""
9956 if test "$build_gstreamer_1_0" = "yes"; then
9958     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
9959     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
9960         ENABLE_GSTREAMER_1_0="TRUE"
9961         AC_MSG_RESULT([yes])
9962         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
9963         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9964         FilterLibs "${GSTREAMER_1_0_LIBS}"
9965         GSTREAMER_1_0_LIBS="${filteredlibs}"
9966     else
9967         AC_MSG_RESULT([no])
9968     fi
9970 AC_SUBST(GSTREAMER_1_0_CFLAGS)
9971 AC_SUBST(GSTREAMER_1_0_LIBS)
9972 AC_SUBST(ENABLE_GSTREAMER_1_0)
9975 ENABLE_GSTREAMER_0_10=""
9976 if test "$build_gstreamer_0_10" = "yes"; then
9978     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
9979     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
9980         ENABLE_GSTREAMER_0_10="TRUE"
9981         AC_MSG_RESULT([yes])
9982         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
9983             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
9984         ])
9985         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9986         FilterLibs "${GSTREAMER_0_10_LIBS}"
9987         GSTREAMER_0_10_LIBS="${filteredlibs}"
9988     else
9989         AC_MSG_RESULT([no])
9990     fi
9993 AC_SUBST(GSTREAMER_0_10_CFLAGS)
9994 AC_SUBST(GSTREAMER_0_10_LIBS)
9995 AC_SUBST(ENABLE_GSTREAMER_0_10)
9997 dnl ===================================================================
9998 dnl Check whether to build the VLC avmedia backend
9999 dnl ===================================================================
10001 ENABLE_VLC=""
10003 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10004 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10005     ENABLE_VLC="TRUE"
10006     AC_MSG_RESULT([yes])
10007 else
10008     AC_MSG_RESULT([no])
10010 AC_SUBST(ENABLE_VLC)
10012 ENABLE_OPENGL_TRANSITIONS=
10013 ENABLE_OPENGL_CANVAS=
10014 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10015    : # disable
10016 elif test "$_os" = "Darwin"; then
10017     # We use frameworks on Mac OS X, no need for detail checks
10018     ENABLE_OPENGL_TRANSITIONS=TRUE
10019     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10020     ENABLE_OPENGL_CANVAS=TRUE
10021 elif test $_os = WINNT; then
10022     ENABLE_OPENGL_TRANSITIONS=TRUE
10023     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10024     ENABLE_OPENGL_CANVAS=TRUE
10025 else
10026     if test "$USING_X11" = TRUE; then
10027         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10028         ENABLE_OPENGL_TRANSITIONS=TRUE
10029         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10030         ENABLE_OPENGL_CANVAS=TRUE
10031     fi
10034 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10035 AC_SUBST(ENABLE_OPENGL_CANVAS)
10037 dnl =================================================
10038 dnl Check whether to build with OpenCL support.
10039 dnl =================================================
10041 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10042     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10043     # platform (optional at run-time, used through clew).
10044     BUILD_TYPE="$BUILD_TYPE OPENCL"
10045     AC_DEFINE(HAVE_FEATURE_OPENCL)
10048 dnl =================================================
10049 dnl Check whether to build with dconf support.
10050 dnl =================================================
10052 if test "$enable_dconf" != no; then
10053     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10054         if test "$enable_dconf" = yes; then
10055             AC_MSG_ERROR([dconf not found])
10056         else
10057             enable_dconf=no
10058         fi])
10060 AC_MSG_CHECKING([whether to enable dconf])
10061 if test "$enable_dconf" = no; then
10062     DCONF_CFLAGS=
10063     DCONF_LIBS=
10064     ENABLE_DCONF=
10065     AC_MSG_RESULT([no])
10066 else
10067     ENABLE_DCONF=TRUE
10068     AC_DEFINE(ENABLE_DCONF)
10069     AC_MSG_RESULT([yes])
10071 AC_SUBST([DCONF_CFLAGS])
10072 AC_SUBST([DCONF_LIBS])
10073 AC_SUBST([ENABLE_DCONF])
10075 # pdf import?
10076 AC_MSG_CHECKING([whether to build the PDF import feature])
10077 ENABLE_PDFIMPORT=
10078 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10079     AC_MSG_RESULT([yes])
10080     ENABLE_PDFIMPORT=TRUE
10081     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10083     dnl ===================================================================
10084     dnl Check for system poppler
10085     dnl ===================================================================
10086     AC_MSG_CHECKING([which PDF import backend to use])
10087     if test "$with_system_poppler" = "yes"; then
10088         AC_MSG_RESULT([external])
10089         SYSTEM_POPPLER=TRUE
10090         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10091         AC_LANG_PUSH([C++])
10092         save_CXXFLAGS=$CXXFLAGS
10093         save_CPPFLAGS=$CPPFLAGS
10094         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10095         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10096         AC_CHECK_HEADER([cpp/poppler-version.h],
10097             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10098             [])
10099         CXXFLAGS=$save_CXXFLAGS
10100         CPPFLAGS=$save_CPPFLAGS
10101         AC_LANG_POP([C++])
10102         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10104         FilterLibs "${POPPLER_LIBS}"
10105         POPPLER_LIBS="${filteredlibs}"
10106     else
10107         AC_MSG_RESULT([internal])
10108         SYSTEM_POPPLER=
10109         BUILD_TYPE="$BUILD_TYPE POPPLER"
10110         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10111     fi
10112     AC_DEFINE([ENABLE_PDFIMPORT],1)
10113 else
10114     AC_MSG_RESULT([no])
10116 AC_SUBST(ENABLE_PDFIMPORT)
10117 AC_SUBST(SYSTEM_POPPLER)
10118 AC_SUBST(POPPLER_CFLAGS)
10119 AC_SUBST(POPPLER_LIBS)
10121 # pdf import?
10122 AC_MSG_CHECKING([whether to build PDFium])
10123 ENABLE_PDFIUM=
10124 if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then
10125     AC_MSG_RESULT([yes])
10126     ENABLE_PDFIUM=TRUE
10127     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10128     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10129 else
10130     AC_MSG_RESULT([no])
10132 AC_SUBST(ENABLE_PDFIUM)
10134 SYSTEM_GPGMEPP=
10136 if test "$build_for_ios" = "YES"; then
10137     AC_MSG_CHECKING([gpgmepp disabled due to iOS])
10138 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10139     dnl ===================================================================
10140     dnl Check for system gpgme
10141     dnl ===================================================================
10142     AC_MSG_CHECKING([which gpgmepp to use])
10143     if test "$with_system_gpgmepp" = "yes"; then
10144         AC_MSG_RESULT([external])
10145         SYSTEM_GPGMEPP=TRUE
10147         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10148         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10149             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10150         # progress_callback is the only func with plain C linkage
10151         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10152         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10153             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10154         AC_CHECK_HEADER(gpgme.h, [],
10155             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10156     else
10157         AC_MSG_RESULT([internal])
10158         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10159         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10161         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10162         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10163         if test "$_os" != "WINNT"; then
10164             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10165             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10166         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10167             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10168         fi
10169     fi
10170     ENABLE_GPGMEPP=TRUE
10171     AC_DEFINE([HAVE_FEATURE_GPGME])
10172     AC_PATH_PROG(GPG, gpg)
10173     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10174     # so let's exclude that manually for the moment
10175     if test -n "$GPG" -a "$_os" != "WINNT"; then
10176         # make sure we not only have a working gpgme, but a full working
10177         # gpg installation to run OpenPGP signature verification
10178         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10179     fi
10181 AC_SUBST(ENABLE_GPGMEPP)
10182 AC_SUBST(SYSTEM_GPGMEPP)
10183 AC_SUBST(GPG_ERROR_CFLAGS)
10184 AC_SUBST(GPG_ERROR_LIBS)
10185 AC_SUBST(LIBASSUAN_CFLAGS)
10186 AC_SUBST(LIBASSUAN_LIBS)
10187 AC_SUBST(GPGMEPP_CFLAGS)
10188 AC_SUBST(GPGMEPP_LIBS)
10190 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10191 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10192     AC_MSG_RESULT([yes])
10193     ENABLE_MEDIAWIKI=TRUE
10194     BUILD_TYPE="$BUILD_TYPE XSLTML"
10195     if test  "x$with_java" = "xno"; then
10196         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10197     fi
10198 else
10199     AC_MSG_RESULT([no])
10200     ENABLE_MEDIAWIKI=
10201     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10203 AC_SUBST(ENABLE_MEDIAWIKI)
10205 AC_MSG_CHECKING([whether to build the Report Builder])
10206 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10207     AC_MSG_RESULT([yes])
10208     ENABLE_REPORTBUILDER=TRUE
10209     AC_MSG_CHECKING([which jfreereport libs to use])
10210     if test "$with_system_jfreereport" = "yes"; then
10211         SYSTEM_JFREEREPORT=TRUE
10212         AC_MSG_RESULT([external])
10213         if test -z $SAC_JAR; then
10214             SAC_JAR=/usr/share/java/sac.jar
10215         fi
10216         if ! test -f $SAC_JAR; then
10217              AC_MSG_ERROR(sac.jar not found.)
10218         fi
10220         if test -z $LIBXML_JAR; then
10221             if test -f /usr/share/java/libxml-1.0.0.jar; then
10222                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10223             elif test -f /usr/share/java/libxml.jar; then
10224                 LIBXML_JAR=/usr/share/java/libxml.jar
10225             else
10226                 AC_MSG_ERROR(libxml.jar replacement not found.)
10227             fi
10228         elif ! test -f $LIBXML_JAR; then
10229             AC_MSG_ERROR(libxml.jar not found.)
10230         fi
10232         if test -z $FLUTE_JAR; then
10233             if test -f/usr/share/java/flute-1.3.0.jar; then
10234                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10235             elif test -f /usr/share/java/flute.jar; then
10236                 FLUTE_JAR=/usr/share/java/flute.jar
10237             else
10238                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10239             fi
10240         elif ! test -f $FLUTE_JAR; then
10241             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10242         fi
10244         if test -z $JFREEREPORT_JAR; then
10245             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10246                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10247             elif test -f /usr/share/java/flow-engine.jar; then
10248                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10249             else
10250                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10251             fi
10252         elif ! test -f  $JFREEREPORT_JAR; then
10253                 AC_MSG_ERROR(jfreereport.jar not found.)
10254         fi
10256         if test -z $LIBLAYOUT_JAR; then
10257             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10258                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10259             elif test -f /usr/share/java/liblayout.jar; then
10260                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10261             else
10262                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10263             fi
10264         elif ! test -f $LIBLAYOUT_JAR; then
10265                 AC_MSG_ERROR(liblayout.jar not found.)
10266         fi
10268         if test -z $LIBLOADER_JAR; then
10269             if test -f /usr/share/java/libloader-1.0.0.jar; then
10270                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10271             elif test -f /usr/share/java/libloader.jar; then
10272                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10273             else
10274                 AC_MSG_ERROR(libloader.jar replacement not found.)
10275             fi
10276         elif ! test -f  $LIBLOADER_JAR; then
10277             AC_MSG_ERROR(libloader.jar not found.)
10278         fi
10280         if test -z $LIBFORMULA_JAR; then
10281             if test -f /usr/share/java/libformula-0.2.0.jar; then
10282                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10283             elif test -f /usr/share/java/libformula.jar; then
10284                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10285             else
10286                 AC_MSG_ERROR(libformula.jar replacement not found.)
10287             fi
10288         elif ! test -f $LIBFORMULA_JAR; then
10289                 AC_MSG_ERROR(libformula.jar not found.)
10290         fi
10292         if test -z $LIBREPOSITORY_JAR; then
10293             if test -f /usr/share/java/librepository-1.0.0.jar; then
10294                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10295             elif test -f /usr/share/java/librepository.jar; then
10296                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10297             else
10298                 AC_MSG_ERROR(librepository.jar replacement not found.)
10299             fi
10300         elif ! test -f $LIBREPOSITORY_JAR; then
10301             AC_MSG_ERROR(librepository.jar not found.)
10302         fi
10304         if test -z $LIBFONTS_JAR; then
10305             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10306                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10307             elif test -f /usr/share/java/libfonts.jar; then
10308                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10309             else
10310                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10311             fi
10312         elif ! test -f $LIBFONTS_JAR; then
10313                 AC_MSG_ERROR(libfonts.jar not found.)
10314         fi
10316         if test -z $LIBSERIALIZER_JAR; then
10317             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10318                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10319             elif test -f /usr/share/java/libserializer.jar; then
10320                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10321             else
10322                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10323             fi
10324         elif ! test -f $LIBSERIALIZER_JAR; then
10325                 AC_MSG_ERROR(libserializer.jar not found.)
10326         fi
10328         if test -z $LIBBASE_JAR; then
10329             if test -f /usr/share/java/libbase-1.0.0.jar; then
10330                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10331             elif test -f /usr/share/java/libbase.jar; then
10332                 LIBBASE_JAR=/usr/share/java/libbase.jar
10333             else
10334                 AC_MSG_ERROR(libbase.jar replacement not found.)
10335             fi
10336         elif ! test -f $LIBBASE_JAR; then
10337             AC_MSG_ERROR(libbase.jar not found.)
10338         fi
10340     else
10341         AC_MSG_RESULT([internal])
10342         SYSTEM_JFREEREPORT=
10343         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10344     fi
10345 else
10346     AC_MSG_RESULT([no])
10347     ENABLE_REPORTBUILDER=
10348     SYSTEM_JFREEREPORT=
10350 AC_SUBST(ENABLE_REPORTBUILDER)
10351 AC_SUBST(SYSTEM_JFREEREPORT)
10352 AC_SUBST(SAC_JAR)
10353 AC_SUBST(LIBXML_JAR)
10354 AC_SUBST(FLUTE_JAR)
10355 AC_SUBST(JFREEREPORT_JAR)
10356 AC_SUBST(LIBBASE_JAR)
10357 AC_SUBST(LIBLAYOUT_JAR)
10358 AC_SUBST(LIBLOADER_JAR)
10359 AC_SUBST(LIBFORMULA_JAR)
10360 AC_SUBST(LIBREPOSITORY_JAR)
10361 AC_SUBST(LIBFONTS_JAR)
10362 AC_SUBST(LIBSERIALIZER_JAR)
10364 # this has to be here because both the Wiki Publisher and the SRB use
10365 # commons-logging
10366 COMMONS_LOGGING_VERSION=1.2
10367 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10368     AC_MSG_CHECKING([which Apache commons-* libs to use])
10369     if test "$with_system_apache_commons" = "yes"; then
10370         SYSTEM_APACHE_COMMONS=TRUE
10371         AC_MSG_RESULT([external])
10372         if test -z $COMMONS_LOGGING_JAR; then
10373             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10374                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10375            elif test -f /usr/share/java/commons-logging.jar; then
10376                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
10377             else
10378                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
10379             fi
10380         elif ! test -f $COMMONS_LOGGING_JAR; then
10381             AC_MSG_ERROR(commons-logging.jar not found.)
10382         fi
10383     else
10384         AC_MSG_RESULT([internal])
10385         SYSTEM_APACHE_COMMONS=
10386         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
10387     fi
10389 AC_SUBST(SYSTEM_APACHE_COMMONS)
10390 AC_SUBST(COMMONS_LOGGING_JAR)
10391 AC_SUBST(COMMONS_LOGGING_VERSION)
10393 # scripting provider for BeanShell?
10394 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10395 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10396     AC_MSG_RESULT([yes])
10397     ENABLE_SCRIPTING_BEANSHELL=TRUE
10399     dnl ===================================================================
10400     dnl Check for system beanshell
10401     dnl ===================================================================
10402     AC_MSG_CHECKING([which beanshell to use])
10403     if test "$with_system_beanshell" = "yes"; then
10404         AC_MSG_RESULT([external])
10405         SYSTEM_BSH=TRUE
10406         if test -z $BSH_JAR; then
10407             BSH_JAR=/usr/share/java/bsh.jar
10408         fi
10409         if ! test -f $BSH_JAR; then
10410             AC_MSG_ERROR(bsh.jar not found.)
10411         fi
10412     else
10413         AC_MSG_RESULT([internal])
10414         SYSTEM_BSH=
10415         BUILD_TYPE="$BUILD_TYPE BSH"
10416     fi
10417 else
10418     AC_MSG_RESULT([no])
10419     ENABLE_SCRIPTING_BEANSHELL=
10420     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10422 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10423 AC_SUBST(SYSTEM_BSH)
10424 AC_SUBST(BSH_JAR)
10426 # scripting provider for JavaScript?
10427 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10428 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10429     AC_MSG_RESULT([yes])
10430     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10432     dnl ===================================================================
10433     dnl Check for system rhino
10434     dnl ===================================================================
10435     AC_MSG_CHECKING([which rhino to use])
10436     if test "$with_system_rhino" = "yes"; then
10437         AC_MSG_RESULT([external])
10438         SYSTEM_RHINO=TRUE
10439         if test -z $RHINO_JAR; then
10440             RHINO_JAR=/usr/share/java/js.jar
10441         fi
10442         if ! test -f $RHINO_JAR; then
10443             AC_MSG_ERROR(js.jar not found.)
10444         fi
10445     else
10446         AC_MSG_RESULT([internal])
10447         SYSTEM_RHINO=
10448         BUILD_TYPE="$BUILD_TYPE RHINO"
10449     fi
10450 else
10451     AC_MSG_RESULT([no])
10452     ENABLE_SCRIPTING_JAVASCRIPT=
10453     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10455 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10456 AC_SUBST(SYSTEM_RHINO)
10457 AC_SUBST(RHINO_JAR)
10459 # This is only used in KDE3/KDE4 checks to determine if /usr/lib64
10460 # paths should be added to library search path. So lets put all 64-bit
10461 # platforms there.
10462 supports_multilib=
10463 case "$host_cpu" in
10464 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
10465     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10466         supports_multilib="yes"
10467     fi
10468     ;;
10470     ;;
10471 esac
10473 dnl ===================================================================
10474 dnl KDE4 Integration
10475 dnl ===================================================================
10477 KDE4_CFLAGS=""
10478 KDE4_LIBS=""
10479 QMAKE4="qmake"
10480 MOC4="moc"
10481 KDE4_GLIB_CFLAGS=""
10482 KDE4_GLIB_LIBS=""
10483 KDE4_HAVE_GLIB=""
10484 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
10485     qt4_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
10486     qt4_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
10488     kde4_incdirs="/usr/include /usr/include/kde4 $x_includes"
10489     kde4_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
10491     if test -n "$supports_multilib"; then
10492         qt4_libdirs="$qt4_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
10493         kde4_libdirs="$kde4_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
10494     fi
10496     if test -n "$QTDIR"; then
10497         qt4_incdirs="$QTDIR/include $qt4_incdirs"
10498         if test -z "$supports_multilib"; then
10499             qt4_libdirs="$QTDIR/lib $qt4_libdirs"
10500         else
10501             qt4_libdirs="$QTDIR/lib64 $QTDIR/lib $qt4_libdirs"
10502         fi
10503     fi
10504     if test -n "$QT4DIR"; then
10505         qt4_incdirs="$QT4DIR/include $qt4_incdirs"
10506         if test -z "$supports_multilib"; then
10507             qt4_libdirs="$QT4DIR/lib $qt4_libdirs"
10508         else
10509             qt4_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt4_libdirs"
10510         fi
10511     fi
10513     if test -n "$KDEDIR"; then
10514         kde4_incdirs="$KDEDIR/include $kde4_incdirs"
10515         if test -z "$supports_multilib"; then
10516             kde4_libdirs="$KDEDIR/lib $kde4_libdirs"
10517         else
10518             kde4_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde4_libdirs"
10519         fi
10520     fi
10521     if test -n "$KDE4DIR"; then
10522         kde4_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde4_incdirs"
10523         if test -z "$supports_multilib"; then
10524             kde4_libdirs="$KDE4DIR/lib $kde4_libdirs"
10525         else
10526             kde4_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde4_libdirs"
10527         fi
10528     fi
10530     qt4_test_include="Qt/qobject.h"
10531     qt4_test_library="libQtNetwork.so"
10532     kde4_test_include="kwindowsystem.h"
10533     kde4_test_library="libsolid.so"
10535     AC_MSG_CHECKING([for Qt4 headers])
10536     qt4_header_dir="no"
10537     for inc_dir in $qt4_incdirs; do
10538         if test -r "$inc_dir/$qt4_test_include"; then
10539             qt4_header_dir="$inc_dir"
10540             break
10541         fi
10542     done
10544     AC_MSG_RESULT([$qt4_header_dir])
10545     if test "x$qt4_header_dir" = "xno"; then
10546         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10547     fi
10549     dnl Check for qmake
10550     AC_PATH_PROGS( QMAKE4, [qmake-qt4 qmake], no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
10551     if test "$QMAKE4" = "no"; then
10552         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10553     else
10554         qmake4_test_ver="`$QMAKE4 -v 2>&1 | sed -n -e '/^Using Qt version 4\./p'`"
10555         if test -z "$qmake4_test_ver"; then
10556             AC_MSG_ERROR([Wrong qmake for Qt4 found. Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
10557         fi
10558     fi
10560     qt4_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt4_libdirs"
10561     AC_MSG_CHECKING([for Qt4 libraries])
10562     qt4_lib_dir="no"
10563     for lib_dir in $qt4_libdirs; do
10564         if test -r "$lib_dir/$qt4_test_library"; then
10565             qt4_lib_dir="$lib_dir"
10566             PKG_CONFIG_PATH="$qt4_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
10567             break
10568         fi
10569     done
10571     AC_MSG_RESULT([$qt4_lib_dir])
10573     if test "x$qt4_lib_dir" = "xno"; then
10574         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10575     fi
10577     dnl Check for Meta Object Compiler
10579     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10580     MOC4="$MOCQT4"
10581     if test "$MOC4" = "no"; then
10582         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10583         if test "$MOC4" = "no"; then
10584             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10585 the root of your Qt installation by exporting QT4DIR before running "configure".])
10586         fi
10587     fi
10589     dnl Check for KDE4 headers
10590     AC_MSG_CHECKING([for KDE4 headers])
10591     kde4_incdir="no"
10592     for kde4_check in $kde4_incdirs; do
10593         if test -r "$kde4_check/$kde4_test_include"; then
10594             kde4_incdir="$kde4_check"
10595             break
10596         fi
10597     done
10598     AC_MSG_RESULT([$kde4_incdir])
10599     if test "x$kde4_incdir" = "xno"; then
10600         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10601     fi
10602     if test "$kde4_incdir" = "/usr/include"; then kde4_incdir=; fi
10604     dnl Check for KDE4 libraries
10605     AC_MSG_CHECKING([for KDE4 libraries])
10606     kde4_libdir="no"
10607     for kde4_check in $kde4_libdirs; do
10608         if test -r "$kde4_check/$kde4_test_library"; then
10609             kde4_libdir="$kde4_check"
10610             break
10611         fi
10612     done
10614     AC_MSG_RESULT([$kde4_libdir])
10615     if test "x$kde4_libdir" = "xno"; then
10616         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10617     fi
10619     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
10620     if ! test -z "$kde4_incdir"; then
10621         KDE4_CFLAGS="-I$kde4_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10622     else
10623         KDE4_CFLAGS="$QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10624     fi
10626     KDE4_LIBS="-L$kde4_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt4_lib_dir $QT4_LIBS"
10627     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10628     FilterLibs "$KDE4_LIBS"
10629     KDE4_LIBS="$filteredlibs"
10631     AC_LANG_PUSH([C++])
10632     save_CXXFLAGS=$CXXFLAGS
10633     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10634     AC_MSG_CHECKING([whether KDE is >= 4.2])
10635        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10636 #include <kdeversion.h>
10638 int main(int argc, char **argv) {
10639        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
10640        else return 1;
10642 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[AC_MSG_ERROR([KDE support not tested with cross-compilation])])
10643     CXXFLAGS=$save_CXXFLAGS
10644     AC_LANG_POP([C++])
10646     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
10647     # Sets also KDE4_GLIB_CFLAGS/KDE4_GLIB_LIBS if successful.
10648     PKG_CHECK_MODULES(KDE4_GLIB,[glib-2.0 >= 2.4],
10649         [
10650             KDE4_HAVE_GLIB=TRUE
10651             AC_DEFINE(KDE4_HAVE_GLIB,1)
10652             KDE4_GLIB_CFLAGS=$(printf '%s' "$KDE4_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10653             FilterLibs "${KDE4_GLIB_LIBS}"
10654             KDE4_GLIB_LIBS="${filteredlibs}"
10656             qt4_fix_warning=
10658             AC_LANG_PUSH([C++])
10659             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
10660             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
10661             #  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
10662             #               ^~~~~~~~~~~~~~~~~~~~~~~
10663             #               vptr for 'QObjectPrivate'
10664             save_CXX=$CXX
10665             CXX=$(printf %s "$CXX" \
10666                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
10667             save_CXXFLAGS=$CXXFLAGS
10668             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10669             save_LIBS=$LIBS
10670             LIBS="$LIBS $KDE4_LIBS"
10671             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
10673             # Prepare meta object data
10674             TSTBASE="tst_exclude_socket_notifiers"
10675             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
10676             ln -fs "${TSTMOC}.hxx"
10677             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10679             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10680 #include <cstdlib>
10681 #include "tst_exclude_socket_notifiers.moc"
10683 int main(int argc, char *argv[])
10685     QCoreApplication app(argc, argv);
10686     exit(tst_processEventsExcludeSocket());
10687     return 0;
10689             ]])],[
10690                 AC_MSG_RESULT([yes])
10691             ],[
10692                 AC_MSG_RESULT([no])
10693                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
10694                 if test -z "$qt4_fix_warning"; then
10695                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
10696                 fi
10697                 qt4_fix_warning=1
10698                 add_warning "  https://bugreports.qt.io/browse/QTBUG-37380 (needed)"
10699                 ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
10701             # Remove meta object data
10702             rm -f "${TSTBASE}."*
10704             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
10706             # Prepare meta object data
10707             TSTBASE="tst_exclude_posted_events"
10708             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
10709             ln -fs "${TSTMOC}.hxx"
10710             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10712             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10713 #include <cstdlib>
10714 #include "tst_exclude_posted_events.moc"
10716 int main(int argc, char *argv[])
10718     QCoreApplication app(argc, argv);
10719     exit(tst_excludePostedEvents());
10720     return 0;
10722             ]])],[
10723                 AC_MSG_RESULT([yes])
10724             ],[
10725                 AC_MSG_RESULT([no])
10726                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
10727                 if test -z "$qt4_fix_warning"; then
10728                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
10729                 fi
10730                 qt4_fix_warning=1
10731                 add_warning "  https://bugreports.qt.io/browse/QTBUG-34614 (needed)"
10732             ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
10734             # Remove meta object data
10735             rm -f "${TSTBASE}."*
10737             if test -n "$qt4_fix_warning"; then
10738                 add_warning "  https://bugreports.qt.io/browse/QTBUG-38585 (recommended)"
10739             fi
10741             LIBS=$save_LIBS
10742             CXXFLAGS=$save_CXXFLAGS
10743             CXX=$save_CXX
10744             AC_LANG_POP([C++])
10745         ],
10746         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
10748 AC_SUBST(KDE4_CFLAGS)
10749 AC_SUBST(KDE4_LIBS)
10750 AC_SUBST(MOC4)
10751 AC_SUBST(KDE4_GLIB_CFLAGS)
10752 AC_SUBST(KDE4_GLIB_LIBS)
10753 AC_SUBST(KDE4_HAVE_GLIB)
10755 dnl ===================================================================
10756 dnl QT5 Integration
10757 dnl ===================================================================
10759 QT5_CFLAGS=""
10760 QT5_LIBS=""
10761 QMAKE5="qmake"
10762 MOC5="moc"
10763 QT5_GLIB_CFLAGS=""
10764 QT5_GLIB_LIBS=""
10765 QT5_HAVE_GLIB=""
10766 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
10767         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \)
10768 then
10769     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
10770     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
10772     if test -n "$supports_multilib"; then
10773         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
10774     fi
10776     qt5_test_include="QtWidgets/qapplication.h"
10777     qt5_test_library="libQt5Widgets.so"
10779     dnl Check for qmake5
10780     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
10781     if test "$QMAKE5" = "no"; then
10782         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
10783     else
10784         qmake5_test_ver="`$QMAKE5 -v 2>&1 | sed -n -e '/^Using Qt version 5\./p'`"
10785         if test -z "$qmake5_test_ver"; then
10786             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
10787         fi
10788     fi
10790     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
10791     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
10793     AC_MSG_CHECKING([for Qt5 headers])
10794     qt5_incdir="no"
10795     for inc_dir in $qt5_incdirs; do
10796         if test -r "$inc_dir/$qt5_test_include"; then
10797             qt5_incdir="$inc_dir"
10798             break
10799         fi
10800     done
10801     AC_MSG_RESULT([$qt5_incdir])
10802     if test "x$qt5_incdir" = "xno"; then
10803         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
10804     fi
10806     AC_MSG_CHECKING([for Qt5 libraries])
10807     qt5_libdir="no"
10808     for lib_dir in $qt5_libdirs; do
10809         if test -r "$lib_dir/$qt5_test_library"; then
10810             qt5_libdir="$lib_dir"
10811             break
10812         fi
10813     done
10814     AC_MSG_RESULT([$qt5_libdir])
10815     if test "x$qt5_libdir" = "xno"; then
10816         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
10817     fi
10819     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10820     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
10822     dnl Check for Meta Object Compiler
10824     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
10825     if test "$MOC5" = "no"; then
10826         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10827 the root of your Qt installation by exporting QT5DIR before running "configure".])
10828     fi
10830     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
10831     # Sets also QT5_GLIB_CFLAGS/QT5_GLIB_LIBS if successful.
10832     PKG_CHECK_MODULES(QT5_GLIB,[glib-2.0 >= 2.4],
10833         [
10834             QT5_HAVE_GLIB=1
10835             AC_DEFINE(QT5_HAVE_GLIB,1)
10836         ],
10837         AC_MSG_WARN([[No Glib found, Qt5 support will not use native file pickers!]])
10838     )
10840 AC_SUBST(QT5_CFLAGS)
10841 AC_SUBST(QT5_LIBS)
10842 AC_SUBST(MOC5)
10843 AC_SUBST(QT5_GLIB_CFLAGS)
10844 AC_SUBST(QT5_GLIB_LIBS)
10845 AC_SUBST(QT5_HAVE_GLIB)
10847 dnl ===================================================================
10848 dnl KDE5 Integration
10849 dnl ===================================================================
10851 KF5_CFLAGS=""
10852 KF5_LIBS=""
10853 KF5_CONFIG="kf5-config"
10854 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
10855         \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \)
10856 then
10857     kf5_incdirs="$KF5INC /usr/include /usr/include/KF5 $x_includes"
10858     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $x_libraries"
10859     if test -n "$supports_multilib"; then
10860         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
10861     fi
10863     kf5_test_include="kcoreaddons_version.h"
10864     kf5_test_library="libKF5CoreAddons.so"
10865     kf5_libdirs="$qt5_libdir $kf5_libdirs"
10867     dnl kf5 KDE4 support compatibility installed
10868     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
10869     if test "$KF5_CONFIG" != "no"; then
10870         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
10871         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
10872     fi
10874     dnl Check for KF5 headers
10875     AC_MSG_CHECKING([for KF5 headers])
10876     kf5_incdir="no"
10877     for kf5_check in $kf5_incdirs; do
10878         if test -r "$kf5_check/$kf5_test_include"; then
10879             kf5_incdir="$kf5_check"
10880             break
10881         fi
10882     done
10883     AC_MSG_RESULT([$kf5_incdir])
10884     if test "x$kf5_incdir" = "xno"; then
10885         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
10886     fi
10888     dnl Check for KF5 libraries
10889     AC_MSG_CHECKING([for KF5 libraries])
10890     kf5_libdir="no"
10891     for kf5_check in $kf5_libdirs; do
10892         if test -r "$kf5_check/$kf5_test_library"; then
10893             kf5_libdir="$kf5_check"
10894             break
10895         fi
10896     done
10898     AC_MSG_RESULT([$kf5_libdir])
10899     if test "x$kf5_libdir" = "xno"; then
10900         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
10901     fi
10903     PKG_CHECK_MODULES(KF5_XCB,[xcb],,[AC_MSG_ERROR([XCB not installed])])
10905     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$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"
10906     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network -lQt5X11Extras $KF5_XCB_LIBS"
10907     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10909     AC_LANG_PUSH([C++])
10910     save_CXXFLAGS=$CXXFLAGS
10911     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
10912     AC_MSG_CHECKING([whether KDE is >= 5.0])
10913        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10914 #include <kcoreaddons_version.h>
10916 int main(int argc, char **argv) {
10917        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
10918        else return 1;
10920        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
10921     CXXFLAGS=$save_CXXFLAGS
10922     AC_LANG_POP([C++])
10924 AC_SUBST(KF5_CFLAGS)
10925 AC_SUBST(KF5_LIBS)
10927 dnl ===================================================================
10928 dnl Test whether to include Evolution 2 support
10929 dnl ===================================================================
10930 AC_MSG_CHECKING([whether to enable evolution 2 support])
10931 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
10932     AC_MSG_RESULT([yes])
10933     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
10934     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10935     FilterLibs "${GOBJECT_LIBS}"
10936     GOBJECT_LIBS="${filteredlibs}"
10937     ENABLE_EVOAB2="TRUE"
10938 else
10939     ENABLE_EVOAB2=""
10940     AC_MSG_RESULT([no])
10942 AC_SUBST(ENABLE_EVOAB2)
10943 AC_SUBST(GOBJECT_CFLAGS)
10944 AC_SUBST(GOBJECT_LIBS)
10946 dnl ===================================================================
10947 dnl Test which themes to include
10948 dnl ===================================================================
10949 AC_MSG_CHECKING([which themes to include])
10950 # if none given use default subset of available themes
10951 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
10952     with_theme="breeze breeze_dark elementary galaxy hicontrast sifr sifr_dark tango"
10953     # test -z "$ENABLE_RELEASE_BUILD" && with_theme="$with_theme tango_testing"
10956 WITH_THEMES=""
10957 if test "x$with_theme" != "xno"; then
10958     for theme in $with_theme; do
10959         case $theme in
10960         breeze|breeze_dark|crystal|elementary|galaxy|hicontrast|oxygen|sifr|sifr_dark|tango|tango_testing) real_theme="$theme" ;;
10961         default) real_theme=galaxy ;;
10962         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
10963         esac
10964         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
10965     done
10967 AC_MSG_RESULT([$WITH_THEMES])
10968 AC_SUBST([WITH_THEMES])
10969 # FIXME: remove this, and the convenience default->galaxy remapping after a crace period
10970 for theme in $with_theme; do
10971     case $theme in
10972     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=galaxy]) ;;
10973     *) ;;
10974     esac
10975 done
10977 dnl ===================================================================
10978 dnl Test whether to integrate helppacks into the product's installer
10979 dnl ===================================================================
10980 AC_MSG_CHECKING([for helppack integration])
10981 if test "$with_helppack_integration" = "no"; then
10982     WITH_HELPPACK_INTEGRATION=
10983     AC_MSG_RESULT([no integration])
10984 else
10985     WITH_HELPPACK_INTEGRATION=TRUE
10986     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
10987     AC_MSG_RESULT([integration])
10989 AC_SUBST(WITH_HELPPACK_INTEGRATION)
10991 ###############################################################################
10992 # Extensions checking
10993 ###############################################################################
10994 AC_MSG_CHECKING([for extensions integration])
10995 if test "x$enable_extension_integration" != "xno"; then
10996     WITH_EXTENSION_INTEGRATION=TRUE
10997     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
10998     AC_MSG_RESULT([yes, use integration])
10999 else
11000     WITH_EXTENSION_INTEGRATION=
11001     AC_MSG_RESULT([no, do not integrate])
11003 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11005 dnl Should any extra extensions be included?
11006 dnl There are standalone tests for each of these below.
11007 WITH_EXTRA_EXTENSIONS=
11008 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11010 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11011 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11012 if test "x$with_java" != "xno"; then
11013     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11014     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11017 TEST_FONTS_MISSING=0
11019 # $1  = font family
11020 # $2+ = accepted font mappings
11021 test_font_map()
11023     FONT="$1" ; shift
11024     AC_MSG_CHECKING([font mapping for '$FONT'])
11025     FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
11026     FONTFILE_LOWER="$(echo $FONTFILE | $AWK '{print tolower($0)}')"
11028     TESTEXPR="'${FONTFILE_LOWER}' = '$(echo $FONT | $AWK '{print tolower($0)}').ttf'"
11029     while test "$#" -ge 1 ; do
11030         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
11031         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
11032     done
11033     if test $TESTEXPR
11034     then
11035         AC_MSG_RESULT([ok])
11036     else
11037         AC_MSG_WARN([unknown ($FONTFILE)])
11038         add_warning "unknown ($FONTFILE)"
11039         TEST_FONTS_MISSING=1
11040     fi
11043 dnl ===================================================================
11044 dnl Test whether to include fonts
11045 dnl ===================================================================
11046 AC_MSG_CHECKING([whether to include third-party fonts])
11047 if test "$with_fonts" != "no"; then
11048     AC_MSG_RESULT([yes])
11049     WITH_FONTS=TRUE
11050     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11051     AC_DEFINE(HAVE_MORE_FONTS)
11052 else
11053     AC_MSG_RESULT([no])
11054     WITH_FONTS=
11055     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11056     if test "$test_fontconfig" = "yes"; then
11057         AC_PATH_PROG([FCMATCH], [fc-match])
11058         if test -z "$FCMATCH"; then
11059             AC_MSG_WARN([Unable to query installed fonts - unit tests disabled.])
11060             TEST_FONTS_MISSING=1
11061         else
11062             test_font_map 'Calibri' 'Carlito'
11063             test_font_map 'DejaVuSans' 'DejaVuSans'
11064             if test ${TEST_FONTS_MISSING} -eq 1
11065             then
11066                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
11067                 add_warning "Unknown font mappings - unit tests disabled."
11068             fi
11069         fi
11070     else
11071         TEST_FONTS_MISSING=1
11072     fi
11074 AC_SUBST(WITH_FONTS)
11075 AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
11078 dnl ===================================================================
11079 dnl Test whether to enable online update service
11080 dnl ===================================================================
11081 AC_MSG_CHECKING([whether to enable online update])
11082 ENABLE_ONLINE_UPDATE=
11083 ENABLE_ONLINE_UPDATE_MAR=
11084 UPDATE_CONFIG=
11085 if test "$enable_online_update" = ""; then
11086     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11087         AC_MSG_RESULT([yes])
11088         ENABLE_ONLINE_UPDATE="TRUE"
11089     else
11090         AC_MSG_RESULT([no])
11091     fi
11092 else
11093     if test "$enable_online_update" = "mar"; then
11094         AC_MSG_RESULT([yes - MAR-based online update])
11095         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11096         if test "$with_update_config" = ""; then
11097             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11098         fi
11099         UPDATE_CONFIG="$with_update_config"
11100         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11101     elif test "$enable_online_update" = "yes"; then
11102         AC_MSG_RESULT([yes])
11103         ENABLE_ONLINE_UPDATE="TRUE"
11104     else
11105         AC_MSG_RESULT([no])
11106     fi
11108 AC_SUBST(ENABLE_ONLINE_UPDATE)
11109 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11110 AC_SUBST(UPDATE_CONFIG)
11112 dnl ===================================================================
11113 dnl Test whether we need bzip2
11114 dnl ===================================================================
11115 SYSTEM_BZIP2=
11116 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11117     AC_MSG_CHECKING([whether to use system bzip2])
11118     if test "$with_system_bzip2" = yes; then
11119         SYSTEM_BZIP2=TRUE
11120         AC_MSG_RESULT([yes])
11121         PKG_CHECK_MODULES(BZIP2, bzip2)
11122         FilterLibs "${BZIP2_LIBS}"
11123         BZIP2_LIBS="${filteredlibs}"
11124     else
11125         AC_MSG_RESULT([no])
11126         BUILD_TYPE="$BUILD_TYPE BZIP2"
11127     fi
11129 AC_SUBST(SYSTEM_BZIP2)
11130 AC_SUBST(BZIP2_CFLAGS)
11131 AC_SUBST(BZIP2_LIBS)
11133 dnl ===================================================================
11134 dnl Test whether to enable extension update
11135 dnl ===================================================================
11136 AC_MSG_CHECKING([whether to enable extension update])
11137 ENABLE_EXTENSION_UPDATE=
11138 if test "x$enable_extension_update" = "xno"; then
11139     AC_MSG_RESULT([no])
11140 else
11141     AC_MSG_RESULT([yes])
11142     ENABLE_EXTENSION_UPDATE="TRUE"
11143     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11144     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11146 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11149 dnl ===================================================================
11150 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11151 dnl ===================================================================
11152 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11153 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11154     AC_MSG_RESULT([no])
11155     ENABLE_SILENT_MSI=
11156 else
11157     AC_MSG_RESULT([yes])
11158     ENABLE_SILENT_MSI=TRUE
11159     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11161 AC_SUBST(ENABLE_SILENT_MSI)
11163 AC_MSG_CHECKING([whether and how to use Xinerama])
11164 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11165     if test "$x_libraries" = "default_x_libraries"; then
11166         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11167         if test "x$XINERAMALIB" = x; then
11168            XINERAMALIB="/usr/lib"
11169         fi
11170     else
11171         XINERAMALIB="$x_libraries"
11172     fi
11173     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11174         # we have both versions, let the user decide but use the dynamic one
11175         # per default
11176         USE_XINERAMA=TRUE
11177         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11178             XINERAMA_LINK=dynamic
11179         else
11180             XINERAMA_LINK=static
11181         fi
11182     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11183         # we have only the dynamic version
11184         USE_XINERAMA=TRUE
11185         XINERAMA_LINK=dynamic
11186     elif test -e "$XINERAMALIB/libXinerama.a"; then
11187         # static version
11188         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11189             USE_XINERAMA=TRUE
11190             XINERAMA_LINK=static
11191         else
11192             USE_XINERAMA=
11193             XINERAMA_LINK=none
11194         fi
11195     else
11196         # no Xinerama
11197         USE_XINERAMA=
11198         XINERAMA_LINK=none
11199     fi
11200     if test "$USE_XINERAMA" = "TRUE"; then
11201         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11202         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11203             [AC_MSG_ERROR(Xinerama header not found.)], [])
11204         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11205         if test "x$XEXTLIB" = x; then
11206            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11207         fi
11208         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11209         if test "$_os" = "FreeBSD"; then
11210             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11211         fi
11212         if test "$_os" = "Linux"; then
11213             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11214         fi
11215         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11216             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11217     else
11218         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11219     fi
11220 else
11221     USE_XINERAMA=
11222     XINERAMA_LINK=none
11223     AC_MSG_RESULT([no])
11225 AC_SUBST(USE_XINERAMA)
11226 AC_SUBST(XINERAMA_LINK)
11228 dnl ===================================================================
11229 dnl Test whether to build cairo or rely on the system version
11230 dnl ===================================================================
11232 if test "$USING_X11" = TRUE; then
11233     # Used in vcl/Library_vclplug_gen.mk
11234     test_cairo=yes
11237 if test "$test_cairo" = "yes"; then
11238     AC_MSG_CHECKING([whether to use the system cairo])
11240     : ${with_system_cairo:=$with_system_libs}
11241     if test "$with_system_cairo" = "yes"; then
11242         SYSTEM_CAIRO=TRUE
11243         AC_MSG_RESULT([yes])
11245         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11246         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11247         FilterLibs "${CAIRO_LIBS}"
11248         CAIRO_LIBS="${filteredlibs}"
11250         if test "$test_xrender" = "yes"; then
11251             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11252             AC_LANG_PUSH([C])
11253             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11254 #ifdef PictStandardA8
11255 #else
11256       return fail;
11257 #endif
11258 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11260             AC_LANG_POP([C])
11261         fi
11262     else
11263         SYSTEM_CAIRO=
11264         AC_MSG_RESULT([no])
11266         BUILD_TYPE="$BUILD_TYPE CAIRO"
11267     fi
11270 AC_SUBST(SYSTEM_CAIRO)
11271 AC_SUBST(CAIRO_CFLAGS)
11272 AC_SUBST(CAIRO_LIBS)
11274 dnl ===================================================================
11275 dnl Test whether to use avahi
11276 dnl ===================================================================
11277 if test "$_os" = "WINNT"; then
11278     # Windows uses bundled mDNSResponder
11279     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11280 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11281     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11282                       [ENABLE_AVAHI="TRUE"])
11283     AC_DEFINE(HAVE_FEATURE_AVAHI)
11284     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11285     FilterLibs "${AVAHI_LIBS}"
11286     AVAHI_LIBS="${filteredlibs}"
11289 AC_SUBST(ENABLE_AVAHI)
11290 AC_SUBST(AVAHI_CFLAGS)
11291 AC_SUBST(AVAHI_LIBS)
11293 dnl ===================================================================
11294 dnl Test whether to use liblangtag
11295 dnl ===================================================================
11296 SYSTEM_LIBLANGTAG=
11297 AC_MSG_CHECKING([whether to use system liblangtag])
11298 if test "$with_system_liblangtag" = yes; then
11299     SYSTEM_LIBLANGTAG=TRUE
11300     AC_MSG_RESULT([yes])
11301     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11302     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11303     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11304     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11305     FilterLibs "${LIBLANGTAG_LIBS}"
11306     LIBLANGTAG_LIBS="${filteredlibs}"
11307 else
11308     SYSTEM_LIBLANGTAG=
11309     AC_MSG_RESULT([no])
11310     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11311     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11312     if test "$COM" = "MSC"; then
11313         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11314     else
11315         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11316     fi
11318 AC_SUBST(SYSTEM_LIBLANGTAG)
11319 AC_SUBST(LIBLANGTAG_CFLAGS)
11320 AC_SUBST(LIBLANGTAG_LIBS)
11322 dnl ===================================================================
11323 dnl Test whether to build libpng or rely on the system version
11324 dnl ===================================================================
11326 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11328 dnl ===================================================================
11329 dnl Check for runtime JVM search path
11330 dnl ===================================================================
11331 if test "$ENABLE_JAVA" != ""; then
11332     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11333     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11334         AC_MSG_RESULT([yes])
11335         if ! test -d "$with_jvm_path"; then
11336             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11337         fi
11338         if ! test -d "$with_jvm_path"jvm; then
11339             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11340         fi
11341         JVM_ONE_PATH_CHECK="$with_jvm_path"
11342         AC_SUBST(JVM_ONE_PATH_CHECK)
11343     else
11344         AC_MSG_RESULT([no])
11345     fi
11348 dnl ===================================================================
11349 dnl Test for the presence of Ant and that it works
11350 dnl ===================================================================
11352 if test "$ENABLE_JAVA" != ""; then
11353     ANT_HOME=; export ANT_HOME
11354     WITH_ANT_HOME=; export WITH_ANT_HOME
11355     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11356         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11357             if test "$_os" = "WINNT"; then
11358                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11359             else
11360                 with_ant_home="$LODE_HOME/opt/ant"
11361             fi
11362         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11363             with_ant_home="$LODE_HOME/opt/ant"
11364         fi
11365     fi
11366     if test -z "$with_ant_home"; then
11367         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11368     else
11369         if test "$_os" = "WINNT"; then
11370             # AC_PATH_PROGS needs unix path
11371             with_ant_home=`cygpath -u "$with_ant_home"`
11372         fi
11373         AbsolutePath "$with_ant_home"
11374         with_ant_home=$absolute_path
11375         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11376         WITH_ANT_HOME=$with_ant_home
11377         ANT_HOME=$with_ant_home
11378     fi
11380     if test -z "$ANT"; then
11381         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11382     else
11383         # resolve relative or absolute symlink
11384         while test -h "$ANT"; do
11385             a_cwd=`pwd`
11386             a_basename=`basename "$ANT"`
11387             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11388             cd "`dirname "$ANT"`"
11389             cd "`dirname "$a_script"`"
11390             ANT="`pwd`"/"`basename "$a_script"`"
11391             cd "$a_cwd"
11392         done
11394         AC_MSG_CHECKING([if $ANT works])
11395         cat > conftest.java << EOF
11396         public class conftest {
11397             int testmethod(int a, int b) {
11398                     return a + b;
11399             }
11400         }
11403         cat > conftest.xml << EOF
11404         <project name="conftest" default="conftest">
11405         <target name="conftest">
11406             <javac srcdir="." includes="conftest.java">
11407             </javac>
11408         </target>
11409         </project>
11412         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11413         if test $? = 0 -a -f ./conftest.class; then
11414             AC_MSG_RESULT([Ant works])
11415             if test -z "$WITH_ANT_HOME"; then
11416                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11417                 if test -z "$ANT_HOME"; then
11418                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11419                 fi
11420             else
11421                 ANT_HOME="$WITH_ANT_HOME"
11422             fi
11423         else
11424             echo "configure: Ant test failed" >&5
11425             cat conftest.java >&5
11426             cat conftest.xml >&5
11427             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11428         fi
11429         rm -f conftest* core core.* *.core
11430     fi
11431     if test -z "$ANT_HOME"; then
11432         ANT_HOME="NO_ANT_HOME"
11433     else
11434         PathFormat "$ANT_HOME"
11435         ANT_HOME="$formatted_path"
11436         PathFormat "$ANT"
11437         ANT="$formatted_path"
11438     fi
11439     AC_SUBST(ANT_HOME)
11440     AC_SUBST(ANT)
11442     dnl Checking for ant.jar
11443     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11444         AC_MSG_CHECKING([Ant lib directory])
11445         if test -f $ANT_HOME/lib/ant.jar; then
11446             ANT_LIB="$ANT_HOME/lib"
11447         else
11448             if test -f $ANT_HOME/ant.jar; then
11449                 ANT_LIB="$ANT_HOME"
11450             else
11451                 if test -f /usr/share/java/ant.jar; then
11452                     ANT_LIB=/usr/share/java
11453                 else
11454                     if test -f /usr/share/ant-core/lib/ant.jar; then
11455                         ANT_LIB=/usr/share/ant-core/lib
11456                     else
11457                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11458                             ANT_LIB="$ANT_HOME/lib/ant"
11459                         else
11460                             if test -f /usr/share/lib/ant/ant.jar; then
11461                                 ANT_LIB=/usr/share/lib/ant
11462                             else
11463                                 AC_MSG_ERROR([Ant libraries not found!])
11464                             fi
11465                         fi
11466                     fi
11467                 fi
11468             fi
11469         fi
11470         PathFormat "$ANT_LIB"
11471         ANT_LIB="$formatted_path"
11472         AC_MSG_RESULT([Ant lib directory found.])
11473     fi
11474     AC_SUBST(ANT_LIB)
11476     ant_minver=1.6.0
11477     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11479     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11480     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11481     ant_version_major=`echo $ant_version | cut -d. -f1`
11482     ant_version_minor=`echo $ant_version | cut -d. -f2`
11483     echo "configure: ant_version $ant_version " >&5
11484     echo "configure: ant_version_major $ant_version_major " >&5
11485     echo "configure: ant_version_minor $ant_version_minor " >&5
11486     if test "$ant_version_major" -ge "2"; then
11487         AC_MSG_RESULT([yes, $ant_version])
11488     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11489         AC_MSG_RESULT([yes, $ant_version])
11490     else
11491         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11492     fi
11494     rm -f conftest* core core.* *.core
11497 OOO_JUNIT_JAR=
11498 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11499     AC_MSG_CHECKING([for JUnit 4])
11500     if test "$with_junit" = "yes"; then
11501         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
11502             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
11503         elif test -e /usr/share/java/junit4.jar; then
11504             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11505         else
11506            if test -e /usr/share/lib/java/junit.jar; then
11507               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11508            else
11509               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11510            fi
11511         fi
11512     else
11513         OOO_JUNIT_JAR=$with_junit
11514     fi
11515     if test "$_os" = "WINNT"; then
11516         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11517     fi
11518     printf 'import org.junit.Before;' > conftest.java
11519     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11520         AC_MSG_RESULT([$OOO_JUNIT_JAR])
11521     else
11522         AC_MSG_ERROR(
11523 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
11524  specify its pathname via --with-junit=..., or disable it via --without-junit])
11525     fi
11526     rm -f conftest.class conftest.java
11527     if test $OOO_JUNIT_JAR != ""; then
11528     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11529     fi
11531 AC_SUBST(OOO_JUNIT_JAR)
11533 HAMCREST_JAR=
11534 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11535     AC_MSG_CHECKING([for included Hamcrest])
11536     printf 'import org.hamcrest.BaseDescription;' > conftest.java
11537     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11538         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
11539     else
11540         AC_MSG_RESULT([Not included])
11541         AC_MSG_CHECKING([for standalone hamcrest jar.])
11542         if test "$with_hamcrest" = "yes"; then
11543             if test -e /usr/share/lib/java/hamcrest.jar; then
11544                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
11545             elif test -e /usr/share/java/hamcrest/core.jar; then
11546                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
11547             else
11548                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
11549             fi
11550         else
11551             HAMCREST_JAR=$with_hamcrest
11552         fi
11553         if test "$_os" = "WINNT"; then
11554             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
11555         fi
11556         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
11557             AC_MSG_RESULT([$HAMCREST_JAR])
11558         else
11559             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),
11560                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
11561         fi
11562     fi
11563     rm -f conftest.class conftest.java
11565 AC_SUBST(HAMCREST_JAR)
11568 AC_SUBST(SCPDEFS)
11571 # check for wget and curl
11573 WGET=
11574 CURL=
11576 if test "$enable_fetch_external" != "no"; then
11578 CURL=`which curl 2>/dev/null`
11580 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
11581     # wget new enough?
11582     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
11583     if test $? -eq 0; then
11584         WGET=$i
11585         break
11586     fi
11587 done
11589 if test -z "$WGET" -a -z "$CURL"; then
11590     AC_MSG_ERROR([neither wget nor curl found!])
11595 AC_SUBST(WGET)
11596 AC_SUBST(CURL)
11599 # check for sha256sum
11601 SHA256SUM=
11603 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
11604     eval "$i -a 256 --version" > /dev/null 2>&1
11605     ret=$?
11606     if test $ret -eq 0; then
11607         SHA256SUM="$i -a 256"
11608         break
11609     fi
11610 done
11612 if test -z "$SHA256SUM"; then
11613     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
11614         eval "$i --version" > /dev/null 2>&1
11615         ret=$?
11616         if test $ret -eq 0; then
11617             SHA256SUM=$i
11618             break
11619         fi
11620     done
11623 if test -z "$SHA256SUM"; then
11624     AC_MSG_ERROR([no sha256sum found!])
11627 AC_SUBST(SHA256SUM)
11629 dnl ===================================================================
11630 dnl Dealing with l10n options
11631 dnl ===================================================================
11632 AC_MSG_CHECKING([which languages to be built])
11633 # get list of all languages
11634 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
11635 # the sed command does the following:
11636 #   + if a line ends with a backslash, append the next line to it
11637 #   + adds " on the beginning of the value (after =)
11638 #   + adds " at the end of the value
11639 #   + removes en-US; we want to put it on the beginning
11640 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
11641 [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)]
11642 ALL_LANGS="en-US $completelangiso"
11643 # check the configured localizations
11644 WITH_LANG="$with_lang"
11645 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
11646     AC_MSG_RESULT([en-US])
11647 else
11648     AC_MSG_RESULT([$WITH_LANG])
11649     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
11650     if test -z "$MSGFMT"; then
11651         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
11652             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
11653         elif test -x "/opt/lo/bin/msgfmt"; then
11654             MSGFMT="/opt/lo/bin/msgfmt"
11655         else
11656             AC_CHECK_PROGS(MSGFMT, [msgfmt])
11657             if test -z "$MSGFMT"; then
11658                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
11659             fi
11660         fi
11661     fi
11662     if test -z "$MSGUNIQ"; then
11663         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
11664             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
11665         elif test -x "/opt/lo/bin/msguniq"; then
11666             MSGUNIQ="/opt/lo/bin/msguniq"
11667         else
11668             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
11669             if test -z "$MSGUNIQ"; then
11670                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
11671             fi
11672         fi
11673     fi
11675 AC_SUBST(MSGFMT)
11676 AC_SUBST(MSGUNIQ)
11677 # check that the list is valid
11678 for lang in $WITH_LANG; do
11679     test "$lang" = "ALL" && continue
11680     # need to check for the exact string, so add space before and after the list of all languages
11681     for vl in $ALL_LANGS; do
11682         if test "$vl" = "$lang"; then
11683            break
11684         fi
11685     done
11686     if test "$vl" != "$lang"; then
11687         # if you're reading this - you prolly quoted your languages remove the quotes ...
11688         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
11689     fi
11690 done
11691 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
11692     echo $WITH_LANG | grep -q en-US
11693     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
11695 # list with substituted ALL
11696 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
11697 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
11698 test "$WITH_LANG" = "en-US" && WITH_LANG=
11699 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
11700     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
11701     ALL_LANGS=`echo $ALL_LANGS qtz`
11703 AC_SUBST(ALL_LANGS)
11704 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
11705 AC_SUBST(WITH_LANG)
11706 AC_SUBST(WITH_LANG_LIST)
11707 AC_SUBST(GIT_NEEDED_SUBMODULES)
11709 WITH_POOR_HELP_LOCALIZATIONS=
11710 if test -d "$SRC_ROOT/translations/source"; then
11711     for l in `ls -1 $SRC_ROOT/translations/source`; do
11712         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
11713             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
11714         fi
11715     done
11717 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
11719 if test -n "$with_locales"; then
11720     WITH_LOCALES="$with_locales"
11722     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
11723     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
11724     # config_host/config_locales.h.in
11725     for locale in $WITH_LOCALES; do
11726         lang=${locale%_*}
11728         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
11730         case $lang in
11731         hi|mr*ne)
11732             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
11733             ;;
11734         bg|ru)
11735             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
11736             ;;
11737         esac
11738     done
11739 else
11740     AC_DEFINE(WITH_LOCALE_ALL)
11742 AC_SUBST(WITH_LOCALES)
11744 dnl git submodule update --reference
11745 dnl ===================================================================
11746 if test -n "${GIT_REFERENCE_SRC}"; then
11747     for repo in ${GIT_NEEDED_SUBMODULES}; do
11748         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
11749             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
11750         fi
11751     done
11753 AC_SUBST(GIT_REFERENCE_SRC)
11755 dnl git submodules linked dirs
11756 dnl ===================================================================
11757 if test -n "${GIT_LINK_SRC}"; then
11758     for repo in ${GIT_NEEDED_SUBMODULES}; do
11759         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
11760             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
11761         fi
11762     done
11764 AC_SUBST(GIT_LINK_SRC)
11766 dnl branding
11767 dnl ===================================================================
11768 AC_MSG_CHECKING([for alternative branding images directory])
11769 # initialize mapped arrays
11770 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
11771 brand_files="$BRAND_INTRO_IMAGES about.svg"
11773 if test -z "$with_branding" -o "$with_branding" = "no"; then
11774     AC_MSG_RESULT([none])
11775     DEFAULT_BRAND_IMAGES="$brand_files"
11776 else
11777     if ! test -d $with_branding ; then
11778         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
11779     else
11780         AC_MSG_RESULT([$with_branding])
11781         CUSTOM_BRAND_DIR="$with_branding"
11782         for lfile in $brand_files
11783         do
11784             if ! test -f $with_branding/$lfile ; then
11785                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
11786                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
11787             else
11788                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
11789             fi
11790         done
11791         check_for_progress="yes"
11792     fi
11794 AC_SUBST([BRAND_INTRO_IMAGES])
11795 AC_SUBST([CUSTOM_BRAND_DIR])
11796 AC_SUBST([CUSTOM_BRAND_IMAGES])
11797 AC_SUBST([DEFAULT_BRAND_IMAGES])
11800 AC_MSG_CHECKING([for 'intro' progress settings])
11801 PROGRESSBARCOLOR=
11802 PROGRESSSIZE=
11803 PROGRESSPOSITION=
11804 PROGRESSFRAMECOLOR=
11805 PROGRESSTEXTCOLOR=
11806 PROGRESSTEXTBASELINE=
11808 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
11809     source "$with_branding/progress.conf"
11810     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
11811 else
11812     AC_MSG_RESULT([none])
11815 AC_SUBST(PROGRESSBARCOLOR)
11816 AC_SUBST(PROGRESSSIZE)
11817 AC_SUBST(PROGRESSPOSITION)
11818 AC_SUBST(PROGRESSFRAMECOLOR)
11819 AC_SUBST(PROGRESSTEXTCOLOR)
11820 AC_SUBST(PROGRESSTEXTBASELINE)
11823 AC_MSG_CHECKING([for extra build ID])
11824 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
11825     EXTRA_BUILDID="$with_extra_buildid"
11827 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
11828 if test -n "$EXTRA_BUILDID" ; then
11829     AC_MSG_RESULT([$EXTRA_BUILDID])
11830 else
11831     AC_MSG_RESULT([not set])
11833 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
11835 OOO_VENDOR=
11836 AC_MSG_CHECKING([for vendor])
11837 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
11838     OOO_VENDOR="$USERNAME"
11840     if test -z "$OOO_VENDOR"; then
11841         OOO_VENDOR="$USER"
11842     fi
11844     if test -z "$OOO_VENDOR"; then
11845         OOO_VENDOR="`id -u -n`"
11846     fi
11848     AC_MSG_RESULT([not set, using $OOO_VENDOR])
11849 else
11850     OOO_VENDOR="$with_vendor"
11851     AC_MSG_RESULT([$OOO_VENDOR])
11853 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
11854 AC_SUBST(OOO_VENDOR)
11856 if test "$_os" = "Android" ; then
11857     ANDROID_PACKAGE_NAME=
11858     AC_MSG_CHECKING([for Android package name])
11859     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
11860         if test -n "$ENABLE_DEBUG"; then
11861             # Default to the package name that makes ndk-gdb happy.
11862             ANDROID_PACKAGE_NAME="org.libreoffice"
11863         else
11864             ANDROID_PACKAGE_NAME="org.example.libreoffice"
11865         fi
11867         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
11868     else
11869         ANDROID_PACKAGE_NAME="$with_android_package_name"
11870         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
11871     fi
11872     AC_SUBST(ANDROID_PACKAGE_NAME)
11875 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
11876 if test "$with_compat_oowrappers" = "yes"; then
11877     WITH_COMPAT_OOWRAPPERS=TRUE
11878     AC_MSG_RESULT(yes)
11879 else
11880     WITH_COMPAT_OOWRAPPERS=
11881     AC_MSG_RESULT(no)
11883 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
11885 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
11886 AC_MSG_CHECKING([for install dirname])
11887 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
11888     INSTALLDIRNAME="$with_install_dirname"
11890 AC_MSG_RESULT([$INSTALLDIRNAME])
11891 AC_SUBST(INSTALLDIRNAME)
11893 AC_MSG_CHECKING([for prefix])
11894 test "x$prefix" = xNONE && prefix=$ac_default_prefix
11895 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
11896 PREFIXDIR="$prefix"
11897 AC_MSG_RESULT([$PREFIXDIR])
11898 AC_SUBST(PREFIXDIR)
11900 LIBDIR=[$(eval echo $(eval echo $libdir))]
11901 AC_SUBST(LIBDIR)
11903 DATADIR=[$(eval echo $(eval echo $datadir))]
11904 AC_SUBST(DATADIR)
11906 MANDIR=[$(eval echo $(eval echo $mandir))]
11907 AC_SUBST(MANDIR)
11909 DOCDIR=[$(eval echo $(eval echo $docdir))]
11910 AC_SUBST(DOCDIR)
11912 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
11913 AC_SUBST(INSTALLDIR)
11915 TESTINSTALLDIR="${BUILDDIR}/test-install"
11916 AC_SUBST(TESTINSTALLDIR)
11919 # ===================================================================
11920 # OAuth2 id and secrets
11921 # ===================================================================
11923 AC_MSG_CHECKING([for Google Drive client id and secret])
11924 GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
11925 GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
11926 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
11927     GDRIVE_CLIENT_ID="\"\""
11930 if test "$with_gdrive_client_secret" = "no" -o -z "$with_gdrive_client_secret"; then
11931     GDRIVE_CLIENT_SECRET="\"\""
11934 if test -z "$GDRIVE_CLIENT_ID" -o -z "$GDRIVE_CLIENT_SECRET"; then
11935     AC_MSG_RESULT([not set])
11936 else
11937     AC_MSG_RESULT([set])
11940 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
11941 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
11943 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
11944 ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
11945 ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
11946 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
11947     ALFRESCO_CLOUD_CLIENT_ID="\"\""
11950 if test "$with_alfresco_cloud_client_secret" = "no" -o -z "$with_alfresco_cloud_client_secret"; then
11951     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
11954 if test -z "$ALFRESCO_CLOUD_CLIENT_ID" -o -z "$ALFRESCO_CLOUD_CLIENT_SECRET"; then
11955     AC_MSG_RESULT([not set])
11956 else
11957     AC_MSG_RESULT([set])
11959 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
11960 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
11962 AC_MSG_CHECKING([for OneDrive client id and secret])
11963 ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
11964 ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
11965 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
11966     ONEDRIVE_CLIENT_ID="\"\""
11969 if test "$with_onedrive_client_secret" = "no" -o -z "$with_onedrive_client_secret"; then
11970     ONEDRIVE_CLIENT_SECRET="\"\""
11973 if test -z "$ONEDRIVE_CLIENT_ID" -o -z "$ONEDRIVE_CLIENT_SECRET"; then
11974     AC_MSG_RESULT([not set])
11975 else
11976     AC_MSG_RESULT([set])
11978 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
11979 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
11982 dnl ===================================================================
11983 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
11984 dnl --enable-dependency-tracking configure option
11985 dnl ===================================================================
11986 AC_MSG_CHECKING([whether to enable dependency tracking])
11987 if test "$enable_dependency_tracking" = "no"; then
11988     nodep=TRUE
11989     AC_MSG_RESULT([no])
11990 else
11991     AC_MSG_RESULT([yes])
11993 AC_SUBST(nodep)
11995 dnl ===================================================================
11996 dnl Number of CPUs to use during the build
11997 dnl ===================================================================
11998 AC_MSG_CHECKING([for number of processors to use])
11999 # plain --with-parallelism is just the default
12000 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12001     if test "$with_parallelism" = "no"; then
12002         PARALLELISM=0
12003     else
12004         PARALLELISM=$with_parallelism
12005     fi
12006 else
12007     if test "$enable_icecream" = "yes"; then
12008         PARALLELISM="10"
12009     else
12010         case `uname -s` in
12012         Darwin|FreeBSD|NetBSD|OpenBSD)
12013             PARALLELISM=`sysctl -n hw.ncpu`
12014             ;;
12016         Linux)
12017             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12018         ;;
12019         # what else than above does profit here *and* has /proc?
12020         *)
12021             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12022             ;;
12023         esac
12025         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12026         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12027     fi
12030 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12031     if test -z "$with_parallelism"; then
12032             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12033             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12034             PARALLELISM="1"
12035     else
12036         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."
12037     fi
12040 if test $PARALLELISM -eq 0; then
12041     AC_MSG_RESULT([explicit make -j option needed])
12042 else
12043     AC_MSG_RESULT([$PARALLELISM])
12045 AC_SUBST(PARALLELISM)
12047 IWYU_PATH="$with_iwyu"
12048 AC_SUBST(IWYU_PATH)
12049 if test ! -z "$IWYU_PATH"; then
12050     if test ! -f "$IWYU_PATH"; then
12051         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12052     fi
12056 # Set up ILIB for MSVC build
12058 ILIB1=
12059 if test "$build_os" = "cygwin"; then
12060     ILIB="."
12061     if test -n "$JAVA_HOME"; then
12062         ILIB="$ILIB;$JAVA_HOME/lib"
12063     fi
12064     ILIB1=-link
12065     if test "$BITNESS_OVERRIDE" = 64; then
12066         if test $vcnum = "150"; then
12067             ILIB="$ILIB;$COMPATH/lib/x64"
12068             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12069         else
12070             ILIB="$ILIB;$COMPATH/lib/amd64"
12071             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/amd64"
12072         fi
12073         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12074         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12075         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12076             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12077             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12078         fi
12079         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12080         ucrtlibpath_formatted=$formatted_path
12081         ILIB="$ILIB;$ucrtlibpath_formatted"
12082         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12083     else
12084         if test $vcnum = "150"; then
12085             ILIB="$ILIB;$COMPATH/lib/x86"
12086             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12087         else
12088             ILIB="$ILIB;$COMPATH/lib"
12089             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib"
12090         fi
12091         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12092         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12093         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12094             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12095             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12096         fi
12097         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12098         ucrtlibpath_formatted=$formatted_path
12099         ILIB="$ILIB;$ucrtlibpath_formatted"
12100         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12101     fi
12102     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12103         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12104     else
12105         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12106     fi
12108     AC_SUBST(ILIB)
12111 dnl We should be able to drop the below check when bumping the GCC baseline to
12112 dnl 4.9, as <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54577>
12113 dnl "deque<T>::erase() still takes iterator instead of const_iterator" should be
12114 dnl fixed there with <https://gcc.gnu.org/git/?p=gcc.git;a=commit;
12115 dnl h=6b0e18ca48bb4b4c01e7b5be2b98849943fdcf91>:
12116 AC_MSG_CHECKING(
12117     [whether C++11 use of const_iterator in standard containers is broken])
12118 save_CXXFLAGS=$CXXFLAGS
12119 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12120 AC_LANG_PUSH([C++])
12121 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12122     #include <list>
12123     ]],[[
12124         std::list<int> l;
12125         l.erase(l.cbegin());
12126     ]])],
12127     [broken=no], [broken=yes])
12128 AC_LANG_POP([C++])
12129 CXXFLAGS=$save_CXXFLAGS
12130 AC_MSG_RESULT([$broken])
12131 if test "$broken" = yes; then
12132     AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
12136 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12137 save_CXXFLAGS=$CXXFLAGS
12138 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12139 save_LIBS=$LIBS
12140 if test -n "$ILIB1"; then
12141     LIBS="$LIBS $ILIB1"
12143 AC_LANG_PUSH([C++])
12144 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12145     // Exit with failure if the static initializer_list is stored on the
12146     // stack (as done by Clang < 3.4):
12147     #include <initializer_list>
12148     struct S {};
12149     bool g(void const * p1, void const * p2) {
12150         int n;
12151         return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12152     }
12153     bool f(void const * p1) {
12154         static std::initializer_list<S> s { S() };
12155         return g(p1, s.begin());
12156     }
12157     ]],[[
12158         int n;
12159         return f(&n) ? 0 : 1;
12160     ]])], [broken=no], [broken=yes],[broken='assuming not (cross-compiling)'])
12161 AC_LANG_POP([C++])
12162 LIBS=$save_LIBS
12163 CXXFLAGS=$save_CXXFLAGS
12164 AC_MSG_RESULT([$broken])
12165 if test "$broken" = yes -a "$_os" != "iOS"; then
12166     AC_MSG_ERROR([working support for static initializer_list needed])
12170 # ===================================================================
12171 # Creating bigger shared library to link against
12172 # ===================================================================
12173 AC_MSG_CHECKING([whether to create huge library])
12174 MERGELIBS=
12176 if test $_os = iOS -o $_os = Android; then
12177     # Never any point in mergelibs for these as we build just static
12178     # libraries anyway...
12179     enable_mergelibs=no
12182 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12183     if test $_os != Linux -a $_os != WINNT; then
12184         add_warning "--enable-mergelibs is not tested for this platform"
12185     fi
12186     MERGELIBS="TRUE"
12187     AC_MSG_RESULT([yes])
12188 else
12189     AC_MSG_RESULT([no])
12191 AC_SUBST([MERGELIBS])
12193 dnl ===================================================================
12194 dnl icerun is a wrapper that stops us spawning tens of processes
12195 dnl locally - for tools that can't be executed on the compile cluster
12196 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12197 dnl ===================================================================
12198 AC_MSG_CHECKING([whether to use icerun wrapper])
12199 ICECREAM_RUN=
12200 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12201     ICECREAM_RUN=icerun
12202     AC_MSG_RESULT([yes])
12203 else
12204     AC_MSG_RESULT([no])
12206 AC_SUBST(ICECREAM_RUN)
12208 dnl ===================================================================
12209 dnl Setup the ICECC_VERSION for the build the same way it was set for
12210 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12211 dnl ===================================================================
12212 x_ICECC_VERSION=[\#]
12213 if test -n "$ICECC_VERSION" ; then
12214     x_ICECC_VERSION=
12216 AC_SUBST(x_ICECC_VERSION)
12217 AC_SUBST(ICECC_VERSION)
12219 dnl ===================================================================
12221 AC_MSG_CHECKING([MPL subset])
12222 MPL_SUBSET=
12224 if test "$enable_mpl_subset" = "yes"; then
12225     warn_report=false
12226     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12227         warn_report=true
12228     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12229         warn_report=true
12230     fi
12231     if test "$warn_report" = "true"; then
12232         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12233     fi
12234     if test "x$enable_postgresql_sdbc" != "xno"; then
12235         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12236     fi
12237     if test "$enable_lotuswordpro" = "yes"; then
12238         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12239     fi
12240     if test "$WITH_WEBDAV" = "neon"; then
12241         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12242     fi
12243     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12244         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12245     fi
12246     if test -n "$ENABLE_PDFIMPORT"; then
12247         if test "x$SYSTEM_POPPLER" = "x"; then
12248             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12249         fi
12250     fi
12251     # cf. m4/libo_check_extension.m4
12252     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12253         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12254     fi
12255     for theme in $WITH_THEMES; do
12256         case $theme in
12257         breeze|crystal|default|hicontrast|oxygen|sifr)
12258             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12259         *) : ;;
12260         esac
12261     done
12263     ENABLE_OPENGL_TRANSITIONS=
12265     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12266         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12267     fi
12269     MPL_SUBSET="TRUE"
12270     AC_DEFINE(MPL_HAVE_SUBSET)
12271     AC_MSG_RESULT([only])
12272 else
12273     AC_MSG_RESULT([no restrictions])
12275 AC_SUBST(MPL_SUBSET)
12277 dnl ===================================================================
12279 AC_MSG_CHECKING([formula logger])
12280 ENABLE_FORMULA_LOGGER=
12282 if test "x$enable_formula_logger" = "xyes"; then
12283     AC_MSG_RESULT([yes])
12284     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12285     ENABLE_FORMULA_LOGGER=TRUE
12286 elif test -n "$ENABLE_DBGUTIL" ; then
12287     AC_MSG_RESULT([yes])
12288     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12289     ENABLE_FORMULA_LOGGER=TRUE
12290 else
12291     AC_MSG_RESULT([no])
12294 AC_SUBST(ENABLE_FORMULA_LOGGER)
12296 dnl ===================================================================
12297 dnl Setting up the environment.
12298 dnl ===================================================================
12299 AC_MSG_NOTICE([setting up the build environment variables...])
12301 AC_SUBST(COMPATH)
12303 if test "$build_os" = "cygwin"; then
12304     if test -d "$COMPATH/atlmfc/lib"; then
12305         ATL_LIB="$COMPATH/atlmfc/lib"
12306         ATL_INCLUDE="$COMPATH/atlmfc/include"
12307     else
12308         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12309         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12310     fi
12311     if test "$BITNESS_OVERRIDE" = 64; then
12312         if test $VCVER = "150"; then
12313             ATL_LIB="$ATL_LIB/x64"
12314         else
12315             ATL_LIB="$ATL_LIB/amd64"
12316         fi
12317     else
12318         if test $VCVER = "150"; then
12319             ATL_LIB="$ATL_LIB/x86"
12320         fi
12321     fi
12322     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12323     PathFormat "/usr/bin/find.exe"
12324     FIND="$formatted_path"
12325     PathFormat "/usr/bin/sort.exe"
12326     SORT="$formatted_path"
12327     PathFormat "/usr/bin/grep.exe"
12328     WIN_GREP="$formatted_path"
12329     PathFormat "/usr/bin/ls.exe"
12330     WIN_LS="$formatted_path"
12331     PathFormat "/usr/bin/touch.exe"
12332     WIN_TOUCH="$formatted_path"
12333 else
12334     FIND=find
12335     SORT=sort
12338 AC_SUBST(ATL_INCLUDE)
12339 AC_SUBST(ATL_LIB)
12340 AC_SUBST(FIND)
12341 AC_SUBST(SORT)
12342 AC_SUBST(WIN_GREP)
12343 AC_SUBST(WIN_LS)
12344 AC_SUBST(WIN_TOUCH)
12346 AC_SUBST(BUILD_TYPE)
12348 AC_SUBST(SOLARINC)
12350 PathFormat "$PERL"
12351 PERL="$formatted_path"
12352 AC_SUBST(PERL)
12354 if test -n "$TMPDIR"; then
12355     TEMP_DIRECTORY="$TMPDIR"
12356 else
12357     TEMP_DIRECTORY="/tmp"
12359 if test "$build_os" = "cygwin"; then
12360     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12362 AC_SUBST(TEMP_DIRECTORY)
12364 # setup the PATH for the environment
12365 if test -n "$LO_PATH_FOR_BUILD"; then
12366     LO_PATH="$LO_PATH_FOR_BUILD"
12367 else
12368     LO_PATH="$PATH"
12370     case "$host_os" in
12372     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12373         if test "$ENABLE_JAVA" != ""; then
12374             pathmunge "$JAVA_HOME/bin" "after"
12375         fi
12376         ;;
12378     cygwin*)
12379         # Win32 make needs native paths
12380         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12381             LO_PATH=`cygpath -p -m "$PATH"`
12382         fi
12383         if test "$BITNESS_OVERRIDE" = 64; then
12384             # needed for msi packaging
12385             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12386         fi
12387         # .NET 4.6 and higher don't have bin directory
12388         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12389             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12390         fi
12391         pathmunge "$ASM_HOME" "before"
12392         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12393         pathmunge "$CSC_PATH" "before"
12394         pathmunge "$MIDL_PATH" "before"
12395         pathmunge "$AL_PATH" "before"
12396         pathmunge "$MSPDB_PATH" "before"
12397         if test -n "$MSBUILD_PATH" ; then
12398             pathmunge "$MSBUILD_PATH" "before"
12399         fi
12400         if test "$BITNESS_OVERRIDE" = 64; then
12401             pathmunge "$COMPATH/bin/amd64" "before"
12402             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12403         else
12404             pathmunge "$COMPATH/bin" "before"
12405             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12406         fi
12407         if test "$ENABLE_JAVA" != ""; then
12408             if test -d "$JAVA_HOME/jre/bin/client"; then
12409                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12410             fi
12411             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12412                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12413             fi
12414             pathmunge "$JAVA_HOME/bin" "before"
12415         fi
12416         ;;
12418     solaris*)
12419         pathmunge "/usr/css/bin" "before"
12420         if test "$ENABLE_JAVA" != ""; then
12421             pathmunge "$JAVA_HOME/bin" "after"
12422         fi
12423         ;;
12424     esac
12427 AC_SUBST(LO_PATH)
12429 libo_FUZZ_SUMMARY
12431 # Generate a configuration sha256 we can use for deps
12432 if test -f config_host.mk; then
12433     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12435 if test -f config_host_lang.mk; then
12436     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12439 CFLAGS=$my_original_CFLAGS
12440 CXXFLAGS=$my_original_CXXFLAGS
12441 CPPFLAGS=$my_original_CPPFLAGS
12443 AC_CONFIG_FILES([config_host.mk
12444                  config_host_lang.mk
12445                  Makefile
12446                  lo.xcent
12447                  bin/bffvalidator.sh
12448                  bin/odfvalidator.sh
12449                  bin/officeotron.sh
12450                  instsetoo_native/util/openoffice.lst
12451                  sysui/desktop/macosx/Info.plist])
12452 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12453 AC_CONFIG_HEADERS([config_host/config_clang.h])
12454 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12455 AC_CONFIG_HEADERS([config_host/config_eot.h])
12456 AC_CONFIG_HEADERS([config_host/config_extension_update.h])
12457 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12458 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12459 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12460 AC_CONFIG_HEADERS([config_host/config_features.h])
12461 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12462 AC_CONFIG_HEADERS([config_host/config_folders.h])
12463 AC_CONFIG_HEADERS([config_host/config_gio.h])
12464 AC_CONFIG_HEADERS([config_host/config_global.h])
12465 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12466 AC_CONFIG_HEADERS([config_host/config_java.h])
12467 AC_CONFIG_HEADERS([config_host/config_langs.h])
12468 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12469 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12470 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12471 AC_CONFIG_HEADERS([config_host/config_locales.h])
12472 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12473 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12474 AC_CONFIG_HEADERS([config_host/config_qt5.h])
12475 AC_CONFIG_HEADERS([config_host/config_oox.h])
12476 AC_CONFIG_HEADERS([config_host/config_options.h])
12477 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12478 AC_CONFIG_HEADERS([config_host/config_test.h])
12479 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12480 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12481 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12482 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12483 AC_CONFIG_HEADERS([config_host/config_version.h])
12484 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12485 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12486 AC_CONFIG_HEADERS([config_host/config_python.h])
12487 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12488 AC_OUTPUT
12490 if test "$CROSS_COMPILING" = TRUE; then
12491     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12494 # touch the config timestamp file
12495 if test ! -f config_host.mk.stamp; then
12496     echo > config_host.mk.stamp
12497 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12498     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12499 else
12500     echo > config_host.mk.stamp
12503 # touch the config lang timestamp file
12504 if test ! -f config_host_lang.mk.stamp; then
12505     echo > config_host_lang.mk.stamp
12506 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12507     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12508 else
12509     echo > config_host_lang.mk.stamp
12513 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12515 cat << _EOS
12516 ****************************************************************************
12517 WARNING:
12518 Your make version is known to be horribly slow, and hard to debug
12519 problems with. To get a reasonably functional make please do:
12521 to install a pre-compiled binary make for Win32
12523  mkdir -p /opt/lo/bin
12524  cd /opt/lo/bin
12525  wget https://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
12526  cp make-85047eb-msvc.exe make
12527  chmod +x make
12529 to install from source:
12530 place yourself in a working directory of you choice.
12532  git clone git://git.savannah.gnu.org/make.git
12534  [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"]
12535  set PATH=%PATH%;C:\Cygwin\bin
12536  [or Cygwin64, if that is what you have]
12537  cd path-to-make-repo-you-cloned-above
12538  build_w32.bat --without-guile
12540 should result in a WinRel/gnumake.exe.
12541 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12543 Then re-run autogen.sh
12545 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12546 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12548 _EOS
12551 cat << _EOF
12552 ****************************************************************************
12554 To build, run:
12555 $GNUMAKE
12557 To view some help, run:
12558 $GNUMAKE help
12560 _EOF
12562 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12563     cat << _EOF
12564 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12565 _EOF
12567     if test $_os = Darwin; then
12568         echo open instdir/$PRODUCTNAME.app
12569     else
12570         echo instdir/program/soffice
12571     fi
12572     cat << _EOF
12574 If you want to run the smoketest, run:
12575 $GNUMAKE check
12577 _EOF
12580 if test -f warn; then
12581     cat warn
12582     rm warn
12585 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: