tdf#101778: Disable crop and rotate in read-only mode
[LibreOffice.git] / configure.ac
blob23b3fd4953c93558038fa1811fdc0897837d11b9
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 102 -*-
2 dnl configure.ac serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 # The version number in the second argument to AC_INIT should be four numbers separated by
6 # periods. Some parts of the code requires the first one to be less than 128 and the others to be less
7 # than 256. The four numbers can optionally be followed by a period and a free-form string containing
8 # no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
9 # several non-alphanumeric characters, those are split off and used only for the
10 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
12 AC_INIT([LibreOffice],[6.2.0.0.alpha0+],[],[],[http://documentfoundation.org/])
14 AC_PREREQ([2.59])
16 if test -n "$BUILD_TYPE"; then
17     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
20 save_CC=$CC
21 save_CXX=$CXX
23 BUILD_TYPE="LibO"
24 SCPDEFS=""
25 GIT_NEEDED_SUBMODULES=""
26 LO_PATH= # used by path_munge to construct a PATH variable
28 FilterLibs()
30     filteredlibs=
31     for f in $1; do
32         case "$f" in
33             # let's start with Fedora's paths for now
34             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
35                 # ignore it: on UNIXoids it is searched by default anyway
36                 # but if it's given explicitly then it may override other paths
37                 # (on Mac OS X it would be an error to use it instead of SDK)
38                 ;;
39             *)
40                 filteredlibs="$filteredlibs $f"
41                 ;;
42         esac
43     done
46 PathFormat()
48     formatted_path="$1"
49     if test "$build_os" = "cygwin"; then
50         pf_conv_to_dos=
51         # spaces,parentheses,brackets,braces are problematic in pathname
52         # so are backslashes
53         case "$formatted_path" in
54             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
55                 pf_conv_to_dos="yes"
56             ;;
57         esac
58         if test "$pf_conv_to_dos" = "yes"; then
59             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
60                 formatted_path=`cygpath -sm "$formatted_path"`
61             else
62                 formatted_path=`cygpath -d "$formatted_path"`
63             fi
64             if test $? -ne 0;  then
65                 AC_MSG_ERROR([path conversion failed for "$1".])
66             fi
67         fi
68         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
69         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
70         if test "$fp_count_slash$fp_count_colon" != "00"; then
71             if test "$fp_count_colon" = "0"; then
72                 new_formatted_path=`realpath "$formatted_path"`
73                 if test $? -ne 0;  then
74                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
75                 else
76                     formatted_path="$new_formatted_path"
77                 fi
78             fi
79             formatted_path=`cygpath -m "$formatted_path"`
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84     fi
87 AbsolutePath()
89     # There appears to be no simple and portable method to get an absolute and
90     # canonical path, so we try creating the directory if does not exist and
91     # utilizing the shell and pwd.
92     rel="$1"
93     absolute_path=""
94     test ! -e "$rel" && mkdir -p "$rel"
95     if test -d "$rel" ; then
96         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
97         absolute_path="$(pwd)"
98         cd - > /dev/null
99     else
100         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
101     fi
104 rm -f warn
105 have_WARNINGS="no"
106 add_warning()
108     if test "$have_WARNINGS" = "no"; then
109         echo "*************************************" > warn
110         have_WARNINGS="yes"
111         if which tput >/dev/null 2>/dev/null && test `tput colors` -ge 8; then
112             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
113             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
114         else
115             COLORWARN="* WARNING :"
116         fi
117     fi
118     echo "$COLORWARN $@" >> warn
121 dnl Some Mac User have the bad habbit of letting a lot fo crap
122 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
123 dnl that confuse the build.
124 dnl For the ones that use LODE, let's be nice and protect them
125 dnl from themselves
127 mac_sanitize_path()
129     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
130 dnl a common but nevertheless necessary thing that may be in a fancy
131 dnl path location is git, so make sure we have it
132     mac_git_path=`which git 2>/dev/null`
133     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
134         mac_path="$mac_path:`dirname $mac_git_path`"
135     fi
136 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
137 dnl path location is gpg, so make sure we find it
138     mac_gpg_path=`which gpg 2>/dev/null`
139     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
140         mac_path="$mac_path:`dirname $mac_gpg_path`"
141     fi
142     PATH="$mac_path"
143     unset mac_path
144     unset mac_git_path
145     unset mac_gpg_path
148 echo "********************************************************************"
149 echo "*"
150 echo "*   Running ${PACKAGE_NAME} build configuration."
151 echo "*"
152 echo "********************************************************************"
153 echo ""
155 dnl ===================================================================
156 dnl checks build and host OSes
157 dnl do this before argument processing to allow for platform dependent defaults
158 dnl ===================================================================
159 AC_CANONICAL_HOST
161 AC_MSG_CHECKING([for product name])
162 PRODUCTNAME="AC_PACKAGE_NAME"
163 if test -n "$with_product_name" -a "$with_product_name" != no; then
164     PRODUCTNAME="$with_product_name"
166 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
167     PRODUCTNAME="${PRODUCTNAME}Dev"
169 AC_MSG_RESULT([$PRODUCTNAME])
170 AC_SUBST(PRODUCTNAME)
171 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
172 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
174 dnl ===================================================================
175 dnl Our version is defined by the AC_INIT() at the top of this script.
176 dnl ===================================================================
178 AC_MSG_CHECKING([for package version])
179 if test -n "$with_package_version" -a "$with_package_version" != no; then
180     PACKAGE_VERSION="$with_package_version"
182 AC_MSG_RESULT([$PACKAGE_VERSION])
184 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
186 LIBO_VERSION_MAJOR=$1
187 LIBO_VERSION_MINOR=$2
188 LIBO_VERSION_MICRO=$3
189 LIBO_VERSION_PATCH=$4
191 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
192 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
193 # no way to encode that into an integer in general.
194 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
196 LIBO_VERSION_SUFFIX=$5
197 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
198 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
199 # they get undoubled before actually passed to sed.
200 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
201 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
202 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
203 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
205 AC_SUBST(LIBO_VERSION_MAJOR)
206 AC_SUBST(LIBO_VERSION_MINOR)
207 AC_SUBST(LIBO_VERSION_MICRO)
208 AC_SUBST(LIBO_VERSION_PATCH)
209 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
210 AC_SUBST(LIBO_VERSION_SUFFIX)
211 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
213 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
214 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
215 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
216 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
218 LIBO_THIS_YEAR=`date +%Y`
219 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
221 dnl ===================================================================
222 dnl Product version
223 dnl ===================================================================
224 AC_MSG_CHECKING([for product version])
225 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
226 AC_MSG_RESULT([$PRODUCTVERSION])
227 AC_SUBST(PRODUCTVERSION)
229 AC_PROG_EGREP
230 # AC_PROG_EGREP doesn't set GREP on all systems as well
231 AC_PATH_PROG(GREP, grep)
233 BUILDDIR=`pwd`
234 cd $srcdir
235 SRC_ROOT=`pwd`
236 cd $BUILDDIR
237 x_Cygwin=[\#]
239 dnl ======================================
240 dnl Required GObject introspection version
241 dnl ======================================
242 INTROSPECTION_REQUIRED_VERSION=1.32.0
244 dnl ===================================================================
245 dnl Search all the common names for GNU Make
246 dnl ===================================================================
247 AC_MSG_CHECKING([for GNU Make])
249 # try to use our own make if it is available and GNUMAKE was not already defined
250 if test -z "$GNUMAKE"; then
251     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
252         GNUMAKE="$LODE_HOME/opt/bin/make"
253     elif test -x "/opt/lo/bin/make"; then
254         GNUMAKE="/opt/lo/bin/make"
255     fi
258 GNUMAKE_WIN_NATIVE=
259 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
260     if test -n "$a"; then
261         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
262         if test $? -eq 0;  then
263             if test "$build_os" = "cygwin"; then
264                 if test -n "$($a -v | grep 'Built for Windows')" ; then
265                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
266                     GNUMAKE_WIN_NATIVE="TRUE"
267                 else
268                     GNUMAKE=`which $a`
269                 fi
270             else
271                 GNUMAKE=`which $a`
272             fi
273             break
274         fi
275     fi
276 done
277 AC_MSG_RESULT($GNUMAKE)
278 if test -z "$GNUMAKE"; then
279     AC_MSG_ERROR([not found. install GNU Make.])
280 else
281     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
282         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
283     fi
286 win_short_path_for_make()
288     local_short_path="$1"
289     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
290         cygpath -sm "$local_short_path"
291     else
292         cygpath -u "$(cygpath -d "$local_short_path")"
293     fi
297 if test "$build_os" = "cygwin"; then
298     PathFormat "$SRC_ROOT"
299     SRC_ROOT="$formatted_path"
300     PathFormat "$BUILDDIR"
301     BUILDDIR="$formatted_path"
302     x_Cygwin=
303     AC_MSG_CHECKING(for explicit COMSPEC)
304     if test -z "$COMSPEC"; then
305         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
306     else
307         AC_MSG_RESULT([found: $COMSPEC])
308     fi
311 AC_SUBST(SRC_ROOT)
312 AC_SUBST(BUILDDIR)
313 AC_SUBST(x_Cygwin)
314 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
315 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
317 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
318     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
321 # need sed in os checks...
322 AC_PATH_PROGS(SED, sed)
323 if test -z "$SED"; then
324     AC_MSG_ERROR([install sed to run this script])
327 # Set the ENABLE_LTO variable
328 # ===================================================================
329 AC_MSG_CHECKING([whether to use link-time optimization])
330 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
331     ENABLE_LTO="TRUE"
332     AC_MSG_RESULT([yes])
333     AC_DEFINE(STATIC_LINKING)
334 else
335     ENABLE_LTO=""
336     AC_MSG_RESULT([no])
338 AC_SUBST(ENABLE_LTO)
340 AC_ARG_ENABLE(fuzz-options,
341     AS_HELP_STRING([--enable-fuzz-options],
342         [Randomly enable or disable each of those configurable options
343          that are supposed to be freely selectable without interdependencies,
344          or where bad interaction from interdependencies is automatically avoided.])
347 dnl ===================================================================
348 dnl When building for Android, --with-android-ndk,
349 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
350 dnl mandatory
351 dnl ===================================================================
353 AC_ARG_WITH(android-ndk,
354     AS_HELP_STRING([--with-android-ndk],
355         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
358 AC_ARG_WITH(android-ndk-toolchain-version,
359     AS_HELP_STRING([--with-android-ndk-toolchain-version],
360         [Specify which toolchain version to use, of those present in the
361         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
362         with_android_ndk_toolchain_version=clang5.0)
364 AC_ARG_WITH(android-sdk,
365     AS_HELP_STRING([--with-android-sdk],
366         [Specify location of the Android SDK. Mandatory when building for Android.]),
369 ANDROID_NDK_HOME=
370 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
371     with_android_ndk="$SRC_ROOT/external/android-ndk"
373 if test -n "$with_android_ndk"; then
374     ANDROID_NDK_HOME=$with_android_ndk
376     # Set up a lot of pre-canned defaults
378     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
379         if test ! -f $ANDROID_NDK_HOME/source.properties; then
380             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
381         fi
382         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
383     else
384         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
385     fi
386     if test -z "$ANDROID_NDK_VERSION";  then
387         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
388     fi
389     case $ANDROID_NDK_VERSION in
390     r9*|r10*)
391         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
392         ;;
393     11.1.*|12.1.*|13.1.*|14.1.*)
394         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
395         ;;
396     16.*)
397         ;;
398     *)
399         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk.])
400         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk."
401         ;;
402     esac
404     ANDROID_API_LEVEL=14
405     android_cpu=$host_cpu
406     ANDROID_ARCH=$android_cpu
407     if test $host_cpu = arm; then
408         android_platform_prefix=$android_cpu-linux-androideabi
409         android_gnu_prefix=$android_platform_prefix
410         LLVM_TRIPLE=armv7-none-linux-androideabi
411         ANDROID_APP_ABI=armeabi-v7a
412         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
413     elif test $host_cpu = aarch64; then
414         android_platform_prefix=$android_cpu-linux-android
415         android_gnu_prefix=$android_platform_prefix
416         LLVM_TRIPLE=aarch64-none-linux-android
417         # minimum android version that supports aarch64
418         ANDROID_API_LEVEL=21
419         ANDROID_APP_ABI=arm64-v8a
420         ANDROID_ARCH=arm64
421     elif test $host_cpu = mips; then
422         android_platform_prefix=mipsel-linux-android
423         android_gnu_prefix=$android_platform_prefix
424         LLVM_TRIPLE=mipsel-none-linux-android
425         ANDROID_APP_ABI=mips
426     else
427         # host_cpu is something like "i386" or "i686" I guess, NDK uses
428         # "x86" in some contexts
429         android_cpu=x86
430         android_platform_prefix=$android_cpu
431         android_gnu_prefix=i686-linux-android
432         LLVM_TRIPLE=i686-none-linux-android
433         ANDROID_APP_ABI=x86
434         ANDROID_ARCH=$android_cpu
435         ANDROIDCFLAGS="-march=atom"
436     fi
438     case "$with_android_ndk_toolchain_version" in
439     clang5.0)
440         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
441         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION
442         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm
443         ;;
444     *)
445         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
446     esac
448     if test ! -d $ANDROID_BINUTILS_DIR; then
449         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
450     elif test ! -d $ANDROID_COMPILER_DIR; then
451         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
452     fi
454     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
455     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
456     # manage to link the (app-specific) single huge .so that is built for the app in
457     # android/source/ if there is debug information in a significant part of the object files.
458     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
459     # all objects have been built with debug information.)
460     case $build_os in
461     linux-gnu*)
462         ndk_build_os=linux
463         ;;
464     darwin*)
465         ndk_build_os=darwin
466         ;;
467     *)
468         AC_MSG_ERROR([We only support building for Android from Linux or OS X])
469         ;;
470     esac
471     ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
472     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
473     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
475     test -z "$SYSBASE" && SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
476     test -z "$AR" && AR=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ar
477     test -z "$NM" && NM=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-nm
478     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-objdump
479     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ranlib
480     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-strip
482     ANDROIDCFLAGS="$ANDROIDCFLAGS -gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT -target $LLVM_TRIPLE$ANDROID_API_LEVEL -no-canonical-prefixes"
483     # android is using different sysroots for compilation and linking, but as
484     # there is no full separation in configure and elsewhere, use isystem for
485     # compilation stuff and sysroot for linking
486     ANDROIDCFLAGS="$ANDROIDCFLAGS -D__ANDROID_API__=$ANDROID_API_LEVEL -isystem $ANDROID_NDK_HOME/sysroot/usr/include"
487     ANDROIDCFLAGS="$ANDROIDCFLAGS -isystem $ANDROID_NDK_HOME/sysroot/usr/include/$android_gnu_prefix"
488     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$SYSBASE -ffunction-sections -fdata-sections -Qunused-arguments"
489     if test "$ANDROID_APP_ABI" = "armeabi-v7a"; then
490     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/libs/$ANDROID_APP_ABI -D_GTHREAD_USE_MUTEX_INIT_FUNC=1"
491     else
492     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/libs/$ANDROID_APP_ABI"
493     fi
494     if test "$ENABLE_LTO" = TRUE; then
495         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
496         # $CC and $CXX when building external libraries
497         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
498     fi
500     if test "$ANDROID_APP_ABI" = "armeabi-v7a"; then
501     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/libs/$ANDROID_APP_ABI/include -std=c++11"
502     else
503     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/include -I$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++abi/include -I$ANDROID_NDK_HOME/sources/android/support/include -std=c++11"
504     fi
506     if test -z "$CC"; then
507         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
508     fi
509     if test -z "$CXX"; then
510         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
511     fi
513     # remember to download the ownCloud Android library later
514     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
516 AC_SUBST(ANDROID_NDK_HOME)
517 AC_SUBST(ANDROID_APP_ABI)
518 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
520 dnl ===================================================================
521 dnl --with-android-sdk
522 dnl ===================================================================
523 ANDROID_SDK_HOME=
524 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
525     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
527 if test -n "$with_android_sdk"; then
528     ANDROID_SDK_HOME=$with_android_sdk
529     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
531 AC_SUBST(ANDROID_SDK_HOME)
533 dnl ===================================================================
534 dnl The following is a list of supported systems.
535 dnl Sequential to keep the logic very simple
536 dnl These values may be checked and reset later.
537 dnl ===================================================================
538 #defaults unless the os test overrides this:
539 test_randr=yes
540 test_xrender=yes
541 test_cups=yes
542 test_dbus=yes
543 test_fontconfig=yes
544 test_cairo=no
546 # Default values, as such probably valid just for Linux, set
547 # differently below just for Mac OSX,but at least better than
548 # hardcoding these as we used to do. Much of this is duplicated also
549 # in solenv for old build system and for gbuild, ideally we should
550 # perhaps define stuff like this only here in configure.ac?
552 LINKFLAGSSHL="-shared"
553 PICSWITCH="-fpic"
554 DLLPOST=".so"
556 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
558 INSTROOTBASESUFFIX=
559 INSTROOTCONTENTSUFFIX=
560 SDKDIRNAME=sdk
562 case "$host_os" in
564 solaris*)
565     test_gtk=yes
566     build_gstreamer_1_0=yes
567     build_gstreamer_0_10=yes
568     test_freetype=yes
569     _os=SunOS
571     dnl ===========================================================
572     dnl Check whether we're using Solaris 10 - SPARC or Intel.
573     dnl ===========================================================
574     AC_MSG_CHECKING([the Solaris operating system release])
575     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
576     if test "$_os_release" -lt "10"; then
577         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
578     else
579         AC_MSG_RESULT([ok ($_os_release)])
580     fi
582     dnl Check whether we're using a SPARC or i386 processor
583     AC_MSG_CHECKING([the processor type])
584     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
585         AC_MSG_RESULT([ok ($host_cpu)])
586     else
587         AC_MSG_ERROR([only SPARC and i386 processors are supported])
588     fi
589     ;;
591 linux-gnu*|k*bsd*-gnu*)
592     test_gtk=yes
593     build_gstreamer_1_0=yes
594     build_gstreamer_0_10=yes
595     test_kde4=yes
596     test_kde5=yes
597     test_qt5=yes
598     test_gtk3_kde5=yes
599     if test "$enable_fuzzers" != yes; then
600         test_freetype=yes
601         test_fontconfig=yes
602     else
603         test_freetype=no
604         test_fontconfig=no
605         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
606     fi
607     _os=Linux
608     ;;
610 gnu)
611     test_randr=no
612     test_xrender=no
613     _os=GNU
614      ;;
616 cygwin*|interix*)
618     # When building on Windows normally with MSVC under Cygwin,
619     # configure thinks that the host platform (the platform the
620     # built code will run on) is Cygwin, even if it obviously is
621     # Windows, which in Autoconf terminology is called
622     # "mingw32". (Which is misleading as MinGW is the name of the
623     # tool-chain, not an operating system.)
625     # Somewhat confusing, yes. But this configure script doesn't
626     # look at $host etc that much, it mostly uses its own $_os
627     # variable, set here in this case statement.
629     test_cups=no
630     test_dbus=no
631     test_randr=no
632     test_xrender=no
633     test_freetype=no
634     test_fontconfig=no
635     _os=WINNT
637     DLLPOST=".dll"
638     LINKFLAGSNOUNDEFS=
639     ;;
641 darwin*) # Mac OS X or iOS
642     test_gtk=yes
643     test_randr=no
644     test_xrender=no
645     test_freetype=no
646     test_fontconfig=no
647     test_dbus=no
648     if test -n "$LODE_HOME" ; then
649         mac_sanitize_path
650         AC_MSG_NOTICE([sanitized the PATH to $PATH])
651     fi
652     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
653         build_for_ios=YES
654         _os=iOS
655         test_gtk=no
656         test_cups=no
657         enable_mpl_subset=yes
658         enable_lotuswordpro=no
659         enable_coinmp=no
660         enable_lpsolve=no
661         enable_postgresql_sdbc=no
662         enable_extension_integration=no
663         enable_report_builder=no
664         with_theme="tango"
665         with_ppds=no
666         if test "$enable_ios_simulator" = "yes"; then
667             host=x86_64-apple-darwin
668         fi
669     else
670         _os=Darwin
671         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
672         INSTROOTCONTENTSUFFIX=/Contents
673         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
674     fi
675     # See comment above the case "$host_os"
676     LINKFLAGSSHL="-dynamiclib -single_module"
678     # -fPIC is default
679     PICSWITCH=""
681     DLLPOST=".dylib"
683     # -undefined error is the default
684     LINKFLAGSNOUNDEFS=""
687 freebsd*)
688     test_gtk=yes
689     build_gstreamer_1_0=yes
690     build_gstreamer_0_10=yes
691     test_kde4=yes
692     test_kde5=yes
693     test_qt5=yes
694     test_gtk3_kde5=yes
695     test_freetype=yes
696     AC_MSG_CHECKING([the FreeBSD operating system release])
697     if test -n "$with_os_version"; then
698         OSVERSION="$with_os_version"
699     else
700         OSVERSION=`/sbin/sysctl -n kern.osreldate`
701     fi
702     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
703     AC_MSG_CHECKING([which thread library to use])
704     if test "$OSVERSION" -lt "500016"; then
705         PTHREAD_CFLAGS="-D_THREAD_SAFE"
706         PTHREAD_LIBS="-pthread"
707     elif test "$OSVERSION" -lt "502102"; then
708         PTHREAD_CFLAGS="-D_THREAD_SAFE"
709         PTHREAD_LIBS="-lc_r"
710     else
711         PTHREAD_CFLAGS=""
712         PTHREAD_LIBS="-pthread"
713     fi
714     AC_MSG_RESULT([$PTHREAD_LIBS])
715     _os=FreeBSD
716     ;;
718 *netbsd*)
719     test_gtk=yes
720     build_gstreamer_1_0=yes
721     build_gstreamer_0_10=yes
722     test_kde4=yes
723     test_kde5=yes
724     test_qt5=yes
725     test_gtk3_kde5=yes
726     test_freetype=yes
727     PTHREAD_LIBS="-pthread -lpthread"
728     _os=NetBSD
729     ;;
731 aix*)
732     test_randr=no
733     test_freetype=yes
734     PTHREAD_LIBS=-pthread
735     _os=AIX
736     ;;
738 openbsd*)
739     test_gtk=yes
740     test_freetype=yes
741     PTHREAD_CFLAGS="-D_THREAD_SAFE"
742     PTHREAD_LIBS="-pthread"
743     _os=OpenBSD
744     ;;
746 dragonfly*)
747     test_gtk=yes
748     build_gstreamer_1_0=yes
749     build_gstreamer_0_10=yes
750     test_kde4=yes
751     test_kde5=yes
752     test_qt5=yes
753     test_gtk3_kde5=yes
754     test_freetype=yes
755     PTHREAD_LIBS="-pthread"
756     _os=DragonFly
757     ;;
759 linux-android*)
760     build_gstreamer_1_0=no
761     build_gstreamer_0_10=no
762     enable_lotuswordpro=no
763     enable_mpl_subset=yes
764     enable_coinmp=yes
765     enable_lpsolve=no
766     enable_report_builder=no
767     enable_odk=no
768     enable_postgresql_sdbc=no
769     enable_python=no
770     with_theme="tango"
771     test_cups=no
772     test_dbus=no
773     test_fontconfig=no
774     test_freetype=no
775     test_gtk=no
776     test_kde4=no
777     test_kde5=no
778     test_qt5=no
779     test_gtk3_kde5=no
780     test_randr=no
781     test_xrender=no
782     _os=Android
784     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
785     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
786     ;;
788 haiku*)
789     test_cups=no
790     test_dbus=no
791     test_randr=no
792     test_xrender=no
793     test_freetype=yes
794     enable_java=no
795     enable_opengl=no
796     enable_odk=no
797     enable_gconf=no
798     enable_gnome_vfs=no
799     enable_gstreamer=no
800     enable_vlc=no
801     enable_gltf=no
802     enable_collada=no
803     enable_coinmp=no
804     enable_pdfium=no
805     enable_postgresql_sdbc=no
806     enable_firebird_sdbc=no
807     _os=Haiku
808     ;;
811     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
812     ;;
813 esac
815 if test "$_os" = "Android" ; then
816     # Verify that the NDK and SDK options are proper
817     if test -z "$with_android_ndk"; then
818         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
819     elif test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
820         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
821     fi
823     if test -z "$ANDROID_SDK_HOME"; then
824         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
825     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
826         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
827     fi
829     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
830     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
831         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
832                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
833                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
834         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
835         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
836         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
837     fi
838     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
839         AC_MSG_WARN([android support repository not found - install with
840                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
841                      to allow the build to download the specified version of the android support libraries])
842         add_warning "android support repository not found - install with"
843         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
844         add_warning "to allow the build to download the specified version of the android support libraries"
845     fi
848 if test "$_os" = "AIX"; then
849     AC_PATH_PROG(GAWK, gawk)
850     if test -z "$GAWK"; then
851         AC_MSG_ERROR([gawk not found in \$PATH])
852     fi
855 AC_SUBST(SDKDIRNAME)
857 AC_SUBST(PTHREAD_CFLAGS)
858 AC_SUBST(PTHREAD_LIBS)
860 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
861 # By default use the ones specified by our build system,
862 # but explicit override is possible.
863 AC_MSG_CHECKING(for explicit AFLAGS)
864 if test -n "$AFLAGS"; then
865     AC_MSG_RESULT([$AFLAGS])
866     x_AFLAGS=
867 else
868     AC_MSG_RESULT(no)
869     x_AFLAGS=[\#]
871 AC_MSG_CHECKING(for explicit CFLAGS)
872 if test -n "$CFLAGS"; then
873     AC_MSG_RESULT([$CFLAGS])
874     x_CFLAGS=
875 else
876     AC_MSG_RESULT(no)
877     x_CFLAGS=[\#]
879 AC_MSG_CHECKING(for explicit CXXFLAGS)
880 if test -n "$CXXFLAGS"; then
881     AC_MSG_RESULT([$CXXFLAGS])
882     x_CXXFLAGS=
883 else
884     AC_MSG_RESULT(no)
885     x_CXXFLAGS=[\#]
887 AC_MSG_CHECKING(for explicit OBJCFLAGS)
888 if test -n "$OBJCFLAGS"; then
889     AC_MSG_RESULT([$OBJCFLAGS])
890     x_OBJCFLAGS=
891 else
892     AC_MSG_RESULT(no)
893     x_OBJCFLAGS=[\#]
895 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
896 if test -n "$OBJCXXFLAGS"; then
897     AC_MSG_RESULT([$OBJCXXFLAGS])
898     x_OBJCXXFLAGS=
899 else
900     AC_MSG_RESULT(no)
901     x_OBJCXXFLAGS=[\#]
903 AC_MSG_CHECKING(for explicit LDFLAGS)
904 if test -n "$LDFLAGS"; then
905     AC_MSG_RESULT([$LDFLAGS])
906     x_LDFLAGS=
907 else
908     AC_MSG_RESULT(no)
909     x_LDFLAGS=[\#]
911 AC_SUBST(AFLAGS)
912 AC_SUBST(CFLAGS)
913 AC_SUBST(CXXFLAGS)
914 AC_SUBST(OBJCFLAGS)
915 AC_SUBST(OBJCXXFLAGS)
916 AC_SUBST(LDFLAGS)
917 AC_SUBST(x_AFLAGS)
918 AC_SUBST(x_CFLAGS)
919 AC_SUBST(x_CXXFLAGS)
920 AC_SUBST(x_OBJCFLAGS)
921 AC_SUBST(x_OBJCXXFLAGS)
922 AC_SUBST(x_LDFLAGS)
924 dnl These are potentially set for MSVC, in the code checking for UCRT below:
925 my_original_CFLAGS=$CFLAGS
926 my_original_CXXFLAGS=$CXXFLAGS
927 my_original_CPPFLAGS=$CPPFLAGS
929 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
930 dnl Needs to precede the AC_SEARCH_LIBS call below, which apparently calls
931 dnl AC_PROG_CC internally.
932 if test "$_os" != "WINNT"; then
933     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
934     save_CFLAGS=$CFLAGS
935     AC_PROG_CC
936     CFLAGS=$save_CFLAGS
939 if test $_os != "WINNT"; then
940     save_LIBS="$LIBS"
941     AC_SEARCH_LIBS([dlsym], [dl],
942         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
943         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
944     LIBS="$save_LIBS"
946 AC_SUBST(DLOPEN_LIBS)
948 ###############################################################################
949 # Extensions switches --enable/--disable
950 ###############################################################################
951 # By default these should be enabled unless having extra dependencies.
952 # If there is extra dependency over configure options then the enable should
953 # be automagic based on whether the requiring feature is enabled or not.
954 # All this options change anything only with --enable-extension-integration.
956 # The name of this option and its help string makes it sound as if
957 # extensions are built anyway, just not integrated in the installer,
958 # if you use --disable-extension-integration. Is that really the
959 # case?
961 AC_ARG_ENABLE(ios-simulator,
962     AS_HELP_STRING([--enable-ios-simulator],
963         [build i386 or x86_64 for ios simulator])
966 libo_FUZZ_ARG_ENABLE(extension-integration,
967     AS_HELP_STRING([--disable-extension-integration],
968         [Disable integration of the built extensions in the installer of the
969          product. Use this switch to disable the integration.])
972 AC_ARG_ENABLE(avmedia,
973     AS_HELP_STRING([--disable-avmedia],
974         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
977 AC_ARG_ENABLE(database-connectivity,
978     AS_HELP_STRING([--disable-database-connectivity],
979         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
982 # This doesn't mean not building (or "integrating") extensions
983 # (although it probably should; i.e. it should imply
984 # --disable-extension-integration I guess), it means not supporting
985 # any extension mechanism at all
986 libo_FUZZ_ARG_ENABLE(extensions,
987     AS_HELP_STRING([--disable-extensions],
988         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
991 AC_ARG_ENABLE(scripting,
992     AS_HELP_STRING([--disable-scripting],
993         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
996 # This is mainly for Android and iOS, but could potentially be used in some
997 # special case otherwise, too, so factored out as a separate setting
999 AC_ARG_ENABLE(dynamic-loading,
1000     AS_HELP_STRING([--disable-dynamic-loading],
1001         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1004 libo_FUZZ_ARG_ENABLE(ext-mariadb-connector,
1005     AS_HELP_STRING([--enable-ext-mariadb-connector],
1006         [Enable the build of the MariaDB/MySQL Connector extension.])
1009 libo_FUZZ_ARG_ENABLE(report-builder,
1010     AS_HELP_STRING([--disable-report-builder],
1011         [Disable the Report Builder.])
1014 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1015     AS_HELP_STRING([--enable-ext-wiki-publisher],
1016         [Enable the Wiki Publisher extension.])
1019 libo_FUZZ_ARG_ENABLE(lpsolve,
1020     AS_HELP_STRING([--disable-lpsolve],
1021         [Disable compilation of the lp solve solver ])
1023 libo_FUZZ_ARG_ENABLE(coinmp,
1024     AS_HELP_STRING([--disable-coinmp],
1025         [Disable compilation of the CoinMP solver ])
1028 libo_FUZZ_ARG_ENABLE(pdfimport,
1029     AS_HELP_STRING([--disable-pdfimport],
1030         [Disable building the PDF import feature.])
1033 libo_FUZZ_ARG_ENABLE(pdfium,
1034     AS_HELP_STRING([--disable-pdfium],
1035         [Disable building PDFium.])
1038 ###############################################################################
1040 dnl ---------- *** ----------
1042 libo_FUZZ_ARG_ENABLE(mergelibs,
1043     AS_HELP_STRING([--enable-mergelibs],
1044         [Merge several of the smaller libraries into one big, "merged", one.])
1047 libo_FUZZ_ARG_ENABLE(breakpad,
1048     AS_HELP_STRING([--enable-breakpad],
1049         [Enables breakpad for crash reporting.])
1052 AC_ARG_ENABLE(fetch-external,
1053     AS_HELP_STRING([--disable-fetch-external],
1054         [Disables fetching external tarballs from web sources.])
1057 AC_ARG_ENABLE(fuzzers,
1058     AS_HELP_STRING([--enable-fuzzers],
1059         [Enables building libfuzzer targets for fuzz testing.])
1062 libo_FUZZ_ARG_ENABLE(pch,
1063     AS_HELP_STRING([--enable-pch],
1064         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1067 libo_FUZZ_ARG_ENABLE(epm,
1068     AS_HELP_STRING([--enable-epm],
1069         [LibreOffice includes self-packaging code, that requires epm, however epm is
1070          useless for large scale package building.])
1073 libo_FUZZ_ARG_ENABLE(odk,
1074     AS_HELP_STRING([--disable-odk],
1075         [LibreOffice includes an ODK, office development kit which some packagers may
1076          wish to build without.])
1079 AC_ARG_ENABLE(mpl-subset,
1080     AS_HELP_STRING([--enable-mpl-subset],
1081         [Don't compile any pieces which are not MPL or more liberally licensed])
1084 libo_FUZZ_ARG_ENABLE(evolution2,
1085     AS_HELP_STRING([--enable-evolution2],
1086         [Allows the built-in evolution 2 addressbook connectivity build to be
1087          enabled.])
1090 AC_ARG_ENABLE(avahi,
1091     AS_HELP_STRING([--enable-avahi],
1092         [Determines whether to use Avahi to advertise Impress to remote controls.])
1095 libo_FUZZ_ARG_ENABLE(werror,
1096     AS_HELP_STRING([--enable-werror],
1097         [Turn warnings to errors. (Has no effect in modules where the treating
1098          of warnings as errors is disabled explicitly.)]),
1101 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1102     AS_HELP_STRING([--enable-assert-always-abort],
1103         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1106 libo_FUZZ_ARG_ENABLE(dbgutil,
1107     AS_HELP_STRING([--enable-dbgutil],
1108         [Provide debugging support from --enable-debug and include additional debugging
1109          utilities such as object counting or more expensive checks.
1110          This is the recommended option for developers.
1111          Note that this makes the build ABI incompatible, it is not possible to mix object
1112          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1114 libo_FUZZ_ARG_ENABLE(debug,
1115     AS_HELP_STRING([--enable-debug],
1116         [Include debugging information, disable compiler optimization and inlining plus
1117          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1119 libo_FUZZ_ARG_ENABLE(split-debug,
1120     AS_HELP_STRING([--enable-split-debug],
1121         [Uses split debug information (-gsplit-dwarf compile flag). Saves disk space and build time,
1122          but requires tools that support it (both build tools and debuggers).]))
1124 libo_FUZZ_ARG_ENABLE(gdb-index,
1125     AS_HELP_STRING([--enable-gdb-index],
1126         [Creates debug information in the gdb index format, which makes gdb start faster.
1127          Requires the gold or lld linker.]))
1129 libo_FUZZ_ARG_ENABLE(sal-log,
1130     AS_HELP_STRING([--enable-sal-log],
1131         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1133 AC_ARG_ENABLE(selective-debuginfo,
1134     AS_HELP_STRING([--enable-selective-debuginfo],
1135         [If --enable-debug or --enable-dbgutil is used, build debugging information
1136          (-g compiler flag) only for the specified gbuild build targets
1137          (where all means everything, - prepended means not to enable, / appended means
1138          everything in the directory; there is no ordering, more specific overrides
1139          more general, and disabling takes precedence).
1140          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1142 libo_FUZZ_ARG_ENABLE(symbols,
1143     AS_HELP_STRING([--enable-symbols],
1144         [Generate debug information.
1145          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1146          otherwise.]))
1148 libo_FUZZ_ARG_ENABLE(optimized,
1149     AS_HELP_STRING([--disable-optimized],
1150         [Whether to compile with optimization flags.
1151          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1152          otherwise.]))
1154 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1155     AS_HELP_STRING([--disable-runtime-optimizations],
1156         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1157          JVM JIT) that are known to interact badly with certain dynamic analysis
1158          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1159          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1160          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1162 AC_ARG_WITH(valgrind,
1163     AS_HELP_STRING([--with-valgrind],
1164         [Make availability of Valgrind headers a hard requirement.]))
1166 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1167     AS_HELP_STRING([--enable-compiler-plugins],
1168         [Enable compiler plugins that will perform additional checks during
1169          building. Enabled automatically by --enable-dbgutil.
1170          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1171 COMPILER_PLUGINS_DEBUG=
1172 if test "$enable_compiler_plugins" = debug; then
1173     enable_compiler_plugins=yes
1174     COMPILER_PLUGINS_DEBUG=TRUE
1177 libo_FUZZ_ARG_ENABLE(ooenv,
1178     AS_HELP_STRING([--disable-ooenv],
1179         [Disable ooenv for the instdir installation.]))
1181 libo_FUZZ_ARG_ENABLE(libnumbertext,
1182     AS_HELP_STRING([--disable-libnumbertext],
1183         [Disable use of numbertext external library.]))
1185 AC_ARG_ENABLE(lto,
1186     AS_HELP_STRING([--enable-lto],
1187         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1188          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1189          linker. For MSVC, this option is broken at the moment. This is experimental work
1190          in progress that shouldn't be used unless you are working on it.)]))
1192 AC_ARG_ENABLE(python,
1193     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1194         [Enables or disables Python support at run-time.
1195          Also specifies what Python to use. 'auto' is the default.
1196          'fully-internal' even forces the internal version for uses of Python
1197          during the build.]))
1199 libo_FUZZ_ARG_ENABLE(gtk,
1200     AS_HELP_STRING([--disable-gtk],
1201         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1202 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1204 libo_FUZZ_ARG_ENABLE(gtk3,
1205     AS_HELP_STRING([--disable-gtk3],
1206         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1207 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1209 AC_ARG_ENABLE(split-app-modules,
1210     AS_HELP_STRING([--enable-split-app-modules],
1211         [Split file lists for app modules, e.g. base, calc.
1212          Has effect only with make distro-pack-install]),
1215 AC_ARG_ENABLE(split-opt-features,
1216     AS_HELP_STRING([--enable-split-opt-features],
1217         [Split file lists for some optional features, e.g. pyuno, testtool.
1218          Has effect only with make distro-pack-install]),
1221 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1222     AS_HELP_STRING([--disable-cairo-canvas],
1223         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1226 libo_FUZZ_ARG_ENABLE(dbus,
1227     AS_HELP_STRING([--disable-dbus],
1228         [Determines whether to enable features that depend on dbus.
1229          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1230 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1232 libo_FUZZ_ARG_ENABLE(sdremote,
1233     AS_HELP_STRING([--disable-sdremote],
1234         [Determines whether to enable Impress remote control (i.e. the server component).]),
1235 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1237 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1238     AS_HELP_STRING([--disable-sdremote-bluetooth],
1239         [Determines whether to build sdremote with bluetooth support.
1240          Requires dbus on Linux.]))
1242 libo_FUZZ_ARG_ENABLE(gio,
1243     AS_HELP_STRING([--disable-gio],
1244         [Determines whether to use the GIO support.]),
1245 ,test "${enable_gio+set}" = set || enable_gio=yes)
1247 AC_ARG_ENABLE(kde4,
1248     AS_HELP_STRING([--enable-kde4],
1249         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1250          KDE4 are available.]),
1253 AC_ARG_ENABLE(qt5,
1254     AS_HELP_STRING([--enable-qt5],
1255         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1256          available.]),
1259 AC_ARG_ENABLE(kde5,
1260     AS_HELP_STRING([--enable-kde5],
1261         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1262          KF5 are available.]),
1265 AC_ARG_ENABLE(gtk3_kde5,
1266     AS_HELP_STRING([--enable-gtk3-kde5],
1267         [Determines whether to use Gtk3 vclplug with KDE file dialogs on
1268          platforms where Gtk3, Qt5 and Plasma is available.]),
1271 libo_FUZZ_ARG_ENABLE(gui,
1272     AS_HELP_STRING([--disable-gui],
1273         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1274          command-line option. Not related to LibreOffice Online functionality. Don't use
1275          unless you are certain you need to. Nobody will help you if you insist on trying
1276          this and run into problems.]),
1277 ,test "${enable_gui+set}" = set || enable_gui=yes)
1279 libo_FUZZ_ARG_ENABLE(randr,
1280     AS_HELP_STRING([--disable-randr],
1281         [Disable RandR support in the vcl project.]),
1282 ,test "${enable_randr+set}" = set || enable_randr=yes)
1284 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1285     AS_HELP_STRING([--disable-gstreamer-1-0],
1286         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1287 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1289 AC_ARG_ENABLE(gstreamer-0-10,
1290     AS_HELP_STRING([--enable-gstreamer-0-10],
1291         [Enable building with the gstreamer 0.10 avmedia backend.]),
1292 ,enable_gstreamer_0_10=no)
1294 libo_FUZZ_ARG_ENABLE(vlc,
1295     AS_HELP_STRING([--enable-vlc],
1296         [Enable building with the (experimental) VLC avmedia backend.]),
1297 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1299 libo_FUZZ_ARG_ENABLE(neon,
1300     AS_HELP_STRING([--disable-neon],
1301         [Disable neon and the compilation of webdav binding.]),
1304 libo_FUZZ_ARG_ENABLE([eot],
1305     [AS_HELP_STRING([--enable-eot],
1306         [Enable support for Embedded OpenType fonts.])],
1307 ,test "${enable_eot+set}" = set || enable_eot=no)
1309 libo_FUZZ_ARG_ENABLE(cve-tests,
1310     AS_HELP_STRING([--disable-cve-tests],
1311         [Prevent CVE tests to be executed]),
1314 libo_FUZZ_ARG_ENABLE(chart-tests,
1315     AS_HELP_STRING([--enable-chart-tests],
1316         [Executes chart XShape tests. In a perfect world these tests would be
1317          stable and everyone could run them, in reality it is best to run them
1318          only on a few machines that are known to work and maintained by people
1319          who can judge if a test failure is a regression or not.]),
1322 AC_ARG_ENABLE(build-unowinreg,
1323     AS_HELP_STRING([--enable-build-unowinreg],
1324         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1325          compiler is needed on Linux.]),
1328 AC_ARG_ENABLE(build-opensymbol,
1329     AS_HELP_STRING([--enable-build-opensymbol],
1330         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1331          fontforge installed.]),
1334 AC_ARG_ENABLE(dependency-tracking,
1335     AS_HELP_STRING([--enable-dependency-tracking],
1336         [Do not reject slow dependency extractors.])[
1337   --disable-dependency-tracking
1338                           Disables generation of dependency information.
1339                           Speed up one-time builds.],
1342 AC_ARG_ENABLE(icecream,
1343     AS_HELP_STRING([--enable-icecream],
1344         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1345          It defaults to /opt/icecream for the location of the icecream gcc/g++
1346          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1349 AC_ARG_ENABLE(ld,
1350     AS_HELP_STRING([--enable-ld=<linker>],
1351         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.]),
1354 libo_FUZZ_ARG_ENABLE(cups,
1355     AS_HELP_STRING([--disable-cups],
1356         [Do not build cups support.])
1359 AC_ARG_ENABLE(ccache,
1360     AS_HELP_STRING([--disable-ccache],
1361         [Do not try to use ccache automatically.
1362          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1363          CC/CXX are not yet set, and --enable-icecream is not given, we
1364          attempt to use ccache. --disable-ccache disables ccache completely.
1368 AC_ARG_ENABLE(64-bit,
1369     AS_HELP_STRING([--enable-64-bit],
1370         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1371          At the moment meaningful only for Windows.]), ,)
1373 libo_FUZZ_ARG_ENABLE(online-update,
1374     AS_HELP_STRING([--enable-online-update],
1375         [Enable the online update service that will check for new versions of
1376          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1377          If the value is "mar", the experimental Mozilla-like update will be
1378          enabled instead of the traditional update mechanism.]),
1381 AC_ARG_WITH(update-config,
1382     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1383                    [Path to the update config ini file]))
1385 libo_FUZZ_ARG_ENABLE(extension-update,
1386     AS_HELP_STRING([--disable-extension-update],
1387         [Disable possibility to update installed extensions.]),
1390 libo_FUZZ_ARG_ENABLE(release-build,
1391     AS_HELP_STRING([--enable-release-build],
1392         [Enable release build. Note that the "release build" choice is orthogonal to
1393          whether symbols are present, debug info is generated, or optimization
1394          is done.
1395          See http://wiki.documentfoundation.org/Development/DevBuild]),
1398 AC_ARG_ENABLE(windows-build-signing,
1399     AS_HELP_STRING([--enable-windows-build-signing],
1400         [Enable signing of windows binaries (*.exe, *.dll)]),
1403 AC_ARG_ENABLE(silent-msi,
1404     AS_HELP_STRING([--enable-silent-msi],
1405         [Enable MSI with LIMITUI=1 (silent install).]),
1408 AC_ARG_ENABLE(macosx-code-signing,
1409     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1410         [Sign executables, dylibs, frameworks and the app bundle. If you
1411          don't provide an identity the first suitable certificate
1412          in your keychain is used.]),
1415 AC_ARG_ENABLE(macosx-package-signing,
1416     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1417         [Create a .pkg suitable for uploading to the Mac App Store and sign
1418          it. If you don't provide an identity the first suitable certificate
1419          in your keychain is used.]),
1422 AC_ARG_ENABLE(macosx-sandbox,
1423     AS_HELP_STRING([--enable-macosx-sandbox],
1424         [Make the app bundle run in a sandbox. Requires code signing.
1425          Is required by apps distributed in the Mac App Store, and implies
1426          adherence to App Store rules.]),
1429 AC_ARG_WITH(macosx-bundle-identifier,
1430     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1431         [Define the OS X bundle identifier. Default is the somewhat weird
1432          org.libreoffice.script ("script", huh?).]),
1433 ,with_macosx_bundle_identifier=org.libreoffice.script)
1435 AC_ARG_WITH(product-name,
1436     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1437         [Define the product name. Default is AC_PACKAGE_NAME.]),
1438 ,with_product_name=$PRODUCTNAME)
1440 AC_ARG_WITH(package-version,
1441     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1442         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1445 libo_FUZZ_ARG_ENABLE(readonly-installset,
1446     AS_HELP_STRING([--enable-readonly-installset],
1447         [Prevents any attempts by LibreOffice to write into its installation. That means
1448          at least that no "system-wide" extensions can be added. Partly experimental work in
1449          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1452 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1453     AS_HELP_STRING([--disable-postgresql-sdbc],
1454         [Disable the build of the PostgreSQL-SDBC driver.])
1457 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1458     AS_HELP_STRING([--disable-lotuswordpro],
1459         [Disable the build of the Lotus Word Pro filter.]),
1460 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1462 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1463     AS_HELP_STRING([--disable-firebird-sdbc],
1464         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1465 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1467 AC_ARG_ENABLE(bogus-pkg-config,
1468     AS_HELP_STRING([--enable-bogus-pkg-config],
1469         [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.]),
1472 AC_ARG_ENABLE(openssl,
1473     AS_HELP_STRING([--disable-openssl],
1474         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1475          components will either use GNUTLS or NSS. Work in progress,
1476          use only if you are hacking on it.]),
1477 ,enable_openssl=yes)
1479 AC_ARG_ENABLE(library-bin-tar,
1480     AS_HELP_STRING([--enable-library-bin-tar],
1481         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1482         Some libraries can save their build result in a tarball
1483         stored in TARFILE_LOCATION. That binary tarball is
1484         uniquely identified by the source tarball,
1485         the content of the config_host.mk file and the content
1486         of the top-level directory in core for that library
1487         If this option is enabled, then if such a tarfile exist, it will be untarred
1488         instead of the source tarfile, and the build step will be skipped for that
1489         library.
1490         If a proper tarfile does not exist, then the normal source-based
1491         build is done for that library and a proper binary tarfile is created
1492         for the next time.]),
1495 AC_ARG_ENABLE(dconf,
1496     AS_HELP_STRING([--disable-dconf],
1497         [Disable the dconf configuration backend (enabled by default where
1498          available).]))
1500 libo_FUZZ_ARG_ENABLE(formula-logger,
1501     AS_HELP_STRING(
1502         [--enable-formula-logger],
1503         [Enable formula logger for logging formula calculation flow in Calc.]
1504     )
1507 dnl ===================================================================
1508 dnl Optional Packages (--with/without-)
1509 dnl ===================================================================
1511 AC_ARG_WITH(gcc-home,
1512     AS_HELP_STRING([--with-gcc-home],
1513         [Specify the location of gcc/g++ manually. This can be used in conjunction
1514          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1515          non-default path.]),
1518 AC_ARG_WITH(gnu-patch,
1519     AS_HELP_STRING([--with-gnu-patch],
1520         [Specify location of GNU patch on Solaris or FreeBSD.]),
1523 AC_ARG_WITH(build-platform-configure-options,
1524     AS_HELP_STRING([--with-build-platform-configure-options],
1525         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1528 AC_ARG_WITH(gnu-cp,
1529     AS_HELP_STRING([--with-gnu-cp],
1530         [Specify location of GNU cp on Solaris or FreeBSD.]),
1533 AC_ARG_WITH(external-tar,
1534     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1535         [Specify an absolute path of where to find (and store) tarfiles.]),
1536     TARFILE_LOCATION=$withval ,
1539 AC_ARG_WITH(referenced-git,
1540     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1541         [Specify another checkout directory to reference. This makes use of
1542                  git submodule update --reference, and saves a lot of diskspace
1543                  when having multiple trees side-by-side.]),
1544     GIT_REFERENCE_SRC=$withval ,
1547 AC_ARG_WITH(linked-git,
1548     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1549         [Specify a directory where the repositories of submodules are located.
1550          This uses a method similar to git-new-workdir to get submodules.]),
1551     GIT_LINK_SRC=$withval ,
1554 AC_ARG_WITH(galleries,
1555     AS_HELP_STRING([--with-galleries],
1556         [Specify how galleries should be built. It is possible either to
1557          build these internally from source ("build"),
1558          or to disable them ("no")]),
1561 AC_ARG_WITH(theme,
1562     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1563         [Choose which themes to include. By default those themes with an '*' are included.
1564          Possible choices: *breeze, *breeze_dark, *colibre, *elementary, *karasa_jaga, *sifr, *sifr_dark, *tango.]),
1567 libo_FUZZ_ARG_WITH(helppack-integration,
1568     AS_HELP_STRING([--without-helppack-integration],
1569         [It will not integrate the helppacks to the installer
1570          of the product. Please use this switch to use the online help
1571          or separate help packages.]),
1574 libo_FUZZ_ARG_WITH(fonts,
1575     AS_HELP_STRING([--without-fonts],
1576         [LibreOffice includes some third-party fonts to provide a reliable basis for
1577          help content, templates, samples, etc. When these fonts are already
1578          known to be available on the system then you should use this option.]),
1581 AC_ARG_WITH(epm,
1582     AS_HELP_STRING([--with-epm],
1583         [Decides which epm to use. Default is to use the one from the system if
1584          one is built. When either this is not there or you say =internal epm
1585          will be built.]),
1588 AC_ARG_WITH(package-format,
1589     AS_HELP_STRING([--with-package-format],
1590         [Specify package format(s) for LibreOffice installation sets. The
1591          implicit --without-package-format leads to no installation sets being
1592          generated. Possible values: aix, archive, bsd, deb, dmg,
1593          installed, msi, pkg, and rpm.
1594          Example: --with-package-format='deb rpm']),
1597 AC_ARG_WITH(tls,
1598     AS_HELP_STRING([--with-tls],
1599         [Decides which TLS/SSL and cryptographic implementations to use for
1600          LibreOffice's code. Notice that this doesn't apply for depending
1601          libraries like "neon", for example. Default is to use OpenSSL
1602          although NSS is also possible. Notice that selecting NSS restricts
1603          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1604          restrict by now the usage of NSS in LO's code. Possible values:
1605          openssl, nss. Example: --with-tls="nss"]),
1608 AC_ARG_WITH(system-libs,
1609     AS_HELP_STRING([--with-system-libs],
1610         [Use libraries already on system -- enables all --with-system-* flags.]),
1613 AC_ARG_WITH(system-bzip2,
1614     AS_HELP_STRING([--with-system-bzip2],
1615         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1616     [with_system_bzip2="$with_system_libs"])
1618 AC_ARG_WITH(system-headers,
1619     AS_HELP_STRING([--with-system-headers],
1620         [Use headers already on system -- enables all --with-system-* flags for
1621          external packages whose headers are the only entities used i.e.
1622          boost/odbc/sane-header(s).]),,
1623     [with_system_headers="$with_system_libs"])
1625 AC_ARG_WITH(system-jars,
1626     AS_HELP_STRING([--without-system-jars],
1627         [When building with --with-system-libs, also the needed jars are expected
1628          on the system. Use this to disable that]),,
1629     [with_system_jars="$with_system_libs"])
1631 AC_ARG_WITH(system-cairo,
1632     AS_HELP_STRING([--with-system-cairo],
1633         [Use cairo libraries already on system.  Happens automatically for
1634          (implicit) --enable-gtk and for --enable-gtk3.]))
1636 AC_ARG_WITH(system-epoxy,
1637     AS_HELP_STRING([--with-system-epoxy],
1638         [Use epoxy libraries already on system.  Happens automatically for
1639          --enable-gtk3.]),,
1640        [with_system_epoxy="$with_system_libs"])
1642 AC_ARG_WITH(myspell-dicts,
1643     AS_HELP_STRING([--with-myspell-dicts],
1644         [Adds myspell dictionaries to the LibreOffice installation set]),
1647 AC_ARG_WITH(system-dicts,
1648     AS_HELP_STRING([--without-system-dicts],
1649         [Do not use dictionaries from system paths.]),
1652 AC_ARG_WITH(external-dict-dir,
1653     AS_HELP_STRING([--with-external-dict-dir],
1654         [Specify external dictionary dir.]),
1657 AC_ARG_WITH(external-hyph-dir,
1658     AS_HELP_STRING([--with-external-hyph-dir],
1659         [Specify external hyphenation pattern dir.]),
1662 AC_ARG_WITH(external-thes-dir,
1663     AS_HELP_STRING([--with-external-thes-dir],
1664         [Specify external thesaurus dir.]),
1667 AC_ARG_WITH(system-zlib,
1668     AS_HELP_STRING([--with-system-zlib],
1669         [Use zlib already on system.]),,
1670     [with_system_zlib=auto])
1672 AC_ARG_WITH(system-jpeg,
1673     AS_HELP_STRING([--with-system-jpeg],
1674         [Use jpeg already on system.]),,
1675     [with_system_jpeg="$with_system_libs"])
1677 AC_ARG_WITH(system-clucene,
1678     AS_HELP_STRING([--with-system-clucene],
1679         [Use clucene already on system.]),,
1680     [with_system_clucene="$with_system_libs"])
1682 AC_ARG_WITH(system-expat,
1683     AS_HELP_STRING([--with-system-expat],
1684         [Use expat already on system.]),,
1685     [with_system_expat="$with_system_libs"])
1687 AC_ARG_WITH(system-libxml,
1688     AS_HELP_STRING([--with-system-libxml],
1689         [Use libxml/libxslt already on system.]),,
1690     [with_system_libxml=auto])
1692 AC_ARG_WITH(system-icu,
1693     AS_HELP_STRING([--with-system-icu],
1694         [Use icu already on system.]),,
1695     [with_system_icu="$with_system_libs"])
1697 AC_ARG_WITH(system-ucpp,
1698     AS_HELP_STRING([--with-system-ucpp],
1699         [Use ucpp already on system.]),,
1700     [])
1702 AC_ARG_WITH(system-openldap,
1703     AS_HELP_STRING([--with-system-openldap],
1704         [Use the OpenLDAP LDAP SDK already on system.]),,
1705     [with_system_openldap="$with_system_libs"])
1707 AC_ARG_WITH(system-poppler,
1708     AS_HELP_STRING([--with-system-poppler],
1709         [Use system poppler (only needed for PDF import).]),,
1710     [with_system_poppler="$with_system_libs"])
1712 AC_ARG_WITH(system-gpgmepp,
1713     AS_HELP_STRING([--with-system-gpgmepp],
1714         [Use gpgmepp already on system]),,
1715     [with_system_gpgmepp="$with_system_libs"])
1717 AC_ARG_WITH(system-apache-commons,
1718     AS_HELP_STRING([--with-system-apache-commons],
1719         [Use Apache commons libraries already on system.]),,
1720     [with_system_apache_commons="$with_system_jars"])
1722 AC_ARG_WITH(system-mariadb,
1723     AS_HELP_STRING([--with-system-mariadb],
1724         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1725          extension.]),,
1726     [with_system_mariadb="$with_system_libs"])
1728 AC_ARG_ENABLE(bundle-mariadb,
1729     AS_HELP_STRING([--enable-bundle-mariadb],
1730         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1733 AC_ARG_WITH(system-mysql-cppconn,
1734     AS_HELP_STRING([--with-system-mysql-cppconn],
1735         [Use MySQL C++ Connector libraries already on system.]),,
1736     [with_system_mysql_cppconn="$with_system_libs"])
1738 AC_ARG_WITH(system-postgresql,
1739     AS_HELP_STRING([--with-system-postgresql],
1740         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1741          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1742     [with_system_postgresql="$with_system_libs"])
1744 AC_ARG_WITH(libpq-path,
1745     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1746         [Use this PostgreSQL C interface (libpq) installation for building
1747          the PostgreSQL-SDBC extension.]),
1750 AC_ARG_WITH(system-firebird,
1751     AS_HELP_STRING([--with-system-firebird],
1752         [Use Firebird libraries already on system, for building the Firebird-SDBC
1753          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1754     [with_system_firebird="$with_system_libs"])
1756 AC_ARG_WITH(system-libtommath,
1757             AS_HELP_STRING([--with-system-libtommath],
1758                            [Use libtommath already on system]),,
1759             [with_system_libtommath="$with_system_libs"])
1761 AC_ARG_WITH(system-hsqldb,
1762     AS_HELP_STRING([--with-system-hsqldb],
1763         [Use hsqldb already on system.]))
1765 AC_ARG_WITH(hsqldb-jar,
1766     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1767         [Specify path to jarfile manually.]),
1768     HSQLDB_JAR=$withval)
1770 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1771     AS_HELP_STRING([--disable-scripting-beanshell],
1772         [Disable support for scripts in BeanShell.]),
1776 AC_ARG_WITH(system-beanshell,
1777     AS_HELP_STRING([--with-system-beanshell],
1778         [Use beanshell already on system.]),,
1779     [with_system_beanshell="$with_system_jars"])
1781 AC_ARG_WITH(beanshell-jar,
1782     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1783         [Specify path to jarfile manually.]),
1784     BSH_JAR=$withval)
1786 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1787     AS_HELP_STRING([--disable-scripting-javascript],
1788         [Disable support for scripts in JavaScript.]),
1792 AC_ARG_WITH(system-rhino,
1793     AS_HELP_STRING([--with-system-rhino],
1794         [Use rhino already on system.]),,)
1795 #    [with_system_rhino="$with_system_jars"])
1796 # Above is not used as we have different debug interface
1797 # patched into internal rhino. This code needs to be fixed
1798 # before we can enable it by default.
1800 AC_ARG_WITH(rhino-jar,
1801     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1802         [Specify path to jarfile manually.]),
1803     RHINO_JAR=$withval)
1805 AC_ARG_WITH(commons-logging-jar,
1806     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1807         [Specify path to jarfile manually.]),
1808     COMMONS_LOGGING_JAR=$withval)
1810 AC_ARG_WITH(system-jfreereport,
1811     AS_HELP_STRING([--with-system-jfreereport],
1812         [Use JFreeReport already on system.]),,
1813     [with_system_jfreereport="$with_system_jars"])
1815 AC_ARG_WITH(sac-jar,
1816     AS_HELP_STRING([--with-sac-jar=JARFILE],
1817         [Specify path to jarfile manually.]),
1818     SAC_JAR=$withval)
1820 AC_ARG_WITH(libxml-jar,
1821     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1822         [Specify path to jarfile manually.]),
1823     LIBXML_JAR=$withval)
1825 AC_ARG_WITH(flute-jar,
1826     AS_HELP_STRING([--with-flute-jar=JARFILE],
1827         [Specify path to jarfile manually.]),
1828     FLUTE_JAR=$withval)
1830 AC_ARG_WITH(jfreereport-jar,
1831     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1832         [Specify path to jarfile manually.]),
1833     JFREEREPORT_JAR=$withval)
1835 AC_ARG_WITH(liblayout-jar,
1836     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1837         [Specify path to jarfile manually.]),
1838     LIBLAYOUT_JAR=$withval)
1840 AC_ARG_WITH(libloader-jar,
1841     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1842         [Specify path to jarfile manually.]),
1843     LIBLOADER_JAR=$withval)
1845 AC_ARG_WITH(libformula-jar,
1846     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1847         [Specify path to jarfile manually.]),
1848     LIBFORMULA_JAR=$withval)
1850 AC_ARG_WITH(librepository-jar,
1851     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1852         [Specify path to jarfile manually.]),
1853     LIBREPOSITORY_JAR=$withval)
1855 AC_ARG_WITH(libfonts-jar,
1856     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1857         [Specify path to jarfile manually.]),
1858     LIBFONTS_JAR=$withval)
1860 AC_ARG_WITH(libserializer-jar,
1861     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1862         [Specify path to jarfile manually.]),
1863     LIBSERIALIZER_JAR=$withval)
1865 AC_ARG_WITH(libbase-jar,
1866     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1867         [Specify path to jarfile manually.]),
1868     LIBBASE_JAR=$withval)
1870 AC_ARG_WITH(system-odbc,
1871     AS_HELP_STRING([--with-system-odbc],
1872         [Use the odbc headers already on system.]),,
1873     [with_system_odbc="auto"])
1875 AC_ARG_WITH(system-sane,
1876     AS_HELP_STRING([--with-system-sane],
1877         [Use sane.h already on system.]),,
1878     [with_system_sane="$with_system_headers"])
1880 AC_ARG_WITH(system-bluez,
1881     AS_HELP_STRING([--with-system-bluez],
1882         [Use bluetooth.h already on system.]),,
1883     [with_system_bluez="$with_system_headers"])
1885 AC_ARG_WITH(system-curl,
1886     AS_HELP_STRING([--with-system-curl],
1887         [Use curl already on system.]),,
1888     [with_system_curl=auto])
1890 AC_ARG_WITH(system-boost,
1891     AS_HELP_STRING([--with-system-boost],
1892         [Use boost already on system.]),,
1893     [with_system_boost="$with_system_headers"])
1895 AC_ARG_WITH(system-glm,
1896     AS_HELP_STRING([--with-system-glm],
1897         [Use glm already on system.]),,
1898     [with_system_glm="$with_system_headers"])
1900 AC_ARG_WITH(system-hunspell,
1901     AS_HELP_STRING([--with-system-hunspell],
1902         [Use libhunspell already on system.]),,
1903     [with_system_hunspell="$with_system_libs"])
1905 AC_ARG_WITH(system-mythes,
1906     AS_HELP_STRING([--with-system-mythes],
1907         [Use mythes already on system.]),,
1908     [with_system_mythes="$with_system_libs"])
1910 AC_ARG_WITH(system-altlinuxhyph,
1911     AS_HELP_STRING([--with-system-altlinuxhyph],
1912         [Use ALTLinuxhyph already on system.]),,
1913     [with_system_altlinuxhyph="$with_system_libs"])
1915 AC_ARG_WITH(system-lpsolve,
1916     AS_HELP_STRING([--with-system-lpsolve],
1917         [Use lpsolve already on system.]),,
1918     [with_system_lpsolve="$with_system_libs"])
1920 AC_ARG_WITH(system-coinmp,
1921     AS_HELP_STRING([--with-system-coinmp],
1922         [Use CoinMP already on system.]),,
1923     [with_system_coinmp="$with_system_libs"])
1925 AC_ARG_WITH(system-liblangtag,
1926     AS_HELP_STRING([--with-system-liblangtag],
1927         [Use liblangtag library already on system.]),,
1928     [with_system_liblangtag="$with_system_libs"])
1930 AC_ARG_WITH(webdav,
1931     AS_HELP_STRING([--with-webdav],
1932         [Specify which library to use for webdav implementation.
1933          Possible values: "neon", "serf", "no". The default value is "neon".
1934          Example: --with-webdav="serf"]),
1935     WITH_WEBDAV=$withval,
1936     WITH_WEBDAV="neon")
1938 AC_ARG_WITH(linker-hash-style,
1939     AS_HELP_STRING([--with-linker-hash-style],
1940         [Use linker with --hash-style=<style> when linking shared objects.
1941          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1942          if supported on the build system, and "sysv" otherwise.]))
1944 AC_ARG_WITH(jdk-home,
1945     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1946         [If you have installed JDK 1.6 or later on your system please supply the
1947          path here. Note that this is not the location of the java command but the
1948          location of the entire distribution.]),
1951 AC_ARG_WITH(help,
1952     AS_HELP_STRING([--with-help],
1953         [Enable the build of help. There is a special parameter "common" that
1954          can be used to bundle only the common part, .e.g help-specific icons.
1955          This is useful when you build the helpcontent separately.])
1956     [
1957                           Usage:     --with-help    build the old local help
1958                                  --without-help     no local help (default)
1959                                  --with-help=html   build the new HTML local help
1960                                  --with-help=online build the new HTML online help
1961     ],
1964 libo_FUZZ_ARG_WITH(java,
1965     AS_HELP_STRING([--with-java=<java command>],
1966         [Specify the name of the Java interpreter command. Typically "java"
1967          which is the default.
1969          To build without support for Java components, applets, accessibility
1970          or the XML filters written in Java, use --without-java or --with-java=no.]),
1971     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1972     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
1975 AC_ARG_WITH(jvm-path,
1976     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
1977         [Use a specific JVM search path at runtime.
1978          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
1981 AC_ARG_WITH(ant-home,
1982     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
1983         [If you have installed Jakarta Ant on your system, please supply the path here.
1984          Note that this is not the location of the Ant binary but the location
1985          of the entire distribution.]),
1988 AC_ARG_WITH(symbol-config,
1989     AS_HELP_STRING([--with-symbol-config],
1990         [Configuration for the crashreport symbol upload]),
1991         [],
1992         [with_symbol_config=no])
1994 AC_ARG_WITH(export-validation,
1995     AS_HELP_STRING([--without-export-validation],
1996         [Disable validating OOXML and ODF files as exported from in-tree tests.
1997          Use this option e.g. if your system only provides Java 5.]),
1998 ,with_export_validation=auto)
2000 AC_ARG_WITH(bffvalidator,
2001     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2002         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2003          Requires installed Microsoft Office Binary File Format Validator.
2004          Note: export-validation (--with-export-validation) is required to be turned on.
2005          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2006 ,with_bffvalidator=no)
2008 libo_FUZZ_ARG_WITH(junit,
2009     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2010         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2011          --without-junit disables those tests. Not relevant in the --without-java case.]),
2012 ,with_junit=yes)
2014 AC_ARG_WITH(hamcrest,
2015     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2016         [Specifies the hamcrest jar file to use for JUnit-based tests.
2017          --without-junit disables those tests. Not relevant in the --without-java case.]),
2018 ,with_hamcrest=yes)
2020 AC_ARG_WITH(perl-home,
2021     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2022         [If you have installed Perl 5 Distribution, on your system, please
2023          supply the path here. Note that this is not the location of the Perl
2024          binary but the location of the entire distribution.]),
2027 libo_FUZZ_ARG_WITH(doxygen,
2028     AS_HELP_STRING(
2029         [--with-doxygen=<absolute path to doxygen executable>],
2030         [Specifies the doxygen executable to use when generating ODK C/C++
2031          documentation. --without-doxygen disables generation of ODK C/C++
2032          documentation. Not relevant in the --disable-odk case.]),
2033 ,with_doxygen=yes)
2035 AC_ARG_WITH(visual-studio,
2036     AS_HELP_STRING([--with-visual-studio=<2017>],
2037         [Specify which Visual Studio version to use in case several are
2038          installed. Currently only 2017 is supported.]),
2041 AC_ARG_WITH(windows-sdk,
2042     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
2043         [Specify which Windows SDK, or "Windows Kit", version to use
2044          in case the one that came with the selected Visual Studio
2045          is not what you want for some reason. Note that not all compiler/SDK
2046          combinations are supported. The intent is that this option should not
2047          be needed.]),
2050 AC_ARG_WITH(lang,
2051     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2052         [Use this option to build LibreOffice with additional UI language support.
2053          English (US) is always included by default.
2054          Separate multiple languages with space.
2055          For all languages, use --with-lang=ALL.]),
2058 AC_ARG_WITH(locales,
2059     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2060         [Use this option to limit the locale information built in.
2061          Separate multiple locales with space.
2062          Very experimental and might well break stuff.
2063          Just a desperate measure to shrink code and data size.
2064          By default all the locales available is included.
2065          This option is completely unrelated to --with-lang.])
2066     [
2067                           Affects also our character encoding conversion
2068                           tables for encodings mainly targeted for a
2069                           particular locale, like EUC-CN and EUC-TW for
2070                           zh, ISO-2022-JP for ja.
2072                           Affects also our add-on break iterator data for
2073                           some languages.
2075                           For the default, all locales, don't use this switch at all.
2076                           Specifying just the language part of a locale means all matching
2077                           locales will be included.
2078     ],
2081 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2082 libo_FUZZ_ARG_WITH(krb5,
2083     AS_HELP_STRING([--with-krb5],
2084         [Enable MIT Kerberos 5 support in modules that support it.
2085          By default automatically enabled on platforms
2086          where a good system Kerberos 5 is available.]),
2089 libo_FUZZ_ARG_WITH(gssapi,
2090     AS_HELP_STRING([--with-gssapi],
2091         [Enable GSSAPI support in modules that support it.
2092          By default automatically enabled on platforms
2093          where a good system GSSAPI is available.]),
2096 AC_ARG_WITH(iwyu,
2097     AS_HELP_STRING([--with-iwyu],
2098         [Use given IWYU binary path to check unneeded includes instead of building.
2099          Use only if you are hacking on it.]),
2102 libo_FUZZ_ARG_WITH(lxml,
2103     AS_HELP_STRING([--without-lxml],
2104         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2105          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2106          report widget classes and ids.]),
2109 dnl ===================================================================
2110 dnl Branding
2111 dnl ===================================================================
2113 AC_ARG_WITH(branding,
2114     AS_HELP_STRING([--with-branding=/path/to/images],
2115         [Use given path to retrieve branding images set.])
2116     [
2117                           Search for intro.png about.svg and flat_logo.svg.
2118                           If any is missing, default ones will be used instead.
2120                           Search also progress.conf for progress
2121                           settings on intro screen :
2123                           PROGRESSBARCOLOR="255,255,255" Set color of
2124                           progress bar. Comma separated RGB decimal values.
2125                           PROGRESSSIZE="407,6" Set size of progress bar.
2126                           Comma separated decimal values (width, height).
2127                           PROGRESSPOSITION="61,317" Set position of progress
2128                           bar from left,top. Comma separated decimal values.
2129                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2130                           bar frame. Comma separated RGB decimal values.
2131                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2132                           bar text. Comma separated RGB decimal values.
2133                           PROGRESSTEXTBASELINE="287" Set vertical position of
2134                           progress bar text from top. Decimal value.
2136                           Default values will be used if not found.
2137     ],
2141 AC_ARG_WITH(extra-buildid,
2142     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2143         [Show addition build identification in about dialog.]),
2147 AC_ARG_WITH(vendor,
2148     AS_HELP_STRING([--with-vendor="John the Builder"],
2149         [Set vendor of the build.]),
2152 AC_ARG_WITH(android-package-name,
2153     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2154         [Set Android package name of the build.]),
2157 AC_ARG_WITH(compat-oowrappers,
2158     AS_HELP_STRING([--with-compat-oowrappers],
2159         [Install oo* wrappers in parallel with
2160          lo* ones to keep backward compatibility.
2161          Has effect only with make distro-pack-install]),
2164 AC_ARG_WITH(os-version,
2165     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2166         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2169 AC_ARG_WITH(mingw-cross-compiler,
2170     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2171         [Specify the MinGW cross-compiler to use.
2172          When building on the ODK on Unix and building unowinreg.dll,
2173          specify the MinGW C++ cross-compiler.]),
2176 AC_ARG_WITH(idlc-cpp,
2177     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2178         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2181 AC_ARG_WITH(build-version,
2182     AS_HELP_STRING([--with-build-version="Built by Jim"],
2183         [Allows the builder to add a custom version tag that will appear in the
2184          Help/About box for QA purposes.]),
2185 with_build_version=$withval,
2188 AC_ARG_WITH(alloc,
2189     AS_HELP_STRING([--with-alloc],
2190         [Define which allocator to build with (choices are internal, system).]),
2193 AC_ARG_WITH(parallelism,
2194     AS_HELP_STRING([--with-parallelism],
2195         [Number of jobs to run simultaneously during build. Parallel builds can
2196         save a lot of time on multi-cpu machines. Defaults to the number of
2197         CPUs on the machine, unless you configure --enable-icecream - then to
2198         10.]),
2201 AC_ARG_WITH(all-tarballs,
2202     AS_HELP_STRING([--with-all-tarballs],
2203         [Download all external tarballs unconditionally]))
2205 AC_ARG_WITH(gdrive-client-id,
2206     AS_HELP_STRING([--with-gdrive-client-id],
2207         [Provides the client id of the application for OAuth2 authentication
2208         on Google Drive. If either this or --with-gdrive-client-secret is
2209         empty, the feature will be disabled]),
2212 AC_ARG_WITH(gdrive-client-secret,
2213     AS_HELP_STRING([--with-gdrive-client-secret],
2214         [Provides the client secret of the application for OAuth2
2215         authentication on Google Drive. If either this or
2216         --with-gdrive-client-id is empty, the feature will be disabled]),
2219 AC_ARG_WITH(alfresco-cloud-client-id,
2220     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2221         [Provides the client id of the application for OAuth2 authentication
2222         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2223         empty, the feature will be disabled]),
2226 AC_ARG_WITH(alfresco-cloud-client-secret,
2227     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2228         [Provides the client secret of the application for OAuth2
2229         authentication on Alfresco Cloud. If either this or
2230         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2233 AC_ARG_WITH(onedrive-client-id,
2234     AS_HELP_STRING([--with-onedrive-client-id],
2235         [Provides the client id of the application for OAuth2 authentication
2236         on OneDrive. If either this or --with-onedrive-client-secret is
2237         empty, the feature will be disabled]),
2240 AC_ARG_WITH(onedrive-client-secret,
2241     AS_HELP_STRING([--with-onedrive-client-secret],
2242         [Provides the client secret of the application for OAuth2
2243         authentication on OneDrive. If either this or
2244         --with-onedrive-client-id is empty, the feature will be disabled]),
2246 dnl ===================================================================
2247 dnl Do we want to use pre-build binary tarball for recompile
2248 dnl ===================================================================
2250 if test "$enable_library_bin_tar" = "yes" ; then
2251     USE_LIBRARY_BIN_TAR=TRUE
2252 else
2253     USE_LIBRARY_BIN_TAR=
2255 AC_SUBST(USE_LIBRARY_BIN_TAR)
2257 dnl ===================================================================
2258 dnl Test whether build target is Release Build
2259 dnl ===================================================================
2260 AC_MSG_CHECKING([whether build target is Release Build])
2261 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2262     AC_MSG_RESULT([no])
2263     ENABLE_RELEASE_BUILD=
2264 else
2265     AC_MSG_RESULT([yes])
2266     ENABLE_RELEASE_BUILD=TRUE
2268 AC_SUBST(ENABLE_RELEASE_BUILD)
2270 dnl ===================================================================
2271 dnl Test whether to sign Windows Build
2272 dnl ===================================================================
2273 AC_MSG_CHECKING([whether to sign windows build])
2274 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2275     AC_MSG_RESULT([yes])
2276     WINDOWS_BUILD_SIGNING="TRUE"
2277 else
2278     AC_MSG_RESULT([no])
2279     WINDOWS_BUILD_SIGNING="FALSE"
2281 AC_SUBST(WINDOWS_BUILD_SIGNING)
2283 dnl ===================================================================
2284 dnl MacOSX build and runtime environment options
2285 dnl ===================================================================
2287 AC_ARG_WITH(macosx-sdk,
2288     AS_HELP_STRING([--with-macosx-sdk=<version>],
2289         [Prefer a specific SDK for building.])
2290     [
2291                           If the requested SDK is not available, a search for the oldest one will be done.
2292                           With current Xcode versions, only the latest SDK is included, so this option is
2293                           not terribly useful. It works fine to build with a new SDK and run the result
2294                           on an older OS.
2296                           e. g.: --with-macosx-sdk=10.9
2298                           there are 3 options to control the MacOSX build:
2299                           --with-macosx-sdk (referred as 'sdk' below)
2300                           --with-macosx-version-min-required (referred as 'min' below)
2301                           --with-macosx-version-max-allowed (referred as 'max' below)
2303                           the connection between these value and the default they take is as follow:
2304                           ( ? means not specified on the command line, s means the SDK version found,
2305                           constraint: 8 <= x <= y <= z)
2307                           ==========================================
2308                            command line      || config result
2309                           ==========================================
2310                           min  | max  | sdk  || min  | max  | sdk  |
2311                           ?    | ?    | ?    || 10.9 | 10.s | 10.s |
2312                           ?    | ?    | 10.x || 10.9 | 10.x | 10.x |
2313                           ?    | 10.x | ?    || 10.9 | 10.s | 10.s |
2314                           ?    | 10.x | 10.y || 10.9 | 10.x | 10.y |
2315                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2316                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2317                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2318                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2321                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2322                           for a detailed technical explanation of these variables
2324                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2325     ],
2328 AC_ARG_WITH(macosx-version-min-required,
2329     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2330         [set the minimum OS version needed to run the built LibreOffice])
2331     [
2332                           e. g.: --with-macos-version-min-required=10.9
2333                           see --with-macosx-sdk for more info
2334     ],
2337 AC_ARG_WITH(macosx-version-max-allowed,
2338     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2339         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2340     [
2341                           e. g.: --with-macos-version-max-allowed=10.9
2342                           see --with-macosx-sdk for more info
2343     ],
2347 dnl ===================================================================
2348 dnl options for stuff used during cross-compilation build
2349 dnl Not quite superseded by --with-build-platform-configure-options.
2350 dnl TODO: check, if the "force" option is still needed anywhere.
2351 dnl ===================================================================
2353 AC_ARG_WITH(system-icu-for-build,
2354     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2355         [Use icu already on system for build tools (cross-compilation only).]))
2358 dnl ===================================================================
2359 dnl Check for incompatible options set by fuzzing, and reset those
2360 dnl automatically to working combinations
2361 dnl ===================================================================
2363 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2364         "$enable_dbus" != "$enable_avahi"; then
2365     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2366     enable_avahi=$enable_dbus
2369 dnl ===================================================================
2370 dnl check for required programs (grep, awk, sed, bash)
2371 dnl ===================================================================
2373 pathmunge ()
2375     if test -n "$1"; then
2376         if test "$build_os" = "cygwin"; then
2377             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2378                 PathFormat "$1"
2379                 new_path=`cygpath -sm "$formatted_path"`
2380             else
2381                 PathFormat "$1"
2382                 new_path=`cygpath -u "$formatted_path"`
2383             fi
2384         else
2385             new_path="$1"
2386         fi
2387         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2388             if test "$2" = "after"; then
2389                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2390             else
2391                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2392             fi
2393         fi
2394         unset new_path
2395     fi
2398 AC_PROG_AWK
2399 AC_PATH_PROG( AWK, $AWK)
2400 if test -z "$AWK"; then
2401     AC_MSG_ERROR([install awk to run this script])
2404 AC_PATH_PROG(BASH, bash)
2405 if test -z "$BASH"; then
2406     AC_MSG_ERROR([bash not found in \$PATH])
2408 AC_SUBST(BASH)
2410 AC_MSG_CHECKING([for GNU or BSD tar])
2411 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2412     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2413     if test $? -eq 0;  then
2414         GNUTAR=$a
2415         break
2416     fi
2417 done
2418 AC_MSG_RESULT($GNUTAR)
2419 if test -z "$GNUTAR"; then
2420     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2422 AC_SUBST(GNUTAR)
2424 AC_MSG_CHECKING([for tar's option to strip components])
2425 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2426 if test $? -eq 0; then
2427     STRIP_COMPONENTS="--strip-components"
2428 else
2429     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2430     if test $? -eq 0; then
2431         STRIP_COMPONENTS="--strip-path"
2432     else
2433         STRIP_COMPONENTS="unsupported"
2434     fi
2436 AC_MSG_RESULT($STRIP_COMPONENTS)
2437 if test x$STRIP_COMPONENTS = xunsupported; then
2438     AC_MSG_ERROR([you need a tar that is able to strip components.])
2440 AC_SUBST(STRIP_COMPONENTS)
2442 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2443 dnl desktop OSes from "mobile" ones.
2445 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2446 dnl In other words, that when building for an OS that is not a
2447 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2449 dnl Note the direction of the implication; there is no assumption that
2450 dnl cross-compiling would imply a non-desktop OS.
2452 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2453     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2454     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2455     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2458 # Whether to build "avmedia" functionality or not.
2460 if test -z "$enable_avmedia"; then
2461     enable_avmedia=yes
2464 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2465 if test "$enable_avmedia" = yes; then
2466     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2467 else
2468     USE_AVMEDIA_DUMMY='TRUE'
2470 AC_SUBST(USE_AVMEDIA_DUMMY)
2472 # Decide whether to build database connectivity stuff (including
2473 # Base) or not. We probably don't want to on non-desktop OSes.
2474 if test -z "$enable_database_connectivity"; then
2475     # --disable-database-connectivity is unfinished work in progress
2476     # and the iOS test app doesn't link if we actually try to use it.
2477     # if test $_os != iOS -a $_os != Android; then
2478     if test $_os != iOS; then
2479         enable_database_connectivity=yes
2480     fi
2483 if test "$enable_database_connectivity" = yes; then
2484     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2485     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2488 if test -z "$enable_extensions"; then
2489     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2490     if test $_os != iOS -a $_os != Android; then
2491         enable_extensions=yes
2492     fi
2495 if test "$enable_extensions" = yes; then
2496     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2497     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2500 if test -z "$enable_scripting"; then
2501     # Disable scripting for iOS unless specifically overridden
2502     # with --enable-scripting.
2503     if test $_os != iOS; then
2504         enable_scripting=yes
2505     fi
2508 DISABLE_SCRIPTING=''
2509 if test "$enable_scripting" = yes; then
2510     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2511     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2512 else
2513     DISABLE_SCRIPTING='TRUE'
2514     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2517 if test $_os = iOS -o $_os = Android; then
2518     # Disable dynamic_loading always for iOS and Android
2519     enable_dynamic_loading=no
2520 elif test -z "$enable_dynamic_loading"; then
2521     # Otherwise enable it unless speficically disabled
2522     enable_dynamic_loading=yes
2525 DISABLE_DYNLOADING=''
2526 if test "$enable_dynamic_loading" = yes; then
2527     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2528 else
2529     DISABLE_DYNLOADING='TRUE'
2531 AC_SUBST(DISABLE_DYNLOADING)
2533 # remenber SYSBASE value
2534 AC_SUBST(SYSBASE)
2536 dnl ===================================================================
2537 dnl  Sort out various gallery compilation options
2538 dnl ===================================================================
2539 AC_MSG_CHECKING([how to build and package galleries])
2540 if test -n "${with_galleries}"; then
2541     if test "$with_galleries" = "build"; then
2542         WITH_GALLERY_BUILD=TRUE
2543         AC_MSG_RESULT([build from source images internally])
2544     elif test "$with_galleries" = "no"; then
2545         WITH_GALLERY_BUILD=
2546         AC_MSG_RESULT([disable non-internal gallery build])
2547     else
2548         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2549     fi
2550 else
2551     if test $_os != iOS -a $_os != Android; then
2552         WITH_GALLERY_BUILD=TRUE
2553         AC_MSG_RESULT([internal src images for desktop])
2554     else
2555         WITH_GALLERY_BUILD=
2556         AC_MSG_RESULT([disable src image build])
2557     fi
2559 AC_SUBST(WITH_GALLERY_BUILD)
2561 dnl ===================================================================
2562 dnl  Checks if ccache is available
2563 dnl ===================================================================
2564 if test "$_os" = "WINNT"; then
2565     # on windows/VC build do not use ccache
2566     CCACHE=""
2567 elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2568     case "%$CC%$CXX%" in
2569     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2570     # assume that's good then
2571     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2572         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2573         ;;
2574     *)
2575         AC_PATH_PROG([CCACHE],[ccache],[not found])
2576         if test "$CCACHE" = "not found"; then
2577             CCACHE=""
2578         else
2579             # Need to check for ccache version: otherwise prevents
2580             # caching of the results (like "-x objective-c++" for Mac)
2581             if test $_os = Darwin -o $_os = iOS; then
2582                 # Check ccache version
2583                 AC_MSG_CHECKING([whether version of ccache is suitable])
2584                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2585                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2586                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2587                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2588                 else
2589                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2590                     CCACHE=""
2591                 fi
2592             fi
2593         fi
2594         ;;
2595     esac
2596 else
2597     CCACHE=""
2600 if test "$CCACHE" != ""; then
2601     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2602     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2603     if test "$ccache_size" = ""; then
2604         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2605         if test "$ccache_size" = ""; then
2606             ccache_size=0
2607         fi
2608         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2609         if test $ccache_size -lt 1024; then
2610             CCACHE=""
2611             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2612             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2613         else
2614             # warn that ccache may be too small for debug build
2615             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2616             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2617         fi
2618     else
2619         if test $ccache_size -lt 5; then
2620             #warn that ccache may be too small for debug build
2621             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2622             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2623         fi
2624     fi
2627 dnl ===================================================================
2628 dnl  Checks for C compiler,
2629 dnl  The check for the C++ compiler is later on.
2630 dnl ===================================================================
2631 if test "$_os" != "WINNT"; then
2632     GCC_HOME_SET="true"
2633     AC_MSG_CHECKING([gcc home])
2634     if test -z "$with_gcc_home"; then
2635         if test "$enable_icecream" = "yes"; then
2636             if test -d "/usr/lib/icecc/bin"; then
2637                 GCC_HOME="/usr/lib/icecc/"
2638             elif test -d "/usr/libexec/icecc/bin"; then
2639                 GCC_HOME="/usr/libexec/icecc/"
2640             elif test -d "/opt/icecream/bin"; then
2641                 GCC_HOME="/opt/icecream/"
2642             else
2643                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2645             fi
2646         else
2647             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2648             GCC_HOME_SET="false"
2649         fi
2650     else
2651         GCC_HOME="$with_gcc_home"
2652     fi
2653     AC_MSG_RESULT($GCC_HOME)
2654     AC_SUBST(GCC_HOME)
2656     if test "$GCC_HOME_SET" = "true"; then
2657         if test -z "$CC"; then
2658             CC="$GCC_HOME/bin/gcc"
2659         fi
2660         if test -z "$CXX"; then
2661             CXX="$GCC_HOME/bin/g++"
2662         fi
2663     fi
2666 COMPATH=`dirname "$CC"`
2667 if test "$COMPATH" = "."; then
2668     AC_PATH_PROGS(COMPATH, $CC)
2669     dnl double square bracket to get single because of M4 quote...
2670     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2672 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2674 dnl ===================================================================
2675 dnl Java support
2676 dnl ===================================================================
2677 AC_MSG_CHECKING([whether to build with Java support])
2678 if test "$with_java" != "no"; then
2679     if test "$DISABLE_SCRIPTING" = TRUE; then
2680         AC_MSG_RESULT([no, overridden by --disable-scripting])
2681         ENABLE_JAVA=""
2682         with_java=no
2683     else
2684         AC_MSG_RESULT([yes])
2685         ENABLE_JAVA="TRUE"
2686         AC_DEFINE(HAVE_FEATURE_JAVA)
2687     fi
2688 else
2689     AC_MSG_RESULT([no])
2690     ENABLE_JAVA=""
2693 AC_SUBST(ENABLE_JAVA)
2695 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2697 dnl ENABLE_JAVA="" indicate no Java support at all
2699 dnl ===================================================================
2700 dnl Check OS X SDK and compiler
2701 dnl ===================================================================
2703 if test $_os = Darwin -o $_os = iOS; then
2705     # If no --with-macosx-sdk option is given, look for one
2707     # The intent is that for "most" Mac-based developers, a suitable
2708     # SDK will be found automatically without any configure options.
2710     # For developers with a current Xcode, the lowest-numbered SDK
2711     # higher than or equal to the minimum required should be found.
2713     AC_MSG_CHECKING([what Mac OS X SDK to use])
2714     for _macosx_sdk in $with_macosx_sdk 10.13 10.12; do
2715         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2716         if test -d "$MACOSX_SDK_PATH"; then
2717             with_macosx_sdk="${_macosx_sdk}"
2718             break
2719         else
2720             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2721             if test -d "$MACOSX_SDK_PATH"; then
2722                 with_macosx_sdk="${_macosx_sdk}"
2723                 break
2724             fi
2725         fi
2726     done
2727     if test ! -d "$MACOSX_SDK_PATH"; then
2728         AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2729     fi
2731     if test $_os = iOS; then
2732         if test "$enable_ios_simulator" = "yes"; then
2733             useos=iphonesimulator
2734         else
2735             useos=iphoneos
2736         fi
2737         MACOSX_SDK_PATH=`xcrun --sdk ${useos} --show-sdk-path 2> /dev/null`
2738     fi
2739     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2742     case $with_macosx_sdk in
2743     10.9)
2744         MACOSX_SDK_VERSION=1090
2745         ;;
2746     10.10)
2747         MACOSX_SDK_VERSION=101000
2748         ;;
2749     10.11)
2750         MACOSX_SDK_VERSION=101100
2751         ;;
2752     10.12)
2753         MACOSX_SDK_VERSION=101200
2754         ;;
2755     10.13)
2756         MACOSX_SDK_VERSION=101300
2757         ;;
2758     *)
2759         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.9--13])
2760         ;;
2761     esac
2763     if test "$with_macosx_version_min_required" = "" ; then
2764         with_macosx_version_min_required="10.9";
2765     fi
2767     if test "$with_macosx_version_max_allowed" = "" ; then
2768         with_macosx_version_max_allowed="$with_macosx_sdk"
2769     fi
2771     # export this so that "xcrun" invocations later return matching values
2772     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2773     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2774     export DEVELOPER_DIR
2775     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2776     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2778     case "$with_macosx_version_min_required" in
2779     10.9)
2780         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2781         ;;
2782     10.10)
2783         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2784         ;;
2785     10.11)
2786         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2787         ;;
2788     10.12)
2789         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2790         ;;
2791     10.13)
2792         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2793         ;;
2794     *)
2795         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.9--13])
2796         ;;
2797     esac
2798     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2800     LIBTOOL=/usr/bin/libtool
2801     INSTALL_NAME_TOOL=install_name_tool
2802     if test -z "$save_CC"; then
2803         AC_MSG_CHECKING([what compiler to use])
2804         stdlib=-stdlib=libc++
2805         if test "$ENABLE_LTO" = TRUE; then
2806             lto=-flto
2807         fi
2808         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2809         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2810         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2811         AR=`xcrun -find ar`
2812         NM=`xcrun -find nm`
2813         STRIP=`xcrun -find strip`
2814         LIBTOOL=`xcrun -find libtool`
2815         RANLIB=`xcrun -find ranlib`
2816         AC_MSG_RESULT([$CC and $CXX])
2817     fi
2819     case "$with_macosx_version_max_allowed" in
2820     10.9)
2821         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2822         ;;
2823     10.10)
2824         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2825         ;;
2826     10.11)
2827         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2828         ;;
2829     10.12)
2830         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2831         ;;
2832     10.13)
2833         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2834         ;;
2835     *)
2836         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.9--13])
2837         ;;
2838     esac
2840     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2841     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2842         AC_MSG_RESULT([$MAC_OS_X_VERSION_MIN_REQUIRED])
2843         AC_MSG_RESULT([$MAC_OS_X_VERSION_MAX_REQUIRED])
2844         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2845     else
2846         AC_MSG_RESULT([ok])
2847     fi
2849     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2850     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2851         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2852     else
2853         AC_MSG_RESULT([ok])
2854     fi
2855     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2856     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2858     AC_MSG_CHECKING([whether to do code signing])
2860     if test "$enable_macosx_code_signing" = yes; then
2861         # By default use the first suitable certificate (?).
2863         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2864         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2865         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2866         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2867         # "Developer ID Application" one.
2869         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2870         if test -n "$identity"; then
2871             MACOSX_CODESIGNING_IDENTITY=$identity
2872             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2873             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2874         else
2875             AC_MSG_ERROR([cannot determine identity to use])
2876         fi
2877     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2878         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2879         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2880         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2881     else
2882         AC_MSG_RESULT([no])
2883     fi
2885     AC_MSG_CHECKING([whether to create a Mac App Store package])
2887     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2888         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2889     elif test "$enable_macosx_package_signing" = yes; then
2890         # By default use the first suitable certificate.
2891         # It should be a "3rd Party Mac Developer Installer" one
2893         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2894         if test -n "$identity"; then
2895             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2896             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2897             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2898         else
2899             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2900         fi
2901     elif test -n "$enable_macosx_package_signing"; then
2902         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2903         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2904         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2905     else
2906         AC_MSG_RESULT([no])
2907     fi
2909     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2910         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2911     fi
2913     AC_MSG_CHECKING([whether to sandbox the application])
2915     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2916         AC_MSG_ERROR([OS X sandboxing requires code signing])
2917     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2918         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2919     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2920         ENABLE_MACOSX_SANDBOX=TRUE
2921         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2922         AC_MSG_RESULT([yes])
2923     else
2924         AC_MSG_RESULT([no])
2925     fi
2927     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2928     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2929     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2931 AC_SUBST(MACOSX_SDK_PATH)
2932 AC_SUBST(MACOSX_SDK_VERSION)
2933 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2934 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2935 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
2936 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2937 AC_SUBST(INSTALL_NAME_TOOL)
2938 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2939 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2940 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2941 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2942 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2944 dnl ===================================================================
2945 dnl Check iOS SDK and compiler
2946 dnl ===================================================================
2948 if test $_os = iOS; then
2949     AC_MSG_CHECKING([what iOS SDK to use])
2950     current_sdk_ver=11.4
2951     if test "$enable_ios_simulator" = "yes"; then
2952         platform=iPhoneSimulator
2953         versionmin=-mios-simulator-version-min=$current_sdk_ver
2954     else
2955         platform=iPhoneOS
2956         versionmin=-miphoneos-version-min=$current_sdk_ver
2957     fi
2958     xcode_developer=`xcode-select -print-path`
2960     for sdkver in $current_sdk_ver; do
2961         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2962         if test -d $t; then
2963             ios_sdk=$sdkver
2964             sysroot=$t
2965             break
2966         fi
2967     done
2969     if test -z "$sysroot"; then
2970         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
2971     fi
2973     AC_MSG_RESULT($sysroot)
2975     IOS_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
2976     IOS_DEPLOYMENT_VERSION=$current_sdk_ver
2978     # LTO is not really recommended for iOS builds,
2979     # the link time will be astronomical
2980     if test "$ENABLE_LTO" = TRUE; then
2981         lto=-flto
2982     fi
2984     stdlib="-stdlib=libc++"
2986     CC="`xcrun -find clang` -arch $host_cpu -isysroot $sysroot $lto $versionmin"
2987     CXX="`xcrun -find clang++` -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
2989     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2990     AR=`xcrun -find ar`
2991     NM=`xcrun -find nm`
2992     STRIP=`xcrun -find strip`
2993     LIBTOOL=`xcrun -find libtool`
2994     RANLIB=`xcrun -find ranlib`
2997 AC_SUBST(IOS_SDK)
2998 AC_SUBST(IOS_DEPLOYMENT_VERSION)
3000 AC_MSG_CHECKING([whether to treat the installation as read-only])
3002 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3003         "$enable_extensions" != yes; then
3004     enable_readonly_installset=yes
3006 if test "$enable_readonly_installset" = yes; then
3007     AC_MSG_RESULT([yes])
3008     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3009 else
3010     AC_MSG_RESULT([no])
3013 dnl ===================================================================
3014 dnl Structure of install set
3015 dnl ===================================================================
3017 if test $_os = Darwin; then
3018     LIBO_BIN_FOLDER=MacOS
3019     LIBO_ETC_FOLDER=Resources
3020     LIBO_LIBEXEC_FOLDER=MacOS
3021     LIBO_LIB_FOLDER=Frameworks
3022     LIBO_LIB_PYUNO_FOLDER=Resources
3023     LIBO_SHARE_FOLDER=Resources
3024     LIBO_SHARE_HELP_FOLDER=Resources/help
3025     LIBO_SHARE_JAVA_FOLDER=Resources/java
3026     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3027     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3028     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3029     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3030     LIBO_URE_BIN_FOLDER=MacOS
3031     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3032     LIBO_URE_LIB_FOLDER=Frameworks
3033     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3034     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3035 elif test $_os = WINNT; then
3036     LIBO_BIN_FOLDER=program
3037     LIBO_ETC_FOLDER=program
3038     LIBO_LIBEXEC_FOLDER=program
3039     LIBO_LIB_FOLDER=program
3040     LIBO_LIB_PYUNO_FOLDER=program
3041     LIBO_SHARE_FOLDER=share
3042     LIBO_SHARE_HELP_FOLDER=help
3043     LIBO_SHARE_JAVA_FOLDER=program/classes
3044     LIBO_SHARE_PRESETS_FOLDER=presets
3045     LIBO_SHARE_READMES_FOLDER=readmes
3046     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3047     LIBO_SHARE_SHELL_FOLDER=program/shell
3048     LIBO_URE_BIN_FOLDER=program
3049     LIBO_URE_ETC_FOLDER=program
3050     LIBO_URE_LIB_FOLDER=program
3051     LIBO_URE_MISC_FOLDER=program
3052     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3053 else
3054     LIBO_BIN_FOLDER=program
3055     LIBO_ETC_FOLDER=program
3056     LIBO_LIBEXEC_FOLDER=program
3057     LIBO_LIB_FOLDER=program
3058     LIBO_LIB_PYUNO_FOLDER=program
3059     LIBO_SHARE_FOLDER=share
3060     LIBO_SHARE_HELP_FOLDER=help
3061     LIBO_SHARE_JAVA_FOLDER=program/classes
3062     LIBO_SHARE_PRESETS_FOLDER=presets
3063     LIBO_SHARE_READMES_FOLDER=readmes
3064     if test "$enable_fuzzers" != yes; then
3065         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3066     else
3067         LIBO_SHARE_RESOURCE_FOLDER=resource
3068     fi
3069     LIBO_SHARE_SHELL_FOLDER=program/shell
3070     LIBO_URE_BIN_FOLDER=program
3071     LIBO_URE_ETC_FOLDER=program
3072     LIBO_URE_LIB_FOLDER=program
3073     LIBO_URE_MISC_FOLDER=program
3074     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3076 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3077 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3078 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3079 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3080 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3081 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3082 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3083 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3084 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3085 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3086 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3087 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3088 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3089 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3090 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3091 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3093 # Not all of them needed in config_host.mk, add more if need arises
3094 AC_SUBST(LIBO_BIN_FOLDER)
3095 AC_SUBST(LIBO_ETC_FOLDER)
3096 AC_SUBST(LIBO_LIB_FOLDER)
3097 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3098 AC_SUBST(LIBO_SHARE_FOLDER)
3099 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3100 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3101 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3102 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3103 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3104 AC_SUBST(LIBO_URE_BIN_FOLDER)
3105 AC_SUBST(LIBO_URE_ETC_FOLDER)
3106 AC_SUBST(LIBO_URE_LIB_FOLDER)
3107 AC_SUBST(LIBO_URE_MISC_FOLDER)
3108 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3110 dnl ===================================================================
3111 dnl Windows specific tests and stuff
3112 dnl ===================================================================
3114 reg_get_value()
3116     # Return value: $regvalue
3117     unset regvalue
3119     local _regentry="/proc/registry${1}/${2}"
3120     if test -f "$_regentry"; then
3121         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3122         # Registry keys read via /proc/registry* are always \0 terminated!
3123         local _regvalue=$(tr -d '\0' < "$_regentry")
3124         if test $? -eq 0; then
3125             regvalue=$_regvalue
3126         fi
3127     fi
3130 # Get a value from the 32-bit side of the Registry
3131 reg_get_value_32()
3133     reg_get_value "32" "$1"
3136 # Get a value from the 64-bit side of the Registry
3137 reg_get_value_64()
3139     reg_get_value "64" "$1"
3142 if test "$_os" = "WINNT"; then
3143     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3144     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3145         AC_MSG_RESULT([no])
3146         WINDOWS_SDK_ARCH="x86"
3147     else
3148         AC_MSG_RESULT([yes])
3149         WINDOWS_SDK_ARCH="x64"
3150         BITNESS_OVERRIDE=64
3151     fi
3153 if test "$_os" = "iOS"; then
3154     cross_compiling="yes"
3157 if test "$cross_compiling" = "yes"; then
3158     export CROSS_COMPILING=TRUE
3159 else
3160     CROSS_COMPILING=
3161     BUILD_TYPE="$BUILD_TYPE NATIVE"
3163 AC_SUBST(CROSS_COMPILING)
3165 USE_LD=
3166 if test -n "$enable_ld" -a "$enable_ld" != "no"; then
3167     AC_MSG_CHECKING([for -fuse-ld=$enable_ld linker support])
3168     if test "$GCC" = "yes"; then
3169         ldflags_save=$LDFLAGS
3170         LDFLAGS="$LDFLAGS -fuse-ld=$enable_ld"
3171         AC_LINK_IFELSE([AC_LANG_PROGRAM([
3172 #include <stdio.h>
3173             ],[
3174 printf ("hello world\n");
3175             ])], USE_LD=$enable_ld, [])
3176         if test -n "$USE_LD"; then
3177             AC_MSG_RESULT( yes )
3178             LDFLAGS="$ldflags_save -fuse-ld=$enable_ld"
3179         else
3180             AC_MSG_ERROR( no )
3181         fi
3182     else
3183         AC_MSG_ERROR( not supported )
3184     fi
3186 AC_SUBST(USE_LD)
3188 ENABLE_GDB_INDEX=
3189 if test "$enable_gdb_index" = "yes"; then
3190     AC_MSG_CHECKING([whether $CC supports -ggnu-pubnames])
3191     save_CFLAGS=$CFLAGS
3192     CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
3193     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ AC_MSG_RESULT( yes )],[ AC_MSG_ERROR( no )])
3195     AC_MSG_CHECKING([whether $CC supports -Wl,--gdb-index])
3196     ldflags_save=$LDFLAGS
3197     LDFLAGS="$LDFLAGS -Wl,--gdb-index"
3198     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3199 #include <stdio.h>
3200         ],[
3201 printf ("hello world\n");
3202         ])], ENABLE_GDB_INDEX=TRUE, [])
3203     if test "$ENABLE_GDB_INDEX" = "TRUE"; then
3204         AC_MSG_RESULT( yes )
3205     else
3206         AC_MSG_ERROR( no )
3207     fi
3208     CFLAGS=$save_CFLAGS
3209     LDFLAGS=$ldflags_save
3211 AC_SUBST(ENABLE_GDB_INDEX)
3213 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3214 if test "$GCC" = "yes"; then
3215     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
3216     bsymbolic_functions_ldflags_save=$LDFLAGS
3217     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
3218     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3219 #include <stdio.h>
3220         ],[
3221 printf ("hello world\n");
3222         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3223     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3224         AC_MSG_RESULT( found )
3225     else
3226         AC_MSG_RESULT( not found )
3227     fi
3228     LDFLAGS=$bsymbolic_functions_ldflags_save
3230 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3232 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3233 # NOTE: must _not_ be used for bundled external libraries!
3234 ISYSTEM=
3235 if test "$GCC" = "yes"; then
3236     AC_MSG_CHECKING( for -isystem )
3237     save_CFLAGS=$CFLAGS
3238     CFLAGS="$CFLAGS -Werror"
3239     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3240     CFLAGS=$save_CFLAGS
3241     if test -n "$ISYSTEM"; then
3242         AC_MSG_RESULT(yes)
3243     else
3244         AC_MSG_RESULT(no)
3245     fi
3247 if test -z "$ISYSTEM"; then
3248     # fall back to using -I
3249     ISYSTEM=-I
3251 AC_SUBST(ISYSTEM)
3253 dnl ===================================================================
3254 dnl  Check which Visual Studio compiler is used
3255 dnl ===================================================================
3257 map_vs_year_to_version()
3259     # Return value: $vsversion
3261     unset vsversion
3263     case $1 in
3264     2017)
3265         vsversion=15.0;;
3266     *)
3267         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3268     esac
3271 vs_versions_to_check()
3273     # Args: $1 (optional) : versions to check, in the order of preference
3274     # Return value: $vsversions
3276     unset vsversions
3278     if test -n "$1"; then
3279         map_vs_year_to_version "$1"
3280         vsversions=$vsversion
3281     else
3282         # We accept only 2017
3283         vsversions="15.0"
3284     fi
3287 win_get_env_from_vsvars32bat()
3289     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3290     # Also seems to be located in another directory under the same name: vsvars32.bat
3291     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3292     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3293     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3294     chmod +x $WRAPPERBATCHFILEPATH
3295     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3296     rm -f $WRAPPERBATCHFILEPATH
3297     printf '%s' "$_win_get_env_from_vsvars32bat"
3300 find_ucrt()
3302     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3303     if test -n "$regvalue"; then
3304         PathFormat "$regvalue"
3305         UCRTSDKDIR=$formatted_path
3306         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3307         UCRTVERSION=$regvalue
3308         # Rest if not exist
3309         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3310           UCRTSDKDIR=
3311         fi
3312     fi
3313     if test -z "$UCRTSDKDIR"; then
3314         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3315         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3316         if test -f "$ide_env_file"; then
3317             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3318             UCRTSDKDIR=$formatted_path
3319             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3320             dnl Hack needed at least by tml:
3321             if test "$UCRTVERSION" = 10.0.15063.0 \
3322                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3323                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3324             then
3325                 UCRTVERSION=10.0.14393.0
3326             fi
3327         else
3328           AC_MSG_ERROR([No UCRT found])
3329         fi
3330     fi
3333 find_msvc()
3335     # Find Visual C++ 2017
3336     # Args: $1 (optional) : The VS version year
3337     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3339     unset vctest vcnum vcnumwithdot vcbuildnumber
3341     vs_versions_to_check "$1"
3343     for ver in $vsversions; do
3344         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3345         if test -n "$regvalue"; then
3346             vctest=$regvalue
3347             break
3348         fi
3349         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver
3350         if test -n "$regvalue"; then
3351             AC_MSG_RESULT([found: $regvalue])
3352             PathFormat "$regvalue"
3353             vctest=$formatted_path
3354             break
3355         fi
3356     done
3357     if test -n "$vctest"; then
3358         vcnumwithdot=$ver
3359         case "$vcnumwithdot" in
3360         15.0)
3361             vcyear=2017
3362             vcnum=150
3363             vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3364             ;;
3365         esac
3366     fi
3369 SOLARINC=
3370 MSBUILD_PATH=
3371 DEVENV=
3372 if test "$_os" = "WINNT"; then
3373     AC_MSG_CHECKING([Visual C++])
3375     find_msvc "$with_visual_studio"
3376     if test -z "$vctest"; then
3377         if test -n "$with_visual_studio"; then
3378             AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3379         else
3380             AC_MSG_ERROR([No Visual Studio 2017 installation found])
3381         fi
3382     fi
3384     if test "$BITNESS_OVERRIDE" = ""; then
3385         if test -f "$vctest/bin/cl.exe"; then
3386             VC_PRODUCT_DIR=$vctest
3387         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3388             VC_PRODUCT_DIR=$vctest/VC
3389         else
3390             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3391         fi
3392     else
3393         if test -f "$vctest/bin/amd64/cl.exe"; then
3394             VC_PRODUCT_DIR=$vctest
3395         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3396             VC_PRODUCT_DIR=$vctest/VC
3397         else
3398             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])
3399         fi
3400     fi
3402     AC_MSG_CHECKING([for short pathname of VC product directory])
3403     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3404     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3406     UCRTSDKDIR=
3407     UCRTVERSION=
3409     AC_MSG_CHECKING([for UCRT location])
3410     find_ucrt
3411     # find_ucrt errors out if it doesn't find it
3412     AC_MSG_RESULT([found])
3413     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3414     ucrtincpath_formatted=$formatted_path
3415     # SOLARINC is used for external modules and must be set too.
3416     # And no, it's not sufficient to set SOLARINC only, as configure
3417     # itself doesn't honour it.
3418     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3419     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3420     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3421     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3423     AC_SUBST(UCRTSDKDIR)
3424     AC_SUBST(UCRTVERSION)
3426     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3427     # Find the proper version of MSBuild.exe to use based on the VS version
3428     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3429     if test -n "$regvalue" ; then
3430         AC_MSG_RESULT([found: $regvalue])
3431         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3432     else
3433         if test "$BITNESS_OVERRIDE" = ""; then
3434             regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3435         else
3436             regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3437         fi
3438         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3439         AC_MSG_RESULT([$regvalue])
3440     fi
3442     # Find the version of devenv.exe
3443     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3444     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3445     if test ! -e "$DEVENV"; then
3446         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3447     fi
3449     dnl ===========================================================
3450     dnl  Check for the corresponding mspdb*.dll
3451     dnl ===========================================================
3453     MSPDB_PATH=
3454     CL_DIR=
3455     CL_LIB=
3457     if test "$BITNESS_OVERRIDE" = ""; then
3458         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86"
3459         CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX86/x86
3460     else
3461         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64"
3462         CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX64/x64
3463     fi
3465     # MSVC 15.0 has libraries from 14.0?
3466     mspdbnum="140"
3468     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3469         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3470     fi
3472     MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3473     MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3475     dnl The path needs to be added before cl is called
3476     PATH="$MSPDB_PATH:$PATH"
3478     AC_MSG_CHECKING([cl.exe])
3480     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3481     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3482     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3483     # is not enough?
3485     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3486     dnl needed when building CLR code:
3487     if test -z "$MSVC_CXX"; then
3488         if test "$BITNESS_OVERRIDE" = ""; then
3489             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3490                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3491             fi
3492         else
3493             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3494                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3495             fi
3496         fi
3498         # This gives us a posix path with 8.3 filename restrictions
3499         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3500     fi
3502     if test -z "$CC"; then
3503         CC=$MSVC_CXX
3504     fi
3505     if test "$BITNESS_OVERRIDE" = ""; then
3506         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3507         MSVC_CXX="$MSVC_CXX -arch:SSE"
3508     fi
3510     if test -n "$CC"; then
3511         # Remove /cl.exe from CC case insensitive
3512         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3513         if test "$BITNESS_OVERRIDE" = ""; then
3514            COMPATH="$VC_PRODUCT_DIR"
3515         else
3516             if test -n "$VC_PRODUCT_DIR"; then
3517                 COMPATH=$VC_PRODUCT_DIR
3518             fi
3519         fi
3520         if test "$BITNESS_OVERRIDE" = ""; then
3521             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3522             CC="$CC -arch:SSE"
3523         fi
3525         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3527         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3529         PathFormat "$COMPATH"
3530         COMPATH="$formatted_path"
3532         VCVER=$vcnum
3533         MSVSVER=$vcyear
3535         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3536         # are always "better", we list them in reverse chronological order.
3538         case $vcnum in
3539         150)
3540             COMEX=19
3541             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3542             ;;
3543         esac
3545         # The expectation is that --with-windows-sdk should not need to be used
3546         if test -n "$with_windows_sdk"; then
3547             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3548             *" "$with_windows_sdk" "*)
3549                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3550                 ;;
3551             *)
3552                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3553                 ;;
3554             esac
3555         fi
3557         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3558         ac_objext=obj
3559         ac_exeext=exe
3561     else
3562         AC_MSG_ERROR([Visual C++ not found after all, huh])
3563     fi
3565     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3566     # version of the Explorer extension (and maybe other small
3567     # bits, too) needed when installing a 32-bit LibreOffice on a
3568     # 64-bit OS. The 64-bit Explorer extension is a feature that
3569     # has been present since long in OOo. Don't confuse it with
3570     # building LibreOffice itself as 64-bit code.
3572     BUILD_X64=
3573     CXX_X64_BINARY=
3574     LINK_X64_BINARY=
3576     if test "$BITNESS_OVERRIDE" = ""; then
3577         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3578         if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3579             # Prefer native x64 compiler to cross-compiler, in case we are running
3580             # the build on a 64-bit OS.
3581             if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3582                 BUILD_X64=TRUE
3583                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3584                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3585             elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3586                 BUILD_X64=TRUE
3587                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3588                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3589             fi
3590         elif test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib"; then
3591             # nobody uses 32-bit OS to build, just pick the 64-bit compiler
3592             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3593                 BUILD_X64=TRUE
3594                 CXX_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"
3595                 LINK_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/link.exe"
3596             fi
3597         fi
3598         if test "$BUILD_X64" = TRUE; then
3599             AC_MSG_RESULT([found])
3600         else
3601             AC_MSG_RESULT([not found])
3602             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3603         fi
3604     fi
3605     AC_SUBST(BUILD_X64)
3607     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3608     AC_SUBST(CXX_X64_BINARY)
3609     AC_SUBST(LINK_X64_BINARY)
3611 AC_SUBST(VCVER)
3612 AC_SUBST(DEVENV)
3613 PathFormat "$MSPDB_PATH"
3614 MSPDB_PATH="$formatted_path"
3615 AC_SUBST(MSVC_CXX)
3618 # unowinreg.dll
3620 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3621 AC_SUBST(UNOWINREG_DLL)
3623 COM_IS_CLANG=
3624 AC_MSG_CHECKING([whether the compiler is actually Clang])
3625 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3626     #ifndef __clang__
3627     you lose
3628     #endif
3629     int foo=42;
3630     ]])],
3631     [AC_MSG_RESULT([yes])
3632      COM_IS_CLANG=TRUE],
3633     [AC_MSG_RESULT([no])])
3635 CC_PLAIN=$CC
3636 if test "$COM_IS_CLANG" = TRUE; then
3637     AC_MSG_CHECKING([the Clang version])
3638     if test "$_os" = WINNT; then
3639         dnl In which case, assume clang-cl:
3640         my_args="/EP /TC"
3641         dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3642         dnl clang-cl:
3643         CC_PLAIN=
3644         for i in $CC; do
3645             case $i in
3646             -FIIntrin.h)
3647                 ;;
3648             *)
3649                 CC_PLAIN="$CC_PLAIN $i"
3650                 ;;
3651             esac
3652         done
3653     else
3654         my_args="-E -P"
3655     fi
3656     clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args -`
3657     CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3658     CLANGVER=`echo $clang_version \
3659         | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3660     AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3661     AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3662     AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3664 AC_SUBST(COM_IS_CLANG)
3665 AC_SUBST(CLANGVER)
3667 SHOWINCLUDES_PREFIX=
3668 if test "$_os" = WINNT; then
3669     dnl We need to guess the prefix of the -showIncludes output, it can be
3670     dnl localized
3671     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3672     echo "#include <stdlib.h>" > conftest.c
3673     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3674         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3675     rm -f conftest.c conftest.obj
3676     if test -z "$SHOWINCLUDES_PREFIX"; then
3677         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3678     else
3679         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3680     fi
3682 AC_SUBST(SHOWINCLUDES_PREFIX)
3685 # prefix C with ccache if needed
3687 if test "$CCACHE" != ""; then
3688     AC_MSG_CHECKING([whether $CC is already ccached])
3690     AC_LANG_PUSH([C])
3691     save_CFLAGS=$CFLAGS
3692     CFLAGS="$CFLAGS --ccache-skip -O2"
3693     dnl an empty program will do, we're checking the compiler flags
3694     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3695                       [use_ccache=yes], [use_ccache=no])
3696     if test $use_ccache = yes; then
3697         AC_MSG_RESULT([yes])
3698     else
3699         CC="$CCACHE $CC"
3700         AC_MSG_RESULT([no])
3701     fi
3702     CFLAGS=$save_CFLAGS
3703     AC_LANG_POP([C])
3706 # ===================================================================
3707 # check various GCC options that Clang does not support now but maybe
3708 # will somewhen in the future, check them even for GCC, so that the
3709 # flags are set
3710 # ===================================================================
3712 HAVE_GCC_GGDB2=
3713 HAVE_GCC_FINLINE_LIMIT=
3714 HAVE_GCC_FNO_INLINE=
3715 if test "$GCC" = "yes"; then
3716     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3717     save_CFLAGS=$CFLAGS
3718     CFLAGS="$CFLAGS -Werror -ggdb2"
3719     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3720     CFLAGS=$save_CFLAGS
3721     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3722         AC_MSG_RESULT([yes])
3723     else
3724         AC_MSG_RESULT([no])
3725     fi
3727     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3728     save_CFLAGS=$CFLAGS
3729     CFLAGS="$CFLAGS -Werror -finline-limit=0"
3730     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3731     CFLAGS=$save_CFLAGS
3732     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3733         AC_MSG_RESULT([yes])
3734     else
3735         AC_MSG_RESULT([no])
3736     fi
3738     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3739     save_CFLAGS=$CFLAGS
3740     CFLAGS="$CFLAGS -Werror -fno-inline"
3741     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3742     CFLAGS=$save_CFLAGS
3743     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3744         AC_MSG_RESULT([yes])
3745     else
3746         AC_MSG_RESULT([no])
3747     fi
3749     if test "$host_cpu" = "m68k"; then
3750         AC_MSG_CHECKING([whether $CC supports -mlong-jump-table-offsets])
3751         save_CFLAGS=$CFLAGS
3752         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3753         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3754         CFLAGS=$save_CFLAGS
3755         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3756             AC_MSG_RESULT([yes])
3757         else
3758             AC_MSG_ERROR([no])
3759         fi
3760     fi
3762 AC_SUBST(HAVE_GCC_GGDB2)
3763 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3764 AC_SUBST(HAVE_GCC_FNO_INLINE)
3766 dnl ===================================================================
3767 dnl  Test the gcc version
3768 dnl ===================================================================
3769 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3770     AC_MSG_CHECKING([the GCC version])
3771     _gcc_version=`$CC -dumpversion`
3772     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3773         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3774     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3776     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3778     if test "$gcc_full_version" -lt 40801; then
3779         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.8.1])
3780     fi
3781 else
3782     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3783     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3784     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3785     # (which reports itself as GCC 4.2.1).
3786     GCC_VERSION=
3788 AC_SUBST(GCC_VERSION)
3790 dnl Set the ENABLE_DBGUTIL variable
3791 dnl ===================================================================
3792 AC_MSG_CHECKING([whether to build with additional debug utilities])
3793 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3794     ENABLE_DBGUTIL="TRUE"
3795     # this is an extra var so it can have different default on different MSVC
3796     # versions (in case there are version specific problems with it)
3797     MSVC_USE_DEBUG_RUNTIME="TRUE"
3799     AC_MSG_RESULT([yes])
3800     # cppunit and graphite expose STL in public headers
3801     if test "$with_system_cppunit" = "yes"; then
3802         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3803     else
3804         with_system_cppunit=no
3805     fi
3806     if test "$with_system_graphite" = "yes"; then
3807         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3808     else
3809         with_system_graphite=no
3810     fi
3811     if test "$with_system_mysql_cppconn" = "yes"; then
3812         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3813     else
3814         with_system_mysql_cppconn=no
3815     fi
3816     if test "$with_system_orcus" = "yes"; then
3817         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3818     else
3819         with_system_orcus=no
3820     fi
3821     if test "$with_system_libcmis" = "yes"; then
3822         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3823     else
3824         with_system_libcmis=no
3825     fi
3826     if test "$with_system_hunspell" = "yes"; then
3827         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3828     else
3829         with_system_hunspell=no
3830     fi
3831     if test "$with_system_gpgmepp" = "yes"; then
3832         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3833     else
3834         with_system_gpgmepp=no
3835     fi
3836     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3837     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3838     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3839     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3840     # of those two is using the system variant:
3841     if test "$with_system_libnumbertext" = "yes"; then
3842         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3843     else
3844         with_system_libnumbertext=no
3845     fi
3846     if test "$with_system_libwps" = "yes"; then
3847         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3848     else
3849         with_system_libwps=no
3850     fi
3851 else
3852     ENABLE_DBGUTIL=""
3853     MSVC_USE_DEBUG_RUNTIME=""
3854     AC_MSG_RESULT([no])
3856 AC_SUBST(ENABLE_DBGUTIL)
3857 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3859 dnl Set the ENABLE_DEBUG variable.
3860 dnl ===================================================================
3861 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3862     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3864 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3865     if test -z "$libo_fuzzed_enable_debug"; then
3866         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3867     else
3868         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3869         enable_debug=yes
3870     fi
3873 AC_MSG_CHECKING([whether to do a debug build])
3874 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3875     ENABLE_DEBUG="TRUE"
3876     if test -n "$ENABLE_DBGUTIL" ; then
3877         AC_MSG_RESULT([yes (dbgutil)])
3878     else
3879         AC_MSG_RESULT([yes])
3880     fi
3881 else
3882     ENABLE_DEBUG=""
3883     AC_MSG_RESULT([no])
3885 AC_SUBST(ENABLE_DEBUG)
3887 if test "$enable_split_debug" = yes; then
3888     HAVE_GSPLIT_DWARF=
3889     if test "$GCC" = "yes"; then
3890         AC_MSG_CHECKING([whether $CC supports -gsplit-dwarf])
3891         save_CFLAGS=$CFLAGS
3892         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
3893         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
3894         CFLAGS=$save_CFLAGS
3895         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
3896             AC_MSG_RESULT([yes])
3897         else
3898             AC_MSG_RESULT([no])
3899         fi
3900     fi
3901     AC_SUBST(HAVE_GCC_SPLIT_DWARF)
3904 if test "$enable_sal_log" = yes; then
3905     ENABLE_SAL_LOG=TRUE
3907 AC_SUBST(ENABLE_SAL_LOG)
3909 dnl Selective debuginfo
3910 ENABLE_DEBUGINFO_FOR=
3911 if test -n "$ENABLE_DEBUG"; then
3912     AC_MSG_CHECKING([whether to use selective debuginfo])
3913     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3914         if test "$enable_selective_debuginfo" = "yes"; then
3915             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3916         fi
3917         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3918         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3919     else
3920         ENABLE_DEBUGINFO_FOR=all
3921         AC_MSG_RESULT([no, for all])
3922     fi
3923 else
3924     if test -n "$enable_selective_debuginfo"; then
3925         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
3926     fi
3928 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3930 dnl Check for enable symbols option
3931 dnl ===================================================================
3932 AC_MSG_CHECKING([whether to generate debug information])
3933 if test -z "$enable_symbols"; then
3934     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3935         enable_symbols=yes
3936     else
3937         enable_symbols=no
3938     fi
3940 if test "$enable_symbols" != no; then
3941     ENABLE_SYMBOLS=TRUE
3942     AC_MSG_RESULT([yes])
3943 else
3944     ENABLE_SYMBOLS=
3945     AC_MSG_RESULT([no])
3947 AC_SUBST(ENABLE_SYMBOLS)
3949 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
3950     # Building on Android with full symbols: without enough memory the linker never finishes currently.
3951     AC_MSG_CHECKING([whether enough memory is available for linking])
3952     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
3953     # Check for 15GB, as Linux reports a bit less than the physical memory size.
3954     if test -n "$mem_size" -a $mem_size -lt 15728640; then
3955         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
3956     else
3957         AC_MSG_RESULT([yes])
3958     fi
3961 AC_MSG_CHECKING([whether to compile with optimization flags])
3962 if test -z "$enable_optimized"; then
3963     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3964         enable_optimized=no
3965     else
3966         enable_optimized=yes
3967     fi
3969 if test "$enable_optimized" != no; then
3970     ENABLE_OPTIMIZED=TRUE
3971     AC_MSG_RESULT([yes])
3972 else
3973     ENABLE_OPTIMIZED=
3974     AC_MSG_RESULT([no])
3976 AC_SUBST(ENABLE_OPTIMIZED)
3979 # determine CPUNAME, OS, ...
3980 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
3982 case "$host_os" in
3984 aix*)
3985     COM=GCC
3986     CPUNAME=POWERPC
3987     USING_X11=TRUE
3988     OS=AIX
3989     RTL_OS=AIX
3990     RTL_ARCH=PowerPC
3991     PLATFORMID=aix_powerpc
3992     P_SEP=:
3993     ;;
3995 cygwin*)
3996     COM=MSC
3997     USING_X11=
3998     OS=WNT
3999     RTL_OS=Windows
4000     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4001         P_SEP=";"
4002     else
4003         P_SEP=:
4004     fi
4005     case "$host_cpu" in
4006     i*86|x86_64)
4007         if test "$BITNESS_OVERRIDE" = 64; then
4008             CPUNAME=X86_64
4009             RTL_ARCH=X86_64
4010             PLATFORMID=windows_x86_64
4011             WINDOWS_X64=1
4012             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4013         else
4014             CPUNAME=INTEL
4015             RTL_ARCH=x86
4016             PLATFORMID=windows_x86
4017         fi
4018         ;;
4019     *)
4020         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4021         ;;
4022     esac
4023     SCPDEFS="$SCPDEFS -D_MSC_VER"
4024     ;;
4026 darwin*)
4027     COM=GCC
4028     USING_X11=
4029     OS=MACOSX
4030     RTL_OS=MacOSX
4031     P_SEP=:
4033     case "$host_cpu" in
4034     arm)
4035         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4036         ;;
4037     arm64)
4038         OS=IOS
4039         if test "$enable_ios_simulator" = "yes"; then
4040             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4041         else
4042             CPUNAME=ARM64
4043             RTL_ARCH=ARM_EABI
4044             PLATFORMID=ios_arm64
4045         fi
4046         ;;
4047     i*86)
4048         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4049         ;;
4050     x86_64)
4051         if test "$enable_ios_simulator" = "yes"; then
4052             OS=IOS
4053         fi
4054         CPUNAME=X86_64
4055         RTL_ARCH=X86_64
4056         PLATFORMID=macosx_x86_64
4057         ;;
4058     *)
4059         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4060         ;;
4061     esac
4062     ;;
4064 dragonfly*)
4065     COM=GCC
4066     USING_X11=TRUE
4067     OS=DRAGONFLY
4068     RTL_OS=DragonFly
4069     P_SEP=:
4071     case "$host_cpu" in
4072     i*86)
4073         CPUNAME=INTEL
4074         RTL_ARCH=x86
4075         PLATFORMID=dragonfly_x86
4076         ;;
4077     x86_64)
4078         CPUNAME=X86_64
4079         RTL_ARCH=X86_64
4080         PLATFORMID=dragonfly_x86_64
4081         ;;
4082     *)
4083         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4084         ;;
4085     esac
4086     ;;
4088 freebsd*)
4089     COM=GCC
4090     USING_X11=TRUE
4091     RTL_OS=FreeBSD
4092     OS=FREEBSD
4093     P_SEP=:
4095     case "$host_cpu" in
4096     i*86)
4097         CPUNAME=INTEL
4098         RTL_ARCH=x86
4099         PLATFORMID=freebsd_x86
4100         ;;
4101     x86_64|amd64)
4102         CPUNAME=X86_64
4103         RTL_ARCH=X86_64
4104         PLATFORMID=freebsd_x86_64
4105         ;;
4106     *)
4107         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4108         ;;
4109     esac
4110     ;;
4112 haiku*)
4113     COM=GCC
4114     USING_X11=
4115     GUIBASE=haiku
4116     RTL_OS=Haiku
4117     OS=HAIKU
4118     P_SEP=:
4120     case "$host_cpu" in
4121     i*86)
4122         CPUNAME=INTEL
4123         RTL_ARCH=x86
4124         PLATFORMID=haiku_x86
4125         ;;
4126     x86_64|amd64)
4127         CPUNAME=X86_64
4128         RTL_ARCH=X86_64
4129         PLATFORMID=haiku_x86_64
4130         ;;
4131     *)
4132         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4133         ;;
4134     esac
4135     ;;
4137 kfreebsd*)
4138     COM=GCC
4139     USING_X11=TRUE
4140     OS=LINUX
4141     RTL_OS=kFreeBSD
4142     P_SEP=:
4144     case "$host_cpu" in
4146     i*86)
4147         CPUNAME=INTEL
4148         RTL_ARCH=x86
4149         PLATFORMID=kfreebsd_x86
4150         ;;
4151     x86_64)
4152         CPUNAME=X86_64
4153         RTL_ARCH=X86_64
4154         PLATFORMID=kfreebsd_x86_64
4155         ;;
4156     *)
4157         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4158         ;;
4159     esac
4160     ;;
4162 linux-gnu*)
4163     COM=GCC
4164     USING_X11=TRUE
4165     OS=LINUX
4166     RTL_OS=Linux
4167     P_SEP=:
4169     case "$host_cpu" in
4171     aarch64)
4172         CPUNAME=AARCH64
4173         PLATFORMID=linux_aarch64
4174         RTL_ARCH=AARCH64
4175         ;;
4176     alpha)
4177         CPUNAME=AXP
4178         RTL_ARCH=ALPHA
4179         PLATFORMID=linux_alpha
4180         ;;
4181     arm*)
4182         CPUNAME=ARM
4183         EPM_FLAGS="-a arm"
4184         RTL_ARCH=ARM_EABI
4185         PLATFORMID=linux_arm_eabi
4186         case "$host_cpu" in
4187         arm*-linux)
4188             RTL_ARCH=ARM_OABI
4189             PLATFORMID=linux_arm_oabi
4190             ;;
4191         esac
4192         ;;
4193     hppa)
4194         CPUNAME=HPPA
4195         RTL_ARCH=HPPA
4196         EPM_FLAGS="-a hppa"
4197         PLATFORMID=linux_hppa
4198         ;;
4199     i*86)
4200         CPUNAME=INTEL
4201         RTL_ARCH=x86
4202         PLATFORMID=linux_x86
4203         ;;
4204     ia64)
4205         CPUNAME=IA64
4206         RTL_ARCH=IA64
4207         PLATFORMID=linux_ia64
4208         ;;
4209     mips)
4210         CPUNAME=GODSON
4211         RTL_ARCH=MIPS_EB
4212         EPM_FLAGS="-a mips"
4213         PLATFORMID=linux_mips_eb
4214         ;;
4215     mips64)
4216         CPUNAME=GODSON64
4217         RTL_ARCH=MIPS64_EB
4218         EPM_FLAGS="-a mips64"
4219         PLATFORMID=linux_mips64_eb
4220         ;;
4221     mips64el)
4222         CPUNAME=GODSON64
4223         RTL_ARCH=MIPS64_EL
4224         EPM_FLAGS="-a mips64el"
4225         PLATFORMID=linux_mips64_el
4226         ;;
4227     mipsel)
4228         CPUNAME=GODSON
4229         RTL_ARCH=MIPS_EL
4230         EPM_FLAGS="-a mipsel"
4231         PLATFORMID=linux_mips_el
4232         ;;
4233     m68k)
4234         CPUNAME=M68K
4235         RTL_ARCH=M68K
4236         PLATFORMID=linux_m68k
4237         ;;
4238     powerpc)
4239         CPUNAME=POWERPC
4240         RTL_ARCH=PowerPC
4241         PLATFORMID=linux_powerpc
4242         ;;
4243     powerpc64)
4244         CPUNAME=POWERPC64
4245         RTL_ARCH=PowerPC_64
4246         PLATFORMID=linux_powerpc64
4247         ;;
4248     powerpc64le)
4249         CPUNAME=POWERPC64
4250         RTL_ARCH=PowerPC_64_LE
4251         PLATFORMID=linux_powerpc64_le
4252         ;;
4253     sparc)
4254         CPUNAME=SPARC
4255         RTL_ARCH=SPARC
4256         PLATFORMID=linux_sparc
4257         ;;
4258     sparc64)
4259         CPUNAME=SPARC64
4260         RTL_ARCH=SPARC64
4261         PLATFORMID=linux_sparc64
4262         ;;
4263     s390)
4264         CPUNAME=S390
4265         RTL_ARCH=S390
4266         PLATFORMID=linux_s390
4267         ;;
4268     s390x)
4269         CPUNAME=S390X
4270         RTL_ARCH=S390x
4271         PLATFORMID=linux_s390x
4272         ;;
4273     x86_64)
4274         CPUNAME=X86_64
4275         RTL_ARCH=X86_64
4276         PLATFORMID=linux_x86_64
4277         ;;
4278     *)
4279         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4280         ;;
4281     esac
4282     ;;
4284 linux-android*)
4285     COM=GCC
4286     USING_X11=
4287     OS=ANDROID
4288     RTL_OS=Android
4289     P_SEP=:
4291     case "$host_cpu" in
4293     arm|armel)
4294         CPUNAME=ARM
4295         RTL_ARCH=ARM_EABI
4296         PLATFORMID=android_arm_eabi
4297         ;;
4298     aarch64)
4299         CPUNAME=AARCH64
4300         RTL_ARCH=AARCH64
4301         PLATFORMID=android_aarch64
4302         ;;
4303     mips|mipsel)
4304         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4305         RTL_ARCH=MIPS_EL
4306         PLATFORMID=android_mips_el
4307         ;;
4308     i*86)
4309         CPUNAME=INTEL
4310         RTL_ARCH=x86
4311         PLATFORMID=android_x86
4312         ;;
4313     *)
4314         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4315         ;;
4316     esac
4317     ;;
4319 *netbsd*)
4320     COM=GCC
4321     USING_X11=TRUE
4322     OS=NETBSD
4323     RTL_OS=NetBSD
4324     P_SEP=:
4326     case "$host_cpu" in
4327     i*86)
4328         CPUNAME=INTEL
4329         RTL_ARCH=x86
4330         PLATFORMID=netbsd_x86
4331         ;;
4332     powerpc)
4333         CPUNAME=POWERPC
4334         RTL_ARCH=PowerPC
4335         PLATFORMID=netbsd_powerpc
4336         ;;
4337     sparc)
4338         CPUNAME=SPARC
4339         RTL_ARCH=SPARC
4340         PLATFORMID=netbsd_sparc
4341         ;;
4342     x86_64)
4343         CPUNAME=X86_64
4344         RTL_ARCH=X86_64
4345         PLATFORMID=netbsd_x86_64
4346         ;;
4347     *)
4348         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4349         ;;
4350     esac
4351     ;;
4353 openbsd*)
4354     COM=GCC
4355     USING_X11=TRUE
4356     OS=OPENBSD
4357     RTL_OS=OpenBSD
4358     P_SEP=:
4360     case "$host_cpu" in
4361     i*86)
4362         CPUNAME=INTEL
4363         RTL_ARCH=x86
4364         PLATFORMID=openbsd_x86
4365         ;;
4366     x86_64)
4367         CPUNAME=X86_64
4368         RTL_ARCH=X86_64
4369         PLATFORMID=openbsd_x86_64
4370         ;;
4371     *)
4372         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4373         ;;
4374     esac
4375     SOLARINC="$SOLARINC -I/usr/local/include"
4376     ;;
4378 solaris*)
4379     COM=GCC
4380     USING_X11=TRUE
4381     OS=SOLARIS
4382     RTL_OS=Solaris
4383     P_SEP=:
4385     case "$host_cpu" in
4386     i*86)
4387         CPUNAME=INTEL
4388         RTL_ARCH=x86
4389         PLATFORMID=solaris_x86
4390         ;;
4391     sparc)
4392         CPUNAME=SPARC
4393         RTL_ARCH=SPARC
4394         PLATFORMID=solaris_sparc
4395         ;;
4396     sparc64)
4397         CPUNAME=SPARC64
4398         RTL_ARCH=SPARC64
4399         PLATFORMID=solaris_sparc64
4400         ;;
4401     *)
4402         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4403         ;;
4404     esac
4405     SOLARINC="$SOLARINC -I/usr/local/include"
4406     ;;
4409     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4410     ;;
4411 esac
4413 if test "$with_x" = "no"; then
4414     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4417 ENABLE_HEADLESS=""
4418 if test "$enable_gui" = "no"; then
4419     if test "$USING_X11" != TRUE; then
4420         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4421     fi
4422     USING_X11=
4423     ENABLE_HEADLESS=TRUE
4424     AC_DEFINE(HAVE_FEATURE_UI,0)
4425     test_cairo=yes
4427 AC_SUBST(ENABLE_HEADLESS)
4429 WORKDIR="${BUILDDIR}/workdir"
4430 INSTDIR="${BUILDDIR}/instdir"
4431 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4432 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4433 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4434 AC_SUBST(COM)
4435 AC_SUBST(CPUNAME)
4436 AC_SUBST(RTL_OS)
4437 AC_SUBST(RTL_ARCH)
4438 AC_SUBST(EPM_FLAGS)
4439 AC_SUBST(USING_X11)
4440 AC_SUBST([INSTDIR])
4441 AC_SUBST([INSTROOT])
4442 AC_SUBST([INSTROOTBASE])
4443 AC_SUBST(OS)
4444 AC_SUBST(P_SEP)
4445 AC_SUBST(WORKDIR)
4446 AC_SUBST(PLATFORMID)
4447 AC_SUBST(WINDOWS_X64)
4448 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4450 dnl ===================================================================
4451 dnl Test which package format to use
4452 dnl ===================================================================
4453 AC_MSG_CHECKING([which package format to use])
4454 if test -n "$with_package_format" -a "$with_package_format" != no; then
4455     for i in $with_package_format; do
4456         case "$i" in
4457         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4458             ;;
4459         *)
4460             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4461 aix - AIX software distribution
4462 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4463 deb - Debian software distribution
4464 pkg - Solaris software distribution
4465 rpm - RedHat software distribution
4467 LibreOffice additionally supports:
4468 archive - .tar.gz or .zip
4469 dmg - Mac OS X .dmg
4470 installed - installation tree
4471 msi - Windows .msi
4472         ])
4473             ;;
4474         esac
4475     done
4476     # fakeroot is needed to ensure correct file ownerships/permissions
4477     # inside deb packages and tar archives created on Linux and Solaris.
4478     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4479         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4480         if test "$FAKEROOT" = "no"; then
4481             AC_MSG_ERROR(
4482                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4483         fi
4484     fi
4485     PKGFORMAT="$with_package_format"
4486     AC_MSG_RESULT([$PKGFORMAT])
4487 else
4488     PKGFORMAT=
4489     AC_MSG_RESULT([none])
4491 AC_SUBST(PKGFORMAT)
4493 dnl ===================================================================
4494 dnl Set up a different compiler to produce tools to run on the build
4495 dnl machine when doing cross-compilation
4496 dnl ===================================================================
4498 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4499 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4500 if test "$cross_compiling" = "yes"; then
4501     AC_MSG_CHECKING([for BUILD platform configuration])
4502     echo
4503     rm -rf CONF-FOR-BUILD config_build.mk
4504     mkdir CONF-FOR-BUILD
4505     # Here must be listed all files needed when running the configure script. In particular, also
4506     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4507     # keep them in the same order as there.
4508     (cd $SRC_ROOT && tar cf - \
4509         config.guess \
4510         bin/get_config_variables \
4511         solenv/bin/getcompver.awk \
4512         solenv/inc/langlist.mk \
4513         download.lst \
4514         config_host.mk.in \
4515         config_host_lang.mk.in \
4516         Makefile.in \
4517         lo.xcent.in \
4518         bin/bffvalidator.sh.in \
4519         bin/odfvalidator.sh.in \
4520         bin/officeotron.sh.in \
4521         instsetoo_native/util/openoffice.lst.in \
4522         config_host/*.in \
4523         sysui/desktop/macosx/Info.plist.in) \
4524     | (cd CONF-FOR-BUILD && tar xf -)
4525     cp configure CONF-FOR-BUILD
4526     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4527     (
4528     unset COM USING_X11 OS CPUNAME
4529     unset CC CXX SYSBASE CFLAGS
4530     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4531     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4532     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4533     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4534     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4535     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4536     cd CONF-FOR-BUILD
4537     sub_conf_opts=""
4538     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4539     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4540     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4541     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4542     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4543     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4544     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4545     # Don't bother having configure look for stuff not needed for the build platform anyway
4546     ./configure \
4547         --disable-cups \
4548         --disable-gtk3 \
4549         --disable-pdfimport \
4550         --disable-postgresql-sdbc \
4551         --with-parallelism="$with_parallelism" \
4552         --without-doxygen \
4553         --without-java \
4554         $sub_conf_opts \
4555         --srcdir=$srcdir \
4556         2>&1 | sed -e 's/^/    /'
4557     test -f ./config_host.mk 2>/dev/null || exit
4558     cp config_host.mk ../config_build.mk
4559     cp config_host_lang.mk ../config_build_lang.mk
4560     mv config.log ../config.Build.log
4561     mkdir -p ../config_build
4562     mv config_host/*.h ../config_build
4563     . ./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
4565     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
4566         VV='$'$V
4567         VV=`eval "echo $VV"`
4568         if test -n "$VV"; then
4569             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4570             echo "$line" >>build-config
4571         fi
4572     done
4574     for V in INSTDIR INSTROOT WORKDIR; do
4575         VV='$'$V
4576         VV=`eval "echo $VV"`
4577         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4578         if test -n "$VV"; then
4579             line="${V}_FOR_BUILD='$VV'"
4580             echo "$line" >>build-config
4581         fi
4582     done
4584     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4585     echo "$line" >>build-config
4587     )
4588     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4589     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])
4590     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4591              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4593     eval `cat CONF-FOR-BUILD/build-config`
4595     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4597     rm -rf CONF-FOR-BUILD
4598 else
4599     OS_FOR_BUILD="$OS"
4600     CC_FOR_BUILD="$CC"
4601     CXX_FOR_BUILD="$CXX"
4602     INSTDIR_FOR_BUILD="$INSTDIR"
4603     INSTROOT_FOR_BUILD="$INSTROOT"
4604     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4605     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4606     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4607     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4608     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4609     WORKDIR_FOR_BUILD="$WORKDIR"
4611 AC_SUBST(OS_FOR_BUILD)
4612 AC_SUBST(INSTDIR_FOR_BUILD)
4613 AC_SUBST(INSTROOT_FOR_BUILD)
4614 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4615 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4616 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4617 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4618 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4619 AC_SUBST(WORKDIR_FOR_BUILD)
4621 dnl ===================================================================
4622 dnl Check for syslog header
4623 dnl ===================================================================
4624 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4626 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4627 dnl ===================================================================
4628 AC_MSG_CHECKING([whether to turn warnings to errors])
4629 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4630     ENABLE_WERROR="TRUE"
4631     AC_MSG_RESULT([yes])
4632 else
4633     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4634         ENABLE_WERROR="TRUE"
4635         AC_MSG_RESULT([yes])
4636     else
4637         AC_MSG_RESULT([no])
4638     fi
4640 AC_SUBST(ENABLE_WERROR)
4642 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4643 dnl ===================================================================
4644 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4645 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4646     ASSERT_ALWAYS_ABORT="TRUE"
4647     AC_MSG_RESULT([yes])
4648 else
4649     ASSERT_ALWAYS_ABORT="FALSE"
4650     AC_MSG_RESULT([no])
4652 AC_SUBST(ASSERT_ALWAYS_ABORT)
4654 # Determine whether to use ooenv for the instdir installation
4655 # ===================================================================
4656 if test $_os != "WINNT" -a $_os != "Darwin"; then
4657     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4658     if test "$enable_ooenv" = "no"; then
4659         AC_MSG_RESULT([no])
4660     else
4661         ENABLE_OOENV="TRUE"
4662         AC_MSG_RESULT([yes])
4663     fi
4665 AC_SUBST(ENABLE_OOENV)
4667 if test "$USING_X11" != TRUE; then
4668     # be sure to do not mess with unneeded stuff
4669     test_randr=no
4670     test_xrender=no
4671     test_cups=no
4672     test_dbus=no
4673     test_gtk=no
4674     build_gstreamer_1_0=no
4675     build_gstreamer_0_10=no
4676     test_kde4=no
4677     test_kde5=no
4678     test_qt5=no
4679     test_gtk3_kde5=no
4680     enable_cairo_canvas=no
4683 if test "$OS" = "HAIKU"; then
4684     enable_cairo_canvas=yes
4685     test_qt5=yes
4686     test_kde5=yes
4689 dnl ===================================================================
4690 dnl check for cups support
4691 dnl ===================================================================
4692 ENABLE_CUPS=""
4694 if test "$enable_cups" = "no"; then
4695     test_cups=no
4698 AC_MSG_CHECKING([whether to enable CUPS support])
4699 if test "$test_cups" = "yes"; then
4700     ENABLE_CUPS="TRUE"
4701     AC_MSG_RESULT([yes])
4703     AC_MSG_CHECKING([whether cups support is present])
4704     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4705     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4706     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4707         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4708     fi
4710 else
4711     AC_MSG_RESULT([no])
4714 AC_SUBST(ENABLE_CUPS)
4716 # fontconfig checks
4717 if test "$test_fontconfig" = "yes"; then
4718     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4719     SYSTEM_FONTCONFIG=TRUE
4720     FilterLibs "${FONTCONFIG_LIBS}"
4721     FONTCONFIG_LIBS="${filteredlibs}"
4723 AC_SUBST(FONTCONFIG_CFLAGS)
4724 AC_SUBST(FONTCONFIG_LIBS)
4725 AC_SUBST([SYSTEM_FONTCONFIG])
4727 dnl whether to find & fetch external tarballs?
4728 dnl ===================================================================
4729 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4730    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4731        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4732    else
4733        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4734    fi
4736 if test -z "$TARFILE_LOCATION"; then
4737     if test -d "$SRC_ROOT/src" ; then
4738         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4739         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4740     fi
4741     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4742 else
4743     AbsolutePath "$TARFILE_LOCATION"
4744     PathFormat "${absolute_path}"
4745     TARFILE_LOCATION="${formatted_path}"
4747 AC_SUBST(TARFILE_LOCATION)
4749 AC_MSG_CHECKING([whether we want to fetch tarballs])
4750 if test "$enable_fetch_external" != "no"; then
4751     if test "$with_all_tarballs" = "yes"; then
4752         AC_MSG_RESULT([yes, all of them])
4753         DO_FETCH_TARBALLS="ALL"
4754     else
4755         AC_MSG_RESULT([yes, if we use them])
4756         DO_FETCH_TARBALLS="TRUE"
4757     fi
4758 else
4759     AC_MSG_RESULT([no])
4760     DO_FETCH_TARBALLS=
4762 AC_SUBST(DO_FETCH_TARBALLS)
4764 AC_MSG_CHECKING([whether to build help])
4765 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4766     BUILD_TYPE="$BUILD_TYPE HELP"
4767     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4768     case "$with_help" in
4769     "html")
4770         ENABLE_HTMLHELP=TRUE
4771         SCPDEFS="$SCPDEFS -DWITH_HELP"
4772         AC_MSG_RESULT([HTML])
4773         ;;
4774     "online")
4775         ENABLE_HTMLHELP=TRUE
4776         HELP_ONLINE=TRUE
4777         AC_MSG_RESULT([HTML])
4778         ;;
4779     yes)
4780         SCPDEFS="$SCPDEFS -DWITH_HELP"
4781         AC_MSG_RESULT([yes])
4782         ;;
4783     *)
4784         AC_MSG_ERROR([Unknown --with-help=$with_help])
4785         ;;
4786     esac
4787 else
4788     AC_MSG_RESULT([no])
4790 AC_SUBST([ENABLE_HTMLHELP])
4791 AC_SUBST([HELP_ONLINE])
4793 dnl Test whether to include MySpell dictionaries
4794 dnl ===================================================================
4795 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4796 if test "$with_myspell_dicts" = "yes"; then
4797     AC_MSG_RESULT([yes])
4798     WITH_MYSPELL_DICTS=TRUE
4799     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4800     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4801 else
4802     AC_MSG_RESULT([no])
4803     WITH_MYSPELL_DICTS=
4805 AC_SUBST(WITH_MYSPELL_DICTS)
4807 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4808 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4809     if test "$with_system_dicts" = yes; then
4810         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4811     fi
4812     with_system_dicts=no
4815 AC_MSG_CHECKING([whether to use dicts from external paths])
4816 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4817     AC_MSG_RESULT([yes])
4818     SYSTEM_DICTS=TRUE
4819     AC_MSG_CHECKING([for spelling dictionary directory])
4820     if test -n "$with_external_dict_dir"; then
4821         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4822     else
4823         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4824         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4825             DICT_SYSTEM_DIR=file:///usr/share/myspell
4826         fi
4827     fi
4828     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4829     AC_MSG_CHECKING([for hyphenation patterns directory])
4830     if test -n "$with_external_hyph_dir"; then
4831         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4832     else
4833         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4834     fi
4835     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4836     AC_MSG_CHECKING([for thesaurus directory])
4837     if test -n "$with_external_thes_dir"; then
4838         THES_SYSTEM_DIR=file://$with_external_thes_dir
4839     else
4840         THES_SYSTEM_DIR=file:///usr/share/mythes
4841     fi
4842     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4843 else
4844     AC_MSG_RESULT([no])
4845     SYSTEM_DICTS=
4847 AC_SUBST(SYSTEM_DICTS)
4848 AC_SUBST(DICT_SYSTEM_DIR)
4849 AC_SUBST(HYPH_SYSTEM_DIR)
4850 AC_SUBST(THES_SYSTEM_DIR)
4852 dnl ===================================================================
4853 dnl enable pch by default on windows
4854 dnl enable it explicitly otherwise
4855 ENABLE_PCH=""
4856 if test "$enable_pch" = yes -a "$enable_compiler_plugins" = yes; then
4857     if test -z "$libo_fuzzed_enable_pch"; then
4858         AC_MSG_ERROR([--enable-pch cannot be used with --enable-compiler-plugins])
4859     else
4860         AC_MSG_NOTICE([Resetting --enable-pch=no])
4861         enable_pch=no
4862     fi
4865 AC_MSG_CHECKING([whether to enable pch feature])
4866 if test "$enable_pch" != "no"; then
4867     if test "$_os" = "WINNT"; then
4868         ENABLE_PCH="TRUE"
4869         AC_MSG_RESULT([yes])
4870     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4871         ENABLE_PCH="TRUE"
4872         AC_MSG_RESULT([yes])
4873     elif test -n "$enable_pch"; then
4874         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4875     else
4876         AC_MSG_RESULT([no])
4877     fi
4878 else
4879     AC_MSG_RESULT([no])
4881 AC_SUBST(ENABLE_PCH)
4883 TAB=`printf '\t'`
4885 AC_MSG_CHECKING([the GNU Make version])
4886 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4887 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4888 if test "$_make_longver" -ge "038200"; then
4889     AC_MSG_RESULT([$GNUMAKE $_make_version])
4891 elif test "$_make_longver" -ge "038100"; then
4892     if test "$build_os" = "cygwin"; then
4893         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4894     fi
4895     AC_MSG_RESULT([$GNUMAKE $_make_version])
4897     dnl ===================================================================
4898     dnl Search all the common names for sha1sum
4899     dnl ===================================================================
4900     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4901     if test -z "$SHA1SUM"; then
4902         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
4903     elif test "$SHA1SUM" = "openssl"; then
4904         SHA1SUM="openssl sha1"
4905     fi
4906     AC_MSG_CHECKING([for GNU Make bug 20033])
4907     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4908     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4909 A := \$(wildcard *.a)
4911 .PHONY: all
4912 all: \$(A:.a=.b)
4913 <TAB>@echo survived bug20033.
4915 .PHONY: setup
4916 setup:
4917 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4919 define d1
4920 @echo lala \$(1)
4921 @sleep 1
4922 endef
4924 define d2
4925 @echo tyty \$(1)
4926 @sleep 1
4927 endef
4929 %.b : %.a
4930 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4931 <TAB>\$(call d1,\$(CHECKSUM)),\
4932 <TAB>\$(call d2,\$(CHECKSUM)))
4934     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4935         no_parallelism_make="YES"
4936         AC_MSG_RESULT([yes, disable parallelism])
4937     else
4938         AC_MSG_RESULT([no, keep parallelism enabled])
4939     fi
4940     rm -rf $TESTGMAKEBUG20033
4941 else
4942     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4945 # find if gnumake support file function
4946 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
4947 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4948 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4949     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
4951 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4952 \$(file >test.txt,Success )
4954 .PHONY: all
4955 all:
4956 <TAB>@cat test.txt
4959 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4960 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4961     HAVE_GNUMAKE_FILE_FUNC=TRUE
4962     AC_MSG_RESULT([yes])
4963 else
4964     AC_MSG_RESULT([no])
4966 rm -rf $TESTGMAKEFILEFUNC
4967 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4968 AC_SUBST(GNUMAKE_WIN_NATIVE)
4970 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
4971 STALE_MAKE=
4972 if test "$_make_ver_check" = ""; then
4973    STALE_MAKE=TRUE
4976 HAVE_LD_HASH_STYLE=FALSE
4977 WITH_LINKER_HASH_STYLE=
4978 AC_MSG_CHECKING([for --hash-style gcc linker support])
4979 if test "$GCC" = "yes"; then
4980     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4981         hash_styles="gnu sysv"
4982     elif test "$with_linker_hash_style" = "no"; then
4983         hash_styles=
4984     else
4985         hash_styles="$with_linker_hash_style"
4986     fi
4988     for hash_style in $hash_styles; do
4989         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4990         hash_style_ldflags_save=$LDFLAGS
4991         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
4993         AC_RUN_IFELSE([AC_LANG_PROGRAM(
4994             [
4995 #include <stdio.h>
4996             ],[
4997 printf ("");
4998             ])],
4999             [
5000                   HAVE_LD_HASH_STYLE=TRUE
5001                   WITH_LINKER_HASH_STYLE=$hash_style
5002             ],
5003             [HAVE_LD_HASH_STYLE=FALSE],
5004             [HAVE_LD_HASH_STYLE=FALSE])
5005         LDFLAGS=$hash_style_ldflags_save
5006     done
5008     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5009         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5010     else
5011         AC_MSG_RESULT( no )
5012     fi
5013     LDFLAGS=$hash_style_ldflags_save
5014 else
5015     AC_MSG_RESULT( no )
5017 AC_SUBST(HAVE_LD_HASH_STYLE)
5018 AC_SUBST(WITH_LINKER_HASH_STYLE)
5020 dnl ===================================================================
5021 dnl Check whether there's a Perl version available.
5022 dnl ===================================================================
5023 if test -z "$with_perl_home"; then
5024     AC_PATH_PROG(PERL, perl)
5025 else
5026     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5027     _perl_path="$with_perl_home/bin/perl"
5028     if test -x "$_perl_path"; then
5029         PERL=$_perl_path
5030     else
5031         AC_MSG_ERROR([$_perl_path not found])
5032     fi
5035 dnl ===================================================================
5036 dnl Testing for Perl version 5 or greater.
5037 dnl $] is the Perl version variable, it is returned as an integer
5038 dnl ===================================================================
5039 if test "$PERL"; then
5040     AC_MSG_CHECKING([the Perl version])
5041     ${PERL} -e "exit($]);"
5042     _perl_version=$?
5043     if test "$_perl_version" -lt 5; then
5044         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5045     fi
5046     AC_MSG_RESULT([Perl $_perl_version])
5047 else
5048     AC_MSG_ERROR([Perl not found, install Perl 5])
5051 dnl ===================================================================
5052 dnl Testing for required Perl modules
5053 dnl ===================================================================
5055 AC_MSG_CHECKING([for required Perl modules])
5056 perl_use_string="use Cwd ; use Digest::MD5"
5057 if test "$_os" = "WINNT"; then
5058     if test -n "$PKGFORMAT"; then
5059         for i in $PKGFORMAT; do
5060             case "$i" in
5061             msi)
5062                 # for getting fonts versions to use in MSI
5063                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5064                 ;;
5065             esac
5066         done
5067     fi
5069 if test "$with_system_hsqldb" = "yes"; then
5070         perl_use_string="$perl_use_string ; use Archive::Zip"
5072 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5073     AC_MSG_RESULT([all modules found])
5074 else
5075     AC_MSG_RESULT([failed to find some modules])
5076     # Find out which modules are missing.
5077     for i in $perl_use_string; do
5078         if test "$i" != "use" -a "$i" != ";"; then
5079             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5080                 missing_perl_modules="$missing_perl_modules $i"
5081             fi
5082         fi
5083     done
5084     AC_MSG_ERROR([
5085     The missing Perl modules are: $missing_perl_modules
5086     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5089 dnl ===================================================================
5090 dnl Check for pkg-config
5091 dnl ===================================================================
5092 if test "$_os" != "WINNT"; then
5093     PKG_PROG_PKG_CONFIG
5096 if test "$_os" != "WINNT"; then
5098     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5099     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5100     # explicitly. Or put /path/to/compiler in PATH yourself.
5102     # Use wrappers for LTO
5103     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5104         AC_CHECK_TOOL(AR,gcc-ar)
5105         AC_CHECK_TOOL(NM,gcc-nm)
5106         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5107     else
5108         AC_CHECK_TOOL(AR,ar)
5109         AC_CHECK_TOOL(NM,nm)
5110         AC_CHECK_TOOL(RANLIB,ranlib)
5111     fi
5112     AC_CHECK_TOOL(OBJDUMP,objdump)
5113     AC_CHECK_TOOL(READELF,readelf)
5114     AC_CHECK_TOOL(STRIP,strip)
5115     if test "$_os" = "WINNT"; then
5116         AC_CHECK_TOOL(DLLTOOL,dlltool)
5117         AC_CHECK_TOOL(WINDRES,windres)
5118     fi
5120 AC_SUBST(AR)
5121 AC_SUBST(DLLTOOL)
5122 AC_SUBST(NM)
5123 AC_SUBST(OBJDUMP)
5124 AC_SUBST(PKG_CONFIG)
5125 AC_SUBST(RANLIB)
5126 AC_SUBST(READELF)
5127 AC_SUBST(STRIP)
5128 AC_SUBST(WINDRES)
5130 dnl ===================================================================
5131 dnl pkg-config checks on Mac OS X
5132 dnl ===================================================================
5134 if test $_os = Darwin; then
5135     AC_MSG_CHECKING([for bogus pkg-config])
5136     if test -n "$PKG_CONFIG"; then
5137         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5138             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5139         else
5140             if test "$enable_bogus_pkg_config" = "yes"; then
5141                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5142             else
5143                 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.])
5144             fi
5145         fi
5146     else
5147         AC_MSG_RESULT([no, good])
5148     fi
5151 find_csc()
5153     # Return value: $csctest
5155     unset csctest
5157     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5158     if test -n "$regvalue"; then
5159         csctest=$regvalue
5160         return
5161     fi
5164 find_al()
5166     # Return value: $altest
5168     unset altest
5170     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5171         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5172         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5173             altest=$regvalue
5174             return
5175         fi
5176     done
5178     # We need this additional check to detect 4.6.1 or above.
5179     for ver in 4.7.1 4.7 4.6.2 4.6.1; do
5180         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5181         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5182             altest=$regvalue
5183             return
5184         fi
5186         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/WOW6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools"
5187         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5188             altest=$regvalue
5189             return
5190         fi
5191     done
5194 find_dotnetsdk()
5196     # Return value: $frametest (that's a silly name...)
5198     unset frametest
5200     for ver in 1.1 2.0; do
5201         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
5202         if test -n "$regvalue"; then
5203             frametest=$regvalue
5204             return
5205         fi
5206     done
5209 find_dotnetsdk46()
5211     unset frametest
5213     for ver in 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5214         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5215         if test -n "$regvalue"; then
5216             frametest=$regvalue
5217             return
5218         fi
5219         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5220         if test -n "$regvalue"; then
5221             frametest=$regvalue
5222             return
5223         fi
5224     done
5227 find_winsdk_version()
5229     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5230     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5232     unset winsdktest winsdkbinsubdir winsdklibsubdir
5234     case "$1" in
5235     7.*)
5236         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5237         if test -n "$regvalue"; then
5238             winsdktest=$regvalue
5239             winsdklibsubdir=.
5240             return
5241         fi
5242         ;;
5243     8.0|8.0A)
5244         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5245         if test -n "$regvalue"; then
5246             winsdktest=$regvalue
5247             winsdklibsubdir=win8
5248             return
5249         fi
5250         ;;
5251     8.1|8.1A)
5252         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5253         if test -n "$regvalue"; then
5254             winsdktest=$regvalue
5255             winsdklibsubdir=winv6.3
5256             return
5257         fi
5258         ;;
5259     10.0)
5260         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5261         if test -n "$regvalue"; then
5262             winsdktest=$regvalue
5263             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5264             if test -n "$regvalue"; then
5265                 winsdkbinsubdir="$regvalue".0
5266             fi
5267             winsdklibsubdir=$regvalue
5268             if test "$regvalue" = "10.0.14393"; then
5269                 winsdklibsubdir="10.0.14393.0"
5270             elif test "$regvalue" = "10.0.16299"; then
5271                 winsdklibsubdir="10.0.16299.0"
5272             elif test "$regvalue" = "10.0.15063"; then
5273                 winsdklibsubdir="10.0.15063.0"
5274             elif test "$regvalue" = "10.0.17134"; then
5275                 winsdklibsubdir="$regvalue.0"
5276             fi
5277             return
5278         fi
5279         ;;
5280     esac
5283 find_winsdk()
5285     # Return value: From find_winsdk_version
5287     unset winsdktest
5289     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5290         find_winsdk_version $ver
5291         if test -n "$winsdktest"; then
5292             return
5293         fi
5294     done
5297 find_msms()
5299     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5300     if test $VCVER = 150; then
5301         my_msm_files="Microsoft_VC141_CRT_x86.msm ${my_msm_files}"
5302     fi
5303     AC_MSG_CHECKING([for ${my_msm_files}])
5304     msmdir=
5305     for ver in 14.0 15.0; do
5306         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5307         if test -n "$regvalue"; then
5308             for f in ${my_msm_files}; do
5309                 if test -e "$regvalue/${f}"; then
5310                     msmdir=$regvalue
5311                     break
5312                 fi
5313             done
5314         fi
5315     done
5316     dnl Is the following fallback really necessary, or was it added in response
5317     dnl to never having started Visual Studio on a given machine, so the
5318     dnl registry keys checked above had presumably not yet been created?
5319     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5320     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5321     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5322     dnl expanding to "C:\Program Files\Common Files"), which would need
5323     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5324     dnl obtain its value from cygwin:
5325     if test -z "$msmdir"; then
5326         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5327         for f in ${my_msm_files}; do
5328             if test -e "$my_msm_dir/${f}"; then
5329                 msmdir=$my_msm_dir
5330             fi
5331         done
5332     fi
5334     dnl Starting from MSVC 15.0, merge modules are located in different directory
5335     if test $VCVER = 150; then
5336         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5337             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])
5338             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5339             for f in ${my_msm_files}; do
5340                 if test -e "$my_msm_dir/${f}"; then
5341                     msmdir=$my_msm_dir
5342                     break
5343                 fi
5344             done
5345         done
5346     fi
5348     if test -n "$msmdir"; then
5349         msmdir=`cygpath -m "$msmdir"`
5350         AC_MSG_RESULT([$msmdir])
5351     else
5352         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5353             AC_MSG_ERROR([not found])
5354         else
5355             AC_MSG_WARN([not found])
5356             add_warning "MSM none of ${my_msm_files} found"
5357         fi
5358     fi
5361 find_msvc_x64_dlls()
5363     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5364     if test "$VCVER" = 150; then
5365         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5366             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT])
5367             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5368                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5369                 break
5370             fi
5371             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5372                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5373                 break
5374             fi
5375         done
5376     fi
5377     msvcdlls="msvcp140.dll vcruntime140.dll"
5378     for dll in $msvcdlls; do
5379         if ! test -f "$msvcdllpath/$dll"; then
5380             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5381         fi
5382     done
5385 dnl =========================================
5386 dnl Check for the Windows  SDK.
5387 dnl =========================================
5388 if test "$_os" = "WINNT"; then
5389     AC_MSG_CHECKING([for Windows SDK])
5390     if test "$build_os" = "cygwin"; then
5391         find_winsdk
5392         WINDOWS_SDK_HOME=$winsdktest
5394         # normalize if found
5395         if test -n "$WINDOWS_SDK_HOME"; then
5396             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5397             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5398         fi
5400         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5401     fi
5403     if test -n "$WINDOWS_SDK_HOME"; then
5404         # Remove a possible trailing backslash
5405         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5407         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5408              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5409              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5410             have_windows_sdk_headers=yes
5411         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5412              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5413              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5414             have_windows_sdk_headers=yes
5415         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5416              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5417              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5418             have_windows_sdk_headers=yes
5419         else
5420             have_windows_sdk_headers=no
5421         fi
5423         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5424             have_windows_sdk_libs=yes
5425         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5426             have_windows_sdk_libs=yes
5427         else
5428             have_windows_sdk_libs=no
5429         fi
5431         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5432             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5433 the  Windows SDK are installed.])
5434         fi
5435     fi
5437     if test -z "$WINDOWS_SDK_HOME"; then
5438         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5439     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
5440         WINDOWS_SDK_VERSION=70
5441         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
5442     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5443         WINDOWS_SDK_VERSION=80
5444         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5445     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5446         WINDOWS_SDK_VERSION=81
5447         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5448     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5449         WINDOWS_SDK_VERSION=10
5450         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5451     else
5452         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5453     fi
5454     PathFormat "$WINDOWS_SDK_HOME"
5455     WINDOWS_SDK_HOME="$formatted_path"
5456     if test "$build_os" = "cygwin"; then
5457         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5458         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5459             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5460         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5461             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5462         fi
5463     fi
5465     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5466     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5467     dnl but not in v8.0), so allow this to be overridden with a
5468     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5469     dnl and configuration error if no WiLangId.vbs is found would arguably be
5470     dnl better, but I do not know under which conditions exactly it is needed by
5471     dnl msiglobal.pm:
5472     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5473         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5474         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5475             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5476         fi
5477         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5478             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5479         fi
5480         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5481             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5482         fi
5483     fi
5484     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5485         if test -n "$with_package_format" -a "$with_package_format" != no; then
5486             for i in "$with_package_format"; do
5487                 if test "$i" = "msi"; then
5488                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5489                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5490                     fi
5491                 fi
5492             done
5493         fi
5494     fi
5496 AC_SUBST(WINDOWS_SDK_HOME)
5497 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5498 AC_SUBST(WINDOWS_SDK_VERSION)
5499 AC_SUBST(WINDOWS_SDK_WILANGID)
5501 if test "$build_os" = "cygwin"; then
5502     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5503     dnl dir, it also determines that dir's path w/o an arch segment if any,
5504     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5505     AC_MSG_CHECKING([for midl.exe])
5507     find_winsdk
5508     if test -n "$winsdkbinsubdir" \
5509         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5510     then
5511         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5512         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5513     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5514         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5515         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5516     elif test -f "$winsdktest/Bin/midl.exe"; then
5517         MIDL_PATH=$winsdktest/Bin
5518         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5519     fi
5520     if test ! -f "$MIDL_PATH/midl.exe"; then
5521         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5522     else
5523         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5524     fi
5526     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5527     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5529     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5530          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5531          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5532          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5533     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5534          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5535          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5536          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5537     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5538          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5539          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5540          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5541     else
5542         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5543     fi
5545     dnl Check csc.exe
5546     AC_MSG_CHECKING([for csc.exe])
5547     find_csc
5548     if test -f "$csctest/csc.exe"; then
5549         CSC_PATH="$csctest"
5550     fi
5551     if test ! -f "$CSC_PATH/csc.exe"; then
5552         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5553     else
5554         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5555     fi
5557     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5559     dnl Check al.exe
5560     AC_MSG_CHECKING([for al.exe])
5561     find_winsdk
5562     if test -n "$winsdkbinsubdir" \
5563         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5564     then
5565         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5566     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5567         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5568     elif test -f "$winsdktest/Bin/al.exe"; then
5569         AL_PATH="$winsdktest/Bin"
5570     fi
5572     if test -z "$AL_PATH"; then
5573         find_al
5574         if test -f "$altest/bin/al.exe"; then
5575             AL_PATH="$altest/bin"
5576         elif test -f "$altest/al.exe"; then
5577             AL_PATH="$altest"
5578         fi
5579     fi
5580     if test ! -f "$AL_PATH/al.exe"; then
5581         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5582     else
5583         AC_MSG_RESULT([$AL_PATH/al.exe])
5584     fi
5586     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5588     dnl Check mscoree.lib / .NET Framework dir
5589     AC_MSG_CHECKING(.NET Framework)
5590     find_dotnetsdk
5591     if test -f "$frametest/lib/mscoree.lib"; then
5592         DOTNET_FRAMEWORK_HOME="$frametest"
5593     else
5594         find_winsdk
5595         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5596             DOTNET_FRAMEWORK_HOME="$winsdktest"
5597         else
5598             find_dotnetsdk46
5599             PathFormat "$frametest"
5600             frametest="$formatted_path"
5601             if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5602                  DOTNET_FRAMEWORK_HOME="$frametest"
5603             fi
5604         fi
5605     fi
5607     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
5608         AC_MSG_ERROR([mscoree.lib not found])
5609     fi
5610     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5612     PathFormat "$MIDL_PATH"
5613     MIDL_PATH="$formatted_path"
5615     PathFormat "$AL_PATH"
5616     AL_PATH="$formatted_path"
5618     PathFormat "$DOTNET_FRAMEWORK_HOME"
5619     DOTNET_FRAMEWORK_HOME="$formatted_path"
5621     PathFormat "$CSC_PATH"
5622     CSC_PATH="$formatted_path"
5625 dnl ===================================================================
5626 dnl Check if stdc headers are available excluding MSVC.
5627 dnl ===================================================================
5628 if test "$_os" != "WINNT"; then
5629     AC_HEADER_STDC
5632 dnl ===================================================================
5633 dnl Testing for C++ compiler and version...
5634 dnl ===================================================================
5636 if test "$_os" != "WINNT"; then
5637     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5638     save_CXXFLAGS=$CXXFLAGS
5639     AC_PROG_CXX
5640     CXXFLAGS=$save_CXXFLAGS
5641 else
5642     if test -n "$CC" -a -z "$CXX"; then
5643         CXX="$CC"
5644     fi
5647 dnl check for GNU C++ compiler version
5648 if test "$GXX" = "yes"; then
5649     AC_MSG_CHECKING([the GNU C++ compiler version])
5651     _gpp_version=`$CXX -dumpversion`
5652     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5654     if test "$_gpp_majmin" -lt "401"; then
5655         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5656     else
5657         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5658     fi
5660     dnl see https://code.google.com/p/android/issues/detail?id=41770
5661     if test "$_gpp_majmin" -ge "401"; then
5662         glibcxx_threads=no
5663         AC_LANG_PUSH([C++])
5664         AC_REQUIRE_CPP
5665         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5666         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5667             #include <bits/c++config.h>]],[[
5668             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5669             && !defined(_GLIBCXX__PTHREADS) \
5670             && !defined(_GLIBCXX_HAS_GTHREADS)
5671             choke me
5672             #endif
5673         ]])],[AC_MSG_RESULT([yes])
5674         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5675         AC_LANG_POP([C++])
5676         if test $glibcxx_threads = yes; then
5677             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5678         fi
5679      fi
5681 AC_SUBST(BOOST_CXXFLAGS)
5684 # prefx CXX with ccache if needed
5686 if test "$CCACHE" != ""; then
5687     AC_MSG_CHECKING([whether $CXX is already ccached])
5688     AC_LANG_PUSH([C++])
5689     save_CXXFLAGS=$CXXFLAGS
5690     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5691     dnl an empty program will do, we're checking the compiler flags
5692     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5693                       [use_ccache=yes], [use_ccache=no])
5694     if test $use_ccache = yes; then
5695         AC_MSG_RESULT([yes])
5696     else
5697         CXX="$CCACHE $CXX"
5698         AC_MSG_RESULT([no])
5699     fi
5700     CXXFLAGS=$save_CXXFLAGS
5701     AC_LANG_POP([C++])
5704 dnl ===================================================================
5705 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5706 dnl ===================================================================
5708 if test "$_os" != "WINNT"; then
5709     AC_PROG_CXXCPP
5711     dnl Check whether there's a C pre-processor.
5712     AC_PROG_CPP
5716 dnl ===================================================================
5717 dnl Find integral type sizes and alignments
5718 dnl ===================================================================
5720 if test "$_os" != "WINNT"; then
5722 if test "$_os" == "iOS"; then
5723     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5724     ac_cv_sizeof_long=8
5725     ac_cv_sizeof_short=2
5726     ac_cv_sizeof_int=4
5727     ac_cv_sizeof_long_long=8
5728     ac_cv_sizeof_double=8
5729     ac_cv_sizeof_voidp=8
5730 else
5731     AC_CHECK_SIZEOF(long)
5732     AC_CHECK_SIZEOF(short)
5733     AC_CHECK_SIZEOF(int)
5734     AC_CHECK_SIZEOF(long long)
5735     AC_CHECK_SIZEOF(double)
5736     AC_CHECK_SIZEOF(void*)
5739     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5740     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5741     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5742     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5743     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5745     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5746     m4_pattern_allow([AC_CHECK_ALIGNOF])
5747     m4_ifdef([AC_CHECK_ALIGNOF],
5748         [
5749             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5750             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5751             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5752             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5753         ],
5754         [
5755             case "$_os-$host_cpu" in
5756             Linux-i686)
5757                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5758                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5759                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5760                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5761                 ;;
5762             Linux-x86_64)
5763                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5764                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5765                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5766                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5767                 ;;
5768             *)
5769                 if test -z "$ac_cv_alignof_short" -o \
5770                         -z "$ac_cv_alignof_int" -o \
5771                         -z "$ac_cv_alignof_long" -o \
5772                         -z "$ac_cv_alignof_double"; then
5773                    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.])
5774                 fi
5775                 ;;
5776             esac
5777         ])
5779     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5780     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5781     if test $ac_cv_sizeof_long -eq 8; then
5782         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5783     elif test $ac_cv_sizeof_double -eq 8; then
5784         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5785     else
5786         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5787     fi
5789     dnl Check for large file support
5790     AC_SYS_LARGEFILE
5791     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5792         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5793     fi
5794     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5795         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5796     fi
5797 else
5798     # Hardcode for MSVC
5799     SAL_TYPES_SIZEOFSHORT=2
5800     SAL_TYPES_SIZEOFINT=4
5801     SAL_TYPES_SIZEOFLONG=4
5802     SAL_TYPES_SIZEOFLONGLONG=8
5803     if test "$BITNESS_OVERRIDE" = ""; then
5804         SAL_TYPES_SIZEOFPOINTER=4
5805     else
5806         SAL_TYPES_SIZEOFPOINTER=8
5807     fi
5808     SAL_TYPES_ALIGNMENT2=2
5809     SAL_TYPES_ALIGNMENT4=4
5810     SAL_TYPES_ALIGNMENT8=8
5811     LFS_CFLAGS=''
5813 AC_SUBST(LFS_CFLAGS)
5815 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5816 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5817 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5818 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5819 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5820 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5821 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5822 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5824 dnl ===================================================================
5825 dnl Check whether to enable runtime optimizations
5826 dnl ===================================================================
5827 ENABLE_RUNTIME_OPTIMIZATIONS=
5828 AC_MSG_CHECKING([whether to enable runtime optimizations])
5829 if test -z "$enable_runtime_optimizations"; then
5830     for i in $CC; do
5831         case $i in
5832         -fsanitize=*)
5833             enable_runtime_optimizations=no
5834             break
5835             ;;
5836         esac
5837     done
5839 if test "$enable_runtime_optimizations" != no; then
5840     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5841     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5842     AC_MSG_RESULT([yes])
5843 else
5844     AC_MSG_RESULT([no])
5846 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5848 dnl ===================================================================
5849 dnl Check if valgrind headers are available
5850 dnl ===================================================================
5851 ENABLE_VALGRIND=
5852 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
5853     prev_cppflags=$CPPFLAGS
5854     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5855     # or where does it come from?
5856     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5857     AC_CHECK_HEADER([valgrind/valgrind.h],
5858         [ENABLE_VALGRIND=TRUE])
5859     CPPFLAGS=$prev_cppflags
5861 AC_SUBST([ENABLE_VALGRIND])
5862 if test -z "$ENABLE_VALGRIND"; then
5863     if test "$with_valgrind" = yes; then
5864         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
5865     fi
5866     VALGRIND_CFLAGS=
5868 AC_SUBST([VALGRIND_CFLAGS])
5871 dnl ===================================================================
5872 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5873 dnl ===================================================================
5875 # We need at least the sys/sdt.h include header.
5876 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5877 if test "$SDT_H_FOUND" = "TRUE"; then
5878     # Found sys/sdt.h header, now make sure the c++ compiler works.
5879     # Old g++ versions had problems with probes in constructors/destructors.
5880     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5881     AC_LANG_PUSH([C++])
5882     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5883     #include <sys/sdt.h>
5884     class ProbeClass
5885     {
5886     private:
5887       int& ref;
5888       const char *name;
5890     public:
5891       ProbeClass(int& v, const char *n) : ref(v), name(n)
5892       {
5893         DTRACE_PROBE2(_test_, cons, name, ref);
5894       }
5896       void method(int min)
5897       {
5898         DTRACE_PROBE3(_test_, meth, name, ref, min);
5899         ref -= min;
5900       }
5902       ~ProbeClass()
5903       {
5904         DTRACE_PROBE2(_test_, dest, name, ref);
5905       }
5906     };
5907     ]],[[
5908     int i = 64;
5909     DTRACE_PROBE1(_test_, call, i);
5910     ProbeClass inst = ProbeClass(i, "call");
5911     inst.method(24);
5912     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5913           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5914     AC_LANG_POP([C++])
5916 AC_CONFIG_HEADERS([config_host/config_probes.h])
5918 dnl ===================================================================
5919 dnl GCC features
5920 dnl ===================================================================
5921 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
5922     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5923     save_CFLAGS=$CFLAGS
5924     CFLAGS="$CFLAGS -Werror -mno-avx"
5925     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5926     CFLAGS=$save_CFLAGS
5927     if test "$HAVE_GCC_AVX" = "TRUE"; then
5928         AC_MSG_RESULT([yes])
5929     else
5930         AC_MSG_RESULT([no])
5931     fi
5933     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5934     save_CFLAGS=$CFLAGS
5935     CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
5936     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5937     CFLAGS=$save_CFLAGS
5938     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5939         AC_MSG_RESULT([yes])
5940     else
5941         AC_MSG_RESULT([no])
5942     fi
5944     AC_MSG_CHECKING([whether $CC supports atomic functions])
5945     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5946     int v = 0;
5947     if (__sync_add_and_fetch(&v, 1) != 1 ||
5948         __sync_sub_and_fetch(&v, 1) != 0)
5949         return 1;
5950     __sync_synchronize();
5951     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5952         v != 1)
5953         return 1;
5954     return 0;
5955 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5956     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5957         AC_MSG_RESULT([yes])
5958         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5959     else
5960         AC_MSG_RESULT([no])
5961     fi
5963     AC_MSG_CHECKING([whether $CC supports __builtin_ffs])
5964     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
5965     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
5966         AC_MSG_RESULT([yes])
5967         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
5968     else
5969         AC_MSG_RESULT([no])
5970     fi
5972     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5973     save_CFLAGS=$CFLAGS
5974     CFLAGS="$CFLAGS -Werror"
5975     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5976             __attribute__((deprecated("test"))) void f();
5977         ])], [
5978             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5979             AC_MSG_RESULT([yes])
5980         ], [AC_MSG_RESULT([no])])
5981     CFLAGS=$save_CFLAGS
5983     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
5984     AC_LANG_PUSH([C++])
5985     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5986             #include <cstddef>
5987             #include <cxxabi.h>
5988             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
5989         ])], [
5990             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
5991             AC_MSG_RESULT([yes])
5992         ], [AC_MSG_RESULT([no])])
5993     AC_LANG_POP([C++])
5995     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
5996     AC_LANG_PUSH([C++])
5997     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5998             #include <cstddef>
5999             #include <cxxabi.h>
6000             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6001         ])], [
6002             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6003             AC_MSG_RESULT([yes])
6004         ], [AC_MSG_RESULT([no])])
6005     AC_LANG_POP([C++])
6007     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
6008     AC_LANG_PUSH([C++])
6009     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6010             #include <cxxabi.h>
6011             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6012         ])], [
6013             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6014             AC_MSG_RESULT([yes])
6015         ], [AC_MSG_RESULT([no])])
6016     AC_LANG_POP([C++])
6018     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
6019     AC_LANG_PUSH([C++])
6020     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6021             #include <cstddef>
6022             #include <cxxabi.h>
6023             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6024         ])], [
6025             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6026             AC_MSG_RESULT([yes])
6027         ], [AC_MSG_RESULT([no])])
6028     AC_LANG_POP([C++])
6030     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
6031     AC_LANG_PUSH([C++])
6032     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6033             #include <cstddef>
6034             #include <cxxabi.h>
6035             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6036         ])], [
6037             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6038             AC_MSG_RESULT([yes])
6039         ], [AC_MSG_RESULT([no])])
6040     AC_LANG_POP([C++])
6042     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6043     AC_LANG_PUSH([C++])
6044     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6045             #include <cxxabi.h>
6046             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6047         ])], [
6048             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6049             AC_MSG_RESULT([yes])
6050         ], [AC_MSG_RESULT([no])])
6051     AC_LANG_POP([C++])
6053     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6054     AC_LANG_PUSH([C++])
6055     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6056             #include <cxxabi.h>
6057             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6058         ])], [
6059             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6060             AC_MSG_RESULT([yes])
6061         ], [AC_MSG_RESULT([no])])
6062     AC_LANG_POP([C++])
6064     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
6065     AC_LANG_PUSH([C++])
6066     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6067             #include <cstddef>
6068             #include <cxxabi.h>
6069             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6070         ])], [
6071             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6072             AC_MSG_RESULT([yes])
6073         ], [AC_MSG_RESULT([no])])
6074     AC_LANG_POP([C++])
6076     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
6077     AC_LANG_PUSH([C++])
6078     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6079             #include <cstddef>
6080             #include <cxxabi.h>
6081             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6082         ])], [
6083             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6084             AC_MSG_RESULT([yes])
6085         ], [AC_MSG_RESULT([no])])
6086     AC_LANG_POP([C++])
6088     dnl Available in GCC 4.9 and at least since Clang 3.4:
6089     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6090     AC_LANG_PUSH([C++])
6091     save_CXXFLAGS=$CXXFLAGS
6092     CXXFLAGS="$CXXFLAGS -Werror"
6093     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6094             struct __attribute__((warn_unused)) dummy {};
6095         ])], [
6096             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6097             AC_MSG_RESULT([yes])
6098         ], [AC_MSG_RESULT([no])])
6099     CXXFLAGS=$save_CXXFLAGS
6100 AC_LANG_POP([C++])
6103 AC_SUBST(HAVE_GCC_AVX)
6104 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6105 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6106 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6108 dnl ===================================================================
6109 dnl Identify the C++ library
6110 dnl ===================================================================
6112 AC_MSG_CHECKING([What the C++ library is])
6113 AC_LANG_PUSH([C++])
6114 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6115 #include <utility>
6116 #ifndef __GLIBCXX__
6117 foo bar
6118 #endif
6119 ]])],
6120     [CPP_LIBRARY=GLIBCXX
6121      cpp_library_name="GNU libstdc++"
6122     ],
6123     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6124 #include <utility>
6125 #ifndef _LIBCPP_VERSION
6126 foo bar
6127 #endif
6128 ]])],
6129     [CPP_LIBRARY=LIBCPP
6130      cpp_library_name="LLVM libc++"
6131      AC_DEFINE([HAVE_LIBCXX])
6132     ],
6133     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6134 #include <utility>
6135 #ifndef _MSC_VER
6136 foo bar
6137 #endif
6138 ]])],
6139     [CPP_LIBRARY=MSVCRT
6140      cpp_library_name="Microsoft"
6141     ],
6142     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6143 AC_MSG_RESULT([$cpp_library_name])
6144 AC_LANG_POP([C++])
6146 dnl ===================================================================
6147 dnl Check for gperf
6148 dnl ===================================================================
6149 AC_PATH_PROG(GPERF, gperf)
6150 if test -z "$GPERF"; then
6151     AC_MSG_ERROR([gperf not found but needed. Install it.])
6153 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6154     GPERF=`cygpath -m $GPERF`
6156 AC_MSG_CHECKING([gperf version])
6157 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
6158     AC_MSG_RESULT([OK])
6159 else
6160     AC_MSG_ERROR([too old, you need at least 3.0.0])
6162 AC_SUBST(GPERF)
6164 dnl ===================================================================
6165 dnl Check for system libcmis
6166 dnl ===================================================================
6167 # libcmis requires curl and we can't build curl for iOS
6168 if test $_os != iOS; then
6169     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.0])
6170     ENABLE_LIBCMIS=TRUE
6171 else
6172     ENABLE_LIBCMIS=
6174 AC_SUBST(ENABLE_LIBCMIS)
6176 dnl ===================================================================
6177 dnl C++11
6178 dnl ===================================================================
6180 my_cxx17switches=
6181 libo_FUZZ_ARG_ENABLE(c++17,
6182     AS_HELP_STRING([--disable-c++17],
6183         [Do not attempt to run GCC/Clang in C++17 mode (needed for Coverity).])
6186 CXXFLAGS_CXX11=
6187 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6188     AC_MSG_CHECKING([whether $CXX supports C++11])
6189     AC_MSG_RESULT(yes)
6190     # MSVC supports (a subset of) CXX11 without any switch
6191 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6192     HAVE_CXX11=
6193     AC_MSG_CHECKING([whether $CXX supports C++17, C++14, or C++11])
6194     dnl But only use C++17 if the gperf that is being used knows not to emit
6195     dnl "register" in C++ output:
6196     printf 'foo\n' | $GPERF -L C++ > conftest.inc
6197     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'
6198     if test "$enable_c__17" != no; then
6199         my_flags="-std=gnu++17 -std=gnu++1z -std=c++17 -std=c++1z $my_flags"
6200     fi
6201     for flag in $my_flags; do
6202         if test "$COM" = MSC; then
6203             flag="-Xclang $flag"
6204         fi
6205         save_CXXFLAGS=$CXXFLAGS
6206         CXXFLAGS="$CXXFLAGS $flag -Werror"
6207         if test "$SYSTEM_LIBCMIS" = TRUE; then
6208             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6209         fi
6210         AC_LANG_PUSH([C++])
6211         dnl Clang 3.9 supports __float128 since
6212         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6213         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6214         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6215         dnl $flag is supported below, so check this first):
6216         my_float128hack=
6217         my_float128hack_impl=-D__float128=void
6218         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6219             #include <vector>
6220             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6221             // (__float128)
6222             ]])
6223         ],,[
6224             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6225             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6226             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6227             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6228             dnl place where __float128 is used is in a template specialization, -D__float128=void
6229             dnl will avoid the problem there while still causing a problem if somebody actually uses
6230             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6231             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6232             dnl "fixed" with this hack):
6233             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6234             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6235                 #include <vector>
6236                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6237                 // (__float128)
6238                 ]])
6239             ],[my_float128hack=$my_float128hack_impl])
6240         ])
6241         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6242             #include <algorithm>
6243             #include <functional>
6244             #include <vector>
6246             #include <string.h>
6247             #pragma GCC diagnostic push
6248             #pragma GCC diagnostic ignored "-Wpragmas"
6249                 // make GCC not warn about next pragma
6250             #pragma GCC diagnostic ignored "-Wdeprecated-register"
6251                 // make Clang with -std < C++17 not even warn about register
6252             #include "conftest.inc"
6253             #pragma GCC diagnostic pop
6255             #if defined SYSTEM_LIBCMIS
6256             // See ucb/source/ucp/cmis/auth_provider.hxx:
6257             #if __GNUC__ >= 7
6258             #pragma GCC diagnostic push
6259             #pragma GCC diagnostic ignored "-Wdeprecated"
6260             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6261             #endif
6262             #include <libcmis/libcmis.hxx>
6263             #if __GNUC__ >= 7
6264             #pragma GCC diagnostic pop
6265             #endif
6266             #endif
6268             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6269                 std::sort(v.begin(), v.end(), fn);
6270             }
6271             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6272         AC_LANG_POP([C++])
6273         CXXFLAGS=$save_CXXFLAGS
6274         if test -n "$CXXFLAGS_CXX11"; then
6275             HAVE_CXX11=TRUE
6276             break
6277         fi
6278     done
6279     rm conftest.inc
6280     if test "$HAVE_CXX11" = TRUE; then
6281         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6282     else
6283         AC_MSG_ERROR(no)
6284     fi
6286 AC_SUBST(CXXFLAGS_CXX11)
6288 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6289 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6290 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6291 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6292 dnl again towards 4.7.2:
6293 if test $CPP_LIBRARY = GLIBCXX; then
6294     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6295     AC_LANG_PUSH([C++])
6296     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6297 #include <list>
6298 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6299     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6300     //   GCC 4.7.0: 20120322
6301     //   GCC 4.7.1: 20120614
6302     // and using a range check is not possible as the mapping between
6303     // __GLIBCXX__ values and GCC versions is not monotonic
6304 /* ok */
6305 #else
6306 abi broken
6307 #endif
6308         ]])], [AC_MSG_RESULT(no, ok)],
6309         [AC_MSG_ERROR(yes)])
6310     AC_LANG_POP([C++])
6313 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6314 save_CXXFLAGS=$CXXFLAGS
6315 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6316 AC_LANG_PUSH([C++])
6318 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6319 #include <stddef.h>
6321 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6323 namespace
6325         struct b
6326         {
6327                 int i;
6328                 int j;
6329         };
6331 ]], [[
6332 struct a
6334         int i;
6335         int j;
6337 a thinga[]={{0,0}, {1,1}};
6338 b thingb[]={{0,0}, {1,1}};
6339 size_t i = sizeof(sal_n_array_size(thinga));
6340 size_t j = sizeof(sal_n_array_size(thingb));
6341 return !(i != 0 && j != 0);
6343     ], [ AC_MSG_RESULT(yes) ],
6344     [ AC_MSG_ERROR(no)])
6345 AC_LANG_POP([C++])
6346 CXXFLAGS=$save_CXXFLAGS
6348 AC_MSG_CHECKING([whether $CXX supports C++14 constexpr])
6349 save_CXXFLAGS=$CXXFLAGS
6350 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6351 AC_LANG_PUSH([C++])
6352 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6353     // A somewhat over-complicated way of checking for
6354     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6355     // in constexpr function":
6356     #include <cassert>
6357     template<typename T> inline constexpr T f(T x) { return x; }
6358     template<typename T> inline constexpr T g(T x) {
6359         assert(f(static_cast<int>(x)));
6360         return x;
6361     }
6362     enum E { e };
6363     auto v = g(E::e);
6365     struct S {
6366         int n_;
6367         constexpr bool f() {
6368             int n = n_;
6369             int i = 0;
6370             while (n > 0) { --n; ++i; }
6371             assert(i >= 0);
6372             return i == 0;
6373         }
6374     };
6375     constexpr auto v2 = S{10}.f();
6376     ]])], [cxx14_constexpr=yes], [cxx14_constexpr=no])
6377 AC_LANG_POP([C++])
6378 CXXFLAGS=$save_CXXFLAGS
6379 AC_MSG_RESULT([$cxx14_constexpr])
6380 if test "$cxx14_constexpr" = yes; then
6381     AC_DEFINE([HAVE_CXX14_CONSTEXPR])
6384 dnl _Pragma support (may require C++11)
6385 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6386     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6387     AC_LANG_PUSH([C++])
6388     save_CXXFLAGS=$CXXFLAGS
6389     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6390     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6391             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6392         ])], [
6393             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6394             AC_MSG_RESULT([yes])
6395         ], [AC_MSG_RESULT([no])])
6396     AC_LANG_POP([C++])
6397     CXXFLAGS=$save_CXXFLAGS
6400 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6401 if test "$GCC" = yes; then
6402     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6403     AC_LANG_PUSH([C++])
6404     save_CXXFLAGS=$CXXFLAGS
6405     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6406     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6407     CXXFLAGS=$save_CXXFLAGS
6408     AC_LANG_POP([C++])
6409     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6410         AC_MSG_RESULT([yes])
6411     else
6412         AC_MSG_RESULT([no])
6413     fi
6415 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6417 HAVE_CPP_GUARANTEED_COPY_ELISION=
6418 AC_MSG_CHECKING([whether $CXX supports guaranteed copy elision])
6419 AC_LANG_PUSH([C++])
6420 save_CXXFLAGS=$CXXFLAGS
6421 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6422 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6423         #if !defined __cpp_guaranteed_copy_elision
6424         struct S {
6425         private:
6426             S(S const &);
6427         public:
6428             S copy() const { return *this; }
6429         };
6430         void f(S & s) { S c(s.copy()); }
6431         #endif
6432     ])], [
6433         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6434         AC_MSG_RESULT([yes])
6435     ], [AC_MSG_RESULT([no])])
6436 CXXFLAGS=$save_CXXFLAGS
6437 AC_LANG_POP([C++])
6438 AC_SUBST([HAVE_CPP_GUARANTEED_COPY_ELISION])
6440 dnl ===================================================================
6441 dnl system stl sanity tests
6442 dnl ===================================================================
6443 if test "$_os" != "WINNT"; then
6445     AC_LANG_PUSH([C++])
6447     save_CPPFLAGS="$CPPFLAGS"
6448     if test -n "$MACOSX_SDK_PATH"; then
6449         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6450     fi
6452     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6453     # only.
6454     if test "$CPP_LIBRARY" = GLIBCXX; then
6455         dnl gcc#19664, gcc#22482, rhbz#162935
6456         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6457         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6458         AC_MSG_RESULT([$stlvisok])
6459         if test "$stlvisok" = "no"; then
6460             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6461         fi
6462     fi
6464     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6465     # when we don't make any dynamic libraries?
6466     if test "$DISABLE_DYNLOADING" = ""; then
6467         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6468         cat > conftestlib1.cc <<_ACEOF
6469 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6470 struct S2: S1<int> { virtual ~S2(); };
6471 S2::~S2() {}
6472 _ACEOF
6473         cat > conftestlib2.cc <<_ACEOF
6474 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6475 struct S2: S1<int> { virtual ~S2(); };
6476 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6477 _ACEOF
6478         gccvisinlineshiddenok=yes
6479         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6480             gccvisinlineshiddenok=no
6481         else
6482             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6483             dnl known to not work with -z defs (unsetting which makes the test
6484             dnl moot, though):
6485             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6486             if test "$COM_IS_CLANG" = TRUE; then
6487                 for i in $CXX $CXXFLAGS; do
6488                     case $i in
6489                     -fsanitize=*)
6490                         my_linkflagsnoundefs=
6491                         break
6492                         ;;
6493                     esac
6494                 done
6495             fi
6496             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6497                 gccvisinlineshiddenok=no
6498             fi
6499         fi
6501         rm -fr libconftest*
6502         AC_MSG_RESULT([$gccvisinlineshiddenok])
6503         if test "$gccvisinlineshiddenok" = "no"; then
6504             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6505         fi
6506     fi
6508    AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6509     cat >visibility.cxx <<_ACEOF
6510 #pragma GCC visibility push(hidden)
6511 struct __attribute__ ((visibility ("default"))) TestStruct {
6512   static void Init();
6514 __attribute__ ((visibility ("default"))) void TestFunc() {
6515   TestStruct::Init();
6517 _ACEOF
6518     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6519         gccvisbroken=yes
6520     else
6521         case "$host_cpu" in
6522         i?86|x86_64)
6523             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6524                 gccvisbroken=no
6525             else
6526                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6527                     gccvisbroken=no
6528                 else
6529                     gccvisbroken=yes
6530                 fi
6531             fi
6532             ;;
6533         *)
6534             gccvisbroken=no
6535             ;;
6536         esac
6537     fi
6538     rm -f visibility.s visibility.cxx
6540     AC_MSG_RESULT([$gccvisbroken])
6541     if test "$gccvisbroken" = "yes"; then
6542         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6543     fi
6545     CPPFLAGS="$save_CPPFLAGS"
6547     AC_LANG_POP([C++])
6550 dnl ===================================================================
6551 dnl  Clang++ tests
6552 dnl ===================================================================
6554 HAVE_GCC_FNO_DEFAULT_INLINE=
6555 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6556 if test "$GCC" = "yes"; then
6557     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6558     AC_LANG_PUSH([C++])
6559     save_CXXFLAGS=$CXXFLAGS
6560     CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6561     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6562     CXXFLAGS=$save_CXXFLAGS
6563     AC_LANG_POP([C++])
6564     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6565         AC_MSG_RESULT([yes])
6566     else
6567         AC_MSG_RESULT([no])
6568     fi
6570     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6571     AC_LANG_PUSH([C++])
6572     save_CXXFLAGS=$CXXFLAGS
6573     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6574     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6575     CXXFLAGS=$save_CXXFLAGS
6576     AC_LANG_POP([C++])
6577     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6578         AC_MSG_RESULT([yes])
6579     else
6580         AC_MSG_RESULT([no])
6581     fi
6583 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6584 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6586 dnl ===================================================================
6587 dnl Compiler plugins
6588 dnl ===================================================================
6590 COMPILER_PLUGINS=
6591 # currently only Clang
6593 if test "$COM_IS_CLANG" != "TRUE"; then
6594     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6595         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6596         enable_compiler_plugins=no
6597     fi
6600 if test "$COM_IS_CLANG" = "TRUE"; then
6601     if test -n "$enable_compiler_plugins"; then
6602         compiler_plugins="$enable_compiler_plugins"
6603     elif test -n "$ENABLE_DBGUTIL"; then
6604         compiler_plugins=test
6605     else
6606         compiler_plugins=no
6607     fi
6608     if test "$compiler_plugins" != no -a "$CLANGVER" -lt 30800; then
6609         if test "$compiler_plugins" = yes; then
6610             AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 3.8.0.])
6611         else
6612             compiler_plugins=no
6613         fi
6614     fi
6615     if test "$compiler_plugins" != "no"; then
6616         dnl The prefix where Clang resides, override to where Clang resides if
6617         dnl using a source build:
6618         if test -z "$CLANGDIR"; then
6619             CLANGDIR=/usr
6620         fi
6621         AC_LANG_PUSH([C++])
6622         save_CPPFLAGS=$CPPFLAGS
6623         save_CXX=$CXX
6624         # compiler plugins must be built with "native" compiler that was used to build Clang itself:
6625         : "${COMPILER_PLUGINS_CXX=g++}"
6626         CXX=$COMPILER_PLUGINS_CXX
6627         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6628         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6629             [COMPILER_PLUGINS=TRUE],
6630             [
6631             if test "$compiler_plugins" = "yes"; then
6632                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6633             else
6634                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6635                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6636             fi
6637             ])
6638         CXX=$save_CXX
6639         CPPFLAGS=$save_CPPFLAGS
6640         AC_LANG_POP([C++])
6641     fi
6642 else
6643     if test "$enable_compiler_plugins" = "yes"; then
6644         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6645     fi
6647 AC_SUBST(COMPILER_PLUGINS)
6648 AC_SUBST(COMPILER_PLUGINS_CXX)
6649 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
6650 AC_SUBST(COMPILER_PLUGINS_DEBUG)
6651 AC_SUBST(CLANGDIR)
6652 AC_SUBST(CLANGLIBDIR)
6654 # Plugin to help linker.
6655 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6656 # This makes --enable-lto build with clang work.
6657 AC_SUBST(LD_PLUGIN)
6659 dnl ===================================================================
6660 dnl allocator
6661 dnl ===================================================================
6662 AC_MSG_CHECKING([which memory allocator to use])
6663 if test "$with_alloc" = "system"; then
6664     AC_MSG_RESULT([system])
6665     ALLOC="SYS_ALLOC"
6667 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6668     AC_MSG_RESULT([internal])
6670 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6671 AC_SUBST(HAVE_POSIX_FALLOCATE)
6672 AC_SUBST(ALLOC)
6674 dnl ===================================================================
6675 dnl Custom build version
6676 dnl ===================================================================
6678 AC_MSG_CHECKING([whether to add custom build version])
6679 if test "$with_build_version" != ""; then
6680     BUILD_VER_STRING=$with_build_version
6681     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6682 else
6683     BUILD_VER_STRING=
6684     AC_MSG_RESULT([no])
6686 AC_SUBST(BUILD_VER_STRING)
6688 JITC_PROCESSOR_TYPE=""
6689 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6690     # IBMs JDK needs this...
6691     JITC_PROCESSOR_TYPE=6
6692     export JITC_PROCESSOR_TYPE
6694 AC_SUBST([JITC_PROCESSOR_TYPE])
6696 # Misc Windows Stuff
6697 AC_ARG_WITH(ucrt-dir,
6698     AS_HELP_STRING([--with-ucrt-dir],
6699         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
6700         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
6701         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
6702             Windows6.1-KB2999226-x64.msu
6703             Windows6.1-KB2999226-x86.msu
6704             Windows8.1-KB2999226-x64.msu
6705             Windows8.1-KB2999226-x86.msu
6706             Windows8-RT-KB2999226-x64.msu
6707             Windows8-RT-KB2999226-x86.msu
6708         A zip archive including those files is available from Microsoft site:
6709         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
6711 UCRT_REDISTDIR="$with_ucrt_dir"
6712 if test $_os = "WINNT"; then
6713     find_msvc_x64_dlls
6714     find_msms
6715     MSVC_DLL_PATH="$msvcdllpath"
6716     MSVC_DLLS="$msvcdlls"
6717     MSM_PATH="$msmdir"
6718     # MSVC 15.3 changed it to VC141
6719     if echo "$MSVC_DLL_PATH" | grep -q "VC141.CRT$"; then
6720         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
6721     else
6722         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6723     fi
6724     if test "$UCRT_REDISTDIR" = "no"; then
6725         dnl explicitly disabled
6726         UCRT_REDISTDIR=""
6727     else
6728         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
6729                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
6730                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
6731                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
6732                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
6733                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
6734             UCRT_REDISTDIR=""
6735             if test -n "$PKGFORMAT"; then
6736                for i in $PKGFORMAT; do
6737                    case "$i" in
6738                    msi)
6739                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
6740                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
6741                        ;;
6742                    esac
6743                done
6744             fi
6745         fi
6746     fi
6749 AC_SUBST(UCRT_REDISTDIR)
6750 AC_SUBST(MSVC_DLL_PATH)
6751 AC_SUBST(MSVC_DLLS)
6752 AC_SUBST(MSM_PATH)
6754 dnl ===================================================================
6755 dnl Checks for Java
6756 dnl ===================================================================
6757 if test "$ENABLE_JAVA" != ""; then
6759     # Windows-specific tests
6760     if test "$build_os" = "cygwin"; then
6761         if test "$BITNESS_OVERRIDE" = 64; then
6762             bitness=64
6763         else
6764             bitness=32
6765         fi
6767         if test -z "$with_jdk_home"; then
6768             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
6769             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
6770             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
6771             if test -n "$regvalue"; then
6772                 ver=$regvalue
6773                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
6774                 _jdk_home=$regvalue
6775             fi
6776             if test -z "$with_jdk_home"; then
6777                 for ver in 1.8 1.7 1.6; do
6778                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6779                     if test -n "$regvalue"; then
6780                         _jdk_home=$regvalue
6781                         break
6782                     fi
6783                 done
6784             fi
6785             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6786                 with_jdk_home="$_jdk_home"
6787                 howfound="found automatically"
6788             else
6789                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6790             fi
6791         else
6792             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6793             howfound="you passed"
6794         fi
6795     fi
6797     # 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.
6798     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6799     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6800         with_jdk_home=`/usr/libexec/java_home`
6801     fi
6803     JAVA_HOME=; export JAVA_HOME
6804     if test -z "$with_jdk_home"; then
6805         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6806     else
6807         _java_path="$with_jdk_home/bin/$with_java"
6808         dnl Check if there is a Java interpreter at all.
6809         if test -x "$_java_path"; then
6810             JAVAINTERPRETER=$_java_path
6811         else
6812             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6813         fi
6814     fi
6816     dnl Check that the JDK found is correct architecture (at least 2 reasons to
6817     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
6818     dnl loaded by java to run JunitTests:
6819     if test "$build_os" = "cygwin"; then
6820         shortjdkhome=`cygpath -d "$with_jdk_home"`
6821         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
6822             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6823             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6824         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
6825             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6826             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6827         fi
6829         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6830             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6831         fi
6832         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6833     elif test "$cross_compiling" != "yes"; then
6834         case $CPUNAME in
6835             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
6836                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6837                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6838                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6839                 fi
6840                 ;;
6841             *) # assumption: everything else 32-bit
6842                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6843                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6844                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6845                 fi
6846                 ;;
6847         esac
6848     fi
6851 HAVE_JAVA9=
6852 dnl ===================================================================
6853 dnl Checks for JDK.
6854 dnl ===================================================================
6856 # Note that JAVA_HOME as for now always means the *build* platform's
6857 # JAVA_HOME. Whether all the complexity here actually is needed any
6858 # more or not, no idea.
6860 if test "$ENABLE_JAVA" != ""; then
6861     _gij_longver=0
6862     AC_MSG_CHECKING([the installed JDK])
6863     if test -n "$JAVAINTERPRETER"; then
6864         dnl java -version sends output to stderr!
6865         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6866             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6867         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6868             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6869         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6870             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6871         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6872             JDK=ibm
6874             dnl IBM JDK specific tests
6875             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6876             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6878             if test "$_jdk_ver" -lt 10600; then
6879                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
6880             fi
6882             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6884             if test "$with_jdk_home" = ""; then
6885                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6886 you must use the "--with-jdk-home" configure option explicitly])
6887             fi
6889             JAVA_HOME=$with_jdk_home
6890         else
6891             JDK=sun
6893             dnl Sun JDK specific tests
6894             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
6895             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6897             if test "$_jdk_ver" -lt 10600; then
6898                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
6899             fi
6900             if test "$_jdk_ver" -gt 10600; then
6901                 JAVA_CLASSPATH_NOT_SET=TRUE
6902             fi
6903             if test "$_jdk_ver" -ge 10900; then
6904                 HAVE_JAVA9=TRUE
6905             fi
6907             AC_MSG_RESULT([checked (JDK $_jdk)])
6908             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6909             if test "$_os" = "WINNT"; then
6910                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6911             fi
6913             # set to limit VM usage for JunitTests
6914             JAVAIFLAGS=-Xmx64M
6915             # set to limit VM usage for javac
6916             JAVAFLAGS=-J-Xmx128M
6917         fi
6918     else
6919         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
6920     fi
6921 else
6922     dnl Java disabled
6923     JAVA_HOME=
6924     export JAVA_HOME
6927 dnl ===================================================================
6928 dnl Set target Java bytecode version
6929 dnl ===================================================================
6930 if test "$ENABLE_JAVA" != ""; then
6931     if test "$HAVE_JAVA9" = "TRUE"; then
6932         _java_target_ver="1.6"
6933     else
6934         _java_target_ver="1.5"
6935     fi
6936     JAVA_SOURCE_VER="$_java_target_ver"
6937     JAVA_TARGET_VER="$_java_target_ver"
6940 dnl ===================================================================
6941 dnl Checks for javac
6942 dnl ===================================================================
6943 if test "$ENABLE_JAVA" != ""; then
6944     javacompiler="javac"
6945     if test -z "$with_jdk_home"; then
6946         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6947     else
6948         _javac_path="$with_jdk_home/bin/$javacompiler"
6949         dnl Check if there is a Java compiler at all.
6950         if test -x "$_javac_path"; then
6951             JAVACOMPILER=$_javac_path
6952         fi
6953     fi
6954     if test -z "$JAVACOMPILER"; then
6955         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6956     fi
6957     if test "$build_os" = "cygwin"; then
6958         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6959             JAVACOMPILER="${JAVACOMPILER}.exe"
6960         fi
6961         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
6962     fi
6965 dnl ===================================================================
6966 dnl Checks for javadoc
6967 dnl ===================================================================
6968 if test "$ENABLE_JAVA" != ""; then
6969     if test -z "$with_jdk_home"; then
6970         AC_PATH_PROG(JAVADOC, javadoc)
6971     else
6972         _javadoc_path="$with_jdk_home/bin/javadoc"
6973         dnl Check if there is a javadoc at all.
6974         if test -x "$_javadoc_path"; then
6975             JAVADOC=$_javadoc_path
6976         else
6977             AC_PATH_PROG(JAVADOC, javadoc)
6978         fi
6979     fi
6980     if test -z "$JAVADOC"; then
6981         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6982     fi
6983     if test "$build_os" = "cygwin"; then
6984         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6985             JAVADOC="${JAVADOC}.exe"
6986         fi
6987         JAVADOC=`win_short_path_for_make "$JAVADOC"`
6988     fi
6990     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6991     JAVADOCISGJDOC="yes"
6992     fi
6994 AC_SUBST(JAVADOCISGJDOC)
6996 if test "$ENABLE_JAVA" != ""; then
6997     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
6998     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
6999         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7000            # try to recover first by looking whether we have a alternatives
7001            # system as in Debian or newer SuSEs where following /usr/bin/javac
7002            # over /etc/alternatives/javac leads to the right bindir where we
7003            # just need to strip a bit away to get a valid JAVA_HOME
7004            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7005         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7006             # maybe only one level of symlink (e.g. on Mac)
7007             JAVA_HOME=$(readlink $JAVACOMPILER)
7008             if test "$(dirname $JAVA_HOME)" = "."; then
7009                 # we've got no path to trim back
7010                 JAVA_HOME=""
7011             fi
7012         else
7013             # else warn
7014             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7015             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7016             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7017             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7018         fi
7019         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
7020         if test "$JAVA_HOME" != "/usr"; then
7021             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7022                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7023                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7024                 dnl Tiger already returns a JDK path..
7025                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7026             else
7027                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7028                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7029                 dnl that checks which version to run
7030                 if test -f "$JAVA_HOME"; then
7031                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7032                 fi
7033             fi
7034         fi
7035     fi
7036     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7038     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7039     if test -z "$JAVA_HOME"; then
7040         if test "x$with_jdk_home" = "x"; then
7041             cat > findhome.java <<_ACEOF
7042 [import java.io.File;
7044 class findhome
7046     public static void main(String args[])
7047     {
7048         String jrelocation = System.getProperty("java.home");
7049         File jre = new File(jrelocation);
7050         System.out.println(jre.getParent());
7051     }
7053 _ACEOF
7054             AC_MSG_CHECKING([if javac works])
7055             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7056             AC_TRY_EVAL(javac_cmd)
7057             if test $? = 0 -a -f ./findhome.class; then
7058                 AC_MSG_RESULT([javac works])
7059             else
7060                 echo "configure: javac test failed" >&5
7061                 cat findhome.java >&5
7062                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7063             fi
7064             AC_MSG_CHECKING([if gij knows its java.home])
7065             JAVA_HOME=`$JAVAINTERPRETER findhome`
7066             if test $? = 0 -a "$JAVA_HOME" != ""; then
7067                 AC_MSG_RESULT([$JAVA_HOME])
7068             else
7069                 echo "configure: java test failed" >&5
7070                 cat findhome.java >&5
7071                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7072             fi
7073             # clean-up after ourselves
7074             rm -f ./findhome.java ./findhome.class
7075         else
7076             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7077         fi
7078     fi
7080     # now check if $JAVA_HOME is really valid
7081     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7082         case "${JAVA_HOME}" in
7083             /Library/Java/JavaVirtualMachines/*)
7084                 ;;
7085             *)
7086                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7087                 ;;
7088         esac
7089         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7090             JAVA_HOME_OK="NO"
7091         fi
7092     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7093         JAVA_HOME_OK="NO"
7094     fi
7095     if test "$JAVA_HOME_OK" = "NO"; then
7096         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7097         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7098         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7099         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7100         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7101         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7102     fi
7103     PathFormat "$JAVA_HOME"
7104     JAVA_HOME="$formatted_path"
7107 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7108     "$_os" != Darwin
7109 then
7110     AC_MSG_CHECKING([for JAWT lib])
7111     if test "$_os" = WINNT; then
7112         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7113         JAWTLIB=jawt.lib
7114     else
7115         case "$host_cpu" in
7116         arm*)
7117             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7118             JAVA_ARCH=$my_java_arch
7119             ;;
7120         i*86)
7121             my_java_arch=i386
7122             ;;
7123         m68k)
7124             my_java_arch=m68k
7125             ;;
7126         powerpc)
7127             my_java_arch=ppc
7128             ;;
7129         powerpc64)
7130             my_java_arch=ppc64
7131             ;;
7132         powerpc64le)
7133             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7134             JAVA_ARCH=$my_java_arch
7135             ;;
7136         sparc64)
7137             my_java_arch=sparcv9
7138             ;;
7139         x86_64)
7140             my_java_arch=amd64
7141             ;;
7142         *)
7143             my_java_arch=$host_cpu
7144             ;;
7145         esac
7146         # This is where JDK9 puts the library
7147         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7148             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7149         else
7150             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7151         fi
7152         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7153     fi
7154     AC_MSG_RESULT([$JAWTLIB])
7156 AC_SUBST(JAWTLIB)
7158 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7159     case "$host_os" in
7161     aix*)
7162         JAVAINC="-I$JAVA_HOME/include"
7163         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7164         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7165         ;;
7167     cygwin*)
7168         JAVAINC="-I$JAVA_HOME/include/win32"
7169         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7170         ;;
7172     darwin*)
7173         if test -d "$JAVA_HOME/include/darwin"; then
7174             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7175         else
7176             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7177         fi
7178         ;;
7180     dragonfly*)
7181         JAVAINC="-I$JAVA_HOME/include"
7182         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7183         ;;
7185     freebsd*)
7186         JAVAINC="-I$JAVA_HOME/include"
7187         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7188         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7189         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7190         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7191         ;;
7193     k*bsd*-gnu*)
7194         JAVAINC="-I$JAVA_HOME/include"
7195         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7196         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7197         ;;
7199     linux-gnu*)
7200         JAVAINC="-I$JAVA_HOME/include"
7201         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7202         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7203         ;;
7205     *netbsd*)
7206         JAVAINC="-I$JAVA_HOME/include"
7207         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7208         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7209        ;;
7211     openbsd*)
7212         JAVAINC="-I$JAVA_HOME/include"
7213         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7214         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7215         ;;
7217     solaris*)
7218         JAVAINC="-I$JAVA_HOME/include"
7219         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7220         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7221         ;;
7222     esac
7224 SOLARINC="$SOLARINC $JAVAINC"
7226 AC_SUBST(JAVACOMPILER)
7227 AC_SUBST(JAVADOC)
7228 AC_SUBST(JAVAINTERPRETER)
7229 AC_SUBST(JAVAIFLAGS)
7230 AC_SUBST(JAVAFLAGS)
7231 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7232 AC_SUBST(JAVA_HOME)
7233 AC_SUBST(JAVA_SOURCE_VER)
7234 AC_SUBST(JAVA_TARGET_VER)
7235 AC_SUBST(JDK)
7238 dnl ===================================================================
7239 dnl Export file validation
7240 dnl ===================================================================
7241 AC_MSG_CHECKING([whether to enable export file validation])
7242 if test "$with_export_validation" != "no"; then
7243     if test -z "$ENABLE_JAVA"; then
7244         if test "$with_export_validation" = "yes"; then
7245             AC_MSG_ERROR([requested, but Java is disabled])
7246         else
7247             AC_MSG_RESULT([no, as Java is disabled])
7248         fi
7249     elif test "$_jdk_ver" -lt 10800; then
7250         if test "$with_export_validation" = "yes"; then
7251             AC_MSG_ERROR([requested, but Java is too old, need Java 8])
7252         else
7253             AC_MSG_RESULT([no, as Java is too old, need Java 8])
7254         fi
7255     else
7256         AC_MSG_RESULT([yes])
7257         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7259         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7260         if test -z "$ODFVALIDATOR"; then
7261             # remember to download the ODF toolkit with validator later
7262             AC_MSG_NOTICE([no odfvalidator found, will download it])
7263             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7264             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7266             # and fetch name of odfvalidator jar name from download.lst
7267             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7268             AC_SUBST(ODFVALIDATOR_JAR)
7270             if test -z "$ODFVALIDATOR_JAR"; then
7271                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7272             fi
7273         fi
7274         if test "$build_os" = "cygwin"; then
7275             # In case of Cygwin it will be executed from Windows,
7276             # so we need to run bash and absolute path to validator
7277             # so instead of "odfvalidator" it will be
7278             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7279             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7280         else
7281             ODFVALIDATOR="sh $ODFVALIDATOR"
7282         fi
7283         AC_SUBST(ODFVALIDATOR)
7286         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7287         if test -z "$OFFICEOTRON"; then
7288             # remember to download the officeotron with validator later
7289             AC_MSG_NOTICE([no officeotron found, will download it])
7290             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7291             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7293             # and fetch name of officeotron jar name from download.lst
7294             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7295             AC_SUBST(OFFICEOTRON_JAR)
7297             if test -z "$OFFICEOTRON_JAR"; then
7298                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7299             fi
7300         else
7301             # check version of existing officeotron
7302             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7303             if test 0"$OFFICEOTRON_VER" -lt 704; then
7304                 AC_MSG_ERROR([officeotron too old])
7305             fi
7306         fi
7307         if test "$build_os" = "cygwin"; then
7308             # In case of Cygwin it will be executed from Windows,
7309             # so we need to run bash and absolute path to validator
7310             # so instead of "odfvalidator" it will be
7311             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7312             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7313         else
7314             OFFICEOTRON="sh $OFFICEOTRON"
7315         fi
7316     fi
7317     AC_SUBST(OFFICEOTRON)
7318 else
7319     AC_MSG_RESULT([no])
7322 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7323 if test "$with_bffvalidator" != "no"; then
7324     AC_DEFINE(HAVE_BFFVALIDATOR)
7326     if test "$with_export_validation" = "no"; then
7327         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7328     fi
7330     if test "$with_bffvalidator" = "yes"; then
7331         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7332     else
7333         BFFVALIDATOR="$with_bffvalidator"
7334     fi
7336     if test "$build_os" = "cygwin"; then
7337         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7338             AC_MSG_RESULT($BFFVALIDATOR)
7339         else
7340             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7341         fi
7342     elif test -n "$BFFVALIDATOR"; then
7343         # We are not in Cygwin but need to run Windows binary with wine
7344         AC_PATH_PROGS(WINE, wine)
7346         # so swap in a shell wrapper that converts paths transparently
7347         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7348         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7349         AC_SUBST(BFFVALIDATOR_EXE)
7350         AC_MSG_RESULT($BFFVALIDATOR)
7351     else
7352         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7353     fi
7354     AC_SUBST(BFFVALIDATOR)
7355 else
7356     AC_MSG_RESULT([no])
7359 dnl ===================================================================
7360 dnl Check for C preprocessor to use
7361 dnl ===================================================================
7362 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7363 if test -n "$with_idlc_cpp"; then
7364     AC_MSG_RESULT([$with_idlc_cpp])
7365     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7366 else
7367     AC_MSG_RESULT([ucpp])
7368     AC_MSG_CHECKING([which ucpp tp use])
7369     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7370         AC_MSG_RESULT([external])
7371         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7372     else
7373         AC_MSG_RESULT([internal])
7374         BUILD_TYPE="$BUILD_TYPE UCPP"
7375     fi
7377 AC_SUBST(SYSTEM_UCPP)
7379 dnl ===================================================================
7380 dnl Check for epm (not needed for Windows)
7381 dnl ===================================================================
7382 AC_MSG_CHECKING([whether to enable EPM for packing])
7383 if test "$enable_epm" = "yes"; then
7384     AC_MSG_RESULT([yes])
7385     if test "$_os" != "WINNT"; then
7386         if test $_os = Darwin; then
7387             EPM=internal
7388         elif test -n "$with_epm"; then
7389             EPM=$with_epm
7390         else
7391             AC_PATH_PROG(EPM, epm, no)
7392         fi
7393         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7394             AC_MSG_NOTICE([EPM will be built.])
7395             BUILD_TYPE="$BUILD_TYPE EPM"
7396             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7397         else
7398             # Gentoo has some epm which is something different...
7399             AC_MSG_CHECKING([whether the found epm is the right epm])
7400             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7401                 AC_MSG_RESULT([yes])
7402             else
7403                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7404             fi
7405             AC_MSG_CHECKING([epm version])
7406             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7407             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7408                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7409                 AC_MSG_RESULT([OK, >= 3.7])
7410             else
7411                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7412                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7413             fi
7414         fi
7415     fi
7417     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7418         AC_MSG_CHECKING([for rpm])
7419         for a in "$RPM" rpmbuild rpm; do
7420             $a --usage >/dev/null 2> /dev/null
7421             if test $? -eq 0; then
7422                 RPM=$a
7423                 break
7424             else
7425                 $a --version >/dev/null 2> /dev/null
7426                 if test $? -eq 0; then
7427                     RPM=$a
7428                     break
7429                 fi
7430             fi
7431         done
7432         if test -z "$RPM"; then
7433             AC_MSG_ERROR([not found])
7434         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7435             RPM_PATH=`which $RPM`
7436             AC_MSG_RESULT([$RPM_PATH])
7437             SCPDEFS="$SCPDEFS -DWITH_RPM"
7438         else
7439             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7440         fi
7441     fi
7442     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7443         AC_PATH_PROG(DPKG, dpkg, no)
7444         if test "$DPKG" = "no"; then
7445             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7446         fi
7447     fi
7448     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7449        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7450         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7451             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7452                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7453                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7454                     AC_MSG_RESULT([yes])
7455                 else
7456                     AC_MSG_RESULT([no])
7457                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7458                         _pt="rpm"
7459                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7460                         add_warning "the rpms will need to be installed with --nodeps"
7461                     else
7462                         _pt="pkg"
7463                     fi
7464                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7465                     add_warning "the ${_pt}s will not be relocatable"
7466                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7467                                  relocation will work, you need to patch your epm with the
7468                                  patch in epm/epm-3.7.patch or build with
7469                                  --with-epm=internal which will build a suitable epm])
7470                 fi
7471             fi
7472         fi
7473     fi
7474     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7475         AC_PATH_PROG(PKGMK, pkgmk, no)
7476         if test "$PKGMK" = "no"; then
7477             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7478         fi
7479     fi
7480     AC_SUBST(RPM)
7481     AC_SUBST(DPKG)
7482     AC_SUBST(PKGMK)
7483 else
7484     for i in $PKGFORMAT; do
7485         case "$i" in
7486         aix | bsd | deb | pkg | rpm | native | portable)
7487             AC_MSG_ERROR(
7488                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7489             ;;
7490         esac
7491     done
7492     AC_MSG_RESULT([no])
7493     EPM=NO
7495 AC_SUBST(EPM)
7497 ENABLE_LWP=
7498 if test "$enable_lotuswordpro" = "yes"; then
7499     ENABLE_LWP="TRUE"
7501 AC_SUBST(ENABLE_LWP)
7503 dnl ===================================================================
7504 dnl Check for building ODK
7505 dnl ===================================================================
7506 if test "$enable_odk" = no; then
7507     unset DOXYGEN
7508 else
7509     if test "$with_doxygen" = no; then
7510         AC_MSG_CHECKING([for doxygen])
7511         unset DOXYGEN
7512         AC_MSG_RESULT([no])
7513     else
7514         if test "$with_doxygen" = yes; then
7515             AC_PATH_PROG([DOXYGEN], [doxygen])
7516             if test -z "$DOXYGEN"; then
7517                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7518             fi
7519             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
7520                 if ! dot -V 2>/dev/null; then
7521                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
7522                 fi
7523             fi
7524         else
7525             AC_MSG_CHECKING([for doxygen])
7526             DOXYGEN=$with_doxygen
7527             AC_MSG_RESULT([$DOXYGEN])
7528         fi
7529         if test -n "$DOXYGEN"; then
7530             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7531             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7532             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7533                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7534             fi
7535         fi
7536     fi
7538 AC_SUBST([DOXYGEN])
7540 AC_MSG_CHECKING([whether to build the ODK])
7541 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7542     AC_MSG_RESULT([yes])
7544     if test "$with_java" != "no"; then
7545         AC_MSG_CHECKING([whether to build unowinreg.dll])
7546         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7547             # build on Win by default
7548             enable_build_unowinreg=yes
7549         fi
7550         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7551             AC_MSG_RESULT([no])
7552             BUILD_UNOWINREG=
7553         else
7554             AC_MSG_RESULT([yes])
7555             BUILD_UNOWINREG=TRUE
7556         fi
7557         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7558             if test -z "$with_mingw_cross_compiler"; then
7559                 dnl Guess...
7560                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7561             elif test -x "$with_mingw_cross_compiler"; then
7562                  MINGWCXX="$with_mingw_cross_compiler"
7563             else
7564                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7565             fi
7567             if test "$MINGWCXX" = "false"; then
7568                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7569             fi
7571             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7572             if test -x "$mingwstrip_test"; then
7573                 MINGWSTRIP="$mingwstrip_test"
7574             else
7575                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7576             fi
7578             if test "$MINGWSTRIP" = "false"; then
7579                 AC_MSG_ERROR(MinGW32 binutils not found.)
7580             fi
7581         fi
7582     fi
7583     BUILD_TYPE="$BUILD_TYPE ODK"
7584 else
7585     AC_MSG_RESULT([no])
7586     BUILD_UNOWINREG=
7588 AC_SUBST(BUILD_UNOWINREG)
7589 AC_SUBST(MINGWCXX)
7590 AC_SUBST(MINGWSTRIP)
7592 dnl ===================================================================
7593 dnl Check for system zlib
7594 dnl ===================================================================
7595 if test "$with_system_zlib" = "auto"; then
7596     case "$_os" in
7597     WINNT)
7598         with_system_zlib="$with_system_libs"
7599         ;;
7600     *)
7601         if test "$enable_fuzzers" != "yes"; then
7602             with_system_zlib=yes
7603         else
7604             with_system_zlib=no
7605         fi
7606         ;;
7607     esac
7610 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7611 dnl and has no pkg-config for it at least on some tinderboxes,
7612 dnl so leaving that out for now
7613 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7614 AC_MSG_CHECKING([which zlib to use])
7615 if test "$with_system_zlib" = "yes"; then
7616     AC_MSG_RESULT([external])
7617     SYSTEM_ZLIB=TRUE
7618     AC_CHECK_HEADER(zlib.h, [],
7619         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7620     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7621         [AC_MSG_ERROR(zlib not found or functional)], [])
7622 else
7623     AC_MSG_RESULT([internal])
7624     SYSTEM_ZLIB=
7625     BUILD_TYPE="$BUILD_TYPE ZLIB"
7626     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7627     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7629 AC_SUBST(ZLIB_CFLAGS)
7630 AC_SUBST(ZLIB_LIBS)
7631 AC_SUBST(SYSTEM_ZLIB)
7633 dnl ===================================================================
7634 dnl Check for system jpeg
7635 dnl ===================================================================
7636 AC_MSG_CHECKING([which libjpeg to use])
7637 if test "$with_system_jpeg" = "yes"; then
7638     AC_MSG_RESULT([external])
7639     SYSTEM_LIBJPEG=TRUE
7640     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7641         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7642     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7643         [AC_MSG_ERROR(jpeg library not found or fuctional)], [])
7644 else
7645     SYSTEM_LIBJPEG=
7646     AC_MSG_RESULT([internal, libjpeg-turbo])
7647     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
7648     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
7649     if test "$COM" = "MSC"; then
7650         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
7651     else
7652         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
7653     fi
7655     case "$host_cpu" in
7656     x86_64 | amd64 | i*86 | x86 | ia32)
7657         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7658         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7659             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7660                 NASM="$LODE_HOME/opt/bin/nasm"
7661             elif test -x "/opt/lo/bin/nasm"; then
7662                 NASM="/opt/lo/bin/nasm"
7663             fi
7664         fi
7666         if test -n "$NASM"; then
7667             AC_MSG_CHECKING([for object file format of host system])
7668             case "$host_os" in
7669               cygwin* | mingw* | pw32* | interix*)
7670                 case "$host_cpu" in
7671                   x86_64)
7672                     objfmt='Win64-COFF'
7673                     ;;
7674                   *)
7675                     objfmt='Win32-COFF'
7676                     ;;
7677                 esac
7678               ;;
7679               msdosdjgpp* | go32*)
7680                 objfmt='COFF'
7681               ;;
7682               os2-emx*)                 # not tested
7683                 objfmt='MSOMF'          # obj
7684               ;;
7685               linux*coff* | linux*oldld*)
7686                 objfmt='COFF'           # ???
7687               ;;
7688               linux*aout*)
7689                 objfmt='a.out'
7690               ;;
7691               linux*)
7692                 case "$host_cpu" in
7693                   x86_64)
7694                     objfmt='ELF64'
7695                     ;;
7696                   *)
7697                     objfmt='ELF'
7698                     ;;
7699                 esac
7700               ;;
7701               kfreebsd* | freebsd* | netbsd* | openbsd*)
7702                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
7703                   objfmt='BSD-a.out'
7704                 else
7705                   case "$host_cpu" in
7706                     x86_64 | amd64)
7707                       objfmt='ELF64'
7708                       ;;
7709                     *)
7710                       objfmt='ELF'
7711                       ;;
7712                   esac
7713                 fi
7714               ;;
7715               solaris* | sunos* | sysv* | sco*)
7716                 case "$host_cpu" in
7717                   x86_64)
7718                     objfmt='ELF64'
7719                     ;;
7720                   *)
7721                     objfmt='ELF'
7722                     ;;
7723                 esac
7724               ;;
7725               darwin* | rhapsody* | nextstep* | openstep* | macos*)
7726                 case "$host_cpu" in
7727                   x86_64)
7728                     objfmt='Mach-O64'
7729                     ;;
7730                   *)
7731                     objfmt='Mach-O'
7732                     ;;
7733                 esac
7734               ;;
7735               *)
7736                 objfmt='ELF ?'
7737               ;;
7738             esac
7740             AC_MSG_RESULT([$objfmt])
7741             if test "$objfmt" = 'ELF ?'; then
7742               objfmt='ELF'
7743               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
7744             fi
7746             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
7747             case "$objfmt" in
7748               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
7749               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
7750               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
7751               COFF)       NAFLAGS='-fcoff -DCOFF';;
7752               a.out)      NAFLAGS='-faout -DAOUT';;
7753               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
7754               ELF)        NAFLAGS='-felf -DELF';;
7755               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
7756               RDF)        NAFLAGS='-frdf -DRDF';;
7757               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
7758               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
7759             esac
7760             AC_MSG_RESULT([$NAFLAGS])
7762             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
7763             cat > conftest.asm << EOF
7764             [%line __oline__ "configure"
7765                     section .text
7766                     global  _main,main
7767             _main:
7768             main:   xor     eax,eax
7769                     ret
7770             ]
7772             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
7773             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
7774               AC_MSG_RESULT(yes)
7775             else
7776               echo "configure: failed program was:" >&AC_FD_CC
7777               cat conftest.asm >&AC_FD_CC
7778               rm -rf conftest*
7779               AC_MSG_RESULT(no)
7780               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
7781               NASM=""
7782             fi
7784         fi
7786         if test -z "$NASM"; then
7787 cat << _EOS
7788 ****************************************************************************
7789 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
7790 To get one please:
7792 _EOS
7793             if test "$build_os" = "cygwin"; then
7794 cat << _EOS
7795 install a pre-compiled binary for Win32
7797 mkdir -p /opt/lo/bin
7798 cd /opt/lo/bin
7799 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7800 chmod +x nasm
7802 or get and install one from http://www.nasm.us/
7804 Then re-run autogen.sh
7806 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7807 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7809 _EOS
7810             else
7811 cat << _EOS
7812 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
7814 _EOS
7815             fi
7816             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
7817             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
7818         fi
7819       ;;
7820     esac
7823 AC_SUBST(NASM)
7824 AC_SUBST(LIBJPEG_CFLAGS)
7825 AC_SUBST(LIBJPEG_LIBS)
7826 AC_SUBST(SYSTEM_LIBJPEG)
7828 dnl ===================================================================
7829 dnl Check for system clucene
7830 dnl ===================================================================
7831 dnl we should rather be using
7832 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7833 dnl but the contribs-lib check seems tricky
7834 AC_MSG_CHECKING([which clucene to use])
7835 if test "$with_system_clucene" = "yes"; then
7836     AC_MSG_RESULT([external])
7837     SYSTEM_CLUCENE=TRUE
7838     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7839     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7840     FilterLibs "${CLUCENE_LIBS}"
7841     CLUCENE_LIBS="${filteredlibs}"
7842     AC_LANG_PUSH([C++])
7843     save_CXXFLAGS=$CXXFLAGS
7844     save_CPPFLAGS=$CPPFLAGS
7845     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7846     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7847     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7848     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7849     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7850                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7851     CXXFLAGS=$save_CXXFLAGS
7852     CPPFLAGS=$save_CPPFLAGS
7853     AC_LANG_POP([C++])
7855     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7856 else
7857     AC_MSG_RESULT([internal])
7858     SYSTEM_CLUCENE=
7859     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7861 AC_SUBST(SYSTEM_CLUCENE)
7862 AC_SUBST(CLUCENE_CFLAGS)
7863 AC_SUBST(CLUCENE_LIBS)
7865 dnl ===================================================================
7866 dnl Check for system expat
7867 dnl ===================================================================
7868 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
7870 dnl ===================================================================
7871 dnl Check for system xmlsec
7872 dnl ===================================================================
7873 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24])
7875 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7876 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7877     ENABLE_EOT="TRUE"
7878     AC_DEFINE([ENABLE_EOT])
7879     AC_MSG_RESULT([yes])
7881     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7882 else
7883     ENABLE_EOT=
7884     AC_MSG_RESULT([no])
7886 AC_SUBST([ENABLE_EOT])
7888 dnl ===================================================================
7889 dnl Check for DLP libs
7890 dnl ===================================================================
7891 AS_IF([test "$COM" = "MSC"],
7892       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7893       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7895 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7897 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7899 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
7901 AS_IF([test "$COM" = "MSC"],
7902       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7903       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7905 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7907 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7909 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7910 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.9])
7912 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7914 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7916 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7918 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
7919 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.14])
7921 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
7922 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
7924 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7926 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
7927 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
7929 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7931 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7933 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
7935 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
7937 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
7938 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
7940 dnl ===================================================================
7941 dnl Check for system lcms2
7942 dnl ===================================================================
7943 if test "$with_system_lcms2" != "yes"; then
7944     SYSTEM_LCMS2=
7946 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7947 if test "$GCC" = "yes"; then
7948     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7950 if test "$COM" = "MSC"; then # override the above
7951     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7954 dnl ===================================================================
7955 dnl Check for system cppunit
7956 dnl ===================================================================
7957 if test "$cross_compiling" != "yes"; then
7958     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
7961 dnl ===================================================================
7962 dnl Check whether freetype is available
7963 dnl ===================================================================
7964 if test  "$test_freetype" = "yes"; then
7965     AC_MSG_CHECKING([whether freetype is available])
7966     # FreeType has 3 different kinds of versions
7967     # * release, like 2.4.10
7968     # * libtool, like 13.0.7 (this what pkg-config returns)
7969     # * soname
7970     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7971     #
7972     # 9.9.3 is 2.2.0
7973     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7974     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7975     FilterLibs "${FREETYPE_LIBS}"
7976     FREETYPE_LIBS="${filteredlibs}"
7977     SYSTEM_FREETYPE=TRUE
7978 else
7979     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
7980     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
7982 AC_SUBST(FREETYPE_CFLAGS)
7983 AC_SUBST(FREETYPE_LIBS)
7984 AC_SUBST([SYSTEM_FREETYPE])
7986 # ===================================================================
7987 # Check for system libxslt
7988 # to prevent incompatibilities between internal libxml2 and external libxslt,
7989 # or vice versa, use with_system_libxml here
7990 # ===================================================================
7991 if test "$with_system_libxml" = "auto"; then
7992     case "$_os" in
7993     WINNT|iOS|Android)
7994         with_system_libxml="$with_system_libs"
7995         ;;
7996     *)
7997         if test "$enable_fuzzers" != "yes"; then
7998             with_system_libxml=yes
7999         else
8000             with_system_libxml=no
8001         fi
8002         ;;
8003     esac
8006 AC_MSG_CHECKING([which libxslt to use])
8007 if test "$with_system_libxml" = "yes"; then
8008     AC_MSG_RESULT([external])
8009     SYSTEM_LIBXSLT=TRUE
8010     if test "$_os" = "Darwin"; then
8011         dnl make sure to use SDK path
8012         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8013         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8014         dnl omit -L/usr/lib
8015         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8016         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8017     else
8018         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8019         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8020         FilterLibs "${LIBXSLT_LIBS}"
8021         LIBXSLT_LIBS="${filteredlibs}"
8022         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8023         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8024         FilterLibs "${LIBEXSLT_LIBS}"
8025         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8026     fi
8028     dnl Check for xsltproc
8029     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8030     if test "$XSLTPROC" = "no"; then
8031         AC_MSG_ERROR([xsltproc is required])
8032     fi
8033 else
8034     AC_MSG_RESULT([internal])
8035     SYSTEM_LIBXSLT=
8036     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8038     if test "$cross_compiling" = "yes"; then
8039         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8040         if test "$XSLTPROC" = "no"; then
8041             AC_MSG_ERROR([xsltproc is required])
8042         fi
8043     fi
8045 AC_SUBST(SYSTEM_LIBXSLT)
8046 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8047     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8049 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8051 AC_SUBST(LIBEXSLT_CFLAGS)
8052 AC_SUBST(LIBEXSLT_LIBS)
8053 AC_SUBST(LIBXSLT_CFLAGS)
8054 AC_SUBST(LIBXSLT_LIBS)
8055 AC_SUBST(XSLTPROC)
8057 # ===================================================================
8058 # Check for system libxml
8059 # ===================================================================
8060 AC_MSG_CHECKING([which libxml to use])
8061 if test "$with_system_libxml" = "yes"; then
8062     AC_MSG_RESULT([external])
8063     SYSTEM_LIBXML=TRUE
8064     if test "$_os" = "Darwin"; then
8065         dnl make sure to use SDK path
8066         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8067         dnl omit -L/usr/lib
8068         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8069     elif test $_os = iOS; then
8070         dnl make sure to use SDK path
8071         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8072         LIBXML_CFLAGS="-I$usr/include/libxml2"
8073         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8074     else
8075         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8076         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8077         FilterLibs "${LIBXML_LIBS}"
8078         LIBXML_LIBS="${filteredlibs}"
8079     fi
8081     dnl Check for xmllint
8082     AC_PATH_PROG(XMLLINT, xmllint, no)
8083     if test "$XMLLINT" = "no"; then
8084         AC_MSG_ERROR([xmllint is required])
8085     fi
8086 else
8087     AC_MSG_RESULT([internal])
8088     SYSTEM_LIBXML=
8089     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8090     if test "$COM" = "MSC"; then
8091         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8092     fi
8093     if test "$COM" = "MSC"; then
8094         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8095     else
8096         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8097     fi
8098     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8100 AC_SUBST(SYSTEM_LIBXML)
8101 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8102     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8104 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8105 AC_SUBST(LIBXML_CFLAGS)
8106 AC_SUBST(LIBXML_LIBS)
8107 AC_SUBST(XMLLINT)
8109 # =====================================================================
8110 # Checking for a Python interpreter with version >= 2.7.
8111 # Build and runtime requires Python 3 compatible version (>= 2.7).
8112 # Optionally user can pass an option to configure, i. e.
8113 # ./configure PYTHON=/usr/bin/python
8114 # =====================================================================
8115 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8116     # This allows a lack of system python with no error, we use internal one in that case.
8117     AM_PATH_PYTHON([2.7],, [:])
8118     # Clean PYTHON_VERSION checked below if cross-compiling
8119     PYTHON_VERSION=""
8120     if test "$PYTHON" != ":"; then
8121         PYTHON_FOR_BUILD=$PYTHON
8122     fi
8124 AC_SUBST(PYTHON_FOR_BUILD)
8126 # Checks for Python to use for Pyuno
8127 AC_MSG_CHECKING([which Python to use for Pyuno])
8128 case "$enable_python" in
8129 no|disable)
8130     if test -z $PYTHON_FOR_BUILD; then
8131         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8132         # requirement from the choice whether to include Python stuff in the installer, but why
8133         # bother?
8134         AC_MSG_ERROR([Python is required at build time.])
8135     fi
8136     enable_python=no
8137     AC_MSG_RESULT([none])
8138     ;;
8139 ""|yes|auto)
8140     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8141         AC_MSG_RESULT([no, overridden by --disable-scripting])
8142         enable_python=no
8143     elif test $build_os = cygwin; then
8144         dnl When building on Windows we don't attempt to use any installed
8145         dnl "system"  Python.
8146         AC_MSG_RESULT([fully internal])
8147         enable_python=internal
8148     elif test "$cross_compiling" = yes; then
8149         AC_MSG_RESULT([system])
8150         enable_python=system
8151     else
8152         # Unset variables set by the above AM_PATH_PYTHON so that
8153         # we actually do check anew.
8154         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
8155         AM_PATH_PYTHON([3.3],, [:])
8156         if test "$PYTHON" = ":"; then
8157             if test -z "$PYTHON_FOR_BUILD"; then
8158                 AC_MSG_RESULT([fully internal])
8159             else
8160                 AC_MSG_RESULT([internal])
8161             fi
8162             enable_python=internal
8163         else
8164             AC_MSG_RESULT([system])
8165             enable_python=system
8166         fi
8167     fi
8168     ;;
8169 internal)
8170     AC_MSG_RESULT([internal])
8171     ;;
8172 fully-internal)
8173     AC_MSG_RESULT([fully internal])
8174     enable_python=internal
8175     ;;
8176 system)
8177     AC_MSG_RESULT([system])
8178     ;;
8180     AC_MSG_ERROR([Incorrect --enable-python option])
8181     ;;
8182 esac
8184 if test $enable_python != no; then
8185     BUILD_TYPE="$BUILD_TYPE PYUNO"
8188 if test $enable_python = system; then
8189     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8190         python_version=2.7
8191         PYTHON=python$python_version
8192         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
8193             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
8194             PYTHON_LIBS="-framework Python"
8195         else
8196             PYTHON_CFLAGS="`$PYTHON-config --includes`"
8197             PYTHON_LIBS="`$PYTHON-config --libs`"
8198         fi
8199     fi
8200     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8201         # Fallback: Accept these in the environment, or as set above
8202         # for MacOSX.
8203         :
8204     elif test "$cross_compiling" != yes; then
8205         # Unset variables set by the above AM_PATH_PYTHON so that
8206         # we actually do check anew.
8207         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
8208         # This causes an error if no python command is found
8209         AM_PATH_PYTHON([3.3])
8210         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8211         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8212         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8213         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8214         if test -z "$PKG_CONFIG"; then
8215             PYTHON_CFLAGS="-I$python_include"
8216             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8217         elif $PKG_CONFIG --exists python-$python_version; then
8218             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8219             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8220         else
8221             PYTHON_CFLAGS="-I$python_include"
8222             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8223         fi
8224         FilterLibs "${PYTHON_LIBS}"
8225         PYTHON_LIBS="${filteredlibs}"
8226     else
8227         dnl How to find out the cross-compilation Python installation path?
8228         AC_MSG_CHECKING([for python version])
8229         AS_IF([test -n "$PYTHON_VERSION"],
8230               [AC_MSG_RESULT([$PYTHON_VERSION])],
8231               [AC_MSG_RESULT([not found])
8232                AC_MSG_ERROR([no usable python found])])
8233         test -n "$PYTHON_CFLAGS" && break
8234     fi
8236     dnl Check if the headers really work
8237     save_CPPFLAGS="$CPPFLAGS"
8238     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8239     AC_CHECK_HEADER(Python.h)
8240     CPPFLAGS="$save_CPPFLAGS"
8242     # let the PYTHON_FOR_BUILD match the same python installation that
8243     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8244     # better for PythonTests.
8245     PYTHON_FOR_BUILD=$PYTHON
8248 if test "$with_lxml" != no; then
8249     if test -z "$PYTHON_FOR_BUILD"; then
8250         case $build_os in
8251             cygwin)
8252                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8253                 ;;
8254             *)
8255                 if test "$cross_compiling" != yes ; then
8256                     BUILD_TYPE="$BUILD_TYPE LXML"
8257                 fi
8258                 ;;
8259         esac
8260     else
8261         AC_MSG_CHECKING([for python lxml])
8262         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8263             AC_MSG_RESULT([yes])
8264         else
8265             case $build_os in
8266                 cygwin)
8267                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8268                     ;;
8269                 *)
8270                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8271                         BUILD_TYPE="$BUILD_TYPE LXML"
8272                         AC_MSG_RESULT([no, using internal lxml])
8273                     else
8274                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8275                     fi
8276                     ;;
8277             esac
8278         fi
8279     fi
8282 dnl By now enable_python should be "system", "internal" or "no"
8283 case $enable_python in
8284 system)
8285     SYSTEM_PYTHON=TRUE
8287     if test "x$ac_cv_header_Python_h" != "xyes"; then
8288        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8289     fi
8291     AC_LANG_PUSH(C)
8292     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8293     AC_MSG_CHECKING([for correct python library version])
8294        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8295 #include <Python.h>
8297 int main(int argc, char **argv) {
8298    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8299        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8300    else return 1;
8302        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3, or Python >= 2.7 when building with Python 2])],[AC_MSG_RESULT([skipped; cross-compiling])])
8303     CFLAGS=$save_CFLAGS
8304     AC_LANG_POP(C)
8306     dnl FIXME Check if the Python library can be linked with, too?
8307     ;;
8309 internal)
8310     SYSTEM_PYTHON=
8311     PYTHON_VERSION_MAJOR=3
8312     PYTHON_VERSION_MINOR=5
8313     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.5
8314     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8315         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8316     fi
8317     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8318     BUILD_TYPE="$BUILD_TYPE PYTHON"
8319     # Embedded Python dies without Home set
8320     if test "$HOME" = ""; then
8321         export HOME=""
8322     fi
8323     ;;
8325     DISABLE_PYTHON=TRUE
8326     SYSTEM_PYTHON=
8327     ;;
8329     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8330     ;;
8331 esac
8333 AC_SUBST(DISABLE_PYTHON)
8334 AC_SUBST(SYSTEM_PYTHON)
8335 AC_SUBST(PYTHON_CFLAGS)
8336 AC_SUBST(PYTHON_LIBS)
8337 AC_SUBST(PYTHON_VERSION)
8338 AC_SUBST(PYTHON_VERSION_MAJOR)
8339 AC_SUBST(PYTHON_VERSION_MINOR)
8341 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8342 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8343     AC_MSG_RESULT([yes])
8344     ENABLE_MARIADBC=TRUE
8345     MARIADBC_MAJOR=1
8346     MARIADBC_MINOR=0
8347     MARIADBC_MICRO=2
8348     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8349 else
8350     AC_MSG_RESULT([no])
8351     ENABLE_MARIADBC=
8353 AC_SUBST(ENABLE_MARIADBC)
8354 AC_SUBST(MARIADBC_MAJOR)
8355 AC_SUBST(MARIADBC_MINOR)
8356 AC_SUBST(MARIADBC_MICRO)
8358 if test "$ENABLE_MARIADBC" = "TRUE"; then
8360     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8362     dnl ===================================================================
8363     dnl Check for system MariaDB
8364     dnl ===================================================================
8365     AC_MSG_CHECKING([which MariaDB to use])
8366     if test "$with_system_mariadb" = "yes"; then
8367         AC_MSG_RESULT([external])
8368         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8369         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8370         if test -z "$MARIADBCONFIG"; then
8371             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8372             if test -z "$MARIADBCONFIG"; then
8373                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8374                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8375             fi
8376         fi
8377         AC_MSG_CHECKING([MariaDB version])
8378         MARIADB_VERSION=`$MARIADBCONFIG --version`
8379         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8380         if test "$MARIADB_MAJOR" -ge "5"; then
8381             AC_MSG_RESULT([OK])
8382         else
8383             AC_MSG_ERROR([too old, use 5.0.x or later])
8384         fi
8385         AC_MSG_CHECKING([for MariaDB Client library])
8386         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8387         if test "$COM_IS_CLANG" = TRUE; then
8388             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8389         fi
8390         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8391         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8392         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8393         dnl linux32:
8394         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8395             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8396             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8397                 | sed -e 's|/lib64/|/lib/|')
8398         fi
8399         FilterLibs "${MARIADB_LIBS}"
8400         MARIADB_LIBS="${filteredlibs}"
8401         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8402         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8403         if test "$enable_bundle_mariadb" = "yes"; then
8404             AC_MSG_RESULT([yes])
8405             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8406             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8408 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8410 /g' | grep -E '(mysqlclient|mariadb)')
8411             if test "$_os" = "Darwin"; then
8412                 LIBMARIADB=${LIBMARIADB}.dylib
8413             elif test "$_os" = "WINNT"; then
8414                 LIBMARIADB=${LIBMARIADB}.dll
8415             else
8416                 LIBMARIADB=${LIBMARIADB}.so
8417             fi
8418             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8419             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8420             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8421                 AC_MSG_RESULT([found.])
8422                 PathFormat "$LIBMARIADB_PATH"
8423                 LIBMARIADB_PATH="$formatted_path"
8424             else
8425                 AC_MSG_ERROR([not found.])
8426             fi
8427         else
8428             AC_MSG_RESULT([no])
8429             BUNDLE_MARIADB_CONNECTOR_C=
8430         fi
8431     else
8432         AC_MSG_RESULT([internal])
8433         SYSTEM_MARIADB_CONNECTOR_C=
8434         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8435         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8436         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8437     fi
8439     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8440     AC_SUBST(MARIADB_CFLAGS)
8441     AC_SUBST(MARIADB_LIBS)
8442     AC_SUBST(LIBMARIADB)
8443     AC_SUBST(LIBMARIADB_PATH)
8444     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8446     AC_LANG_PUSH([C++])
8447     dnl ===================================================================
8448     dnl Check for system MySQL C++ Connector
8449     dnl ===================================================================
8450     # FIXME!
8451     # who thought this too-generic cppconn dir was a good idea?
8452     AC_MSG_CHECKING([MySQL Connector/C++])
8453     if test "$with_system_mysql_cppconn" = "yes"; then
8454         AC_MSG_RESULT([external])
8455         SYSTEM_MYSQL_CONNECTOR_CPP=TRUE
8456         AC_LANG_PUSH([C++])
8457         AC_CHECK_HEADER(mysql_driver.h, [],
8458                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8459         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8460                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8461         save_LIBS=$LIBS
8462         LIBS="$LIBS -lmysqlcppconn"
8463         AC_MSG_CHECKING([version])
8464         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8465 #include <mysql_driver.h>
8467 int main(int argc, char **argv) {
8468     sql::Driver *driver;
8469     driver = get_driver_instance();
8470     if (driver->getMajorVersion() > 1 || \
8471        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8472        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8473         return 0;
8474       else
8475         return 1;
8477       ]])],[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])])
8479         AC_LANG_POP([C++])
8480         LIBS=$save_LIBS
8481     else
8482         AC_MSG_RESULT([internal])
8483         BUILD_TYPE="$BUILD_TYPE MYSQL_CONNECTOR_CPP"
8484         SYSTEM_MYSQL_CONNECTOR_CPP=
8485     fi
8486     AC_LANG_POP([C++])
8488 AC_SUBST(SYSTEM_MYSQL_CONNECTOR_CPP)
8490 dnl ===================================================================
8491 dnl Check for system hsqldb
8492 dnl ===================================================================
8493 if test "$with_java" != "no"; then
8494     HSQLDB_USE_JDBC_4_1=
8495     AC_MSG_CHECKING([which hsqldb to use])
8496     if test "$with_system_hsqldb" = "yes"; then
8497         AC_MSG_RESULT([external])
8498         SYSTEM_HSQLDB=TRUE
8499         if test -z $HSQLDB_JAR; then
8500             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8501         fi
8502         if ! test -f $HSQLDB_JAR; then
8503                AC_MSG_ERROR(hsqldb.jar not found.)
8504         fi
8505         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8506         export HSQLDB_JAR
8507         if $PERL -e \
8508            'use Archive::Zip;
8509             my $file = "$ENV{'HSQLDB_JAR'}";
8510             my $zip = Archive::Zip->new( $file );
8511             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8512             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8513             {
8514                 push @l, split(/\n/, $mf);
8515                 foreach my $line (@l)
8516                 {
8517                     if ($line =~ m/Specification-Version:/)
8518                     {
8519                         ($t, $version) = split (/:/,$line);
8520                         $version =~ s/^\s//;
8521                         ($a, $b, $c, $d) = split (/\./,$version);
8522                         if ($c == "0" && $d > "8")
8523                         {
8524                             exit 0;
8525                         }
8526                         else
8527                         {
8528                             exit 1;
8529                         }
8530                     }
8531                 }
8532             }
8533             else
8534             {
8535                 exit 1;
8536             }'; then
8537             AC_MSG_RESULT([yes])
8538         else
8539             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8540         fi
8541     else
8542         AC_MSG_RESULT([internal])
8543         SYSTEM_HSQLDB=
8544         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8545         NEED_ANT=TRUE
8546         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8547         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8548         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8549             AC_MSG_RESULT([yes])
8550             HSQLDB_USE_JDBC_4_1=TRUE
8551         else
8552             AC_MSG_RESULT([no])
8553         fi
8554     fi
8555     AC_SUBST(SYSTEM_HSQLDB)
8556     AC_SUBST(HSQLDB_JAR)
8557     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8560 dnl ===================================================================
8561 dnl Check for PostgreSQL stuff
8562 dnl ===================================================================
8563 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
8564 if test "x$enable_postgresql_sdbc" != "xno"; then
8565     AC_MSG_RESULT([yes])
8566     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8568     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8569         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8570     fi
8571     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8572         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8573     fi
8575     postgres_interface=""
8576     if test "$with_system_postgresql" = "yes"; then
8577         postgres_interface="external PostgreSQL"
8578         SYSTEM_POSTGRESQL=TRUE
8579         if test "$_os" = Darwin; then
8580             supp_path=''
8581             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8582                 pg_supp_path="$P_SEP$d$pg_supp_path"
8583             done
8584         fi
8585         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8586         if test -z "$PGCONFIG"; then
8587             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8588         fi
8589         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8590         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8591         FilterLibs "${POSTGRESQL_LIB}"
8592         POSTGRESQL_LIB="${filteredlibs}"
8593     else
8594         # if/when anything else than PostgreSQL uses Kerberos,
8595         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8596         WITH_KRB5=
8597         WITH_GSSAPI=
8598         case "$_os" in
8599         Darwin)
8600             # MacOS X has system MIT Kerberos 5 since 10.4
8601             if test "$with_krb5" != "no"; then
8602                 WITH_KRB5=TRUE
8603                 save_LIBS=$LIBS
8604                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8605                 # that the libraries where these functions are located on macOS will change, is it?
8606                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8607                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8608                 KRB5_LIBS=$LIBS
8609                 LIBS=$save_LIBS
8610                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8611                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8612                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8613                 LIBS=$save_LIBS
8614             fi
8615             if test "$with_gssapi" != "no"; then
8616                 WITH_GSSAPI=TRUE
8617                 save_LIBS=$LIBS
8618                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8619                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8620                 GSSAPI_LIBS=$LIBS
8621                 LIBS=$save_LIBS
8622             fi
8623             ;;
8624         WINNT)
8625             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8626                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8627             fi
8628             ;;
8629         Linux|GNU|*BSD|DragonFly)
8630             if test "$with_krb5" != "no"; then
8631                 WITH_KRB5=TRUE
8632                 save_LIBS=$LIBS
8633                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8634                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8635                 KRB5_LIBS=$LIBS
8636                 LIBS=$save_LIBS
8637                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8638                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8639                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8640                 LIBS=$save_LIBS
8641             fi
8642             if test "$with_gssapi" != "no"; then
8643                 WITH_GSSAPI=TRUE
8644                 save_LIBS=$LIBS
8645                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8646                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8647                 GSSAPI_LIBS=$LIBS
8648                 LIBS=$save_LIBS
8649             fi
8650             ;;
8651         *)
8652             if test "$with_krb5" = "yes"; then
8653                 WITH_KRB5=TRUE
8654                 save_LIBS=$LIBS
8655                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8656                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8657                 KRB5_LIBS=$LIBS
8658                 LIBS=$save_LIBS
8659                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8660                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8661                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8662                 LIBS=$save_LIBS
8663             fi
8664             if test "$with_gssapi" = "yes"; then
8665                 WITH_GSSAPI=TRUE
8666                 save_LIBS=$LIBS
8667                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8668                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8669                 LIBS=$save_LIBS
8670                 GSSAPI_LIBS=$LIBS
8671             fi
8672         esac
8674         if test -n "$with_libpq_path"; then
8675             SYSTEM_POSTGRESQL=TRUE
8676             postgres_interface="external libpq"
8677             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8678             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8679         else
8680             SYSTEM_POSTGRESQL=
8681             postgres_interface="internal"
8682             POSTGRESQL_LIB=""
8683             POSTGRESQL_INC="%OVERRIDE_ME%"
8684             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8685         fi
8686     fi
8688     AC_MSG_CHECKING([PostgreSQL C interface])
8689     AC_MSG_RESULT([$postgres_interface])
8691     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8692         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8693         save_CFLAGS=$CFLAGS
8694         save_CPPFLAGS=$CPPFLAGS
8695         save_LIBS=$LIBS
8696         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8697         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8698         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8699         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8700             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8701         CFLAGS=$save_CFLAGS
8702         CPPFLAGS=$save_CPPFLAGS
8703         LIBS=$save_LIBS
8704     fi
8705     BUILD_POSTGRESQL_SDBC=TRUE
8706 else
8707     AC_MSG_RESULT([no])
8709 AC_SUBST(WITH_KRB5)
8710 AC_SUBST(WITH_GSSAPI)
8711 AC_SUBST(GSSAPI_LIBS)
8712 AC_SUBST(KRB5_LIBS)
8713 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8714 AC_SUBST(SYSTEM_POSTGRESQL)
8715 AC_SUBST(POSTGRESQL_INC)
8716 AC_SUBST(POSTGRESQL_LIB)
8718 dnl ===================================================================
8719 dnl Check for Firebird stuff
8720 dnl ===================================================================
8721 ENABLE_FIREBIRD_SDBC=""
8722 if test "$enable_firebird_sdbc" = "yes" ; then
8723     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8725     dnl ===================================================================
8726     dnl Check for system Firebird
8727     dnl ===================================================================
8728     AC_MSG_CHECKING([which Firebird to use])
8729     if test "$with_system_firebird" = "yes"; then
8730         AC_MSG_RESULT([external])
8731         SYSTEM_FIREBIRD=TRUE
8732         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8733         if test -z "$FIREBIRDCONFIG"; then
8734             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8735             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8736                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8737             ])
8738             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8739         else
8740             AC_MSG_NOTICE([fb_config found])
8741             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8742             AC_MSG_CHECKING([for Firebird Client library])
8743             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8744             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8745             FilterLibs "${FIREBIRD_LIBS}"
8746             FIREBIRD_LIBS="${filteredlibs}"
8747         fi
8748         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8749         AC_MSG_CHECKING([Firebird version])
8750         if test -n "${FIREBIRD_VERSION}"; then
8751             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8752             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8753             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8754                 AC_MSG_RESULT([OK])
8755             else
8756                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
8757             fi
8758         else
8759             __save_CFLAGS="${CFLAGS}"
8760             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8761             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8762 #if defined(FB_API_VER) && FB_API_VER == 30
8763 int fb_api_is_30(void) { return 0; }
8764 #else
8765 #error "Wrong Firebird API version"
8766 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
8767             CFLAGS="${__save_CFLAGS}"
8768         fi
8769         ENABLE_FIREBIRD_SDBC="TRUE"
8770     elif test "$enable_database_connectivity" != yes; then
8771         AC_MSG_RESULT([none])
8772     elif test "$cross_compiling" = "yes"; then
8773         AC_MSG_RESULT([none])
8774     else
8775         dnl Embedded Firebird has version 3.0
8776         AC_DEFINE(HAVE_FIREBIRD_30, 1)
8777         dnl We need libatomic-ops for any non X86/X64 system
8778         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8779             dnl ===================================================================
8780             dnl Check for system libatomic-ops
8781             dnl ===================================================================
8782             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8783             if test "$with_system_libatomic_ops" = "yes"; then
8784                 SYSTEM_LIBATOMIC_OPS=TRUE
8785                 AC_CHECK_HEADERS(atomic_ops.h, [],
8786                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8787             else
8788                 SYSTEM_LIBATOMIC_OPS=
8789                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8790                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8791                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8792             fi
8793         fi
8795         AC_MSG_RESULT([internal])
8796         SYSTEM_FIREBIRD=
8797         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
8798         FIREBIRD_LIBS="-lfbclient"
8800         if test "$with_system_libtommath" = "yes"; then
8801             SYSTEM_LIBTOMMATH=TRUE
8802             dnl check for tommath presence
8803             save_LIBS=$LIBS
8804             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
8805             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
8806             LIBS=$save_LIBS
8807         else
8808             SYSTEM_LIBTOMMATH=
8809             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
8810             LIBTOMMATH_LIBS="-ltommath"
8811             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
8812         fi
8814         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8815         ENABLE_FIREBIRD_SDBC="TRUE"
8816         AC_DEFINE(ENABLE_FIREBIRD_SDBC)
8817     fi
8819 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8820 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8821 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8822 AC_SUBST(LIBATOMIC_OPS_LIBS)
8823 AC_SUBST(SYSTEM_FIREBIRD)
8824 AC_SUBST(FIREBIRD_CFLAGS)
8825 AC_SUBST(FIREBIRD_LIBS)
8826 AC_SUBST([TOMMATH_CFLAGS])
8827 AC_SUBST([TOMMATH_LIBS])
8829 dnl ===================================================================
8830 dnl Check for system curl
8831 dnl ===================================================================
8832 AC_MSG_CHECKING([which libcurl to use])
8833 if test "$with_system_curl" = "auto"; then
8834     with_system_curl="$with_system_libs"
8837 if test "$with_system_curl" = "yes"; then
8838     AC_MSG_RESULT([external])
8839     SYSTEM_CURL=TRUE
8841     # First try PKGCONFIG and then fall back
8842     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8844     if test -n "$CURL_PKG_ERRORS"; then
8845         AC_PATH_PROG(CURLCONFIG, curl-config)
8846         if test -z "$CURLCONFIG"; then
8847             AC_MSG_ERROR([curl development files not found])
8848         fi
8849         CURL_LIBS=`$CURLCONFIG --libs`
8850         FilterLibs "${CURL_LIBS}"
8851         CURL_LIBS="${filteredlibs}"
8852         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8853         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8855         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8856         case $curl_version in
8857         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8858         dnl so they need to be doubled to end up in the configure script
8859         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8860             AC_MSG_RESULT([yes])
8861             ;;
8862         *)
8863             AC_MSG_ERROR([no, you have $curl_version])
8864             ;;
8865         esac
8866     fi
8868     ENABLE_CURL=TRUE
8869 elif test $_os = iOS; then
8870     # Let's see if we need curl, I think not?
8871     AC_MSG_RESULT([none])
8872     ENABLE_CURL=
8873 else
8874     AC_MSG_RESULT([internal])
8875     SYSTEM_CURL=
8876     BUILD_TYPE="$BUILD_TYPE CURL"
8877     ENABLE_CURL=TRUE
8879 AC_SUBST(SYSTEM_CURL)
8880 AC_SUBST(CURL_CFLAGS)
8881 AC_SUBST(CURL_LIBS)
8882 AC_SUBST(ENABLE_CURL)
8884 dnl ===================================================================
8885 dnl Check for system boost
8886 dnl ===================================================================
8887 AC_MSG_CHECKING([which boost to use])
8888 if test "$with_system_boost" = "yes"; then
8889     AC_MSG_RESULT([external])
8890     SYSTEM_BOOST=TRUE
8891     AX_BOOST_BASE(1.47)
8892     AX_BOOST_DATE_TIME
8893     AX_BOOST_FILESYSTEM
8894     AX_BOOST_IOSTREAMS
8895     AX_BOOST_LOCALE
8896     AC_LANG_PUSH([C++])
8897     save_CXXFLAGS=$CXXFLAGS
8898     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8899     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8900        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8901     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8902        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8903     CXXFLAGS=$save_CXXFLAGS
8904     AC_LANG_POP([C++])
8905     # this is in m4/ax_boost_base.m4
8906     FilterLibs "${BOOST_LDFLAGS}"
8907     BOOST_LDFLAGS="${filteredlibs}"
8908 else
8909     AC_MSG_RESULT([internal])
8910     BUILD_TYPE="$BUILD_TYPE BOOST"
8911     SYSTEM_BOOST=
8912     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
8913         # use warning-suppressing wrapper headers
8914         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
8915     else
8916         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
8917     fi
8919 AC_SUBST(SYSTEM_BOOST)
8921 dnl ===================================================================
8922 dnl Check for system mdds
8923 dnl ===================================================================
8924 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.2 >= 1.2.3], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8926 dnl ===================================================================
8927 dnl Check for system glm
8928 dnl ===================================================================
8929 AC_MSG_CHECKING([which glm to use])
8930 if test "$with_system_glm" = "yes"; then
8931     AC_MSG_RESULT([external])
8932     SYSTEM_GLM=TRUE
8933     AC_LANG_PUSH([C++])
8934     AC_CHECK_HEADER([glm/glm.hpp], [],
8935        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8936     AC_LANG_POP([C++])
8937 else
8938     AC_MSG_RESULT([internal])
8939     BUILD_TYPE="$BUILD_TYPE GLM"
8940     SYSTEM_GLM=
8941     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8943 AC_SUBST([GLM_CFLAGS])
8944 AC_SUBST([SYSTEM_GLM])
8946 dnl ===================================================================
8947 dnl Check for system odbc
8948 dnl ===================================================================
8949 AC_MSG_CHECKING([which odbc headers to use])
8950 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
8951     AC_MSG_RESULT([external])
8952     SYSTEM_ODBC_HEADERS=TRUE
8954     if test "$build_os" = "cygwin"; then
8955         save_CPPFLAGS=$CPPFLAGS
8956         find_winsdk
8957         PathFormat "$winsdktest"
8958         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"
8959         AC_CHECK_HEADER(sqlext.h, [],
8960             [AC_MSG_ERROR(odbc not found. install odbc)],
8961             [#include <windows.h>])
8962         CPPFLAGS=$save_CPPFLAGS
8963     else
8964         AC_CHECK_HEADER(sqlext.h, [],
8965             [AC_MSG_ERROR(odbc not found. install odbc)],[])
8966     fi
8967 elif test "$enable_database_connectivity" != yes; then
8968     AC_MSG_RESULT([none])
8969 else
8970     AC_MSG_RESULT([internal])
8971     SYSTEM_ODBC_HEADERS=
8973 AC_SUBST(SYSTEM_ODBC_HEADERS)
8976 dnl ===================================================================
8977 dnl Check for system openldap
8978 dnl ===================================================================
8980 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8981 AC_MSG_CHECKING([which openldap library to use])
8982 if test "$with_system_openldap" = "yes"; then
8983     AC_MSG_RESULT([external])
8984     SYSTEM_OPENLDAP=TRUE
8985     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8986     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8987     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8988 else
8989     AC_MSG_RESULT([internal])
8990     SYSTEM_OPENLDAP=
8991     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8994 AC_SUBST(SYSTEM_OPENLDAP)
8996 dnl ===================================================================
8997 dnl Check for system NSS
8998 dnl ===================================================================
8999 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9000     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9001     AC_DEFINE(HAVE_FEATURE_NSS)
9002     ENABLE_NSS="TRUE"
9003     AC_DEFINE(ENABLE_NSS)
9004 elif test $_os != iOS ; then
9005     with_tls=openssl
9007 AC_SUBST(ENABLE_NSS)
9009 dnl ===================================================================
9010 dnl Check for TLS/SSL and cryptographic implementation to use
9011 dnl ===================================================================
9012 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9013 if test -n "$with_tls"; then
9014     case $with_tls in
9015     openssl)
9016         AC_DEFINE(USE_TLS_OPENSSL)
9017         TLS=OPENSSL
9019         if test "$enable_openssl" != "yes"; then
9020             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9021         fi
9023         # warn that OpenSSL has been selected but not all TLS code has this option
9024         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9025         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9026         ;;
9027     nss)
9028         AC_DEFINE(USE_TLS_NSS)
9029         TLS=NSS
9030         ;;
9031     no)
9032         AC_MSG_WARN([Skipping TLS/SSL])
9033         ;;
9034     *)
9035         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9036 openssl - OpenSSL
9037 nss - Mozilla's Network Security Services (NSS)
9038     ])
9039         ;;
9040     esac
9041 else
9042     # default to using NSS, it results in smaller oox lib
9043     AC_DEFINE(USE_TLS_NSS)
9044     TLS=NSS
9046 AC_MSG_RESULT([$TLS])
9047 AC_SUBST(TLS)
9049 dnl ===================================================================
9050 dnl Check for system sane
9051 dnl ===================================================================
9052 AC_MSG_CHECKING([which sane header to use])
9053 if test "$with_system_sane" = "yes"; then
9054     AC_MSG_RESULT([external])
9055     AC_CHECK_HEADER(sane/sane.h, [],
9056       [AC_MSG_ERROR(sane not found. install sane)], [])
9057 else
9058     AC_MSG_RESULT([internal])
9059     BUILD_TYPE="$BUILD_TYPE SANE"
9062 dnl ===================================================================
9063 dnl Check for system icu
9064 dnl ===================================================================
9065 SYSTEM_GENBRK=
9066 SYSTEM_GENCCODE=
9067 SYSTEM_GENCMN=
9069 ICU_MAJOR=61
9070 ICU_MINOR=1
9071 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9072 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9073 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9074 AC_MSG_CHECKING([which icu to use])
9075 if test "$with_system_icu" = "yes"; then
9076     AC_MSG_RESULT([external])
9077     SYSTEM_ICU=TRUE
9078     AC_LANG_PUSH([C++])
9079     AC_MSG_CHECKING([for unicode/rbbi.h])
9080     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9081     AC_LANG_POP([C++])
9083     if test "$cross_compiling" != "yes"; then
9084         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9085         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9086         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9087         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9088     fi
9090     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9091         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9092         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9093         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9094         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9095         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9096             AC_MSG_RESULT([yes])
9097         else
9098             AC_MSG_RESULT([no])
9099             if test "$with_system_icu_for_build" != "force"; then
9100                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9101 You can use --with-system-icu-for-build=force to use it anyway.])
9102             fi
9103         fi
9104     fi
9106     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9107         # using the system icu tools can lead to version confusion, use the
9108         # ones from the build environment when cross-compiling
9109         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9110         if test -z "$SYSTEM_GENBRK"; then
9111             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9112         fi
9113         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9114         if test -z "$SYSTEM_GENCCODE"; then
9115             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9116         fi
9117         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9118         if test -z "$SYSTEM_GENCMN"; then
9119             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9120         fi
9121         if test "$ICU_MAJOR" -ge "49"; then
9122             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9123             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9124             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9125         else
9126             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9127             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9128             ICU_RECLASSIFIED_HEBREW_LETTER=
9129         fi
9130     fi
9132     if test "$cross_compiling" = "yes"; then
9133         if test "$ICU_MAJOR" -ge "50"; then
9134             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9135             ICU_MINOR=""
9136         fi
9137     fi
9138 else
9139     AC_MSG_RESULT([internal])
9140     SYSTEM_ICU=
9141     BUILD_TYPE="$BUILD_TYPE ICU"
9142     # surprisingly set these only for "internal" (to be used by various other
9143     # external libs): the system icu-config is quite unhelpful and spits out
9144     # dozens of weird flags and also default path -I/usr/include
9145     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9146     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9148 if test "$ICU_MAJOR" -ge "59"; then
9149     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9150     # with -std=c++11 but not all external libraries can be built with that,
9151     # for those use a bit-compatible typedef uint16_t UChar; see
9152     # icu/source/common/unicode/umachine.h
9153     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9154 else
9155     ICU_UCHAR_TYPE=""
9157 AC_SUBST(SYSTEM_ICU)
9158 AC_SUBST(SYSTEM_GENBRK)
9159 AC_SUBST(SYSTEM_GENCCODE)
9160 AC_SUBST(SYSTEM_GENCMN)
9161 AC_SUBST(ICU_MAJOR)
9162 AC_SUBST(ICU_MINOR)
9163 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9164 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9165 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9166 AC_SUBST(ICU_CFLAGS)
9167 AC_SUBST(ICU_LIBS)
9168 AC_SUBST(ICU_UCHAR_TYPE)
9170 dnl ==================================================================
9171 dnl Breakpad
9172 dnl ==================================================================
9173 AC_MSG_CHECKING([whether to enable breakpad])
9174 if test "$enable_breakpad" != yes; then
9175     AC_MSG_RESULT([no])
9176 else
9177     AC_MSG_RESULT([yes])
9178     ENABLE_BREAKPAD="TRUE"
9179     AC_DEFINE(ENABLE_BREAKPAD)
9180     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9181     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9183     AC_MSG_CHECKING([for crashreport config])
9184     if test "$with_symbol_config" = "no"; then
9185         BREAKPAD_SYMBOL_CONFIG="invalid"
9186         AC_MSG_RESULT([no])
9187     else
9188         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9189         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9190         AC_MSG_RESULT([yes])
9191     fi
9192     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9194 AC_SUBST(ENABLE_BREAKPAD)
9196 dnl ==================================================================
9197 dnl libfuzzer
9198 dnl ==================================================================
9199 AC_MSG_CHECKING([whether to enable fuzzers])
9200 if test "$enable_fuzzers" != yes; then
9201     AC_MSG_RESULT([no])
9202 else
9203     AC_MSG_RESULT([yes])
9204     ENABLE_FUZZERS="TRUE"
9205     AC_DEFINE(ENABLE_FUZZERS)
9206     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9208 AC_SUBST(ENABLE_FUZZERS)
9210 dnl ===================================================================
9211 dnl Orcus
9212 dnl ===================================================================
9213 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.13 >= 0.13.3])
9214 if test "$with_system_orcus" != "yes"; then
9215     if test "$SYSTEM_BOOST" = "TRUE"; then
9216         # ===========================================================
9217         # Determine if we are going to need to link with Boost.System
9218         # ===========================================================
9219         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9220         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9221         dnl in documentation has no effect.
9222         AC_MSG_CHECKING([if we need to link with Boost.System])
9223         AC_LANG_PUSH([C++])
9224         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9225                 @%:@include <boost/version.hpp>
9226             ]],[[
9227                 #if BOOST_VERSION >= 105000
9228                 #   error yes, we need to link with Boost.System
9229                 #endif
9230             ]])],[
9231                 AC_MSG_RESULT([no])
9232             ],[
9233                 AC_MSG_RESULT([yes])
9234                 AX_BOOST_SYSTEM
9235         ])
9236         AC_LANG_POP([C++])
9237     fi
9239 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9240 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9241 AC_SUBST([BOOST_SYSTEM_LIB])
9242 AC_SUBST(SYSTEM_LIBORCUS)
9244 dnl ===================================================================
9245 dnl HarfBuzz
9246 dnl ===================================================================
9247 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9248                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9249                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9251 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9252                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9253                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9255 if test "$COM" = "MSC"; then # override the above
9256     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9257     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9260 if test "$with_system_harfbuzz" = "yes"; then
9261     if test "$with_system_graphite" = "no"; then
9262         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9263     fi
9264     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9265     _save_libs="$LIBS"
9266     _save_cflags="$CFLAGS"
9267     LIBS="$LIBS $HARFBUZZ_LIBS"
9268     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9269     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9270     LIBS="$_save_libs"
9271     CFLAGS="$_save_cflags"
9272 else
9273     if test "$with_system_graphite" = "yes"; then
9274         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9275     fi
9278 AC_MSG_CHECKING([whether to use X11])
9279 dnl ***************************************
9280 dnl testing for X libraries and includes...
9281 dnl ***************************************
9282 if test "$USING_X11" = TRUE; then
9283     AC_DEFINE(HAVE_FEATURE_X11)
9285 AC_MSG_RESULT([$USING_X11])
9287 if test "$USING_X11" = TRUE; then
9288     AC_PATH_X
9289     AC_PATH_XTRA
9290     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9292     if test -z "$x_includes"; then
9293         x_includes="default_x_includes"
9294     fi
9295     if test -z "$x_libraries"; then
9296         x_libraries="default_x_libraries"
9297     fi
9298     CFLAGS="$CFLAGS $X_CFLAGS"
9299     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9300     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9301 else
9302     x_includes="no_x_includes"
9303     x_libraries="no_x_libraries"
9306 if test "$USING_X11" = TRUE; then
9307     dnl ===================================================================
9308     dnl Check for extension headers
9309     dnl ===================================================================
9310     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9311      [#include <X11/extensions/shape.h>])
9313     # vcl needs ICE and SM
9314     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9315     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9316         [AC_MSG_ERROR(ICE library not found)])
9317     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9318     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9319         [AC_MSG_ERROR(SM library not found)])
9322 dnl ===================================================================
9323 dnl Check for system Xrender
9324 dnl ===================================================================
9325 AC_MSG_CHECKING([whether to use Xrender])
9326 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9327     AC_MSG_RESULT([yes])
9328     PKG_CHECK_MODULES(XRENDER, xrender)
9329     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9330     FilterLibs "${XRENDER_LIBS}"
9331     XRENDER_LIBS="${filteredlibs}"
9332     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9333       [AC_MSG_ERROR(libXrender not found or functional)], [])
9334     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9335       [AC_MSG_ERROR(Xrender not found. install X)], [])
9336 else
9337     AC_MSG_RESULT([no])
9339 AC_SUBST(XRENDER_CFLAGS)
9340 AC_SUBST(XRENDER_LIBS)
9342 dnl ===================================================================
9343 dnl Check for XRandr
9344 dnl ===================================================================
9345 AC_MSG_CHECKING([whether to enable RandR support])
9346 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9347     AC_MSG_RESULT([yes])
9348     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9349     if test "$ENABLE_RANDR" != "TRUE"; then
9350         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9351                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9352         XRANDR_CFLAGS=" "
9353         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9354           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9355         XRANDR_LIBS="-lXrandr "
9356         ENABLE_RANDR="TRUE"
9357     fi
9358     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9359     FilterLibs "${XRANDR_LIBS}"
9360     XRANDR_LIBS="${filteredlibs}"
9361 else
9362     ENABLE_RANDR=""
9363     AC_MSG_RESULT([no])
9365 AC_SUBST(XRANDR_CFLAGS)
9366 AC_SUBST(XRANDR_LIBS)
9367 AC_SUBST(ENABLE_RANDR)
9369 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9370     WITH_WEBDAV="serf"
9372 if test $_os = iOS -o $_os = Android; then
9373     WITH_WEBDAV="no"
9375 AC_MSG_CHECKING([for webdav library])
9376 case "$WITH_WEBDAV" in
9377 serf)
9378     AC_MSG_RESULT([serf])
9379     # Check for system apr-util
9380     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9381                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9382                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9383     if test "$COM" = "MSC"; then
9384         APR_LIB_DIR="LibR"
9385         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9386         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9387     fi
9389     # Check for system serf
9390     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9391                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9392     if test "$COM" = "MSC"; then
9393         SERF_LIB_DIR="Release"
9394         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9395         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9396     fi
9397     ;;
9398 neon)
9399     AC_MSG_RESULT([neon])
9400     # Check for system neon
9401     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9402     if test "$with_system_neon" = "yes"; then
9403         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9404     else
9405         NEON_VERSION=0295
9406     fi
9407     AC_SUBST(NEON_VERSION)
9408     ;;
9410     AC_MSG_RESULT([none, disabled])
9411     WITH_WEBDAV=""
9412     ;;
9413 esac
9414 AC_SUBST(WITH_WEBDAV)
9416 dnl ===================================================================
9417 dnl Check for disabling cve_tests
9418 dnl ===================================================================
9419 AC_MSG_CHECKING([whether to execute CVE tests])
9420 # If not explicitly enabled or disabled, default
9421 if test -z "$enable_cve_tests"; then
9422     case "$OS" in
9423     WNT)
9424         # Default cves off for windows with its wild and wonderful
9425         # varienty of AV software kicking in and panicking
9426         enable_cve_tests=no
9427         ;;
9428     *)
9429         # otherwise yes
9430         enable_cve_tests=yes
9431         ;;
9432     esac
9434 if test "$enable_cve_tests" = "no"; then
9435     AC_MSG_RESULT([no])
9436     DISABLE_CVE_TESTS=TRUE
9437     AC_SUBST(DISABLE_CVE_TESTS)
9438 else
9439     AC_MSG_RESULT([yes])
9442 dnl ===================================================================
9443 dnl Check for enabling chart XShape tests
9444 dnl ===================================================================
9445 AC_MSG_CHECKING([whether to execute chart XShape tests])
9446 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9447     AC_MSG_RESULT([yes])
9448     ENABLE_CHART_TESTS=TRUE
9449     AC_SUBST(ENABLE_CHART_TESTS)
9450 else
9451     AC_MSG_RESULT([no])
9454 dnl ===================================================================
9455 dnl Check for system openssl
9456 dnl ===================================================================
9457 DISABLE_OPENSSL=
9458 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9459 if test "$enable_openssl" = "yes"; then
9460     AC_MSG_RESULT([no])
9461     if test "$_os" = Darwin ; then
9462         # OpenSSL is deprecated when building for 10.7 or later.
9463         #
9464         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9465         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9467         with_system_openssl=no
9468         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9469     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9470             && test "$with_system_openssl" != "no"; then
9471         with_system_openssl=yes
9472         SYSTEM_OPENSSL=TRUE
9473         OPENSSL_CFLAGS=
9474         OPENSSL_LIBS="-lssl -lcrypto"
9475     else
9476         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9477     fi
9478     if test "$with_system_openssl" = "yes"; then
9479         AC_MSG_CHECKING([whether openssl supports SHA512])
9480         AC_LANG_PUSH([C])
9481         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9482             SHA512_CTX context;
9483 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9484         AC_LANG_POP(C)
9485     fi
9486 else
9487     AC_MSG_RESULT([yes])
9488     DISABLE_OPENSSL=TRUE
9490     # warn that although OpenSSL is disabled, system libraries may depend on it
9491     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9492     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9495 AC_SUBST([DISABLE_OPENSSL])
9497 dnl ===================================================================
9498 dnl Check for building gnutls
9499 dnl ===================================================================
9500 AC_MSG_CHECKING([whether to use gnutls])
9501 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9502     AC_MSG_RESULT([yes])
9503     AM_PATH_LIBGCRYPT()
9504     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9505         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9506                       available in the system to use as replacement.]]))
9507     FilterLibs "${LIBGCRYPT_LIBS}"
9508     LIBGCRYPT_LIBS="${filteredlibs}"
9509 else
9510     AC_MSG_RESULT([no])
9513 AC_SUBST([LIBGCRYPT_CFLAGS])
9514 AC_SUBST([LIBGCRYPT_LIBS])
9516 dnl ===================================================================
9517 dnl Check for system redland
9518 dnl ===================================================================
9519 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9520 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9521 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9522 if test "$with_system_redland" = "yes"; then
9523     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9524             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9525 else
9526     RAPTOR_MAJOR="0"
9527     RASQAL_MAJOR="3"
9528     REDLAND_MAJOR="0"
9530 AC_SUBST(RAPTOR_MAJOR)
9531 AC_SUBST(RASQAL_MAJOR)
9532 AC_SUBST(REDLAND_MAJOR)
9534 dnl ===================================================================
9535 dnl Check for system hunspell
9536 dnl ===================================================================
9537 AC_MSG_CHECKING([which libhunspell to use])
9538 if test "$with_system_hunspell" = "yes"; then
9539     AC_MSG_RESULT([external])
9540     SYSTEM_HUNSPELL=TRUE
9541     AC_LANG_PUSH([C++])
9542     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9543     if test "$HUNSPELL_PC" != "TRUE"; then
9544         AC_CHECK_HEADER(hunspell.hxx, [],
9545             [
9546             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9547             [AC_MSG_ERROR(hunspell headers not found.)], [])
9548             ], [])
9549         AC_CHECK_LIB([hunspell], [main], [:],
9550            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9551         HUNSPELL_LIBS=-lhunspell
9552     fi
9553     AC_LANG_POP([C++])
9554     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9555     FilterLibs "${HUNSPELL_LIBS}"
9556     HUNSPELL_LIBS="${filteredlibs}"
9557 else
9558     AC_MSG_RESULT([internal])
9559     SYSTEM_HUNSPELL=
9560     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9561     if test "$COM" = "MSC"; then
9562         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9563     else
9564         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.6"
9565     fi
9566     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9568 AC_SUBST(SYSTEM_HUNSPELL)
9569 AC_SUBST(HUNSPELL_CFLAGS)
9570 AC_SUBST(HUNSPELL_LIBS)
9572 dnl ===================================================================
9573 dnl Checking for altlinuxhyph
9574 dnl ===================================================================
9575 AC_MSG_CHECKING([which altlinuxhyph to use])
9576 if test "$with_system_altlinuxhyph" = "yes"; then
9577     AC_MSG_RESULT([external])
9578     SYSTEM_HYPH=TRUE
9579     AC_CHECK_HEADER(hyphen.h, [],
9580        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9581     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9582        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9583        [#include <hyphen.h>])
9584     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9585         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9586     if test -z "$HYPHEN_LIB"; then
9587         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9588            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9589     fi
9590     if test -z "$HYPHEN_LIB"; then
9591         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9592            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9593     fi
9594 else
9595     AC_MSG_RESULT([internal])
9596     SYSTEM_HYPH=
9597     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9598     if test "$COM" = "MSC"; then
9599         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9600     else
9601         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9602     fi
9604 AC_SUBST(SYSTEM_HYPH)
9605 AC_SUBST(HYPHEN_LIB)
9607 dnl ===================================================================
9608 dnl Checking for mythes
9609 dnl ===================================================================
9610 AC_MSG_CHECKING([which mythes to use])
9611 if test "$with_system_mythes" = "yes"; then
9612     AC_MSG_RESULT([external])
9613     SYSTEM_MYTHES=TRUE
9614     AC_LANG_PUSH([C++])
9615     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9616     if test "$MYTHES_PKGCONFIG" = "no"; then
9617         AC_CHECK_HEADER(mythes.hxx, [],
9618             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9619         AC_CHECK_LIB([mythes-1.2], [main], [:],
9620             [ MYTHES_FOUND=no], [])
9621     if test "$MYTHES_FOUND" = "no"; then
9622         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9623                 [ MYTHES_FOUND=no], [])
9624     fi
9625     if test "$MYTHES_FOUND" = "no"; then
9626         AC_MSG_ERROR([mythes library not found!.])
9627     fi
9628     fi
9629     AC_LANG_POP([C++])
9630     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9631     FilterLibs "${MYTHES_LIBS}"
9632     MYTHES_LIBS="${filteredlibs}"
9633 else
9634     AC_MSG_RESULT([internal])
9635     SYSTEM_MYTHES=
9636     BUILD_TYPE="$BUILD_TYPE MYTHES"
9637     if test "$COM" = "MSC"; then
9638         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9639     else
9640         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9641     fi
9643 AC_SUBST(SYSTEM_MYTHES)
9644 AC_SUBST(MYTHES_CFLAGS)
9645 AC_SUBST(MYTHES_LIBS)
9647 dnl ===================================================================
9648 dnl How should we build the linear programming solver ?
9649 dnl ===================================================================
9651 ENABLE_COINMP=
9652 AC_MSG_CHECKING([whether to build with CoinMP])
9653 if test "$enable_coinmp" != "no"; then
9654     ENABLE_COINMP=TRUE
9655     AC_MSG_RESULT([yes])
9656     if test "$with_system_coinmp" = "yes"; then
9657         SYSTEM_COINMP=TRUE
9658         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9659         FilterLibs "${COINMP_LIBS}"
9660         COINMP_LIBS="${filteredlibs}"
9661     else
9662         BUILD_TYPE="$BUILD_TYPE COINMP"
9663     fi
9664 else
9665     AC_MSG_RESULT([no])
9667 AC_SUBST(ENABLE_COINMP)
9668 AC_SUBST(SYSTEM_COINMP)
9669 AC_SUBST(COINMP_CFLAGS)
9670 AC_SUBST(COINMP_LIBS)
9672 ENABLE_LPSOLVE=
9673 AC_MSG_CHECKING([whether to build with lpsolve])
9674 if test "$enable_lpsolve" != "no"; then
9675     ENABLE_LPSOLVE=TRUE
9676     AC_MSG_RESULT([yes])
9677 else
9678     AC_MSG_RESULT([no])
9680 AC_SUBST(ENABLE_LPSOLVE)
9682 if test "$ENABLE_LPSOLVE" = TRUE; then
9683     AC_MSG_CHECKING([which lpsolve to use])
9684     if test "$with_system_lpsolve" = "yes"; then
9685         AC_MSG_RESULT([external])
9686         SYSTEM_LPSOLVE=TRUE
9687         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9688            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9689         save_LIBS=$LIBS
9690         # some systems need this. Like Ubuntu....
9691         AC_CHECK_LIB(m, floor)
9692         AC_CHECK_LIB(dl, dlopen)
9693         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9694             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9695         LIBS=$save_LIBS
9696     else
9697         AC_MSG_RESULT([internal])
9698         SYSTEM_LPSOLVE=
9699         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9700     fi
9702 AC_SUBST(SYSTEM_LPSOLVE)
9704 dnl ===================================================================
9705 dnl Checking for libexttextcat
9706 dnl ===================================================================
9707 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9708 if test "$with_system_libexttextcat" = "yes"; then
9709     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9711 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9713 dnl ===================================================================
9714 dnl Checking for libnumbertext
9715 dnl ===================================================================
9716 AC_MSG_CHECKING([whether to use libnumbertext])
9717 if test "$enable_libnumbertext" = "no"; then
9718     AC_MSG_RESULT([no])
9719     ENABLE_LIBNUMBERTEXT=
9720     SYSTEM_LIBNUMBERTEXT=
9721 else
9722     AC_MSG_RESULT([yes])
9723     ENABLE_LIBNUMBERTEXT=TRUE
9724     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
9725     if test "$with_system_libnumbertext" = "yes"; then
9726         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
9727         SYSTEM_LIBNUMBERTEXT=YES
9728     else
9729         SYSTEM_LIBNUMBERTEXT=
9730         AC_LANG_PUSH([C++])
9731         save_CPPFLAGS=$CPPFLAGS
9732         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
9733         AC_CHECK_HEADERS([codecvt regex])
9734         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
9735                 [ ENABLE_LIBNUMBERTEXT=''
9736                   LIBNUMBERTEXT_CFLAGS=''
9737                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
9738                                Enable libnumbertext fallback (missing number to number name conversion).])
9739                 ])
9740         CPPFLAGS=$save_CPPFLAGS
9741         AC_LANG_POP([C++])
9742     fi
9743     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
9744         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
9745     fi
9747 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
9748 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
9749 AC_SUBST(ENABLE_LIBNUMBERTEXT)
9750 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
9752 dnl ***************************************
9753 dnl testing libc version for Linux...
9754 dnl ***************************************
9755 if test "$_os" = "Linux"; then
9756     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9757     exec 6>/dev/null # no output
9758     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9759     exec 6>&1 # output on again
9760     if test "$HAVE_LIBC"; then
9761         AC_MSG_RESULT([yes])
9762     else
9763         AC_MSG_ERROR([no, upgrade libc])
9764     fi
9767 dnl =========================================
9768 dnl Check for uuidgen
9769 dnl =========================================
9770 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9771     # presence is already tested above in the WINDOWS_SDK_HOME check
9772     UUIDGEN=uuidgen.exe
9773     AC_SUBST(UUIDGEN)
9774 else
9775     AC_PATH_PROG([UUIDGEN], [uuidgen])
9776     if test -z "$UUIDGEN"; then
9777         AC_MSG_WARN([uuid is needed for building installation sets])
9778     fi
9781 dnl ***************************************
9782 dnl Checking for bison and flex
9783 dnl ***************************************
9784 AC_PATH_PROG(BISON, bison)
9785 if test -z "$BISON"; then
9786     AC_MSG_ERROR([no bison found in \$PATH, install it])
9787 else
9788     AC_MSG_CHECKING([the bison version])
9789     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9790     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9791     # Accept newer than 2.0
9792     if test "$_bison_longver" -lt 2000; then
9793         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9794     fi
9797 AC_PATH_PROG(FLEX, flex)
9798 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9799     FLEX=`cygpath -m $FLEX`
9801 if test -z "$FLEX"; then
9802     AC_MSG_ERROR([no flex found in \$PATH, install it])
9803 else
9804     AC_MSG_CHECKING([the flex version])
9805     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9806     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9807         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9808     fi
9810 AC_SUBST([FLEX])
9811 dnl ***************************************
9812 dnl Checking for patch
9813 dnl ***************************************
9814 AC_PATH_PROG(PATCH, patch)
9815 if test -z "$PATCH"; then
9816     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9819 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9820 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9821     if test -z "$with_gnu_patch"; then
9822         GNUPATCH=$PATCH
9823     else
9824         if test -x "$with_gnu_patch"; then
9825             GNUPATCH=$with_gnu_patch
9826         else
9827             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9828         fi
9829     fi
9831     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9832     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9833         AC_MSG_RESULT([yes])
9834     else
9835         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9836     fi
9837 else
9838     GNUPATCH=$PATCH
9841 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9842     GNUPATCH=`cygpath -m $GNUPATCH`
9845 dnl We also need to check for --with-gnu-cp
9847 if test -z "$with_gnu_cp"; then
9848     # check the place where the good stuff is hidden on Solaris...
9849     if test -x /usr/gnu/bin/cp; then
9850         GNUCP=/usr/gnu/bin/cp
9851     else
9852         AC_PATH_PROGS(GNUCP, gnucp cp)
9853     fi
9854     if test -z $GNUCP; then
9855         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9856     fi
9857 else
9858     if test -x "$with_gnu_cp"; then
9859         GNUCP=$with_gnu_cp
9860     else
9861         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9862     fi
9865 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9866     GNUCP=`cygpath -m $GNUCP`
9869 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9870 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9871     AC_MSG_RESULT([yes])
9872 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9873     AC_MSG_RESULT([yes])
9874 else
9875     case "$build_os" in
9876     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9877         x_GNUCP=[\#]
9878         GNUCP=''
9879         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9880         ;;
9881     *)
9882         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9883         ;;
9884     esac
9887 AC_SUBST(GNUPATCH)
9888 AC_SUBST(GNUCP)
9889 AC_SUBST(x_GNUCP)
9891 dnl ***************************************
9892 dnl testing assembler path
9893 dnl ***************************************
9894 ML_EXE=""
9895 if test "$_os" = "WINNT"; then
9896     if test "$BITNESS_OVERRIDE" = ""; then
9897         assembler=ml.exe
9898         assembler_bin=$CL_DIR
9899     else
9900         assembler=ml64.exe
9901         assembler_bin=$CL_DIR
9902     fi
9904     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9905     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9906         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9907         AC_MSG_RESULT([found])
9908         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9909     else
9910         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9911     fi
9913     PathFormat "$ASM_HOME"
9914     ASM_HOME="$formatted_path"
9915 else
9916     ASM_HOME=""
9919 AC_SUBST(ML_EXE)
9921 dnl ===================================================================
9922 dnl We need zip and unzip
9923 dnl ===================================================================
9924 AC_PATH_PROG(ZIP, zip)
9925 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9926 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9927     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],,)
9930 AC_PATH_PROG(UNZIP, unzip)
9931 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9933 dnl ===================================================================
9934 dnl Zip must be a specific type for different build types.
9935 dnl ===================================================================
9936 if test $build_os = cygwin; then
9937     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9938         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9939     fi
9942 dnl ===================================================================
9943 dnl We need touch with -h option support.
9944 dnl ===================================================================
9945 AC_PATH_PROG(TOUCH, touch)
9946 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
9947 touch warn
9948 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
9949     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],,)
9952 dnl ===================================================================
9953 dnl Check for system epoxy
9954 dnl ===================================================================
9955 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
9957 dnl ===================================================================
9958 dnl Set vcl option: coordinate device in double or sal_Int32
9959 dnl ===================================================================
9961 dnl disabled for now, we don't want subtle differences between OSs
9962 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
9963 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
9964 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
9965 dnl     AC_MSG_RESULT([double])
9966 dnl else
9967 dnl     AC_MSG_RESULT([sal_Int32])
9968 dnl fi
9970 dnl ===================================================================
9971 dnl Test which vclplugs have to be built.
9972 dnl ===================================================================
9973 R=""
9974 if test "$USING_X11" != TRUE; then
9975     enable_gtk=no
9976     enable_gtk3=no
9978 GTK3_CFLAGS=""
9979 GTK3_LIBS=""
9980 ENABLE_GTK3=""
9981 if test "x$enable_gtk3" = "xyes"; then
9982     if test "$with_system_cairo" = no; then
9983         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
9984     fi
9985     : ${with_system_cairo:=yes}
9986     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="")
9987     if test "x$ENABLE_GTK3" = "xTRUE"; then
9988         R="gtk3"
9989         dnl Avoid installed by unpackaged files for now.
9990         if test -z "$PKGFORMAT"; then
9991             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
9992         fi
9993     else
9994         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
9995     fi
9996     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9997     FilterLibs "${GTK3_LIBS}"
9998     GTK3_LIBS="${filteredlibs}"
10000     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10001     if test "$with_system_epoxy" != "yes"; then
10002         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10003         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10004                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10005     fi
10007 AC_SUBST(GTK3_LIBS)
10008 AC_SUBST(GTK3_CFLAGS)
10009 AC_SUBST(ENABLE_GTK3)
10011 ENABLE_GTK=""
10012 if test "x$enable_gtk" = "xyes"; then
10013     if test "$with_system_cairo" = no; then
10014         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
10015     fi
10016     : ${with_system_cairo:=yes}
10017     ENABLE_GTK="TRUE"
10018     AC_DEFINE(ENABLE_GTK)
10019     R="gtk $R"
10021 AC_SUBST(ENABLE_GTK)
10023 ENABLE_KDE4=""
10024 if test "x$enable_kde4" = "xyes"; then
10025     ENABLE_KDE4="TRUE"
10026     AC_DEFINE(ENABLE_KDE4)
10027     R="$R kde4"
10029 AC_SUBST(ENABLE_KDE4)
10031 ENABLE_QT5=""
10032 if test "x$enable_qt5" = "xyes"; then
10033     ENABLE_QT5="TRUE"
10034     AC_DEFINE(ENABLE_QT5)
10035     R="$R qt5"
10037 AC_SUBST(ENABLE_QT5)
10039 ENABLE_KDE5=""
10040 if test "x$enable_kde5" = "xyes"; then
10041     ENABLE_KDE5="TRUE"
10042     AC_DEFINE(ENABLE_KDE5)
10043     R="$R kde5"
10045 AC_SUBST(ENABLE_KDE5)
10047 ENABLE_GTK3_KDE5=""
10048 if test "x$enable_gtk3_kde5" = "xyes"; then
10049     ENABLE_GTK3_KDE5="TRUE"
10050     AC_DEFINE(ENABLE_GTK3_KDE5)
10051     R="$R gtk3_kde5"
10053 AC_SUBST(ENABLE_GTK3_KDE5)
10055 build_vcl_plugins="$R"
10056 if test -z "$build_vcl_plugins"; then
10057     build_vcl_plugins="none"
10059 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10061 dnl ===================================================================
10062 dnl check for dbus support
10063 dnl ===================================================================
10064 ENABLE_DBUS=""
10065 DBUS_CFLAGS=""
10066 DBUS_LIBS=""
10068 if test "$enable_dbus" = "no"; then
10069     test_dbus=no
10072 AC_MSG_CHECKING([whether to enable DBUS support])
10073 if test "$test_dbus" = "yes"; then
10074     ENABLE_DBUS="TRUE"
10075     AC_MSG_RESULT([yes])
10076     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
10077     AC_DEFINE(ENABLE_DBUS)
10078     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10079     FilterLibs "${DBUS_LIBS}"
10080     DBUS_LIBS="${filteredlibs}"
10081 else
10082     AC_MSG_RESULT([no])
10085 AC_SUBST(ENABLE_DBUS)
10086 AC_SUBST(DBUS_CFLAGS)
10087 AC_SUBST(DBUS_LIBS)
10089 AC_MSG_CHECKING([whether to enable Impress remote control])
10090 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10091     AC_MSG_RESULT([yes])
10092     ENABLE_SDREMOTE=TRUE
10093     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10095     # If not explicitly enabled or disabled, default
10096     if test -z "$enable_sdremote_bluetooth"; then
10097         case "$OS" in
10098         LINUX|MACOSX|WNT)
10099             # Default to yes for these
10100             enable_sdremote_bluetooth=yes
10101             ;;
10102         *)
10103             # otherwise no
10104             enable_sdremote_bluetooth=no
10105             ;;
10106         esac
10107     fi
10108     # $enable_sdremote_bluetooth is guaranteed non-empty now
10110     if test "$enable_sdremote_bluetooth" != "no"; then
10111         if test "$OS" = "LINUX"; then
10112             if test "$ENABLE_DBUS" = "TRUE"; then
10113                 AC_MSG_RESULT([yes])
10114                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10115                 dnl ===================================================================
10116                 dnl Check for system bluez
10117                 dnl ===================================================================
10118                 AC_MSG_CHECKING([which Bluetooth header to use])
10119                 if test "$with_system_bluez" = "yes"; then
10120                     AC_MSG_RESULT([external])
10121                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10122                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10123                     SYSTEM_BLUEZ=TRUE
10124                 else
10125                     AC_MSG_RESULT([internal])
10126                     SYSTEM_BLUEZ=
10127                 fi
10128             else
10129                 AC_MSG_RESULT([no, dbus disabled])
10130                 ENABLE_SDREMOTE_BLUETOOTH=
10131                 SYSTEM_BLUEZ=
10132             fi
10133         else
10134             AC_MSG_RESULT([yes])
10135             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10136             SYSTEM_BLUEZ=
10137         fi
10138     else
10139         AC_MSG_RESULT([no])
10140         ENABLE_SDREMOTE_BLUETOOTH=
10141         SYSTEM_BLUEZ=
10142     fi
10143 else
10144     ENABLE_SDREMOTE=
10145     SYSTEM_BLUEZ=
10146     AC_MSG_RESULT([no])
10148 AC_SUBST(ENABLE_SDREMOTE)
10149 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10150 AC_SUBST(SYSTEM_BLUEZ)
10152 dnl ===================================================================
10153 dnl Check whether the gtk 2.0 libraries are available.
10154 dnl ===================================================================
10156 GTK_CFLAGS=""
10157 GTK_LIBS=""
10158 if test  "$test_gtk" = "yes"; then
10160     if test "$ENABLE_GTK" = "TRUE"; then
10161         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]))
10162         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10163         FilterLibs "${GTK_LIBS}"
10164         GTK_LIBS="${filteredlibs}"
10165         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]))
10166         BUILD_TYPE="$BUILD_TYPE GTK"
10167         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10168         FilterLibs "${GTHREAD_LIBS}"
10169         GTHREAD_LIBS="${filteredlibs}"
10171         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10172         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10173                           [ENABLE_GTK_PRINT="TRUE"],
10174                           [ENABLE_GTK_PRINT=""])
10175         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10176         FilterLibs "${GTK_PRINT_LIBS}"
10177         GTK_PRINT_LIBS="${filteredlibs}"
10178     fi
10180     if test "$ENABLE_GTK" = "TRUE" || test "$ENABLE_GTK3" = "TRUE"; then
10181         AC_MSG_CHECKING([whether to enable GIO support])
10182         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10183             dnl Need at least 2.26 for the dbus support.
10184             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10185                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10186             if test "$ENABLE_GIO" = "TRUE"; then
10187                 AC_DEFINE(ENABLE_GIO)
10188                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10189                 FilterLibs "${GIO_LIBS}"
10190                 GIO_LIBS="${filteredlibs}"
10191             fi
10192         else
10193             AC_MSG_RESULT([no])
10194         fi
10195     fi
10197 AC_SUBST(ENABLE_GIO)
10198 AC_SUBST(GIO_CFLAGS)
10199 AC_SUBST(GIO_LIBS)
10200 AC_SUBST(GTK_CFLAGS)
10201 AC_SUBST(GTK_LIBS)
10202 AC_SUBST(GTHREAD_CFLAGS)
10203 AC_SUBST(GTHREAD_LIBS)
10204 AC_SUBST([ENABLE_GTK_PRINT])
10205 AC_SUBST([GTK_PRINT_CFLAGS])
10206 AC_SUBST([GTK_PRINT_LIBS])
10209 dnl ===================================================================
10211 SPLIT_APP_MODULES=""
10212 if test "$enable_split_app_modules" = "yes"; then
10213     SPLIT_APP_MODULES="TRUE"
10215 AC_SUBST(SPLIT_APP_MODULES)
10217 SPLIT_OPT_FEATURES=""
10218 if test "$enable_split_opt_features" = "yes"; then
10219     SPLIT_OPT_FEATURES="TRUE"
10221 AC_SUBST(SPLIT_OPT_FEATURES)
10223 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10224     if test "$enable_cairo_canvas" = yes; then
10225         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10226     fi
10227     enable_cairo_canvas=no
10228 elif test -z "$enable_cairo_canvas"; then
10229     enable_cairo_canvas=yes
10232 ENABLE_CAIRO_CANVAS=""
10233 if test "$enable_cairo_canvas" = "yes"; then
10234     test_cairo=yes
10235     ENABLE_CAIRO_CANVAS="TRUE"
10236     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10238 AC_SUBST(ENABLE_CAIRO_CANVAS)
10240 dnl ===================================================================
10241 dnl Check whether the GStreamer libraries are available.
10242 dnl It's possible to build avmedia with both GStreamer backends!
10243 dnl ===================================================================
10245 ENABLE_GSTREAMER_1_0=""
10247 if test "$build_gstreamer_1_0" = "yes"; then
10249     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10250     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10251         ENABLE_GSTREAMER_1_0="TRUE"
10252         AC_MSG_RESULT([yes])
10253         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10254         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10255         FilterLibs "${GSTREAMER_1_0_LIBS}"
10256         GSTREAMER_1_0_LIBS="${filteredlibs}"
10257     else
10258         AC_MSG_RESULT([no])
10259     fi
10261 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10262 AC_SUBST(GSTREAMER_1_0_LIBS)
10263 AC_SUBST(ENABLE_GSTREAMER_1_0)
10266 ENABLE_GSTREAMER_0_10=""
10267 if test "$build_gstreamer_0_10" = "yes"; then
10269     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10270     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10271         ENABLE_GSTREAMER_0_10="TRUE"
10272         AC_MSG_RESULT([yes])
10273         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10274             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10275         ])
10276         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10277         FilterLibs "${GSTREAMER_0_10_LIBS}"
10278         GSTREAMER_0_10_LIBS="${filteredlibs}"
10279     else
10280         AC_MSG_RESULT([no])
10281     fi
10284 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10285 AC_SUBST(GSTREAMER_0_10_LIBS)
10286 AC_SUBST(ENABLE_GSTREAMER_0_10)
10288 dnl ===================================================================
10289 dnl Check whether to build the VLC avmedia backend
10290 dnl ===================================================================
10292 ENABLE_VLC=""
10294 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10295 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10296     ENABLE_VLC="TRUE"
10297     AC_MSG_RESULT([yes])
10298 else
10299     AC_MSG_RESULT([no])
10301 AC_SUBST(ENABLE_VLC)
10303 ENABLE_OPENGL_TRANSITIONS=
10304 ENABLE_OPENGL_CANVAS=
10305 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10306    : # disable
10307 elif test "$_os" = "Darwin"; then
10308     # We use frameworks on Mac OS X, no need for detail checks
10309     ENABLE_OPENGL_TRANSITIONS=TRUE
10310     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10311     ENABLE_OPENGL_CANVAS=TRUE
10312 elif test $_os = WINNT; then
10313     ENABLE_OPENGL_TRANSITIONS=TRUE
10314     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10315     ENABLE_OPENGL_CANVAS=TRUE
10316 else
10317     if test "$USING_X11" = TRUE; then
10318         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10319         ENABLE_OPENGL_TRANSITIONS=TRUE
10320         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10321         ENABLE_OPENGL_CANVAS=TRUE
10322     fi
10325 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10326 AC_SUBST(ENABLE_OPENGL_CANVAS)
10328 dnl =================================================
10329 dnl Check whether to build with OpenCL support.
10330 dnl =================================================
10332 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10333     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10334     # platform (optional at run-time, used through clew).
10335     BUILD_TYPE="$BUILD_TYPE OPENCL"
10336     AC_DEFINE(HAVE_FEATURE_OPENCL)
10339 dnl =================================================
10340 dnl Check whether to build with dconf support.
10341 dnl =================================================
10343 if test "$enable_dconf" != no; then
10344     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10345         if test "$enable_dconf" = yes; then
10346             AC_MSG_ERROR([dconf not found])
10347         else
10348             enable_dconf=no
10349         fi])
10351 AC_MSG_CHECKING([whether to enable dconf])
10352 if test "$enable_dconf" = no; then
10353     DCONF_CFLAGS=
10354     DCONF_LIBS=
10355     ENABLE_DCONF=
10356     AC_MSG_RESULT([no])
10357 else
10358     ENABLE_DCONF=TRUE
10359     AC_DEFINE(ENABLE_DCONF)
10360     AC_MSG_RESULT([yes])
10362 AC_SUBST([DCONF_CFLAGS])
10363 AC_SUBST([DCONF_LIBS])
10364 AC_SUBST([ENABLE_DCONF])
10366 # pdf import?
10367 AC_MSG_CHECKING([whether to build the PDF import feature])
10368 ENABLE_PDFIMPORT=
10369 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10370     AC_MSG_RESULT([yes])
10371     ENABLE_PDFIMPORT=TRUE
10372     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10374     dnl ===================================================================
10375     dnl Check for system poppler
10376     dnl ===================================================================
10377     AC_MSG_CHECKING([which PDF import backend to use])
10378     if test "$with_system_poppler" = "yes"; then
10379         AC_MSG_RESULT([external])
10380         SYSTEM_POPPLER=TRUE
10381         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10382         AC_LANG_PUSH([C++])
10383         save_CXXFLAGS=$CXXFLAGS
10384         save_CPPFLAGS=$CPPFLAGS
10385         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10386         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10387         AC_CHECK_HEADER([cpp/poppler-version.h],
10388             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10389             [])
10390         CXXFLAGS=$save_CXXFLAGS
10391         CPPFLAGS=$save_CPPFLAGS
10392         AC_LANG_POP([C++])
10393         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10395         FilterLibs "${POPPLER_LIBS}"
10396         POPPLER_LIBS="${filteredlibs}"
10397     else
10398         AC_MSG_RESULT([internal])
10399         SYSTEM_POPPLER=
10400         BUILD_TYPE="$BUILD_TYPE POPPLER"
10401         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10402     fi
10403     AC_DEFINE([ENABLE_PDFIMPORT],1)
10404 else
10405     AC_MSG_RESULT([no])
10407 AC_SUBST(ENABLE_PDFIMPORT)
10408 AC_SUBST(SYSTEM_POPPLER)
10409 AC_SUBST(POPPLER_CFLAGS)
10410 AC_SUBST(POPPLER_LIBS)
10412 # pdf import?
10413 AC_MSG_CHECKING([whether to build PDFium])
10414 ENABLE_PDFIUM=
10415 if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then
10416     AC_MSG_RESULT([yes])
10417     ENABLE_PDFIUM=TRUE
10418     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10419     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10420 else
10421     AC_MSG_RESULT([no])
10423 AC_SUBST(ENABLE_PDFIUM)
10425 SYSTEM_GPGMEPP=
10427 if test "$build_for_ios" = "YES"; then
10428     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10429     AC_MSG_RESULT([yes])
10430 elif test "$enable_mpl_subset" = "yes"; then
10431     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10432     AC_MSG_RESULT([yes])
10433 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10434     dnl ===================================================================
10435     dnl Check for system gpgme
10436     dnl ===================================================================
10437     AC_MSG_CHECKING([which gpgmepp to use])
10438     if test "$with_system_gpgmepp" = "yes"; then
10439         AC_MSG_RESULT([external])
10440         SYSTEM_GPGMEPP=TRUE
10442         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10443         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10444             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10445         # progress_callback is the only func with plain C linkage
10446         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10447         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10448             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10449         AC_CHECK_HEADER(gpgme.h, [],
10450             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10451     else
10452         AC_MSG_RESULT([internal])
10453         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10454         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10456         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10457         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10458         if test "$_os" != "WINNT"; then
10459             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10460             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10461         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10462             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10463         fi
10464     fi
10465     ENABLE_GPGMEPP=TRUE
10466     AC_DEFINE([HAVE_FEATURE_GPGME])
10467     AC_PATH_PROG(GPG, gpg)
10468     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10469     # so let's exclude that manually for the moment
10470     if test -n "$GPG" -a "$_os" != "WINNT"; then
10471         # make sure we not only have a working gpgme, but a full working
10472         # gpg installation to run OpenPGP signature verification
10473         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10474     fi
10475     if test "$_os" = "Linux"; then
10476       uid=`id -u`
10477       AC_MSG_CHECKING([for /run/user/$uid])
10478       if test -d /run/user/$uid; then
10479         AC_MSG_RESULT([yes])
10480         AC_PATH_PROG(GPGCONF, gpgconf)
10481         AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10482         if $GPGCONF --dump-options > /dev/null ; then
10483           if $GPGCONF --dump-options | grep -q create-socketdir ; then
10484             AC_MSG_RESULT([yes])
10485             AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10486           else
10487             AC_MSG_RESULT([no])
10488           fi
10489         else
10490           AC_MSG_RESULT([no. missing or broken gpgconf?])
10491         fi
10492       else
10493         AC_MSG_RESULT([no])
10494      fi
10495    fi
10497 AC_SUBST(ENABLE_GPGMEPP)
10498 AC_SUBST(SYSTEM_GPGMEPP)
10499 AC_SUBST(GPG_ERROR_CFLAGS)
10500 AC_SUBST(GPG_ERROR_LIBS)
10501 AC_SUBST(LIBASSUAN_CFLAGS)
10502 AC_SUBST(LIBASSUAN_LIBS)
10503 AC_SUBST(GPGMEPP_CFLAGS)
10504 AC_SUBST(GPGMEPP_LIBS)
10505 AC_SUBST(GPGCONF)
10506 AC_SUBST(HAVE_GPGCONF_SOCKETDIR)
10508 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10509 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10510     AC_MSG_RESULT([yes])
10511     ENABLE_MEDIAWIKI=TRUE
10512     BUILD_TYPE="$BUILD_TYPE XSLTML"
10513     if test  "x$with_java" = "xno"; then
10514         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10515     fi
10516 else
10517     AC_MSG_RESULT([no])
10518     ENABLE_MEDIAWIKI=
10519     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10521 AC_SUBST(ENABLE_MEDIAWIKI)
10523 AC_MSG_CHECKING([whether to build the Report Builder])
10524 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10525     AC_MSG_RESULT([yes])
10526     ENABLE_REPORTBUILDER=TRUE
10527     AC_MSG_CHECKING([which jfreereport libs to use])
10528     if test "$with_system_jfreereport" = "yes"; then
10529         SYSTEM_JFREEREPORT=TRUE
10530         AC_MSG_RESULT([external])
10531         if test -z $SAC_JAR; then
10532             SAC_JAR=/usr/share/java/sac.jar
10533         fi
10534         if ! test -f $SAC_JAR; then
10535              AC_MSG_ERROR(sac.jar not found.)
10536         fi
10538         if test -z $LIBXML_JAR; then
10539             if test -f /usr/share/java/libxml-1.0.0.jar; then
10540                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10541             elif test -f /usr/share/java/libxml.jar; then
10542                 LIBXML_JAR=/usr/share/java/libxml.jar
10543             else
10544                 AC_MSG_ERROR(libxml.jar replacement not found.)
10545             fi
10546         elif ! test -f $LIBXML_JAR; then
10547             AC_MSG_ERROR(libxml.jar not found.)
10548         fi
10550         if test -z $FLUTE_JAR; then
10551             if test -f/usr/share/java/flute-1.3.0.jar; then
10552                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10553             elif test -f /usr/share/java/flute.jar; then
10554                 FLUTE_JAR=/usr/share/java/flute.jar
10555             else
10556                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10557             fi
10558         elif ! test -f $FLUTE_JAR; then
10559             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10560         fi
10562         if test -z $JFREEREPORT_JAR; then
10563             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10564                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10565             elif test -f /usr/share/java/flow-engine.jar; then
10566                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10567             else
10568                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10569             fi
10570         elif ! test -f  $JFREEREPORT_JAR; then
10571                 AC_MSG_ERROR(jfreereport.jar not found.)
10572         fi
10574         if test -z $LIBLAYOUT_JAR; then
10575             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10576                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10577             elif test -f /usr/share/java/liblayout.jar; then
10578                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10579             else
10580                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10581             fi
10582         elif ! test -f $LIBLAYOUT_JAR; then
10583                 AC_MSG_ERROR(liblayout.jar not found.)
10584         fi
10586         if test -z $LIBLOADER_JAR; then
10587             if test -f /usr/share/java/libloader-1.0.0.jar; then
10588                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10589             elif test -f /usr/share/java/libloader.jar; then
10590                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10591             else
10592                 AC_MSG_ERROR(libloader.jar replacement not found.)
10593             fi
10594         elif ! test -f  $LIBLOADER_JAR; then
10595             AC_MSG_ERROR(libloader.jar not found.)
10596         fi
10598         if test -z $LIBFORMULA_JAR; then
10599             if test -f /usr/share/java/libformula-0.2.0.jar; then
10600                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10601             elif test -f /usr/share/java/libformula.jar; then
10602                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10603             else
10604                 AC_MSG_ERROR(libformula.jar replacement not found.)
10605             fi
10606         elif ! test -f $LIBFORMULA_JAR; then
10607                 AC_MSG_ERROR(libformula.jar not found.)
10608         fi
10610         if test -z $LIBREPOSITORY_JAR; then
10611             if test -f /usr/share/java/librepository-1.0.0.jar; then
10612                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10613             elif test -f /usr/share/java/librepository.jar; then
10614                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10615             else
10616                 AC_MSG_ERROR(librepository.jar replacement not found.)
10617             fi
10618         elif ! test -f $LIBREPOSITORY_JAR; then
10619             AC_MSG_ERROR(librepository.jar not found.)
10620         fi
10622         if test -z $LIBFONTS_JAR; then
10623             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10624                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10625             elif test -f /usr/share/java/libfonts.jar; then
10626                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10627             else
10628                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10629             fi
10630         elif ! test -f $LIBFONTS_JAR; then
10631                 AC_MSG_ERROR(libfonts.jar not found.)
10632         fi
10634         if test -z $LIBSERIALIZER_JAR; then
10635             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10636                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10637             elif test -f /usr/share/java/libserializer.jar; then
10638                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10639             else
10640                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10641             fi
10642         elif ! test -f $LIBSERIALIZER_JAR; then
10643                 AC_MSG_ERROR(libserializer.jar not found.)
10644         fi
10646         if test -z $LIBBASE_JAR; then
10647             if test -f /usr/share/java/libbase-1.0.0.jar; then
10648                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10649             elif test -f /usr/share/java/libbase.jar; then
10650                 LIBBASE_JAR=/usr/share/java/libbase.jar
10651             else
10652                 AC_MSG_ERROR(libbase.jar replacement not found.)
10653             fi
10654         elif ! test -f $LIBBASE_JAR; then
10655             AC_MSG_ERROR(libbase.jar not found.)
10656         fi
10658     else
10659         AC_MSG_RESULT([internal])
10660         SYSTEM_JFREEREPORT=
10661         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10662         NEED_ANT=TRUE
10663     fi
10664 else
10665     AC_MSG_RESULT([no])
10666     ENABLE_REPORTBUILDER=
10667     SYSTEM_JFREEREPORT=
10669 AC_SUBST(ENABLE_REPORTBUILDER)
10670 AC_SUBST(SYSTEM_JFREEREPORT)
10671 AC_SUBST(SAC_JAR)
10672 AC_SUBST(LIBXML_JAR)
10673 AC_SUBST(FLUTE_JAR)
10674 AC_SUBST(JFREEREPORT_JAR)
10675 AC_SUBST(LIBBASE_JAR)
10676 AC_SUBST(LIBLAYOUT_JAR)
10677 AC_SUBST(LIBLOADER_JAR)
10678 AC_SUBST(LIBFORMULA_JAR)
10679 AC_SUBST(LIBREPOSITORY_JAR)
10680 AC_SUBST(LIBFONTS_JAR)
10681 AC_SUBST(LIBSERIALIZER_JAR)
10683 # this has to be here because both the Wiki Publisher and the SRB use
10684 # commons-logging
10685 COMMONS_LOGGING_VERSION=1.2
10686 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10687     AC_MSG_CHECKING([which Apache commons-* libs to use])
10688     if test "$with_system_apache_commons" = "yes"; then
10689         SYSTEM_APACHE_COMMONS=TRUE
10690         AC_MSG_RESULT([external])
10691         if test -z $COMMONS_LOGGING_JAR; then
10692             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10693                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10694            elif test -f /usr/share/java/commons-logging.jar; then
10695                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
10696             else
10697                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
10698             fi
10699         elif ! test -f $COMMONS_LOGGING_JAR; then
10700             AC_MSG_ERROR(commons-logging.jar not found.)
10701         fi
10702     else
10703         AC_MSG_RESULT([internal])
10704         SYSTEM_APACHE_COMMONS=
10705         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
10706         NEED_ANT=TRUE
10707     fi
10709 AC_SUBST(SYSTEM_APACHE_COMMONS)
10710 AC_SUBST(COMMONS_LOGGING_JAR)
10711 AC_SUBST(COMMONS_LOGGING_VERSION)
10713 # scripting provider for BeanShell?
10714 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10715 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10716     AC_MSG_RESULT([yes])
10717     ENABLE_SCRIPTING_BEANSHELL=TRUE
10719     dnl ===================================================================
10720     dnl Check for system beanshell
10721     dnl ===================================================================
10722     AC_MSG_CHECKING([which beanshell to use])
10723     if test "$with_system_beanshell" = "yes"; then
10724         AC_MSG_RESULT([external])
10725         SYSTEM_BSH=TRUE
10726         if test -z $BSH_JAR; then
10727             BSH_JAR=/usr/share/java/bsh.jar
10728         fi
10729         if ! test -f $BSH_JAR; then
10730             AC_MSG_ERROR(bsh.jar not found.)
10731         fi
10732     else
10733         AC_MSG_RESULT([internal])
10734         SYSTEM_BSH=
10735         BUILD_TYPE="$BUILD_TYPE BSH"
10736     fi
10737 else
10738     AC_MSG_RESULT([no])
10739     ENABLE_SCRIPTING_BEANSHELL=
10740     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10742 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10743 AC_SUBST(SYSTEM_BSH)
10744 AC_SUBST(BSH_JAR)
10746 # scripting provider for JavaScript?
10747 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10748 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10749     AC_MSG_RESULT([yes])
10750     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10752     dnl ===================================================================
10753     dnl Check for system rhino
10754     dnl ===================================================================
10755     AC_MSG_CHECKING([which rhino to use])
10756     if test "$with_system_rhino" = "yes"; then
10757         AC_MSG_RESULT([external])
10758         SYSTEM_RHINO=TRUE
10759         if test -z $RHINO_JAR; then
10760             RHINO_JAR=/usr/share/java/js.jar
10761         fi
10762         if ! test -f $RHINO_JAR; then
10763             AC_MSG_ERROR(js.jar not found.)
10764         fi
10765     else
10766         AC_MSG_RESULT([internal])
10767         SYSTEM_RHINO=
10768         BUILD_TYPE="$BUILD_TYPE RHINO"
10769         NEED_ANT=TRUE
10770     fi
10771 else
10772     AC_MSG_RESULT([no])
10773     ENABLE_SCRIPTING_JAVASCRIPT=
10774     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10776 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10777 AC_SUBST(SYSTEM_RHINO)
10778 AC_SUBST(RHINO_JAR)
10780 # This is only used in KDE3/KDE4 checks to determine if /usr/lib64
10781 # paths should be added to library search path. So lets put all 64-bit
10782 # platforms there.
10783 supports_multilib=
10784 case "$host_cpu" in
10785 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
10786     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10787         supports_multilib="yes"
10788     fi
10789     ;;
10791     ;;
10792 esac
10794 dnl ===================================================================
10795 dnl KDE4 Integration
10796 dnl ===================================================================
10798 KDE4_CFLAGS=""
10799 KDE4_LIBS=""
10800 QMAKE4="qmake"
10801 MOC4="moc"
10802 KDE4_GLIB_CFLAGS=""
10803 KDE4_GLIB_LIBS=""
10804 KDE4_HAVE_GLIB=""
10805 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
10806     qt4_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
10807     qt4_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
10809     kde4_incdirs="/usr/include /usr/include/kde4 $x_includes"
10810     kde4_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
10812     if test -n "$supports_multilib"; then
10813         qt4_libdirs="$qt4_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
10814         kde4_libdirs="$kde4_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
10815     fi
10817     if test -n "$QTDIR"; then
10818         qt4_incdirs="$QTDIR/include $qt4_incdirs"
10819         if test -z "$supports_multilib"; then
10820             qt4_libdirs="$QTDIR/lib $qt4_libdirs"
10821         else
10822             qt4_libdirs="$QTDIR/lib64 $QTDIR/lib $qt4_libdirs"
10823         fi
10824     fi
10825     if test -n "$QT4DIR"; then
10826         qt4_incdirs="$QT4DIR/include $qt4_incdirs"
10827         if test -z "$supports_multilib"; then
10828             qt4_libdirs="$QT4DIR/lib $qt4_libdirs"
10829         else
10830             qt4_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt4_libdirs"
10831         fi
10832     fi
10834     if test -n "$KDEDIR"; then
10835         kde4_incdirs="$KDEDIR/include $kde4_incdirs"
10836         if test -z "$supports_multilib"; then
10837             kde4_libdirs="$KDEDIR/lib $kde4_libdirs"
10838         else
10839             kde4_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde4_libdirs"
10840         fi
10841     fi
10842     if test -n "$KDE4DIR"; then
10843         kde4_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde4_incdirs"
10844         if test -z "$supports_multilib"; then
10845             kde4_libdirs="$KDE4DIR/lib $kde4_libdirs"
10846         else
10847             kde4_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde4_libdirs"
10848         fi
10849     fi
10851     qt4_test_include="Qt/qobject.h"
10852     qt4_test_library="libQtNetwork.so"
10853     kde4_test_include="kwindowsystem.h"
10854     kde4_test_library="libsolid.so"
10856     AC_MSG_CHECKING([for Qt4 headers])
10857     qt4_header_dir="no"
10858     for inc_dir in $qt4_incdirs; do
10859         if test -r "$inc_dir/$qt4_test_include"; then
10860             qt4_header_dir="$inc_dir"
10861             break
10862         fi
10863     done
10865     AC_MSG_RESULT([$qt4_header_dir])
10866     if test "x$qt4_header_dir" = "xno"; then
10867         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10868     fi
10870     dnl Check for qmake
10871     AC_PATH_PROGS( QMAKE4, [qmake-qt4 qmake], no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
10872     if test "$QMAKE4" = "no"; then
10873         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10874     else
10875         qmake4_test_ver="`$QMAKE4 -v 2>&1 | sed -n -e '/^Using Qt version 4\./p'`"
10876         if test -z "$qmake4_test_ver"; then
10877             AC_MSG_ERROR([Wrong qmake for Qt4 found. Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
10878         fi
10879     fi
10881     qt4_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt4_libdirs"
10882     AC_MSG_CHECKING([for Qt4 libraries])
10883     qt4_lib_dir="no"
10884     for lib_dir in $qt4_libdirs; do
10885         if test -r "$lib_dir/$qt4_test_library"; then
10886             qt4_lib_dir="$lib_dir"
10887             PKG_CONFIG_PATH="$qt4_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
10888             break
10889         fi
10890     done
10892     AC_MSG_RESULT([$qt4_lib_dir])
10894     if test "x$qt4_lib_dir" = "xno"; then
10895         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10896     fi
10898     dnl Check for Meta Object Compiler
10900     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10901     MOC4="$MOCQT4"
10902     if test "$MOC4" = "no"; then
10903         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10904         if test "$MOC4" = "no"; then
10905             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10906 the root of your Qt installation by exporting QT4DIR before running "configure".])
10907         fi
10908     fi
10910     dnl Check for KDE4 headers
10911     AC_MSG_CHECKING([for KDE4 headers])
10912     kde4_incdir="no"
10913     for kde4_check in $kde4_incdirs; do
10914         if test -r "$kde4_check/$kde4_test_include"; then
10915             kde4_incdir="$kde4_check"
10916             break
10917         fi
10918     done
10919     AC_MSG_RESULT([$kde4_incdir])
10920     if test "x$kde4_incdir" = "xno"; then
10921         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10922     fi
10923     if test "$kde4_incdir" = "/usr/include"; then kde4_incdir=; fi
10925     dnl Check for KDE4 libraries
10926     AC_MSG_CHECKING([for KDE4 libraries])
10927     kde4_libdir="no"
10928     for kde4_check in $kde4_libdirs; do
10929         if test -r "$kde4_check/$kde4_test_library"; then
10930             kde4_libdir="$kde4_check"
10931             break
10932         fi
10933     done
10935     AC_MSG_RESULT([$kde4_libdir])
10936     if test "x$kde4_libdir" = "xno"; then
10937         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10938     fi
10940     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
10941     if ! test -z "$kde4_incdir"; then
10942         KDE4_CFLAGS="-I$kde4_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10943     else
10944         KDE4_CFLAGS="$QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10945     fi
10947     KDE4_LIBS="-L$kde4_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt4_lib_dir $QT4_LIBS"
10948     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10949     FilterLibs "$KDE4_LIBS"
10950     KDE4_LIBS="$filteredlibs"
10952     AC_LANG_PUSH([C++])
10953     save_CXXFLAGS=$CXXFLAGS
10954     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10955     AC_MSG_CHECKING([whether KDE is >= 4.2])
10956        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10957 #include <kdeversion.h>
10959 int main(int argc, char **argv) {
10960        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
10961        else return 1;
10963 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[AC_MSG_ERROR([KDE support not tested with cross-compilation])])
10964     CXXFLAGS=$save_CXXFLAGS
10965     AC_LANG_POP([C++])
10967     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
10968     # Sets also KDE4_GLIB_CFLAGS/KDE4_GLIB_LIBS if successful.
10969     PKG_CHECK_MODULES(KDE4_GLIB,[glib-2.0 >= 2.4],
10970         [
10971             KDE4_HAVE_GLIB=TRUE
10972             AC_DEFINE(KDE4_HAVE_GLIB,1)
10973             KDE4_GLIB_CFLAGS=$(printf '%s' "$KDE4_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10974             FilterLibs "${KDE4_GLIB_LIBS}"
10975             KDE4_GLIB_LIBS="${filteredlibs}"
10977             qt4_fix_warning=
10979             AC_LANG_PUSH([C++])
10980             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
10981             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
10982             #  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
10983             #               ^~~~~~~~~~~~~~~~~~~~~~~
10984             #               vptr for 'QObjectPrivate'
10985             # so temporarily ignore here whichever way would be used to make such errors fatal
10986             # (-fno-sanitize-recover=... or UBSAN_OPTIONS halt_on_error=1):
10987             save_CXX=$CXX
10988             CXX=$(printf %s "$CXX" \
10989                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
10990             save_UBSAN_OPTIONS=$UBSAN_OPTIONS
10991             UBSAN_OPTIONS=$UBSAN_OPTIONS:halt_on_error=0
10992             save_CXXFLAGS=$CXXFLAGS
10993             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10994             save_LIBS=$LIBS
10995             LIBS="$LIBS $KDE4_LIBS"
10996             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
10998             # Prepare meta object data
10999             TSTBASE="tst_exclude_socket_notifiers"
11000             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11001             ln -fs "${TSTMOC}.hxx"
11002             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11004             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11005 #include <cstdlib>
11006 #include "tst_exclude_socket_notifiers.moc"
11008 int main(int argc, char *argv[])
11010     QCoreApplication app(argc, argv);
11011     exit(tst_processEventsExcludeSocket());
11012     return 0;
11014             ]])],[
11015                 AC_MSG_RESULT([yes])
11016             ],[
11017                 AC_MSG_RESULT([no])
11018                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11019                 if test -z "$qt4_fix_warning"; then
11020                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11021                 fi
11022                 qt4_fix_warning=1
11023                 add_warning "  https://bugreports.qt.io/browse/QTBUG-37380 (needed)"
11024                 ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11026             # Remove meta object data
11027             rm -f "${TSTBASE}."*
11029             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
11031             # Prepare meta object data
11032             TSTBASE="tst_exclude_posted_events"
11033             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11034             ln -fs "${TSTMOC}.hxx"
11035             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11037             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11038 #include <cstdlib>
11039 #include "tst_exclude_posted_events.moc"
11041 int main(int argc, char *argv[])
11043     QCoreApplication app(argc, argv);
11044     exit(tst_excludePostedEvents());
11045     return 0;
11047             ]])],[
11048                 AC_MSG_RESULT([yes])
11049             ],[
11050                 AC_MSG_RESULT([no])
11051                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11052                 if test -z "$qt4_fix_warning"; then
11053                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11054                 fi
11055                 qt4_fix_warning=1
11056                 add_warning "  https://bugreports.qt.io/browse/QTBUG-34614 (needed)"
11057             ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11059             # Remove meta object data
11060             rm -f "${TSTBASE}."*
11062             if test -n "$qt4_fix_warning"; then
11063                 add_warning "  https://bugreports.qt.io/browse/QTBUG-38585 (recommended)"
11064             fi
11066             LIBS=$save_LIBS
11067             CXXFLAGS=$save_CXXFLAGS
11068             UBSAN_OPTIONS=$save_UBSAN_OPTIONS
11069             CXX=$save_CXX
11070             AC_LANG_POP([C++])
11071         ],
11072         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11074 AC_SUBST(KDE4_CFLAGS)
11075 AC_SUBST(KDE4_LIBS)
11076 AC_SUBST(MOC4)
11077 AC_SUBST(KDE4_GLIB_CFLAGS)
11078 AC_SUBST(KDE4_GLIB_LIBS)
11079 AC_SUBST(KDE4_HAVE_GLIB)
11081 dnl ===================================================================
11082 dnl QT5 Integration
11083 dnl ===================================================================
11085 QT5_CFLAGS=""
11086 QT5_LIBS=""
11087 QMAKE5="qmake"
11088 MOC5="moc"
11089 QT5_GLIB_CFLAGS=""
11090 QT5_GLIB_LIBS=""
11091 QT5_HAVE_GLIB=""
11092 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11093         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11094         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11095 then
11096     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11097     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11099     if test -n "$supports_multilib"; then
11100         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11101     fi
11103     qt5_test_include="QtWidgets/qapplication.h"
11104     qt5_test_library="libQt5Widgets.so"
11106     dnl Check for qmake5
11107     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
11108     if test "$QMAKE5" = "no"; then
11109         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11110     else
11111         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11112         if test -z "$qmake5_test_ver"; then
11113             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11114         fi
11115         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11116         qt5_minimal_minor="6"
11117         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11118             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11119         else
11120             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11121         fi
11122     fi
11124     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11125     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11127     AC_MSG_CHECKING([for Qt5 headers])
11128     qt5_incdir="no"
11129     for inc_dir in $qt5_incdirs; do
11130         if test -r "$inc_dir/$qt5_test_include"; then
11131             qt5_incdir="$inc_dir"
11132             break
11133         fi
11134     done
11135     AC_MSG_RESULT([$qt5_incdir])
11136     if test "x$qt5_incdir" = "xno"; then
11137         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11138     fi
11140     AC_MSG_CHECKING([for Qt5 libraries])
11141     qt5_libdir="no"
11142     for lib_dir in $qt5_libdirs; do
11143         if test -r "$lib_dir/$qt5_test_library"; then
11144             qt5_libdir="$lib_dir"
11145             break
11146         fi
11147     done
11148     AC_MSG_RESULT([$qt5_libdir])
11149     if test "x$qt5_libdir" = "xno"; then
11150         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11151     fi
11153     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11154     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11155     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11157     dnl Check for Meta Object Compiler
11159     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
11160     if test "$MOC5" = "no"; then
11161         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11162 the root of your Qt installation by exporting QT5DIR before running "configure".])
11163     fi
11165     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11166     # Sets also QT5_GLIB_CFLAGS/QT5_GLIB_LIBS if successful.
11167     PKG_CHECK_MODULES(QT5_GLIB,[glib-2.0 >= 2.4],
11168         [
11169             QT5_HAVE_GLIB=1
11170             AC_DEFINE(QT5_HAVE_GLIB,1)
11171         ],
11172         AC_MSG_WARN([[No Glib found, Qt5 support will not use native file pickers!]])
11173     )
11175 AC_SUBST(QT5_CFLAGS)
11176 AC_SUBST(QT5_LIBS)
11177 AC_SUBST(MOC5)
11178 AC_SUBST(QT5_GLIB_CFLAGS)
11179 AC_SUBST(QT5_GLIB_LIBS)
11180 AC_SUBST(QT5_HAVE_GLIB)
11182 dnl ===================================================================
11183 dnl KDE5 Integration
11184 dnl ===================================================================
11186 KF5_CFLAGS=""
11187 KF5_LIBS=""
11188 KF5_CONFIG="kf5-config"
11189 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11190         \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11191         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11192 then
11193     if test "$OS" = "HAIKU"; then
11194         haiku_arch="`echo $RTL_ARCH | tr X x`"
11195         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11196         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11197     fi
11199     kf5_incdirs="$KF5INC /usr/include/ $kf5_haiku_incdirs $x_includes"
11200     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11201     if test -n "$supports_multilib"; then
11202         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11203     fi
11205     kf5_test_include="KF5/kcoreaddons_version.h"
11206     kf5_test_library="libKF5CoreAddons.so"
11207     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11209     dnl kf5 KDE4 support compatibility installed
11210     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11211     if test "$KF5_CONFIG" != "no"; then
11212         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11213         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11214     fi
11216     dnl Check for KF5 headers
11217     AC_MSG_CHECKING([for KF5 headers])
11218     kf5_incdir="no"
11219     for kf5_check in $kf5_incdirs; do
11220         if test -r "$kf5_check/$kf5_test_include"; then
11221             kf5_incdir="$kf5_check/KF5"
11222             break
11223         fi
11224     done
11225     AC_MSG_RESULT([$kf5_incdir])
11226     if test "x$kf5_incdir" = "xno"; then
11227         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11228     fi
11230     dnl Check for KF5 libraries
11231     AC_MSG_CHECKING([for KF5 libraries])
11232     kf5_libdir="no"
11233     for kf5_check in $kf5_libdirs; do
11234         if test -r "$kf5_check/$kf5_test_library"; then
11235             kf5_libdir="$kf5_check"
11236             break
11237         fi
11238     done
11240     AC_MSG_RESULT([$kf5_libdir])
11241     if test "x$kf5_libdir" = "xno"; then
11242         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11243     fi
11245     PKG_CHECK_MODULES(KF5_XCB,[xcb],,[AC_MSG_ERROR([XCB not installed])])
11247     KF5_CFLAGS="-I$kf5_incdir -I$kf5_incdir/KCoreAddons -I$kf5_incdir/KI18n -I$kf5_incdir/KConfigCore -I$kf5_incdir/KWindowSystem -I$kf5_incdir/KIOCore -I$kf5_incdir/KIOWidgets -I$kf5_incdir/KIOFileWidgets -I$qt5_incdir -I$qt5_incdir/QtCore -I$qt5_incdir/QtGui -I$qt5_incdir/QtWidgets -I$qt5_incdir/QtNetwork -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT $KF5_XCB_CFLAGS"
11248     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network $KF5_XCB_LIBS"
11249     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11251     AC_LANG_PUSH([C++])
11252     save_CXXFLAGS=$CXXFLAGS
11253     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11254     AC_MSG_CHECKING([whether KDE is >= 5.0])
11255        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11256 #include <kcoreaddons_version.h>
11258 int main(int argc, char **argv) {
11259        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11260        else return 1;
11262        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11263     CXXFLAGS=$save_CXXFLAGS
11264     AC_LANG_POP([C++])
11266 AC_SUBST(KF5_CFLAGS)
11267 AC_SUBST(KF5_LIBS)
11269 dnl ===================================================================
11270 dnl Test whether to include Evolution 2 support
11271 dnl ===================================================================
11272 AC_MSG_CHECKING([whether to enable evolution 2 support])
11273 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11274     AC_MSG_RESULT([yes])
11275     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11276     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11277     FilterLibs "${GOBJECT_LIBS}"
11278     GOBJECT_LIBS="${filteredlibs}"
11279     ENABLE_EVOAB2="TRUE"
11280 else
11281     ENABLE_EVOAB2=""
11282     AC_MSG_RESULT([no])
11284 AC_SUBST(ENABLE_EVOAB2)
11285 AC_SUBST(GOBJECT_CFLAGS)
11286 AC_SUBST(GOBJECT_LIBS)
11288 dnl ===================================================================
11289 dnl Test which themes to include
11290 dnl ===================================================================
11291 AC_MSG_CHECKING([which themes to include])
11292 # if none given use default subset of available themes
11293 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11294     with_theme="breeze breeze_dark colibre elementary karasa_jaga sifr sifr_dark tango"
11297 WITH_THEMES=""
11298 if test "x$with_theme" != "xno"; then
11299     for theme in $with_theme; do
11300         case $theme in
11301         breeze|breeze_dark|colibre|elementary|karasa_jaga|sifr|sifr_dark|tango) real_theme="$theme" ;;
11302         default) real_theme=colibre ;;
11303         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11304         esac
11305         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11306     done
11308 AC_MSG_RESULT([$WITH_THEMES])
11309 AC_SUBST([WITH_THEMES])
11310 # FIXME: remove this, and the convenience default->colibre remapping after a crace period
11311 for theme in $with_theme; do
11312     case $theme in
11313     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11314     *) ;;
11315     esac
11316 done
11318 dnl ===================================================================
11319 dnl Test whether to integrate helppacks into the product's installer
11320 dnl ===================================================================
11321 AC_MSG_CHECKING([for helppack integration])
11322 if test "$with_helppack_integration" = "no"; then
11323     AC_MSG_RESULT([no integration])
11324 else
11325     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11326     AC_MSG_RESULT([integration])
11329 ###############################################################################
11330 # Extensions checking
11331 ###############################################################################
11332 AC_MSG_CHECKING([for extensions integration])
11333 if test "x$enable_extension_integration" != "xno"; then
11334     WITH_EXTENSION_INTEGRATION=TRUE
11335     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11336     AC_MSG_RESULT([yes, use integration])
11337 else
11338     WITH_EXTENSION_INTEGRATION=
11339     AC_MSG_RESULT([no, do not integrate])
11341 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11343 dnl Should any extra extensions be included?
11344 dnl There are standalone tests for each of these below.
11345 WITH_EXTRA_EXTENSIONS=
11346 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11348 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11349 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11350 if test "x$with_java" != "xno"; then
11351     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11352     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11355 AC_MSG_CHECKING([whether to build opens___.ttf])
11356 if test "$enable_build_opensymbol" = "yes"; then
11357     AC_MSG_RESULT([yes])
11358     AC_PATH_PROG(FONTFORGE, fontforge)
11359     if test -z "$FONTFORGE"; then
11360         AC_MSG_ERROR([fontforge not installed])
11361     fi
11362 else
11363     AC_MSG_RESULT([no])
11364     OPENSYMBOL_TTF=49a64f3bcf20a7909ba2751349231d6652ded9cd2840e961b5164d09de3ffa63-opens___.ttf
11365     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11367 AC_SUBST(OPENSYMBOL_TTF)
11368 AC_SUBST(FONTFORGE)
11370 dnl ===================================================================
11371 dnl Test whether to include fonts
11372 dnl ===================================================================
11373 AC_MSG_CHECKING([whether to include third-party fonts])
11374 if test "$with_fonts" != "no"; then
11375     AC_MSG_RESULT([yes])
11376     WITH_FONTS=TRUE
11377     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11378     AC_DEFINE(HAVE_MORE_FONTS)
11379 else
11380     AC_MSG_RESULT([no])
11381     WITH_FONTS=
11382     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11384 AC_SUBST(WITH_FONTS)
11387 dnl ===================================================================
11388 dnl Test whether to enable online update service
11389 dnl ===================================================================
11390 AC_MSG_CHECKING([whether to enable online update])
11391 ENABLE_ONLINE_UPDATE=
11392 ENABLE_ONLINE_UPDATE_MAR=
11393 UPDATE_CONFIG=
11394 if test "$enable_online_update" = ""; then
11395     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11396         AC_MSG_RESULT([yes])
11397         ENABLE_ONLINE_UPDATE="TRUE"
11398     else
11399         AC_MSG_RESULT([no])
11400     fi
11401 else
11402     if test "$enable_online_update" = "mar"; then
11403         AC_MSG_RESULT([yes - MAR-based online update])
11404         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11405         if test "$with_update_config" = ""; then
11406             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11407         fi
11408         UPDATE_CONFIG="$with_update_config"
11409         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11410     elif test "$enable_online_update" = "yes"; then
11411         AC_MSG_RESULT([yes])
11412         ENABLE_ONLINE_UPDATE="TRUE"
11413     else
11414         AC_MSG_RESULT([no])
11415     fi
11417 AC_SUBST(ENABLE_ONLINE_UPDATE)
11418 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11419 AC_SUBST(UPDATE_CONFIG)
11421 dnl ===================================================================
11422 dnl Test whether we need bzip2
11423 dnl ===================================================================
11424 SYSTEM_BZIP2=
11425 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11426     AC_MSG_CHECKING([whether to use system bzip2])
11427     if test "$with_system_bzip2" = yes; then
11428         SYSTEM_BZIP2=TRUE
11429         AC_MSG_RESULT([yes])
11430         PKG_CHECK_MODULES(BZIP2, bzip2)
11431         FilterLibs "${BZIP2_LIBS}"
11432         BZIP2_LIBS="${filteredlibs}"
11433     else
11434         AC_MSG_RESULT([no])
11435         BUILD_TYPE="$BUILD_TYPE BZIP2"
11436     fi
11438 AC_SUBST(SYSTEM_BZIP2)
11439 AC_SUBST(BZIP2_CFLAGS)
11440 AC_SUBST(BZIP2_LIBS)
11442 dnl ===================================================================
11443 dnl Test whether to enable extension update
11444 dnl ===================================================================
11445 AC_MSG_CHECKING([whether to enable extension update])
11446 ENABLE_EXTENSION_UPDATE=
11447 if test "x$enable_extension_update" = "xno"; then
11448     AC_MSG_RESULT([no])
11449 else
11450     AC_MSG_RESULT([yes])
11451     ENABLE_EXTENSION_UPDATE="TRUE"
11452     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11453     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11455 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11458 dnl ===================================================================
11459 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11460 dnl ===================================================================
11461 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11462 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11463     AC_MSG_RESULT([no])
11464     ENABLE_SILENT_MSI=
11465 else
11466     AC_MSG_RESULT([yes])
11467     ENABLE_SILENT_MSI=TRUE
11468     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11470 AC_SUBST(ENABLE_SILENT_MSI)
11472 AC_MSG_CHECKING([whether and how to use Xinerama])
11473 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11474     if test "$x_libraries" = "default_x_libraries"; then
11475         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11476         if test "x$XINERAMALIB" = x; then
11477            XINERAMALIB="/usr/lib"
11478         fi
11479     else
11480         XINERAMALIB="$x_libraries"
11481     fi
11482     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11483         # we have both versions, let the user decide but use the dynamic one
11484         # per default
11485         USE_XINERAMA=TRUE
11486         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11487             XINERAMA_LINK=dynamic
11488         else
11489             XINERAMA_LINK=static
11490         fi
11491     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11492         # we have only the dynamic version
11493         USE_XINERAMA=TRUE
11494         XINERAMA_LINK=dynamic
11495     elif test -e "$XINERAMALIB/libXinerama.a"; then
11496         # static version
11497         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11498             USE_XINERAMA=TRUE
11499             XINERAMA_LINK=static
11500         else
11501             USE_XINERAMA=
11502             XINERAMA_LINK=none
11503         fi
11504     else
11505         # no Xinerama
11506         USE_XINERAMA=
11507         XINERAMA_LINK=none
11508     fi
11509     if test "$USE_XINERAMA" = "TRUE"; then
11510         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11511         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11512             [AC_MSG_ERROR(Xinerama header not found.)], [])
11513         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11514         if test "x$XEXTLIB" = x; then
11515            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11516         fi
11517         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11518         if test "$_os" = "FreeBSD"; then
11519             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11520         fi
11521         if test "$_os" = "Linux"; then
11522             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11523         fi
11524         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11525             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11526     else
11527         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11528     fi
11529 else
11530     USE_XINERAMA=
11531     XINERAMA_LINK=none
11532     AC_MSG_RESULT([no])
11534 AC_SUBST(USE_XINERAMA)
11535 AC_SUBST(XINERAMA_LINK)
11537 dnl ===================================================================
11538 dnl Test whether to build cairo or rely on the system version
11539 dnl ===================================================================
11541 if test "$USING_X11" = TRUE; then
11542     # Used in vcl/Library_vclplug_gen.mk
11543     test_cairo=yes
11546 if test "$test_cairo" = "yes"; then
11547     AC_MSG_CHECKING([whether to use the system cairo])
11549     : ${with_system_cairo:=$with_system_libs}
11550     if test "$with_system_cairo" = "yes"; then
11551         SYSTEM_CAIRO=TRUE
11552         AC_MSG_RESULT([yes])
11554         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11555         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11556         FilterLibs "${CAIRO_LIBS}"
11557         CAIRO_LIBS="${filteredlibs}"
11559         if test "$test_xrender" = "yes"; then
11560             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11561             AC_LANG_PUSH([C])
11562             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11563 #ifdef PictStandardA8
11564 #else
11565       return fail;
11566 #endif
11567 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11569             AC_LANG_POP([C])
11570         fi
11571     else
11572         SYSTEM_CAIRO=
11573         AC_MSG_RESULT([no])
11575         BUILD_TYPE="$BUILD_TYPE CAIRO"
11576     fi
11579 AC_SUBST(SYSTEM_CAIRO)
11580 AC_SUBST(CAIRO_CFLAGS)
11581 AC_SUBST(CAIRO_LIBS)
11583 dnl ===================================================================
11584 dnl Test whether to use avahi
11585 dnl ===================================================================
11586 if test "$_os" = "WINNT"; then
11587     # Windows uses bundled mDNSResponder
11588     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11589 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11590     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11591                       [ENABLE_AVAHI="TRUE"])
11592     AC_DEFINE(HAVE_FEATURE_AVAHI)
11593     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11594     FilterLibs "${AVAHI_LIBS}"
11595     AVAHI_LIBS="${filteredlibs}"
11598 AC_SUBST(ENABLE_AVAHI)
11599 AC_SUBST(AVAHI_CFLAGS)
11600 AC_SUBST(AVAHI_LIBS)
11602 dnl ===================================================================
11603 dnl Test whether to use liblangtag
11604 dnl ===================================================================
11605 SYSTEM_LIBLANGTAG=
11606 AC_MSG_CHECKING([whether to use system liblangtag])
11607 if test "$with_system_liblangtag" = yes; then
11608     SYSTEM_LIBLANGTAG=TRUE
11609     AC_MSG_RESULT([yes])
11610     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11611     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11612     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11613     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11614     FilterLibs "${LIBLANGTAG_LIBS}"
11615     LIBLANGTAG_LIBS="${filteredlibs}"
11616 else
11617     SYSTEM_LIBLANGTAG=
11618     AC_MSG_RESULT([no])
11619     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11620     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11621     if test "$COM" = "MSC"; then
11622         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11623     else
11624         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11625     fi
11627 AC_SUBST(SYSTEM_LIBLANGTAG)
11628 AC_SUBST(LIBLANGTAG_CFLAGS)
11629 AC_SUBST(LIBLANGTAG_LIBS)
11631 dnl ===================================================================
11632 dnl Test whether to build libpng or rely on the system version
11633 dnl ===================================================================
11635 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11637 dnl ===================================================================
11638 dnl Check for runtime JVM search path
11639 dnl ===================================================================
11640 if test "$ENABLE_JAVA" != ""; then
11641     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11642     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11643         AC_MSG_RESULT([yes])
11644         if ! test -d "$with_jvm_path"; then
11645             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11646         fi
11647         if ! test -d "$with_jvm_path"jvm; then
11648             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11649         fi
11650         JVM_ONE_PATH_CHECK="$with_jvm_path"
11651         AC_SUBST(JVM_ONE_PATH_CHECK)
11652     else
11653         AC_MSG_RESULT([no])
11654     fi
11657 dnl ===================================================================
11658 dnl Test for the presence of Ant and that it works
11659 dnl ===================================================================
11661 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
11662     ANT_HOME=; export ANT_HOME
11663     WITH_ANT_HOME=; export WITH_ANT_HOME
11664     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11665         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11666             if test "$_os" = "WINNT"; then
11667                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11668             else
11669                 with_ant_home="$LODE_HOME/opt/ant"
11670             fi
11671         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11672             with_ant_home="$LODE_HOME/opt/ant"
11673         fi
11674     fi
11675     if test -z "$with_ant_home"; then
11676         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11677     else
11678         if test "$_os" = "WINNT"; then
11679             # AC_PATH_PROGS needs unix path
11680             with_ant_home=`cygpath -u "$with_ant_home"`
11681         fi
11682         AbsolutePath "$with_ant_home"
11683         with_ant_home=$absolute_path
11684         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11685         WITH_ANT_HOME=$with_ant_home
11686         ANT_HOME=$with_ant_home
11687     fi
11689     if test -z "$ANT"; then
11690         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11691     else
11692         # resolve relative or absolute symlink
11693         while test -h "$ANT"; do
11694             a_cwd=`pwd`
11695             a_basename=`basename "$ANT"`
11696             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11697             cd "`dirname "$ANT"`"
11698             cd "`dirname "$a_script"`"
11699             ANT="`pwd`"/"`basename "$a_script"`"
11700             cd "$a_cwd"
11701         done
11703         AC_MSG_CHECKING([if $ANT works])
11704         mkdir -p conftest.dir
11705         a_cwd=$(pwd)
11706         cd conftest.dir
11707         cat > conftest.java << EOF
11708         public class conftest {
11709             int testmethod(int a, int b) {
11710                     return a + b;
11711             }
11712         }
11715         cat > conftest.xml << EOF
11716         <project name="conftest" default="conftest">
11717         <target name="conftest">
11718             <javac srcdir="." includes="conftest.java">
11719             </javac>
11720         </target>
11721         </project>
11724         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11725         if test $? = 0 -a -f ./conftest.class; then
11726             AC_MSG_RESULT([Ant works])
11727             if test -z "$WITH_ANT_HOME"; then
11728                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11729                 if test -z "$ANT_HOME"; then
11730                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11731                 fi
11732             else
11733                 ANT_HOME="$WITH_ANT_HOME"
11734             fi
11735         else
11736             echo "configure: Ant test failed" >&5
11737             cat conftest.java >&5
11738             cat conftest.xml >&5
11739             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11740         fi
11741         cd "$a_cwd"
11742         rm -fr conftest.dir
11743     fi
11744     if test -z "$ANT_HOME"; then
11745         ANT_HOME="NO_ANT_HOME"
11746     else
11747         PathFormat "$ANT_HOME"
11748         ANT_HOME="$formatted_path"
11749         PathFormat "$ANT"
11750         ANT="$formatted_path"
11751     fi
11752     AC_SUBST(ANT_HOME)
11753     AC_SUBST(ANT)
11755     dnl Checking for ant.jar
11756     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11757         AC_MSG_CHECKING([Ant lib directory])
11758         if test -f $ANT_HOME/lib/ant.jar; then
11759             ANT_LIB="$ANT_HOME/lib"
11760         else
11761             if test -f $ANT_HOME/ant.jar; then
11762                 ANT_LIB="$ANT_HOME"
11763             else
11764                 if test -f /usr/share/java/ant.jar; then
11765                     ANT_LIB=/usr/share/java
11766                 else
11767                     if test -f /usr/share/ant-core/lib/ant.jar; then
11768                         ANT_LIB=/usr/share/ant-core/lib
11769                     else
11770                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11771                             ANT_LIB="$ANT_HOME/lib/ant"
11772                         else
11773                             if test -f /usr/share/lib/ant/ant.jar; then
11774                                 ANT_LIB=/usr/share/lib/ant
11775                             else
11776                                 AC_MSG_ERROR([Ant libraries not found!])
11777                             fi
11778                         fi
11779                     fi
11780                 fi
11781             fi
11782         fi
11783         PathFormat "$ANT_LIB"
11784         ANT_LIB="$formatted_path"
11785         AC_MSG_RESULT([Ant lib directory found.])
11786     fi
11787     AC_SUBST(ANT_LIB)
11789     ant_minver=1.6.0
11790     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11792     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11793     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11794     ant_version_major=`echo $ant_version | cut -d. -f1`
11795     ant_version_minor=`echo $ant_version | cut -d. -f2`
11796     echo "configure: ant_version $ant_version " >&5
11797     echo "configure: ant_version_major $ant_version_major " >&5
11798     echo "configure: ant_version_minor $ant_version_minor " >&5
11799     if test "$ant_version_major" -ge "2"; then
11800         AC_MSG_RESULT([yes, $ant_version])
11801     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11802         AC_MSG_RESULT([yes, $ant_version])
11803     else
11804         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11805     fi
11807     rm -f conftest* core core.* *.core
11810 OOO_JUNIT_JAR=
11811 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11812     AC_MSG_CHECKING([for JUnit 4])
11813     if test "$with_junit" = "yes"; then
11814         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
11815             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
11816         elif test -e /usr/share/java/junit4.jar; then
11817             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11818         else
11819            if test -e /usr/share/lib/java/junit.jar; then
11820               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11821            else
11822               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11823            fi
11824         fi
11825     else
11826         OOO_JUNIT_JAR=$with_junit
11827     fi
11828     if test "$_os" = "WINNT"; then
11829         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11830     fi
11831     printf 'import org.junit.Before;' > conftest.java
11832     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11833         AC_MSG_RESULT([$OOO_JUNIT_JAR])
11834     else
11835         AC_MSG_ERROR(
11836 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
11837  specify its pathname via --with-junit=..., or disable it via --without-junit])
11838     fi
11839     rm -f conftest.class conftest.java
11840     if test $OOO_JUNIT_JAR != ""; then
11841     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11842     fi
11844 AC_SUBST(OOO_JUNIT_JAR)
11846 HAMCREST_JAR=
11847 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11848     AC_MSG_CHECKING([for included Hamcrest])
11849     printf 'import org.hamcrest.BaseDescription;' > conftest.java
11850     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11851         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
11852     else
11853         AC_MSG_RESULT([Not included])
11854         AC_MSG_CHECKING([for standalone hamcrest jar.])
11855         if test "$with_hamcrest" = "yes"; then
11856             if test -e /usr/share/lib/java/hamcrest.jar; then
11857                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
11858             elif test -e /usr/share/java/hamcrest/core.jar; then
11859                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
11860             else
11861                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
11862             fi
11863         else
11864             HAMCREST_JAR=$with_hamcrest
11865         fi
11866         if test "$_os" = "WINNT"; then
11867             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
11868         fi
11869         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
11870             AC_MSG_RESULT([$HAMCREST_JAR])
11871         else
11872             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),
11873                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
11874         fi
11875     fi
11876     rm -f conftest.class conftest.java
11878 AC_SUBST(HAMCREST_JAR)
11881 AC_SUBST(SCPDEFS)
11884 # check for wget and curl
11886 WGET=
11887 CURL=
11889 if test "$enable_fetch_external" != "no"; then
11891 CURL=`which curl 2>/dev/null`
11893 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
11894     # wget new enough?
11895     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
11896     if test $? -eq 0; then
11897         WGET=$i
11898         break
11899     fi
11900 done
11902 if test -z "$WGET" -a -z "$CURL"; then
11903     AC_MSG_ERROR([neither wget nor curl found!])
11908 AC_SUBST(WGET)
11909 AC_SUBST(CURL)
11912 # check for sha256sum
11914 SHA256SUM=
11916 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
11917     eval "$i -a 256 --version" > /dev/null 2>&1
11918     ret=$?
11919     if test $ret -eq 0; then
11920         SHA256SUM="$i -a 256"
11921         break
11922     fi
11923 done
11925 if test -z "$SHA256SUM"; then
11926     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
11927         eval "$i --version" > /dev/null 2>&1
11928         ret=$?
11929         if test $ret -eq 0; then
11930             SHA256SUM=$i
11931             break
11932         fi
11933     done
11936 if test -z "$SHA256SUM"; then
11937     AC_MSG_ERROR([no sha256sum found!])
11940 AC_SUBST(SHA256SUM)
11942 dnl ===================================================================
11943 dnl Dealing with l10n options
11944 dnl ===================================================================
11945 AC_MSG_CHECKING([which languages to be built])
11946 # get list of all languages
11947 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
11948 # the sed command does the following:
11949 #   + if a line ends with a backslash, append the next line to it
11950 #   + adds " on the beginning of the value (after =)
11951 #   + adds " at the end of the value
11952 #   + removes en-US; we want to put it on the beginning
11953 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
11954 [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)]
11955 ALL_LANGS="en-US $completelangiso"
11956 # check the configured localizations
11957 WITH_LANG="$with_lang"
11959 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
11960 # (Norwegian is "nb" and "nn".)
11961 if test "$WITH_LANG" = "no"; then
11962     WITH_LANG=
11965 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
11966     AC_MSG_RESULT([en-US])
11967 else
11968     AC_MSG_RESULT([$WITH_LANG])
11969     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
11970     if test -z "$MSGFMT"; then
11971         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
11972             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
11973         elif test -x "/opt/lo/bin/msgfmt"; then
11974             MSGFMT="/opt/lo/bin/msgfmt"
11975         else
11976             AC_CHECK_PROGS(MSGFMT, [msgfmt])
11977             if test -z "$MSGFMT"; then
11978                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
11979             fi
11980         fi
11981     fi
11982     if test -z "$MSGUNIQ"; then
11983         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
11984             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
11985         elif test -x "/opt/lo/bin/msguniq"; then
11986             MSGUNIQ="/opt/lo/bin/msguniq"
11987         else
11988             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
11989             if test -z "$MSGUNIQ"; then
11990                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
11991             fi
11992         fi
11993     fi
11995 AC_SUBST(MSGFMT)
11996 AC_SUBST(MSGUNIQ)
11997 # check that the list is valid
11998 for lang in $WITH_LANG; do
11999     test "$lang" = "ALL" && continue
12000     # need to check for the exact string, so add space before and after the list of all languages
12001     for vl in $ALL_LANGS; do
12002         if test "$vl" = "$lang"; then
12003            break
12004         fi
12005     done
12006     if test "$vl" != "$lang"; then
12007         # if you're reading this - you prolly quoted your languages remove the quotes ...
12008         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12009     fi
12010 done
12011 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12012     echo $WITH_LANG | grep -q en-US
12013     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12015 # list with substituted ALL
12016 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12017 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12018 test "$WITH_LANG" = "en-US" && WITH_LANG=
12019 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12020     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12021     ALL_LANGS=`echo $ALL_LANGS qtz`
12023 AC_SUBST(ALL_LANGS)
12024 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12025 AC_SUBST(WITH_LANG)
12026 AC_SUBST(WITH_LANG_LIST)
12027 AC_SUBST(GIT_NEEDED_SUBMODULES)
12029 WITH_POOR_HELP_LOCALIZATIONS=
12030 if test -d "$SRC_ROOT/translations/source"; then
12031     for l in `ls -1 $SRC_ROOT/translations/source`; do
12032         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12033             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12034         fi
12035     done
12037 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12039 if test -n "$with_locales"; then
12040     WITH_LOCALES="$with_locales"
12042     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12043     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12044     # config_host/config_locales.h.in
12045     for locale in $WITH_LOCALES; do
12046         lang=${locale%_*}
12048         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12050         case $lang in
12051         hi|mr*ne)
12052             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12053             ;;
12054         bg|ru)
12055             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12056             ;;
12057         esac
12058     done
12059 else
12060     AC_DEFINE(WITH_LOCALE_ALL)
12062 AC_SUBST(WITH_LOCALES)
12064 dnl git submodule update --reference
12065 dnl ===================================================================
12066 if test -n "${GIT_REFERENCE_SRC}"; then
12067     for repo in ${GIT_NEEDED_SUBMODULES}; do
12068         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12069             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12070         fi
12071     done
12073 AC_SUBST(GIT_REFERENCE_SRC)
12075 dnl git submodules linked dirs
12076 dnl ===================================================================
12077 if test -n "${GIT_LINK_SRC}"; then
12078     for repo in ${GIT_NEEDED_SUBMODULES}; do
12079         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12080             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12081         fi
12082     done
12084 AC_SUBST(GIT_LINK_SRC)
12086 dnl branding
12087 dnl ===================================================================
12088 AC_MSG_CHECKING([for alternative branding images directory])
12089 # initialize mapped arrays
12090 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12091 brand_files="$BRAND_INTRO_IMAGES about.svg"
12093 if test -z "$with_branding" -o "$with_branding" = "no"; then
12094     AC_MSG_RESULT([none])
12095     DEFAULT_BRAND_IMAGES="$brand_files"
12096 else
12097     if ! test -d $with_branding ; then
12098         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12099     else
12100         AC_MSG_RESULT([$with_branding])
12101         CUSTOM_BRAND_DIR="$with_branding"
12102         for lfile in $brand_files
12103         do
12104             if ! test -f $with_branding/$lfile ; then
12105                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12106                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12107             else
12108                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12109             fi
12110         done
12111         check_for_progress="yes"
12112     fi
12114 AC_SUBST([BRAND_INTRO_IMAGES])
12115 AC_SUBST([CUSTOM_BRAND_DIR])
12116 AC_SUBST([CUSTOM_BRAND_IMAGES])
12117 AC_SUBST([DEFAULT_BRAND_IMAGES])
12120 AC_MSG_CHECKING([for 'intro' progress settings])
12121 PROGRESSBARCOLOR=
12122 PROGRESSSIZE=
12123 PROGRESSPOSITION=
12124 PROGRESSFRAMECOLOR=
12125 PROGRESSTEXTCOLOR=
12126 PROGRESSTEXTBASELINE=
12128 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12129     source "$with_branding/progress.conf"
12130     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12131 else
12132     AC_MSG_RESULT([none])
12135 AC_SUBST(PROGRESSBARCOLOR)
12136 AC_SUBST(PROGRESSSIZE)
12137 AC_SUBST(PROGRESSPOSITION)
12138 AC_SUBST(PROGRESSFRAMECOLOR)
12139 AC_SUBST(PROGRESSTEXTCOLOR)
12140 AC_SUBST(PROGRESSTEXTBASELINE)
12143 AC_MSG_CHECKING([for extra build ID])
12144 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12145     EXTRA_BUILDID="$with_extra_buildid"
12147 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12148 if test -n "$EXTRA_BUILDID" ; then
12149     AC_MSG_RESULT([$EXTRA_BUILDID])
12150 else
12151     AC_MSG_RESULT([not set])
12153 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12155 OOO_VENDOR=
12156 AC_MSG_CHECKING([for vendor])
12157 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12158     OOO_VENDOR="$USERNAME"
12160     if test -z "$OOO_VENDOR"; then
12161         OOO_VENDOR="$USER"
12162     fi
12164     if test -z "$OOO_VENDOR"; then
12165         OOO_VENDOR="`id -u -n`"
12166     fi
12168     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12169 else
12170     OOO_VENDOR="$with_vendor"
12171     AC_MSG_RESULT([$OOO_VENDOR])
12173 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12174 AC_SUBST(OOO_VENDOR)
12176 if test "$_os" = "Android" ; then
12177     ANDROID_PACKAGE_NAME=
12178     AC_MSG_CHECKING([for Android package name])
12179     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12180         if test -n "$ENABLE_DEBUG"; then
12181             # Default to the package name that makes ndk-gdb happy.
12182             ANDROID_PACKAGE_NAME="org.libreoffice"
12183         else
12184             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12185         fi
12187         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12188     else
12189         ANDROID_PACKAGE_NAME="$with_android_package_name"
12190         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12191     fi
12192     AC_SUBST(ANDROID_PACKAGE_NAME)
12195 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12196 if test "$with_compat_oowrappers" = "yes"; then
12197     WITH_COMPAT_OOWRAPPERS=TRUE
12198     AC_MSG_RESULT(yes)
12199 else
12200     WITH_COMPAT_OOWRAPPERS=
12201     AC_MSG_RESULT(no)
12203 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12205 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12206 AC_MSG_CHECKING([for install dirname])
12207 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12208     INSTALLDIRNAME="$with_install_dirname"
12210 AC_MSG_RESULT([$INSTALLDIRNAME])
12211 AC_SUBST(INSTALLDIRNAME)
12213 AC_MSG_CHECKING([for prefix])
12214 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12215 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12216 PREFIXDIR="$prefix"
12217 AC_MSG_RESULT([$PREFIXDIR])
12218 AC_SUBST(PREFIXDIR)
12220 LIBDIR=[$(eval echo $(eval echo $libdir))]
12221 AC_SUBST(LIBDIR)
12223 DATADIR=[$(eval echo $(eval echo $datadir))]
12224 AC_SUBST(DATADIR)
12226 MANDIR=[$(eval echo $(eval echo $mandir))]
12227 AC_SUBST(MANDIR)
12229 DOCDIR=[$(eval echo $(eval echo $docdir))]
12230 AC_SUBST(DOCDIR)
12232 BINDIR=[$(eval echo $(eval echo $bindir))]
12233 AC_SUBST(BINDIR)
12235 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12236 AC_SUBST(INSTALLDIR)
12238 TESTINSTALLDIR="${BUILDDIR}/test-install"
12239 AC_SUBST(TESTINSTALLDIR)
12242 # ===================================================================
12243 # OAuth2 id and secrets
12244 # ===================================================================
12246 AC_MSG_CHECKING([for Google Drive client id and secret])
12247 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12248     AC_MSG_RESULT([not set])
12249     GDRIVE_CLIENT_ID="\"\""
12250     GDRIVE_CLIENT_SECRET="\"\""
12251 else
12252     AC_MSG_RESULT([set])
12253     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12254     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12256 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12257 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12259 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12260 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12261     AC_MSG_RESULT([not set])
12262     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12263     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12264 else
12265     AC_MSG_RESULT([set])
12266     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12267     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12269 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12270 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12272 AC_MSG_CHECKING([for OneDrive client id and secret])
12273 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12274     AC_MSG_RESULT([not set])
12275     ONEDRIVE_CLIENT_ID="\"\""
12276     ONEDRIVE_CLIENT_SECRET="\"\""
12277 else
12278     AC_MSG_RESULT([set])
12279     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12280     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12282 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12283 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12286 dnl ===================================================================
12287 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12288 dnl --enable-dependency-tracking configure option
12289 dnl ===================================================================
12290 AC_MSG_CHECKING([whether to enable dependency tracking])
12291 if test "$enable_dependency_tracking" = "no"; then
12292     nodep=TRUE
12293     AC_MSG_RESULT([no])
12294 else
12295     AC_MSG_RESULT([yes])
12297 AC_SUBST(nodep)
12299 dnl ===================================================================
12300 dnl Number of CPUs to use during the build
12301 dnl ===================================================================
12302 AC_MSG_CHECKING([for number of processors to use])
12303 # plain --with-parallelism is just the default
12304 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12305     if test "$with_parallelism" = "no"; then
12306         PARALLELISM=0
12307     else
12308         PARALLELISM=$with_parallelism
12309     fi
12310 else
12311     if test "$enable_icecream" = "yes"; then
12312         PARALLELISM="10"
12313     else
12314         case `uname -s` in
12316         Darwin|FreeBSD|NetBSD|OpenBSD)
12317             PARALLELISM=`sysctl -n hw.ncpu`
12318             ;;
12320         Linux)
12321             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12322         ;;
12323         # what else than above does profit here *and* has /proc?
12324         *)
12325             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12326             ;;
12327         esac
12329         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12330         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12331     fi
12334 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12335     if test -z "$with_parallelism"; then
12336             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12337             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12338             PARALLELISM="1"
12339     else
12340         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."
12341     fi
12344 if test $PARALLELISM -eq 0; then
12345     AC_MSG_RESULT([explicit make -j option needed])
12346 else
12347     AC_MSG_RESULT([$PARALLELISM])
12349 AC_SUBST(PARALLELISM)
12351 IWYU_PATH="$with_iwyu"
12352 AC_SUBST(IWYU_PATH)
12353 if test ! -z "$IWYU_PATH"; then
12354     if test ! -f "$IWYU_PATH"; then
12355         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12356     fi
12360 # Set up ILIB for MSVC build
12362 ILIB1=
12363 if test "$build_os" = "cygwin"; then
12364     ILIB="."
12365     if test -n "$JAVA_HOME"; then
12366         ILIB="$ILIB;$JAVA_HOME/lib"
12367     fi
12368     ILIB1=-link
12369     if test "$BITNESS_OVERRIDE" = 64; then
12370         ILIB="$ILIB;$COMPATH/lib/x64"
12371         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12372         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12373         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12374         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12375             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12376             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12377         fi
12378         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12379         ucrtlibpath_formatted=$formatted_path
12380         ILIB="$ILIB;$ucrtlibpath_formatted"
12381         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12382     else
12383         ILIB="$ILIB;$COMPATH/lib/x86"
12384         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12385         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12386         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12387         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12388             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12389             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12390         fi
12391         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12392         ucrtlibpath_formatted=$formatted_path
12393         ILIB="$ILIB;$ucrtlibpath_formatted"
12394         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12395     fi
12396     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12397         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12398     else
12399         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12400     fi
12402     AC_SUBST(ILIB)
12405 dnl We should be able to drop the below check when bumping the GCC baseline to
12406 dnl 4.9, as <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54577>
12407 dnl "deque<T>::erase() still takes iterator instead of const_iterator" should be
12408 dnl fixed there with <https://gcc.gnu.org/git/?p=gcc.git;a=commit;
12409 dnl h=6b0e18ca48bb4b4c01e7b5be2b98849943fdcf91>:
12410 AC_MSG_CHECKING(
12411     [whether C++11 use of const_iterator in standard containers is broken])
12412 save_CXXFLAGS=$CXXFLAGS
12413 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12414 AC_LANG_PUSH([C++])
12415 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12416     #include <list>
12417     ]],[[
12418         std::list<int> l;
12419         l.erase(l.cbegin());
12420     ]])],
12421     [broken=no], [broken=yes])
12422 AC_LANG_POP([C++])
12423 CXXFLAGS=$save_CXXFLAGS
12424 AC_MSG_RESULT([$broken])
12425 if test "$broken" = yes; then
12426     AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
12430 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12431 save_CXXFLAGS=$CXXFLAGS
12432 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12433 save_LIBS=$LIBS
12434 if test -n "$ILIB1"; then
12435     LIBS="$LIBS $ILIB1"
12437 AC_LANG_PUSH([C++])
12438 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12439     // Exit with failure if the static initializer_list is stored on the
12440     // stack (as done by Clang < 3.4):
12441     #include <initializer_list>
12442     struct S {};
12443     bool g(void const * p1, void const * p2) {
12444         int n;
12445         return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12446     }
12447     bool f(void const * p1) {
12448         static std::initializer_list<S> s { S() };
12449         return g(p1, s.begin());
12450     }
12451     ]],[[
12452         int n;
12453         return f(&n) ? 0 : 1;
12454     ]])], [broken=no], [broken=yes],[broken='assuming not (cross-compiling)'])
12455 AC_LANG_POP([C++])
12456 LIBS=$save_LIBS
12457 CXXFLAGS=$save_CXXFLAGS
12458 AC_MSG_RESULT([$broken])
12459 if test "$broken" = yes -a "$_os" != "iOS"; then
12460     AC_MSG_ERROR([working support for static initializer_list needed])
12464 # ===================================================================
12465 # Creating bigger shared library to link against
12466 # ===================================================================
12467 AC_MSG_CHECKING([whether to create huge library])
12468 MERGELIBS=
12470 if test $_os = iOS -o $_os = Android; then
12471     # Never any point in mergelibs for these as we build just static
12472     # libraries anyway...
12473     enable_mergelibs=no
12476 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12477     if test $_os != Linux -a $_os != WINNT; then
12478         add_warning "--enable-mergelibs is not tested for this platform"
12479     fi
12480     MERGELIBS="TRUE"
12481     AC_MSG_RESULT([yes])
12482 else
12483     AC_MSG_RESULT([no])
12485 AC_SUBST([MERGELIBS])
12487 dnl ===================================================================
12488 dnl icerun is a wrapper that stops us spawning tens of processes
12489 dnl locally - for tools that can't be executed on the compile cluster
12490 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12491 dnl ===================================================================
12492 AC_MSG_CHECKING([whether to use icerun wrapper])
12493 ICECREAM_RUN=
12494 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12495     ICECREAM_RUN=icerun
12496     AC_MSG_RESULT([yes])
12497 else
12498     AC_MSG_RESULT([no])
12500 AC_SUBST(ICECREAM_RUN)
12502 dnl ===================================================================
12503 dnl Setup the ICECC_VERSION for the build the same way it was set for
12504 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12505 dnl ===================================================================
12506 x_ICECC_VERSION=[\#]
12507 if test -n "$ICECC_VERSION" ; then
12508     x_ICECC_VERSION=
12510 AC_SUBST(x_ICECC_VERSION)
12511 AC_SUBST(ICECC_VERSION)
12513 dnl ===================================================================
12515 AC_MSG_CHECKING([MPL subset])
12516 MPL_SUBSET=
12518 if test "$enable_mpl_subset" = "yes"; then
12519     warn_report=false
12520     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12521         warn_report=true
12522     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12523         warn_report=true
12524     fi
12525     if test "$warn_report" = "true"; then
12526         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12527     fi
12528     if test "x$enable_postgresql_sdbc" != "xno"; then
12529         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12530     fi
12531     if test "$enable_lotuswordpro" = "yes"; then
12532         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12533     fi
12534     if test "$WITH_WEBDAV" = "neon"; then
12535         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12536     fi
12537     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12538         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12539     fi
12540     if test -n "$ENABLE_PDFIMPORT"; then
12541         if test "x$SYSTEM_POPPLER" = "x"; then
12542             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12543         fi
12544     fi
12545     # cf. m4/libo_check_extension.m4
12546     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12547         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12548     fi
12549     for theme in $WITH_THEMES; do
12550         case $theme in
12551         breeze|breeze_dark|sifr|sifr_dark|elementary|karasa_jaga) #blacklist of icon themes under GPL or LGPL
12552             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12553         *) : ;;
12554         esac
12555     done
12557     ENABLE_OPENGL_TRANSITIONS=
12559     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12560         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12561     fi
12563     MPL_SUBSET="TRUE"
12564     AC_DEFINE(MPL_HAVE_SUBSET)
12565     AC_MSG_RESULT([only])
12566 else
12567     AC_MSG_RESULT([no restrictions])
12569 AC_SUBST(MPL_SUBSET)
12571 dnl ===================================================================
12573 AC_MSG_CHECKING([formula logger])
12574 ENABLE_FORMULA_LOGGER=
12576 if test "x$enable_formula_logger" = "xyes"; then
12577     AC_MSG_RESULT([yes])
12578     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12579     ENABLE_FORMULA_LOGGER=TRUE
12580 elif test -n "$ENABLE_DBGUTIL" ; then
12581     AC_MSG_RESULT([yes])
12582     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12583     ENABLE_FORMULA_LOGGER=TRUE
12584 else
12585     AC_MSG_RESULT([no])
12588 AC_SUBST(ENABLE_FORMULA_LOGGER)
12590 dnl ===================================================================
12591 dnl Setting up the environment.
12592 dnl ===================================================================
12593 AC_MSG_NOTICE([setting up the build environment variables...])
12595 AC_SUBST(COMPATH)
12597 if test "$build_os" = "cygwin"; then
12598     if test -d "$COMPATH/atlmfc/lib"; then
12599         ATL_LIB="$COMPATH/atlmfc/lib"
12600         ATL_INCLUDE="$COMPATH/atlmfc/include"
12601     else
12602         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12603         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12604     fi
12605     if test "$BITNESS_OVERRIDE" = 64; then
12606         if test $VCVER = "150"; then
12607             ATL_LIB="$ATL_LIB/x64"
12608         else
12609             ATL_LIB="$ATL_LIB/amd64"
12610         fi
12611     else
12612         if test $VCVER = "150"; then
12613             ATL_LIB="$ATL_LIB/x86"
12614         fi
12615     fi
12616     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12617     PathFormat "/usr/bin/find.exe"
12618     FIND="$formatted_path"
12619     PathFormat "/usr/bin/sort.exe"
12620     SORT="$formatted_path"
12621     PathFormat "/usr/bin/grep.exe"
12622     WIN_GREP="$formatted_path"
12623     PathFormat "/usr/bin/ls.exe"
12624     WIN_LS="$formatted_path"
12625     PathFormat "/usr/bin/touch.exe"
12626     WIN_TOUCH="$formatted_path"
12627 else
12628     FIND=find
12629     SORT=sort
12632 AC_SUBST(ATL_INCLUDE)
12633 AC_SUBST(ATL_LIB)
12634 AC_SUBST(FIND)
12635 AC_SUBST(SORT)
12636 AC_SUBST(WIN_GREP)
12637 AC_SUBST(WIN_LS)
12638 AC_SUBST(WIN_TOUCH)
12640 AC_SUBST(BUILD_TYPE)
12642 AC_SUBST(SOLARINC)
12644 PathFormat "$PERL"
12645 PERL="$formatted_path"
12646 AC_SUBST(PERL)
12648 if test -n "$TMPDIR"; then
12649     TEMP_DIRECTORY="$TMPDIR"
12650 else
12651     TEMP_DIRECTORY="/tmp"
12653 if test "$build_os" = "cygwin"; then
12654     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12656 AC_SUBST(TEMP_DIRECTORY)
12658 # setup the PATH for the environment
12659 if test -n "$LO_PATH_FOR_BUILD"; then
12660     LO_PATH="$LO_PATH_FOR_BUILD"
12661 else
12662     LO_PATH="$PATH"
12664     case "$host_os" in
12666     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12667         if test "$ENABLE_JAVA" != ""; then
12668             pathmunge "$JAVA_HOME/bin" "after"
12669         fi
12670         ;;
12672     cygwin*)
12673         # Win32 make needs native paths
12674         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12675             LO_PATH=`cygpath -p -m "$PATH"`
12676         fi
12677         if test "$BITNESS_OVERRIDE" = 64; then
12678             # needed for msi packaging
12679             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12680         fi
12681         # .NET 4.6 and higher don't have bin directory
12682         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12683             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12684         fi
12685         pathmunge "$ASM_HOME" "before"
12686         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12687         pathmunge "$CSC_PATH" "before"
12688         pathmunge "$MIDL_PATH" "before"
12689         pathmunge "$AL_PATH" "before"
12690         pathmunge "$MSPDB_PATH" "before"
12691         if test -n "$MSBUILD_PATH" ; then
12692             pathmunge "$MSBUILD_PATH" "before"
12693         fi
12694         if test "$BITNESS_OVERRIDE" = 64; then
12695             pathmunge "$COMPATH/bin/amd64" "before"
12696             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12697         else
12698             pathmunge "$COMPATH/bin" "before"
12699             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12700         fi
12701         if test "$ENABLE_JAVA" != ""; then
12702             if test -d "$JAVA_HOME/jre/bin/client"; then
12703                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12704             fi
12705             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12706                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12707             fi
12708             pathmunge "$JAVA_HOME/bin" "before"
12709         fi
12710         ;;
12712     solaris*)
12713         pathmunge "/usr/css/bin" "before"
12714         if test "$ENABLE_JAVA" != ""; then
12715             pathmunge "$JAVA_HOME/bin" "after"
12716         fi
12717         ;;
12718     esac
12721 AC_SUBST(LO_PATH)
12723 libo_FUZZ_SUMMARY
12725 # Generate a configuration sha256 we can use for deps
12726 if test -f config_host.mk; then
12727     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12729 if test -f config_host_lang.mk; then
12730     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12733 CFLAGS=$my_original_CFLAGS
12734 CXXFLAGS=$my_original_CXXFLAGS
12735 CPPFLAGS=$my_original_CPPFLAGS
12737 AC_CONFIG_FILES([config_host.mk
12738                  config_host_lang.mk
12739                  Makefile
12740                  lo.xcent
12741                  bin/bffvalidator.sh
12742                  bin/odfvalidator.sh
12743                  bin/officeotron.sh
12744                  instsetoo_native/util/openoffice.lst
12745                  sysui/desktop/macosx/Info.plist])
12746 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12747 AC_CONFIG_HEADERS([config_host/config_clang.h])
12748 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12749 AC_CONFIG_HEADERS([config_host/config_eot.h])
12750 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12751 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12752 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12753 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12754 AC_CONFIG_HEADERS([config_host/config_features.h])
12755 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12756 AC_CONFIG_HEADERS([config_host/config_folders.h])
12757 AC_CONFIG_HEADERS([config_host/config_gio.h])
12758 AC_CONFIG_HEADERS([config_host/config_global.h])
12759 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12760 AC_CONFIG_HEADERS([config_host/config_java.h])
12761 AC_CONFIG_HEADERS([config_host/config_langs.h])
12762 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12763 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12764 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12765 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
12766 AC_CONFIG_HEADERS([config_host/config_locales.h])
12767 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12768 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12769 AC_CONFIG_HEADERS([config_host/config_qt5.h])
12770 AC_CONFIG_HEADERS([config_host/config_kde5.h])
12771 AC_CONFIG_HEADERS([config_host/config_gtk3_kde5.h])
12772 AC_CONFIG_HEADERS([config_host/config_oox.h])
12773 AC_CONFIG_HEADERS([config_host/config_options.h])
12774 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12775 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12776 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12777 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12778 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12779 AC_CONFIG_HEADERS([config_host/config_version.h])
12780 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12781 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12782 AC_CONFIG_HEADERS([config_host/config_python.h])
12783 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12784 AC_OUTPUT
12786 if test "$CROSS_COMPILING" = TRUE; then
12787     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12790 # touch the config timestamp file
12791 if test ! -f config_host.mk.stamp; then
12792     echo > config_host.mk.stamp
12793 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12794     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12795 else
12796     echo > config_host.mk.stamp
12799 # touch the config lang timestamp file
12800 if test ! -f config_host_lang.mk.stamp; then
12801     echo > config_host_lang.mk.stamp
12802 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12803     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12804 else
12805     echo > config_host_lang.mk.stamp
12809 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12811 cat << _EOS
12812 ****************************************************************************
12813 WARNING:
12814 Your make version is known to be horribly slow, and hard to debug
12815 problems with. To get a reasonably functional make please do:
12817 to install a pre-compiled binary make for Win32
12819  mkdir -p /opt/lo/bin
12820  cd /opt/lo/bin
12821  wget https://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
12822  cp make-85047eb-msvc.exe make
12823  chmod +x make
12825 to install from source:
12826 place yourself in a working directory of you choice.
12828  git clone git://git.savannah.gnu.org/make.git
12830  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
12831  set PATH=%PATH%;C:\Cygwin\bin
12832  [or Cygwin64, if that is what you have]
12833  cd path-to-make-repo-you-cloned-above
12834  build_w32.bat --without-guile
12836 should result in a WinRel/gnumake.exe.
12837 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12839 Then re-run autogen.sh
12841 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12842 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12844 _EOS
12847 cat << _EOF
12848 ****************************************************************************
12850 To build, run:
12851 $GNUMAKE
12853 To view some help, run:
12854 $GNUMAKE help
12856 _EOF
12858 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12859     cat << _EOF
12860 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12861 _EOF
12863     if test $_os = Darwin; then
12864         echo open instdir/$PRODUCTNAME.app
12865     else
12866         echo instdir/program/soffice
12867     fi
12868     cat << _EOF
12870 If you want to run the smoketest, run:
12871 $GNUMAKE check
12873 _EOF
12876 if test -f warn; then
12877     cat warn
12878     rm warn
12881 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: