Bump version to 6.0-14
[LibreOffice.git] / configure.ac
blobf34da48630f0938a22d02feaa27e8e5c55287703
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([Collabora Office],[6.0.10.14],[],[],[https://collaboraoffice.com/])
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"
168     PRODUCTNAME=AC_PACKAGE_NAME
170 AC_MSG_RESULT([$PRODUCTNAME])
171 AC_SUBST(PRODUCTNAME)
172 PRODUCTNAME_WITHOUT_SPACES=$(echo "$PRODUCTNAME" | sed 's/ //g')
173 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
175 dnl ===================================================================
176 dnl Our version is defined by the AC_INIT() at the top of this script.
177 dnl ===================================================================
179 AC_MSG_CHECKING([for package version])
180 if test -n "$with_package_version" -a "$with_package_version" != no; then
181     PACKAGE_VERSION="$with_package_version"
183 AC_MSG_RESULT([$PACKAGE_VERSION])
185 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
187 LIBO_VERSION_MAJOR=$1
188 LIBO_VERSION_MINOR=$2
189 LIBO_VERSION_MICRO=$3
190 LIBO_VERSION_PATCH=$4
192 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
193 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
194 # no way to encode that into an integer in general.
195 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
197 LIBO_VERSION_SUFFIX=$5
198 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
199 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
200 # they get undoubled before actually passed to sed.
201 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
202 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
203 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
204 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
206 AC_SUBST(LIBO_VERSION_MAJOR)
207 AC_SUBST(LIBO_VERSION_MINOR)
208 AC_SUBST(LIBO_VERSION_MICRO)
209 AC_SUBST(LIBO_VERSION_PATCH)
210 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
211 AC_SUBST(LIBO_VERSION_SUFFIX)
212 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
214 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
215 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
216 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
217 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
219 LIBO_THIS_YEAR=`date +%Y`
220 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
222 dnl ===================================================================
223 dnl Product version
224 dnl ===================================================================
225 AC_MSG_CHECKING([for product version])
226 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
227 AC_MSG_RESULT([$PRODUCTVERSION])
228 AC_SUBST(PRODUCTVERSION)
230 AC_PROG_EGREP
231 # AC_PROG_EGREP doesn't set GREP on all systems as well
232 AC_PATH_PROG(GREP, grep)
234 BUILDDIR=`pwd`
235 cd $srcdir
236 SRC_ROOT=`pwd`
237 cd $BUILDDIR
238 x_Cygwin=[\#]
240 dnl ======================================
241 dnl Required GObject introspection version
242 dnl ======================================
243 INTROSPECTION_REQUIRED_VERSION=1.32.0
245 dnl ===================================================================
246 dnl Search all the common names for GNU Make
247 dnl ===================================================================
248 AC_MSG_CHECKING([for GNU Make])
250 # try to use our own make if it is available and GNUMAKE was not already defined
251 if test -z "$GNUMAKE"; then
252     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
253         GNUMAKE="$LODE_HOME/opt/bin/make"
254     elif test -x "/opt/lo/bin/make"; then
255         GNUMAKE="/opt/lo/bin/make"
256     fi
259 GNUMAKE_WIN_NATIVE=
260 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
261     if test -n "$a"; then
262         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
263         if test $? -eq 0;  then
264             if test "$build_os" = "cygwin"; then
265                 if test -n "$($a -v | grep 'Built for Windows')" ; then
266                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
267                     GNUMAKE_WIN_NATIVE="TRUE"
268                 else
269                     GNUMAKE=`which $a`
270                 fi
271             else
272                 GNUMAKE=`which $a`
273             fi
274             break
275         fi
276     fi
277 done
278 AC_MSG_RESULT($GNUMAKE)
279 if test -z "$GNUMAKE"; then
280     AC_MSG_ERROR([not found. install GNU Make.])
281 else
282     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
283         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
284     fi
287 win_short_path_for_make()
289     local_short_path="$1"
290     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
291         cygpath -sm "$local_short_path"
292     else
293         cygpath -u "$(cygpath -d "$local_short_path")"
294     fi
298 if test "$build_os" = "cygwin"; then
299     PathFormat "$SRC_ROOT"
300     SRC_ROOT="$formatted_path"
301     PathFormat "$BUILDDIR"
302     BUILDDIR="$formatted_path"
303     x_Cygwin=
304     AC_MSG_CHECKING(for explicit COMSPEC)
305     if test -z "$COMSPEC"; then
306         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
307     else
308         AC_MSG_RESULT([found: $COMSPEC])
309     fi
312 AC_SUBST(SRC_ROOT)
313 AC_SUBST(BUILDDIR)
314 AC_SUBST(x_Cygwin)
315 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
316 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
318 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
319     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
322 # need sed in os checks...
323 AC_PATH_PROGS(SED, sed)
324 if test -z "$SED"; then
325     AC_MSG_ERROR([install sed to run this script])
328 # Set the ENABLE_LTO variable
329 # ===================================================================
330 AC_MSG_CHECKING([whether to use link-time optimization])
331 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
332     ENABLE_LTO="TRUE"
333     AC_MSG_RESULT([yes])
334     AC_DEFINE(STATIC_LINKING)
335 else
336     ENABLE_LTO=""
337     AC_MSG_RESULT([no])
339 AC_SUBST(ENABLE_LTO)
341 AC_ARG_ENABLE(fuzz-options,
342     AS_HELP_STRING([--enable-fuzz-options],
343         [Randomly enable or disable each of those configurable options
344          that are supposed to be freely selectable without interdependencies,
345          or where bad interaction from interdependencies is automatically avoided.])
348 dnl ===================================================================
349 dnl When building for Android, --with-android-ndk,
350 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
351 dnl mandatory
352 dnl ===================================================================
354 AC_ARG_WITH(android-ndk,
355     AS_HELP_STRING([--with-android-ndk],
356         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
359 AC_ARG_WITH(android-ndk-toolchain-version,
360     AS_HELP_STRING([--with-android-ndk-toolchain-version],
361         [Specify which toolchain version to use, of those present in the
362         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
363         with_android_ndk_toolchain_version=clang5.0)
365 AC_ARG_WITH(android-sdk,
366     AS_HELP_STRING([--with-android-sdk],
367         [Specify location of the Android SDK. Mandatory when building for Android.]),
370 ANDROID_NDK_HOME=
371 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
372     with_android_ndk="$SRC_ROOT/external/android-ndk"
374 if test -n "$with_android_ndk"; then
375     ANDROID_NDK_HOME=$with_android_ndk
377     # Set up a lot of pre-canned defaults
379     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
380         if test ! -f $ANDROID_NDK_HOME/source.properties; then
381             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
382         fi
383         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
384     else
385         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
386     fi
387     if test -z "$ANDROID_NDK_VERSION";  then
388         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
389     fi
390     case $ANDROID_NDK_VERSION in
391     r9*|r10*)
392         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 15.x*])
393         ;;
394     11.1.*|12.1.*|13.1.*|14.1.*)
395         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 15.x.*])
396         ;;
397     15.0.*|15.1.*)
398         ;;
399     *)
400         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only version 15.0.* and 15.1.* have been used successfully. Proceed at your own risk.])
401         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only version 15.0.* and 15.1.* have been used successfully. Proceed at your own risk."
402         ;;
403     esac
405     ANDROID_API_LEVEL=14
406     android_cpu=$host_cpu
407     ANDROID_ARCH=$android_cpu
408     if test $host_cpu = arm; then
409         android_platform_prefix=$android_cpu-linux-androideabi
410         android_gnu_prefix=$android_platform_prefix
411         LLVM_TRIPLE=armv7-none-linux-androideabi
412         ANDROID_APP_ABI=armeabi-v7a
413         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
414     elif test $host_cpu = aarch64; then
415         android_platform_prefix=$android_cpu-linux-android
416         android_gnu_prefix=$android_platform_prefix
417         LLVM_TRIPLE=aarch64-none-linux-android
418         # minimum android version that supports aarch64
419         ANDROID_API_LEVEL=21
420         ANDROID_APP_ABI=arm64-v8a
421         ANDROID_ARCH=arm64
422     elif test $host_cpu = mips; then
423         android_platform_prefix=mipsel-linux-android
424         android_gnu_prefix=$android_platform_prefix
425         LLVM_TRIPLE=mipsel-none-linux-android
426         ANDROID_APP_ABI=mips
427     else
428         # host_cpu is something like "i386" or "i686" I guess, NDK uses
429         # "x86" in some contexts
430         android_cpu=x86
431         android_platform_prefix=$android_cpu
432         android_gnu_prefix=i686-linux-android
433         LLVM_TRIPLE=i686-none-linux-android
434         ANDROID_APP_ABI=x86
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
474     test -z "$SYSBASE" && SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
475     test -z "$AR" && AR=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ar
476     test -z "$NM" && NM=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-nm
477     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-objdump
478     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ranlib
479     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-strip
481     ANDROIDCFLAGS="$ANDROIDCFLAGS -gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT -target $LLVM_TRIPLE -no-canonical-prefixes"
482     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$SYSBASE -ffunction-sections -fdata-sections -Qunused-arguments"
483     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/$ANDROID_GCC_TOOLCHAIN_VERSION/libs/$ANDROID_APP_ABI"
484     if test "$ENABLE_LTO" = TRUE; then
485         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
486         # $CC and $CXX when building external libraries
487         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
488     fi
490     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/$ANDROID_GCC_TOOLCHAIN_VERSION/include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/$ANDROID_GCC_TOOLCHAIN_VERSION/libs/$ANDROID_APP_ABI/include -I$ANDROID_NDK_HOME/sources/cxx-stl/gabi++/include"
492     if test -z "$CC"; then
493         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
494     fi
495     if test -z "$CXX"; then
496         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
497     fi
499     # remember to download the ownCloud Android library later
500     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
502 AC_SUBST(ANDROID_NDK_HOME)
503 AC_SUBST(ANDROID_APP_ABI)
504 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
506 dnl ===================================================================
507 dnl --with-android-sdk
508 dnl ===================================================================
509 ANDROID_SDK_HOME=
510 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
511     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
513 if test -n "$with_android_sdk"; then
514     ANDROID_SDK_HOME=$with_android_sdk
515     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
517 AC_SUBST(ANDROID_SDK_HOME)
519 dnl ===================================================================
520 dnl The following is a list of supported systems.
521 dnl Sequential to keep the logic very simple
522 dnl These values may be checked and reset later.
523 dnl ===================================================================
524 #defaults unless the os test overrides this:
525 test_randr=yes
526 test_xrender=yes
527 test_cups=yes
528 test_dbus=yes
529 test_fontconfig=yes
530 test_cairo=no
532 # Default values, as such probably valid just for Linux, set
533 # differently below just for Mac OSX,but at least better than
534 # hardcoding these as we used to do. Much of this is duplicated also
535 # in solenv for old build system and for gbuild, ideally we should
536 # perhaps define stuff like this only here in configure.ac?
538 LINKFLAGSSHL="-shared"
539 PICSWITCH="-fpic"
540 DLLPOST=".so"
542 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
544 INSTROOTBASESUFFIX=
545 INSTROOTCONTENTSUFFIX=
546 SDKDIRNAME=sdk
548 case "$host_os" in
550 solaris*)
551     test_gtk=yes
552     build_gstreamer_1_0=yes
553     build_gstreamer_0_10=yes
554     test_freetype=yes
555     _os=SunOS
557     dnl ===========================================================
558     dnl Check whether we're using Solaris 10 - SPARC or Intel.
559     dnl ===========================================================
560     AC_MSG_CHECKING([the Solaris operating system release])
561     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
562     if test "$_os_release" -lt "10"; then
563         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
564     else
565         AC_MSG_RESULT([ok ($_os_release)])
566     fi
568     dnl Check whether we're using a SPARC or i386 processor
569     AC_MSG_CHECKING([the processor type])
570     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
571         AC_MSG_RESULT([ok ($host_cpu)])
572     else
573         AC_MSG_ERROR([only SPARC and i386 processors are supported])
574     fi
575     ;;
577 linux-gnu*|k*bsd*-gnu*)
578     test_gtk=yes
579     build_gstreamer_1_0=yes
580     build_gstreamer_0_10=yes
581     test_kde4=yes
582     test_qt5=yes
583     if test "$enable_fuzzers" != yes; then
584         test_freetype=yes
585         test_fontconfig=yes
586     else
587         test_freetype=no
588         test_fontconfig=no
589         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
590     fi
591     _os=Linux
592     ;;
594 gnu)
595     test_randr=no
596     test_xrender=no
597     _os=GNU
598      ;;
600 cygwin*|interix*)
602     # When building on Windows normally with MSVC under Cygwin,
603     # configure thinks that the host platform (the platform the
604     # built code will run on) is Cygwin, even if it obviously is
605     # Windows, which in Autoconf terminology is called
606     # "mingw32". (Which is misleading as MinGW is the name of the
607     # tool-chain, not an operating system.)
609     # Somewhat confusing, yes. But this configure script doesn't
610     # look at $host etc that much, it mostly uses its own $_os
611     # variable, set here in this case statement.
613     test_cups=no
614     test_dbus=no
615     test_randr=no
616     test_xrender=no
617     test_freetype=no
618     test_fontconfig=no
619     _os=WINNT
621     DLLPOST=".dll"
622     LINKFLAGSNOUNDEFS=
623     ;;
625 darwin*) # Mac OS X or iOS
626     test_gtk=yes
627     test_randr=no
628     test_xrender=no
629     test_freetype=no
630     test_fontconfig=no
631     test_dbus=no
632     if test -n "$LODE_HOME" ; then
633         mac_sanitize_path
634         AC_MSG_NOTICE([sanitized the PATH to $PATH])
635     fi
636     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
637         _os=iOS
638         test_gtk=no
639         test_cups=no
640         enable_mpl_subset=yes
641         enable_lotuswordpro=no
642         enable_coinmp=no
643         enable_lpsolve=no
644         enable_postgresql_sdbc=no
645         enable_extension_integration=no
646         enable_report_builder=no
647         with_ppds=no
648         if test "$enable_ios_simulator" = "yes"; then
649             host=x86_64-apple-darwin
650         fi
651     else
652         _os=Darwin
653         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
654         INSTROOTCONTENTSUFFIX=/Contents
655         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
656     fi
657     enable_systray=no
658     # See comment above the case "$host_os"
659     LINKFLAGSSHL="-dynamiclib -single_module"
661     # -fPIC is default
662     PICSWITCH=""
664     DLLPOST=".dylib"
666     # -undefined error is the default
667     LINKFLAGSNOUNDEFS=""
670 freebsd*)
671     test_gtk=yes
672     build_gstreamer_1_0=yes
673     build_gstreamer_0_10=yes
674     test_kde4=yes
675     test_qt5=yes
676     test_freetype=yes
677     AC_MSG_CHECKING([the FreeBSD operating system release])
678     if test -n "$with_os_version"; then
679         OSVERSION="$with_os_version"
680     else
681         OSVERSION=`/sbin/sysctl -n kern.osreldate`
682     fi
683     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
684     AC_MSG_CHECKING([which thread library to use])
685     if test "$OSVERSION" -lt "500016"; then
686         PTHREAD_CFLAGS="-D_THREAD_SAFE"
687         PTHREAD_LIBS="-pthread"
688     elif test "$OSVERSION" -lt "502102"; then
689         PTHREAD_CFLAGS="-D_THREAD_SAFE"
690         PTHREAD_LIBS="-lc_r"
691     else
692         PTHREAD_CFLAGS=""
693         PTHREAD_LIBS="-pthread"
694     fi
695     AC_MSG_RESULT([$PTHREAD_LIBS])
696     _os=FreeBSD
697     ;;
699 *netbsd*)
700     test_gtk=yes
701     build_gstreamer_1_0=yes
702     build_gstreamer_0_10=yes
703     test_kde4=yes
704     test_qt5=yes
705     test_freetype=yes
706     PTHREAD_LIBS="-pthread -lpthread"
707     _os=NetBSD
708     ;;
710 aix*)
711     test_randr=no
712     test_freetype=yes
713     PTHREAD_LIBS=-pthread
714     _os=AIX
715     ;;
717 openbsd*)
718     test_gtk=yes
719     test_freetype=yes
720     PTHREAD_CFLAGS="-D_THREAD_SAFE"
721     PTHREAD_LIBS="-pthread"
722     _os=OpenBSD
723     ;;
725 dragonfly*)
726     test_gtk=yes
727     build_gstreamer_1_0=yes
728     build_gstreamer_0_10=yes
729     test_kde4=yes
730     test_qt5=yes
731     test_freetype=yes
732     PTHREAD_LIBS="-pthread"
733     _os=DragonFly
734     ;;
736 linux-android*)
737     build_gstreamer_1_0=no
738     build_gstreamer_0_10=no
739     enable_lotuswordpro=no
740     enable_mpl_subset=yes
741     enable_coinmp=yes
742     enable_lpsolve=no
743     enable_report_builder=no
744     enable_odk=no
745     enable_postgresql_sdbc=no
746     enable_python=no
747     with_theme="tango"
748     test_cups=no
749     test_dbus=no
750     test_fontconfig=no
751     test_freetype=no
752     test_gtk=no
753     test_kde4=no
754     test_qt5=no
755     test_randr=no
756     test_xrender=no
757     _os=Android
759     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
760     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
761     ;;
764     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
765     ;;
766 esac
768 if test "$_os" = "Android" ; then
769     # Verify that the NDK and SDK options are proper
770     if test -z "$with_android_ndk"; then
771         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
772     elif test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
773         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
774     fi
776     if test -z "$ANDROID_SDK_HOME"; then
777         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
778     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
779         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
780     fi
782     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
783     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
784         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
785                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
786                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
787         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
788         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
789         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
790     fi
791     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
792         AC_MSG_WARN([android support repository not found - install with
793                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
794                      to allow the build to download the specified version of the android support libraries])
795         add_warning "android support repository not found - install with"
796         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
797         add_warning "to allow the build to download the specified version of the android support libraries"
798     fi
801 if test "$_os" = "AIX"; then
802     AC_PATH_PROG(GAWK, gawk)
803     if test -z "$GAWK"; then
804         AC_MSG_ERROR([gawk not found in \$PATH])
805     fi
808 AC_SUBST(SDKDIRNAME)
810 AC_SUBST(PTHREAD_CFLAGS)
811 AC_SUBST(PTHREAD_LIBS)
813 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
814 # By default use the ones specified by our build system,
815 # but explicit override is possible.
816 AC_MSG_CHECKING(for explicit AFLAGS)
817 if test -n "$AFLAGS"; then
818     AC_MSG_RESULT([$AFLAGS])
819     x_AFLAGS=
820 else
821     AC_MSG_RESULT(no)
822     x_AFLAGS=[\#]
824 AC_MSG_CHECKING(for explicit CFLAGS)
825 if test -n "$CFLAGS"; then
826     AC_MSG_RESULT([$CFLAGS])
827     x_CFLAGS=
828 else
829     AC_MSG_RESULT(no)
830     x_CFLAGS=[\#]
832 AC_MSG_CHECKING(for explicit CXXFLAGS)
833 if test -n "$CXXFLAGS"; then
834     AC_MSG_RESULT([$CXXFLAGS])
835     x_CXXFLAGS=
836 else
837     AC_MSG_RESULT(no)
838     x_CXXFLAGS=[\#]
840 AC_MSG_CHECKING(for explicit OBJCFLAGS)
841 if test -n "$OBJCFLAGS"; then
842     AC_MSG_RESULT([$OBJCFLAGS])
843     x_OBJCFLAGS=
844 else
845     AC_MSG_RESULT(no)
846     x_OBJCFLAGS=[\#]
848 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
849 if test -n "$OBJCXXFLAGS"; then
850     AC_MSG_RESULT([$OBJCXXFLAGS])
851     x_OBJCXXFLAGS=
852 else
853     AC_MSG_RESULT(no)
854     x_OBJCXXFLAGS=[\#]
856 AC_MSG_CHECKING(for explicit LDFLAGS)
857 if test -n "$LDFLAGS"; then
858     AC_MSG_RESULT([$LDFLAGS])
859     x_LDFLAGS=
860 else
861     AC_MSG_RESULT(no)
862     x_LDFLAGS=[\#]
864 AC_SUBST(AFLAGS)
865 AC_SUBST(CFLAGS)
866 AC_SUBST(CXXFLAGS)
867 AC_SUBST(OBJCFLAGS)
868 AC_SUBST(OBJCXXFLAGS)
869 AC_SUBST(LDFLAGS)
870 AC_SUBST(x_AFLAGS)
871 AC_SUBST(x_CFLAGS)
872 AC_SUBST(x_CXXFLAGS)
873 AC_SUBST(x_OBJCFLAGS)
874 AC_SUBST(x_OBJCXXFLAGS)
875 AC_SUBST(x_LDFLAGS)
877 dnl These are potentially set for MSVC, in the code checking for UCRT below:
878 my_original_CFLAGS=$CFLAGS
879 my_original_CXXFLAGS=$CXXFLAGS
880 my_original_CPPFLAGS=$CPPFLAGS
882 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
883 dnl Needs to precede the AC_SEARCH_LIBS call below, which apparently calls
884 dnl AC_PROG_CC internally.
885 if test "$_os" != "WINNT"; then
886     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
887     save_CFLAGS=$CFLAGS
888     AC_PROG_CC
889     CFLAGS=$save_CFLAGS
892 if test $_os != "WINNT"; then
893     save_LIBS="$LIBS"
894     AC_SEARCH_LIBS([dlsym], [dl],
895         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
896         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
897     LIBS="$save_LIBS"
899 AC_SUBST(DLOPEN_LIBS)
901 ###############################################################################
902 # Extensions switches --enable/--disable
903 ###############################################################################
904 # By default these should be enabled unless having extra dependencies.
905 # If there is extra dependency over configure options then the enable should
906 # be automagic based on whether the requiring feature is enabled or not.
907 # All this options change anything only with --enable-extension-integration.
909 # The name of this option and its help string makes it sound as if
910 # extensions are built anyway, just not integrated in the installer,
911 # if you use --disable-extension-integration. Is that really the
912 # case?
914 AC_ARG_ENABLE(ios-simulator,
915     AS_HELP_STRING([--enable-ios-simulator],
916         [build i386 or x86_64 for ios simulator])
919 libo_FUZZ_ARG_ENABLE(extension-integration,
920     AS_HELP_STRING([--disable-extension-integration],
921         [Disable integration of the built extensions in the installer of the
922          product. Use this switch to disable the integration.])
925 AC_ARG_ENABLE(avmedia,
926     AS_HELP_STRING([--disable-avmedia],
927         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
930 AC_ARG_ENABLE(database-connectivity,
931     AS_HELP_STRING([--disable-database-connectivity],
932         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
935 # This doesn't mean not building (or "integrating") extensions
936 # (although it probably should; i.e. it should imply
937 # --disable-extension-integration I guess), it means not supporting
938 # any extension mechanism at all
939 libo_FUZZ_ARG_ENABLE(extensions,
940     AS_HELP_STRING([--disable-extensions],
941         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
944 AC_ARG_ENABLE(scripting,
945     AS_HELP_STRING([--disable-scripting],
946         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
949 # This is mainly for Android and iOS, but could potentially be used in some
950 # special case otherwise, too, so factored out as a separate setting
952 AC_ARG_ENABLE(dynamic-loading,
953     AS_HELP_STRING([--disable-dynamic-loading],
954         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
957 libo_FUZZ_ARG_ENABLE(report-builder,
958     AS_HELP_STRING([--disable-report-builder],
959         [Disable the Report Builder.])
962 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
963     AS_HELP_STRING([--enable-ext-wiki-publisher],
964         [Enable the Wiki Publisher extension.])
967 libo_FUZZ_ARG_ENABLE(lpsolve,
968     AS_HELP_STRING([--disable-lpsolve],
969         [Disable compilation of the lp solve solver ])
971 libo_FUZZ_ARG_ENABLE(coinmp,
972     AS_HELP_STRING([--disable-coinmp],
973         [Disable compilation of the CoinMP solver ])
976 libo_FUZZ_ARG_ENABLE(pdfimport,
977     AS_HELP_STRING([--disable-pdfimport],
978         [Disable building the PDF import feature.])
981 libo_FUZZ_ARG_ENABLE(pdfium,
982     AS_HELP_STRING([--disable-pdfium],
983         [Disable building PDFium.])
986 ###############################################################################
988 dnl ---------- *** ----------
990 libo_FUZZ_ARG_ENABLE(mergelibs,
991     AS_HELP_STRING([--enable-mergelibs],
992         [Merge several of the smaller libraries into one big, "merged", one.])
995 libo_FUZZ_ARG_ENABLE(breakpad,
996     AS_HELP_STRING([--enable-breakpad],
997         [Enables breakpad for crash reporting.])
1000 AC_ARG_ENABLE(fetch-external,
1001     AS_HELP_STRING([--disable-fetch-external],
1002         [Disables fetching external tarballs from web sources.])
1005 AC_ARG_ENABLE(fuzzers,
1006     AS_HELP_STRING([--enable-fuzzers],
1007         [Enables building libfuzzer targets for fuzz testing.])
1010 libo_FUZZ_ARG_ENABLE(pch,
1011     AS_HELP_STRING([--enable-pch],
1012         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1015 libo_FUZZ_ARG_ENABLE(epm,
1016     AS_HELP_STRING([--enable-epm],
1017         [LibreOffice includes self-packaging code, that requires epm, however epm is
1018          useless for large scale package building.])
1021 libo_FUZZ_ARG_ENABLE(odk,
1022     AS_HELP_STRING([--disable-odk],
1023         [LibreOffice includes an ODK, office development kit which some packagers may
1024          wish to build without.])
1027 AC_ARG_ENABLE(mpl-subset,
1028     AS_HELP_STRING([--enable-mpl-subset],
1029         [Don't compile any pieces which are not MPL or more liberally licensed])
1032 libo_FUZZ_ARG_ENABLE(evolution2,
1033     AS_HELP_STRING([--enable-evolution2],
1034         [Allows the built-in evolution 2 addressbook connectivity build to be
1035          enabled.])
1038 AC_ARG_ENABLE(avahi,
1039     AS_HELP_STRING([--enable-avahi],
1040         [Determines whether to use Avahi to advertise Impress to remote controls.])
1043 libo_FUZZ_ARG_ENABLE(werror,
1044     AS_HELP_STRING([--enable-werror],
1045         [Turn warnings to errors. (Has no effect in modules where the treating
1046          of warnings as errors is disabled explicitly.)]),
1049 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1050     AS_HELP_STRING([--enable-assert-always-abort],
1051         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1054 libo_FUZZ_ARG_ENABLE(dbgutil,
1055     AS_HELP_STRING([--enable-dbgutil],
1056         [Provide debugging support from --enable-debug and include additional debugging
1057          utilities such as object counting or more expensive checks.
1058          This is the recommended option for developers.
1059          Note that this makes the build ABI incompatible, it is not possible to mix object
1060          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1062 libo_FUZZ_ARG_ENABLE(debug,
1063     AS_HELP_STRING([--enable-debug],
1064         [Include debugging information, disable compiler optimization and inlining plus
1065          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1067 libo_FUZZ_ARG_ENABLE(sal-log,
1068     AS_HELP_STRING([--enable-sal-log],
1069         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1071 AC_ARG_ENABLE(selective-debuginfo,
1072     AS_HELP_STRING([--enable-selective-debuginfo],
1073         [If --enable-debug or --enable-dbgutil is used, build debugging information
1074          (-g compiler flag) only for the specified gbuild build targets
1075          (where all means everything, - prepended means not to enable, / appended means
1076          everything in the directory; there is no ordering, more specific overrides
1077          more general, and disabling takes precedence).
1078          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1080 libo_FUZZ_ARG_ENABLE(symbols,
1081     AS_HELP_STRING([--enable-symbols],
1082         [Generate debug information.
1083          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1084          otherwise.]))
1086 libo_FUZZ_ARG_ENABLE(optimized,
1087     AS_HELP_STRING([--disable-optimized],
1088         [Whether to compile with optimization flags.
1089          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1090          otherwise.]))
1092 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1093     AS_HELP_STRING([--disable-runtime-optimizations],
1094         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1095          JVM JIT) that are known to interact badly with certain dynamic analysis
1096          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1097          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1098          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1100 AC_ARG_WITH(valgrind,
1101     AS_HELP_STRING([--with-valgrind],
1102         [Make availability of Valgrind headers a hard requirement.]))
1104 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1105     AS_HELP_STRING([--enable-compiler-plugins],
1106         [Enable compiler plugins that will perform additional checks during
1107          building. Enabled automatically by --enable-dbgutil.]))
1109 libo_FUZZ_ARG_ENABLE(ooenv,
1110     AS_HELP_STRING([--disable-ooenv],
1111         [Disable ooenv for the instdir installation.]))
1113 AC_ARG_ENABLE(lto,
1114     AS_HELP_STRING([--enable-lto],
1115         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1116          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1117          linker. For MSVC, this option is broken at the moment. This is experimental work
1118          in progress that shouldn't be used unless you are working on it.)]))
1120 AC_ARG_ENABLE(python,
1121     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1122         [Enables or disables Python support at run-time and build-time.
1123          Also specifies what Python to use. 'auto' is the default.
1124          'fully-internal' even forces the internal version for uses of Python
1125          during the build.]))
1127 libo_FUZZ_ARG_ENABLE(gtk,
1128     AS_HELP_STRING([--disable-gtk],
1129         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1130 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1132 libo_FUZZ_ARG_ENABLE(gtk3,
1133     AS_HELP_STRING([--disable-gtk3],
1134         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.
1135          This is experimental and may not work.]),
1136 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1138 libo_FUZZ_ARG_ENABLE(systray,
1139     AS_HELP_STRING([--disable-systray],
1140         [Determines whether to build the systray quickstarter.]),
1141 ,test "${enable_systray+set}" = set || enable_systray=yes)
1143 AC_ARG_ENABLE(split-app-modules,
1144     AS_HELP_STRING([--enable-split-app-modules],
1145         [Split file lists for app modules, e.g. base, calc.
1146          Has effect only with make distro-pack-install]),
1149 AC_ARG_ENABLE(split-opt-features,
1150     AS_HELP_STRING([--enable-split-opt-features],
1151         [Split file lists for some optional features, e.g. pyuno, testtool.
1152          Has effect only with make distro-pack-install]),
1155 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1156     AS_HELP_STRING([--disable-cairo-canvas],
1157         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1160 libo_FUZZ_ARG_ENABLE(dbus,
1161     AS_HELP_STRING([--disable-dbus],
1162         [Determines whether to enable features that depend on dbus.
1163          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1164 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1166 libo_FUZZ_ARG_ENABLE(sdremote,
1167     AS_HELP_STRING([--disable-sdremote],
1168         [Determines whether to enable Impress remote control (i.e. the server component).]),
1169 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1171 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1172     AS_HELP_STRING([--disable-sdremote-bluetooth],
1173         [Determines whether to build sdremote with bluetooth support.
1174          Requires dbus on Linux.]))
1176 libo_FUZZ_ARG_ENABLE(gio,
1177     AS_HELP_STRING([--disable-gio],
1178         [Determines whether to use the GIO support.]),
1179 ,test "${enable_gio+set}" = set || enable_gio=yes)
1181 AC_ARG_ENABLE(kde4,
1182     AS_HELP_STRING([--enable-kde4],
1183         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1184          KDE4 are available.]),
1187 AC_ARG_ENABLE(qt5,
1188     AS_HELP_STRING([--enable-qt5],
1189         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1190          available.]),
1193 libo_FUZZ_ARG_ENABLE(gui,
1194     AS_HELP_STRING([--disable-gui],
1195         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1196          command-line option. Not related to LibreOffice Online functionality. Don't use
1197          unless you are certain you need to. Nobody will help you if you insist on trying
1198          this and run into problems.]),
1199 ,test "${enable_gui+set}" = set || enable_gui=yes)
1201 libo_FUZZ_ARG_ENABLE(randr,
1202     AS_HELP_STRING([--disable-randr],
1203         [Disable RandR support in the vcl project.]),
1204 ,test "${enable_randr+set}" = set || enable_randr=yes)
1206 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1207     AS_HELP_STRING([--disable-gstreamer-1-0],
1208         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1209 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1211 AC_ARG_ENABLE(gstreamer-0-10,
1212     AS_HELP_STRING([--enable-gstreamer-0-10],
1213         [Enable building with the gstreamer 0.10 avmedia backend.]),
1214 ,enable_gstreamer_0_10=no)
1216 libo_FUZZ_ARG_ENABLE(vlc,
1217     AS_HELP_STRING([--enable-vlc],
1218         [Enable building with the (experimental) VLC avmedia backend.]),
1219 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1221 libo_FUZZ_ARG_ENABLE(neon,
1222     AS_HELP_STRING([--disable-neon],
1223         [Disable neon and the compilation of webdav binding.]),
1226 libo_FUZZ_ARG_ENABLE([eot],
1227     [AS_HELP_STRING([--enable-eot],
1228         [Enable support for Embedded OpenType fonts.])],
1229 ,test "${enable_eot+set}" = set || enable_eot=no)
1231 libo_FUZZ_ARG_ENABLE(cve-tests,
1232     AS_HELP_STRING([--disable-cve-tests],
1233         [Prevent CVE tests to be executed]),
1236 libo_FUZZ_ARG_ENABLE(chart-tests,
1237     AS_HELP_STRING([--enable-chart-tests],
1238         [Executes chart XShape tests. In a perfect world these tests would be
1239          stable and everyone could run them, in reality it is best to run them
1240          only on a few machines that are known to work and maintained by people
1241          who can judge if a test failure is a regression or not.]),
1244 AC_ARG_ENABLE(build-unowinreg,
1245     AS_HELP_STRING([--enable-build-unowinreg],
1246         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1247          compiler is needed on Linux.]),
1250 AC_ARG_ENABLE(dependency-tracking,
1251     AS_HELP_STRING([--enable-dependency-tracking],
1252         [Do not reject slow dependency extractors.])[
1253   --disable-dependency-tracking
1254                           Disables generation of dependency information.
1255                           Speed up one-time builds.],
1258 AC_ARG_ENABLE(icecream,
1259     AS_HELP_STRING([--enable-icecream],
1260         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1261          It defaults to /opt/icecream for the location of the icecream gcc/g++
1262          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1265 libo_FUZZ_ARG_ENABLE(cups,
1266     AS_HELP_STRING([--disable-cups],
1267         [Do not build cups support.])
1270 AC_ARG_ENABLE(ccache,
1271     AS_HELP_STRING([--disable-ccache],
1272         [Do not try to use ccache automatically.
1273          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1274          CC/CXX are not yet set, and --enable-icecream is not given, we
1275          attempt to use ccache. --disable-ccache disables ccache completely.
1279 AC_ARG_ENABLE(64-bit,
1280     AS_HELP_STRING([--enable-64-bit],
1281         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1282          At the moment meaningful only for Windows.]), ,)
1284 libo_FUZZ_ARG_ENABLE(online-update,
1285     AS_HELP_STRING([--enable-online-update],
1286         [Enable the online update service that will check for new versions of
1287          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1288          If the value is "mar", the experimental Mozilla-like update will be
1289          enabled instead of the traditional update mechanism.]),
1292 AC_ARG_WITH(update-config,
1293     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1294                    [Path to the update config ini file]))
1296 libo_FUZZ_ARG_ENABLE(extension-update,
1297     AS_HELP_STRING([--disable-extension-update],
1298         [Disable possibility to update installed extensions.]),
1301 libo_FUZZ_ARG_ENABLE(release-build,
1302     AS_HELP_STRING([--enable-release-build],
1303         [Enable release build. Note that the "release build" choice is orthogonal to
1304          whether symbols are present, debug info is generated, or optimization
1305          is done.
1306          See http://wiki.documentfoundation.org/Development/DevBuild]),
1309 AC_ARG_ENABLE(windows-build-signing,
1310     AS_HELP_STRING([--enable-windows-build-signing],
1311         [Enable signing of windows binaries (*.exe, *.dll)]),
1314 AC_ARG_ENABLE(silent-msi,
1315     AS_HELP_STRING([--enable-silent-msi],
1316         [Enable MSI with LIMITUI=1 (silent install).]),
1319 AC_ARG_ENABLE(macosx-code-signing,
1320     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1321         [Sign executables, dylibs, frameworks and the app bundle. If you
1322          don't provide an identity the first suitable certificate
1323          in your keychain is used.]),
1326 AC_ARG_ENABLE(macosx-package-signing,
1327     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1328         [Create a .pkg suitable for uploading to the Mac App Store and sign
1329          it. If you don't provide an identity the first suitable certificate
1330          in your keychain is used.]),
1333 AC_ARG_ENABLE(macosx-sandbox,
1334     AS_HELP_STRING([--enable-macosx-sandbox],
1335         [Make the app bundle run in a sandbox. Requires code signing.
1336          Is required by apps distributed in the Mac App Store, and implies
1337          adherence to App Store rules.]),
1340 AC_ARG_WITH(macosx-bundle-identifier,
1341     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1342         [Define the OS X bundle identifier. Default is the somewhat weird
1343          org.libreoffice.script ("script", huh?).]),
1344 ,with_macosx_bundle_identifier=org.libreoffice.script)
1346 AC_ARG_WITH(product-name,
1347     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1348         [Define the product name. Default is AC_PACKAGE_NAME.]),
1349 ,with_product_name=$PRODUCTNAME)
1351 AC_ARG_WITH(package-version,
1352     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1353         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1356 libo_FUZZ_ARG_ENABLE(readonly-installset,
1357     AS_HELP_STRING([--enable-readonly-installset],
1358         [Prevents any attempts by LibreOffice to write into its installation. That means
1359          at least that no "system-wide" extensions can be added. Experimental work in
1360          progress.]),
1363 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1364     AS_HELP_STRING([--disable-postgresql-sdbc],
1365         [Disable the build of the PostgreSQL-SDBC driver.])
1368 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1369     AS_HELP_STRING([--disable-lotuswordpro],
1370         [Disable the build of the Lotus Word Pro filter.]),
1371 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1373 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1374     AS_HELP_STRING([--disable-firebird-sdbc],
1375         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1376 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1378 AC_ARG_ENABLE(bogus-pkg-config,
1379     AS_HELP_STRING([--enable-bogus-pkg-config],
1380         [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.]),
1383 AC_ARG_ENABLE(openssl,
1384     AS_HELP_STRING([--disable-openssl],
1385         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1386          components will either use GNUTLS or NSS. Work in progress,
1387          use only if you are hacking on it.]),
1388 ,enable_openssl=yes)
1390 AC_ARG_ENABLE(library-bin-tar,
1391     AS_HELP_STRING([--enable-library-bin-tar],
1392         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1393         Some libraries can save their build result in a tarball
1394         stored in TARFILE_LOCATION. That binary tarball is
1395         uniquely identified by the source tarball,
1396         the content of the config_host.mk file and the content
1397         of the top-level directory in core for that library
1398         If this option is enabled, then if such a tarfile exist, it will be untarred
1399         instead of the source tarfile, and the build step will be skipped for that
1400         library.
1401         If a proper tarfile does not exist, then the normal source-based
1402         build is done for that library and a proper binary tarfile is created
1403         for the next time.]),
1406 AC_ARG_ENABLE(dconf,
1407     AS_HELP_STRING([--disable-dconf],
1408         [Disable the dconf configuration backend (enabled by default where
1409          available).]))
1411 libo_FUZZ_ARG_ENABLE(formula-logger,
1412     AS_HELP_STRING(
1413         [--enable-formula-logger],
1414         [Enable formula logger for logging formula calculation flow in Calc.]
1415     )
1418 dnl ===================================================================
1419 dnl Optional Packages (--with/without-)
1420 dnl ===================================================================
1422 AC_ARG_WITH(gcc-home,
1423     AS_HELP_STRING([--with-gcc-home],
1424         [Specify the location of gcc/g++ manually. This can be used in conjunction
1425          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1426          non-default path.]),
1429 AC_ARG_WITH(gnu-patch,
1430     AS_HELP_STRING([--with-gnu-patch],
1431         [Specify location of GNU patch on Solaris or FreeBSD.]),
1434 AC_ARG_WITH(build-platform-configure-options,
1435     AS_HELP_STRING([--with-build-platform-configure-options],
1436         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1439 AC_ARG_WITH(gnu-cp,
1440     AS_HELP_STRING([--with-gnu-cp],
1441         [Specify location of GNU cp on Solaris or FreeBSD.]),
1444 AC_ARG_WITH(external-tar,
1445     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1446         [Specify an absolute path of where to find (and store) tarfiles.]),
1447     TARFILE_LOCATION=$withval ,
1450 AC_ARG_WITH(referenced-git,
1451     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1452         [Specify another checkout directory to reference. This makes use of
1453                  git submodule update --reference, and saves a lot of diskspace
1454                  when having multiple trees side-by-side.]),
1455     GIT_REFERENCE_SRC=$withval ,
1458 AC_ARG_WITH(linked-git,
1459     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1460         [Specify a directory where the repositories of submodules are located.
1461          This uses a method similar to git-new-workdir to get submodules.]),
1462     GIT_LINK_SRC=$withval ,
1465 AC_ARG_WITH(galleries,
1466     AS_HELP_STRING([--with-galleries],
1467         [Specify how galleries should be built. It is possible either to
1468          build these internally from source ("build"),
1469          or to disable them ("no")]),
1472 AC_ARG_WITH(theme,
1473     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1474         [Choose which themes to include. By default those themes with an '*' are included.
1475          Possible choices: *breeze, *breeze_dark, crystal, *colibre, *elementary, *galaxy, *hicontrast, oxygen, *sifr, *sifr_dark, *tango, tango_testing.]),
1478 libo_FUZZ_ARG_WITH(helppack-integration,
1479     AS_HELP_STRING([--without-helppack-integration],
1480         [It will not integrate the helppacks to the installer
1481          of the product. Please use this switch to use the online help
1482          or separate help packages.]),
1485 libo_FUZZ_ARG_WITH(fonts,
1486     AS_HELP_STRING([--without-fonts],
1487         [LibreOffice includes some third-party fonts to provide a reliable basis for
1488          help content, templates, samples, etc. When these fonts are already
1489          known to be available on the system then you should use this option.]),
1492 AC_ARG_ENABLE(noto-font,
1493     AS_HELP_STRING([--enable-noto-font],
1494         [Add more Google Noto fonts.]),
1497 AC_ARG_WITH(epm,
1498     AS_HELP_STRING([--with-epm],
1499         [Decides which epm to use. Default is to use the one from the system if
1500          one is built. When either this is not there or you say =internal epm
1501          will be built.]),
1504 AC_ARG_WITH(package-format,
1505     AS_HELP_STRING([--with-package-format],
1506         [Specify package format(s) for LibreOffice installation sets. The
1507          implicit --without-package-format leads to no installation sets being
1508          generated. Possible values: aix, archive, bsd, deb, dmg,
1509          installed, msi, pkg, and rpm.
1510          Example: --with-package-format='deb rpm']),
1513 AC_ARG_WITH(tls,
1514     AS_HELP_STRING([--with-tls],
1515         [Decides which TLS/SSL and cryptographic implementations to use for
1516          LibreOffice's code. Notice that this doesn't apply for depending
1517          libraries like "neon", for example. Default is to use OpenSSL
1518          although NSS is also possible. Notice that selecting NSS restricts
1519          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1520          restrict by now the usage of NSS in LO's code. Possible values:
1521          openssl, nss. Example: --with-tls="nss"]),
1524 AC_ARG_WITH(system-libs,
1525     AS_HELP_STRING([--with-system-libs],
1526         [Use libraries already on system -- enables all --with-system-* flags.]),
1529 AC_ARG_WITH(system-bzip2,
1530     AS_HELP_STRING([--with-system-bzip2],
1531         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1532     [with_system_bzip2="$with_system_libs"])
1534 AC_ARG_WITH(system-headers,
1535     AS_HELP_STRING([--with-system-headers],
1536         [Use headers already on system -- enables all --with-system-* flags for
1537          external packages whose headers are the only entities used i.e.
1538          boost/odbc/sane-header(s).]),,
1539     [with_system_headers="$with_system_libs"])
1541 AC_ARG_WITH(system-jars,
1542     AS_HELP_STRING([--without-system-jars],
1543         [When building with --with-system-libs, also the needed jars are expected
1544          on the system. Use this to disable that]),,
1545     [with_system_jars="$with_system_libs"])
1547 AC_ARG_WITH(system-cairo,
1548     AS_HELP_STRING([--with-system-cairo],
1549         [Use cairo libraries already on system.  Happens automatically for
1550          (implicit) --enable-gtk and for --enable-gtk3.]))
1552 AC_ARG_WITH(system-epoxy,
1553     AS_HELP_STRING([--with-system-epoxy],
1554         [Use epoxy libraries already on system.  Happens automatically for
1555          --enable-gtk3.]),,
1556        [with_system_epoxy="$with_system_libs"])
1558 AC_ARG_WITH(myspell-dicts,
1559     AS_HELP_STRING([--with-myspell-dicts],
1560         [Adds myspell dictionaries to the LibreOffice installation set]),
1563 AC_ARG_WITH(system-dicts,
1564     AS_HELP_STRING([--without-system-dicts],
1565         [Do not use dictionaries from system paths.]),
1568 AC_ARG_WITH(external-dict-dir,
1569     AS_HELP_STRING([--with-external-dict-dir],
1570         [Specify external dictionary dir.]),
1573 AC_ARG_WITH(external-hyph-dir,
1574     AS_HELP_STRING([--with-external-hyph-dir],
1575         [Specify external hyphenation pattern dir.]),
1578 AC_ARG_WITH(external-thes-dir,
1579     AS_HELP_STRING([--with-external-thes-dir],
1580         [Specify external thesaurus dir.]),
1583 AC_ARG_WITH(system-zlib,
1584     AS_HELP_STRING([--with-system-zlib],
1585         [Use zlib already on system.]),,
1586     [with_system_zlib=auto])
1588 AC_ARG_WITH(system-jpeg,
1589     AS_HELP_STRING([--with-system-jpeg],
1590         [Use jpeg already on system.]),,
1591     [with_system_jpeg="$with_system_libs"])
1593 AC_ARG_WITH(system-clucene,
1594     AS_HELP_STRING([--with-system-clucene],
1595         [Use clucene already on system.]),,
1596     [with_system_clucene="$with_system_libs"])
1598 AC_ARG_WITH(system-expat,
1599     AS_HELP_STRING([--with-system-expat],
1600         [Use expat already on system.]),,
1601     [with_system_expat="$with_system_libs"])
1603 AC_ARG_WITH(system-libxml,
1604     AS_HELP_STRING([--with-system-libxml],
1605         [Use libxml/libxslt already on system.]),,
1606     [with_system_libxml=auto])
1608 AC_ARG_WITH(system-icu,
1609     AS_HELP_STRING([--with-system-icu],
1610         [Use icu already on system.]),,
1611     [with_system_icu="$with_system_libs"])
1613 AC_ARG_WITH(system-ucpp,
1614     AS_HELP_STRING([--with-system-ucpp],
1615         [Use ucpp already on system.]),,
1616     [])
1618 AC_ARG_WITH(system-openldap,
1619     AS_HELP_STRING([--with-system-openldap],
1620         [Use the OpenLDAP LDAP SDK already on system.]),,
1621     [with_system_openldap="$with_system_libs"])
1623 AC_ARG_WITH(system-poppler,
1624     AS_HELP_STRING([--with-system-poppler],
1625         [Use system poppler (only needed for PDF import).]),,
1626     [with_system_poppler="$with_system_libs"])
1628 AC_ARG_WITH(system-gpgmepp,
1629     AS_HELP_STRING([--with-system-gpgmepp],
1630         [Use gpgmepp already on system]),,
1631     [with_system_gpgmepp="$with_system_libs"])
1633 AC_ARG_WITH(system-apache-commons,
1634     AS_HELP_STRING([--with-system-apache-commons],
1635         [Use Apache commons libraries already on system.]),,
1636     [with_system_apache_commons="$with_system_jars"])
1638 AC_ARG_WITH(system-mariadb,
1639     AS_HELP_STRING([--with-system-mariadb],
1640         [Use MariaDB/MySQL libraries already on system.]),,
1641     [with_system_mariadb="$with_system_libs"])
1643 AC_ARG_ENABLE(bundle-mariadb,
1644     AS_HELP_STRING([--enable-bundle-mariadb],
1645         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1648 AC_ARG_WITH(system-mysql-cppconn,
1649     AS_HELP_STRING([--with-system-mysql-cppconn],
1650         [Use MySQL C++ Connector libraries already on system.]),,
1651     [with_system_mysql_cppconn="$with_system_libs"])
1653 AC_ARG_WITH(system-postgresql,
1654     AS_HELP_STRING([--with-system-postgresql],
1655         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1656          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1657     [with_system_postgresql="$with_system_libs"])
1659 AC_ARG_WITH(libpq-path,
1660     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1661         [Use this PostgreSQL C interface (libpq) installation for building
1662          the PostgreSQL-SDBC extension.]),
1665 AC_ARG_WITH(system-firebird,
1666     AS_HELP_STRING([--with-system-firebird],
1667         [Use Firebird libraries already on system, for building the Firebird-SDBC
1668          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1669     [with_system_firebird="$with_system_libs"])
1671 AC_ARG_WITH(system-libtommath,
1672             AS_HELP_STRING([--with-system-libtommath],
1673                            [Use libtommath already on system]),,
1674             [with_system_libtommath="$with_system_libs"])
1676 AC_ARG_WITH(system-hsqldb,
1677     AS_HELP_STRING([--with-system-hsqldb],
1678         [Use hsqldb already on system.]))
1680 AC_ARG_WITH(hsqldb-jar,
1681     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1682         [Specify path to jarfile manually.]),
1683     HSQLDB_JAR=$withval)
1685 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1686     AS_HELP_STRING([--disable-scripting-beanshell],
1687         [Disable support for scripts in BeanShell.]),
1691 AC_ARG_WITH(system-beanshell,
1692     AS_HELP_STRING([--with-system-beanshell],
1693         [Use beanshell already on system.]),,
1694     [with_system_beanshell="$with_system_jars"])
1696 AC_ARG_WITH(beanshell-jar,
1697     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1698         [Specify path to jarfile manually.]),
1699     BSH_JAR=$withval)
1701 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1702     AS_HELP_STRING([--disable-scripting-javascript],
1703         [Disable support for scripts in JavaScript.]),
1707 AC_ARG_WITH(system-rhino,
1708     AS_HELP_STRING([--with-system-rhino],
1709         [Use rhino already on system.]),,)
1710 #    [with_system_rhino="$with_system_jars"])
1711 # Above is not used as we have different debug interface
1712 # patched into internal rhino. This code needs to be fixed
1713 # before we can enable it by default.
1715 AC_ARG_WITH(rhino-jar,
1716     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1717         [Specify path to jarfile manually.]),
1718     RHINO_JAR=$withval)
1720 AC_ARG_WITH(commons-logging-jar,
1721     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1722         [Specify path to jarfile manually.]),
1723     COMMONS_LOGGING_JAR=$withval)
1725 AC_ARG_WITH(system-jfreereport,
1726     AS_HELP_STRING([--with-system-jfreereport],
1727         [Use JFreeReport already on system.]),,
1728     [with_system_jfreereport="$with_system_jars"])
1730 AC_ARG_WITH(sac-jar,
1731     AS_HELP_STRING([--with-sac-jar=JARFILE],
1732         [Specify path to jarfile manually.]),
1733     SAC_JAR=$withval)
1735 AC_ARG_WITH(libxml-jar,
1736     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1737         [Specify path to jarfile manually.]),
1738     LIBXML_JAR=$withval)
1740 AC_ARG_WITH(flute-jar,
1741     AS_HELP_STRING([--with-flute-jar=JARFILE],
1742         [Specify path to jarfile manually.]),
1743     FLUTE_JAR=$withval)
1745 AC_ARG_WITH(jfreereport-jar,
1746     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1747         [Specify path to jarfile manually.]),
1748     JFREEREPORT_JAR=$withval)
1750 AC_ARG_WITH(liblayout-jar,
1751     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1752         [Specify path to jarfile manually.]),
1753     LIBLAYOUT_JAR=$withval)
1755 AC_ARG_WITH(libloader-jar,
1756     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1757         [Specify path to jarfile manually.]),
1758     LIBLOADER_JAR=$withval)
1760 AC_ARG_WITH(libformula-jar,
1761     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1762         [Specify path to jarfile manually.]),
1763     LIBFORMULA_JAR=$withval)
1765 AC_ARG_WITH(librepository-jar,
1766     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1767         [Specify path to jarfile manually.]),
1768     LIBREPOSITORY_JAR=$withval)
1770 AC_ARG_WITH(libfonts-jar,
1771     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1772         [Specify path to jarfile manually.]),
1773     LIBFONTS_JAR=$withval)
1775 AC_ARG_WITH(libserializer-jar,
1776     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1777         [Specify path to jarfile manually.]),
1778     LIBSERIALIZER_JAR=$withval)
1780 AC_ARG_WITH(libbase-jar,
1781     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1782         [Specify path to jarfile manually.]),
1783     LIBBASE_JAR=$withval)
1785 AC_ARG_WITH(system-odbc,
1786     AS_HELP_STRING([--with-system-odbc],
1787         [Use the odbc headers already on system.]),,
1788     [with_system_odbc="auto"])
1790 AC_ARG_WITH(system-sane,
1791     AS_HELP_STRING([--with-system-sane],
1792         [Use sane.h already on system.]),,
1793     [with_system_sane="$with_system_headers"])
1795 AC_ARG_WITH(system-bluez,
1796     AS_HELP_STRING([--with-system-bluez],
1797         [Use bluetooth.h already on system.]),,
1798     [with_system_bluez="$with_system_headers"])
1800 AC_ARG_WITH(system-curl,
1801     AS_HELP_STRING([--with-system-curl],
1802         [Use curl already on system.]),,
1803     [with_system_curl=auto])
1805 AC_ARG_WITH(system-boost,
1806     AS_HELP_STRING([--with-system-boost],
1807         [Use boost already on system.]),,
1808     [with_system_boost="$with_system_headers"])
1810 AC_ARG_WITH(system-glm,
1811     AS_HELP_STRING([--with-system-glm],
1812         [Use glm already on system.]),,
1813     [with_system_glm="$with_system_headers"])
1815 AC_ARG_WITH(system-hunspell,
1816     AS_HELP_STRING([--with-system-hunspell],
1817         [Use libhunspell already on system.]),,
1818     [with_system_hunspell="$with_system_libs"])
1820 AC_ARG_WITH(system-mythes,
1821     AS_HELP_STRING([--with-system-mythes],
1822         [Use mythes already on system.]),,
1823     [with_system_mythes="$with_system_libs"])
1825 AC_ARG_WITH(system-altlinuxhyph,
1826     AS_HELP_STRING([--with-system-altlinuxhyph],
1827         [Use ALTLinuxhyph already on system.]),,
1828     [with_system_altlinuxhyph="$with_system_libs"])
1830 AC_ARG_WITH(system-lpsolve,
1831     AS_HELP_STRING([--with-system-lpsolve],
1832         [Use lpsolve already on system.]),,
1833     [with_system_lpsolve="$with_system_libs"])
1835 AC_ARG_WITH(system-coinmp,
1836     AS_HELP_STRING([--with-system-coinmp],
1837         [Use CoinMP already on system.]),,
1838     [with_system_coinmp="$with_system_libs"])
1840 AC_ARG_WITH(system-liblangtag,
1841     AS_HELP_STRING([--with-system-liblangtag],
1842         [Use liblangtag library already on system.]),,
1843     [with_system_liblangtag="$with_system_libs"])
1845 AC_ARG_WITH(webdav,
1846     AS_HELP_STRING([--with-webdav],
1847         [Specify which library to use for webdav implementation.
1848          Possible values: "neon", "serf", "no". The default value is "neon".
1849          Example: --with-webdav="serf"]),
1850     WITH_WEBDAV=$withval,
1851     WITH_WEBDAV="neon")
1853 AC_ARG_WITH(linker-hash-style,
1854     AS_HELP_STRING([--with-linker-hash-style],
1855         [Use linker with --hash-style=<style> when linking shared objects.
1856          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1857          if supported on the build system, and "sysv" otherwise.]))
1859 AC_ARG_WITH(jdk-home,
1860     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1861         [If you have installed JDK 1.6 or later on your system please supply the
1862          path here. Note that this is not the location of the java command but the
1863          location of the entire distribution.]),
1866 AC_ARG_WITH(help,
1867     AS_HELP_STRING([--with-help],
1868         [Enable the build of help. There is a special parameter "common" that
1869          can be used to bundle only the common part, .e.g help-specific icons.
1870          This is useful when you build the helpcontent separately.])
1871     [
1872                           Usage:     --with-help    build the old local help
1873                                  --without-help     no local help (default)
1874                                  --with-help=html   build the new HTML local help
1875                                  --with-help=online build the new HTML online help
1876                                  --with-help=common bundle common files for the local
1877                                                     help but do not build the whole help
1878     ],
1881 libo_FUZZ_ARG_WITH(java,
1882     AS_HELP_STRING([--with-java=<java command>],
1883         [Specify the name of the Java interpreter command. Typically "java"
1884          which is the default.
1886          To build without support for Java components, applets, accessibility
1887          or the XML filters written in Java, use --without-java or --with-java=no.]),
1888     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1889     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
1892 AC_ARG_WITH(jvm-path,
1893     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
1894         [Use a specific JVM search path at runtime.
1895          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
1898 AC_ARG_WITH(ant-home,
1899     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
1900         [If you have installed Jakarta Ant on your system, please supply the path here.
1901          Note that this is not the location of the Ant binary but the location
1902          of the entire distribution.]),
1905 AC_ARG_WITH(symbol-config,
1906     AS_HELP_STRING([--with-symbol-config],
1907         [Configuration for the crashreport symbol upload]),
1908         [],
1909         [with_symbol_config=no])
1911 AC_ARG_WITH(export-validation,
1912     AS_HELP_STRING([--without-export-validation],
1913         [Disable validating OOXML and ODF files as exported from in-tree tests.
1914          Use this option e.g. if your system only provides Java 5.]),
1915 ,with_export_validation=auto)
1917 AC_ARG_WITH(bffvalidator,
1918     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
1919         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
1920          Requires installed Microsoft Office Binary File Format Validator.
1921          Note: export-validation (--with-export-validation) is required to be turned on.
1922          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
1923 ,with_bffvalidator=no)
1925 libo_FUZZ_ARG_WITH(junit,
1926     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
1927         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
1928          --without-junit disables those tests. Not relevant in the --without-java case.]),
1929 ,with_junit=yes)
1931 AC_ARG_WITH(hamcrest,
1932     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
1933         [Specifies the hamcrest jar file to use for JUnit-based tests.
1934          --without-junit disables those tests. Not relevant in the --without-java case.]),
1935 ,with_hamcrest=yes)
1937 AC_ARG_WITH(perl-home,
1938     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
1939         [If you have installed Perl 5 Distribution, on your system, please
1940          supply the path here. Note that this is not the location of the Perl
1941          binary but the location of the entire distribution.]),
1944 libo_FUZZ_ARG_WITH(doxygen,
1945     AS_HELP_STRING(
1946         [--with-doxygen=<absolute path to doxygen executable>],
1947         [Specifies the doxygen executable to use when generating ODK C/C++
1948          documentation. --without-doxygen disables generation of ODK C/C++
1949          documentation. Not relevant in the --disable-odk case.]),
1950 ,with_doxygen=yes)
1952 AC_ARG_WITH(visual-studio,
1953     AS_HELP_STRING([--with-visual-studio=<2015/2017>],
1954         [Specify which Visual Studio version to use in case several are
1955          installed. If not specified, defaults to 2015.]),
1958 AC_ARG_WITH(windows-sdk,
1959     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
1960         [Specify which Windows SDK, or "Windows Kit", version to use
1961          in case the one that came with the selected Visual Studio
1962          is not what you want for some reason. Note that not all compiler/SDK
1963          combinations are supported. The intent is that this option should not
1964          be needed.]),
1967 AC_ARG_WITH(lang,
1968     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
1969         [Use this option to build LibreOffice with additional UI language support.
1970          English (US) is always included by default.
1971          Separate multiple languages with space.
1972          For all languages, use --with-lang=ALL.]),
1975 AC_ARG_WITH(locales,
1976     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
1977         [Use this option to limit the locale information built in.
1978          Separate multiple locales with space.
1979          Very experimental and might well break stuff.
1980          Just a desperate measure to shrink code and data size.
1981          By default all the locales available is included.
1982          This option is completely unrelated to --with-lang.])
1983     [
1984                           Affects also our character encoding conversion
1985                           tables for encodings mainly targeted for a
1986                           particular locale, like EUC-CN and EUC-TW for
1987                           zh, ISO-2022-JP for ja.
1989                           Affects also our add-on break iterator data for
1990                           some languages.
1992                           For the default, all locales, don't use this switch at all.
1993                           Specifying just the language part of a locale means all matching
1994                           locales will be included.
1995     ],
1998 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
1999 libo_FUZZ_ARG_WITH(krb5,
2000     AS_HELP_STRING([--with-krb5],
2001         [Enable MIT Kerberos 5 support in modules that support it.
2002          By default automatically enabled on platforms
2003          where a good system Kerberos 5 is available.]),
2006 libo_FUZZ_ARG_WITH(gssapi,
2007     AS_HELP_STRING([--with-gssapi],
2008         [Enable GSSAPI support in modules that support it.
2009          By default automatically enabled on platforms
2010          where a good system GSSAPI is available.]),
2013 AC_ARG_WITH(iwyu,
2014     AS_HELP_STRING([--with-iwyu],
2015         [Use given IWYU binary path to check unneeded includes instead of building.
2016          Use only if you are hacking on it.]),
2019 dnl ===================================================================
2020 dnl Branding
2021 dnl ===================================================================
2023 AC_ARG_WITH(branding,
2024     AS_HELP_STRING([--with-branding=/path/to/images],
2025         [Use given path to retrieve branding images set.])
2026     [
2027                           Search for intro.png about.svg and flat_logo.svg.
2028                           If any is missing, default ones will be used instead.
2030                           Search also progress.conf for progress
2031                           settings on intro screen :
2033                           PROGRESSBARCOLOR="255,255,255" Set color of
2034                           progress bar. Comma separated RGB decimal values.
2035                           PROGRESSSIZE="407,6" Set size of progress bar.
2036                           Comma separated decimal values (width, height).
2037                           PROGRESSPOSITION="61,317" Set position of progress
2038                           bar from left,top. Comma separated decimal values.
2039                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2040                           bar frame. Comma separated RGB decimal values.
2041                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2042                           bar text. Comma separated RGB decimal values.
2043                           PROGRESSTEXTBASELINE="287" Set vertical position of
2044                           progress bar text from top. Decimal value.
2046                           Default values will be used if not found.
2047     ],
2051 AC_ARG_WITH(extra-buildid,
2052     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2053         [Show addition build identification in about dialog.]),
2057 AC_ARG_WITH(vendor,
2058     AS_HELP_STRING([--with-vendor="John the Builder"],
2059         [Set vendor of the build.]),
2062 AC_ARG_WITH(android-package-name,
2063     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2064         [Set Android package name of the build.]),
2067 AC_ARG_WITH(compat-oowrappers,
2068     AS_HELP_STRING([--with-compat-oowrappers],
2069         [Install oo* wrappers in parallel with
2070          lo* ones to keep backward compatibility.
2071          Has effect only with make distro-pack-install]),
2074 AC_ARG_WITH(os-version,
2075     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2076         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2079 AC_ARG_WITH(mingw-cross-compiler,
2080     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2081         [Specify the MinGW cross-compiler to use.
2082          When building on the ODK on Unix and building unowinreg.dll,
2083          specify the MinGW C++ cross-compiler.]),
2086 AC_ARG_WITH(idlc-cpp,
2087     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2088         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2091 AC_ARG_WITH(build-version,
2092     AS_HELP_STRING([--with-build-version="Built by Jim"],
2093         [Allows the builder to add a custom version tag that will appear in the
2094          Help/About box for QA purposes.]),
2095 with_build_version=$withval,
2098 AC_ARG_WITH(alloc,
2099     AS_HELP_STRING([--with-alloc],
2100         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
2101          Note that on FreeBSD/NetBSD system==jemalloc]),
2104 AC_ARG_WITH(parallelism,
2105     AS_HELP_STRING([--with-parallelism],
2106         [Number of jobs to run simultaneously during build. Parallel builds can
2107         save a lot of time on multi-cpu machines. Defaults to the number of
2108         CPUs on the machine, unless you configure --enable-icecream - then to
2109         10.]),
2112 AC_ARG_WITH(all-tarballs,
2113     AS_HELP_STRING([--with-all-tarballs],
2114         [Download all external tarballs unconditionally]))
2116 AC_ARG_WITH(gdrive-client-id,
2117     AS_HELP_STRING([--with-gdrive-client-id],
2118         [Provides the client id of the application for OAuth2 authentication
2119         on Google Drive. If either this or --with-gdrive-client-secret is
2120         empty, the feature will be disabled]),
2123 AC_ARG_WITH(gdrive-client-secret,
2124     AS_HELP_STRING([--with-gdrive-client-secret],
2125         [Provides the client secret of the application for OAuth2
2126         authentication on Google Drive. If either this or
2127         --with-gdrive-client-id is empty, the feature will be disabled]),
2130 AC_ARG_WITH(alfresco-cloud-client-id,
2131     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2132         [Provides the client id of the application for OAuth2 authentication
2133         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2134         empty, the feature will be disabled]),
2137 AC_ARG_WITH(alfresco-cloud-client-secret,
2138     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2139         [Provides the client secret of the application for OAuth2
2140         authentication on Alfresco Cloud. If either this or
2141         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2144 AC_ARG_WITH(onedrive-client-id,
2145     AS_HELP_STRING([--with-onedrive-client-id],
2146         [Provides the client id of the application for OAuth2 authentication
2147         on OneDrive. If either this or --with-onedrive-client-secret is
2148         empty, the feature will be disabled]),
2151 AC_ARG_WITH(onedrive-client-secret,
2152     AS_HELP_STRING([--with-onedrive-client-secret],
2153         [Provides the client secret of the application for OAuth2
2154         authentication on OneDrive. If either this or
2155         --with-onedrive-client-id is empty, the feature will be disabled]),
2157 dnl ===================================================================
2158 dnl Do we want to use pre-build binary tarball for recompile
2159 dnl ===================================================================
2161 if test "$enable_library_bin_tar" = "yes" ; then
2162     USE_LIBRARY_BIN_TAR=TRUE
2163 else
2164     USE_LIBRARY_BIN_TAR=
2166 AC_SUBST(USE_LIBRARY_BIN_TAR)
2168 dnl ===================================================================
2169 dnl Test whether build target is Release Build
2170 dnl ===================================================================
2171 AC_MSG_CHECKING([whether build target is Release Build])
2172 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2173     AC_MSG_RESULT([no])
2174     ENABLE_RELEASE_BUILD=
2175 else
2176     AC_MSG_RESULT([yes])
2177     ENABLE_RELEASE_BUILD=TRUE
2179 AC_SUBST(ENABLE_RELEASE_BUILD)
2181 dnl ===================================================================
2182 dnl Test whether to sign Windows Build
2183 dnl ===================================================================
2184 AC_MSG_CHECKING([whether to sign windows build])
2185 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2186     AC_MSG_RESULT([yes])
2187     WINDOWS_BUILD_SIGNING="TRUE"
2188 else
2189     AC_MSG_RESULT([no])
2190     WINDOWS_BUILD_SIGNING="FALSE"
2192 AC_SUBST(WINDOWS_BUILD_SIGNING)
2194 dnl ===================================================================
2195 dnl MacOSX build and runtime environment options
2196 dnl ===================================================================
2198 AC_ARG_WITH(macosx-sdk,
2199     AS_HELP_STRING([--with-macosx-sdk=<version>],
2200         [Prefer a specific SDK for building.])
2201     [
2202                           If the requested SDK is not available, a search for the oldest one will be done.
2203                           With current Xcode versions, only the latest SDK is included, so this option is
2204                           not terribly useful. It works fine to build with a new SDK and run the result
2205                           on an older OS.
2207                           e. g.: --with-macosx-sdk=10.9
2209                           there are 3 options to control the MacOSX build:
2210                           --with-macosx-sdk (referred as 'sdk' below)
2211                           --with-macosx-version-min-required (referred as 'min' below)
2212                           --with-macosx-version-max-allowed (referred as 'max' below)
2214                           the connection between these value and the default they take is as follow:
2215                           ( ? means not specified on the command line, s means the SDK version found,
2216                           constraint: 8 <= x <= y <= z)
2218                           ==========================================
2219                            command line      || config result
2220                           ==========================================
2221                           min  | max  | sdk  || min  | max  | sdk  |
2222                           ?    | ?    | ?    || 10.9 | 10.s | 10.s |
2223                           ?    | ?    | 10.x || 10.9 | 10.x | 10.x |
2224                           ?    | 10.x | ?    || 10.9 | 10.s | 10.s |
2225                           ?    | 10.x | 10.y || 10.9 | 10.x | 10.y |
2226                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2227                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2228                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2229                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2232                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2233                           for a detailed technical explanation of these variables
2235                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2236     ],
2239 AC_ARG_WITH(macosx-version-min-required,
2240     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2241         [set the minimum OS version needed to run the built LibreOffice])
2242     [
2243                           e. g.: --with-macos-version-min-required=10.9
2244                           see --with-macosx-sdk for more info
2245     ],
2248 AC_ARG_WITH(macosx-version-max-allowed,
2249     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2250         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2251     [
2252                           e. g.: --with-macos-version-max-allowed=10.9
2253                           see --with-macosx-sdk for more info
2254     ],
2258 dnl ===================================================================
2259 dnl options for stuff used during cross-compilation build
2260 dnl Not quite superseded by --with-build-platform-configure-options.
2261 dnl TODO: check, if the "force" option is still needed anywhere.
2262 dnl ===================================================================
2264 AC_ARG_WITH(system-icu-for-build,
2265     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2266         [Use icu already on system for build tools (cross-compilation only).]))
2269 dnl ===================================================================
2270 dnl Check for incompatible options set by fuzzing, and reset those
2271 dnl automatically to working combinations
2272 dnl ===================================================================
2274 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2275         "$enable_dbus" != "$enable_avahi"; then
2276     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2277     enable_avahi=$enable_dbus
2280 dnl ===================================================================
2281 dnl check for required programs (grep, awk, sed, bash)
2282 dnl ===================================================================
2284 pathmunge ()
2286     if test -n "$1"; then
2287         if test "$build_os" = "cygwin"; then
2288             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2289                 PathFormat "$1"
2290                 new_path=`cygpath -sm "$formatted_path"`
2291             else
2292                 PathFormat "$1"
2293                 new_path=`cygpath -u "$formatted_path"`
2294             fi
2295         else
2296             new_path="$1"
2297         fi
2298         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2299             if test "$2" = "after"; then
2300                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2301             else
2302                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2303             fi
2304         fi
2305         unset new_path
2306     fi
2309 AC_PROG_AWK
2310 AC_PATH_PROG( AWK, $AWK)
2311 if test -z "$AWK"; then
2312     AC_MSG_ERROR([install awk to run this script])
2315 AC_PATH_PROG(BASH, bash)
2316 if test -z "$BASH"; then
2317     AC_MSG_ERROR([bash not found in \$PATH])
2319 AC_SUBST(BASH)
2321 AC_MSG_CHECKING([for GNU or BSD tar])
2322 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2323     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2324     if test $? -eq 0;  then
2325         GNUTAR=$a
2326         break
2327     fi
2328 done
2329 AC_MSG_RESULT($GNUTAR)
2330 if test -z "$GNUTAR"; then
2331     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2333 AC_SUBST(GNUTAR)
2335 AC_MSG_CHECKING([for tar's option to strip components])
2336 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2337 if test $? -eq 0; then
2338     STRIP_COMPONENTS="--strip-components"
2339 else
2340     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2341     if test $? -eq 0; then
2342         STRIP_COMPONENTS="--strip-path"
2343     else
2344         STRIP_COMPONENTS="unsupported"
2345     fi
2347 AC_MSG_RESULT($STRIP_COMPONENTS)
2348 if test x$STRIP_COMPONENTS = xunsupported; then
2349     AC_MSG_ERROR([you need a tar that is able to strip components.])
2351 AC_SUBST(STRIP_COMPONENTS)
2353 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2354 dnl desktop OSes from "mobile" ones.
2356 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2357 dnl In other words, that when building for an OS that is not a
2358 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2360 dnl Note the direction of the implication; there is no assumption that
2361 dnl cross-compiling would imply a non-desktop OS.
2363 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2364     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2365     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2366     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2369 # Whether to build "avmedia" functionality or not.
2371 if test -z "$enable_avmedia"; then
2372     enable_avmedia=yes
2375 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2376 if test "$enable_avmedia" = yes; then
2377     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2378 else
2379     USE_AVMEDIA_DUMMY='TRUE'
2381 AC_SUBST(USE_AVMEDIA_DUMMY)
2383 # Decide whether to build database connectivity stuff (including
2384 # Base) or not. We probably don't want to on non-desktop OSes.
2385 if test -z "$enable_database_connectivity"; then
2386     # --disable-database-connectivity is unfinished work in progress
2387     # and the iOS test app doesn't link if we actually try to use it.
2388     # if test $_os != iOS -a $_os != Android; then
2389     if test $_os != iOS; then
2390         enable_database_connectivity=yes
2391     fi
2394 if test "$enable_database_connectivity" = yes; then
2395     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2396     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2399 if test -z "$enable_extensions"; then
2400     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2401     if test $_os != iOS -a $_os != Android; then
2402         enable_extensions=yes
2403     fi
2406 if test "$enable_extensions" = yes; then
2407     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2408     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2411 if test -z "$enable_scripting"; then
2412     # Disable scripting for iOS unless specifically overridden
2413     # with --enable-scripting.
2414     if test $_os != iOS; then
2415         enable_scripting=yes
2416     fi
2419 DISABLE_SCRIPTING=''
2420 if test "$enable_scripting" = yes; then
2421     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2422     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2423 else
2424     DISABLE_SCRIPTING='TRUE'
2425     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2428 if test $_os = iOS -o $_os = Android; then
2429     # Disable dynamic_loading always for iOS and Android
2430     enable_dynamic_loading=no
2431 elif test -z "$enable_dynamic_loading"; then
2432     # Otherwise enable it unless speficically disabled
2433     enable_dynamic_loading=yes
2436 DISABLE_DYNLOADING=''
2437 if test "$enable_dynamic_loading" = yes; then
2438     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2439 else
2440     DISABLE_DYNLOADING='TRUE'
2442 AC_SUBST(DISABLE_DYNLOADING)
2444 # remenber SYSBASE value
2445 AC_SUBST(SYSBASE)
2447 dnl ===================================================================
2448 dnl  Sort out various gallery compilation options
2449 dnl ===================================================================
2450 AC_MSG_CHECKING([how to build and package galleries])
2451 if test -n "${with_galleries}"; then
2452     if test "$with_galleries" = "build"; then
2453         WITH_GALLERY_BUILD=TRUE
2454         AC_MSG_RESULT([build from source images internally])
2455     elif test "$with_galleries" = "no"; then
2456         WITH_GALLERY_BUILD=
2457         AC_MSG_RESULT([disable non-internal gallery build])
2458     else
2459         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2460     fi
2461 else
2462     if test $_os != iOS -a $_os != Android; then
2463         WITH_GALLERY_BUILD=TRUE
2464         AC_MSG_RESULT([internal src images for desktop])
2465     else
2466         WITH_GALLERY_BUILD=
2467         AC_MSG_RESULT([disable src image build])
2468     fi
2470 AC_SUBST(WITH_GALLERY_BUILD)
2472 dnl ===================================================================
2473 dnl  Checks if ccache is available
2474 dnl ===================================================================
2475 if test "$_os" = "WINNT"; then
2476     # on windows/VC build do not use ccache
2477     CCACHE=""
2478 elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2479     case "%$CC%$CXX%" in
2480     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2481     # assume that's good then
2482     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2483         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2484         ;;
2485     *)
2486         AC_PATH_PROG([CCACHE],[ccache],[not found])
2487         if test "$CCACHE" = "not found"; then
2488             CCACHE=""
2489         else
2490             # Need to check for ccache version: otherwise prevents
2491             # caching of the results (like "-x objective-c++" for Mac)
2492             if test $_os = Darwin -o $_os = iOS; then
2493                 # Check ccache version
2494                 AC_MSG_CHECKING([whether version of ccache is suitable])
2495                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2496                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2497                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2498                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2499                 else
2500                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2501                     CCACHE=""
2502                 fi
2503             fi
2504         fi
2505         ;;
2506     esac
2507 else
2508     CCACHE=""
2511 if test "$CCACHE" != ""; then
2512     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2513     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2514     if test "$ccache_size" = ""; then
2515         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2516         if test "$ccache_size" = ""; then
2517             ccache_size=0
2518         fi
2519         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2520         if test $ccache_size -lt 1024; then
2521             CCACHE=""
2522             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2523             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2524         else
2525             # warn that ccache may be too small for debug build
2526             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2527             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2528         fi
2529     else
2530         if test $ccache_size -lt 5; then
2531             #warn that ccache may be too small for debug build
2532             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2533             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2534         fi
2535     fi
2538 dnl ===================================================================
2539 dnl  Checks for C compiler,
2540 dnl  The check for the C++ compiler is later on.
2541 dnl ===================================================================
2542 if test "$_os" != "WINNT"; then
2543     GCC_HOME_SET="true"
2544     AC_MSG_CHECKING([gcc home])
2545     if test -z "$with_gcc_home"; then
2546         if test "$enable_icecream" = "yes"; then
2547             if test -d "/usr/lib/icecc/bin"; then
2548                 GCC_HOME="/usr/lib/icecc/"
2549             else
2550                 GCC_HOME="/opt/icecream/"
2551             fi
2552         else
2553             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2554             GCC_HOME_SET="false"
2555         fi
2556     else
2557         GCC_HOME="$with_gcc_home"
2558     fi
2559     AC_MSG_RESULT($GCC_HOME)
2560     AC_SUBST(GCC_HOME)
2562     if test "$GCC_HOME_SET" = "true"; then
2563         if test -z "$CC"; then
2564             CC="$GCC_HOME/bin/gcc"
2565         fi
2566         if test -z "$CXX"; then
2567             CXX="$GCC_HOME/bin/g++"
2568         fi
2569     fi
2572 COMPATH=`dirname "$CC"`
2573 if test "$COMPATH" = "."; then
2574     AC_PATH_PROGS(COMPATH, $CC)
2575     dnl double square bracket to get single because of M4 quote...
2576     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2578 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2580 dnl ===================================================================
2581 dnl Java support
2582 dnl ===================================================================
2583 AC_MSG_CHECKING([whether to build with Java support])
2584 if test "$with_java" != "no"; then
2585     if test "$DISABLE_SCRIPTING" = TRUE; then
2586         AC_MSG_RESULT([no, overridden by --disable-scripting])
2587         ENABLE_JAVA=""
2588         with_java=no
2589     else
2590         AC_MSG_RESULT([yes])
2591         ENABLE_JAVA="TRUE"
2592         AC_DEFINE(HAVE_FEATURE_JAVA)
2593     fi
2594 else
2595     AC_MSG_RESULT([no])
2596     ENABLE_JAVA=""
2599 AC_SUBST(ENABLE_JAVA)
2601 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2603 dnl ENABLE_JAVA="" indicate no Java support at all
2605 dnl ===================================================================
2606 dnl Check OS X SDK and compiler
2607 dnl ===================================================================
2609 if test $_os = Darwin -o $_os = iOS; then
2611     # If no --with-macosx-sdk option is given, look for one
2613     # The intent is that for "most" Mac-based developers, a suitable
2614     # SDK will be found automatically without any configure options.
2616     # For developers with a current Xcode, the lowest-numbered SDK
2617     # higher than or equal to the minimum required should be found.
2619     AC_MSG_CHECKING([what Mac OS X SDK to use])
2620     for _macosx_sdk in ${with_macosx_sdk-10.14 10.13 10.12}; do
2621         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2622         if test -d "$MACOSX_SDK_PATH"; then
2623             with_macosx_sdk="${_macosx_sdk}"
2624             break
2625         else
2626             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2627             if test -d "$MACOSX_SDK_PATH"; then
2628                 with_macosx_sdk="${_macosx_sdk}"
2629                 break
2630             fi
2631         fi
2632     done
2633     if test ! -d "$MACOSX_SDK_PATH"; then
2634         AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2635     fi
2637     if test $_os = iOS; then
2638         if test "$enable_ios_simulator" = "yes"; then
2639             useos=iphonesimulator
2640         else
2641             useos=iphoneos
2642         fi
2643         MACOSX_SDK_PATH=`xcrun --sdk ${useos} --show-sdk-path 2> /dev/null`
2644     fi
2645     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2648     case $with_macosx_sdk in
2649     10.9)
2650         MACOSX_SDK_VERSION=1090
2651         ;;
2652     10.10)
2653         MACOSX_SDK_VERSION=101000
2654         ;;
2655     10.11)
2656         MACOSX_SDK_VERSION=101100
2657         ;;
2658     10.12)
2659         MACOSX_SDK_VERSION=101200
2660         ;;
2661     10.13)
2662         MACOSX_SDK_VERSION=101300
2663         ;;
2664     10.14)
2665         MACOSX_SDK_VERSION=101400
2666         ;;
2667     *)
2668         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.9--13])
2669         ;;
2670     esac
2672     if test "$with_macosx_version_min_required" = "" ; then
2673         with_macosx_version_min_required="10.9";
2674     fi
2676     if test "$with_macosx_version_max_allowed" = "" ; then
2677         with_macosx_version_max_allowed="$with_macosx_sdk"
2678     fi
2680     # export this so that "xcrun" invocations later return matching values
2681     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2682     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2683     export DEVELOPER_DIR
2684     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2685     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2687     case "$with_macosx_version_min_required" in
2688     10.9)
2689         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2690         ;;
2691     10.10)
2692         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2693         ;;
2694     10.11)
2695         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2696         ;;
2697     10.12)
2698         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2699         ;;
2700     10.13)
2701         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2702         ;;
2703     10.14)
2704         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2705         ;;
2706     *)
2707         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.9--13])
2708         ;;
2709     esac
2710     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2712     LIBTOOL=/usr/bin/libtool
2713     INSTALL_NAME_TOOL=install_name_tool
2714     if test -z "$save_CC"; then
2715         AC_MSG_CHECKING([what compiler to use])
2716         stdlib=-stdlib=libc++
2717         if test "$ENABLE_LTO" = TRUE; then
2718             lto=-flto
2719         fi
2720         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2721         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2722         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2723         AR=`xcrun -find ar`
2724         NM=`xcrun -find nm`
2725         STRIP=`xcrun -find strip`
2726         LIBTOOL=`xcrun -find libtool`
2727         RANLIB=`xcrun -find ranlib`
2728         AC_MSG_RESULT([$CC and $CXX])
2729     fi
2731     case "$with_macosx_version_max_allowed" in
2732     10.9)
2733         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2734         ;;
2735     10.10)
2736         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2737         ;;
2738     10.11)
2739         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2740         ;;
2741     10.12)
2742         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2743         ;;
2744     10.13)
2745         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2746         ;;
2747     10.14)
2748         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2749         ;;
2750     *)
2751         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.9--13])
2752         ;;
2753     esac
2755     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2756     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2757         AC_MSG_RESULT([$MAC_OS_X_VERSION_MIN_REQUIRED])
2758         AC_MSG_RESULT([$MAC_OS_X_VERSION_MAX_REQUIRED])
2759         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2760     else
2761         AC_MSG_RESULT([ok])
2762     fi
2764     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2765     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2766         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2767     else
2768         AC_MSG_RESULT([ok])
2769     fi
2770     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2771     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2773     AC_MSG_CHECKING([whether to do code signing])
2775     if test "$enable_macosx_code_signing" = yes; then
2776         # By default use the first suitable certificate (?).
2778         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2779         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2780         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2781         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2782         # "Developer ID Application" one.
2784         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2785         if test -n "$identity"; then
2786             MACOSX_CODESIGNING_IDENTITY=$identity
2787             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2788             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2789         else
2790             AC_MSG_ERROR([cannot determine identity to use])
2791         fi
2792     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2793         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2794         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2795         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2796     else
2797         AC_MSG_RESULT([no])
2798     fi
2800     AC_MSG_CHECKING([whether to create a Mac App Store package])
2802     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2803         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2804     elif test "$enable_macosx_package_signing" = yes; then
2805         # By default use the first suitable certificate.
2806         # It should be a "3rd Party Mac Developer Installer" one
2808         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2809         if test -n "$identity"; then
2810             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2811             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2812             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2813         else
2814             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2815         fi
2816     elif test -n "$enable_macosx_package_signing"; then
2817         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2818         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2819         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2820     else
2821         AC_MSG_RESULT([no])
2822     fi
2824     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2825         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2826     fi
2828     AC_MSG_CHECKING([whether to sandbox the application])
2830     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2831         AC_MSG_ERROR([OS X sandboxing requires code signing])
2832     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2833         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2834     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2835         ENABLE_MACOSX_SANDBOX=TRUE
2836         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2837         AC_MSG_RESULT([yes])
2838     else
2839         AC_MSG_RESULT([no])
2840     fi
2842     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2843     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2844     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2846 AC_SUBST(MACOSX_SDK_PATH)
2847 AC_SUBST(MACOSX_SDK_VERSION)
2848 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2849 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2850 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
2851 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2852 AC_SUBST(INSTALL_NAME_TOOL)
2853 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2854 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2855 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2856 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2857 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2859 dnl ===================================================================
2860 dnl Check iOS SDK and compiler
2861 dnl ===================================================================
2863 if test $_os = iOS; then
2864     AC_MSG_CHECKING([what iOS SDK to use])
2865     current_sdk_ver=12.1
2866     if test "$enable_ios_simulator" = "yes"; then
2867         platform=iPhoneSimulator
2868         versionmin=-mios-simulator-version-min=$current_sdk_ver
2869     else
2870         platform=iPhoneOS
2871         versionmin=-miphoneos-version-min=11.0
2872     fi
2873     xcode_developer=`xcode-select -print-path`
2875     for sdkver in $current_sdk_ver; do
2876         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2877         if test -d $t; then
2878             ios_sdk=$sdkver
2879             sysroot=$t
2880             break
2881         fi
2882     done
2884     if test -z "$sysroot"; then
2885         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
2886     fi
2888     AC_MSG_RESULT($sysroot)
2890     IOS_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
2891     IOS_DEPLOYMENT_VERSION=$current_sdk_ver
2893     # LTO is not really recommended for iOS builds,
2894     # the link time will be astronomical
2895     if test "$ENABLE_LTO" = TRUE; then
2896         lto=-flto
2897     fi
2899     stdlib="-stdlib=libc++"
2901     CC="`xcrun -find clang` -arch $host_cpu -isysroot $sysroot $lto $versionmin"
2902     CXX="`xcrun -find clang++` -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
2904     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2905     AR=`xcrun -find ar`
2906     NM=`xcrun -find nm`
2907     STRIP=`xcrun -find strip`
2908     LIBTOOL=`xcrun -find libtool`
2909     RANLIB=`xcrun -find ranlib`
2912 AC_SUBST(IOS_SDK)
2913 AC_SUBST(IOS_DEPLOYMENT_VERSION)
2915 AC_MSG_CHECKING([whether to treat the installation as read-only])
2917 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
2918         "$enable_extensions" != yes; then
2919     enable_readonly_installset=yes
2921 if test "$enable_readonly_installset" = yes; then
2922     AC_MSG_RESULT([yes])
2923     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
2924 else
2925     AC_MSG_RESULT([no])
2928 dnl ===================================================================
2929 dnl Structure of install set
2930 dnl ===================================================================
2932 if test $_os = Darwin; then
2933     LIBO_BIN_FOLDER=MacOS
2934     LIBO_ETC_FOLDER=Resources
2935     LIBO_LIBEXEC_FOLDER=MacOS
2936     LIBO_LIB_FOLDER=Frameworks
2937     LIBO_LIB_PYUNO_FOLDER=Resources
2938     LIBO_SHARE_FOLDER=Resources
2939     LIBO_SHARE_HELP_FOLDER=Resources/help
2940     LIBO_SHARE_JAVA_FOLDER=Resources/java
2941     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
2942     LIBO_SHARE_READMES_FOLDER=Resources/readmes
2943     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
2944     LIBO_SHARE_SHELL_FOLDER=Resources/shell
2945     LIBO_URE_BIN_FOLDER=MacOS
2946     LIBO_URE_ETC_FOLDER=Resources/ure/etc
2947     LIBO_URE_LIB_FOLDER=Frameworks
2948     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
2949     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
2950 elif test $_os = WINNT; then
2951     LIBO_BIN_FOLDER=program
2952     LIBO_ETC_FOLDER=program
2953     LIBO_LIBEXEC_FOLDER=program
2954     LIBO_LIB_FOLDER=program
2955     LIBO_LIB_PYUNO_FOLDER=program
2956     LIBO_SHARE_FOLDER=share
2957     LIBO_SHARE_HELP_FOLDER=help
2958     LIBO_SHARE_JAVA_FOLDER=program/classes
2959     LIBO_SHARE_PRESETS_FOLDER=presets
2960     LIBO_SHARE_READMES_FOLDER=readmes
2961     LIBO_SHARE_RESOURCE_FOLDER=program/resource
2962     LIBO_SHARE_SHELL_FOLDER=program/shell
2963     LIBO_URE_BIN_FOLDER=program
2964     LIBO_URE_ETC_FOLDER=program
2965     LIBO_URE_LIB_FOLDER=program
2966     LIBO_URE_MISC_FOLDER=program
2967     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
2968 else
2969     LIBO_BIN_FOLDER=program
2970     LIBO_ETC_FOLDER=program
2971     LIBO_LIBEXEC_FOLDER=program
2972     LIBO_LIB_FOLDER=program
2973     LIBO_LIB_PYUNO_FOLDER=program
2974     LIBO_SHARE_FOLDER=share
2975     LIBO_SHARE_HELP_FOLDER=help
2976     LIBO_SHARE_JAVA_FOLDER=program/classes
2977     LIBO_SHARE_PRESETS_FOLDER=presets
2978     LIBO_SHARE_READMES_FOLDER=readmes
2979     if test "$enable_fuzzers" != yes; then
2980         LIBO_SHARE_RESOURCE_FOLDER=program/resource
2981     else
2982         LIBO_SHARE_RESOURCE_FOLDER=resource
2983     fi
2984     LIBO_SHARE_SHELL_FOLDER=program/shell
2985     LIBO_URE_BIN_FOLDER=program
2986     LIBO_URE_ETC_FOLDER=program
2987     LIBO_URE_LIB_FOLDER=program
2988     LIBO_URE_MISC_FOLDER=program
2989     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
2991 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
2992 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
2993 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
2994 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
2995 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
2996 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
2997 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
2998 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
2999 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3000 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3001 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3002 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3003 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3004 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3005 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3006 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3008 # Not all of them needed in config_host.mk, add more if need arises
3009 AC_SUBST(LIBO_BIN_FOLDER)
3010 AC_SUBST(LIBO_ETC_FOLDER)
3011 AC_SUBST(LIBO_LIB_FOLDER)
3012 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3013 AC_SUBST(LIBO_SHARE_FOLDER)
3014 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3015 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3016 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3017 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3018 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3019 AC_SUBST(LIBO_URE_BIN_FOLDER)
3020 AC_SUBST(LIBO_URE_ETC_FOLDER)
3021 AC_SUBST(LIBO_URE_LIB_FOLDER)
3022 AC_SUBST(LIBO_URE_MISC_FOLDER)
3023 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3025 dnl ===================================================================
3026 dnl Windows specific tests and stuff
3027 dnl ===================================================================
3029 reg_get_value()
3031     # Return value: $regvalue
3032     unset regvalue
3034     local _regentry="/proc/registry${1}/${2}"
3035     if test -f "$_regentry"; then
3036         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3037         # Registry keys read via /proc/registry* are always \0 terminated!
3038         local _regvalue=$(tr -d '\0' < "$_regentry")
3039         if test $? -eq 0; then
3040             regvalue=$_regvalue
3041         fi
3042     fi
3045 # Get a value from the 32-bit side of the Registry
3046 reg_get_value_32()
3048     reg_get_value "32" "$1"
3051 # Get a value from the 64-bit side of the Registry
3052 reg_get_value_64()
3054     reg_get_value "64" "$1"
3057 if test "$_os" = "WINNT"; then
3058     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3059     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3060         AC_MSG_RESULT([no])
3061         WINDOWS_SDK_ARCH="x86"
3062     else
3063         AC_MSG_RESULT([yes])
3064         WINDOWS_SDK_ARCH="x64"
3065         BITNESS_OVERRIDE=64
3066     fi
3068 AC_SUBST(WINDOWS_SDK_ARCH)
3069 if test "$_os" = "iOS"; then
3070     cross_compiling="yes"
3073 if test "$cross_compiling" = "yes"; then
3074     export CROSS_COMPILING=TRUE
3075 else
3076     CROSS_COMPILING=
3077     BUILD_TYPE="$BUILD_TYPE NATIVE"
3079 AC_SUBST(CROSS_COMPILING)
3081 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3082 if test "$GCC" = "yes"; then
3083     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
3084     bsymbolic_functions_ldflags_save=$LDFLAGS
3085     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3086     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3087 #include <stdio.h>
3088         ],[
3089 printf ("hello world\n");
3090         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3091     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3092         AC_MSG_RESULT( found )
3093     else
3094         AC_MSG_RESULT( not found )
3095     fi
3096     LDFLAGS=$bsymbolic_functions_ldflags_save
3098 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3100 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3101 # NOTE: must _not_ be used for bundled external libraries!
3102 ISYSTEM=
3103 if test "$GCC" = "yes"; then
3104     AC_MSG_CHECKING( for -isystem )
3105     save_CFLAGS=$CFLAGS
3106     CFLAGS="$CFLAGS -Werror"
3107     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3108     CFLAGS=$save_CFLAGS
3109     if test -n "$ISYSTEM"; then
3110         AC_MSG_RESULT(yes)
3111     else
3112         AC_MSG_RESULT(no)
3113     fi
3115 if test -z "$ISYSTEM"; then
3116     # fall back to using -I
3117     ISYSTEM=-I
3119 AC_SUBST(ISYSTEM)
3121 dnl ===================================================================
3122 dnl  Check which Visual Studio compiler is used
3123 dnl ===================================================================
3125 map_vs_year_to_version()
3127     # Return value: $vsversion
3129     unset vsversion
3131     case $1 in
3132     2015)
3133         vsversion=14.0;;
3134     2017)
3135         vsversion=15.0;;
3136     *)
3137         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3138     esac
3141 vs_versions_to_check()
3143     # Args: $1 (optional) : versions to check, in the order of preference
3144     # Return value: $vsversions
3146     unset vsversions
3148     if test -n "$1"; then
3149         map_vs_year_to_version "$1"
3150         vsversions=$vsversion
3151     else
3152         # By default we prefer 2015/2017, in this order
3153         vsversions="14.0 15.0"
3154     fi
3157 win_get_env_from_vsvars32bat()
3159     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3160     if test $vcnum = "150"; then
3161       # Also seems to be located in another directory under the same name: vsvars32.bat
3162       # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3163       printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3164     else
3165       printf '@call "%s/../Common7/Tools/vsvars32.bat"\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3166     fi
3167     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3168     chmod +x $WRAPPERBATCHFILEPATH
3169     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3170     rm -f $WRAPPERBATCHFILEPATH
3171     printf '%s' "$_win_get_env_from_vsvars32bat"
3174 find_ucrt()
3176     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3177     if test -n "$regvalue"; then
3178         PathFormat "$regvalue"
3179         UCRTSDKDIR=$formatted_path
3180         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3181         UCRTVERSION=$regvalue
3182         # Rest if not exist
3183         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3184           UCRTSDKDIR=
3185         fi
3186     fi
3187     if test -z "$UCRTSDKDIR"; then
3188         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3189         if test "$vcnum" = "150"; then
3190           ide_env_file="${ide_env_dir}VsDevCmd.bat"
3191         else
3192           ide_env_file="${ide_env_dir}/vsvars32.bat"
3193         fi
3194         if test -f "$ide_env_file"; then
3195             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3196             UCRTSDKDIR=$formatted_path
3197             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3198             dnl Hack needed at least by tml:
3199             if test "$UCRTVERSION" = 10.0.15063.0 \
3200                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3201                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3202             then
3203                 UCRTVERSION=10.0.14393.0
3204             fi
3205         else
3206           AC_MSG_ERROR([No UCRT found])
3207         fi
3208     fi
3211 find_msvc()
3213     # Find Visual C++ 2015/2017
3214     # Args: $1 (optional) : The VS version year
3215     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3217     unset vctest vcnum vcnumwithdot vcbuildnumber
3219     vs_versions_to_check "$1"
3221     for ver in $vsversions; do
3222         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3223         if test -n "$regvalue"; then
3224             vctest=$regvalue
3225             break
3226         fi
3227         # As always MSVC 15.0 is special here
3228         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver
3229         if test -n "$regvalue"; then
3230             AC_MSG_RESULT([found: $regvalue])
3231             PathFormat "$regvalue"
3232             vctest=$formatted_path
3233             break
3234         fi
3235     done
3236     if test -n "$vctest"; then
3237         vcnumwithdot=$ver
3238         case "$vcnumwithdot" in
3239         14.0)
3240             vcyear=2015
3241             vcnum=140
3242             ;;
3243         15.0)
3244             vcyear=2017
3245             vcnum=150
3246             vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3247             ;;
3248         esac
3249     fi
3252 SOLARINC=
3253 MSBUILD_PATH=
3254 DEVENV=
3255 if test "$_os" = "WINNT"; then
3256     AC_MSG_CHECKING([Visual C++])
3258     find_msvc "$with_visual_studio"
3259     if test -z "$vctest"; then
3260         if test -n "$with_visual_studio"; then
3261             AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3262         else
3263             AC_MSG_ERROR([No Visual Studio 2015/2017 installation found])
3264         fi
3265     fi
3267     if test "$BITNESS_OVERRIDE" = ""; then
3268         if test -f "$vctest/bin/cl.exe"; then
3269             VC_PRODUCT_DIR=$vctest
3270         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3271             VC_PRODUCT_DIR=$vctest/VC
3272         else
3273             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3274         fi
3275     else
3276         if test -f "$vctest/bin/amd64/cl.exe"; then
3277             VC_PRODUCT_DIR=$vctest
3278         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3279             VC_PRODUCT_DIR=$vctest/VC
3280         else
3281             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])
3282         fi
3283     fi
3285     AC_MSG_CHECKING([for short pathname of VC product directory])
3286     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3287     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3289     UCRTSDKDIR=
3290     UCRTVERSION=
3292     AC_MSG_CHECKING([for UCRT location])
3293     find_ucrt
3294     # find_ucrt errors out if it doesn't find it
3295     AC_MSG_RESULT([found])
3296     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3297     ucrtincpath_formatted=$formatted_path
3298     # SOLARINC is used for external modules and must be set too.
3299     # And no, it's not sufficient to set SOLARINC only, as configure
3300     # itself doesn't honour it.
3301     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3302     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3303     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3304     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3306     AC_SUBST(UCRTSDKDIR)
3307     AC_SUBST(UCRTVERSION)
3309     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3310     # Find the proper version of MSBuild.exe to use based on the VS version
3311     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3312     if test -n "$regvalue" ; then
3313         AC_MSG_RESULT([found: $regvalue])
3314         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3315     else
3316         if test $vcnum = "150"; then
3317             if test "$BITNESS_OVERRIDE" = ""; then
3318                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3319             else
3320                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3321             fi
3322             MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3323         else
3324             AC_MSG_ERROR([No msbuild found, Visual Studio installation broken?])
3325         fi
3326         AC_MSG_RESULT([$regvalue])
3327     fi
3329     # Find the version of devenv.exe
3330     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3331     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3332     if test ! -e "$DEVENV"; then
3333         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3334     fi
3336     dnl ===========================================================
3337     dnl  Check for the corresponding mspdb*.dll
3338     dnl ===========================================================
3340     MSPDB_PATH=
3341     CL_DIR=
3342     CL_LIB=
3344     if test "$BITNESS_OVERRIDE" = ""; then
3345         if test "$vcnum" = "150"; then
3346             MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86"
3347             CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX86/x86
3348         else
3349             MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3350             CL_DIR=bin
3351         fi
3352     else
3353         if test "$vcnum" = "150"; then
3354             MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64"
3355             CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX64/x64
3356         else
3357             MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3358             CL_DIR=bin/amd64
3359         fi
3360     fi
3362     # MSVC 15.0 has libraries from 14.0?
3363     if test  "$vcnum" = "150"; then
3364         mspdbnum="140"
3365     else
3366         mspdbnum=$vcnum
3367     fi
3369     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3370         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3371     fi
3373     MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3374     MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3376     dnl The path needs to be added before cl is called
3377     PATH="$MSPDB_PATH:$PATH"
3379     AC_MSG_CHECKING([cl.exe])
3381     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3382     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3383     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3384     # is not enough?
3386     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3387     dnl needed when building CLR code:
3388     if test -z "$MSVC_CXX"; then
3389         if test "$BITNESS_OVERRIDE" = ""; then
3390             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3391                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3392             fi
3393         else
3394             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3395                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3396             fi
3397         fi
3399         # This gives us a posix path with 8.3 filename restrictions
3400         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3401     fi
3403     if test -z "$CC"; then
3404         CC=$MSVC_CXX
3405     fi
3406     if test "$BITNESS_OVERRIDE" = ""; then
3407         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3408         MSVC_CXX="$MSVC_CXX -arch:SSE"
3409     fi
3411     if test -n "$CC"; then
3412         # Remove /cl.exe from CC case insensitive
3413         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3414         if test "$BITNESS_OVERRIDE" = ""; then
3415            if test "$vcnum" = "150"; then
3416                COMPATH="$VC_PRODUCT_DIR"
3417            else
3418                COMPATH=`echo "$CC" | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3419            fi
3420         else
3421             if test -n "$VC_PRODUCT_DIR"; then
3422                 COMPATH=$VC_PRODUCT_DIR
3423             fi
3424         fi
3425         if test "$BITNESS_OVERRIDE" = ""; then
3426             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3427             CC="$CC -arch:SSE"
3428         fi
3430         if test "$vcnum" = "150"; then
3431             COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3432         fi
3434         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3436         PathFormat "$COMPATH"
3437         COMPATH="$formatted_path"
3439         VCVER=$vcnum
3440         MSVSVER=$vcyear
3442         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3443         # are always "better", we list them in reverse chronological order.
3445         case $vcnum in
3446         140)
3447             COMEX=19
3448             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3449             ;;
3450         150)
3451             COMEX=19
3452             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3453             ;;
3454         esac
3456         # The expectation is that --with-windows-sdk should not need to be used
3457         if test -n "$with_windows_sdk"; then
3458             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3459             *" "$with_windows_sdk" "*)
3460                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3461                 ;;
3462             *)
3463                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3464                 ;;
3465             esac
3466         fi
3468         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3469         ac_objext=obj
3470         ac_exeext=exe
3472     else
3473         AC_MSG_ERROR([Visual C++ not found after all, huh])
3474     fi
3476     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3477     # version of the Explorer extension (and maybe other small
3478     # bits, too) needed when installing a 32-bit LibreOffice on a
3479     # 64-bit OS. The 64-bit Explorer extension is a feature that
3480     # has been present since long in OOo. Don't confuse it with
3481     # building LibreOffice itself as 64-bit code.
3483     BUILD_X64=
3484     CXX_X64_BINARY=
3485     LINK_X64_BINARY=
3487     if test "$BITNESS_OVERRIDE" = ""; then
3488         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3489         if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3490             # Prefer native x64 compiler to cross-compiler, in case we are running
3491             # the build on a 64-bit OS.
3492             if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3493                 BUILD_X64=TRUE
3494                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3495                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3496             elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3497                 BUILD_X64=TRUE
3498                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3499                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3500             fi
3501         elif test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib"; then
3502             # nobody uses 32-bit OS to build, just pick the 64-bit compiler
3503             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3504                 BUILD_X64=TRUE
3505                 CXX_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"
3506                 LINK_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/link.exe"
3507             fi
3508         fi
3509         if test "$BUILD_X64" = TRUE; then
3510             AC_MSG_RESULT([found])
3511         else
3512             AC_MSG_RESULT([not found])
3513             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3514         fi
3515     fi
3516     AC_SUBST(BUILD_X64)
3518     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3519     AC_SUBST(CXX_X64_BINARY)
3520     AC_SUBST(LINK_X64_BINARY)
3522 AC_SUBST(VCVER)
3523 AC_SUBST(DEVENV)
3524 PathFormat "$MSPDB_PATH"
3525 MSPDB_PATH="$formatted_path"
3526 AC_SUBST(MSVC_CXX)
3529 # unowinreg.dll
3531 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3532 AC_SUBST(UNOWINREG_DLL)
3534 COM_IS_CLANG=
3535 AC_MSG_CHECKING([whether the compiler is actually Clang])
3536 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3537     #ifndef __clang__
3538     you lose
3539     #endif
3540     int foo=42;
3541     ]])],
3542     [AC_MSG_RESULT([yes])
3543      COM_IS_CLANG=TRUE],
3544     [AC_MSG_RESULT([no])])
3546 CC_PLAIN=$CC
3547 if test "$COM_IS_CLANG" = TRUE; then
3548     AC_MSG_CHECKING([the Clang version])
3549     if test "$_os" = WINNT; then
3550         dnl In which case, assume clang-cl:
3551         my_args="/EP /TC"
3552         dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3553         dnl clang-cl:
3554         CC_PLAIN=
3555         for i in $CC; do
3556             case $i in
3557             -FIIntrin.h)
3558                 ;;
3559             *)
3560                 CC_PLAIN="$CC_PLAIN $i"
3561                 ;;
3562             esac
3563         done
3564     else
3565         my_args="-E -P"
3566     fi
3567     clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args -`
3568     CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3569     CLANGVER=`echo $clang_version \
3570         | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3571     AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3572     AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3573     AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3575 AC_SUBST(COM_IS_CLANG)
3577 SHOWINCLUDES_PREFIX=
3578 if test "$_os" = WINNT; then
3579     dnl We need to guess the prefix of the -showIncludes output, it can be
3580     dnl localized
3581     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3582     echo "#include <stdlib.h>" > conftest.c
3583     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3584         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3585     rm -f conftest.c conftest.obj
3586     if test -z "$SHOWINCLUDES_PREFIX"; then
3587         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3588     else
3589         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3590     fi
3592 AC_SUBST(SHOWINCLUDES_PREFIX)
3595 # prefix C with ccache if needed
3597 if test "$CCACHE" != ""; then
3598     AC_MSG_CHECKING([whether $CC is already ccached])
3600     AC_LANG_PUSH([C])
3601     save_CFLAGS=$CFLAGS
3602     CFLAGS="$CFLAGS --ccache-skip -O2"
3603     dnl an empty program will do, we're checking the compiler flags
3604     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3605                       [use_ccache=yes], [use_ccache=no])
3606     if test $use_ccache = yes; then
3607         AC_MSG_RESULT([yes])
3608     else
3609         CC="$CCACHE $CC"
3610         AC_MSG_RESULT([no])
3611     fi
3612     CFLAGS=$save_CFLAGS
3613     AC_LANG_POP([C])
3616 # ===================================================================
3617 # check various GCC options that Clang does not support now but maybe
3618 # will somewhen in the future, check them even for GCC, so that the
3619 # flags are set
3620 # ===================================================================
3622 HAVE_GCC_GGDB2=
3623 HAVE_GCC_FINLINE_LIMIT=
3624 HAVE_GCC_FNO_INLINE=
3625 if test "$GCC" = "yes"; then
3626     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3627     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3628         # Option just ignored and silly warning that isn't a real
3629         # warning printed
3630         :
3631     else
3632         save_CFLAGS=$CFLAGS
3633         CFLAGS="$CFLAGS -Werror -ggdb2"
3634         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3635         CFLAGS=$save_CFLAGS
3636     fi
3637     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3638         AC_MSG_RESULT([yes])
3639     else
3640         AC_MSG_RESULT([no])
3641     fi
3643     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3644     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3645         # As above
3646         :
3647     else
3648         save_CFLAGS=$CFLAGS
3649         CFLAGS="$CFLAGS -Werror -finline-limit=0"
3650         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3651         CFLAGS=$save_CFLAGS
3652     fi
3653     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3654         AC_MSG_RESULT([yes])
3655     else
3656         AC_MSG_RESULT([no])
3657     fi
3659     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3660     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3661         # Ditto
3662         :
3663     else
3664         save_CFLAGS=$CFLAGS
3665         CFLAGS="$CFLAGS -Werror -fno-inline"
3666         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3667         CFLAGS=$save_CFLAGS
3668     fi
3669     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3670         AC_MSG_RESULT([yes])
3671     else
3672         AC_MSG_RESULT([no])
3673     fi
3675     if test "$host_cpu" = "m68k"; then
3676         AC_MSG_CHECKING([whether $CC supports -mlong-jump-table-offsets])
3677         save_CFLAGS=$CFLAGS
3678         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3679         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3680         CFLAGS=$save_CFLAGS
3681         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3682             AC_MSG_RESULT([yes])
3683         else
3684             AC_MSG_ERROR([no])
3685         fi
3686     fi
3688 AC_SUBST(HAVE_GCC_GGDB2)
3689 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3690 AC_SUBST(HAVE_GCC_FNO_INLINE)
3692 dnl ===================================================================
3693 dnl  Test the gcc version
3694 dnl ===================================================================
3695 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3696     AC_MSG_CHECKING([the GCC version])
3697     _gcc_version=`$CC -dumpversion`
3698     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3699         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3700     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3702     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3704     if test "$gcc_full_version" -lt 40801; then
3705         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.8.1])
3706     fi
3707 else
3708     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3709     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3710     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3711     # (which reports itself as GCC 4.2.1).
3712     GCC_VERSION=
3714 AC_SUBST(GCC_VERSION)
3716 dnl Set the ENABLE_DBGUTIL variable
3717 dnl ===================================================================
3718 AC_MSG_CHECKING([whether to build with additional debug utilities])
3719 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3720     ENABLE_DBGUTIL="TRUE"
3721     # this is an extra var so it can have different default on different MSVC
3722     # versions (in case there are version specific problems with it)
3723     MSVC_USE_DEBUG_RUNTIME="TRUE"
3725     AC_MSG_RESULT([yes])
3726     # cppunit and graphite expose STL in public headers
3727     if test "$with_system_cppunit" = "yes"; then
3728         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3729     else
3730         with_system_cppunit=no
3731     fi
3732     if test "$with_system_graphite" = "yes"; then
3733         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3734     else
3735         with_system_graphite=no
3736     fi
3737     if test "$with_system_mysql_cppconn" = "yes"; then
3738         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3739     else
3740         with_system_mysql_cppconn=no
3741     fi
3742     if test "$with_system_orcus" = "yes"; then
3743         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3744     else
3745         with_system_orcus=no
3746     fi
3747     if test "$with_system_libcmis" = "yes"; then
3748         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3749     else
3750         with_system_libcmis=no
3751     fi
3752     if test "$with_system_hunspell" = "yes"; then
3753         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3754     else
3755         with_system_hunspell=no
3756     fi
3757 else
3758     ENABLE_DBGUTIL=""
3759     MSVC_USE_DEBUG_RUNTIME=""
3760     AC_MSG_RESULT([no])
3762 AC_SUBST(ENABLE_DBGUTIL)
3763 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3765 dnl Set the ENABLE_DEBUG variable.
3766 dnl ===================================================================
3767 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3768     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3770 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3771     if test -z "$libo_fuzzed_enable_debug"; then
3772         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3773     else
3774         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3775         enable_debug=yes
3776     fi
3779 AC_MSG_CHECKING([whether to do a debug build])
3780 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3781     ENABLE_DEBUG="TRUE"
3782     if test -n "$ENABLE_DBGUTIL" ; then
3783         AC_MSG_RESULT([yes (dbgutil)])
3784     else
3785         AC_MSG_RESULT([yes])
3786     fi
3787 else
3788     ENABLE_DEBUG=""
3789     AC_MSG_RESULT([no])
3791 AC_SUBST(ENABLE_DEBUG)
3793 if test "$enable_sal_log" = yes; then
3794     ENABLE_SAL_LOG=TRUE
3796 AC_SUBST(ENABLE_SAL_LOG)
3798 dnl Selective debuginfo
3799 ENABLE_DEBUGINFO_FOR=
3800 if test -n "$ENABLE_DEBUG"; then
3801     AC_MSG_CHECKING([whether to use selective debuginfo])
3802     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3803         if test "$enable_selective_debuginfo" = "yes"; then
3804             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3805         fi
3806         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3807         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3808     else
3809         ENABLE_DEBUGINFO_FOR=all
3810         AC_MSG_RESULT([no, for all])
3811     fi
3812 else
3813     if test -n "$enable_selective_debuginfo"; then
3814         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
3815     fi
3817 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3819 dnl Check for enable symbols option
3820 dnl ===================================================================
3821 AC_MSG_CHECKING([whether to generate debug information])
3822 if test -z "$enable_symbols"; then
3823     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3824         enable_symbols=yes
3825     else
3826         enable_symbols=no
3827     fi
3829 if test "$enable_symbols" != no; then
3830     ENABLE_SYMBOLS=TRUE
3831     AC_MSG_RESULT([yes])
3832 else
3833     ENABLE_SYMBOLS=
3834     AC_MSG_RESULT([no])
3836 AC_SUBST(ENABLE_SYMBOLS)
3838 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
3839     # Building on Android with full symbols: without enough memory the linker never finishes currently.
3840     AC_MSG_CHECKING([whether enough memory is available for linking])
3841     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
3842     # Check for 15GB, as Linux reports a bit less than the physical memory size.
3843     if test -n "$mem_size" -a $mem_size -lt 15728640; then
3844         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
3845     else
3846         AC_MSG_RESULT([yes])
3847     fi
3850 AC_MSG_CHECKING([whether to compile with optimization flags])
3851 if test -z "$enable_optimized"; then
3852     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3853         enable_optimized=no
3854     else
3855         enable_optimized=yes
3856     fi
3858 if test "$enable_optimized" != no; then
3859     ENABLE_OPTIMIZED=TRUE
3860     AC_MSG_RESULT([yes])
3861 else
3862     ENABLE_OPTIMIZED=
3863     AC_MSG_RESULT([no])
3865 AC_SUBST(ENABLE_OPTIMIZED)
3868 # determine CPUNAME, OS, ...
3869 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
3871 case "$host_os" in
3873 aix*)
3874     COM=GCC
3875     CPUNAME=POWERPC
3876     USING_X11=TRUE
3877     OS=AIX
3878     RTL_OS=AIX
3879     RTL_ARCH=PowerPC
3880     PLATFORMID=aix_powerpc
3881     P_SEP=:
3882     ;;
3884 cygwin*)
3885     COM=MSC
3886     USING_X11=
3887     OS=WNT
3888     RTL_OS=Windows
3889     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3890         P_SEP=";"
3891     else
3892         P_SEP=:
3893     fi
3894     case "$host_cpu" in
3895     i*86|x86_64)
3896         if test "$BITNESS_OVERRIDE" = 64; then
3897             CPUNAME=X86_64
3898             RTL_ARCH=X86_64
3899             PLATFORMID=windows_x86_64
3900             WINDOWS_X64=1
3901             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
3902         else
3903             CPUNAME=INTEL
3904             RTL_ARCH=x86
3905             PLATFORMID=windows_x86
3906         fi
3907         ;;
3908     *)
3909         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3910         ;;
3911     esac
3912     SCPDEFS="$SCPDEFS -D_MSC_VER"
3913     ;;
3915 darwin*)
3916     COM=GCC
3917     USING_X11=
3918     OS=MACOSX
3919     RTL_OS=MacOSX
3920     P_SEP=:
3922     case "$host_cpu" in
3923     arm)
3924         AC_MSG_ERROR([Can't build 32-bit code for iOS])
3925         ;;
3926     arm64)
3927         OS=IOS
3928         if test "$enable_ios_simulator" = "yes"; then
3929             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
3930         else
3931             CPUNAME=ARM64
3932             RTL_ARCH=ARM_EABI
3933             PLATFORMID=ios_arm64
3934         fi
3935         ;;
3936     i*86)
3937         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
3938         ;;
3939     x86_64)
3940         if test "$enable_ios_simulator" = "yes"; then
3941             OS=IOS
3942         fi
3943         CPUNAME=X86_64
3944         RTL_ARCH=X86_64
3945         PLATFORMID=macosx_x86_64
3946         ;;
3947     *)
3948         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3949         ;;
3950     esac
3951     ;;
3953 dragonfly*)
3954     COM=GCC
3955     USING_X11=TRUE
3956     OS=DRAGONFLY
3957     RTL_OS=DragonFly
3958     P_SEP=:
3960     case "$host_cpu" in
3961     i*86)
3962         CPUNAME=INTEL
3963         RTL_ARCH=x86
3964         PLATFORMID=dragonfly_x86
3965         ;;
3966     x86_64)
3967         CPUNAME=X86_64
3968         RTL_ARCH=X86_64
3969         PLATFORMID=dragonfly_x86_64
3970         ;;
3971     *)
3972         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3973         ;;
3974     esac
3975     ;;
3977 freebsd*)
3978     COM=GCC
3979     USING_X11=TRUE
3980     RTL_OS=FreeBSD
3981     OS=FREEBSD
3982     P_SEP=:
3984     case "$host_cpu" in
3985     i*86)
3986         CPUNAME=INTEL
3987         RTL_ARCH=x86
3988         PLATFORMID=freebsd_x86
3989         ;;
3990     x86_64|amd64)
3991         CPUNAME=X86_64
3992         RTL_ARCH=X86_64
3993         PLATFORMID=freebsd_x86_64
3994         ;;
3995     *)
3996         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3997         ;;
3998     esac
3999     ;;
4001 kfreebsd*)
4002     COM=GCC
4003     USING_X11=TRUE
4004     OS=LINUX
4005     RTL_OS=kFreeBSD
4006     P_SEP=:
4008     case "$host_cpu" in
4010     i*86)
4011         CPUNAME=INTEL
4012         RTL_ARCH=x86
4013         PLATFORMID=kfreebsd_x86
4014         ;;
4015     x86_64)
4016         CPUNAME=X86_64
4017         RTL_ARCH=X86_64
4018         PLATFORMID=kfreebsd_x86_64
4019         ;;
4020     *)
4021         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4022         ;;
4023     esac
4024     ;;
4026 linux-gnu*)
4027     COM=GCC
4028     USING_X11=TRUE
4029     OS=LINUX
4030     RTL_OS=Linux
4031     P_SEP=:
4033     case "$host_cpu" in
4035     aarch64)
4036         CPUNAME=AARCH64
4037         PLATFORMID=linux_aarch64
4038         RTL_ARCH=AARCH64
4039         ;;
4040     alpha)
4041         CPUNAME=AXP
4042         RTL_ARCH=ALPHA
4043         PLATFORMID=linux_alpha
4044         ;;
4045     arm*)
4046         CPUNAME=ARM
4047         EPM_FLAGS="-a arm"
4048         RTL_ARCH=ARM_EABI
4049         PLATFORMID=linux_arm_eabi
4050         case "$host_cpu" in
4051         arm*-linux)
4052             RTL_ARCH=ARM_OABI
4053             PLATFORMID=linux_arm_oabi
4054             ;;
4055         esac
4056         ;;
4057     hppa)
4058         CPUNAME=HPPA
4059         RTL_ARCH=HPPA
4060         EPM_FLAGS="-a hppa"
4061         PLATFORMID=linux_hppa
4062         ;;
4063     i*86)
4064         CPUNAME=INTEL
4065         RTL_ARCH=x86
4066         PLATFORMID=linux_x86
4067         ;;
4068     ia64)
4069         CPUNAME=IA64
4070         RTL_ARCH=IA64
4071         PLATFORMID=linux_ia64
4072         ;;
4073     mips)
4074         CPUNAME=GODSON
4075         RTL_ARCH=MIPS_EB
4076         EPM_FLAGS="-a mips"
4077         PLATFORMID=linux_mips_eb
4078         ;;
4079     mips64)
4080         CPUNAME=GODSON64
4081         RTL_ARCH=MIPS64_EB
4082         EPM_FLAGS="-a mips64"
4083         PLATFORMID=linux_mips64_eb
4084         ;;
4085     mips64el)
4086         CPUNAME=GODSON64
4087         RTL_ARCH=MIPS64_EL
4088         EPM_FLAGS="-a mips64el"
4089         PLATFORMID=linux_mips64_el
4090         ;;
4091     mipsel)
4092         CPUNAME=GODSON
4093         RTL_ARCH=MIPS_EL
4094         EPM_FLAGS="-a mipsel"
4095         PLATFORMID=linux_mips_el
4096         ;;
4097     m68k)
4098         CPUNAME=M68K
4099         RTL_ARCH=M68K
4100         PLATFORMID=linux_m68k
4101         ;;
4102     powerpc)
4103         CPUNAME=POWERPC
4104         RTL_ARCH=PowerPC
4105         PLATFORMID=linux_powerpc
4106         ;;
4107     powerpc64)
4108         CPUNAME=POWERPC64
4109         RTL_ARCH=PowerPC_64
4110         PLATFORMID=linux_powerpc64
4111         ;;
4112     powerpc64le)
4113         CPUNAME=POWERPC64
4114         RTL_ARCH=PowerPC_64_LE
4115         PLATFORMID=linux_powerpc64_le
4116         ;;
4117     sparc)
4118         CPUNAME=SPARC
4119         RTL_ARCH=SPARC
4120         PLATFORMID=linux_sparc
4121         ;;
4122     sparc64)
4123         CPUNAME=SPARC64
4124         RTL_ARCH=SPARC64
4125         PLATFORMID=linux_sparc64
4126         ;;
4127     s390)
4128         CPUNAME=S390
4129         RTL_ARCH=S390
4130         PLATFORMID=linux_s390
4131         ;;
4132     s390x)
4133         CPUNAME=S390X
4134         RTL_ARCH=S390x
4135         PLATFORMID=linux_s390x
4136         ;;
4137     x86_64)
4138         CPUNAME=X86_64
4139         RTL_ARCH=X86_64
4140         PLATFORMID=linux_x86_64
4141         ;;
4142     *)
4143         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4144         ;;
4145     esac
4146     ;;
4148 linux-android*)
4149     COM=GCC
4150     USING_X11=
4151     OS=ANDROID
4152     RTL_OS=Android
4153     P_SEP=:
4155     case "$host_cpu" in
4157     arm|armel)
4158         CPUNAME=ARM
4159         RTL_ARCH=ARM_EABI
4160         PLATFORMID=android_arm_eabi
4161         ;;
4162     aarch64)
4163         CPUNAME=AARCH64
4164         RTL_ARCH=AARCH64
4165         PLATFORMID=android_aarch64
4166         ;;
4167     mips|mipsel)
4168         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4169         RTL_ARCH=MIPS_EL
4170         PLATFORMID=android_mips_el
4171         ;;
4172     i*86)
4173         CPUNAME=INTEL
4174         RTL_ARCH=x86
4175         PLATFORMID=android_x86
4176         ;;
4177     *)
4178         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4179         ;;
4180     esac
4181     ;;
4183 *netbsd*)
4184     COM=GCC
4185     USING_X11=TRUE
4186     OS=NETBSD
4187     RTL_OS=NetBSD
4188     P_SEP=:
4190     case "$host_cpu" in
4191     i*86)
4192         CPUNAME=INTEL
4193         RTL_ARCH=x86
4194         PLATFORMID=netbsd_x86
4195         ;;
4196     powerpc)
4197         CPUNAME=POWERPC
4198         RTL_ARCH=PowerPC
4199         PLATFORMID=netbsd_powerpc
4200         ;;
4201     sparc)
4202         CPUNAME=SPARC
4203         RTL_ARCH=SPARC
4204         PLATFORMID=netbsd_sparc
4205         ;;
4206     x86_64)
4207         CPUNAME=X86_64
4208         RTL_ARCH=X86_64
4209         PLATFORMID=netbsd_x86_64
4210         ;;
4211     *)
4212         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4213         ;;
4214     esac
4215     ;;
4217 openbsd*)
4218     COM=GCC
4219     USING_X11=TRUE
4220     OS=OPENBSD
4221     RTL_OS=OpenBSD
4222     P_SEP=:
4224     case "$host_cpu" in
4225     i*86)
4226         CPUNAME=INTEL
4227         RTL_ARCH=x86
4228         PLATFORMID=openbsd_x86
4229         ;;
4230     x86_64)
4231         CPUNAME=X86_64
4232         RTL_ARCH=X86_64
4233         PLATFORMID=openbsd_x86_64
4234         ;;
4235     *)
4236         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4237         ;;
4238     esac
4239     SOLARINC="$SOLARINC -I/usr/local/include"
4240     ;;
4242 solaris*)
4243     COM=GCC
4244     USING_X11=TRUE
4245     OS=SOLARIS
4246     RTL_OS=Solaris
4247     P_SEP=:
4249     case "$host_cpu" in
4250     i*86)
4251         CPUNAME=INTEL
4252         RTL_ARCH=x86
4253         PLATFORMID=solaris_x86
4254         ;;
4255     sparc)
4256         CPUNAME=SPARC
4257         RTL_ARCH=SPARC
4258         PLATFORMID=solaris_sparc
4259         ;;
4260     sparc64)
4261         CPUNAME=SPARC64
4262         RTL_ARCH=SPARC64
4263         PLATFORMID=solaris_sparc64
4264         ;;
4265     *)
4266         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4267         ;;
4268     esac
4269     SOLARINC="$SOLARINC -I/usr/local/include"
4270     ;;
4273     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4274     ;;
4275 esac
4277 if test "$with_x" = "no"; then
4278     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4281 ENABLE_HEADLESS=""
4282 if test "$enable_gui" = "no"; then
4283     if test "$USING_X11" != TRUE; then
4284         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4285     fi
4286     USING_X11=
4287     ENABLE_HEADLESS=TRUE
4288     AC_DEFINE(HAVE_FEATURE_UI,0)
4289     test_cairo=yes
4291 AC_SUBST(ENABLE_HEADLESS)
4293 WORKDIR="${BUILDDIR}/workdir"
4294 INSTDIR="${BUILDDIR}/instdir"
4295 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4296 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4297 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4298 AC_SUBST(COM)
4299 AC_SUBST(CPUNAME)
4300 AC_SUBST(RTL_OS)
4301 AC_SUBST(RTL_ARCH)
4302 AC_SUBST(EPM_FLAGS)
4303 AC_SUBST(USING_X11)
4304 AC_SUBST([INSTDIR])
4305 AC_SUBST([INSTROOT])
4306 AC_SUBST([INSTROOTBASE])
4307 AC_SUBST(OS)
4308 AC_SUBST(P_SEP)
4309 AC_SUBST(WORKDIR)
4310 AC_SUBST(PLATFORMID)
4311 AC_SUBST(WINDOWS_X64)
4312 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4314 dnl ===================================================================
4315 dnl Test which package format to use
4316 dnl ===================================================================
4317 AC_MSG_CHECKING([which package format to use])
4318 if test -n "$with_package_format" -a "$with_package_format" != no; then
4319     for i in $with_package_format; do
4320         case "$i" in
4321         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4322             ;;
4323         *)
4324             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4325 aix - AIX software distribution
4326 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4327 deb - Debian software distribution
4328 pkg - Solaris software distribution
4329 rpm - RedHat software distribution
4331 LibreOffice additionally supports:
4332 archive - .tar.gz or .zip
4333 dmg - Mac OS X .dmg
4334 installed - installation tree
4335 msi - Windows .msi
4336         ])
4337             ;;
4338         esac
4339     done
4340     PKGFORMAT="$with_package_format"
4341     AC_MSG_RESULT([$PKGFORMAT])
4342 else
4343     PKGFORMAT=
4344     AC_MSG_RESULT([none])
4346 AC_SUBST(PKGFORMAT)
4348 dnl ===================================================================
4349 dnl Set up a different compiler to produce tools to run on the build
4350 dnl machine when doing cross-compilation
4351 dnl ===================================================================
4353 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4354 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4355 if test "$cross_compiling" = "yes"; then
4356     AC_MSG_CHECKING([for BUILD platform configuration])
4357     echo
4358     rm -rf CONF-FOR-BUILD config_build.mk
4359     mkdir CONF-FOR-BUILD
4360     # Here must be listed all files needed when running the configure script. In particular, also
4361     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4362     # keep them in the same order as there.
4363     (cd $SRC_ROOT && tar cf - \
4364         config.guess \
4365         bin/get_config_variables \
4366         solenv/bin/getcompver.awk \
4367         solenv/inc/langlist.mk \
4368         download.lst \
4369         config_host.mk.in \
4370         config_host_lang.mk.in \
4371         Makefile.in \
4372         lo.xcent.in \
4373         bin/bffvalidator.sh.in \
4374         bin/odfvalidator.sh.in \
4375         bin/officeotron.sh.in \
4376         instsetoo_native/util/openoffice.lst.in \
4377         setup_native/source/packinfo/finals_instsetoo.txt.in \
4378         config_host/*.in \
4379         sysui/desktop/macosx/Info.plist.in) \
4380     | (cd CONF-FOR-BUILD && tar xf -)
4381     cp configure CONF-FOR-BUILD
4382     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4383     (
4384     unset COM USING_X11 OS CPUNAME
4385     unset CC CXX SYSBASE CFLAGS
4386     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4387     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4388     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4389     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4390     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4391     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4392     cd CONF-FOR-BUILD
4393     sub_conf_opts=""
4394     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4395     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4396     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4397     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4398     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4399     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4400     # Don't bother having configure look for stuff not needed for the build platform anyway
4401     ./configure \
4402         --disable-cups \
4403         --disable-gtk3 \
4404         --disable-pdfimport \
4405         --disable-postgresql-sdbc \
4406         --with-parallelism="$with_parallelism" \
4407         --without-doxygen \
4408         --without-java \
4409         $sub_conf_opts \
4410         --srcdir=$srcdir \
4411         2>&1 | sed -e 's/^/    /'
4412     test -f ./config_host.mk 2>/dev/null || exit
4413     cp config_host.mk ../config_build.mk
4414     cp config_host_lang.mk ../config_build_lang.mk
4415     mv config.log ../config.Build.log
4416     mkdir -p ../config_build
4417     mv config_host/*.h ../config_build
4418     . ./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
4420     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
4421         VV='$'$V
4422         VV=`eval "echo $VV"`
4423         if test -n "$VV"; then
4424             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4425             echo "$line" >>build-config
4426         fi
4427     done
4429     for V in INSTDIR INSTROOT WORKDIR; do
4430         VV='$'$V
4431         VV=`eval "echo $VV"`
4432         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4433         if test -n "$VV"; then
4434             line="${V}_FOR_BUILD='$VV'"
4435             echo "$line" >>build-config
4436         fi
4437     done
4439     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4440     echo "$line" >>build-config
4442     )
4443     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4444     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])
4445     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4446              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4448     eval `cat CONF-FOR-BUILD/build-config`
4450     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4452     rm -rf CONF-FOR-BUILD
4453 else
4454     OS_FOR_BUILD="$OS"
4455     CC_FOR_BUILD="$CC"
4456     CXX_FOR_BUILD="$CXX"
4457     INSTDIR_FOR_BUILD="$INSTDIR"
4458     INSTROOT_FOR_BUILD="$INSTROOT"
4459     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4460     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4461     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4462     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4463     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4464     WORKDIR_FOR_BUILD="$WORKDIR"
4466 AC_SUBST(OS_FOR_BUILD)
4467 AC_SUBST(INSTDIR_FOR_BUILD)
4468 AC_SUBST(INSTROOT_FOR_BUILD)
4469 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4470 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4471 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4472 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4473 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4474 AC_SUBST(WORKDIR_FOR_BUILD)
4476 dnl ===================================================================
4477 dnl Check for syslog header
4478 dnl ===================================================================
4479 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4481 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4482 dnl ===================================================================
4483 AC_MSG_CHECKING([whether to turn warnings to errors])
4484 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4485     ENABLE_WERROR="TRUE"
4486     AC_MSG_RESULT([yes])
4487 else
4488     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4489         ENABLE_WERROR="TRUE"
4490         AC_MSG_RESULT([yes])
4491     else
4492         AC_MSG_RESULT([no])
4493     fi
4495 AC_SUBST(ENABLE_WERROR)
4497 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4498 dnl ===================================================================
4499 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4500 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4501     ASSERT_ALWAYS_ABORT="TRUE"
4502     AC_MSG_RESULT([yes])
4503 else
4504     ASSERT_ALWAYS_ABORT="FALSE"
4505     AC_MSG_RESULT([no])
4507 AC_SUBST(ASSERT_ALWAYS_ABORT)
4509 # Determine whether to use ooenv for the instdir installation
4510 # ===================================================================
4511 if test $_os != "WINNT" -a $_os != "Darwin"; then
4512     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4513     if test "$enable_ooenv" = "no"; then
4514         AC_MSG_RESULT([no])
4515     else
4516         ENABLE_OOENV="TRUE"
4517         AC_MSG_RESULT([yes])
4518     fi
4520 AC_SUBST(ENABLE_OOENV)
4522 if test "$USING_X11" != TRUE; then
4523     # be sure to do not mess with unneeded stuff
4524     test_randr=no
4525     test_xrender=no
4526     test_cups=no
4527     test_dbus=no
4528     test_gtk=no
4529     build_gstreamer_1_0=no
4530     build_gstreamer_0_10=no
4531     test_kde4=no
4532     test_qt5=no
4533     enable_cairo_canvas=no
4536 dnl ===================================================================
4537 dnl check for cups support
4538 dnl ===================================================================
4539 ENABLE_CUPS=""
4541 if test "$enable_cups" = "no"; then
4542     test_cups=no
4545 AC_MSG_CHECKING([whether to enable CUPS support])
4546 if test "$test_cups" = "yes"; then
4547     ENABLE_CUPS="TRUE"
4548     AC_MSG_RESULT([yes])
4550     AC_MSG_CHECKING([whether cups support is present])
4551     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4552     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4553     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4554         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4555     fi
4557 else
4558     AC_MSG_RESULT([no])
4561 AC_SUBST(ENABLE_CUPS)
4563 # fontconfig checks
4564 if test "$test_fontconfig" = "yes"; then
4565     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4566     SYSTEM_FONTCONFIG=TRUE
4567     FilterLibs "${FONTCONFIG_LIBS}"
4568     FONTCONFIG_LIBS="${filteredlibs}"
4570 AC_SUBST(FONTCONFIG_CFLAGS)
4571 AC_SUBST(FONTCONFIG_LIBS)
4572 AC_SUBST([SYSTEM_FONTCONFIG])
4574 dnl whether to find & fetch external tarballs?
4575 dnl ===================================================================
4576 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4577    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4578        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4579    else
4580        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4581    fi
4583 if test -z "$TARFILE_LOCATION"; then
4584     if test -d "$SRC_ROOT/src" ; then
4585         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4586         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4587     fi
4588     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4589 else
4590     AbsolutePath "$TARFILE_LOCATION"
4591     PathFormat "${absolute_path}"
4592     TARFILE_LOCATION="${formatted_path}"
4594 AC_SUBST(TARFILE_LOCATION)
4596 AC_MSG_CHECKING([whether we want to fetch tarballs])
4597 if test "$enable_fetch_external" != "no"; then
4598     if test "$with_all_tarballs" = "yes"; then
4599         AC_MSG_RESULT([yes, all of them])
4600         DO_FETCH_TARBALLS="ALL"
4601     else
4602         AC_MSG_RESULT([yes, if we use them])
4603         DO_FETCH_TARBALLS="TRUE"
4604     fi
4605 else
4606     AC_MSG_RESULT([no])
4607     DO_FETCH_TARBALLS=
4609 AC_SUBST(DO_FETCH_TARBALLS)
4611 AC_MSG_CHECKING([whether to build help])
4612 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4613     BUILD_TYPE="$BUILD_TYPE HELP"
4614     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4615     case "$with_help" in
4616     "common")
4617         AC_MSG_RESULT([common only])
4618         ;;
4619     "html")
4620         ENABLE_HTMLHELP=TRUE
4621         AC_MSG_RESULT([HTML])
4622         ;;
4623     "online")
4624         ENABLE_HTMLHELP=TRUE
4625         HELP_ONLINE=TRUE
4626         AC_MSG_RESULT([HTML])
4627         ;;
4628     *)
4629         SCPDEFS="$SCPDEFS -DWITH_HELP"
4630         AC_MSG_RESULT([yes])
4631         ;;
4632     esac
4633 else
4634     AC_MSG_RESULT([no])
4636 AC_SUBST([ENABLE_HTMLHELP])
4637 AC_SUBST([HELP_ONLINE])
4639 dnl Test whether to include MySpell dictionaries
4640 dnl ===================================================================
4641 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4642 if test "$with_myspell_dicts" = "yes"; then
4643     AC_MSG_RESULT([yes])
4644     WITH_MYSPELL_DICTS=TRUE
4645     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4646     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4647 else
4648     AC_MSG_RESULT([no])
4649     WITH_MYSPELL_DICTS=
4651 AC_SUBST(WITH_MYSPELL_DICTS)
4653 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4654 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4655     if test "$with_system_dicts" = yes; then
4656         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4657     fi
4658     with_system_dicts=no
4661 AC_MSG_CHECKING([whether to use dicts from external paths])
4662 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4663     AC_MSG_RESULT([yes])
4664     SYSTEM_DICTS=TRUE
4665     AC_MSG_CHECKING([for spelling dictionary directory])
4666     if test -n "$with_external_dict_dir"; then
4667         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4668     else
4669         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4670         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4671             DICT_SYSTEM_DIR=file:///usr/share/myspell
4672         fi
4673     fi
4674     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4675     AC_MSG_CHECKING([for hyphenation patterns directory])
4676     if test -n "$with_external_hyph_dir"; then
4677         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4678     else
4679         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4680     fi
4681     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4682     AC_MSG_CHECKING([for thesaurus directory])
4683     if test -n "$with_external_thes_dir"; then
4684         THES_SYSTEM_DIR=file://$with_external_thes_dir
4685     else
4686         THES_SYSTEM_DIR=file:///usr/share/mythes
4687     fi
4688     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4689 else
4690     AC_MSG_RESULT([no])
4691     SYSTEM_DICTS=
4693 AC_SUBST(SYSTEM_DICTS)
4694 AC_SUBST(DICT_SYSTEM_DIR)
4695 AC_SUBST(HYPH_SYSTEM_DIR)
4696 AC_SUBST(THES_SYSTEM_DIR)
4698 dnl ===================================================================
4699 dnl enable pch by default on windows
4700 dnl enable it explicitly otherwise
4701 ENABLE_PCH=""
4702 if test "$enable_pch" = yes -a "$enable_compiler_plugins" = yes; then
4703     if test -z "$libo_fuzzed_enable_pch"; then
4704         AC_MSG_ERROR([--enable-pch cannot be used with --enable-compiler-plugins])
4705     else
4706         AC_MSG_NOTICE([Resetting --enable-pch=no])
4707         enable_pch=no
4708     fi
4711 AC_MSG_CHECKING([whether to enable pch feature])
4712 if test "$enable_pch" != "no"; then
4713     if test "$_os" = "WINNT"; then
4714         ENABLE_PCH="TRUE"
4715         AC_MSG_RESULT([yes])
4716     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4717         ENABLE_PCH="TRUE"
4718         AC_MSG_RESULT([yes])
4719     elif test -n "$enable_pch"; then
4720         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4721     else
4722         AC_MSG_RESULT([no])
4723     fi
4724 else
4725     AC_MSG_RESULT([no])
4727 AC_SUBST(ENABLE_PCH)
4729 TAB=`printf '\t'`
4731 AC_MSG_CHECKING([the GNU Make version])
4732 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4733 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4734 if test "$_make_longver" -ge "038200"; then
4735     AC_MSG_RESULT([$GNUMAKE $_make_version])
4737 elif test "$_make_longver" -ge "038100"; then
4738     if test "$build_os" = "cygwin"; then
4739         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4740     fi
4741     AC_MSG_RESULT([$GNUMAKE $_make_version])
4743     dnl ===================================================================
4744     dnl Search all the common names for sha1sum
4745     dnl ===================================================================
4746     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4747     if test -z "$SHA1SUM"; then
4748         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
4749     elif test "$SHA1SUM" = "openssl"; then
4750         SHA1SUM="openssl sha1"
4751     fi
4752     AC_MSG_CHECKING([for GNU Make bug 20033])
4753     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4754     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4755 A := \$(wildcard *.a)
4757 .PHONY: all
4758 all: \$(A:.a=.b)
4759 <TAB>@echo survived bug20033.
4761 .PHONY: setup
4762 setup:
4763 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4765 define d1
4766 @echo lala \$(1)
4767 @sleep 1
4768 endef
4770 define d2
4771 @echo tyty \$(1)
4772 @sleep 1
4773 endef
4775 %.b : %.a
4776 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4777 <TAB>\$(call d1,\$(CHECKSUM)),\
4778 <TAB>\$(call d2,\$(CHECKSUM)))
4780     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4781         no_parallelism_make="YES"
4782         AC_MSG_RESULT([yes, disable parallelism])
4783     else
4784         AC_MSG_RESULT([no, keep parallelism enabled])
4785     fi
4786     rm -rf $TESTGMAKEBUG20033
4787 else
4788     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4791 # find if gnumake support file function
4792 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
4793 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4794 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4795     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
4797 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4798 \$(file >test.txt,Success )
4800 .PHONY: all
4801 all:
4802 <TAB>@cat test.txt
4805 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4806 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4807     HAVE_GNUMAKE_FILE_FUNC=TRUE
4808     AC_MSG_RESULT([yes])
4809 else
4810     AC_MSG_RESULT([no])
4812 rm -rf $TESTGMAKEFILEFUNC
4813 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4814 AC_SUBST(GNUMAKE_WIN_NATIVE)
4816 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
4817 STALE_MAKE=
4818 if test "$_make_ver_check" = ""; then
4819    STALE_MAKE=TRUE
4822 HAVE_LD_HASH_STYLE=FALSE
4823 WITH_LINKER_HASH_STYLE=
4824 AC_MSG_CHECKING([for --hash-style gcc linker support])
4825 if test "$GCC" = "yes"; then
4826     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4827         hash_styles="gnu sysv"
4828     elif test "$with_linker_hash_style" = "no"; then
4829         hash_styles=
4830     else
4831         hash_styles="$with_linker_hash_style"
4832     fi
4834     for hash_style in $hash_styles; do
4835         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4836         hash_style_ldflags_save=$LDFLAGS
4837         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
4839         AC_RUN_IFELSE([AC_LANG_PROGRAM(
4840             [
4841 #include <stdio.h>
4842             ],[
4843 printf ("");
4844             ])],
4845             [
4846                   HAVE_LD_HASH_STYLE=TRUE
4847                   WITH_LINKER_HASH_STYLE=$hash_style
4848             ],
4849             [HAVE_LD_HASH_STYLE=FALSE],
4850             [HAVE_LD_HASH_STYLE=FALSE])
4851         LDFLAGS=$hash_style_ldflags_save
4852     done
4854     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
4855         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
4856     else
4857         AC_MSG_RESULT( no )
4858     fi
4859     LDFLAGS=$hash_style_ldflags_save
4860 else
4861     AC_MSG_RESULT( no )
4863 AC_SUBST(HAVE_LD_HASH_STYLE)
4864 AC_SUBST(WITH_LINKER_HASH_STYLE)
4866 dnl ===================================================================
4867 dnl Check whether there's a Perl version available.
4868 dnl ===================================================================
4869 if test -z "$with_perl_home"; then
4870     AC_PATH_PROG(PERL, perl)
4871 else
4872     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
4873     _perl_path="$with_perl_home/bin/perl"
4874     if test -x "$_perl_path"; then
4875         PERL=$_perl_path
4876     else
4877         AC_MSG_ERROR([$_perl_path not found])
4878     fi
4881 dnl ===================================================================
4882 dnl Testing for Perl version 5 or greater.
4883 dnl $] is the Perl version variable, it is returned as an integer
4884 dnl ===================================================================
4885 if test "$PERL"; then
4886     AC_MSG_CHECKING([the Perl version])
4887     ${PERL} -e "exit($]);"
4888     _perl_version=$?
4889     if test "$_perl_version" -lt 5; then
4890         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
4891     fi
4892     AC_MSG_RESULT([Perl $_perl_version])
4893 else
4894     AC_MSG_ERROR([Perl not found, install Perl 5])
4897 dnl ===================================================================
4898 dnl Testing for required Perl modules
4899 dnl ===================================================================
4901 AC_MSG_CHECKING([for required Perl modules])
4902 if `$PERL -e 'use Cwd; use Digest::MD5'>/dev/null 2>&1`; then
4903     AC_MSG_RESULT([all modules found])
4904 else
4905     AC_MSG_RESULT([failed to find some modules])
4906     # Find out which modules are missing.
4907     if ! `$PERL -e 'use Cwd;'>/dev/null 2>&1`; then
4908         missing_perl_modules="$missing_perl_modules Cwd"
4909     fi
4910     if ! `$PERL -e 'use Digest::MD5;'>/dev/null 2>&1`; then
4911         missing_perl_modules="$missing_perl_modules Digest::MD5"
4912     fi
4913        AC_MSG_ERROR([
4914     The missing Perl modules are: $missing_perl_modules
4915     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
4918 dnl ===================================================================
4919 dnl Check for pkg-config
4920 dnl ===================================================================
4921 if test "$_os" != "WINNT"; then
4922     PKG_PROG_PKG_CONFIG
4925 if test "$_os" != "WINNT"; then
4927     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
4928     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
4929     # explicitly. Or put /path/to/compiler in PATH yourself.
4931     # Use wrappers for LTO
4932     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
4933         AC_CHECK_TOOL(AR,gcc-ar)
4934         AC_CHECK_TOOL(NM,gcc-nm)
4935         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
4936     else
4937         AC_CHECK_TOOL(AR,ar)
4938         AC_CHECK_TOOL(NM,nm)
4939         AC_CHECK_TOOL(RANLIB,ranlib)
4940     fi
4941     AC_CHECK_TOOL(OBJDUMP,objdump)
4942     AC_CHECK_TOOL(READELF,readelf)
4943     AC_CHECK_TOOL(STRIP,strip)
4944     if test "$_os" = "WINNT"; then
4945         AC_CHECK_TOOL(DLLTOOL,dlltool)
4946         AC_CHECK_TOOL(WINDRES,windres)
4947     fi
4949 AC_SUBST(AR)
4950 AC_SUBST(DLLTOOL)
4951 AC_SUBST(NM)
4952 AC_SUBST(OBJDUMP)
4953 AC_SUBST(PKG_CONFIG)
4954 AC_SUBST(RANLIB)
4955 AC_SUBST(READELF)
4956 AC_SUBST(STRIP)
4957 AC_SUBST(WINDRES)
4959 dnl ===================================================================
4960 dnl pkg-config checks on Mac OS X
4961 dnl ===================================================================
4963 if test $_os = Darwin; then
4964     AC_MSG_CHECKING([for bogus pkg-config])
4965     if test -n "$PKG_CONFIG"; then
4966         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
4967             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
4968         else
4969             if test "$enable_bogus_pkg_config" = "yes"; then
4970                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
4971             else
4972                 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.])
4973             fi
4974         fi
4975     else
4976         AC_MSG_RESULT([no, good])
4977     fi
4980 find_csc()
4982     # Return value: $csctest
4984     unset csctest
4986     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
4987     if test -n "$regvalue"; then
4988         csctest=$regvalue
4989         return
4990     fi
4993 find_al()
4995     # Return value: $altest
4997     unset altest
4999     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5000         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5001         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5002             altest=$regvalue
5003             return
5004         fi
5005     done
5007     # We need this additional check to detect 4.6.1 or above.
5008     for ver in 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5009         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5010         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5011             altest=$regvalue
5012             return
5013         fi
5015         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/WOW6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools"
5016         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5017             altest=$regvalue
5018             return
5019         fi
5020     done
5023 find_dotnetsdk46()
5025     unset frametest
5027     for ver in 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5028         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5029         if test -n "$regvalue"; then
5030             frametest=$regvalue
5031             return
5032         fi
5033         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5034         if test -n "$regvalue"; then
5035             frametest=$regvalue
5036             return
5037         fi
5038     done
5041 find_winsdk_version()
5043     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5044     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5046     unset winsdktest winsdkbinsubdir winsdklibsubdir
5048     case "$1" in
5049     7.*)
5050         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5051         if test -n "$regvalue"; then
5052             winsdktest=$regvalue
5053             winsdklibsubdir=.
5054             return
5055         fi
5056         ;;
5057     8.0|8.0A)
5058         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5059         if test -n "$regvalue"; then
5060             winsdktest=$regvalue
5061             winsdklibsubdir=win8
5062             return
5063         fi
5064         ;;
5065     8.1|8.1A)
5066         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5067         if test -n "$regvalue"; then
5068             winsdktest=$regvalue
5069             winsdklibsubdir=winv6.3
5070             return
5071         fi
5072         ;;
5073     10.0)
5074         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5075         if test -n "$regvalue"; then
5076             winsdktest=$regvalue
5077             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5078             if test -n "$regvalue"; then
5079                 winsdkbinsubdir="$regvalue".0
5080             fi
5081             winsdklibsubdir=$regvalue
5082             if test "$regvalue" = "10.0.14393"; then
5083                 winsdklibsubdir="10.0.14393.0"
5084             elif test "$regvalue" = "10.0.16299"; then
5085                 winsdklibsubdir="10.0.16299.0"
5086             elif test "$regvalue" = "10.0.15063"; then
5087                 winsdklibsubdir="10.0.15063.0"
5088             elif test "$regvalue" = "10.0.17134"; then
5089                 winsdklibsubdir="$regvalue.0"
5090             fi
5091             return
5092         fi
5093         ;;
5094     esac
5097 find_winsdk()
5099     # Return value: From find_winsdk_version
5101     unset winsdktest
5103     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5104         find_winsdk_version $ver
5105         if test -n "$winsdktest"; then
5106             return
5107         fi
5108     done
5111 find_msms()
5113     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5114     if test $VCVER = 150; then
5115         my_msm_files="Microsoft_VC141_CRT_x86.msm ${my_msm_files}"
5116     fi
5117     AC_MSG_CHECKING([for ${my_msm_files}])
5118     msmdir=
5119     for ver in 14.0 15.0; do
5120         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5121         if test -n "$regvalue"; then
5122             for f in ${my_msm_files}; do
5123                 if test -e "$regvalue/${f}"; then
5124                     msmdir=$regvalue
5125                     break
5126                 fi
5127             done
5128         fi
5129     done
5130     dnl Is the following fallback really necessary, or was it added in response
5131     dnl to never having started Visual Studio on a given machine, so the
5132     dnl registry keys checked above had presumably not yet been created?
5133     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5134     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5135     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5136     dnl expanding to "C:\Program Files\Common Files"), which would need
5137     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5138     dnl obtain its value from cygwin:
5139     if test -z "$msmdir"; then
5140         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5141         for f in ${my_msm_files}; do
5142             if test -e "$my_msm_dir/${f}"; then
5143                 msmdir=$my_msm_dir
5144             fi
5145         done
5146     fi
5148     dnl Starting from MSVC 15.0, merge modules are located in different directory
5149     if test $VCVER = 150; then
5150         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5151             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])
5152             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5153             for f in ${my_msm_files}; do
5154                 if test -e "$my_msm_dir/${f}"; then
5155                     msmdir=$my_msm_dir
5156                     break
5157                 fi
5158             done
5159         done
5160     fi
5162     if test -n "$msmdir"; then
5163         msmdir=`cygpath -m "$msmdir"`
5164         AC_MSG_RESULT([$msmdir])
5165     else
5166         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5167             AC_MSG_ERROR([not found])
5168         else
5169             AC_MSG_WARN([not found])
5170             add_warning "MSM none of ${my_msm_files} found"
5171         fi
5172     fi
5175 find_msvc_x64_dlls()
5177     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5178     if test "$VCVER" = 150; then
5179         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5180             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT])
5181             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5182                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5183                 break
5184             fi
5185             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5186                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5187                 break
5188             fi
5189         done
5190     fi
5191     msvcdlls="msvcp140.dll vcruntime140.dll"
5192     for dll in $msvcdlls; do
5193         if ! test -f "$msvcdllpath/$dll"; then
5194             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5195         fi
5196     done
5199 dnl =========================================
5200 dnl Check for the Windows  SDK.
5201 dnl =========================================
5202 if test "$_os" = "WINNT"; then
5203     AC_MSG_CHECKING([for Windows SDK])
5204     if test "$build_os" = "cygwin"; then
5205         find_winsdk
5206         WINDOWS_SDK_HOME=$winsdktest
5208         # normalize if found
5209         if test -n "$WINDOWS_SDK_HOME"; then
5210             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5211             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5212         fi
5214         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5215     fi
5217     if test -n "$WINDOWS_SDK_HOME"; then
5218         # Remove a possible trailing backslash
5219         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5221         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5222              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5223              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5224             have_windows_sdk_headers=yes
5225         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5226              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5227              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5228             have_windows_sdk_headers=yes
5229         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5230              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5231              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5232             have_windows_sdk_headers=yes
5233         else
5234             have_windows_sdk_headers=no
5235         fi
5237         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5238             have_windows_sdk_libs=yes
5239         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5240             have_windows_sdk_libs=yes
5241         else
5242             have_windows_sdk_libs=no
5243         fi
5245         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5246             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5247 the  Windows SDK are installed.])
5248         fi
5249     fi
5251     if test -z "$WINDOWS_SDK_HOME"; then
5252         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5253     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
5254         WINDOWS_SDK_VERSION=70
5255         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
5256     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5257         WINDOWS_SDK_VERSION=80
5258         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5259     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5260         WINDOWS_SDK_VERSION=81
5261         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5262     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5263         WINDOWS_SDK_VERSION=10
5264         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5265     else
5266         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5267     fi
5268     PathFormat "$WINDOWS_SDK_HOME"
5269     WINDOWS_SDK_HOME="$formatted_path"
5270     if test "$build_os" = "cygwin"; then
5271         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5272         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5273             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5274         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5275             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5276         fi
5277     fi
5279     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5280     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5281     dnl but not in v8.0), so allow this to be overridden with a
5282     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5283     dnl and configuration error if no WiLangId.vbs is found would arguably be
5284     dnl better, but I do not know under which conditions exactly it is needed by
5285     dnl msiglobal.pm:
5286     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5287         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5288         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5289             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5290         fi
5291         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5292             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5293         fi
5294         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5295             AC_MSG_WARN([WiLangId.vbs not found - building translated packages will fail])
5296             add_warning "WiLangId.vbs not found - building translated packages will fail"
5297         fi
5298     fi
5300 AC_SUBST(WINDOWS_SDK_HOME)
5301 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5302 AC_SUBST(WINDOWS_SDK_VERSION)
5303 AC_SUBST(WINDOWS_SDK_WILANGID)
5305 if test "$build_os" = "cygwin"; then
5306     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5307     dnl dir, it also determines that dir's path w/o an arch segment if any,
5308     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5309     AC_MSG_CHECKING([for midl.exe])
5311     find_winsdk
5312     if test -n "$winsdkbinsubdir" \
5313         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5314     then
5315         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5316         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5317     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5318         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5319         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5320     elif test -f "$winsdktest/Bin/midl.exe"; then
5321         MIDL_PATH=$winsdktest/Bin
5322         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5323     fi
5324     if test ! -f "$MIDL_PATH/midl.exe"; then
5325         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5326     else
5327         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5328     fi
5330     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5331     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5333     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5334          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5335          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5336          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5337     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5338          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5339          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5340          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5341     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5342          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5343          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5344          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5345     else
5346         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5347     fi
5349     dnl Check csc.exe
5350     AC_MSG_CHECKING([for csc.exe])
5351     find_csc
5352     if test -f "$csctest/csc.exe"; then
5353         CSC_PATH="$csctest"
5354     fi
5355     if test ! -f "$CSC_PATH/csc.exe"; then
5356         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5357     else
5358         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5359     fi
5361     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5363     dnl Check al.exe
5364     AC_MSG_CHECKING([for al.exe])
5365     find_winsdk
5366     if test -n "$winsdkbinsubdir" \
5367         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5368     then
5369         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5370     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5371         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5372     elif test -f "$winsdktest/Bin/al.exe"; then
5373         AL_PATH="$winsdktest/Bin"
5374     fi
5376     if test -z "$AL_PATH"; then
5377         find_al
5378         if test -f "$altest/bin/al.exe"; then
5379             AL_PATH="$altest/bin"
5380         elif test -f "$altest/al.exe"; then
5381             AL_PATH="$altest"
5382         fi
5383     fi
5384     if test ! -f "$AL_PATH/al.exe"; then
5385         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5386     else
5387         AC_MSG_RESULT([$AL_PATH/al.exe])
5388     fi
5390     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5392     dnl Check mscoree.lib / .NET Framework dir
5393     AC_MSG_CHECKING(.NET Framework)
5394     find_dotnetsdk46
5395     PathFormat "$frametest"
5396     frametest="$formatted_path"
5397     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5398         DOTNET_FRAMEWORK_HOME="$frametest"
5399     else
5400         find_winsdk
5401         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5402             DOTNET_FRAMEWORK_HOME="$winsdktest"
5403         fi
5404     fi
5405     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
5406         AC_MSG_ERROR([mscoree.lib not found])
5407     fi
5408     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5410     PathFormat "$MIDL_PATH"
5411     MIDL_PATH="$formatted_path"
5413     PathFormat "$AL_PATH"
5414     AL_PATH="$formatted_path"
5416     PathFormat "$DOTNET_FRAMEWORK_HOME"
5417     DOTNET_FRAMEWORK_HOME="$formatted_path"
5419     PathFormat "$CSC_PATH"
5420     CSC_PATH="$formatted_path"
5423 dnl ===================================================================
5424 dnl Check if stdc headers are available excluding MSVC.
5425 dnl ===================================================================
5426 if test "$_os" != "WINNT"; then
5427     AC_HEADER_STDC
5430 dnl ===================================================================
5431 dnl Testing for C++ compiler and version...
5432 dnl ===================================================================
5434 if test "$_os" != "WINNT"; then
5435     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5436     save_CXXFLAGS=$CXXFLAGS
5437     AC_PROG_CXX
5438     CXXFLAGS=$save_CXXFLAGS
5439 else
5440     if test -n "$CC" -a -z "$CXX"; then
5441         CXX="$CC"
5442     fi
5445 dnl At least MSVC 2015 Update 1 is known to sporadically emit warning C4592
5446 dnl ("implementation limitation" when defining OUStringLiteral variables in
5447 dnl vcl/source/app/IconThemeInfo.cxx), while Update 3 is known good, and it is
5448 dnl probably a good idea to require that anyway.  A reliable way to check for
5449 dnl MSVC 2015 Update 3 appears to be to check for support of C++17 nested
5450 dnl namespace definitions (which requires /std:c++latest to be enabled):
5451 if test "$COM" = MSC -a "$VCVER" = 140; then
5452     AC_MSG_CHECKING([whether MSVC 2015 compiler $MSVC_CXX is at least Update 3])
5453     save_CXX=$CXX
5454     save_CXXFLAGS=$CXXFLAGS
5455     CXX=$MSVC_CXX
5456     CXXFLAGS="$CXXFLAGS /std:c++latest"
5457     AC_LANG_PUSH([C++])
5458     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5459         namespace A::B {}
5460     ]])], [good=yes], [good=no])
5461     AC_LANG_POP([C++])
5462     CXX=$save_CXX
5463     CXXFLAGS=$save_CXXFLAGS
5464     AC_MSG_RESULT([$good])
5465     if test "$good" = no; then
5466         AC_MSG_ERROR([When using MSVC 2015, at least Update 3 must be installed])
5467     fi
5470 dnl check for GNU C++ compiler version
5471 if test "$GXX" = "yes"; then
5472     AC_MSG_CHECKING([the GNU C++ compiler version])
5474     _gpp_version=`$CXX -dumpversion`
5475     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5477     if test "$_gpp_majmin" -lt "401"; then
5478         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5479     else
5480         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5481     fi
5483     dnl see https://code.google.com/p/android/issues/detail?id=41770
5484     if test "$_gpp_majmin" -ge "401"; then
5485         glibcxx_threads=no
5486         AC_LANG_PUSH([C++])
5487         AC_REQUIRE_CPP
5488         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5489         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5490             #include <bits/c++config.h>]],[[
5491             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5492             && !defined(_GLIBCXX__PTHREADS) \
5493             && !defined(_GLIBCXX_HAS_GTHREADS)
5494             choke me
5495             #endif
5496         ]])],[AC_MSG_RESULT([yes])
5497         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5498         AC_LANG_POP([C++])
5499         if test $glibcxx_threads = yes; then
5500             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5501         fi
5502      fi
5504 AC_SUBST(BOOST_CXXFLAGS)
5507 # prefx CXX with ccache if needed
5509 if test "$CCACHE" != ""; then
5510     AC_MSG_CHECKING([whether $CXX is already ccached])
5511     AC_LANG_PUSH([C++])
5512     save_CXXFLAGS=$CXXFLAGS
5513     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5514     dnl an empty program will do, we're checking the compiler flags
5515     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5516                       [use_ccache=yes], [use_ccache=no])
5517     if test $use_ccache = yes; then
5518         AC_MSG_RESULT([yes])
5519     else
5520         CXX="$CCACHE $CXX"
5521         AC_MSG_RESULT([no])
5522     fi
5523     CXXFLAGS=$save_CXXFLAGS
5524     AC_LANG_POP([C++])
5527 dnl ===================================================================
5528 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5529 dnl ===================================================================
5531 if test "$_os" != "WINNT"; then
5532     AC_PROG_CXXCPP
5534     dnl Check whether there's a C pre-processor.
5535     AC_PROG_CPP
5539 dnl ===================================================================
5540 dnl Find integral type sizes and alignments
5541 dnl ===================================================================
5543 if test "$_os" != "WINNT"; then
5545 if test "$_os" == "iOS"; then
5546     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5547     ac_cv_sizeof_long=8
5548     ac_cv_sizeof_short=2
5549     ac_cv_sizeof_int=4
5550     ac_cv_sizeof_long_long=8
5551     ac_cv_sizeof_double=8
5552     ac_cv_sizeof_voidp=8
5553 else
5554     AC_CHECK_SIZEOF(long)
5555     AC_CHECK_SIZEOF(short)
5556     AC_CHECK_SIZEOF(int)
5557     AC_CHECK_SIZEOF(long long)
5558     AC_CHECK_SIZEOF(double)
5559     AC_CHECK_SIZEOF(void*)
5562     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5563     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5564     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5565     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5566     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5568     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5569     m4_pattern_allow([AC_CHECK_ALIGNOF])
5570     m4_ifdef([AC_CHECK_ALIGNOF],
5571         [
5572             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5573             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5574             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5575             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5576         ],
5577         [
5578             case "$_os-$host_cpu" in
5579             Linux-i686)
5580                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5581                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5582                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5583                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5584                 ;;
5585             Linux-x86_64)
5586                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5587                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5588                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5589                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5590                 ;;
5591             *)
5592                 if test -z "$ac_cv_alignof_short" -o \
5593                         -z "$ac_cv_alignof_int" -o \
5594                         -z "$ac_cv_alignof_long" -o \
5595                         -z "$ac_cv_alignof_double"; then
5596                    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.])
5597                 fi
5598                 ;;
5599             esac
5600         ])
5602     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5603     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5604     if test $ac_cv_sizeof_long -eq 8; then
5605         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5606     elif test $ac_cv_sizeof_double -eq 8; then
5607         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5608     else
5609         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5610     fi
5612     dnl Check for large file support
5613     AC_SYS_LARGEFILE
5614     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5615         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5616     fi
5617     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5618         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5619     fi
5620 else
5621     # Hardcode for MSVC
5622     SAL_TYPES_SIZEOFSHORT=2
5623     SAL_TYPES_SIZEOFINT=4
5624     SAL_TYPES_SIZEOFLONG=4
5625     SAL_TYPES_SIZEOFLONGLONG=8
5626     if test "$BITNESS_OVERRIDE" = ""; then
5627         SAL_TYPES_SIZEOFPOINTER=4
5628     else
5629         SAL_TYPES_SIZEOFPOINTER=8
5630     fi
5631     SAL_TYPES_ALIGNMENT2=2
5632     SAL_TYPES_ALIGNMENT4=4
5633     SAL_TYPES_ALIGNMENT8=8
5634     LFS_CFLAGS=''
5636 AC_SUBST(LFS_CFLAGS)
5638 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5639 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5640 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5641 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5642 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5643 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5644 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5645 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5647 dnl ===================================================================
5648 dnl Check whether to enable runtime optimizations
5649 dnl ===================================================================
5650 ENABLE_RUNTIME_OPTIMIZATIONS=
5651 AC_MSG_CHECKING([whether to enable runtime optimizations])
5652 if test -z "$enable_runtime_optimizations"; then
5653     for i in $CC; do
5654         case $i in
5655         -fsanitize=*)
5656             enable_runtime_optimizations=no
5657             break
5658             ;;
5659         esac
5660     done
5662 if test "$enable_runtime_optimizations" != no; then
5663     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5664     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5665     AC_MSG_RESULT([yes])
5666 else
5667     AC_MSG_RESULT([no])
5669 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5671 dnl ===================================================================
5672 dnl Check if valgrind headers are available
5673 dnl ===================================================================
5674 ENABLE_VALGRIND=
5675 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
5676     prev_cppflags=$CPPFLAGS
5677     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5678     # or where does it come from?
5679     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5680     AC_CHECK_HEADER([valgrind/valgrind.h],
5681         [ENABLE_VALGRIND=TRUE])
5682     CPPFLAGS=$prev_cppflags
5684 AC_SUBST([ENABLE_VALGRIND])
5685 if test -z "$ENABLE_VALGRIND"; then
5686     if test "$with_valgrind" = yes; then
5687         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
5688     fi
5689     VALGRIND_CFLAGS=
5691 AC_SUBST([VALGRIND_CFLAGS])
5694 dnl ===================================================================
5695 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5696 dnl ===================================================================
5698 # We need at least the sys/sdt.h include header.
5699 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5700 if test "$SDT_H_FOUND" = "TRUE"; then
5701     # Found sys/sdt.h header, now make sure the c++ compiler works.
5702     # Old g++ versions had problems with probes in constructors/destructors.
5703     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5704     AC_LANG_PUSH([C++])
5705     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5706     #include <sys/sdt.h>
5707     class ProbeClass
5708     {
5709     private:
5710       int& ref;
5711       const char *name;
5713     public:
5714       ProbeClass(int& v, const char *n) : ref(v), name(n)
5715       {
5716         DTRACE_PROBE2(_test_, cons, name, ref);
5717       }
5719       void method(int min)
5720       {
5721         DTRACE_PROBE3(_test_, meth, name, ref, min);
5722         ref -= min;
5723       }
5725       ~ProbeClass()
5726       {
5727         DTRACE_PROBE2(_test_, dest, name, ref);
5728       }
5729     };
5730     ]],[[
5731     int i = 64;
5732     DTRACE_PROBE1(_test_, call, i);
5733     ProbeClass inst = ProbeClass(i, "call");
5734     inst.method(24);
5735     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5736           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5737     AC_LANG_POP([C++])
5739 AC_CONFIG_HEADERS([config_host/config_probes.h])
5741 dnl ===================================================================
5742 dnl GCC features
5743 dnl ===================================================================
5744 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
5745     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5746     save_CFLAGS=$CFLAGS
5747     CFLAGS="$CFLAGS -Werror -mno-avx"
5748     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5749     CFLAGS=$save_CFLAGS
5750     if test "$HAVE_GCC_AVX" = "TRUE"; then
5751         AC_MSG_RESULT([yes])
5752     else
5753         AC_MSG_RESULT([no])
5754     fi
5756     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5757     save_CFLAGS=$CFLAGS
5758     CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
5759     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5760     CFLAGS=$save_CFLAGS
5761     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5762         AC_MSG_RESULT([yes])
5763     else
5764         AC_MSG_RESULT([no])
5765     fi
5767     AC_MSG_CHECKING([whether $CC supports atomic functions])
5768     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5769     int v = 0;
5770     if (__sync_add_and_fetch(&v, 1) != 1 ||
5771         __sync_sub_and_fetch(&v, 1) != 0)
5772         return 1;
5773     __sync_synchronize();
5774     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5775         v != 1)
5776         return 1;
5777     return 0;
5778 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5779     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5780         AC_MSG_RESULT([yes])
5781         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5782     else
5783         AC_MSG_RESULT([no])
5784     fi
5786     AC_MSG_CHECKING([whether $CC supports __builtin_ffs])
5787     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
5788     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
5789         AC_MSG_RESULT([yes])
5790         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
5791     else
5792         AC_MSG_RESULT([no])
5793     fi
5795     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5796     save_CFLAGS=$CFLAGS
5797     CFLAGS="$CFLAGS -Werror"
5798     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5799             __attribute__((deprecated("test"))) void f();
5800         ])], [
5801             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5802             AC_MSG_RESULT([yes])
5803         ], [AC_MSG_RESULT([no])])
5804     CFLAGS=$save_CFLAGS
5806     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
5807     AC_LANG_PUSH([C++])
5808     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5809             #include <cstddef>
5810             #include <cxxabi.h>
5811             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
5812         ])], [
5813             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
5814             AC_MSG_RESULT([yes])
5815         ], [AC_MSG_RESULT([no])])
5816     AC_LANG_POP([C++])
5818     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
5819     AC_LANG_PUSH([C++])
5820     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5821             #include <cstddef>
5822             #include <cxxabi.h>
5823             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
5824         ])], [
5825             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
5826             AC_MSG_RESULT([yes])
5827         ], [AC_MSG_RESULT([no])])
5828     AC_LANG_POP([C++])
5830     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
5831     AC_LANG_PUSH([C++])
5832     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5833             #include <cxxabi.h>
5834             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
5835         ])], [
5836             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
5837             AC_MSG_RESULT([yes])
5838         ], [AC_MSG_RESULT([no])])
5839     AC_LANG_POP([C++])
5841     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
5842     AC_LANG_PUSH([C++])
5843     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5844             #include <cstddef>
5845             #include <cxxabi.h>
5846             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
5847         ])], [
5848             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
5849             AC_MSG_RESULT([yes])
5850         ], [AC_MSG_RESULT([no])])
5851     AC_LANG_POP([C++])
5853     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
5854     AC_LANG_PUSH([C++])
5855     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5856             #include <cstddef>
5857             #include <cxxabi.h>
5858             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
5859         ])], [
5860             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
5861             AC_MSG_RESULT([yes])
5862         ], [AC_MSG_RESULT([no])])
5863     AC_LANG_POP([C++])
5865     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
5866     AC_LANG_PUSH([C++])
5867     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5868             #include <cxxabi.h>
5869             void * f() { return __cxxabiv1::__cxa_get_globals(); }
5870         ])], [
5871             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
5872             AC_MSG_RESULT([yes])
5873         ], [AC_MSG_RESULT([no])])
5874     AC_LANG_POP([C++])
5876     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
5877     AC_LANG_PUSH([C++])
5878     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5879             #include <cxxabi.h>
5880             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
5881         ])], [
5882             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
5883             AC_MSG_RESULT([yes])
5884         ], [AC_MSG_RESULT([no])])
5885     AC_LANG_POP([C++])
5887     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
5888     AC_LANG_PUSH([C++])
5889     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5890             #include <cstddef>
5891             #include <cxxabi.h>
5892             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
5893         ])], [
5894             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
5895             AC_MSG_RESULT([yes])
5896         ], [AC_MSG_RESULT([no])])
5897     AC_LANG_POP([C++])
5899     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
5900     AC_LANG_PUSH([C++])
5901     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5902             #include <cstddef>
5903             #include <cxxabi.h>
5904             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
5905         ])], [
5906             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
5907             AC_MSG_RESULT([yes])
5908         ], [AC_MSG_RESULT([no])])
5909     AC_LANG_POP([C++])
5911     dnl Available in GCC 4.9 and at least in Clang 3.4 (which is the baseline
5912     dnl for at least --enable-compiler-plugins according to README.md):
5913     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
5914     AC_LANG_PUSH([C++])
5915     save_CXXFLAGS=$CXXFLAGS
5916     CXXFLAGS="$CXXFLAGS -Werror -Wunknown-pragmas"
5917     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5918             struct __attribute__((warn_unused)) dummy {};
5919         ])], [
5920             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
5921             AC_MSG_RESULT([yes])
5922         ], [AC_MSG_RESULT([no])])
5923     CXXFLAGS=$save_CXXFLAGS
5924 AC_LANG_POP([C++])
5927 AC_SUBST(HAVE_GCC_AVX)
5928 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
5929 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
5930 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
5932 dnl ===================================================================
5933 dnl Identify the C++ library
5934 dnl ===================================================================
5936 AC_MSG_CHECKING([What the C++ library is])
5937 AC_LANG_PUSH([C++])
5938 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5939 #include <utility>
5940 #ifndef __GLIBCXX__
5941 foo bar
5942 #endif
5943 ]])],
5944     [CPP_LIBRARY=GLIBCXX
5945      cpp_library_name="GNU libstdc++"
5946     ],
5947     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5948 #include <utility>
5949 #ifndef _LIBCPP_VERSION
5950 foo bar
5951 #endif
5952 ]])],
5953     [CPP_LIBRARY=LIBCPP
5954      cpp_library_name="LLVM libc++"
5955     ],
5956     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5957 #include <utility>
5958 #ifndef _MSC_VER
5959 foo bar
5960 #endif
5961 ]])],
5962     [CPP_LIBRARY=MSVCRT
5963      cpp_library_name="Microsoft"
5964     ],
5965     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
5966 AC_MSG_RESULT([$cpp_library_name])
5967 AC_LANG_POP([C++])
5969 dnl ===================================================================
5970 dnl C++11
5971 dnl ===================================================================
5973 CXXFLAGS_CXX11=
5974 if test "$COM" = MSC; then
5975     AC_MSG_CHECKING([whether $CXX supports C++11])
5976     AC_MSG_RESULT(yes)
5977     # MSVC supports (a subset of) CXX11 without any switch
5978 elif test "$GCC" = "yes"; then
5979     HAVE_CXX11=
5980     AC_MSG_CHECKING([whether $CXX supports C++14 or C++11])
5981     for flag in -std=gnu++14 -std=gnu++1y -std=c++14 -std=c++1y -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x ; do
5982         save_CXXFLAGS=$CXXFLAGS
5983         CXXFLAGS="$CXXFLAGS $flag -Werror"
5984         AC_LANG_PUSH([C++])
5985         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5986             #include <algorithm>
5987             #include <functional>
5988             #include <vector>
5989             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
5990                 std::sort(v.begin(), v.end(), fn);
5991             }
5992             ]])],[CXXFLAGS_CXX11=$flag])
5993         AC_LANG_POP([C++])
5994         CXXFLAGS=$save_CXXFLAGS
5995         if test -n "$CXXFLAGS_CXX11"; then
5996             HAVE_CXX11=TRUE
5997             break
5998         fi
5999     done
6000     if test "$HAVE_CXX11" = TRUE; then
6001         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6002     else
6003         AC_MSG_ERROR(no)
6004     fi
6007 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6008 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6009 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6010 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6011 dnl again towards 4.7.2:
6012 if test $CPP_LIBRARY = GLIBCXX; then
6013     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6014     AC_LANG_PUSH([C++])
6015     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6016 #include <list>
6017 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6018     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6019     //   GCC 4.7.0: 20120322
6020     //   GCC 4.7.1: 20120614
6021     // and using a range check is not possible as the mapping between
6022     // __GLIBCXX__ values and GCC versions is not monotonic
6023 /* ok */
6024 #else
6025 abi broken
6026 #endif
6027         ]])], [AC_MSG_RESULT(no, ok)],
6028         [AC_MSG_ERROR(yes)])
6029     AC_LANG_POP([C++])
6032 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6033 save_CXXFLAGS=$CXXFLAGS
6034 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6035 AC_LANG_PUSH([C++])
6037 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6038 #include <stddef.h>
6040 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6042 namespace
6044         struct b
6045         {
6046                 int i;
6047                 int j;
6048         };
6050 ]], [[
6051 struct a
6053         int i;
6054         int j;
6056 a thinga[]={{0,0}, {1,1}};
6057 b thingb[]={{0,0}, {1,1}};
6058 size_t i = sizeof(sal_n_array_size(thinga));
6059 size_t j = sizeof(sal_n_array_size(thingb));
6060 return !(i != 0 && j != 0);
6062     ], [ AC_MSG_RESULT(yes) ],
6063     [ AC_MSG_ERROR(no)])
6064 AC_LANG_POP([C++])
6065 CXXFLAGS=$save_CXXFLAGS
6067 dnl Clang 3.9 supports __float128 since
6068 dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6069 dnl __float128 in Clang and enable it on pertinent platforms":
6070 AC_MSG_CHECKING([whether $CXX supports C++11 without __float128 compile error])
6071 save_CXXFLAGS=$CXXFLAGS
6072 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6073 AC_LANG_PUSH([C++])
6075 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6076 #include <vector>
6077     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6078     // (__float128)
6080     ],[ AC_MSG_RESULT(yes) ],
6081     [
6082         AC_MSG_RESULT(no)
6083         # The only reason why libstdc++ headers fail with Clang in C++11 mode is because
6084         # they use the __float128 type that Clang doesn't know (libstdc++ checks whether
6085         # __float128 is available during its build, but it's usually built using GCC,
6086         # and so c++config.h hardcodes __float128 being supported). As the only place
6087         # where __float128 is actually used is in a template specialization,
6088         # -D__float128=void will avoid the problem there while still causing a problem
6089         # if somebody actually uses the type.
6090         AC_MSG_CHECKING([whether -D__float128=void workaround helps])
6091         CXXFLAGS="$CXXFLAGS -D__float128=void"
6092         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6093 #include <vector>
6094     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6095     // (__float128)
6097     ],
6098     [
6099      AC_MSG_RESULT(yes)
6100      CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -D__float128=void"
6101     ],
6102     [
6103      AC_MSG_ERROR(no)
6104     ])
6107 AC_LANG_POP([C++])
6108 CXXFLAGS=$save_CXXFLAGS
6110 AC_SUBST(CXXFLAGS_CXX11)
6112 AC_MSG_CHECKING([whether $CXX supports C++14 constexpr])
6113 save_CXXFLAGS=$CXXFLAGS
6114 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6115 AC_LANG_PUSH([C++])
6116 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6117     // A somewhat over-complicated way of checking for
6118     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6119     // in constexpr function":
6120     #include <cassert>
6121     template<typename T> inline constexpr T f(T x) { return x; }
6122     template<typename T> inline constexpr T g(T x) {
6123         assert(f(static_cast<int>(x)));
6124         return x;
6125     }
6126     enum E { e };
6127     auto v = g(E::e);
6129     struct S {
6130         int n_;
6131         constexpr bool f() {
6132             int n = n_;
6133             int i = 0;
6134             while (n > 0) { --n; ++i; }
6135             assert(i >= 0);
6136             return i == 0;
6137         }
6138     };
6139     constexpr auto v2 = S{10}.f();
6140     ]])], [cxx14_constexpr=yes], [cxx14_constexpr=no])
6141 AC_LANG_POP([C++])
6142 CXXFLAGS=$save_CXXFLAGS
6143 AC_MSG_RESULT([$cxx14_constexpr])
6144 if test "$cxx14_constexpr" = yes; then
6145     AC_DEFINE([HAVE_CXX14_CONSTEXPR])
6148 AC_MSG_CHECKING([whether $CXX supports C++11 ref-qualifier])
6149 save_CXXFLAGS=$CXXFLAGS
6150 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6151 AC_LANG_PUSH([C++])
6152 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6153     struct S {
6154         void f() &;
6155         void f() &&;
6156     };
6157     ]])], [cxx11_ref_qualifier=yes], [cxx11_ref_qualifier=no])
6158 AC_LANG_POP([C++])
6159 CXXFLAGS=$save_CXXFLAGS
6160 AC_MSG_RESULT([$cxx11_ref_qualifier])
6161 if test "$cxx11_ref_qualifier" = no; then
6162     AC_MSG_ERROR([Your $CXX does not support C++11 ref-qualifiers. This is no longer supported.])
6165 dnl _Pragma support (may require C++11)
6166 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6167     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6168     AC_LANG_PUSH([C++])
6169     save_CXXFLAGS=$CXXFLAGS
6170     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6171     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6172             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6173         ])], [
6174             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6175             AC_MSG_RESULT([yes])
6176         ], [AC_MSG_RESULT([no])])
6177     AC_LANG_POP([C++])
6178     CXXFLAGS=$save_CXXFLAGS
6181 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6182 if test "$GCC" = yes; then
6183     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6184     AC_LANG_PUSH([C++])
6185     save_CXXFLAGS=$CXXFLAGS
6186     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6187     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6188     CXXFLAGS=$save_CXXFLAGS
6189     AC_LANG_POP([C++])
6190     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6191         AC_MSG_RESULT([yes])
6192     else
6193         AC_MSG_RESULT([no])
6194     fi
6196 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6198 dnl ===================================================================
6199 dnl system stl sanity tests
6200 dnl ===================================================================
6201 if test "$_os" != "WINNT"; then
6203     AC_LANG_PUSH([C++])
6205     save_CPPFLAGS="$CPPFLAGS"
6206     if test -n "$MACOSX_SDK_PATH"; then
6207         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6208     fi
6210     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6211     # only.
6212     if test "$CPP_LIBRARY" = GLIBCXX; then
6213         dnl gcc#19664, gcc#22482, rhbz#162935
6214         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6215         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6216         AC_MSG_RESULT([$stlvisok])
6217         if test "$stlvisok" = "no"; then
6218             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6219         fi
6220     fi
6222     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6223     # when we don't make any dynamic libraries?
6224     if test "$DISABLE_DYNLOADING" = ""; then
6225         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6226         cat > conftestlib1.cc <<_ACEOF
6227 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6228 struct S2: S1<int> { virtual ~S2(); };
6229 S2::~S2() {}
6230 _ACEOF
6231         cat > conftestlib2.cc <<_ACEOF
6232 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6233 struct S2: S1<int> { virtual ~S2(); };
6234 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6235 _ACEOF
6236         gccvisinlineshiddenok=yes
6237         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6238             gccvisinlineshiddenok=no
6239         else
6240             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6241             dnl known to not work with -z defs (unsetting which makes the test
6242             dnl moot, though):
6243             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6244             if test "$COM_IS_CLANG" = TRUE; then
6245                 for i in $CXX $CXXFLAGS; do
6246                     case $i in
6247                     -fsanitize=*)
6248                         my_linkflagsnoundefs=
6249                         break
6250                         ;;
6251                     esac
6252                 done
6253             fi
6254             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6255                 gccvisinlineshiddenok=no
6256             fi
6257         fi
6259         rm -fr libconftest*
6260         AC_MSG_RESULT([$gccvisinlineshiddenok])
6261         if test "$gccvisinlineshiddenok" = "no"; then
6262             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6263         fi
6264     fi
6266    AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6267     cat >visibility.cxx <<_ACEOF
6268 #pragma GCC visibility push(hidden)
6269 struct __attribute__ ((visibility ("default"))) TestStruct {
6270   static void Init();
6272 __attribute__ ((visibility ("default"))) void TestFunc() {
6273   TestStruct::Init();
6275 _ACEOF
6276     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6277         gccvisbroken=yes
6278     else
6279         case "$host_cpu" in
6280         i?86|x86_64)
6281             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6282                 gccvisbroken=no
6283             else
6284                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6285                     gccvisbroken=no
6286                 else
6287                     gccvisbroken=yes
6288                 fi
6289             fi
6290             ;;
6291         *)
6292             gccvisbroken=no
6293             ;;
6294         esac
6295     fi
6296     rm -f visibility.s visibility.cxx
6298     AC_MSG_RESULT([$gccvisbroken])
6299     if test "$gccvisbroken" = "yes"; then
6300         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6301     fi
6303     CPPFLAGS="$save_CPPFLAGS"
6305     AC_LANG_POP([C++])
6308 dnl ===================================================================
6309 dnl  Clang++ tests
6310 dnl ===================================================================
6312 HAVE_GCC_FNO_DEFAULT_INLINE=
6313 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6314 if test "$GCC" = "yes"; then
6315     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6316     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6317         # Option just ignored and silly warning that isn't a real
6318         # warning printed
6319         :
6320     else
6321         AC_LANG_PUSH([C++])
6322         save_CXXFLAGS=$CXXFLAGS
6323         CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6324         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6325         CXXFLAGS=$save_CXXFLAGS
6326         AC_LANG_POP([C++])
6327     fi
6328     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6329         AC_MSG_RESULT([yes])
6330     else
6331         AC_MSG_RESULT([no])
6332     fi
6334     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6335     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6336         # As above
6337         :
6338     else
6339         AC_LANG_PUSH([C++])
6340         save_CXXFLAGS=$CXXFLAGS
6341         CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6342         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6343         CXXFLAGS=$save_CXXFLAGS
6344         AC_LANG_POP([C++])
6345     fi
6346     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6347         AC_MSG_RESULT([yes])
6348     else
6349         AC_MSG_RESULT([no])
6350     fi
6352 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6353 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6355 dnl ===================================================================
6356 dnl Compiler plugins
6357 dnl ===================================================================
6359 COMPILER_PLUGINS=
6360 # currently only Clang
6362 if test "$COM_IS_CLANG" != "TRUE"; then
6363     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6364         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6365         enable_compiler_plugins=no
6366     fi
6369 if test "$COM_IS_CLANG" = "TRUE"; then
6370     if test -n "$enable_compiler_plugins"; then
6371         compiler_plugins="$enable_compiler_plugins"
6372     elif test -n "$ENABLE_DBGUTIL"; then
6373         compiler_plugins=test
6374     else
6375         compiler_plugins=no
6376     fi
6377     if test "$compiler_plugins" != "no"; then
6378         dnl The prefix where Clang resides, override to where Clang resides if
6379         dnl using a source build:
6380         if test -z "$CLANGDIR"; then
6381             CLANGDIR=/usr
6382         fi
6383         AC_LANG_PUSH([C++])
6384         save_CPPFLAGS=$CPPFLAGS
6385         save_CXX=$CXX
6386         # compiler plugins must be built with "native" bitness of clang
6387         # because they link against clang libraries
6388         CXX=${COMPILER_PLUGINS_CXX-$(echo $CXX | sed -e s/-m64// -e s/-m32//)}
6389         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6390         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6391             [COMPILER_PLUGINS=TRUE],
6392             [
6393             if test "$compiler_plugins" = "yes"; then
6394                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6395             else
6396                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6397                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6398             fi
6399             ])
6400         CXX=$save_CXX
6401         CPPFLAGS=$save_CPPFLAGS
6402         AC_LANG_POP([C++])
6403     fi
6404 else
6405     if test "$enable_compiler_plugins" = "yes"; then
6406         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6407     fi
6409 AC_SUBST(COMPILER_PLUGINS)
6410 AC_SUBST(COMPILER_PLUGINS_CXX)
6411 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
6412 AC_SUBST(CLANGDIR)
6413 AC_SUBST(CLANGLIBDIR)
6415 # Plugin to help linker.
6416 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6417 # This makes --enable-lto build with clang work.
6418 AC_SUBST(LD_PLUGIN)
6420 dnl ===================================================================
6421 dnl allocator
6422 dnl ===================================================================
6423 AC_MSG_CHECKING([which memory allocator to use])
6424 if test "$with_alloc" = "system"; then
6425     AC_MSG_RESULT([system])
6426     ALLOC="SYS_ALLOC"
6428 if test "$with_alloc" = "tcmalloc"; then
6429     AC_MSG_RESULT(tcmalloc)
6430     if ! echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6431         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
6432     fi
6433     AC_CHECK_LIB([tcmalloc], [malloc], [:],
6434         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
6435     ALLOC="TCMALLOC"
6437 if test "$with_alloc" = "jemalloc"; then
6438     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
6439         AC_MSG_RESULT(jemalloc)
6440         save_CFLAGS=$CFLAGS
6441         CFLAGS="$CFLAGS -pthread"
6442         AC_CHECK_LIB([jemalloc], [malloc], [:],
6443             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
6444         ALLOC="JEMALLOC"
6445         CFLAGS=$save_CFLAGS
6446     else
6447         AC_MSG_RESULT([system])
6448         ALLOC="SYS_ALLOC"
6449     fi
6451 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6452     AC_MSG_RESULT([internal])
6454 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6455 AC_SUBST(HAVE_POSIX_FALLOCATE)
6456 AC_SUBST(ALLOC)
6458 dnl ===================================================================
6459 dnl Custom build version
6460 dnl ===================================================================
6462 AC_MSG_CHECKING([whether to add custom build version])
6463 if test "$with_build_version" != ""; then
6464     BUILD_VER_STRING=$with_build_version
6465     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6466 else
6467     BUILD_VER_STRING=
6468     AC_MSG_RESULT([no])
6470 AC_SUBST(BUILD_VER_STRING)
6472 JITC_PROCESSOR_TYPE=""
6473 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6474     # IBMs JDK needs this...
6475     JITC_PROCESSOR_TYPE=6
6476     export JITC_PROCESSOR_TYPE
6478 AC_SUBST([JITC_PROCESSOR_TYPE])
6480 # Misc Windows Stuff
6481 AC_ARG_WITH(ucrt-dir,
6482     AS_HELP_STRING([--with-ucrt-dir],
6483         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
6484         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
6485         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
6486             Windows6.1-KB2999226-x64.msu
6487             Windows6.1-KB2999226-x86.msu
6488             Windows8.1-KB2999226-x64.msu
6489             Windows8.1-KB2999226-x86.msu
6490             Windows8-RT-KB2999226-x64.msu
6491             Windows8-RT-KB2999226-x86.msu
6492         A zip archive including those files is available from Microsoft site:
6493         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
6495 UCRT_REDISTDIR="$with_ucrt_dir"
6496 if test $_os = "WINNT"; then
6497     find_msvc_x64_dlls
6498     find_msms
6499     MSVC_DLL_PATH="$msvcdllpath"
6500     MSVC_DLLS="$msvcdlls"
6501     MSM_PATH="$msmdir"
6502     # MSVC 15.3 changed it to VC141
6503     if echo "$MSVC_DLL_PATH" | grep -q "VC141.CRT$"; then
6504         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
6505     else
6506         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6507     fi
6508     if test "$UCRT_REDISTDIR" = "no"; then
6509         dnl explicitly disabled
6510         UCRT_REDISTDIR=""
6511     else
6512         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
6513                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
6514                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
6515                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
6516                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
6517                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
6518             UCRT_REDISTDIR=""
6519             if test -n "$PKGFORMAT"; then
6520                for i in "$PKGFORMAT"; do
6521                    case "$i" in
6522                    msi)
6523                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
6524                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
6525                        ;;
6526                    esac
6527                done
6528             fi
6529         fi
6530     fi
6533 AC_SUBST(UCRT_REDISTDIR)
6534 AC_SUBST(MSVC_DLL_PATH)
6535 AC_SUBST(MSVC_DLLS)
6536 AC_SUBST(MSM_PATH)
6538 dnl ===================================================================
6539 dnl Checks for Java
6540 dnl ===================================================================
6541 if test "$ENABLE_JAVA" != ""; then
6543     # Windows-specific tests
6544     if test "$build_os" = "cygwin"; then
6545         if test "$BITNESS_OVERRIDE" = 64; then
6546             bitness=64
6547         else
6548             bitness=32
6549         fi
6551         if test -z "$with_jdk_home"; then
6552             for ver in 1.8 1.7 1.6; do
6553                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6554                 if test -n "$regvalue"; then
6555                     _jdk_home=$regvalue
6556                     break
6557                 fi
6558             done
6559             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6560                 with_jdk_home="$_jdk_home"
6561                 howfound="found automatically"
6562             else
6563                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6564             fi
6565         else
6566             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6567             howfound="you passed"
6568         fi
6569     fi
6571     # 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.
6572     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6573     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6574         with_jdk_home=`/usr/libexec/java_home`
6575     fi
6577     JAVA_HOME=; export JAVA_HOME
6578     if test -z "$with_jdk_home"; then
6579         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6580     else
6581         _java_path="$with_jdk_home/bin/$with_java"
6582         dnl Check if there is a Java interpreter at all.
6583         if test -x "$_java_path"; then
6584             JAVAINTERPRETER=$_java_path
6585         else
6586             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6587         fi
6588     fi
6590     dnl Check that the JDK found is correct architecture (at least 2 reasons to
6591     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
6592     dnl loaded by java to run JunitTests:
6593     if test "$build_os" = "cygwin"; then
6594         shortjdkhome=`cygpath -d "$with_jdk_home"`
6595         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
6596             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6597             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6598         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
6599             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6600             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6601         fi
6603         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6604             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6605         fi
6606         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6607     elif test "$cross_compiling" != "yes"; then
6608         case $CPUNAME in
6609             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
6610                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6611                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6612                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6613                 fi
6614                 ;;
6615             *) # assumption: everything else 32-bit
6616                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6617                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6618                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6619                 fi
6620                 ;;
6621         esac
6622     fi
6625 HAVE_JAVA9=
6626 dnl ===================================================================
6627 dnl Checks for JDK.
6628 dnl ===================================================================
6630 # Note that JAVA_HOME as for now always means the *build* platform's
6631 # JAVA_HOME. Whether all the complexity here actually is needed any
6632 # more or not, no idea.
6634 if test "$ENABLE_JAVA" != ""; then
6635     _gij_longver=0
6636     AC_MSG_CHECKING([the installed JDK])
6637     if test -n "$JAVAINTERPRETER"; then
6638         dnl java -version sends output to stderr!
6639         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6640             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6641         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6642             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6643         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6644             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6645         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6646             JDK=ibm
6648             dnl IBM JDK specific tests
6649             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6650             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6652             if test "$_jdk_ver" -lt 10600; then
6653                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
6654             fi
6656             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6658             if test "$with_jdk_home" = ""; then
6659                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6660 you must use the "--with-jdk-home" configure option explicitly])
6661             fi
6663             JAVA_HOME=$with_jdk_home
6664         else
6665             JDK=sun
6667             dnl Sun JDK specific tests
6668             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6669             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6671             if test "$_jdk_ver" -lt 10600; then
6672                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
6673             fi
6674             if test "$_jdk_ver" -gt 10600; then
6675                 JAVA_CLASSPATH_NOT_SET=TRUE
6676             fi
6677             if test "$_jdk_ver" -ge 10900; then
6678                 HAVE_JAVA9=TRUE
6679             fi
6681             AC_MSG_RESULT([checked (JDK $_jdk)])
6682             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6683             if test "$_os" = "WINNT"; then
6684                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6685             fi
6687             # set to limit VM usage for JunitTests
6688             JAVAIFLAGS=-Xmx64M
6689             # set to limit VM usage for javac
6690             JAVAFLAGS=-J-Xmx128M
6691         fi
6692     else
6693         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
6694     fi
6695 else
6696     dnl Java disabled
6697     JAVA_HOME=
6698     export JAVA_HOME
6701 dnl ===================================================================
6702 dnl Set target Java bytecode version
6703 dnl ===================================================================
6704 if test "$ENABLE_JAVA" != ""; then
6705     if test "$HAVE_JAVA9" = "TRUE"; then
6706         _java_target_ver="1.6"
6707     else
6708         _java_target_ver="1.5"
6709     fi
6710     JAVA_SOURCE_VER="$_java_target_ver"
6711     JAVA_TARGET_VER="$_java_target_ver"
6714 dnl ===================================================================
6715 dnl Checks for javac
6716 dnl ===================================================================
6717 if test "$ENABLE_JAVA" != ""; then
6718     javacompiler="javac"
6719     if test -z "$with_jdk_home"; then
6720         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6721     else
6722         _javac_path="$with_jdk_home/bin/$javacompiler"
6723         dnl Check if there is a Java compiler at all.
6724         if test -x "$_javac_path"; then
6725             JAVACOMPILER=$_javac_path
6726         fi
6727     fi
6728     if test -z "$JAVACOMPILER"; then
6729         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6730     fi
6731     if test "$build_os" = "cygwin"; then
6732         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6733             JAVACOMPILER="${JAVACOMPILER}.exe"
6734         fi
6735         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
6736     fi
6739 dnl ===================================================================
6740 dnl Checks for javadoc
6741 dnl ===================================================================
6742 if test "$ENABLE_JAVA" != ""; then
6743     if test -z "$with_jdk_home"; then
6744         AC_PATH_PROG(JAVADOC, javadoc)
6745     else
6746         _javadoc_path="$with_jdk_home/bin/javadoc"
6747         dnl Check if there is a javadoc at all.
6748         if test -x "$_javadoc_path"; then
6749             JAVADOC=$_javadoc_path
6750         else
6751             AC_PATH_PROG(JAVADOC, javadoc)
6752         fi
6753     fi
6754     if test -z "$JAVADOC"; then
6755         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6756     fi
6757     if test "$build_os" = "cygwin"; then
6758         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6759             JAVADOC="${JAVADOC}.exe"
6760         fi
6761         JAVADOC=`win_short_path_for_make "$JAVADOC"`
6762     fi
6764     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6765     JAVADOCISGJDOC="yes"
6766     fi
6768 AC_SUBST(JAVADOCISGJDOC)
6770 if test "$ENABLE_JAVA" != ""; then
6771     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
6772     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
6773         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
6774            # try to recover first by looking whether we have a alternatives
6775            # system as in Debian or newer SuSEs where following /usr/bin/javac
6776            # over /etc/alternatives/javac leads to the right bindir where we
6777            # just need to strip a bit away to get a valid JAVA_HOME
6778            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
6779         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
6780             # maybe only one level of symlink (e.g. on Mac)
6781             JAVA_HOME=$(readlink $JAVACOMPILER)
6782             if test "$(dirname $JAVA_HOME)" = "."; then
6783                 # we've got no path to trim back
6784                 JAVA_HOME=""
6785             fi
6786         else
6787             # else warn
6788             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
6789             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
6790             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
6791             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
6792         fi
6793         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
6794         if test "$JAVA_HOME" != "/usr"; then
6795             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6796                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
6797                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
6798                 dnl Tiger already returns a JDK path..
6799                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
6800             else
6801                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
6802                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
6803                 dnl that checks which version to run
6804                 if test -f "$JAVA_HOME"; then
6805                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
6806                 fi
6807             fi
6808         fi
6809     fi
6810     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
6812     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
6813     if test -z "$JAVA_HOME"; then
6814         if test "x$with_jdk_home" = "x"; then
6815             cat > findhome.java <<_ACEOF
6816 [import java.io.File;
6818 class findhome
6820     public static void main(String args[])
6821     {
6822         String jrelocation = System.getProperty("java.home");
6823         File jre = new File(jrelocation);
6824         System.out.println(jre.getParent());
6825     }
6827 _ACEOF
6828             AC_MSG_CHECKING([if javac works])
6829             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
6830             AC_TRY_EVAL(javac_cmd)
6831             if test $? = 0 -a -f ./findhome.class; then
6832                 AC_MSG_RESULT([javac works])
6833             else
6834                 echo "configure: javac test failed" >&5
6835                 cat findhome.java >&5
6836                 AC_MSG_ERROR([javac does not work - java projects will not build!])
6837             fi
6838             AC_MSG_CHECKING([if gij knows its java.home])
6839             JAVA_HOME=`$JAVAINTERPRETER findhome`
6840             if test $? = 0 -a "$JAVA_HOME" != ""; then
6841                 AC_MSG_RESULT([$JAVA_HOME])
6842             else
6843                 echo "configure: java test failed" >&5
6844                 cat findhome.java >&5
6845                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
6846             fi
6847             # clean-up after ourselves
6848             rm -f ./findhome.java ./findhome.class
6849         else
6850             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
6851         fi
6852     fi
6854     # now check if $JAVA_HOME is really valid
6855     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6856         case "${JAVA_HOME}" in
6857             /Library/Java/JavaVirtualMachines/*)
6858                 ;;
6859             *)
6860                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
6861                 ;;
6862         esac
6863         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
6864             JAVA_HOME_OK="NO"
6865         fi
6866     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
6867         JAVA_HOME_OK="NO"
6868     fi
6869     if test "$JAVA_HOME_OK" = "NO"; then
6870         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
6871         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
6872         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
6873         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
6874         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
6875         add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
6876     fi
6877     PathFormat "$JAVA_HOME"
6878     JAVA_HOME="$formatted_path"
6881 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
6882     "$_os" != Darwin
6883 then
6884     AC_MSG_CHECKING([for JAWT lib])
6885     if test "$_os" = WINNT; then
6886         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
6887         JAWTLIB=jawt.lib
6888     else
6889         case "$host_cpu" in
6890         arm*)
6891             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
6892             JAVA_ARCH=$my_java_arch
6893             ;;
6894         i*86)
6895             my_java_arch=i386
6896             ;;
6897         m68k)
6898             my_java_arch=m68k
6899             ;;
6900         powerpc)
6901             my_java_arch=ppc
6902             ;;
6903         powerpc64)
6904             my_java_arch=ppc64
6905             ;;
6906         powerpc64le)
6907             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
6908             JAVA_ARCH=$my_java_arch
6909             ;;
6910         sparc64)
6911             my_java_arch=sparcv9
6912             ;;
6913         x86_64)
6914             my_java_arch=amd64
6915             ;;
6916         *)
6917             my_java_arch=$host_cpu
6918             ;;
6919         esac
6920         # This is where JDK9 puts the library
6921         if test -e "$JAVA_HOME/lib/libjawt.so"; then
6922             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
6923         else
6924             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
6925         fi
6926         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
6927     fi
6928     AC_MSG_RESULT([$JAWTLIB])
6930 AC_SUBST(JAWTLIB)
6932 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
6933     case "$host_os" in
6935     aix*)
6936         JAVAINC="-I$JAVA_HOME/include"
6937         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
6938         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6939         ;;
6941     cygwin*)
6942         JAVAINC="-I$JAVA_HOME/include/win32"
6943         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
6944         ;;
6946     darwin*)
6947         if test -d "$JAVA_HOME/include/darwin"; then
6948             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
6949         else
6950             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
6951         fi
6952         ;;
6954     dragonfly*)
6955         JAVAINC="-I$JAVA_HOME/include"
6956         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6957         ;;
6959     freebsd*)
6960         JAVAINC="-I$JAVA_HOME/include"
6961         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
6962         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
6963         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
6964         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6965         ;;
6967     k*bsd*-gnu*)
6968         JAVAINC="-I$JAVA_HOME/include"
6969         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
6970         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6971         ;;
6973     linux-gnu*)
6974         JAVAINC="-I$JAVA_HOME/include"
6975         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
6976         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6977         ;;
6979     *netbsd*)
6980         JAVAINC="-I$JAVA_HOME/include"
6981         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
6982         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6983        ;;
6985     openbsd*)
6986         JAVAINC="-I$JAVA_HOME/include"
6987         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
6988         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6989         ;;
6991     solaris*)
6992         JAVAINC="-I$JAVA_HOME/include"
6993         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
6994         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6995         ;;
6996     esac
6998 SOLARINC="$SOLARINC $JAVAINC"
7000 AC_SUBST(JAVACOMPILER)
7001 AC_SUBST(JAVADOC)
7002 AC_SUBST(JAVAINTERPRETER)
7003 AC_SUBST(JAVAIFLAGS)
7004 AC_SUBST(JAVAFLAGS)
7005 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7006 AC_SUBST(JAVA_HOME)
7007 AC_SUBST(JAVA_SOURCE_VER)
7008 AC_SUBST(JAVA_TARGET_VER)
7009 AC_SUBST(JDK)
7012 dnl ===================================================================
7013 dnl Export file validation
7014 dnl ===================================================================
7015 AC_MSG_CHECKING([whether to enable export file validation])
7016 if test "$with_export_validation" != "no"; then
7017     if test -z "$ENABLE_JAVA"; then
7018         if test "$with_export_validation" = "yes"; then
7019             AC_MSG_ERROR([requested, but Java is disabled])
7020         else
7021             AC_MSG_RESULT([no, as Java is disabled])
7022         fi
7023     elif test "$_jdk_ver" -lt 10800; then
7024         if test "$with_export_validation" = "yes"; then
7025             AC_MSG_ERROR([requested, but Java is too old, need Java 8])
7026         else
7027             AC_MSG_RESULT([no, as Java is too old, need Java 8])
7028         fi
7029     else
7030         AC_MSG_RESULT([yes])
7031         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7033         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7034         if test -z "$ODFVALIDATOR"; then
7035             # remember to download the ODF toolkit with validator later
7036             AC_MSG_NOTICE([no odfvalidator found, will download it])
7037             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7038             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7040             # and fetch name of odfvalidator jar name from download.lst
7041             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7042             AC_SUBST(ODFVALIDATOR_JAR)
7044             if test -z "$ODFVALIDATOR_JAR"; then
7045                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7046             fi
7047         fi
7048         if test "$build_os" = "cygwin"; then
7049             # In case of Cygwin it will be executed from Windows,
7050             # so we need to run bash and absolute path to validator
7051             # so instead of "odfvalidator" it will be
7052             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7053             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7054         else
7055             ODFVALIDATOR="sh $ODFVALIDATOR"
7056         fi
7057         AC_SUBST(ODFVALIDATOR)
7060         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7061         if test -z "$OFFICEOTRON"; then
7062             # remember to download the officeotron with validator later
7063             AC_MSG_NOTICE([no officeotron found, will download it])
7064             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7065             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7067             # and fetch name of officeotron jar name from download.lst
7068             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7069             AC_SUBST(OFFICEOTRON_JAR)
7071             if test -z "$OFFICEOTRON_JAR"; then
7072                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7073             fi
7074         else
7075             # check version of existing officeotron
7076             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7077             if test 0"$OFFICEOTRON_VER" -lt 704; then
7078                 AC_MSG_ERROR([officeotron too old])
7079             fi
7080         fi
7081         if test "$build_os" = "cygwin"; then
7082             # In case of Cygwin it will be executed from Windows,
7083             # so we need to run bash and absolute path to validator
7084             # so instead of "odfvalidator" it will be
7085             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7086             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7087         else
7088             OFFICEOTRON="sh $OFFICEOTRON"
7089         fi
7090     fi
7091     AC_SUBST(OFFICEOTRON)
7092 else
7093     AC_MSG_RESULT([no])
7096 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7097 if test "$with_bffvalidator" != "no"; then
7098     AC_DEFINE(HAVE_BFFVALIDATOR)
7100     if test "$with_export_validation" = "no"; then
7101         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7102     fi
7104     if test "$with_bffvalidator" = "yes"; then
7105         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7106     else
7107         BFFVALIDATOR="$with_bffvalidator"
7108     fi
7110     if test "$build_os" = "cygwin"; then
7111         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7112             AC_MSG_RESULT($BFFVALIDATOR)
7113         else
7114             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7115         fi
7116     elif test -n "$BFFVALIDATOR"; then
7117         # We are not in Cygwin but need to run Windows binary with wine
7118         AC_PATH_PROGS(WINE, wine)
7120         # so swap in a shell wrapper that converts paths transparently
7121         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7122         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7123         AC_SUBST(BFFVALIDATOR_EXE)
7124         AC_MSG_RESULT($BFFVALIDATOR)
7125     else
7126         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7127     fi
7128     AC_SUBST(BFFVALIDATOR)
7129 else
7130     AC_MSG_RESULT([no])
7133 dnl ===================================================================
7134 dnl Check for C preprocessor to use
7135 dnl ===================================================================
7136 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7137 if test -n "$with_idlc_cpp"; then
7138     AC_MSG_RESULT([$with_idlc_cpp])
7139     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7140 else
7141     AC_MSG_RESULT([ucpp])
7142     AC_MSG_CHECKING([which ucpp tp use])
7143     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7144         AC_MSG_RESULT([external])
7145         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7146     else
7147         AC_MSG_RESULT([internal])
7148         BUILD_TYPE="$BUILD_TYPE UCPP"
7149     fi
7151 AC_SUBST(SYSTEM_UCPP)
7153 dnl ===================================================================
7154 dnl Check for epm (not needed for Windows)
7155 dnl ===================================================================
7156 AC_MSG_CHECKING([whether to enable EPM for packing])
7157 if test "$enable_epm" = "yes"; then
7158     AC_MSG_RESULT([yes])
7159     if test "$_os" != "WINNT"; then
7160         if test $_os = Darwin; then
7161             EPM=internal
7162         elif test -n "$with_epm"; then
7163             EPM=$with_epm
7164         else
7165             AC_PATH_PROG(EPM, epm, no)
7166         fi
7167         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7168             AC_MSG_NOTICE([EPM will be built.])
7169             BUILD_TYPE="$BUILD_TYPE EPM"
7170             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7171         else
7172             # Gentoo has some epm which is something different...
7173             AC_MSG_CHECKING([whether the found epm is the right epm])
7174             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7175                 AC_MSG_RESULT([yes])
7176             else
7177                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7178             fi
7179             AC_MSG_CHECKING([epm version])
7180             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7181             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7182                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7183                 AC_MSG_RESULT([OK, >= 3.7])
7184             else
7185                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7186                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7187             fi
7188         fi
7189     fi
7191     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7192         AC_MSG_CHECKING([for rpm])
7193         for a in "$RPM" rpmbuild rpm; do
7194             $a --usage >/dev/null 2> /dev/null
7195             if test $? -eq 0; then
7196                 RPM=$a
7197                 break
7198             else
7199                 $a --version >/dev/null 2> /dev/null
7200                 if test $? -eq 0; then
7201                     RPM=$a
7202                     break
7203                 fi
7204             fi
7205         done
7206         if test -z "$RPM"; then
7207             AC_MSG_ERROR([not found])
7208         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7209             RPM_PATH=`which $RPM`
7210             AC_MSG_RESULT([$RPM_PATH])
7211             SCPDEFS="$SCPDEFS -DWITH_RPM"
7212         else
7213             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7214         fi
7215     fi
7216     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7217         AC_PATH_PROG(DPKG, dpkg, no)
7218         if test "$DPKG" = "no"; then
7219             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7220         fi
7221     fi
7222     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7223        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7224         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7225             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7226                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7227                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7228                     AC_MSG_RESULT([yes])
7229                 else
7230                     AC_MSG_RESULT([no])
7231                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7232                         _pt="rpm"
7233                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7234                         add_warning "the rpms will need to be installed with --nodeps"
7235                     else
7236                         _pt="pkg"
7237                     fi
7238                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
7239                     add_warning "the ${_pt}s will not be relocateable"
7240                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7241                                  relocation will work, you need to patch your epm with the
7242                                  patch in epm/epm-3.7.patch or build with
7243                                  --with-epm=internal which will build a suitable epm])
7244                 fi
7245             fi
7246         fi
7247     fi
7248     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7249         AC_PATH_PROG(PKGMK, pkgmk, no)
7250         if test "$PKGMK" = "no"; then
7251             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7252         fi
7253     fi
7254     AC_SUBST(RPM)
7255     AC_SUBST(DPKG)
7256     AC_SUBST(PKGMK)
7257 else
7258     for i in $PKGFORMAT; do
7259         case "$i" in
7260         aix | bsd | deb | pkg | rpm | native | portable)
7261             AC_MSG_ERROR(
7262                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7263             ;;
7264         esac
7265     done
7266     AC_MSG_RESULT([no])
7267     EPM=NO
7269 AC_SUBST(EPM)
7271 ENABLE_LWP=
7272 if test "$enable_lotuswordpro" = "yes"; then
7273     ENABLE_LWP="TRUE"
7275 AC_SUBST(ENABLE_LWP)
7277 dnl ===================================================================
7278 dnl Check for gperf
7279 dnl ===================================================================
7280 AC_PATH_PROG(GPERF, gperf)
7281 if test -z "$GPERF"; then
7282     AC_MSG_ERROR([gperf not found but needed. Install it.])
7284 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7285     GPERF=`cygpath -m $GPERF`
7287 AC_MSG_CHECKING([gperf version])
7288 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
7289     AC_MSG_RESULT([OK])
7290 else
7291     AC_MSG_ERROR([too old, you need at least 3.0.0])
7293 AC_SUBST(GPERF)
7295 dnl ===================================================================
7296 dnl Check for building ODK
7297 dnl ===================================================================
7298 if test "$enable_odk" = no; then
7299     unset DOXYGEN
7300 else
7301     if test "$with_doxygen" = no; then
7302         AC_MSG_CHECKING([for doxygen])
7303         unset DOXYGEN
7304         AC_MSG_RESULT([no])
7305     else
7306         if test "$with_doxygen" = yes; then
7307             AC_PATH_PROG([DOXYGEN], [doxygen])
7308             if test -z "$DOXYGEN"; then
7309                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7310             fi
7311         else
7312             AC_MSG_CHECKING([for doxygen])
7313             DOXYGEN=$with_doxygen
7314             AC_MSG_RESULT([$DOXYGEN])
7315         fi
7316         if test -n "$DOXYGEN"; then
7317             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7318             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7319             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7320                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7321             fi
7322         fi
7323     fi
7325 AC_SUBST([DOXYGEN])
7327 AC_MSG_CHECKING([whether to build the ODK])
7328 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7329     AC_MSG_RESULT([yes])
7331     if test "$with_java" != "no"; then
7332         AC_MSG_CHECKING([whether to build unowinreg.dll])
7333         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7334             # build on Win by default
7335             enable_build_unowinreg=yes
7336         fi
7337         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7338             AC_MSG_RESULT([no])
7339             BUILD_UNOWINREG=
7340         else
7341             AC_MSG_RESULT([yes])
7342             BUILD_UNOWINREG=TRUE
7343         fi
7344         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7345             if test -z "$with_mingw_cross_compiler"; then
7346                 dnl Guess...
7347                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7348             elif test -x "$with_mingw_cross_compiler"; then
7349                  MINGWCXX="$with_mingw_cross_compiler"
7350             else
7351                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7352             fi
7354             if test "$MINGWCXX" = "false"; then
7355                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7356             fi
7358             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7359             if test -x "$mingwstrip_test"; then
7360                 MINGWSTRIP="$mingwstrip_test"
7361             else
7362                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7363             fi
7365             if test "$MINGWSTRIP" = "false"; then
7366                 AC_MSG_ERROR(MinGW32 binutils not found.)
7367             fi
7368         fi
7369     fi
7370     BUILD_TYPE="$BUILD_TYPE ODK"
7371 else
7372     AC_MSG_RESULT([no])
7373     BUILD_UNOWINREG=
7375 AC_SUBST(BUILD_UNOWINREG)
7376 AC_SUBST(MINGWCXX)
7377 AC_SUBST(MINGWSTRIP)
7379 dnl ===================================================================
7380 dnl Check for system zlib
7381 dnl ===================================================================
7382 if test "$with_system_zlib" = "auto"; then
7383     case "$_os" in
7384     WINNT)
7385         with_system_zlib="$with_system_libs"
7386         ;;
7387     *)
7388         if test "$enable_fuzzers" != "yes"; then
7389             with_system_zlib=yes
7390         else
7391             with_system_zlib=no
7392         fi
7393         ;;
7394     esac
7397 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7398 dnl and has no pkg-config for it at least on some tinderboxes,
7399 dnl so leaving that out for now
7400 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7401 AC_MSG_CHECKING([which zlib to use])
7402 if test "$with_system_zlib" = "yes"; then
7403     AC_MSG_RESULT([external])
7404     SYSTEM_ZLIB=TRUE
7405     AC_CHECK_HEADER(zlib.h, [],
7406         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7407     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7408         [AC_MSG_ERROR(zlib not found or functional)], [])
7409 else
7410     AC_MSG_RESULT([internal])
7411     SYSTEM_ZLIB=
7412     BUILD_TYPE="$BUILD_TYPE ZLIB"
7413     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7414     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7416 AC_SUBST(ZLIB_CFLAGS)
7417 AC_SUBST(ZLIB_LIBS)
7418 AC_SUBST(SYSTEM_ZLIB)
7420 dnl ===================================================================
7421 dnl Check for system jpeg
7422 dnl ===================================================================
7423 AC_MSG_CHECKING([which libjpeg to use])
7424 if test "$with_system_jpeg" = "yes"; then
7425     AC_MSG_RESULT([external])
7426     SYSTEM_LIBJPEG=TRUE
7427     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7428         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7429     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7430         [AC_MSG_ERROR(jpeg library not found or fuctional)], [])
7431 else
7432     SYSTEM_LIBJPEG=
7433     AC_MSG_RESULT([internal, libjpeg-turbo])
7434     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
7435     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
7436     if test "$COM" = "MSC"; then
7437         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
7438     else
7439         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
7440     fi
7442     case "$host_cpu" in
7443     x86_64 | amd64 | i*86 | x86 | ia32)
7444         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7445         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7446             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7447                 NASM="$LODE_HOME/opt/bin/nasm"
7448             elif test -x "/opt/lo/bin/nasm"; then
7449                 NASM="/opt/lo/bin/nasm"
7450             fi
7451         fi
7453         if test -n "$NASM"; then
7454             AC_MSG_CHECKING([for object file format of host system])
7455             case "$host_os" in
7456               cygwin* | mingw* | pw32* | interix*)
7457                 case "$host_cpu" in
7458                   x86_64)
7459                     objfmt='Win64-COFF'
7460                     ;;
7461                   *)
7462                     objfmt='Win32-COFF'
7463                     ;;
7464                 esac
7465               ;;
7466               msdosdjgpp* | go32*)
7467                 objfmt='COFF'
7468               ;;
7469               os2-emx*)                 # not tested
7470                 objfmt='MSOMF'          # obj
7471               ;;
7472               linux*coff* | linux*oldld*)
7473                 objfmt='COFF'           # ???
7474               ;;
7475               linux*aout*)
7476                 objfmt='a.out'
7477               ;;
7478               linux*)
7479                 case "$host_cpu" in
7480                   x86_64)
7481                     objfmt='ELF64'
7482                     ;;
7483                   *)
7484                     objfmt='ELF'
7485                     ;;
7486                 esac
7487               ;;
7488               kfreebsd* | freebsd* | netbsd* | openbsd*)
7489                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
7490                   objfmt='BSD-a.out'
7491                 else
7492                   case "$host_cpu" in
7493                     x86_64 | amd64)
7494                       objfmt='ELF64'
7495                       ;;
7496                     *)
7497                       objfmt='ELF'
7498                       ;;
7499                   esac
7500                 fi
7501               ;;
7502               solaris* | sunos* | sysv* | sco*)
7503                 case "$host_cpu" in
7504                   x86_64)
7505                     objfmt='ELF64'
7506                     ;;
7507                   *)
7508                     objfmt='ELF'
7509                     ;;
7510                 esac
7511               ;;
7512               darwin* | rhapsody* | nextstep* | openstep* | macos*)
7513                 case "$host_cpu" in
7514                   x86_64)
7515                     objfmt='Mach-O64'
7516                     ;;
7517                   *)
7518                     objfmt='Mach-O'
7519                     ;;
7520                 esac
7521               ;;
7522               *)
7523                 objfmt='ELF ?'
7524               ;;
7525             esac
7527             AC_MSG_RESULT([$objfmt])
7528             if test "$objfmt" = 'ELF ?'; then
7529               objfmt='ELF'
7530               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
7531             fi
7533             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
7534             case "$objfmt" in
7535               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
7536               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
7537               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
7538               COFF)       NAFLAGS='-fcoff -DCOFF';;
7539               a.out)      NAFLAGS='-faout -DAOUT';;
7540               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
7541               ELF)        NAFLAGS='-felf -DELF';;
7542               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
7543               RDF)        NAFLAGS='-frdf -DRDF';;
7544               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
7545               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
7546             esac
7547             AC_MSG_RESULT([$NAFLAGS])
7549             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
7550             cat > conftest.asm << EOF
7551             [%line __oline__ "configure"
7552                     section .text
7553                     global  _main,main
7554             _main:
7555             main:   xor     eax,eax
7556                     ret
7557             ]
7559             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
7560             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
7561               AC_MSG_RESULT(yes)
7562             else
7563               echo "configure: failed program was:" >&AC_FD_CC
7564               cat conftest.asm >&AC_FD_CC
7565               rm -rf conftest*
7566               AC_MSG_RESULT(no)
7567               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
7568               NASM=""
7569             fi
7571         fi
7573         if test -z "$NASM"; then
7574 cat << _EOS
7575 ****************************************************************************
7576 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
7577 To get one please:
7579 _EOS
7580             if test "$build_os" = "cygwin"; then
7581 cat << _EOS
7582 install a pre-compiled binary for Win32
7584 mkdir -p /opt/lo/bin
7585 cd /opt/lo/bin
7586 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7587 chmod +x nasm
7589 or get and install one from http://www.nasm.us/
7591 Then re-run autogen.sh
7593 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7594 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7596 _EOS
7597             else
7598 cat << _EOS
7599 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
7601 _EOS
7602             fi
7603             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
7604             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
7605         fi
7606       ;;
7607     esac
7610 AC_SUBST(NASM)
7611 AC_SUBST(LIBJPEG_CFLAGS)
7612 AC_SUBST(LIBJPEG_LIBS)
7613 AC_SUBST(SYSTEM_LIBJPEG)
7615 dnl ===================================================================
7616 dnl Check for system clucene
7617 dnl ===================================================================
7618 dnl we should rather be using
7619 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7620 dnl but the contribs-lib check seems tricky
7621 AC_MSG_CHECKING([which clucene to use])
7622 if test "$with_system_clucene" = "yes"; then
7623     AC_MSG_RESULT([external])
7624     SYSTEM_CLUCENE=TRUE
7625     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7626     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7627     FilterLibs "${CLUCENE_LIBS}"
7628     CLUCENE_LIBS="${filteredlibs}"
7629     AC_LANG_PUSH([C++])
7630     save_CXXFLAGS=$CXXFLAGS
7631     save_CPPFLAGS=$CPPFLAGS
7632     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7633     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7634     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7635     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7636     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7637                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7638     CXXFLAGS=$save_CXXFLAGS
7639     CPPFLAGS=$save_CPPFLAGS
7640     AC_LANG_POP([C++])
7642     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7643 else
7644     AC_MSG_RESULT([internal])
7645     SYSTEM_CLUCENE=
7646     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7648 AC_SUBST(SYSTEM_CLUCENE)
7649 AC_SUBST(CLUCENE_CFLAGS)
7650 AC_SUBST(CLUCENE_LIBS)
7652 dnl ===================================================================
7653 dnl Check for system expat
7654 dnl ===================================================================
7655 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
7657 dnl ===================================================================
7658 dnl Check for system xmlsec
7659 dnl ===================================================================
7660 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24])
7662 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7663 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7664     ENABLE_EOT="TRUE"
7665     AC_DEFINE([ENABLE_EOT])
7666     AC_MSG_RESULT([yes])
7668     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7669 else
7670     ENABLE_EOT=
7671     AC_MSG_RESULT([no])
7673 AC_SUBST([ENABLE_EOT])
7675 dnl ===================================================================
7676 dnl Check for DLP libs
7677 dnl ===================================================================
7678 AS_IF([test "$COM" = "MSC"],
7679       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7680       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7682 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7684 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7686 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
7688 AS_IF([test "$COM" = "MSC"],
7689       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7690       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7692 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7694 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7696 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7697 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.8])
7699 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7701 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7703 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7705 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
7706 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.13])
7708 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
7709 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.7])
7711 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7713 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
7714 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
7716 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7718 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7720 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
7722 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
7724 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
7725 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.4])
7727 dnl ===================================================================
7728 dnl Check for system libcmis
7729 dnl ===================================================================
7730 # libcmis requires curl and we can't build curl for iOS
7731 if test $_os != iOS; then
7732     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.0])
7733     ENABLE_LIBCMIS=TRUE
7734 else
7735     ENABLE_LIBCMIS=
7737 AC_SUBST(ENABLE_LIBCMIS)
7739 dnl ===================================================================
7740 dnl Check for system lcms2
7741 dnl ===================================================================
7742 if test "$with_system_lcms2" != "yes"; then
7743     SYSTEM_LCMS2=
7745 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7746 if test "$GCC" = "yes"; then
7747     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7749 if test "$COM" = "MSC"; then # override the above
7750     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7753 dnl ===================================================================
7754 dnl Check for system cppunit
7755 dnl ===================================================================
7756 if test "$cross_compiling" != "yes"; then
7757     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
7760 dnl ===================================================================
7761 dnl Check whether freetype is available
7762 dnl ===================================================================
7763 if test  "$test_freetype" = "yes"; then
7764     AC_MSG_CHECKING([whether freetype is available])
7765     # FreeType has 3 different kinds of versions
7766     # * release, like 2.4.10
7767     # * libtool, like 13.0.7 (this what pkg-config returns)
7768     # * soname
7769     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7770     #
7771     # 9.9.3 is 2.2.0
7772     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7773     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7774     FilterLibs "${FREETYPE_LIBS}"
7775     FREETYPE_LIBS="${filteredlibs}"
7776     SYSTEM_FREETYPE=TRUE
7777 else
7778     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
7779     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
7781 AC_SUBST(FREETYPE_CFLAGS)
7782 AC_SUBST(FREETYPE_LIBS)
7783 AC_SUBST([SYSTEM_FREETYPE])
7785 # ===================================================================
7786 # Check for system libxslt
7787 # to prevent incompatibilities between internal libxml2 and external libxslt,
7788 # or vice versa, use with_system_libxml here
7789 # ===================================================================
7790 if test "$with_system_libxml" = "auto"; then
7791     case "$_os" in
7792     WINNT|iOS|Android)
7793         with_system_libxml="$with_system_libs"
7794         ;;
7795     *)
7796         if test "$enable_fuzzers" != "yes"; then
7797             with_system_libxml=yes
7798         else
7799             with_system_libxml=no
7800         fi
7801         ;;
7802     esac
7805 AC_MSG_CHECKING([which libxslt to use])
7806 if test "$with_system_libxml" = "yes"; then
7807     AC_MSG_RESULT([external])
7808     SYSTEM_LIBXSLT=TRUE
7809     if test "$_os" = "Darwin"; then
7810         dnl make sure to use SDK path
7811         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7812         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7813         dnl omit -L/usr/lib
7814         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7815         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7816     else
7817         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7818         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7819         FilterLibs "${LIBXSLT_LIBS}"
7820         LIBXSLT_LIBS="${filteredlibs}"
7821         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7822         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7823         FilterLibs "${LIBEXSLT_LIBS}"
7824         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
7825     fi
7827     dnl Check for xsltproc
7828     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7829     if test "$XSLTPROC" = "no"; then
7830         AC_MSG_ERROR([xsltproc is required])
7831     fi
7832 else
7833     AC_MSG_RESULT([internal])
7834     SYSTEM_LIBXSLT=
7835     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
7837     if test "$cross_compiling" = "yes"; then
7838         AC_PATH_PROG(XSLTPROC, xsltproc, no)
7839         if test "$XSLTPROC" = "no"; then
7840             AC_MSG_ERROR([xsltproc is required])
7841         fi
7842     fi
7844 AC_SUBST(SYSTEM_LIBXSLT)
7845 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
7846     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
7848 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
7850 AC_SUBST(LIBEXSLT_CFLAGS)
7851 AC_SUBST(LIBEXSLT_LIBS)
7852 AC_SUBST(LIBXSLT_CFLAGS)
7853 AC_SUBST(LIBXSLT_LIBS)
7854 AC_SUBST(XSLTPROC)
7856 # ===================================================================
7857 # Check for system libxml
7858 # ===================================================================
7859 AC_MSG_CHECKING([which libxml to use])
7860 if test "$with_system_libxml" = "yes"; then
7861     AC_MSG_RESULT([external])
7862     SYSTEM_LIBXML=TRUE
7863     if test "$_os" = "Darwin"; then
7864         dnl make sure to use SDK path
7865         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7866         dnl omit -L/usr/lib
7867         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
7868     elif test $_os = iOS; then
7869         dnl make sure to use SDK path
7870         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
7871         LIBXML_CFLAGS="-I$usr/include/libxml2"
7872         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
7873     else
7874         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
7875         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7876         FilterLibs "${LIBXML_LIBS}"
7877         LIBXML_LIBS="${filteredlibs}"
7878     fi
7880     dnl Check for xmllint
7881     AC_PATH_PROG(XMLLINT, xmllint, no)
7882     if test "$XMLLINT" = "no"; then
7883         AC_MSG_ERROR([xmllint is required])
7884     fi
7885 else
7886     AC_MSG_RESULT([internal])
7887     SYSTEM_LIBXML=
7888     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
7889     if test "$COM" = "MSC"; then
7890         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
7891     fi
7892     if test "$COM" = "MSC"; then
7893         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
7894     else
7895         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
7896     fi
7897     BUILD_TYPE="$BUILD_TYPE LIBXML2"
7899 AC_SUBST(SYSTEM_LIBXML)
7900 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
7901     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
7903 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
7904 AC_SUBST(LIBXML_CFLAGS)
7905 AC_SUBST(LIBXML_LIBS)
7906 AC_SUBST(XMLLINT)
7908 # =====================================================================
7909 # Checking for a Python interpreter with version >= 2.6.
7910 # Build and runtime requires Python 3 compatible version (>= 2.6).
7911 # Optionally user can pass an option to configure, i. e.
7912 # ./configure PYTHON=/usr/bin/python
7913 # =====================================================================
7914 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
7915     # This allows a lack of system python with no error, we use internal one in that case.
7916     AM_PATH_PYTHON([2.6],, [:])
7917     # Clean PYTHON_VERSION checked below if cross-compiling
7918     PYTHON_VERSION=""
7919     if test "$PYTHON" != ":"; then
7920         PYTHON_FOR_BUILD=$PYTHON
7921     fi
7923 AC_SUBST(PYTHON_FOR_BUILD)
7925 # Checks for Python to use for Pyuno
7926 AC_MSG_CHECKING([which Python to use for Pyuno])
7927 case "$enable_python" in
7928 no|disable)
7929     if test -z $PYTHON_FOR_BUILD; then
7930         # Python is required to build LibreOffice. In theory we could separate the build-time Python
7931         # requirement from the choice whether to include Python stuff in the installer, but why
7932         # bother?
7933         AC_MSG_ERROR([Python is required at build time.])
7934     fi
7935     enable_python=no
7936     AC_MSG_RESULT([none])
7937     ;;
7938 ""|yes|auto)
7939     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
7940         AC_MSG_RESULT([no, overridden by --disable-scripting])
7941         enable_python=no
7942     elif test $build_os = cygwin; then
7943         dnl When building on Windows we don't attempt to use any installed
7944         dnl "system"  Python.
7945         AC_MSG_RESULT([fully internal])
7946         enable_python=internal
7947     elif test "$cross_compiling" = yes; then
7948         AC_MSG_RESULT([system])
7949         enable_python=system
7950     else
7951         # Unset variables set by the above AM_PATH_PYTHON so that
7952         # we actually do check anew.
7953         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
7954         AM_PATH_PYTHON([3.3],, [:])
7955         if test "$PYTHON" = ":"; then
7956             if test -z "$PYTHON_FOR_BUILD"; then
7957                 AC_MSG_RESULT([fully internal])
7958             else
7959                 AC_MSG_RESULT([internal])
7960             fi
7961             enable_python=internal
7962         else
7963             AC_MSG_RESULT([system])
7964             enable_python=system
7965         fi
7966     fi
7967     ;;
7968 internal)
7969     AC_MSG_RESULT([internal])
7970     ;;
7971 fully-internal)
7972     AC_MSG_RESULT([fully internal])
7973     enable_python=internal
7974     ;;
7975 system)
7976     AC_MSG_RESULT([system])
7977     ;;
7979     AC_MSG_ERROR([Incorrect --enable-python option])
7980     ;;
7981 esac
7983 if test $enable_python != no; then
7984     BUILD_TYPE="$BUILD_TYPE PYUNO"
7987 if test $enable_python = system; then
7988     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
7989         python_version=2.7
7990         PYTHON=python$python_version
7991         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
7992             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
7993             PYTHON_LIBS="-framework Python"
7994         else
7995             PYTHON_CFLAGS="`$PYTHON-config --includes`"
7996             PYTHON_LIBS="`$PYTHON-config --libs`"
7997         fi
7998     fi
7999     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8000         # Fallback: Accept these in the environment, or as set above
8001         # for MacOSX.
8002         :
8003     elif test "$cross_compiling" != yes; then
8004         # Unset variables set by the above AM_PATH_PYTHON so that
8005         # we actually do check anew.
8006         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
8007         # This causes an error if no python command is found
8008         AM_PATH_PYTHON([3.3])
8009         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8010         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8011         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8012         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8013         if test -z "$PKG_CONFIG"; then
8014             PYTHON_CFLAGS="-I$python_include"
8015             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8016         elif $PKG_CONFIG --exists python-$python_version; then
8017             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8018             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8019         else
8020             PYTHON_CFLAGS="-I$python_include"
8021             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8022         fi
8023         FilterLibs "${PYTHON_LIBS}"
8024         PYTHON_LIBS="${filteredlibs}"
8025     else
8026         dnl How to find out the cross-compilation Python installation path?
8027         AC_MSG_CHECKING([for python version])
8028         AS_IF([test -n "$PYTHON_VERSION"],
8029               [AC_MSG_RESULT([$PYTHON_VERSION])],
8030               [AC_MSG_RESULT([not found])
8031                AC_MSG_ERROR([no usable python found])])
8032         test -n "$PYTHON_CFLAGS" && break
8033     fi
8034     # let the PYTHON_FOR_BUILD match the same python installation that
8035     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8036     # better for PythonTests.
8037     PYTHON_FOR_BUILD=$PYTHON
8040 dnl By now enable_python should be "system", "internal" or "no"
8041 case $enable_python in
8042 system)
8043     SYSTEM_PYTHON=TRUE
8045     dnl Check if the headers really work
8046     save_CPPFLAGS="$CPPFLAGS"
8047     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8048     AC_CHECK_HEADER(Python.h, [],
8049        [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
8050        [])
8051     CPPFLAGS="$save_CPPFLAGS"
8053     AC_LANG_PUSH(C)
8054     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8055     AC_MSG_CHECKING([for correct python library version])
8056        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8057 #include <Python.h>
8059 int main(int argc, char **argv) {
8060    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
8061        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8062    else return 1;
8064        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3, or Python >= 2.6 when building with Python 2])],[AC_MSG_RESULT([skipped; cross-compiling])])
8065     CFLAGS=$save_CFLAGS
8066     AC_LANG_POP(C)
8068     dnl FIXME Check if the Python library can be linked with, too?
8069     ;;
8071 internal)
8072     SYSTEM_PYTHON=
8073     PYTHON_VERSION_MAJOR=3
8074     PYTHON_VERSION_MINOR=5
8075     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.5
8076     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8077         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8078     fi
8079     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8080     BUILD_TYPE="$BUILD_TYPE PYTHON"
8081     # Embedded Python dies without Home set
8082     if test "$HOME" = ""; then
8083         export HOME=""
8084     fi
8085     # bz2 tarball and bzip2 is not standard
8086     if test -z "$BZIP2"; then
8087         AC_PATH_PROG( BZIP2, bzip2)
8088         if test -z "$BZIP2"; then
8089             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
8090         fi
8091     fi
8092     ;;
8094     DISABLE_PYTHON=TRUE
8095     SYSTEM_PYTHON=
8096     ;;
8098     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8099     ;;
8100 esac
8102 AC_SUBST(DISABLE_PYTHON)
8103 AC_SUBST(SYSTEM_PYTHON)
8104 AC_SUBST(PYTHON_CFLAGS)
8105 AC_SUBST(PYTHON_LIBS)
8106 AC_SUBST(PYTHON_VERSION)
8107 AC_SUBST(PYTHON_VERSION_MAJOR)
8108 AC_SUBST(PYTHON_VERSION_MINOR)
8110 ENABLE_MARIADBC=TRUE
8111 if test "$_os" = "iOS"; then
8112     ENABLE_MARIADBC=
8114 MARIADBC_MAJOR=1
8115 MARIADBC_MINOR=0
8116 MARIADBC_MICRO=2
8117 BUILD_TYPE="$BUILD_TYPE MARIADBC"
8119 AC_SUBST(ENABLE_MARIADBC)
8120 AC_SUBST(MARIADBC_MAJOR)
8121 AC_SUBST(MARIADBC_MINOR)
8122 AC_SUBST(MARIADBC_MICRO)
8124 if test "$ENABLE_MARIADBC" = "TRUE"; then
8125     dnl ===================================================================
8126     dnl Check for system MariaDB
8127     dnl ===================================================================
8128     AC_MSG_CHECKING([which MariaDB to use])
8129     if test "$with_system_mariadb" = "yes"; then
8130         AC_MSG_RESULT([external])
8131         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8132         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8133         if test -z "$MARIADBCONFIG"; then
8134             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8135             if test -z "$MARIADBCONFIG"; then
8136                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8137                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8138             fi
8139         fi
8140         AC_MSG_CHECKING([MariaDB version])
8141         MARIADB_VERSION=`$MARIADBCONFIG --version`
8142         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8143         if test "$MARIADB_MAJOR" -ge "5"; then
8144             AC_MSG_RESULT([OK])
8145         else
8146             AC_MSG_ERROR([too old, use 5.0.x or later])
8147         fi
8148         AC_MSG_CHECKING([for MariaDB Client library])
8149         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8150         if test "$COM_IS_CLANG" = TRUE; then
8151             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8152         fi
8153         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8154         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8155         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8156         dnl linux32:
8157         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8158             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8159             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8160                 | sed -e 's|/lib64/|/lib/|')
8161         fi
8162         FilterLibs "${MARIADB_LIBS}"
8163         MARIADB_LIBS="${filteredlibs}"
8164         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8165         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8166         if test "$enable_bundle_mariadb" = "yes"; then
8167             AC_MSG_RESULT([yes])
8168             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8169             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8171 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8173 /g' | grep -E '(mysqlclient|mariadb)')
8174             if test "$_os" = "Darwin"; then
8175                 LIBMARIADB=${LIBMARIADB}.dylib
8176             elif test "$_os" = "WINNT"; then
8177                 LIBMARIADB=${LIBMARIADB}.dll
8178             else
8179                 LIBMARIADB=${LIBMARIADB}.so
8180             fi
8181             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8182             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8183             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8184                 AC_MSG_RESULT([found.])
8185                 PathFormat "$LIBMARIADB_PATH"
8186                 LIBMARIADB_PATH="$formatted_path"
8187             else
8188                 AC_MSG_ERROR([not found.])
8189             fi
8190         else
8191             AC_MSG_RESULT([no])
8192             BUNDLE_MARIADB_CONNECTOR_C=
8193         fi
8194     else
8195         AC_MSG_RESULT([internal])
8196         SYSTEM_MARIADB_CONNECTOR_C=
8197         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8198         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8199         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8200     fi
8202     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8203     AC_SUBST(MARIADB_CFLAGS)
8204     AC_SUBST(MARIADB_LIBS)
8205     AC_SUBST(LIBMARIADB)
8206     AC_SUBST(LIBMARIADB_PATH)
8207     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8210 dnl ===================================================================
8211 dnl Check for system hsqldb
8212 dnl ===================================================================
8213 if test "$with_java" != "no"; then
8214     HSQLDB_USE_JDBC_4_1=
8215     AC_MSG_CHECKING([which hsqldb to use])
8216     if test "$with_system_hsqldb" = "yes"; then
8217         AC_MSG_RESULT([external])
8218         SYSTEM_HSQLDB=TRUE
8219         if test -z $HSQLDB_JAR; then
8220             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8221         fi
8222         if ! test -f $HSQLDB_JAR; then
8223                AC_MSG_ERROR(hsqldb.jar not found.)
8224         fi
8225         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8226         export HSQLDB_JAR
8227         if $PERL -e \
8228            'use Archive::Zip;
8229             my $file = "$ENV{'HSQLDB_JAR'}";
8230             my $zip = Archive::Zip->new( $file );
8231             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8232             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8233             {
8234                 push @l, split(/\n/, $mf);
8235                 foreach my $line (@l)
8236                 {
8237                     if ($line =~ m/Specification-Version:/)
8238                     {
8239                         ($t, $version) = split (/:/,$line);
8240                         $version =~ s/^\s//;
8241                         ($a, $b, $c, $d) = split (/\./,$version);
8242                         if ($c == "0" && $d > "8")
8243                         {
8244                             exit 0;
8245                         }
8246                         else
8247                         {
8248                             exit 1;
8249                         }
8250                     }
8251                 }
8252             }
8253             else
8254             {
8255                 exit 1;
8256             }'; then
8257             AC_MSG_RESULT([yes])
8258         else
8259             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8260         fi
8261     else
8262         AC_MSG_RESULT([internal])
8263         SYSTEM_HSQLDB=
8264         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8265         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8266         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8267         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8268             AC_MSG_RESULT([yes])
8269             HSQLDB_USE_JDBC_4_1=TRUE
8270         else
8271             AC_MSG_RESULT([no])
8272         fi
8273     fi
8274     AC_SUBST(SYSTEM_HSQLDB)
8275     AC_SUBST(HSQLDB_JAR)
8276     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8279 dnl ===================================================================
8280 dnl Check for PostgreSQL stuff
8281 dnl ===================================================================
8282 if test "x$enable_postgresql_sdbc" != "xno"; then
8283     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8285     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8286         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8287     fi
8288     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8289         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8290     fi
8292     postgres_interface=""
8293     if test "$with_system_postgresql" = "yes"; then
8294         postgres_interface="external PostgreSQL"
8295         SYSTEM_POSTGRESQL=TRUE
8296         if test "$_os" = Darwin; then
8297             supp_path=''
8298             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8299                 pg_supp_path="$P_SEP$d$pg_supp_path"
8300             done
8301         fi
8302         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8303         if test -z "$PGCONFIG"; then
8304             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8305         fi
8306         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8307         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8308         FilterLibs "${POSTGRESQL_LIB}"
8309         POSTGRESQL_LIB="${filteredlibs}"
8310     else
8311         # if/when anything else than PostgreSQL uses Kerberos,
8312         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8313         WITH_KRB5=
8314         WITH_GSSAPI=
8315         case "$_os" in
8316         Darwin)
8317             # MacOS X has system MIT Kerberos 5 since 10.4
8318             if test "$with_krb5" != "no"; then
8319                 WITH_KRB5=TRUE
8320                 save_LIBS=$LIBS
8321                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8322                 # that the libraries where these functions are located on macOS will change, is it?
8323                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8324                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8325                 KRB5_LIBS=$LIBS
8326                 LIBS=$save_LIBS
8327                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8328                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8329                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8330                 LIBS=$save_LIBS
8331             fi
8332             if test "$with_gssapi" != "no"; then
8333                 WITH_GSSAPI=TRUE
8334                 save_LIBS=$LIBS
8335                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8336                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8337                 GSSAPI_LIBS=$LIBS
8338                 LIBS=$save_LIBS
8339             fi
8340             ;;
8341         WINNT)
8342             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8343                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8344             fi
8345             ;;
8346         Linux|GNU|*BSD|DragonFly)
8347             if test "$with_krb5" != "no"; then
8348                 WITH_KRB5=TRUE
8349                 save_LIBS=$LIBS
8350                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8351                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8352                 KRB5_LIBS=$LIBS
8353                 LIBS=$save_LIBS
8354                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8355                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8356                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8357                 LIBS=$save_LIBS
8358             fi
8359             if test "$with_gssapi" != "no"; then
8360                 WITH_GSSAPI=TRUE
8361                 save_LIBS=$LIBS
8362                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8363                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8364                 GSSAPI_LIBS=$LIBS
8365                 LIBS=$save_LIBS
8366             fi
8367             ;;
8368         *)
8369             if test "$with_krb5" = "yes"; then
8370                 WITH_KRB5=TRUE
8371                 save_LIBS=$LIBS
8372                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8373                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8374                 KRB5_LIBS=$LIBS
8375                 LIBS=$save_LIBS
8376                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8377                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8378                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8379                 LIBS=$save_LIBS
8380             fi
8381             if test "$with_gssapi" = "yes"; then
8382                 WITH_GSSAPI=TRUE
8383                 save_LIBS=$LIBS
8384                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8385                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8386                 LIBS=$save_LIBS
8387                 GSSAPI_LIBS=$LIBS
8388             fi
8389         esac
8391         if test -n "$with_libpq_path"; then
8392             SYSTEM_POSTGRESQL=TRUE
8393             postgres_interface="external libpq"
8394             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8395             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8396         else
8397             SYSTEM_POSTGRESQL=
8398             postgres_interface="internal"
8399             POSTGRESQL_LIB=""
8400             POSTGRESQL_INC="%OVERRIDE_ME%"
8401             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8402         fi
8403     fi
8405     AC_MSG_CHECKING([PostgreSQL C interface])
8406     AC_MSG_RESULT([$postgres_interface])
8408     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8409         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8410         save_CFLAGS=$CFLAGS
8411         save_CPPFLAGS=$CPPFLAGS
8412         save_LIBS=$LIBS
8413         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8414         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8415         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8416         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8417             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8418         CFLAGS=$save_CFLAGS
8419         CPPFLAGS=$save_CPPFLAGS
8420         LIBS=$save_LIBS
8421     fi
8422     BUILD_POSTGRESQL_SDBC=TRUE
8424 AC_SUBST(WITH_KRB5)
8425 AC_SUBST(WITH_GSSAPI)
8426 AC_SUBST(GSSAPI_LIBS)
8427 AC_SUBST(KRB5_LIBS)
8428 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8429 AC_SUBST(SYSTEM_POSTGRESQL)
8430 AC_SUBST(POSTGRESQL_INC)
8431 AC_SUBST(POSTGRESQL_LIB)
8433 dnl ===================================================================
8434 dnl Check for Firebird stuff
8435 dnl ===================================================================
8436 ENABLE_FIREBIRD_SDBC=""
8437 if test "$enable_firebird_sdbc" = "yes" ; then
8438     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8440     dnl ===================================================================
8441     dnl Check for system Firebird
8442     dnl ===================================================================
8443     AC_MSG_CHECKING([which Firebird to use])
8444     if test "$with_system_firebird" = "yes"; then
8445         AC_MSG_RESULT([external])
8446         SYSTEM_FIREBIRD=TRUE
8447         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8448         if test -z "$FIREBIRDCONFIG"; then
8449             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8450             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8451                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8452             ])
8453             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8454         else
8455             AC_MSG_NOTICE([fb_config found])
8456             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8457             AC_MSG_CHECKING([for Firebird Client library])
8458             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8459             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8460             FilterLibs "${FIREBIRD_LIBS}"
8461             FIREBIRD_LIBS="${filteredlibs}"
8462         fi
8463         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8464         AC_MSG_CHECKING([Firebird version])
8465         if test -n "${FIREBIRD_VERSION}"; then
8466             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8467             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8468             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8469                 AC_MSG_RESULT([OK])
8470             else
8471                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
8472             fi
8473         else
8474             __save_CFLAGS="${CFLAGS}"
8475             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8476             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8477 #if defined(FB_API_VER) && FB_API_VER == 30
8478 int fb_api_is_30(void) { return 0; }
8479 #else
8480 #error "Wrong Firebird API version"
8481 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
8482             CFLAGS="${__save_CFLAGS}"
8483         fi
8484         ENABLE_FIREBIRD_SDBC="TRUE"
8485     elif test "$enable_database_connectivity" != yes; then
8486         AC_MSG_RESULT([none])
8487     elif test "$cross_compiling" = "yes"; then
8488         AC_MSG_RESULT([none])
8489     else
8490         dnl Embedded Firebird has version 3.0
8491         AC_DEFINE(HAVE_FIREBIRD_30, 1)
8492         dnl We need libatomic-ops for any non X86/X64 system
8493         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8494             dnl ===================================================================
8495             dnl Check for system libatomic-ops
8496             dnl ===================================================================
8497             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8498             if test "$with_system_libatomic_ops" = "yes"; then
8499                 SYSTEM_LIBATOMIC_OPS=TRUE
8500                 AC_CHECK_HEADERS(atomic_ops.h, [],
8501                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8502             else
8503                 SYSTEM_LIBATOMIC_OPS=
8504                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8505                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8506                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8507             fi
8508         fi
8510         AC_MSG_RESULT([internal])
8511         SYSTEM_FIREBIRD=
8512         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
8513         FIREBIRD_LIBS="-lfbclient"
8515         if test "$with_system_libtommath" = "yes"; then
8516             SYSTEM_LIBTOMMATH=TRUE
8517             dnl check for tommath presence
8518             save_LIBS=$LIBS
8519             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
8520             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
8521             LIBS=$save_LIBS
8522         else
8523             SYSTEM_LIBTOMMATH=
8524             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
8525             LIBTOMMATH_LIBS="-ltommath"
8526             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
8527         fi
8529         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8530         ENABLE_FIREBIRD_SDBC="TRUE"
8531     fi
8533 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8534 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8535 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8536 AC_SUBST(LIBATOMIC_OPS_LIBS)
8537 AC_SUBST(SYSTEM_FIREBIRD)
8538 AC_SUBST(FIREBIRD_CFLAGS)
8539 AC_SUBST(FIREBIRD_LIBS)
8540 AC_SUBST([TOMMATH_CFLAGS])
8541 AC_SUBST([TOMMATH_LIBS])
8543 dnl ===================================================================
8544 dnl Check for system curl
8545 dnl ===================================================================
8546 AC_MSG_CHECKING([which libcurl to use])
8547 if test "$with_system_curl" = "auto"; then
8548     with_system_curl="$with_system_libs"
8551 if test "$with_system_curl" = "yes"; then
8552     AC_MSG_RESULT([external])
8553     SYSTEM_CURL=TRUE
8555     # First try PKGCONFIG and then fall back
8556     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8558     if test -n "$CURL_PKG_ERRORS"; then
8559         AC_PATH_PROG(CURLCONFIG, curl-config)
8560         if test -z "$CURLCONFIG"; then
8561             AC_MSG_ERROR([curl development files not found])
8562         fi
8563         CURL_LIBS=`$CURLCONFIG --libs`
8564         FilterLibs "${CURL_LIBS}"
8565         CURL_LIBS="${filteredlibs}"
8566         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8567         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8569         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8570         case $curl_version in
8571         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8572         dnl so they need to be doubled to end up in the configure script
8573         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8574             AC_MSG_RESULT([yes])
8575             ;;
8576         *)
8577             AC_MSG_ERROR([no, you have $curl_version])
8578             ;;
8579         esac
8580     fi
8582     ENABLE_CURL=TRUE
8583 elif test $_os = iOS; then
8584     # Let's see if we need curl, I think not?
8585     AC_MSG_RESULT([none])
8586     ENABLE_CURL=
8587 else
8588     AC_MSG_RESULT([internal])
8589     SYSTEM_CURL=
8590     BUILD_TYPE="$BUILD_TYPE CURL"
8591     ENABLE_CURL=TRUE
8593 AC_SUBST(SYSTEM_CURL)
8594 AC_SUBST(CURL_CFLAGS)
8595 AC_SUBST(CURL_LIBS)
8596 AC_SUBST(ENABLE_CURL)
8598 dnl ===================================================================
8599 dnl Check for system boost
8600 dnl ===================================================================
8601 AC_MSG_CHECKING([which boost to use])
8602 if test "$with_system_boost" = "yes"; then
8603     AC_MSG_RESULT([external])
8604     SYSTEM_BOOST=TRUE
8605     AX_BOOST_BASE(1.47)
8606     AX_BOOST_DATE_TIME
8607     AX_BOOST_FILESYSTEM
8608     AX_BOOST_IOSTREAMS
8609     AX_BOOST_LOCALE
8610     AC_LANG_PUSH([C++])
8611     save_CXXFLAGS=$CXXFLAGS
8612     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8613     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8614        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8615     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8616        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8617     CXXFLAGS=$save_CXXFLAGS
8618     AC_LANG_POP([C++])
8619     # this is in m4/ax_boost_base.m4
8620     FilterLibs "${BOOST_LDFLAGS}"
8621     BOOST_LDFLAGS="${filteredlibs}"
8622 else
8623     AC_MSG_RESULT([internal])
8624     BUILD_TYPE="$BUILD_TYPE BOOST"
8625     SYSTEM_BOOST=
8626     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
8627         # use warning-suppressing wrapper headers
8628         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
8629     else
8630         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
8631     fi
8633 AC_SUBST(SYSTEM_BOOST)
8635 dnl ===================================================================
8636 dnl Check for system mdds
8637 dnl ===================================================================
8638 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.2 >= 1.2.3], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8640 dnl ===================================================================
8641 dnl Check for system glm
8642 dnl ===================================================================
8643 AC_MSG_CHECKING([which glm to use])
8644 if test "$with_system_glm" = "yes"; then
8645     AC_MSG_RESULT([external])
8646     SYSTEM_GLM=TRUE
8647     AC_LANG_PUSH([C++])
8648     AC_CHECK_HEADER([glm/glm.hpp], [],
8649        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8650     AC_LANG_POP([C++])
8651 else
8652     AC_MSG_RESULT([internal])
8653     BUILD_TYPE="$BUILD_TYPE GLM"
8654     SYSTEM_GLM=
8655     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8657 AC_SUBST([GLM_CFLAGS])
8658 AC_SUBST([SYSTEM_GLM])
8660 dnl ===================================================================
8661 dnl Check for system odbc
8662 dnl ===================================================================
8663 AC_MSG_CHECKING([which odbc headers to use])
8664 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
8665     AC_MSG_RESULT([external])
8666     SYSTEM_ODBC_HEADERS=TRUE
8668     if test "$build_os" = "cygwin"; then
8669         save_CPPFLAGS=$CPPFLAGS
8670         find_winsdk
8671         PathFormat "$winsdktest"
8672         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"
8673         AC_CHECK_HEADER(sqlext.h, [],
8674             [AC_MSG_ERROR(odbc not found. install odbc)],
8675             [#include <windows.h>])
8676         CPPFLAGS=$save_CPPFLAGS
8677     else
8678         AC_CHECK_HEADER(sqlext.h, [],
8679             [AC_MSG_ERROR(odbc not found. install odbc)],[])
8680     fi
8681 elif test "$enable_database_connectivity" != yes; then
8682     AC_MSG_RESULT([none])
8683 else
8684     AC_MSG_RESULT([internal])
8685     SYSTEM_ODBC_HEADERS=
8687 AC_SUBST(SYSTEM_ODBC_HEADERS)
8690 dnl ===================================================================
8691 dnl Check for system openldap
8692 dnl ===================================================================
8694 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8695 AC_MSG_CHECKING([which openldap library to use])
8696 if test "$with_system_openldap" = "yes"; then
8697     AC_MSG_RESULT([external])
8698     SYSTEM_OPENLDAP=TRUE
8699     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8700     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8701     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8702 else
8703     AC_MSG_RESULT([internal])
8704     SYSTEM_OPENLDAP=
8705     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8708 AC_SUBST(SYSTEM_OPENLDAP)
8710 dnl ===================================================================
8711 dnl Check for system NSS
8712 dnl ===================================================================
8713 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
8714     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8715     AC_DEFINE(HAVE_FEATURE_NSS)
8716     ENABLE_NSS="TRUE"
8717     AC_DEFINE(ENABLE_NSS)
8718 elif test $_os != iOS ; then
8719     with_tls=openssl
8721 AC_SUBST(ENABLE_NSS)
8723 dnl ===================================================================
8724 dnl Check for TLS/SSL and cryptographic implementation to use
8725 dnl ===================================================================
8726 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8727 if test -n "$with_tls"; then
8728     case $with_tls in
8729     openssl)
8730         AC_DEFINE(USE_TLS_OPENSSL)
8731         TLS=OPENSSL
8733         if test "$enable_openssl" != "yes"; then
8734             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8735         fi
8737         # warn that OpenSSL has been selected but not all TLS code has this option
8738         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
8739         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
8740         ;;
8741     nss)
8742         AC_DEFINE(USE_TLS_NSS)
8743         TLS=NSS
8744         ;;
8745     no)
8746         AC_MSG_WARN([Skipping TLS/SSL])
8747         ;;
8748     *)
8749         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8750 openssl - OpenSSL
8751 nss - Mozilla's Network Security Services (NSS)
8752     ])
8753         ;;
8754     esac
8755 else
8756     # default to using NSS, it results in smaller oox lib
8757     AC_DEFINE(USE_TLS_NSS)
8758     TLS=NSS
8760 AC_MSG_RESULT([$TLS])
8761 AC_SUBST(TLS)
8763 dnl ===================================================================
8764 dnl Check for system sane
8765 dnl ===================================================================
8766 AC_MSG_CHECKING([which sane header to use])
8767 if test "$with_system_sane" = "yes"; then
8768     AC_MSG_RESULT([external])
8769     AC_CHECK_HEADER(sane/sane.h, [],
8770       [AC_MSG_ERROR(sane not found. install sane)], [])
8771 else
8772     AC_MSG_RESULT([internal])
8773     BUILD_TYPE="$BUILD_TYPE SANE"
8776 dnl ===================================================================
8777 dnl Check for system icu
8778 dnl ===================================================================
8779 SYSTEM_GENBRK=
8780 SYSTEM_GENCCODE=
8781 SYSTEM_GENCMN=
8783 ICU_MAJOR=60
8784 ICU_MINOR=2
8785 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
8786 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
8787 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
8788 AC_MSG_CHECKING([which icu to use])
8789 if test "$with_system_icu" = "yes"; then
8790     AC_MSG_RESULT([external])
8791     SYSTEM_ICU=TRUE
8792     AC_LANG_PUSH([C++])
8793     AC_MSG_CHECKING([for unicode/rbbi.h])
8794     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
8795     AC_LANG_POP([C++])
8797     if test "$cross_compiling" != "yes"; then
8798         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
8799         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
8800         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
8801         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
8802     fi
8804     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
8805         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
8806         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
8807         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
8808         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
8809         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
8810             AC_MSG_RESULT([yes])
8811         else
8812             AC_MSG_RESULT([no])
8813             if test "$with_system_icu_for_build" != "force"; then
8814                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
8815 You can use --with-system-icu-for-build=force to use it anyway.])
8816             fi
8817         fi
8818     fi
8820     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
8821         # using the system icu tools can lead to version confusion, use the
8822         # ones from the build environment when cross-compiling
8823         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
8824         if test -z "$SYSTEM_GENBRK"; then
8825             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
8826         fi
8827         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8828         if test -z "$SYSTEM_GENCCODE"; then
8829             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
8830         fi
8831         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8832         if test -z "$SYSTEM_GENCMN"; then
8833             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
8834         fi
8835         if test "$ICU_MAJOR" -ge "49"; then
8836             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
8837             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
8838             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
8839         else
8840             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
8841             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
8842             ICU_RECLASSIFIED_HEBREW_LETTER=
8843         fi
8844     fi
8846     if test "$cross_compiling" = "yes"; then
8847         if test "$ICU_MAJOR" -ge "50"; then
8848             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
8849             ICU_MINOR=""
8850         fi
8851     fi
8852 else
8853     AC_MSG_RESULT([internal])
8854     SYSTEM_ICU=
8855     BUILD_TYPE="$BUILD_TYPE ICU"
8856     # surprisingly set these only for "internal" (to be used by various other
8857     # external libs): the system icu-config is quite unhelpful and spits out
8858     # dozens of weird flags and also default path -I/usr/include
8859     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8860     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
8862 if test "$ICU_MAJOR" -ge "59"; then
8863     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
8864     # with -std=c++11 but not all external libraries can be built with that,
8865     # for those use a bit-compatible typedef uint16_t UChar; see
8866     # icu/source/common/unicode/umachine.h
8867     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
8868 else
8869     ICU_UCHAR_TYPE=""
8871 AC_SUBST(SYSTEM_ICU)
8872 AC_SUBST(SYSTEM_GENBRK)
8873 AC_SUBST(SYSTEM_GENCCODE)
8874 AC_SUBST(SYSTEM_GENCMN)
8875 AC_SUBST(ICU_MAJOR)
8876 AC_SUBST(ICU_MINOR)
8877 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
8878 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
8879 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
8880 AC_SUBST(ICU_CFLAGS)
8881 AC_SUBST(ICU_LIBS)
8882 AC_SUBST(ICU_UCHAR_TYPE)
8884 dnl ==================================================================
8885 dnl Breakpad
8886 dnl ==================================================================
8887 AC_MSG_CHECKING([whether to enable breakpad])
8888 if test "$enable_breakpad" != yes; then
8889     AC_MSG_RESULT([no])
8890 else
8891     AC_MSG_RESULT([yes])
8892     ENABLE_BREAKPAD="TRUE"
8893     AC_DEFINE(ENABLE_BREAKPAD)
8894     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
8895     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
8897     AC_MSG_CHECKING([for crashreport config])
8898     if test "$with_symbol_config" = "no"; then
8899         BREAKPAD_SYMBOL_CONFIG="invalid"
8900         AC_MSG_RESULT([no])
8901     else
8902         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
8903         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
8904         AC_MSG_RESULT([yes])
8905     fi
8906     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
8908 AC_SUBST(ENABLE_BREAKPAD)
8910 dnl ==================================================================
8911 dnl libfuzzer
8912 dnl ==================================================================
8913 AC_MSG_CHECKING([whether to enable fuzzers])
8914 if test "$enable_fuzzers" != yes; then
8915     AC_MSG_RESULT([no])
8916 else
8917     AC_MSG_RESULT([yes])
8918     ENABLE_FUZZERS="TRUE"
8919     AC_DEFINE(ENABLE_FUZZERS)
8920     BUILD_TYPE="$BUILD_TYPE FUZZERS"
8922 AC_SUBST(ENABLE_FUZZERS)
8924 dnl ===================================================================
8925 dnl Orcus
8926 dnl ===================================================================
8927 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.13 >= 0.13.3])
8928 if test "$with_system_orcus" != "yes"; then
8929     if test "$SYSTEM_BOOST" = "TRUE"; then
8930         # ===========================================================
8931         # Determine if we are going to need to link with Boost.System
8932         # ===========================================================
8933         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
8934         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
8935         dnl in documentation has no effect.
8936         AC_MSG_CHECKING([if we need to link with Boost.System])
8937         AC_LANG_PUSH([C++])
8938         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
8939                 @%:@include <boost/version.hpp>
8940             ]],[[
8941                 #if BOOST_VERSION >= 105000
8942                 #   error yes, we need to link with Boost.System
8943                 #endif
8944             ]])],[
8945                 AC_MSG_RESULT([no])
8946             ],[
8947                 AC_MSG_RESULT([yes])
8948                 AX_BOOST_SYSTEM
8949         ])
8950         AC_LANG_POP([C++])
8951     fi
8953 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
8954 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
8955 AC_SUBST([BOOST_SYSTEM_LIB])
8956 AC_SUBST(SYSTEM_LIBORCUS)
8958 dnl ===================================================================
8959 dnl HarfBuzz
8960 dnl ===================================================================
8961 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
8962                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
8963                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
8965 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
8966                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
8967                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
8969 if test "$COM" = "MSC"; then # override the above
8970     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
8971     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
8974 if test "$with_system_harfbuzz" = "yes"; then
8975     if test "$with_system_graphite" = "no"; then
8976         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
8977     fi
8978     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
8979     _save_libs="$LIBS"
8980     _save_cflags="$CFLAGS"
8981     LIBS="$LIBS $HARFBUZZ_LIBS"
8982     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
8983     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
8984     LIBS="$_save_libs"
8985     CFLAGS="$_save_cflags"
8986 else
8987     if test "$with_system_graphite" = "yes"; then
8988         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
8989     fi
8992 AC_MSG_CHECKING([whether to use X11])
8993 dnl ***************************************
8994 dnl testing for X libraries and includes...
8995 dnl ***************************************
8996 if test "$USING_X11" = TRUE; then
8997     AC_DEFINE(HAVE_FEATURE_X11)
8999 AC_MSG_RESULT([$USING_X11])
9001 if test "$USING_X11" = TRUE; then
9002     AC_PATH_X
9003     AC_PATH_XTRA
9004     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9006     if test -z "$x_includes"; then
9007         x_includes="default_x_includes"
9008     fi
9009     if test -z "$x_libraries"; then
9010         x_libraries="default_x_libraries"
9011     fi
9012     CFLAGS="$CFLAGS $X_CFLAGS"
9013     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9014     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9015 else
9016     x_includes="no_x_includes"
9017     x_libraries="no_x_libraries"
9020 if test "$USING_X11" = TRUE; then
9021     dnl ===================================================================
9022     dnl Check for extension headers
9023     dnl ===================================================================
9024     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9025      [#include <X11/extensions/shape.h>])
9027     # vcl needs ICE and SM
9028     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9029     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9030         [AC_MSG_ERROR(ICE library not found)])
9031     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9032     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9033         [AC_MSG_ERROR(SM library not found)])
9036 dnl ===================================================================
9037 dnl Check for system Xrender
9038 dnl ===================================================================
9039 AC_MSG_CHECKING([whether to use Xrender])
9040 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9041     AC_MSG_RESULT([yes])
9042     PKG_CHECK_MODULES(XRENDER, xrender)
9043     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9044     FilterLibs "${XRENDER_LIBS}"
9045     XRENDER_LIBS="${filteredlibs}"
9046     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9047       [AC_MSG_ERROR(libXrender not found or functional)], [])
9048     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9049       [AC_MSG_ERROR(Xrender not found. install X)], [])
9050 else
9051     AC_MSG_RESULT([no])
9053 AC_SUBST(XRENDER_CFLAGS)
9054 AC_SUBST(XRENDER_LIBS)
9056 dnl ===================================================================
9057 dnl Check for XRandr
9058 dnl ===================================================================
9059 AC_MSG_CHECKING([whether to enable RandR support])
9060 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9061     AC_MSG_RESULT([yes])
9062     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9063     if test "$ENABLE_RANDR" != "TRUE"; then
9064         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9065                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9066         XRANDR_CFLAGS=" "
9067         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9068           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9069         XRANDR_LIBS="-lXrandr "
9070         ENABLE_RANDR="TRUE"
9071     fi
9072     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9073     FilterLibs "${XRANDR_LIBS}"
9074     XRANDR_LIBS="${filteredlibs}"
9075 else
9076     ENABLE_RANDR=""
9077     AC_MSG_RESULT([no])
9079 AC_SUBST(XRANDR_CFLAGS)
9080 AC_SUBST(XRANDR_LIBS)
9081 AC_SUBST(ENABLE_RANDR)
9083 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9084     WITH_WEBDAV="serf"
9086 if test $_os = iOS -o $_os = Android; then
9087     WITH_WEBDAV="no"
9089 AC_MSG_CHECKING([for webdav library])
9090 case "$WITH_WEBDAV" in
9091 serf)
9092     AC_MSG_RESULT([serf])
9093     # Check for system apr-util
9094     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9095                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9096                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9097     if test "$COM" = "MSC"; then
9098         APR_LIB_DIR="LibR"
9099         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9100         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9101     fi
9103     # Check for system serf
9104     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9105                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9106     if test "$COM" = "MSC"; then
9107         SERF_LIB_DIR="Release"
9108         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9109         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9110     fi
9111     ;;
9112 neon)
9113     AC_MSG_RESULT([neon])
9114     # Check for system neon
9115     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9116     if test "$with_system_neon" = "yes"; then
9117         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9118     else
9119         NEON_VERSION=0295
9120     fi
9121     AC_SUBST(NEON_VERSION)
9122     ;;
9124     AC_MSG_RESULT([none, disabled])
9125     WITH_WEBDAV=""
9126     ;;
9127 esac
9128 AC_SUBST(WITH_WEBDAV)
9130 dnl ===================================================================
9131 dnl Check for disabling cve_tests
9132 dnl ===================================================================
9133 AC_MSG_CHECKING([whether to execute CVE tests])
9134 # If not explicitly enabled or disabled, default
9135 if test -z "$enable_cve_tests"; then
9136     case "$OS" in
9137     WNT)
9138         # Default cves off for windows with its wild and wonderful
9139         # varienty of AV software kicking in and panicing
9140         enable_cve_tests=no
9141         ;;
9142     *)
9143         # otherwise yes
9144         enable_cve_tests=yes
9145         ;;
9146     esac
9148 if test "$enable_cve_tests" = "no"; then
9149     AC_MSG_RESULT([no])
9150     DISABLE_CVE_TESTS=TRUE
9151     AC_SUBST(DISABLE_CVE_TESTS)
9152 else
9153     AC_MSG_RESULT([yes])
9156 dnl ===================================================================
9157 dnl Check for enabling chart XShape tests
9158 dnl ===================================================================
9159 AC_MSG_CHECKING([whether to execute chart XShape tests])
9160 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9161     AC_MSG_RESULT([yes])
9162     ENABLE_CHART_TESTS=TRUE
9163     AC_SUBST(ENABLE_CHART_TESTS)
9164 else
9165     AC_MSG_RESULT([no])
9168 dnl ===================================================================
9169 dnl Check for system openssl
9170 dnl ===================================================================
9171 DISABLE_OPENSSL=
9172 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9173 if test "$enable_openssl" = "yes"; then
9174     AC_MSG_RESULT([no])
9175     if test "$_os" = Darwin ; then
9176         # OpenSSL is deprecated when building for 10.7 or later.
9177         #
9178         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9179         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9181         with_system_openssl=no
9182         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9183     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9184             && test "$with_system_openssl" != "no"; then
9185         with_system_openssl=yes
9186         SYSTEM_OPENSSL=TRUE
9187         OPENSSL_CFLAGS=
9188         OPENSSL_LIBS="-lssl -lcrypto"
9189     else
9190         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9191     fi
9192     if test "$with_system_openssl" = "yes"; then
9193         AC_MSG_CHECKING([whether openssl supports SHA512])
9194         AC_LANG_PUSH([C])
9195         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9196             SHA512_CTX context;
9197 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9198         AC_LANG_POP(C)
9199     fi
9200 else
9201     AC_MSG_RESULT([yes])
9202     DISABLE_OPENSSL=TRUE
9204     # warn that although OpenSSL is disabled, system libraries may depend on it
9205     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9206     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9209 AC_SUBST([DISABLE_OPENSSL])
9211 dnl ===================================================================
9212 dnl Check for building gnutls
9213 dnl ===================================================================
9214 AC_MSG_CHECKING([whether to use gnutls])
9215 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9216     AC_MSG_RESULT([yes])
9217     AM_PATH_LIBGCRYPT()
9218     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9219         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9220                       available in the system to use as replacement.]]))
9221     FilterLibs "${LIBGCRYPT_LIBS}"
9222     LIBGCRYPT_LIBS="${filteredlibs}"
9223 else
9224     AC_MSG_RESULT([no])
9227 AC_SUBST([LIBGCRYPT_CFLAGS])
9228 AC_SUBST([LIBGCRYPT_LIBS])
9230 dnl ===================================================================
9231 dnl Check for system redland
9232 dnl ===================================================================
9233 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9234 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9235 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9236 if test "$with_system_redland" = "yes"; then
9237     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9238             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9239 else
9240     RAPTOR_MAJOR="0"
9241     RASQAL_MAJOR="3"
9242     REDLAND_MAJOR="0"
9244 AC_SUBST(RAPTOR_MAJOR)
9245 AC_SUBST(RASQAL_MAJOR)
9246 AC_SUBST(REDLAND_MAJOR)
9248 dnl ===================================================================
9249 dnl Check for system hunspell
9250 dnl ===================================================================
9251 AC_MSG_CHECKING([which libhunspell to use])
9252 if test "$with_system_hunspell" = "yes"; then
9253     AC_MSG_RESULT([external])
9254     SYSTEM_HUNSPELL=TRUE
9255     AC_LANG_PUSH([C++])
9256     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9257     if test "$HUNSPELL_PC" != "TRUE"; then
9258         AC_CHECK_HEADER(hunspell.hxx, [],
9259             [
9260             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9261             [AC_MSG_ERROR(hunspell headers not found.)], [])
9262             ], [])
9263         AC_CHECK_LIB([hunspell], [main], [:],
9264            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9265         HUNSPELL_LIBS=-lhunspell
9266     fi
9267     AC_LANG_POP([C++])
9268     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9269     FilterLibs "${HUNSPELL_LIBS}"
9270     HUNSPELL_LIBS="${filteredlibs}"
9271 else
9272     AC_MSG_RESULT([internal])
9273     SYSTEM_HUNSPELL=
9274     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9275     if test "$COM" = "MSC"; then
9276         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9277     else
9278         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.6"
9279     fi
9280     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9282 AC_SUBST(SYSTEM_HUNSPELL)
9283 AC_SUBST(HUNSPELL_CFLAGS)
9284 AC_SUBST(HUNSPELL_LIBS)
9286 dnl ===================================================================
9287 dnl Checking for altlinuxhyph
9288 dnl ===================================================================
9289 AC_MSG_CHECKING([which altlinuxhyph to use])
9290 if test "$with_system_altlinuxhyph" = "yes"; then
9291     AC_MSG_RESULT([external])
9292     SYSTEM_HYPH=TRUE
9293     AC_CHECK_HEADER(hyphen.h, [],
9294        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9295     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9296        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9297        [#include <hyphen.h>])
9298     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9299         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9300     if test -z "$HYPHEN_LIB"; then
9301         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9302            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9303     fi
9304     if test -z "$HYPHEN_LIB"; then
9305         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9306            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9307     fi
9308 else
9309     AC_MSG_RESULT([internal])
9310     SYSTEM_HYPH=
9311     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9312     if test "$COM" = "MSC"; then
9313         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9314     else
9315         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9316     fi
9318 AC_SUBST(SYSTEM_HYPH)
9319 AC_SUBST(HYPHEN_LIB)
9321 dnl ===================================================================
9322 dnl Checking for mythes
9323 dnl ===================================================================
9324 AC_MSG_CHECKING([which mythes to use])
9325 if test "$with_system_mythes" = "yes"; then
9326     AC_MSG_RESULT([external])
9327     SYSTEM_MYTHES=TRUE
9328     AC_LANG_PUSH([C++])
9329     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9330     if test "$MYTHES_PKGCONFIG" = "no"; then
9331         AC_CHECK_HEADER(mythes.hxx, [],
9332             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9333         AC_CHECK_LIB([mythes-1.2], [main], [:],
9334             [ MYTHES_FOUND=no], [])
9335     if test "$MYTHES_FOUND" = "no"; then
9336         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9337                 [ MYTHES_FOUND=no], [])
9338     fi
9339     if test "$MYTHES_FOUND" = "no"; then
9340         AC_MSG_ERROR([mythes library not found!.])
9341     fi
9342     fi
9343     AC_LANG_POP([C++])
9344     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9345     FilterLibs "${MYTHES_LIBS}"
9346     MYTHES_LIBS="${filteredlibs}"
9347 else
9348     AC_MSG_RESULT([internal])
9349     SYSTEM_MYTHES=
9350     BUILD_TYPE="$BUILD_TYPE MYTHES"
9351     if test "$COM" = "MSC"; then
9352         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9353     else
9354         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9355     fi
9357 AC_SUBST(SYSTEM_MYTHES)
9358 AC_SUBST(MYTHES_CFLAGS)
9359 AC_SUBST(MYTHES_LIBS)
9361 dnl ===================================================================
9362 dnl How should we build the linear programming solver ?
9363 dnl ===================================================================
9365 ENABLE_COINMP=
9366 AC_MSG_CHECKING([whether to build with CoinMP])
9367 if test "$enable_coinmp" != "no"; then
9368     ENABLE_COINMP=TRUE
9369     AC_MSG_RESULT([yes])
9370     if test "$with_system_coinmp" = "yes"; then
9371         SYSTEM_COINMP=TRUE
9372         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9373         FilterLibs "${COINMP_LIBS}"
9374         COINMP_LIBS="${filteredlibs}"
9375     else
9376         BUILD_TYPE="$BUILD_TYPE COINMP"
9377     fi
9378 else
9379     AC_MSG_RESULT([no])
9381 AC_SUBST(ENABLE_COINMP)
9382 AC_SUBST(SYSTEM_COINMP)
9383 AC_SUBST(COINMP_CFLAGS)
9384 AC_SUBST(COINMP_LIBS)
9386 ENABLE_LPSOLVE=
9387 AC_MSG_CHECKING([whether to build with lpsolve])
9388 if test "$enable_lpsolve" != "no"; then
9389     ENABLE_LPSOLVE=TRUE
9390     AC_MSG_RESULT([yes])
9391 else
9392     AC_MSG_RESULT([no])
9394 AC_SUBST(ENABLE_LPSOLVE)
9396 if test "$ENABLE_LPSOLVE" = TRUE; then
9397     AC_MSG_CHECKING([which lpsolve to use])
9398     if test "$with_system_lpsolve" = "yes"; then
9399         AC_MSG_RESULT([external])
9400         SYSTEM_LPSOLVE=TRUE
9401         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9402            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9403         save_LIBS=$LIBS
9404         # some systems need this. Like Ubuntu....
9405         AC_CHECK_LIB(m, floor)
9406         AC_CHECK_LIB(dl, dlopen)
9407         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9408             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9409         LIBS=$save_LIBS
9410     else
9411         AC_MSG_RESULT([internal])
9412         SYSTEM_LPSOLVE=
9413         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9414     fi
9416 AC_SUBST(SYSTEM_LPSOLVE)
9418 dnl ===================================================================
9419 dnl Checking for libexttextcat
9420 dnl ===================================================================
9421 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9422 if test "$with_system_libexttextcat" = "yes"; then
9423     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9425 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9427 dnl ***************************************
9428 dnl testing libc version for Linux...
9429 dnl ***************************************
9430 if test "$_os" = "Linux"; then
9431     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9432     exec 6>/dev/null # no output
9433     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9434     exec 6>&1 # output on again
9435     if test "$HAVE_LIBC"; then
9436         AC_MSG_RESULT([yes])
9437     else
9438         AC_MSG_ERROR([no, upgrade libc])
9439     fi
9442 dnl =========================================
9443 dnl Check for uuidgen
9444 dnl =========================================
9445 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9446     # presence is already tested above in the WINDOWS_SDK_HOME check
9447     UUIDGEN=uuidgen.exe
9448     AC_SUBST(UUIDGEN)
9449 else
9450     AC_PATH_PROG([UUIDGEN], [uuidgen])
9451     if test -z "$UUIDGEN"; then
9452         AC_MSG_WARN([uuid is needed for building installation sets])
9453     fi
9456 dnl ***************************************
9457 dnl Checking for bison and flex
9458 dnl ***************************************
9459 AC_PATH_PROG(BISON, bison)
9460 if test -z "$BISON"; then
9461     AC_MSG_ERROR([no bison found in \$PATH, install it])
9462 else
9463     AC_MSG_CHECKING([the bison version])
9464     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9465     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9466     # Accept newer than 2.0
9467     if test "$_bison_longver" -lt 2000; then
9468         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9469     fi
9472 AC_PATH_PROG(FLEX, flex)
9473 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9474     FLEX=`cygpath -m $FLEX`
9476 if test -z "$FLEX"; then
9477     AC_MSG_ERROR([no flex found in \$PATH, install it])
9478 else
9479     AC_MSG_CHECKING([the flex version])
9480     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9481     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9482         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9483     fi
9485 AC_SUBST([FLEX])
9486 dnl ***************************************
9487 dnl Checking for patch
9488 dnl ***************************************
9489 AC_PATH_PROG(PATCH, patch)
9490 if test -z "$PATCH"; then
9491     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9494 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9495 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9496     if test -z "$with_gnu_patch"; then
9497         GNUPATCH=$PATCH
9498     else
9499         if test -x "$with_gnu_patch"; then
9500             GNUPATCH=$with_gnu_patch
9501         else
9502             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9503         fi
9504     fi
9506     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9507     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9508         AC_MSG_RESULT([yes])
9509     else
9510         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9511     fi
9512 else
9513     GNUPATCH=$PATCH
9516 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9517     GNUPATCH=`cygpath -m $GNUPATCH`
9520 dnl We also need to check for --with-gnu-cp
9522 if test -z "$with_gnu_cp"; then
9523     # check the place where the good stuff is hidden on Solaris...
9524     if test -x /usr/gnu/bin/cp; then
9525         GNUCP=/usr/gnu/bin/cp
9526     else
9527         AC_PATH_PROGS(GNUCP, gnucp cp)
9528     fi
9529     if test -z $GNUCP; then
9530         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9531     fi
9532 else
9533     if test -x "$with_gnu_cp"; then
9534         GNUCP=$with_gnu_cp
9535     else
9536         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9537     fi
9540 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9541     GNUCP=`cygpath -m $GNUCP`
9544 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9545 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9546     AC_MSG_RESULT([yes])
9547 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9548     AC_MSG_RESULT([yes])
9549 else
9550     case "$build_os" in
9551     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9552         x_GNUCP=[\#]
9553         GNUCP=''
9554         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9555         ;;
9556     *)
9557         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9558         ;;
9559     esac
9562 AC_SUBST(GNUPATCH)
9563 AC_SUBST(GNUCP)
9564 AC_SUBST(x_GNUCP)
9566 dnl ***************************************
9567 dnl testing assembler path
9568 dnl ***************************************
9569 ML_EXE=""
9570 if test "$_os" = "WINNT"; then
9571     if test "$BITNESS_OVERRIDE" = ""; then
9572         assembler=ml.exe
9573         assembler_bin=$CL_DIR
9574     else
9575         assembler=ml64.exe
9576         assembler_bin=$CL_DIR
9577     fi
9579     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9580     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9581         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9582         AC_MSG_RESULT([found])
9583         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9584     else
9585         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9586     fi
9588     PathFormat "$ASM_HOME"
9589     ASM_HOME="$formatted_path"
9590 else
9591     ASM_HOME=""
9594 AC_SUBST(ML_EXE)
9596 dnl ===================================================================
9597 dnl We need zip and unzip
9598 dnl ===================================================================
9599 AC_PATH_PROG(ZIP, zip)
9600 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9601 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9602     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],,)
9605 AC_PATH_PROG(UNZIP, unzip)
9606 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9608 dnl ===================================================================
9609 dnl Zip must be a specific type for different build types.
9610 dnl ===================================================================
9611 if test $build_os = cygwin; then
9612     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9613         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9614     fi
9617 dnl ===================================================================
9618 dnl We need touch with -h option support.
9619 dnl ===================================================================
9620 AC_PATH_PROG(TOUCH, touch)
9621 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
9622 touch warn
9623 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
9624     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],,)
9627 dnl ===================================================================
9628 dnl Check for system epoxy
9629 dnl ===================================================================
9630 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
9632 dnl ===================================================================
9633 dnl Set vcl option: coordinate device in double or sal_Int32
9634 dnl ===================================================================
9636 dnl disabled for now, we don't want subtle differences between OSs
9637 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
9638 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
9639 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
9640 dnl     AC_MSG_RESULT([double])
9641 dnl else
9642 dnl     AC_MSG_RESULT([sal_Int32])
9643 dnl fi
9645 dnl ===================================================================
9646 dnl Test which vclplugs have to be built.
9647 dnl ===================================================================
9648 R=""
9649 if test "$USING_X11" != TRUE; then
9650     enable_gtk=no
9651     enable_gtk3=no
9653 GTK3_CFLAGS=""
9654 GTK3_LIBS=""
9655 ENABLE_GTK3=""
9656 if test "x$enable_gtk3" = "xyes"; then
9657     if test "$with_system_cairo" = no; then
9658         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
9659     fi
9660     : ${with_system_cairo:=yes}
9661     PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.8 gtk+-unix-print-3.0 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo, ENABLE_GTK3="TRUE", ENABLE_GTK3="")
9662     if test "x$ENABLE_GTK3" = "xTRUE"; then
9663         R="gtk3"
9664         dnl Avoid installed by unpackaged files for now.
9665         if test -z "$PKGFORMAT"; then
9666             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
9667         fi
9668     else
9669         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
9670     fi
9671     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9672     FilterLibs "${GTK3_LIBS}"
9673     GTK3_LIBS="${filteredlibs}"
9675     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
9676     if test "$with_system_epoxy" != "yes"; then
9677         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
9678         AC_CHECK_HEADER(EGL/eglplatform.h, [],
9679                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
9680     fi
9682 AC_SUBST(GTK3_LIBS)
9683 AC_SUBST(GTK3_CFLAGS)
9684 AC_SUBST(ENABLE_GTK3)
9686 ENABLE_GTK=""
9687 if test "x$enable_gtk" = "xyes"; then
9688     if test "$with_system_cairo" = no; then
9689         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
9690     fi
9691     : ${with_system_cairo:=yes}
9692     ENABLE_GTK="TRUE"
9693     AC_DEFINE(ENABLE_GTK)
9694     R="gtk $R"
9696 AC_SUBST(ENABLE_GTK)
9698 ENABLE_KDE4=""
9699 if test "x$enable_kde4" = "xyes"; then
9700     ENABLE_KDE4="TRUE"
9701     AC_DEFINE(ENABLE_KDE4)
9702     R="$R kde4"
9704 AC_SUBST(ENABLE_KDE4)
9706 ENABLE_QT5=""
9707 if test "x$enable_qt5" = "xyes"; then
9708     ENABLE_QT5="TRUE"
9709     AC_DEFINE(ENABLE_QT5)
9710     R="$R qt5"
9712 AC_SUBST(ENABLE_QT5)
9714 build_vcl_plugins="$R"
9715 if test -z "$build_vcl_plugins"; then
9716     build_vcl_plugins="none"
9718 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
9720 dnl ===================================================================
9721 dnl check for dbus support
9722 dnl ===================================================================
9723 ENABLE_DBUS=""
9724 DBUS_CFLAGS=""
9725 DBUS_LIBS=""
9727 if test "$enable_dbus" = "no"; then
9728     test_dbus=no
9731 AC_MSG_CHECKING([whether to enable DBUS support])
9732 if test "$test_dbus" = "yes"; then
9733     ENABLE_DBUS="TRUE"
9734     AC_MSG_RESULT([yes])
9735     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
9736     AC_DEFINE(ENABLE_DBUS)
9737     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9738     FilterLibs "${DBUS_LIBS}"
9739     DBUS_LIBS="${filteredlibs}"
9740 else
9741     AC_MSG_RESULT([no])
9744 AC_SUBST(ENABLE_DBUS)
9745 AC_SUBST(DBUS_CFLAGS)
9746 AC_SUBST(DBUS_LIBS)
9748 AC_MSG_CHECKING([whether to enable Impress remote control])
9749 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
9750     AC_MSG_RESULT([yes])
9751     ENABLE_SDREMOTE=TRUE
9752     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
9754     # If not explicitly enabled or disabled, default
9755     if test -z "$enable_sdremote_bluetooth"; then
9756         case "$OS" in
9757         LINUX|MACOSX|WNT)
9758             # Default to yes for these
9759             enable_sdremote_bluetooth=yes
9760             ;;
9761         *)
9762             # otherwise no
9763             enable_sdremote_bluetooth=no
9764             ;;
9765         esac
9766     fi
9767     # $enable_sdremote_bluetooth is guaranteed non-empty now
9769     if test "$enable_sdremote_bluetooth" != "no"; then
9770         if test "$OS" = "LINUX"; then
9771             if test "$ENABLE_DBUS" = "TRUE"; then
9772                 AC_MSG_RESULT([yes])
9773                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
9774                 dnl ===================================================================
9775                 dnl Check for system bluez
9776                 dnl ===================================================================
9777                 AC_MSG_CHECKING([which Bluetooth header to use])
9778                 if test "$with_system_bluez" = "yes"; then
9779                     AC_MSG_RESULT([external])
9780                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
9781                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
9782                     SYSTEM_BLUEZ=TRUE
9783                 else
9784                     AC_MSG_RESULT([internal])
9785                     SYSTEM_BLUEZ=
9786                 fi
9787             else
9788                 AC_MSG_RESULT([no, dbus disabled])
9789                 ENABLE_SDREMOTE_BLUETOOTH=
9790                 SYSTEM_BLUEZ=
9791             fi
9792         else
9793             AC_MSG_RESULT([yes])
9794             ENABLE_SDREMOTE_BLUETOOTH=TRUE
9795             SYSTEM_BLUEZ=
9796         fi
9797     else
9798         AC_MSG_RESULT([no])
9799         ENABLE_SDREMOTE_BLUETOOTH=
9800         SYSTEM_BLUEZ=
9801     fi
9802 else
9803     ENABLE_SDREMOTE=
9804     SYSTEM_BLUEZ=
9805     AC_MSG_RESULT([no])
9807 AC_SUBST(ENABLE_SDREMOTE)
9808 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
9809 AC_SUBST(SYSTEM_BLUEZ)
9811 dnl ===================================================================
9812 dnl Check whether the gtk 2.0 libraries are available.
9813 dnl ===================================================================
9815 GTK_CFLAGS=""
9816 GTK_LIBS=""
9817 ENABLE_SYSTRAY_GTK=""
9818 if test  "$test_gtk" = "yes"; then
9820     if test "$ENABLE_GTK" = "TRUE"; then
9821         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]))
9822         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9823         FilterLibs "${GTK_LIBS}"
9824         GTK_LIBS="${filteredlibs}"
9825         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]))
9826         BUILD_TYPE="$BUILD_TYPE GTK"
9827         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9828         FilterLibs "${GTHREAD_LIBS}"
9829         GTHREAD_LIBS="${filteredlibs}"
9831         if test "x$enable_systray" = "xyes"; then
9832             ENABLE_SYSTRAY_GTK="TRUE"
9833         fi
9835         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
9836         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
9837                           [ENABLE_GTK_PRINT="TRUE"],
9838                           [ENABLE_GTK_PRINT=""])
9839         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9840         FilterLibs "${GTK_PRINT_LIBS}"
9841         GTK_PRINT_LIBS="${filteredlibs}"
9842     fi
9844     if test "$ENABLE_GTK" = "TRUE" || test "$ENABLE_GTK3" = "TRUE"; then
9845         AC_MSG_CHECKING([whether to enable GIO support])
9846         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
9847             dnl Need at least 2.26 for the dbus support.
9848             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
9849                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
9850             if test "$ENABLE_GIO" = "TRUE"; then
9851                 AC_DEFINE(ENABLE_GIO)
9852                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9853                 FilterLibs "${GIO_LIBS}"
9854                 GIO_LIBS="${filteredlibs}"
9855             fi
9856         else
9857             AC_MSG_RESULT([no])
9858         fi
9859     fi
9861 AC_SUBST(ENABLE_GIO)
9862 AC_SUBST(GIO_CFLAGS)
9863 AC_SUBST(GIO_LIBS)
9864 AC_SUBST(ENABLE_SYSTRAY_GTK)
9865 AC_SUBST(GTK_CFLAGS)
9866 AC_SUBST(GTK_LIBS)
9867 AC_SUBST(GTHREAD_CFLAGS)
9868 AC_SUBST(GTHREAD_LIBS)
9869 AC_SUBST([ENABLE_GTK_PRINT])
9870 AC_SUBST([GTK_PRINT_CFLAGS])
9871 AC_SUBST([GTK_PRINT_LIBS])
9874 dnl ===================================================================
9876 SPLIT_APP_MODULES=""
9877 if test "$enable_split_app_modules" = "yes"; then
9878     SPLIT_APP_MODULES="TRUE"
9880 AC_SUBST(SPLIT_APP_MODULES)
9882 SPLIT_OPT_FEATURES=""
9883 if test "$enable_split_opt_features" = "yes"; then
9884     SPLIT_OPT_FEATURES="TRUE"
9886 AC_SUBST(SPLIT_OPT_FEATURES)
9888 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
9889     if test "$enable_cairo_canvas" = yes; then
9890         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
9891     fi
9892     enable_cairo_canvas=no
9893 elif test -z "$enable_cairo_canvas"; then
9894     enable_cairo_canvas=yes
9897 ENABLE_CAIRO_CANVAS=""
9898 if test "$enable_cairo_canvas" = "yes"; then
9899     test_cairo=yes
9900     ENABLE_CAIRO_CANVAS="TRUE"
9901     AC_DEFINE(ENABLE_CAIRO_CANVAS)
9903 AC_SUBST(ENABLE_CAIRO_CANVAS)
9905 dnl ===================================================================
9906 dnl Check whether the GStreamer libraries are available.
9907 dnl It's possible to build avmedia with both GStreamer backends!
9908 dnl ===================================================================
9910 ENABLE_GSTREAMER_1_0=""
9912 if test "$build_gstreamer_1_0" = "yes"; then
9914     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
9915     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
9916         ENABLE_GSTREAMER_1_0="TRUE"
9917         AC_MSG_RESULT([yes])
9918         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
9919         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9920         FilterLibs "${GSTREAMER_1_0_LIBS}"
9921         GSTREAMER_1_0_LIBS="${filteredlibs}"
9922     else
9923         AC_MSG_RESULT([no])
9924     fi
9926 AC_SUBST(GSTREAMER_1_0_CFLAGS)
9927 AC_SUBST(GSTREAMER_1_0_LIBS)
9928 AC_SUBST(ENABLE_GSTREAMER_1_0)
9931 ENABLE_GSTREAMER_0_10=""
9932 if test "$build_gstreamer_0_10" = "yes"; then
9934     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
9935     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
9936         ENABLE_GSTREAMER_0_10="TRUE"
9937         AC_MSG_RESULT([yes])
9938         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
9939             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
9940         ])
9941         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9942         FilterLibs "${GSTREAMER_0_10_LIBS}"
9943         GSTREAMER_0_10_LIBS="${filteredlibs}"
9944     else
9945         AC_MSG_RESULT([no])
9946     fi
9949 AC_SUBST(GSTREAMER_0_10_CFLAGS)
9950 AC_SUBST(GSTREAMER_0_10_LIBS)
9951 AC_SUBST(ENABLE_GSTREAMER_0_10)
9953 dnl ===================================================================
9954 dnl Check whether to build the VLC avmedia backend
9955 dnl ===================================================================
9957 ENABLE_VLC=""
9959 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
9960 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
9961     ENABLE_VLC="TRUE"
9962     AC_MSG_RESULT([yes])
9963 else
9964     AC_MSG_RESULT([no])
9966 AC_SUBST(ENABLE_VLC)
9968 ENABLE_OPENGL_TRANSITIONS=
9969 ENABLE_OPENGL_CANVAS=
9970 if test $_os = iOS -o $_os = Android; then
9971    : # disable
9972 elif test "$_os" = "Darwin"; then
9973     # We use frameworks on Mac OS X, no need for detail checks
9974     ENABLE_OPENGL_TRANSITIONS=TRUE
9975     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
9976     ENABLE_OPENGL_CANVAS=TRUE
9977 elif test $_os = WINNT; then
9978     ENABLE_OPENGL_TRANSITIONS=TRUE
9979     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
9980     ENABLE_OPENGL_CANVAS=TRUE
9981 else
9982     if test "$USING_X11" = TRUE; then
9983         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
9984         ENABLE_OPENGL_TRANSITIONS=TRUE
9985         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
9986         ENABLE_OPENGL_CANVAS=TRUE
9987     fi
9990 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
9991 AC_SUBST(ENABLE_OPENGL_CANVAS)
9993 dnl =================================================
9994 dnl Check whether to build with OpenCL support.
9995 dnl =================================================
9997 if test $_os != iOS -a $_os != Android; then
9998     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
9999     # platform (optional at run-time, used through clew).
10000     BUILD_TYPE="$BUILD_TYPE OPENCL"
10001     AC_DEFINE(HAVE_FEATURE_OPENCL)
10004 dnl =================================================
10005 dnl Check whether to build with dconf support.
10006 dnl =================================================
10008 if test "$enable_dconf" != no; then
10009     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10010         if test "$enable_dconf" = yes; then
10011             AC_MSG_ERROR([dconf not found])
10012         else
10013             enable_dconf=no
10014         fi])
10016 AC_MSG_CHECKING([whether to enable dconf])
10017 if test "$enable_dconf" = no; then
10018     DCONF_CFLAGS=
10019     DCONF_LIBS=
10020     ENABLE_DCONF=
10021     AC_MSG_RESULT([no])
10022 else
10023     ENABLE_DCONF=TRUE
10024     AC_DEFINE(ENABLE_DCONF)
10025     AC_MSG_RESULT([yes])
10027 AC_SUBST([DCONF_CFLAGS])
10028 AC_SUBST([DCONF_LIBS])
10029 AC_SUBST([ENABLE_DCONF])
10031 # pdf import?
10032 AC_MSG_CHECKING([whether to build the PDF import feature])
10033 ENABLE_PDFIMPORT=
10034 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10035     AC_MSG_RESULT([yes])
10036     ENABLE_PDFIMPORT=TRUE
10037     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10039     dnl ===================================================================
10040     dnl Check for system poppler
10041     dnl ===================================================================
10042     AC_MSG_CHECKING([which PDF import backend to use])
10043     if test "$with_system_poppler" = "yes"; then
10044         AC_MSG_RESULT([external])
10045         SYSTEM_POPPLER=TRUE
10046         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10047         AC_LANG_PUSH([C++])
10048         save_CXXFLAGS=$CXXFLAGS
10049         save_CPPFLAGS=$CPPFLAGS
10050         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10051         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10052         AC_CHECK_HEADER([cpp/poppler-version.h],
10053             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10054             [])
10055         CXXFLAGS=$save_CXXFLAGS
10056         CPPFLAGS=$save_CPPFLAGS
10057         AC_LANG_POP([C++])
10058         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10060         FilterLibs "${POPPLER_LIBS}"
10061         POPPLER_LIBS="${filteredlibs}"
10062     else
10063         AC_MSG_RESULT([internal])
10064         SYSTEM_POPPLER=
10065         BUILD_TYPE="$BUILD_TYPE POPPLER"
10066         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10067     fi
10068     AC_DEFINE([ENABLE_PDFIMPORT],1)
10069 else
10070     AC_MSG_RESULT([no])
10072 AC_SUBST(ENABLE_PDFIMPORT)
10073 AC_SUBST(SYSTEM_POPPLER)
10074 AC_SUBST(POPPLER_CFLAGS)
10075 AC_SUBST(POPPLER_LIBS)
10077 # pdf import?
10078 AC_MSG_CHECKING([whether to build PDFium])
10079 ENABLE_PDFIUM=
10080 if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then
10081     AC_MSG_RESULT([yes])
10082     ENABLE_PDFIUM=TRUE
10083     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10084     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10085 else
10086     AC_MSG_RESULT([no])
10088 AC_SUBST(ENABLE_PDFIUM)
10090 SYSTEM_GPGMEPP=
10092 if test "$build_for_ios" = "YES"; then
10093     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10094     AC_MSG_RESULT([yes])
10095 elif test "$enable_mpl_subset" = "yes"; then
10096     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10097     AC_MSG_RESULT([yes])
10098 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10099     dnl ===================================================================
10100     dnl Check for system gpgme
10101     dnl ===================================================================
10102     AC_MSG_CHECKING([which gpgmepp to use])
10103     if test "$with_system_gpgmepp" = "yes"; then
10104         AC_MSG_RESULT([external])
10105         SYSTEM_GPGMEPP=TRUE
10107         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10108         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10109             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10110         # progress_callback is the only func with plain C linkage
10111         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10112         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10113             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10114         AC_CHECK_HEADER(gpgme.h, [],
10115             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10116     else
10117         AC_MSG_RESULT([internal])
10118         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10119         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10121         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10122         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10123         if test "$_os" != "WINNT"; then
10124             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10125             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10126         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10127             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10128         fi
10129     fi
10130     ENABLE_GPGMEPP=TRUE
10131     AC_DEFINE([HAVE_FEATURE_GPGME])
10132     AC_PATH_PROG(GPG, gpg)
10133     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10134     # so let's exclude that manually for the moment
10135     if test -n "$GPG" -a "$_os" != "WINNT"; then
10136         # make sure we not only have a working gpgme, but a full working
10137         # gpg installation to run OpenPGP signature verification
10138         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10139     fi
10140     if test "$_os" = "Linux"; then
10141       uid=`id -u`
10142       AC_MSG_CHECKING([for /run/user/$uid])
10143       if test -d /run/user/$uid; then
10144         AC_MSG_RESULT([yes])
10145         AC_PATH_PROG(GPGCONF, gpgconf)
10146         AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10147         if $GPGCONF --dump-options > /dev/null ; then
10148           if $GPGCONF --dump-options | grep -q create-socketdir ; then
10149             AC_MSG_RESULT([yes])
10150             AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10151           else
10152             AC_MSG_RESULT([no])
10153           fi
10154         else
10155           AC_MSG_RESULT([no. missing or broken gpgconf?])
10156         fi
10157       else
10158         AC_MSG_RESULT([no])
10159      fi
10160    fi
10162 AC_SUBST(ENABLE_GPGMEPP)
10163 AC_SUBST(SYSTEM_GPGMEPP)
10164 AC_SUBST(GPG_ERROR_CFLAGS)
10165 AC_SUBST(GPG_ERROR_LIBS)
10166 AC_SUBST(LIBASSUAN_CFLAGS)
10167 AC_SUBST(LIBASSUAN_LIBS)
10168 AC_SUBST(GPGMEPP_CFLAGS)
10169 AC_SUBST(GPGMEPP_LIBS)
10170 AC_SUBST(GPGCONF)
10171 AC_SUBST(HAVE_GPGCONF_SOCKETDIR)
10173 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10174 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10175     AC_MSG_RESULT([yes])
10176     ENABLE_MEDIAWIKI=TRUE
10177     BUILD_TYPE="$BUILD_TYPE XSLTML"
10178     if test  "x$with_java" = "xno"; then
10179         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10180     fi
10181 else
10182     AC_MSG_RESULT([no])
10183     ENABLE_MEDIAWIKI=
10184     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10186 AC_SUBST(ENABLE_MEDIAWIKI)
10188 AC_MSG_CHECKING([whether to build the Report Builder])
10189 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10190     AC_MSG_RESULT([yes])
10191     ENABLE_REPORTBUILDER=TRUE
10192     AC_MSG_CHECKING([which jfreereport libs to use])
10193     if test "$with_system_jfreereport" = "yes"; then
10194         SYSTEM_JFREEREPORT=TRUE
10195         AC_MSG_RESULT([external])
10196         if test -z $SAC_JAR; then
10197             SAC_JAR=/usr/share/java/sac.jar
10198         fi
10199         if ! test -f $SAC_JAR; then
10200              AC_MSG_ERROR(sac.jar not found.)
10201         fi
10203         if test -z $LIBXML_JAR; then
10204             if test -f /usr/share/java/libxml-1.0.0.jar; then
10205                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10206             elif test -f /usr/share/java/libxml.jar; then
10207                 LIBXML_JAR=/usr/share/java/libxml.jar
10208             else
10209                 AC_MSG_ERROR(libxml.jar replacement not found.)
10210             fi
10211         elif ! test -f $LIBXML_JAR; then
10212             AC_MSG_ERROR(libxml.jar not found.)
10213         fi
10215         if test -z $FLUTE_JAR; then
10216             if test -f/usr/share/java/flute-1.3.0.jar; then
10217                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10218             elif test -f /usr/share/java/flute.jar; then
10219                 FLUTE_JAR=/usr/share/java/flute.jar
10220             else
10221                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10222             fi
10223         elif ! test -f $FLUTE_JAR; then
10224             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10225         fi
10227         if test -z $JFREEREPORT_JAR; then
10228             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10229                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10230             elif test -f /usr/share/java/flow-engine.jar; then
10231                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10232             else
10233                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10234             fi
10235         elif ! test -f  $JFREEREPORT_JAR; then
10236                 AC_MSG_ERROR(jfreereport.jar not found.)
10237         fi
10239         if test -z $LIBLAYOUT_JAR; then
10240             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10241                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10242             elif test -f /usr/share/java/liblayout.jar; then
10243                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10244             else
10245                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10246             fi
10247         elif ! test -f $LIBLAYOUT_JAR; then
10248                 AC_MSG_ERROR(liblayout.jar not found.)
10249         fi
10251         if test -z $LIBLOADER_JAR; then
10252             if test -f /usr/share/java/libloader-1.0.0.jar; then
10253                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10254             elif test -f /usr/share/java/libloader.jar; then
10255                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10256             else
10257                 AC_MSG_ERROR(libloader.jar replacement not found.)
10258             fi
10259         elif ! test -f  $LIBLOADER_JAR; then
10260             AC_MSG_ERROR(libloader.jar not found.)
10261         fi
10263         if test -z $LIBFORMULA_JAR; then
10264             if test -f /usr/share/java/libformula-0.2.0.jar; then
10265                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10266             elif test -f /usr/share/java/libformula.jar; then
10267                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10268             else
10269                 AC_MSG_ERROR(libformula.jar replacement not found.)
10270             fi
10271         elif ! test -f $LIBFORMULA_JAR; then
10272                 AC_MSG_ERROR(libformula.jar not found.)
10273         fi
10275         if test -z $LIBREPOSITORY_JAR; then
10276             if test -f /usr/share/java/librepository-1.0.0.jar; then
10277                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10278             elif test -f /usr/share/java/librepository.jar; then
10279                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10280             else
10281                 AC_MSG_ERROR(librepository.jar replacement not found.)
10282             fi
10283         elif ! test -f $LIBREPOSITORY_JAR; then
10284             AC_MSG_ERROR(librepository.jar not found.)
10285         fi
10287         if test -z $LIBFONTS_JAR; then
10288             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10289                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10290             elif test -f /usr/share/java/libfonts.jar; then
10291                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10292             else
10293                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10294             fi
10295         elif ! test -f $LIBFONTS_JAR; then
10296                 AC_MSG_ERROR(libfonts.jar not found.)
10297         fi
10299         if test -z $LIBSERIALIZER_JAR; then
10300             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10301                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10302             elif test -f /usr/share/java/libserializer.jar; then
10303                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10304             else
10305                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10306             fi
10307         elif ! test -f $LIBSERIALIZER_JAR; then
10308                 AC_MSG_ERROR(libserializer.jar not found.)
10309         fi
10311         if test -z $LIBBASE_JAR; then
10312             if test -f /usr/share/java/libbase-1.0.0.jar; then
10313                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10314             elif test -f /usr/share/java/libbase.jar; then
10315                 LIBBASE_JAR=/usr/share/java/libbase.jar
10316             else
10317                 AC_MSG_ERROR(libbase.jar replacement not found.)
10318             fi
10319         elif ! test -f $LIBBASE_JAR; then
10320             AC_MSG_ERROR(libbase.jar not found.)
10321         fi
10323     else
10324         AC_MSG_RESULT([internal])
10325         SYSTEM_JFREEREPORT=
10326         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10327     fi
10328 else
10329     AC_MSG_RESULT([no])
10330     ENABLE_REPORTBUILDER=
10331     SYSTEM_JFREEREPORT=
10333 AC_SUBST(ENABLE_REPORTBUILDER)
10334 AC_SUBST(SYSTEM_JFREEREPORT)
10335 AC_SUBST(SAC_JAR)
10336 AC_SUBST(LIBXML_JAR)
10337 AC_SUBST(FLUTE_JAR)
10338 AC_SUBST(JFREEREPORT_JAR)
10339 AC_SUBST(LIBBASE_JAR)
10340 AC_SUBST(LIBLAYOUT_JAR)
10341 AC_SUBST(LIBLOADER_JAR)
10342 AC_SUBST(LIBFORMULA_JAR)
10343 AC_SUBST(LIBREPOSITORY_JAR)
10344 AC_SUBST(LIBFONTS_JAR)
10345 AC_SUBST(LIBSERIALIZER_JAR)
10347 # this has to be here because both the Wiki Publisher and the SRB use
10348 # commons-logging
10349 COMMONS_LOGGING_VERSION=1.2
10350 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10351     AC_MSG_CHECKING([which Apache commons-* libs to use])
10352     if test "$with_system_apache_commons" = "yes"; then
10353         SYSTEM_APACHE_COMMONS=TRUE
10354         AC_MSG_RESULT([external])
10355         if test -z $COMMONS_LOGGING_JAR; then
10356             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10357                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10358            elif test -f /usr/share/java/commons-logging.jar; then
10359                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
10360             else
10361                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
10362             fi
10363         elif ! test -f $COMMONS_LOGGING_JAR; then
10364             AC_MSG_ERROR(commons-logging.jar not found.)
10365         fi
10366     else
10367         AC_MSG_RESULT([internal])
10368         SYSTEM_APACHE_COMMONS=
10369         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
10370     fi
10372 AC_SUBST(SYSTEM_APACHE_COMMONS)
10373 AC_SUBST(COMMONS_LOGGING_JAR)
10374 AC_SUBST(COMMONS_LOGGING_VERSION)
10376 # scripting provider for BeanShell?
10377 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10378 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10379     AC_MSG_RESULT([yes])
10380     ENABLE_SCRIPTING_BEANSHELL=TRUE
10382     dnl ===================================================================
10383     dnl Check for system beanshell
10384     dnl ===================================================================
10385     AC_MSG_CHECKING([which beanshell to use])
10386     if test "$with_system_beanshell" = "yes"; then
10387         AC_MSG_RESULT([external])
10388         SYSTEM_BSH=TRUE
10389         if test -z $BSH_JAR; then
10390             BSH_JAR=/usr/share/java/bsh.jar
10391         fi
10392         if ! test -f $BSH_JAR; then
10393             AC_MSG_ERROR(bsh.jar not found.)
10394         fi
10395     else
10396         AC_MSG_RESULT([internal])
10397         SYSTEM_BSH=
10398         BUILD_TYPE="$BUILD_TYPE BSH"
10399     fi
10400 else
10401     AC_MSG_RESULT([no])
10402     ENABLE_SCRIPTING_BEANSHELL=
10403     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10405 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10406 AC_SUBST(SYSTEM_BSH)
10407 AC_SUBST(BSH_JAR)
10409 # scripting provider for JavaScript?
10410 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10411 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10412     AC_MSG_RESULT([yes])
10413     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10415     dnl ===================================================================
10416     dnl Check for system rhino
10417     dnl ===================================================================
10418     AC_MSG_CHECKING([which rhino to use])
10419     if test "$with_system_rhino" = "yes"; then
10420         AC_MSG_RESULT([external])
10421         SYSTEM_RHINO=TRUE
10422         if test -z $RHINO_JAR; then
10423             RHINO_JAR=/usr/share/java/js.jar
10424         fi
10425         if ! test -f $RHINO_JAR; then
10426             AC_MSG_ERROR(js.jar not found.)
10427         fi
10428     else
10429         AC_MSG_RESULT([internal])
10430         SYSTEM_RHINO=
10431         BUILD_TYPE="$BUILD_TYPE RHINO"
10432     fi
10433 else
10434     AC_MSG_RESULT([no])
10435     ENABLE_SCRIPTING_JAVASCRIPT=
10436     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10438 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10439 AC_SUBST(SYSTEM_RHINO)
10440 AC_SUBST(RHINO_JAR)
10442 # This is only used in KDE3/KDE4 checks to determine if /usr/lib64
10443 # paths should be added to library search path. So lets put all 64-bit
10444 # platforms there.
10445 supports_multilib=
10446 case "$host_cpu" in
10447 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
10448     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10449         supports_multilib="yes"
10450     fi
10451     ;;
10453     ;;
10454 esac
10456 dnl ===================================================================
10457 dnl KDE4 Integration
10458 dnl ===================================================================
10460 KDE4_CFLAGS=""
10461 KDE4_LIBS=""
10462 QMAKE4="qmake"
10463 MOC4="moc"
10464 KDE4_GLIB_CFLAGS=""
10465 KDE4_GLIB_LIBS=""
10466 KDE4_HAVE_GLIB=""
10467 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
10468     qt4_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
10469     qt4_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
10471     kde4_incdirs="/usr/include /usr/include/kde4 $x_includes"
10472     kde4_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
10474     if test -n "$supports_multilib"; then
10475         qt4_libdirs="$qt4_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
10476         kde4_libdirs="$kde4_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
10477     fi
10479     if test -n "$QTDIR"; then
10480         qt4_incdirs="$QTDIR/include $qt4_incdirs"
10481         if test -z "$supports_multilib"; then
10482             qt4_libdirs="$QTDIR/lib $qt4_libdirs"
10483         else
10484             qt4_libdirs="$QTDIR/lib64 $QTDIR/lib $qt4_libdirs"
10485         fi
10486     fi
10487     if test -n "$QT4DIR"; then
10488         qt4_incdirs="$QT4DIR/include $qt4_incdirs"
10489         if test -z "$supports_multilib"; then
10490             qt4_libdirs="$QT4DIR/lib $qt4_libdirs"
10491         else
10492             qt4_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt4_libdirs"
10493         fi
10494     fi
10496     if test -n "$KDEDIR"; then
10497         kde4_incdirs="$KDEDIR/include $kde4_incdirs"
10498         if test -z "$supports_multilib"; then
10499             kde4_libdirs="$KDEDIR/lib $kde4_libdirs"
10500         else
10501             kde4_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde4_libdirs"
10502         fi
10503     fi
10504     if test -n "$KDE4DIR"; then
10505         kde4_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde4_incdirs"
10506         if test -z "$supports_multilib"; then
10507             kde4_libdirs="$KDE4DIR/lib $kde4_libdirs"
10508         else
10509             kde4_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde4_libdirs"
10510         fi
10511     fi
10513     qt4_test_include="Qt/qobject.h"
10514     qt4_test_library="libQtNetwork.so"
10515     kde4_test_include="kwindowsystem.h"
10516     kde4_test_library="libsolid.so"
10518     AC_MSG_CHECKING([for Qt4 headers])
10519     qt4_header_dir="no"
10520     for inc_dir in $qt4_incdirs; do
10521         if test -r "$inc_dir/$qt4_test_include"; then
10522             qt4_header_dir="$inc_dir"
10523             break
10524         fi
10525     done
10527     AC_MSG_RESULT([$qt4_header_dir])
10528     if test "x$qt4_header_dir" = "xno"; then
10529         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10530     fi
10532     dnl Check for qmake
10533     AC_PATH_PROGS( QMAKE4, [qmake-qt4 qmake], no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
10534     if test "$QMAKE4" = "no"; then
10535         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10536     else
10537         qmake4_test_ver="`$QMAKE4 -v 2>&1 | sed -n -e '/^Using Qt version 4\./p'`"
10538         if test -z "$qmake4_test_ver"; then
10539             AC_MSG_ERROR([Wrong qmake for Qt4 found. Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
10540         fi
10541     fi
10543     qt4_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt4_libdirs"
10544     AC_MSG_CHECKING([for Qt4 libraries])
10545     qt4_lib_dir="no"
10546     for lib_dir in $qt4_libdirs; do
10547         if test -r "$lib_dir/$qt4_test_library"; then
10548             qt4_lib_dir="$lib_dir"
10549             PKG_CONFIG_PATH="$qt4_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
10550             break
10551         fi
10552     done
10554     AC_MSG_RESULT([$qt4_lib_dir])
10556     if test "x$qt4_lib_dir" = "xno"; then
10557         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10558     fi
10560     dnl Check for Meta Object Compiler
10562     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10563     MOC4="$MOCQT4"
10564     if test "$MOC4" = "no"; then
10565         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10566         if test "$MOC4" = "no"; then
10567             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10568 the root of your Qt installation by exporting QT4DIR before running "configure".])
10569         fi
10570     fi
10572     dnl Check for KDE4 headers
10573     AC_MSG_CHECKING([for KDE4 headers])
10574     kde4_incdir="no"
10575     for kde4_check in $kde4_incdirs; do
10576         if test -r "$kde4_check/$kde4_test_include"; then
10577             kde4_incdir="$kde4_check"
10578             break
10579         fi
10580     done
10581     AC_MSG_RESULT([$kde4_incdir])
10582     if test "x$kde4_incdir" = "xno"; then
10583         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10584     fi
10585     if test "$kde4_incdir" = "/usr/include"; then kde4_incdir=; fi
10587     dnl Check for KDE4 libraries
10588     AC_MSG_CHECKING([for KDE4 libraries])
10589     kde4_libdir="no"
10590     for kde4_check in $kde4_libdirs; do
10591         if test -r "$kde4_check/$kde4_test_library"; then
10592             kde4_libdir="$kde4_check"
10593             break
10594         fi
10595     done
10597     AC_MSG_RESULT([$kde4_libdir])
10598     if test "x$kde4_libdir" = "xno"; then
10599         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10600     fi
10602     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
10603     if ! test -z "$kde4_incdir"; then
10604         KDE4_CFLAGS="-I$kde4_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10605     else
10606         KDE4_CFLAGS="$QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10607     fi
10609     KDE4_LIBS="-L$kde4_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt4_lib_dir $QT4_LIBS"
10610     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10611     FilterLibs "$KDE4_LIBS"
10612     KDE4_LIBS="$filteredlibs"
10614     AC_LANG_PUSH([C++])
10615     save_CXXFLAGS=$CXXFLAGS
10616     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10617     AC_MSG_CHECKING([whether KDE is >= 4.2])
10618        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10619 #include <kdeversion.h>
10621 int main(int argc, char **argv) {
10622        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
10623        else return 1;
10625 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[AC_MSG_ERROR([KDE support not tested with cross-compilation])])
10626     CXXFLAGS=$save_CXXFLAGS
10627     AC_LANG_POP([C++])
10629     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
10630     # Sets also KDE4_GLIB_CFLAGS/KDE4_GLIB_LIBS if successful.
10631     PKG_CHECK_MODULES(KDE4_GLIB,[glib-2.0 >= 2.4],
10632         [
10633             KDE4_HAVE_GLIB=TRUE
10634             AC_DEFINE(KDE4_HAVE_GLIB,1)
10635             KDE4_GLIB_CFLAGS=$(printf '%s' "$KDE4_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10636             FilterLibs "${KDE4_GLIB_LIBS}"
10637             KDE4_GLIB_LIBS="${filteredlibs}"
10639             qt4_fix_warning=
10641             AC_LANG_PUSH([C++])
10642             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
10643             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
10644             #  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
10645             #               ^~~~~~~~~~~~~~~~~~~~~~~
10646             #               vptr for 'QObjectPrivate'
10647             save_CXX=$CXX
10648             CXX=$(printf %s "$CXX" \
10649                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
10650             save_CXXFLAGS=$CXXFLAGS
10651             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10652             save_LIBS=$LIBS
10653             LIBS="$LIBS $KDE4_LIBS"
10654             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
10656             # Prepare meta object data
10657             TSTBASE="tst_exclude_socket_notifiers"
10658             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
10659             ln -fs "${TSTMOC}.hxx"
10660             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10662             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10663 #include <cstdlib>
10664 #include "tst_exclude_socket_notifiers.moc"
10666 int main(int argc, char *argv[])
10668     QCoreApplication app(argc, argv);
10669     exit(tst_processEventsExcludeSocket());
10670     return 0;
10672             ]])],[
10673                 AC_MSG_RESULT([yes])
10674             ],[
10675                 AC_MSG_RESULT([no])
10676                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
10677                 if test -z "$qt4_fix_warning"; then
10678                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
10679                 fi
10680                 qt4_fix_warning=1
10681                 add_warning "  https://bugreports.qt.io/browse/QTBUG-37380 (needed)"
10682                 ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
10684             # Remove meta object data
10685             rm -f "${TSTBASE}."*
10687             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
10689             # Prepare meta object data
10690             TSTBASE="tst_exclude_posted_events"
10691             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
10692             ln -fs "${TSTMOC}.hxx"
10693             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10695             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10696 #include <cstdlib>
10697 #include "tst_exclude_posted_events.moc"
10699 int main(int argc, char *argv[])
10701     QCoreApplication app(argc, argv);
10702     exit(tst_excludePostedEvents());
10703     return 0;
10705             ]])],[
10706                 AC_MSG_RESULT([yes])
10707             ],[
10708                 AC_MSG_RESULT([no])
10709                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
10710                 if test -z "$qt4_fix_warning"; then
10711                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
10712                 fi
10713                 qt4_fix_warning=1
10714                 add_warning "  https://bugreports.qt.io/browse/QTBUG-34614 (needed)"
10715             ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
10717             # Remove meta object data
10718             rm -f "${TSTBASE}."*
10720             if test -n "$qt4_fix_warning"; then
10721                 add_warning "  https://bugreports.qt.io/browse/QTBUG-38585 (recommended)"
10722             fi
10724             LIBS=$save_LIBS
10725             CXXFLAGS=$save_CXXFLAGS
10726             CXX=$save_CXX
10727             AC_LANG_POP([C++])
10728         ],
10729         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
10731 AC_SUBST(KDE4_CFLAGS)
10732 AC_SUBST(KDE4_LIBS)
10733 AC_SUBST(MOC4)
10734 AC_SUBST(KDE4_GLIB_CFLAGS)
10735 AC_SUBST(KDE4_GLIB_LIBS)
10736 AC_SUBST(KDE4_HAVE_GLIB)
10738 dnl ===================================================================
10739 dnl QT5 Integration
10740 dnl ===================================================================
10742 QT5_CFLAGS=""
10743 QT5_LIBS=""
10744 QMAKE5="qmake"
10745 MOC5="moc"
10746 QT5_GLIB_CFLAGS=""
10747 QT5_GLIB_LIBS=""
10748 QT5_HAVE_GLIB=""
10749 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
10750         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \)
10751 then
10752     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
10753     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
10755     if test -n "$supports_multilib"; then
10756         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
10757     fi
10759     qt5_test_include="QtWidgets/qapplication.h"
10760     qt5_test_library="libQt5Widgets.so"
10762     dnl Check for qmake5
10763     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
10764     if test "$QMAKE5" = "no"; then
10765         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
10766     else
10767         qmake5_test_ver="`$QMAKE5 -v 2>&1 | sed -n -e '/^Using Qt version 5\./p'`"
10768         if test -z "$qmake5_test_ver"; then
10769             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
10770         fi
10771     fi
10773     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
10774     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
10776     AC_MSG_CHECKING([for Qt5 headers])
10777     qt5_incdir="no"
10778     for inc_dir in $qt5_incdirs; do
10779         if test -r "$inc_dir/$qt5_test_include"; then
10780             qt5_incdir="$inc_dir"
10781             break
10782         fi
10783     done
10784     AC_MSG_RESULT([$qt5_incdir])
10785     if test "x$qt5_incdir" = "xno"; then
10786         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
10787     fi
10789     AC_MSG_CHECKING([for Qt5 libraries])
10790     qt5_libdir="no"
10791     for lib_dir in $qt5_libdirs; do
10792         if test -r "$lib_dir/$qt5_test_library"; then
10793             qt5_libdir="$lib_dir"
10794             break
10795         fi
10796     done
10797     AC_MSG_RESULT([$qt5_libdir])
10798     if test "x$qt5_libdir" = "xno"; then
10799         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
10800     fi
10802     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10803     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
10805     dnl Check for Meta Object Compiler
10807     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
10808     if test "$MOC5" = "no"; then
10809         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10810 the root of your Qt installation by exporting QT5DIR before running "configure".])
10811     fi
10813     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
10814     # Sets also QT5_GLIB_CFLAGS/QT5_GLIB_LIBS if successful.
10815     PKG_CHECK_MODULES(QT5_GLIB,[glib-2.0 >= 2.4],
10816         [
10817             QT5_HAVE_GLIB=1
10818             AC_DEFINE(QT5_HAVE_GLIB,1)
10819             QT5_GLIB_CFLAGS=$(printf '%s' "$QT5_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10820             FilterLibs "${QT5_GLIB_LIBS}"
10821             QT5_GLIB_LIBS="${filteredlibs}"
10823             qt5_fix_warning=
10825             AC_LANG_PUSH([C++])
10826             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QO
10827             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
10828             #  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
10829             #               ^~~~~~~~~~~~~~~~~~~~~~~
10830             #               vptr for 'QObjectPrivate'
10831             save_CXX=$CXX
10832             CXX=$(printf %s "$CXX" \
10833                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
10834             save_CXXFLAGS=$CXXFLAGS
10835             CXXFLAGS="$CXXFLAGS $QT5_CFLAGS"
10836             save_LIBS=$LIBS
10837             LIBS="$LIBS $QT5_LIBS"
10838             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
10839             # Prepare meta object data
10840             TSTBASE="tst_exclude_socket_notifiers"
10841             TSTMOC="${SRC_ROOT}/vcl/unx/qt5/${TSTBASE}"
10842             ln -fs "${TSTMOC}.hxx"
10843             $MOC5 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10845             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10846 #include <cstdlib>
10847 #include "tst_exclude_socket_notifiers.moc"
10849 int main(int argc, char *argv[])
10851     QCoreApplication app(argc, argv);
10852     exit(tst_processEventsExcludeSocket());
10853     return 0;
10855             ]])],[
10856                 AC_MSG_RESULT([yes])
10857             ],[
10858                 AC_MSG_RESULT([no])
10859                 AC_MSG_WARN([native Qt5 file pickers will be disabled at runtime])
10860                 if test -z "$qt5_fix_warning"; then
10861                     add_warning "native QT5 file pickers will be disabled at runtime, Qt5 fixes needed"
10862                 fi
10863                 qt5_fix_warning=1
10864                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-37380 (needed)"
10865             ])
10867             # Remove meta object data
10868             rm -f "${TSTBASE}."*
10870             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
10871             # Prepare meta object data
10872             TSTBASE="tst_exclude_posted_events"
10873             TSTMOC="${SRC_ROOT}/vcl/unx/qt5/${TSTBASE}"
10874             ln -fs "${TSTMOC}.hxx"
10875             $MOC5 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10877             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10878 #include <cstdlib>
10879 #include "tst_exclude_posted_events.moc"
10881 int main(int argc, char *argv[])
10883     QCoreApplication app(argc, argv);
10884     exit(tst_excludePostedEvents());
10885     return 0;
10887             ]])],[
10888                 AC_MSG_RESULT([yes])
10889             ],[
10890                 AC_MSG_RESULT([no])
10891                 AC_MSG_WARN([native QT5 file pickers will be disabled at runtime])
10892                 if test -z "$qt5_fix_warning"; then
10893                     add_warning "native QT5 file pickers will be disabled at runtime, Qt5 fixes needed"
10894                 fi
10895                 qt5_fix_warning=1
10896                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-34614 (needed)"
10897             ])
10899             # Remove meta object data
10900             rm -f "${TSTBASE}."*
10902             if test -n "$qt5_fix_warning"; then
10903                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-38585 (recommended)"
10904             fi
10906             LIBS=$save_LIBS
10907             CXXFLAGS=$save_CXXFLAGS
10908             CXX=$save_CXX
10909             AC_LANG_POP([C++])
10910         ],
10911         AC_MSG_WARN([[No Glib found, Qt5 support will not use native file pickers!]])
10912     )
10914 AC_SUBST(QT5_CFLAGS)
10915 AC_SUBST(QT5_LIBS)
10916 AC_SUBST(MOC5)
10917 AC_SUBST(QT5_GLIB_CFLAGS)
10918 AC_SUBST(QT5_GLIB_LIBS)
10919 AC_SUBST(QT5_HAVE_GLIB)
10921 dnl ===================================================================
10922 dnl KDE5 Integration
10923 dnl ===================================================================
10925 KF5_CFLAGS=""
10926 KF5_LIBS=""
10927 KF5_CONFIG="kf5-config"
10928 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
10929         \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \)
10930 then
10931     kf5_incdirs="$KF5INC /usr/include /usr/include/KF5 $x_includes"
10932     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $x_libraries"
10933     if test -n "$supports_multilib"; then
10934         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
10935     fi
10937     kf5_test_include="kcoreaddons_version.h"
10938     kf5_test_library="libKF5CoreAddons.so"
10939     kf5_libdirs="$qt5_libdir $kf5_libdirs"
10941     dnl kf5 KDE4 support compatibility installed
10942     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
10943     if test "$KF5_CONFIG" != "no"; then
10944         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
10945         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
10946     fi
10948     dnl Check for KF5 headers
10949     AC_MSG_CHECKING([for KF5 headers])
10950     kf5_incdir="no"
10951     for kf5_check in $kf5_incdirs; do
10952         if test -r "$kf5_check/$kf5_test_include"; then
10953             kf5_incdir="$kf5_check"
10954             break
10955         fi
10956     done
10957     AC_MSG_RESULT([$kf5_incdir])
10958     if test "x$kf5_incdir" = "xno"; then
10959         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
10960     fi
10962     dnl Check for KF5 libraries
10963     AC_MSG_CHECKING([for KF5 libraries])
10964     kf5_libdir="no"
10965     for kf5_check in $kf5_libdirs; do
10966         if test -r "$kf5_check/$kf5_test_library"; then
10967             kf5_libdir="$kf5_check"
10968             break
10969         fi
10970     done
10972     AC_MSG_RESULT([$kf5_libdir])
10973     if test "x$kf5_libdir" = "xno"; then
10974         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
10975     fi
10977     PKG_CHECK_MODULES(KF5_XCB,[xcb],,[AC_MSG_ERROR([XCB not installed])])
10979     KF5_CFLAGS="-I$kf5_incdir -I$kf5_incdir/KCoreAddons -I$kf5_incdir/KI18n -I$kf5_incdir/KConfigCore -I$kf5_incdir/KWindowSystem -I$kf5_incdir/KIOCore -I$qt5_incdir -I$qt5_incdir/QtCore -I$qt5_incdir/QtGui -I$qt5_incdir/QtWidgets -I$qt5_incdir/QtNetwork -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT $KF5_XCB_CFLAGS"
10980     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network -lQt5X11Extras $KF5_XCB_LIBS"
10981     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10983     AC_LANG_PUSH([C++])
10984     save_CXXFLAGS=$CXXFLAGS
10985     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
10986     AC_MSG_CHECKING([whether KDE is >= 5.0])
10987        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10988 #include <kcoreaddons_version.h>
10990 int main(int argc, char **argv) {
10991        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
10992        else return 1;
10994        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
10995     CXXFLAGS=$save_CXXFLAGS
10996     AC_LANG_POP([C++])
10998 AC_SUBST(KF5_CFLAGS)
10999 AC_SUBST(KF5_LIBS)
11001 dnl ===================================================================
11002 dnl Test whether to include Evolution 2 support
11003 dnl ===================================================================
11004 AC_MSG_CHECKING([whether to enable evolution 2 support])
11005 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11006     AC_MSG_RESULT([yes])
11007     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11008     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11009     FilterLibs "${GOBJECT_LIBS}"
11010     GOBJECT_LIBS="${filteredlibs}"
11011     ENABLE_EVOAB2="TRUE"
11012 else
11013     ENABLE_EVOAB2=""
11014     AC_MSG_RESULT([no])
11016 AC_SUBST(ENABLE_EVOAB2)
11017 AC_SUBST(GOBJECT_CFLAGS)
11018 AC_SUBST(GOBJECT_LIBS)
11020 dnl ===================================================================
11021 dnl Test which themes to include
11022 dnl ===================================================================
11023 AC_MSG_CHECKING([which themes to include])
11024 # if none given use default subset of available themes
11025 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11026     with_theme="breeze breeze_dark colibre elementary galaxy hicontrast sifr sifr_dark tango"
11027     # test -z "$ENABLE_RELEASE_BUILD" && with_theme="$with_theme tango_testing"
11030 WITH_THEMES=""
11031 if test "x$with_theme" != "xno"; then
11032     for theme in $with_theme; do
11033         case $theme in
11034         breeze|breeze_dark|crystal|colibre|elementary|galaxy|hicontrast|oxygen|sifr|sifr_dark|tango|tango_testing) real_theme="$theme" ;;
11035         default) real_theme=galaxy ;;
11036         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11037         esac
11038         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11039     done
11041 AC_MSG_RESULT([$WITH_THEMES])
11042 AC_SUBST([WITH_THEMES])
11043 # FIXME: remove this, and the convenience default->galaxy remapping after a crace period
11044 for theme in $with_theme; do
11045     case $theme in
11046     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=galaxy]) ;;
11047     *) ;;
11048     esac
11049 done
11051 dnl ===================================================================
11052 dnl Test whether to integrate helppacks into the product's installer
11053 dnl ===================================================================
11054 AC_MSG_CHECKING([for helppack integration])
11055 if test "$with_helppack_integration" = "no"; then
11056     WITH_HELPPACK_INTEGRATION=
11057     AC_MSG_RESULT([no integration])
11058 else
11059     WITH_HELPPACK_INTEGRATION=TRUE
11060     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11061     AC_MSG_RESULT([integration])
11063 AC_SUBST(WITH_HELPPACK_INTEGRATION)
11065 ###############################################################################
11066 # Extensions checking
11067 ###############################################################################
11068 AC_MSG_CHECKING([for extensions integration])
11069 if test "x$enable_extension_integration" != "xno"; then
11070     WITH_EXTENSION_INTEGRATION=TRUE
11071     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11072     AC_MSG_RESULT([yes, use integration])
11073 else
11074     WITH_EXTENSION_INTEGRATION=
11075     AC_MSG_RESULT([no, do not integrate])
11077 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11079 dnl Should any extra extensions be included?
11080 dnl There are standalone tests for each of these below.
11081 WITH_EXTRA_EXTENSIONS=
11082 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11084 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11085 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11086 if test "x$with_java" != "xno"; then
11087     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11088     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11091 TEST_FONTS_MISSING=0
11093 # $1  = font family
11094 # $2+ = accepted font mappings
11095 test_font_map()
11097     FONT="$1" ; shift
11098     AC_MSG_CHECKING([font mapping for '$FONT'])
11099     FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
11100     FONTFILE_LOWER="$(echo $FONTFILE | $AWK '{print tolower($0)}')"
11102     TESTEXPR="'${FONTFILE_LOWER}' = '$(echo $FONT | $AWK '{print tolower($0)}').ttf'"
11103     while test "$#" -ge 1 ; do
11104         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
11105         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
11106     done
11107     if test $TESTEXPR
11108     then
11109         AC_MSG_RESULT([ok])
11110     else
11111         AC_MSG_WARN([unknown ($FONTFILE)])
11112         add_warning "unknown ($FONTFILE)"
11113         TEST_FONTS_MISSING=1
11114     fi
11117 dnl ===================================================================
11118 dnl Test whether to include fonts
11119 dnl ===================================================================
11120 AC_MSG_CHECKING([whether to include third-party fonts])
11121 if test "$with_fonts" != "no"; then
11122     AC_MSG_RESULT([yes])
11123     WITH_FONTS=TRUE
11124     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11125     AC_DEFINE(HAVE_MORE_FONTS)
11126 else
11127     AC_MSG_RESULT([no])
11128     WITH_FONTS=
11129     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11130     if test "$test_fontconfig" = "yes"; then
11131         AC_PATH_PROG([FCMATCH], [fc-match])
11132         if test -z "$FCMATCH"; then
11133             AC_MSG_WARN([Unable to query installed fonts - unit tests disabled.])
11134             TEST_FONTS_MISSING=1
11135         else
11136             test_font_map 'Calibri' 'Carlito'
11137             test_font_map 'DejaVuSans' 'DejaVuSans'
11138             if test ${TEST_FONTS_MISSING} -eq 1
11139             then
11140                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
11141                 add_warning "Unknown font mappings - unit tests disabled."
11142             fi
11143         fi
11144     else
11145         TEST_FONTS_MISSING=1
11146     fi
11148 AC_SUBST(WITH_FONTS)
11149 AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
11151 dnl Test whether to include more Google Noto fonts
11152 dnl ===================================================================
11153 AC_MSG_CHECKING([whether to include more Google Noto fonts])
11154 if test "$enable_noto_font" = "" -o "$enable_noto_font" = "no" -o "$with_fonts" = "no"; then
11155     AC_MSG_RESULT([no])
11156     WITH_NOTO_FONT=
11157 else
11158     AC_MSG_RESULT([yes])
11159     WITH_NOTO_FONT=TRUE
11160     BUILD_TYPE="$BUILD_TYPE NOTO_FONT"
11161     SCPDEFS="$SCPDEFS -DWITH_NOTO_FONT"
11163 AC_SUBST(WITH_NOTO_FONT)
11165 dnl ===================================================================
11166 dnl Test whether to enable online update service
11167 dnl ===================================================================
11168 AC_MSG_CHECKING([whether to enable online update])
11169 ENABLE_ONLINE_UPDATE=
11170 ENABLE_ONLINE_UPDATE_MAR=
11171 UPDATE_CONFIG=
11172 if test "$enable_online_update" = ""; then
11173     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11174         AC_MSG_RESULT([yes])
11175         ENABLE_ONLINE_UPDATE="TRUE"
11176     else
11177         AC_MSG_RESULT([no])
11178     fi
11179 else
11180     if test "$enable_online_update" = "mar"; then
11181         AC_MSG_RESULT([yes - MAR-based online update])
11182         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11183         if test "$with_update_config" = ""; then
11184             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11185         fi
11186         UPDATE_CONFIG="$with_update_config"
11187         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11188     elif test "$enable_online_update" = "yes"; then
11189         AC_MSG_RESULT([yes])
11190         ENABLE_ONLINE_UPDATE="TRUE"
11191     else
11192         AC_MSG_RESULT([no])
11193     fi
11195 AC_SUBST(ENABLE_ONLINE_UPDATE)
11196 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11197 AC_SUBST(UPDATE_CONFIG)
11199 dnl ===================================================================
11200 dnl Test whether we need bzip2
11201 dnl ===================================================================
11202 SYSTEM_BZIP2=
11203 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11204     AC_MSG_CHECKING([whether to use system bzip2])
11205     if test "$with_system_bzip2" = yes; then
11206         SYSTEM_BZIP2=TRUE
11207         AC_MSG_RESULT([yes])
11208         PKG_CHECK_MODULES(BZIP2, bzip2)
11209         FilterLibs "${BZIP2_LIBS}"
11210         BZIP2_LIBS="${filteredlibs}"
11211     else
11212         AC_MSG_RESULT([no])
11213         BUILD_TYPE="$BUILD_TYPE BZIP2"
11214     fi
11216 AC_SUBST(SYSTEM_BZIP2)
11217 AC_SUBST(BZIP2_CFLAGS)
11218 AC_SUBST(BZIP2_LIBS)
11220 dnl ===================================================================
11221 dnl Test whether to enable extension update
11222 dnl ===================================================================
11223 AC_MSG_CHECKING([whether to enable extension update])
11224 ENABLE_EXTENSION_UPDATE=
11225 if test "x$enable_extension_update" = "xno"; then
11226     AC_MSG_RESULT([no])
11227 else
11228     AC_MSG_RESULT([yes])
11229     ENABLE_EXTENSION_UPDATE="TRUE"
11230     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11231     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11233 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11236 dnl ===================================================================
11237 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11238 dnl ===================================================================
11239 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11240 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11241     AC_MSG_RESULT([no])
11242     ENABLE_SILENT_MSI=
11243 else
11244     AC_MSG_RESULT([yes])
11245     ENABLE_SILENT_MSI=TRUE
11246     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11248 AC_SUBST(ENABLE_SILENT_MSI)
11250 AC_MSG_CHECKING([whether and how to use Xinerama])
11251 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11252     if test "$x_libraries" = "default_x_libraries"; then
11253         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11254         if test "x$XINERAMALIB" = x; then
11255            XINERAMALIB="/usr/lib"
11256         fi
11257     else
11258         XINERAMALIB="$x_libraries"
11259     fi
11260     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11261         # we have both versions, let the user decide but use the dynamic one
11262         # per default
11263         USE_XINERAMA=TRUE
11264         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11265             XINERAMA_LINK=dynamic
11266         else
11267             XINERAMA_LINK=static
11268         fi
11269     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11270         # we have only the dynamic version
11271         USE_XINERAMA=TRUE
11272         XINERAMA_LINK=dynamic
11273     elif test -e "$XINERAMALIB/libXinerama.a"; then
11274         # static version
11275         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11276             USE_XINERAMA=TRUE
11277             XINERAMA_LINK=static
11278         else
11279             USE_XINERAMA=
11280             XINERAMA_LINK=none
11281         fi
11282     else
11283         # no Xinerama
11284         USE_XINERAMA=
11285         XINERAMA_LINK=none
11286     fi
11287     if test "$USE_XINERAMA" = "TRUE"; then
11288         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11289         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11290             [AC_MSG_ERROR(Xinerama header not found.)], [])
11291         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11292         if test "x$XEXTLIB" = x; then
11293            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11294         fi
11295         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11296         if test "$_os" = "FreeBSD"; then
11297             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11298         fi
11299         if test "$_os" = "Linux"; then
11300             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11301         fi
11302         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11303             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11304     else
11305         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11306     fi
11307 else
11308     USE_XINERAMA=
11309     XINERAMA_LINK=none
11310     AC_MSG_RESULT([no])
11312 AC_SUBST(USE_XINERAMA)
11313 AC_SUBST(XINERAMA_LINK)
11315 dnl ===================================================================
11316 dnl Test whether to build cairo or rely on the system version
11317 dnl ===================================================================
11319 if test "$USING_X11" = TRUE; then
11320     # Used in vcl/Library_vclplug_gen.mk
11321     test_cairo=yes
11324 if test "$test_cairo" = "yes"; then
11325     AC_MSG_CHECKING([whether to use the system cairo])
11327     : ${with_system_cairo:=$with_system_libs}
11328     if test "$with_system_cairo" = "yes"; then
11329         SYSTEM_CAIRO=TRUE
11330         AC_MSG_RESULT([yes])
11332         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11333         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11334         FilterLibs "${CAIRO_LIBS}"
11335         CAIRO_LIBS="${filteredlibs}"
11337         if test "$test_xrender" = "yes"; then
11338             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11339             AC_LANG_PUSH([C])
11340             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11341 #ifdef PictStandardA8
11342 #else
11343       return fail;
11344 #endif
11345 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11347             AC_LANG_POP([C])
11348         fi
11349     else
11350         SYSTEM_CAIRO=
11351         AC_MSG_RESULT([no])
11353         BUILD_TYPE="$BUILD_TYPE CAIRO"
11354     fi
11357 AC_SUBST(SYSTEM_CAIRO)
11358 AC_SUBST(CAIRO_CFLAGS)
11359 AC_SUBST(CAIRO_LIBS)
11361 dnl ===================================================================
11362 dnl Test whether to use avahi
11363 dnl ===================================================================
11364 if test "$_os" = "WINNT"; then
11365     # Windows uses bundled mDNSResponder
11366     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11367 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11368     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11369                       [ENABLE_AVAHI="TRUE"])
11370     AC_DEFINE(HAVE_FEATURE_AVAHI)
11371     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11372     FilterLibs "${AVAHI_LIBS}"
11373     AVAHI_LIBS="${filteredlibs}"
11376 AC_SUBST(ENABLE_AVAHI)
11377 AC_SUBST(AVAHI_CFLAGS)
11378 AC_SUBST(AVAHI_LIBS)
11380 dnl ===================================================================
11381 dnl Test whether to use liblangtag
11382 dnl ===================================================================
11383 SYSTEM_LIBLANGTAG=
11384 AC_MSG_CHECKING([whether to use system liblangtag])
11385 if test "$with_system_liblangtag" = yes; then
11386     SYSTEM_LIBLANGTAG=TRUE
11387     AC_MSG_RESULT([yes])
11388     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11389     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11390     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11391     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11392     FilterLibs "${LIBLANGTAG_LIBS}"
11393     LIBLANGTAG_LIBS="${filteredlibs}"
11394 else
11395     SYSTEM_LIBLANGTAG=
11396     AC_MSG_RESULT([no])
11397     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11398     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11399     if test "$COM" = "MSC"; then
11400         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11401     else
11402         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11403     fi
11405 AC_SUBST(SYSTEM_LIBLANGTAG)
11406 AC_SUBST(LIBLANGTAG_CFLAGS)
11407 AC_SUBST(LIBLANGTAG_LIBS)
11409 dnl ===================================================================
11410 dnl Test whether to build libpng or rely on the system version
11411 dnl ===================================================================
11413 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11415 dnl ===================================================================
11416 dnl Check for runtime JVM search path
11417 dnl ===================================================================
11418 if test "$ENABLE_JAVA" != ""; then
11419     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11420     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11421         AC_MSG_RESULT([yes])
11422         if ! test -d "$with_jvm_path"; then
11423             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11424         fi
11425         if ! test -d "$with_jvm_path"jvm; then
11426             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11427         fi
11428         JVM_ONE_PATH_CHECK="$with_jvm_path"
11429         AC_SUBST(JVM_ONE_PATH_CHECK)
11430     else
11431         AC_MSG_RESULT([no])
11432     fi
11435 dnl ===================================================================
11436 dnl Test for the presence of Ant and that it works
11437 dnl ===================================================================
11439 if test "$ENABLE_JAVA" != ""; then
11440     ANT_HOME=; export ANT_HOME
11441     WITH_ANT_HOME=; export WITH_ANT_HOME
11442     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11443         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11444             if test "$_os" = "WINNT"; then
11445                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11446             else
11447                 with_ant_home="$LODE_HOME/opt/ant"
11448             fi
11449         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11450             with_ant_home="$LODE_HOME/opt/ant"
11451         fi
11452     fi
11453     if test -z "$with_ant_home"; then
11454         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11455     else
11456         if test "$_os" = "WINNT"; then
11457             # AC_PATH_PROGS needs unix path
11458             with_ant_home=`cygpath -u "$with_ant_home"`
11459         fi
11460         AbsolutePath "$with_ant_home"
11461         with_ant_home=$absolute_path
11462         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11463         WITH_ANT_HOME=$with_ant_home
11464         ANT_HOME=$with_ant_home
11465     fi
11467     if test -z "$ANT"; then
11468         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11469     else
11470         # resolve relative or absolute symlink
11471         while test -h "$ANT"; do
11472             a_cwd=`pwd`
11473             a_basename=`basename "$ANT"`
11474             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11475             cd "`dirname "$ANT"`"
11476             cd "`dirname "$a_script"`"
11477             ANT="`pwd`"/"`basename "$a_script"`"
11478             cd "$a_cwd"
11479         done
11481         AC_MSG_CHECKING([if $ANT works])
11482         cat > conftest.java << EOF
11483         public class conftest {
11484             int testmethod(int a, int b) {
11485                     return a + b;
11486             }
11487         }
11490         cat > conftest.xml << EOF
11491         <project name="conftest" default="conftest">
11492         <target name="conftest">
11493             <javac srcdir="." includes="conftest.java">
11494             </javac>
11495         </target>
11496         </project>
11499         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11500         if test $? = 0 -a -f ./conftest.class; then
11501             AC_MSG_RESULT([Ant works])
11502             if test -z "$WITH_ANT_HOME"; then
11503                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11504                 if test -z "$ANT_HOME"; then
11505                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11506                 fi
11507             else
11508                 ANT_HOME="$WITH_ANT_HOME"
11509             fi
11510         else
11511             echo "configure: Ant test failed" >&5
11512             cat conftest.java >&5
11513             cat conftest.xml >&5
11514             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11515         fi
11516         rm -f conftest* core core.* *.core
11517     fi
11518     if test -z "$ANT_HOME"; then
11519         ANT_HOME="NO_ANT_HOME"
11520     else
11521         PathFormat "$ANT_HOME"
11522         ANT_HOME="$formatted_path"
11523         PathFormat "$ANT"
11524         ANT="$formatted_path"
11525     fi
11526     AC_SUBST(ANT_HOME)
11527     AC_SUBST(ANT)
11529     dnl Checking for ant.jar
11530     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11531         AC_MSG_CHECKING([Ant lib directory])
11532         if test -f $ANT_HOME/lib/ant.jar; then
11533             ANT_LIB="$ANT_HOME/lib"
11534         else
11535             if test -f $ANT_HOME/ant.jar; then
11536                 ANT_LIB="$ANT_HOME"
11537             else
11538                 if test -f /usr/share/java/ant.jar; then
11539                     ANT_LIB=/usr/share/java
11540                 else
11541                     if test -f /usr/share/ant-core/lib/ant.jar; then
11542                         ANT_LIB=/usr/share/ant-core/lib
11543                     else
11544                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11545                             ANT_LIB="$ANT_HOME/lib/ant"
11546                         else
11547                             if test -f /usr/share/lib/ant/ant.jar; then
11548                                 ANT_LIB=/usr/share/lib/ant
11549                             else
11550                                 AC_MSG_ERROR([Ant libraries not found!])
11551                             fi
11552                         fi
11553                     fi
11554                 fi
11555             fi
11556         fi
11557         PathFormat "$ANT_LIB"
11558         ANT_LIB="$formatted_path"
11559         AC_MSG_RESULT([Ant lib directory found.])
11560     fi
11561     AC_SUBST(ANT_LIB)
11563     ant_minver=1.6.0
11564     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11566     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11567     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11568     ant_version_major=`echo $ant_version | cut -d. -f1`
11569     ant_version_minor=`echo $ant_version | cut -d. -f2`
11570     echo "configure: ant_version $ant_version " >&5
11571     echo "configure: ant_version_major $ant_version_major " >&5
11572     echo "configure: ant_version_minor $ant_version_minor " >&5
11573     if test "$ant_version_major" -ge "2"; then
11574         AC_MSG_RESULT([yes, $ant_version])
11575     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11576         AC_MSG_RESULT([yes, $ant_version])
11577     else
11578         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11579     fi
11581     rm -f conftest* core core.* *.core
11584 OOO_JUNIT_JAR=
11585 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11586     AC_MSG_CHECKING([for JUnit 4])
11587     if test "$with_junit" = "yes"; then
11588         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
11589             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
11590         elif test -e /usr/share/java/junit4.jar; then
11591             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11592         else
11593            if test -e /usr/share/lib/java/junit.jar; then
11594               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11595            else
11596               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11597            fi
11598         fi
11599     else
11600         OOO_JUNIT_JAR=$with_junit
11601     fi
11602     if test "$_os" = "WINNT"; then
11603         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11604     fi
11605     printf 'import org.junit.Before;' > conftest.java
11606     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11607         AC_MSG_RESULT([$OOO_JUNIT_JAR])
11608     else
11609         AC_MSG_ERROR(
11610 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
11611  specify its pathname via --with-junit=..., or disable it via --without-junit])
11612     fi
11613     rm -f conftest.class conftest.java
11614     if test $OOO_JUNIT_JAR != ""; then
11615     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11616     fi
11618 AC_SUBST(OOO_JUNIT_JAR)
11620 HAMCREST_JAR=
11621 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11622     AC_MSG_CHECKING([for included Hamcrest])
11623     printf 'import org.hamcrest.BaseDescription;' > conftest.java
11624     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11625         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
11626     else
11627         AC_MSG_RESULT([Not included])
11628         AC_MSG_CHECKING([for standalone hamcrest jar.])
11629         if test "$with_hamcrest" = "yes"; then
11630             if test -e /usr/share/lib/java/hamcrest.jar; then
11631                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
11632             elif test -e /usr/share/java/hamcrest/core.jar; then
11633                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
11634             else
11635                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
11636             fi
11637         else
11638             HAMCREST_JAR=$with_hamcrest
11639         fi
11640         if test "$_os" = "WINNT"; then
11641             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
11642         fi
11643         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
11644             AC_MSG_RESULT([$HAMCREST_JAR])
11645         else
11646             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),
11647                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
11648         fi
11649     fi
11650     rm -f conftest.class conftest.java
11652 AC_SUBST(HAMCREST_JAR)
11655 AC_SUBST(SCPDEFS)
11658 # check for wget and curl
11660 WGET=
11661 CURL=
11663 if test "$enable_fetch_external" != "no"; then
11665 CURL=`which curl 2>/dev/null`
11667 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
11668     # wget new enough?
11669     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
11670     if test $? -eq 0; then
11671         WGET=$i
11672         break
11673     fi
11674 done
11676 if test -z "$WGET" -a -z "$CURL"; then
11677     AC_MSG_ERROR([neither wget nor curl found!])
11682 AC_SUBST(WGET)
11683 AC_SUBST(CURL)
11686 # check for sha256sum
11688 SHA256SUM=
11690 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
11691     eval "$i -a 256 --version" > /dev/null 2>&1
11692     ret=$?
11693     if test $ret -eq 0; then
11694         SHA256SUM="$i -a 256"
11695         break
11696     fi
11697 done
11699 if test -z "$SHA256SUM"; then
11700     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
11701         eval "$i --version" > /dev/null 2>&1
11702         ret=$?
11703         if test $ret -eq 0; then
11704             SHA256SUM=$i
11705             break
11706         fi
11707     done
11710 if test -z "$SHA256SUM"; then
11711     AC_MSG_ERROR([no sha256sum found!])
11714 AC_SUBST(SHA256SUM)
11716 dnl ===================================================================
11717 dnl Dealing with l10n options
11718 dnl ===================================================================
11719 AC_MSG_CHECKING([which languages to be built])
11720 # get list of all languages
11721 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
11722 # the sed command does the following:
11723 #   + if a line ends with a backslash, append the next line to it
11724 #   + adds " on the beginning of the value (after =)
11725 #   + adds " at the end of the value
11726 #   + removes en-US; we want to put it on the beginning
11727 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
11728 [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)]
11729 ALL_LANGS="en-US $completelangiso"
11730 # check the configured localizations
11731 WITH_LANG="$with_lang"
11732 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
11733     AC_MSG_RESULT([en-US])
11734 else
11735     AC_MSG_RESULT([$WITH_LANG])
11736     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
11737     if test -z "$MSGFMT"; then
11738         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
11739             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
11740         elif test -x "/opt/lo/bin/msgfmt"; then
11741             MSGFMT="/opt/lo/bin/msgfmt"
11742         else
11743             AC_CHECK_PROGS(MSGFMT, [msgfmt])
11744             if test -z "$MSGFMT"; then
11745                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
11746             fi
11747         fi
11748     fi
11749     if test -z "$MSGUNIQ"; then
11750         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
11751             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
11752         elif test -x "/opt/lo/bin/msguniq"; then
11753             MSGUNIQ="/opt/lo/bin/msguniq"
11754         else
11755             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
11756             if test -z "$MSGUNIQ"; then
11757                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
11758             fi
11759         fi
11760     fi
11762 AC_SUBST(MSGFMT)
11763 AC_SUBST(MSGUNIQ)
11764 # check that the list is valid
11765 for lang in $WITH_LANG; do
11766     test "$lang" = "ALL" && continue
11767     # need to check for the exact string, so add space before and after the list of all languages
11768     for vl in $ALL_LANGS; do
11769         if test "$vl" = "$lang"; then
11770            break
11771         fi
11772     done
11773     if test "$vl" != "$lang"; then
11774         # if you're reading this - you prolly quoted your languages remove the quotes ...
11775         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
11776     fi
11777 done
11778 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
11779     echo $WITH_LANG | grep -q en-US
11780     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
11782 # list with substituted ALL
11783 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
11784 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
11785 test "$WITH_LANG" = "en-US" && WITH_LANG=
11786 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
11787     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
11788     ALL_LANGS=`echo $ALL_LANGS qtz`
11790 AC_SUBST(ALL_LANGS)
11791 AC_SUBST(WITH_LANG)
11792 AC_SUBST(WITH_LANG_LIST)
11793 AC_SUBST(GIT_NEEDED_SUBMODULES)
11795 WITH_POOR_HELP_LOCALIZATIONS=
11796 if test -d "$SRC_ROOT/translations/source"; then
11797     for l in `ls -1 $SRC_ROOT/translations/source`; do
11798         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
11799             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
11800         fi
11801     done
11803 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
11805 if test -n "$with_locales"; then
11806     WITH_LOCALES="$with_locales"
11808     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
11809     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
11810     # config_host/config_locales.h.in
11811     for locale in $WITH_LOCALES; do
11812         lang=${locale%_*}
11814         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
11816         case $lang in
11817         hi|mr*ne)
11818             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
11819             ;;
11820         bg|ru)
11821             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
11822             ;;
11823         esac
11824     done
11825 else
11826     AC_DEFINE(WITH_LOCALE_ALL)
11828 AC_SUBST(WITH_LOCALES)
11830 dnl git submodule update --reference
11831 dnl ===================================================================
11832 if test -n "${GIT_REFERENCE_SRC}"; then
11833     for repo in ${GIT_NEEDED_SUBMODULES}; do
11834         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
11835             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
11836         fi
11837     done
11839 AC_SUBST(GIT_REFERENCE_SRC)
11841 dnl git submodules linked dirs
11842 dnl ===================================================================
11843 if test -n "${GIT_LINK_SRC}"; then
11844     for repo in ${GIT_NEEDED_SUBMODULES}; do
11845         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
11846             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
11847         fi
11848     done
11850 AC_SUBST(GIT_LINK_SRC)
11852 dnl branding
11853 dnl ===================================================================
11854 AC_MSG_CHECKING([for alternative branding images directory])
11855 # initialize mapped arrays
11856 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
11857 brand_files="$BRAND_INTRO_IMAGES about.svg"
11859 if test -z "$with_branding" -o "$with_branding" = "no"; then
11860     AC_MSG_RESULT([none])
11861     DEFAULT_BRAND_IMAGES="$brand_files"
11862 else
11863     if ! test -d $with_branding ; then
11864         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
11865     else
11866         AC_MSG_RESULT([$with_branding])
11867         CUSTOM_BRAND_DIR="$with_branding"
11868         for lfile in $brand_files
11869         do
11870             if ! test -f $with_branding/$lfile ; then
11871                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
11872                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
11873             else
11874                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
11875             fi
11876         done
11877         check_for_progress="yes"
11878     fi
11880 AC_SUBST([BRAND_INTRO_IMAGES])
11881 AC_SUBST([CUSTOM_BRAND_DIR])
11882 AC_SUBST([CUSTOM_BRAND_IMAGES])
11883 AC_SUBST([DEFAULT_BRAND_IMAGES])
11886 AC_MSG_CHECKING([for 'intro' progress settings])
11887 PROGRESSBARCOLOR=
11888 PROGRESSSIZE=
11889 PROGRESSPOSITION=
11890 PROGRESSFRAMECOLOR=
11891 PROGRESSTEXTCOLOR=
11892 PROGRESSTEXTBASELINE=
11894 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
11895     source "$with_branding/progress.conf"
11896     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
11897 else
11898     AC_MSG_RESULT([none])
11901 AC_SUBST(PROGRESSBARCOLOR)
11902 AC_SUBST(PROGRESSSIZE)
11903 AC_SUBST(PROGRESSPOSITION)
11904 AC_SUBST(PROGRESSFRAMECOLOR)
11905 AC_SUBST(PROGRESSTEXTCOLOR)
11906 AC_SUBST(PROGRESSTEXTBASELINE)
11909 AC_MSG_CHECKING([for extra build ID])
11910 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
11911     EXTRA_BUILDID="$with_extra_buildid"
11913 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
11914 if test -n "$EXTRA_BUILDID" ; then
11915     AC_MSG_RESULT([$EXTRA_BUILDID])
11916 else
11917     AC_MSG_RESULT([not set])
11919 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
11921 OOO_VENDOR=
11922 AC_MSG_CHECKING([for vendor])
11923 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
11924     OOO_VENDOR="$USERNAME"
11926     if test -z "$OOO_VENDOR"; then
11927         OOO_VENDOR="$USER"
11928     fi
11930     if test -z "$OOO_VENDOR"; then
11931         OOO_VENDOR="`id -u -n`"
11932     fi
11934     AC_MSG_RESULT([not set, using $OOO_VENDOR])
11935 else
11936     OOO_VENDOR="$with_vendor"
11937     AC_MSG_RESULT([$OOO_VENDOR])
11939 AC_SUBST(OOO_VENDOR)
11941 if test "$_os" = "Android" ; then
11942     ANDROID_PACKAGE_NAME=
11943     AC_MSG_CHECKING([for Android package name])
11944     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
11945         if test -n "$ENABLE_DEBUG"; then
11946             # Default to the package name that makes ndk-gdb happy.
11947             ANDROID_PACKAGE_NAME="org.libreoffice"
11948         else
11949             ANDROID_PACKAGE_NAME="org.example.libreoffice"
11950         fi
11952         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
11953     else
11954         ANDROID_PACKAGE_NAME="$with_android_package_name"
11955         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
11956     fi
11957     AC_SUBST(ANDROID_PACKAGE_NAME)
11960 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
11961 if test "$with_compat_oowrappers" = "yes"; then
11962     WITH_COMPAT_OOWRAPPERS=TRUE
11963     AC_MSG_RESULT(yes)
11964 else
11965     WITH_COMPAT_OOWRAPPERS=
11966     AC_MSG_RESULT(no)
11968 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
11970 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{gsub(" ", "", $0);print tolower($0)}'`
11971 AC_MSG_CHECKING([for install dirname])
11972 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
11973     INSTALLDIRNAME="$with_install_dirname"
11975 AC_MSG_RESULT([$INSTALLDIRNAME])
11976 AC_SUBST(INSTALLDIRNAME)
11978 AC_MSG_CHECKING([for prefix])
11979 test "x$prefix" = xNONE && prefix=$ac_default_prefix
11980 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
11981 PREFIXDIR="$prefix"
11982 AC_MSG_RESULT([$PREFIXDIR])
11983 AC_SUBST(PREFIXDIR)
11985 LIBDIR=[$(eval echo $(eval echo $libdir))]
11986 AC_SUBST(LIBDIR)
11988 DATADIR=[$(eval echo $(eval echo $datadir))]
11989 AC_SUBST(DATADIR)
11991 MANDIR=[$(eval echo $(eval echo $mandir))]
11992 AC_SUBST(MANDIR)
11994 DOCDIR=[$(eval echo $(eval echo $docdir))]
11995 AC_SUBST(DOCDIR)
11997 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
11998 AC_SUBST(INSTALLDIR)
12000 TESTINSTALLDIR="${BUILDDIR}/test-install"
12001 AC_SUBST(TESTINSTALLDIR)
12004 # ===================================================================
12005 # OAuth2 id and secrets
12006 # ===================================================================
12008 AC_MSG_CHECKING([for Google Drive client id and secret])
12009 GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12010 GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12011 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12012     GDRIVE_CLIENT_ID="\"\""
12015 if test "$with_gdrive_client_secret" = "no" -o -z "$with_gdrive_client_secret"; then
12016     GDRIVE_CLIENT_SECRET="\"\""
12019 if test -z "$GDRIVE_CLIENT_ID" -o -z "$GDRIVE_CLIENT_SECRET"; then
12020     AC_MSG_RESULT([not set])
12021 else
12022     AC_MSG_RESULT([set])
12025 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12026 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12028 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12029 ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12030 ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12031 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12032     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12035 if test "$with_alfresco_cloud_client_secret" = "no" -o -z "$with_alfresco_cloud_client_secret"; then
12036     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12039 if test -z "$ALFRESCO_CLOUD_CLIENT_ID" -o -z "$ALFRESCO_CLOUD_CLIENT_SECRET"; then
12040     AC_MSG_RESULT([not set])
12041 else
12042     AC_MSG_RESULT([set])
12044 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12045 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12047 AC_MSG_CHECKING([for OneDrive client id and secret])
12048 ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12049 ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12050 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12051     ONEDRIVE_CLIENT_ID="\"\""
12054 if test "$with_onedrive_client_secret" = "no" -o -z "$with_onedrive_client_secret"; then
12055     ONEDRIVE_CLIENT_SECRET="\"\""
12058 if test -z "$ONEDRIVE_CLIENT_ID" -o -z "$ONEDRIVE_CLIENT_SECRET"; then
12059     AC_MSG_RESULT([not set])
12060 else
12061     AC_MSG_RESULT([set])
12063 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12064 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12067 dnl ===================================================================
12068 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12069 dnl --enable-dependency-tracking configure option
12070 dnl ===================================================================
12071 AC_MSG_CHECKING([whether to enable dependency tracking])
12072 if test "$enable_dependency_tracking" = "no"; then
12073     nodep=TRUE
12074     AC_MSG_RESULT([no])
12075 else
12076     AC_MSG_RESULT([yes])
12078 AC_SUBST(nodep)
12080 dnl ===================================================================
12081 dnl Number of CPUs to use during the build
12082 dnl ===================================================================
12083 AC_MSG_CHECKING([for number of processors to use])
12084 # plain --with-parallelism is just the default
12085 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12086     if test "$with_parallelism" = "no"; then
12087         PARALLELISM=0
12088     else
12089         PARALLELISM=$with_parallelism
12090     fi
12091 else
12092     if test "$enable_icecream" = "yes"; then
12093         PARALLELISM="10"
12094     else
12095         case `uname -s` in
12097         Darwin|FreeBSD|NetBSD|OpenBSD)
12098             PARALLELISM=`sysctl -n hw.ncpu`
12099             ;;
12101         Linux)
12102             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12103         ;;
12104         # what else than above does profit here *and* has /proc?
12105         *)
12106             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12107             ;;
12108         esac
12110         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12111         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12112     fi
12115 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12116     if test -z "$with_parallelism"; then
12117             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12118             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12119             PARALLELISM="1"
12120     else
12121         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."
12122     fi
12125 if test $PARALLELISM -eq 0; then
12126     AC_MSG_RESULT([explicit make -j option needed])
12127 else
12128     AC_MSG_RESULT([$PARALLELISM])
12130 AC_SUBST(PARALLELISM)
12132 IWYU_PATH="$with_iwyu"
12133 AC_SUBST(IWYU_PATH)
12134 if test ! -z "$IWYU_PATH"; then
12135     if test ! -f "$IWYU_PATH"; then
12136         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12137     fi
12141 # Set up ILIB for MSVC build
12143 ILIB1=
12144 if test "$build_os" = "cygwin"; then
12145     ILIB="."
12146     if test -n "$JAVA_HOME"; then
12147         ILIB="$ILIB;$JAVA_HOME/lib"
12148     fi
12149     ILIB1=-link
12150     if test "$BITNESS_OVERRIDE" = 64; then
12151         if test $vcnum = "150"; then
12152             ILIB="$ILIB;$COMPATH/lib/x64"
12153             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12154         else
12155             ILIB="$ILIB;$COMPATH/lib/amd64"
12156             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/amd64"
12157         fi
12158         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12159         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12160         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12161             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12162             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12163         fi
12164         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12165         ucrtlibpath_formatted=$formatted_path
12166         ILIB="$ILIB;$ucrtlibpath_formatted"
12167         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12168     else
12169         if test $vcnum = "150"; then
12170             ILIB="$ILIB;$COMPATH/lib/x86"
12171             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12172         else
12173             ILIB="$ILIB;$COMPATH/lib"
12174             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib"
12175         fi
12176         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12177         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12178         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12179             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12180             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12181         fi
12182         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12183         ucrtlibpath_formatted=$formatted_path
12184         ILIB="$ILIB;$ucrtlibpath_formatted"
12185         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12186     fi
12187     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12188         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12189     else
12190         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12191     fi
12193     AC_SUBST(ILIB)
12196 dnl We should be able to drop the below check when bumping the GCC baseline to
12197 dnl 4.9, as <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54577>
12198 dnl "deque<T>::erase() still takes iterator instead of const_iterator" should be
12199 dnl fixed there with <https://gcc.gnu.org/git/?p=gcc.git;a=commit;
12200 dnl h=6b0e18ca48bb4b4c01e7b5be2b98849943fdcf91>:
12201 AC_MSG_CHECKING(
12202     [whether C++11 use of const_iterator in standard containers is broken])
12203 save_CXXFLAGS=$CXXFLAGS
12204 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12205 AC_LANG_PUSH([C++])
12206 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12207     #include <list>
12208     ]],[[
12209         std::list<int> l;
12210         l.erase(l.cbegin());
12211     ]])],
12212     [broken=no], [broken=yes])
12213 AC_LANG_POP([C++])
12214 CXXFLAGS=$save_CXXFLAGS
12215 AC_MSG_RESULT([$broken])
12216 if test "$broken" = yes; then
12217     AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
12221 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12222 save_CXXFLAGS=$CXXFLAGS
12223 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12224 save_LIBS=$LIBS
12225 if test -n "$ILIB1"; then
12226     LIBS="$LIBS $ILIB1"
12228 AC_LANG_PUSH([C++])
12229 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12230     // Exit with failure if the static initializer_list is stored on the
12231     // stack (as done by Clang < 3.4):
12232     #include <initializer_list>
12233     struct S {};
12234     bool g(void const * p1, void const * p2) {
12235         int n;
12236         return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12237     }
12238     bool f(void const * p1) {
12239         static std::initializer_list<S> s { S() };
12240         return g(p1, s.begin());
12241     }
12242     ]],[[
12243         int n;
12244         return f(&n) ? 0 : 1;
12245     ]])], [broken=no], [broken=yes],[broken='assuming not (cross-compiling)'])
12246 AC_LANG_POP([C++])
12247 LIBS=$save_LIBS
12248 CXXFLAGS=$save_CXXFLAGS
12249 AC_MSG_RESULT([$broken])
12250 if test "$broken" = yes -a "$_os" != "iOS"; then
12251     AC_MSG_ERROR([working support for static initializer_list needed])
12255 # ===================================================================
12256 # Creating bigger shared library to link against
12257 # ===================================================================
12258 AC_MSG_CHECKING([whether to create huge library])
12259 MERGELIBS=
12261 if test $_os = iOS -o $_os = Android; then
12262     # Never any point in mergelibs for these as we build just static
12263     # libraries anyway...
12264     enable_mergelibs=no
12267 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12268     if test $_os != Linux -a $_os != WINNT; then
12269         add_warning "--enable-mergelibs is not tested for this platform"
12270     fi
12271     MERGELIBS="TRUE"
12272     AC_MSG_RESULT([yes])
12273 else
12274     AC_MSG_RESULT([no])
12276 AC_SUBST([MERGELIBS])
12278 dnl ===================================================================
12279 dnl icerun is a wrapper that stops us spawning tens of processes
12280 dnl locally - for tools that can't be executed on the compile cluster
12281 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12282 dnl ===================================================================
12283 AC_MSG_CHECKING([whether to use icerun wrapper])
12284 ICECREAM_RUN=
12285 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12286     ICECREAM_RUN=icerun
12287     AC_MSG_RESULT([yes])
12288 else
12289     AC_MSG_RESULT([no])
12291 AC_SUBST(ICECREAM_RUN)
12293 dnl ===================================================================
12294 dnl Setup the ICECC_VERSION for the build the same way it was set for
12295 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12296 dnl ===================================================================
12297 x_ICECC_VERSION=[\#]
12298 if test -n "$ICECC_VERSION" ; then
12299     x_ICECC_VERSION=
12301 AC_SUBST(x_ICECC_VERSION)
12302 AC_SUBST(ICECC_VERSION)
12304 dnl ===================================================================
12306 AC_MSG_CHECKING([MPL subset])
12307 MPL_SUBSET=
12309 if test "$enable_mpl_subset" = "yes"; then
12310     warn_report=false
12311     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12312         warn_report=true
12313     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12314         warn_report=true
12315     fi
12316     if test "$warn_report" = "true"; then
12317         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12318     fi
12319     if test "x$enable_postgresql_sdbc" != "xno"; then
12320         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12321     fi
12322     if test "$enable_lotuswordpro" = "yes"; then
12323         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12324     fi
12325     if test "$WITH_WEBDAV" = "neon"; then
12326         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12327     fi
12328     if test -n "$ENABLE_PDFIMPORT"; then
12329         if test "x$SYSTEM_POPPLER" = "x"; then
12330             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12331         fi
12332     fi
12333     # cf. m4/libo_check_extension.m4
12334     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12335         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12336     fi
12337     for theme in $WITH_THEMES; do
12338         case $theme in
12339         crystal|default|hicontrast|oxygen)
12340             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12341         *) : ;;
12342         esac
12343     done
12345     ENABLE_OPENGL_TRANSITIONS=
12347     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12348         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12349     fi
12351     MPL_SUBSET="TRUE"
12352     AC_DEFINE(MPL_HAVE_SUBSET)
12353     AC_MSG_RESULT([only])
12354 else
12355     AC_MSG_RESULT([no restrictions])
12357 AC_SUBST(MPL_SUBSET)
12359 dnl ===================================================================
12361 AC_MSG_CHECKING([formula logger])
12362 ENABLE_FORMULA_LOGGER=
12364 if test "x$enable_formula_logger" = "xyes"; then
12365     AC_MSG_RESULT([yes])
12366     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12367     ENABLE_FORMULA_LOGGER=TRUE
12368 elif test -n "$ENABLE_DBGUTIL" ; then
12369     AC_MSG_RESULT([yes])
12370     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12371     ENABLE_FORMULA_LOGGER=TRUE
12372 else
12373     AC_MSG_RESULT([no])
12376 AC_SUBST(ENABLE_FORMULA_LOGGER)
12378 dnl ===================================================================
12379 dnl Setting up the environment.
12380 dnl ===================================================================
12381 AC_MSG_NOTICE([setting up the build environment variables...])
12383 AC_SUBST(COMPATH)
12385 if test "$build_os" = "cygwin"; then
12386     if test -d "$COMPATH/atlmfc/lib"; then
12387         ATL_LIB="$COMPATH/atlmfc/lib"
12388         ATL_INCLUDE="$COMPATH/atlmfc/include"
12389     else
12390         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12391         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12392     fi
12393     if test "$BITNESS_OVERRIDE" = 64; then
12394         if test $VCVER = "150"; then
12395             ATL_LIB="$ATL_LIB/x64"
12396         else
12397             ATL_LIB="$ATL_LIB/amd64"
12398         fi
12399     else
12400         if test $VCVER = "150"; then
12401             ATL_LIB="$ATL_LIB/x86"
12402         fi
12403     fi
12404     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12405     PathFormat "/usr/bin/find.exe"
12406     FIND="$formatted_path"
12407     PathFormat "/usr/bin/sort.exe"
12408     SORT="$formatted_path"
12409     PathFormat "/usr/bin/grep.exe"
12410     WIN_GREP="$formatted_path"
12411     PathFormat "/usr/bin/ls.exe"
12412     WIN_LS="$formatted_path"
12413     PathFormat "/usr/bin/touch.exe"
12414     WIN_TOUCH="$formatted_path"
12415 else
12416     FIND=find
12417     SORT=sort
12420 AC_SUBST(ATL_INCLUDE)
12421 AC_SUBST(ATL_LIB)
12422 AC_SUBST(FIND)
12423 AC_SUBST(SORT)
12424 AC_SUBST(WIN_GREP)
12425 AC_SUBST(WIN_LS)
12426 AC_SUBST(WIN_TOUCH)
12428 AC_SUBST(BUILD_TYPE)
12430 AC_SUBST(SOLARINC)
12432 PathFormat "$PERL"
12433 PERL="$formatted_path"
12434 AC_SUBST(PERL)
12436 if test -n "$TMPDIR"; then
12437     TEMP_DIRECTORY="$TMPDIR"
12438 else
12439     TEMP_DIRECTORY="/tmp"
12441 if test "$build_os" = "cygwin"; then
12442     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12444 AC_SUBST(TEMP_DIRECTORY)
12446 # setup the PATH for the environment
12447 if test -n "$LO_PATH_FOR_BUILD"; then
12448     LO_PATH="$LO_PATH_FOR_BUILD"
12449 else
12450     LO_PATH="$PATH"
12452     case "$host_os" in
12454     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12455         if test "$ENABLE_JAVA" != ""; then
12456             pathmunge "$JAVA_HOME/bin" "after"
12457         fi
12458         ;;
12460     cygwin*)
12461         # Win32 make needs native paths
12462         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12463             LO_PATH=`cygpath -p -m "$PATH"`
12464         fi
12465         if test "$BITNESS_OVERRIDE" = 64; then
12466             # needed for msi packaging
12467             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12468         fi
12469         # .NET 4.6 and higher don't have bin directory
12470         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12471             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12472         fi
12473         pathmunge "$ASM_HOME" "before"
12474         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12475         pathmunge "$CSC_PATH" "before"
12476         pathmunge "$MIDL_PATH" "before"
12477         pathmunge "$AL_PATH" "before"
12478         pathmunge "$MSPDB_PATH" "before"
12479         if test -n "$MSBUILD_PATH" ; then
12480             pathmunge "$MSBUILD_PATH" "before"
12481         fi
12482         if test "$BITNESS_OVERRIDE" = 64; then
12483             pathmunge "$COMPATH/bin/amd64" "before"
12484             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12485         else
12486             pathmunge "$COMPATH/bin" "before"
12487             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12488         fi
12489         if test "$ENABLE_JAVA" != ""; then
12490             if test -d "$JAVA_HOME/jre/bin/client"; then
12491                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12492             fi
12493             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12494                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12495             fi
12496             pathmunge "$JAVA_HOME/bin" "before"
12497         fi
12498         ;;
12500     solaris*)
12501         pathmunge "/usr/css/bin" "before"
12502         if test "$ENABLE_JAVA" != ""; then
12503             pathmunge "$JAVA_HOME/bin" "after"
12504         fi
12505         ;;
12506     esac
12509 AC_SUBST(LO_PATH)
12511 libo_FUZZ_SUMMARY
12513 # Generate a configuration sha256 we can use for deps
12514 if test -f config_host.mk; then
12515     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12517 if test -f config_host_lang.mk; then
12518     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12521 CFLAGS=$my_original_CFLAGS
12522 CXXFLAGS=$my_original_CXXFLAGS
12523 CPPFLAGS=$my_original_CPPFLAGS
12525 AC_CONFIG_FILES([config_host.mk
12526                  config_host_lang.mk
12527                  Makefile
12528                  lo.xcent
12529                  bin/bffvalidator.sh
12530                  bin/odfvalidator.sh
12531                  bin/officeotron.sh
12532                  instsetoo_native/util/openoffice.lst
12533                  setup_native/source/packinfo/finals_instsetoo.txt
12534                  sysui/desktop/macosx/Info.plist])
12535 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12536 AC_CONFIG_HEADERS([config_host/config_clang.h])
12537 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12538 AC_CONFIG_HEADERS([config_host/config_eot.h])
12539 AC_CONFIG_HEADERS([config_host/config_extension_update.h])
12540 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12541 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12542 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12543 AC_CONFIG_HEADERS([config_host/config_features.h])
12544 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12545 AC_CONFIG_HEADERS([config_host/config_folders.h])
12546 AC_CONFIG_HEADERS([config_host/config_gio.h])
12547 AC_CONFIG_HEADERS([config_host/config_global.h])
12548 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12549 AC_CONFIG_HEADERS([config_host/config_java.h])
12550 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12551 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12552 AC_CONFIG_HEADERS([config_host/config_locales.h])
12553 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12554 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12555 AC_CONFIG_HEADERS([config_host/config_qt5.h])
12556 AC_CONFIG_HEADERS([config_host/config_oox.h])
12557 AC_CONFIG_HEADERS([config_host/config_options.h])
12558 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12559 AC_CONFIG_HEADERS([config_host/config_test.h])
12560 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12561 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12562 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12563 AC_CONFIG_HEADERS([config_host/config_version.h])
12564 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12565 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12566 AC_CONFIG_HEADERS([config_host/config_python.h])
12567 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12568 AC_OUTPUT
12570 if test "$CROSS_COMPILING" = TRUE; then
12571     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12574 # touch the config timestamp file
12575 if test ! -f config_host.mk.stamp; then
12576     echo > config_host.mk.stamp
12577 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12578     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12579 else
12580     echo > config_host.mk.stamp
12583 # touch the config lang timestamp file
12584 if test ! -f config_host_lang.mk.stamp; then
12585     echo > config_host_lang.mk.stamp
12586 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12587     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12588 else
12589     echo > config_host_lang.mk.stamp
12593 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12595 cat << _EOS
12596 ****************************************************************************
12597 WARNING:
12598 Your make version is known to be horribly slow, and hard to debug
12599 problems with. To get a reasonably functional make please do:
12601 to install a pre-compiled binary make for Win32
12603  mkdir -p /opt/lo/bin
12604  cd /opt/lo/bin
12605  wget https://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
12606  cp make-85047eb-msvc.exe make
12607  chmod +x make
12609 to install from source:
12610 place yourself in a working directory of you choice.
12612  git clone git://git.savannah.gnu.org/make.git
12614  [go to Start menu, click "All Programs", click "Visual Studio 2015", click "Visual Studio Tools", double-click "VS2015 x86 Native Tools Command Prompt" or "VS2015 x64 Native Tools Command Prompt"]
12615  set PATH=%PATH%;C:\Cygwin\bin
12616  [or Cygwin64, if that is what you have]
12617  cd path-to-make-repo-you-cloned-above
12618  build_w32.bat --without-guile
12620 should result in a WinRel/gnumake.exe.
12621 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12623 Then re-run autogen.sh
12625 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12626 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12628 _EOS
12631 cat << _EOF
12632 ****************************************************************************
12634 To build, run:
12635 $GNUMAKE
12637 To view some help, run:
12638 $GNUMAKE help
12640 _EOF
12642 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12643     cat << _EOF
12644 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12645 _EOF
12647     if test $_os = Darwin; then
12648         echo open instdir/$PRODUCTNAME.app
12649     else
12650         echo instdir/program/soffice
12651     fi
12652     cat << _EOF
12654 If you want to run the smoketest, run:
12655 $GNUMAKE check
12657 _EOF
12660 if test -f warn; then
12661     cat warn
12662     rm warn
12665 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: