Migrate user profile from Collabora GovOffice 5.x
[LibreOffice.git] / configure.ac
blob4209ed882167055ec73b0a233cde610e6e5102cc
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.3],[],[],[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_theme="tango"
648         with_ppds=no
649         if test "$enable_ios_simulator" = "yes"; then
650             host=x86_64-apple-darwin
651         fi
652     else
653         _os=Darwin
654         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
655         INSTROOTCONTENTSUFFIX=/Contents
656         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
657     fi
658     enable_systray=no
659     # See comment above the case "$host_os"
660     LINKFLAGSSHL="-dynamiclib -single_module"
662     # -fPIC is default
663     PICSWITCH=""
665     DLLPOST=".dylib"
667     # -undefined error is the default
668     LINKFLAGSNOUNDEFS=""
671 freebsd*)
672     test_gtk=yes
673     build_gstreamer_1_0=yes
674     build_gstreamer_0_10=yes
675     test_kde4=yes
676     test_qt5=yes
677     test_freetype=yes
678     AC_MSG_CHECKING([the FreeBSD operating system release])
679     if test -n "$with_os_version"; then
680         OSVERSION="$with_os_version"
681     else
682         OSVERSION=`/sbin/sysctl -n kern.osreldate`
683     fi
684     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
685     AC_MSG_CHECKING([which thread library to use])
686     if test "$OSVERSION" -lt "500016"; then
687         PTHREAD_CFLAGS="-D_THREAD_SAFE"
688         PTHREAD_LIBS="-pthread"
689     elif test "$OSVERSION" -lt "502102"; then
690         PTHREAD_CFLAGS="-D_THREAD_SAFE"
691         PTHREAD_LIBS="-lc_r"
692     else
693         PTHREAD_CFLAGS=""
694         PTHREAD_LIBS="-pthread"
695     fi
696     AC_MSG_RESULT([$PTHREAD_LIBS])
697     _os=FreeBSD
698     ;;
700 *netbsd*)
701     test_gtk=yes
702     build_gstreamer_1_0=yes
703     build_gstreamer_0_10=yes
704     test_kde4=yes
705     test_qt5=yes
706     test_freetype=yes
707     PTHREAD_LIBS="-pthread -lpthread"
708     _os=NetBSD
709     ;;
711 aix*)
712     test_randr=no
713     test_freetype=yes
714     PTHREAD_LIBS=-pthread
715     _os=AIX
716     ;;
718 openbsd*)
719     test_gtk=yes
720     test_freetype=yes
721     PTHREAD_CFLAGS="-D_THREAD_SAFE"
722     PTHREAD_LIBS="-pthread"
723     _os=OpenBSD
724     ;;
726 dragonfly*)
727     test_gtk=yes
728     build_gstreamer_1_0=yes
729     build_gstreamer_0_10=yes
730     test_kde4=yes
731     test_qt5=yes
732     test_freetype=yes
733     PTHREAD_LIBS="-pthread"
734     _os=DragonFly
735     ;;
737 linux-android*)
738     build_gstreamer_1_0=no
739     build_gstreamer_0_10=no
740     enable_lotuswordpro=no
741     enable_mpl_subset=yes
742     enable_coinmp=yes
743     enable_lpsolve=no
744     enable_report_builder=no
745     enable_odk=no
746     enable_postgresql_sdbc=no
747     enable_python=no
748     with_theme="tango"
749     test_cups=no
750     test_dbus=no
751     test_fontconfig=no
752     test_freetype=no
753     test_gtk=no
754     test_kde4=no
755     test_qt5=no
756     test_randr=no
757     test_xrender=no
758     _os=Android
760     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
761     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
762     ;;
765     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
766     ;;
767 esac
769 if test "$_os" = "Android" ; then
770     # Verify that the NDK and SDK options are proper
771     if test -z "$with_android_ndk"; then
772         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
773     elif test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
774         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
775     fi
777     if test -z "$ANDROID_SDK_HOME"; then
778         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
779     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
780         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
781     fi
783     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
784     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
785         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
786                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
787                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
788         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
789         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
790         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
791     fi
792     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
793         AC_MSG_WARN([android support repository not found - install with
794                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
795                      to allow the build to download the specified version of the android support libraries])
796         add_warning "android support repository not found - install with"
797         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
798         add_warning "to allow the build to download the specified version of the android support libraries"
799     fi
802 if test "$_os" = "AIX"; then
803     AC_PATH_PROG(GAWK, gawk)
804     if test -z "$GAWK"; then
805         AC_MSG_ERROR([gawk not found in \$PATH])
806     fi
809 AC_SUBST(SDKDIRNAME)
811 AC_SUBST(PTHREAD_CFLAGS)
812 AC_SUBST(PTHREAD_LIBS)
814 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
815 # By default use the ones specified by our build system,
816 # but explicit override is possible.
817 AC_MSG_CHECKING(for explicit AFLAGS)
818 if test -n "$AFLAGS"; then
819     AC_MSG_RESULT([$AFLAGS])
820     x_AFLAGS=
821 else
822     AC_MSG_RESULT(no)
823     x_AFLAGS=[\#]
825 AC_MSG_CHECKING(for explicit CFLAGS)
826 if test -n "$CFLAGS"; then
827     AC_MSG_RESULT([$CFLAGS])
828     x_CFLAGS=
829 else
830     AC_MSG_RESULT(no)
831     x_CFLAGS=[\#]
833 AC_MSG_CHECKING(for explicit CXXFLAGS)
834 if test -n "$CXXFLAGS"; then
835     AC_MSG_RESULT([$CXXFLAGS])
836     x_CXXFLAGS=
837 else
838     AC_MSG_RESULT(no)
839     x_CXXFLAGS=[\#]
841 AC_MSG_CHECKING(for explicit OBJCFLAGS)
842 if test -n "$OBJCFLAGS"; then
843     AC_MSG_RESULT([$OBJCFLAGS])
844     x_OBJCFLAGS=
845 else
846     AC_MSG_RESULT(no)
847     x_OBJCFLAGS=[\#]
849 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
850 if test -n "$OBJCXXFLAGS"; then
851     AC_MSG_RESULT([$OBJCXXFLAGS])
852     x_OBJCXXFLAGS=
853 else
854     AC_MSG_RESULT(no)
855     x_OBJCXXFLAGS=[\#]
857 AC_MSG_CHECKING(for explicit LDFLAGS)
858 if test -n "$LDFLAGS"; then
859     AC_MSG_RESULT([$LDFLAGS])
860     x_LDFLAGS=
861 else
862     AC_MSG_RESULT(no)
863     x_LDFLAGS=[\#]
865 AC_SUBST(AFLAGS)
866 AC_SUBST(CFLAGS)
867 AC_SUBST(CXXFLAGS)
868 AC_SUBST(OBJCFLAGS)
869 AC_SUBST(OBJCXXFLAGS)
870 AC_SUBST(LDFLAGS)
871 AC_SUBST(x_AFLAGS)
872 AC_SUBST(x_CFLAGS)
873 AC_SUBST(x_CXXFLAGS)
874 AC_SUBST(x_OBJCFLAGS)
875 AC_SUBST(x_OBJCXXFLAGS)
876 AC_SUBST(x_LDFLAGS)
878 dnl These are potentially set for MSVC, in the code checking for UCRT below:
879 my_original_CFLAGS=$CFLAGS
880 my_original_CXXFLAGS=$CXXFLAGS
881 my_original_CPPFLAGS=$CPPFLAGS
883 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
884 dnl Needs to precede the AC_SEARCH_LIBS call below, which apparently calls
885 dnl AC_PROG_CC internally.
886 if test "$_os" != "WINNT"; then
887     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
888     save_CFLAGS=$CFLAGS
889     AC_PROG_CC
890     CFLAGS=$save_CFLAGS
893 if test $_os != "WINNT"; then
894     save_LIBS="$LIBS"
895     AC_SEARCH_LIBS([dlsym], [dl],
896         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
897         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
898     LIBS="$save_LIBS"
900 AC_SUBST(DLOPEN_LIBS)
902 ###############################################################################
903 # Extensions switches --enable/--disable
904 ###############################################################################
905 # By default these should be enabled unless having extra dependencies.
906 # If there is extra dependency over configure options then the enable should
907 # be automagic based on whether the requiring feature is enabled or not.
908 # All this options change anything only with --enable-extension-integration.
910 # The name of this option and its help string makes it sound as if
911 # extensions are built anyway, just not integrated in the installer,
912 # if you use --disable-extension-integration. Is that really the
913 # case?
915 AC_ARG_ENABLE(ios-simulator,
916     AS_HELP_STRING([--enable-ios-simulator],
917         [build i386 or x86_64 for ios simulator])
920 libo_FUZZ_ARG_ENABLE(extension-integration,
921     AS_HELP_STRING([--disable-extension-integration],
922         [Disable integration of the built extensions in the installer of the
923          product. Use this switch to disable the integration.])
926 AC_ARG_ENABLE(avmedia,
927     AS_HELP_STRING([--disable-avmedia],
928         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
931 AC_ARG_ENABLE(database-connectivity,
932     AS_HELP_STRING([--disable-database-connectivity],
933         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
936 # This doesn't mean not building (or "integrating") extensions
937 # (although it probably should; i.e. it should imply
938 # --disable-extension-integration I guess), it means not supporting
939 # any extension mechanism at all
940 libo_FUZZ_ARG_ENABLE(extensions,
941     AS_HELP_STRING([--disable-extensions],
942         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
945 AC_ARG_ENABLE(scripting,
946     AS_HELP_STRING([--disable-scripting],
947         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
950 # This is mainly for Android and iOS, but could potentially be used in some
951 # special case otherwise, too, so factored out as a separate setting
953 AC_ARG_ENABLE(dynamic-loading,
954     AS_HELP_STRING([--disable-dynamic-loading],
955         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
958 libo_FUZZ_ARG_ENABLE(ext-mariadb-connector,
959     AS_HELP_STRING([--enable-ext-mariadb-connector],
960         [Enable the build of the MariaDB/MySQL Connector extension.])
963 libo_FUZZ_ARG_ENABLE(report-builder,
964     AS_HELP_STRING([--disable-report-builder],
965         [Disable the Report Builder.])
968 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
969     AS_HELP_STRING([--enable-ext-wiki-publisher],
970         [Enable the Wiki Publisher extension.])
973 libo_FUZZ_ARG_ENABLE(lpsolve,
974     AS_HELP_STRING([--disable-lpsolve],
975         [Disable compilation of the lp solve solver ])
977 libo_FUZZ_ARG_ENABLE(coinmp,
978     AS_HELP_STRING([--disable-coinmp],
979         [Disable compilation of the CoinMP solver ])
982 libo_FUZZ_ARG_ENABLE(pdfimport,
983     AS_HELP_STRING([--disable-pdfimport],
984         [Disable building the PDF import feature.])
987 libo_FUZZ_ARG_ENABLE(pdfium,
988     AS_HELP_STRING([--disable-pdfium],
989         [Disable building PDFium.])
992 ###############################################################################
994 dnl ---------- *** ----------
996 libo_FUZZ_ARG_ENABLE(mergelibs,
997     AS_HELP_STRING([--enable-mergelibs],
998         [Merge several of the smaller libraries into one big, "merged", one.])
1001 libo_FUZZ_ARG_ENABLE(breakpad,
1002     AS_HELP_STRING([--enable-breakpad],
1003         [Enables breakpad for crash reporting.])
1006 AC_ARG_ENABLE(fetch-external,
1007     AS_HELP_STRING([--disable-fetch-external],
1008         [Disables fetching external tarballs from web sources.])
1011 AC_ARG_ENABLE(fuzzers,
1012     AS_HELP_STRING([--enable-fuzzers],
1013         [Enables building libfuzzer targets for fuzz testing.])
1016 libo_FUZZ_ARG_ENABLE(pch,
1017     AS_HELP_STRING([--enable-pch],
1018         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1021 libo_FUZZ_ARG_ENABLE(epm,
1022     AS_HELP_STRING([--enable-epm],
1023         [LibreOffice includes self-packaging code, that requires epm, however epm is
1024          useless for large scale package building.])
1027 libo_FUZZ_ARG_ENABLE(odk,
1028     AS_HELP_STRING([--disable-odk],
1029         [LibreOffice includes an ODK, office development kit which some packagers may
1030          wish to build without.])
1033 AC_ARG_ENABLE(mpl-subset,
1034     AS_HELP_STRING([--enable-mpl-subset],
1035         [Don't compile any pieces which are not MPL or more liberally licensed])
1038 libo_FUZZ_ARG_ENABLE(evolution2,
1039     AS_HELP_STRING([--enable-evolution2],
1040         [Allows the built-in evolution 2 addressbook connectivity build to be
1041          enabled.])
1044 AC_ARG_ENABLE(avahi,
1045     AS_HELP_STRING([--enable-avahi],
1046         [Determines whether to use Avahi to advertise Impress to remote controls.])
1049 libo_FUZZ_ARG_ENABLE(werror,
1050     AS_HELP_STRING([--enable-werror],
1051         [Turn warnings to errors. (Has no effect in modules where the treating
1052          of warnings as errors is disabled explicitly.)]),
1055 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1056     AS_HELP_STRING([--enable-assert-always-abort],
1057         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1060 libo_FUZZ_ARG_ENABLE(dbgutil,
1061     AS_HELP_STRING([--enable-dbgutil],
1062         [Provide debugging support from --enable-debug and include additional debugging
1063          utilities such as object counting or more expensive checks.
1064          This is the recommended option for developers.
1065          Note that this makes the build ABI incompatible, it is not possible to mix object
1066          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1068 libo_FUZZ_ARG_ENABLE(debug,
1069     AS_HELP_STRING([--enable-debug],
1070         [Include debugging information, disable compiler optimization and inlining plus
1071          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1073 libo_FUZZ_ARG_ENABLE(sal-log,
1074     AS_HELP_STRING([--enable-sal-log],
1075         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1077 AC_ARG_ENABLE(selective-debuginfo,
1078     AS_HELP_STRING([--enable-selective-debuginfo],
1079         [If --enable-debug or --enable-dbgutil is used, build debugging information
1080          (-g compiler flag) only for the specified gbuild build targets
1081          (where all means everything, - prepended means not to enable, / appended means
1082          everything in the directory; there is no ordering, more specific overrides
1083          more general, and disabling takes precedence).
1084          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1086 libo_FUZZ_ARG_ENABLE(symbols,
1087     AS_HELP_STRING([--enable-symbols],
1088         [Generate debug information.
1089          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1090          otherwise.]))
1092 libo_FUZZ_ARG_ENABLE(optimized,
1093     AS_HELP_STRING([--disable-optimized],
1094         [Whether to compile with optimization flags.
1095          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1096          otherwise.]))
1098 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1099     AS_HELP_STRING([--disable-runtime-optimizations],
1100         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1101          JVM JIT) that are known to interact badly with certain dynamic analysis
1102          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1103          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1104          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1106 AC_ARG_WITH(valgrind,
1107     AS_HELP_STRING([--with-valgrind],
1108         [Make availability of Valgrind headers a hard requirement.]))
1110 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1111     AS_HELP_STRING([--enable-compiler-plugins],
1112         [Enable compiler plugins that will perform additional checks during
1113          building. Enabled automatically by --enable-dbgutil.]))
1115 libo_FUZZ_ARG_ENABLE(ooenv,
1116     AS_HELP_STRING([--disable-ooenv],
1117         [Disable ooenv for the instdir installation.]))
1119 AC_ARG_ENABLE(lto,
1120     AS_HELP_STRING([--enable-lto],
1121         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1122          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1123          linker. For MSVC, this option is broken at the moment. This is experimental work
1124          in progress that shouldn't be used unless you are working on it.)]))
1126 AC_ARG_ENABLE(python,
1127     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1128         [Enables or disables Python support at run-time and build-time.
1129          Also specifies what Python to use. 'auto' is the default.
1130          'fully-internal' even forces the internal version for uses of Python
1131          during the build.]))
1133 libo_FUZZ_ARG_ENABLE(gtk,
1134     AS_HELP_STRING([--disable-gtk],
1135         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1136 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1138 libo_FUZZ_ARG_ENABLE(gtk3,
1139     AS_HELP_STRING([--disable-gtk3],
1140         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.
1141          This is experimental and may not work.]),
1142 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1144 libo_FUZZ_ARG_ENABLE(systray,
1145     AS_HELP_STRING([--disable-systray],
1146         [Determines whether to build the systray quickstarter.]),
1147 ,test "${enable_systray+set}" = set || enable_systray=yes)
1149 AC_ARG_ENABLE(split-app-modules,
1150     AS_HELP_STRING([--enable-split-app-modules],
1151         [Split file lists for app modules, e.g. base, calc.
1152          Has effect only with make distro-pack-install]),
1155 AC_ARG_ENABLE(split-opt-features,
1156     AS_HELP_STRING([--enable-split-opt-features],
1157         [Split file lists for some optional features, e.g. pyuno, testtool.
1158          Has effect only with make distro-pack-install]),
1161 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1162     AS_HELP_STRING([--disable-cairo-canvas],
1163         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1166 libo_FUZZ_ARG_ENABLE(dbus,
1167     AS_HELP_STRING([--disable-dbus],
1168         [Determines whether to enable features that depend on dbus.
1169          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1170 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1172 libo_FUZZ_ARG_ENABLE(sdremote,
1173     AS_HELP_STRING([--disable-sdremote],
1174         [Determines whether to enable Impress remote control (i.e. the server component).]),
1175 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1177 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1178     AS_HELP_STRING([--disable-sdremote-bluetooth],
1179         [Determines whether to build sdremote with bluetooth support.
1180          Requires dbus on Linux.]))
1182 libo_FUZZ_ARG_ENABLE(gio,
1183     AS_HELP_STRING([--disable-gio],
1184         [Determines whether to use the GIO support.]),
1185 ,test "${enable_gio+set}" = set || enable_gio=yes)
1187 AC_ARG_ENABLE(kde4,
1188     AS_HELP_STRING([--enable-kde4],
1189         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1190          KDE4 are available.]),
1193 AC_ARG_ENABLE(qt5,
1194     AS_HELP_STRING([--enable-qt5],
1195         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1196          available.]),
1199 libo_FUZZ_ARG_ENABLE(gui,
1200     AS_HELP_STRING([--disable-gui],
1201         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1202          command-line option. Not related to LibreOffice Online functionality. Don't use
1203          unless you are certain you need to. Nobody will help you if you insist on trying
1204          this and run into problems.]),
1205 ,test "${enable_gui+set}" = set || enable_gui=yes)
1207 libo_FUZZ_ARG_ENABLE(randr,
1208     AS_HELP_STRING([--disable-randr],
1209         [Disable RandR support in the vcl project.]),
1210 ,test "${enable_randr+set}" = set || enable_randr=yes)
1212 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1213     AS_HELP_STRING([--disable-gstreamer-1-0],
1214         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1215 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1217 AC_ARG_ENABLE(gstreamer-0-10,
1218     AS_HELP_STRING([--enable-gstreamer-0-10],
1219         [Enable building with the gstreamer 0.10 avmedia backend.]),
1220 ,enable_gstreamer_0_10=no)
1222 libo_FUZZ_ARG_ENABLE(vlc,
1223     AS_HELP_STRING([--enable-vlc],
1224         [Enable building with the (experimental) VLC avmedia backend.]),
1225 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1227 libo_FUZZ_ARG_ENABLE(neon,
1228     AS_HELP_STRING([--disable-neon],
1229         [Disable neon and the compilation of webdav binding.]),
1232 libo_FUZZ_ARG_ENABLE([eot],
1233     [AS_HELP_STRING([--enable-eot],
1234         [Enable support for Embedded OpenType fonts.])],
1235 ,test "${enable_eot+set}" = set || enable_eot=no)
1237 libo_FUZZ_ARG_ENABLE(cve-tests,
1238     AS_HELP_STRING([--disable-cve-tests],
1239         [Prevent CVE tests to be executed]),
1242 libo_FUZZ_ARG_ENABLE(chart-tests,
1243     AS_HELP_STRING([--enable-chart-tests],
1244         [Executes chart XShape tests. In a perfect world these tests would be
1245          stable and everyone could run them, in reality it is best to run them
1246          only on a few machines that are known to work and maintained by people
1247          who can judge if a test failure is a regression or not.]),
1250 AC_ARG_ENABLE(build-unowinreg,
1251     AS_HELP_STRING([--enable-build-unowinreg],
1252         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1253          compiler is needed on Linux.]),
1256 AC_ARG_ENABLE(dependency-tracking,
1257     AS_HELP_STRING([--enable-dependency-tracking],
1258         [Do not reject slow dependency extractors.])[
1259   --disable-dependency-tracking
1260                           Disables generation of dependency information.
1261                           Speed up one-time builds.],
1264 AC_ARG_ENABLE(icecream,
1265     AS_HELP_STRING([--enable-icecream],
1266         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1267          It defaults to /opt/icecream for the location of the icecream gcc/g++
1268          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1271 libo_FUZZ_ARG_ENABLE(cups,
1272     AS_HELP_STRING([--disable-cups],
1273         [Do not build cups support.])
1276 AC_ARG_ENABLE(ccache,
1277     AS_HELP_STRING([--disable-ccache],
1278         [Do not try to use ccache automatically.
1279          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1280          CC/CXX are not yet set, and --enable-icecream is not given, we
1281          attempt to use ccache. --disable-ccache disables ccache completely.
1285 AC_ARG_ENABLE(64-bit,
1286     AS_HELP_STRING([--enable-64-bit],
1287         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1288          At the moment meaningful only for Windows.]), ,)
1290 libo_FUZZ_ARG_ENABLE(online-update,
1291     AS_HELP_STRING([--enable-online-update],
1292         [Enable the online update service that will check for new versions of
1293          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1294          If the value is "mar", the experimental Mozilla-like update will be
1295          enabled instead of the traditional update mechanism.]),
1298 AC_ARG_WITH(update-config,
1299     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1300                    [Path to the update config ini file]))
1302 libo_FUZZ_ARG_ENABLE(extension-update,
1303     AS_HELP_STRING([--disable-extension-update],
1304         [Disable possibility to update installed extensions.]),
1307 libo_FUZZ_ARG_ENABLE(release-build,
1308     AS_HELP_STRING([--enable-release-build],
1309         [Enable release build. Note that the "release build" choice is orthogonal to
1310          whether symbols are present, debug info is generated, or optimization
1311          is done.
1312          See http://wiki.documentfoundation.org/Development/DevBuild]),
1315 AC_ARG_ENABLE(windows-build-signing,
1316     AS_HELP_STRING([--enable-windows-build-signing],
1317         [Enable signing of windows binaries (*.exe, *.dll)]),
1320 AC_ARG_ENABLE(silent-msi,
1321     AS_HELP_STRING([--enable-silent-msi],
1322         [Enable MSI with LIMITUI=1 (silent install).]),
1325 AC_ARG_ENABLE(macosx-code-signing,
1326     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1327         [Sign executables, dylibs, frameworks and the app bundle. If you
1328          don't provide an identity the first suitable certificate
1329          in your keychain is used.]),
1332 AC_ARG_ENABLE(macosx-package-signing,
1333     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1334         [Create a .pkg suitable for uploading to the Mac App Store and sign
1335          it. If you don't provide an identity the first suitable certificate
1336          in your keychain is used.]),
1339 AC_ARG_ENABLE(macosx-sandbox,
1340     AS_HELP_STRING([--enable-macosx-sandbox],
1341         [Make the app bundle run in a sandbox. Requires code signing.
1342          Is required by apps distributed in the Mac App Store, and implies
1343          adherence to App Store rules.]),
1346 AC_ARG_WITH(macosx-bundle-identifier,
1347     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1348         [Define the OS X bundle identifier. Default is the somewhat weird
1349          org.libreoffice.script ("script", huh?).]),
1350 ,with_macosx_bundle_identifier=org.libreoffice.script)
1352 AC_ARG_WITH(product-name,
1353     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1354         [Define the product name. Default is AC_PACKAGE_NAME.]),
1355 ,with_product_name=$PRODUCTNAME)
1357 AC_ARG_WITH(package-version,
1358     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1359         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1362 libo_FUZZ_ARG_ENABLE(readonly-installset,
1363     AS_HELP_STRING([--enable-readonly-installset],
1364         [Prevents any attempts by LibreOffice to write into its installation. That means
1365          at least that no "system-wide" extensions can be added. Experimental work in
1366          progress.]),
1369 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1370     AS_HELP_STRING([--disable-postgresql-sdbc],
1371         [Disable the build of the PostgreSQL-SDBC driver.])
1374 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1375     AS_HELP_STRING([--disable-lotuswordpro],
1376         [Disable the build of the Lotus Word Pro filter.]),
1377 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1379 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1380     AS_HELP_STRING([--disable-firebird-sdbc],
1381         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1382 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1384 AC_ARG_ENABLE(bogus-pkg-config,
1385     AS_HELP_STRING([--enable-bogus-pkg-config],
1386         [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.]),
1389 AC_ARG_ENABLE(openssl,
1390     AS_HELP_STRING([--disable-openssl],
1391         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1392          components will either use GNUTLS or NSS. Work in progress,
1393          use only if you are hacking on it.]),
1394 ,enable_openssl=yes)
1396 AC_ARG_ENABLE(library-bin-tar,
1397     AS_HELP_STRING([--enable-library-bin-tar],
1398         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1399         Some libraries can save their build result in a tarball
1400         stored in TARFILE_LOCATION. That binary tarball is
1401         uniquely identified by the source tarball,
1402         the content of the config_host.mk file and the content
1403         of the top-level directory in core for that library
1404         If this option is enabled, then if such a tarfile exist, it will be untarred
1405         instead of the source tarfile, and the build step will be skipped for that
1406         library.
1407         If a proper tarfile does not exist, then the normal source-based
1408         build is done for that library and a proper binary tarfile is created
1409         for the next time.]),
1412 AC_ARG_ENABLE(dconf,
1413     AS_HELP_STRING([--disable-dconf],
1414         [Disable the dconf configuration backend (enabled by default where
1415          available).]))
1417 libo_FUZZ_ARG_ENABLE(formula-logger,
1418     AS_HELP_STRING(
1419         [--enable-formula-logger],
1420         [Enable formula logger for logging formula calculation flow in Calc.]
1421     )
1424 dnl ===================================================================
1425 dnl Optional Packages (--with/without-)
1426 dnl ===================================================================
1428 AC_ARG_WITH(gcc-home,
1429     AS_HELP_STRING([--with-gcc-home],
1430         [Specify the location of gcc/g++ manually. This can be used in conjunction
1431          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1432          non-default path.]),
1435 AC_ARG_WITH(gnu-patch,
1436     AS_HELP_STRING([--with-gnu-patch],
1437         [Specify location of GNU patch on Solaris or FreeBSD.]),
1440 AC_ARG_WITH(build-platform-configure-options,
1441     AS_HELP_STRING([--with-build-platform-configure-options],
1442         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1445 AC_ARG_WITH(gnu-cp,
1446     AS_HELP_STRING([--with-gnu-cp],
1447         [Specify location of GNU cp on Solaris or FreeBSD.]),
1450 AC_ARG_WITH(external-tar,
1451     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1452         [Specify an absolute path of where to find (and store) tarfiles.]),
1453     TARFILE_LOCATION=$withval ,
1456 AC_ARG_WITH(referenced-git,
1457     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1458         [Specify another checkout directory to reference. This makes use of
1459                  git submodule update --reference, and saves a lot of diskspace
1460                  when having multiple trees side-by-side.]),
1461     GIT_REFERENCE_SRC=$withval ,
1464 AC_ARG_WITH(linked-git,
1465     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1466         [Specify a directory where the repositories of submodules are located.
1467          This uses a method similar to git-new-workdir to get submodules.]),
1468     GIT_LINK_SRC=$withval ,
1471 AC_ARG_WITH(galleries,
1472     AS_HELP_STRING([--with-galleries],
1473         [Specify how galleries should be built. It is possible either to
1474          build these internally from source ("build"),
1475          or to disable them ("no")]),
1478 AC_ARG_WITH(theme,
1479     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1480         [Choose which themes to include. By default those themes with an '*' are included.
1481          Possible choices: *breeze, *breeze_dark, crystal, *elementary, *galaxy, *hicontrast, oxygen, *sifr, *sifr_dark, *tango, tango_testing.]),
1484 libo_FUZZ_ARG_WITH(helppack-integration,
1485     AS_HELP_STRING([--without-helppack-integration],
1486         [It will not integrate the helppacks to the installer
1487          of the product. Please use this switch to use the online help
1488          or separate help packages.]),
1491 libo_FUZZ_ARG_WITH(fonts,
1492     AS_HELP_STRING([--without-fonts],
1493         [LibreOffice includes some third-party fonts to provide a reliable basis for
1494          help content, templates, samples, etc. When these fonts are already
1495          known to be available on the system then you should use this option.]),
1498 AC_ARG_ENABLE(noto-font,
1499     AS_HELP_STRING([--enable-noto-font],
1500         [Add more Google Noto fonts.]),
1503 AC_ARG_WITH(epm,
1504     AS_HELP_STRING([--with-epm],
1505         [Decides which epm to use. Default is to use the one from the system if
1506          one is built. When either this is not there or you say =internal epm
1507          will be built.]),
1510 AC_ARG_WITH(package-format,
1511     AS_HELP_STRING([--with-package-format],
1512         [Specify package format(s) for LibreOffice installation sets. The
1513          implicit --without-package-format leads to no installation sets being
1514          generated. Possible values: aix, archive, bsd, deb, dmg,
1515          installed, msi, pkg, and rpm.
1516          Example: --with-package-format='deb rpm']),
1519 AC_ARG_WITH(tls,
1520     AS_HELP_STRING([--with-tls],
1521         [Decides which TLS/SSL and cryptographic implementations to use for
1522          LibreOffice's code. Notice that this doesn't apply for depending
1523          libraries like "neon", for example. Default is to use OpenSSL
1524          although NSS is also possible. Notice that selecting NSS restricts
1525          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1526          restrict by now the usage of NSS in LO's code. Possible values:
1527          openssl, nss. Example: --with-tls="nss"]),
1530 AC_ARG_WITH(system-libs,
1531     AS_HELP_STRING([--with-system-libs],
1532         [Use libraries already on system -- enables all --with-system-* flags.]),
1535 AC_ARG_WITH(system-bzip2,
1536     AS_HELP_STRING([--with-system-bzip2],
1537         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1538     [with_system_bzip2="$with_system_libs"])
1540 AC_ARG_WITH(system-headers,
1541     AS_HELP_STRING([--with-system-headers],
1542         [Use headers already on system -- enables all --with-system-* flags for
1543          external packages whose headers are the only entities used i.e.
1544          boost/odbc/sane-header(s).]),,
1545     [with_system_headers="$with_system_libs"])
1547 AC_ARG_WITH(system-jars,
1548     AS_HELP_STRING([--without-system-jars],
1549         [When building with --with-system-libs, also the needed jars are expected
1550          on the system. Use this to disable that]),,
1551     [with_system_jars="$with_system_libs"])
1553 AC_ARG_WITH(system-cairo,
1554     AS_HELP_STRING([--with-system-cairo],
1555         [Use cairo libraries already on system.  Happens automatically for
1556          (implicit) --enable-gtk and for --enable-gtk3.]))
1558 AC_ARG_WITH(system-epoxy,
1559     AS_HELP_STRING([--with-system-epoxy],
1560         [Use epoxy libraries already on system.  Happens automatically for
1561          --enable-gtk3.]),,
1562        [with_system_epoxy="$with_system_libs"])
1564 AC_ARG_WITH(myspell-dicts,
1565     AS_HELP_STRING([--with-myspell-dicts],
1566         [Adds myspell dictionaries to the LibreOffice installation set]),
1569 AC_ARG_WITH(system-dicts,
1570     AS_HELP_STRING([--without-system-dicts],
1571         [Do not use dictionaries from system paths.]),
1574 AC_ARG_WITH(external-dict-dir,
1575     AS_HELP_STRING([--with-external-dict-dir],
1576         [Specify external dictionary dir.]),
1579 AC_ARG_WITH(external-hyph-dir,
1580     AS_HELP_STRING([--with-external-hyph-dir],
1581         [Specify external hyphenation pattern dir.]),
1584 AC_ARG_WITH(external-thes-dir,
1585     AS_HELP_STRING([--with-external-thes-dir],
1586         [Specify external thesaurus dir.]),
1589 AC_ARG_WITH(system-zlib,
1590     AS_HELP_STRING([--with-system-zlib],
1591         [Use zlib already on system.]),,
1592     [with_system_zlib=auto])
1594 AC_ARG_WITH(system-jpeg,
1595     AS_HELP_STRING([--with-system-jpeg],
1596         [Use jpeg already on system.]),,
1597     [with_system_jpeg="$with_system_libs"])
1599 AC_ARG_WITH(system-clucene,
1600     AS_HELP_STRING([--with-system-clucene],
1601         [Use clucene already on system.]),,
1602     [with_system_clucene="$with_system_libs"])
1604 AC_ARG_WITH(system-expat,
1605     AS_HELP_STRING([--with-system-expat],
1606         [Use expat already on system.]),,
1607     [with_system_expat="$with_system_libs"])
1609 AC_ARG_WITH(system-libxml,
1610     AS_HELP_STRING([--with-system-libxml],
1611         [Use libxml/libxslt already on system.]),,
1612     [with_system_libxml=auto])
1614 AC_ARG_WITH(system-icu,
1615     AS_HELP_STRING([--with-system-icu],
1616         [Use icu already on system.]),,
1617     [with_system_icu="$with_system_libs"])
1619 AC_ARG_WITH(system-ucpp,
1620     AS_HELP_STRING([--with-system-ucpp],
1621         [Use ucpp already on system.]),,
1622     [])
1624 AC_ARG_WITH(system-openldap,
1625     AS_HELP_STRING([--with-system-openldap],
1626         [Use the OpenLDAP LDAP SDK already on system.]),,
1627     [with_system_openldap="$with_system_libs"])
1629 AC_ARG_WITH(system-poppler,
1630     AS_HELP_STRING([--with-system-poppler],
1631         [Use system poppler (only needed for PDF import).]),,
1632     [with_system_poppler="$with_system_libs"])
1634 AC_ARG_WITH(system-gpgmepp,
1635     AS_HELP_STRING([--with-system-gpgmepp],
1636         [Use gpgmepp already on system]),,
1637     [with_system_gpgmepp="$with_system_libs"])
1639 AC_ARG_WITH(system-apache-commons,
1640     AS_HELP_STRING([--with-system-apache-commons],
1641         [Use Apache commons libraries already on system.]),,
1642     [with_system_apache_commons="$with_system_jars"])
1644 AC_ARG_WITH(system-mariadb,
1645     AS_HELP_STRING([--with-system-mariadb],
1646         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1647          extension.]),,
1648     [with_system_mariadb="$with_system_libs"])
1650 AC_ARG_ENABLE(bundle-mariadb,
1651     AS_HELP_STRING([--enable-bundle-mariadb],
1652         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1655 AC_ARG_WITH(system-mysql-cppconn,
1656     AS_HELP_STRING([--with-system-mysql-cppconn],
1657         [Use MySQL C++ Connector libraries already on system.]),,
1658     [with_system_mysql_cppconn="$with_system_libs"])
1660 AC_ARG_WITH(system-postgresql,
1661     AS_HELP_STRING([--with-system-postgresql],
1662         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1663          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1664     [with_system_postgresql="$with_system_libs"])
1666 AC_ARG_WITH(libpq-path,
1667     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1668         [Use this PostgreSQL C interface (libpq) installation for building
1669          the PostgreSQL-SDBC extension.]),
1672 AC_ARG_WITH(system-firebird,
1673     AS_HELP_STRING([--with-system-firebird],
1674         [Use Firebird libraries already on system, for building the Firebird-SDBC
1675          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1676     [with_system_firebird="$with_system_libs"])
1678 AC_ARG_WITH(system-libtommath,
1679             AS_HELP_STRING([--with-system-libtommath],
1680                            [Use libtommath already on system]),,
1681             [with_system_libtommath="$with_system_libs"])
1683 AC_ARG_WITH(system-hsqldb,
1684     AS_HELP_STRING([--with-system-hsqldb],
1685         [Use hsqldb already on system.]))
1687 AC_ARG_WITH(hsqldb-jar,
1688     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1689         [Specify path to jarfile manually.]),
1690     HSQLDB_JAR=$withval)
1692 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1693     AS_HELP_STRING([--disable-scripting-beanshell],
1694         [Disable support for scripts in BeanShell.]),
1698 AC_ARG_WITH(system-beanshell,
1699     AS_HELP_STRING([--with-system-beanshell],
1700         [Use beanshell already on system.]),,
1701     [with_system_beanshell="$with_system_jars"])
1703 AC_ARG_WITH(beanshell-jar,
1704     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1705         [Specify path to jarfile manually.]),
1706     BSH_JAR=$withval)
1708 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1709     AS_HELP_STRING([--disable-scripting-javascript],
1710         [Disable support for scripts in JavaScript.]),
1714 AC_ARG_WITH(system-rhino,
1715     AS_HELP_STRING([--with-system-rhino],
1716         [Use rhino already on system.]),,)
1717 #    [with_system_rhino="$with_system_jars"])
1718 # Above is not used as we have different debug interface
1719 # patched into internal rhino. This code needs to be fixed
1720 # before we can enable it by default.
1722 AC_ARG_WITH(rhino-jar,
1723     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1724         [Specify path to jarfile manually.]),
1725     RHINO_JAR=$withval)
1727 AC_ARG_WITH(commons-logging-jar,
1728     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1729         [Specify path to jarfile manually.]),
1730     COMMONS_LOGGING_JAR=$withval)
1732 AC_ARG_WITH(system-jfreereport,
1733     AS_HELP_STRING([--with-system-jfreereport],
1734         [Use JFreeReport already on system.]),,
1735     [with_system_jfreereport="$with_system_jars"])
1737 AC_ARG_WITH(sac-jar,
1738     AS_HELP_STRING([--with-sac-jar=JARFILE],
1739         [Specify path to jarfile manually.]),
1740     SAC_JAR=$withval)
1742 AC_ARG_WITH(libxml-jar,
1743     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1744         [Specify path to jarfile manually.]),
1745     LIBXML_JAR=$withval)
1747 AC_ARG_WITH(flute-jar,
1748     AS_HELP_STRING([--with-flute-jar=JARFILE],
1749         [Specify path to jarfile manually.]),
1750     FLUTE_JAR=$withval)
1752 AC_ARG_WITH(jfreereport-jar,
1753     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1754         [Specify path to jarfile manually.]),
1755     JFREEREPORT_JAR=$withval)
1757 AC_ARG_WITH(liblayout-jar,
1758     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1759         [Specify path to jarfile manually.]),
1760     LIBLAYOUT_JAR=$withval)
1762 AC_ARG_WITH(libloader-jar,
1763     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1764         [Specify path to jarfile manually.]),
1765     LIBLOADER_JAR=$withval)
1767 AC_ARG_WITH(libformula-jar,
1768     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1769         [Specify path to jarfile manually.]),
1770     LIBFORMULA_JAR=$withval)
1772 AC_ARG_WITH(librepository-jar,
1773     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1774         [Specify path to jarfile manually.]),
1775     LIBREPOSITORY_JAR=$withval)
1777 AC_ARG_WITH(libfonts-jar,
1778     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1779         [Specify path to jarfile manually.]),
1780     LIBFONTS_JAR=$withval)
1782 AC_ARG_WITH(libserializer-jar,
1783     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1784         [Specify path to jarfile manually.]),
1785     LIBSERIALIZER_JAR=$withval)
1787 AC_ARG_WITH(libbase-jar,
1788     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1789         [Specify path to jarfile manually.]),
1790     LIBBASE_JAR=$withval)
1792 AC_ARG_WITH(system-odbc,
1793     AS_HELP_STRING([--with-system-odbc],
1794         [Use the odbc headers already on system.]),,
1795     [with_system_odbc="auto"])
1797 AC_ARG_WITH(system-sane,
1798     AS_HELP_STRING([--with-system-sane],
1799         [Use sane.h already on system.]),,
1800     [with_system_sane="$with_system_headers"])
1802 AC_ARG_WITH(system-bluez,
1803     AS_HELP_STRING([--with-system-bluez],
1804         [Use bluetooth.h already on system.]),,
1805     [with_system_bluez="$with_system_headers"])
1807 AC_ARG_WITH(system-curl,
1808     AS_HELP_STRING([--with-system-curl],
1809         [Use curl already on system.]),,
1810     [with_system_curl=auto])
1812 AC_ARG_WITH(system-boost,
1813     AS_HELP_STRING([--with-system-boost],
1814         [Use boost already on system.]),,
1815     [with_system_boost="$with_system_headers"])
1817 AC_ARG_WITH(system-glm,
1818     AS_HELP_STRING([--with-system-glm],
1819         [Use glm already on system.]),,
1820     [with_system_glm="$with_system_headers"])
1822 AC_ARG_WITH(system-hunspell,
1823     AS_HELP_STRING([--with-system-hunspell],
1824         [Use libhunspell already on system.]),,
1825     [with_system_hunspell="$with_system_libs"])
1827 AC_ARG_WITH(system-mythes,
1828     AS_HELP_STRING([--with-system-mythes],
1829         [Use mythes already on system.]),,
1830     [with_system_mythes="$with_system_libs"])
1832 AC_ARG_WITH(system-altlinuxhyph,
1833     AS_HELP_STRING([--with-system-altlinuxhyph],
1834         [Use ALTLinuxhyph already on system.]),,
1835     [with_system_altlinuxhyph="$with_system_libs"])
1837 AC_ARG_WITH(system-lpsolve,
1838     AS_HELP_STRING([--with-system-lpsolve],
1839         [Use lpsolve already on system.]),,
1840     [with_system_lpsolve="$with_system_libs"])
1842 AC_ARG_WITH(system-coinmp,
1843     AS_HELP_STRING([--with-system-coinmp],
1844         [Use CoinMP already on system.]),,
1845     [with_system_coinmp="$with_system_libs"])
1847 AC_ARG_WITH(system-liblangtag,
1848     AS_HELP_STRING([--with-system-liblangtag],
1849         [Use liblangtag library already on system.]),,
1850     [with_system_liblangtag="$with_system_libs"])
1852 AC_ARG_WITH(webdav,
1853     AS_HELP_STRING([--with-webdav],
1854         [Specify which library to use for webdav implementation.
1855          Possible values: "neon", "serf", "no". The default value is "neon".
1856          Example: --with-webdav="serf"]),
1857     WITH_WEBDAV=$withval,
1858     WITH_WEBDAV="neon")
1860 AC_ARG_WITH(linker-hash-style,
1861     AS_HELP_STRING([--with-linker-hash-style],
1862         [Use linker with --hash-style=<style> when linking shared objects.
1863          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1864          if supported on the build system, and "sysv" otherwise.]))
1866 AC_ARG_WITH(jdk-home,
1867     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1868         [If you have installed JDK 1.6 or later on your system please supply the
1869          path here. Note that this is not the location of the java command but the
1870          location of the entire distribution.]),
1873 AC_ARG_WITH(help,
1874     AS_HELP_STRING([--with-help],
1875         [Enable the build of help. There is a special parameter "common" that
1876          can be used to bundle only the common part, .e.g help-specific icons.
1877          This is useful when you build the helpcontent separately.])
1878     [
1879                           Usage:     --with-help    build the entire local help
1880                                  --without-help     no local help (default)
1881                                  --with-help=common bundle common files for the local
1882                                                     help but do not build the whole help
1883     ],
1886 libo_FUZZ_ARG_WITH(java,
1887     AS_HELP_STRING([--with-java=<java command>],
1888         [Specify the name of the Java interpreter command. Typically "java"
1889          which is the default.
1891          To build without support for Java components, applets, accessibility
1892          or the XML filters written in Java, use --without-java or --with-java=no.]),
1893     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1894     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
1897 AC_ARG_WITH(jvm-path,
1898     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
1899         [Use a specific JVM search path at runtime.
1900          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
1903 AC_ARG_WITH(ant-home,
1904     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
1905         [If you have installed Jakarta Ant on your system, please supply the path here.
1906          Note that this is not the location of the Ant binary but the location
1907          of the entire distribution.]),
1910 AC_ARG_WITH(symbol-config,
1911     AS_HELP_STRING([--with-symbol-config],
1912         [Configuration for the crashreport symbol upload]),
1913         [],
1914         [with_symbol_config=no])
1916 AC_ARG_WITH(export-validation,
1917     AS_HELP_STRING([--without-export-validation],
1918         [Disable validating OOXML and ODF files as exported from in-tree tests.
1919          Use this option e.g. if your system only provides Java 5.]),
1920 ,with_export_validation=auto)
1922 AC_ARG_WITH(bffvalidator,
1923     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
1924         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
1925          Requires installed Microsoft Office Binary File Format Validator.
1926          Note: export-validation (--with-export-validation) is required to be turned on.
1927          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
1928 ,with_bffvalidator=no)
1930 libo_FUZZ_ARG_WITH(junit,
1931     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
1932         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
1933          --without-junit disables those tests. Not relevant in the --without-java case.]),
1934 ,with_junit=yes)
1936 AC_ARG_WITH(hamcrest,
1937     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
1938         [Specifies the hamcrest jar file to use for JUnit-based tests.
1939          --without-junit disables those tests. Not relevant in the --without-java case.]),
1940 ,with_hamcrest=yes)
1942 AC_ARG_WITH(perl-home,
1943     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
1944         [If you have installed Perl 5 Distribution, on your system, please
1945          supply the path here. Note that this is not the location of the Perl
1946          binary but the location of the entire distribution.]),
1949 libo_FUZZ_ARG_WITH(doxygen,
1950     AS_HELP_STRING(
1951         [--with-doxygen=<absolute path to doxygen executable>],
1952         [Specifies the doxygen executable to use when generating ODK C/C++
1953          documentation. --without-doxygen disables generation of ODK C/C++
1954          documentation. Not relevant in the --disable-odk case.]),
1955 ,with_doxygen=yes)
1957 AC_ARG_WITH(visual-studio,
1958     AS_HELP_STRING([--with-visual-studio=<2015/2017>],
1959         [Specify which Visual Studio version to use in case several are
1960          installed. If not specified, defaults to 2015.]),
1963 AC_ARG_WITH(windows-sdk,
1964     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
1965         [Specify which Windows SDK, or "Windows Kit", version to use
1966          in case the one that came with the selected Visual Studio
1967          is not what you want for some reason. Note that not all compiler/SDK
1968          combinations are supported. The intent is that this option should not
1969          be needed.]),
1972 AC_ARG_WITH(lang,
1973     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
1974         [Use this option to build LibreOffice with additional UI language support.
1975          English (US) is always included by default.
1976          Separate multiple languages with space.
1977          For all languages, use --with-lang=ALL.]),
1980 AC_ARG_WITH(locales,
1981     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
1982         [Use this option to limit the locale information built in.
1983          Separate multiple locales with space.
1984          Very experimental and might well break stuff.
1985          Just a desperate measure to shrink code and data size.
1986          By default all the locales available is included.
1987          This option is completely unrelated to --with-lang.])
1988     [
1989                           Affects also our character encoding conversion
1990                           tables for encodings mainly targeted for a
1991                           particular locale, like EUC-CN and EUC-TW for
1992                           zh, ISO-2022-JP for ja.
1994                           Affects also our add-on break iterator data for
1995                           some languages.
1997                           For the default, all locales, don't use this switch at all.
1998                           Specifying just the language part of a locale means all matching
1999                           locales will be included.
2000     ],
2003 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2004 libo_FUZZ_ARG_WITH(krb5,
2005     AS_HELP_STRING([--with-krb5],
2006         [Enable MIT Kerberos 5 support in modules that support it.
2007          By default automatically enabled on platforms
2008          where a good system Kerberos 5 is available.]),
2011 libo_FUZZ_ARG_WITH(gssapi,
2012     AS_HELP_STRING([--with-gssapi],
2013         [Enable GSSAPI support in modules that support it.
2014          By default automatically enabled on platforms
2015          where a good system GSSAPI is available.]),
2018 AC_ARG_WITH(iwyu,
2019     AS_HELP_STRING([--with-iwyu],
2020         [Use given IWYU binary path to check unneeded includes instead of building.
2021          Use only if you are hacking on it.]),
2024 dnl ===================================================================
2025 dnl Branding
2026 dnl ===================================================================
2028 AC_ARG_WITH(branding,
2029     AS_HELP_STRING([--with-branding=/path/to/images],
2030         [Use given path to retrieve branding images set.])
2031     [
2032                           Search for intro.png about.svg and flat_logo.svg.
2033                           If any is missing, default ones will be used instead.
2035                           Search also progress.conf for progress
2036                           settings on intro screen :
2038                           PROGRESSBARCOLOR="255,255,255" Set color of
2039                           progress bar. Comma separated RGB decimal values.
2040                           PROGRESSSIZE="407,6" Set size of progress bar.
2041                           Comma separated decimal values (width, height).
2042                           PROGRESSPOSITION="61,317" Set position of progress
2043                           bar from left,top. Comma separated decimal values.
2044                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2045                           bar frame. Comma separated RGB decimal values.
2046                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2047                           bar text. Comma separated RGB decimal values.
2048                           PROGRESSTEXTBASELINE="287" Set vertical position of
2049                           progress bar text from top. Decimal value.
2051                           Default values will be used if not found.
2052     ],
2056 AC_ARG_WITH(extra-buildid,
2057     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2058         [Show addition build identification in about dialog.]),
2062 AC_ARG_WITH(vendor,
2063     AS_HELP_STRING([--with-vendor="John the Builder"],
2064         [Set vendor of the build.]),
2067 AC_ARG_WITH(android-package-name,
2068     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2069         [Set Android package name of the build.]),
2072 AC_ARG_WITH(compat-oowrappers,
2073     AS_HELP_STRING([--with-compat-oowrappers],
2074         [Install oo* wrappers in parallel with
2075          lo* ones to keep backward compatibility.
2076          Has effect only with make distro-pack-install]),
2079 AC_ARG_WITH(os-version,
2080     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2081         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2084 AC_ARG_WITH(mingw-cross-compiler,
2085     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2086         [Specify the MinGW cross-compiler to use.
2087          When building on the ODK on Unix and building unowinreg.dll,
2088          specify the MinGW C++ cross-compiler.]),
2091 AC_ARG_WITH(idlc-cpp,
2092     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2093         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2096 AC_ARG_WITH(build-version,
2097     AS_HELP_STRING([--with-build-version="Built by Jim"],
2098         [Allows the builder to add a custom version tag that will appear in the
2099          Help/About box for QA purposes.]),
2100 with_build_version=$withval,
2103 AC_ARG_WITH(alloc,
2104     AS_HELP_STRING([--with-alloc],
2105         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
2106          Note that on FreeBSD/NetBSD system==jemalloc]),
2109 AC_ARG_WITH(parallelism,
2110     AS_HELP_STRING([--with-parallelism],
2111         [Number of jobs to run simultaneously during build. Parallel builds can
2112         save a lot of time on multi-cpu machines. Defaults to the number of
2113         CPUs on the machine, unless you configure --enable-icecream - then to
2114         10.]),
2117 AC_ARG_WITH(all-tarballs,
2118     AS_HELP_STRING([--with-all-tarballs],
2119         [Download all external tarballs unconditionally]))
2121 AC_ARG_WITH(gdrive-client-id,
2122     AS_HELP_STRING([--with-gdrive-client-id],
2123         [Provides the client id of the application for OAuth2 authentication
2124         on Google Drive. If either this or --with-gdrive-client-secret is
2125         empty, the feature will be disabled]),
2128 AC_ARG_WITH(gdrive-client-secret,
2129     AS_HELP_STRING([--with-gdrive-client-secret],
2130         [Provides the client secret of the application for OAuth2
2131         authentication on Google Drive. If either this or
2132         --with-gdrive-client-id is empty, the feature will be disabled]),
2135 AC_ARG_WITH(alfresco-cloud-client-id,
2136     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2137         [Provides the client id of the application for OAuth2 authentication
2138         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2139         empty, the feature will be disabled]),
2142 AC_ARG_WITH(alfresco-cloud-client-secret,
2143     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2144         [Provides the client secret of the application for OAuth2
2145         authentication on Alfresco Cloud. If either this or
2146         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2149 AC_ARG_WITH(onedrive-client-id,
2150     AS_HELP_STRING([--with-onedrive-client-id],
2151         [Provides the client id of the application for OAuth2 authentication
2152         on OneDrive. If either this or --with-onedrive-client-secret is
2153         empty, the feature will be disabled]),
2156 AC_ARG_WITH(onedrive-client-secret,
2157     AS_HELP_STRING([--with-onedrive-client-secret],
2158         [Provides the client secret of the application for OAuth2
2159         authentication on OneDrive. If either this or
2160         --with-onedrive-client-id is empty, the feature will be disabled]),
2162 dnl ===================================================================
2163 dnl Do we want to use pre-build binary tarball for recompile
2164 dnl ===================================================================
2166 if test "$enable_library_bin_tar" = "yes" ; then
2167     USE_LIBRARY_BIN_TAR=TRUE
2168 else
2169     USE_LIBRARY_BIN_TAR=
2171 AC_SUBST(USE_LIBRARY_BIN_TAR)
2173 dnl ===================================================================
2174 dnl Test whether build target is Release Build
2175 dnl ===================================================================
2176 AC_MSG_CHECKING([whether build target is Release Build])
2177 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2178     AC_MSG_RESULT([no])
2179     ENABLE_RELEASE_BUILD=
2180 else
2181     AC_MSG_RESULT([yes])
2182     ENABLE_RELEASE_BUILD=TRUE
2184 AC_SUBST(ENABLE_RELEASE_BUILD)
2186 dnl ===================================================================
2187 dnl Test whether to sign Windows Build
2188 dnl ===================================================================
2189 AC_MSG_CHECKING([whether to sign windows build])
2190 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2191     AC_MSG_RESULT([yes])
2192     WINDOWS_BUILD_SIGNING="TRUE"
2193 else
2194     AC_MSG_RESULT([no])
2195     WINDOWS_BUILD_SIGNING="FALSE"
2197 AC_SUBST(WINDOWS_BUILD_SIGNING)
2199 dnl ===================================================================
2200 dnl MacOSX build and runtime environment options
2201 dnl ===================================================================
2203 AC_ARG_WITH(macosx-sdk,
2204     AS_HELP_STRING([--with-macosx-sdk=<version>],
2205         [Prefer a specific SDK for building.])
2206     [
2207                           If the requested SDK is not available, a search for the oldest one will be done.
2208                           With current Xcode versions, only the latest SDK is included, so this option is
2209                           not terribly useful. It works fine to build with a new SDK and run the result
2210                           on an older OS.
2212                           e. g.: --with-macosx-sdk=10.9
2214                           there are 3 options to control the MacOSX build:
2215                           --with-macosx-sdk (referred as 'sdk' below)
2216                           --with-macosx-version-min-required (referred as 'min' below)
2217                           --with-macosx-version-max-allowed (referred as 'max' below)
2219                           the connection between these value and the default they take is as follow:
2220                           ( ? means not specified on the command line, s means the SDK version found,
2221                           constraint: 8 <= x <= y <= z)
2223                           ==========================================
2224                            command line      || config result
2225                           ==========================================
2226                           min  | max  | sdk  || min  | max  | sdk  |
2227                           ?    | ?    | ?    || 10.9 | 10.s | 10.s |
2228                           ?    | ?    | 10.x || 10.9 | 10.x | 10.x |
2229                           ?    | 10.x | ?    || 10.9 | 10.s | 10.s |
2230                           ?    | 10.x | 10.y || 10.9 | 10.x | 10.y |
2231                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2232                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2233                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2234                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2237                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2238                           for a detailed technical explanation of these variables
2240                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2241     ],
2244 AC_ARG_WITH(macosx-version-min-required,
2245     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2246         [set the minimum OS version needed to run the built LibreOffice])
2247     [
2248                           e. g.: --with-macos-version-min-required=10.9
2249                           see --with-macosx-sdk for more info
2250     ],
2253 AC_ARG_WITH(macosx-version-max-allowed,
2254     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2255         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2256     [
2257                           e. g.: --with-macos-version-max-allowed=10.9
2258                           see --with-macosx-sdk for more info
2259     ],
2263 dnl ===================================================================
2264 dnl options for stuff used during cross-compilation build
2265 dnl Not quite superseded by --with-build-platform-configure-options.
2266 dnl TODO: check, if the "force" option is still needed anywhere.
2267 dnl ===================================================================
2269 AC_ARG_WITH(system-icu-for-build,
2270     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2271         [Use icu already on system for build tools (cross-compilation only).]))
2274 dnl ===================================================================
2275 dnl Check for incompatible options set by fuzzing, and reset those
2276 dnl automatically to working combinations
2277 dnl ===================================================================
2279 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2280         "$enable_dbus" != "$enable_avahi"; then
2281     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2282     enable_avahi=$enable_dbus
2285 dnl ===================================================================
2286 dnl check for required programs (grep, awk, sed, bash)
2287 dnl ===================================================================
2289 pathmunge ()
2291     if test -n "$1"; then
2292         if test "$build_os" = "cygwin"; then
2293             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2294                 PathFormat "$1"
2295                 new_path=`cygpath -sm "$formatted_path"`
2296             else
2297                 PathFormat "$1"
2298                 new_path=`cygpath -u "$formatted_path"`
2299             fi
2300         else
2301             new_path="$1"
2302         fi
2303         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2304             if test "$2" = "after"; then
2305                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2306             else
2307                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2308             fi
2309         fi
2310         unset new_path
2311     fi
2314 AC_PROG_AWK
2315 AC_PATH_PROG( AWK, $AWK)
2316 if test -z "$AWK"; then
2317     AC_MSG_ERROR([install awk to run this script])
2320 AC_PATH_PROG(BASH, bash)
2321 if test -z "$BASH"; then
2322     AC_MSG_ERROR([bash not found in \$PATH])
2324 AC_SUBST(BASH)
2326 AC_MSG_CHECKING([for GNU or BSD tar])
2327 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2328     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2329     if test $? -eq 0;  then
2330         GNUTAR=$a
2331         break
2332     fi
2333 done
2334 AC_MSG_RESULT($GNUTAR)
2335 if test -z "$GNUTAR"; then
2336     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2338 AC_SUBST(GNUTAR)
2340 AC_MSG_CHECKING([for tar's option to strip components])
2341 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2342 if test $? -eq 0; then
2343     STRIP_COMPONENTS="--strip-components"
2344 else
2345     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2346     if test $? -eq 0; then
2347         STRIP_COMPONENTS="--strip-path"
2348     else
2349         STRIP_COMPONENTS="unsupported"
2350     fi
2352 AC_MSG_RESULT($STRIP_COMPONENTS)
2353 if test x$STRIP_COMPONENTS = xunsupported; then
2354     AC_MSG_ERROR([you need a tar that is able to strip components.])
2356 AC_SUBST(STRIP_COMPONENTS)
2358 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2359 dnl desktop OSes from "mobile" ones.
2361 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2362 dnl In other words, that when building for an OS that is not a
2363 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2365 dnl Note the direction of the implication; there is no assumption that
2366 dnl cross-compiling would imply a non-desktop OS.
2368 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2369     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2370     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2371     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2374 # Whether to build "avmedia" functionality or not.
2376 if test -z "$enable_avmedia"; then
2377     enable_avmedia=yes
2380 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2381 if test "$enable_avmedia" = yes; then
2382     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2383 else
2384     USE_AVMEDIA_DUMMY='TRUE'
2386 AC_SUBST(USE_AVMEDIA_DUMMY)
2388 # Decide whether to build database connectivity stuff (including
2389 # Base) or not. We probably don't want to on non-desktop OSes.
2390 if test -z "$enable_database_connectivity"; then
2391     # --disable-database-connectivity is unfinished work in progress
2392     # and the iOS test app doesn't link if we actually try to use it.
2393     # if test $_os != iOS -a $_os != Android; then
2394     if test $_os != iOS; then
2395         enable_database_connectivity=yes
2396     fi
2399 if test "$enable_database_connectivity" = yes; then
2400     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2401     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2404 if test -z "$enable_extensions"; then
2405     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2406     if test $_os != iOS -a $_os != Android; then
2407         enable_extensions=yes
2408     fi
2411 if test "$enable_extensions" = yes; then
2412     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2413     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2416 if test -z "$enable_scripting"; then
2417     # Disable scripting for iOS unless specifically overridden
2418     # with --enable-scripting.
2419     if test $_os != iOS; then
2420         enable_scripting=yes
2421     fi
2424 DISABLE_SCRIPTING=''
2425 if test "$enable_scripting" = yes; then
2426     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2427     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2428 else
2429     DISABLE_SCRIPTING='TRUE'
2430     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2433 if test $_os = iOS -o $_os = Android; then
2434     # Disable dynamic_loading always for iOS and Android
2435     enable_dynamic_loading=no
2436 elif test -z "$enable_dynamic_loading"; then
2437     # Otherwise enable it unless speficically disabled
2438     enable_dynamic_loading=yes
2441 DISABLE_DYNLOADING=''
2442 if test "$enable_dynamic_loading" = yes; then
2443     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2444 else
2445     DISABLE_DYNLOADING='TRUE'
2447 AC_SUBST(DISABLE_DYNLOADING)
2449 # remenber SYSBASE value
2450 AC_SUBST(SYSBASE)
2452 dnl ===================================================================
2453 dnl  Sort out various gallery compilation options
2454 dnl ===================================================================
2455 AC_MSG_CHECKING([how to build and package galleries])
2456 if test -n "${with_galleries}"; then
2457     if test "$with_galleries" = "build"; then
2458         WITH_GALLERY_BUILD=TRUE
2459         AC_MSG_RESULT([build from source images internally])
2460     elif test "$with_galleries" = "no"; then
2461         WITH_GALLERY_BUILD=
2462         AC_MSG_RESULT([disable non-internal gallery build])
2463     else
2464         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2465     fi
2466 else
2467     if test $_os != iOS -a $_os != Android; then
2468         WITH_GALLERY_BUILD=TRUE
2469         AC_MSG_RESULT([internal src images for desktop])
2470     else
2471         WITH_GALLERY_BUILD=
2472         AC_MSG_RESULT([disable src image build])
2473     fi
2475 AC_SUBST(WITH_GALLERY_BUILD)
2477 dnl ===================================================================
2478 dnl  Checks if ccache is available
2479 dnl ===================================================================
2480 if test "$_os" = "WINNT"; then
2481     # on windows/VC build do not use ccache
2482     CCACHE=""
2483 elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2484     case "%$CC%$CXX%" in
2485     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2486     # assume that's good then
2487     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2488         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2489         ;;
2490     *)
2491         AC_PATH_PROG([CCACHE],[ccache],[not found])
2492         if test "$CCACHE" = "not found"; then
2493             CCACHE=""
2494         else
2495             # Need to check for ccache version: otherwise prevents
2496             # caching of the results (like "-x objective-c++" for Mac)
2497             if test $_os = Darwin -o $_os = iOS; then
2498                 # Check ccache version
2499                 AC_MSG_CHECKING([whether version of ccache is suitable])
2500                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2501                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2502                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2503                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2504                 else
2505                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2506                     CCACHE=""
2507                 fi
2508             fi
2509         fi
2510         ;;
2511     esac
2512 else
2513     CCACHE=""
2516 if test "$CCACHE" != ""; then
2517     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2518     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2519     if test "$ccache_size" = ""; then
2520         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2521         if test "$ccache_size" = ""; then
2522             ccache_size=0
2523         fi
2524         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2525         if test $ccache_size -lt 1024; then
2526             CCACHE=""
2527             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2528             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2529         else
2530             # warn that ccache may be too small for debug build
2531             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2532             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2533         fi
2534     else
2535         if test $ccache_size -lt 5; then
2536             #warn that ccache may be too small for debug build
2537             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2538             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2539         fi
2540     fi
2543 dnl ===================================================================
2544 dnl  Checks for C compiler,
2545 dnl  The check for the C++ compiler is later on.
2546 dnl ===================================================================
2547 if test "$_os" != "WINNT"; then
2548     GCC_HOME_SET="true"
2549     AC_MSG_CHECKING([gcc home])
2550     if test -z "$with_gcc_home"; then
2551         if test "$enable_icecream" = "yes"; then
2552             if test -d "/usr/lib/icecc/bin"; then
2553                 GCC_HOME="/usr/lib/icecc/"
2554             else
2555                 GCC_HOME="/opt/icecream/"
2556             fi
2557         else
2558             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2559             GCC_HOME_SET="false"
2560         fi
2561     else
2562         GCC_HOME="$with_gcc_home"
2563     fi
2564     AC_MSG_RESULT($GCC_HOME)
2565     AC_SUBST(GCC_HOME)
2567     if test "$GCC_HOME_SET" = "true"; then
2568         if test -z "$CC"; then
2569             CC="$GCC_HOME/bin/gcc"
2570         fi
2571         if test -z "$CXX"; then
2572             CXX="$GCC_HOME/bin/g++"
2573         fi
2574     fi
2577 COMPATH=`dirname "$CC"`
2578 if test "$COMPATH" = "."; then
2579     AC_PATH_PROGS(COMPATH, $CC)
2580     dnl double square bracket to get single because of M4 quote...
2581     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2583 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2585 dnl ===================================================================
2586 dnl Java support
2587 dnl ===================================================================
2588 AC_MSG_CHECKING([whether to build with Java support])
2589 if test "$with_java" != "no"; then
2590     if test "$DISABLE_SCRIPTING" = TRUE; then
2591         AC_MSG_RESULT([no, overridden by --disable-scripting])
2592         ENABLE_JAVA=""
2593         with_java=no
2594     else
2595         AC_MSG_RESULT([yes])
2596         ENABLE_JAVA="TRUE"
2597         AC_DEFINE(HAVE_FEATURE_JAVA)
2598     fi
2599 else
2600     AC_MSG_RESULT([no])
2601     ENABLE_JAVA=""
2604 AC_SUBST(ENABLE_JAVA)
2606 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2608 dnl ENABLE_JAVA="" indicate no Java support at all
2610 dnl ===================================================================
2611 dnl Check OS X SDK and compiler
2612 dnl ===================================================================
2614 if test $_os = Darwin -o $_os = iOS; then
2616     # If no --with-macosx-sdk option is given, look for one
2618     # The intent is that for "most" Mac-based developers, a suitable
2619     # SDK will be found automatically without any configure options.
2621     # For developers with a current Xcode, the lowest-numbered SDK
2622     # higher than or equal to the minimum required should be found.
2624     AC_MSG_CHECKING([what Mac OS X SDK to use])
2625     for _macosx_sdk in $with_macosx_sdk 10.13 10.12; do
2626         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2627         if test -d "$MACOSX_SDK_PATH"; then
2628             with_macosx_sdk="${_macosx_sdk}"
2629             break
2630         else
2631             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2632             if test -d "$MACOSX_SDK_PATH"; then
2633                 with_macosx_sdk="${_macosx_sdk}"
2634                 break
2635             fi
2636         fi
2637     done
2638     if test ! -d "$MACOSX_SDK_PATH"; then
2639         AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2640     fi
2642     if test $_os = iOS; then
2643         if test "$enable_ios_simulator" = "yes"; then
2644             useos=iphonesimulator
2645         else
2646             useos=iphoneos
2647         fi
2648         MACOSX_SDK_PATH=`xcrun --sdk ${useos} --show-sdk-path 2> /dev/null`
2649     fi
2650     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2653     case $with_macosx_sdk in
2654     10.9)
2655         MACOSX_SDK_VERSION=1090
2656         ;;
2657     10.10)
2658         MACOSX_SDK_VERSION=101000
2659         ;;
2660     10.11)
2661         MACOSX_SDK_VERSION=101100
2662         ;;
2663     10.12)
2664         MACOSX_SDK_VERSION=101200
2665         ;;
2666     10.13)
2667         MACOSX_SDK_VERSION=101300
2668         ;;
2669     *)
2670         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.9--13])
2671         ;;
2672     esac
2674     if test "$with_macosx_version_min_required" = "" ; then
2675         with_macosx_version_min_required="10.9";
2676     fi
2678     if test "$with_macosx_version_max_allowed" = "" ; then
2679         with_macosx_version_max_allowed="$with_macosx_sdk"
2680     fi
2682     # export this so that "xcrun" invocations later return matching values
2683     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2684     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2685     export DEVELOPER_DIR
2686     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2687     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2689     case "$with_macosx_version_min_required" in
2690     10.9)
2691         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2692         ;;
2693     10.10)
2694         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2695         ;;
2696     10.11)
2697         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2698         ;;
2699     10.12)
2700         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2701         ;;
2702     10.13)
2703         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2704         ;;
2705     *)
2706         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.9--13])
2707         ;;
2708     esac
2709     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2711     LIBTOOL=/usr/bin/libtool
2712     INSTALL_NAME_TOOL=install_name_tool
2713     if test -z "$save_CC"; then
2714         AC_MSG_CHECKING([what compiler to use])
2715         stdlib=-stdlib=libc++
2716         if test "$ENABLE_LTO" = TRUE; then
2717             lto=-flto
2718         fi
2719         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2720         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2721         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2722         AR=`xcrun -find ar`
2723         NM=`xcrun -find nm`
2724         STRIP=`xcrun -find strip`
2725         LIBTOOL=`xcrun -find libtool`
2726         RANLIB=`xcrun -find ranlib`
2727         AC_MSG_RESULT([$CC and $CXX])
2728     fi
2730     case "$with_macosx_version_max_allowed" in
2731     10.9)
2732         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2733         ;;
2734     10.10)
2735         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2736         ;;
2737     10.11)
2738         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2739         ;;
2740     10.12)
2741         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2742         ;;
2743     10.13)
2744         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2745         ;;
2746     *)
2747         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.9--13])
2748         ;;
2749     esac
2751     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2752     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2753         AC_MSG_RESULT([$MAC_OS_X_VERSION_MIN_REQUIRED])
2754         AC_MSG_RESULT([$MAC_OS_X_VERSION_MAX_REQUIRED])
2755         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2756     else
2757         AC_MSG_RESULT([ok])
2758     fi
2760     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2761     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2762         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2763     else
2764         AC_MSG_RESULT([ok])
2765     fi
2766     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2767     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2769     AC_MSG_CHECKING([whether to do code signing])
2771     if test "$enable_macosx_code_signing" = yes; then
2772         # By default use the first suitable certificate (?).
2774         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2775         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2776         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2777         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2778         # "Developer ID Application" one.
2780         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2781         if test -n "$identity"; then
2782             MACOSX_CODESIGNING_IDENTITY=$identity
2783             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2784             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2785         else
2786             AC_MSG_ERROR([cannot determine identity to use])
2787         fi
2788     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2789         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2790         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2791         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2792     else
2793         AC_MSG_RESULT([no])
2794     fi
2796     AC_MSG_CHECKING([whether to create a Mac App Store package])
2798     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2799         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2800     elif test "$enable_macosx_package_signing" = yes; then
2801         # By default use the first suitable certificate.
2802         # It should be a "3rd Party Mac Developer Installer" one
2804         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2805         if test -n "$identity"; then
2806             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2807             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2808             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2809         else
2810             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2811         fi
2812     elif test -n "$enable_macosx_package_signing"; then
2813         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2814         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2815         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2816     else
2817         AC_MSG_RESULT([no])
2818     fi
2820     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2821         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2822     fi
2824     AC_MSG_CHECKING([whether to sandbox the application])
2826     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2827         AC_MSG_ERROR([OS X sandboxing requires code signing])
2828     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2829         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2830     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2831         ENABLE_MACOSX_SANDBOX=TRUE
2832         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2833         AC_MSG_RESULT([yes])
2834     else
2835         AC_MSG_RESULT([no])
2836     fi
2838     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2839     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2840     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2842 AC_SUBST(MACOSX_SDK_PATH)
2843 AC_SUBST(MACOSX_SDK_VERSION)
2844 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2845 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2846 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
2847 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2848 AC_SUBST(INSTALL_NAME_TOOL)
2849 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2850 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2851 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2852 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2853 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2855 dnl ===================================================================
2856 dnl Check iOS SDK and compiler
2857 dnl ===================================================================
2859 if test $_os = iOS; then
2860     AC_MSG_CHECKING([what iOS SDK to use])
2861     current_sdk_ver=11.1
2862     if test "$enable_ios_simulator" = "yes"; then
2863         platform=iPhoneSimulator
2864         versionmin=-mios-simulator-version-min=$current_sdk_ver
2865     else
2866         platform=iPhoneOS
2867         versionmin=-miphoneos-version-min=$current_sdk_ver
2868     fi
2869     xcode_developer=`xcode-select -print-path`
2871     for sdkver in $current_sdk_ver; do
2872         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2873         if test -d $t; then
2874             ios_sdk=$sdkver
2875             sysroot=$t
2876             break
2877         fi
2878     done
2880     if test -z "$sysroot"; then
2881         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
2882     fi
2884     AC_MSG_RESULT($sysroot)
2886     IOS_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
2887     IOS_DEPLOYMENT_VERSION=$current_sdk_ver
2889     # LTO is not really recommended for iOS builds,
2890     # the link time will be astronomical
2891     if test "$ENABLE_LTO" = TRUE; then
2892         lto=-flto
2893     fi
2895     stdlib="-stdlib=libc++"
2897     CC="`xcrun -find clang` -arch $host_cpu -isysroot $sysroot $lto $versionmin"
2898     CXX="`xcrun -find clang++` -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
2900     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2901     AR=`xcrun -find ar`
2902     NM=`xcrun -find nm`
2903     STRIP=`xcrun -find strip`
2904     LIBTOOL=`xcrun -find libtool`
2905     RANLIB=`xcrun -find ranlib`
2908 AC_SUBST(IOS_SDK)
2909 AC_SUBST(IOS_DEPLOYMENT_VERSION)
2911 AC_MSG_CHECKING([whether to treat the installation as read-only])
2913 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
2914         "$enable_extensions" != yes; then
2915     enable_readonly_installset=yes
2917 if test "$enable_readonly_installset" = yes; then
2918     AC_MSG_RESULT([yes])
2919     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
2920 else
2921     AC_MSG_RESULT([no])
2924 dnl ===================================================================
2925 dnl Structure of install set
2926 dnl ===================================================================
2928 if test $_os = Darwin; then
2929     LIBO_BIN_FOLDER=MacOS
2930     LIBO_ETC_FOLDER=Resources
2931     LIBO_LIBEXEC_FOLDER=MacOS
2932     LIBO_LIB_FOLDER=Frameworks
2933     LIBO_LIB_PYUNO_FOLDER=Resources
2934     LIBO_SHARE_FOLDER=Resources
2935     LIBO_SHARE_HELP_FOLDER=Resources/help
2936     LIBO_SHARE_JAVA_FOLDER=Resources/java
2937     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
2938     LIBO_SHARE_READMES_FOLDER=Resources/readmes
2939     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
2940     LIBO_SHARE_SHELL_FOLDER=Resources/shell
2941     LIBO_URE_BIN_FOLDER=MacOS
2942     LIBO_URE_ETC_FOLDER=Resources/ure/etc
2943     LIBO_URE_LIB_FOLDER=Frameworks
2944     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
2945     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
2946 elif test $_os = WINNT; then
2947     LIBO_BIN_FOLDER=program
2948     LIBO_ETC_FOLDER=program
2949     LIBO_LIBEXEC_FOLDER=program
2950     LIBO_LIB_FOLDER=program
2951     LIBO_LIB_PYUNO_FOLDER=program
2952     LIBO_SHARE_FOLDER=share
2953     LIBO_SHARE_HELP_FOLDER=help
2954     LIBO_SHARE_JAVA_FOLDER=program/classes
2955     LIBO_SHARE_PRESETS_FOLDER=presets
2956     LIBO_SHARE_READMES_FOLDER=readmes
2957     LIBO_SHARE_RESOURCE_FOLDER=program/resource
2958     LIBO_SHARE_SHELL_FOLDER=program/shell
2959     LIBO_URE_BIN_FOLDER=program
2960     LIBO_URE_ETC_FOLDER=program
2961     LIBO_URE_LIB_FOLDER=program
2962     LIBO_URE_MISC_FOLDER=program
2963     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
2964 else
2965     LIBO_BIN_FOLDER=program
2966     LIBO_ETC_FOLDER=program
2967     LIBO_LIBEXEC_FOLDER=program
2968     LIBO_LIB_FOLDER=program
2969     LIBO_LIB_PYUNO_FOLDER=program
2970     LIBO_SHARE_FOLDER=share
2971     LIBO_SHARE_HELP_FOLDER=help
2972     LIBO_SHARE_JAVA_FOLDER=program/classes
2973     LIBO_SHARE_PRESETS_FOLDER=presets
2974     LIBO_SHARE_READMES_FOLDER=readmes
2975     if test "$enable_fuzzers" != yes; then
2976         LIBO_SHARE_RESOURCE_FOLDER=program/resource
2977     else
2978         LIBO_SHARE_RESOURCE_FOLDER=resource
2979     fi
2980     LIBO_SHARE_SHELL_FOLDER=program/shell
2981     LIBO_URE_BIN_FOLDER=program
2982     LIBO_URE_ETC_FOLDER=program
2983     LIBO_URE_LIB_FOLDER=program
2984     LIBO_URE_MISC_FOLDER=program
2985     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
2987 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
2988 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
2989 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
2990 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
2991 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
2992 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
2993 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
2994 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
2995 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
2996 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
2997 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
2998 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
2999 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3000 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3001 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3002 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3004 # Not all of them needed in config_host.mk, add more if need arises
3005 AC_SUBST(LIBO_BIN_FOLDER)
3006 AC_SUBST(LIBO_ETC_FOLDER)
3007 AC_SUBST(LIBO_LIB_FOLDER)
3008 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3009 AC_SUBST(LIBO_SHARE_FOLDER)
3010 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3011 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3012 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3013 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3014 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3015 AC_SUBST(LIBO_URE_BIN_FOLDER)
3016 AC_SUBST(LIBO_URE_ETC_FOLDER)
3017 AC_SUBST(LIBO_URE_LIB_FOLDER)
3018 AC_SUBST(LIBO_URE_MISC_FOLDER)
3019 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3021 dnl ===================================================================
3022 dnl Windows specific tests and stuff
3023 dnl ===================================================================
3025 reg_get_value()
3027     # Return value: $regvalue
3028     unset regvalue
3030     local _regentry="/proc/registry${1}/${2}"
3031     if test -f "$_regentry"; then
3032         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3033         # Registry keys read via /proc/registry* are always \0 terminated!
3034         local _regvalue=$(tr -d '\0' < "$_regentry")
3035         if test $? -eq 0; then
3036             regvalue=$_regvalue
3037         fi
3038     fi
3041 # Get a value from the 32-bit side of the Registry
3042 reg_get_value_32()
3044     reg_get_value "32" "$1"
3047 # Get a value from the 64-bit side of the Registry
3048 reg_get_value_64()
3050     reg_get_value "64" "$1"
3053 if test "$_os" = "WINNT"; then
3054     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3055     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3056         AC_MSG_RESULT([no])
3057         WINDOWS_SDK_ARCH="x86"
3058     else
3059         AC_MSG_RESULT([yes])
3060         WINDOWS_SDK_ARCH="x64"
3061         BITNESS_OVERRIDE=64
3062     fi
3064 if test "$_os" = "iOS"; then
3065     cross_compiling="yes"
3068 if test "$cross_compiling" = "yes"; then
3069     export CROSS_COMPILING=TRUE
3070 else
3071     CROSS_COMPILING=
3072     BUILD_TYPE="$BUILD_TYPE NATIVE"
3074 AC_SUBST(CROSS_COMPILING)
3076 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3077 if test "$GCC" = "yes"; then
3078     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
3079     bsymbolic_functions_ldflags_save=$LDFLAGS
3080     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3081     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3082 #include <stdio.h>
3083         ],[
3084 printf ("hello world\n");
3085         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3086     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3087         AC_MSG_RESULT( found )
3088     else
3089         AC_MSG_RESULT( not found )
3090     fi
3091     LDFLAGS=$bsymbolic_functions_ldflags_save
3093 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3095 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3096 # NOTE: must _not_ be used for bundled external libraries!
3097 ISYSTEM=
3098 if test "$GCC" = "yes"; then
3099     AC_MSG_CHECKING( for -isystem )
3100     save_CFLAGS=$CFLAGS
3101     CFLAGS="$CFLAGS -Werror"
3102     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3103     CFLAGS=$save_CFLAGS
3104     if test -n "$ISYSTEM"; then
3105         AC_MSG_RESULT(yes)
3106     else
3107         AC_MSG_RESULT(no)
3108     fi
3110 if test -z "$ISYSTEM"; then
3111     # fall back to using -I
3112     ISYSTEM=-I
3114 AC_SUBST(ISYSTEM)
3116 dnl ===================================================================
3117 dnl  Check which Visual Studio compiler is used
3118 dnl ===================================================================
3120 map_vs_year_to_version()
3122     # Return value: $vsversion
3124     unset vsversion
3126     case $1 in
3127     2015)
3128         vsversion=14.0;;
3129     2017)
3130         vsversion=15.0;;
3131     *)
3132         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3133     esac
3136 vs_versions_to_check()
3138     # Args: $1 (optional) : versions to check, in the order of preference
3139     # Return value: $vsversions
3141     unset vsversions
3143     if test -n "$1"; then
3144         map_vs_year_to_version "$1"
3145         vsversions=$vsversion
3146     else
3147         # By default we prefer 2015/2017, in this order
3148         vsversions="14.0 15.0"
3149     fi
3152 win_get_env_from_vsvars32bat()
3154     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3155     if test $vcnum = "150"; then
3156       # Also seems to be located in another directory under the same name: vsvars32.bat
3157       # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3158       printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3159     else
3160       printf '@call "%s/../Common7/Tools/vsvars32.bat"\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3161     fi
3162     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3163     chmod +x $WRAPPERBATCHFILEPATH
3164     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3165     rm -f $WRAPPERBATCHFILEPATH
3166     printf '%s' "$_win_get_env_from_vsvars32bat"
3169 find_ucrt()
3171     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3172     if test -n "$regvalue"; then
3173         PathFormat "$regvalue"
3174         UCRTSDKDIR=$formatted_path
3175         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3176         UCRTVERSION=$regvalue
3177         # Rest if not exist
3178         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3179           UCRTSDKDIR=
3180         fi
3181     fi
3182     if test -z "$UCRTSDKDIR"; then
3183         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3184         if test "$vcnum" = "150"; then
3185           ide_env_file="${ide_env_dir}VsDevCmd.bat"
3186         else
3187           ide_env_file="${ide_env_dir}/vsvars32.bat"
3188         fi
3189         if test -f "$ide_env_file"; then
3190             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3191             UCRTSDKDIR=$formatted_path
3192             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3193             dnl Hack needed at least by tml:
3194             if test "$UCRTVERSION" = 10.0.15063.0 \
3195                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3196                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3197             then
3198                 UCRTVERSION=10.0.14393.0
3199             fi
3200         else
3201           AC_MSG_ERROR([No UCRT found])
3202         fi
3203     fi
3206 find_msvc()
3208     # Find Visual C++ 2015/2017
3209     # Args: $1 (optional) : The VS version year
3210     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3212     unset vctest vcnum vcnumwithdot vcbuildnumber
3214     vs_versions_to_check "$1"
3216     for ver in $vsversions; do
3217         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3218         if test -n "$regvalue"; then
3219             vctest=$regvalue
3220             break
3221         fi
3222         # As always MSVC 15.0 is special here
3223         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver
3224         if test -n "$regvalue"; then
3225             AC_MSG_RESULT([found: $regvalue])
3226             PathFormat "$regvalue"
3227             vctest=$formatted_path
3228             break
3229         fi
3230     done
3231     if test -n "$vctest"; then
3232         vcnumwithdot=$ver
3233         case "$vcnumwithdot" in
3234         14.0)
3235             vcyear=2015
3236             vcnum=140
3237             ;;
3238         15.0)
3239             vcyear=2017
3240             vcnum=150
3241             vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3242             ;;
3243         esac
3244     fi
3247 SOLARINC=
3248 MSBUILD_PATH=
3249 DEVENV=
3250 if test "$_os" = "WINNT"; then
3251     AC_MSG_CHECKING([Visual C++])
3253     find_msvc "$with_visual_studio"
3254     if test -z "$vctest"; then
3255         if test -n "$with_visual_studio"; then
3256             AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3257         else
3258             AC_MSG_ERROR([No Visual Studio 2015/2017 installation found])
3259         fi
3260     fi
3262     if test "$BITNESS_OVERRIDE" = ""; then
3263         if test -f "$vctest/bin/cl.exe"; then
3264             VC_PRODUCT_DIR=$vctest
3265         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3266             VC_PRODUCT_DIR=$vctest/VC
3267         else
3268             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3269         fi
3270     else
3271         if test -f "$vctest/bin/amd64/cl.exe"; then
3272             VC_PRODUCT_DIR=$vctest
3273         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3274             VC_PRODUCT_DIR=$vctest/VC
3275         else
3276             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])
3277         fi
3278     fi
3280     AC_MSG_CHECKING([for short pathname of VC product directory])
3281     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3282     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3284     UCRTSDKDIR=
3285     UCRTVERSION=
3287     AC_MSG_CHECKING([for UCRT location])
3288     find_ucrt
3289     # find_ucrt errors out if it doesn't find it
3290     AC_MSG_RESULT([found])
3291     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3292     ucrtincpath_formatted=$formatted_path
3293     # SOLARINC is used for external modules and must be set too.
3294     # And no, it's not sufficient to set SOLARINC only, as configure
3295     # itself doesn't honour it.
3296     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3297     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3298     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3299     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3301     AC_SUBST(UCRTSDKDIR)
3302     AC_SUBST(UCRTVERSION)
3304     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3305     # Find the proper version of MSBuild.exe to use based on the VS version
3306     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3307     if test -n "$regvalue" ; then
3308         AC_MSG_RESULT([found: $regvalue])
3309         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3310     else
3311         if test $vcnum = "150"; then
3312             if test "$BITNESS_OVERRIDE" = ""; then
3313                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3314             else
3315                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3316             fi
3317             MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3318         else
3319             AC_MSG_ERROR([No msbuild found, Visual Studio installation broken?])
3320         fi
3321         AC_MSG_RESULT([$regvalue])
3322     fi
3324     # Find the version of devenv.exe
3325     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3326     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3327     if test ! -e "$DEVENV"; then
3328         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3329     fi
3331     dnl ===========================================================
3332     dnl  Check for the corresponding mspdb*.dll
3333     dnl ===========================================================
3335     MSPDB_PATH=
3336     CL_DIR=
3337     CL_LIB=
3339     if test "$BITNESS_OVERRIDE" = ""; then
3340         if test "$vcnum" = "150"; then
3341             MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86"
3342             CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX86/x86
3343         else
3344             MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3345             CL_DIR=bin
3346         fi
3347     else
3348         if test "$vcnum" = "150"; then
3349             MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64"
3350             CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX64/x64
3351         else
3352             MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3353             CL_DIR=bin/amd64
3354         fi
3355     fi
3357     # MSVC 15.0 has libraries from 14.0?
3358     if test  "$vcnum" = "150"; then
3359         mspdbnum="140"
3360     else
3361         mspdbnum=$vcnum
3362     fi
3364     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3365         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3366     fi
3368     MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3369     MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3371     dnl The path needs to be added before cl is called
3372     PATH="$MSPDB_PATH:$PATH"
3374     AC_MSG_CHECKING([cl.exe])
3376     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3377     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3378     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3379     # is not enough?
3381     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3382     dnl needed when building CLR code:
3383     if test -z "$MSVC_CXX"; then
3384         if test "$BITNESS_OVERRIDE" = ""; then
3385             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3386                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3387             fi
3388         else
3389             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3390                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3391             fi
3392         fi
3394         # This gives us a posix path with 8.3 filename restrictions
3395         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3396     fi
3398     if test -z "$CC"; then
3399         CC=$MSVC_CXX
3400     fi
3401     if test "$BITNESS_OVERRIDE" = ""; then
3402         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3403         MSVC_CXX="$MSVC_CXX -arch:SSE"
3404     fi
3406     if test -n "$CC"; then
3407         # Remove /cl.exe from CC case insensitive
3408         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3409         if test "$BITNESS_OVERRIDE" = ""; then
3410            if test "$vcnum" = "150"; then
3411                COMPATH="$VC_PRODUCT_DIR"
3412            else
3413                COMPATH=`echo "$CC" | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3414            fi
3415         else
3416             if test -n "$VC_PRODUCT_DIR"; then
3417                 COMPATH=$VC_PRODUCT_DIR
3418             fi
3419         fi
3420         if test "$BITNESS_OVERRIDE" = ""; then
3421             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3422             CC="$CC -arch:SSE"
3423         fi
3425         if test "$vcnum" = "150"; then
3426             COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3427         fi
3429         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3431         PathFormat "$COMPATH"
3432         COMPATH="$formatted_path"
3434         VCVER=$vcnum
3435         MSVSVER=$vcyear
3437         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3438         # are always "better", we list them in reverse chronological order.
3440         case $vcnum in
3441         140)
3442             COMEX=19
3443             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3444             ;;
3445         150)
3446             COMEX=19
3447             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3448             ;;
3449         esac
3451         # The expectation is that --with-windows-sdk should not need to be used
3452         if test -n "$with_windows_sdk"; then
3453             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3454             *" "$with_windows_sdk" "*)
3455                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3456                 ;;
3457             *)
3458                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3459                 ;;
3460             esac
3461         fi
3463         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3464         ac_objext=obj
3465         ac_exeext=exe
3467     else
3468         AC_MSG_ERROR([Visual C++ not found after all, huh])
3469     fi
3471     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3472     # version of the Explorer extension (and maybe other small
3473     # bits, too) needed when installing a 32-bit LibreOffice on a
3474     # 64-bit OS. The 64-bit Explorer extension is a feature that
3475     # has been present since long in OOo. Don't confuse it with
3476     # building LibreOffice itself as 64-bit code.
3478     BUILD_X64=
3479     CXX_X64_BINARY=
3480     LINK_X64_BINARY=
3482     if test "$BITNESS_OVERRIDE" = ""; then
3483         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3484         if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3485             # Prefer native x64 compiler to cross-compiler, in case we are running
3486             # the build on a 64-bit OS.
3487             if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3488                 BUILD_X64=TRUE
3489                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3490                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3491             elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3492                 BUILD_X64=TRUE
3493                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3494                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3495             fi
3496         elif test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib"; then
3497             # nobody uses 32-bit OS to build, just pick the 64-bit compiler
3498             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3499                 BUILD_X64=TRUE
3500                 CXX_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"
3501                 LINK_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/link.exe"
3502             fi
3503         fi
3504         if test "$BUILD_X64" = TRUE; then
3505             AC_MSG_RESULT([found])
3506         else
3507             AC_MSG_RESULT([not found])
3508             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3509         fi
3510     fi
3511     AC_SUBST(BUILD_X64)
3513     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3514     AC_SUBST(CXX_X64_BINARY)
3515     AC_SUBST(LINK_X64_BINARY)
3517 AC_SUBST(VCVER)
3518 AC_SUBST(DEVENV)
3519 PathFormat "$MSPDB_PATH"
3520 MSPDB_PATH="$formatted_path"
3521 AC_SUBST(MSVC_CXX)
3524 # unowinreg.dll
3526 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3527 AC_SUBST(UNOWINREG_DLL)
3529 COM_IS_CLANG=
3530 AC_MSG_CHECKING([whether the compiler is actually Clang])
3531 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3532     #ifndef __clang__
3533     you lose
3534     #endif
3535     int foo=42;
3536     ]])],
3537     [AC_MSG_RESULT([yes])
3538      COM_IS_CLANG=TRUE],
3539     [AC_MSG_RESULT([no])])
3541 CC_PLAIN=$CC
3542 if test "$COM_IS_CLANG" = TRUE; then
3543     AC_MSG_CHECKING([the Clang version])
3544     if test "$_os" = WINNT; then
3545         dnl In which case, assume clang-cl:
3546         my_args="/EP /TC"
3547         dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3548         dnl clang-cl:
3549         CC_PLAIN=
3550         for i in $CC; do
3551             case $i in
3552             -FIIntrin.h)
3553                 ;;
3554             *)
3555                 CC_PLAIN="$CC_PLAIN $i"
3556                 ;;
3557             esac
3558         done
3559     else
3560         my_args="-E -P"
3561     fi
3562     clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args -`
3563     CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3564     CLANGVER=`echo $clang_version \
3565         | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3566     AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3567     AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3568     AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3570 AC_SUBST(COM_IS_CLANG)
3572 SHOWINCLUDES_PREFIX=
3573 if test "$_os" = WINNT; then
3574     dnl We need to guess the prefix of the -showIncludes output, it can be
3575     dnl localized
3576     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3577     echo "#include <stdlib.h>" > conftest.c
3578     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3579         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3580     rm -f conftest.c conftest.obj
3581     if test -z "$SHOWINCLUDES_PREFIX"; then
3582         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3583     else
3584         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3585     fi
3587 AC_SUBST(SHOWINCLUDES_PREFIX)
3590 # prefix C with ccache if needed
3592 if test "$CCACHE" != ""; then
3593     AC_MSG_CHECKING([whether $CC is already ccached])
3595     AC_LANG_PUSH([C])
3596     save_CFLAGS=$CFLAGS
3597     CFLAGS="$CFLAGS --ccache-skip -O2"
3598     dnl an empty program will do, we're checking the compiler flags
3599     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3600                       [use_ccache=yes], [use_ccache=no])
3601     if test $use_ccache = yes; then
3602         AC_MSG_RESULT([yes])
3603     else
3604         CC="$CCACHE $CC"
3605         AC_MSG_RESULT([no])
3606     fi
3607     CFLAGS=$save_CFLAGS
3608     AC_LANG_POP([C])
3611 # ===================================================================
3612 # check various GCC options that Clang does not support now but maybe
3613 # will somewhen in the future, check them even for GCC, so that the
3614 # flags are set
3615 # ===================================================================
3617 HAVE_GCC_GGDB2=
3618 HAVE_GCC_FINLINE_LIMIT=
3619 HAVE_GCC_FNO_INLINE=
3620 if test "$GCC" = "yes"; then
3621     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3622     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3623         # Option just ignored and silly warning that isn't a real
3624         # warning printed
3625         :
3626     else
3627         save_CFLAGS=$CFLAGS
3628         CFLAGS="$CFLAGS -Werror -ggdb2"
3629         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3630         CFLAGS=$save_CFLAGS
3631     fi
3632     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3633         AC_MSG_RESULT([yes])
3634     else
3635         AC_MSG_RESULT([no])
3636     fi
3638     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3639     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3640         # As above
3641         :
3642     else
3643         save_CFLAGS=$CFLAGS
3644         CFLAGS="$CFLAGS -Werror -finline-limit=0"
3645         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3646         CFLAGS=$save_CFLAGS
3647     fi
3648     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3649         AC_MSG_RESULT([yes])
3650     else
3651         AC_MSG_RESULT([no])
3652     fi
3654     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3655     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3656         # Ditto
3657         :
3658     else
3659         save_CFLAGS=$CFLAGS
3660         CFLAGS="$CFLAGS -Werror -fno-inline"
3661         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3662         CFLAGS=$save_CFLAGS
3663     fi
3664     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3665         AC_MSG_RESULT([yes])
3666     else
3667         AC_MSG_RESULT([no])
3668     fi
3670     if test "$host_cpu" = "m68k"; then
3671         AC_MSG_CHECKING([whether $CC supports -mlong-jump-table-offsets])
3672         save_CFLAGS=$CFLAGS
3673         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3674         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3675         CFLAGS=$save_CFLAGS
3676         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3677             AC_MSG_RESULT([yes])
3678         else
3679             AC_MSG_ERROR([no])
3680         fi
3681     fi
3683 AC_SUBST(HAVE_GCC_GGDB2)
3684 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3685 AC_SUBST(HAVE_GCC_FNO_INLINE)
3687 dnl ===================================================================
3688 dnl  Test the gcc version
3689 dnl ===================================================================
3690 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3691     AC_MSG_CHECKING([the GCC version])
3692     _gcc_version=`$CC -dumpversion`
3693     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3694         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3695     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3697     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3699     if test "$gcc_full_version" -lt 40801; then
3700         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.8.1])
3701     fi
3702 else
3703     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3704     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3705     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3706     # (which reports itself as GCC 4.2.1).
3707     GCC_VERSION=
3709 AC_SUBST(GCC_VERSION)
3711 dnl Set the ENABLE_DBGUTIL variable
3712 dnl ===================================================================
3713 AC_MSG_CHECKING([whether to build with additional debug utilities])
3714 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3715     ENABLE_DBGUTIL="TRUE"
3716     # this is an extra var so it can have different default on different MSVC
3717     # versions (in case there are version specific problems with it)
3718     MSVC_USE_DEBUG_RUNTIME="TRUE"
3720     AC_MSG_RESULT([yes])
3721     # cppunit and graphite expose STL in public headers
3722     if test "$with_system_cppunit" = "yes"; then
3723         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3724     else
3725         with_system_cppunit=no
3726     fi
3727     if test "$with_system_graphite" = "yes"; then
3728         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3729     else
3730         with_system_graphite=no
3731     fi
3732     if test "$with_system_mysql_cppconn" = "yes"; then
3733         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3734     else
3735         with_system_mysql_cppconn=no
3736     fi
3737     if test "$with_system_orcus" = "yes"; then
3738         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3739     else
3740         with_system_orcus=no
3741     fi
3742     if test "$with_system_libcmis" = "yes"; then
3743         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3744     else
3745         with_system_libcmis=no
3746     fi
3747     if test "$with_system_hunspell" = "yes"; then
3748         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3749     else
3750         with_system_hunspell=no
3751     fi
3752 else
3753     ENABLE_DBGUTIL=""
3754     MSVC_USE_DEBUG_RUNTIME=""
3755     AC_MSG_RESULT([no])
3757 AC_SUBST(ENABLE_DBGUTIL)
3758 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3760 dnl Set the ENABLE_DEBUG variable.
3761 dnl ===================================================================
3762 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3763     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3765 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3766     if test -z "$libo_fuzzed_enable_debug"; then
3767         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3768     else
3769         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3770         enable_debug=yes
3771     fi
3774 AC_MSG_CHECKING([whether to do a debug build])
3775 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3776     ENABLE_DEBUG="TRUE"
3777     if test -n "$ENABLE_DBGUTIL" ; then
3778         AC_MSG_RESULT([yes (dbgutil)])
3779     else
3780         AC_MSG_RESULT([yes])
3781     fi
3782 else
3783     ENABLE_DEBUG=""
3784     AC_MSG_RESULT([no])
3786 AC_SUBST(ENABLE_DEBUG)
3788 if test "$enable_sal_log" = yes; then
3789     ENABLE_SAL_LOG=TRUE
3791 AC_SUBST(ENABLE_SAL_LOG)
3793 dnl Selective debuginfo
3794 ENABLE_DEBUGINFO_FOR=
3795 if test -n "$ENABLE_DEBUG"; then
3796     AC_MSG_CHECKING([whether to use selective debuginfo])
3797     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3798         if test "$enable_selective_debuginfo" = "yes"; then
3799             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3800         fi
3801         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3802         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3803     else
3804         ENABLE_DEBUGINFO_FOR=all
3805         AC_MSG_RESULT([no, for all])
3806     fi
3807 else
3808     if test -n "$enable_selective_debuginfo"; then
3809         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
3810     fi
3812 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3814 dnl Check for enable symbols option
3815 dnl ===================================================================
3816 AC_MSG_CHECKING([whether to generate debug information])
3817 if test -z "$enable_symbols"; then
3818     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3819         enable_symbols=yes
3820     else
3821         enable_symbols=no
3822     fi
3824 if test "$enable_symbols" != no; then
3825     ENABLE_SYMBOLS=TRUE
3826     AC_MSG_RESULT([yes])
3827 else
3828     ENABLE_SYMBOLS=
3829     AC_MSG_RESULT([no])
3831 AC_SUBST(ENABLE_SYMBOLS)
3833 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
3834     # Building on Android with full symbols: without enough memory the linker never finishes currently.
3835     AC_MSG_CHECKING([whether enough memory is available for linking])
3836     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
3837     # Check for 15GB, as Linux reports a bit less than the physical memory size.
3838     if test -n "$mem_size" -a $mem_size -lt 15728640; then
3839         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
3840     else
3841         AC_MSG_RESULT([yes])
3842     fi
3845 AC_MSG_CHECKING([whether to compile with optimization flags])
3846 if test -z "$enable_optimized"; then
3847     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3848         enable_optimized=no
3849     else
3850         enable_optimized=yes
3851     fi
3853 if test "$enable_optimized" != no; then
3854     ENABLE_OPTIMIZED=TRUE
3855     AC_MSG_RESULT([yes])
3856 else
3857     ENABLE_OPTIMIZED=
3858     AC_MSG_RESULT([no])
3860 AC_SUBST(ENABLE_OPTIMIZED)
3863 # determine CPUNAME, OS, ...
3864 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
3866 case "$host_os" in
3868 aix*)
3869     COM=GCC
3870     CPUNAME=POWERPC
3871     USING_X11=TRUE
3872     OS=AIX
3873     RTL_OS=AIX
3874     RTL_ARCH=PowerPC
3875     PLATFORMID=aix_powerpc
3876     P_SEP=:
3877     ;;
3879 cygwin*)
3880     COM=MSC
3881     USING_X11=
3882     OS=WNT
3883     RTL_OS=Windows
3884     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3885         P_SEP=";"
3886     else
3887         P_SEP=:
3888     fi
3889     case "$host_cpu" in
3890     i*86|x86_64)
3891         if test "$BITNESS_OVERRIDE" = 64; then
3892             CPUNAME=X86_64
3893             RTL_ARCH=X86_64
3894             PLATFORMID=windows_x86_64
3895             WINDOWS_X64=1
3896             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
3897         else
3898             CPUNAME=INTEL
3899             RTL_ARCH=x86
3900             PLATFORMID=windows_x86
3901         fi
3902         ;;
3903     *)
3904         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3905         ;;
3906     esac
3907     SCPDEFS="$SCPDEFS -D_MSC_VER"
3908     ;;
3910 darwin*)
3911     COM=GCC
3912     USING_X11=
3913     OS=MACOSX
3914     RTL_OS=MacOSX
3915     P_SEP=:
3917     case "$host_cpu" in
3918     arm)
3919         AC_MSG_ERROR([Can't build 32-bit code for iOS])
3920         ;;
3921     arm64)
3922         OS=IOS
3923         if test "$enable_ios_simulator" = "yes"; then
3924             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
3925         else
3926             CPUNAME=ARM64
3927             RTL_ARCH=ARM_EABI
3928             PLATFORMID=ios_arm64
3929         fi
3930         ;;
3931     i*86)
3932         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
3933         ;;
3934     x86_64)
3935         if test "$enable_ios_simulator" = "yes"; then
3936             OS=IOS
3937         fi
3938         CPUNAME=X86_64
3939         RTL_ARCH=X86_64
3940         PLATFORMID=macosx_x86_64
3941         ;;
3942     *)
3943         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3944         ;;
3945     esac
3946     ;;
3948 dragonfly*)
3949     COM=GCC
3950     USING_X11=TRUE
3951     OS=DRAGONFLY
3952     RTL_OS=DragonFly
3953     P_SEP=:
3955     case "$host_cpu" in
3956     i*86)
3957         CPUNAME=INTEL
3958         RTL_ARCH=x86
3959         PLATFORMID=dragonfly_x86
3960         ;;
3961     x86_64)
3962         CPUNAME=X86_64
3963         RTL_ARCH=X86_64
3964         PLATFORMID=dragonfly_x86_64
3965         ;;
3966     *)
3967         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3968         ;;
3969     esac
3970     ;;
3972 freebsd*)
3973     COM=GCC
3974     USING_X11=TRUE
3975     RTL_OS=FreeBSD
3976     OS=FREEBSD
3977     P_SEP=:
3979     case "$host_cpu" in
3980     i*86)
3981         CPUNAME=INTEL
3982         RTL_ARCH=x86
3983         PLATFORMID=freebsd_x86
3984         ;;
3985     x86_64|amd64)
3986         CPUNAME=X86_64
3987         RTL_ARCH=X86_64
3988         PLATFORMID=freebsd_x86_64
3989         ;;
3990     *)
3991         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3992         ;;
3993     esac
3994     ;;
3996 kfreebsd*)
3997     COM=GCC
3998     USING_X11=TRUE
3999     OS=LINUX
4000     RTL_OS=kFreeBSD
4001     P_SEP=:
4003     case "$host_cpu" in
4005     i*86)
4006         CPUNAME=INTEL
4007         RTL_ARCH=x86
4008         PLATFORMID=kfreebsd_x86
4009         ;;
4010     x86_64)
4011         CPUNAME=X86_64
4012         RTL_ARCH=X86_64
4013         PLATFORMID=kfreebsd_x86_64
4014         ;;
4015     *)
4016         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4017         ;;
4018     esac
4019     ;;
4021 linux-gnu*)
4022     COM=GCC
4023     USING_X11=TRUE
4024     OS=LINUX
4025     RTL_OS=Linux
4026     P_SEP=:
4028     case "$host_cpu" in
4030     aarch64)
4031         CPUNAME=AARCH64
4032         PLATFORMID=linux_aarch64
4033         RTL_ARCH=AARCH64
4034         ;;
4035     alpha)
4036         CPUNAME=AXP
4037         RTL_ARCH=ALPHA
4038         PLATFORMID=linux_alpha
4039         ;;
4040     arm*)
4041         CPUNAME=ARM
4042         EPM_FLAGS="-a arm"
4043         RTL_ARCH=ARM_EABI
4044         PLATFORMID=linux_arm_eabi
4045         case "$host_cpu" in
4046         arm*-linux)
4047             RTL_ARCH=ARM_OABI
4048             PLATFORMID=linux_arm_oabi
4049             ;;
4050         esac
4051         ;;
4052     hppa)
4053         CPUNAME=HPPA
4054         RTL_ARCH=HPPA
4055         EPM_FLAGS="-a hppa"
4056         PLATFORMID=linux_hppa
4057         ;;
4058     i*86)
4059         CPUNAME=INTEL
4060         RTL_ARCH=x86
4061         PLATFORMID=linux_x86
4062         ;;
4063     ia64)
4064         CPUNAME=IA64
4065         RTL_ARCH=IA64
4066         PLATFORMID=linux_ia64
4067         ;;
4068     mips)
4069         CPUNAME=GODSON
4070         RTL_ARCH=MIPS_EB
4071         EPM_FLAGS="-a mips"
4072         PLATFORMID=linux_mips_eb
4073         ;;
4074     mips64)
4075         CPUNAME=GODSON64
4076         RTL_ARCH=MIPS64_EB
4077         EPM_FLAGS="-a mips64"
4078         PLATFORMID=linux_mips64_eb
4079         ;;
4080     mips64el)
4081         CPUNAME=GODSON64
4082         RTL_ARCH=MIPS64_EL
4083         EPM_FLAGS="-a mips64el"
4084         PLATFORMID=linux_mips64_el
4085         ;;
4086     mipsel)
4087         CPUNAME=GODSON
4088         RTL_ARCH=MIPS_EL
4089         EPM_FLAGS="-a mipsel"
4090         PLATFORMID=linux_mips_el
4091         ;;
4092     m68k)
4093         CPUNAME=M68K
4094         RTL_ARCH=M68K
4095         PLATFORMID=linux_m68k
4096         ;;
4097     powerpc)
4098         CPUNAME=POWERPC
4099         RTL_ARCH=PowerPC
4100         PLATFORMID=linux_powerpc
4101         ;;
4102     powerpc64)
4103         CPUNAME=POWERPC64
4104         RTL_ARCH=PowerPC_64
4105         PLATFORMID=linux_powerpc64
4106         ;;
4107     powerpc64le)
4108         CPUNAME=POWERPC64
4109         RTL_ARCH=PowerPC_64_LE
4110         PLATFORMID=linux_powerpc64_le
4111         ;;
4112     sparc)
4113         CPUNAME=SPARC
4114         RTL_ARCH=SPARC
4115         PLATFORMID=linux_sparc
4116         ;;
4117     sparc64)
4118         CPUNAME=SPARC64
4119         RTL_ARCH=SPARC64
4120         PLATFORMID=linux_sparc64
4121         ;;
4122     s390)
4123         CPUNAME=S390
4124         RTL_ARCH=S390
4125         PLATFORMID=linux_s390
4126         ;;
4127     s390x)
4128         CPUNAME=S390X
4129         RTL_ARCH=S390x
4130         PLATFORMID=linux_s390x
4131         ;;
4132     x86_64)
4133         CPUNAME=X86_64
4134         RTL_ARCH=X86_64
4135         PLATFORMID=linux_x86_64
4136         ;;
4137     *)
4138         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4139         ;;
4140     esac
4141     ;;
4143 linux-android*)
4144     COM=GCC
4145     USING_X11=
4146     OS=ANDROID
4147     RTL_OS=Android
4148     P_SEP=:
4150     case "$host_cpu" in
4152     arm|armel)
4153         CPUNAME=ARM
4154         RTL_ARCH=ARM_EABI
4155         PLATFORMID=android_arm_eabi
4156         ;;
4157     aarch64)
4158         CPUNAME=AARCH64
4159         RTL_ARCH=AARCH64
4160         PLATFORMID=android_aarch64
4161         ;;
4162     mips|mipsel)
4163         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4164         RTL_ARCH=MIPS_EL
4165         PLATFORMID=android_mips_el
4166         ;;
4167     i*86)
4168         CPUNAME=INTEL
4169         RTL_ARCH=x86
4170         PLATFORMID=android_x86
4171         ;;
4172     *)
4173         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4174         ;;
4175     esac
4176     ;;
4178 *netbsd*)
4179     COM=GCC
4180     USING_X11=TRUE
4181     OS=NETBSD
4182     RTL_OS=NetBSD
4183     P_SEP=:
4185     case "$host_cpu" in
4186     i*86)
4187         CPUNAME=INTEL
4188         RTL_ARCH=x86
4189         PLATFORMID=netbsd_x86
4190         ;;
4191     powerpc)
4192         CPUNAME=POWERPC
4193         RTL_ARCH=PowerPC
4194         PLATFORMID=netbsd_powerpc
4195         ;;
4196     sparc)
4197         CPUNAME=SPARC
4198         RTL_ARCH=SPARC
4199         PLATFORMID=netbsd_sparc
4200         ;;
4201     x86_64)
4202         CPUNAME=X86_64
4203         RTL_ARCH=X86_64
4204         PLATFORMID=netbsd_x86_64
4205         ;;
4206     *)
4207         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4208         ;;
4209     esac
4210     ;;
4212 openbsd*)
4213     COM=GCC
4214     USING_X11=TRUE
4215     OS=OPENBSD
4216     RTL_OS=OpenBSD
4217     P_SEP=:
4219     case "$host_cpu" in
4220     i*86)
4221         CPUNAME=INTEL
4222         RTL_ARCH=x86
4223         PLATFORMID=openbsd_x86
4224         ;;
4225     x86_64)
4226         CPUNAME=X86_64
4227         RTL_ARCH=X86_64
4228         PLATFORMID=openbsd_x86_64
4229         ;;
4230     *)
4231         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4232         ;;
4233     esac
4234     SOLARINC="$SOLARINC -I/usr/local/include"
4235     ;;
4237 solaris*)
4238     COM=GCC
4239     USING_X11=TRUE
4240     OS=SOLARIS
4241     RTL_OS=Solaris
4242     P_SEP=:
4244     case "$host_cpu" in
4245     i*86)
4246         CPUNAME=INTEL
4247         RTL_ARCH=x86
4248         PLATFORMID=solaris_x86
4249         ;;
4250     sparc)
4251         CPUNAME=SPARC
4252         RTL_ARCH=SPARC
4253         PLATFORMID=solaris_sparc
4254         ;;
4255     sparc64)
4256         CPUNAME=SPARC64
4257         RTL_ARCH=SPARC64
4258         PLATFORMID=solaris_sparc64
4259         ;;
4260     *)
4261         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4262         ;;
4263     esac
4264     SOLARINC="$SOLARINC -I/usr/local/include"
4265     ;;
4268     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4269     ;;
4270 esac
4272 if test "$with_x" = "no"; then
4273     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4276 ENABLE_HEADLESS=""
4277 if test "$enable_gui" = "no"; then
4278     if test "$USING_X11" != TRUE; then
4279         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4280     fi
4281     USING_X11=
4282     ENABLE_HEADLESS=TRUE
4283     AC_DEFINE(HAVE_FEATURE_UI,0)
4284     test_cairo=yes
4286 AC_SUBST(ENABLE_HEADLESS)
4288 WORKDIR="${BUILDDIR}/workdir"
4289 INSTDIR="${BUILDDIR}/instdir"
4290 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4291 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4292 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4293 AC_SUBST(COM)
4294 AC_SUBST(CPUNAME)
4295 AC_SUBST(RTL_OS)
4296 AC_SUBST(RTL_ARCH)
4297 AC_SUBST(EPM_FLAGS)
4298 AC_SUBST(USING_X11)
4299 AC_SUBST([INSTDIR])
4300 AC_SUBST([INSTROOT])
4301 AC_SUBST([INSTROOTBASE])
4302 AC_SUBST(OS)
4303 AC_SUBST(P_SEP)
4304 AC_SUBST(WORKDIR)
4305 AC_SUBST(PLATFORMID)
4306 AC_SUBST(WINDOWS_X64)
4307 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4309 dnl ===================================================================
4310 dnl Test which package format to use
4311 dnl ===================================================================
4312 AC_MSG_CHECKING([which package format to use])
4313 if test -n "$with_package_format" -a "$with_package_format" != no; then
4314     for i in $with_package_format; do
4315         case "$i" in
4316         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4317             ;;
4318         *)
4319             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4320 aix - AIX software distribution
4321 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4322 deb - Debian software distribution
4323 pkg - Solaris software distribution
4324 rpm - RedHat software distribution
4326 LibreOffice additionally supports:
4327 archive - .tar.gz or .zip
4328 dmg - Mac OS X .dmg
4329 installed - installation tree
4330 msi - Windows .msi
4331         ])
4332             ;;
4333         esac
4334     done
4335     PKGFORMAT="$with_package_format"
4336     AC_MSG_RESULT([$PKGFORMAT])
4337 else
4338     PKGFORMAT=
4339     AC_MSG_RESULT([none])
4341 AC_SUBST(PKGFORMAT)
4343 dnl ===================================================================
4344 dnl Set up a different compiler to produce tools to run on the build
4345 dnl machine when doing cross-compilation
4346 dnl ===================================================================
4348 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4349 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4350 if test "$cross_compiling" = "yes"; then
4351     AC_MSG_CHECKING([for BUILD platform configuration])
4352     echo
4353     rm -rf CONF-FOR-BUILD config_build.mk
4354     mkdir CONF-FOR-BUILD
4355     # Here must be listed all files needed when running the configure script. In particular, also
4356     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4357     # keep them in the same order as there.
4358     (cd $SRC_ROOT && tar cf - \
4359         config.guess \
4360         bin/get_config_variables \
4361         solenv/bin/getcompver.awk \
4362         solenv/inc/langlist.mk \
4363         download.lst \
4364         config_host.mk.in \
4365         config_host_lang.mk.in \
4366         Makefile.in \
4367         lo.xcent.in \
4368         bin/bffvalidator.sh.in \
4369         bin/odfvalidator.sh.in \
4370         bin/officeotron.sh.in \
4371         instsetoo_native/util/openoffice.lst.in \
4372         config_host/*.in \
4373         sysui/desktop/macosx/Info.plist.in) \
4374     | (cd CONF-FOR-BUILD && tar xf -)
4375     cp configure CONF-FOR-BUILD
4376     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4377     (
4378     unset COM USING_X11 OS CPUNAME
4379     unset CC CXX SYSBASE CFLAGS
4380     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4381     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4382     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4383     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4384     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4385     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4386     cd CONF-FOR-BUILD
4387     sub_conf_opts=""
4388     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4389     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4390     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4391     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4392     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4393     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4394     # Don't bother having configure look for stuff not needed for the build platform anyway
4395     ./configure \
4396         --disable-cups \
4397         --disable-gtk3 \
4398         --disable-pdfimport \
4399         --disable-postgresql-sdbc \
4400         --with-parallelism="$with_parallelism" \
4401         --without-doxygen \
4402         --without-java \
4403         $sub_conf_opts \
4404         --srcdir=$srcdir \
4405         2>&1 | sed -e 's/^/    /'
4406     test -f ./config_host.mk 2>/dev/null || exit
4407     cp config_host.mk ../config_build.mk
4408     cp config_host_lang.mk ../config_build_lang.mk
4409     mv config.log ../config.Build.log
4410     mkdir -p ../config_build
4411     mv config_host/*.h ../config_build
4412     . ./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
4414     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
4415         VV='$'$V
4416         VV=`eval "echo $VV"`
4417         if test -n "$VV"; then
4418             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4419             echo "$line" >>build-config
4420         fi
4421     done
4423     for V in INSTDIR INSTROOT WORKDIR; do
4424         VV='$'$V
4425         VV=`eval "echo $VV"`
4426         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4427         if test -n "$VV"; then
4428             line="${V}_FOR_BUILD='$VV'"
4429             echo "$line" >>build-config
4430         fi
4431     done
4433     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4434     echo "$line" >>build-config
4436     )
4437     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4438     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])
4439     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4440              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4442     eval `cat CONF-FOR-BUILD/build-config`
4444     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4446     rm -rf CONF-FOR-BUILD
4447 else
4448     OS_FOR_BUILD="$OS"
4449     CC_FOR_BUILD="$CC"
4450     CXX_FOR_BUILD="$CXX"
4451     INSTDIR_FOR_BUILD="$INSTDIR"
4452     INSTROOT_FOR_BUILD="$INSTROOT"
4453     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4454     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4455     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4456     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4457     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4458     WORKDIR_FOR_BUILD="$WORKDIR"
4460 AC_SUBST(OS_FOR_BUILD)
4461 AC_SUBST(INSTDIR_FOR_BUILD)
4462 AC_SUBST(INSTROOT_FOR_BUILD)
4463 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4464 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4465 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4466 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4467 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4468 AC_SUBST(WORKDIR_FOR_BUILD)
4470 dnl ===================================================================
4471 dnl Check for syslog header
4472 dnl ===================================================================
4473 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4475 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4476 dnl ===================================================================
4477 AC_MSG_CHECKING([whether to turn warnings to errors])
4478 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4479     ENABLE_WERROR="TRUE"
4480     AC_MSG_RESULT([yes])
4481 else
4482     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4483         ENABLE_WERROR="TRUE"
4484         AC_MSG_RESULT([yes])
4485     else
4486         AC_MSG_RESULT([no])
4487     fi
4489 AC_SUBST(ENABLE_WERROR)
4491 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4492 dnl ===================================================================
4493 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4494 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4495     ASSERT_ALWAYS_ABORT="TRUE"
4496     AC_MSG_RESULT([yes])
4497 else
4498     ASSERT_ALWAYS_ABORT="FALSE"
4499     AC_MSG_RESULT([no])
4501 AC_SUBST(ASSERT_ALWAYS_ABORT)
4503 # Determine whether to use ooenv for the instdir installation
4504 # ===================================================================
4505 if test $_os != "WINNT" -a $_os != "Darwin"; then
4506     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4507     if test "$enable_ooenv" = "no"; then
4508         AC_MSG_RESULT([no])
4509     else
4510         ENABLE_OOENV="TRUE"
4511         AC_MSG_RESULT([yes])
4512     fi
4514 AC_SUBST(ENABLE_OOENV)
4516 if test "$USING_X11" != TRUE; then
4517     # be sure to do not mess with unneeded stuff
4518     test_randr=no
4519     test_xrender=no
4520     test_cups=no
4521     test_dbus=no
4522     test_gtk=no
4523     build_gstreamer_1_0=no
4524     build_gstreamer_0_10=no
4525     test_kde4=no
4526     test_qt5=no
4527     enable_cairo_canvas=no
4530 dnl ===================================================================
4531 dnl check for cups support
4532 dnl ===================================================================
4533 ENABLE_CUPS=""
4535 if test "$enable_cups" = "no"; then
4536     test_cups=no
4539 AC_MSG_CHECKING([whether to enable CUPS support])
4540 if test "$test_cups" = "yes"; then
4541     ENABLE_CUPS="TRUE"
4542     AC_MSG_RESULT([yes])
4544     AC_MSG_CHECKING([whether cups support is present])
4545     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4546     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4547     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4548         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4549     fi
4551 else
4552     AC_MSG_RESULT([no])
4555 AC_SUBST(ENABLE_CUPS)
4557 # fontconfig checks
4558 if test "$test_fontconfig" = "yes"; then
4559     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4560     SYSTEM_FONTCONFIG=TRUE
4561     FilterLibs "${FONTCONFIG_LIBS}"
4562     FONTCONFIG_LIBS="${filteredlibs}"
4564 AC_SUBST(FONTCONFIG_CFLAGS)
4565 AC_SUBST(FONTCONFIG_LIBS)
4566 AC_SUBST([SYSTEM_FONTCONFIG])
4568 dnl whether to find & fetch external tarballs?
4569 dnl ===================================================================
4570 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4571    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4572        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4573    else
4574        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4575    fi
4577 if test -z "$TARFILE_LOCATION"; then
4578     if test -d "$SRC_ROOT/src" ; then
4579         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4580         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4581     fi
4582     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4583 else
4584     AbsolutePath "$TARFILE_LOCATION"
4585     PathFormat "${absolute_path}"
4586     TARFILE_LOCATION="${formatted_path}"
4588 AC_SUBST(TARFILE_LOCATION)
4590 AC_MSG_CHECKING([whether we want to fetch tarballs])
4591 if test "$enable_fetch_external" != "no"; then
4592     if test "$with_all_tarballs" = "yes"; then
4593         AC_MSG_RESULT([yes, all of them])
4594         DO_FETCH_TARBALLS="ALL"
4595     else
4596         AC_MSG_RESULT([yes, if we use them])
4597         DO_FETCH_TARBALLS="TRUE"
4598     fi
4599 else
4600     AC_MSG_RESULT([no])
4601     DO_FETCH_TARBALLS=
4603 AC_SUBST(DO_FETCH_TARBALLS)
4605 AC_MSG_CHECKING([whether to build help])
4606 HELP_COMMON_ONLY=FALSE
4607 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4608     BUILD_TYPE="$BUILD_TYPE HELP"
4609     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4610     if test "$with_help" = "common" ; then
4611         HELP_COMMON_ONLY=TRUE
4612         AC_MSG_RESULT([common only])
4613     else
4614         SCPDEFS="$SCPDEFS -DWITH_HELP"
4615         AC_MSG_RESULT([yes])
4616     fi
4617 else
4618     AC_MSG_RESULT([no])
4620 AC_SUBST(HELP_COMMON_ONLY)
4622 dnl Test whether to include MySpell dictionaries
4623 dnl ===================================================================
4624 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4625 if test "$with_myspell_dicts" = "yes"; then
4626     AC_MSG_RESULT([yes])
4627     WITH_MYSPELL_DICTS=TRUE
4628     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4629     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4630 else
4631     AC_MSG_RESULT([no])
4632     WITH_MYSPELL_DICTS=
4634 AC_SUBST(WITH_MYSPELL_DICTS)
4636 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4637 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4638     if test "$with_system_dicts" = yes; then
4639         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4640     fi
4641     with_system_dicts=no
4644 AC_MSG_CHECKING([whether to use dicts from external paths])
4645 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4646     AC_MSG_RESULT([yes])
4647     SYSTEM_DICTS=TRUE
4648     AC_MSG_CHECKING([for spelling dictionary directory])
4649     if test -n "$with_external_dict_dir"; then
4650         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4651     else
4652         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4653         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4654             DICT_SYSTEM_DIR=file:///usr/share/myspell
4655         fi
4656     fi
4657     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4658     AC_MSG_CHECKING([for hyphenation patterns directory])
4659     if test -n "$with_external_hyph_dir"; then
4660         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4661     else
4662         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4663     fi
4664     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4665     AC_MSG_CHECKING([for thesaurus directory])
4666     if test -n "$with_external_thes_dir"; then
4667         THES_SYSTEM_DIR=file://$with_external_thes_dir
4668     else
4669         THES_SYSTEM_DIR=file:///usr/share/mythes
4670     fi
4671     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4672 else
4673     AC_MSG_RESULT([no])
4674     SYSTEM_DICTS=
4676 AC_SUBST(SYSTEM_DICTS)
4677 AC_SUBST(DICT_SYSTEM_DIR)
4678 AC_SUBST(HYPH_SYSTEM_DIR)
4679 AC_SUBST(THES_SYSTEM_DIR)
4681 dnl ===================================================================
4682 dnl enable pch by default on windows
4683 dnl enable it explicitly otherwise
4684 ENABLE_PCH=""
4685 if test "$enable_pch" = yes -a "$enable_compiler_plugins" = yes; then
4686     if test -z "$libo_fuzzed_enable_pch"; then
4687         AC_MSG_ERROR([--enable-pch cannot be used with --enable-compiler-plugins])
4688     else
4689         AC_MSG_NOTICE([Resetting --enable-pch=no])
4690         enable_pch=no
4691     fi
4694 AC_MSG_CHECKING([whether to enable pch feature])
4695 if test "$enable_pch" != "no"; then
4696     if test "$_os" = "WINNT"; then
4697         ENABLE_PCH="TRUE"
4698         AC_MSG_RESULT([yes])
4699     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4700         ENABLE_PCH="TRUE"
4701         AC_MSG_RESULT([yes])
4702     elif test -n "$enable_pch"; then
4703         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4704     else
4705         AC_MSG_RESULT([no])
4706     fi
4707 else
4708     AC_MSG_RESULT([no])
4710 AC_SUBST(ENABLE_PCH)
4712 TAB=`printf '\t'`
4714 AC_MSG_CHECKING([the GNU Make version])
4715 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4716 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4717 if test "$_make_longver" -ge "038200"; then
4718     AC_MSG_RESULT([$GNUMAKE $_make_version])
4720 elif test "$_make_longver" -ge "038100"; then
4721     if test "$build_os" = "cygwin"; then
4722         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4723     fi
4724     AC_MSG_RESULT([$GNUMAKE $_make_version])
4726     dnl ===================================================================
4727     dnl Search all the common names for sha1sum
4728     dnl ===================================================================
4729     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4730     if test -z "$SHA1SUM"; then
4731         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
4732     elif test "$SHA1SUM" = "openssl"; then
4733         SHA1SUM="openssl sha1"
4734     fi
4735     AC_MSG_CHECKING([for GNU Make bug 20033])
4736     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4737     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4738 A := \$(wildcard *.a)
4740 .PHONY: all
4741 all: \$(A:.a=.b)
4742 <TAB>@echo survived bug20033.
4744 .PHONY: setup
4745 setup:
4746 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4748 define d1
4749 @echo lala \$(1)
4750 @sleep 1
4751 endef
4753 define d2
4754 @echo tyty \$(1)
4755 @sleep 1
4756 endef
4758 %.b : %.a
4759 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4760 <TAB>\$(call d1,\$(CHECKSUM)),\
4761 <TAB>\$(call d2,\$(CHECKSUM)))
4763     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4764         no_parallelism_make="YES"
4765         AC_MSG_RESULT([yes, disable parallelism])
4766     else
4767         AC_MSG_RESULT([no, keep parallelism enabled])
4768     fi
4769     rm -rf $TESTGMAKEBUG20033
4770 else
4771     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4774 # find if gnumake support file function
4775 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
4776 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4777 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4778     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
4780 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4781 \$(file >test.txt,Success )
4783 .PHONY: all
4784 all:
4785 <TAB>@cat test.txt
4788 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4789 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4790     HAVE_GNUMAKE_FILE_FUNC=TRUE
4791     AC_MSG_RESULT([yes])
4792 else
4793     AC_MSG_RESULT([no])
4795 rm -rf $TESTGMAKEFILEFUNC
4796 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4797 AC_SUBST(GNUMAKE_WIN_NATIVE)
4799 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
4800 STALE_MAKE=
4801 if test "$_make_ver_check" = ""; then
4802    STALE_MAKE=TRUE
4805 HAVE_LD_HASH_STYLE=FALSE
4806 WITH_LINKER_HASH_STYLE=
4807 AC_MSG_CHECKING([for --hash-style gcc linker support])
4808 if test "$GCC" = "yes"; then
4809     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4810         hash_styles="gnu sysv"
4811     elif test "$with_linker_hash_style" = "no"; then
4812         hash_styles=
4813     else
4814         hash_styles="$with_linker_hash_style"
4815     fi
4817     for hash_style in $hash_styles; do
4818         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4819         hash_style_ldflags_save=$LDFLAGS
4820         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
4822         AC_RUN_IFELSE([AC_LANG_PROGRAM(
4823             [
4824 #include <stdio.h>
4825             ],[
4826 printf ("");
4827             ])],
4828             [
4829                   HAVE_LD_HASH_STYLE=TRUE
4830                   WITH_LINKER_HASH_STYLE=$hash_style
4831             ],
4832             [HAVE_LD_HASH_STYLE=FALSE],
4833             [HAVE_LD_HASH_STYLE=FALSE])
4834         LDFLAGS=$hash_style_ldflags_save
4835     done
4837     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
4838         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
4839     else
4840         AC_MSG_RESULT( no )
4841     fi
4842     LDFLAGS=$hash_style_ldflags_save
4843 else
4844     AC_MSG_RESULT( no )
4846 AC_SUBST(HAVE_LD_HASH_STYLE)
4847 AC_SUBST(WITH_LINKER_HASH_STYLE)
4849 dnl ===================================================================
4850 dnl Check whether there's a Perl version available.
4851 dnl ===================================================================
4852 if test -z "$with_perl_home"; then
4853     AC_PATH_PROG(PERL, perl)
4854 else
4855     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
4856     _perl_path="$with_perl_home/bin/perl"
4857     if test -x "$_perl_path"; then
4858         PERL=$_perl_path
4859     else
4860         AC_MSG_ERROR([$_perl_path not found])
4861     fi
4864 dnl ===================================================================
4865 dnl Testing for Perl version 5 or greater.
4866 dnl $] is the Perl version variable, it is returned as an integer
4867 dnl ===================================================================
4868 if test "$PERL"; then
4869     AC_MSG_CHECKING([the Perl version])
4870     ${PERL} -e "exit($]);"
4871     _perl_version=$?
4872     if test "$_perl_version" -lt 5; then
4873         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
4874     fi
4875     AC_MSG_RESULT([Perl $_perl_version])
4876 else
4877     AC_MSG_ERROR([Perl not found, install Perl 5])
4880 dnl ===================================================================
4881 dnl Testing for required Perl modules
4882 dnl ===================================================================
4884 AC_MSG_CHECKING([for required Perl modules])
4885 if `$PERL -e 'use Cwd; use Digest::MD5'>/dev/null 2>&1`; then
4886     AC_MSG_RESULT([all modules found])
4887 else
4888     AC_MSG_RESULT([failed to find some modules])
4889     # Find out which modules are missing.
4890     if ! `$PERL -e 'use Cwd;'>/dev/null 2>&1`; then
4891         missing_perl_modules="$missing_perl_modules Cwd"
4892     fi
4893     if ! `$PERL -e 'use Digest::MD5;'>/dev/null 2>&1`; then
4894         missing_perl_modules="$missing_perl_modules Digest::MD5"
4895     fi
4896        AC_MSG_ERROR([
4897     The missing Perl modules are: $missing_perl_modules
4898     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
4901 dnl ===================================================================
4902 dnl Check for pkg-config
4903 dnl ===================================================================
4904 if test "$_os" != "WINNT"; then
4905     PKG_PROG_PKG_CONFIG
4908 if test "$_os" != "WINNT"; then
4910     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
4911     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
4912     # explicitly. Or put /path/to/compiler in PATH yourself.
4914     # Use wrappers for LTO
4915     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
4916         AC_CHECK_TOOL(AR,gcc-ar)
4917         AC_CHECK_TOOL(NM,gcc-nm)
4918         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
4919     else
4920         AC_CHECK_TOOL(AR,ar)
4921         AC_CHECK_TOOL(NM,nm)
4922         AC_CHECK_TOOL(RANLIB,ranlib)
4923     fi
4924     AC_CHECK_TOOL(OBJDUMP,objdump)
4925     AC_CHECK_TOOL(READELF,readelf)
4926     AC_CHECK_TOOL(STRIP,strip)
4927     if test "$_os" = "WINNT"; then
4928         AC_CHECK_TOOL(DLLTOOL,dlltool)
4929         AC_CHECK_TOOL(WINDRES,windres)
4930     fi
4932 AC_SUBST(AR)
4933 AC_SUBST(DLLTOOL)
4934 AC_SUBST(NM)
4935 AC_SUBST(OBJDUMP)
4936 AC_SUBST(PKG_CONFIG)
4937 AC_SUBST(RANLIB)
4938 AC_SUBST(READELF)
4939 AC_SUBST(STRIP)
4940 AC_SUBST(WINDRES)
4942 dnl ===================================================================
4943 dnl pkg-config checks on Mac OS X
4944 dnl ===================================================================
4946 if test $_os = Darwin; then
4947     AC_MSG_CHECKING([for bogus pkg-config])
4948     if test -n "$PKG_CONFIG"; then
4949         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
4950             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
4951         else
4952             if test "$enable_bogus_pkg_config" = "yes"; then
4953                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
4954             else
4955                 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.])
4956             fi
4957         fi
4958     else
4959         AC_MSG_RESULT([no, good])
4960     fi
4963 find_csc()
4965     # Return value: $csctest
4967     unset csctest
4969     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
4970     if test -n "$regvalue"; then
4971         csctest=$regvalue
4972         return
4973     fi
4976 find_al()
4978     # Return value: $altest
4980     unset altest
4982     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
4983         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
4984         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
4985             altest=$regvalue
4986             return
4987         fi
4988     done
4990     # We need this additional check to detect 4.6.1 or above.
4991     for ver in 4.7.1 4.7 4.6.2 4.6.1; do
4992         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
4993         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
4994             altest=$regvalue
4995             return
4996         fi
4998         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/WOW6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools"
4999         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5000             altest=$regvalue
5001             return
5002         fi
5003     done
5006 find_dotnetsdk()
5008     # Return value: $frametest (that's a silly name...)
5010     unset frametest
5012     for ver in 1.1 2.0; do
5013         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
5014         if test -n "$regvalue"; then
5015             frametest=$regvalue
5016             return
5017         fi
5018     done
5021 find_dotnetsdk46()
5023     unset frametest
5025     for ver in 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5026         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5027         if test -n "$regvalue"; then
5028             frametest=$regvalue
5029             return
5030         fi
5031         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5032         if test -n "$regvalue"; then
5033             frametest=$regvalue
5034             return
5035         fi
5036     done
5039 find_winsdk_version()
5041     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5042     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5044     unset winsdktest winsdkbinsubdir winsdklibsubdir
5046     case "$1" in
5047     7.*)
5048         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5049         if test -n "$regvalue"; then
5050             winsdktest=$regvalue
5051             winsdklibsubdir=.
5052             return
5053         fi
5054         ;;
5055     8.0|8.0A)
5056         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5057         if test -n "$regvalue"; then
5058             winsdktest=$regvalue
5059             winsdklibsubdir=win8
5060             return
5061         fi
5062         ;;
5063     8.1|8.1A)
5064         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5065         if test -n "$regvalue"; then
5066             winsdktest=$regvalue
5067             winsdklibsubdir=winv6.3
5068             return
5069         fi
5070         ;;
5071     10.0)
5072         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5073         if test -n "$regvalue"; then
5074             winsdktest=$regvalue
5075             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5076             if test -n "$regvalue"; then
5077                 winsdkbinsubdir="$regvalue".0
5078             fi
5079             winsdklibsubdir=$regvalue
5080             if test "$regvalue" = "10.0.14393"; then
5081                 winsdklibsubdir="10.0.14393.0"
5082             elif test "$regvalue" = "10.0.16299"; then
5083                 winsdklibsubdir="10.0.16299.0"
5084             elif test "$regvalue" = "10.0.15063"; then
5085                 winsdklibsubdir="10.0.15063.0"
5086             elif test "$regvalue" = "10.0.17134"; then
5087                 winsdklibsubdir="$regvalue.0"
5088             fi
5089             return
5090         fi
5091         ;;
5092     esac
5095 find_winsdk()
5097     # Return value: From find_winsdk_version
5099     unset winsdktest
5101     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5102         find_winsdk_version $ver
5103         if test -n "$winsdktest"; then
5104             return
5105         fi
5106     done
5109 find_msms()
5111     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5112     if test $VCVER = 150; then
5113         my_msm_files="Microsoft_VC141_CRT_x86.msm ${my_msm_files}"
5114     fi
5115     AC_MSG_CHECKING([for ${my_msm_files}])
5116     msmdir=
5117     for ver in 14.0 15.0; do
5118         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5119         if test -n "$regvalue"; then
5120             for f in ${my_msm_files}; do
5121                 if test -e "$regvalue/${f}"; then
5122                     msmdir=$regvalue
5123                     break
5124                 fi
5125             done
5126         fi
5127     done
5128     dnl Is the following fallback really necessary, or was it added in response
5129     dnl to never having started Visual Studio on a given machine, so the
5130     dnl registry keys checked above had presumably not yet been created?
5131     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5132     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5133     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5134     dnl expanding to "C:\Program Files\Common Files"), which would need
5135     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5136     dnl obtain its value from cygwin:
5137     if test -z "$msmdir"; then
5138         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5139         for f in ${my_msm_files}; do
5140             if test -e "$my_msm_dir/${f}"; then
5141                 msmdir=$my_msm_dir
5142             fi
5143         done
5144     fi
5146     dnl Starting from MSVC 15.0, merge modules are located in different directory
5147     if test $VCVER = 150; then
5148         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5149             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])
5150             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5151             for f in ${my_msm_files}; do
5152                 if test -e "$my_msm_dir/${f}"; then
5153                     msmdir=$my_msm_dir
5154                     break
5155                 fi
5156             done
5157         done
5158     fi
5160     if test -n "$msmdir"; then
5161         msmdir=`cygpath -m "$msmdir"`
5162         AC_MSG_RESULT([$msmdir])
5163     else
5164         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5165             AC_MSG_ERROR([not found])
5166         else
5167             AC_MSG_WARN([not found])
5168             add_warning "MSM none of ${my_msm_files} found"
5169         fi
5170     fi
5173 find_msvc_x64_dlls()
5175     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5176     if test "$VCVER" = 150; then
5177         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5178             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT])
5179             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5180                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5181                 break
5182             fi
5183             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5184                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5185                 break
5186             fi
5187         done
5188     fi
5189     msvcdlls="msvcp140.dll vcruntime140.dll"
5190     for dll in $msvcdlls; do
5191         if ! test -f "$msvcdllpath/$dll"; then
5192             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5193         fi
5194     done
5197 dnl =========================================
5198 dnl Check for the Windows  SDK.
5199 dnl =========================================
5200 if test "$_os" = "WINNT"; then
5201     AC_MSG_CHECKING([for Windows SDK])
5202     if test "$build_os" = "cygwin"; then
5203         find_winsdk
5204         WINDOWS_SDK_HOME=$winsdktest
5206         # normalize if found
5207         if test -n "$WINDOWS_SDK_HOME"; then
5208             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5209             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5210         fi
5212         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5213     fi
5215     if test -n "$WINDOWS_SDK_HOME"; then
5216         # Remove a possible trailing backslash
5217         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5219         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5220              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5221              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5222             have_windows_sdk_headers=yes
5223         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5224              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5225              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5226             have_windows_sdk_headers=yes
5227         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5228              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5229              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5230             have_windows_sdk_headers=yes
5231         else
5232             have_windows_sdk_headers=no
5233         fi
5235         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5236             have_windows_sdk_libs=yes
5237         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5238             have_windows_sdk_libs=yes
5239         else
5240             have_windows_sdk_libs=no
5241         fi
5243         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5244             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5245 the  Windows SDK are installed.])
5246         fi
5247     fi
5249     if test -z "$WINDOWS_SDK_HOME"; then
5250         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5251     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
5252         WINDOWS_SDK_VERSION=70
5253         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
5254     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5255         WINDOWS_SDK_VERSION=80
5256         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5257     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5258         WINDOWS_SDK_VERSION=81
5259         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5260     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5261         WINDOWS_SDK_VERSION=10
5262         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5263     else
5264         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5265     fi
5266     PathFormat "$WINDOWS_SDK_HOME"
5267     WINDOWS_SDK_HOME="$formatted_path"
5268     if test "$build_os" = "cygwin"; then
5269         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5270         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5271             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5272         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5273             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5274         fi
5275     fi
5277     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5278     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5279     dnl but not in v8.0), so allow this to be overridden with a
5280     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5281     dnl and configuration error if no WiLangId.vbs is found would arguably be
5282     dnl better, but I do not know under which conditions exactly it is needed by
5283     dnl msiglobal.pm:
5284     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5285         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5286         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5287             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5288         fi
5289         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5290             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5291         fi
5292         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5293             AC_MSG_WARN([WiLangId.vbs not found - building translated packages will fail])
5294             add_warning "WiLangId.vbs not found - building translated packages will fail"
5295         fi
5296     fi
5298 AC_SUBST(WINDOWS_SDK_HOME)
5299 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5300 AC_SUBST(WINDOWS_SDK_VERSION)
5301 AC_SUBST(WINDOWS_SDK_WILANGID)
5303 if test "$build_os" = "cygwin"; then
5304     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5305     dnl dir, it also determines that dir's path w/o an arch segment if any,
5306     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5307     AC_MSG_CHECKING([for midl.exe])
5309     find_winsdk
5310     if test -n "$winsdkbinsubdir" \
5311         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5312     then
5313         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5314         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5315     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5316         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5317         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5318     elif test -f "$winsdktest/Bin/midl.exe"; then
5319         MIDL_PATH=$winsdktest/Bin
5320         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5321     fi
5322     if test ! -f "$MIDL_PATH/midl.exe"; then
5323         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5324     else
5325         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5326     fi
5328     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5329     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5331     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5332          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5333          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5334          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5335     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5336          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5337          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5338          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5339     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5340          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5341          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5342          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5343     else
5344         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5345     fi
5347     dnl Check csc.exe
5348     AC_MSG_CHECKING([for csc.exe])
5349     find_csc
5350     if test -f "$csctest/csc.exe"; then
5351         CSC_PATH="$csctest"
5352     fi
5353     if test ! -f "$CSC_PATH/csc.exe"; then
5354         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5355     else
5356         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5357     fi
5359     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5361     dnl Check al.exe
5362     AC_MSG_CHECKING([for al.exe])
5363     find_winsdk
5364     if test -n "$winsdkbinsubdir" \
5365         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5366     then
5367         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5368     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5369         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5370     elif test -f "$winsdktest/Bin/al.exe"; then
5371         AL_PATH="$winsdktest/Bin"
5372     fi
5374     if test -z "$AL_PATH"; then
5375         find_al
5376         if test -f "$altest/bin/al.exe"; then
5377             AL_PATH="$altest/bin"
5378         elif test -f "$altest/al.exe"; then
5379             AL_PATH="$altest"
5380         fi
5381     fi
5382     if test ! -f "$AL_PATH/al.exe"; then
5383         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5384     else
5385         AC_MSG_RESULT([$AL_PATH/al.exe])
5386     fi
5388     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5390     dnl Check mscoree.lib / .NET Framework dir
5391     AC_MSG_CHECKING(.NET Framework)
5392     find_dotnetsdk
5393     if test -f "$frametest/lib/mscoree.lib"; then
5394         DOTNET_FRAMEWORK_HOME="$frametest"
5395     else
5396         find_winsdk
5397         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5398             DOTNET_FRAMEWORK_HOME="$winsdktest"
5399         else
5400             find_dotnetsdk46
5401             PathFormat "$frametest"
5402             frametest="$formatted_path"
5403             if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5404                  DOTNET_FRAMEWORK_HOME="$frametest"
5405             fi
5406         fi
5407     fi
5409     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
5410         AC_MSG_ERROR([mscoree.lib not found])
5411     fi
5412     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5414     PathFormat "$MIDL_PATH"
5415     MIDL_PATH="$formatted_path"
5417     PathFormat "$AL_PATH"
5418     AL_PATH="$formatted_path"
5420     PathFormat "$DOTNET_FRAMEWORK_HOME"
5421     DOTNET_FRAMEWORK_HOME="$formatted_path"
5423     PathFormat "$CSC_PATH"
5424     CSC_PATH="$formatted_path"
5427 dnl ===================================================================
5428 dnl Check if stdc headers are available excluding MSVC.
5429 dnl ===================================================================
5430 if test "$_os" != "WINNT"; then
5431     AC_HEADER_STDC
5434 dnl ===================================================================
5435 dnl Testing for C++ compiler and version...
5436 dnl ===================================================================
5438 if test "$_os" != "WINNT"; then
5439     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5440     save_CXXFLAGS=$CXXFLAGS
5441     AC_PROG_CXX
5442     CXXFLAGS=$save_CXXFLAGS
5443 else
5444     if test -n "$CC" -a -z "$CXX"; then
5445         CXX="$CC"
5446     fi
5449 dnl At least MSVC 2015 Update 1 is known to sporadically emit warning C4592
5450 dnl ("implementation limitation" when defining OUStringLiteral variables in
5451 dnl vcl/source/app/IconThemeInfo.cxx), while Update 3 is known good, and it is
5452 dnl probably a good idea to require that anyway.  A reliable way to check for
5453 dnl MSVC 2015 Update 3 appears to be to check for support of C++17 nested
5454 dnl namespace definitions (which requires /std:c++latest to be enabled):
5455 if test "$COM" = MSC -a "$VCVER" = 140; then
5456     AC_MSG_CHECKING([whether MSVC 2015 compiler $MSVC_CXX is at least Update 3])
5457     save_CXX=$CXX
5458     save_CXXFLAGS=$CXXFLAGS
5459     CXX=$MSVC_CXX
5460     CXXFLAGS="$CXXFLAGS /std:c++latest"
5461     AC_LANG_PUSH([C++])
5462     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5463         namespace A::B {}
5464     ]])], [good=yes], [good=no])
5465     AC_LANG_POP([C++])
5466     CXX=$save_CXX
5467     CXXFLAGS=$save_CXXFLAGS
5468     AC_MSG_RESULT([$good])
5469     if test "$good" = no; then
5470         AC_MSG_ERROR([When using MSVC 2015, at least Update 3 must be installed])
5471     fi
5474 dnl check for GNU C++ compiler version
5475 if test "$GXX" = "yes"; then
5476     AC_MSG_CHECKING([the GNU C++ compiler version])
5478     _gpp_version=`$CXX -dumpversion`
5479     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5481     if test "$_gpp_majmin" -lt "401"; then
5482         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5483     else
5484         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5485     fi
5487     dnl see https://code.google.com/p/android/issues/detail?id=41770
5488     if test "$_gpp_majmin" -ge "401"; then
5489         glibcxx_threads=no
5490         AC_LANG_PUSH([C++])
5491         AC_REQUIRE_CPP
5492         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5493         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5494             #include <bits/c++config.h>]],[[
5495             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5496             && !defined(_GLIBCXX__PTHREADS) \
5497             && !defined(_GLIBCXX_HAS_GTHREADS)
5498             choke me
5499             #endif
5500         ]])],[AC_MSG_RESULT([yes])
5501         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5502         AC_LANG_POP([C++])
5503         if test $glibcxx_threads = yes; then
5504             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5505         fi
5506      fi
5508 AC_SUBST(BOOST_CXXFLAGS)
5511 # prefx CXX with ccache if needed
5513 if test "$CCACHE" != ""; then
5514     AC_MSG_CHECKING([whether $CXX is already ccached])
5515     AC_LANG_PUSH([C++])
5516     save_CXXFLAGS=$CXXFLAGS
5517     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5518     dnl an empty program will do, we're checking the compiler flags
5519     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5520                       [use_ccache=yes], [use_ccache=no])
5521     if test $use_ccache = yes; then
5522         AC_MSG_RESULT([yes])
5523     else
5524         CXX="$CCACHE $CXX"
5525         AC_MSG_RESULT([no])
5526     fi
5527     CXXFLAGS=$save_CXXFLAGS
5528     AC_LANG_POP([C++])
5531 dnl ===================================================================
5532 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5533 dnl ===================================================================
5535 if test "$_os" != "WINNT"; then
5536     AC_PROG_CXXCPP
5538     dnl Check whether there's a C pre-processor.
5539     AC_PROG_CPP
5543 dnl ===================================================================
5544 dnl Find integral type sizes and alignments
5545 dnl ===================================================================
5547 if test "$_os" != "WINNT"; then
5549 if test "$_os" == "iOS"; then
5550     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5551     ac_cv_sizeof_long=8
5552     ac_cv_sizeof_short=2
5553     ac_cv_sizeof_int=4
5554     ac_cv_sizeof_long_long=8
5555     ac_cv_sizeof_double=8
5556     ac_cv_sizeof_voidp=8
5557 else
5558     AC_CHECK_SIZEOF(long)
5559     AC_CHECK_SIZEOF(short)
5560     AC_CHECK_SIZEOF(int)
5561     AC_CHECK_SIZEOF(long long)
5562     AC_CHECK_SIZEOF(double)
5563     AC_CHECK_SIZEOF(void*)
5566     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5567     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5568     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5569     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5570     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5572     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5573     m4_pattern_allow([AC_CHECK_ALIGNOF])
5574     m4_ifdef([AC_CHECK_ALIGNOF],
5575         [
5576             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5577             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5578             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5579             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5580         ],
5581         [
5582             case "$_os-$host_cpu" in
5583             Linux-i686)
5584                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5585                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5586                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5587                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5588                 ;;
5589             Linux-x86_64)
5590                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5591                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5592                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5593                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5594                 ;;
5595             *)
5596                 if test -z "$ac_cv_alignof_short" -o \
5597                         -z "$ac_cv_alignof_int" -o \
5598                         -z "$ac_cv_alignof_long" -o \
5599                         -z "$ac_cv_alignof_double"; then
5600                    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.])
5601                 fi
5602                 ;;
5603             esac
5604         ])
5606     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5607     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5608     if test $ac_cv_sizeof_long -eq 8; then
5609         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5610     elif test $ac_cv_sizeof_double -eq 8; then
5611         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5612     else
5613         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5614     fi
5616     dnl Check for large file support
5617     AC_SYS_LARGEFILE
5618     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5619         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5620     fi
5621     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5622         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5623     fi
5624 else
5625     # Hardcode for MSVC
5626     SAL_TYPES_SIZEOFSHORT=2
5627     SAL_TYPES_SIZEOFINT=4
5628     SAL_TYPES_SIZEOFLONG=4
5629     SAL_TYPES_SIZEOFLONGLONG=8
5630     if test "$BITNESS_OVERRIDE" = ""; then
5631         SAL_TYPES_SIZEOFPOINTER=4
5632     else
5633         SAL_TYPES_SIZEOFPOINTER=8
5634     fi
5635     SAL_TYPES_ALIGNMENT2=2
5636     SAL_TYPES_ALIGNMENT4=4
5637     SAL_TYPES_ALIGNMENT8=8
5638     LFS_CFLAGS=''
5640 AC_SUBST(LFS_CFLAGS)
5642 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5643 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5644 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5645 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5646 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5647 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5648 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5649 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5651 dnl ===================================================================
5652 dnl Check whether to enable runtime optimizations
5653 dnl ===================================================================
5654 ENABLE_RUNTIME_OPTIMIZATIONS=
5655 AC_MSG_CHECKING([whether to enable runtime optimizations])
5656 if test -z "$enable_runtime_optimizations"; then
5657     for i in $CC; do
5658         case $i in
5659         -fsanitize=*)
5660             enable_runtime_optimizations=no
5661             break
5662             ;;
5663         esac
5664     done
5666 if test "$enable_runtime_optimizations" != no; then
5667     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5668     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5669     AC_MSG_RESULT([yes])
5670 else
5671     AC_MSG_RESULT([no])
5673 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5675 dnl ===================================================================
5676 dnl Check if valgrind headers are available
5677 dnl ===================================================================
5678 ENABLE_VALGRIND=
5679 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
5680     prev_cppflags=$CPPFLAGS
5681     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5682     # or where does it come from?
5683     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5684     AC_CHECK_HEADER([valgrind/valgrind.h],
5685         [ENABLE_VALGRIND=TRUE])
5686     CPPFLAGS=$prev_cppflags
5688 AC_SUBST([ENABLE_VALGRIND])
5689 if test -z "$ENABLE_VALGRIND"; then
5690     if test "$with_valgrind" = yes; then
5691         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
5692     fi
5693     VALGRIND_CFLAGS=
5695 AC_SUBST([VALGRIND_CFLAGS])
5698 dnl ===================================================================
5699 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5700 dnl ===================================================================
5702 # We need at least the sys/sdt.h include header.
5703 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5704 if test "$SDT_H_FOUND" = "TRUE"; then
5705     # Found sys/sdt.h header, now make sure the c++ compiler works.
5706     # Old g++ versions had problems with probes in constructors/destructors.
5707     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5708     AC_LANG_PUSH([C++])
5709     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5710     #include <sys/sdt.h>
5711     class ProbeClass
5712     {
5713     private:
5714       int& ref;
5715       const char *name;
5717     public:
5718       ProbeClass(int& v, const char *n) : ref(v), name(n)
5719       {
5720         DTRACE_PROBE2(_test_, cons, name, ref);
5721       }
5723       void method(int min)
5724       {
5725         DTRACE_PROBE3(_test_, meth, name, ref, min);
5726         ref -= min;
5727       }
5729       ~ProbeClass()
5730       {
5731         DTRACE_PROBE2(_test_, dest, name, ref);
5732       }
5733     };
5734     ]],[[
5735     int i = 64;
5736     DTRACE_PROBE1(_test_, call, i);
5737     ProbeClass inst = ProbeClass(i, "call");
5738     inst.method(24);
5739     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5740           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5741     AC_LANG_POP([C++])
5743 AC_CONFIG_HEADERS([config_host/config_probes.h])
5745 dnl ===================================================================
5746 dnl GCC features
5747 dnl ===================================================================
5748 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
5749     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5750     save_CFLAGS=$CFLAGS
5751     CFLAGS="$CFLAGS -Werror -mno-avx"
5752     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5753     CFLAGS=$save_CFLAGS
5754     if test "$HAVE_GCC_AVX" = "TRUE"; then
5755         AC_MSG_RESULT([yes])
5756     else
5757         AC_MSG_RESULT([no])
5758     fi
5760     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5761     save_CFLAGS=$CFLAGS
5762     CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
5763     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5764     CFLAGS=$save_CFLAGS
5765     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5766         AC_MSG_RESULT([yes])
5767     else
5768         AC_MSG_RESULT([no])
5769     fi
5771     AC_MSG_CHECKING([whether $CC supports atomic functions])
5772     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5773     int v = 0;
5774     if (__sync_add_and_fetch(&v, 1) != 1 ||
5775         __sync_sub_and_fetch(&v, 1) != 0)
5776         return 1;
5777     __sync_synchronize();
5778     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5779         v != 1)
5780         return 1;
5781     return 0;
5782 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5783     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5784         AC_MSG_RESULT([yes])
5785         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5786     else
5787         AC_MSG_RESULT([no])
5788     fi
5790     AC_MSG_CHECKING([whether $CC supports __builtin_ffs])
5791     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
5792     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
5793         AC_MSG_RESULT([yes])
5794         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
5795     else
5796         AC_MSG_RESULT([no])
5797     fi
5799     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5800     save_CFLAGS=$CFLAGS
5801     CFLAGS="$CFLAGS -Werror"
5802     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5803             __attribute__((deprecated("test"))) void f();
5804         ])], [
5805             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5806             AC_MSG_RESULT([yes])
5807         ], [AC_MSG_RESULT([no])])
5808     CFLAGS=$save_CFLAGS
5810     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
5811     AC_LANG_PUSH([C++])
5812     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5813             #include <cstddef>
5814             #include <cxxabi.h>
5815             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
5816         ])], [
5817             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
5818             AC_MSG_RESULT([yes])
5819         ], [AC_MSG_RESULT([no])])
5820     AC_LANG_POP([C++])
5822     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
5823     AC_LANG_PUSH([C++])
5824     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5825             #include <cstddef>
5826             #include <cxxabi.h>
5827             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
5828         ])], [
5829             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
5830             AC_MSG_RESULT([yes])
5831         ], [AC_MSG_RESULT([no])])
5832     AC_LANG_POP([C++])
5834     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
5835     AC_LANG_PUSH([C++])
5836     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5837             #include <cxxabi.h>
5838             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
5839         ])], [
5840             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
5841             AC_MSG_RESULT([yes])
5842         ], [AC_MSG_RESULT([no])])
5843     AC_LANG_POP([C++])
5845     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
5846     AC_LANG_PUSH([C++])
5847     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5848             #include <cstddef>
5849             #include <cxxabi.h>
5850             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
5851         ])], [
5852             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
5853             AC_MSG_RESULT([yes])
5854         ], [AC_MSG_RESULT([no])])
5855     AC_LANG_POP([C++])
5857     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
5858     AC_LANG_PUSH([C++])
5859     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5860             #include <cstddef>
5861             #include <cxxabi.h>
5862             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
5863         ])], [
5864             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
5865             AC_MSG_RESULT([yes])
5866         ], [AC_MSG_RESULT([no])])
5867     AC_LANG_POP([C++])
5869     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
5870     AC_LANG_PUSH([C++])
5871     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5872             #include <cxxabi.h>
5873             void * f() { return __cxxabiv1::__cxa_get_globals(); }
5874         ])], [
5875             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
5876             AC_MSG_RESULT([yes])
5877         ], [AC_MSG_RESULT([no])])
5878     AC_LANG_POP([C++])
5880     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
5881     AC_LANG_PUSH([C++])
5882     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5883             #include <cxxabi.h>
5884             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
5885         ])], [
5886             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
5887             AC_MSG_RESULT([yes])
5888         ], [AC_MSG_RESULT([no])])
5889     AC_LANG_POP([C++])
5891     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
5892     AC_LANG_PUSH([C++])
5893     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5894             #include <cstddef>
5895             #include <cxxabi.h>
5896             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
5897         ])], [
5898             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
5899             AC_MSG_RESULT([yes])
5900         ], [AC_MSG_RESULT([no])])
5901     AC_LANG_POP([C++])
5903     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
5904     AC_LANG_PUSH([C++])
5905     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5906             #include <cstddef>
5907             #include <cxxabi.h>
5908             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
5909         ])], [
5910             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
5911             AC_MSG_RESULT([yes])
5912         ], [AC_MSG_RESULT([no])])
5913     AC_LANG_POP([C++])
5915     dnl Available in GCC 4.9 and at least in Clang 3.4 (which is the baseline
5916     dnl for at least --enable-compiler-plugins according to README.md):
5917     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
5918     AC_LANG_PUSH([C++])
5919     save_CXXFLAGS=$CXXFLAGS
5920     CXXFLAGS="$CXXFLAGS -Werror -Wunknown-pragmas"
5921     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5922             struct __attribute__((warn_unused)) dummy {};
5923         ])], [
5924             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
5925             AC_MSG_RESULT([yes])
5926         ], [AC_MSG_RESULT([no])])
5927     CXXFLAGS=$save_CXXFLAGS
5928 AC_LANG_POP([C++])
5931 AC_SUBST(HAVE_GCC_AVX)
5932 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
5933 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
5934 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
5936 dnl ===================================================================
5937 dnl Identify the C++ library
5938 dnl ===================================================================
5940 AC_MSG_CHECKING([What the C++ library is])
5941 AC_LANG_PUSH([C++])
5942 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5943 #include <utility>
5944 #ifndef __GLIBCXX__
5945 foo bar
5946 #endif
5947 ]])],
5948     [CPP_LIBRARY=GLIBCXX
5949      cpp_library_name="GNU libstdc++"
5950     ],
5951     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5952 #include <utility>
5953 #ifndef _LIBCPP_VERSION
5954 foo bar
5955 #endif
5956 ]])],
5957     [CPP_LIBRARY=LIBCPP
5958      cpp_library_name="LLVM libc++"
5959     ],
5960     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5961 #include <utility>
5962 #ifndef _MSC_VER
5963 foo bar
5964 #endif
5965 ]])],
5966     [CPP_LIBRARY=MSVCRT
5967      cpp_library_name="Microsoft"
5968     ],
5969     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
5970 AC_MSG_RESULT([$cpp_library_name])
5971 AC_LANG_POP([C++])
5973 dnl ===================================================================
5974 dnl C++11
5975 dnl ===================================================================
5977 CXXFLAGS_CXX11=
5978 if test "$COM" = MSC; then
5979     AC_MSG_CHECKING([whether $CXX supports C++11])
5980     AC_MSG_RESULT(yes)
5981     # MSVC supports (a subset of) CXX11 without any switch
5982 elif test "$GCC" = "yes"; then
5983     HAVE_CXX11=
5984     AC_MSG_CHECKING([whether $CXX supports C++14 or C++11])
5985     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
5986         save_CXXFLAGS=$CXXFLAGS
5987         CXXFLAGS="$CXXFLAGS $flag -Werror"
5988         AC_LANG_PUSH([C++])
5989         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5990             #include <algorithm>
5991             #include <functional>
5992             #include <vector>
5993             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
5994                 std::sort(v.begin(), v.end(), fn);
5995             }
5996             ]])],[CXXFLAGS_CXX11=$flag])
5997         AC_LANG_POP([C++])
5998         CXXFLAGS=$save_CXXFLAGS
5999         if test -n "$CXXFLAGS_CXX11"; then
6000             HAVE_CXX11=TRUE
6001             break
6002         fi
6003     done
6004     if test "$HAVE_CXX11" = TRUE; then
6005         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6006     else
6007         AC_MSG_ERROR(no)
6008     fi
6011 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6012 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6013 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6014 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6015 dnl again towards 4.7.2:
6016 if test $CPP_LIBRARY = GLIBCXX; then
6017     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6018     AC_LANG_PUSH([C++])
6019     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6020 #include <list>
6021 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6022     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6023     //   GCC 4.7.0: 20120322
6024     //   GCC 4.7.1: 20120614
6025     // and using a range check is not possible as the mapping between
6026     // __GLIBCXX__ values and GCC versions is not monotonic
6027 /* ok */
6028 #else
6029 abi broken
6030 #endif
6031         ]])], [AC_MSG_RESULT(no, ok)],
6032         [AC_MSG_ERROR(yes)])
6033     AC_LANG_POP([C++])
6036 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6037 save_CXXFLAGS=$CXXFLAGS
6038 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6039 AC_LANG_PUSH([C++])
6041 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6042 #include <stddef.h>
6044 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6046 namespace
6048         struct b
6049         {
6050                 int i;
6051                 int j;
6052         };
6054 ]], [[
6055 struct a
6057         int i;
6058         int j;
6060 a thinga[]={{0,0}, {1,1}};
6061 b thingb[]={{0,0}, {1,1}};
6062 size_t i = sizeof(sal_n_array_size(thinga));
6063 size_t j = sizeof(sal_n_array_size(thingb));
6064 return !(i != 0 && j != 0);
6066     ], [ AC_MSG_RESULT(yes) ],
6067     [ AC_MSG_ERROR(no)])
6068 AC_LANG_POP([C++])
6069 CXXFLAGS=$save_CXXFLAGS
6071 dnl Clang 3.9 supports __float128 since
6072 dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6073 dnl __float128 in Clang and enable it on pertinent platforms":
6074 AC_MSG_CHECKING([whether $CXX supports C++11 without __float128 compile error])
6075 save_CXXFLAGS=$CXXFLAGS
6076 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6077 AC_LANG_PUSH([C++])
6079 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6080 #include <vector>
6081     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6082     // (__float128)
6084     ],[ AC_MSG_RESULT(yes) ],
6085     [
6086         AC_MSG_RESULT(no)
6087         # The only reason why libstdc++ headers fail with Clang in C++11 mode is because
6088         # they use the __float128 type that Clang doesn't know (libstdc++ checks whether
6089         # __float128 is available during its build, but it's usually built using GCC,
6090         # and so c++config.h hardcodes __float128 being supported). As the only place
6091         # where __float128 is actually used is in a template specialization,
6092         # -D__float128=void will avoid the problem there while still causing a problem
6093         # if somebody actually uses the type.
6094         AC_MSG_CHECKING([whether -D__float128=void workaround helps])
6095         CXXFLAGS="$CXXFLAGS -D__float128=void"
6096         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6097 #include <vector>
6098     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6099     // (__float128)
6101     ],
6102     [
6103      AC_MSG_RESULT(yes)
6104      CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -D__float128=void"
6105     ],
6106     [
6107      AC_MSG_ERROR(no)
6108     ])
6111 AC_LANG_POP([C++])
6112 CXXFLAGS=$save_CXXFLAGS
6114 AC_SUBST(CXXFLAGS_CXX11)
6116 AC_MSG_CHECKING([whether $CXX supports C++14 constexpr])
6117 save_CXXFLAGS=$CXXFLAGS
6118 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6119 AC_LANG_PUSH([C++])
6120 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6121     // A somewhat over-complicated way of checking for
6122     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6123     // in constexpr function":
6124     #include <cassert>
6125     template<typename T> inline constexpr T f(T x) { return x; }
6126     template<typename T> inline constexpr T g(T x) {
6127         assert(f(static_cast<int>(x)));
6128         return x;
6129     }
6130     enum E { e };
6131     auto v = g(E::e);
6133     struct S {
6134         int n_;
6135         constexpr bool f() {
6136             int n = n_;
6137             int i = 0;
6138             while (n > 0) { --n; ++i; }
6139             assert(i >= 0);
6140             return i == 0;
6141         }
6142     };
6143     constexpr auto v2 = S{10}.f();
6144     ]])], [cxx14_constexpr=yes], [cxx14_constexpr=no])
6145 AC_LANG_POP([C++])
6146 CXXFLAGS=$save_CXXFLAGS
6147 AC_MSG_RESULT([$cxx14_constexpr])
6148 if test "$cxx14_constexpr" = yes; then
6149     AC_DEFINE([HAVE_CXX14_CONSTEXPR])
6152 AC_MSG_CHECKING([whether $CXX supports C++11 ref-qualifier])
6153 save_CXXFLAGS=$CXXFLAGS
6154 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6155 AC_LANG_PUSH([C++])
6156 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6157     struct S {
6158         void f() &;
6159         void f() &&;
6160     };
6161     ]])], [cxx11_ref_qualifier=yes], [cxx11_ref_qualifier=no])
6162 AC_LANG_POP([C++])
6163 CXXFLAGS=$save_CXXFLAGS
6164 AC_MSG_RESULT([$cxx11_ref_qualifier])
6165 if test "$cxx11_ref_qualifier" = no; then
6166     AC_MSG_ERROR([Your $CXX does not support C++11 ref-qualifiers. This is no longer supported.])
6169 dnl _Pragma support (may require C++11)
6170 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6171     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6172     AC_LANG_PUSH([C++])
6173     save_CXXFLAGS=$CXXFLAGS
6174     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6175     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6176             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6177         ])], [
6178             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6179             AC_MSG_RESULT([yes])
6180         ], [AC_MSG_RESULT([no])])
6181     AC_LANG_POP([C++])
6182     CXXFLAGS=$save_CXXFLAGS
6185 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6186 if test "$GCC" = yes; then
6187     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6188     AC_LANG_PUSH([C++])
6189     save_CXXFLAGS=$CXXFLAGS
6190     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6191     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6192     CXXFLAGS=$save_CXXFLAGS
6193     AC_LANG_POP([C++])
6194     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6195         AC_MSG_RESULT([yes])
6196     else
6197         AC_MSG_RESULT([no])
6198     fi
6200 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6202 dnl ===================================================================
6203 dnl system stl sanity tests
6204 dnl ===================================================================
6205 if test "$_os" != "WINNT"; then
6207     AC_LANG_PUSH([C++])
6209     save_CPPFLAGS="$CPPFLAGS"
6210     if test -n "$MACOSX_SDK_PATH"; then
6211         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6212     fi
6214     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6215     # only.
6216     if test "$CPP_LIBRARY" = GLIBCXX; then
6217         dnl gcc#19664, gcc#22482, rhbz#162935
6218         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6219         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6220         AC_MSG_RESULT([$stlvisok])
6221         if test "$stlvisok" = "no"; then
6222             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6223         fi
6224     fi
6226     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6227     # when we don't make any dynamic libraries?
6228     if test "$DISABLE_DYNLOADING" = ""; then
6229         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6230         cat > conftestlib1.cc <<_ACEOF
6231 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6232 struct S2: S1<int> { virtual ~S2(); };
6233 S2::~S2() {}
6234 _ACEOF
6235         cat > conftestlib2.cc <<_ACEOF
6236 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6237 struct S2: S1<int> { virtual ~S2(); };
6238 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6239 _ACEOF
6240         gccvisinlineshiddenok=yes
6241         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6242             gccvisinlineshiddenok=no
6243         else
6244             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6245             dnl known to not work with -z defs (unsetting which makes the test
6246             dnl moot, though):
6247             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6248             if test "$COM_IS_CLANG" = TRUE; then
6249                 for i in $CXX $CXXFLAGS; do
6250                     case $i in
6251                     -fsanitize=*)
6252                         my_linkflagsnoundefs=
6253                         break
6254                         ;;
6255                     esac
6256                 done
6257             fi
6258             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6259                 gccvisinlineshiddenok=no
6260             fi
6261         fi
6263         rm -fr libconftest*
6264         AC_MSG_RESULT([$gccvisinlineshiddenok])
6265         if test "$gccvisinlineshiddenok" = "no"; then
6266             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6267         fi
6268     fi
6270    AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6271     cat >visibility.cxx <<_ACEOF
6272 #pragma GCC visibility push(hidden)
6273 struct __attribute__ ((visibility ("default"))) TestStruct {
6274   static void Init();
6276 __attribute__ ((visibility ("default"))) void TestFunc() {
6277   TestStruct::Init();
6279 _ACEOF
6280     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6281         gccvisbroken=yes
6282     else
6283         case "$host_cpu" in
6284         i?86|x86_64)
6285             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6286                 gccvisbroken=no
6287             else
6288                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6289                     gccvisbroken=no
6290                 else
6291                     gccvisbroken=yes
6292                 fi
6293             fi
6294             ;;
6295         *)
6296             gccvisbroken=no
6297             ;;
6298         esac
6299     fi
6300     rm -f visibility.s visibility.cxx
6302     AC_MSG_RESULT([$gccvisbroken])
6303     if test "$gccvisbroken" = "yes"; then
6304         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6305     fi
6307     CPPFLAGS="$save_CPPFLAGS"
6309     AC_LANG_POP([C++])
6312 dnl ===================================================================
6313 dnl  Clang++ tests
6314 dnl ===================================================================
6316 HAVE_GCC_FNO_DEFAULT_INLINE=
6317 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6318 if test "$GCC" = "yes"; then
6319     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6320     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6321         # Option just ignored and silly warning that isn't a real
6322         # warning printed
6323         :
6324     else
6325         AC_LANG_PUSH([C++])
6326         save_CXXFLAGS=$CXXFLAGS
6327         CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6328         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6329         CXXFLAGS=$save_CXXFLAGS
6330         AC_LANG_POP([C++])
6331     fi
6332     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6333         AC_MSG_RESULT([yes])
6334     else
6335         AC_MSG_RESULT([no])
6336     fi
6338     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6339     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6340         # As above
6341         :
6342     else
6343         AC_LANG_PUSH([C++])
6344         save_CXXFLAGS=$CXXFLAGS
6345         CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6346         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6347         CXXFLAGS=$save_CXXFLAGS
6348         AC_LANG_POP([C++])
6349     fi
6350     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6351         AC_MSG_RESULT([yes])
6352     else
6353         AC_MSG_RESULT([no])
6354     fi
6356 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6357 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6359 dnl ===================================================================
6360 dnl Compiler plugins
6361 dnl ===================================================================
6363 COMPILER_PLUGINS=
6364 # currently only Clang
6366 if test "$COM_IS_CLANG" != "TRUE"; then
6367     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6368         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6369         enable_compiler_plugins=no
6370     fi
6373 if test "$COM_IS_CLANG" = "TRUE"; then
6374     if test -n "$enable_compiler_plugins"; then
6375         compiler_plugins="$enable_compiler_plugins"
6376     elif test -n "$ENABLE_DBGUTIL"; then
6377         compiler_plugins=test
6378     else
6379         compiler_plugins=no
6380     fi
6381     if test "$compiler_plugins" != "no"; then
6382         dnl The prefix where Clang resides, override to where Clang resides if
6383         dnl using a source build:
6384         if test -z "$CLANGDIR"; then
6385             CLANGDIR=/usr
6386         fi
6387         AC_LANG_PUSH([C++])
6388         save_CPPFLAGS=$CPPFLAGS
6389         save_CXX=$CXX
6390         # compiler plugins must be built with "native" bitness of clang
6391         # because they link against clang libraries
6392         CXX=${COMPILER_PLUGINS_CXX-$(echo $CXX | sed -e s/-m64// -e s/-m32//)}
6393         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6394         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6395             [COMPILER_PLUGINS=TRUE],
6396             [
6397             if test "$compiler_plugins" = "yes"; then
6398                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6399             else
6400                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6401                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6402             fi
6403             ])
6404         CXX=$save_CXX
6405         CPPFLAGS=$save_CPPFLAGS
6406         AC_LANG_POP([C++])
6407     fi
6408 else
6409     if test "$enable_compiler_plugins" = "yes"; then
6410         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6411     fi
6413 AC_SUBST(COMPILER_PLUGINS)
6414 AC_SUBST(COMPILER_PLUGINS_CXX)
6415 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
6416 AC_SUBST(CLANGDIR)
6417 AC_SUBST(CLANGLIBDIR)
6419 # Plugin to help linker.
6420 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6421 # This makes --enable-lto build with clang work.
6422 AC_SUBST(LD_PLUGIN)
6424 dnl ===================================================================
6425 dnl allocator
6426 dnl ===================================================================
6427 AC_MSG_CHECKING([which memory allocator to use])
6428 if test "$with_alloc" = "system"; then
6429     AC_MSG_RESULT([system])
6430     ALLOC="SYS_ALLOC"
6432 if test "$with_alloc" = "tcmalloc"; then
6433     AC_MSG_RESULT(tcmalloc)
6434     if ! echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6435         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
6436     fi
6437     AC_CHECK_LIB([tcmalloc], [malloc], [:],
6438         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
6439     ALLOC="TCMALLOC"
6441 if test "$with_alloc" = "jemalloc"; then
6442     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
6443         AC_MSG_RESULT(jemalloc)
6444         save_CFLAGS=$CFLAGS
6445         CFLAGS="$CFLAGS -pthread"
6446         AC_CHECK_LIB([jemalloc], [malloc], [:],
6447             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
6448         ALLOC="JEMALLOC"
6449         CFLAGS=$save_CFLAGS
6450     else
6451         AC_MSG_RESULT([system])
6452         ALLOC="SYS_ALLOC"
6453     fi
6455 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6456     AC_MSG_RESULT([internal])
6458 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6459 AC_SUBST(HAVE_POSIX_FALLOCATE)
6460 AC_SUBST(ALLOC)
6462 dnl ===================================================================
6463 dnl Custom build version
6464 dnl ===================================================================
6466 AC_MSG_CHECKING([whether to add custom build version])
6467 if test "$with_build_version" != ""; then
6468     BUILD_VER_STRING=$with_build_version
6469     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6470 else
6471     BUILD_VER_STRING=
6472     AC_MSG_RESULT([no])
6474 AC_SUBST(BUILD_VER_STRING)
6476 JITC_PROCESSOR_TYPE=""
6477 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6478     # IBMs JDK needs this...
6479     JITC_PROCESSOR_TYPE=6
6480     export JITC_PROCESSOR_TYPE
6482 AC_SUBST([JITC_PROCESSOR_TYPE])
6484 # Misc Windows Stuff
6485 AC_ARG_WITH(ucrt-dir,
6486     AS_HELP_STRING([--with-ucrt-dir],
6487         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
6488         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
6489         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
6490             Windows6.1-KB2999226-x64.msu
6491             Windows6.1-KB2999226-x86.msu
6492             Windows8.1-KB2999226-x64.msu
6493             Windows8.1-KB2999226-x86.msu
6494             Windows8-RT-KB2999226-x64.msu
6495             Windows8-RT-KB2999226-x86.msu
6496         A zip archive including those files is available from Microsoft site:
6497         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
6499 UCRT_REDISTDIR="$with_ucrt_dir"
6500 if test $_os = "WINNT"; then
6501     find_msvc_x64_dlls
6502     find_msms
6503     MSVC_DLL_PATH="$msvcdllpath"
6504     MSVC_DLLS="$msvcdlls"
6505     MSM_PATH="$msmdir"
6506     # MSVC 15.3 changed it to VC141
6507     if echo "$MSVC_DLL_PATH" | grep -q "VC141.CRT$"; then
6508         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
6509     else
6510         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6511     fi
6512     if test "$UCRT_REDISTDIR" = "no"; then
6513         dnl explicitly disabled
6514         UCRT_REDISTDIR=""
6515     else
6516         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
6517                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
6518                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
6519                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
6520                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
6521                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
6522             UCRT_REDISTDIR=""
6523             if test -n "$PKGFORMAT"; then
6524                for i in "$PKGFORMAT"; do
6525                    case "$i" in
6526                    msi)
6527                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
6528                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
6529                        ;;
6530                    esac
6531                done
6532             fi
6533         fi
6534     fi
6537 AC_SUBST(UCRT_REDISTDIR)
6538 AC_SUBST(MSVC_DLL_PATH)
6539 AC_SUBST(MSVC_DLLS)
6540 AC_SUBST(MSM_PATH)
6542 dnl ===================================================================
6543 dnl Checks for Java
6544 dnl ===================================================================
6545 if test "$ENABLE_JAVA" != ""; then
6547     # Windows-specific tests
6548     if test "$build_os" = "cygwin"; then
6549         if test "$BITNESS_OVERRIDE" = 64; then
6550             bitness=64
6551         else
6552             bitness=32
6553         fi
6555         if test -z "$with_jdk_home"; then
6556             for ver in 1.8 1.7 1.6; do
6557                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6558                 if test -n "$regvalue"; then
6559                     _jdk_home=$regvalue
6560                     break
6561                 fi
6562             done
6563             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6564                 with_jdk_home="$_jdk_home"
6565                 howfound="found automatically"
6566             else
6567                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6568             fi
6569         else
6570             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6571             howfound="you passed"
6572         fi
6573     fi
6575     # 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.
6576     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6577     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6578         with_jdk_home=`/usr/libexec/java_home`
6579     fi
6581     JAVA_HOME=; export JAVA_HOME
6582     if test -z "$with_jdk_home"; then
6583         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6584     else
6585         _java_path="$with_jdk_home/bin/$with_java"
6586         dnl Check if there is a Java interpreter at all.
6587         if test -x "$_java_path"; then
6588             JAVAINTERPRETER=$_java_path
6589         else
6590             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6591         fi
6592     fi
6594     dnl Check that the JDK found is correct architecture (at least 2 reasons to
6595     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
6596     dnl loaded by java to run JunitTests:
6597     if test "$build_os" = "cygwin"; then
6598         shortjdkhome=`cygpath -d "$with_jdk_home"`
6599         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
6600             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6601             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6602         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
6603             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6604             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6605         fi
6607         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6608             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6609         fi
6610         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6611     elif test "$cross_compiling" != "yes"; then
6612         case $CPUNAME in
6613             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
6614                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6615                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6616                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6617                 fi
6618                 ;;
6619             *) # assumption: everything else 32-bit
6620                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6621                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6622                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6623                 fi
6624                 ;;
6625         esac
6626     fi
6629 HAVE_JAVA9=
6630 dnl ===================================================================
6631 dnl Checks for JDK.
6632 dnl ===================================================================
6634 # Note that JAVA_HOME as for now always means the *build* platform's
6635 # JAVA_HOME. Whether all the complexity here actually is needed any
6636 # more or not, no idea.
6638 if test "$ENABLE_JAVA" != ""; then
6639     _gij_longver=0
6640     AC_MSG_CHECKING([the installed JDK])
6641     if test -n "$JAVAINTERPRETER"; then
6642         dnl java -version sends output to stderr!
6643         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -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 | $GREP -c "GNU libgcj"` -gt 0; then
6646             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6647         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6648             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6649         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6650             JDK=ibm
6652             dnl IBM JDK specific tests
6653             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6654             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6656             if test "$_jdk_ver" -lt 10600; then
6657                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
6658             fi
6660             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6662             if test "$with_jdk_home" = ""; then
6663                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6664 you must use the "--with-jdk-home" configure option explicitly])
6665             fi
6667             JAVA_HOME=$with_jdk_home
6668         else
6669             JDK=sun
6671             dnl Sun JDK specific tests
6672             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6673             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6675             if test "$_jdk_ver" -lt 10600; then
6676                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
6677             fi
6678             if test "$_jdk_ver" -gt 10600; then
6679                 JAVA_CLASSPATH_NOT_SET=TRUE
6680             fi
6681             if test "$_jdk_ver" -ge 10900; then
6682                 HAVE_JAVA9=TRUE
6683             fi
6685             AC_MSG_RESULT([checked (JDK $_jdk)])
6686             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6687             if test "$_os" = "WINNT"; then
6688                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6689             fi
6691             # set to limit VM usage for JunitTests
6692             JAVAIFLAGS=-Xmx64M
6693             # set to limit VM usage for javac
6694             JAVAFLAGS=-J-Xmx128M
6695         fi
6696     else
6697         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
6698     fi
6699 else
6700     dnl Java disabled
6701     JAVA_HOME=
6702     export JAVA_HOME
6705 dnl ===================================================================
6706 dnl Set target Java bytecode version
6707 dnl ===================================================================
6708 if test "$ENABLE_JAVA" != ""; then
6709     if test "$HAVE_JAVA9" = "TRUE"; then
6710         _java_target_ver="1.6"
6711     else
6712         _java_target_ver="1.5"
6713     fi
6714     JAVA_SOURCE_VER="$_java_target_ver"
6715     JAVA_TARGET_VER="$_java_target_ver"
6718 dnl ===================================================================
6719 dnl Checks for javac
6720 dnl ===================================================================
6721 if test "$ENABLE_JAVA" != ""; then
6722     javacompiler="javac"
6723     if test -z "$with_jdk_home"; then
6724         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6725     else
6726         _javac_path="$with_jdk_home/bin/$javacompiler"
6727         dnl Check if there is a Java compiler at all.
6728         if test -x "$_javac_path"; then
6729             JAVACOMPILER=$_javac_path
6730         fi
6731     fi
6732     if test -z "$JAVACOMPILER"; then
6733         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6734     fi
6735     if test "$build_os" = "cygwin"; then
6736         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6737             JAVACOMPILER="${JAVACOMPILER}.exe"
6738         fi
6739         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
6740     fi
6743 dnl ===================================================================
6744 dnl Checks for javadoc
6745 dnl ===================================================================
6746 if test "$ENABLE_JAVA" != ""; then
6747     if test -z "$with_jdk_home"; then
6748         AC_PATH_PROG(JAVADOC, javadoc)
6749     else
6750         _javadoc_path="$with_jdk_home/bin/javadoc"
6751         dnl Check if there is a javadoc at all.
6752         if test -x "$_javadoc_path"; then
6753             JAVADOC=$_javadoc_path
6754         else
6755             AC_PATH_PROG(JAVADOC, javadoc)
6756         fi
6757     fi
6758     if test -z "$JAVADOC"; then
6759         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6760     fi
6761     if test "$build_os" = "cygwin"; then
6762         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6763             JAVADOC="${JAVADOC}.exe"
6764         fi
6765         JAVADOC=`win_short_path_for_make "$JAVADOC"`
6766     fi
6768     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6769     JAVADOCISGJDOC="yes"
6770     fi
6772 AC_SUBST(JAVADOCISGJDOC)
6774 if test "$ENABLE_JAVA" != ""; then
6775     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
6776     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
6777         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
6778            # try to recover first by looking whether we have a alternatives
6779            # system as in Debian or newer SuSEs where following /usr/bin/javac
6780            # over /etc/alternatives/javac leads to the right bindir where we
6781            # just need to strip a bit away to get a valid JAVA_HOME
6782            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
6783         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
6784             # maybe only one level of symlink (e.g. on Mac)
6785             JAVA_HOME=$(readlink $JAVACOMPILER)
6786             if test "$(dirname $JAVA_HOME)" = "."; then
6787                 # we've got no path to trim back
6788                 JAVA_HOME=""
6789             fi
6790         else
6791             # else warn
6792             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
6793             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
6794             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
6795             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
6796         fi
6797         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
6798         if test "$JAVA_HOME" != "/usr"; then
6799             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6800                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
6801                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
6802                 dnl Tiger already returns a JDK path..
6803                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
6804             else
6805                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
6806                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
6807                 dnl that checks which version to run
6808                 if test -f "$JAVA_HOME"; then
6809                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
6810                 fi
6811             fi
6812         fi
6813     fi
6814     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
6816     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
6817     if test -z "$JAVA_HOME"; then
6818         if test "x$with_jdk_home" = "x"; then
6819             cat > findhome.java <<_ACEOF
6820 [import java.io.File;
6822 class findhome
6824     public static void main(String args[])
6825     {
6826         String jrelocation = System.getProperty("java.home");
6827         File jre = new File(jrelocation);
6828         System.out.println(jre.getParent());
6829     }
6831 _ACEOF
6832             AC_MSG_CHECKING([if javac works])
6833             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
6834             AC_TRY_EVAL(javac_cmd)
6835             if test $? = 0 -a -f ./findhome.class; then
6836                 AC_MSG_RESULT([javac works])
6837             else
6838                 echo "configure: javac test failed" >&5
6839                 cat findhome.java >&5
6840                 AC_MSG_ERROR([javac does not work - java projects will not build!])
6841             fi
6842             AC_MSG_CHECKING([if gij knows its java.home])
6843             JAVA_HOME=`$JAVAINTERPRETER findhome`
6844             if test $? = 0 -a "$JAVA_HOME" != ""; then
6845                 AC_MSG_RESULT([$JAVA_HOME])
6846             else
6847                 echo "configure: java test failed" >&5
6848                 cat findhome.java >&5
6849                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
6850             fi
6851             # clean-up after ourselves
6852             rm -f ./findhome.java ./findhome.class
6853         else
6854             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
6855         fi
6856     fi
6858     # now check if $JAVA_HOME is really valid
6859     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6860         case "${JAVA_HOME}" in
6861             /Library/Java/JavaVirtualMachines/*)
6862                 ;;
6863             *)
6864                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
6865                 ;;
6866         esac
6867         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
6868             JAVA_HOME_OK="NO"
6869         fi
6870     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
6871         JAVA_HOME_OK="NO"
6872     fi
6873     if test "$JAVA_HOME_OK" = "NO"; then
6874         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
6875         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
6876         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
6877         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
6878         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
6879         add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
6880     fi
6881     PathFormat "$JAVA_HOME"
6882     JAVA_HOME="$formatted_path"
6885 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
6886     "$_os" != Darwin
6887 then
6888     AC_MSG_CHECKING([for JAWT lib])
6889     if test "$_os" = WINNT; then
6890         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
6891         JAWTLIB=jawt.lib
6892     else
6893         case "$host_cpu" in
6894         arm*)
6895             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
6896             JAVA_ARCH=$my_java_arch
6897             ;;
6898         i*86)
6899             my_java_arch=i386
6900             ;;
6901         m68k)
6902             my_java_arch=m68k
6903             ;;
6904         powerpc)
6905             my_java_arch=ppc
6906             ;;
6907         powerpc64)
6908             my_java_arch=ppc64
6909             ;;
6910         powerpc64le)
6911             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
6912             JAVA_ARCH=$my_java_arch
6913             ;;
6914         sparc64)
6915             my_java_arch=sparcv9
6916             ;;
6917         x86_64)
6918             my_java_arch=amd64
6919             ;;
6920         *)
6921             my_java_arch=$host_cpu
6922             ;;
6923         esac
6924         # This is where JDK9 puts the library
6925         if test -e "$JAVA_HOME/lib/libjawt.so"; then
6926             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
6927         else
6928             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
6929         fi
6930         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
6931     fi
6932     AC_MSG_RESULT([$JAWTLIB])
6934 AC_SUBST(JAWTLIB)
6936 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
6937     case "$host_os" in
6939     aix*)
6940         JAVAINC="-I$JAVA_HOME/include"
6941         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
6942         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6943         ;;
6945     cygwin*)
6946         JAVAINC="-I$JAVA_HOME/include/win32"
6947         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
6948         ;;
6950     darwin*)
6951         if test -d "$JAVA_HOME/include/darwin"; then
6952             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
6953         else
6954             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
6955         fi
6956         ;;
6958     dragonfly*)
6959         JAVAINC="-I$JAVA_HOME/include"
6960         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6961         ;;
6963     freebsd*)
6964         JAVAINC="-I$JAVA_HOME/include"
6965         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
6966         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
6967         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
6968         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6969         ;;
6971     k*bsd*-gnu*)
6972         JAVAINC="-I$JAVA_HOME/include"
6973         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
6974         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6975         ;;
6977     linux-gnu*)
6978         JAVAINC="-I$JAVA_HOME/include"
6979         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
6980         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6981         ;;
6983     *netbsd*)
6984         JAVAINC="-I$JAVA_HOME/include"
6985         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
6986         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6987        ;;
6989     openbsd*)
6990         JAVAINC="-I$JAVA_HOME/include"
6991         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
6992         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6993         ;;
6995     solaris*)
6996         JAVAINC="-I$JAVA_HOME/include"
6997         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
6998         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6999         ;;
7000     esac
7002 SOLARINC="$SOLARINC $JAVAINC"
7004 AC_SUBST(JAVACOMPILER)
7005 AC_SUBST(JAVADOC)
7006 AC_SUBST(JAVAINTERPRETER)
7007 AC_SUBST(JAVAIFLAGS)
7008 AC_SUBST(JAVAFLAGS)
7009 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7010 AC_SUBST(JAVA_HOME)
7011 AC_SUBST(JAVA_SOURCE_VER)
7012 AC_SUBST(JAVA_TARGET_VER)
7013 AC_SUBST(JDK)
7016 dnl ===================================================================
7017 dnl Export file validation
7018 dnl ===================================================================
7019 AC_MSG_CHECKING([whether to enable export file validation])
7020 if test "$with_export_validation" != "no"; then
7021     if test -z "$ENABLE_JAVA"; then
7022         if test "$with_export_validation" = "yes"; then
7023             AC_MSG_ERROR([requested, but Java is disabled])
7024         else
7025             AC_MSG_RESULT([no, as Java is disabled])
7026         fi
7027     elif test "$_jdk_ver" -lt 10800; then
7028         if test "$with_export_validation" = "yes"; then
7029             AC_MSG_ERROR([requested, but Java is too old, need Java 8])
7030         else
7031             AC_MSG_RESULT([no, as Java is too old, need Java 8])
7032         fi
7033     else
7034         AC_MSG_RESULT([yes])
7035         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7037         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7038         if test -z "$ODFVALIDATOR"; then
7039             # remember to download the ODF toolkit with validator later
7040             AC_MSG_NOTICE([no odfvalidator found, will download it])
7041             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7042             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7044             # and fetch name of odfvalidator jar name from download.lst
7045             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7046             AC_SUBST(ODFVALIDATOR_JAR)
7048             if test -z "$ODFVALIDATOR_JAR"; then
7049                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7050             fi
7051         fi
7052         if test "$build_os" = "cygwin"; then
7053             # In case of Cygwin it will be executed from Windows,
7054             # so we need to run bash and absolute path to validator
7055             # so instead of "odfvalidator" it will be
7056             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7057             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7058         else
7059             ODFVALIDATOR="sh $ODFVALIDATOR"
7060         fi
7061         AC_SUBST(ODFVALIDATOR)
7064         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7065         if test -z "$OFFICEOTRON"; then
7066             # remember to download the officeotron with validator later
7067             AC_MSG_NOTICE([no officeotron found, will download it])
7068             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7069             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7071             # and fetch name of officeotron jar name from download.lst
7072             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7073             AC_SUBST(OFFICEOTRON_JAR)
7075             if test -z "$OFFICEOTRON_JAR"; then
7076                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7077             fi
7078         else
7079             # check version of existing officeotron
7080             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7081             if test 0"$OFFICEOTRON_VER" -lt 704; then
7082                 AC_MSG_ERROR([officeotron too old])
7083             fi
7084         fi
7085         if test "$build_os" = "cygwin"; then
7086             # In case of Cygwin it will be executed from Windows,
7087             # so we need to run bash and absolute path to validator
7088             # so instead of "odfvalidator" it will be
7089             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7090             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7091         else
7092             OFFICEOTRON="sh $OFFICEOTRON"
7093         fi
7094     fi
7095     AC_SUBST(OFFICEOTRON)
7096 else
7097     AC_MSG_RESULT([no])
7100 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7101 if test "$with_bffvalidator" != "no"; then
7102     AC_DEFINE(HAVE_BFFVALIDATOR)
7104     if test "$with_export_validation" = "no"; then
7105         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7106     fi
7108     if test "$with_bffvalidator" = "yes"; then
7109         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7110     else
7111         BFFVALIDATOR="$with_bffvalidator"
7112     fi
7114     if test "$build_os" = "cygwin"; then
7115         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7116             AC_MSG_RESULT($BFFVALIDATOR)
7117         else
7118             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7119         fi
7120     elif test -n "$BFFVALIDATOR"; then
7121         # We are not in Cygwin but need to run Windows binary with wine
7122         AC_PATH_PROGS(WINE, wine)
7124         # so swap in a shell wrapper that converts paths transparently
7125         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7126         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7127         AC_SUBST(BFFVALIDATOR_EXE)
7128         AC_MSG_RESULT($BFFVALIDATOR)
7129     else
7130         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7131     fi
7132     AC_SUBST(BFFVALIDATOR)
7133 else
7134     AC_MSG_RESULT([no])
7137 dnl ===================================================================
7138 dnl Check for C preprocessor to use
7139 dnl ===================================================================
7140 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7141 if test -n "$with_idlc_cpp"; then
7142     AC_MSG_RESULT([$with_idlc_cpp])
7143     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7144 else
7145     AC_MSG_RESULT([ucpp])
7146     AC_MSG_CHECKING([which ucpp tp use])
7147     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7148         AC_MSG_RESULT([external])
7149         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7150     else
7151         AC_MSG_RESULT([internal])
7152         BUILD_TYPE="$BUILD_TYPE UCPP"
7153     fi
7155 AC_SUBST(SYSTEM_UCPP)
7157 dnl ===================================================================
7158 dnl Check for epm (not needed for Windows)
7159 dnl ===================================================================
7160 AC_MSG_CHECKING([whether to enable EPM for packing])
7161 if test "$enable_epm" = "yes"; then
7162     AC_MSG_RESULT([yes])
7163     if test "$_os" != "WINNT"; then
7164         if test $_os = Darwin; then
7165             EPM=internal
7166         elif test -n "$with_epm"; then
7167             EPM=$with_epm
7168         else
7169             AC_PATH_PROG(EPM, epm, no)
7170         fi
7171         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7172             AC_MSG_NOTICE([EPM will be built.])
7173             BUILD_TYPE="$BUILD_TYPE EPM"
7174             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7175         else
7176             # Gentoo has some epm which is something different...
7177             AC_MSG_CHECKING([whether the found epm is the right epm])
7178             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7179                 AC_MSG_RESULT([yes])
7180             else
7181                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7182             fi
7183             AC_MSG_CHECKING([epm version])
7184             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7185             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7186                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7187                 AC_MSG_RESULT([OK, >= 3.7])
7188             else
7189                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7190                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7191             fi
7192         fi
7193     fi
7195     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7196         AC_MSG_CHECKING([for rpm])
7197         for a in "$RPM" rpmbuild rpm; do
7198             $a --usage >/dev/null 2> /dev/null
7199             if test $? -eq 0; then
7200                 RPM=$a
7201                 break
7202             else
7203                 $a --version >/dev/null 2> /dev/null
7204                 if test $? -eq 0; then
7205                     RPM=$a
7206                     break
7207                 fi
7208             fi
7209         done
7210         if test -z "$RPM"; then
7211             AC_MSG_ERROR([not found])
7212         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7213             RPM_PATH=`which $RPM`
7214             AC_MSG_RESULT([$RPM_PATH])
7215             SCPDEFS="$SCPDEFS -DWITH_RPM"
7216         else
7217             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7218         fi
7219     fi
7220     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7221         AC_PATH_PROG(DPKG, dpkg, no)
7222         if test "$DPKG" = "no"; then
7223             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7224         fi
7225     fi
7226     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7227        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7228         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7229             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7230                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7231                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7232                     AC_MSG_RESULT([yes])
7233                 else
7234                     AC_MSG_RESULT([no])
7235                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7236                         _pt="rpm"
7237                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7238                         add_warning "the rpms will need to be installed with --nodeps"
7239                     else
7240                         _pt="pkg"
7241                     fi
7242                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
7243                     add_warning "the ${_pt}s will not be relocateable"
7244                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7245                                  relocation will work, you need to patch your epm with the
7246                                  patch in epm/epm-3.7.patch or build with
7247                                  --with-epm=internal which will build a suitable epm])
7248                 fi
7249             fi
7250         fi
7251     fi
7252     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7253         AC_PATH_PROG(PKGMK, pkgmk, no)
7254         if test "$PKGMK" = "no"; then
7255             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7256         fi
7257     fi
7258     AC_SUBST(RPM)
7259     AC_SUBST(DPKG)
7260     AC_SUBST(PKGMK)
7261 else
7262     for i in $PKGFORMAT; do
7263         case "$i" in
7264         aix | bsd | deb | pkg | rpm | native | portable)
7265             AC_MSG_ERROR(
7266                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7267             ;;
7268         esac
7269     done
7270     AC_MSG_RESULT([no])
7271     EPM=NO
7273 AC_SUBST(EPM)
7275 ENABLE_LWP=
7276 if test "$enable_lotuswordpro" = "yes"; then
7277     ENABLE_LWP="TRUE"
7279 AC_SUBST(ENABLE_LWP)
7281 dnl ===================================================================
7282 dnl Check for gperf
7283 dnl ===================================================================
7284 AC_PATH_PROG(GPERF, gperf)
7285 if test -z "$GPERF"; then
7286     AC_MSG_ERROR([gperf not found but needed. Install it.])
7288 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7289     GPERF=`cygpath -m $GPERF`
7291 AC_MSG_CHECKING([gperf version])
7292 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
7293     AC_MSG_RESULT([OK])
7294 else
7295     AC_MSG_ERROR([too old, you need at least 3.0.0])
7297 AC_SUBST(GPERF)
7299 dnl ===================================================================
7300 dnl Check for building ODK
7301 dnl ===================================================================
7302 if test "$enable_odk" = no; then
7303     unset DOXYGEN
7304 else
7305     if test "$with_doxygen" = no; then
7306         AC_MSG_CHECKING([for doxygen])
7307         unset DOXYGEN
7308         AC_MSG_RESULT([no])
7309     else
7310         if test "$with_doxygen" = yes; then
7311             AC_PATH_PROG([DOXYGEN], [doxygen])
7312             if test -z "$DOXYGEN"; then
7313                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7314             fi
7315         else
7316             AC_MSG_CHECKING([for doxygen])
7317             DOXYGEN=$with_doxygen
7318             AC_MSG_RESULT([$DOXYGEN])
7319         fi
7320         if test -n "$DOXYGEN"; then
7321             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7322             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7323             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7324                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7325             fi
7326         fi
7327     fi
7329 AC_SUBST([DOXYGEN])
7331 AC_MSG_CHECKING([whether to build the ODK])
7332 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7333     AC_MSG_RESULT([yes])
7335     if test "$with_java" != "no"; then
7336         AC_MSG_CHECKING([whether to build unowinreg.dll])
7337         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7338             # build on Win by default
7339             enable_build_unowinreg=yes
7340         fi
7341         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7342             AC_MSG_RESULT([no])
7343             BUILD_UNOWINREG=
7344         else
7345             AC_MSG_RESULT([yes])
7346             BUILD_UNOWINREG=TRUE
7347         fi
7348         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7349             if test -z "$with_mingw_cross_compiler"; then
7350                 dnl Guess...
7351                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7352             elif test -x "$with_mingw_cross_compiler"; then
7353                  MINGWCXX="$with_mingw_cross_compiler"
7354             else
7355                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7356             fi
7358             if test "$MINGWCXX" = "false"; then
7359                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7360             fi
7362             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7363             if test -x "$mingwstrip_test"; then
7364                 MINGWSTRIP="$mingwstrip_test"
7365             else
7366                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7367             fi
7369             if test "$MINGWSTRIP" = "false"; then
7370                 AC_MSG_ERROR(MinGW32 binutils not found.)
7371             fi
7372         fi
7373     fi
7374     BUILD_TYPE="$BUILD_TYPE ODK"
7375 else
7376     AC_MSG_RESULT([no])
7377     BUILD_UNOWINREG=
7379 AC_SUBST(BUILD_UNOWINREG)
7380 AC_SUBST(MINGWCXX)
7381 AC_SUBST(MINGWSTRIP)
7383 dnl ===================================================================
7384 dnl Check for system zlib
7385 dnl ===================================================================
7386 if test "$with_system_zlib" = "auto"; then
7387     case "$_os" in
7388     WINNT)
7389         with_system_zlib="$with_system_libs"
7390         ;;
7391     *)
7392         if test "$enable_fuzzers" != "yes"; then
7393             with_system_zlib=yes
7394         else
7395             with_system_zlib=no
7396         fi
7397         ;;
7398     esac
7401 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7402 dnl and has no pkg-config for it at least on some tinderboxes,
7403 dnl so leaving that out for now
7404 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7405 AC_MSG_CHECKING([which zlib to use])
7406 if test "$with_system_zlib" = "yes"; then
7407     AC_MSG_RESULT([external])
7408     SYSTEM_ZLIB=TRUE
7409     AC_CHECK_HEADER(zlib.h, [],
7410         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7411     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7412         [AC_MSG_ERROR(zlib not found or functional)], [])
7413 else
7414     AC_MSG_RESULT([internal])
7415     SYSTEM_ZLIB=
7416     BUILD_TYPE="$BUILD_TYPE ZLIB"
7417     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7418     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7420 AC_SUBST(ZLIB_CFLAGS)
7421 AC_SUBST(ZLIB_LIBS)
7422 AC_SUBST(SYSTEM_ZLIB)
7424 dnl ===================================================================
7425 dnl Check for system jpeg
7426 dnl ===================================================================
7427 AC_MSG_CHECKING([which libjpeg to use])
7428 if test "$with_system_jpeg" = "yes"; then
7429     AC_MSG_RESULT([external])
7430     SYSTEM_LIBJPEG=TRUE
7431     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7432         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7433     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7434         [AC_MSG_ERROR(jpeg library not found or fuctional)], [])
7435 else
7436     SYSTEM_LIBJPEG=
7437     AC_MSG_RESULT([internal, libjpeg-turbo])
7438     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
7439     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
7440     if test "$COM" = "MSC"; then
7441         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
7442     else
7443         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
7444     fi
7446     case "$host_cpu" in
7447     x86_64 | amd64 | i*86 | x86 | ia32)
7448         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7449         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7450             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7451                 NASM="$LODE_HOME/opt/bin/nasm"
7452             elif test -x "/opt/lo/bin/nasm"; then
7453                 NASM="/opt/lo/bin/nasm"
7454             fi
7455         fi
7457         if test -n "$NASM"; then
7458             AC_MSG_CHECKING([for object file format of host system])
7459             case "$host_os" in
7460               cygwin* | mingw* | pw32* | interix*)
7461                 case "$host_cpu" in
7462                   x86_64)
7463                     objfmt='Win64-COFF'
7464                     ;;
7465                   *)
7466                     objfmt='Win32-COFF'
7467                     ;;
7468                 esac
7469               ;;
7470               msdosdjgpp* | go32*)
7471                 objfmt='COFF'
7472               ;;
7473               os2-emx*)                 # not tested
7474                 objfmt='MSOMF'          # obj
7475               ;;
7476               linux*coff* | linux*oldld*)
7477                 objfmt='COFF'           # ???
7478               ;;
7479               linux*aout*)
7480                 objfmt='a.out'
7481               ;;
7482               linux*)
7483                 case "$host_cpu" in
7484                   x86_64)
7485                     objfmt='ELF64'
7486                     ;;
7487                   *)
7488                     objfmt='ELF'
7489                     ;;
7490                 esac
7491               ;;
7492               kfreebsd* | freebsd* | netbsd* | openbsd*)
7493                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
7494                   objfmt='BSD-a.out'
7495                 else
7496                   case "$host_cpu" in
7497                     x86_64 | amd64)
7498                       objfmt='ELF64'
7499                       ;;
7500                     *)
7501                       objfmt='ELF'
7502                       ;;
7503                   esac
7504                 fi
7505               ;;
7506               solaris* | sunos* | sysv* | sco*)
7507                 case "$host_cpu" in
7508                   x86_64)
7509                     objfmt='ELF64'
7510                     ;;
7511                   *)
7512                     objfmt='ELF'
7513                     ;;
7514                 esac
7515               ;;
7516               darwin* | rhapsody* | nextstep* | openstep* | macos*)
7517                 case "$host_cpu" in
7518                   x86_64)
7519                     objfmt='Mach-O64'
7520                     ;;
7521                   *)
7522                     objfmt='Mach-O'
7523                     ;;
7524                 esac
7525               ;;
7526               *)
7527                 objfmt='ELF ?'
7528               ;;
7529             esac
7531             AC_MSG_RESULT([$objfmt])
7532             if test "$objfmt" = 'ELF ?'; then
7533               objfmt='ELF'
7534               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
7535             fi
7537             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
7538             case "$objfmt" in
7539               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
7540               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
7541               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
7542               COFF)       NAFLAGS='-fcoff -DCOFF';;
7543               a.out)      NAFLAGS='-faout -DAOUT';;
7544               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
7545               ELF)        NAFLAGS='-felf -DELF';;
7546               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
7547               RDF)        NAFLAGS='-frdf -DRDF';;
7548               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
7549               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
7550             esac
7551             AC_MSG_RESULT([$NAFLAGS])
7553             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
7554             cat > conftest.asm << EOF
7555             [%line __oline__ "configure"
7556                     section .text
7557                     global  _main,main
7558             _main:
7559             main:   xor     eax,eax
7560                     ret
7561             ]
7563             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
7564             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
7565               AC_MSG_RESULT(yes)
7566             else
7567               echo "configure: failed program was:" >&AC_FD_CC
7568               cat conftest.asm >&AC_FD_CC
7569               rm -rf conftest*
7570               AC_MSG_RESULT(no)
7571               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
7572               NASM=""
7573             fi
7575         fi
7577         if test -z "$NASM"; then
7578 cat << _EOS
7579 ****************************************************************************
7580 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
7581 To get one please:
7583 _EOS
7584             if test "$build_os" = "cygwin"; then
7585 cat << _EOS
7586 install a pre-compiled binary for Win32
7588 mkdir -p /opt/lo/bin
7589 cd /opt/lo/bin
7590 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7591 chmod +x nasm
7593 or get and install one from http://www.nasm.us/
7595 Then re-run autogen.sh
7597 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7598 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7600 _EOS
7601             else
7602 cat << _EOS
7603 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
7605 _EOS
7606             fi
7607             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
7608             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
7609         fi
7610       ;;
7611     esac
7614 AC_SUBST(NASM)
7615 AC_SUBST(LIBJPEG_CFLAGS)
7616 AC_SUBST(LIBJPEG_LIBS)
7617 AC_SUBST(SYSTEM_LIBJPEG)
7619 dnl ===================================================================
7620 dnl Check for system clucene
7621 dnl ===================================================================
7622 dnl we should rather be using
7623 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7624 dnl but the contribs-lib check seems tricky
7625 AC_MSG_CHECKING([which clucene to use])
7626 if test "$with_system_clucene" = "yes"; then
7627     AC_MSG_RESULT([external])
7628     SYSTEM_CLUCENE=TRUE
7629     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7630     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7631     FilterLibs "${CLUCENE_LIBS}"
7632     CLUCENE_LIBS="${filteredlibs}"
7633     AC_LANG_PUSH([C++])
7634     save_CXXFLAGS=$CXXFLAGS
7635     save_CPPFLAGS=$CPPFLAGS
7636     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7637     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7638     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7639     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7640     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7641                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7642     CXXFLAGS=$save_CXXFLAGS
7643     CPPFLAGS=$save_CPPFLAGS
7644     AC_LANG_POP([C++])
7646     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7647 else
7648     AC_MSG_RESULT([internal])
7649     SYSTEM_CLUCENE=
7650     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7652 AC_SUBST(SYSTEM_CLUCENE)
7653 AC_SUBST(CLUCENE_CFLAGS)
7654 AC_SUBST(CLUCENE_LIBS)
7656 dnl ===================================================================
7657 dnl Check for system expat
7658 dnl ===================================================================
7659 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
7661 dnl ===================================================================
7662 dnl Check for system xmlsec
7663 dnl ===================================================================
7664 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24])
7666 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7667 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7668     ENABLE_EOT="TRUE"
7669     AC_DEFINE([ENABLE_EOT])
7670     AC_MSG_RESULT([yes])
7672     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7673 else
7674     ENABLE_EOT=
7675     AC_MSG_RESULT([no])
7677 AC_SUBST([ENABLE_EOT])
7679 dnl ===================================================================
7680 dnl Check for DLP libs
7681 dnl ===================================================================
7682 AS_IF([test "$COM" = "MSC"],
7683       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7684       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7686 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7688 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7690 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
7692 AS_IF([test "$COM" = "MSC"],
7693       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7694       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7696 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7698 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7700 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7701 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.8])
7703 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7705 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7707 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7709 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
7710 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.13])
7712 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
7713 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.7])
7715 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7717 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
7718 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
7720 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7722 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7724 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
7726 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
7728 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
7729 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.4])
7731 dnl ===================================================================
7732 dnl Check for system libcmis
7733 dnl ===================================================================
7734 # libcmis requires curl and we can't build curl for iOS
7735 if test $_os != iOS; then
7736     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.0])
7737     ENABLE_LIBCMIS=TRUE
7738 else
7739     ENABLE_LIBCMIS=
7741 AC_SUBST(ENABLE_LIBCMIS)
7743 dnl ===================================================================
7744 dnl Check for system lcms2
7745 dnl ===================================================================
7746 if test "$with_system_lcms2" != "yes"; then
7747     SYSTEM_LCMS2=
7749 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7750 if test "$GCC" = "yes"; then
7751     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7753 if test "$COM" = "MSC"; then # override the above
7754     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7757 dnl ===================================================================
7758 dnl Check for system cppunit
7759 dnl ===================================================================
7760 if test "$cross_compiling" != "yes"; then
7761     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
7764 dnl ===================================================================
7765 dnl Check whether freetype is available
7766 dnl ===================================================================
7767 if test  "$test_freetype" = "yes"; then
7768     AC_MSG_CHECKING([whether freetype is available])
7769     # FreeType has 3 different kinds of versions
7770     # * release, like 2.4.10
7771     # * libtool, like 13.0.7 (this what pkg-config returns)
7772     # * soname
7773     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7774     #
7775     # 9.9.3 is 2.2.0
7776     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7777     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7778     FilterLibs "${FREETYPE_LIBS}"
7779     FREETYPE_LIBS="${filteredlibs}"
7780     SYSTEM_FREETYPE=TRUE
7781 else
7782     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
7783     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
7785 AC_SUBST(FREETYPE_CFLAGS)
7786 AC_SUBST(FREETYPE_LIBS)
7787 AC_SUBST([SYSTEM_FREETYPE])
7789 # ===================================================================
7790 # Check for system libxslt
7791 # to prevent incompatibilities between internal libxml2 and external libxslt,
7792 # or vice versa, use with_system_libxml here
7793 # ===================================================================
7794 if test "$with_system_libxml" = "auto"; then
7795     case "$_os" in
7796     WINNT|iOS|Android)
7797         with_system_libxml="$with_system_libs"
7798         ;;
7799     *)
7800         if test "$enable_fuzzers" != "yes"; then
7801             with_system_libxml=yes
7802         else
7803             with_system_libxml=no
7804         fi
7805         ;;
7806     esac
7809 AC_MSG_CHECKING([which libxslt to use])
7810 if test "$with_system_libxml" = "yes"; then
7811     AC_MSG_RESULT([external])
7812     SYSTEM_LIBXSLT=TRUE
7813     if test "$_os" = "Darwin"; then
7814         dnl make sure to use SDK path
7815         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7816         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7817         dnl omit -L/usr/lib
7818         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7819         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7820     else
7821         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7822         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7823         FilterLibs "${LIBXSLT_LIBS}"
7824         LIBXSLT_LIBS="${filteredlibs}"
7825         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7826         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7827         FilterLibs "${LIBEXSLT_LIBS}"
7828         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
7829     fi
7831     dnl Check for xsltproc
7832     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7833     if test "$XSLTPROC" = "no"; then
7834         AC_MSG_ERROR([xsltproc is required])
7835     fi
7836 else
7837     AC_MSG_RESULT([internal])
7838     SYSTEM_LIBXSLT=
7839     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
7841     if test "$cross_compiling" = "yes"; then
7842         AC_PATH_PROG(XSLTPROC, xsltproc, no)
7843         if test "$XSLTPROC" = "no"; then
7844             AC_MSG_ERROR([xsltproc is required])
7845         fi
7846     fi
7848 AC_SUBST(SYSTEM_LIBXSLT)
7849 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
7850     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
7852 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
7854 AC_SUBST(LIBEXSLT_CFLAGS)
7855 AC_SUBST(LIBEXSLT_LIBS)
7856 AC_SUBST(LIBXSLT_CFLAGS)
7857 AC_SUBST(LIBXSLT_LIBS)
7858 AC_SUBST(XSLTPROC)
7860 # ===================================================================
7861 # Check for system libxml
7862 # ===================================================================
7863 AC_MSG_CHECKING([which libxml to use])
7864 if test "$with_system_libxml" = "yes"; then
7865     AC_MSG_RESULT([external])
7866     SYSTEM_LIBXML=TRUE
7867     if test "$_os" = "Darwin"; then
7868         dnl make sure to use SDK path
7869         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7870         dnl omit -L/usr/lib
7871         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
7872     elif test $_os = iOS; then
7873         dnl make sure to use SDK path
7874         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
7875         LIBXML_CFLAGS="-I$usr/include/libxml2"
7876         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
7877     else
7878         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
7879         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7880         FilterLibs "${LIBXML_LIBS}"
7881         LIBXML_LIBS="${filteredlibs}"
7882     fi
7884     dnl Check for xmllint
7885     AC_PATH_PROG(XMLLINT, xmllint, no)
7886     if test "$XMLLINT" = "no"; then
7887         AC_MSG_ERROR([xmllint is required])
7888     fi
7889 else
7890     AC_MSG_RESULT([internal])
7891     SYSTEM_LIBXML=
7892     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
7893     if test "$COM" = "MSC"; then
7894         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
7895     fi
7896     if test "$COM" = "MSC"; then
7897         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
7898     else
7899         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
7900     fi
7901     BUILD_TYPE="$BUILD_TYPE LIBXML2"
7903 AC_SUBST(SYSTEM_LIBXML)
7904 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
7905     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
7907 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
7908 AC_SUBST(LIBXML_CFLAGS)
7909 AC_SUBST(LIBXML_LIBS)
7910 AC_SUBST(XMLLINT)
7912 # =====================================================================
7913 # Checking for a Python interpreter with version >= 2.6.
7914 # Build and runtime requires Python 3 compatible version (>= 2.6).
7915 # Optionally user can pass an option to configure, i. e.
7916 # ./configure PYTHON=/usr/bin/python
7917 # =====================================================================
7918 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
7919     # This allows a lack of system python with no error, we use internal one in that case.
7920     AM_PATH_PYTHON([2.6],, [:])
7921     # Clean PYTHON_VERSION checked below if cross-compiling
7922     PYTHON_VERSION=""
7923     if test "$PYTHON" != ":"; then
7924         PYTHON_FOR_BUILD=$PYTHON
7925     fi
7927 AC_SUBST(PYTHON_FOR_BUILD)
7929 # Checks for Python to use for Pyuno
7930 AC_MSG_CHECKING([which Python to use for Pyuno])
7931 case "$enable_python" in
7932 no|disable)
7933     if test -z $PYTHON_FOR_BUILD; then
7934         # Python is required to build LibreOffice. In theory we could separate the build-time Python
7935         # requirement from the choice whether to include Python stuff in the installer, but why
7936         # bother?
7937         AC_MSG_ERROR([Python is required at build time.])
7938     fi
7939     enable_python=no
7940     AC_MSG_RESULT([none])
7941     ;;
7942 ""|yes|auto)
7943     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
7944         AC_MSG_RESULT([no, overridden by --disable-scripting])
7945         enable_python=no
7946     elif test $build_os = cygwin; then
7947         dnl When building on Windows we don't attempt to use any installed
7948         dnl "system"  Python.
7949         AC_MSG_RESULT([fully internal])
7950         enable_python=internal
7951     elif test "$cross_compiling" = yes; then
7952         AC_MSG_RESULT([system])
7953         enable_python=system
7954     else
7955         # Unset variables set by the above AM_PATH_PYTHON so that
7956         # we actually do check anew.
7957         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
7958         AM_PATH_PYTHON([3.3],, [:])
7959         if test "$PYTHON" = ":"; then
7960             if test -z "$PYTHON_FOR_BUILD"; then
7961                 AC_MSG_RESULT([fully internal])
7962             else
7963                 AC_MSG_RESULT([internal])
7964             fi
7965             enable_python=internal
7966         else
7967             AC_MSG_RESULT([system])
7968             enable_python=system
7969         fi
7970     fi
7971     ;;
7972 internal)
7973     AC_MSG_RESULT([internal])
7974     ;;
7975 fully-internal)
7976     AC_MSG_RESULT([fully internal])
7977     enable_python=internal
7978     ;;
7979 system)
7980     AC_MSG_RESULT([system])
7981     ;;
7983     AC_MSG_ERROR([Incorrect --enable-python option])
7984     ;;
7985 esac
7987 if test $enable_python != no; then
7988     BUILD_TYPE="$BUILD_TYPE PYUNO"
7991 if test $enable_python = system; then
7992     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
7993         python_version=2.7
7994         PYTHON=python$python_version
7995         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
7996             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
7997             PYTHON_LIBS="-framework Python"
7998         else
7999             PYTHON_CFLAGS="`$PYTHON-config --includes`"
8000             PYTHON_LIBS="`$PYTHON-config --libs`"
8001         fi
8002     fi
8003     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8004         # Fallback: Accept these in the environment, or as set above
8005         # for MacOSX.
8006         :
8007     elif test "$cross_compiling" != yes; then
8008         # Unset variables set by the above AM_PATH_PYTHON so that
8009         # we actually do check anew.
8010         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
8011         # This causes an error if no python command is found
8012         AM_PATH_PYTHON([3.3])
8013         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8014         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8015         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8016         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8017         if test -z "$PKG_CONFIG"; then
8018             PYTHON_CFLAGS="-I$python_include"
8019             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8020         elif $PKG_CONFIG --exists python-$python_version; then
8021             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8022             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8023         else
8024             PYTHON_CFLAGS="-I$python_include"
8025             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8026         fi
8027         FilterLibs "${PYTHON_LIBS}"
8028         PYTHON_LIBS="${filteredlibs}"
8029     else
8030         dnl How to find out the cross-compilation Python installation path?
8031         AC_MSG_CHECKING([for python version])
8032         AS_IF([test -n "$PYTHON_VERSION"],
8033               [AC_MSG_RESULT([$PYTHON_VERSION])],
8034               [AC_MSG_RESULT([not found])
8035                AC_MSG_ERROR([no usable python found])])
8036         test -n "$PYTHON_CFLAGS" && break
8037     fi
8038     # let the PYTHON_FOR_BUILD match the same python installation that
8039     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8040     # better for PythonTests.
8041     PYTHON_FOR_BUILD=$PYTHON
8044 dnl By now enable_python should be "system", "internal" or "no"
8045 case $enable_python in
8046 system)
8047     SYSTEM_PYTHON=TRUE
8049     dnl Check if the headers really work
8050     save_CPPFLAGS="$CPPFLAGS"
8051     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8052     AC_CHECK_HEADER(Python.h, [],
8053        [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
8054        [])
8055     CPPFLAGS="$save_CPPFLAGS"
8057     AC_LANG_PUSH(C)
8058     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8059     AC_MSG_CHECKING([for correct python library version])
8060        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8061 #include <Python.h>
8063 int main(int argc, char **argv) {
8064    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
8065        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8066    else return 1;
8068        ]])],[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])])
8069     CFLAGS=$save_CFLAGS
8070     AC_LANG_POP(C)
8072     dnl FIXME Check if the Python library can be linked with, too?
8073     ;;
8075 internal)
8076     SYSTEM_PYTHON=
8077     PYTHON_VERSION_MAJOR=3
8078     PYTHON_VERSION_MINOR=5
8079     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.4
8080     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8081         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8082     fi
8083     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8084     BUILD_TYPE="$BUILD_TYPE PYTHON"
8085     # Embedded Python dies without Home set
8086     if test "$HOME" = ""; then
8087         export HOME=""
8088     fi
8089     # bz2 tarball and bzip2 is not standard
8090     if test -z "$BZIP2"; then
8091         AC_PATH_PROG( BZIP2, bzip2)
8092         if test -z "$BZIP2"; then
8093             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
8094         fi
8095     fi
8096     ;;
8098     DISABLE_PYTHON=TRUE
8099     SYSTEM_PYTHON=
8100     ;;
8102     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8103     ;;
8104 esac
8106 AC_SUBST(DISABLE_PYTHON)
8107 AC_SUBST(SYSTEM_PYTHON)
8108 AC_SUBST(PYTHON_CFLAGS)
8109 AC_SUBST(PYTHON_LIBS)
8110 AC_SUBST(PYTHON_VERSION)
8111 AC_SUBST(PYTHON_VERSION_MAJOR)
8112 AC_SUBST(PYTHON_VERSION_MINOR)
8114 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8115 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8116     AC_MSG_RESULT([yes])
8117     ENABLE_MARIADBC=TRUE
8118     MARIADBC_MAJOR=1
8119     MARIADBC_MINOR=0
8120     MARIADBC_MICRO=2
8121     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8122 else
8123     AC_MSG_RESULT([no])
8124     ENABLE_MARIADBC=
8126 AC_SUBST(ENABLE_MARIADBC)
8127 AC_SUBST(MARIADBC_MAJOR)
8128 AC_SUBST(MARIADBC_MINOR)
8129 AC_SUBST(MARIADBC_MICRO)
8131 if test "$ENABLE_MARIADBC" = "TRUE"; then
8133     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8135     dnl ===================================================================
8136     dnl Check for system MariaDB
8137     dnl ===================================================================
8138     AC_MSG_CHECKING([which MariaDB to use])
8139     if test "$with_system_mariadb" = "yes"; then
8140         AC_MSG_RESULT([external])
8141         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8142         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8143         if test -z "$MARIADBCONFIG"; then
8144             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8145             if test -z "$MARIADBCONFIG"; then
8146                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8147                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8148             fi
8149         fi
8150         AC_MSG_CHECKING([MariaDB version])
8151         MARIADB_VERSION=`$MARIADBCONFIG --version`
8152         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8153         if test "$MARIADB_MAJOR" -ge "5"; then
8154             AC_MSG_RESULT([OK])
8155         else
8156             AC_MSG_ERROR([too old, use 5.0.x or later])
8157         fi
8158         AC_MSG_CHECKING([for MariaDB Client library])
8159         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8160         if test "$COM_IS_CLANG" = TRUE; then
8161             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8162         fi
8163         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8164         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8165         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8166         dnl linux32:
8167         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8168             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8169             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8170                 | sed -e 's|/lib64/|/lib/|')
8171         fi
8172         FilterLibs "${MARIADB_LIBS}"
8173         MARIADB_LIBS="${filteredlibs}"
8174         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8175         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8176         if test "$enable_bundle_mariadb" = "yes"; then
8177             AC_MSG_RESULT([yes])
8178             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8179             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8181 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8183 /g' | grep -E '(mysqlclient|mariadb)')
8184             if test "$_os" = "Darwin"; then
8185                 LIBMARIADB=${LIBMARIADB}.dylib
8186             elif test "$_os" = "WINNT"; then
8187                 LIBMARIADB=${LIBMARIADB}.dll
8188             else
8189                 LIBMARIADB=${LIBMARIADB}.so
8190             fi
8191             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8192             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8193             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8194                 AC_MSG_RESULT([found.])
8195                 PathFormat "$LIBMARIADB_PATH"
8196                 LIBMARIADB_PATH="$formatted_path"
8197             else
8198                 AC_MSG_ERROR([not found.])
8199             fi
8200         else
8201             AC_MSG_RESULT([no])
8202             BUNDLE_MARIADB_CONNECTOR_C=
8203         fi
8204     else
8205         AC_MSG_RESULT([internal])
8206         SYSTEM_MARIADB_CONNECTOR_C=
8207         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8208         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8209         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8210     fi
8212     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8213     AC_SUBST(MARIADB_CFLAGS)
8214     AC_SUBST(MARIADB_LIBS)
8215     AC_SUBST(LIBMARIADB)
8216     AC_SUBST(LIBMARIADB_PATH)
8217     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8219     AC_LANG_PUSH([C++])
8220     dnl ===================================================================
8221     dnl Check for system MySQL C++ Connector
8222     dnl ===================================================================
8223     # FIXME!
8224     # who thought this too-generic cppconn dir was a good idea?
8225     AC_MSG_CHECKING([MySQL Connector/C++])
8226     if test "$with_system_mysql_cppconn" = "yes"; then
8227         AC_MSG_RESULT([external])
8228         SYSTEM_MYSQL_CONNECTOR_CPP=TRUE
8229         AC_LANG_PUSH([C++])
8230         AC_CHECK_HEADER(mysql_driver.h, [],
8231                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8232         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8233                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8234         save_LIBS=$LIBS
8235         LIBS="$LIBS -lmysqlcppconn"
8236         AC_MSG_CHECKING([version])
8237         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8238 #include <mysql_driver.h>
8240 int main(int argc, char **argv) {
8241     sql::Driver *driver;
8242     driver = get_driver_instance();
8243     if (driver->getMajorVersion() > 1 || \
8244        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8245        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8246         return 0;
8247       else
8248         return 1;
8250       ]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR([not suitable, we need >= 1.0.6])],[AC_MSG_ERROR([MySQL C++ Connecter not tested with cross-compilation])])
8252         AC_LANG_POP([C++])
8253         LIBS=$save_LIBS
8254     else
8255         AC_MSG_RESULT([internal])
8256         BUILD_TYPE="$BUILD_TYPE MYSQL_CONNECTOR_CPP"
8257         SYSTEM_MYSQL_CONNECTOR_CPP=
8258     fi
8259     AC_LANG_POP([C++])
8261 AC_SUBST(SYSTEM_MYSQL_CONNECTOR_CPP)
8263 dnl ===================================================================
8264 dnl Check for system hsqldb
8265 dnl ===================================================================
8266 if test "$with_java" != "no"; then
8267     HSQLDB_USE_JDBC_4_1=
8268     AC_MSG_CHECKING([which hsqldb to use])
8269     if test "$with_system_hsqldb" = "yes"; then
8270         AC_MSG_RESULT([external])
8271         SYSTEM_HSQLDB=TRUE
8272         if test -z $HSQLDB_JAR; then
8273             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8274         fi
8275         if ! test -f $HSQLDB_JAR; then
8276                AC_MSG_ERROR(hsqldb.jar not found.)
8277         fi
8278         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8279         export HSQLDB_JAR
8280         if $PERL -e \
8281            'use Archive::Zip;
8282             my $file = "$ENV{'HSQLDB_JAR'}";
8283             my $zip = Archive::Zip->new( $file );
8284             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8285             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8286             {
8287                 push @l, split(/\n/, $mf);
8288                 foreach my $line (@l)
8289                 {
8290                     if ($line =~ m/Specification-Version:/)
8291                     {
8292                         ($t, $version) = split (/:/,$line);
8293                         $version =~ s/^\s//;
8294                         ($a, $b, $c, $d) = split (/\./,$version);
8295                         if ($c == "0" && $d > "8")
8296                         {
8297                             exit 0;
8298                         }
8299                         else
8300                         {
8301                             exit 1;
8302                         }
8303                     }
8304                 }
8305             }
8306             else
8307             {
8308                 exit 1;
8309             }'; then
8310             AC_MSG_RESULT([yes])
8311         else
8312             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8313         fi
8314     else
8315         AC_MSG_RESULT([internal])
8316         SYSTEM_HSQLDB=
8317         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8318         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8319         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8320         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8321             AC_MSG_RESULT([yes])
8322             HSQLDB_USE_JDBC_4_1=TRUE
8323         else
8324             AC_MSG_RESULT([no])
8325         fi
8326     fi
8327     AC_SUBST(SYSTEM_HSQLDB)
8328     AC_SUBST(HSQLDB_JAR)
8329     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8332 dnl ===================================================================
8333 dnl Check for PostgreSQL stuff
8334 dnl ===================================================================
8335 if test "x$enable_postgresql_sdbc" != "xno"; then
8336     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8338     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8339         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8340     fi
8341     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8342         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8343     fi
8345     postgres_interface=""
8346     if test "$with_system_postgresql" = "yes"; then
8347         postgres_interface="external PostgreSQL"
8348         SYSTEM_POSTGRESQL=TRUE
8349         if test "$_os" = Darwin; then
8350             supp_path=''
8351             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8352                 pg_supp_path="$P_SEP$d$pg_supp_path"
8353             done
8354         fi
8355         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8356         if test -z "$PGCONFIG"; then
8357             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8358         fi
8359         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8360         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8361         FilterLibs "${POSTGRESQL_LIB}"
8362         POSTGRESQL_LIB="${filteredlibs}"
8363     else
8364         # if/when anything else than PostgreSQL uses Kerberos,
8365         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8366         WITH_KRB5=
8367         WITH_GSSAPI=
8368         case "$_os" in
8369         Darwin)
8370             # MacOS X has system MIT Kerberos 5 since 10.4
8371             if test "$with_krb5" != "no"; then
8372                 WITH_KRB5=TRUE
8373                 save_LIBS=$LIBS
8374                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8375                 # that the libraries where these functions are located on macOS will change, is it?
8376                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8377                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8378                 KRB5_LIBS=$LIBS
8379                 LIBS=$save_LIBS
8380                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8381                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8382                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8383                 LIBS=$save_LIBS
8384             fi
8385             if test "$with_gssapi" != "no"; then
8386                 WITH_GSSAPI=TRUE
8387                 save_LIBS=$LIBS
8388                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8389                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8390                 GSSAPI_LIBS=$LIBS
8391                 LIBS=$save_LIBS
8392             fi
8393             ;;
8394         WINNT)
8395             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8396                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8397             fi
8398             ;;
8399         Linux|GNU|*BSD|DragonFly)
8400             if test "$with_krb5" != "no"; then
8401                 WITH_KRB5=TRUE
8402                 save_LIBS=$LIBS
8403                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8404                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8405                 KRB5_LIBS=$LIBS
8406                 LIBS=$save_LIBS
8407                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8408                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8409                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8410                 LIBS=$save_LIBS
8411             fi
8412             if test "$with_gssapi" != "no"; then
8413                 WITH_GSSAPI=TRUE
8414                 save_LIBS=$LIBS
8415                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8416                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8417                 GSSAPI_LIBS=$LIBS
8418                 LIBS=$save_LIBS
8419             fi
8420             ;;
8421         *)
8422             if test "$with_krb5" = "yes"; then
8423                 WITH_KRB5=TRUE
8424                 save_LIBS=$LIBS
8425                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8426                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8427                 KRB5_LIBS=$LIBS
8428                 LIBS=$save_LIBS
8429                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8430                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8431                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8432                 LIBS=$save_LIBS
8433             fi
8434             if test "$with_gssapi" = "yes"; then
8435                 WITH_GSSAPI=TRUE
8436                 save_LIBS=$LIBS
8437                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8438                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8439                 LIBS=$save_LIBS
8440                 GSSAPI_LIBS=$LIBS
8441             fi
8442         esac
8444         if test -n "$with_libpq_path"; then
8445             SYSTEM_POSTGRESQL=TRUE
8446             postgres_interface="external libpq"
8447             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8448             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8449         else
8450             SYSTEM_POSTGRESQL=
8451             postgres_interface="internal"
8452             POSTGRESQL_LIB=""
8453             POSTGRESQL_INC="%OVERRIDE_ME%"
8454             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8455         fi
8456     fi
8458     AC_MSG_CHECKING([PostgreSQL C interface])
8459     AC_MSG_RESULT([$postgres_interface])
8461     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8462         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8463         save_CFLAGS=$CFLAGS
8464         save_CPPFLAGS=$CPPFLAGS
8465         save_LIBS=$LIBS
8466         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8467         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8468         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8469         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8470             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8471         CFLAGS=$save_CFLAGS
8472         CPPFLAGS=$save_CPPFLAGS
8473         LIBS=$save_LIBS
8474     fi
8475     BUILD_POSTGRESQL_SDBC=TRUE
8477 AC_SUBST(WITH_KRB5)
8478 AC_SUBST(WITH_GSSAPI)
8479 AC_SUBST(GSSAPI_LIBS)
8480 AC_SUBST(KRB5_LIBS)
8481 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8482 AC_SUBST(SYSTEM_POSTGRESQL)
8483 AC_SUBST(POSTGRESQL_INC)
8484 AC_SUBST(POSTGRESQL_LIB)
8486 dnl ===================================================================
8487 dnl Check for Firebird stuff
8488 dnl ===================================================================
8489 ENABLE_FIREBIRD_SDBC=""
8490 if test "$enable_firebird_sdbc" = "yes" ; then
8491     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8493     dnl ===================================================================
8494     dnl Check for system Firebird
8495     dnl ===================================================================
8496     AC_MSG_CHECKING([which Firebird to use])
8497     if test "$with_system_firebird" = "yes"; then
8498         AC_MSG_RESULT([external])
8499         SYSTEM_FIREBIRD=TRUE
8500         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8501         if test -z "$FIREBIRDCONFIG"; then
8502             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8503             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8504                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8505             ])
8506             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8507         else
8508             AC_MSG_NOTICE([fb_config found])
8509             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8510             AC_MSG_CHECKING([for Firebird Client library])
8511             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8512             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8513             FilterLibs "${FIREBIRD_LIBS}"
8514             FIREBIRD_LIBS="${filteredlibs}"
8515         fi
8516         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8517         AC_MSG_CHECKING([Firebird version])
8518         if test -n "${FIREBIRD_VERSION}"; then
8519             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8520             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8521             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8522                 AC_MSG_RESULT([OK])
8523             else
8524                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
8525             fi
8526         else
8527             __save_CFLAGS="${CFLAGS}"
8528             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8529             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8530 #if defined(FB_API_VER) && FB_API_VER == 30
8531 int fb_api_is_30(void) { return 0; }
8532 #else
8533 #error "Wrong Firebird API version"
8534 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
8535             CFLAGS="${__save_CFLAGS}"
8536         fi
8537         ENABLE_FIREBIRD_SDBC="TRUE"
8538     elif test "$enable_database_connectivity" != yes; then
8539         AC_MSG_RESULT([none])
8540     elif test "$cross_compiling" = "yes"; then
8541         AC_MSG_RESULT([none])
8542     else
8543         dnl Embedded Firebird has version 3.0
8544         AC_DEFINE(HAVE_FIREBIRD_30, 1)
8545         dnl We need libatomic-ops for any non X86/X64 system
8546         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8547             dnl ===================================================================
8548             dnl Check for system libatomic-ops
8549             dnl ===================================================================
8550             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8551             if test "$with_system_libatomic_ops" = "yes"; then
8552                 SYSTEM_LIBATOMIC_OPS=TRUE
8553                 AC_CHECK_HEADERS(atomic_ops.h, [],
8554                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8555             else
8556                 SYSTEM_LIBATOMIC_OPS=
8557                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8558                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8559                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8560             fi
8561         fi
8563         AC_MSG_RESULT([internal])
8564         SYSTEM_FIREBIRD=
8565         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
8566         FIREBIRD_LIBS="-lfbclient"
8568         if test "$with_system_libtommath" = "yes"; then
8569             SYSTEM_LIBTOMMATH=TRUE
8570             dnl check for tommath presence
8571             save_LIBS=$LIBS
8572             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
8573             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
8574             LIBS=$save_LIBS
8575         else
8576             SYSTEM_LIBTOMMATH=
8577             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
8578             LIBTOMMATH_LIBS="-ltommath"
8579             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
8580         fi
8582         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8583         ENABLE_FIREBIRD_SDBC="TRUE"
8584     fi
8586 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8587 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8588 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8589 AC_SUBST(LIBATOMIC_OPS_LIBS)
8590 AC_SUBST(SYSTEM_FIREBIRD)
8591 AC_SUBST(FIREBIRD_CFLAGS)
8592 AC_SUBST(FIREBIRD_LIBS)
8593 AC_SUBST([TOMMATH_CFLAGS])
8594 AC_SUBST([TOMMATH_LIBS])
8596 dnl ===================================================================
8597 dnl Check for system curl
8598 dnl ===================================================================
8599 AC_MSG_CHECKING([which libcurl to use])
8600 if test "$with_system_curl" = "auto"; then
8601     with_system_curl="$with_system_libs"
8604 if test "$with_system_curl" = "yes"; then
8605     AC_MSG_RESULT([external])
8606     SYSTEM_CURL=TRUE
8608     # First try PKGCONFIG and then fall back
8609     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8611     if test -n "$CURL_PKG_ERRORS"; then
8612         AC_PATH_PROG(CURLCONFIG, curl-config)
8613         if test -z "$CURLCONFIG"; then
8614             AC_MSG_ERROR([curl development files not found])
8615         fi
8616         CURL_LIBS=`$CURLCONFIG --libs`
8617         FilterLibs "${CURL_LIBS}"
8618         CURL_LIBS="${filteredlibs}"
8619         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8620         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8622         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8623         case $curl_version in
8624         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8625         dnl so they need to be doubled to end up in the configure script
8626         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8627             AC_MSG_RESULT([yes])
8628             ;;
8629         *)
8630             AC_MSG_ERROR([no, you have $curl_version])
8631             ;;
8632         esac
8633     fi
8635     ENABLE_CURL=TRUE
8636 elif test $_os = iOS; then
8637     # Let's see if we need curl, I think not?
8638     AC_MSG_RESULT([none])
8639     ENABLE_CURL=
8640 else
8641     AC_MSG_RESULT([internal])
8642     SYSTEM_CURL=
8643     BUILD_TYPE="$BUILD_TYPE CURL"
8644     ENABLE_CURL=TRUE
8646 AC_SUBST(SYSTEM_CURL)
8647 AC_SUBST(CURL_CFLAGS)
8648 AC_SUBST(CURL_LIBS)
8649 AC_SUBST(ENABLE_CURL)
8651 dnl ===================================================================
8652 dnl Check for system boost
8653 dnl ===================================================================
8654 AC_MSG_CHECKING([which boost to use])
8655 if test "$with_system_boost" = "yes"; then
8656     AC_MSG_RESULT([external])
8657     SYSTEM_BOOST=TRUE
8658     AX_BOOST_BASE(1.47)
8659     AX_BOOST_DATE_TIME
8660     AX_BOOST_FILESYSTEM
8661     AX_BOOST_IOSTREAMS
8662     AX_BOOST_LOCALE
8663     AC_LANG_PUSH([C++])
8664     save_CXXFLAGS=$CXXFLAGS
8665     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8666     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8667        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8668     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8669        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8670     CXXFLAGS=$save_CXXFLAGS
8671     AC_LANG_POP([C++])
8672     # this is in m4/ax_boost_base.m4
8673     FilterLibs "${BOOST_LDFLAGS}"
8674     BOOST_LDFLAGS="${filteredlibs}"
8675 else
8676     AC_MSG_RESULT([internal])
8677     BUILD_TYPE="$BUILD_TYPE BOOST"
8678     SYSTEM_BOOST=
8679     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
8680         # use warning-suppressing wrapper headers
8681         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
8682     else
8683         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
8684     fi
8686 AC_SUBST(SYSTEM_BOOST)
8688 dnl ===================================================================
8689 dnl Check for system mdds
8690 dnl ===================================================================
8691 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.2 >= 1.2.3], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8693 dnl ===================================================================
8694 dnl Check for system glm
8695 dnl ===================================================================
8696 AC_MSG_CHECKING([which glm to use])
8697 if test "$with_system_glm" = "yes"; then
8698     AC_MSG_RESULT([external])
8699     SYSTEM_GLM=TRUE
8700     AC_LANG_PUSH([C++])
8701     AC_CHECK_HEADER([glm/glm.hpp], [],
8702        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8703     AC_LANG_POP([C++])
8704 else
8705     AC_MSG_RESULT([internal])
8706     BUILD_TYPE="$BUILD_TYPE GLM"
8707     SYSTEM_GLM=
8708     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8710 AC_SUBST([GLM_CFLAGS])
8711 AC_SUBST([SYSTEM_GLM])
8713 dnl ===================================================================
8714 dnl Check for system odbc
8715 dnl ===================================================================
8716 AC_MSG_CHECKING([which odbc headers to use])
8717 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
8718     AC_MSG_RESULT([external])
8719     SYSTEM_ODBC_HEADERS=TRUE
8721     if test "$build_os" = "cygwin"; then
8722         save_CPPFLAGS=$CPPFLAGS
8723         find_winsdk
8724         PathFormat "$winsdktest"
8725         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"
8726         AC_CHECK_HEADER(sqlext.h, [],
8727             [AC_MSG_ERROR(odbc not found. install odbc)],
8728             [#include <windows.h>])
8729         CPPFLAGS=$save_CPPFLAGS
8730     else
8731         AC_CHECK_HEADER(sqlext.h, [],
8732             [AC_MSG_ERROR(odbc not found. install odbc)],[])
8733     fi
8734 elif test "$enable_database_connectivity" != yes; then
8735     AC_MSG_RESULT([none])
8736 else
8737     AC_MSG_RESULT([internal])
8738     SYSTEM_ODBC_HEADERS=
8740 AC_SUBST(SYSTEM_ODBC_HEADERS)
8743 dnl ===================================================================
8744 dnl Check for system openldap
8745 dnl ===================================================================
8747 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8748 AC_MSG_CHECKING([which openldap library to use])
8749 if test "$with_system_openldap" = "yes"; then
8750     AC_MSG_RESULT([external])
8751     SYSTEM_OPENLDAP=TRUE
8752     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8753     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8754     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8755 else
8756     AC_MSG_RESULT([internal])
8757     SYSTEM_OPENLDAP=
8758     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8761 AC_SUBST(SYSTEM_OPENLDAP)
8763 dnl ===================================================================
8764 dnl Check for system NSS
8765 dnl ===================================================================
8766 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
8767     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8768     AC_DEFINE(HAVE_FEATURE_NSS)
8769     ENABLE_NSS="TRUE"
8770     AC_DEFINE(ENABLE_NSS)
8771 elif test $_os != iOS ; then
8772     with_tls=openssl
8774 AC_SUBST(ENABLE_NSS)
8776 dnl ===================================================================
8777 dnl Check for TLS/SSL and cryptographic implementation to use
8778 dnl ===================================================================
8779 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8780 if test -n "$with_tls"; then
8781     case $with_tls in
8782     openssl)
8783         AC_DEFINE(USE_TLS_OPENSSL)
8784         TLS=OPENSSL
8786         if test "$enable_openssl" != "yes"; then
8787             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8788         fi
8790         # warn that OpenSSL has been selected but not all TLS code has this option
8791         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
8792         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
8793         ;;
8794     nss)
8795         AC_DEFINE(USE_TLS_NSS)
8796         TLS=NSS
8797         ;;
8798     no)
8799         AC_MSG_WARN([Skipping TLS/SSL])
8800         ;;
8801     *)
8802         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8803 openssl - OpenSSL
8804 nss - Mozilla's Network Security Services (NSS)
8805     ])
8806         ;;
8807     esac
8808 else
8809     # default to using NSS, it results in smaller oox lib
8810     AC_DEFINE(USE_TLS_NSS)
8811     TLS=NSS
8813 AC_MSG_RESULT([$TLS])
8814 AC_SUBST(TLS)
8816 dnl ===================================================================
8817 dnl Check for system sane
8818 dnl ===================================================================
8819 AC_MSG_CHECKING([which sane header to use])
8820 if test "$with_system_sane" = "yes"; then
8821     AC_MSG_RESULT([external])
8822     AC_CHECK_HEADER(sane/sane.h, [],
8823       [AC_MSG_ERROR(sane not found. install sane)], [])
8824 else
8825     AC_MSG_RESULT([internal])
8826     BUILD_TYPE="$BUILD_TYPE SANE"
8829 dnl ===================================================================
8830 dnl Check for system icu
8831 dnl ===================================================================
8832 SYSTEM_GENBRK=
8833 SYSTEM_GENCCODE=
8834 SYSTEM_GENCMN=
8836 ICU_MAJOR=60
8837 ICU_MINOR=2
8838 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
8839 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
8840 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
8841 AC_MSG_CHECKING([which icu to use])
8842 if test "$with_system_icu" = "yes"; then
8843     AC_MSG_RESULT([external])
8844     SYSTEM_ICU=TRUE
8845     AC_LANG_PUSH([C++])
8846     AC_MSG_CHECKING([for unicode/rbbi.h])
8847     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
8848     AC_LANG_POP([C++])
8850     if test "$cross_compiling" != "yes"; then
8851         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
8852         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
8853         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
8854         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
8855     fi
8857     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
8858         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
8859         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
8860         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
8861         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
8862         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
8863             AC_MSG_RESULT([yes])
8864         else
8865             AC_MSG_RESULT([no])
8866             if test "$with_system_icu_for_build" != "force"; then
8867                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
8868 You can use --with-system-icu-for-build=force to use it anyway.])
8869             fi
8870         fi
8871     fi
8873     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
8874         # using the system icu tools can lead to version confusion, use the
8875         # ones from the build environment when cross-compiling
8876         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
8877         if test -z "$SYSTEM_GENBRK"; then
8878             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
8879         fi
8880         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8881         if test -z "$SYSTEM_GENCCODE"; then
8882             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
8883         fi
8884         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8885         if test -z "$SYSTEM_GENCMN"; then
8886             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
8887         fi
8888         if test "$ICU_MAJOR" -ge "49"; then
8889             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
8890             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
8891             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
8892         else
8893             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
8894             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
8895             ICU_RECLASSIFIED_HEBREW_LETTER=
8896         fi
8897     fi
8899     if test "$cross_compiling" = "yes"; then
8900         if test "$ICU_MAJOR" -ge "50"; then
8901             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
8902             ICU_MINOR=""
8903         fi
8904     fi
8905 else
8906     AC_MSG_RESULT([internal])
8907     SYSTEM_ICU=
8908     BUILD_TYPE="$BUILD_TYPE ICU"
8909     # surprisingly set these only for "internal" (to be used by various other
8910     # external libs): the system icu-config is quite unhelpful and spits out
8911     # dozens of weird flags and also default path -I/usr/include
8912     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8913     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
8915 if test "$ICU_MAJOR" -ge "59"; then
8916     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
8917     # with -std=c++11 but not all external libraries can be built with that,
8918     # for those use a bit-compatible typedef uint16_t UChar; see
8919     # icu/source/common/unicode/umachine.h
8920     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
8921 else
8922     ICU_UCHAR_TYPE=""
8924 AC_SUBST(SYSTEM_ICU)
8925 AC_SUBST(SYSTEM_GENBRK)
8926 AC_SUBST(SYSTEM_GENCCODE)
8927 AC_SUBST(SYSTEM_GENCMN)
8928 AC_SUBST(ICU_MAJOR)
8929 AC_SUBST(ICU_MINOR)
8930 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
8931 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
8932 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
8933 AC_SUBST(ICU_CFLAGS)
8934 AC_SUBST(ICU_LIBS)
8935 AC_SUBST(ICU_UCHAR_TYPE)
8937 dnl ==================================================================
8938 dnl Breakpad
8939 dnl ==================================================================
8940 AC_MSG_CHECKING([whether to enable breakpad])
8941 if test "$enable_breakpad" != yes; then
8942     AC_MSG_RESULT([no])
8943 else
8944     AC_MSG_RESULT([yes])
8945     ENABLE_BREAKPAD="TRUE"
8946     AC_DEFINE(ENABLE_BREAKPAD)
8947     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
8948     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
8950     AC_MSG_CHECKING([for crashreport config])
8951     if test "$with_symbol_config" = "no"; then
8952         BREAKPAD_SYMBOL_CONFIG="invalid"
8953         AC_MSG_RESULT([no])
8954     else
8955         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
8956         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
8957         AC_MSG_RESULT([yes])
8958     fi
8959     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
8961 AC_SUBST(ENABLE_BREAKPAD)
8963 dnl ==================================================================
8964 dnl libfuzzer
8965 dnl ==================================================================
8966 AC_MSG_CHECKING([whether to enable fuzzers])
8967 if test "$enable_fuzzers" != yes; then
8968     AC_MSG_RESULT([no])
8969 else
8970     AC_MSG_RESULT([yes])
8971     ENABLE_FUZZERS="TRUE"
8972     AC_DEFINE(ENABLE_FUZZERS)
8973     BUILD_TYPE="$BUILD_TYPE FUZZERS"
8975 AC_SUBST(ENABLE_FUZZERS)
8977 dnl ===================================================================
8978 dnl Orcus
8979 dnl ===================================================================
8980 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.13 >= 0.13.3])
8981 if test "$with_system_orcus" != "yes"; then
8982     if test "$SYSTEM_BOOST" = "TRUE"; then
8983         # ===========================================================
8984         # Determine if we are going to need to link with Boost.System
8985         # ===========================================================
8986         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
8987         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
8988         dnl in documentation has no effect.
8989         AC_MSG_CHECKING([if we need to link with Boost.System])
8990         AC_LANG_PUSH([C++])
8991         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
8992                 @%:@include <boost/version.hpp>
8993             ]],[[
8994                 #if BOOST_VERSION >= 105000
8995                 #   error yes, we need to link with Boost.System
8996                 #endif
8997             ]])],[
8998                 AC_MSG_RESULT([no])
8999             ],[
9000                 AC_MSG_RESULT([yes])
9001                 AX_BOOST_SYSTEM
9002         ])
9003         AC_LANG_POP([C++])
9004     fi
9006 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9007 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9008 AC_SUBST([BOOST_SYSTEM_LIB])
9009 AC_SUBST(SYSTEM_LIBORCUS)
9011 dnl ===================================================================
9012 dnl HarfBuzz
9013 dnl ===================================================================
9014 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9015                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9016                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9018 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9019                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9020                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9022 if test "$COM" = "MSC"; then # override the above
9023     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9024     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9027 if test "$with_system_harfbuzz" = "yes"; then
9028     if test "$with_system_graphite" = "no"; then
9029         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9030     fi
9031     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9032     _save_libs="$LIBS"
9033     _save_cflags="$CFLAGS"
9034     LIBS="$LIBS $HARFBUZZ_LIBS"
9035     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9036     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9037     LIBS="$_save_libs"
9038     CFLAGS="$_save_cflags"
9039 else
9040     if test "$with_system_graphite" = "yes"; then
9041         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9042     fi
9045 AC_MSG_CHECKING([whether to use X11])
9046 dnl ***************************************
9047 dnl testing for X libraries and includes...
9048 dnl ***************************************
9049 if test "$USING_X11" = TRUE; then
9050     AC_DEFINE(HAVE_FEATURE_X11)
9052 AC_MSG_RESULT([$USING_X11])
9054 if test "$USING_X11" = TRUE; then
9055     AC_PATH_X
9056     AC_PATH_XTRA
9057     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9059     if test -z "$x_includes"; then
9060         x_includes="default_x_includes"
9061     fi
9062     if test -z "$x_libraries"; then
9063         x_libraries="default_x_libraries"
9064     fi
9065     CFLAGS="$CFLAGS $X_CFLAGS"
9066     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9067     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9068 else
9069     x_includes="no_x_includes"
9070     x_libraries="no_x_libraries"
9073 if test "$USING_X11" = TRUE; then
9074     dnl ===================================================================
9075     dnl Check for extension headers
9076     dnl ===================================================================
9077     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9078      [#include <X11/extensions/shape.h>])
9080     # vcl needs ICE and SM
9081     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9082     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9083         [AC_MSG_ERROR(ICE library not found)])
9084     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9085     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9086         [AC_MSG_ERROR(SM library not found)])
9089 dnl ===================================================================
9090 dnl Check for system Xrender
9091 dnl ===================================================================
9092 AC_MSG_CHECKING([whether to use Xrender])
9093 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9094     AC_MSG_RESULT([yes])
9095     PKG_CHECK_MODULES(XRENDER, xrender)
9096     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9097     FilterLibs "${XRENDER_LIBS}"
9098     XRENDER_LIBS="${filteredlibs}"
9099     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9100       [AC_MSG_ERROR(libXrender not found or functional)], [])
9101     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9102       [AC_MSG_ERROR(Xrender not found. install X)], [])
9103 else
9104     AC_MSG_RESULT([no])
9106 AC_SUBST(XRENDER_CFLAGS)
9107 AC_SUBST(XRENDER_LIBS)
9109 dnl ===================================================================
9110 dnl Check for XRandr
9111 dnl ===================================================================
9112 AC_MSG_CHECKING([whether to enable RandR support])
9113 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9114     AC_MSG_RESULT([yes])
9115     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9116     if test "$ENABLE_RANDR" != "TRUE"; then
9117         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9118                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9119         XRANDR_CFLAGS=" "
9120         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9121           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9122         XRANDR_LIBS="-lXrandr "
9123         ENABLE_RANDR="TRUE"
9124     fi
9125     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9126     FilterLibs "${XRANDR_LIBS}"
9127     XRANDR_LIBS="${filteredlibs}"
9128 else
9129     ENABLE_RANDR=""
9130     AC_MSG_RESULT([no])
9132 AC_SUBST(XRANDR_CFLAGS)
9133 AC_SUBST(XRANDR_LIBS)
9134 AC_SUBST(ENABLE_RANDR)
9136 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9137     WITH_WEBDAV="serf"
9139 if test $_os = iOS -o $_os = Android; then
9140     WITH_WEBDAV="no"
9142 AC_MSG_CHECKING([for webdav library])
9143 case "$WITH_WEBDAV" in
9144 serf)
9145     AC_MSG_RESULT([serf])
9146     # Check for system apr-util
9147     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9148                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9149                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9150     if test "$COM" = "MSC"; then
9151         APR_LIB_DIR="LibR"
9152         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9153         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9154     fi
9156     # Check for system serf
9157     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9158                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9159     if test "$COM" = "MSC"; then
9160         SERF_LIB_DIR="Release"
9161         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9162         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9163     fi
9164     ;;
9165 neon)
9166     AC_MSG_RESULT([neon])
9167     # Check for system neon
9168     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9169     if test "$with_system_neon" = "yes"; then
9170         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9171     else
9172         NEON_VERSION=0295
9173     fi
9174     AC_SUBST(NEON_VERSION)
9175     ;;
9177     AC_MSG_RESULT([none, disabled])
9178     WITH_WEBDAV=""
9179     ;;
9180 esac
9181 AC_SUBST(WITH_WEBDAV)
9183 dnl ===================================================================
9184 dnl Check for disabling cve_tests
9185 dnl ===================================================================
9186 AC_MSG_CHECKING([whether to execute CVE tests])
9187 # If not explicitly enabled or disabled, default
9188 if test -z "$enable_cve_tests"; then
9189     case "$OS" in
9190     WNT)
9191         # Default cves off for windows with its wild and wonderful
9192         # varienty of AV software kicking in and panicing
9193         enable_cve_tests=no
9194         ;;
9195     *)
9196         # otherwise yes
9197         enable_cve_tests=yes
9198         ;;
9199     esac
9201 if test "$enable_cve_tests" = "no"; then
9202     AC_MSG_RESULT([no])
9203     DISABLE_CVE_TESTS=TRUE
9204     AC_SUBST(DISABLE_CVE_TESTS)
9205 else
9206     AC_MSG_RESULT([yes])
9209 dnl ===================================================================
9210 dnl Check for enabling chart XShape tests
9211 dnl ===================================================================
9212 AC_MSG_CHECKING([whether to execute chart XShape tests])
9213 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9214     AC_MSG_RESULT([yes])
9215     ENABLE_CHART_TESTS=TRUE
9216     AC_SUBST(ENABLE_CHART_TESTS)
9217 else
9218     AC_MSG_RESULT([no])
9221 dnl ===================================================================
9222 dnl Check for system openssl
9223 dnl ===================================================================
9224 DISABLE_OPENSSL=
9225 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9226 if test "$enable_openssl" = "yes"; then
9227     AC_MSG_RESULT([no])
9228     if test "$_os" = Darwin ; then
9229         # OpenSSL is deprecated when building for 10.7 or later.
9230         #
9231         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9232         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9234         with_system_openssl=no
9235         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9236     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9237             && test "$with_system_openssl" != "no"; then
9238         with_system_openssl=yes
9239         SYSTEM_OPENSSL=TRUE
9240         OPENSSL_CFLAGS=
9241         OPENSSL_LIBS="-lssl -lcrypto"
9242     else
9243         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9244     fi
9245     if test "$with_system_openssl" = "yes"; then
9246         AC_MSG_CHECKING([whether openssl supports SHA512])
9247         AC_LANG_PUSH([C])
9248         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9249             SHA512_CTX context;
9250 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9251         AC_LANG_POP(C)
9252     fi
9253 else
9254     AC_MSG_RESULT([yes])
9255     DISABLE_OPENSSL=TRUE
9257     # warn that although OpenSSL is disabled, system libraries may depend on it
9258     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9259     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9262 AC_SUBST([DISABLE_OPENSSL])
9264 dnl ===================================================================
9265 dnl Check for building gnutls
9266 dnl ===================================================================
9267 AC_MSG_CHECKING([whether to use gnutls])
9268 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9269     AC_MSG_RESULT([yes])
9270     AM_PATH_LIBGCRYPT()
9271     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9272         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9273                       available in the system to use as replacement.]]))
9274     FilterLibs "${LIBGCRYPT_LIBS}"
9275     LIBGCRYPT_LIBS="${filteredlibs}"
9276 else
9277     AC_MSG_RESULT([no])
9280 AC_SUBST([LIBGCRYPT_CFLAGS])
9281 AC_SUBST([LIBGCRYPT_LIBS])
9283 dnl ===================================================================
9284 dnl Check for system redland
9285 dnl ===================================================================
9286 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9287 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9288 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9289 if test "$with_system_redland" = "yes"; then
9290     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9291             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9292 else
9293     RAPTOR_MAJOR="0"
9294     RASQAL_MAJOR="3"
9295     REDLAND_MAJOR="0"
9297 AC_SUBST(RAPTOR_MAJOR)
9298 AC_SUBST(RASQAL_MAJOR)
9299 AC_SUBST(REDLAND_MAJOR)
9301 dnl ===================================================================
9302 dnl Check for system hunspell
9303 dnl ===================================================================
9304 AC_MSG_CHECKING([which libhunspell to use])
9305 if test "$with_system_hunspell" = "yes"; then
9306     AC_MSG_RESULT([external])
9307     SYSTEM_HUNSPELL=TRUE
9308     AC_LANG_PUSH([C++])
9309     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9310     if test "$HUNSPELL_PC" != "TRUE"; then
9311         AC_CHECK_HEADER(hunspell.hxx, [],
9312             [
9313             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9314             [AC_MSG_ERROR(hunspell headers not found.)], [])
9315             ], [])
9316         AC_CHECK_LIB([hunspell], [main], [:],
9317            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9318         HUNSPELL_LIBS=-lhunspell
9319     fi
9320     AC_LANG_POP([C++])
9321     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9322     FilterLibs "${HUNSPELL_LIBS}"
9323     HUNSPELL_LIBS="${filteredlibs}"
9324 else
9325     AC_MSG_RESULT([internal])
9326     SYSTEM_HUNSPELL=
9327     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9328     if test "$COM" = "MSC"; then
9329         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9330     else
9331         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.6"
9332     fi
9333     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9335 AC_SUBST(SYSTEM_HUNSPELL)
9336 AC_SUBST(HUNSPELL_CFLAGS)
9337 AC_SUBST(HUNSPELL_LIBS)
9339 dnl ===================================================================
9340 dnl Checking for altlinuxhyph
9341 dnl ===================================================================
9342 AC_MSG_CHECKING([which altlinuxhyph to use])
9343 if test "$with_system_altlinuxhyph" = "yes"; then
9344     AC_MSG_RESULT([external])
9345     SYSTEM_HYPH=TRUE
9346     AC_CHECK_HEADER(hyphen.h, [],
9347        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9348     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9349        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9350        [#include <hyphen.h>])
9351     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9352         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9353     if test -z "$HYPHEN_LIB"; then
9354         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9355            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9356     fi
9357     if test -z "$HYPHEN_LIB"; then
9358         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9359            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9360     fi
9361 else
9362     AC_MSG_RESULT([internal])
9363     SYSTEM_HYPH=
9364     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9365     if test "$COM" = "MSC"; then
9366         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9367     else
9368         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9369     fi
9371 AC_SUBST(SYSTEM_HYPH)
9372 AC_SUBST(HYPHEN_LIB)
9374 dnl ===================================================================
9375 dnl Checking for mythes
9376 dnl ===================================================================
9377 AC_MSG_CHECKING([which mythes to use])
9378 if test "$with_system_mythes" = "yes"; then
9379     AC_MSG_RESULT([external])
9380     SYSTEM_MYTHES=TRUE
9381     AC_LANG_PUSH([C++])
9382     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9383     if test "$MYTHES_PKGCONFIG" = "no"; then
9384         AC_CHECK_HEADER(mythes.hxx, [],
9385             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9386         AC_CHECK_LIB([mythes-1.2], [main], [:],
9387             [ MYTHES_FOUND=no], [])
9388     if test "$MYTHES_FOUND" = "no"; then
9389         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9390                 [ MYTHES_FOUND=no], [])
9391     fi
9392     if test "$MYTHES_FOUND" = "no"; then
9393         AC_MSG_ERROR([mythes library not found!.])
9394     fi
9395     fi
9396     AC_LANG_POP([C++])
9397     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9398     FilterLibs "${MYTHES_LIBS}"
9399     MYTHES_LIBS="${filteredlibs}"
9400 else
9401     AC_MSG_RESULT([internal])
9402     SYSTEM_MYTHES=
9403     BUILD_TYPE="$BUILD_TYPE MYTHES"
9404     if test "$COM" = "MSC"; then
9405         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9406     else
9407         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9408     fi
9410 AC_SUBST(SYSTEM_MYTHES)
9411 AC_SUBST(MYTHES_CFLAGS)
9412 AC_SUBST(MYTHES_LIBS)
9414 dnl ===================================================================
9415 dnl How should we build the linear programming solver ?
9416 dnl ===================================================================
9418 ENABLE_COINMP=
9419 AC_MSG_CHECKING([whether to build with CoinMP])
9420 if test "$enable_coinmp" != "no"; then
9421     ENABLE_COINMP=TRUE
9422     AC_MSG_RESULT([yes])
9423     if test "$with_system_coinmp" = "yes"; then
9424         SYSTEM_COINMP=TRUE
9425         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9426         FilterLibs "${COINMP_LIBS}"
9427         COINMP_LIBS="${filteredlibs}"
9428     else
9429         BUILD_TYPE="$BUILD_TYPE COINMP"
9430     fi
9431 else
9432     AC_MSG_RESULT([no])
9434 AC_SUBST(ENABLE_COINMP)
9435 AC_SUBST(SYSTEM_COINMP)
9436 AC_SUBST(COINMP_CFLAGS)
9437 AC_SUBST(COINMP_LIBS)
9439 ENABLE_LPSOLVE=
9440 AC_MSG_CHECKING([whether to build with lpsolve])
9441 if test "$enable_lpsolve" != "no"; then
9442     ENABLE_LPSOLVE=TRUE
9443     AC_MSG_RESULT([yes])
9444 else
9445     AC_MSG_RESULT([no])
9447 AC_SUBST(ENABLE_LPSOLVE)
9449 if test "$ENABLE_LPSOLVE" = TRUE; then
9450     AC_MSG_CHECKING([which lpsolve to use])
9451     if test "$with_system_lpsolve" = "yes"; then
9452         AC_MSG_RESULT([external])
9453         SYSTEM_LPSOLVE=TRUE
9454         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9455            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9456         save_LIBS=$LIBS
9457         # some systems need this. Like Ubuntu....
9458         AC_CHECK_LIB(m, floor)
9459         AC_CHECK_LIB(dl, dlopen)
9460         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9461             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9462         LIBS=$save_LIBS
9463     else
9464         AC_MSG_RESULT([internal])
9465         SYSTEM_LPSOLVE=
9466         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9467     fi
9469 AC_SUBST(SYSTEM_LPSOLVE)
9471 dnl ===================================================================
9472 dnl Checking for libexttextcat
9473 dnl ===================================================================
9474 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9475 if test "$with_system_libexttextcat" = "yes"; then
9476     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9478 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9480 dnl ***************************************
9481 dnl testing libc version for Linux...
9482 dnl ***************************************
9483 if test "$_os" = "Linux"; then
9484     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9485     exec 6>/dev/null # no output
9486     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9487     exec 6>&1 # output on again
9488     if test "$HAVE_LIBC"; then
9489         AC_MSG_RESULT([yes])
9490     else
9491         AC_MSG_ERROR([no, upgrade libc])
9492     fi
9495 dnl =========================================
9496 dnl Check for uuidgen
9497 dnl =========================================
9498 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9499     # presence is already tested above in the WINDOWS_SDK_HOME check
9500     UUIDGEN=uuidgen.exe
9501     AC_SUBST(UUIDGEN)
9502 else
9503     AC_PATH_PROG([UUIDGEN], [uuidgen])
9504     if test -z "$UUIDGEN"; then
9505         AC_MSG_WARN([uuid is needed for building installation sets])
9506     fi
9509 dnl ***************************************
9510 dnl Checking for bison and flex
9511 dnl ***************************************
9512 AC_PATH_PROG(BISON, bison)
9513 if test -z "$BISON"; then
9514     AC_MSG_ERROR([no bison found in \$PATH, install it])
9515 else
9516     AC_MSG_CHECKING([the bison version])
9517     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9518     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9519     # Accept newer than 2.0
9520     if test "$_bison_longver" -lt 2000; then
9521         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9522     fi
9525 AC_PATH_PROG(FLEX, flex)
9526 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9527     FLEX=`cygpath -m $FLEX`
9529 if test -z "$FLEX"; then
9530     AC_MSG_ERROR([no flex found in \$PATH, install it])
9531 else
9532     AC_MSG_CHECKING([the flex version])
9533     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9534     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9535         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9536     fi
9538 AC_SUBST([FLEX])
9539 dnl ***************************************
9540 dnl Checking for patch
9541 dnl ***************************************
9542 AC_PATH_PROG(PATCH, patch)
9543 if test -z "$PATCH"; then
9544     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9547 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9548 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9549     if test -z "$with_gnu_patch"; then
9550         GNUPATCH=$PATCH
9551     else
9552         if test -x "$with_gnu_patch"; then
9553             GNUPATCH=$with_gnu_patch
9554         else
9555             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9556         fi
9557     fi
9559     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9560     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9561         AC_MSG_RESULT([yes])
9562     else
9563         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9564     fi
9565 else
9566     GNUPATCH=$PATCH
9569 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9570     GNUPATCH=`cygpath -m $GNUPATCH`
9573 dnl We also need to check for --with-gnu-cp
9575 if test -z "$with_gnu_cp"; then
9576     # check the place where the good stuff is hidden on Solaris...
9577     if test -x /usr/gnu/bin/cp; then
9578         GNUCP=/usr/gnu/bin/cp
9579     else
9580         AC_PATH_PROGS(GNUCP, gnucp cp)
9581     fi
9582     if test -z $GNUCP; then
9583         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9584     fi
9585 else
9586     if test -x "$with_gnu_cp"; then
9587         GNUCP=$with_gnu_cp
9588     else
9589         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9590     fi
9593 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9594     GNUCP=`cygpath -m $GNUCP`
9597 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9598 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9599     AC_MSG_RESULT([yes])
9600 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9601     AC_MSG_RESULT([yes])
9602 else
9603     case "$build_os" in
9604     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9605         x_GNUCP=[\#]
9606         GNUCP=''
9607         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9608         ;;
9609     *)
9610         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9611         ;;
9612     esac
9615 AC_SUBST(GNUPATCH)
9616 AC_SUBST(GNUCP)
9617 AC_SUBST(x_GNUCP)
9619 dnl ***************************************
9620 dnl testing assembler path
9621 dnl ***************************************
9622 ML_EXE=""
9623 if test "$_os" = "WINNT"; then
9624     if test "$BITNESS_OVERRIDE" = ""; then
9625         assembler=ml.exe
9626         assembler_bin=$CL_DIR
9627     else
9628         assembler=ml64.exe
9629         assembler_bin=$CL_DIR
9630     fi
9632     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9633     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9634         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9635         AC_MSG_RESULT([found])
9636         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9637     else
9638         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9639     fi
9641     PathFormat "$ASM_HOME"
9642     ASM_HOME="$formatted_path"
9643 else
9644     ASM_HOME=""
9647 AC_SUBST(ML_EXE)
9649 dnl ===================================================================
9650 dnl We need zip and unzip
9651 dnl ===================================================================
9652 AC_PATH_PROG(ZIP, zip)
9653 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9654 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9655     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],,)
9658 AC_PATH_PROG(UNZIP, unzip)
9659 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9661 dnl ===================================================================
9662 dnl Zip must be a specific type for different build types.
9663 dnl ===================================================================
9664 if test $build_os = cygwin; then
9665     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9666         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9667     fi
9670 dnl ===================================================================
9671 dnl We need touch with -h option support.
9672 dnl ===================================================================
9673 AC_PATH_PROG(TOUCH, touch)
9674 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
9675 touch warn
9676 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
9677     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],,)
9680 dnl ===================================================================
9681 dnl Check for system epoxy
9682 dnl ===================================================================
9683 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
9685 dnl ===================================================================
9686 dnl Set vcl option: coordinate device in double or sal_Int32
9687 dnl ===================================================================
9689 dnl disabled for now, we don't want subtle differences between OSs
9690 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
9691 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
9692 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
9693 dnl     AC_MSG_RESULT([double])
9694 dnl else
9695 dnl     AC_MSG_RESULT([sal_Int32])
9696 dnl fi
9698 dnl ===================================================================
9699 dnl Test which vclplugs have to be built.
9700 dnl ===================================================================
9701 R=""
9702 if test "$USING_X11" != TRUE; then
9703     enable_gtk=no
9704     enable_gtk3=no
9706 GTK3_CFLAGS=""
9707 GTK3_LIBS=""
9708 ENABLE_GTK3=""
9709 if test "x$enable_gtk3" = "xyes"; then
9710     if test "$with_system_cairo" = no; then
9711         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
9712     fi
9713     : ${with_system_cairo:=yes}
9714     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="")
9715     if test "x$ENABLE_GTK3" = "xTRUE"; then
9716         R="gtk3"
9717         dnl Avoid installed by unpackaged files for now.
9718         if test -z "$PKGFORMAT"; then
9719             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
9720         fi
9721     else
9722         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
9723     fi
9724     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9725     FilterLibs "${GTK3_LIBS}"
9726     GTK3_LIBS="${filteredlibs}"
9728     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
9729     if test "$with_system_epoxy" != "yes"; then
9730         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
9731         AC_CHECK_HEADER(EGL/eglplatform.h, [],
9732                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
9733     fi
9735 AC_SUBST(GTK3_LIBS)
9736 AC_SUBST(GTK3_CFLAGS)
9737 AC_SUBST(ENABLE_GTK3)
9739 ENABLE_GTK=""
9740 if test "x$enable_gtk" = "xyes"; then
9741     if test "$with_system_cairo" = no; then
9742         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
9743     fi
9744     : ${with_system_cairo:=yes}
9745     ENABLE_GTK="TRUE"
9746     AC_DEFINE(ENABLE_GTK)
9747     R="gtk $R"
9749 AC_SUBST(ENABLE_GTK)
9751 ENABLE_KDE4=""
9752 if test "x$enable_kde4" = "xyes"; then
9753     ENABLE_KDE4="TRUE"
9754     AC_DEFINE(ENABLE_KDE4)
9755     R="$R kde4"
9757 AC_SUBST(ENABLE_KDE4)
9759 ENABLE_QT5=""
9760 if test "x$enable_qt5" = "xyes"; then
9761     ENABLE_QT5="TRUE"
9762     AC_DEFINE(ENABLE_QT5)
9763     R="$R qt5"
9765 AC_SUBST(ENABLE_QT5)
9767 build_vcl_plugins="$R"
9768 if test -z "$build_vcl_plugins"; then
9769     build_vcl_plugins="none"
9771 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
9773 dnl ===================================================================
9774 dnl check for dbus support
9775 dnl ===================================================================
9776 ENABLE_DBUS=""
9777 DBUS_CFLAGS=""
9778 DBUS_LIBS=""
9780 if test "$enable_dbus" = "no"; then
9781     test_dbus=no
9784 AC_MSG_CHECKING([whether to enable DBUS support])
9785 if test "$test_dbus" = "yes"; then
9786     ENABLE_DBUS="TRUE"
9787     AC_MSG_RESULT([yes])
9788     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
9789     AC_DEFINE(ENABLE_DBUS)
9790     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9791     FilterLibs "${DBUS_LIBS}"
9792     DBUS_LIBS="${filteredlibs}"
9793 else
9794     AC_MSG_RESULT([no])
9797 AC_SUBST(ENABLE_DBUS)
9798 AC_SUBST(DBUS_CFLAGS)
9799 AC_SUBST(DBUS_LIBS)
9801 AC_MSG_CHECKING([whether to enable Impress remote control])
9802 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
9803     AC_MSG_RESULT([yes])
9804     ENABLE_SDREMOTE=TRUE
9805     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
9807     # If not explicitly enabled or disabled, default
9808     if test -z "$enable_sdremote_bluetooth"; then
9809         case "$OS" in
9810         LINUX|MACOSX|WNT)
9811             # Default to yes for these
9812             enable_sdremote_bluetooth=yes
9813             ;;
9814         *)
9815             # otherwise no
9816             enable_sdremote_bluetooth=no
9817             ;;
9818         esac
9819     fi
9820     # $enable_sdremote_bluetooth is guaranteed non-empty now
9822     if test "$enable_sdremote_bluetooth" != "no"; then
9823         if test "$OS" = "LINUX"; then
9824             if test "$ENABLE_DBUS" = "TRUE"; then
9825                 AC_MSG_RESULT([yes])
9826                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
9827                 dnl ===================================================================
9828                 dnl Check for system bluez
9829                 dnl ===================================================================
9830                 AC_MSG_CHECKING([which Bluetooth header to use])
9831                 if test "$with_system_bluez" = "yes"; then
9832                     AC_MSG_RESULT([external])
9833                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
9834                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
9835                     SYSTEM_BLUEZ=TRUE
9836                 else
9837                     AC_MSG_RESULT([internal])
9838                     SYSTEM_BLUEZ=
9839                 fi
9840             else
9841                 AC_MSG_RESULT([no, dbus disabled])
9842                 ENABLE_SDREMOTE_BLUETOOTH=
9843                 SYSTEM_BLUEZ=
9844             fi
9845         else
9846             AC_MSG_RESULT([yes])
9847             ENABLE_SDREMOTE_BLUETOOTH=TRUE
9848             SYSTEM_BLUEZ=
9849         fi
9850     else
9851         AC_MSG_RESULT([no])
9852         ENABLE_SDREMOTE_BLUETOOTH=
9853         SYSTEM_BLUEZ=
9854     fi
9855 else
9856     ENABLE_SDREMOTE=
9857     SYSTEM_BLUEZ=
9858     AC_MSG_RESULT([no])
9860 AC_SUBST(ENABLE_SDREMOTE)
9861 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
9862 AC_SUBST(SYSTEM_BLUEZ)
9864 dnl ===================================================================
9865 dnl Check whether the gtk 2.0 libraries are available.
9866 dnl ===================================================================
9868 GTK_CFLAGS=""
9869 GTK_LIBS=""
9870 ENABLE_SYSTRAY_GTK=""
9871 if test  "$test_gtk" = "yes"; then
9873     if test "$ENABLE_GTK" = "TRUE"; then
9874         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]))
9875         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9876         FilterLibs "${GTK_LIBS}"
9877         GTK_LIBS="${filteredlibs}"
9878         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]))
9879         BUILD_TYPE="$BUILD_TYPE GTK"
9880         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9881         FilterLibs "${GTHREAD_LIBS}"
9882         GTHREAD_LIBS="${filteredlibs}"
9884         if test "x$enable_systray" = "xyes"; then
9885             ENABLE_SYSTRAY_GTK="TRUE"
9886         fi
9888         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
9889         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
9890                           [ENABLE_GTK_PRINT="TRUE"],
9891                           [ENABLE_GTK_PRINT=""])
9892         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9893         FilterLibs "${GTK_PRINT_LIBS}"
9894         GTK_PRINT_LIBS="${filteredlibs}"
9895     fi
9897     if test "$ENABLE_GTK" = "TRUE" || test "$ENABLE_GTK3" = "TRUE"; then
9898         AC_MSG_CHECKING([whether to enable GIO support])
9899         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
9900             dnl Need at least 2.26 for the dbus support.
9901             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
9902                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
9903             if test "$ENABLE_GIO" = "TRUE"; then
9904                 AC_DEFINE(ENABLE_GIO)
9905                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9906                 FilterLibs "${GIO_LIBS}"
9907                 GIO_LIBS="${filteredlibs}"
9908             fi
9909         else
9910             AC_MSG_RESULT([no])
9911         fi
9912     fi
9914 AC_SUBST(ENABLE_GIO)
9915 AC_SUBST(GIO_CFLAGS)
9916 AC_SUBST(GIO_LIBS)
9917 AC_SUBST(ENABLE_SYSTRAY_GTK)
9918 AC_SUBST(GTK_CFLAGS)
9919 AC_SUBST(GTK_LIBS)
9920 AC_SUBST(GTHREAD_CFLAGS)
9921 AC_SUBST(GTHREAD_LIBS)
9922 AC_SUBST([ENABLE_GTK_PRINT])
9923 AC_SUBST([GTK_PRINT_CFLAGS])
9924 AC_SUBST([GTK_PRINT_LIBS])
9927 dnl ===================================================================
9929 SPLIT_APP_MODULES=""
9930 if test "$enable_split_app_modules" = "yes"; then
9931     SPLIT_APP_MODULES="TRUE"
9933 AC_SUBST(SPLIT_APP_MODULES)
9935 SPLIT_OPT_FEATURES=""
9936 if test "$enable_split_opt_features" = "yes"; then
9937     SPLIT_OPT_FEATURES="TRUE"
9939 AC_SUBST(SPLIT_OPT_FEATURES)
9941 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
9942     if test "$enable_cairo_canvas" = yes; then
9943         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
9944     fi
9945     enable_cairo_canvas=no
9946 elif test -z "$enable_cairo_canvas"; then
9947     enable_cairo_canvas=yes
9950 ENABLE_CAIRO_CANVAS=""
9951 if test "$enable_cairo_canvas" = "yes"; then
9952     test_cairo=yes
9953     ENABLE_CAIRO_CANVAS="TRUE"
9954     AC_DEFINE(ENABLE_CAIRO_CANVAS)
9956 AC_SUBST(ENABLE_CAIRO_CANVAS)
9958 dnl ===================================================================
9959 dnl Check whether the GStreamer libraries are available.
9960 dnl It's possible to build avmedia with both GStreamer backends!
9961 dnl ===================================================================
9963 ENABLE_GSTREAMER_1_0=""
9965 if test "$build_gstreamer_1_0" = "yes"; then
9967     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
9968     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
9969         ENABLE_GSTREAMER_1_0="TRUE"
9970         AC_MSG_RESULT([yes])
9971         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
9972         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9973         FilterLibs "${GSTREAMER_1_0_LIBS}"
9974         GSTREAMER_1_0_LIBS="${filteredlibs}"
9975     else
9976         AC_MSG_RESULT([no])
9977     fi
9979 AC_SUBST(GSTREAMER_1_0_CFLAGS)
9980 AC_SUBST(GSTREAMER_1_0_LIBS)
9981 AC_SUBST(ENABLE_GSTREAMER_1_0)
9984 ENABLE_GSTREAMER_0_10=""
9985 if test "$build_gstreamer_0_10" = "yes"; then
9987     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
9988     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
9989         ENABLE_GSTREAMER_0_10="TRUE"
9990         AC_MSG_RESULT([yes])
9991         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
9992             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
9993         ])
9994         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9995         FilterLibs "${GSTREAMER_0_10_LIBS}"
9996         GSTREAMER_0_10_LIBS="${filteredlibs}"
9997     else
9998         AC_MSG_RESULT([no])
9999     fi
10002 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10003 AC_SUBST(GSTREAMER_0_10_LIBS)
10004 AC_SUBST(ENABLE_GSTREAMER_0_10)
10006 dnl ===================================================================
10007 dnl Check whether to build the VLC avmedia backend
10008 dnl ===================================================================
10010 ENABLE_VLC=""
10012 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10013 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10014     ENABLE_VLC="TRUE"
10015     AC_MSG_RESULT([yes])
10016 else
10017     AC_MSG_RESULT([no])
10019 AC_SUBST(ENABLE_VLC)
10021 ENABLE_OPENGL_TRANSITIONS=
10022 ENABLE_OPENGL_CANVAS=
10023 if test $_os = iOS -o $_os = Android; then
10024    : # disable
10025 elif test "$_os" = "Darwin"; then
10026     # We use frameworks on Mac OS X, no need for detail checks
10027     ENABLE_OPENGL_TRANSITIONS=TRUE
10028     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10029     ENABLE_OPENGL_CANVAS=TRUE
10030 elif test $_os = WINNT; then
10031     ENABLE_OPENGL_TRANSITIONS=TRUE
10032     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10033     ENABLE_OPENGL_CANVAS=TRUE
10034 else
10035     if test "$USING_X11" = TRUE; then
10036         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10037         ENABLE_OPENGL_TRANSITIONS=TRUE
10038         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10039         ENABLE_OPENGL_CANVAS=TRUE
10040     fi
10043 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10044 AC_SUBST(ENABLE_OPENGL_CANVAS)
10046 dnl =================================================
10047 dnl Check whether to build with OpenCL support.
10048 dnl =================================================
10050 if test $_os != iOS -a $_os != Android; then
10051     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10052     # platform (optional at run-time, used through clew).
10053     BUILD_TYPE="$BUILD_TYPE OPENCL"
10054     AC_DEFINE(HAVE_FEATURE_OPENCL)
10057 dnl =================================================
10058 dnl Check whether to build with dconf support.
10059 dnl =================================================
10061 if test "$enable_dconf" != no; then
10062     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10063         if test "$enable_dconf" = yes; then
10064             AC_MSG_ERROR([dconf not found])
10065         else
10066             enable_dconf=no
10067         fi])
10069 AC_MSG_CHECKING([whether to enable dconf])
10070 if test "$enable_dconf" = no; then
10071     DCONF_CFLAGS=
10072     DCONF_LIBS=
10073     ENABLE_DCONF=
10074     AC_MSG_RESULT([no])
10075 else
10076     ENABLE_DCONF=TRUE
10077     AC_DEFINE(ENABLE_DCONF)
10078     AC_MSG_RESULT([yes])
10080 AC_SUBST([DCONF_CFLAGS])
10081 AC_SUBST([DCONF_LIBS])
10082 AC_SUBST([ENABLE_DCONF])
10084 # pdf import?
10085 AC_MSG_CHECKING([whether to build the PDF import feature])
10086 ENABLE_PDFIMPORT=
10087 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10088     AC_MSG_RESULT([yes])
10089     ENABLE_PDFIMPORT=TRUE
10090     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10092     dnl ===================================================================
10093     dnl Check for system poppler
10094     dnl ===================================================================
10095     AC_MSG_CHECKING([which PDF import backend to use])
10096     if test "$with_system_poppler" = "yes"; then
10097         AC_MSG_RESULT([external])
10098         SYSTEM_POPPLER=TRUE
10099         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10100         AC_LANG_PUSH([C++])
10101         save_CXXFLAGS=$CXXFLAGS
10102         save_CPPFLAGS=$CPPFLAGS
10103         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10104         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10105         AC_CHECK_HEADER([cpp/poppler-version.h],
10106             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10107             [])
10108         CXXFLAGS=$save_CXXFLAGS
10109         CPPFLAGS=$save_CPPFLAGS
10110         AC_LANG_POP([C++])
10111         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10113         FilterLibs "${POPPLER_LIBS}"
10114         POPPLER_LIBS="${filteredlibs}"
10115     else
10116         AC_MSG_RESULT([internal])
10117         SYSTEM_POPPLER=
10118         BUILD_TYPE="$BUILD_TYPE POPPLER"
10119         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10120     fi
10121     AC_DEFINE([ENABLE_PDFIMPORT],1)
10122 else
10123     AC_MSG_RESULT([no])
10125 AC_SUBST(ENABLE_PDFIMPORT)
10126 AC_SUBST(SYSTEM_POPPLER)
10127 AC_SUBST(POPPLER_CFLAGS)
10128 AC_SUBST(POPPLER_LIBS)
10130 # pdf import?
10131 AC_MSG_CHECKING([whether to build PDFium])
10132 ENABLE_PDFIUM=
10133 if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then
10134     AC_MSG_RESULT([yes])
10135     ENABLE_PDFIUM=TRUE
10136     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10137     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10138 else
10139     AC_MSG_RESULT([no])
10141 AC_SUBST(ENABLE_PDFIUM)
10143 SYSTEM_GPGMEPP=
10145 if test "$build_for_ios" = "YES"; then
10146     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10147     AC_MSG_RESULT([yes])
10148 elif test "$enable_mpl_subset" = "yes"; then
10149     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10150     AC_MSG_RESULT([yes])
10151 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10152     dnl ===================================================================
10153     dnl Check for system gpgme
10154     dnl ===================================================================
10155     AC_MSG_CHECKING([which gpgmepp to use])
10156     if test "$with_system_gpgmepp" = "yes"; then
10157         AC_MSG_RESULT([external])
10158         SYSTEM_GPGMEPP=TRUE
10160         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10161         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10162             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10163         # progress_callback is the only func with plain C linkage
10164         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10165         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10166             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10167         AC_CHECK_HEADER(gpgme.h, [],
10168             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10169     else
10170         AC_MSG_RESULT([internal])
10171         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10172         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10174         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10175         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10176         if test "$_os" != "WINNT"; then
10177             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10178             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10179         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10180             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10181         fi
10182     fi
10183     ENABLE_GPGMEPP=TRUE
10184     AC_DEFINE([HAVE_FEATURE_GPGME])
10185     AC_PATH_PROG(GPG, gpg)
10186     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10187     # so let's exclude that manually for the moment
10188     if test -n "$GPG" -a "$_os" != "WINNT"; then
10189         # make sure we not only have a working gpgme, but a full working
10190         # gpg installation to run OpenPGP signature verification
10191         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10192     fi
10193     if test "$_os" = "Linux"; then
10194       uid=`id -u`
10195       AC_MSG_CHECKING([for /run/user/$uid])
10196       if test -d /run/user/$uid; then
10197         AC_MSG_RESULT([yes])
10198         AC_PATH_PROG(GPGCONF, gpgconf)
10199         AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10200         if $GPGCONF --dump-options > /dev/null ; then
10201           if $GPGCONF --dump-options | grep -q create-socketdir ; then
10202             AC_MSG_RESULT([yes])
10203             AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10204           else
10205             AC_MSG_RESULT([no])
10206           fi
10207         else
10208           AC_MSG_RESULT([no. missing or broken gpgconf?])
10209         fi
10210       else
10211         AC_MSG_RESULT([no])
10212      fi
10213    fi
10215 AC_SUBST(ENABLE_GPGMEPP)
10216 AC_SUBST(SYSTEM_GPGMEPP)
10217 AC_SUBST(GPG_ERROR_CFLAGS)
10218 AC_SUBST(GPG_ERROR_LIBS)
10219 AC_SUBST(LIBASSUAN_CFLAGS)
10220 AC_SUBST(LIBASSUAN_LIBS)
10221 AC_SUBST(GPGMEPP_CFLAGS)
10222 AC_SUBST(GPGMEPP_LIBS)
10223 AC_SUBST(GPGCONF)
10224 AC_SUBST(HAVE_GPGCONF_SOCKETDIR)
10226 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10227 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10228     AC_MSG_RESULT([yes])
10229     ENABLE_MEDIAWIKI=TRUE
10230     BUILD_TYPE="$BUILD_TYPE XSLTML"
10231     if test  "x$with_java" = "xno"; then
10232         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10233     fi
10234 else
10235     AC_MSG_RESULT([no])
10236     ENABLE_MEDIAWIKI=
10237     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10239 AC_SUBST(ENABLE_MEDIAWIKI)
10241 AC_MSG_CHECKING([whether to build the Report Builder])
10242 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10243     AC_MSG_RESULT([yes])
10244     ENABLE_REPORTBUILDER=TRUE
10245     AC_MSG_CHECKING([which jfreereport libs to use])
10246     if test "$with_system_jfreereport" = "yes"; then
10247         SYSTEM_JFREEREPORT=TRUE
10248         AC_MSG_RESULT([external])
10249         if test -z $SAC_JAR; then
10250             SAC_JAR=/usr/share/java/sac.jar
10251         fi
10252         if ! test -f $SAC_JAR; then
10253              AC_MSG_ERROR(sac.jar not found.)
10254         fi
10256         if test -z $LIBXML_JAR; then
10257             if test -f /usr/share/java/libxml-1.0.0.jar; then
10258                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10259             elif test -f /usr/share/java/libxml.jar; then
10260                 LIBXML_JAR=/usr/share/java/libxml.jar
10261             else
10262                 AC_MSG_ERROR(libxml.jar replacement not found.)
10263             fi
10264         elif ! test -f $LIBXML_JAR; then
10265             AC_MSG_ERROR(libxml.jar not found.)
10266         fi
10268         if test -z $FLUTE_JAR; then
10269             if test -f/usr/share/java/flute-1.3.0.jar; then
10270                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10271             elif test -f /usr/share/java/flute.jar; then
10272                 FLUTE_JAR=/usr/share/java/flute.jar
10273             else
10274                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10275             fi
10276         elif ! test -f $FLUTE_JAR; then
10277             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10278         fi
10280         if test -z $JFREEREPORT_JAR; then
10281             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10282                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10283             elif test -f /usr/share/java/flow-engine.jar; then
10284                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10285             else
10286                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10287             fi
10288         elif ! test -f  $JFREEREPORT_JAR; then
10289                 AC_MSG_ERROR(jfreereport.jar not found.)
10290         fi
10292         if test -z $LIBLAYOUT_JAR; then
10293             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10294                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10295             elif test -f /usr/share/java/liblayout.jar; then
10296                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10297             else
10298                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10299             fi
10300         elif ! test -f $LIBLAYOUT_JAR; then
10301                 AC_MSG_ERROR(liblayout.jar not found.)
10302         fi
10304         if test -z $LIBLOADER_JAR; then
10305             if test -f /usr/share/java/libloader-1.0.0.jar; then
10306                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10307             elif test -f /usr/share/java/libloader.jar; then
10308                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10309             else
10310                 AC_MSG_ERROR(libloader.jar replacement not found.)
10311             fi
10312         elif ! test -f  $LIBLOADER_JAR; then
10313             AC_MSG_ERROR(libloader.jar not found.)
10314         fi
10316         if test -z $LIBFORMULA_JAR; then
10317             if test -f /usr/share/java/libformula-0.2.0.jar; then
10318                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10319             elif test -f /usr/share/java/libformula.jar; then
10320                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10321             else
10322                 AC_MSG_ERROR(libformula.jar replacement not found.)
10323             fi
10324         elif ! test -f $LIBFORMULA_JAR; then
10325                 AC_MSG_ERROR(libformula.jar not found.)
10326         fi
10328         if test -z $LIBREPOSITORY_JAR; then
10329             if test -f /usr/share/java/librepository-1.0.0.jar; then
10330                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10331             elif test -f /usr/share/java/librepository.jar; then
10332                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10333             else
10334                 AC_MSG_ERROR(librepository.jar replacement not found.)
10335             fi
10336         elif ! test -f $LIBREPOSITORY_JAR; then
10337             AC_MSG_ERROR(librepository.jar not found.)
10338         fi
10340         if test -z $LIBFONTS_JAR; then
10341             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10342                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10343             elif test -f /usr/share/java/libfonts.jar; then
10344                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10345             else
10346                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10347             fi
10348         elif ! test -f $LIBFONTS_JAR; then
10349                 AC_MSG_ERROR(libfonts.jar not found.)
10350         fi
10352         if test -z $LIBSERIALIZER_JAR; then
10353             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10354                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10355             elif test -f /usr/share/java/libserializer.jar; then
10356                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10357             else
10358                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10359             fi
10360         elif ! test -f $LIBSERIALIZER_JAR; then
10361                 AC_MSG_ERROR(libserializer.jar not found.)
10362         fi
10364         if test -z $LIBBASE_JAR; then
10365             if test -f /usr/share/java/libbase-1.0.0.jar; then
10366                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10367             elif test -f /usr/share/java/libbase.jar; then
10368                 LIBBASE_JAR=/usr/share/java/libbase.jar
10369             else
10370                 AC_MSG_ERROR(libbase.jar replacement not found.)
10371             fi
10372         elif ! test -f $LIBBASE_JAR; then
10373             AC_MSG_ERROR(libbase.jar not found.)
10374         fi
10376     else
10377         AC_MSG_RESULT([internal])
10378         SYSTEM_JFREEREPORT=
10379         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10380     fi
10381 else
10382     AC_MSG_RESULT([no])
10383     ENABLE_REPORTBUILDER=
10384     SYSTEM_JFREEREPORT=
10386 AC_SUBST(ENABLE_REPORTBUILDER)
10387 AC_SUBST(SYSTEM_JFREEREPORT)
10388 AC_SUBST(SAC_JAR)
10389 AC_SUBST(LIBXML_JAR)
10390 AC_SUBST(FLUTE_JAR)
10391 AC_SUBST(JFREEREPORT_JAR)
10392 AC_SUBST(LIBBASE_JAR)
10393 AC_SUBST(LIBLAYOUT_JAR)
10394 AC_SUBST(LIBLOADER_JAR)
10395 AC_SUBST(LIBFORMULA_JAR)
10396 AC_SUBST(LIBREPOSITORY_JAR)
10397 AC_SUBST(LIBFONTS_JAR)
10398 AC_SUBST(LIBSERIALIZER_JAR)
10400 # this has to be here because both the Wiki Publisher and the SRB use
10401 # commons-logging
10402 COMMONS_LOGGING_VERSION=1.2
10403 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10404     AC_MSG_CHECKING([which Apache commons-* libs to use])
10405     if test "$with_system_apache_commons" = "yes"; then
10406         SYSTEM_APACHE_COMMONS=TRUE
10407         AC_MSG_RESULT([external])
10408         if test -z $COMMONS_LOGGING_JAR; then
10409             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10410                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10411            elif test -f /usr/share/java/commons-logging.jar; then
10412                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
10413             else
10414                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
10415             fi
10416         elif ! test -f $COMMONS_LOGGING_JAR; then
10417             AC_MSG_ERROR(commons-logging.jar not found.)
10418         fi
10419     else
10420         AC_MSG_RESULT([internal])
10421         SYSTEM_APACHE_COMMONS=
10422         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
10423     fi
10425 AC_SUBST(SYSTEM_APACHE_COMMONS)
10426 AC_SUBST(COMMONS_LOGGING_JAR)
10427 AC_SUBST(COMMONS_LOGGING_VERSION)
10429 # scripting provider for BeanShell?
10430 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10431 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10432     AC_MSG_RESULT([yes])
10433     ENABLE_SCRIPTING_BEANSHELL=TRUE
10435     dnl ===================================================================
10436     dnl Check for system beanshell
10437     dnl ===================================================================
10438     AC_MSG_CHECKING([which beanshell to use])
10439     if test "$with_system_beanshell" = "yes"; then
10440         AC_MSG_RESULT([external])
10441         SYSTEM_BSH=TRUE
10442         if test -z $BSH_JAR; then
10443             BSH_JAR=/usr/share/java/bsh.jar
10444         fi
10445         if ! test -f $BSH_JAR; then
10446             AC_MSG_ERROR(bsh.jar not found.)
10447         fi
10448     else
10449         AC_MSG_RESULT([internal])
10450         SYSTEM_BSH=
10451         BUILD_TYPE="$BUILD_TYPE BSH"
10452     fi
10453 else
10454     AC_MSG_RESULT([no])
10455     ENABLE_SCRIPTING_BEANSHELL=
10456     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10458 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10459 AC_SUBST(SYSTEM_BSH)
10460 AC_SUBST(BSH_JAR)
10462 # scripting provider for JavaScript?
10463 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10464 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10465     AC_MSG_RESULT([yes])
10466     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10468     dnl ===================================================================
10469     dnl Check for system rhino
10470     dnl ===================================================================
10471     AC_MSG_CHECKING([which rhino to use])
10472     if test "$with_system_rhino" = "yes"; then
10473         AC_MSG_RESULT([external])
10474         SYSTEM_RHINO=TRUE
10475         if test -z $RHINO_JAR; then
10476             RHINO_JAR=/usr/share/java/js.jar
10477         fi
10478         if ! test -f $RHINO_JAR; then
10479             AC_MSG_ERROR(js.jar not found.)
10480         fi
10481     else
10482         AC_MSG_RESULT([internal])
10483         SYSTEM_RHINO=
10484         BUILD_TYPE="$BUILD_TYPE RHINO"
10485     fi
10486 else
10487     AC_MSG_RESULT([no])
10488     ENABLE_SCRIPTING_JAVASCRIPT=
10489     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10491 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10492 AC_SUBST(SYSTEM_RHINO)
10493 AC_SUBST(RHINO_JAR)
10495 # This is only used in KDE3/KDE4 checks to determine if /usr/lib64
10496 # paths should be added to library search path. So lets put all 64-bit
10497 # platforms there.
10498 supports_multilib=
10499 case "$host_cpu" in
10500 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
10501     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10502         supports_multilib="yes"
10503     fi
10504     ;;
10506     ;;
10507 esac
10509 dnl ===================================================================
10510 dnl KDE4 Integration
10511 dnl ===================================================================
10513 KDE4_CFLAGS=""
10514 KDE4_LIBS=""
10515 QMAKE4="qmake"
10516 MOC4="moc"
10517 KDE4_GLIB_CFLAGS=""
10518 KDE4_GLIB_LIBS=""
10519 KDE4_HAVE_GLIB=""
10520 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
10521     qt4_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
10522     qt4_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
10524     kde4_incdirs="/usr/include /usr/include/kde4 $x_includes"
10525     kde4_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
10527     if test -n "$supports_multilib"; then
10528         qt4_libdirs="$qt4_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
10529         kde4_libdirs="$kde4_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
10530     fi
10532     if test -n "$QTDIR"; then
10533         qt4_incdirs="$QTDIR/include $qt4_incdirs"
10534         if test -z "$supports_multilib"; then
10535             qt4_libdirs="$QTDIR/lib $qt4_libdirs"
10536         else
10537             qt4_libdirs="$QTDIR/lib64 $QTDIR/lib $qt4_libdirs"
10538         fi
10539     fi
10540     if test -n "$QT4DIR"; then
10541         qt4_incdirs="$QT4DIR/include $qt4_incdirs"
10542         if test -z "$supports_multilib"; then
10543             qt4_libdirs="$QT4DIR/lib $qt4_libdirs"
10544         else
10545             qt4_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt4_libdirs"
10546         fi
10547     fi
10549     if test -n "$KDEDIR"; then
10550         kde4_incdirs="$KDEDIR/include $kde4_incdirs"
10551         if test -z "$supports_multilib"; then
10552             kde4_libdirs="$KDEDIR/lib $kde4_libdirs"
10553         else
10554             kde4_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde4_libdirs"
10555         fi
10556     fi
10557     if test -n "$KDE4DIR"; then
10558         kde4_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde4_incdirs"
10559         if test -z "$supports_multilib"; then
10560             kde4_libdirs="$KDE4DIR/lib $kde4_libdirs"
10561         else
10562             kde4_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde4_libdirs"
10563         fi
10564     fi
10566     qt4_test_include="Qt/qobject.h"
10567     qt4_test_library="libQtNetwork.so"
10568     kde4_test_include="kwindowsystem.h"
10569     kde4_test_library="libsolid.so"
10571     AC_MSG_CHECKING([for Qt4 headers])
10572     qt4_header_dir="no"
10573     for inc_dir in $qt4_incdirs; do
10574         if test -r "$inc_dir/$qt4_test_include"; then
10575             qt4_header_dir="$inc_dir"
10576             break
10577         fi
10578     done
10580     AC_MSG_RESULT([$qt4_header_dir])
10581     if test "x$qt4_header_dir" = "xno"; then
10582         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10583     fi
10585     dnl Check for qmake
10586     AC_PATH_PROGS( QMAKE4, [qmake-qt4 qmake], no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
10587     if test "$QMAKE4" = "no"; then
10588         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10589     else
10590         qmake4_test_ver="`$QMAKE4 -v 2>&1 | sed -n -e '/^Using Qt version 4\./p'`"
10591         if test -z "$qmake4_test_ver"; then
10592             AC_MSG_ERROR([Wrong qmake for Qt4 found. Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
10593         fi
10594     fi
10596     qt4_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt4_libdirs"
10597     AC_MSG_CHECKING([for Qt4 libraries])
10598     qt4_lib_dir="no"
10599     for lib_dir in $qt4_libdirs; do
10600         if test -r "$lib_dir/$qt4_test_library"; then
10601             qt4_lib_dir="$lib_dir"
10602             PKG_CONFIG_PATH="$qt4_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
10603             break
10604         fi
10605     done
10607     AC_MSG_RESULT([$qt4_lib_dir])
10609     if test "x$qt4_lib_dir" = "xno"; then
10610         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10611     fi
10613     dnl Check for Meta Object Compiler
10615     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10616     MOC4="$MOCQT4"
10617     if test "$MOC4" = "no"; then
10618         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10619         if test "$MOC4" = "no"; then
10620             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10621 the root of your Qt installation by exporting QT4DIR before running "configure".])
10622         fi
10623     fi
10625     dnl Check for KDE4 headers
10626     AC_MSG_CHECKING([for KDE4 headers])
10627     kde4_incdir="no"
10628     for kde4_check in $kde4_incdirs; do
10629         if test -r "$kde4_check/$kde4_test_include"; then
10630             kde4_incdir="$kde4_check"
10631             break
10632         fi
10633     done
10634     AC_MSG_RESULT([$kde4_incdir])
10635     if test "x$kde4_incdir" = "xno"; then
10636         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10637     fi
10638     if test "$kde4_incdir" = "/usr/include"; then kde4_incdir=; fi
10640     dnl Check for KDE4 libraries
10641     AC_MSG_CHECKING([for KDE4 libraries])
10642     kde4_libdir="no"
10643     for kde4_check in $kde4_libdirs; do
10644         if test -r "$kde4_check/$kde4_test_library"; then
10645             kde4_libdir="$kde4_check"
10646             break
10647         fi
10648     done
10650     AC_MSG_RESULT([$kde4_libdir])
10651     if test "x$kde4_libdir" = "xno"; then
10652         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10653     fi
10655     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
10656     if ! test -z "$kde4_incdir"; then
10657         KDE4_CFLAGS="-I$kde4_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10658     else
10659         KDE4_CFLAGS="$QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10660     fi
10662     KDE4_LIBS="-L$kde4_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt4_lib_dir $QT4_LIBS"
10663     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10664     FilterLibs "$KDE4_LIBS"
10665     KDE4_LIBS="$filteredlibs"
10667     AC_LANG_PUSH([C++])
10668     save_CXXFLAGS=$CXXFLAGS
10669     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10670     AC_MSG_CHECKING([whether KDE is >= 4.2])
10671        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10672 #include <kdeversion.h>
10674 int main(int argc, char **argv) {
10675        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
10676        else return 1;
10678 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[AC_MSG_ERROR([KDE support not tested with cross-compilation])])
10679     CXXFLAGS=$save_CXXFLAGS
10680     AC_LANG_POP([C++])
10682     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
10683     # Sets also KDE4_GLIB_CFLAGS/KDE4_GLIB_LIBS if successful.
10684     PKG_CHECK_MODULES(KDE4_GLIB,[glib-2.0 >= 2.4],
10685         [
10686             KDE4_HAVE_GLIB=TRUE
10687             AC_DEFINE(KDE4_HAVE_GLIB,1)
10688             KDE4_GLIB_CFLAGS=$(printf '%s' "$KDE4_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10689             FilterLibs "${KDE4_GLIB_LIBS}"
10690             KDE4_GLIB_LIBS="${filteredlibs}"
10692             qt4_fix_warning=
10694             AC_LANG_PUSH([C++])
10695             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
10696             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
10697             #  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
10698             #               ^~~~~~~~~~~~~~~~~~~~~~~
10699             #               vptr for 'QObjectPrivate'
10700             save_CXX=$CXX
10701             CXX=$(printf %s "$CXX" \
10702                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
10703             save_CXXFLAGS=$CXXFLAGS
10704             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10705             save_LIBS=$LIBS
10706             LIBS="$LIBS $KDE4_LIBS"
10707             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
10709             # Prepare meta object data
10710             TSTBASE="tst_exclude_socket_notifiers"
10711             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
10712             ln -fs "${TSTMOC}.hxx"
10713             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10715             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10716 #include <cstdlib>
10717 #include "tst_exclude_socket_notifiers.moc"
10719 int main(int argc, char *argv[])
10721     QCoreApplication app(argc, argv);
10722     exit(tst_processEventsExcludeSocket());
10723     return 0;
10725             ]])],[
10726                 AC_MSG_RESULT([yes])
10727             ],[
10728                 AC_MSG_RESULT([no])
10729                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
10730                 if test -z "$qt4_fix_warning"; then
10731                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
10732                 fi
10733                 qt4_fix_warning=1
10734                 add_warning "  https://bugreports.qt.io/browse/QTBUG-37380 (needed)"
10735                 ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
10737             # Remove meta object data
10738             rm -f "${TSTBASE}."*
10740             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
10742             # Prepare meta object data
10743             TSTBASE="tst_exclude_posted_events"
10744             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
10745             ln -fs "${TSTMOC}.hxx"
10746             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10748             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10749 #include <cstdlib>
10750 #include "tst_exclude_posted_events.moc"
10752 int main(int argc, char *argv[])
10754     QCoreApplication app(argc, argv);
10755     exit(tst_excludePostedEvents());
10756     return 0;
10758             ]])],[
10759                 AC_MSG_RESULT([yes])
10760             ],[
10761                 AC_MSG_RESULT([no])
10762                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
10763                 if test -z "$qt4_fix_warning"; then
10764                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
10765                 fi
10766                 qt4_fix_warning=1
10767                 add_warning "  https://bugreports.qt.io/browse/QTBUG-34614 (needed)"
10768             ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
10770             # Remove meta object data
10771             rm -f "${TSTBASE}."*
10773             if test -n "$qt4_fix_warning"; then
10774                 add_warning "  https://bugreports.qt.io/browse/QTBUG-38585 (recommended)"
10775             fi
10777             LIBS=$save_LIBS
10778             CXXFLAGS=$save_CXXFLAGS
10779             CXX=$save_CXX
10780             AC_LANG_POP([C++])
10781         ],
10782         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
10784 AC_SUBST(KDE4_CFLAGS)
10785 AC_SUBST(KDE4_LIBS)
10786 AC_SUBST(MOC4)
10787 AC_SUBST(KDE4_GLIB_CFLAGS)
10788 AC_SUBST(KDE4_GLIB_LIBS)
10789 AC_SUBST(KDE4_HAVE_GLIB)
10791 dnl ===================================================================
10792 dnl QT5 Integration
10793 dnl ===================================================================
10795 QT5_CFLAGS=""
10796 QT5_LIBS=""
10797 QMAKE5="qmake"
10798 MOC5="moc"
10799 QT5_GLIB_CFLAGS=""
10800 QT5_GLIB_LIBS=""
10801 QT5_HAVE_GLIB=""
10802 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
10803         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \)
10804 then
10805     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
10806     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
10808     if test -n "$supports_multilib"; then
10809         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
10810     fi
10812     qt5_test_include="QtWidgets/qapplication.h"
10813     qt5_test_library="libQt5Widgets.so"
10815     dnl Check for qmake5
10816     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
10817     if test "$QMAKE5" = "no"; then
10818         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
10819     else
10820         qmake5_test_ver="`$QMAKE5 -v 2>&1 | sed -n -e '/^Using Qt version 5\./p'`"
10821         if test -z "$qmake5_test_ver"; then
10822             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
10823         fi
10824     fi
10826     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
10827     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
10829     AC_MSG_CHECKING([for Qt5 headers])
10830     qt5_incdir="no"
10831     for inc_dir in $qt5_incdirs; do
10832         if test -r "$inc_dir/$qt5_test_include"; then
10833             qt5_incdir="$inc_dir"
10834             break
10835         fi
10836     done
10837     AC_MSG_RESULT([$qt5_incdir])
10838     if test "x$qt5_incdir" = "xno"; then
10839         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
10840     fi
10842     AC_MSG_CHECKING([for Qt5 libraries])
10843     qt5_libdir="no"
10844     for lib_dir in $qt5_libdirs; do
10845         if test -r "$lib_dir/$qt5_test_library"; then
10846             qt5_libdir="$lib_dir"
10847             break
10848         fi
10849     done
10850     AC_MSG_RESULT([$qt5_libdir])
10851     if test "x$qt5_libdir" = "xno"; then
10852         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
10853     fi
10855     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10856     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
10858     dnl Check for Meta Object Compiler
10860     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
10861     if test "$MOC5" = "no"; then
10862         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10863 the root of your Qt installation by exporting QT5DIR before running "configure".])
10864     fi
10866     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
10867     # Sets also QT5_GLIB_CFLAGS/QT5_GLIB_LIBS if successful.
10868     PKG_CHECK_MODULES(QT5_GLIB,[glib-2.0 >= 2.4],
10869         [
10870             QT5_HAVE_GLIB=1
10871             AC_DEFINE(QT5_HAVE_GLIB,1)
10872             QT5_GLIB_CFLAGS=$(printf '%s' "$QT5_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10873             FilterLibs "${QT5_GLIB_LIBS}"
10874             QT5_GLIB_LIBS="${filteredlibs}"
10876             qt5_fix_warning=
10878             AC_LANG_PUSH([C++])
10879             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QO
10880             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
10881             #  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
10882             #               ^~~~~~~~~~~~~~~~~~~~~~~
10883             #               vptr for 'QObjectPrivate'
10884             save_CXX=$CXX
10885             CXX=$(printf %s "$CXX" \
10886                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
10887             save_CXXFLAGS=$CXXFLAGS
10888             CXXFLAGS="$CXXFLAGS $QT5_CFLAGS"
10889             save_LIBS=$LIBS
10890             LIBS="$LIBS $QT5_LIBS"
10891             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
10892             # Prepare meta object data
10893             TSTBASE="tst_exclude_socket_notifiers"
10894             TSTMOC="${SRC_ROOT}/vcl/unx/qt5/${TSTBASE}"
10895             ln -fs "${TSTMOC}.hxx"
10896             $MOC5 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10898             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10899 #include <cstdlib>
10900 #include "tst_exclude_socket_notifiers.moc"
10902 int main(int argc, char *argv[])
10904     QCoreApplication app(argc, argv);
10905     exit(tst_processEventsExcludeSocket());
10906     return 0;
10908             ]])],[
10909                 AC_MSG_RESULT([yes])
10910             ],[
10911                 AC_MSG_RESULT([no])
10912                 AC_MSG_WARN([native Qt5 file pickers will be disabled at runtime])
10913                 if test -z "$qt5_fix_warning"; then
10914                     add_warning "native QT5 file pickers will be disabled at runtime, Qt5 fixes needed"
10915                 fi
10916                 qt5_fix_warning=1
10917                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-37380 (needed)"
10918             ])
10920             # Remove meta object data
10921             rm -f "${TSTBASE}."*
10923             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
10924             # Prepare meta object data
10925             TSTBASE="tst_exclude_posted_events"
10926             TSTMOC="${SRC_ROOT}/vcl/unx/qt5/${TSTBASE}"
10927             ln -fs "${TSTMOC}.hxx"
10928             $MOC5 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10930             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10931 #include <cstdlib>
10932 #include "tst_exclude_posted_events.moc"
10934 int main(int argc, char *argv[])
10936     QCoreApplication app(argc, argv);
10937     exit(tst_excludePostedEvents());
10938     return 0;
10940             ]])],[
10941                 AC_MSG_RESULT([yes])
10942             ],[
10943                 AC_MSG_RESULT([no])
10944                 AC_MSG_WARN([native QT5 file pickers will be disabled at runtime])
10945                 if test -z "$qt5_fix_warning"; then
10946                     add_warning "native QT5 file pickers will be disabled at runtime, Qt5 fixes needed"
10947                 fi
10948                 qt5_fix_warning=1
10949                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-34614 (needed)"
10950             ])
10952             # Remove meta object data
10953             rm -f "${TSTBASE}."*
10955             if test -n "$qt5_fix_warning"; then
10956                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-38585 (recommended)"
10957             fi
10959             LIBS=$save_LIBS
10960             CXXFLAGS=$save_CXXFLAGS
10961             CXX=$save_CXX
10962             AC_LANG_POP([C++])
10963         ],
10964         AC_MSG_WARN([[No Glib found, Qt5 support will not use native file pickers!]])
10965     )
10967 AC_SUBST(QT5_CFLAGS)
10968 AC_SUBST(QT5_LIBS)
10969 AC_SUBST(MOC5)
10970 AC_SUBST(QT5_GLIB_CFLAGS)
10971 AC_SUBST(QT5_GLIB_LIBS)
10972 AC_SUBST(QT5_HAVE_GLIB)
10974 dnl ===================================================================
10975 dnl KDE5 Integration
10976 dnl ===================================================================
10978 KF5_CFLAGS=""
10979 KF5_LIBS=""
10980 KF5_CONFIG="kf5-config"
10981 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
10982         \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \)
10983 then
10984     kf5_incdirs="$KF5INC /usr/include /usr/include/KF5 $x_includes"
10985     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $x_libraries"
10986     if test -n "$supports_multilib"; then
10987         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
10988     fi
10990     kf5_test_include="kcoreaddons_version.h"
10991     kf5_test_library="libKF5CoreAddons.so"
10992     kf5_libdirs="$qt5_libdir $kf5_libdirs"
10994     dnl kf5 KDE4 support compatibility installed
10995     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
10996     if test "$KF5_CONFIG" != "no"; then
10997         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
10998         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
10999     fi
11001     dnl Check for KF5 headers
11002     AC_MSG_CHECKING([for KF5 headers])
11003     kf5_incdir="no"
11004     for kf5_check in $kf5_incdirs; do
11005         if test -r "$kf5_check/$kf5_test_include"; then
11006             kf5_incdir="$kf5_check"
11007             break
11008         fi
11009     done
11010     AC_MSG_RESULT([$kf5_incdir])
11011     if test "x$kf5_incdir" = "xno"; then
11012         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11013     fi
11015     dnl Check for KF5 libraries
11016     AC_MSG_CHECKING([for KF5 libraries])
11017     kf5_libdir="no"
11018     for kf5_check in $kf5_libdirs; do
11019         if test -r "$kf5_check/$kf5_test_library"; then
11020             kf5_libdir="$kf5_check"
11021             break
11022         fi
11023     done
11025     AC_MSG_RESULT([$kf5_libdir])
11026     if test "x$kf5_libdir" = "xno"; then
11027         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11028     fi
11030     PKG_CHECK_MODULES(KF5_XCB,[xcb],,[AC_MSG_ERROR([XCB not installed])])
11032     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"
11033     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network -lQt5X11Extras $KF5_XCB_LIBS"
11034     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11036     AC_LANG_PUSH([C++])
11037     save_CXXFLAGS=$CXXFLAGS
11038     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11039     AC_MSG_CHECKING([whether KDE is >= 5.0])
11040        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11041 #include <kcoreaddons_version.h>
11043 int main(int argc, char **argv) {
11044        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11045        else return 1;
11047        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11048     CXXFLAGS=$save_CXXFLAGS
11049     AC_LANG_POP([C++])
11051 AC_SUBST(KF5_CFLAGS)
11052 AC_SUBST(KF5_LIBS)
11054 dnl ===================================================================
11055 dnl Test whether to include Evolution 2 support
11056 dnl ===================================================================
11057 AC_MSG_CHECKING([whether to enable evolution 2 support])
11058 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11059     AC_MSG_RESULT([yes])
11060     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11061     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11062     FilterLibs "${GOBJECT_LIBS}"
11063     GOBJECT_LIBS="${filteredlibs}"
11064     ENABLE_EVOAB2="TRUE"
11065 else
11066     ENABLE_EVOAB2=""
11067     AC_MSG_RESULT([no])
11069 AC_SUBST(ENABLE_EVOAB2)
11070 AC_SUBST(GOBJECT_CFLAGS)
11071 AC_SUBST(GOBJECT_LIBS)
11073 dnl ===================================================================
11074 dnl Test which themes to include
11075 dnl ===================================================================
11076 AC_MSG_CHECKING([which themes to include])
11077 # if none given use default subset of available themes
11078 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11079     with_theme="breeze breeze_dark elementary galaxy hicontrast sifr sifr_dark tango"
11080     # test -z "$ENABLE_RELEASE_BUILD" && with_theme="$with_theme tango_testing"
11083 WITH_THEMES=""
11084 if test "x$with_theme" != "xno"; then
11085     for theme in $with_theme; do
11086         case $theme in
11087         breeze|breeze_dark|crystal|elementary|galaxy|hicontrast|oxygen|sifr|sifr_dark|tango|tango_testing) real_theme="$theme" ;;
11088         default) real_theme=galaxy ;;
11089         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11090         esac
11091         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11092     done
11094 AC_MSG_RESULT([$WITH_THEMES])
11095 AC_SUBST([WITH_THEMES])
11096 # FIXME: remove this, and the convenience default->galaxy remapping after a crace period
11097 for theme in $with_theme; do
11098     case $theme in
11099     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=galaxy]) ;;
11100     *) ;;
11101     esac
11102 done
11104 dnl ===================================================================
11105 dnl Test whether to integrate helppacks into the product's installer
11106 dnl ===================================================================
11107 AC_MSG_CHECKING([for helppack integration])
11108 if test "$with_helppack_integration" = "no"; then
11109     WITH_HELPPACK_INTEGRATION=
11110     AC_MSG_RESULT([no integration])
11111 else
11112     WITH_HELPPACK_INTEGRATION=TRUE
11113     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11114     AC_MSG_RESULT([integration])
11116 AC_SUBST(WITH_HELPPACK_INTEGRATION)
11118 ###############################################################################
11119 # Extensions checking
11120 ###############################################################################
11121 AC_MSG_CHECKING([for extensions integration])
11122 if test "x$enable_extension_integration" != "xno"; then
11123     WITH_EXTENSION_INTEGRATION=TRUE
11124     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11125     AC_MSG_RESULT([yes, use integration])
11126 else
11127     WITH_EXTENSION_INTEGRATION=
11128     AC_MSG_RESULT([no, do not integrate])
11130 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11132 dnl Should any extra extensions be included?
11133 dnl There are standalone tests for each of these below.
11134 WITH_EXTRA_EXTENSIONS=
11135 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11137 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11138 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11139 if test "x$with_java" != "xno"; then
11140     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11141     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11144 TEST_FONTS_MISSING=0
11146 # $1  = font family
11147 # $2+ = accepted font mappings
11148 test_font_map()
11150     FONT="$1" ; shift
11151     AC_MSG_CHECKING([font mapping for '$FONT'])
11152     FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
11153     FONTFILE_LOWER="$(echo $FONTFILE | $AWK '{print tolower($0)}')"
11155     TESTEXPR="'${FONTFILE_LOWER}' = '$(echo $FONT | $AWK '{print tolower($0)}').ttf'"
11156     while test "$#" -ge 1 ; do
11157         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
11158         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
11159     done
11160     if test $TESTEXPR
11161     then
11162         AC_MSG_RESULT([ok])
11163     else
11164         AC_MSG_WARN([unknown ($FONTFILE)])
11165         add_warning "unknown ($FONTFILE)"
11166         TEST_FONTS_MISSING=1
11167     fi
11170 dnl ===================================================================
11171 dnl Test whether to include fonts
11172 dnl ===================================================================
11173 AC_MSG_CHECKING([whether to include third-party fonts])
11174 if test "$with_fonts" != "no"; then
11175     AC_MSG_RESULT([yes])
11176     WITH_FONTS=TRUE
11177     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11178     AC_DEFINE(HAVE_MORE_FONTS)
11179 else
11180     AC_MSG_RESULT([no])
11181     WITH_FONTS=
11182     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11183     if test "$test_fontconfig" = "yes"; then
11184         AC_PATH_PROG([FCMATCH], [fc-match])
11185         if test -z "$FCMATCH"; then
11186             AC_MSG_WARN([Unable to query installed fonts - unit tests disabled.])
11187             TEST_FONTS_MISSING=1
11188         else
11189             test_font_map 'Calibri' 'Carlito'
11190             test_font_map 'DejaVuSans' 'DejaVuSans'
11191             if test ${TEST_FONTS_MISSING} -eq 1
11192             then
11193                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
11194                 add_warning "Unknown font mappings - unit tests disabled."
11195             fi
11196         fi
11197     else
11198         TEST_FONTS_MISSING=1
11199     fi
11201 AC_SUBST(WITH_FONTS)
11202 AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
11204 dnl Test whether to include more Google Noto fonts
11205 dnl ===================================================================
11206 AC_MSG_CHECKING([whether to include more Google Noto fonts])
11207 if test "$enable_noto_font" = "" -o "$enable_noto_font" = "no" -o "$with_fonts" = "no"; then
11208     AC_MSG_RESULT([no])
11209     WITH_NOTO_FONT=
11210 else
11211     AC_MSG_RESULT([yes])
11212     WITH_NOTO_FONT=TRUE
11213     BUILD_TYPE="$BUILD_TYPE NOTO_FONT"
11214     SCPDEFS="$SCPDEFS -DWITH_NOTO_FONT"
11216 AC_SUBST(WITH_NOTO_FONT)
11218 dnl ===================================================================
11219 dnl Test whether to enable online update service
11220 dnl ===================================================================
11221 AC_MSG_CHECKING([whether to enable online update])
11222 ENABLE_ONLINE_UPDATE=
11223 ENABLE_ONLINE_UPDATE_MAR=
11224 UPDATE_CONFIG=
11225 if test "$enable_online_update" = ""; then
11226     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11227         AC_MSG_RESULT([yes])
11228         ENABLE_ONLINE_UPDATE="TRUE"
11229     else
11230         AC_MSG_RESULT([no])
11231     fi
11232 else
11233     if test "$enable_online_update" = "mar"; then
11234         AC_MSG_RESULT([yes - MAR-based online update])
11235         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11236         if test "$with_update_config" = ""; then
11237             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11238         fi
11239         UPDATE_CONFIG="$with_update_config"
11240         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11241     elif test "$enable_online_update" = "yes"; then
11242         AC_MSG_RESULT([yes])
11243         ENABLE_ONLINE_UPDATE="TRUE"
11244     else
11245         AC_MSG_RESULT([no])
11246     fi
11248 AC_SUBST(ENABLE_ONLINE_UPDATE)
11249 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11250 AC_SUBST(UPDATE_CONFIG)
11252 dnl ===================================================================
11253 dnl Test whether we need bzip2
11254 dnl ===================================================================
11255 SYSTEM_BZIP2=
11256 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11257     AC_MSG_CHECKING([whether to use system bzip2])
11258     if test "$with_system_bzip2" = yes; then
11259         SYSTEM_BZIP2=TRUE
11260         AC_MSG_RESULT([yes])
11261         PKG_CHECK_MODULES(BZIP2, bzip2)
11262         FilterLibs "${BZIP2_LIBS}"
11263         BZIP2_LIBS="${filteredlibs}"
11264     else
11265         AC_MSG_RESULT([no])
11266         BUILD_TYPE="$BUILD_TYPE BZIP2"
11267     fi
11269 AC_SUBST(SYSTEM_BZIP2)
11270 AC_SUBST(BZIP2_CFLAGS)
11271 AC_SUBST(BZIP2_LIBS)
11273 dnl ===================================================================
11274 dnl Test whether to enable extension update
11275 dnl ===================================================================
11276 AC_MSG_CHECKING([whether to enable extension update])
11277 ENABLE_EXTENSION_UPDATE=
11278 if test "x$enable_extension_update" = "xno"; then
11279     AC_MSG_RESULT([no])
11280 else
11281     AC_MSG_RESULT([yes])
11282     ENABLE_EXTENSION_UPDATE="TRUE"
11283     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11284     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11286 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11289 dnl ===================================================================
11290 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11291 dnl ===================================================================
11292 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11293 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11294     AC_MSG_RESULT([no])
11295     ENABLE_SILENT_MSI=
11296 else
11297     AC_MSG_RESULT([yes])
11298     ENABLE_SILENT_MSI=TRUE
11299     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11301 AC_SUBST(ENABLE_SILENT_MSI)
11303 AC_MSG_CHECKING([whether and how to use Xinerama])
11304 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11305     if test "$x_libraries" = "default_x_libraries"; then
11306         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11307         if test "x$XINERAMALIB" = x; then
11308            XINERAMALIB="/usr/lib"
11309         fi
11310     else
11311         XINERAMALIB="$x_libraries"
11312     fi
11313     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11314         # we have both versions, let the user decide but use the dynamic one
11315         # per default
11316         USE_XINERAMA=TRUE
11317         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11318             XINERAMA_LINK=dynamic
11319         else
11320             XINERAMA_LINK=static
11321         fi
11322     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11323         # we have only the dynamic version
11324         USE_XINERAMA=TRUE
11325         XINERAMA_LINK=dynamic
11326     elif test -e "$XINERAMALIB/libXinerama.a"; then
11327         # static version
11328         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11329             USE_XINERAMA=TRUE
11330             XINERAMA_LINK=static
11331         else
11332             USE_XINERAMA=
11333             XINERAMA_LINK=none
11334         fi
11335     else
11336         # no Xinerama
11337         USE_XINERAMA=
11338         XINERAMA_LINK=none
11339     fi
11340     if test "$USE_XINERAMA" = "TRUE"; then
11341         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11342         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11343             [AC_MSG_ERROR(Xinerama header not found.)], [])
11344         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11345         if test "x$XEXTLIB" = x; then
11346            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11347         fi
11348         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11349         if test "$_os" = "FreeBSD"; then
11350             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11351         fi
11352         if test "$_os" = "Linux"; then
11353             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11354         fi
11355         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11356             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11357     else
11358         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11359     fi
11360 else
11361     USE_XINERAMA=
11362     XINERAMA_LINK=none
11363     AC_MSG_RESULT([no])
11365 AC_SUBST(USE_XINERAMA)
11366 AC_SUBST(XINERAMA_LINK)
11368 dnl ===================================================================
11369 dnl Test whether to build cairo or rely on the system version
11370 dnl ===================================================================
11372 if test "$USING_X11" = TRUE; then
11373     # Used in vcl/Library_vclplug_gen.mk
11374     test_cairo=yes
11377 if test "$test_cairo" = "yes"; then
11378     AC_MSG_CHECKING([whether to use the system cairo])
11380     : ${with_system_cairo:=$with_system_libs}
11381     if test "$with_system_cairo" = "yes"; then
11382         SYSTEM_CAIRO=TRUE
11383         AC_MSG_RESULT([yes])
11385         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11386         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11387         FilterLibs "${CAIRO_LIBS}"
11388         CAIRO_LIBS="${filteredlibs}"
11390         if test "$test_xrender" = "yes"; then
11391             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11392             AC_LANG_PUSH([C])
11393             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11394 #ifdef PictStandardA8
11395 #else
11396       return fail;
11397 #endif
11398 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11400             AC_LANG_POP([C])
11401         fi
11402     else
11403         SYSTEM_CAIRO=
11404         AC_MSG_RESULT([no])
11406         BUILD_TYPE="$BUILD_TYPE CAIRO"
11407     fi
11410 AC_SUBST(SYSTEM_CAIRO)
11411 AC_SUBST(CAIRO_CFLAGS)
11412 AC_SUBST(CAIRO_LIBS)
11414 dnl ===================================================================
11415 dnl Test whether to use avahi
11416 dnl ===================================================================
11417 if test "$_os" = "WINNT"; then
11418     # Windows uses bundled mDNSResponder
11419     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11420 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11421     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11422                       [ENABLE_AVAHI="TRUE"])
11423     AC_DEFINE(HAVE_FEATURE_AVAHI)
11424     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11425     FilterLibs "${AVAHI_LIBS}"
11426     AVAHI_LIBS="${filteredlibs}"
11429 AC_SUBST(ENABLE_AVAHI)
11430 AC_SUBST(AVAHI_CFLAGS)
11431 AC_SUBST(AVAHI_LIBS)
11433 dnl ===================================================================
11434 dnl Test whether to use liblangtag
11435 dnl ===================================================================
11436 SYSTEM_LIBLANGTAG=
11437 AC_MSG_CHECKING([whether to use system liblangtag])
11438 if test "$with_system_liblangtag" = yes; then
11439     SYSTEM_LIBLANGTAG=TRUE
11440     AC_MSG_RESULT([yes])
11441     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11442     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11443     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11444     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11445     FilterLibs "${LIBLANGTAG_LIBS}"
11446     LIBLANGTAG_LIBS="${filteredlibs}"
11447 else
11448     SYSTEM_LIBLANGTAG=
11449     AC_MSG_RESULT([no])
11450     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11451     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11452     if test "$COM" = "MSC"; then
11453         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11454     else
11455         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11456     fi
11458 AC_SUBST(SYSTEM_LIBLANGTAG)
11459 AC_SUBST(LIBLANGTAG_CFLAGS)
11460 AC_SUBST(LIBLANGTAG_LIBS)
11462 dnl ===================================================================
11463 dnl Test whether to build libpng or rely on the system version
11464 dnl ===================================================================
11466 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11468 dnl ===================================================================
11469 dnl Check for runtime JVM search path
11470 dnl ===================================================================
11471 if test "$ENABLE_JAVA" != ""; then
11472     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11473     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11474         AC_MSG_RESULT([yes])
11475         if ! test -d "$with_jvm_path"; then
11476             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11477         fi
11478         if ! test -d "$with_jvm_path"jvm; then
11479             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11480         fi
11481         JVM_ONE_PATH_CHECK="$with_jvm_path"
11482         AC_SUBST(JVM_ONE_PATH_CHECK)
11483     else
11484         AC_MSG_RESULT([no])
11485     fi
11488 dnl ===================================================================
11489 dnl Test for the presence of Ant and that it works
11490 dnl ===================================================================
11492 if test "$ENABLE_JAVA" != ""; then
11493     ANT_HOME=; export ANT_HOME
11494     WITH_ANT_HOME=; export WITH_ANT_HOME
11495     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11496         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11497             if test "$_os" = "WINNT"; then
11498                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11499             else
11500                 with_ant_home="$LODE_HOME/opt/ant"
11501             fi
11502         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11503             with_ant_home="$LODE_HOME/opt/ant"
11504         fi
11505     fi
11506     if test -z "$with_ant_home"; then
11507         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11508     else
11509         if test "$_os" = "WINNT"; then
11510             # AC_PATH_PROGS needs unix path
11511             with_ant_home=`cygpath -u "$with_ant_home"`
11512         fi
11513         AbsolutePath "$with_ant_home"
11514         with_ant_home=$absolute_path
11515         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11516         WITH_ANT_HOME=$with_ant_home
11517         ANT_HOME=$with_ant_home
11518     fi
11520     if test -z "$ANT"; then
11521         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11522     else
11523         # resolve relative or absolute symlink
11524         while test -h "$ANT"; do
11525             a_cwd=`pwd`
11526             a_basename=`basename "$ANT"`
11527             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11528             cd "`dirname "$ANT"`"
11529             cd "`dirname "$a_script"`"
11530             ANT="`pwd`"/"`basename "$a_script"`"
11531             cd "$a_cwd"
11532         done
11534         AC_MSG_CHECKING([if $ANT works])
11535         cat > conftest.java << EOF
11536         public class conftest {
11537             int testmethod(int a, int b) {
11538                     return a + b;
11539             }
11540         }
11543         cat > conftest.xml << EOF
11544         <project name="conftest" default="conftest">
11545         <target name="conftest">
11546             <javac srcdir="." includes="conftest.java">
11547             </javac>
11548         </target>
11549         </project>
11552         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11553         if test $? = 0 -a -f ./conftest.class; then
11554             AC_MSG_RESULT([Ant works])
11555             if test -z "$WITH_ANT_HOME"; then
11556                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11557                 if test -z "$ANT_HOME"; then
11558                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11559                 fi
11560             else
11561                 ANT_HOME="$WITH_ANT_HOME"
11562             fi
11563         else
11564             echo "configure: Ant test failed" >&5
11565             cat conftest.java >&5
11566             cat conftest.xml >&5
11567             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11568         fi
11569         rm -f conftest* core core.* *.core
11570     fi
11571     if test -z "$ANT_HOME"; then
11572         ANT_HOME="NO_ANT_HOME"
11573     else
11574         PathFormat "$ANT_HOME"
11575         ANT_HOME="$formatted_path"
11576         PathFormat "$ANT"
11577         ANT="$formatted_path"
11578     fi
11579     AC_SUBST(ANT_HOME)
11580     AC_SUBST(ANT)
11582     dnl Checking for ant.jar
11583     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11584         AC_MSG_CHECKING([Ant lib directory])
11585         if test -f $ANT_HOME/lib/ant.jar; then
11586             ANT_LIB="$ANT_HOME/lib"
11587         else
11588             if test -f $ANT_HOME/ant.jar; then
11589                 ANT_LIB="$ANT_HOME"
11590             else
11591                 if test -f /usr/share/java/ant.jar; then
11592                     ANT_LIB=/usr/share/java
11593                 else
11594                     if test -f /usr/share/ant-core/lib/ant.jar; then
11595                         ANT_LIB=/usr/share/ant-core/lib
11596                     else
11597                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11598                             ANT_LIB="$ANT_HOME/lib/ant"
11599                         else
11600                             if test -f /usr/share/lib/ant/ant.jar; then
11601                                 ANT_LIB=/usr/share/lib/ant
11602                             else
11603                                 AC_MSG_ERROR([Ant libraries not found!])
11604                             fi
11605                         fi
11606                     fi
11607                 fi
11608             fi
11609         fi
11610         PathFormat "$ANT_LIB"
11611         ANT_LIB="$formatted_path"
11612         AC_MSG_RESULT([Ant lib directory found.])
11613     fi
11614     AC_SUBST(ANT_LIB)
11616     ant_minver=1.6.0
11617     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11619     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11620     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11621     ant_version_major=`echo $ant_version | cut -d. -f1`
11622     ant_version_minor=`echo $ant_version | cut -d. -f2`
11623     echo "configure: ant_version $ant_version " >&5
11624     echo "configure: ant_version_major $ant_version_major " >&5
11625     echo "configure: ant_version_minor $ant_version_minor " >&5
11626     if test "$ant_version_major" -ge "2"; then
11627         AC_MSG_RESULT([yes, $ant_version])
11628     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11629         AC_MSG_RESULT([yes, $ant_version])
11630     else
11631         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11632     fi
11634     rm -f conftest* core core.* *.core
11637 OOO_JUNIT_JAR=
11638 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11639     AC_MSG_CHECKING([for JUnit 4])
11640     if test "$with_junit" = "yes"; then
11641         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
11642             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
11643         elif test -e /usr/share/java/junit4.jar; then
11644             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11645         else
11646            if test -e /usr/share/lib/java/junit.jar; then
11647               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11648            else
11649               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11650            fi
11651         fi
11652     else
11653         OOO_JUNIT_JAR=$with_junit
11654     fi
11655     if test "$_os" = "WINNT"; then
11656         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11657     fi
11658     printf 'import org.junit.Before;' > conftest.java
11659     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11660         AC_MSG_RESULT([$OOO_JUNIT_JAR])
11661     else
11662         AC_MSG_ERROR(
11663 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
11664  specify its pathname via --with-junit=..., or disable it via --without-junit])
11665     fi
11666     rm -f conftest.class conftest.java
11667     if test $OOO_JUNIT_JAR != ""; then
11668     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11669     fi
11671 AC_SUBST(OOO_JUNIT_JAR)
11673 HAMCREST_JAR=
11674 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11675     AC_MSG_CHECKING([for included Hamcrest])
11676     printf 'import org.hamcrest.BaseDescription;' > conftest.java
11677     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11678         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
11679     else
11680         AC_MSG_RESULT([Not included])
11681         AC_MSG_CHECKING([for standalone hamcrest jar.])
11682         if test "$with_hamcrest" = "yes"; then
11683             if test -e /usr/share/lib/java/hamcrest.jar; then
11684                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
11685             elif test -e /usr/share/java/hamcrest/core.jar; then
11686                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
11687             else
11688                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
11689             fi
11690         else
11691             HAMCREST_JAR=$with_hamcrest
11692         fi
11693         if test "$_os" = "WINNT"; then
11694             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
11695         fi
11696         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
11697             AC_MSG_RESULT([$HAMCREST_JAR])
11698         else
11699             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),
11700                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
11701         fi
11702     fi
11703     rm -f conftest.class conftest.java
11705 AC_SUBST(HAMCREST_JAR)
11708 AC_SUBST(SCPDEFS)
11711 # check for wget and curl
11713 WGET=
11714 CURL=
11716 if test "$enable_fetch_external" != "no"; then
11718 CURL=`which curl 2>/dev/null`
11720 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
11721     # wget new enough?
11722     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
11723     if test $? -eq 0; then
11724         WGET=$i
11725         break
11726     fi
11727 done
11729 if test -z "$WGET" -a -z "$CURL"; then
11730     AC_MSG_ERROR([neither wget nor curl found!])
11735 AC_SUBST(WGET)
11736 AC_SUBST(CURL)
11739 # check for sha256sum
11741 SHA256SUM=
11743 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
11744     eval "$i -a 256 --version" > /dev/null 2>&1
11745     ret=$?
11746     if test $ret -eq 0; then
11747         SHA256SUM="$i -a 256"
11748         break
11749     fi
11750 done
11752 if test -z "$SHA256SUM"; then
11753     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
11754         eval "$i --version" > /dev/null 2>&1
11755         ret=$?
11756         if test $ret -eq 0; then
11757             SHA256SUM=$i
11758             break
11759         fi
11760     done
11763 if test -z "$SHA256SUM"; then
11764     AC_MSG_ERROR([no sha256sum found!])
11767 AC_SUBST(SHA256SUM)
11769 dnl ===================================================================
11770 dnl Dealing with l10n options
11771 dnl ===================================================================
11772 AC_MSG_CHECKING([which languages to be built])
11773 # get list of all languages
11774 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
11775 # the sed command does the following:
11776 #   + if a line ends with a backslash, append the next line to it
11777 #   + adds " on the beginning of the value (after =)
11778 #   + adds " at the end of the value
11779 #   + removes en-US; we want to put it on the beginning
11780 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
11781 [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)]
11782 ALL_LANGS="en-US $completelangiso"
11783 # check the configured localizations
11784 WITH_LANG="$with_lang"
11785 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
11786     AC_MSG_RESULT([en-US])
11787 else
11788     AC_MSG_RESULT([$WITH_LANG])
11789     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
11790     if test -z "$MSGFMT"; then
11791         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
11792             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
11793         elif test -x "/opt/lo/bin/msgfmt"; then
11794             MSGFMT="/opt/lo/bin/msgfmt"
11795         else
11796             AC_CHECK_PROGS(MSGFMT, [msgfmt])
11797             if test -z "$MSGFMT"; then
11798                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
11799             fi
11800         fi
11801     fi
11802     if test -z "$MSGUNIQ"; then
11803         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
11804             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
11805         elif test -x "/opt/lo/bin/msguniq"; then
11806             MSGUNIQ="/opt/lo/bin/msguniq"
11807         else
11808             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
11809             if test -z "$MSGUNIQ"; then
11810                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
11811             fi
11812         fi
11813     fi
11815 AC_SUBST(MSGFMT)
11816 AC_SUBST(MSGUNIQ)
11817 # check that the list is valid
11818 for lang in $WITH_LANG; do
11819     test "$lang" = "ALL" && continue
11820     # need to check for the exact string, so add space before and after the list of all languages
11821     for vl in $ALL_LANGS; do
11822         if test "$vl" = "$lang"; then
11823            break
11824         fi
11825     done
11826     if test "$vl" != "$lang"; then
11827         # if you're reading this - you prolly quoted your languages remove the quotes ...
11828         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
11829     fi
11830 done
11831 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
11832     echo $WITH_LANG | grep -q en-US
11833     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
11835 # list with substituted ALL
11836 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
11837 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
11838 test "$WITH_LANG" = "en-US" && WITH_LANG=
11839 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
11840     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
11841     ALL_LANGS=`echo $ALL_LANGS qtz`
11843 AC_SUBST(ALL_LANGS)
11844 AC_SUBST(WITH_LANG)
11845 AC_SUBST(WITH_LANG_LIST)
11846 AC_SUBST(GIT_NEEDED_SUBMODULES)
11848 WITH_POOR_HELP_LOCALIZATIONS=
11849 if test -d "$SRC_ROOT/translations/source"; then
11850     for l in `ls -1 $SRC_ROOT/translations/source`; do
11851         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
11852             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
11853         fi
11854     done
11856 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
11858 if test -n "$with_locales"; then
11859     WITH_LOCALES="$with_locales"
11861     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
11862     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
11863     # config_host/config_locales.h.in
11864     for locale in $WITH_LOCALES; do
11865         lang=${locale%_*}
11867         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
11869         case $lang in
11870         hi|mr*ne)
11871             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
11872             ;;
11873         bg|ru)
11874             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
11875             ;;
11876         esac
11877     done
11878 else
11879     AC_DEFINE(WITH_LOCALE_ALL)
11881 AC_SUBST(WITH_LOCALES)
11883 dnl git submodule update --reference
11884 dnl ===================================================================
11885 if test -n "${GIT_REFERENCE_SRC}"; then
11886     for repo in ${GIT_NEEDED_SUBMODULES}; do
11887         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
11888             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
11889         fi
11890     done
11892 AC_SUBST(GIT_REFERENCE_SRC)
11894 dnl git submodules linked dirs
11895 dnl ===================================================================
11896 if test -n "${GIT_LINK_SRC}"; then
11897     for repo in ${GIT_NEEDED_SUBMODULES}; do
11898         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
11899             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
11900         fi
11901     done
11903 AC_SUBST(GIT_LINK_SRC)
11905 dnl branding
11906 dnl ===================================================================
11907 AC_MSG_CHECKING([for alternative branding images directory])
11908 # initialize mapped arrays
11909 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
11910 brand_files="$BRAND_INTRO_IMAGES about.svg"
11912 if test -z "$with_branding" -o "$with_branding" = "no"; then
11913     AC_MSG_RESULT([none])
11914     DEFAULT_BRAND_IMAGES="$brand_files"
11915 else
11916     if ! test -d $with_branding ; then
11917         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
11918     else
11919         AC_MSG_RESULT([$with_branding])
11920         CUSTOM_BRAND_DIR="$with_branding"
11921         for lfile in $brand_files
11922         do
11923             if ! test -f $with_branding/$lfile ; then
11924                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
11925                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
11926             else
11927                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
11928             fi
11929         done
11930         check_for_progress="yes"
11931     fi
11933 AC_SUBST([BRAND_INTRO_IMAGES])
11934 AC_SUBST([CUSTOM_BRAND_DIR])
11935 AC_SUBST([CUSTOM_BRAND_IMAGES])
11936 AC_SUBST([DEFAULT_BRAND_IMAGES])
11939 AC_MSG_CHECKING([for 'intro' progress settings])
11940 PROGRESSBARCOLOR=
11941 PROGRESSSIZE=
11942 PROGRESSPOSITION=
11943 PROGRESSFRAMECOLOR=
11944 PROGRESSTEXTCOLOR=
11945 PROGRESSTEXTBASELINE=
11947 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
11948     source "$with_branding/progress.conf"
11949     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
11950 else
11951     AC_MSG_RESULT([none])
11954 AC_SUBST(PROGRESSBARCOLOR)
11955 AC_SUBST(PROGRESSSIZE)
11956 AC_SUBST(PROGRESSPOSITION)
11957 AC_SUBST(PROGRESSFRAMECOLOR)
11958 AC_SUBST(PROGRESSTEXTCOLOR)
11959 AC_SUBST(PROGRESSTEXTBASELINE)
11962 AC_MSG_CHECKING([for extra build ID])
11963 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
11964     EXTRA_BUILDID="$with_extra_buildid"
11966 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
11967 if test -n "$EXTRA_BUILDID" ; then
11968     AC_MSG_RESULT([$EXTRA_BUILDID])
11969 else
11970     AC_MSG_RESULT([not set])
11972 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
11974 OOO_VENDOR=
11975 AC_MSG_CHECKING([for vendor])
11976 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
11977     OOO_VENDOR="$USERNAME"
11979     if test -z "$OOO_VENDOR"; then
11980         OOO_VENDOR="$USER"
11981     fi
11983     if test -z "$OOO_VENDOR"; then
11984         OOO_VENDOR="`id -u -n`"
11985     fi
11987     AC_MSG_RESULT([not set, using $OOO_VENDOR])
11988 else
11989     OOO_VENDOR="$with_vendor"
11990     AC_MSG_RESULT([$OOO_VENDOR])
11992 AC_SUBST(OOO_VENDOR)
11994 if test "$_os" = "Android" ; then
11995     ANDROID_PACKAGE_NAME=
11996     AC_MSG_CHECKING([for Android package name])
11997     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
11998         if test -n "$ENABLE_DEBUG"; then
11999             # Default to the package name that makes ndk-gdb happy.
12000             ANDROID_PACKAGE_NAME="org.libreoffice"
12001         else
12002             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12003         fi
12005         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12006     else
12007         ANDROID_PACKAGE_NAME="$with_android_package_name"
12008         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12009     fi
12010     AC_SUBST(ANDROID_PACKAGE_NAME)
12013 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12014 if test "$with_compat_oowrappers" = "yes"; then
12015     WITH_COMPAT_OOWRAPPERS=TRUE
12016     AC_MSG_RESULT(yes)
12017 else
12018     WITH_COMPAT_OOWRAPPERS=
12019     AC_MSG_RESULT(no)
12021 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12023 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{gsub(" ", "", $0);print tolower($0)}'`
12024 AC_MSG_CHECKING([for install dirname])
12025 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12026     INSTALLDIRNAME="$with_install_dirname"
12028 AC_MSG_RESULT([$INSTALLDIRNAME])
12029 AC_SUBST(INSTALLDIRNAME)
12031 AC_MSG_CHECKING([for prefix])
12032 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12033 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12034 PREFIXDIR="$prefix"
12035 AC_MSG_RESULT([$PREFIXDIR])
12036 AC_SUBST(PREFIXDIR)
12038 LIBDIR=[$(eval echo $(eval echo $libdir))]
12039 AC_SUBST(LIBDIR)
12041 DATADIR=[$(eval echo $(eval echo $datadir))]
12042 AC_SUBST(DATADIR)
12044 MANDIR=[$(eval echo $(eval echo $mandir))]
12045 AC_SUBST(MANDIR)
12047 DOCDIR=[$(eval echo $(eval echo $docdir))]
12048 AC_SUBST(DOCDIR)
12050 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12051 AC_SUBST(INSTALLDIR)
12053 TESTINSTALLDIR="${BUILDDIR}/test-install"
12054 AC_SUBST(TESTINSTALLDIR)
12057 # ===================================================================
12058 # OAuth2 id and secrets
12059 # ===================================================================
12061 AC_MSG_CHECKING([for Google Drive client id and secret])
12062 GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12063 GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12064 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12065     GDRIVE_CLIENT_ID="\"\""
12068 if test "$with_gdrive_client_secret" = "no" -o -z "$with_gdrive_client_secret"; then
12069     GDRIVE_CLIENT_SECRET="\"\""
12072 if test -z "$GDRIVE_CLIENT_ID" -o -z "$GDRIVE_CLIENT_SECRET"; then
12073     AC_MSG_RESULT([not set])
12074 else
12075     AC_MSG_RESULT([set])
12078 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12079 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12081 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12082 ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12083 ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12084 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12085     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12088 if test "$with_alfresco_cloud_client_secret" = "no" -o -z "$with_alfresco_cloud_client_secret"; then
12089     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12092 if test -z "$ALFRESCO_CLOUD_CLIENT_ID" -o -z "$ALFRESCO_CLOUD_CLIENT_SECRET"; then
12093     AC_MSG_RESULT([not set])
12094 else
12095     AC_MSG_RESULT([set])
12097 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12098 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12100 AC_MSG_CHECKING([for OneDrive client id and secret])
12101 ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12102 ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12103 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12104     ONEDRIVE_CLIENT_ID="\"\""
12107 if test "$with_onedrive_client_secret" = "no" -o -z "$with_onedrive_client_secret"; then
12108     ONEDRIVE_CLIENT_SECRET="\"\""
12111 if test -z "$ONEDRIVE_CLIENT_ID" -o -z "$ONEDRIVE_CLIENT_SECRET"; then
12112     AC_MSG_RESULT([not set])
12113 else
12114     AC_MSG_RESULT([set])
12116 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12117 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12120 dnl ===================================================================
12121 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12122 dnl --enable-dependency-tracking configure option
12123 dnl ===================================================================
12124 AC_MSG_CHECKING([whether to enable dependency tracking])
12125 if test "$enable_dependency_tracking" = "no"; then
12126     nodep=TRUE
12127     AC_MSG_RESULT([no])
12128 else
12129     AC_MSG_RESULT([yes])
12131 AC_SUBST(nodep)
12133 dnl ===================================================================
12134 dnl Number of CPUs to use during the build
12135 dnl ===================================================================
12136 AC_MSG_CHECKING([for number of processors to use])
12137 # plain --with-parallelism is just the default
12138 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12139     if test "$with_parallelism" = "no"; then
12140         PARALLELISM=0
12141     else
12142         PARALLELISM=$with_parallelism
12143     fi
12144 else
12145     if test "$enable_icecream" = "yes"; then
12146         PARALLELISM="10"
12147     else
12148         case `uname -s` in
12150         Darwin|FreeBSD|NetBSD|OpenBSD)
12151             PARALLELISM=`sysctl -n hw.ncpu`
12152             ;;
12154         Linux)
12155             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12156         ;;
12157         # what else than above does profit here *and* has /proc?
12158         *)
12159             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12160             ;;
12161         esac
12163         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12164         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12165     fi
12168 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12169     if test -z "$with_parallelism"; then
12170             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12171             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12172             PARALLELISM="1"
12173     else
12174         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."
12175     fi
12178 if test $PARALLELISM -eq 0; then
12179     AC_MSG_RESULT([explicit make -j option needed])
12180 else
12181     AC_MSG_RESULT([$PARALLELISM])
12183 AC_SUBST(PARALLELISM)
12185 IWYU_PATH="$with_iwyu"
12186 AC_SUBST(IWYU_PATH)
12187 if test ! -z "$IWYU_PATH"; then
12188     if test ! -f "$IWYU_PATH"; then
12189         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12190     fi
12194 # Set up ILIB for MSVC build
12196 ILIB1=
12197 if test "$build_os" = "cygwin"; then
12198     ILIB="."
12199     if test -n "$JAVA_HOME"; then
12200         ILIB="$ILIB;$JAVA_HOME/lib"
12201     fi
12202     ILIB1=-link
12203     if test "$BITNESS_OVERRIDE" = 64; then
12204         if test $vcnum = "150"; then
12205             ILIB="$ILIB;$COMPATH/lib/x64"
12206             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12207         else
12208             ILIB="$ILIB;$COMPATH/lib/amd64"
12209             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/amd64"
12210         fi
12211         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12212         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12213         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12214             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12215             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12216         fi
12217         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12218         ucrtlibpath_formatted=$formatted_path
12219         ILIB="$ILIB;$ucrtlibpath_formatted"
12220         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12221     else
12222         if test $vcnum = "150"; then
12223             ILIB="$ILIB;$COMPATH/lib/x86"
12224             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12225         else
12226             ILIB="$ILIB;$COMPATH/lib"
12227             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib"
12228         fi
12229         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12230         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12231         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12232             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12233             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12234         fi
12235         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12236         ucrtlibpath_formatted=$formatted_path
12237         ILIB="$ILIB;$ucrtlibpath_formatted"
12238         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12239     fi
12240     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12241         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12242     else
12243         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12244     fi
12246     AC_SUBST(ILIB)
12249 dnl We should be able to drop the below check when bumping the GCC baseline to
12250 dnl 4.9, as <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54577>
12251 dnl "deque<T>::erase() still takes iterator instead of const_iterator" should be
12252 dnl fixed there with <https://gcc.gnu.org/git/?p=gcc.git;a=commit;
12253 dnl h=6b0e18ca48bb4b4c01e7b5be2b98849943fdcf91>:
12254 AC_MSG_CHECKING(
12255     [whether C++11 use of const_iterator in standard containers is broken])
12256 save_CXXFLAGS=$CXXFLAGS
12257 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12258 AC_LANG_PUSH([C++])
12259 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12260     #include <list>
12261     ]],[[
12262         std::list<int> l;
12263         l.erase(l.cbegin());
12264     ]])],
12265     [broken=no], [broken=yes])
12266 AC_LANG_POP([C++])
12267 CXXFLAGS=$save_CXXFLAGS
12268 AC_MSG_RESULT([$broken])
12269 if test "$broken" = yes; then
12270     AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
12274 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12275 save_CXXFLAGS=$CXXFLAGS
12276 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12277 save_LIBS=$LIBS
12278 if test -n "$ILIB1"; then
12279     LIBS="$LIBS $ILIB1"
12281 AC_LANG_PUSH([C++])
12282 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12283     // Exit with failure if the static initializer_list is stored on the
12284     // stack (as done by Clang < 3.4):
12285     #include <initializer_list>
12286     struct S {};
12287     bool g(void const * p1, void const * p2) {
12288         int n;
12289         return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12290     }
12291     bool f(void const * p1) {
12292         static std::initializer_list<S> s { S() };
12293         return g(p1, s.begin());
12294     }
12295     ]],[[
12296         int n;
12297         return f(&n) ? 0 : 1;
12298     ]])], [broken=no], [broken=yes],[broken='assuming not (cross-compiling)'])
12299 AC_LANG_POP([C++])
12300 LIBS=$save_LIBS
12301 CXXFLAGS=$save_CXXFLAGS
12302 AC_MSG_RESULT([$broken])
12303 if test "$broken" = yes -a "$_os" != "iOS"; then
12304     AC_MSG_ERROR([working support for static initializer_list needed])
12308 # ===================================================================
12309 # Creating bigger shared library to link against
12310 # ===================================================================
12311 AC_MSG_CHECKING([whether to create huge library])
12312 MERGELIBS=
12314 if test $_os = iOS -o $_os = Android; then
12315     # Never any point in mergelibs for these as we build just static
12316     # libraries anyway...
12317     enable_mergelibs=no
12320 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12321     if test $_os != Linux -a $_os != WINNT; then
12322         add_warning "--enable-mergelibs is not tested for this platform"
12323     fi
12324     MERGELIBS="TRUE"
12325     AC_MSG_RESULT([yes])
12326 else
12327     AC_MSG_RESULT([no])
12329 AC_SUBST([MERGELIBS])
12331 dnl ===================================================================
12332 dnl icerun is a wrapper that stops us spawning tens of processes
12333 dnl locally - for tools that can't be executed on the compile cluster
12334 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12335 dnl ===================================================================
12336 AC_MSG_CHECKING([whether to use icerun wrapper])
12337 ICECREAM_RUN=
12338 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12339     ICECREAM_RUN=icerun
12340     AC_MSG_RESULT([yes])
12341 else
12342     AC_MSG_RESULT([no])
12344 AC_SUBST(ICECREAM_RUN)
12346 dnl ===================================================================
12347 dnl Setup the ICECC_VERSION for the build the same way it was set for
12348 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12349 dnl ===================================================================
12350 x_ICECC_VERSION=[\#]
12351 if test -n "$ICECC_VERSION" ; then
12352     x_ICECC_VERSION=
12354 AC_SUBST(x_ICECC_VERSION)
12355 AC_SUBST(ICECC_VERSION)
12357 dnl ===================================================================
12359 AC_MSG_CHECKING([MPL subset])
12360 MPL_SUBSET=
12362 if test "$enable_mpl_subset" = "yes"; then
12363     warn_report=false
12364     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12365         warn_report=true
12366     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12367         warn_report=true
12368     fi
12369     if test "$warn_report" = "true"; then
12370         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12371     fi
12372     if test "x$enable_postgresql_sdbc" != "xno"; then
12373         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12374     fi
12375     if test "$enable_lotuswordpro" = "yes"; then
12376         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12377     fi
12378     if test "$WITH_WEBDAV" = "neon"; then
12379         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12380     fi
12381     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12382         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12383     fi
12384     if test -n "$ENABLE_PDFIMPORT"; then
12385         if test "x$SYSTEM_POPPLER" = "x"; then
12386             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12387         fi
12388     fi
12389     # cf. m4/libo_check_extension.m4
12390     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12391         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12392     fi
12393     for theme in $WITH_THEMES; do
12394         case $theme in
12395         crystal|default|hicontrast|oxygen)
12396             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12397         *) : ;;
12398         esac
12399     done
12401     ENABLE_OPENGL_TRANSITIONS=
12403     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12404         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12405     fi
12407     MPL_SUBSET="TRUE"
12408     AC_DEFINE(MPL_HAVE_SUBSET)
12409     AC_MSG_RESULT([only])
12410 else
12411     AC_MSG_RESULT([no restrictions])
12413 AC_SUBST(MPL_SUBSET)
12415 dnl ===================================================================
12417 AC_MSG_CHECKING([formula logger])
12418 ENABLE_FORMULA_LOGGER=
12420 if test "x$enable_formula_logger" = "xyes"; then
12421     AC_MSG_RESULT([yes])
12422     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12423     ENABLE_FORMULA_LOGGER=TRUE
12424 elif test -n "$ENABLE_DBGUTIL" ; then
12425     AC_MSG_RESULT([yes])
12426     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12427     ENABLE_FORMULA_LOGGER=TRUE
12428 else
12429     AC_MSG_RESULT([no])
12432 AC_SUBST(ENABLE_FORMULA_LOGGER)
12434 dnl ===================================================================
12435 dnl Setting up the environment.
12436 dnl ===================================================================
12437 AC_MSG_NOTICE([setting up the build environment variables...])
12439 AC_SUBST(COMPATH)
12441 if test "$build_os" = "cygwin"; then
12442     if test -d "$COMPATH/atlmfc/lib"; then
12443         ATL_LIB="$COMPATH/atlmfc/lib"
12444         ATL_INCLUDE="$COMPATH/atlmfc/include"
12445     else
12446         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12447         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12448     fi
12449     if test "$BITNESS_OVERRIDE" = 64; then
12450         if test $VCVER = "150"; then
12451             ATL_LIB="$ATL_LIB/x64"
12452         else
12453             ATL_LIB="$ATL_LIB/amd64"
12454         fi
12455     else
12456         if test $VCVER = "150"; then
12457             ATL_LIB="$ATL_LIB/x86"
12458         fi
12459     fi
12460     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12461     PathFormat "/usr/bin/find.exe"
12462     FIND="$formatted_path"
12463     PathFormat "/usr/bin/sort.exe"
12464     SORT="$formatted_path"
12465     PathFormat "/usr/bin/grep.exe"
12466     WIN_GREP="$formatted_path"
12467     PathFormat "/usr/bin/ls.exe"
12468     WIN_LS="$formatted_path"
12469     PathFormat "/usr/bin/touch.exe"
12470     WIN_TOUCH="$formatted_path"
12471 else
12472     FIND=find
12473     SORT=sort
12476 AC_SUBST(ATL_INCLUDE)
12477 AC_SUBST(ATL_LIB)
12478 AC_SUBST(FIND)
12479 AC_SUBST(SORT)
12480 AC_SUBST(WIN_GREP)
12481 AC_SUBST(WIN_LS)
12482 AC_SUBST(WIN_TOUCH)
12484 AC_SUBST(BUILD_TYPE)
12486 AC_SUBST(SOLARINC)
12488 PathFormat "$PERL"
12489 PERL="$formatted_path"
12490 AC_SUBST(PERL)
12492 if test -n "$TMPDIR"; then
12493     TEMP_DIRECTORY="$TMPDIR"
12494 else
12495     TEMP_DIRECTORY="/tmp"
12497 if test "$build_os" = "cygwin"; then
12498     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12500 AC_SUBST(TEMP_DIRECTORY)
12502 # setup the PATH for the environment
12503 if test -n "$LO_PATH_FOR_BUILD"; then
12504     LO_PATH="$LO_PATH_FOR_BUILD"
12505 else
12506     LO_PATH="$PATH"
12508     case "$host_os" in
12510     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12511         if test "$ENABLE_JAVA" != ""; then
12512             pathmunge "$JAVA_HOME/bin" "after"
12513         fi
12514         ;;
12516     cygwin*)
12517         # Win32 make needs native paths
12518         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12519             LO_PATH=`cygpath -p -m "$PATH"`
12520         fi
12521         if test "$BITNESS_OVERRIDE" = 64; then
12522             # needed for msi packaging
12523             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12524         fi
12525         # .NET 4.6 and higher don't have bin directory
12526         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12527             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12528         fi
12529         pathmunge "$ASM_HOME" "before"
12530         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12531         pathmunge "$CSC_PATH" "before"
12532         pathmunge "$MIDL_PATH" "before"
12533         pathmunge "$AL_PATH" "before"
12534         pathmunge "$MSPDB_PATH" "before"
12535         if test -n "$MSBUILD_PATH" ; then
12536             pathmunge "$MSBUILD_PATH" "before"
12537         fi
12538         if test "$BITNESS_OVERRIDE" = 64; then
12539             pathmunge "$COMPATH/bin/amd64" "before"
12540             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12541         else
12542             pathmunge "$COMPATH/bin" "before"
12543             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12544         fi
12545         if test "$ENABLE_JAVA" != ""; then
12546             if test -d "$JAVA_HOME/jre/bin/client"; then
12547                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12548             fi
12549             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12550                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12551             fi
12552             pathmunge "$JAVA_HOME/bin" "before"
12553         fi
12554         ;;
12556     solaris*)
12557         pathmunge "/usr/css/bin" "before"
12558         if test "$ENABLE_JAVA" != ""; then
12559             pathmunge "$JAVA_HOME/bin" "after"
12560         fi
12561         ;;
12562     esac
12565 AC_SUBST(LO_PATH)
12567 libo_FUZZ_SUMMARY
12569 # Generate a configuration sha256 we can use for deps
12570 if test -f config_host.mk; then
12571     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12573 if test -f config_host_lang.mk; then
12574     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12577 CFLAGS=$my_original_CFLAGS
12578 CXXFLAGS=$my_original_CXXFLAGS
12579 CPPFLAGS=$my_original_CPPFLAGS
12581 AC_CONFIG_FILES([config_host.mk
12582                  config_host_lang.mk
12583                  Makefile
12584                  lo.xcent
12585                  bin/bffvalidator.sh
12586                  bin/odfvalidator.sh
12587                  bin/officeotron.sh
12588                  instsetoo_native/util/openoffice.lst
12589                  sysui/desktop/macosx/Info.plist])
12590 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12591 AC_CONFIG_HEADERS([config_host/config_clang.h])
12592 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12593 AC_CONFIG_HEADERS([config_host/config_eot.h])
12594 AC_CONFIG_HEADERS([config_host/config_extension_update.h])
12595 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12596 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12597 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12598 AC_CONFIG_HEADERS([config_host/config_features.h])
12599 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12600 AC_CONFIG_HEADERS([config_host/config_folders.h])
12601 AC_CONFIG_HEADERS([config_host/config_gio.h])
12602 AC_CONFIG_HEADERS([config_host/config_global.h])
12603 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12604 AC_CONFIG_HEADERS([config_host/config_java.h])
12605 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12606 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12607 AC_CONFIG_HEADERS([config_host/config_locales.h])
12608 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12609 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12610 AC_CONFIG_HEADERS([config_host/config_qt5.h])
12611 AC_CONFIG_HEADERS([config_host/config_oox.h])
12612 AC_CONFIG_HEADERS([config_host/config_options.h])
12613 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12614 AC_CONFIG_HEADERS([config_host/config_test.h])
12615 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12616 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12617 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12618 AC_CONFIG_HEADERS([config_host/config_version.h])
12619 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12620 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12621 AC_CONFIG_HEADERS([config_host/config_python.h])
12622 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12623 AC_OUTPUT
12625 if test "$CROSS_COMPILING" = TRUE; then
12626     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12629 # touch the config timestamp file
12630 if test ! -f config_host.mk.stamp; then
12631     echo > config_host.mk.stamp
12632 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12633     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12634 else
12635     echo > config_host.mk.stamp
12638 # touch the config lang timestamp file
12639 if test ! -f config_host_lang.mk.stamp; then
12640     echo > config_host_lang.mk.stamp
12641 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12642     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12643 else
12644     echo > config_host_lang.mk.stamp
12648 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12650 cat << _EOS
12651 ****************************************************************************
12652 WARNING:
12653 Your make version is known to be horribly slow, and hard to debug
12654 problems with. To get a reasonably functional make please do:
12656 to install a pre-compiled binary make for Win32
12658  mkdir -p /opt/lo/bin
12659  cd /opt/lo/bin
12660  wget https://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
12661  cp make-85047eb-msvc.exe make
12662  chmod +x make
12664 to install from source:
12665 place yourself in a working directory of you choice.
12667  git clone git://git.savannah.gnu.org/make.git
12669  [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"]
12670  set PATH=%PATH%;C:\Cygwin\bin
12671  [or Cygwin64, if that is what you have]
12672  cd path-to-make-repo-you-cloned-above
12673  build_w32.bat --without-guile
12675 should result in a WinRel/gnumake.exe.
12676 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12678 Then re-run autogen.sh
12680 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12681 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12683 _EOS
12686 cat << _EOF
12687 ****************************************************************************
12689 To build, run:
12690 $GNUMAKE
12692 To view some help, run:
12693 $GNUMAKE help
12695 _EOF
12697 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12698     cat << _EOF
12699 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12700 _EOF
12702     if test $_os = Darwin; then
12703         echo open instdir/$PRODUCTNAME.app
12704     else
12705         echo instdir/program/soffice
12706     fi
12707     cat << _EOF
12709 If you want to run the smoketest, run:
12710 $GNUMAKE check
12712 _EOF
12715 if test -f warn; then
12716     cat warn
12717     rm warn
12720 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: