LOK: tilebench improvements
[LibreOffice.git] / configure.ac
blobf0eb940fbae20a3218caccd44e9ce8713aa30beb
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 102 -*-
2 dnl configure.ac serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 # The version number in the second argument to AC_INIT should be four numbers separated by
6 # periods. Some parts of the code requires the first one to be less than 128 and the others to be less
7 # than 256. The four numbers can optionally be followed by a period and a free-form string containing
8 # no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
9 # several non-alphanumeric characters, those are split off and used only for the
10 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
12 AC_INIT([LibreOffice],[6.1.0.0.alpha0+],[],[],[http://documentfoundation.org/])
14 AC_PREREQ([2.59])
16 if test -n "$BUILD_TYPE"; then
17     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
20 save_CC=$CC
21 save_CXX=$CXX
23 BUILD_TYPE="LibO"
24 SCPDEFS=""
25 GIT_NEEDED_SUBMODULES=""
26 LO_PATH= # used by path_munge to construct a PATH variable
28 FilterLibs()
30     filteredlibs=
31     for f in $1; do
32         case "$f" in
33             # let's start with Fedora's paths for now
34             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
35                 # ignore it: on UNIXoids it is searched by default anyway
36                 # but if it's given explicitly then it may override other paths
37                 # (on Mac OS X it would be an error to use it instead of SDK)
38                 ;;
39             *)
40                 filteredlibs="$filteredlibs $f"
41                 ;;
42         esac
43     done
46 PathFormat()
48     formatted_path="$1"
49     if test "$build_os" = "cygwin"; then
50         pf_conv_to_dos=
51         # spaces,parentheses,brackets,braces are problematic in pathname
52         # so are backslashes
53         case "$formatted_path" in
54             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
55                 pf_conv_to_dos="yes"
56             ;;
57         esac
58         if test "$pf_conv_to_dos" = "yes"; then
59             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
60                 formatted_path=`cygpath -sm "$formatted_path"`
61             else
62                 formatted_path=`cygpath -d "$formatted_path"`
63             fi
64             if test $? -ne 0;  then
65                 AC_MSG_ERROR([path conversion failed for "$1".])
66             fi
67         fi
68         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
69         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
70         if test "$fp_count_slash$fp_count_colon" != "00"; then
71             if test "$fp_count_colon" = "0"; then
72                 new_formatted_path=`realpath "$formatted_path"`
73                 if test $? -ne 0;  then
74                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
75                 else
76                     formatted_path="$new_formatted_path"
77                 fi
78             fi
79             formatted_path=`cygpath -m "$formatted_path"`
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84     fi
87 AbsolutePath()
89     # There appears to be no simple and portable method to get an absolute and
90     # canonical path, so we try creating the directory if does not exist and
91     # utilizing the shell and pwd.
92     rel="$1"
93     absolute_path=""
94     test ! -e "$rel" && mkdir -p "$rel"
95     if test -d "$rel" ; then
96         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
97         absolute_path="$(pwd)"
98         cd - > /dev/null
99     else
100         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
101     fi
104 rm -f warn
105 have_WARNINGS="no"
106 add_warning()
108     if test "$have_WARNINGS" = "no"; then
109         echo "*************************************" > warn
110         have_WARNINGS="yes"
111         if which tput >/dev/null 2>/dev/null && test `tput colors` -ge 8; then
112             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
113             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
114         else
115             COLORWARN="* WARNING :"
116         fi
117     fi
118     echo "$COLORWARN $@" >> warn
121 dnl Some Mac User have the bad habbit of letting a lot fo crap
122 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
123 dnl that confuse the build.
124 dnl For the ones that use LODE, let's be nice and protect them
125 dnl from themselves
127 mac_sanitize_path()
129     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
130 dnl a common but nevertheless necessary thing that may be in a fancy
131 dnl path location is git, so make sure we have it
132     mac_git_path=`which git 2>/dev/null`
133     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
134         mac_path="$mac_path:`dirname $mac_git_path`"
135     fi
136 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
137 dnl path location is gpg, so make sure we find it
138     mac_gpg_path=`which gpg 2>/dev/null`
139     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
140         mac_path="$mac_path:`dirname $mac_gpg_path`"
141     fi
142     PATH="$mac_path"
143     unset mac_path
144     unset mac_git_path
145     unset mac_gpg_path
148 echo "********************************************************************"
149 echo "*"
150 echo "*   Running ${PACKAGE_NAME} build configuration."
151 echo "*"
152 echo "********************************************************************"
153 echo ""
155 dnl ===================================================================
156 dnl checks build and host OSes
157 dnl do this before argument processing to allow for platform dependent defaults
158 dnl ===================================================================
159 AC_CANONICAL_HOST
161 AC_MSG_CHECKING([for product name])
162 PRODUCTNAME="AC_PACKAGE_NAME"
163 if test -n "$with_product_name" -a "$with_product_name" != no; then
164     PRODUCTNAME="$with_product_name"
166 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
167     PRODUCTNAME="${PRODUCTNAME}Dev"
169 AC_MSG_RESULT([$PRODUCTNAME])
170 AC_SUBST(PRODUCTNAME)
171 PRODUCTNAME_WITHOUT_SPACES=${PRODUCTNAME// /}
172 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
174 dnl ===================================================================
175 dnl Our version is defined by the AC_INIT() at the top of this script.
176 dnl ===================================================================
178 AC_MSG_CHECKING([for package version])
179 if test -n "$with_package_version" -a "$with_package_version" != no; then
180     PACKAGE_VERSION="$with_package_version"
182 AC_MSG_RESULT([$PACKAGE_VERSION])
184 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
186 LIBO_VERSION_MAJOR=$1
187 LIBO_VERSION_MINOR=$2
188 LIBO_VERSION_MICRO=$3
189 LIBO_VERSION_PATCH=$4
191 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
192 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
193 # no way to encode that into an integer in general.
194 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
196 LIBO_VERSION_SUFFIX=$5
197 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
198 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
199 # they get undoubled before actually passed to sed.
200 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
201 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
202 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
203 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
205 AC_SUBST(LIBO_VERSION_MAJOR)
206 AC_SUBST(LIBO_VERSION_MINOR)
207 AC_SUBST(LIBO_VERSION_MICRO)
208 AC_SUBST(LIBO_VERSION_PATCH)
209 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
210 AC_SUBST(LIBO_VERSION_SUFFIX)
211 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
213 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
214 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
215 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
216 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
218 LIBO_THIS_YEAR=`date +%Y`
219 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
221 dnl ===================================================================
222 dnl Product version
223 dnl ===================================================================
224 AC_MSG_CHECKING([for product version])
225 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
226 AC_MSG_RESULT([$PRODUCTVERSION])
227 AC_SUBST(PRODUCTVERSION)
229 AC_PROG_EGREP
230 # AC_PROG_EGREP doesn't set GREP on all systems as well
231 AC_PATH_PROG(GREP, grep)
233 BUILDDIR=`pwd`
234 cd $srcdir
235 SRC_ROOT=`pwd`
236 cd $BUILDDIR
237 x_Cygwin=[\#]
239 dnl ======================================
240 dnl Required GObject introspection version
241 dnl ======================================
242 INTROSPECTION_REQUIRED_VERSION=1.32.0
244 dnl ===================================================================
245 dnl Search all the common names for GNU Make
246 dnl ===================================================================
247 AC_MSG_CHECKING([for GNU Make])
249 # try to use our own make if it is available and GNUMAKE was not already defined
250 if test -z "$GNUMAKE"; then
251     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
252         GNUMAKE="$LODE_HOME/opt/bin/make"
253     elif test -x "/opt/lo/bin/make"; then
254         GNUMAKE="/opt/lo/bin/make"
255     fi
258 GNUMAKE_WIN_NATIVE=
259 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
260     if test -n "$a"; then
261         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
262         if test $? -eq 0;  then
263             if test "$build_os" = "cygwin"; then
264                 if test -n "$($a -v | grep 'Built for Windows')" ; then
265                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
266                     GNUMAKE_WIN_NATIVE="TRUE"
267                 else
268                     GNUMAKE=`which $a`
269                 fi
270             else
271                 GNUMAKE=`which $a`
272             fi
273             break
274         fi
275     fi
276 done
277 AC_MSG_RESULT($GNUMAKE)
278 if test -z "$GNUMAKE"; then
279     AC_MSG_ERROR([not found. install GNU Make.])
280 else
281     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
282         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
283     fi
286 win_short_path_for_make()
288     local_short_path="$1"
289     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
290         cygpath -sm "$local_short_path"
291     else
292         cygpath -u "$(cygpath -d "$local_short_path")"
293     fi
297 if test "$build_os" = "cygwin"; then
298     PathFormat "$SRC_ROOT"
299     SRC_ROOT="$formatted_path"
300     PathFormat "$BUILDDIR"
301     BUILDDIR="$formatted_path"
302     x_Cygwin=
303     AC_MSG_CHECKING(for explicit COMSPEC)
304     if test -z "$COMSPEC"; then
305         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
306     else
307         AC_MSG_RESULT([found: $COMSPEC])
308     fi
311 AC_SUBST(SRC_ROOT)
312 AC_SUBST(BUILDDIR)
313 AC_SUBST(x_Cygwin)
314 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
315 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
317 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
318     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
321 # need sed in os checks...
322 AC_PATH_PROGS(SED, sed)
323 if test -z "$SED"; then
324     AC_MSG_ERROR([install sed to run this script])
327 # Set the ENABLE_LTO variable
328 # ===================================================================
329 AC_MSG_CHECKING([whether to use link-time optimization])
330 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
331     ENABLE_LTO="TRUE"
332     AC_MSG_RESULT([yes])
333     AC_DEFINE(STATIC_LINKING)
334 else
335     ENABLE_LTO=""
336     AC_MSG_RESULT([no])
338 AC_SUBST(ENABLE_LTO)
340 AC_ARG_ENABLE(fuzz-options,
341     AS_HELP_STRING([--enable-fuzz-options],
342         [Randomly enable or disable each of those configurable options
343          that are supposed to be freely selectable without interdependencies,
344          or where bad interaction from interdependencies is automatically avoided.])
347 dnl ===================================================================
348 dnl When building for Android, --with-android-ndk,
349 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
350 dnl mandatory
351 dnl ===================================================================
353 AC_ARG_WITH(android-ndk,
354     AS_HELP_STRING([--with-android-ndk],
355         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
358 AC_ARG_WITH(android-ndk-toolchain-version,
359     AS_HELP_STRING([--with-android-ndk-toolchain-version],
360         [Specify which toolchain version to use, of those present in the
361         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
362         with_android_ndk_toolchain_version=clang5.0)
364 AC_ARG_WITH(android-sdk,
365     AS_HELP_STRING([--with-android-sdk],
366         [Specify location of the Android SDK. Mandatory when building for Android.]),
369 ANDROID_NDK_HOME=
370 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
371     with_android_ndk="$SRC_ROOT/external/android-ndk"
373 if test -n "$with_android_ndk"; then
374     ANDROID_NDK_HOME=$with_android_ndk
376     # Set up a lot of pre-canned defaults
378     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
379         if test ! -f $ANDROID_NDK_HOME/source.properties; then
380             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
381         fi
382         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
383     else
384         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
385     fi
386     if test -z "$ANDROID_NDK_VERSION";  then
387         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
388     fi
389     case $ANDROID_NDK_VERSION in
390     r9*|r10*)
391         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 15.x*])
392         ;;
393     11.1.*|12.1.*|13.1.*|14.1.*)
394         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 15.x.*])
395         ;;
396     15.0.*|15.1.*)
397         ;;
398     *)
399         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only version 15.0.* and 15.1.* have been used successfully. Proceed at your own risk.])
400         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only version 15.0.* and 15.1.* have been used successfully. Proceed at your own risk."
401         ;;
402     esac
404     ANDROID_API_LEVEL=14
405     android_cpu=$host_cpu
406     ANDROID_ARCH=$android_cpu
407     if test $host_cpu = arm; then
408         android_platform_prefix=$android_cpu-linux-androideabi
409         android_gnu_prefix=$android_platform_prefix
410         LLVM_TRIPLE=armv7-none-linux-androideabi
411         ANDROID_APP_ABI=armeabi-v7a
412         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
413     elif test $host_cpu = aarch64; then
414         android_platform_prefix=$android_cpu-linux-android
415         android_gnu_prefix=$android_platform_prefix
416         LLVM_TRIPLE=aarch64-none-linux-android
417         # minimum android version that supports aarch64
418         ANDROID_API_LEVEL=21
419         ANDROID_APP_ABI=arm64-v8a
420         ANDROID_ARCH=arm64
421     elif test $host_cpu = mips; then
422         android_platform_prefix=mipsel-linux-android
423         android_gnu_prefix=$android_platform_prefix
424         LLVM_TRIPLE=mipsel-none-linux-android
425         ANDROID_APP_ABI=mips
426     else
427         # host_cpu is something like "i386" or "i686" I guess, NDK uses
428         # "x86" in some contexts
429         android_cpu=x86
430         android_platform_prefix=$android_cpu
431         android_gnu_prefix=i686-linux-android
432         LLVM_TRIPLE=i686-none-linux-android
433         ANDROID_APP_ABI=x86
434         ANDROIDCFLAGS="-march=atom"
435     fi
437     case "$with_android_ndk_toolchain_version" in
438     clang5.0)
439         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
440         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION
441         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm
442         ;;
443     *)
444         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
445     esac
447     if test ! -d $ANDROID_BINUTILS_DIR; then
448         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
449     elif test ! -d $ANDROID_COMPILER_DIR; then
450         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
451     fi
453     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
454     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
455     # manage to link the (app-specific) single huge .so that is built for the app in
456     # android/source/ if there is debug information in a significant part of the object files.
457     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
458     # all objects have been built with debug information.)
459     case $build_os in
460     linux-gnu*)
461         ndk_build_os=linux
462         ;;
463     darwin*)
464         ndk_build_os=darwin
465         ;;
466     *)
467         AC_MSG_ERROR([We only support building for Android from Linux or OS X])
468         ;;
469     esac
470     ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
471     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
473     test -z "$SYSBASE" && SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
474     test -z "$AR" && AR=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ar
475     test -z "$NM" && NM=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-nm
476     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-objdump
477     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ranlib
478     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-strip
480     ANDROIDCFLAGS="$ANDROIDCFLAGS -gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT -target $LLVM_TRIPLE -no-canonical-prefixes"
481     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$SYSBASE -ffunction-sections -fdata-sections -Qunused-arguments"
482     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/$ANDROID_GCC_TOOLCHAIN_VERSION/libs/$ANDROID_APP_ABI"
483     if test "$ENABLE_LTO" = TRUE; then
484         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
485         # $CC and $CXX when building external libraries
486         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
487     fi
489     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/$ANDROID_GCC_TOOLCHAIN_VERSION/include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/$ANDROID_GCC_TOOLCHAIN_VERSION/libs/$ANDROID_APP_ABI/include -I$ANDROID_NDK_HOME/sources/cxx-stl/gabi++/include"
491     if test -z "$CC"; then
492         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
493     fi
494     if test -z "$CXX"; then
495         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
496     fi
498     # remember to download the ownCloud Android library later
499     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
501 AC_SUBST(ANDROID_NDK_HOME)
502 AC_SUBST(ANDROID_APP_ABI)
503 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
505 dnl ===================================================================
506 dnl --with-android-sdk
507 dnl ===================================================================
508 ANDROID_SDK_HOME=
509 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
510     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
512 if test -n "$with_android_sdk"; then
513     ANDROID_SDK_HOME=$with_android_sdk
514     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
516 AC_SUBST(ANDROID_SDK_HOME)
518 dnl ===================================================================
519 dnl The following is a list of supported systems.
520 dnl Sequential to keep the logic very simple
521 dnl These values may be checked and reset later.
522 dnl ===================================================================
523 #defaults unless the os test overrides this:
524 test_randr=yes
525 test_xrender=yes
526 test_cups=yes
527 test_dbus=yes
528 test_fontconfig=yes
529 test_cairo=no
531 # Default values, as such probably valid just for Linux, set
532 # differently below just for Mac OSX,but at least better than
533 # hardcoding these as we used to do. Much of this is duplicated also
534 # in solenv for old build system and for gbuild, ideally we should
535 # perhaps define stuff like this only here in configure.ac?
537 LINKFLAGSSHL="-shared"
538 PICSWITCH="-fpic"
539 DLLPOST=".so"
541 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
543 INSTROOTBASESUFFIX=
544 INSTROOTCONTENTSUFFIX=
545 SDKDIRNAME=sdk
547 case "$host_os" in
549 solaris*)
550     test_gtk=yes
551     build_gstreamer_1_0=yes
552     build_gstreamer_0_10=yes
553     test_freetype=yes
554     _os=SunOS
556     dnl ===========================================================
557     dnl Check whether we're using Solaris 10 - SPARC or Intel.
558     dnl ===========================================================
559     AC_MSG_CHECKING([the Solaris operating system release])
560     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
561     if test "$_os_release" -lt "10"; then
562         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
563     else
564         AC_MSG_RESULT([ok ($_os_release)])
565     fi
567     dnl Check whether we're using a SPARC or i386 processor
568     AC_MSG_CHECKING([the processor type])
569     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
570         AC_MSG_RESULT([ok ($host_cpu)])
571     else
572         AC_MSG_ERROR([only SPARC and i386 processors are supported])
573     fi
574     ;;
576 linux-gnu*|k*bsd*-gnu*)
577     test_gtk=yes
578     build_gstreamer_1_0=yes
579     build_gstreamer_0_10=yes
580     test_kde4=yes
581     test_qt5=yes
582     if test "$enable_fuzzers" != yes; then
583         test_freetype=yes
584         test_fontconfig=yes
585     else
586         test_freetype=no
587         test_fontconfig=no
588         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
589     fi
590     _os=Linux
591     ;;
593 gnu)
594     test_randr=no
595     test_xrender=no
596     _os=GNU
597      ;;
599 cygwin*|interix*)
601     # When building on Windows normally with MSVC under Cygwin,
602     # configure thinks that the host platform (the platform the
603     # built code will run on) is Cygwin, even if it obviously is
604     # Windows, which in Autoconf terminology is called
605     # "mingw32". (Which is misleading as MinGW is the name of the
606     # tool-chain, not an operating system.)
608     # Somewhat confusing, yes. But this configure script doesn't
609     # look at $host etc that much, it mostly uses its own $_os
610     # variable, set here in this case statement.
612     test_cups=no
613     test_dbus=no
614     test_randr=no
615     test_xrender=no
616     test_freetype=no
617     test_fontconfig=no
618     _os=WINNT
620     DLLPOST=".dll"
621     LINKFLAGSNOUNDEFS=
622     ;;
624 darwin*) # Mac OS X or iOS
625     test_gtk=yes
626     test_randr=no
627     test_xrender=no
628     test_freetype=no
629     test_fontconfig=no
630     test_dbus=no
631     if test -n "$LODE_HOME" ; then
632         mac_sanitize_path
633         AC_MSG_NOTICE([sanitized the PATH to $PATH])
634     fi
635     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
636         _os=iOS
637         test_gtk=no
638         test_cups=no
639         enable_mpl_subset=yes
640         enable_lotuswordpro=no
641         enable_coinmp=no
642         enable_lpsolve=no
643         enable_postgresql_sdbc=no
644         enable_extension_integration=no
645         enable_report_builder=no
646         with_theme="tango"
647         with_ppds=no
648         if test "$enable_ios_simulator" = "yes"; then
649             host=x86_64-apple-darwin
650         fi
651     else
652         _os=Darwin
653         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
654         INSTROOTCONTENTSUFFIX=/Contents
655         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
656     fi
657     enable_systray=no
658     # See comment above the case "$host_os"
659     LINKFLAGSSHL="-dynamiclib -single_module"
661     # -fPIC is default
662     PICSWITCH=""
664     DLLPOST=".dylib"
666     # -undefined error is the default
667     LINKFLAGSNOUNDEFS=""
670 freebsd*)
671     test_gtk=yes
672     build_gstreamer_1_0=yes
673     build_gstreamer_0_10=yes
674     test_kde4=yes
675     test_qt5=yes
676     test_freetype=yes
677     AC_MSG_CHECKING([the FreeBSD operating system release])
678     if test -n "$with_os_version"; then
679         OSVERSION="$with_os_version"
680     else
681         OSVERSION=`/sbin/sysctl -n kern.osreldate`
682     fi
683     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
684     AC_MSG_CHECKING([which thread library to use])
685     if test "$OSVERSION" -lt "500016"; then
686         PTHREAD_CFLAGS="-D_THREAD_SAFE"
687         PTHREAD_LIBS="-pthread"
688     elif test "$OSVERSION" -lt "502102"; then
689         PTHREAD_CFLAGS="-D_THREAD_SAFE"
690         PTHREAD_LIBS="-lc_r"
691     else
692         PTHREAD_CFLAGS=""
693         PTHREAD_LIBS="-pthread"
694     fi
695     AC_MSG_RESULT([$PTHREAD_LIBS])
696     _os=FreeBSD
697     ;;
699 *netbsd*)
700     test_gtk=yes
701     build_gstreamer_1_0=yes
702     build_gstreamer_0_10=yes
703     test_kde4=yes
704     test_qt5=yes
705     test_freetype=yes
706     PTHREAD_LIBS="-pthread -lpthread"
707     _os=NetBSD
708     ;;
710 aix*)
711     test_randr=no
712     test_freetype=yes
713     PTHREAD_LIBS=-pthread
714     _os=AIX
715     ;;
717 openbsd*)
718     test_gtk=yes
719     test_freetype=yes
720     PTHREAD_CFLAGS="-D_THREAD_SAFE"
721     PTHREAD_LIBS="-pthread"
722     _os=OpenBSD
723     ;;
725 dragonfly*)
726     test_gtk=yes
727     build_gstreamer_1_0=yes
728     build_gstreamer_0_10=yes
729     test_kde4=yes
730     test_qt5=yes
731     test_freetype=yes
732     PTHREAD_LIBS="-pthread"
733     _os=DragonFly
734     ;;
736 linux-android*)
737     build_gstreamer_1_0=no
738     build_gstreamer_0_10=no
739     enable_lotuswordpro=no
740     enable_mpl_subset=yes
741     enable_coinmp=yes
742     enable_lpsolve=no
743     enable_report_builder=no
744     enable_odk=no
745     enable_postgresql_sdbc=no
746     enable_python=no
747     with_theme="tango"
748     test_cups=no
749     test_dbus=no
750     test_fontconfig=no
751     test_freetype=no
752     test_gtk=no
753     test_kde4=no
754     test_qt5=no
755     test_randr=no
756     test_xrender=no
757     _os=Android
759     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
760     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
761     ;;
764     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
765     ;;
766 esac
768 if test "$_os" = "Android" ; then
769     # Verify that the NDK and SDK options are proper
770     if test -z "$with_android_ndk"; then
771         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
772     elif test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
773         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
774     fi
776     if test -z "$ANDROID_SDK_HOME"; then
777         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
778     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
779         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
780     fi
782     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
783     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
784         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
785                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
786                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
787         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
788         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
789         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
790     fi
791     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
792         AC_MSG_WARN([android support repository not found - install with
793                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
794                      to allow the build to download the specified version of the android support libraries])
795         add_warning "android support repository not found - install with"
796         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
797         add_warning "to allow the build to download the specified version of the android support libraries"
798     fi
801 if test "$_os" = "AIX"; then
802     AC_PATH_PROG(GAWK, gawk)
803     if test -z "$GAWK"; then
804         AC_MSG_ERROR([gawk not found in \$PATH])
805     fi
808 AC_SUBST(SDKDIRNAME)
810 AC_SUBST(PTHREAD_CFLAGS)
811 AC_SUBST(PTHREAD_LIBS)
813 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
814 # By default use the ones specified by our build system,
815 # but explicit override is possible.
816 AC_MSG_CHECKING(for explicit AFLAGS)
817 if test -n "$AFLAGS"; then
818     AC_MSG_RESULT([$AFLAGS])
819     x_AFLAGS=
820 else
821     AC_MSG_RESULT(no)
822     x_AFLAGS=[\#]
824 AC_MSG_CHECKING(for explicit CFLAGS)
825 if test -n "$CFLAGS"; then
826     AC_MSG_RESULT([$CFLAGS])
827     x_CFLAGS=
828 else
829     AC_MSG_RESULT(no)
830     x_CFLAGS=[\#]
832 AC_MSG_CHECKING(for explicit CXXFLAGS)
833 if test -n "$CXXFLAGS"; then
834     AC_MSG_RESULT([$CXXFLAGS])
835     x_CXXFLAGS=
836 else
837     AC_MSG_RESULT(no)
838     x_CXXFLAGS=[\#]
840 AC_MSG_CHECKING(for explicit OBJCFLAGS)
841 if test -n "$OBJCFLAGS"; then
842     AC_MSG_RESULT([$OBJCFLAGS])
843     x_OBJCFLAGS=
844 else
845     AC_MSG_RESULT(no)
846     x_OBJCFLAGS=[\#]
848 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
849 if test -n "$OBJCXXFLAGS"; then
850     AC_MSG_RESULT([$OBJCXXFLAGS])
851     x_OBJCXXFLAGS=
852 else
853     AC_MSG_RESULT(no)
854     x_OBJCXXFLAGS=[\#]
856 AC_MSG_CHECKING(for explicit LDFLAGS)
857 if test -n "$LDFLAGS"; then
858     AC_MSG_RESULT([$LDFLAGS])
859     x_LDFLAGS=
860 else
861     AC_MSG_RESULT(no)
862     x_LDFLAGS=[\#]
864 AC_SUBST(AFLAGS)
865 AC_SUBST(CFLAGS)
866 AC_SUBST(CXXFLAGS)
867 AC_SUBST(OBJCFLAGS)
868 AC_SUBST(OBJCXXFLAGS)
869 AC_SUBST(LDFLAGS)
870 AC_SUBST(x_AFLAGS)
871 AC_SUBST(x_CFLAGS)
872 AC_SUBST(x_CXXFLAGS)
873 AC_SUBST(x_OBJCFLAGS)
874 AC_SUBST(x_OBJCXXFLAGS)
875 AC_SUBST(x_LDFLAGS)
877 dnl These are potentially set for MSVC, in the code checking for UCRT below:
878 my_original_CFLAGS=$CFLAGS
879 my_original_CXXFLAGS=$CXXFLAGS
880 my_original_CPPFLAGS=$CPPFLAGS
882 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
883 dnl Needs to precede the AC_SEARCH_LIBS call below, which apparently calls
884 dnl AC_PROG_CC internally.
885 if test "$_os" != "WINNT"; then
886     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
887     save_CFLAGS=$CFLAGS
888     AC_PROG_CC
889     CFLAGS=$save_CFLAGS
892 if test $_os != "WINNT"; then
893     save_LIBS="$LIBS"
894     AC_SEARCH_LIBS([dlsym], [dl],
895         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
896         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
897     LIBS="$save_LIBS"
899 AC_SUBST(DLOPEN_LIBS)
901 ###############################################################################
902 # Extensions switches --enable/--disable
903 ###############################################################################
904 # By default these should be enabled unless having extra dependencies.
905 # If there is extra dependency over configure options then the enable should
906 # be automagic based on whether the requiring feature is enabled or not.
907 # All this options change anything only with --enable-extension-integration.
909 # The name of this option and its help string makes it sound as if
910 # extensions are built anyway, just not integrated in the installer,
911 # if you use --disable-extension-integration. Is that really the
912 # case?
914 AC_ARG_ENABLE(ios-simulator,
915     AS_HELP_STRING([--enable-ios-simulator],
916         [build i386 or x86_64 for ios simulator])
919 libo_FUZZ_ARG_ENABLE(extension-integration,
920     AS_HELP_STRING([--disable-extension-integration],
921         [Disable integration of the built extensions in the installer of the
922          product. Use this switch to disable the integration.])
925 AC_ARG_ENABLE(avmedia,
926     AS_HELP_STRING([--disable-avmedia],
927         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
930 AC_ARG_ENABLE(database-connectivity,
931     AS_HELP_STRING([--disable-database-connectivity],
932         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
935 # This doesn't mean not building (or "integrating") extensions
936 # (although it probably should; i.e. it should imply
937 # --disable-extension-integration I guess), it means not supporting
938 # any extension mechanism at all
939 libo_FUZZ_ARG_ENABLE(extensions,
940     AS_HELP_STRING([--disable-extensions],
941         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
944 AC_ARG_ENABLE(scripting,
945     AS_HELP_STRING([--disable-scripting],
946         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
949 # This is mainly for Android and iOS, but could potentially be used in some
950 # special case otherwise, too, so factored out as a separate setting
952 AC_ARG_ENABLE(dynamic-loading,
953     AS_HELP_STRING([--disable-dynamic-loading],
954         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
957 libo_FUZZ_ARG_ENABLE(ext-mariadb-connector,
958     AS_HELP_STRING([--enable-ext-mariadb-connector],
959         [Enable the build of the MariaDB/MySQL Connector extension.])
962 libo_FUZZ_ARG_ENABLE(report-builder,
963     AS_HELP_STRING([--disable-report-builder],
964         [Disable the Report Builder.])
967 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
968     AS_HELP_STRING([--enable-ext-wiki-publisher],
969         [Enable the Wiki Publisher extension.])
972 libo_FUZZ_ARG_ENABLE(lpsolve,
973     AS_HELP_STRING([--disable-lpsolve],
974         [Disable compilation of the lp solve solver ])
976 libo_FUZZ_ARG_ENABLE(coinmp,
977     AS_HELP_STRING([--disable-coinmp],
978         [Disable compilation of the CoinMP solver ])
981 libo_FUZZ_ARG_ENABLE(pdfimport,
982     AS_HELP_STRING([--disable-pdfimport],
983         [Disable building the PDF import feature.])
986 libo_FUZZ_ARG_ENABLE(pdfium,
987     AS_HELP_STRING([--disable-pdfium],
988         [Disable building PDFium.])
991 ###############################################################################
993 dnl ---------- *** ----------
995 libo_FUZZ_ARG_ENABLE(mergelibs,
996     AS_HELP_STRING([--enable-mergelibs],
997         [Merge several of the smaller libraries into one big, "merged", one.])
1000 libo_FUZZ_ARG_ENABLE(breakpad,
1001     AS_HELP_STRING([--enable-breakpad],
1002         [Enables breakpad for crash reporting.])
1005 AC_ARG_ENABLE(fetch-external,
1006     AS_HELP_STRING([--disable-fetch-external],
1007         [Disables fetching external tarballs from web sources.])
1010 AC_ARG_ENABLE(fuzzers,
1011     AS_HELP_STRING([--enable-fuzzers],
1012         [Enables building libfuzzer targets for fuzz testing.])
1015 libo_FUZZ_ARG_ENABLE(pch,
1016     AS_HELP_STRING([--enable-pch],
1017         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1020 libo_FUZZ_ARG_ENABLE(epm,
1021     AS_HELP_STRING([--enable-epm],
1022         [LibreOffice includes self-packaging code, that requires epm, however epm is
1023          useless for large scale package building.])
1026 libo_FUZZ_ARG_ENABLE(odk,
1027     AS_HELP_STRING([--disable-odk],
1028         [LibreOffice includes an ODK, office development kit which some packagers may
1029          wish to build without.])
1032 AC_ARG_ENABLE(mpl-subset,
1033     AS_HELP_STRING([--enable-mpl-subset],
1034         [Don't compile any pieces which are not MPL or more liberally licensed])
1037 libo_FUZZ_ARG_ENABLE(evolution2,
1038     AS_HELP_STRING([--enable-evolution2],
1039         [Allows the built-in evolution 2 addressbook connectivity build to be
1040          enabled.])
1043 AC_ARG_ENABLE(avahi,
1044     AS_HELP_STRING([--enable-avahi],
1045         [Determines whether to use Avahi to advertise Impress to remote controls.])
1048 libo_FUZZ_ARG_ENABLE(werror,
1049     AS_HELP_STRING([--enable-werror],
1050         [Turn warnings to errors. (Has no effect in modules where the treating
1051          of warnings as errors is disabled explicitly.)]),
1054 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1055     AS_HELP_STRING([--enable-assert-always-abort],
1056         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1059 libo_FUZZ_ARG_ENABLE(dbgutil,
1060     AS_HELP_STRING([--enable-dbgutil],
1061         [Provide debugging support from --enable-debug and include additional debugging
1062          utilities such as object counting or more expensive checks.
1063          This is the recommended option for developers.
1064          Note that this makes the build ABI incompatible, it is not possible to mix object
1065          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1067 libo_FUZZ_ARG_ENABLE(debug,
1068     AS_HELP_STRING([--enable-debug],
1069         [Include debugging information, disable compiler optimization and inlining plus
1070          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1072 libo_FUZZ_ARG_ENABLE(sal-log,
1073     AS_HELP_STRING([--enable-sal-log],
1074         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1076 AC_ARG_ENABLE(selective-debuginfo,
1077     AS_HELP_STRING([--enable-selective-debuginfo],
1078         [If --enable-debug or --enable-dbgutil is used, build debugging information
1079          (-g compiler flag) only for the specified gbuild build targets
1080          (where all means everything, - prepended means not to enable, / appended means
1081          everything in the directory; there is no ordering, more specific overrides
1082          more general, and disabling takes precedence).
1083          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1085 libo_FUZZ_ARG_ENABLE(symbols,
1086     AS_HELP_STRING([--enable-symbols],
1087         [Generate debug information.
1088          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1089          otherwise.]))
1091 libo_FUZZ_ARG_ENABLE(optimized,
1092     AS_HELP_STRING([--disable-optimized],
1093         [Whether to compile with optimization flags.
1094          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1095          otherwise.]))
1097 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1098     AS_HELP_STRING([--disable-runtime-optimizations],
1099         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1100          JVM JIT) that are known to interact badly with certain dynamic analysis
1101          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1102          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1103          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1105 AC_ARG_WITH(valgrind,
1106     AS_HELP_STRING([--with-valgrind],
1107         [Make availability of Valgrind headers a hard requirement.]))
1109 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1110     AS_HELP_STRING([--enable-compiler-plugins],
1111         [Enable compiler plugins that will perform additional checks during
1112          building. Enabled automatically by --enable-dbgutil.
1113          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1114 COMPILER_PLUGINS_DEBUG=
1115 if test "$enable_compiler_plugins" = debug; then
1116     enable_compiler_plugins=yes
1117     COMPILER_PLUGINS_DEBUG=TRUE
1120 libo_FUZZ_ARG_ENABLE(ooenv,
1121     AS_HELP_STRING([--disable-ooenv],
1122         [Disable ooenv for the instdir installation.]))
1124 AC_ARG_ENABLE(lto,
1125     AS_HELP_STRING([--enable-lto],
1126         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1127          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1128          linker. For MSVC, this option is broken at the moment. This is experimental work
1129          in progress that shouldn't be used unless you are working on it.)]))
1131 AC_ARG_ENABLE(python,
1132     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1133         [Enables or disables Python support at run-time and build-time.
1134          Also specifies what Python to use. 'auto' is the default.
1135          'fully-internal' even forces the internal version for uses of Python
1136          during the build.]))
1138 libo_FUZZ_ARG_ENABLE(gtk,
1139     AS_HELP_STRING([--disable-gtk],
1140         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1141 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1143 libo_FUZZ_ARG_ENABLE(gtk3,
1144     AS_HELP_STRING([--disable-gtk3],
1145         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1146 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1148 libo_FUZZ_ARG_ENABLE(systray,
1149     AS_HELP_STRING([--disable-systray],
1150         [Determines whether to build the systray quickstarter.]),
1151 ,test "${enable_systray+set}" = set || enable_systray=yes)
1153 AC_ARG_ENABLE(split-app-modules,
1154     AS_HELP_STRING([--enable-split-app-modules],
1155         [Split file lists for app modules, e.g. base, calc.
1156          Has effect only with make distro-pack-install]),
1159 AC_ARG_ENABLE(split-opt-features,
1160     AS_HELP_STRING([--enable-split-opt-features],
1161         [Split file lists for some optional features, e.g. pyuno, testtool.
1162          Has effect only with make distro-pack-install]),
1165 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1166     AS_HELP_STRING([--disable-cairo-canvas],
1167         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1170 libo_FUZZ_ARG_ENABLE(dbus,
1171     AS_HELP_STRING([--disable-dbus],
1172         [Determines whether to enable features that depend on dbus.
1173          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1174 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1176 libo_FUZZ_ARG_ENABLE(sdremote,
1177     AS_HELP_STRING([--disable-sdremote],
1178         [Determines whether to enable Impress remote control (i.e. the server component).]),
1179 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1181 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1182     AS_HELP_STRING([--disable-sdremote-bluetooth],
1183         [Determines whether to build sdremote with bluetooth support.
1184          Requires dbus on Linux.]))
1186 libo_FUZZ_ARG_ENABLE(gio,
1187     AS_HELP_STRING([--disable-gio],
1188         [Determines whether to use the GIO support.]),
1189 ,test "${enable_gio+set}" = set || enable_gio=yes)
1191 AC_ARG_ENABLE(kde4,
1192     AS_HELP_STRING([--enable-kde4],
1193         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1194          KDE4 are available.]),
1197 AC_ARG_ENABLE(qt5,
1198     AS_HELP_STRING([--enable-qt5],
1199         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1200          available.]),
1203 libo_FUZZ_ARG_ENABLE(gui,
1204     AS_HELP_STRING([--disable-gui],
1205         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1206          command-line option. Not related to LibreOffice Online functionality. Don't use
1207          unless you are certain you need to. Nobody will help you if you insist on trying
1208          this and run into problems.]),
1209 ,test "${enable_gui+set}" = set || enable_gui=yes)
1211 libo_FUZZ_ARG_ENABLE(randr,
1212     AS_HELP_STRING([--disable-randr],
1213         [Disable RandR support in the vcl project.]),
1214 ,test "${enable_randr+set}" = set || enable_randr=yes)
1216 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1217     AS_HELP_STRING([--disable-gstreamer-1-0],
1218         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1219 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1221 AC_ARG_ENABLE(gstreamer-0-10,
1222     AS_HELP_STRING([--enable-gstreamer-0-10],
1223         [Enable building with the gstreamer 0.10 avmedia backend.]),
1224 ,enable_gstreamer_0_10=no)
1226 libo_FUZZ_ARG_ENABLE(vlc,
1227     AS_HELP_STRING([--enable-vlc],
1228         [Enable building with the (experimental) VLC avmedia backend.]),
1229 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1231 libo_FUZZ_ARG_ENABLE(neon,
1232     AS_HELP_STRING([--disable-neon],
1233         [Disable neon and the compilation of webdav binding.]),
1236 libo_FUZZ_ARG_ENABLE([eot],
1237     [AS_HELP_STRING([--enable-eot],
1238         [Enable support for Embedded OpenType fonts.])],
1239 ,test "${enable_eot+set}" = set || enable_eot=no)
1241 libo_FUZZ_ARG_ENABLE(cve-tests,
1242     AS_HELP_STRING([--disable-cve-tests],
1243         [Prevent CVE tests to be executed]),
1246 libo_FUZZ_ARG_ENABLE(chart-tests,
1247     AS_HELP_STRING([--enable-chart-tests],
1248         [Executes chart XShape tests. In a perfect world these tests would be
1249          stable and everyone could run them, in reality it is best to run them
1250          only on a few machines that are known to work and maintained by people
1251          who can judge if a test failure is a regression or not.]),
1254 AC_ARG_ENABLE(build-unowinreg,
1255     AS_HELP_STRING([--enable-build-unowinreg],
1256         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1257          compiler is needed on Linux.]),
1260 AC_ARG_ENABLE(dependency-tracking,
1261     AS_HELP_STRING([--enable-dependency-tracking],
1262         [Do not reject slow dependency extractors.])[
1263   --disable-dependency-tracking
1264                           Disables generation of dependency information.
1265                           Speed up one-time builds.],
1268 AC_ARG_ENABLE(icecream,
1269     AS_HELP_STRING([--enable-icecream],
1270         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1271          It defaults to /opt/icecream for the location of the icecream gcc/g++
1272          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1275 libo_FUZZ_ARG_ENABLE(cups,
1276     AS_HELP_STRING([--disable-cups],
1277         [Do not build cups support.])
1280 AC_ARG_ENABLE(ccache,
1281     AS_HELP_STRING([--disable-ccache],
1282         [Do not try to use ccache automatically.
1283          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1284          CC/CXX are not yet set, and --enable-icecream is not given, we
1285          attempt to use ccache. --disable-ccache disables ccache completely.
1289 AC_ARG_ENABLE(64-bit,
1290     AS_HELP_STRING([--enable-64-bit],
1291         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1292          At the moment meaningful only for Windows.]), ,)
1294 libo_FUZZ_ARG_ENABLE(online-update,
1295     AS_HELP_STRING([--enable-online-update],
1296         [Enable the online update service that will check for new versions of
1297          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1298          If the value is "mar", the experimental Mozilla-like update will be
1299          enabled instead of the traditional update mechanism.]),
1302 AC_ARG_WITH(update-config,
1303     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1304                    [Path to the update config ini file]))
1306 libo_FUZZ_ARG_ENABLE(extension-update,
1307     AS_HELP_STRING([--disable-extension-update],
1308         [Disable possibility to update installed extensions.]),
1311 libo_FUZZ_ARG_ENABLE(release-build,
1312     AS_HELP_STRING([--enable-release-build],
1313         [Enable release build. Note that the "release build" choice is orthogonal to
1314          whether symbols are present, debug info is generated, or optimization
1315          is done.
1316          See http://wiki.documentfoundation.org/Development/DevBuild]),
1319 AC_ARG_ENABLE(windows-build-signing,
1320     AS_HELP_STRING([--enable-windows-build-signing],
1321         [Enable signing of windows binaries (*.exe, *.dll)]),
1324 AC_ARG_ENABLE(silent-msi,
1325     AS_HELP_STRING([--enable-silent-msi],
1326         [Enable MSI with LIMITUI=1 (silent install).]),
1329 AC_ARG_ENABLE(macosx-code-signing,
1330     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1331         [Sign executables, dylibs, frameworks and the app bundle. If you
1332          don't provide an identity the first suitable certificate
1333          in your keychain is used.]),
1336 AC_ARG_ENABLE(macosx-package-signing,
1337     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1338         [Create a .pkg suitable for uploading to the Mac App Store and sign
1339          it. If you don't provide an identity the first suitable certificate
1340          in your keychain is used.]),
1343 AC_ARG_ENABLE(macosx-sandbox,
1344     AS_HELP_STRING([--enable-macosx-sandbox],
1345         [Make the app bundle run in a sandbox. Requires code signing.
1346          Is required by apps distributed in the Mac App Store, and implies
1347          adherence to App Store rules.]),
1350 AC_ARG_WITH(macosx-bundle-identifier,
1351     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1352         [Define the OS X bundle identifier. Default is the somewhat weird
1353          org.libreoffice.script ("script", huh?).]),
1354 ,with_macosx_bundle_identifier=org.libreoffice.script)
1356 AC_ARG_WITH(product-name,
1357     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1358         [Define the product name. Default is AC_PACKAGE_NAME.]),
1359 ,with_product_name=$PRODUCTNAME)
1361 AC_ARG_WITH(package-version,
1362     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1363         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1366 libo_FUZZ_ARG_ENABLE(readonly-installset,
1367     AS_HELP_STRING([--enable-readonly-installset],
1368         [Prevents any attempts by LibreOffice to write into its installation. That means
1369          at least that no "system-wide" extensions can be added. Experimental work in
1370          progress.]),
1373 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1374     AS_HELP_STRING([--disable-postgresql-sdbc],
1375         [Disable the build of the PostgreSQL-SDBC driver.])
1378 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1379     AS_HELP_STRING([--disable-lotuswordpro],
1380         [Disable the build of the Lotus Word Pro filter.]),
1381 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1383 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1384     AS_HELP_STRING([--disable-firebird-sdbc],
1385         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1386 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1388 AC_ARG_ENABLE(bogus-pkg-config,
1389     AS_HELP_STRING([--enable-bogus-pkg-config],
1390         [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.]),
1393 AC_ARG_ENABLE(openssl,
1394     AS_HELP_STRING([--disable-openssl],
1395         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1396          components will either use GNUTLS or NSS. Work in progress,
1397          use only if you are hacking on it.]),
1398 ,enable_openssl=yes)
1400 AC_ARG_ENABLE(library-bin-tar,
1401     AS_HELP_STRING([--enable-library-bin-tar],
1402         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1403         Some libraries can save their build result in a tarball
1404         stored in TARFILE_LOCATION. That binary tarball is
1405         uniquely identified by the source tarball,
1406         the content of the config_host.mk file and the content
1407         of the top-level directory in core for that library
1408         If this option is enabled, then if such a tarfile exist, it will be untarred
1409         instead of the source tarfile, and the build step will be skipped for that
1410         library.
1411         If a proper tarfile does not exist, then the normal source-based
1412         build is done for that library and a proper binary tarfile is created
1413         for the next time.]),
1416 AC_ARG_ENABLE(dconf,
1417     AS_HELP_STRING([--disable-dconf],
1418         [Disable the dconf configuration backend (enabled by default where
1419          available).]))
1421 libo_FUZZ_ARG_ENABLE(formula-logger,
1422     AS_HELP_STRING(
1423         [--enable-formula-logger],
1424         [Enable formula logger for logging formula calculation flow in Calc.]
1425     )
1428 dnl ===================================================================
1429 dnl Optional Packages (--with/without-)
1430 dnl ===================================================================
1432 AC_ARG_WITH(gcc-home,
1433     AS_HELP_STRING([--with-gcc-home],
1434         [Specify the location of gcc/g++ manually. This can be used in conjunction
1435          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1436          non-default path.]),
1439 AC_ARG_WITH(gnu-patch,
1440     AS_HELP_STRING([--with-gnu-patch],
1441         [Specify location of GNU patch on Solaris or FreeBSD.]),
1444 AC_ARG_WITH(build-platform-configure-options,
1445     AS_HELP_STRING([--with-build-platform-configure-options],
1446         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1449 AC_ARG_WITH(gnu-cp,
1450     AS_HELP_STRING([--with-gnu-cp],
1451         [Specify location of GNU cp on Solaris or FreeBSD.]),
1454 AC_ARG_WITH(external-tar,
1455     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1456         [Specify an absolute path of where to find (and store) tarfiles.]),
1457     TARFILE_LOCATION=$withval ,
1460 AC_ARG_WITH(referenced-git,
1461     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1462         [Specify another checkout directory to reference. This makes use of
1463                  git submodule update --reference, and saves a lot of diskspace
1464                  when having multiple trees side-by-side.]),
1465     GIT_REFERENCE_SRC=$withval ,
1468 AC_ARG_WITH(linked-git,
1469     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1470         [Specify a directory where the repositories of submodules are located.
1471          This uses a method similar to git-new-workdir to get submodules.]),
1472     GIT_LINK_SRC=$withval ,
1475 AC_ARG_WITH(galleries,
1476     AS_HELP_STRING([--with-galleries],
1477         [Specify how galleries should be built. It is possible either to
1478          build these internally from source ("build"),
1479          or to disable them ("no")]),
1482 AC_ARG_WITH(theme,
1483     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1484         [Choose which themes to include. By default those themes with an '*' are included.
1485          Possible choices: *breeze, *breeze_dark, crystal, *elementary, *galaxy, *hicontrast, oxygen, *sifr, *sifr_dark, *tango, tango_testing.]),
1488 libo_FUZZ_ARG_WITH(helppack-integration,
1489     AS_HELP_STRING([--without-helppack-integration],
1490         [It will not integrate the helppacks to the installer
1491          of the product. Please use this switch to use the online help
1492          or separate help packages.]),
1495 libo_FUZZ_ARG_WITH(fonts,
1496     AS_HELP_STRING([--without-fonts],
1497         [LibreOffice includes some third-party fonts to provide a reliable basis for
1498          help content, templates, samples, etc. When these fonts are already
1499          known to be available on the system then you should use this option.]),
1502 AC_ARG_WITH(epm,
1503     AS_HELP_STRING([--with-epm],
1504         [Decides which epm to use. Default is to use the one from the system if
1505          one is built. When either this is not there or you say =internal epm
1506          will be built.]),
1509 AC_ARG_WITH(package-format,
1510     AS_HELP_STRING([--with-package-format],
1511         [Specify package format(s) for LibreOffice installation sets. The
1512          implicit --without-package-format leads to no installation sets being
1513          generated. Possible values: aix, archive, bsd, deb, dmg,
1514          installed, msi, pkg, and rpm.
1515          Example: --with-package-format='deb rpm']),
1518 AC_ARG_WITH(tls,
1519     AS_HELP_STRING([--with-tls],
1520         [Decides which TLS/SSL and cryptographic implementations to use for
1521          LibreOffice's code. Notice that this doesn't apply for depending
1522          libraries like "neon", for example. Default is to use OpenSSL
1523          although NSS is also possible. Notice that selecting NSS restricts
1524          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1525          restrict by now the usage of NSS in LO's code. Possible values:
1526          openssl, nss. Example: --with-tls="nss"]),
1529 AC_ARG_WITH(system-libs,
1530     AS_HELP_STRING([--with-system-libs],
1531         [Use libraries already on system -- enables all --with-system-* flags.]),
1534 AC_ARG_WITH(system-bzip2,
1535     AS_HELP_STRING([--with-system-bzip2],
1536         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1537     [with_system_bzip2="$with_system_libs"])
1539 AC_ARG_WITH(system-headers,
1540     AS_HELP_STRING([--with-system-headers],
1541         [Use headers already on system -- enables all --with-system-* flags for
1542          external packages whose headers are the only entities used i.e.
1543          boost/odbc/sane-header(s).]),,
1544     [with_system_headers="$with_system_libs"])
1546 AC_ARG_WITH(system-jars,
1547     AS_HELP_STRING([--without-system-jars],
1548         [When building with --with-system-libs, also the needed jars are expected
1549          on the system. Use this to disable that]),,
1550     [with_system_jars="$with_system_libs"])
1552 AC_ARG_WITH(system-cairo,
1553     AS_HELP_STRING([--with-system-cairo],
1554         [Use cairo libraries already on system.  Happens automatically for
1555          (implicit) --enable-gtk and for --enable-gtk3.]))
1557 AC_ARG_WITH(system-epoxy,
1558     AS_HELP_STRING([--with-system-epoxy],
1559         [Use epoxy libraries already on system.  Happens automatically for
1560          --enable-gtk3.]),,
1561        [with_system_epoxy="$with_system_libs"])
1563 AC_ARG_WITH(myspell-dicts,
1564     AS_HELP_STRING([--with-myspell-dicts],
1565         [Adds myspell dictionaries to the LibreOffice installation set]),
1568 AC_ARG_WITH(system-dicts,
1569     AS_HELP_STRING([--without-system-dicts],
1570         [Do not use dictionaries from system paths.]),
1573 AC_ARG_WITH(external-dict-dir,
1574     AS_HELP_STRING([--with-external-dict-dir],
1575         [Specify external dictionary dir.]),
1578 AC_ARG_WITH(external-hyph-dir,
1579     AS_HELP_STRING([--with-external-hyph-dir],
1580         [Specify external hyphenation pattern dir.]),
1583 AC_ARG_WITH(external-thes-dir,
1584     AS_HELP_STRING([--with-external-thes-dir],
1585         [Specify external thesaurus dir.]),
1588 AC_ARG_WITH(system-zlib,
1589     AS_HELP_STRING([--with-system-zlib],
1590         [Use zlib already on system.]),,
1591     [with_system_zlib=auto])
1593 AC_ARG_WITH(system-jpeg,
1594     AS_HELP_STRING([--with-system-jpeg],
1595         [Use jpeg already on system.]),,
1596     [with_system_jpeg="$with_system_libs"])
1598 AC_ARG_WITH(system-clucene,
1599     AS_HELP_STRING([--with-system-clucene],
1600         [Use clucene already on system.]),,
1601     [with_system_clucene="$with_system_libs"])
1603 AC_ARG_WITH(system-expat,
1604     AS_HELP_STRING([--with-system-expat],
1605         [Use expat already on system.]),,
1606     [with_system_expat="$with_system_libs"])
1608 AC_ARG_WITH(system-libxml,
1609     AS_HELP_STRING([--with-system-libxml],
1610         [Use libxml/libxslt already on system.]),,
1611     [with_system_libxml=auto])
1613 AC_ARG_WITH(system-icu,
1614     AS_HELP_STRING([--with-system-icu],
1615         [Use icu already on system.]),,
1616     [with_system_icu="$with_system_libs"])
1618 AC_ARG_WITH(system-ucpp,
1619     AS_HELP_STRING([--with-system-ucpp],
1620         [Use ucpp already on system.]),,
1621     [])
1623 AC_ARG_WITH(system-openldap,
1624     AS_HELP_STRING([--with-system-openldap],
1625         [Use the OpenLDAP LDAP SDK already on system.]),,
1626     [with_system_openldap="$with_system_libs"])
1628 AC_ARG_WITH(system-poppler,
1629     AS_HELP_STRING([--with-system-poppler],
1630         [Use system poppler (only needed for PDF import).]),,
1631     [with_system_poppler="$with_system_libs"])
1633 AC_ARG_WITH(system-gpgmepp,
1634     AS_HELP_STRING([--with-system-gpgmepp],
1635         [Use gpgmepp already on system]),,
1636     [with_system_gpgmepp="$with_system_libs"])
1638 AC_ARG_WITH(system-apache-commons,
1639     AS_HELP_STRING([--with-system-apache-commons],
1640         [Use Apache commons libraries already on system.]),,
1641     [with_system_apache_commons="$with_system_jars"])
1643 AC_ARG_WITH(system-mariadb,
1644     AS_HELP_STRING([--with-system-mariadb],
1645         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1646          extension.]),,
1647     [with_system_mariadb="$with_system_libs"])
1649 AC_ARG_ENABLE(bundle-mariadb,
1650     AS_HELP_STRING([--enable-bundle-mariadb],
1651         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1654 AC_ARG_WITH(system-mysql-cppconn,
1655     AS_HELP_STRING([--with-system-mysql-cppconn],
1656         [Use MySQL C++ Connector libraries already on system.]),,
1657     [with_system_mysql_cppconn="$with_system_libs"])
1659 AC_ARG_WITH(system-postgresql,
1660     AS_HELP_STRING([--with-system-postgresql],
1661         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1662          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1663     [with_system_postgresql="$with_system_libs"])
1665 AC_ARG_WITH(libpq-path,
1666     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1667         [Use this PostgreSQL C interface (libpq) installation for building
1668          the PostgreSQL-SDBC extension.]),
1671 AC_ARG_WITH(system-firebird,
1672     AS_HELP_STRING([--with-system-firebird],
1673         [Use Firebird libraries already on system, for building the Firebird-SDBC
1674          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1675     [with_system_firebird="$with_system_libs"])
1677 AC_ARG_WITH(system-libtommath,
1678             AS_HELP_STRING([--with-system-libtommath],
1679                            [Use libtommath already on system]),,
1680             [with_system_libtommath="$with_system_libs"])
1682 AC_ARG_WITH(system-hsqldb,
1683     AS_HELP_STRING([--with-system-hsqldb],
1684         [Use hsqldb already on system.]))
1686 AC_ARG_WITH(hsqldb-jar,
1687     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1688         [Specify path to jarfile manually.]),
1689     HSQLDB_JAR=$withval)
1691 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1692     AS_HELP_STRING([--disable-scripting-beanshell],
1693         [Disable support for scripts in BeanShell.]),
1697 AC_ARG_WITH(system-beanshell,
1698     AS_HELP_STRING([--with-system-beanshell],
1699         [Use beanshell already on system.]),,
1700     [with_system_beanshell="$with_system_jars"])
1702 AC_ARG_WITH(beanshell-jar,
1703     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1704         [Specify path to jarfile manually.]),
1705     BSH_JAR=$withval)
1707 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1708     AS_HELP_STRING([--disable-scripting-javascript],
1709         [Disable support for scripts in JavaScript.]),
1713 AC_ARG_WITH(system-rhino,
1714     AS_HELP_STRING([--with-system-rhino],
1715         [Use rhino already on system.]),,)
1716 #    [with_system_rhino="$with_system_jars"])
1717 # Above is not used as we have different debug interface
1718 # patched into internal rhino. This code needs to be fixed
1719 # before we can enable it by default.
1721 AC_ARG_WITH(rhino-jar,
1722     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1723         [Specify path to jarfile manually.]),
1724     RHINO_JAR=$withval)
1726 AC_ARG_WITH(commons-logging-jar,
1727     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1728         [Specify path to jarfile manually.]),
1729     COMMONS_LOGGING_JAR=$withval)
1731 AC_ARG_WITH(system-jfreereport,
1732     AS_HELP_STRING([--with-system-jfreereport],
1733         [Use JFreeReport already on system.]),,
1734     [with_system_jfreereport="$with_system_jars"])
1736 AC_ARG_WITH(sac-jar,
1737     AS_HELP_STRING([--with-sac-jar=JARFILE],
1738         [Specify path to jarfile manually.]),
1739     SAC_JAR=$withval)
1741 AC_ARG_WITH(libxml-jar,
1742     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1743         [Specify path to jarfile manually.]),
1744     LIBXML_JAR=$withval)
1746 AC_ARG_WITH(flute-jar,
1747     AS_HELP_STRING([--with-flute-jar=JARFILE],
1748         [Specify path to jarfile manually.]),
1749     FLUTE_JAR=$withval)
1751 AC_ARG_WITH(jfreereport-jar,
1752     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1753         [Specify path to jarfile manually.]),
1754     JFREEREPORT_JAR=$withval)
1756 AC_ARG_WITH(liblayout-jar,
1757     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1758         [Specify path to jarfile manually.]),
1759     LIBLAYOUT_JAR=$withval)
1761 AC_ARG_WITH(libloader-jar,
1762     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1763         [Specify path to jarfile manually.]),
1764     LIBLOADER_JAR=$withval)
1766 AC_ARG_WITH(libformula-jar,
1767     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1768         [Specify path to jarfile manually.]),
1769     LIBFORMULA_JAR=$withval)
1771 AC_ARG_WITH(librepository-jar,
1772     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1773         [Specify path to jarfile manually.]),
1774     LIBREPOSITORY_JAR=$withval)
1776 AC_ARG_WITH(libfonts-jar,
1777     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1778         [Specify path to jarfile manually.]),
1779     LIBFONTS_JAR=$withval)
1781 AC_ARG_WITH(libserializer-jar,
1782     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1783         [Specify path to jarfile manually.]),
1784     LIBSERIALIZER_JAR=$withval)
1786 AC_ARG_WITH(libbase-jar,
1787     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1788         [Specify path to jarfile manually.]),
1789     LIBBASE_JAR=$withval)
1791 AC_ARG_WITH(system-odbc,
1792     AS_HELP_STRING([--with-system-odbc],
1793         [Use the odbc headers already on system.]),,
1794     [with_system_odbc="auto"])
1796 AC_ARG_WITH(system-sane,
1797     AS_HELP_STRING([--with-system-sane],
1798         [Use sane.h already on system.]),,
1799     [with_system_sane="$with_system_headers"])
1801 AC_ARG_WITH(system-bluez,
1802     AS_HELP_STRING([--with-system-bluez],
1803         [Use bluetooth.h already on system.]),,
1804     [with_system_bluez="$with_system_headers"])
1806 AC_ARG_WITH(system-curl,
1807     AS_HELP_STRING([--with-system-curl],
1808         [Use curl already on system.]),,
1809     [with_system_curl=auto])
1811 AC_ARG_WITH(system-boost,
1812     AS_HELP_STRING([--with-system-boost],
1813         [Use boost already on system.]),,
1814     [with_system_boost="$with_system_headers"])
1816 AC_ARG_WITH(system-glm,
1817     AS_HELP_STRING([--with-system-glm],
1818         [Use glm already on system.]),,
1819     [with_system_glm="$with_system_headers"])
1821 AC_ARG_WITH(system-hunspell,
1822     AS_HELP_STRING([--with-system-hunspell],
1823         [Use libhunspell already on system.]),,
1824     [with_system_hunspell="$with_system_libs"])
1826 AC_ARG_WITH(system-mythes,
1827     AS_HELP_STRING([--with-system-mythes],
1828         [Use mythes already on system.]),,
1829     [with_system_mythes="$with_system_libs"])
1831 AC_ARG_WITH(system-altlinuxhyph,
1832     AS_HELP_STRING([--with-system-altlinuxhyph],
1833         [Use ALTLinuxhyph already on system.]),,
1834     [with_system_altlinuxhyph="$with_system_libs"])
1836 AC_ARG_WITH(system-lpsolve,
1837     AS_HELP_STRING([--with-system-lpsolve],
1838         [Use lpsolve already on system.]),,
1839     [with_system_lpsolve="$with_system_libs"])
1841 AC_ARG_WITH(system-coinmp,
1842     AS_HELP_STRING([--with-system-coinmp],
1843         [Use CoinMP already on system.]),,
1844     [with_system_coinmp="$with_system_libs"])
1846 AC_ARG_WITH(system-liblangtag,
1847     AS_HELP_STRING([--with-system-liblangtag],
1848         [Use liblangtag library already on system.]),,
1849     [with_system_liblangtag="$with_system_libs"])
1851 AC_ARG_WITH(webdav,
1852     AS_HELP_STRING([--with-webdav],
1853         [Specify which library to use for webdav implementation.
1854          Possible values: "neon", "serf", "no". The default value is "neon".
1855          Example: --with-webdav="serf"]),
1856     WITH_WEBDAV=$withval,
1857     WITH_WEBDAV="neon")
1859 AC_ARG_WITH(linker-hash-style,
1860     AS_HELP_STRING([--with-linker-hash-style],
1861         [Use linker with --hash-style=<style> when linking shared objects.
1862          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1863          if supported on the build system, and "sysv" otherwise.]))
1865 AC_ARG_WITH(jdk-home,
1866     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1867         [If you have installed JDK 1.6 or later on your system please supply the
1868          path here. Note that this is not the location of the java command but the
1869          location of the entire distribution.]),
1872 AC_ARG_WITH(help,
1873     AS_HELP_STRING([--with-help],
1874         [Enable the build of help. There is a special parameter "common" that
1875          can be used to bundle only the common part, .e.g help-specific icons.
1876          This is useful when you build the helpcontent separately.])
1877     [
1878                           Usage:     --with-help    build the old local help
1879                                  --without-help     no local help (default)
1880                                  --with-help=html   build the new HTML local help
1881                                  --with-help=online build the new HTML online help
1882                                  --with-help=common bundle common files for the local
1883                                                     help but do not build the whole help
1884     ],
1887 libo_FUZZ_ARG_WITH(java,
1888     AS_HELP_STRING([--with-java=<java command>],
1889         [Specify the name of the Java interpreter command. Typically "java"
1890          which is the default.
1892          To build without support for Java components, applets, accessibility
1893          or the XML filters written in Java, use --without-java or --with-java=no.]),
1894     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1895     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
1898 AC_ARG_WITH(jvm-path,
1899     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
1900         [Use a specific JVM search path at runtime.
1901          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
1904 AC_ARG_WITH(ant-home,
1905     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
1906         [If you have installed Jakarta Ant on your system, please supply the path here.
1907          Note that this is not the location of the Ant binary but the location
1908          of the entire distribution.]),
1911 AC_ARG_WITH(symbol-config,
1912     AS_HELP_STRING([--with-symbol-config],
1913         [Configuration for the crashreport symbol upload]),
1914         [],
1915         [with_symbol_config=no])
1917 AC_ARG_WITH(export-validation,
1918     AS_HELP_STRING([--without-export-validation],
1919         [Disable validating OOXML and ODF files as exported from in-tree tests.
1920          Use this option e.g. if your system only provides Java 5.]),
1921 ,with_export_validation=auto)
1923 AC_ARG_WITH(bffvalidator,
1924     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
1925         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
1926          Requires installed Microsoft Office Binary File Format Validator.
1927          Note: export-validation (--with-export-validation) is required to be turned on.
1928          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
1929 ,with_bffvalidator=no)
1931 libo_FUZZ_ARG_WITH(junit,
1932     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
1933         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
1934          --without-junit disables those tests. Not relevant in the --without-java case.]),
1935 ,with_junit=yes)
1937 AC_ARG_WITH(hamcrest,
1938     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
1939         [Specifies the hamcrest jar file to use for JUnit-based tests.
1940          --without-junit disables those tests. Not relevant in the --without-java case.]),
1941 ,with_hamcrest=yes)
1943 AC_ARG_WITH(perl-home,
1944     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
1945         [If you have installed Perl 5 Distribution, on your system, please
1946          supply the path here. Note that this is not the location of the Perl
1947          binary but the location of the entire distribution.]),
1950 libo_FUZZ_ARG_WITH(doxygen,
1951     AS_HELP_STRING(
1952         [--with-doxygen=<absolute path to doxygen executable>],
1953         [Specifies the doxygen executable to use when generating ODK C/C++
1954          documentation. --without-doxygen disables generation of ODK C/C++
1955          documentation. Not relevant in the --disable-odk case.]),
1956 ,with_doxygen=yes)
1958 AC_ARG_WITH(visual-studio,
1959     AS_HELP_STRING([--with-visual-studio=<2015/2017>],
1960         [Specify which Visual Studio version to use in case several are
1961          installed. If not specified, defaults to 2015.]),
1964 AC_ARG_WITH(windows-sdk,
1965     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
1966         [Specify which Windows SDK, or "Windows Kit", version to use
1967          in case the one that came with the selected Visual Studio
1968          is not what you want for some reason. Note that not all compiler/SDK
1969          combinations are supported. The intent is that this option should not
1970          be needed.]),
1973 AC_ARG_WITH(lang,
1974     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
1975         [Use this option to build LibreOffice with additional UI language support.
1976          English (US) is always included by default.
1977          Separate multiple languages with space.
1978          For all languages, use --with-lang=ALL.]),
1981 AC_ARG_WITH(locales,
1982     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
1983         [Use this option to limit the locale information built in.
1984          Separate multiple locales with space.
1985          Very experimental and might well break stuff.
1986          Just a desperate measure to shrink code and data size.
1987          By default all the locales available is included.
1988          This option is completely unrelated to --with-lang.])
1989     [
1990                           Affects also our character encoding conversion
1991                           tables for encodings mainly targeted for a
1992                           particular locale, like EUC-CN and EUC-TW for
1993                           zh, ISO-2022-JP for ja.
1995                           Affects also our add-on break iterator data for
1996                           some languages.
1998                           For the default, all locales, don't use this switch at all.
1999                           Specifying just the language part of a locale means all matching
2000                           locales will be included.
2001     ],
2004 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2005 libo_FUZZ_ARG_WITH(krb5,
2006     AS_HELP_STRING([--with-krb5],
2007         [Enable MIT Kerberos 5 support in modules that support it.
2008          By default automatically enabled on platforms
2009          where a good system Kerberos 5 is available.]),
2012 libo_FUZZ_ARG_WITH(gssapi,
2013     AS_HELP_STRING([--with-gssapi],
2014         [Enable GSSAPI support in modules that support it.
2015          By default automatically enabled on platforms
2016          where a good system GSSAPI is available.]),
2019 AC_ARG_WITH(iwyu,
2020     AS_HELP_STRING([--with-iwyu],
2021         [Use given IWYU binary path to check unneeded includes instead of building.
2022          Use only if you are hacking on it.]),
2025 dnl ===================================================================
2026 dnl Branding
2027 dnl ===================================================================
2029 AC_ARG_WITH(branding,
2030     AS_HELP_STRING([--with-branding=/path/to/images],
2031         [Use given path to retrieve branding images set.])
2032     [
2033                           Search for intro.png about.svg and flat_logo.svg.
2034                           If any is missing, default ones will be used instead.
2036                           Search also progress.conf for progress
2037                           settings on intro screen :
2039                           PROGRESSBARCOLOR="255,255,255" Set color of
2040                           progress bar. Comma separated RGB decimal values.
2041                           PROGRESSSIZE="407,6" Set size of progress bar.
2042                           Comma separated decimal values (width, height).
2043                           PROGRESSPOSITION="61,317" Set position of progress
2044                           bar from left,top. Comma separated decimal values.
2045                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2046                           bar frame. Comma separated RGB decimal values.
2047                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2048                           bar text. Comma separated RGB decimal values.
2049                           PROGRESSTEXTBASELINE="287" Set vertical position of
2050                           progress bar text from top. Decimal value.
2052                           Default values will be used if not found.
2053     ],
2057 AC_ARG_WITH(extra-buildid,
2058     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2059         [Show addition build identification in about dialog.]),
2063 AC_ARG_WITH(vendor,
2064     AS_HELP_STRING([--with-vendor="John the Builder"],
2065         [Set vendor of the build.]),
2068 AC_ARG_WITH(android-package-name,
2069     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2070         [Set Android package name of the build.]),
2073 AC_ARG_WITH(compat-oowrappers,
2074     AS_HELP_STRING([--with-compat-oowrappers],
2075         [Install oo* wrappers in parallel with
2076          lo* ones to keep backward compatibility.
2077          Has effect only with make distro-pack-install]),
2080 AC_ARG_WITH(os-version,
2081     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2082         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2085 AC_ARG_WITH(mingw-cross-compiler,
2086     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2087         [Specify the MinGW cross-compiler to use.
2088          When building on the ODK on Unix and building unowinreg.dll,
2089          specify the MinGW C++ cross-compiler.]),
2092 AC_ARG_WITH(idlc-cpp,
2093     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2094         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2097 AC_ARG_WITH(build-version,
2098     AS_HELP_STRING([--with-build-version="Built by Jim"],
2099         [Allows the builder to add a custom version tag that will appear in the
2100          Help/About box for QA purposes.]),
2101 with_build_version=$withval,
2104 AC_ARG_WITH(alloc,
2105     AS_HELP_STRING([--with-alloc],
2106         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
2107          Note that on FreeBSD/NetBSD system==jemalloc]),
2110 AC_ARG_WITH(parallelism,
2111     AS_HELP_STRING([--with-parallelism],
2112         [Number of jobs to run simultaneously during build. Parallel builds can
2113         save a lot of time on multi-cpu machines. Defaults to the number of
2114         CPUs on the machine, unless you configure --enable-icecream - then to
2115         10.]),
2118 AC_ARG_WITH(all-tarballs,
2119     AS_HELP_STRING([--with-all-tarballs],
2120         [Download all external tarballs unconditionally]))
2122 AC_ARG_WITH(gdrive-client-id,
2123     AS_HELP_STRING([--with-gdrive-client-id],
2124         [Provides the client id of the application for OAuth2 authentication
2125         on Google Drive. If either this or --with-gdrive-client-secret is
2126         empty, the feature will be disabled]),
2129 AC_ARG_WITH(gdrive-client-secret,
2130     AS_HELP_STRING([--with-gdrive-client-secret],
2131         [Provides the client secret of the application for OAuth2
2132         authentication on Google Drive. If either this or
2133         --with-gdrive-client-id is empty, the feature will be disabled]),
2136 AC_ARG_WITH(alfresco-cloud-client-id,
2137     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2138         [Provides the client id of the application for OAuth2 authentication
2139         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2140         empty, the feature will be disabled]),
2143 AC_ARG_WITH(alfresco-cloud-client-secret,
2144     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2145         [Provides the client secret of the application for OAuth2
2146         authentication on Alfresco Cloud. If either this or
2147         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2150 AC_ARG_WITH(onedrive-client-id,
2151     AS_HELP_STRING([--with-onedrive-client-id],
2152         [Provides the client id of the application for OAuth2 authentication
2153         on OneDrive. If either this or --with-onedrive-client-secret is
2154         empty, the feature will be disabled]),
2157 AC_ARG_WITH(onedrive-client-secret,
2158     AS_HELP_STRING([--with-onedrive-client-secret],
2159         [Provides the client secret of the application for OAuth2
2160         authentication on OneDrive. If either this or
2161         --with-onedrive-client-id is empty, the feature will be disabled]),
2163 dnl ===================================================================
2164 dnl Do we want to use pre-build binary tarball for recompile
2165 dnl ===================================================================
2167 if test "$enable_library_bin_tar" = "yes" ; then
2168     USE_LIBRARY_BIN_TAR=TRUE
2169 else
2170     USE_LIBRARY_BIN_TAR=
2172 AC_SUBST(USE_LIBRARY_BIN_TAR)
2174 dnl ===================================================================
2175 dnl Test whether build target is Release Build
2176 dnl ===================================================================
2177 AC_MSG_CHECKING([whether build target is Release Build])
2178 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2179     AC_MSG_RESULT([no])
2180     ENABLE_RELEASE_BUILD=
2181 else
2182     AC_MSG_RESULT([yes])
2183     ENABLE_RELEASE_BUILD=TRUE
2185 AC_SUBST(ENABLE_RELEASE_BUILD)
2187 dnl ===================================================================
2188 dnl Test whether to sign Windows Build
2189 dnl ===================================================================
2190 AC_MSG_CHECKING([whether to sign windows build])
2191 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2192     AC_MSG_RESULT([yes])
2193     WINDOWS_BUILD_SIGNING="TRUE"
2194 else
2195     AC_MSG_RESULT([no])
2196     WINDOWS_BUILD_SIGNING="FALSE"
2198 AC_SUBST(WINDOWS_BUILD_SIGNING)
2200 dnl ===================================================================
2201 dnl MacOSX build and runtime environment options
2202 dnl ===================================================================
2204 AC_ARG_WITH(macosx-sdk,
2205     AS_HELP_STRING([--with-macosx-sdk=<version>],
2206         [Prefer a specific SDK for building.])
2207     [
2208                           If the requested SDK is not available, a search for the oldest one will be done.
2209                           With current Xcode versions, only the latest SDK is included, so this option is
2210                           not terribly useful. It works fine to build with a new SDK and run the result
2211                           on an older OS.
2213                           e. g.: --with-macosx-sdk=10.9
2215                           there are 3 options to control the MacOSX build:
2216                           --with-macosx-sdk (referred as 'sdk' below)
2217                           --with-macosx-version-min-required (referred as 'min' below)
2218                           --with-macosx-version-max-allowed (referred as 'max' below)
2220                           the connection between these value and the default they take is as follow:
2221                           ( ? means not specified on the command line, s means the SDK version found,
2222                           constraint: 8 <= x <= y <= z)
2224                           ==========================================
2225                            command line      || config result
2226                           ==========================================
2227                           min  | max  | sdk  || min  | max  | sdk  |
2228                           ?    | ?    | ?    || 10.9 | 10.s | 10.s |
2229                           ?    | ?    | 10.x || 10.9 | 10.x | 10.x |
2230                           ?    | 10.x | ?    || 10.9 | 10.s | 10.s |
2231                           ?    | 10.x | 10.y || 10.9 | 10.x | 10.y |
2232                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2233                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2234                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2235                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2238                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2239                           for a detailed technical explanation of these variables
2241                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2242     ],
2245 AC_ARG_WITH(macosx-version-min-required,
2246     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2247         [set the minimum OS version needed to run the built LibreOffice])
2248     [
2249                           e. g.: --with-macos-version-min-required=10.9
2250                           see --with-macosx-sdk for more info
2251     ],
2254 AC_ARG_WITH(macosx-version-max-allowed,
2255     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2256         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2257     [
2258                           e. g.: --with-macos-version-max-allowed=10.9
2259                           see --with-macosx-sdk for more info
2260     ],
2264 dnl ===================================================================
2265 dnl options for stuff used during cross-compilation build
2266 dnl Not quite superseded by --with-build-platform-configure-options.
2267 dnl TODO: check, if the "force" option is still needed anywhere.
2268 dnl ===================================================================
2270 AC_ARG_WITH(system-icu-for-build,
2271     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2272         [Use icu already on system for build tools (cross-compilation only).]))
2275 dnl ===================================================================
2276 dnl Check for incompatible options set by fuzzing, and reset those
2277 dnl automatically to working combinations
2278 dnl ===================================================================
2280 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2281         "$enable_dbus" != "$enable_avahi"; then
2282     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2283     enable_avahi=$enable_dbus
2286 dnl ===================================================================
2287 dnl check for required programs (grep, awk, sed, bash)
2288 dnl ===================================================================
2290 pathmunge ()
2292     if test -n "$1"; then
2293         if test "$build_os" = "cygwin"; then
2294             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2295                 PathFormat "$1"
2296                 new_path=`cygpath -sm "$formatted_path"`
2297             else
2298                 PathFormat "$1"
2299                 new_path=`cygpath -u "$formatted_path"`
2300             fi
2301         else
2302             new_path="$1"
2303         fi
2304         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2305             if test "$2" = "after"; then
2306                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2307             else
2308                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2309             fi
2310         fi
2311         unset new_path
2312     fi
2315 AC_PROG_AWK
2316 AC_PATH_PROG( AWK, $AWK)
2317 if test -z "$AWK"; then
2318     AC_MSG_ERROR([install awk to run this script])
2321 AC_PATH_PROG(BASH, bash)
2322 if test -z "$BASH"; then
2323     AC_MSG_ERROR([bash not found in \$PATH])
2325 AC_SUBST(BASH)
2327 AC_MSG_CHECKING([for GNU or BSD tar])
2328 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2329     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2330     if test $? -eq 0;  then
2331         GNUTAR=$a
2332         break
2333     fi
2334 done
2335 AC_MSG_RESULT($GNUTAR)
2336 if test -z "$GNUTAR"; then
2337     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2339 AC_SUBST(GNUTAR)
2341 AC_MSG_CHECKING([for tar's option to strip components])
2342 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2343 if test $? -eq 0; then
2344     STRIP_COMPONENTS="--strip-components"
2345 else
2346     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2347     if test $? -eq 0; then
2348         STRIP_COMPONENTS="--strip-path"
2349     else
2350         STRIP_COMPONENTS="unsupported"
2351     fi
2353 AC_MSG_RESULT($STRIP_COMPONENTS)
2354 if test x$STRIP_COMPONENTS = xunsupported; then
2355     AC_MSG_ERROR([you need a tar that is able to strip components.])
2357 AC_SUBST(STRIP_COMPONENTS)
2359 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2360 dnl desktop OSes from "mobile" ones.
2362 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2363 dnl In other words, that when building for an OS that is not a
2364 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2366 dnl Note the direction of the implication; there is no assumption that
2367 dnl cross-compiling would imply a non-desktop OS.
2369 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2370     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2371     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2372     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2375 # Whether to build "avmedia" functionality or not.
2377 if test -z "$enable_avmedia"; then
2378     enable_avmedia=yes
2381 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2382 if test "$enable_avmedia" = yes; then
2383     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2384 else
2385     USE_AVMEDIA_DUMMY='TRUE'
2387 AC_SUBST(USE_AVMEDIA_DUMMY)
2389 # Decide whether to build database connectivity stuff (including
2390 # Base) or not. We probably don't want to on non-desktop OSes.
2391 if test -z "$enable_database_connectivity"; then
2392     # --disable-database-connectivity is unfinished work in progress
2393     # and the iOS test app doesn't link if we actually try to use it.
2394     # if test $_os != iOS -a $_os != Android; then
2395     if test $_os != iOS; then
2396         enable_database_connectivity=yes
2397     fi
2400 if test "$enable_database_connectivity" = yes; then
2401     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2402     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2405 if test -z "$enable_extensions"; then
2406     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2407     if test $_os != iOS -a $_os != Android; then
2408         enable_extensions=yes
2409     fi
2412 if test "$enable_extensions" = yes; then
2413     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2414     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2417 if test -z "$enable_scripting"; then
2418     # Disable scripting for iOS unless specifically overridden
2419     # with --enable-scripting.
2420     if test $_os != iOS; then
2421         enable_scripting=yes
2422     fi
2425 DISABLE_SCRIPTING=''
2426 if test "$enable_scripting" = yes; then
2427     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2428     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2429 else
2430     DISABLE_SCRIPTING='TRUE'
2431     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2434 if test $_os = iOS -o $_os = Android; then
2435     # Disable dynamic_loading always for iOS and Android
2436     enable_dynamic_loading=no
2437 elif test -z "$enable_dynamic_loading"; then
2438     # Otherwise enable it unless speficically disabled
2439     enable_dynamic_loading=yes
2442 DISABLE_DYNLOADING=''
2443 if test "$enable_dynamic_loading" = yes; then
2444     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2445 else
2446     DISABLE_DYNLOADING='TRUE'
2448 AC_SUBST(DISABLE_DYNLOADING)
2450 # remenber SYSBASE value
2451 AC_SUBST(SYSBASE)
2453 dnl ===================================================================
2454 dnl  Sort out various gallery compilation options
2455 dnl ===================================================================
2456 AC_MSG_CHECKING([how to build and package galleries])
2457 if test -n "${with_galleries}"; then
2458     if test "$with_galleries" = "build"; then
2459         WITH_GALLERY_BUILD=TRUE
2460         AC_MSG_RESULT([build from source images internally])
2461     elif test "$with_galleries" = "no"; then
2462         WITH_GALLERY_BUILD=
2463         AC_MSG_RESULT([disable non-internal gallery build])
2464     else
2465         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2466     fi
2467 else
2468     if test $_os != iOS -a $_os != Android; then
2469         WITH_GALLERY_BUILD=TRUE
2470         AC_MSG_RESULT([internal src images for desktop])
2471     else
2472         WITH_GALLERY_BUILD=
2473         AC_MSG_RESULT([disable src image build])
2474     fi
2476 AC_SUBST(WITH_GALLERY_BUILD)
2478 dnl ===================================================================
2479 dnl  Checks if ccache is available
2480 dnl ===================================================================
2481 if test "$_os" = "WINNT"; then
2482     # on windows/VC build do not use ccache
2483     CCACHE=""
2484 elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2485     case "%$CC%$CXX%" in
2486     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2487     # assume that's good then
2488     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2489         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2490         ;;
2491     *)
2492         AC_PATH_PROG([CCACHE],[ccache],[not found])
2493         if test "$CCACHE" = "not found"; then
2494             CCACHE=""
2495         else
2496             # Need to check for ccache version: otherwise prevents
2497             # caching of the results (like "-x objective-c++" for Mac)
2498             if test $_os = Darwin -o $_os = iOS; then
2499                 # Check ccache version
2500                 AC_MSG_CHECKING([whether version of ccache is suitable])
2501                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2502                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2503                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2504                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2505                 else
2506                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2507                     CCACHE=""
2508                 fi
2509             fi
2510         fi
2511         ;;
2512     esac
2513 else
2514     CCACHE=""
2517 if test "$CCACHE" != ""; then
2518     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2519     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2520     if test "$ccache_size" = ""; then
2521         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2522         if test "$ccache_size" = ""; then
2523             ccache_size=0
2524         fi
2525         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2526         if test $ccache_size -lt 1024; then
2527             CCACHE=""
2528             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2529             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2530         else
2531             # warn that ccache may be too small for debug build
2532             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2533             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2534         fi
2535     else
2536         if test $ccache_size -lt 5; then
2537             #warn that ccache may be too small for debug build
2538             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2539             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2540         fi
2541     fi
2544 dnl ===================================================================
2545 dnl  Checks for C compiler,
2546 dnl  The check for the C++ compiler is later on.
2547 dnl ===================================================================
2548 if test "$_os" != "WINNT"; then
2549     GCC_HOME_SET="true"
2550     AC_MSG_CHECKING([gcc home])
2551     if test -z "$with_gcc_home"; then
2552         if test "$enable_icecream" = "yes"; then
2553             if test -d "/usr/lib/icecc/bin"; then
2554                 GCC_HOME="/usr/lib/icecc/"
2555             else
2556                 GCC_HOME="/opt/icecream/"
2557             fi
2558         else
2559             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2560             GCC_HOME_SET="false"
2561         fi
2562     else
2563         GCC_HOME="$with_gcc_home"
2564     fi
2565     AC_MSG_RESULT($GCC_HOME)
2566     AC_SUBST(GCC_HOME)
2568     if test "$GCC_HOME_SET" = "true"; then
2569         if test -z "$CC"; then
2570             CC="$GCC_HOME/bin/gcc"
2571         fi
2572         if test -z "$CXX"; then
2573             CXX="$GCC_HOME/bin/g++"
2574         fi
2575     fi
2578 COMPATH=`dirname "$CC"`
2579 if test "$COMPATH" = "."; then
2580     AC_PATH_PROGS(COMPATH, $CC)
2581     dnl double square bracket to get single because of M4 quote...
2582     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2584 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2586 dnl ===================================================================
2587 dnl Java support
2588 dnl ===================================================================
2589 AC_MSG_CHECKING([whether to build with Java support])
2590 if test "$with_java" != "no"; then
2591     if test "$DISABLE_SCRIPTING" = TRUE; then
2592         AC_MSG_RESULT([no, overridden by --disable-scripting])
2593         ENABLE_JAVA=""
2594         with_java=no
2595     else
2596         AC_MSG_RESULT([yes])
2597         ENABLE_JAVA="TRUE"
2598         AC_DEFINE(HAVE_FEATURE_JAVA)
2599     fi
2600 else
2601     AC_MSG_RESULT([no])
2602     ENABLE_JAVA=""
2605 AC_SUBST(ENABLE_JAVA)
2607 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2609 dnl ENABLE_JAVA="" indicate no Java support at all
2611 dnl ===================================================================
2612 dnl Check OS X SDK and compiler
2613 dnl ===================================================================
2615 if test $_os = Darwin -o $_os = iOS; then
2617     # If no --with-macosx-sdk option is given, look for one
2619     # The intent is that for "most" Mac-based developers, a suitable
2620     # SDK will be found automatically without any configure options.
2622     # For developers with a current Xcode, the lowest-numbered SDK
2623     # higher than or equal to the minimum required should be found.
2625     AC_MSG_CHECKING([what Mac OS X SDK to use])
2626     for _macosx_sdk in $with_macosx_sdk 10.13 10.12; do
2627         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2628         if test -d "$MACOSX_SDK_PATH"; then
2629             with_macosx_sdk="${_macosx_sdk}"
2630             break
2631         else
2632             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2633             if test -d "$MACOSX_SDK_PATH"; then
2634                 with_macosx_sdk="${_macosx_sdk}"
2635                 break
2636             fi
2637         fi
2638     done
2639     if test ! -d "$MACOSX_SDK_PATH"; then
2640         AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2641     fi
2643     if test $_os = iOS; then
2644         if test "$enable_ios_simulator" = "yes"; then
2645             useos=iphonesimulator
2646         else
2647             useos=iphoneos
2648         fi
2649         MACOSX_SDK_PATH=`xcrun --sdk ${useos} --show-sdk-path 2> /dev/null`
2650     fi
2651     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2654     case $with_macosx_sdk in
2655     10.9)
2656         MACOSX_SDK_VERSION=1090
2657         ;;
2658     10.10)
2659         MACOSX_SDK_VERSION=101000
2660         ;;
2661     10.11)
2662         MACOSX_SDK_VERSION=101100
2663         ;;
2664     10.12)
2665         MACOSX_SDK_VERSION=101200
2666         ;;
2667     10.13)
2668         MACOSX_SDK_VERSION=101300
2669         ;;
2670     *)
2671         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.9--13])
2672         ;;
2673     esac
2675     if test "$with_macosx_version_min_required" = "" ; then
2676         with_macosx_version_min_required="10.9";
2677     fi
2679     if test "$with_macosx_version_max_allowed" = "" ; then
2680         with_macosx_version_max_allowed="$with_macosx_sdk"
2681     fi
2683     # export this so that "xcrun" invocations later return matching values
2684     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2685     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2686     export DEVELOPER_DIR
2687     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2688     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2690     case "$with_macosx_version_min_required" in
2691     10.9)
2692         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2693         ;;
2694     10.10)
2695         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2696         ;;
2697     10.11)
2698         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2699         ;;
2700     10.12)
2701         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2702         ;;
2703     10.13)
2704         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2705         ;;
2706     *)
2707         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.9--13])
2708         ;;
2709     esac
2710     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2712     LIBTOOL=/usr/bin/libtool
2713     INSTALL_NAME_TOOL=install_name_tool
2714     if test -z "$save_CC"; then
2715         AC_MSG_CHECKING([what compiler to use])
2716         stdlib=-stdlib=libc++
2717         if test "$ENABLE_LTO" = TRUE; then
2718             lto=-flto
2719         fi
2720         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2721         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2722         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2723         AR=`xcrun -find ar`
2724         NM=`xcrun -find nm`
2725         STRIP=`xcrun -find strip`
2726         LIBTOOL=`xcrun -find libtool`
2727         RANLIB=`xcrun -find ranlib`
2728         AC_MSG_RESULT([$CC and $CXX])
2729     fi
2731     case "$with_macosx_version_max_allowed" in
2732     10.9)
2733         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2734         ;;
2735     10.10)
2736         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2737         ;;
2738     10.11)
2739         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2740         ;;
2741     10.12)
2742         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2743         ;;
2744     10.13)
2745         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2746         ;;
2747     *)
2748         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.9--13])
2749         ;;
2750     esac
2752     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2753     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2754         AC_MSG_RESULT([$MAC_OS_X_VERSION_MIN_REQUIRED])
2755         AC_MSG_RESULT([$MAC_OS_X_VERSION_MAX_REQUIRED])
2756         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2757     else
2758         AC_MSG_RESULT([ok])
2759     fi
2761     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2762     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2763         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2764     else
2765         AC_MSG_RESULT([ok])
2766     fi
2767     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2768     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2770     AC_MSG_CHECKING([whether to do code signing])
2772     if test "$enable_macosx_code_signing" = yes; then
2773         # By default use the first suitable certificate (?).
2775         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2776         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2777         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2778         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2779         # "Developer ID Application" one.
2781         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2782         if test -n "$identity"; then
2783             MACOSX_CODESIGNING_IDENTITY=$identity
2784             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2785             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2786         else
2787             AC_MSG_ERROR([cannot determine identity to use])
2788         fi
2789     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2790         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2791         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2792         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2793     else
2794         AC_MSG_RESULT([no])
2795     fi
2797     AC_MSG_CHECKING([whether to create a Mac App Store package])
2799     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2800         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2801     elif test "$enable_macosx_package_signing" = yes; then
2802         # By default use the first suitable certificate.
2803         # It should be a "3rd Party Mac Developer Installer" one
2805         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2806         if test -n "$identity"; then
2807             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2808             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2809             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2810         else
2811             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2812         fi
2813     elif test -n "$enable_macosx_package_signing"; then
2814         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2815         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2816         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2817     else
2818         AC_MSG_RESULT([no])
2819     fi
2821     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2822         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2823     fi
2825     AC_MSG_CHECKING([whether to sandbox the application])
2827     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2828         AC_MSG_ERROR([OS X sandboxing requires code signing])
2829     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2830         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2831     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2832         ENABLE_MACOSX_SANDBOX=TRUE
2833         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2834         AC_MSG_RESULT([yes])
2835     else
2836         AC_MSG_RESULT([no])
2837     fi
2839     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2840     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2841     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2843 AC_SUBST(MACOSX_SDK_PATH)
2844 AC_SUBST(MACOSX_SDK_VERSION)
2845 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2846 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2847 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
2848 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2849 AC_SUBST(INSTALL_NAME_TOOL)
2850 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2851 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2852 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2853 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2854 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2856 dnl ===================================================================
2857 dnl Check iOS SDK and compiler
2858 dnl ===================================================================
2860 if test $_os = iOS; then
2861     AC_MSG_CHECKING([what iOS SDK to use])
2862     current_sdk_ver=11.1
2863     if test "$enable_ios_simulator" = "yes"; then
2864         platform=iPhoneSimulator
2865         versionmin=-mios-simulator-version-min=$current_sdk_ver
2866     else
2867         platform=iPhoneOS
2868         versionmin=-miphoneos-version-min=$current_sdk_ver
2869     fi
2870     xcode_developer=`xcode-select -print-path`
2872     for sdkver in $current_sdk_ver; do
2873         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2874         if test -d $t; then
2875             ios_sdk=$sdkver
2876             sysroot=$t
2877             break
2878         fi
2879     done
2881     if test -z "$sysroot"; then
2882         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
2883     fi
2885     AC_MSG_RESULT($sysroot)
2887     IOS_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
2888     IOS_DEPLOYMENT_VERSION=$current_sdk_ver
2890     # LTO is not really recommended for iOS builds,
2891     # the link time will be astronomical
2892     if test "$ENABLE_LTO" = TRUE; then
2893         lto=-flto
2894     fi
2896     stdlib="-stdlib=libc++"
2898     CC="`xcrun -find clang` -arch $host_cpu -isysroot $sysroot $lto $versionmin"
2899     CXX="`xcrun -find clang++` -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
2901     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2902     AR=`xcrun -find ar`
2903     NM=`xcrun -find nm`
2904     STRIP=`xcrun -find strip`
2905     LIBTOOL=`xcrun -find libtool`
2906     RANLIB=`xcrun -find ranlib`
2909 AC_SUBST(IOS_SDK)
2910 AC_SUBST(IOS_DEPLOYMENT_VERSION)
2912 AC_MSG_CHECKING([whether to treat the installation as read-only])
2914 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
2915         "$enable_extensions" != yes; then
2916     enable_readonly_installset=yes
2918 if test "$enable_readonly_installset" = yes; then
2919     AC_MSG_RESULT([yes])
2920     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
2921 else
2922     AC_MSG_RESULT([no])
2925 dnl ===================================================================
2926 dnl Structure of install set
2927 dnl ===================================================================
2929 if test $_os = Darwin; then
2930     LIBO_BIN_FOLDER=MacOS
2931     LIBO_ETC_FOLDER=Resources
2932     LIBO_LIBEXEC_FOLDER=MacOS
2933     LIBO_LIB_FOLDER=Frameworks
2934     LIBO_LIB_PYUNO_FOLDER=Resources
2935     LIBO_SHARE_FOLDER=Resources
2936     LIBO_SHARE_HELP_FOLDER=Resources/help
2937     LIBO_SHARE_JAVA_FOLDER=Resources/java
2938     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
2939     LIBO_SHARE_READMES_FOLDER=Resources/readmes
2940     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
2941     LIBO_SHARE_SHELL_FOLDER=Resources/shell
2942     LIBO_URE_BIN_FOLDER=MacOS
2943     LIBO_URE_ETC_FOLDER=Resources/ure/etc
2944     LIBO_URE_LIB_FOLDER=Frameworks
2945     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
2946     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
2947 elif test $_os = WINNT; then
2948     LIBO_BIN_FOLDER=program
2949     LIBO_ETC_FOLDER=program
2950     LIBO_LIBEXEC_FOLDER=program
2951     LIBO_LIB_FOLDER=program
2952     LIBO_LIB_PYUNO_FOLDER=program
2953     LIBO_SHARE_FOLDER=share
2954     LIBO_SHARE_HELP_FOLDER=help
2955     LIBO_SHARE_JAVA_FOLDER=program/classes
2956     LIBO_SHARE_PRESETS_FOLDER=presets
2957     LIBO_SHARE_READMES_FOLDER=readmes
2958     LIBO_SHARE_RESOURCE_FOLDER=program/resource
2959     LIBO_SHARE_SHELL_FOLDER=program/shell
2960     LIBO_URE_BIN_FOLDER=program
2961     LIBO_URE_ETC_FOLDER=program
2962     LIBO_URE_LIB_FOLDER=program
2963     LIBO_URE_MISC_FOLDER=program
2964     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
2965 else
2966     LIBO_BIN_FOLDER=program
2967     LIBO_ETC_FOLDER=program
2968     LIBO_LIBEXEC_FOLDER=program
2969     LIBO_LIB_FOLDER=program
2970     LIBO_LIB_PYUNO_FOLDER=program
2971     LIBO_SHARE_FOLDER=share
2972     LIBO_SHARE_HELP_FOLDER=help
2973     LIBO_SHARE_JAVA_FOLDER=program/classes
2974     LIBO_SHARE_PRESETS_FOLDER=presets
2975     LIBO_SHARE_READMES_FOLDER=readmes
2976     if test "$enable_fuzzers" != yes; then
2977         LIBO_SHARE_RESOURCE_FOLDER=program/resource
2978     else
2979         LIBO_SHARE_RESOURCE_FOLDER=resource
2980     fi
2981     LIBO_SHARE_SHELL_FOLDER=program/shell
2982     LIBO_URE_BIN_FOLDER=program
2983     LIBO_URE_ETC_FOLDER=program
2984     LIBO_URE_LIB_FOLDER=program
2985     LIBO_URE_MISC_FOLDER=program
2986     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
2988 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
2989 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
2990 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
2991 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
2992 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
2993 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
2994 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
2995 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
2996 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
2997 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
2998 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
2999 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3000 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3001 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3002 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3003 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3005 # Not all of them needed in config_host.mk, add more if need arises
3006 AC_SUBST(LIBO_BIN_FOLDER)
3007 AC_SUBST(LIBO_ETC_FOLDER)
3008 AC_SUBST(LIBO_LIB_FOLDER)
3009 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3010 AC_SUBST(LIBO_SHARE_FOLDER)
3011 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3012 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3013 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3014 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3015 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3016 AC_SUBST(LIBO_URE_BIN_FOLDER)
3017 AC_SUBST(LIBO_URE_ETC_FOLDER)
3018 AC_SUBST(LIBO_URE_LIB_FOLDER)
3019 AC_SUBST(LIBO_URE_MISC_FOLDER)
3020 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3022 dnl ===================================================================
3023 dnl Windows specific tests and stuff
3024 dnl ===================================================================
3026 reg_get_value()
3028     # Return value: $regvalue
3029     unset regvalue
3031     local _regentry="/proc/registry${1}/${2}"
3032     if test -f "$_regentry"; then
3033         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3034         # Registry keys read via /proc/registry* are always \0 terminated!
3035         local _regvalue=$(tr -d '\0' < "$_regentry")
3036         if test $? -eq 0; then
3037             regvalue=$_regvalue
3038         fi
3039     fi
3042 # Get a value from the 32-bit side of the Registry
3043 reg_get_value_32()
3045     reg_get_value "32" "$1"
3048 # Get a value from the 64-bit side of the Registry
3049 reg_get_value_64()
3051     reg_get_value "64" "$1"
3054 if test "$_os" = "WINNT"; then
3055     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3056     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3057         AC_MSG_RESULT([no])
3058         WINDOWS_SDK_ARCH="x86"
3059     else
3060         AC_MSG_RESULT([yes])
3061         WINDOWS_SDK_ARCH="x64"
3062         BITNESS_OVERRIDE=64
3063     fi
3065 if test "$_os" = "iOS"; then
3066     cross_compiling="yes"
3069 if test "$cross_compiling" = "yes"; then
3070     export CROSS_COMPILING=TRUE
3071 else
3072     CROSS_COMPILING=
3073     BUILD_TYPE="$BUILD_TYPE NATIVE"
3075 AC_SUBST(CROSS_COMPILING)
3077 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3078 if test "$GCC" = "yes"; then
3079     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
3080     bsymbolic_functions_ldflags_save=$LDFLAGS
3081     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3082     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3083 #include <stdio.h>
3084         ],[
3085 printf ("hello world\n");
3086         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3087     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3088         AC_MSG_RESULT( found )
3089     else
3090         AC_MSG_RESULT( not found )
3091     fi
3092     LDFLAGS=$bsymbolic_functions_ldflags_save
3094 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3096 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3097 # NOTE: must _not_ be used for bundled external libraries!
3098 ISYSTEM=
3099 if test "$GCC" = "yes"; then
3100     AC_MSG_CHECKING( for -isystem )
3101     save_CFLAGS=$CFLAGS
3102     CFLAGS="$CFLAGS -Werror"
3103     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3104     CFLAGS=$save_CFLAGS
3105     if test -n "$ISYSTEM"; then
3106         AC_MSG_RESULT(yes)
3107     else
3108         AC_MSG_RESULT(no)
3109     fi
3111 if test -z "$ISYSTEM"; then
3112     # fall back to using -I
3113     ISYSTEM=-I
3115 AC_SUBST(ISYSTEM)
3117 dnl ===================================================================
3118 dnl  Check which Visual Studio compiler is used
3119 dnl ===================================================================
3121 map_vs_year_to_version()
3123     # Return value: $vsversion
3125     unset vsversion
3127     case $1 in
3128     2015)
3129         vsversion=14.0;;
3130     2017)
3131         vsversion=15.0;;
3132     *)
3133         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3134     esac
3137 vs_versions_to_check()
3139     # Args: $1 (optional) : versions to check, in the order of preference
3140     # Return value: $vsversions
3142     unset vsversions
3144     if test -n "$1"; then
3145         map_vs_year_to_version "$1"
3146         vsversions=$vsversion
3147     else
3148         # By default we prefer 2015/2017, in this order
3149         vsversions="14.0 15.0"
3150     fi
3153 win_get_env_from_vsvars32bat()
3155     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3156     if test $vcnum = "150"; then
3157       # Also seems to be located in another directory under the same name: vsvars32.bat
3158       # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3159       printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3160     else
3161       printf '@call "%s/../Common7/Tools/vsvars32.bat"\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3162     fi
3163     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3164     chmod +x $WRAPPERBATCHFILEPATH
3165     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3166     rm -f $WRAPPERBATCHFILEPATH
3167     printf '%s' "$_win_get_env_from_vsvars32bat"
3170 find_ucrt()
3172     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3173     if test -n "$regvalue"; then
3174         PathFormat "$regvalue"
3175         UCRTSDKDIR=$formatted_path
3176         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3177         UCRTVERSION=$regvalue
3178         # Rest if not exist
3179         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3180           UCRTSDKDIR=
3181         fi
3182     fi
3183     if test -z "$UCRTSDKDIR"; then
3184         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3185         if test "$vcnum" = "150"; then
3186           ide_env_file="${ide_env_dir}VsDevCmd.bat"
3187         else
3188           ide_env_file="${ide_env_dir}/vsvars32.bat"
3189         fi
3190         if test -f "$ide_env_file"; then
3191             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3192             UCRTSDKDIR=$formatted_path
3193             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3194             dnl Hack needed at least by tml:
3195             if test "$UCRTVERSION" = 10.0.15063.0 \
3196                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3197                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3198             then
3199                 UCRTVERSION=10.0.14393.0
3200             fi
3201         else
3202           AC_MSG_ERROR([No UCRT found])
3203         fi
3204     fi
3207 find_msvc()
3209     # Find Visual C++ 2015/2017
3210     # Args: $1 (optional) : The VS version year
3211     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3213     unset vctest vcnum vcnumwithdot vcbuildnumber
3215     vs_versions_to_check "$1"
3217     for ver in $vsversions; do
3218         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3219         if test -n "$regvalue"; then
3220             vctest=$regvalue
3221             break
3222         fi
3223         # As always MSVC 15.0 is special here
3224         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver
3225         if test -n "$regvalue"; then
3226             AC_MSG_RESULT([found: $regvalue])
3227             PathFormat "$regvalue"
3228             vctest=$formatted_path
3229             break
3230         fi
3231     done
3232     if test -n "$vctest"; then
3233         vcnumwithdot=$ver
3234         case "$vcnumwithdot" in
3235         14.0)
3236             vcyear=2015
3237             vcnum=140
3238             ;;
3239         15.0)
3240             vcyear=2017
3241             vcnum=150
3242             vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3243             ;;
3244         esac
3245     fi
3248 SOLARINC=
3249 MSBUILD_PATH=
3250 DEVENV=
3251 if test "$_os" = "WINNT"; then
3252     AC_MSG_CHECKING([Visual C++])
3254     find_msvc "$with_visual_studio"
3255     if test -z "$vctest"; then
3256         if test -n "$with_visual_studio"; then
3257             AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3258         else
3259             AC_MSG_ERROR([No Visual Studio 2015/2017 installation found])
3260         fi
3261     fi
3263     if test "$BITNESS_OVERRIDE" = ""; then
3264         if test -f "$vctest/bin/cl.exe"; then
3265             VC_PRODUCT_DIR=$vctest
3266         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3267             VC_PRODUCT_DIR=$vctest/VC
3268         else
3269             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3270         fi
3271     else
3272         if test -f "$vctest/bin/amd64/cl.exe"; then
3273             VC_PRODUCT_DIR=$vctest
3274         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3275             VC_PRODUCT_DIR=$vctest/VC
3276         else
3277             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe or $vctest/bin/amd64/cl.exe or $vctest/bin/x86_amd64/cl.exe])
3278         fi
3279     fi
3281     AC_MSG_CHECKING([for short pathname of VC product directory])
3282     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3283     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3285     UCRTSDKDIR=
3286     UCRTVERSION=
3288     AC_MSG_CHECKING([for UCRT location])
3289     find_ucrt
3290     # find_ucrt errors out if it doesn't find it
3291     AC_MSG_RESULT([found])
3292     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3293     ucrtincpath_formatted=$formatted_path
3294     # SOLARINC is used for external modules and must be set too.
3295     # And no, it's not sufficient to set SOLARINC only, as configure
3296     # itself doesn't honour it.
3297     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3298     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3299     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3300     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3302     AC_SUBST(UCRTSDKDIR)
3303     AC_SUBST(UCRTVERSION)
3305     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3306     # Find the proper version of MSBuild.exe to use based on the VS version
3307     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3308     if test -n "$regvalue" ; then
3309         AC_MSG_RESULT([found: $regvalue])
3310         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3311     else
3312         if test $vcnum = "150"; then
3313             if test "$BITNESS_OVERRIDE" = ""; then
3314                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3315             else
3316                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3317             fi
3318             MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3319         else
3320             AC_MSG_ERROR([No msbuild found, Visual Studio installation broken?])
3321         fi
3322         AC_MSG_RESULT([$regvalue])
3323     fi
3325     # Find the version of devenv.exe
3326     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3327     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3328     if test ! -e "$DEVENV"; then
3329         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3330     fi
3332     dnl ===========================================================
3333     dnl  Check for the corresponding mspdb*.dll
3334     dnl ===========================================================
3336     MSPDB_PATH=
3337     CL_DIR=
3338     CL_LIB=
3340     if test "$BITNESS_OVERRIDE" = ""; then
3341         if test "$vcnum" = "150"; then
3342             MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86"
3343             CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX86/x86
3344         else
3345             MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3346             CL_DIR=bin
3347         fi
3348     else
3349         if test "$vcnum" = "150"; then
3350             MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64"
3351             CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX64/x64
3352         else
3353             MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3354             CL_DIR=bin/amd64
3355         fi
3356     fi
3358     # MSVC 15.0 has libraries from 14.0?
3359     if test  "$vcnum" = "150"; then
3360         mspdbnum="140"
3361     else
3362         mspdbnum=$vcnum
3363     fi
3365     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3366         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3367     fi
3369     MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3370     MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3372     dnl The path needs to be added before cl is called
3373     PATH="$MSPDB_PATH:$PATH"
3375     AC_MSG_CHECKING([cl.exe])
3377     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3378     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3379     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3380     # is not enough?
3382     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3383     dnl needed when building CLR code:
3384     if test -z "$MSVC_CXX"; then
3385         if test "$BITNESS_OVERRIDE" = ""; then
3386             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3387                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3388             fi
3389         else
3390             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3391                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3392             fi
3393         fi
3395         # This gives us a posix path with 8.3 filename restrictions
3396         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3397     fi
3399     if test -z "$CC"; then
3400         CC=$MSVC_CXX
3401     fi
3402     if test "$BITNESS_OVERRIDE" = ""; then
3403         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3404         MSVC_CXX="$MSVC_CXX -arch:SSE"
3405     fi
3407     if test -n "$CC"; then
3408         # Remove /cl.exe from CC case insensitive
3409         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3410         if test "$BITNESS_OVERRIDE" = ""; then
3411            if test "$vcnum" = "150"; then
3412                COMPATH="$VC_PRODUCT_DIR"
3413            else
3414                COMPATH=`echo "$CC" | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3415            fi
3416         else
3417             if test -n "$VC_PRODUCT_DIR"; then
3418                 COMPATH=$VC_PRODUCT_DIR
3419             fi
3420         fi
3421         if test "$BITNESS_OVERRIDE" = ""; then
3422             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3423             CC="$CC -arch:SSE"
3424         fi
3426         if test "$vcnum" = "150"; then
3427             COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3428         fi
3430         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3432         PathFormat "$COMPATH"
3433         COMPATH="$formatted_path"
3435         VCVER=$vcnum
3436         MSVSVER=$vcyear
3438         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3439         # are always "better", we list them in reverse chronological order.
3441         case $vcnum in
3442         140)
3443             COMEX=19
3444             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3445             ;;
3446         150)
3447             COMEX=19
3448             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3449             ;;
3450         esac
3452         # The expectation is that --with-windows-sdk should not need to be used
3453         if test -n "$with_windows_sdk"; then
3454             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3455             *" "$with_windows_sdk" "*)
3456                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3457                 ;;
3458             *)
3459                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3460                 ;;
3461             esac
3462         fi
3464         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3465         ac_objext=obj
3466         ac_exeext=exe
3468     else
3469         AC_MSG_ERROR([Visual C++ not found after all, huh])
3470     fi
3472     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3473     # version of the Explorer extension (and maybe other small
3474     # bits, too) needed when installing a 32-bit LibreOffice on a
3475     # 64-bit OS. The 64-bit Explorer extension is a feature that
3476     # has been present since long in OOo. Don't confuse it with
3477     # building LibreOffice itself as 64-bit code.
3479     BUILD_X64=
3480     CXX_X64_BINARY=
3481     LINK_X64_BINARY=
3483     if test "$BITNESS_OVERRIDE" = ""; then
3484         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3485         if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3486             # Prefer native x64 compiler to cross-compiler, in case we are running
3487             # the build on a 64-bit OS.
3488             if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3489                 BUILD_X64=TRUE
3490                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3491                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3492             elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3493                 BUILD_X64=TRUE
3494                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3495                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3496             fi
3497         elif test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib"; then
3498             # nobody uses 32-bit OS to build, just pick the 64-bit compiler
3499             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3500                 BUILD_X64=TRUE
3501                 CXX_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"
3502                 LINK_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/link.exe"
3503             fi
3504         fi
3505         if test "$BUILD_X64" = TRUE; then
3506             AC_MSG_RESULT([found])
3507         else
3508             AC_MSG_RESULT([not found])
3509             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3510         fi
3511     fi
3512     AC_SUBST(BUILD_X64)
3514     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3515     AC_SUBST(CXX_X64_BINARY)
3516     AC_SUBST(LINK_X64_BINARY)
3518 AC_SUBST(VCVER)
3519 AC_SUBST(DEVENV)
3520 PathFormat "$MSPDB_PATH"
3521 MSPDB_PATH="$formatted_path"
3522 AC_SUBST(MSVC_CXX)
3525 # unowinreg.dll
3527 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3528 AC_SUBST(UNOWINREG_DLL)
3530 COM_IS_CLANG=
3531 AC_MSG_CHECKING([whether the compiler is actually Clang])
3532 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3533     #ifndef __clang__
3534     you lose
3535     #endif
3536     int foo=42;
3537     ]])],
3538     [AC_MSG_RESULT([yes])
3539      COM_IS_CLANG=TRUE],
3540     [AC_MSG_RESULT([no])])
3542 CC_PLAIN=$CC
3543 if test "$COM_IS_CLANG" = TRUE; then
3544     AC_MSG_CHECKING([the Clang version])
3545     if test "$_os" = WINNT; then
3546         dnl In which case, assume clang-cl:
3547         my_args="/EP /TC"
3548         dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3549         dnl clang-cl:
3550         CC_PLAIN=
3551         for i in $CC; do
3552             case $i in
3553             -FIIntrin.h)
3554                 ;;
3555             *)
3556                 CC_PLAIN="$CC_PLAIN $i"
3557                 ;;
3558             esac
3559         done
3560     else
3561         my_args="-E -P"
3562     fi
3563     clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args -`
3564     CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3565     CLANGVER=`echo $clang_version \
3566         | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3567     AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3568     AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3569     AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3571 AC_SUBST(COM_IS_CLANG)
3573 SHOWINCLUDES_PREFIX=
3574 if test "$_os" = WINNT; then
3575     dnl We need to guess the prefix of the -showIncludes output, it can be
3576     dnl localized
3577     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3578     echo "#include <stdlib.h>" > conftest.c
3579     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3580         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3581     rm -f conftest.c conftest.obj
3582     if test -z "$SHOWINCLUDES_PREFIX"; then
3583         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3584     else
3585         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3586     fi
3588 AC_SUBST(SHOWINCLUDES_PREFIX)
3591 # prefix C with ccache if needed
3593 if test "$CCACHE" != ""; then
3594     AC_MSG_CHECKING([whether $CC is already ccached])
3596     AC_LANG_PUSH([C])
3597     save_CFLAGS=$CFLAGS
3598     CFLAGS="$CFLAGS --ccache-skip -O2"
3599     dnl an empty program will do, we're checking the compiler flags
3600     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3601                       [use_ccache=yes], [use_ccache=no])
3602     if test $use_ccache = yes; then
3603         AC_MSG_RESULT([yes])
3604     else
3605         CC="$CCACHE $CC"
3606         AC_MSG_RESULT([no])
3607     fi
3608     CFLAGS=$save_CFLAGS
3609     AC_LANG_POP([C])
3612 # ===================================================================
3613 # check various GCC options that Clang does not support now but maybe
3614 # will somewhen in the future, check them even for GCC, so that the
3615 # flags are set
3616 # ===================================================================
3618 HAVE_GCC_GGDB2=
3619 HAVE_GCC_FINLINE_LIMIT=
3620 HAVE_GCC_FNO_INLINE=
3621 if test "$GCC" = "yes"; then
3622     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3623     save_CFLAGS=$CFLAGS
3624     CFLAGS="$CFLAGS -Werror -ggdb2"
3625     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3626     CFLAGS=$save_CFLAGS
3627     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3628         AC_MSG_RESULT([yes])
3629     else
3630         AC_MSG_RESULT([no])
3631     fi
3633     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3634     save_CFLAGS=$CFLAGS
3635     CFLAGS="$CFLAGS -Werror -finline-limit=0"
3636     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3637     CFLAGS=$save_CFLAGS
3638     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3639         AC_MSG_RESULT([yes])
3640     else
3641         AC_MSG_RESULT([no])
3642     fi
3644     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3645     save_CFLAGS=$CFLAGS
3646     CFLAGS="$CFLAGS -Werror -fno-inline"
3647     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3648     CFLAGS=$save_CFLAGS
3649     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3650         AC_MSG_RESULT([yes])
3651     else
3652         AC_MSG_RESULT([no])
3653     fi
3655     if test "$host_cpu" = "m68k"; then
3656         AC_MSG_CHECKING([whether $CC supports -mlong-jump-table-offsets])
3657         save_CFLAGS=$CFLAGS
3658         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3659         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3660         CFLAGS=$save_CFLAGS
3661         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3662             AC_MSG_RESULT([yes])
3663         else
3664             AC_MSG_ERROR([no])
3665         fi
3666     fi
3668 AC_SUBST(HAVE_GCC_GGDB2)
3669 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3670 AC_SUBST(HAVE_GCC_FNO_INLINE)
3672 dnl ===================================================================
3673 dnl  Test the gcc version
3674 dnl ===================================================================
3675 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3676     AC_MSG_CHECKING([the GCC version])
3677     _gcc_version=`$CC -dumpversion`
3678     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3679         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3680     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3682     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3684     if test "$gcc_full_version" -lt 40801; then
3685         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.8.1])
3686     fi
3687 else
3688     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3689     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3690     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3691     # (which reports itself as GCC 4.2.1).
3692     GCC_VERSION=
3694 AC_SUBST(GCC_VERSION)
3696 dnl Set the ENABLE_DBGUTIL variable
3697 dnl ===================================================================
3698 AC_MSG_CHECKING([whether to build with additional debug utilities])
3699 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3700     ENABLE_DBGUTIL="TRUE"
3701     # this is an extra var so it can have different default on different MSVC
3702     # versions (in case there are version specific problems with it)
3703     MSVC_USE_DEBUG_RUNTIME="TRUE"
3705     AC_MSG_RESULT([yes])
3706     # cppunit and graphite expose STL in public headers
3707     if test "$with_system_cppunit" = "yes"; then
3708         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3709     else
3710         with_system_cppunit=no
3711     fi
3712     if test "$with_system_graphite" = "yes"; then
3713         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3714     else
3715         with_system_graphite=no
3716     fi
3717     if test "$with_system_mysql_cppconn" = "yes"; then
3718         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3719     else
3720         with_system_mysql_cppconn=no
3721     fi
3722     if test "$with_system_orcus" = "yes"; then
3723         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3724     else
3725         with_system_orcus=no
3726     fi
3727     if test "$with_system_libcmis" = "yes"; then
3728         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3729     else
3730         with_system_libcmis=no
3731     fi
3732     if test "$with_system_hunspell" = "yes"; then
3733         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3734     else
3735         with_system_hunspell=no
3736     fi
3737     if test "$with_system_gpgmepp" = "yes"; then
3738         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3739     else
3740         with_system_gpgmepp=no
3741     fi
3742 else
3743     ENABLE_DBGUTIL=""
3744     MSVC_USE_DEBUG_RUNTIME=""
3745     AC_MSG_RESULT([no])
3747 AC_SUBST(ENABLE_DBGUTIL)
3748 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3750 dnl Set the ENABLE_DEBUG variable.
3751 dnl ===================================================================
3752 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3753     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3755 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3756     if test -z "$libo_fuzzed_enable_debug"; then
3757         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3758     else
3759         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3760         enable_debug=yes
3761     fi
3764 AC_MSG_CHECKING([whether to do a debug build])
3765 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3766     ENABLE_DEBUG="TRUE"
3767     if test -n "$ENABLE_DBGUTIL" ; then
3768         AC_MSG_RESULT([yes (dbgutil)])
3769     else
3770         AC_MSG_RESULT([yes])
3771     fi
3772 else
3773     ENABLE_DEBUG=""
3774     AC_MSG_RESULT([no])
3776 AC_SUBST(ENABLE_DEBUG)
3778 if test "$enable_sal_log" = yes; then
3779     ENABLE_SAL_LOG=TRUE
3781 AC_SUBST(ENABLE_SAL_LOG)
3783 dnl Selective debuginfo
3784 ENABLE_DEBUGINFO_FOR=
3785 if test -n "$ENABLE_DEBUG"; then
3786     AC_MSG_CHECKING([whether to use selective debuginfo])
3787     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3788         if test "$enable_selective_debuginfo" = "yes"; then
3789             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3790         fi
3791         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3792         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3793     else
3794         ENABLE_DEBUGINFO_FOR=all
3795         AC_MSG_RESULT([no, for all])
3796     fi
3797 else
3798     if test -n "$enable_selective_debuginfo"; then
3799         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
3800     fi
3802 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3804 dnl Check for enable symbols option
3805 dnl ===================================================================
3806 AC_MSG_CHECKING([whether to generate debug information])
3807 if test -z "$enable_symbols"; then
3808     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3809         enable_symbols=yes
3810     else
3811         enable_symbols=no
3812     fi
3814 if test "$enable_symbols" != no; then
3815     ENABLE_SYMBOLS=TRUE
3816     AC_MSG_RESULT([yes])
3817 else
3818     ENABLE_SYMBOLS=
3819     AC_MSG_RESULT([no])
3821 AC_SUBST(ENABLE_SYMBOLS)
3823 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
3824     # Building on Android with full symbols: without enough memory the linker never finishes currently.
3825     AC_MSG_CHECKING([whether enough memory is available for linking])
3826     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
3827     # Check for 15GB, as Linux reports a bit less than the physical memory size.
3828     if test -n "$mem_size" -a $mem_size -lt 15728640; then
3829         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
3830     else
3831         AC_MSG_RESULT([yes])
3832     fi
3835 AC_MSG_CHECKING([whether to compile with optimization flags])
3836 if test -z "$enable_optimized"; then
3837     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3838         enable_optimized=no
3839     else
3840         enable_optimized=yes
3841     fi
3843 if test "$enable_optimized" != no; then
3844     ENABLE_OPTIMIZED=TRUE
3845     AC_MSG_RESULT([yes])
3846 else
3847     ENABLE_OPTIMIZED=
3848     AC_MSG_RESULT([no])
3850 AC_SUBST(ENABLE_OPTIMIZED)
3853 # determine CPUNAME, OS, ...
3854 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
3856 case "$host_os" in
3858 aix*)
3859     COM=GCC
3860     CPUNAME=POWERPC
3861     USING_X11=TRUE
3862     OS=AIX
3863     RTL_OS=AIX
3864     RTL_ARCH=PowerPC
3865     PLATFORMID=aix_powerpc
3866     P_SEP=:
3867     ;;
3869 cygwin*)
3870     COM=MSC
3871     USING_X11=
3872     OS=WNT
3873     RTL_OS=Windows
3874     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3875         P_SEP=";"
3876     else
3877         P_SEP=:
3878     fi
3879     case "$host_cpu" in
3880     i*86|x86_64)
3881         if test "$BITNESS_OVERRIDE" = 64; then
3882             CPUNAME=X86_64
3883             RTL_ARCH=X86_64
3884             PLATFORMID=windows_x86_64
3885             WINDOWS_X64=1
3886             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
3887         else
3888             CPUNAME=INTEL
3889             RTL_ARCH=x86
3890             PLATFORMID=windows_x86
3891         fi
3892         ;;
3893     *)
3894         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3895         ;;
3896     esac
3897     SCPDEFS="$SCPDEFS -D_MSC_VER"
3898     ;;
3900 darwin*)
3901     COM=GCC
3902     USING_X11=
3903     OS=MACOSX
3904     RTL_OS=MacOSX
3905     P_SEP=:
3907     case "$host_cpu" in
3908     arm)
3909         AC_MSG_ERROR([Can't build 32-bit code for iOS])
3910         ;;
3911     arm64)
3912         OS=IOS
3913         if test "$enable_ios_simulator" = "yes"; then
3914             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
3915         else
3916             CPUNAME=ARM64
3917             RTL_ARCH=ARM_EABI
3918             PLATFORMID=ios_arm64
3919         fi
3920         ;;
3921     i*86)
3922         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
3923         ;;
3924     x86_64)
3925         if test "$enable_ios_simulator" = "yes"; then
3926             OS=IOS
3927         fi
3928         CPUNAME=X86_64
3929         RTL_ARCH=X86_64
3930         PLATFORMID=macosx_x86_64
3931         ;;
3932     *)
3933         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3934         ;;
3935     esac
3936     ;;
3938 dragonfly*)
3939     COM=GCC
3940     USING_X11=TRUE
3941     OS=DRAGONFLY
3942     RTL_OS=DragonFly
3943     P_SEP=:
3945     case "$host_cpu" in
3946     i*86)
3947         CPUNAME=INTEL
3948         RTL_ARCH=x86
3949         PLATFORMID=dragonfly_x86
3950         ;;
3951     x86_64)
3952         CPUNAME=X86_64
3953         RTL_ARCH=X86_64
3954         PLATFORMID=dragonfly_x86_64
3955         ;;
3956     *)
3957         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3958         ;;
3959     esac
3960     ;;
3962 freebsd*)
3963     COM=GCC
3964     USING_X11=TRUE
3965     RTL_OS=FreeBSD
3966     OS=FREEBSD
3967     P_SEP=:
3969     case "$host_cpu" in
3970     i*86)
3971         CPUNAME=INTEL
3972         RTL_ARCH=x86
3973         PLATFORMID=freebsd_x86
3974         ;;
3975     x86_64|amd64)
3976         CPUNAME=X86_64
3977         RTL_ARCH=X86_64
3978         PLATFORMID=freebsd_x86_64
3979         ;;
3980     *)
3981         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3982         ;;
3983     esac
3984     ;;
3986 kfreebsd*)
3987     COM=GCC
3988     USING_X11=TRUE
3989     OS=LINUX
3990     RTL_OS=kFreeBSD
3991     P_SEP=:
3993     case "$host_cpu" in
3995     i*86)
3996         CPUNAME=INTEL
3997         RTL_ARCH=x86
3998         PLATFORMID=kfreebsd_x86
3999         ;;
4000     x86_64)
4001         CPUNAME=X86_64
4002         RTL_ARCH=X86_64
4003         PLATFORMID=kfreebsd_x86_64
4004         ;;
4005     *)
4006         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4007         ;;
4008     esac
4009     ;;
4011 linux-gnu*)
4012     COM=GCC
4013     USING_X11=TRUE
4014     OS=LINUX
4015     RTL_OS=Linux
4016     P_SEP=:
4018     case "$host_cpu" in
4020     aarch64)
4021         CPUNAME=AARCH64
4022         PLATFORMID=linux_aarch64
4023         RTL_ARCH=AARCH64
4024         ;;
4025     alpha)
4026         CPUNAME=AXP
4027         RTL_ARCH=ALPHA
4028         PLATFORMID=linux_alpha
4029         ;;
4030     arm*)
4031         CPUNAME=ARM
4032         EPM_FLAGS="-a arm"
4033         RTL_ARCH=ARM_EABI
4034         PLATFORMID=linux_arm_eabi
4035         case "$host_cpu" in
4036         arm*-linux)
4037             RTL_ARCH=ARM_OABI
4038             PLATFORMID=linux_arm_oabi
4039             ;;
4040         esac
4041         ;;
4042     hppa)
4043         CPUNAME=HPPA
4044         RTL_ARCH=HPPA
4045         EPM_FLAGS="-a hppa"
4046         PLATFORMID=linux_hppa
4047         ;;
4048     i*86)
4049         CPUNAME=INTEL
4050         RTL_ARCH=x86
4051         PLATFORMID=linux_x86
4052         ;;
4053     ia64)
4054         CPUNAME=IA64
4055         RTL_ARCH=IA64
4056         PLATFORMID=linux_ia64
4057         ;;
4058     mips)
4059         CPUNAME=GODSON
4060         RTL_ARCH=MIPS_EB
4061         EPM_FLAGS="-a mips"
4062         PLATFORMID=linux_mips_eb
4063         ;;
4064     mips64)
4065         CPUNAME=GODSON64
4066         RTL_ARCH=MIPS64_EB
4067         EPM_FLAGS="-a mips64"
4068         PLATFORMID=linux_mips64_eb
4069         ;;
4070     mips64el)
4071         CPUNAME=GODSON64
4072         RTL_ARCH=MIPS64_EL
4073         EPM_FLAGS="-a mips64el"
4074         PLATFORMID=linux_mips64_el
4075         ;;
4076     mipsel)
4077         CPUNAME=GODSON
4078         RTL_ARCH=MIPS_EL
4079         EPM_FLAGS="-a mipsel"
4080         PLATFORMID=linux_mips_el
4081         ;;
4082     m68k)
4083         CPUNAME=M68K
4084         RTL_ARCH=M68K
4085         PLATFORMID=linux_m68k
4086         ;;
4087     powerpc)
4088         CPUNAME=POWERPC
4089         RTL_ARCH=PowerPC
4090         PLATFORMID=linux_powerpc
4091         ;;
4092     powerpc64)
4093         CPUNAME=POWERPC64
4094         RTL_ARCH=PowerPC_64
4095         PLATFORMID=linux_powerpc64
4096         ;;
4097     powerpc64le)
4098         CPUNAME=POWERPC64
4099         RTL_ARCH=PowerPC_64_LE
4100         PLATFORMID=linux_powerpc64_le
4101         ;;
4102     sparc)
4103         CPUNAME=SPARC
4104         RTL_ARCH=SPARC
4105         PLATFORMID=linux_sparc
4106         ;;
4107     sparc64)
4108         CPUNAME=SPARC64
4109         RTL_ARCH=SPARC64
4110         PLATFORMID=linux_sparc64
4111         ;;
4112     s390)
4113         CPUNAME=S390
4114         RTL_ARCH=S390
4115         PLATFORMID=linux_s390
4116         ;;
4117     s390x)
4118         CPUNAME=S390X
4119         RTL_ARCH=S390x
4120         PLATFORMID=linux_s390x
4121         ;;
4122     x86_64)
4123         CPUNAME=X86_64
4124         RTL_ARCH=X86_64
4125         PLATFORMID=linux_x86_64
4126         ;;
4127     *)
4128         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4129         ;;
4130     esac
4131     ;;
4133 linux-android*)
4134     COM=GCC
4135     USING_X11=
4136     OS=ANDROID
4137     RTL_OS=Android
4138     P_SEP=:
4140     case "$host_cpu" in
4142     arm|armel)
4143         CPUNAME=ARM
4144         RTL_ARCH=ARM_EABI
4145         PLATFORMID=android_arm_eabi
4146         ;;
4147     aarch64)
4148         CPUNAME=AARCH64
4149         RTL_ARCH=AARCH64
4150         PLATFORMID=android_aarch64
4151         ;;
4152     mips|mipsel)
4153         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4154         RTL_ARCH=MIPS_EL
4155         PLATFORMID=android_mips_el
4156         ;;
4157     i*86)
4158         CPUNAME=INTEL
4159         RTL_ARCH=x86
4160         PLATFORMID=android_x86
4161         ;;
4162     *)
4163         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4164         ;;
4165     esac
4166     ;;
4168 *netbsd*)
4169     COM=GCC
4170     USING_X11=TRUE
4171     OS=NETBSD
4172     RTL_OS=NetBSD
4173     P_SEP=:
4175     case "$host_cpu" in
4176     i*86)
4177         CPUNAME=INTEL
4178         RTL_ARCH=x86
4179         PLATFORMID=netbsd_x86
4180         ;;
4181     powerpc)
4182         CPUNAME=POWERPC
4183         RTL_ARCH=PowerPC
4184         PLATFORMID=netbsd_powerpc
4185         ;;
4186     sparc)
4187         CPUNAME=SPARC
4188         RTL_ARCH=SPARC
4189         PLATFORMID=netbsd_sparc
4190         ;;
4191     x86_64)
4192         CPUNAME=X86_64
4193         RTL_ARCH=X86_64
4194         PLATFORMID=netbsd_x86_64
4195         ;;
4196     *)
4197         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4198         ;;
4199     esac
4200     ;;
4202 openbsd*)
4203     COM=GCC
4204     USING_X11=TRUE
4205     OS=OPENBSD
4206     RTL_OS=OpenBSD
4207     P_SEP=:
4209     case "$host_cpu" in
4210     i*86)
4211         CPUNAME=INTEL
4212         RTL_ARCH=x86
4213         PLATFORMID=openbsd_x86
4214         ;;
4215     x86_64)
4216         CPUNAME=X86_64
4217         RTL_ARCH=X86_64
4218         PLATFORMID=openbsd_x86_64
4219         ;;
4220     *)
4221         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4222         ;;
4223     esac
4224     SOLARINC="$SOLARINC -I/usr/local/include"
4225     ;;
4227 solaris*)
4228     COM=GCC
4229     USING_X11=TRUE
4230     OS=SOLARIS
4231     RTL_OS=Solaris
4232     P_SEP=:
4234     case "$host_cpu" in
4235     i*86)
4236         CPUNAME=INTEL
4237         RTL_ARCH=x86
4238         PLATFORMID=solaris_x86
4239         ;;
4240     sparc)
4241         CPUNAME=SPARC
4242         RTL_ARCH=SPARC
4243         PLATFORMID=solaris_sparc
4244         ;;
4245     sparc64)
4246         CPUNAME=SPARC64
4247         RTL_ARCH=SPARC64
4248         PLATFORMID=solaris_sparc64
4249         ;;
4250     *)
4251         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4252         ;;
4253     esac
4254     SOLARINC="$SOLARINC -I/usr/local/include"
4255     ;;
4258     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4259     ;;
4260 esac
4262 if test "$with_x" = "no"; then
4263     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4266 ENABLE_HEADLESS=""
4267 if test "$enable_gui" = "no"; then
4268     if test "$USING_X11" != TRUE; then
4269         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4270     fi
4271     USING_X11=
4272     ENABLE_HEADLESS=TRUE
4273     AC_DEFINE(HAVE_FEATURE_UI,0)
4274     test_cairo=yes
4276 AC_SUBST(ENABLE_HEADLESS)
4278 WORKDIR="${BUILDDIR}/workdir"
4279 INSTDIR="${BUILDDIR}/instdir"
4280 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4281 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4282 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4283 AC_SUBST(COM)
4284 AC_SUBST(CPUNAME)
4285 AC_SUBST(RTL_OS)
4286 AC_SUBST(RTL_ARCH)
4287 AC_SUBST(EPM_FLAGS)
4288 AC_SUBST(USING_X11)
4289 AC_SUBST([INSTDIR])
4290 AC_SUBST([INSTROOT])
4291 AC_SUBST([INSTROOTBASE])
4292 AC_SUBST(OS)
4293 AC_SUBST(P_SEP)
4294 AC_SUBST(WORKDIR)
4295 AC_SUBST(PLATFORMID)
4296 AC_SUBST(WINDOWS_X64)
4297 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4299 dnl ===================================================================
4300 dnl Test which package format to use
4301 dnl ===================================================================
4302 AC_MSG_CHECKING([which package format to use])
4303 if test -n "$with_package_format" -a "$with_package_format" != no; then
4304     for i in $with_package_format; do
4305         case "$i" in
4306         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4307             ;;
4308         *)
4309             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4310 aix - AIX software distribution
4311 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4312 deb - Debian software distribution
4313 pkg - Solaris software distribution
4314 rpm - RedHat software distribution
4316 LibreOffice additionally supports:
4317 archive - .tar.gz or .zip
4318 dmg - Mac OS X .dmg
4319 installed - installation tree
4320 msi - Windows .msi
4321         ])
4322             ;;
4323         esac
4324     done
4325     PKGFORMAT="$with_package_format"
4326     AC_MSG_RESULT([$PKGFORMAT])
4327 else
4328     PKGFORMAT=
4329     AC_MSG_RESULT([none])
4331 AC_SUBST(PKGFORMAT)
4333 dnl ===================================================================
4334 dnl Set up a different compiler to produce tools to run on the build
4335 dnl machine when doing cross-compilation
4336 dnl ===================================================================
4338 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4339 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4340 if test "$cross_compiling" = "yes"; then
4341     AC_MSG_CHECKING([for BUILD platform configuration])
4342     echo
4343     rm -rf CONF-FOR-BUILD config_build.mk
4344     mkdir CONF-FOR-BUILD
4345     # Here must be listed all files needed when running the configure script. In particular, also
4346     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4347     # keep them in the same order as there.
4348     (cd $SRC_ROOT && tar cf - \
4349         config.guess \
4350         bin/get_config_variables \
4351         solenv/bin/getcompver.awk \
4352         solenv/inc/langlist.mk \
4353         download.lst \
4354         config_host.mk.in \
4355         config_host_lang.mk.in \
4356         Makefile.in \
4357         lo.xcent.in \
4358         bin/bffvalidator.sh.in \
4359         bin/odfvalidator.sh.in \
4360         bin/officeotron.sh.in \
4361         instsetoo_native/util/openoffice.lst.in \
4362         config_host/*.in \
4363         sysui/desktop/macosx/Info.plist.in) \
4364     | (cd CONF-FOR-BUILD && tar xf -)
4365     cp configure CONF-FOR-BUILD
4366     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4367     (
4368     unset COM USING_X11 OS CPUNAME
4369     unset CC CXX SYSBASE CFLAGS
4370     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4371     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4372     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4373     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4374     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4375     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4376     cd CONF-FOR-BUILD
4377     sub_conf_opts=""
4378     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4379     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4380     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4381     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4382     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4383     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4384     # Don't bother having configure look for stuff not needed for the build platform anyway
4385     ./configure \
4386         --disable-cups \
4387         --disable-gtk3 \
4388         --disable-pdfimport \
4389         --disable-postgresql-sdbc \
4390         --with-parallelism="$with_parallelism" \
4391         --without-doxygen \
4392         --without-java \
4393         $sub_conf_opts \
4394         --srcdir=$srcdir \
4395         2>&1 | sed -e 's/^/    /'
4396     test -f ./config_host.mk 2>/dev/null || exit
4397     cp config_host.mk ../config_build.mk
4398     cp config_host_lang.mk ../config_build_lang.mk
4399     mv config.log ../config.Build.log
4400     mkdir -p ../config_build
4401     mv config_host/*.h ../config_build
4402     . ./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
4404     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
4405         VV='$'$V
4406         VV=`eval "echo $VV"`
4407         if test -n "$VV"; then
4408             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4409             echo "$line" >>build-config
4410         fi
4411     done
4413     for V in INSTDIR INSTROOT WORKDIR; do
4414         VV='$'$V
4415         VV=`eval "echo $VV"`
4416         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4417         if test -n "$VV"; then
4418             line="${V}_FOR_BUILD='$VV'"
4419             echo "$line" >>build-config
4420         fi
4421     done
4423     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4424     echo "$line" >>build-config
4426     )
4427     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4428     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])
4429     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4430              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4432     eval `cat CONF-FOR-BUILD/build-config`
4434     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4436     rm -rf CONF-FOR-BUILD
4437 else
4438     OS_FOR_BUILD="$OS"
4439     CC_FOR_BUILD="$CC"
4440     CXX_FOR_BUILD="$CXX"
4441     INSTDIR_FOR_BUILD="$INSTDIR"
4442     INSTROOT_FOR_BUILD="$INSTROOT"
4443     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4444     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4445     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4446     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4447     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4448     WORKDIR_FOR_BUILD="$WORKDIR"
4450 AC_SUBST(OS_FOR_BUILD)
4451 AC_SUBST(INSTDIR_FOR_BUILD)
4452 AC_SUBST(INSTROOT_FOR_BUILD)
4453 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4454 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4455 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4456 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4457 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4458 AC_SUBST(WORKDIR_FOR_BUILD)
4460 dnl ===================================================================
4461 dnl Check for syslog header
4462 dnl ===================================================================
4463 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4465 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4466 dnl ===================================================================
4467 AC_MSG_CHECKING([whether to turn warnings to errors])
4468 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4469     ENABLE_WERROR="TRUE"
4470     AC_MSG_RESULT([yes])
4471 else
4472     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4473         ENABLE_WERROR="TRUE"
4474         AC_MSG_RESULT([yes])
4475     else
4476         AC_MSG_RESULT([no])
4477     fi
4479 AC_SUBST(ENABLE_WERROR)
4481 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4482 dnl ===================================================================
4483 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4484 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4485     ASSERT_ALWAYS_ABORT="TRUE"
4486     AC_MSG_RESULT([yes])
4487 else
4488     ASSERT_ALWAYS_ABORT="FALSE"
4489     AC_MSG_RESULT([no])
4491 AC_SUBST(ASSERT_ALWAYS_ABORT)
4493 # Determine whether to use ooenv for the instdir installation
4494 # ===================================================================
4495 if test $_os != "WINNT" -a $_os != "Darwin"; then
4496     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4497     if test "$enable_ooenv" = "no"; then
4498         AC_MSG_RESULT([no])
4499     else
4500         ENABLE_OOENV="TRUE"
4501         AC_MSG_RESULT([yes])
4502     fi
4504 AC_SUBST(ENABLE_OOENV)
4506 if test "$USING_X11" != TRUE; then
4507     # be sure to do not mess with unneeded stuff
4508     test_randr=no
4509     test_xrender=no
4510     test_cups=no
4511     test_dbus=no
4512     test_gtk=no
4513     build_gstreamer_1_0=no
4514     build_gstreamer_0_10=no
4515     test_kde4=no
4516     test_qt5=no
4517     enable_cairo_canvas=no
4520 dnl ===================================================================
4521 dnl check for cups support
4522 dnl ===================================================================
4523 ENABLE_CUPS=""
4525 if test "$enable_cups" = "no"; then
4526     test_cups=no
4529 AC_MSG_CHECKING([whether to enable CUPS support])
4530 if test "$test_cups" = "yes"; then
4531     ENABLE_CUPS="TRUE"
4532     AC_MSG_RESULT([yes])
4534     AC_MSG_CHECKING([whether cups support is present])
4535     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4536     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4537     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4538         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4539     fi
4541 else
4542     AC_MSG_RESULT([no])
4545 AC_SUBST(ENABLE_CUPS)
4547 # fontconfig checks
4548 if test "$test_fontconfig" = "yes"; then
4549     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4550     SYSTEM_FONTCONFIG=TRUE
4551     FilterLibs "${FONTCONFIG_LIBS}"
4552     FONTCONFIG_LIBS="${filteredlibs}"
4554 AC_SUBST(FONTCONFIG_CFLAGS)
4555 AC_SUBST(FONTCONFIG_LIBS)
4556 AC_SUBST([SYSTEM_FONTCONFIG])
4558 dnl whether to find & fetch external tarballs?
4559 dnl ===================================================================
4560 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4561    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4562        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4563    else
4564        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4565    fi
4567 if test -z "$TARFILE_LOCATION"; then
4568     if test -d "$SRC_ROOT/src" ; then
4569         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4570         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4571     fi
4572     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4573 else
4574     AbsolutePath "$TARFILE_LOCATION"
4575     PathFormat "${absolute_path}"
4576     TARFILE_LOCATION="${formatted_path}"
4578 AC_SUBST(TARFILE_LOCATION)
4580 AC_MSG_CHECKING([whether we want to fetch tarballs])
4581 if test "$enable_fetch_external" != "no"; then
4582     if test "$with_all_tarballs" = "yes"; then
4583         AC_MSG_RESULT([yes, all of them])
4584         DO_FETCH_TARBALLS="ALL"
4585     else
4586         AC_MSG_RESULT([yes, if we use them])
4587         DO_FETCH_TARBALLS="TRUE"
4588     fi
4589 else
4590     AC_MSG_RESULT([no])
4591     DO_FETCH_TARBALLS=
4593 AC_SUBST(DO_FETCH_TARBALLS)
4595 AC_MSG_CHECKING([whether to build help])
4596 HELP_COMMON_ONLY=FALSE
4597 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4598     BUILD_TYPE="$BUILD_TYPE HELP"
4599     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4600     case "$with_help" in
4601     "common")
4602         HELP_COMMON_ONLY=TRUE
4603         AC_MSG_RESULT([common only])
4604         ;;
4605     "html")
4606         ENABLE_HTMLHELP=TRUE
4607         AC_MSG_RESULT([HTML])
4608         ;;
4609     "online")
4610         ENABLE_HTMLHELP=TRUE
4611         HELP_ONLINE=TRUE
4612         AC_MSG_RESULT([HTML])
4613         ;;
4614     *)
4615         SCPDEFS="$SCPDEFS -DWITH_HELP"
4616         AC_MSG_RESULT([yes])
4617         ;;
4618     esac
4619 else
4620     AC_MSG_RESULT([no])
4622 AC_SUBST([ENABLE_HTMLHELP])
4623 AC_SUBST(HELP_COMMON_ONLY)
4624 AC_SUBST([HELP_ONLINE])
4626 dnl Test whether to include MySpell dictionaries
4627 dnl ===================================================================
4628 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4629 if test "$with_myspell_dicts" = "yes"; then
4630     AC_MSG_RESULT([yes])
4631     WITH_MYSPELL_DICTS=TRUE
4632     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4633     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4634 else
4635     AC_MSG_RESULT([no])
4636     WITH_MYSPELL_DICTS=
4638 AC_SUBST(WITH_MYSPELL_DICTS)
4640 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4641 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4642     if test "$with_system_dicts" = yes; then
4643         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4644     fi
4645     with_system_dicts=no
4648 AC_MSG_CHECKING([whether to use dicts from external paths])
4649 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4650     AC_MSG_RESULT([yes])
4651     SYSTEM_DICTS=TRUE
4652     AC_MSG_CHECKING([for spelling dictionary directory])
4653     if test -n "$with_external_dict_dir"; then
4654         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4655     else
4656         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4657         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4658             DICT_SYSTEM_DIR=file:///usr/share/myspell
4659         fi
4660     fi
4661     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4662     AC_MSG_CHECKING([for hyphenation patterns directory])
4663     if test -n "$with_external_hyph_dir"; then
4664         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4665     else
4666         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4667     fi
4668     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4669     AC_MSG_CHECKING([for thesaurus directory])
4670     if test -n "$with_external_thes_dir"; then
4671         THES_SYSTEM_DIR=file://$with_external_thes_dir
4672     else
4673         THES_SYSTEM_DIR=file:///usr/share/mythes
4674     fi
4675     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4676 else
4677     AC_MSG_RESULT([no])
4678     SYSTEM_DICTS=
4680 AC_SUBST(SYSTEM_DICTS)
4681 AC_SUBST(DICT_SYSTEM_DIR)
4682 AC_SUBST(HYPH_SYSTEM_DIR)
4683 AC_SUBST(THES_SYSTEM_DIR)
4685 dnl ===================================================================
4686 dnl enable pch by default on windows
4687 dnl enable it explicitly otherwise
4688 ENABLE_PCH=""
4689 if test "$enable_pch" = yes -a "$enable_compiler_plugins" = yes; then
4690     if test -z "$libo_fuzzed_enable_pch"; then
4691         AC_MSG_ERROR([--enable-pch cannot be used with --enable-compiler-plugins])
4692     else
4693         AC_MSG_NOTICE([Resetting --enable-pch=no])
4694         enable_pch=no
4695     fi
4698 AC_MSG_CHECKING([whether to enable pch feature])
4699 if test "$enable_pch" != "no"; then
4700     if test "$_os" = "WINNT"; then
4701         ENABLE_PCH="TRUE"
4702         AC_MSG_RESULT([yes])
4703     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4704         ENABLE_PCH="TRUE"
4705         AC_MSG_RESULT([yes])
4706     elif test -n "$enable_pch"; then
4707         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4708     else
4709         AC_MSG_RESULT([no])
4710     fi
4711 else
4712     AC_MSG_RESULT([no])
4714 AC_SUBST(ENABLE_PCH)
4716 TAB=`printf '\t'`
4718 AC_MSG_CHECKING([the GNU Make version])
4719 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4720 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4721 if test "$_make_longver" -ge "038200"; then
4722     AC_MSG_RESULT([$GNUMAKE $_make_version])
4724 elif test "$_make_longver" -ge "038100"; then
4725     if test "$build_os" = "cygwin"; then
4726         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4727     fi
4728     AC_MSG_RESULT([$GNUMAKE $_make_version])
4730     dnl ===================================================================
4731     dnl Search all the common names for sha1sum
4732     dnl ===================================================================
4733     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4734     if test -z "$SHA1SUM"; then
4735         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
4736     elif test "$SHA1SUM" = "openssl"; then
4737         SHA1SUM="openssl sha1"
4738     fi
4739     AC_MSG_CHECKING([for GNU Make bug 20033])
4740     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4741     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4742 A := \$(wildcard *.a)
4744 .PHONY: all
4745 all: \$(A:.a=.b)
4746 <TAB>@echo survived bug20033.
4748 .PHONY: setup
4749 setup:
4750 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4752 define d1
4753 @echo lala \$(1)
4754 @sleep 1
4755 endef
4757 define d2
4758 @echo tyty \$(1)
4759 @sleep 1
4760 endef
4762 %.b : %.a
4763 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4764 <TAB>\$(call d1,\$(CHECKSUM)),\
4765 <TAB>\$(call d2,\$(CHECKSUM)))
4767     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4768         no_parallelism_make="YES"
4769         AC_MSG_RESULT([yes, disable parallelism])
4770     else
4771         AC_MSG_RESULT([no, keep parallelism enabled])
4772     fi
4773     rm -rf $TESTGMAKEBUG20033
4774 else
4775     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4778 # find if gnumake support file function
4779 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
4780 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4781 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4782     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
4784 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4785 \$(file >test.txt,Success )
4787 .PHONY: all
4788 all:
4789 <TAB>@cat test.txt
4792 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4793 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4794     HAVE_GNUMAKE_FILE_FUNC=TRUE
4795     AC_MSG_RESULT([yes])
4796 else
4797     AC_MSG_RESULT([no])
4799 rm -rf $TESTGMAKEFILEFUNC
4800 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4801 AC_SUBST(GNUMAKE_WIN_NATIVE)
4803 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
4804 STALE_MAKE=
4805 if test "$_make_ver_check" = ""; then
4806    STALE_MAKE=TRUE
4809 HAVE_LD_HASH_STYLE=FALSE
4810 WITH_LINKER_HASH_STYLE=
4811 AC_MSG_CHECKING([for --hash-style gcc linker support])
4812 if test "$GCC" = "yes"; then
4813     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4814         hash_styles="gnu sysv"
4815     elif test "$with_linker_hash_style" = "no"; then
4816         hash_styles=
4817     else
4818         hash_styles="$with_linker_hash_style"
4819     fi
4821     for hash_style in $hash_styles; do
4822         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4823         hash_style_ldflags_save=$LDFLAGS
4824         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
4826         AC_RUN_IFELSE([AC_LANG_PROGRAM(
4827             [
4828 #include <stdio.h>
4829             ],[
4830 printf ("");
4831             ])],
4832             [
4833                   HAVE_LD_HASH_STYLE=TRUE
4834                   WITH_LINKER_HASH_STYLE=$hash_style
4835             ],
4836             [HAVE_LD_HASH_STYLE=FALSE],
4837             [HAVE_LD_HASH_STYLE=FALSE])
4838         LDFLAGS=$hash_style_ldflags_save
4839     done
4841     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
4842         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
4843     else
4844         AC_MSG_RESULT( no )
4845     fi
4846     LDFLAGS=$hash_style_ldflags_save
4847 else
4848     AC_MSG_RESULT( no )
4850 AC_SUBST(HAVE_LD_HASH_STYLE)
4851 AC_SUBST(WITH_LINKER_HASH_STYLE)
4853 dnl ===================================================================
4854 dnl Check whether there's a Perl version available.
4855 dnl ===================================================================
4856 if test -z "$with_perl_home"; then
4857     AC_PATH_PROG(PERL, perl)
4858 else
4859     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
4860     _perl_path="$with_perl_home/bin/perl"
4861     if test -x "$_perl_path"; then
4862         PERL=$_perl_path
4863     else
4864         AC_MSG_ERROR([$_perl_path not found])
4865     fi
4868 dnl ===================================================================
4869 dnl Testing for Perl version 5 or greater.
4870 dnl $] is the Perl version variable, it is returned as an integer
4871 dnl ===================================================================
4872 if test "$PERL"; then
4873     AC_MSG_CHECKING([the Perl version])
4874     ${PERL} -e "exit($]);"
4875     _perl_version=$?
4876     if test "$_perl_version" -lt 5; then
4877         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
4878     fi
4879     AC_MSG_RESULT([Perl $_perl_version])
4880 else
4881     AC_MSG_ERROR([Perl not found, install Perl 5])
4884 dnl ===================================================================
4885 dnl Testing for required Perl modules
4886 dnl ===================================================================
4888 AC_MSG_CHECKING([for required Perl modules])
4889 if `$PERL -e 'use Cwd; use Digest::MD5'>/dev/null 2>&1`; then
4890     AC_MSG_RESULT([all modules found])
4891 else
4892     AC_MSG_RESULT([failed to find some modules])
4893     # Find out which modules are missing.
4894     if ! `$PERL -e 'use Cwd;'>/dev/null 2>&1`; then
4895         missing_perl_modules="$missing_perl_modules Cwd"
4896     fi
4897     if ! `$PERL -e 'use Digest::MD5;'>/dev/null 2>&1`; then
4898         missing_perl_modules="$missing_perl_modules Digest::MD5"
4899     fi
4900        AC_MSG_ERROR([
4901     The missing Perl modules are: $missing_perl_modules
4902     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
4905 dnl ===================================================================
4906 dnl Check for pkg-config
4907 dnl ===================================================================
4908 if test "$_os" != "WINNT"; then
4909     PKG_PROG_PKG_CONFIG
4912 if test "$_os" != "WINNT"; then
4914     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
4915     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
4916     # explicitly. Or put /path/to/compiler in PATH yourself.
4918     # Use wrappers for LTO
4919     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
4920         AC_CHECK_TOOL(AR,gcc-ar)
4921         AC_CHECK_TOOL(NM,gcc-nm)
4922         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
4923     else
4924         AC_CHECK_TOOL(AR,ar)
4925         AC_CHECK_TOOL(NM,nm)
4926         AC_CHECK_TOOL(RANLIB,ranlib)
4927     fi
4928     AC_CHECK_TOOL(OBJDUMP,objdump)
4929     AC_CHECK_TOOL(READELF,readelf)
4930     AC_CHECK_TOOL(STRIP,strip)
4931     if test "$_os" = "WINNT"; then
4932         AC_CHECK_TOOL(DLLTOOL,dlltool)
4933         AC_CHECK_TOOL(WINDRES,windres)
4934     fi
4936 AC_SUBST(AR)
4937 AC_SUBST(DLLTOOL)
4938 AC_SUBST(NM)
4939 AC_SUBST(OBJDUMP)
4940 AC_SUBST(PKG_CONFIG)
4941 AC_SUBST(RANLIB)
4942 AC_SUBST(READELF)
4943 AC_SUBST(STRIP)
4944 AC_SUBST(WINDRES)
4946 dnl ===================================================================
4947 dnl pkg-config checks on Mac OS X
4948 dnl ===================================================================
4950 if test $_os = Darwin; then
4951     AC_MSG_CHECKING([for bogus pkg-config])
4952     if test -n "$PKG_CONFIG"; then
4953         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
4954             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
4955         else
4956             if test "$enable_bogus_pkg_config" = "yes"; then
4957                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
4958             else
4959                 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.])
4960             fi
4961         fi
4962     else
4963         AC_MSG_RESULT([no, good])
4964     fi
4967 find_csc()
4969     # Return value: $csctest
4971     unset csctest
4973     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
4974     if test -n "$regvalue"; then
4975         csctest=$regvalue
4976         return
4977     fi
4980 find_al()
4982     # Return value: $altest
4984     unset altest
4986     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
4987         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
4988         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
4989             altest=$regvalue
4990             return
4991         fi
4992     done
4994     # We need this additional check to detect 4.6.1 or above.
4995     for ver in 4.7 4.6.2 4.6.1; do
4996         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
4997         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
4998             altest=$regvalue
4999             return
5000         fi
5002         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/WOW6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools"
5003         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5004             altest=$regvalue
5005             return
5006         fi
5007     done
5010 find_dotnetsdk()
5012     # Return value: $frametest (that's a silly name...)
5014     unset frametest
5016     for ver in 1.1 2.0; do
5017         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
5018         if test -n "$regvalue"; then
5019             frametest=$regvalue
5020             return
5021         fi
5022     done
5025 find_dotnetsdk46()
5027     unset frametest
5029     for ver in 4.7 4.6.2 4.6.1 4.6; do
5030         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5031         if test -n "$regvalue"; then
5032             frametest=$regvalue
5033             return
5034         fi
5035         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5036         if test -n "$regvalue"; then
5037             frametest=$regvalue
5038             return
5039         fi
5040     done
5043 find_winsdk_version()
5045     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5046     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5048     unset winsdktest winsdkbinsubdir winsdklibsubdir
5050     case "$1" in
5051     7.*)
5052         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5053         if test -n "$regvalue"; then
5054             winsdktest=$regvalue
5055             winsdklibsubdir=.
5056             return
5057         fi
5058         ;;
5059     8.0|8.0A)
5060         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5061         if test -n "$regvalue"; then
5062             winsdktest=$regvalue
5063             winsdklibsubdir=win8
5064             return
5065         fi
5066         ;;
5067     8.1|8.1A)
5068         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5069         if test -n "$regvalue"; then
5070             winsdktest=$regvalue
5071             winsdklibsubdir=winv6.3
5072             return
5073         fi
5074         ;;
5075     10.0)
5076         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5077         if test -n "$regvalue"; then
5078             winsdktest=$regvalue
5079             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5080             if test -n "$regvalue"; then
5081                 winsdkbinsubdir="$regvalue".0
5082             fi
5083             winsdklibsubdir=$regvalue
5084             if test "$regvalue" = "10.0.14393"; then
5085                 winsdklibsubdir="10.0.14393.0"
5086             elif test "$regvalue" = "10.0.16299"; then
5087                 winsdklibsubdir="10.0.16299.0"
5088             elif test "$regvalue" = "10.0.15063"; then
5089                 winsdklibsubdir="10.0.15063.0"
5090                 dnl Hack needed at least by tml:
5091                 if test ! -f "${winsdktest}/Include/10.0.15063.0/um/sqlext.h" \
5092                     -a -f "${winsdktest}/Include/10.0.14393.0/um/sqlext.h"
5093                 then
5094                     winsdklibsubdir="10.0.14393.0"
5095                 fi
5096             fi
5097             return
5098         fi
5099         ;;
5100     esac
5103 find_winsdk()
5105     # Return value: From find_winsdk_version
5107     unset winsdktest
5109     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5110         find_winsdk_version $ver
5111         if test -n "$winsdktest"; then
5112             return
5113         fi
5114     done
5117 find_msms()
5119     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5120     if test $VCVER = 150; then
5121         my_msm_files="Microsoft_VC141_CRT_x86.msm ${my_msm_files}"
5122     fi
5123     AC_MSG_CHECKING([for ${my_msm_files}])
5124     msmdir=
5125     for ver in 14.0 15.0; do
5126         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5127         if test -n "$regvalue"; then
5128             for f in ${my_msm_files}; do
5129                 if test -e "$regvalue/${f}"; then
5130                     msmdir=$regvalue
5131                     break
5132                 fi
5133             done
5134         fi
5135     done
5136     dnl Is the following fallback really necessary, or was it added in response
5137     dnl to never having started Visual Studio on a given machine, so the
5138     dnl registry keys checked above had presumably not yet been created?
5139     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5140     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5141     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5142     dnl expanding to "C:\Program Files\Common Files"), which would need
5143     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5144     dnl obtain its value from cygwin:
5145     if test -z "$msmdir"; then
5146         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5147         for f in ${my_msm_files}; do
5148             if test -e "$my_msm_dir/${f}"; then
5149                 msmdir=$my_msm_dir
5150             fi
5151         done
5152     fi
5154     dnl Starting from MSVC 15.0, merge modules are located in different directory
5155     if test $VCVER = 150; then
5156         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5157             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])
5158             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5159             for f in ${my_msm_files}; do
5160                 if test -e "$my_msm_dir/${f}"; then
5161                     msmdir=$my_msm_dir
5162                     break
5163                 fi
5164             done
5165         done
5166     fi
5168     if test -n "$msmdir"; then
5169         msmdir=`cygpath -m "$msmdir"`
5170         AC_MSG_RESULT([$msmdir])
5171     else
5172         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5173             AC_MSG_ERROR([not found])
5174         else
5175             AC_MSG_WARN([not found])
5176             add_warning "MSM none of ${my_msm_files} found"
5177         fi
5178     fi
5181 find_msvc_x64_dlls()
5183     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5184     if test "$VCVER" = 150; then
5185         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5186             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT])
5187             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5188                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5189                 break
5190             fi
5191             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5192                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5193                 break
5194             fi
5195         done
5196     fi
5197     msvcdlls="msvcp140.dll vcruntime140.dll"
5198     for dll in $msvcdlls; do
5199         if ! test -f "$msvcdllpath/$dll"; then
5200             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5201         fi
5202     done
5205 dnl =========================================
5206 dnl Check for the Windows  SDK.
5207 dnl =========================================
5208 if test "$_os" = "WINNT"; then
5209     AC_MSG_CHECKING([for Windows SDK])
5210     if test "$build_os" = "cygwin"; then
5211         find_winsdk
5212         WINDOWS_SDK_HOME=$winsdktest
5214         # normalize if found
5215         if test -n "$WINDOWS_SDK_HOME"; then
5216             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5217             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5218         fi
5220         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5221     fi
5223     if test -n "$WINDOWS_SDK_HOME"; then
5224         # Remove a possible trailing backslash
5225         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5227         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5228              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5229              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5230             have_windows_sdk_headers=yes
5231         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5232              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5233              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5234             have_windows_sdk_headers=yes
5235         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5236              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5237              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5238             have_windows_sdk_headers=yes
5239         else
5240             have_windows_sdk_headers=no
5241         fi
5243         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5244             have_windows_sdk_libs=yes
5245         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5246             have_windows_sdk_libs=yes
5247         else
5248             have_windows_sdk_libs=no
5249         fi
5251         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5252             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5253 the  Windows SDK are installed.])
5254         fi
5255     fi
5257     if test -z "$WINDOWS_SDK_HOME"; then
5258         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5259     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
5260         WINDOWS_SDK_VERSION=70
5261         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
5262     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5263         WINDOWS_SDK_VERSION=80
5264         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5265     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5266         WINDOWS_SDK_VERSION=81
5267         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5268     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5269         WINDOWS_SDK_VERSION=10
5270         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5271     else
5272         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5273     fi
5274     PathFormat "$WINDOWS_SDK_HOME"
5275     WINDOWS_SDK_HOME="$formatted_path"
5276     if test "$build_os" = "cygwin"; then
5277         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5278         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5279             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5280         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5281             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5282         fi
5283     fi
5285     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5286     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5287     dnl but not in v8.0), so allow this to be overridden with a
5288     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5289     dnl and configuration error if no WiLangId.vbs is found would arguably be
5290     dnl better, but I do not know under which conditions exactly it is needed by
5291     dnl msiglobal.pm:
5292     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5293         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5294         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5295             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5296         fi
5297         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5298             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5299         fi
5300         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5301             AC_MSG_WARN([WiLangId.vbs not found - building translated packages will fail])
5302             add_warning "WiLangId.vbs not found - building translated packages will fail"
5303         fi
5304     fi
5306 AC_SUBST(WINDOWS_SDK_HOME)
5307 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5308 AC_SUBST(WINDOWS_SDK_VERSION)
5309 AC_SUBST(WINDOWS_SDK_WILANGID)
5311 if test "$build_os" = "cygwin"; then
5312     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5313     dnl dir, it also determines that dir's path w/o an arch segment if any,
5314     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5315     AC_MSG_CHECKING([for midl.exe])
5317     find_winsdk
5318     if test -n "$winsdkbinsubdir" \
5319         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5320     then
5321         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5322         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5323     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5324         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5325         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5326     elif test -f "$winsdktest/Bin/midl.exe"; then
5327         MIDL_PATH=$winsdktest/Bin
5328         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5329     fi
5330     if test ! -f "$MIDL_PATH/midl.exe"; then
5331         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5332     else
5333         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5334     fi
5336     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5337     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5339     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5340          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5341          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5342          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5343     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5344          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5345          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5346          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5347     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5348          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5349          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5350          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5351     else
5352         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5353     fi
5355     dnl Check csc.exe
5356     AC_MSG_CHECKING([for csc.exe])
5357     find_csc
5358     if test -f "$csctest/csc.exe"; then
5359         CSC_PATH="$csctest"
5360     fi
5361     if test ! -f "$CSC_PATH/csc.exe"; then
5362         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5363     else
5364         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5365     fi
5367     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5369     dnl Check al.exe
5370     AC_MSG_CHECKING([for al.exe])
5371     find_winsdk
5372     if test -n "$winsdkbinsubdir" \
5373         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5374     then
5375         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5376     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5377         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5378     elif test -f "$winsdktest/Bin/al.exe"; then
5379         AL_PATH="$winsdktest/Bin"
5380     fi
5382     if test -z "$AL_PATH"; then
5383         find_al
5384         if test -f "$altest/bin/al.exe"; then
5385             AL_PATH="$altest/bin"
5386         elif test -f "$altest/al.exe"; then
5387             AL_PATH="$altest"
5388         fi
5389     fi
5390     if test ! -f "$AL_PATH/al.exe"; then
5391         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5392     else
5393         AC_MSG_RESULT([$AL_PATH/al.exe])
5394     fi
5396     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5398     dnl Check mscoree.lib / .NET Framework dir
5399     AC_MSG_CHECKING(.NET Framework)
5400     find_dotnetsdk
5401     if test -f "$frametest/lib/mscoree.lib"; then
5402         DOTNET_FRAMEWORK_HOME="$frametest"
5403     else
5404         find_winsdk
5405         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5406             DOTNET_FRAMEWORK_HOME="$winsdktest"
5407         else
5408             find_dotnetsdk46
5409             PathFormat "$frametest"
5410             frametest="$formatted_path"
5411             if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5412                  DOTNET_FRAMEWORK_HOME="$frametest"
5413             fi
5414         fi
5415     fi
5417     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
5418         AC_MSG_ERROR([mscoree.lib not found])
5419     fi
5420     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5422     PathFormat "$MIDL_PATH"
5423     MIDL_PATH="$formatted_path"
5425     PathFormat "$AL_PATH"
5426     AL_PATH="$formatted_path"
5428     PathFormat "$DOTNET_FRAMEWORK_HOME"
5429     DOTNET_FRAMEWORK_HOME="$formatted_path"
5431     PathFormat "$CSC_PATH"
5432     CSC_PATH="$formatted_path"
5435 dnl ===================================================================
5436 dnl Check if stdc headers are available excluding MSVC.
5437 dnl ===================================================================
5438 if test "$_os" != "WINNT"; then
5439     AC_HEADER_STDC
5442 dnl ===================================================================
5443 dnl Testing for C++ compiler and version...
5444 dnl ===================================================================
5446 if test "$_os" != "WINNT"; then
5447     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5448     save_CXXFLAGS=$CXXFLAGS
5449     AC_PROG_CXX
5450     CXXFLAGS=$save_CXXFLAGS
5451 else
5452     if test -n "$CC" -a -z "$CXX"; then
5453         CXX="$CC"
5454     fi
5457 dnl At least MSVC 2015 Update 1 is known to sporadically emit warning C4592
5458 dnl ("implementation limitation" when defining OUStringLiteral variables in
5459 dnl vcl/source/app/IconThemeInfo.cxx), while Update 3 is known good, and it is
5460 dnl probably a good idea to require that anyway.  A reliable way to check for
5461 dnl MSVC 2015 Update 3 appears to be to check for support of C++17 nested
5462 dnl namespace definitions (which requires /std:c++latest to be enabled):
5463 if test "$COM" = MSC -a "$VCVER" = 140; then
5464     AC_MSG_CHECKING([whether MSVC 2015 compiler $MSVC_CXX is at least Update 3])
5465     save_CXX=$CXX
5466     save_CXXFLAGS=$CXXFLAGS
5467     CXX=$MSVC_CXX
5468     CXXFLAGS="$CXXFLAGS /std:c++latest"
5469     AC_LANG_PUSH([C++])
5470     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5471         namespace A::B {}
5472     ]])], [good=yes], [good=no])
5473     AC_LANG_POP([C++])
5474     CXX=$save_CXX
5475     CXXFLAGS=$save_CXXFLAGS
5476     AC_MSG_RESULT([$good])
5477     if test "$good" = no; then
5478         AC_MSG_ERROR([When using MSVC 2015, at least Update 3 must be installed])
5479     fi
5482 dnl check for GNU C++ compiler version
5483 if test "$GXX" = "yes"; then
5484     AC_MSG_CHECKING([the GNU C++ compiler version])
5486     _gpp_version=`$CXX -dumpversion`
5487     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5489     if test "$_gpp_majmin" -lt "401"; then
5490         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5491     else
5492         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5493     fi
5495     dnl see https://code.google.com/p/android/issues/detail?id=41770
5496     if test "$_gpp_majmin" -ge "401"; then
5497         glibcxx_threads=no
5498         AC_LANG_PUSH([C++])
5499         AC_REQUIRE_CPP
5500         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5501         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5502             #include <bits/c++config.h>]],[[
5503             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5504             && !defined(_GLIBCXX__PTHREADS) \
5505             && !defined(_GLIBCXX_HAS_GTHREADS)
5506             choke me
5507             #endif
5508         ]])],[AC_MSG_RESULT([yes])
5509         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5510         AC_LANG_POP([C++])
5511         if test $glibcxx_threads = yes; then
5512             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5513         fi
5514      fi
5516 AC_SUBST(BOOST_CXXFLAGS)
5519 # prefx CXX with ccache if needed
5521 if test "$CCACHE" != ""; then
5522     AC_MSG_CHECKING([whether $CXX is already ccached])
5523     AC_LANG_PUSH([C++])
5524     save_CXXFLAGS=$CXXFLAGS
5525     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5526     dnl an empty program will do, we're checking the compiler flags
5527     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5528                       [use_ccache=yes], [use_ccache=no])
5529     if test $use_ccache = yes; then
5530         AC_MSG_RESULT([yes])
5531     else
5532         CXX="$CCACHE $CXX"
5533         AC_MSG_RESULT([no])
5534     fi
5535     CXXFLAGS=$save_CXXFLAGS
5536     AC_LANG_POP([C++])
5539 dnl ===================================================================
5540 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5541 dnl ===================================================================
5543 if test "$_os" != "WINNT"; then
5544     AC_PROG_CXXCPP
5546     dnl Check whether there's a C pre-processor.
5547     AC_PROG_CPP
5551 dnl ===================================================================
5552 dnl Find integral type sizes and alignments
5553 dnl ===================================================================
5555 if test "$_os" != "WINNT"; then
5557 if test "$_os" == "iOS"; then
5558     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5559     ac_cv_sizeof_long=8
5560     ac_cv_sizeof_short=2
5561     ac_cv_sizeof_int=4
5562     ac_cv_sizeof_long_long=8
5563     ac_cv_sizeof_double=8
5564     ac_cv_sizeof_voidp=8
5565 else
5566     AC_CHECK_SIZEOF(long)
5567     AC_CHECK_SIZEOF(short)
5568     AC_CHECK_SIZEOF(int)
5569     AC_CHECK_SIZEOF(long long)
5570     AC_CHECK_SIZEOF(double)
5571     AC_CHECK_SIZEOF(void*)
5574     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5575     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5576     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5577     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5578     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5580     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5581     m4_pattern_allow([AC_CHECK_ALIGNOF])
5582     m4_ifdef([AC_CHECK_ALIGNOF],
5583         [
5584             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5585             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5586             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5587             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5588         ],
5589         [
5590             case "$_os-$host_cpu" in
5591             Linux-i686)
5592                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5593                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5594                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5595                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5596                 ;;
5597             Linux-x86_64)
5598                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5599                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5600                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5601                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5602                 ;;
5603             *)
5604                 if test -z "$ac_cv_alignof_short" -o \
5605                         -z "$ac_cv_alignof_int" -o \
5606                         -z "$ac_cv_alignof_long" -o \
5607                         -z "$ac_cv_alignof_double"; then
5608                    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.])
5609                 fi
5610                 ;;
5611             esac
5612         ])
5614     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5615     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5616     if test $ac_cv_sizeof_long -eq 8; then
5617         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5618     elif test $ac_cv_sizeof_double -eq 8; then
5619         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5620     else
5621         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5622     fi
5624     dnl Check for large file support
5625     AC_SYS_LARGEFILE
5626     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5627         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5628     fi
5629     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5630         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5631     fi
5632 else
5633     # Hardcode for MSVC
5634     SAL_TYPES_SIZEOFSHORT=2
5635     SAL_TYPES_SIZEOFINT=4
5636     SAL_TYPES_SIZEOFLONG=4
5637     SAL_TYPES_SIZEOFLONGLONG=8
5638     if test "$BITNESS_OVERRIDE" = ""; then
5639         SAL_TYPES_SIZEOFPOINTER=4
5640     else
5641         SAL_TYPES_SIZEOFPOINTER=8
5642     fi
5643     SAL_TYPES_ALIGNMENT2=2
5644     SAL_TYPES_ALIGNMENT4=4
5645     SAL_TYPES_ALIGNMENT8=8
5646     LFS_CFLAGS=''
5648 AC_SUBST(LFS_CFLAGS)
5650 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5651 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5652 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5653 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5654 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5655 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5656 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5657 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5659 dnl ===================================================================
5660 dnl Check whether to enable runtime optimizations
5661 dnl ===================================================================
5662 ENABLE_RUNTIME_OPTIMIZATIONS=
5663 AC_MSG_CHECKING([whether to enable runtime optimizations])
5664 if test -z "$enable_runtime_optimizations"; then
5665     for i in $CC; do
5666         case $i in
5667         -fsanitize=*)
5668             enable_runtime_optimizations=no
5669             break
5670             ;;
5671         esac
5672     done
5674 if test "$enable_runtime_optimizations" != no; then
5675     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5676     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5677     AC_MSG_RESULT([yes])
5678 else
5679     AC_MSG_RESULT([no])
5681 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5683 dnl ===================================================================
5684 dnl Check if valgrind headers are available
5685 dnl ===================================================================
5686 ENABLE_VALGRIND=
5687 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
5688     prev_cppflags=$CPPFLAGS
5689     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5690     # or where does it come from?
5691     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5692     AC_CHECK_HEADER([valgrind/valgrind.h],
5693         [ENABLE_VALGRIND=TRUE])
5694     CPPFLAGS=$prev_cppflags
5696 AC_SUBST([ENABLE_VALGRIND])
5697 if test -z "$ENABLE_VALGRIND"; then
5698     if test "$with_valgrind" = yes; then
5699         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
5700     fi
5701     VALGRIND_CFLAGS=
5703 AC_SUBST([VALGRIND_CFLAGS])
5706 dnl ===================================================================
5707 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5708 dnl ===================================================================
5710 # We need at least the sys/sdt.h include header.
5711 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5712 if test "$SDT_H_FOUND" = "TRUE"; then
5713     # Found sys/sdt.h header, now make sure the c++ compiler works.
5714     # Old g++ versions had problems with probes in constructors/destructors.
5715     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5716     AC_LANG_PUSH([C++])
5717     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5718     #include <sys/sdt.h>
5719     class ProbeClass
5720     {
5721     private:
5722       int& ref;
5723       const char *name;
5725     public:
5726       ProbeClass(int& v, const char *n) : ref(v), name(n)
5727       {
5728         DTRACE_PROBE2(_test_, cons, name, ref);
5729       }
5731       void method(int min)
5732       {
5733         DTRACE_PROBE3(_test_, meth, name, ref, min);
5734         ref -= min;
5735       }
5737       ~ProbeClass()
5738       {
5739         DTRACE_PROBE2(_test_, dest, name, ref);
5740       }
5741     };
5742     ]],[[
5743     int i = 64;
5744     DTRACE_PROBE1(_test_, call, i);
5745     ProbeClass inst = ProbeClass(i, "call");
5746     inst.method(24);
5747     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5748           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5749     AC_LANG_POP([C++])
5751 AC_CONFIG_HEADERS([config_host/config_probes.h])
5753 dnl ===================================================================
5754 dnl GCC features
5755 dnl ===================================================================
5756 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
5757     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5758     save_CFLAGS=$CFLAGS
5759     CFLAGS="$CFLAGS -Werror -mno-avx"
5760     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5761     CFLAGS=$save_CFLAGS
5762     if test "$HAVE_GCC_AVX" = "TRUE"; then
5763         AC_MSG_RESULT([yes])
5764     else
5765         AC_MSG_RESULT([no])
5766     fi
5768     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5769     save_CFLAGS=$CFLAGS
5770     CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
5771     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5772     CFLAGS=$save_CFLAGS
5773     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5774         AC_MSG_RESULT([yes])
5775     else
5776         AC_MSG_RESULT([no])
5777     fi
5779     AC_MSG_CHECKING([whether $CC supports atomic functions])
5780     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5781     int v = 0;
5782     if (__sync_add_and_fetch(&v, 1) != 1 ||
5783         __sync_sub_and_fetch(&v, 1) != 0)
5784         return 1;
5785     __sync_synchronize();
5786     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5787         v != 1)
5788         return 1;
5789     return 0;
5790 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5791     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5792         AC_MSG_RESULT([yes])
5793         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5794     else
5795         AC_MSG_RESULT([no])
5796     fi
5798     AC_MSG_CHECKING([whether $CC supports __builtin_ffs])
5799     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
5800     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
5801         AC_MSG_RESULT([yes])
5802         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
5803     else
5804         AC_MSG_RESULT([no])
5805     fi
5807     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5808     save_CFLAGS=$CFLAGS
5809     CFLAGS="$CFLAGS -Werror"
5810     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5811             __attribute__((deprecated("test"))) void f();
5812         ])], [
5813             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5814             AC_MSG_RESULT([yes])
5815         ], [AC_MSG_RESULT([no])])
5816     CFLAGS=$save_CFLAGS
5818     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
5819     AC_LANG_PUSH([C++])
5820     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5821             #include <cstddef>
5822             #include <cxxabi.h>
5823             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
5824         ])], [
5825             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
5826             AC_MSG_RESULT([yes])
5827         ], [AC_MSG_RESULT([no])])
5828     AC_LANG_POP([C++])
5830     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
5831     AC_LANG_PUSH([C++])
5832     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5833             #include <cstddef>
5834             #include <cxxabi.h>
5835             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
5836         ])], [
5837             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
5838             AC_MSG_RESULT([yes])
5839         ], [AC_MSG_RESULT([no])])
5840     AC_LANG_POP([C++])
5842     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
5843     AC_LANG_PUSH([C++])
5844     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5845             #include <cxxabi.h>
5846             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
5847         ])], [
5848             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
5849             AC_MSG_RESULT([yes])
5850         ], [AC_MSG_RESULT([no])])
5851     AC_LANG_POP([C++])
5853     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
5854     AC_LANG_PUSH([C++])
5855     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5856             #include <cstddef>
5857             #include <cxxabi.h>
5858             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
5859         ])], [
5860             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
5861             AC_MSG_RESULT([yes])
5862         ], [AC_MSG_RESULT([no])])
5863     AC_LANG_POP([C++])
5865     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
5866     AC_LANG_PUSH([C++])
5867     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5868             #include <cstddef>
5869             #include <cxxabi.h>
5870             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
5871         ])], [
5872             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
5873             AC_MSG_RESULT([yes])
5874         ], [AC_MSG_RESULT([no])])
5875     AC_LANG_POP([C++])
5877     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
5878     AC_LANG_PUSH([C++])
5879     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5880             #include <cxxabi.h>
5881             void * f() { return __cxxabiv1::__cxa_get_globals(); }
5882         ])], [
5883             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
5884             AC_MSG_RESULT([yes])
5885         ], [AC_MSG_RESULT([no])])
5886     AC_LANG_POP([C++])
5888     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
5889     AC_LANG_PUSH([C++])
5890     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5891             #include <cxxabi.h>
5892             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
5893         ])], [
5894             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
5895             AC_MSG_RESULT([yes])
5896         ], [AC_MSG_RESULT([no])])
5897     AC_LANG_POP([C++])
5899     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
5900     AC_LANG_PUSH([C++])
5901     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5902             #include <cstddef>
5903             #include <cxxabi.h>
5904             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
5905         ])], [
5906             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
5907             AC_MSG_RESULT([yes])
5908         ], [AC_MSG_RESULT([no])])
5909     AC_LANG_POP([C++])
5911     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
5912     AC_LANG_PUSH([C++])
5913     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5914             #include <cstddef>
5915             #include <cxxabi.h>
5916             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
5917         ])], [
5918             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
5919             AC_MSG_RESULT([yes])
5920         ], [AC_MSG_RESULT([no])])
5921     AC_LANG_POP([C++])
5923     dnl Available in GCC 4.9 and at least since Clang 3.4:
5924     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
5925     AC_LANG_PUSH([C++])
5926     save_CXXFLAGS=$CXXFLAGS
5927     CXXFLAGS="$CXXFLAGS -Werror"
5928     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5929             struct __attribute__((warn_unused)) dummy {};
5930         ])], [
5931             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
5932             AC_MSG_RESULT([yes])
5933         ], [AC_MSG_RESULT([no])])
5934     CXXFLAGS=$save_CXXFLAGS
5935 AC_LANG_POP([C++])
5938 AC_SUBST(HAVE_GCC_AVX)
5939 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
5940 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
5941 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
5943 dnl ===================================================================
5944 dnl Identify the C++ library
5945 dnl ===================================================================
5947 AC_MSG_CHECKING([What the C++ library is])
5948 AC_LANG_PUSH([C++])
5949 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5950 #include <utility>
5951 #ifndef __GLIBCXX__
5952 foo bar
5953 #endif
5954 ]])],
5955     [CPP_LIBRARY=GLIBCXX
5956      cpp_library_name="GNU libstdc++"
5957     ],
5958     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5959 #include <utility>
5960 #ifndef _LIBCPP_VERSION
5961 foo bar
5962 #endif
5963 ]])],
5964     [CPP_LIBRARY=LIBCPP
5965      cpp_library_name="LLVM libc++"
5966      AC_DEFINE([HAVE_LIBCXX])
5967     ],
5968     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5969 #include <utility>
5970 #ifndef _MSC_VER
5971 foo bar
5972 #endif
5973 ]])],
5974     [CPP_LIBRARY=MSVCRT
5975      cpp_library_name="Microsoft"
5976     ],
5977     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
5978 AC_MSG_RESULT([$cpp_library_name])
5979 AC_LANG_POP([C++])
5981 dnl ===================================================================
5982 dnl Check for gperf
5983 dnl ===================================================================
5984 AC_PATH_PROG(GPERF, gperf)
5985 if test -z "$GPERF"; then
5986     AC_MSG_ERROR([gperf not found but needed. Install it.])
5988 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5989     GPERF=`cygpath -m $GPERF`
5991 AC_MSG_CHECKING([gperf version])
5992 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
5993     AC_MSG_RESULT([OK])
5994 else
5995     AC_MSG_ERROR([too old, you need at least 3.0.0])
5997 AC_SUBST(GPERF)
5999 dnl ===================================================================
6000 dnl Check for system libcmis
6001 dnl ===================================================================
6002 # libcmis requires curl and we can't build curl for iOS
6003 if test $_os != iOS; then
6004     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.0])
6005     ENABLE_LIBCMIS=TRUE
6006 else
6007     ENABLE_LIBCMIS=
6009 AC_SUBST(ENABLE_LIBCMIS)
6011 dnl ===================================================================
6012 dnl C++11
6013 dnl ===================================================================
6015 my_cxx17switches=
6016 libo_FUZZ_ARG_ENABLE(c++17,
6017     AS_HELP_STRING([--disable-c++17],
6018         [Do not attempt to run GCC/Clang in C++17 mode (needed for Coverity).])
6021 CXXFLAGS_CXX11=
6022 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6023     AC_MSG_CHECKING([whether $CXX supports C++11])
6024     AC_MSG_RESULT(yes)
6025     # MSVC supports (a subset of) CXX11 without any switch
6026 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6027     HAVE_CXX11=
6028     AC_MSG_CHECKING([whether $CXX supports C++17, C++14, or C++11])
6029     dnl But only use C++17 if the gperf that is being used knows not to emit
6030     dnl "register" in C++ output:
6031     printf 'foo\n' | $GPERF -L C++ > conftest.inc
6032     my_flags='-std=gnu++14 -std=gnu++1y -std=c++14 -std=c++1y -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x'
6033     if test "$enable_c__17" != no; then
6034         my_flags="-std=gnu++17 -std=gnu++1z -std=c++17 -std=c++1z $my_flags"
6035     fi
6036     for flag in $my_flags; do
6037         if test "$COM" = MSC; then
6038             flag="-Xclang $flag"
6039         fi
6040         save_CXXFLAGS=$CXXFLAGS
6041         CXXFLAGS="$CXXFLAGS $flag -Werror"
6042         if test "$SYSTEM_LIBCMIS" = TRUE; then
6043             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6044         fi
6045         AC_LANG_PUSH([C++])
6046         dnl Clang 3.9 supports __float128 since
6047         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6048         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6049         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6050         dnl $flag is supported below, so check this first):
6051         my_float128hack=
6052         my_float128hack_impl=-D__float128=void
6053         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6054             #include <vector>
6055             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6056             // (__float128)
6057             ]])
6058         ],,[
6059             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6060             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6061             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6062             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6063             dnl place where __float128 is used is in a template specialization, -D__float128=void
6064             dnl will avoid the problem there while still causing a problem if somebody actually uses
6065             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6066             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6067             dnl "fixed" with this hack):
6068             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6069             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6070                 #include <vector>
6071                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6072                 // (__float128)
6073                 ]])
6074             ],[my_float128hack=$my_float128hack_impl])
6075         ])
6076         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6077             #include <algorithm>
6078             #include <functional>
6079             #include <vector>
6081             #include <string.h>
6082             #pragma GCC diagnostic push
6083             #pragma GCC diagnostic ignored "-Wpragmas"
6084                 // make GCC not warn about next pragma
6085             #pragma GCC diagnostic ignored "-Wdeprecated-register"
6086                 // make Clang with -std < C++17 not even warn about register
6087             #include "conftest.inc"
6088             #pragma GCC diagnostic pop
6090             #if defined SYSTEM_LIBCMIS
6091             // See ucb/source/ucp/cmis/auth_provider.hxx:
6092             #if __GNUC__ >= 7
6093             #pragma GCC diagnostic push
6094             #pragma GCC diagnostic ignored "-Wdeprecated"
6095             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6096             #endif
6097             #include <libcmis/libcmis.hxx>
6098             #if __GNUC__ >= 7
6099             #pragma GCC diagnostic pop
6100             #endif
6101             #endif
6103             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6104                 std::sort(v.begin(), v.end(), fn);
6105             }
6106             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6107         AC_LANG_POP([C++])
6108         CXXFLAGS=$save_CXXFLAGS
6109         if test -n "$CXXFLAGS_CXX11"; then
6110             HAVE_CXX11=TRUE
6111             break
6112         fi
6113     done
6114     rm conftest.inc
6115     if test "$HAVE_CXX11" = TRUE; then
6116         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6117     else
6118         AC_MSG_ERROR(no)
6119     fi
6121 AC_SUBST(CXXFLAGS_CXX11)
6123 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6124 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6125 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6126 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6127 dnl again towards 4.7.2:
6128 if test $CPP_LIBRARY = GLIBCXX; then
6129     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6130     AC_LANG_PUSH([C++])
6131     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6132 #include <list>
6133 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6134     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6135     //   GCC 4.7.0: 20120322
6136     //   GCC 4.7.1: 20120614
6137     // and using a range check is not possible as the mapping between
6138     // __GLIBCXX__ values and GCC versions is not monotonic
6139 /* ok */
6140 #else
6141 abi broken
6142 #endif
6143         ]])], [AC_MSG_RESULT(no, ok)],
6144         [AC_MSG_ERROR(yes)])
6145     AC_LANG_POP([C++])
6148 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6149 save_CXXFLAGS=$CXXFLAGS
6150 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6151 AC_LANG_PUSH([C++])
6153 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6154 #include <stddef.h>
6156 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6158 namespace
6160         struct b
6161         {
6162                 int i;
6163                 int j;
6164         };
6166 ]], [[
6167 struct a
6169         int i;
6170         int j;
6172 a thinga[]={{0,0}, {1,1}};
6173 b thingb[]={{0,0}, {1,1}};
6174 size_t i = sizeof(sal_n_array_size(thinga));
6175 size_t j = sizeof(sal_n_array_size(thingb));
6176 return !(i != 0 && j != 0);
6178     ], [ AC_MSG_RESULT(yes) ],
6179     [ AC_MSG_ERROR(no)])
6180 AC_LANG_POP([C++])
6181 CXXFLAGS=$save_CXXFLAGS
6183 AC_MSG_CHECKING([whether $CXX supports C++14 constexpr])
6184 save_CXXFLAGS=$CXXFLAGS
6185 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6186 AC_LANG_PUSH([C++])
6187 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6188     // A somewhat over-complicated way of checking for
6189     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6190     // in constexpr function":
6191     #include <cassert>
6192     template<typename T> inline constexpr T f(T x) { return x; }
6193     template<typename T> inline constexpr T g(T x) {
6194         assert(f(static_cast<int>(x)));
6195         return x;
6196     }
6197     enum E { e };
6198     auto v = g(E::e);
6200     struct S {
6201         int n_;
6202         constexpr bool f() {
6203             int n = n_;
6204             int i = 0;
6205             while (n > 0) { --n; ++i; }
6206             assert(i >= 0);
6207             return i == 0;
6208         }
6209     };
6210     constexpr auto v2 = S{10}.f();
6211     ]])], [cxx14_constexpr=yes], [cxx14_constexpr=no])
6212 AC_LANG_POP([C++])
6213 CXXFLAGS=$save_CXXFLAGS
6214 AC_MSG_RESULT([$cxx14_constexpr])
6215 if test "$cxx14_constexpr" = yes; then
6216     AC_DEFINE([HAVE_CXX14_CONSTEXPR])
6219 dnl _Pragma support (may require C++11)
6220 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6221     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6222     AC_LANG_PUSH([C++])
6223     save_CXXFLAGS=$CXXFLAGS
6224     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6225     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6226             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6227         ])], [
6228             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6229             AC_MSG_RESULT([yes])
6230         ], [AC_MSG_RESULT([no])])
6231     AC_LANG_POP([C++])
6232     CXXFLAGS=$save_CXXFLAGS
6235 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6236 if test "$GCC" = yes; then
6237     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6238     AC_LANG_PUSH([C++])
6239     save_CXXFLAGS=$CXXFLAGS
6240     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6241     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6242     CXXFLAGS=$save_CXXFLAGS
6243     AC_LANG_POP([C++])
6244     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6245         AC_MSG_RESULT([yes])
6246     else
6247         AC_MSG_RESULT([no])
6248     fi
6250 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6252 dnl ===================================================================
6253 dnl system stl sanity tests
6254 dnl ===================================================================
6255 if test "$_os" != "WINNT"; then
6257     AC_LANG_PUSH([C++])
6259     save_CPPFLAGS="$CPPFLAGS"
6260     if test -n "$MACOSX_SDK_PATH"; then
6261         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6262     fi
6264     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6265     # only.
6266     if test "$CPP_LIBRARY" = GLIBCXX; then
6267         dnl gcc#19664, gcc#22482, rhbz#162935
6268         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6269         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6270         AC_MSG_RESULT([$stlvisok])
6271         if test "$stlvisok" = "no"; then
6272             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6273         fi
6274     fi
6276     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6277     # when we don't make any dynamic libraries?
6278     if test "$DISABLE_DYNLOADING" = ""; then
6279         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6280         cat > conftestlib1.cc <<_ACEOF
6281 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6282 struct S2: S1<int> { virtual ~S2(); };
6283 S2::~S2() {}
6284 _ACEOF
6285         cat > conftestlib2.cc <<_ACEOF
6286 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6287 struct S2: S1<int> { virtual ~S2(); };
6288 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6289 _ACEOF
6290         gccvisinlineshiddenok=yes
6291         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6292             gccvisinlineshiddenok=no
6293         else
6294             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6295             dnl known to not work with -z defs (unsetting which makes the test
6296             dnl moot, though):
6297             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6298             if test "$COM_IS_CLANG" = TRUE; then
6299                 for i in $CXX $CXXFLAGS; do
6300                     case $i in
6301                     -fsanitize=*)
6302                         my_linkflagsnoundefs=
6303                         break
6304                         ;;
6305                     esac
6306                 done
6307             fi
6308             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6309                 gccvisinlineshiddenok=no
6310             fi
6311         fi
6313         rm -fr libconftest*
6314         AC_MSG_RESULT([$gccvisinlineshiddenok])
6315         if test "$gccvisinlineshiddenok" = "no"; then
6316             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6317         fi
6318     fi
6320    AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6321     cat >visibility.cxx <<_ACEOF
6322 #pragma GCC visibility push(hidden)
6323 struct __attribute__ ((visibility ("default"))) TestStruct {
6324   static void Init();
6326 __attribute__ ((visibility ("default"))) void TestFunc() {
6327   TestStruct::Init();
6329 _ACEOF
6330     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6331         gccvisbroken=yes
6332     else
6333         case "$host_cpu" in
6334         i?86|x86_64)
6335             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6336                 gccvisbroken=no
6337             else
6338                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6339                     gccvisbroken=no
6340                 else
6341                     gccvisbroken=yes
6342                 fi
6343             fi
6344             ;;
6345         *)
6346             gccvisbroken=no
6347             ;;
6348         esac
6349     fi
6350     rm -f visibility.s visibility.cxx
6352     AC_MSG_RESULT([$gccvisbroken])
6353     if test "$gccvisbroken" = "yes"; then
6354         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6355     fi
6357     CPPFLAGS="$save_CPPFLAGS"
6359     AC_LANG_POP([C++])
6362 dnl ===================================================================
6363 dnl  Clang++ tests
6364 dnl ===================================================================
6366 HAVE_GCC_FNO_DEFAULT_INLINE=
6367 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6368 if test "$GCC" = "yes"; then
6369     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6370     AC_LANG_PUSH([C++])
6371     save_CXXFLAGS=$CXXFLAGS
6372     CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6373     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6374     CXXFLAGS=$save_CXXFLAGS
6375     AC_LANG_POP([C++])
6376     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6377         AC_MSG_RESULT([yes])
6378     else
6379         AC_MSG_RESULT([no])
6380     fi
6382     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6383     AC_LANG_PUSH([C++])
6384     save_CXXFLAGS=$CXXFLAGS
6385     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6386     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6387     CXXFLAGS=$save_CXXFLAGS
6388     AC_LANG_POP([C++])
6389     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6390         AC_MSG_RESULT([yes])
6391     else
6392         AC_MSG_RESULT([no])
6393     fi
6395 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6396 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6398 dnl ===================================================================
6399 dnl Compiler plugins
6400 dnl ===================================================================
6402 COMPILER_PLUGINS=
6403 # currently only Clang
6405 if test "$COM_IS_CLANG" != "TRUE"; then
6406     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6407         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6408         enable_compiler_plugins=no
6409     fi
6412 if test "$COM_IS_CLANG" = "TRUE"; then
6413     if test -n "$enable_compiler_plugins"; then
6414         compiler_plugins="$enable_compiler_plugins"
6415     elif test -n "$ENABLE_DBGUTIL"; then
6416         compiler_plugins=test
6417     else
6418         compiler_plugins=no
6419     fi
6420     if test "$compiler_plugins" != no -a "$CLANGVER" -lt 30800; then
6421         if test "$compiler_plugins" = yes; then
6422             AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 3.8.0.])
6423         else
6424             compiler_plugins=no
6425         fi
6426     fi
6427     if test "$compiler_plugins" != "no"; then
6428         dnl The prefix where Clang resides, override to where Clang resides if
6429         dnl using a source build:
6430         if test -z "$CLANGDIR"; then
6431             CLANGDIR=/usr
6432         fi
6433         AC_LANG_PUSH([C++])
6434         save_CPPFLAGS=$CPPFLAGS
6435         save_CXX=$CXX
6436         # compiler plugins must be built with "native" compiler that was used to build Clang itself:
6437         : "${COMPILER_PLUGINS_CXX=g++}"
6438         CXX=$COMPILER_PLUGINS_CXX
6439         CPPFLAGS="$CPPFLAGS -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6440         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6441             [COMPILER_PLUGINS=TRUE],
6442             [
6443             if test "$compiler_plugins" = "yes"; then
6444                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6445             else
6446                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6447                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6448             fi
6449             ])
6450         CXX=$save_CXX
6451         CPPFLAGS=$save_CPPFLAGS
6452         AC_LANG_POP([C++])
6453     fi
6454 else
6455     if test "$enable_compiler_plugins" = "yes"; then
6456         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6457     fi
6459 AC_SUBST(COMPILER_PLUGINS)
6460 AC_SUBST(COMPILER_PLUGINS_CXX)
6461 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
6462 AC_SUBST(COMPILER_PLUGINS_DEBUG)
6463 AC_SUBST(CLANGDIR)
6464 AC_SUBST(CLANGLIBDIR)
6466 # Plugin to help linker.
6467 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6468 # This makes --enable-lto build with clang work.
6469 AC_SUBST(LD_PLUGIN)
6471 dnl ===================================================================
6472 dnl allocator
6473 dnl ===================================================================
6474 AC_MSG_CHECKING([which memory allocator to use])
6475 if test "$with_alloc" = "system"; then
6476     AC_MSG_RESULT([system])
6477     ALLOC="SYS_ALLOC"
6479 if test "$with_alloc" = "tcmalloc"; then
6480     AC_MSG_RESULT(tcmalloc)
6481     if ! echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6482         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
6483     fi
6484     AC_CHECK_LIB([tcmalloc], [malloc], [:],
6485         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
6486     ALLOC="TCMALLOC"
6488 if test "$with_alloc" = "jemalloc"; then
6489     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
6490         AC_MSG_RESULT(jemalloc)
6491         save_CFLAGS=$CFLAGS
6492         CFLAGS="$CFLAGS -pthread"
6493         AC_CHECK_LIB([jemalloc], [malloc], [:],
6494             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
6495         ALLOC="JEMALLOC"
6496         CFLAGS=$save_CFLAGS
6497     else
6498         AC_MSG_RESULT([system])
6499         ALLOC="SYS_ALLOC"
6500     fi
6502 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6503     AC_MSG_RESULT([internal])
6505 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6506 AC_SUBST(HAVE_POSIX_FALLOCATE)
6507 AC_SUBST(ALLOC)
6509 dnl ===================================================================
6510 dnl Custom build version
6511 dnl ===================================================================
6513 AC_MSG_CHECKING([whether to add custom build version])
6514 if test "$with_build_version" != ""; then
6515     BUILD_VER_STRING=$with_build_version
6516     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6517 else
6518     BUILD_VER_STRING=
6519     AC_MSG_RESULT([no])
6521 AC_SUBST(BUILD_VER_STRING)
6523 JITC_PROCESSOR_TYPE=""
6524 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6525     # IBMs JDK needs this...
6526     JITC_PROCESSOR_TYPE=6
6527     export JITC_PROCESSOR_TYPE
6529 AC_SUBST([JITC_PROCESSOR_TYPE])
6531 # Misc Windows Stuff
6532 AC_ARG_WITH(vcredist-dir,
6533     AS_HELP_STRING([--with-vcredist-dir],
6534         [path to the directory with the arch-specific executables (vc_redist.x64.exe, vc_redist.x86.exe)
6535         for packaging into the installsets (without those the target system needs to install
6536         the Visual C++ Runtimes manually)]),
6538 VCREDIST_DIR="$with_vcredist_dir"
6539 if test $_os = "WINNT"; then
6540     find_msvc_x64_dlls
6541     find_msms
6542     MSVC_DLL_PATH="$msvcdllpath"
6543     MSVC_DLLS="$msvcdlls"
6544     MSM_PATH="$msmdir"
6545     SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6546     if test "$VCREDIST_DIR" = "no"; then
6547         dnl explicitly disabled
6548         VCREDIST_DIR=""
6549     else
6550         if test -f "$VCREDIST_DIR/vc_redist.$WINDOWS_SDK_ARCH.exe"; then
6551             VCREDIST_EXE="vc_redist.$WINDOWS_SDK_ARCH.exe"
6552         else
6553             VCREDIST_DIR=""
6554             if test -n "$PKGFORMAT"; then
6555                for i in "$PKGFORMAT"; do
6556                    case "$i" in
6557                    msi)
6558                        AC_MSG_WARN([--without-vcredist-dir not specified or exe not found - installer will have runtime dependency])
6559                        add_warning "--without-vcredist-dir not specified or exe not found - installer will have runtime dependency"
6560                        ;;
6561                    esac
6562                done
6563             fi
6564         fi
6565     fi
6568 AC_SUBST(VCREDIST_DIR)
6569 AC_SUBST(VCREDIST_EXE)
6570 AC_SUBST(MSVC_DLL_PATH)
6571 AC_SUBST(MSVC_DLLS)
6572 AC_SUBST(MSM_PATH)
6574 dnl ===================================================================
6575 dnl Checks for Java
6576 dnl ===================================================================
6577 if test "$ENABLE_JAVA" != ""; then
6579     # Windows-specific tests
6580     if test "$build_os" = "cygwin"; then
6581         if test "$BITNESS_OVERRIDE" = 64; then
6582             bitness=64
6583         else
6584             bitness=32
6585         fi
6587         if test -z "$with_jdk_home"; then
6588             for ver in 1.8 1.7 1.6; do
6589                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6590                 if test -n "$regvalue"; then
6591                     _jdk_home=$regvalue
6592                     break
6593                 fi
6594             done
6595             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6596                 with_jdk_home="$_jdk_home"
6597                 howfound="found automatically"
6598             else
6599                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6600             fi
6601         else
6602             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6603             howfound="you passed"
6604         fi
6605     fi
6607     # 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.
6608     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6609     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6610         with_jdk_home=`/usr/libexec/java_home`
6611     fi
6613     JAVA_HOME=; export JAVA_HOME
6614     if test -z "$with_jdk_home"; then
6615         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6616     else
6617         _java_path="$with_jdk_home/bin/$with_java"
6618         dnl Check if there is a Java interpreter at all.
6619         if test -x "$_java_path"; then
6620             JAVAINTERPRETER=$_java_path
6621         else
6622             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6623         fi
6624     fi
6626     dnl Check that the JDK found is correct architecture (at least 2 reasons to
6627     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
6628     dnl loaded by java to run JunitTests:
6629     if test "$build_os" = "cygwin"; then
6630         shortjdkhome=`cygpath -d "$with_jdk_home"`
6631         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
6632             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6633             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6634         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
6635             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6636             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6637         fi
6639         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6640             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6641         fi
6642         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6643     elif test "$cross_compiling" != "yes"; then
6644         case $CPUNAME in
6645             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
6646                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6647                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6648                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6649                 fi
6650                 ;;
6651             *) # assumption: everything else 32-bit
6652                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6653                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6654                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6655                 fi
6656                 ;;
6657         esac
6658     fi
6661 HAVE_JAVA9=
6662 dnl ===================================================================
6663 dnl Checks for JDK.
6664 dnl ===================================================================
6666 # Note that JAVA_HOME as for now always means the *build* platform's
6667 # JAVA_HOME. Whether all the complexity here actually is needed any
6668 # more or not, no idea.
6670 if test "$ENABLE_JAVA" != ""; then
6671     _gij_longver=0
6672     AC_MSG_CHECKING([the installed JDK])
6673     if test -n "$JAVAINTERPRETER"; then
6674         dnl java -version sends output to stderr!
6675         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6676             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6677         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6678             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6679         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6680             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6681         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6682             JDK=ibm
6684             dnl IBM JDK specific tests
6685             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6686             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6688             if test "$_jdk_ver" -lt 10600; then
6689                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
6690             fi
6692             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6694             if test "$with_jdk_home" = ""; then
6695                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6696 you must use the "--with-jdk-home" configure option explicitly])
6697             fi
6699             JAVA_HOME=$with_jdk_home
6700         else
6701             JDK=sun
6703             dnl Sun JDK specific tests
6704             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6705             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6707             if test "$_jdk_ver" -lt 10600; then
6708                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
6709             fi
6710             if test "$_jdk_ver" -gt 10600; then
6711                 JAVA_CLASSPATH_NOT_SET=TRUE
6712             fi
6713             if test "$_jdk_ver" -ge 10900; then
6714                 HAVE_JAVA9=TRUE
6715             fi
6717             AC_MSG_RESULT([checked (JDK $_jdk)])
6718             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6719             if test "$_os" = "WINNT"; then
6720                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6721             fi
6723             # set to limit VM usage for JunitTests
6724             JAVAIFLAGS=-Xmx64M
6725             # set to limit VM usage for javac
6726             JAVAFLAGS=-J-Xmx128M
6727         fi
6728     else
6729         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
6730     fi
6731 else
6732     dnl Java disabled
6733     JAVA_HOME=
6734     export JAVA_HOME
6737 dnl ===================================================================
6738 dnl Set target Java bytecode version
6739 dnl ===================================================================
6740 if test "$ENABLE_JAVA" != ""; then
6741     if test "$HAVE_JAVA9" = "TRUE"; then
6742         _java_target_ver="1.6"
6743     else
6744         _java_target_ver="1.5"
6745     fi
6746     JAVA_SOURCE_VER="$_java_target_ver"
6747     JAVA_TARGET_VER="$_java_target_ver"
6750 dnl ===================================================================
6751 dnl Checks for javac
6752 dnl ===================================================================
6753 if test "$ENABLE_JAVA" != ""; then
6754     javacompiler="javac"
6755     if test -z "$with_jdk_home"; then
6756         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6757     else
6758         _javac_path="$with_jdk_home/bin/$javacompiler"
6759         dnl Check if there is a Java compiler at all.
6760         if test -x "$_javac_path"; then
6761             JAVACOMPILER=$_javac_path
6762         fi
6763     fi
6764     if test -z "$JAVACOMPILER"; then
6765         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6766     fi
6767     if test "$build_os" = "cygwin"; then
6768         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6769             JAVACOMPILER="${JAVACOMPILER}.exe"
6770         fi
6771         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
6772     fi
6775 dnl ===================================================================
6776 dnl Checks for javadoc
6777 dnl ===================================================================
6778 if test "$ENABLE_JAVA" != ""; then
6779     if test -z "$with_jdk_home"; then
6780         AC_PATH_PROG(JAVADOC, javadoc)
6781     else
6782         _javadoc_path="$with_jdk_home/bin/javadoc"
6783         dnl Check if there is a javadoc at all.
6784         if test -x "$_javadoc_path"; then
6785             JAVADOC=$_javadoc_path
6786         else
6787             AC_PATH_PROG(JAVADOC, javadoc)
6788         fi
6789     fi
6790     if test -z "$JAVADOC"; then
6791         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6792     fi
6793     if test "$build_os" = "cygwin"; then
6794         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6795             JAVADOC="${JAVADOC}.exe"
6796         fi
6797         JAVADOC=`win_short_path_for_make "$JAVADOC"`
6798     fi
6800     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6801     JAVADOCISGJDOC="yes"
6802     fi
6804 AC_SUBST(JAVADOCISGJDOC)
6806 if test "$ENABLE_JAVA" != ""; then
6807     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
6808     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
6809         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
6810            # try to recover first by looking whether we have a alternatives
6811            # system as in Debian or newer SuSEs where following /usr/bin/javac
6812            # over /etc/alternatives/javac leads to the right bindir where we
6813            # just need to strip a bit away to get a valid JAVA_HOME
6814            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
6815         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
6816             # maybe only one level of symlink (e.g. on Mac)
6817             JAVA_HOME=$(readlink $JAVACOMPILER)
6818             if test "$(dirname $JAVA_HOME)" = "."; then
6819                 # we've got no path to trim back
6820                 JAVA_HOME=""
6821             fi
6822         else
6823             # else warn
6824             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
6825             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
6826             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
6827             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
6828         fi
6829         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
6830         if test "$JAVA_HOME" != "/usr"; then
6831             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6832                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
6833                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
6834                 dnl Tiger already returns a JDK path..
6835                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
6836             else
6837                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
6838                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
6839                 dnl that checks which version to run
6840                 if test -f "$JAVA_HOME"; then
6841                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
6842                 fi
6843             fi
6844         fi
6845     fi
6846     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
6848     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
6849     if test -z "$JAVA_HOME"; then
6850         if test "x$with_jdk_home" = "x"; then
6851             cat > findhome.java <<_ACEOF
6852 [import java.io.File;
6854 class findhome
6856     public static void main(String args[])
6857     {
6858         String jrelocation = System.getProperty("java.home");
6859         File jre = new File(jrelocation);
6860         System.out.println(jre.getParent());
6861     }
6863 _ACEOF
6864             AC_MSG_CHECKING([if javac works])
6865             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
6866             AC_TRY_EVAL(javac_cmd)
6867             if test $? = 0 -a -f ./findhome.class; then
6868                 AC_MSG_RESULT([javac works])
6869             else
6870                 echo "configure: javac test failed" >&5
6871                 cat findhome.java >&5
6872                 AC_MSG_ERROR([javac does not work - java projects will not build!])
6873             fi
6874             AC_MSG_CHECKING([if gij knows its java.home])
6875             JAVA_HOME=`$JAVAINTERPRETER findhome`
6876             if test $? = 0 -a "$JAVA_HOME" != ""; then
6877                 AC_MSG_RESULT([$JAVA_HOME])
6878             else
6879                 echo "configure: java test failed" >&5
6880                 cat findhome.java >&5
6881                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
6882             fi
6883             # clean-up after ourselves
6884             rm -f ./findhome.java ./findhome.class
6885         else
6886             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
6887         fi
6888     fi
6890     # now check if $JAVA_HOME is really valid
6891     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6892         case "${JAVA_HOME}" in
6893             /Library/Java/JavaVirtualMachines/*)
6894                 ;;
6895             *)
6896                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
6897                 ;;
6898         esac
6899         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
6900             JAVA_HOME_OK="NO"
6901         fi
6902     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
6903         JAVA_HOME_OK="NO"
6904     fi
6905     if test "$JAVA_HOME_OK" = "NO"; then
6906         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
6907         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
6908         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
6909         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
6910         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
6911         add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
6912     fi
6913     PathFormat "$JAVA_HOME"
6914     JAVA_HOME="$formatted_path"
6917 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
6918     "$_os" != Darwin
6919 then
6920     AC_MSG_CHECKING([for JAWT lib])
6921     if test "$_os" = WINNT; then
6922         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
6923         JAWTLIB=jawt.lib
6924     else
6925         case "$host_cpu" in
6926         arm*)
6927             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
6928             JAVA_ARCH=$my_java_arch
6929             ;;
6930         i*86)
6931             my_java_arch=i386
6932             ;;
6933         m68k)
6934             my_java_arch=m68k
6935             ;;
6936         powerpc)
6937             my_java_arch=ppc
6938             ;;
6939         powerpc64)
6940             my_java_arch=ppc64
6941             ;;
6942         powerpc64le)
6943             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
6944             JAVA_ARCH=$my_java_arch
6945             ;;
6946         sparc64)
6947             my_java_arch=sparcv9
6948             ;;
6949         x86_64)
6950             my_java_arch=amd64
6951             ;;
6952         *)
6953             my_java_arch=$host_cpu
6954             ;;
6955         esac
6956         # This is where JDK9 puts the library
6957         if test -e "$JAVA_HOME/lib/libjawt.so"; then
6958             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
6959         else
6960             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
6961         fi
6962         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
6963     fi
6964     AC_MSG_RESULT([$JAWTLIB])
6966 AC_SUBST(JAWTLIB)
6968 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
6969     case "$host_os" in
6971     aix*)
6972         JAVAINC="-I$JAVA_HOME/include"
6973         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
6974         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6975         ;;
6977     cygwin*)
6978         JAVAINC="-I$JAVA_HOME/include/win32"
6979         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
6980         ;;
6982     darwin*)
6983         if test -d "$JAVA_HOME/include/darwin"; then
6984             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
6985         else
6986             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
6987         fi
6988         ;;
6990     dragonfly*)
6991         JAVAINC="-I$JAVA_HOME/include"
6992         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6993         ;;
6995     freebsd*)
6996         JAVAINC="-I$JAVA_HOME/include"
6997         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
6998         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
6999         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7000         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7001         ;;
7003     k*bsd*-gnu*)
7004         JAVAINC="-I$JAVA_HOME/include"
7005         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7006         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7007         ;;
7009     linux-gnu*)
7010         JAVAINC="-I$JAVA_HOME/include"
7011         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7012         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7013         ;;
7015     *netbsd*)
7016         JAVAINC="-I$JAVA_HOME/include"
7017         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7018         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7019        ;;
7021     openbsd*)
7022         JAVAINC="-I$JAVA_HOME/include"
7023         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7024         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7025         ;;
7027     solaris*)
7028         JAVAINC="-I$JAVA_HOME/include"
7029         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7030         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7031         ;;
7032     esac
7034 SOLARINC="$SOLARINC $JAVAINC"
7036 AC_SUBST(JAVACOMPILER)
7037 AC_SUBST(JAVADOC)
7038 AC_SUBST(JAVAINTERPRETER)
7039 AC_SUBST(JAVAIFLAGS)
7040 AC_SUBST(JAVAFLAGS)
7041 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7042 AC_SUBST(JAVA_HOME)
7043 AC_SUBST(JAVA_SOURCE_VER)
7044 AC_SUBST(JAVA_TARGET_VER)
7045 AC_SUBST(JDK)
7048 dnl ===================================================================
7049 dnl Export file validation
7050 dnl ===================================================================
7051 AC_MSG_CHECKING([whether to enable export file validation])
7052 if test "$with_export_validation" != "no"; then
7053     if test -z "$ENABLE_JAVA"; then
7054         if test "$with_export_validation" = "yes"; then
7055             AC_MSG_ERROR([requested, but Java is disabled])
7056         else
7057             AC_MSG_RESULT([no, as Java is disabled])
7058         fi
7059     elif test "$_jdk_ver" -lt 10800; then
7060         if test "$with_export_validation" = "yes"; then
7061             AC_MSG_ERROR([requested, but Java is too old, need Java 8])
7062         else
7063             AC_MSG_RESULT([no, as Java is too old, need Java 8])
7064         fi
7065     else
7066         AC_MSG_RESULT([yes])
7067         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7069         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7070         if test -z "$ODFVALIDATOR"; then
7071             # remember to download the ODF toolkit with validator later
7072             AC_MSG_NOTICE([no odfvalidator found, will download it])
7073             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7074             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7076             # and fetch name of odfvalidator jar name from download.lst
7077             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7078             AC_SUBST(ODFVALIDATOR_JAR)
7080             if test -z "$ODFVALIDATOR_JAR"; then
7081                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7082             fi
7083         fi
7084         if test "$build_os" = "cygwin"; then
7085             # In case of Cygwin it will be executed from Windows,
7086             # so we need to run bash and absolute path to validator
7087             # so instead of "odfvalidator" it will be
7088             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7089             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7090         else
7091             ODFVALIDATOR="sh $ODFVALIDATOR"
7092         fi
7093         AC_SUBST(ODFVALIDATOR)
7096         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7097         if test -z "$OFFICEOTRON"; then
7098             # remember to download the officeotron with validator later
7099             AC_MSG_NOTICE([no officeotron found, will download it])
7100             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7101             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7103             # and fetch name of officeotron jar name from download.lst
7104             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7105             AC_SUBST(OFFICEOTRON_JAR)
7107             if test -z "$OFFICEOTRON_JAR"; then
7108                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7109             fi
7110         else
7111             # check version of existing officeotron
7112             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7113             if test 0"$OFFICEOTRON_VER" -lt 704; then
7114                 AC_MSG_ERROR([officeotron too old])
7115             fi
7116         fi
7117         if test "$build_os" = "cygwin"; then
7118             # In case of Cygwin it will be executed from Windows,
7119             # so we need to run bash and absolute path to validator
7120             # so instead of "odfvalidator" it will be
7121             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7122             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7123         else
7124             OFFICEOTRON="sh $OFFICEOTRON"
7125         fi
7126     fi
7127     AC_SUBST(OFFICEOTRON)
7128 else
7129     AC_MSG_RESULT([no])
7132 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7133 if test "$with_bffvalidator" != "no"; then
7134     AC_DEFINE(HAVE_BFFVALIDATOR)
7136     if test "$with_export_validation" = "no"; then
7137         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7138     fi
7140     if test "$with_bffvalidator" = "yes"; then
7141         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7142     else
7143         BFFVALIDATOR="$with_bffvalidator"
7144     fi
7146     if test "$build_os" = "cygwin"; then
7147         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7148             AC_MSG_RESULT($BFFVALIDATOR)
7149         else
7150             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7151         fi
7152     elif test -n "$BFFVALIDATOR"; then
7153         # We are not in Cygwin but need to run Windows binary with wine
7154         AC_PATH_PROGS(WINE, wine)
7156         # so swap in a shell wrapper that converts paths transparently
7157         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7158         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7159         AC_SUBST(BFFVALIDATOR_EXE)
7160         AC_MSG_RESULT($BFFVALIDATOR)
7161     else
7162         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7163     fi
7164     AC_SUBST(BFFVALIDATOR)
7165 else
7166     AC_MSG_RESULT([no])
7169 dnl ===================================================================
7170 dnl Check for C preprocessor to use
7171 dnl ===================================================================
7172 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7173 if test -n "$with_idlc_cpp"; then
7174     AC_MSG_RESULT([$with_idlc_cpp])
7175     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7176 else
7177     AC_MSG_RESULT([ucpp])
7178     AC_MSG_CHECKING([which ucpp tp use])
7179     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7180         AC_MSG_RESULT([external])
7181         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7182     else
7183         AC_MSG_RESULT([internal])
7184         BUILD_TYPE="$BUILD_TYPE UCPP"
7185     fi
7187 AC_SUBST(SYSTEM_UCPP)
7189 dnl ===================================================================
7190 dnl Check for epm (not needed for Windows)
7191 dnl ===================================================================
7192 AC_MSG_CHECKING([whether to enable EPM for packing])
7193 if test "$enable_epm" = "yes"; then
7194     AC_MSG_RESULT([yes])
7195     if test "$_os" != "WINNT"; then
7196         if test $_os = Darwin; then
7197             EPM=internal
7198         elif test -n "$with_epm"; then
7199             EPM=$with_epm
7200         else
7201             AC_PATH_PROG(EPM, epm, no)
7202         fi
7203         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7204             AC_MSG_NOTICE([EPM will be built.])
7205             BUILD_TYPE="$BUILD_TYPE EPM"
7206             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7207         else
7208             # Gentoo has some epm which is something different...
7209             AC_MSG_CHECKING([whether the found epm is the right epm])
7210             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7211                 AC_MSG_RESULT([yes])
7212             else
7213                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7214             fi
7215             AC_MSG_CHECKING([epm version])
7216             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7217             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7218                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7219                 AC_MSG_RESULT([OK, >= 3.7])
7220             else
7221                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7222                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7223             fi
7224         fi
7225     fi
7227     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7228         AC_MSG_CHECKING([for rpm])
7229         for a in "$RPM" rpmbuild rpm; do
7230             $a --usage >/dev/null 2> /dev/null
7231             if test $? -eq 0; then
7232                 RPM=$a
7233                 break
7234             else
7235                 $a --version >/dev/null 2> /dev/null
7236                 if test $? -eq 0; then
7237                     RPM=$a
7238                     break
7239                 fi
7240             fi
7241         done
7242         if test -z "$RPM"; then
7243             AC_MSG_ERROR([not found])
7244         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7245             RPM_PATH=`which $RPM`
7246             AC_MSG_RESULT([$RPM_PATH])
7247             SCPDEFS="$SCPDEFS -DWITH_RPM"
7248         else
7249             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7250         fi
7251     fi
7252     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7253         AC_PATH_PROG(DPKG, dpkg, no)
7254         if test "$DPKG" = "no"; then
7255             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7256         fi
7257     fi
7258     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7259        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7260         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7261             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7262                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7263                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7264                     AC_MSG_RESULT([yes])
7265                 else
7266                     AC_MSG_RESULT([no])
7267                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7268                         _pt="rpm"
7269                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7270                         add_warning "the rpms will need to be installed with --nodeps"
7271                     else
7272                         _pt="pkg"
7273                     fi
7274                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
7275                     add_warning "the ${_pt}s will not be relocateable"
7276                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7277                                  relocation will work, you need to patch your epm with the
7278                                  patch in epm/epm-3.7.patch or build with
7279                                  --with-epm=internal which will build a suitable epm])
7280                 fi
7281             fi
7282         fi
7283     fi
7284     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7285         AC_PATH_PROG(PKGMK, pkgmk, no)
7286         if test "$PKGMK" = "no"; then
7287             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7288         fi
7289     fi
7290     AC_SUBST(RPM)
7291     AC_SUBST(DPKG)
7292     AC_SUBST(PKGMK)
7293 else
7294     for i in $PKGFORMAT; do
7295         case "$i" in
7296         aix | bsd | deb | pkg | rpm | native | portable)
7297             AC_MSG_ERROR(
7298                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7299             ;;
7300         esac
7301     done
7302     AC_MSG_RESULT([no])
7303     EPM=NO
7305 AC_SUBST(EPM)
7307 ENABLE_LWP=
7308 if test "$enable_lotuswordpro" = "yes"; then
7309     ENABLE_LWP="TRUE"
7311 AC_SUBST(ENABLE_LWP)
7313 dnl ===================================================================
7314 dnl Check for building ODK
7315 dnl ===================================================================
7316 if test "$enable_odk" = no; then
7317     unset DOXYGEN
7318 else
7319     if test "$with_doxygen" = no; then
7320         AC_MSG_CHECKING([for doxygen])
7321         unset DOXYGEN
7322         AC_MSG_RESULT([no])
7323     else
7324         if test "$with_doxygen" = yes; then
7325             AC_PATH_PROG([DOXYGEN], [doxygen])
7326             if test -z "$DOXYGEN"; then
7327                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7328             fi
7329             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
7330                 if ! dot -V 2>/dev/null; then
7331                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
7332                 fi
7333             fi
7334         else
7335             AC_MSG_CHECKING([for doxygen])
7336             DOXYGEN=$with_doxygen
7337             AC_MSG_RESULT([$DOXYGEN])
7338         fi
7339         if test -n "$DOXYGEN"; then
7340             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7341             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7342             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7343                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7344             fi
7345         fi
7346     fi
7348 AC_SUBST([DOXYGEN])
7350 AC_MSG_CHECKING([whether to build the ODK])
7351 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7352     AC_MSG_RESULT([yes])
7354     if test "$with_java" != "no"; then
7355         AC_MSG_CHECKING([whether to build unowinreg.dll])
7356         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7357             # build on Win by default
7358             enable_build_unowinreg=yes
7359         fi
7360         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7361             AC_MSG_RESULT([no])
7362             BUILD_UNOWINREG=
7363         else
7364             AC_MSG_RESULT([yes])
7365             BUILD_UNOWINREG=TRUE
7366         fi
7367         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7368             if test -z "$with_mingw_cross_compiler"; then
7369                 dnl Guess...
7370                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7371             elif test -x "$with_mingw_cross_compiler"; then
7372                  MINGWCXX="$with_mingw_cross_compiler"
7373             else
7374                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7375             fi
7377             if test "$MINGWCXX" = "false"; then
7378                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7379             fi
7381             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7382             if test -x "$mingwstrip_test"; then
7383                 MINGWSTRIP="$mingwstrip_test"
7384             else
7385                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7386             fi
7388             if test "$MINGWSTRIP" = "false"; then
7389                 AC_MSG_ERROR(MinGW32 binutils not found.)
7390             fi
7391         fi
7392     fi
7393     BUILD_TYPE="$BUILD_TYPE ODK"
7394 else
7395     AC_MSG_RESULT([no])
7396     BUILD_UNOWINREG=
7398 AC_SUBST(BUILD_UNOWINREG)
7399 AC_SUBST(MINGWCXX)
7400 AC_SUBST(MINGWSTRIP)
7402 dnl ===================================================================
7403 dnl Check for system zlib
7404 dnl ===================================================================
7405 if test "$with_system_zlib" = "auto"; then
7406     case "$_os" in
7407     WINNT)
7408         with_system_zlib="$with_system_libs"
7409         ;;
7410     *)
7411         if test "$enable_fuzzers" != "yes"; then
7412             with_system_zlib=yes
7413         else
7414             with_system_zlib=no
7415         fi
7416         ;;
7417     esac
7420 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7421 dnl and has no pkg-config for it at least on some tinderboxes,
7422 dnl so leaving that out for now
7423 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7424 AC_MSG_CHECKING([which zlib to use])
7425 if test "$with_system_zlib" = "yes"; then
7426     AC_MSG_RESULT([external])
7427     SYSTEM_ZLIB=TRUE
7428     AC_CHECK_HEADER(zlib.h, [],
7429         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7430     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7431         [AC_MSG_ERROR(zlib not found or functional)], [])
7432 else
7433     AC_MSG_RESULT([internal])
7434     SYSTEM_ZLIB=
7435     BUILD_TYPE="$BUILD_TYPE ZLIB"
7436     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7437     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7439 AC_SUBST(ZLIB_CFLAGS)
7440 AC_SUBST(ZLIB_LIBS)
7441 AC_SUBST(SYSTEM_ZLIB)
7443 dnl ===================================================================
7444 dnl Check for system jpeg
7445 dnl ===================================================================
7446 AC_MSG_CHECKING([which libjpeg to use])
7447 if test "$with_system_jpeg" = "yes"; then
7448     AC_MSG_RESULT([external])
7449     SYSTEM_LIBJPEG=TRUE
7450     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7451         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7452     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7453         [AC_MSG_ERROR(jpeg library not found or fuctional)], [])
7454 else
7455     SYSTEM_LIBJPEG=
7456     AC_MSG_RESULT([internal, libjpeg-turbo])
7457     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
7458     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
7459     if test "$COM" = "MSC"; then
7460         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
7461     else
7462         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
7463     fi
7465     case "$host_cpu" in
7466     x86_64 | amd64 | i*86 | x86 | ia32)
7467         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7468         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7469             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7470                 NASM="$LODE_HOME/opt/bin/nasm"
7471             elif test -x "/opt/lo/bin/nasm"; then
7472                 NASM="/opt/lo/bin/nasm"
7473             fi
7474         fi
7476         if test -n "$NASM"; then
7477             AC_MSG_CHECKING([for object file format of host system])
7478             case "$host_os" in
7479               cygwin* | mingw* | pw32* | interix*)
7480                 case "$host_cpu" in
7481                   x86_64)
7482                     objfmt='Win64-COFF'
7483                     ;;
7484                   *)
7485                     objfmt='Win32-COFF'
7486                     ;;
7487                 esac
7488               ;;
7489               msdosdjgpp* | go32*)
7490                 objfmt='COFF'
7491               ;;
7492               os2-emx*)                 # not tested
7493                 objfmt='MSOMF'          # obj
7494               ;;
7495               linux*coff* | linux*oldld*)
7496                 objfmt='COFF'           # ???
7497               ;;
7498               linux*aout*)
7499                 objfmt='a.out'
7500               ;;
7501               linux*)
7502                 case "$host_cpu" in
7503                   x86_64)
7504                     objfmt='ELF64'
7505                     ;;
7506                   *)
7507                     objfmt='ELF'
7508                     ;;
7509                 esac
7510               ;;
7511               kfreebsd* | freebsd* | netbsd* | openbsd*)
7512                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
7513                   objfmt='BSD-a.out'
7514                 else
7515                   case "$host_cpu" in
7516                     x86_64 | amd64)
7517                       objfmt='ELF64'
7518                       ;;
7519                     *)
7520                       objfmt='ELF'
7521                       ;;
7522                   esac
7523                 fi
7524               ;;
7525               solaris* | sunos* | sysv* | sco*)
7526                 case "$host_cpu" in
7527                   x86_64)
7528                     objfmt='ELF64'
7529                     ;;
7530                   *)
7531                     objfmt='ELF'
7532                     ;;
7533                 esac
7534               ;;
7535               darwin* | rhapsody* | nextstep* | openstep* | macos*)
7536                 case "$host_cpu" in
7537                   x86_64)
7538                     objfmt='Mach-O64'
7539                     ;;
7540                   *)
7541                     objfmt='Mach-O'
7542                     ;;
7543                 esac
7544               ;;
7545               *)
7546                 objfmt='ELF ?'
7547               ;;
7548             esac
7550             AC_MSG_RESULT([$objfmt])
7551             if test "$objfmt" = 'ELF ?'; then
7552               objfmt='ELF'
7553               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
7554             fi
7556             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
7557             case "$objfmt" in
7558               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
7559               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
7560               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
7561               COFF)       NAFLAGS='-fcoff -DCOFF';;
7562               a.out)      NAFLAGS='-faout -DAOUT';;
7563               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
7564               ELF)        NAFLAGS='-felf -DELF';;
7565               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
7566               RDF)        NAFLAGS='-frdf -DRDF';;
7567               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
7568               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
7569             esac
7570             AC_MSG_RESULT([$NAFLAGS])
7572             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
7573             cat > conftest.asm << EOF
7574             [%line __oline__ "configure"
7575                     section .text
7576                     global  _main,main
7577             _main:
7578             main:   xor     eax,eax
7579                     ret
7580             ]
7582             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
7583             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
7584               AC_MSG_RESULT(yes)
7585             else
7586               echo "configure: failed program was:" >&AC_FD_CC
7587               cat conftest.asm >&AC_FD_CC
7588               rm -rf conftest*
7589               AC_MSG_RESULT(no)
7590               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
7591               NASM=""
7592             fi
7594         fi
7596         if test -z "$NASM"; then
7597 cat << _EOS
7598 ****************************************************************************
7599 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
7600 To get one please:
7602 _EOS
7603             if test "$build_os" = "cygwin"; then
7604 cat << _EOS
7605 install a pre-compiled binary for Win32
7607 mkdir -p /opt/lo/bin
7608 cd /opt/lo/bin
7609 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7610 chmod +x nasm
7612 or get and install one from http://www.nasm.us/
7614 Then re-run autogen.sh
7616 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7617 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7619 _EOS
7620             else
7621 cat << _EOS
7622 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
7624 _EOS
7625             fi
7626             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
7627             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
7628         fi
7629       ;;
7630     esac
7633 AC_SUBST(NASM)
7634 AC_SUBST(LIBJPEG_CFLAGS)
7635 AC_SUBST(LIBJPEG_LIBS)
7636 AC_SUBST(SYSTEM_LIBJPEG)
7638 dnl ===================================================================
7639 dnl Check for system clucene
7640 dnl ===================================================================
7641 dnl we should rather be using
7642 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7643 dnl but the contribs-lib check seems tricky
7644 AC_MSG_CHECKING([which clucene to use])
7645 if test "$with_system_clucene" = "yes"; then
7646     AC_MSG_RESULT([external])
7647     SYSTEM_CLUCENE=TRUE
7648     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7649     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7650     FilterLibs "${CLUCENE_LIBS}"
7651     CLUCENE_LIBS="${filteredlibs}"
7652     AC_LANG_PUSH([C++])
7653     save_CXXFLAGS=$CXXFLAGS
7654     save_CPPFLAGS=$CPPFLAGS
7655     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7656     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7657     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7658     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7659     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7660                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7661     CXXFLAGS=$save_CXXFLAGS
7662     CPPFLAGS=$save_CPPFLAGS
7663     AC_LANG_POP([C++])
7665     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7666 else
7667     AC_MSG_RESULT([internal])
7668     SYSTEM_CLUCENE=
7669     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7671 AC_SUBST(SYSTEM_CLUCENE)
7672 AC_SUBST(CLUCENE_CFLAGS)
7673 AC_SUBST(CLUCENE_LIBS)
7675 dnl ===================================================================
7676 dnl Check for system expat
7677 dnl ===================================================================
7678 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
7680 dnl ===================================================================
7681 dnl Check for system xmlsec
7682 dnl ===================================================================
7683 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24])
7685 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7686 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7687     ENABLE_EOT="TRUE"
7688     AC_DEFINE([ENABLE_EOT])
7689     AC_MSG_RESULT([yes])
7691     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7692 else
7693     ENABLE_EOT=
7694     AC_MSG_RESULT([no])
7696 AC_SUBST([ENABLE_EOT])
7698 dnl ===================================================================
7699 dnl Check for DLP libs
7700 dnl ===================================================================
7701 AS_IF([test "$COM" = "MSC"],
7702       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7703       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7705 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7707 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7709 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
7711 AS_IF([test "$COM" = "MSC"],
7712       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7713       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7715 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7717 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7719 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7720 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.8])
7722 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7724 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7726 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7728 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
7729 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.13])
7731 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
7732 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.7])
7734 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7736 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
7737 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
7739 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7741 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7743 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
7745 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
7747 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
7748 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.4])
7750 dnl ===================================================================
7751 dnl Check for system lcms2
7752 dnl ===================================================================
7753 if test "$with_system_lcms2" != "yes"; then
7754     SYSTEM_LCMS2=
7756 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7757 if test "$GCC" = "yes"; then
7758     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7760 if test "$COM" = "MSC"; then # override the above
7761     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7764 dnl ===================================================================
7765 dnl Check for system cppunit
7766 dnl ===================================================================
7767 if test "$cross_compiling" != "yes"; then
7768     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
7771 dnl ===================================================================
7772 dnl Check whether freetype is available
7773 dnl ===================================================================
7774 if test  "$test_freetype" = "yes"; then
7775     AC_MSG_CHECKING([whether freetype is available])
7776     # FreeType has 3 different kinds of versions
7777     # * release, like 2.4.10
7778     # * libtool, like 13.0.7 (this what pkg-config returns)
7779     # * soname
7780     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7781     #
7782     # 9.9.3 is 2.2.0
7783     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7784     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7785     FilterLibs "${FREETYPE_LIBS}"
7786     FREETYPE_LIBS="${filteredlibs}"
7787     SYSTEM_FREETYPE=TRUE
7788 else
7789     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
7790     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
7792 AC_SUBST(FREETYPE_CFLAGS)
7793 AC_SUBST(FREETYPE_LIBS)
7794 AC_SUBST([SYSTEM_FREETYPE])
7796 # ===================================================================
7797 # Check for system libxslt
7798 # to prevent incompatibilities between internal libxml2 and external libxslt,
7799 # or vice versa, use with_system_libxml here
7800 # ===================================================================
7801 if test "$with_system_libxml" = "auto"; then
7802     case "$_os" in
7803     WINNT|iOS|Android)
7804         with_system_libxml="$with_system_libs"
7805         ;;
7806     *)
7807         if test "$enable_fuzzers" != "yes"; then
7808             with_system_libxml=yes
7809         else
7810             with_system_libxml=no
7811         fi
7812         ;;
7813     esac
7816 AC_MSG_CHECKING([which libxslt to use])
7817 if test "$with_system_libxml" = "yes"; then
7818     AC_MSG_RESULT([external])
7819     SYSTEM_LIBXSLT=TRUE
7820     if test "$_os" = "Darwin"; then
7821         dnl make sure to use SDK path
7822         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7823         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7824         dnl omit -L/usr/lib
7825         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7826         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7827     else
7828         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7829         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7830         FilterLibs "${LIBXSLT_LIBS}"
7831         LIBXSLT_LIBS="${filteredlibs}"
7832         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7833         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7834         FilterLibs "${LIBEXSLT_LIBS}"
7835         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
7836     fi
7838     dnl Check for xsltproc
7839     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7840     if test "$XSLTPROC" = "no"; then
7841         AC_MSG_ERROR([xsltproc is required])
7842     fi
7843 else
7844     AC_MSG_RESULT([internal])
7845     SYSTEM_LIBXSLT=
7846     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
7848     if test "$cross_compiling" = "yes"; then
7849         AC_PATH_PROG(XSLTPROC, xsltproc, no)
7850         if test "$XSLTPROC" = "no"; then
7851             AC_MSG_ERROR([xsltproc is required])
7852         fi
7853     fi
7855 AC_SUBST(SYSTEM_LIBXSLT)
7856 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
7857     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
7859 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
7861 AC_SUBST(LIBEXSLT_CFLAGS)
7862 AC_SUBST(LIBEXSLT_LIBS)
7863 AC_SUBST(LIBXSLT_CFLAGS)
7864 AC_SUBST(LIBXSLT_LIBS)
7865 AC_SUBST(XSLTPROC)
7867 # ===================================================================
7868 # Check for system libxml
7869 # ===================================================================
7870 AC_MSG_CHECKING([which libxml to use])
7871 if test "$with_system_libxml" = "yes"; then
7872     AC_MSG_RESULT([external])
7873     SYSTEM_LIBXML=TRUE
7874     if test "$_os" = "Darwin"; then
7875         dnl make sure to use SDK path
7876         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7877         dnl omit -L/usr/lib
7878         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
7879     elif test $_os = iOS; then
7880         dnl make sure to use SDK path
7881         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
7882         LIBXML_CFLAGS="-I$usr/include/libxml2"
7883         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
7884     else
7885         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
7886         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7887         FilterLibs "${LIBXML_LIBS}"
7888         LIBXML_LIBS="${filteredlibs}"
7889     fi
7891     dnl Check for xmllint
7892     AC_PATH_PROG(XMLLINT, xmllint, no)
7893     if test "$XMLLINT" = "no"; then
7894         AC_MSG_ERROR([xmllint is required])
7895     fi
7896 else
7897     AC_MSG_RESULT([internal])
7898     SYSTEM_LIBXML=
7899     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
7900     if test "$COM" = "MSC"; then
7901         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
7902     fi
7903     if test "$COM" = "MSC"; then
7904         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
7905     else
7906         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
7907     fi
7908     BUILD_TYPE="$BUILD_TYPE LIBXML2"
7910 AC_SUBST(SYSTEM_LIBXML)
7911 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
7912     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
7914 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
7915 AC_SUBST(LIBXML_CFLAGS)
7916 AC_SUBST(LIBXML_LIBS)
7917 AC_SUBST(XMLLINT)
7919 # =====================================================================
7920 # Checking for a Python interpreter with version >= 2.6.
7921 # Build and runtime requires Python 3 compatible version (>= 2.6).
7922 # Optionally user can pass an option to configure, i. e.
7923 # ./configure PYTHON=/usr/bin/python
7924 # =====================================================================
7925 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
7926     # This allows a lack of system python with no error, we use internal one in that case.
7927     AM_PATH_PYTHON([2.6],, [:])
7928     # Clean PYTHON_VERSION checked below if cross-compiling
7929     PYTHON_VERSION=""
7930     if test "$PYTHON" != ":"; then
7931         PYTHON_FOR_BUILD=$PYTHON
7932     fi
7934 AC_SUBST(PYTHON_FOR_BUILD)
7936 # Checks for Python to use for Pyuno
7937 AC_MSG_CHECKING([which Python to use for Pyuno])
7938 case "$enable_python" in
7939 no|disable)
7940     if test -z $PYTHON_FOR_BUILD; then
7941         # Python is required to build LibreOffice. In theory we could separate the build-time Python
7942         # requirement from the choice whether to include Python stuff in the installer, but why
7943         # bother?
7944         AC_MSG_ERROR([Python is required at build time.])
7945     fi
7946     enable_python=no
7947     AC_MSG_RESULT([none])
7948     ;;
7949 ""|yes|auto)
7950     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
7951         AC_MSG_RESULT([no, overridden by --disable-scripting])
7952         enable_python=no
7953     elif test $build_os = cygwin; then
7954         dnl When building on Windows we don't attempt to use any installed
7955         dnl "system"  Python.
7956         AC_MSG_RESULT([fully internal])
7957         enable_python=internal
7958     elif test "$cross_compiling" = yes; then
7959         AC_MSG_RESULT([system])
7960         enable_python=system
7961     else
7962         # Unset variables set by the above AM_PATH_PYTHON so that
7963         # we actually do check anew.
7964         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
7965         AM_PATH_PYTHON([3.3],, [:])
7966         if test "$PYTHON" = ":"; then
7967             if test -z "$PYTHON_FOR_BUILD"; then
7968                 AC_MSG_RESULT([fully internal])
7969             else
7970                 AC_MSG_RESULT([internal])
7971             fi
7972             enable_python=internal
7973         else
7974             AC_MSG_RESULT([system])
7975             enable_python=system
7976         fi
7977     fi
7978     ;;
7979 internal)
7980     AC_MSG_RESULT([internal])
7981     ;;
7982 fully-internal)
7983     AC_MSG_RESULT([fully internal])
7984     enable_python=internal
7985     ;;
7986 system)
7987     AC_MSG_RESULT([system])
7988     ;;
7990     AC_MSG_ERROR([Incorrect --enable-python option])
7991     ;;
7992 esac
7994 if test $enable_python != no; then
7995     BUILD_TYPE="$BUILD_TYPE PYUNO"
7998 if test $enable_python = system; then
7999     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8000         python_version=2.7
8001         PYTHON=python$python_version
8002         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
8003             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
8004             PYTHON_LIBS="-framework Python"
8005         else
8006             PYTHON_CFLAGS="`$PYTHON-config --includes`"
8007             PYTHON_LIBS="`$PYTHON-config --libs`"
8008         fi
8009     fi
8010     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8011         # Fallback: Accept these in the environment, or as set above
8012         # for MacOSX.
8013         :
8014     elif test "$cross_compiling" != yes; then
8015         # Unset variables set by the above AM_PATH_PYTHON so that
8016         # we actually do check anew.
8017         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
8018         # This causes an error if no python command is found
8019         AM_PATH_PYTHON([3.3])
8020         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8021         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8022         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8023         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8024         if test -z "$PKG_CONFIG"; then
8025             PYTHON_CFLAGS="-I$python_include"
8026             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8027         elif $PKG_CONFIG --exists python-$python_version; then
8028             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8029             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8030         else
8031             PYTHON_CFLAGS="-I$python_include"
8032             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8033         fi
8034         FilterLibs "${PYTHON_LIBS}"
8035         PYTHON_LIBS="${filteredlibs}"
8036     else
8037         dnl How to find out the cross-compilation Python installation path?
8038         AC_MSG_CHECKING([for python version])
8039         AS_IF([test -n "$PYTHON_VERSION"],
8040               [AC_MSG_RESULT([$PYTHON_VERSION])],
8041               [AC_MSG_RESULT([not found])
8042                AC_MSG_ERROR([no usable python found])])
8043         test -n "$PYTHON_CFLAGS" && break
8044     fi
8045     # let the PYTHON_FOR_BUILD match the same python installation that
8046     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8047     # better for PythonTests.
8048     PYTHON_FOR_BUILD=$PYTHON
8051 dnl By now enable_python should be "system", "internal" or "no"
8052 case $enable_python in
8053 system)
8054     SYSTEM_PYTHON=TRUE
8056     dnl Check if the headers really work
8057     save_CPPFLAGS="$CPPFLAGS"
8058     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8059     AC_CHECK_HEADER(Python.h, [],
8060        [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
8061        [])
8062     CPPFLAGS="$save_CPPFLAGS"
8064     AC_LANG_PUSH(C)
8065     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8066     AC_MSG_CHECKING([for correct python library version])
8067        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8068 #include <Python.h>
8070 int main(int argc, char **argv) {
8071    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
8072        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8073    else return 1;
8075        ]])],[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])])
8076     CFLAGS=$save_CFLAGS
8077     AC_LANG_POP(C)
8079     dnl FIXME Check if the Python library can be linked with, too?
8080     ;;
8082 internal)
8083     SYSTEM_PYTHON=
8084     PYTHON_VERSION_MAJOR=3
8085     PYTHON_VERSION_MINOR=5
8086     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.4
8087     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8088         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8089     fi
8090     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8091     BUILD_TYPE="$BUILD_TYPE PYTHON"
8092     # Embedded Python dies without Home set
8093     if test "$HOME" = ""; then
8094         export HOME=""
8095     fi
8096     # bz2 tarball and bzip2 is not standard
8097     if test -z "$BZIP2"; then
8098         AC_PATH_PROG( BZIP2, bzip2)
8099         if test -z "$BZIP2"; then
8100             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
8101         fi
8102     fi
8103     ;;
8105     DISABLE_PYTHON=TRUE
8106     SYSTEM_PYTHON=
8107     ;;
8109     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8110     ;;
8111 esac
8113 AC_SUBST(DISABLE_PYTHON)
8114 AC_SUBST(SYSTEM_PYTHON)
8115 AC_SUBST(PYTHON_CFLAGS)
8116 AC_SUBST(PYTHON_LIBS)
8117 AC_SUBST(PYTHON_VERSION)
8118 AC_SUBST(PYTHON_VERSION_MAJOR)
8119 AC_SUBST(PYTHON_VERSION_MINOR)
8121 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8122 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8123     AC_MSG_RESULT([yes])
8124     ENABLE_MARIADBC=TRUE
8125     MARIADBC_MAJOR=1
8126     MARIADBC_MINOR=0
8127     MARIADBC_MICRO=2
8128     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8129 else
8130     AC_MSG_RESULT([no])
8131     ENABLE_MARIADBC=
8133 AC_SUBST(ENABLE_MARIADBC)
8134 AC_SUBST(MARIADBC_MAJOR)
8135 AC_SUBST(MARIADBC_MINOR)
8136 AC_SUBST(MARIADBC_MICRO)
8138 if test "$ENABLE_MARIADBC" = "TRUE"; then
8140     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8142     dnl ===================================================================
8143     dnl Check for system MariaDB
8144     dnl ===================================================================
8145     AC_MSG_CHECKING([which MariaDB to use])
8146     if test "$with_system_mariadb" = "yes"; then
8147         AC_MSG_RESULT([external])
8148         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8149         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8150         if test -z "$MARIADBCONFIG"; then
8151             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8152             if test -z "$MARIADBCONFIG"; then
8153                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8154                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8155             fi
8156         fi
8157         AC_MSG_CHECKING([MariaDB version])
8158         MARIADB_VERSION=`$MARIADBCONFIG --version`
8159         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8160         if test "$MARIADB_MAJOR" -ge "5"; then
8161             AC_MSG_RESULT([OK])
8162         else
8163             AC_MSG_ERROR([too old, use 5.0.x or later])
8164         fi
8165         AC_MSG_CHECKING([for MariaDB Client library])
8166         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8167         if test "$COM_IS_CLANG" = TRUE; then
8168             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8169         fi
8170         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8171         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8172         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8173         dnl linux32:
8174         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8175             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8176             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8177                 | sed -e 's|/lib64/|/lib/|')
8178         fi
8179         FilterLibs "${MARIADB_LIBS}"
8180         MARIADB_LIBS="${filteredlibs}"
8181         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8182         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8183         if test "$enable_bundle_mariadb" = "yes"; then
8184             AC_MSG_RESULT([yes])
8185             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8186             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8188 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8190 /g' | grep -E '(mysqlclient|mariadb)')
8191             if test "$_os" = "Darwin"; then
8192                 LIBMARIADB=${LIBMARIADB}.dylib
8193             elif test "$_os" = "WINNT"; then
8194                 LIBMARIADB=${LIBMARIADB}.dll
8195             else
8196                 LIBMARIADB=${LIBMARIADB}.so
8197             fi
8198             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8199             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8200             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8201                 AC_MSG_RESULT([found.])
8202                 PathFormat "$LIBMARIADB_PATH"
8203                 LIBMARIADB_PATH="$formatted_path"
8204             else
8205                 AC_MSG_ERROR([not found.])
8206             fi
8207         else
8208             AC_MSG_RESULT([no])
8209             BUNDLE_MARIADB_CONNECTOR_C=
8210         fi
8211     else
8212         AC_MSG_RESULT([internal])
8213         SYSTEM_MARIADB_CONNECTOR_C=
8214         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8215         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8216         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8217     fi
8219     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8220     AC_SUBST(MARIADB_CFLAGS)
8221     AC_SUBST(MARIADB_LIBS)
8222     AC_SUBST(LIBMARIADB)
8223     AC_SUBST(LIBMARIADB_PATH)
8224     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8226     AC_LANG_PUSH([C++])
8227     dnl ===================================================================
8228     dnl Check for system MySQL C++ Connector
8229     dnl ===================================================================
8230     # FIXME!
8231     # who thought this too-generic cppconn dir was a good idea?
8232     AC_MSG_CHECKING([MySQL Connector/C++])
8233     if test "$with_system_mysql_cppconn" = "yes"; then
8234         AC_MSG_RESULT([external])
8235         SYSTEM_MYSQL_CONNECTOR_CPP=TRUE
8236         AC_LANG_PUSH([C++])
8237         AC_CHECK_HEADER(mysql_driver.h, [],
8238                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8239         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8240                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8241         save_LIBS=$LIBS
8242         LIBS="$LIBS -lmysqlcppconn"
8243         AC_MSG_CHECKING([version])
8244         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8245 #include <mysql_driver.h>
8247 int main(int argc, char **argv) {
8248     sql::Driver *driver;
8249     driver = get_driver_instance();
8250     if (driver->getMajorVersion() > 1 || \
8251        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8252        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8253         return 0;
8254       else
8255         return 1;
8257       ]])],[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])])
8259         AC_LANG_POP([C++])
8260         LIBS=$save_LIBS
8261     else
8262         AC_MSG_RESULT([internal])
8263         BUILD_TYPE="$BUILD_TYPE MYSQL_CONNECTOR_CPP"
8264         SYSTEM_MYSQL_CONNECTOR_CPP=
8265     fi
8266     AC_LANG_POP([C++])
8268 AC_SUBST(SYSTEM_MYSQL_CONNECTOR_CPP)
8270 dnl ===================================================================
8271 dnl Check for system hsqldb
8272 dnl ===================================================================
8273 if test "$with_java" != "no"; then
8274     HSQLDB_USE_JDBC_4_1=
8275     AC_MSG_CHECKING([which hsqldb to use])
8276     if test "$with_system_hsqldb" = "yes"; then
8277         AC_MSG_RESULT([external])
8278         SYSTEM_HSQLDB=TRUE
8279         if test -z $HSQLDB_JAR; then
8280             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8281         fi
8282         if ! test -f $HSQLDB_JAR; then
8283                AC_MSG_ERROR(hsqldb.jar not found.)
8284         fi
8285         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8286         export HSQLDB_JAR
8287         if $PERL -e \
8288            'use Archive::Zip;
8289             my $file = "$ENV{'HSQLDB_JAR'}";
8290             my $zip = Archive::Zip->new( $file );
8291             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8292             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8293             {
8294                 push @l, split(/\n/, $mf);
8295                 foreach my $line (@l)
8296                 {
8297                     if ($line =~ m/Specification-Version:/)
8298                     {
8299                         ($t, $version) = split (/:/,$line);
8300                         $version =~ s/^\s//;
8301                         ($a, $b, $c, $d) = split (/\./,$version);
8302                         if ($c == "0" && $d > "8")
8303                         {
8304                             exit 0;
8305                         }
8306                         else
8307                         {
8308                             exit 1;
8309                         }
8310                     }
8311                 }
8312             }
8313             else
8314             {
8315                 exit 1;
8316             }'; then
8317             AC_MSG_RESULT([yes])
8318         else
8319             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8320         fi
8321     else
8322         AC_MSG_RESULT([internal])
8323         SYSTEM_HSQLDB=
8324         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8325         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8326         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8327         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8328             AC_MSG_RESULT([yes])
8329             HSQLDB_USE_JDBC_4_1=TRUE
8330         else
8331             AC_MSG_RESULT([no])
8332         fi
8333     fi
8334     AC_SUBST(SYSTEM_HSQLDB)
8335     AC_SUBST(HSQLDB_JAR)
8336     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8339 dnl ===================================================================
8340 dnl Check for PostgreSQL stuff
8341 dnl ===================================================================
8342 if test "x$enable_postgresql_sdbc" != "xno"; then
8343     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8345     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8346         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8347     fi
8348     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8349         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8350     fi
8352     postgres_interface=""
8353     if test "$with_system_postgresql" = "yes"; then
8354         postgres_interface="external PostgreSQL"
8355         SYSTEM_POSTGRESQL=TRUE
8356         if test "$_os" = Darwin; then
8357             supp_path=''
8358             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8359                 pg_supp_path="$P_SEP$d$pg_supp_path"
8360             done
8361         fi
8362         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8363         if test -z "$PGCONFIG"; then
8364             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8365         fi
8366         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8367         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8368         FilterLibs "${POSTGRESQL_LIB}"
8369         POSTGRESQL_LIB="${filteredlibs}"
8370     else
8371         # if/when anything else than PostgreSQL uses Kerberos,
8372         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8373         WITH_KRB5=
8374         WITH_GSSAPI=
8375         case "$_os" in
8376         Darwin)
8377             # MacOS X has system MIT Kerberos 5 since 10.4
8378             if test "$with_krb5" != "no"; then
8379                 WITH_KRB5=TRUE
8380                 save_LIBS=$LIBS
8381                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8382                 # that the libraries where these functions are located on macOS will change, is it?
8383                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8384                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8385                 KRB5_LIBS=$LIBS
8386                 LIBS=$save_LIBS
8387                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8388                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8389                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8390                 LIBS=$save_LIBS
8391             fi
8392             if test "$with_gssapi" != "no"; then
8393                 WITH_GSSAPI=TRUE
8394                 save_LIBS=$LIBS
8395                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8396                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8397                 GSSAPI_LIBS=$LIBS
8398                 LIBS=$save_LIBS
8399             fi
8400             ;;
8401         WINNT)
8402             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8403                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8404             fi
8405             ;;
8406         Linux|GNU|*BSD|DragonFly)
8407             if test "$with_krb5" != "no"; then
8408                 WITH_KRB5=TRUE
8409                 save_LIBS=$LIBS
8410                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8411                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8412                 KRB5_LIBS=$LIBS
8413                 LIBS=$save_LIBS
8414                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8415                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8416                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8417                 LIBS=$save_LIBS
8418             fi
8419             if test "$with_gssapi" != "no"; then
8420                 WITH_GSSAPI=TRUE
8421                 save_LIBS=$LIBS
8422                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8423                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8424                 GSSAPI_LIBS=$LIBS
8425                 LIBS=$save_LIBS
8426             fi
8427             ;;
8428         *)
8429             if test "$with_krb5" = "yes"; then
8430                 WITH_KRB5=TRUE
8431                 save_LIBS=$LIBS
8432                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8433                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8434                 KRB5_LIBS=$LIBS
8435                 LIBS=$save_LIBS
8436                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8437                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8438                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8439                 LIBS=$save_LIBS
8440             fi
8441             if test "$with_gssapi" = "yes"; then
8442                 WITH_GSSAPI=TRUE
8443                 save_LIBS=$LIBS
8444                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8445                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8446                 LIBS=$save_LIBS
8447                 GSSAPI_LIBS=$LIBS
8448             fi
8449         esac
8451         if test -n "$with_libpq_path"; then
8452             SYSTEM_POSTGRESQL=TRUE
8453             postgres_interface="external libpq"
8454             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8455             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8456         else
8457             SYSTEM_POSTGRESQL=
8458             postgres_interface="internal"
8459             POSTGRESQL_LIB=""
8460             POSTGRESQL_INC="%OVERRIDE_ME%"
8461             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8462         fi
8463     fi
8465     AC_MSG_CHECKING([PostgreSQL C interface])
8466     AC_MSG_RESULT([$postgres_interface])
8468     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8469         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8470         save_CFLAGS=$CFLAGS
8471         save_CPPFLAGS=$CPPFLAGS
8472         save_LIBS=$LIBS
8473         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8474         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8475         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8476         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8477             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8478         CFLAGS=$save_CFLAGS
8479         CPPFLAGS=$save_CPPFLAGS
8480         LIBS=$save_LIBS
8481     fi
8482     BUILD_POSTGRESQL_SDBC=TRUE
8484 AC_SUBST(WITH_KRB5)
8485 AC_SUBST(WITH_GSSAPI)
8486 AC_SUBST(GSSAPI_LIBS)
8487 AC_SUBST(KRB5_LIBS)
8488 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8489 AC_SUBST(SYSTEM_POSTGRESQL)
8490 AC_SUBST(POSTGRESQL_INC)
8491 AC_SUBST(POSTGRESQL_LIB)
8493 dnl ===================================================================
8494 dnl Check for Firebird stuff
8495 dnl ===================================================================
8496 ENABLE_FIREBIRD_SDBC=""
8497 if test "$enable_firebird_sdbc" = "yes" ; then
8498     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8500     dnl ===================================================================
8501     dnl Check for system Firebird
8502     dnl ===================================================================
8503     AC_MSG_CHECKING([which Firebird to use])
8504     if test "$with_system_firebird" = "yes"; then
8505         AC_MSG_RESULT([external])
8506         SYSTEM_FIREBIRD=TRUE
8507         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8508         if test -z "$FIREBIRDCONFIG"; then
8509             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8510             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8511                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8512             ])
8513             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8514         else
8515             AC_MSG_NOTICE([fb_config found])
8516             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8517             AC_MSG_CHECKING([for Firebird Client library])
8518             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8519             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8520             FilterLibs "${FIREBIRD_LIBS}"
8521             FIREBIRD_LIBS="${filteredlibs}"
8522         fi
8523         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8524         AC_MSG_CHECKING([Firebird version])
8525         if test -n "${FIREBIRD_VERSION}"; then
8526             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8527             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8528             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8529                 AC_MSG_RESULT([OK])
8530             else
8531                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
8532             fi
8533         else
8534             __save_CFLAGS="${CFLAGS}"
8535             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8536             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8537 #if defined(FB_API_VER) && FB_API_VER == 30
8538 int fb_api_is_30(void) { return 0; }
8539 #else
8540 #error "Wrong Firebird API version"
8541 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
8542             CFLAGS="${__save_CFLAGS}"
8543         fi
8544         ENABLE_FIREBIRD_SDBC="TRUE"
8545     elif test "$enable_database_connectivity" != yes; then
8546         AC_MSG_RESULT([none])
8547     elif test "$cross_compiling" = "yes"; then
8548         AC_MSG_RESULT([none])
8549     else
8550         dnl Embedded Firebird has version 3.0
8551         AC_DEFINE(HAVE_FIREBIRD_30, 1)
8552         dnl We need libatomic-ops for any non X86/X64 system
8553         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8554             dnl ===================================================================
8555             dnl Check for system libatomic-ops
8556             dnl ===================================================================
8557             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8558             if test "$with_system_libatomic_ops" = "yes"; then
8559                 SYSTEM_LIBATOMIC_OPS=TRUE
8560                 AC_CHECK_HEADERS(atomic_ops.h, [],
8561                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8562             else
8563                 SYSTEM_LIBATOMIC_OPS=
8564                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8565                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8566                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8567             fi
8568         fi
8570         AC_MSG_RESULT([internal])
8571         SYSTEM_FIREBIRD=
8572         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
8573         FIREBIRD_LIBS="-lfbclient"
8575         if test "$with_system_libtommath" = "yes"; then
8576             SYSTEM_LIBTOMMATH=TRUE
8577             dnl check for tommath presence
8578             save_LIBS=$LIBS
8579             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
8580             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
8581             LIBS=$save_LIBS
8582         else
8583             SYSTEM_LIBTOMMATH=
8584             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
8585             LIBTOMMATH_LIBS="-ltommath"
8586             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
8587         fi
8589         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8590         ENABLE_FIREBIRD_SDBC="TRUE"
8591     fi
8593 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8594 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8595 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8596 AC_SUBST(LIBATOMIC_OPS_LIBS)
8597 AC_SUBST(SYSTEM_FIREBIRD)
8598 AC_SUBST(FIREBIRD_CFLAGS)
8599 AC_SUBST(FIREBIRD_LIBS)
8600 AC_SUBST([TOMMATH_CFLAGS])
8601 AC_SUBST([TOMMATH_LIBS])
8603 dnl ===================================================================
8604 dnl Check for system curl
8605 dnl ===================================================================
8606 AC_MSG_CHECKING([which libcurl to use])
8607 if test "$with_system_curl" = "auto"; then
8608     with_system_curl="$with_system_libs"
8611 if test "$with_system_curl" = "yes"; then
8612     AC_MSG_RESULT([external])
8613     SYSTEM_CURL=TRUE
8615     # First try PKGCONFIG and then fall back
8616     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8618     if test -n "$CURL_PKG_ERRORS"; then
8619         AC_PATH_PROG(CURLCONFIG, curl-config)
8620         if test -z "$CURLCONFIG"; then
8621             AC_MSG_ERROR([curl development files not found])
8622         fi
8623         CURL_LIBS=`$CURLCONFIG --libs`
8624         FilterLibs "${CURL_LIBS}"
8625         CURL_LIBS="${filteredlibs}"
8626         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8627         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8629         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8630         case $curl_version in
8631         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8632         dnl so they need to be doubled to end up in the configure script
8633         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8634             AC_MSG_RESULT([yes])
8635             ;;
8636         *)
8637             AC_MSG_ERROR([no, you have $curl_version])
8638             ;;
8639         esac
8640     fi
8642     ENABLE_CURL=TRUE
8643 elif test $_os = iOS; then
8644     # Let's see if we need curl, I think not?
8645     AC_MSG_RESULT([none])
8646     ENABLE_CURL=
8647 else
8648     AC_MSG_RESULT([internal])
8649     SYSTEM_CURL=
8650     BUILD_TYPE="$BUILD_TYPE CURL"
8651     ENABLE_CURL=TRUE
8653 AC_SUBST(SYSTEM_CURL)
8654 AC_SUBST(CURL_CFLAGS)
8655 AC_SUBST(CURL_LIBS)
8656 AC_SUBST(ENABLE_CURL)
8658 dnl ===================================================================
8659 dnl Check for system boost
8660 dnl ===================================================================
8661 AC_MSG_CHECKING([which boost to use])
8662 if test "$with_system_boost" = "yes"; then
8663     AC_MSG_RESULT([external])
8664     SYSTEM_BOOST=TRUE
8665     AX_BOOST_BASE(1.47)
8666     AX_BOOST_DATE_TIME
8667     AX_BOOST_FILESYSTEM
8668     AX_BOOST_IOSTREAMS
8669     AX_BOOST_LOCALE
8670     AC_LANG_PUSH([C++])
8671     save_CXXFLAGS=$CXXFLAGS
8672     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8673     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8674        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8675     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8676        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8677     CXXFLAGS=$save_CXXFLAGS
8678     AC_LANG_POP([C++])
8679     # this is in m4/ax_boost_base.m4
8680     FilterLibs "${BOOST_LDFLAGS}"
8681     BOOST_LDFLAGS="${filteredlibs}"
8682 else
8683     AC_MSG_RESULT([internal])
8684     BUILD_TYPE="$BUILD_TYPE BOOST"
8685     SYSTEM_BOOST=
8686     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
8687         # use warning-suppressing wrapper headers
8688         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
8689     else
8690         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
8691     fi
8693 AC_SUBST(SYSTEM_BOOST)
8695 dnl ===================================================================
8696 dnl Check for system mdds
8697 dnl ===================================================================
8698 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.2 >= 1.2.3], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8700 dnl ===================================================================
8701 dnl Check for system glm
8702 dnl ===================================================================
8703 AC_MSG_CHECKING([which glm to use])
8704 if test "$with_system_glm" = "yes"; then
8705     AC_MSG_RESULT([external])
8706     SYSTEM_GLM=TRUE
8707     AC_LANG_PUSH([C++])
8708     AC_CHECK_HEADER([glm/glm.hpp], [],
8709        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8710     AC_LANG_POP([C++])
8711 else
8712     AC_MSG_RESULT([internal])
8713     BUILD_TYPE="$BUILD_TYPE GLM"
8714     SYSTEM_GLM=
8715     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8717 AC_SUBST([GLM_CFLAGS])
8718 AC_SUBST([SYSTEM_GLM])
8720 dnl ===================================================================
8721 dnl Check for system odbc
8722 dnl ===================================================================
8723 AC_MSG_CHECKING([which odbc headers to use])
8724 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
8725     AC_MSG_RESULT([external])
8726     SYSTEM_ODBC_HEADERS=TRUE
8728     if test "$build_os" = "cygwin"; then
8729         save_CPPFLAGS=$CPPFLAGS
8730         find_winsdk
8731         PathFormat "$winsdktest"
8732         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"
8733         AC_CHECK_HEADER(sqlext.h, [],
8734             [AC_MSG_ERROR(odbc not found. install odbc)],
8735             [#include <windows.h>])
8736         CPPFLAGS=$save_CPPFLAGS
8737     else
8738         AC_CHECK_HEADER(sqlext.h, [],
8739             [AC_MSG_ERROR(odbc not found. install odbc)],[])
8740     fi
8741 elif test "$enable_database_connectivity" != yes; then
8742     AC_MSG_RESULT([none])
8743 else
8744     AC_MSG_RESULT([internal])
8745     SYSTEM_ODBC_HEADERS=
8747 AC_SUBST(SYSTEM_ODBC_HEADERS)
8750 dnl ===================================================================
8751 dnl Check for system openldap
8752 dnl ===================================================================
8754 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8755 AC_MSG_CHECKING([which openldap library to use])
8756 if test "$with_system_openldap" = "yes"; then
8757     AC_MSG_RESULT([external])
8758     SYSTEM_OPENLDAP=TRUE
8759     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8760     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8761     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8762 else
8763     AC_MSG_RESULT([internal])
8764     SYSTEM_OPENLDAP=
8765     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8768 AC_SUBST(SYSTEM_OPENLDAP)
8770 dnl ===================================================================
8771 dnl Check for system NSS
8772 dnl ===================================================================
8773 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
8774     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8775     AC_DEFINE(HAVE_FEATURE_NSS)
8776     ENABLE_NSS="TRUE"
8777     AC_DEFINE(ENABLE_NSS)
8778 elif test $_os != iOS ; then
8779     with_tls=openssl
8781 AC_SUBST(ENABLE_NSS)
8783 dnl ===================================================================
8784 dnl Check for TLS/SSL and cryptographic implementation to use
8785 dnl ===================================================================
8786 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8787 if test -n "$with_tls"; then
8788     case $with_tls in
8789     openssl)
8790         AC_DEFINE(USE_TLS_OPENSSL)
8791         TLS=OPENSSL
8793         if test "$enable_openssl" != "yes"; then
8794             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8795         fi
8797         # warn that OpenSSL has been selected but not all TLS code has this option
8798         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
8799         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
8800         ;;
8801     nss)
8802         AC_DEFINE(USE_TLS_NSS)
8803         TLS=NSS
8804         ;;
8805     no)
8806         AC_MSG_WARN([Skipping TLS/SSL])
8807         ;;
8808     *)
8809         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8810 openssl - OpenSSL
8811 nss - Mozilla's Network Security Services (NSS)
8812     ])
8813         ;;
8814     esac
8815 else
8816     # default to using NSS, it results in smaller oox lib
8817     AC_DEFINE(USE_TLS_NSS)
8818     TLS=NSS
8820 AC_MSG_RESULT([$TLS])
8821 AC_SUBST(TLS)
8823 dnl ===================================================================
8824 dnl Check for system sane
8825 dnl ===================================================================
8826 AC_MSG_CHECKING([which sane header to use])
8827 if test "$with_system_sane" = "yes"; then
8828     AC_MSG_RESULT([external])
8829     AC_CHECK_HEADER(sane/sane.h, [],
8830       [AC_MSG_ERROR(sane not found. install sane)], [])
8831 else
8832     AC_MSG_RESULT([internal])
8833     BUILD_TYPE="$BUILD_TYPE SANE"
8836 dnl ===================================================================
8837 dnl Check for system icu
8838 dnl ===================================================================
8839 SYSTEM_GENBRK=
8840 SYSTEM_GENCCODE=
8841 SYSTEM_GENCMN=
8843 ICU_MAJOR=60
8844 ICU_MINOR=2
8845 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
8846 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
8847 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
8848 AC_MSG_CHECKING([which icu to use])
8849 if test "$with_system_icu" = "yes"; then
8850     AC_MSG_RESULT([external])
8851     SYSTEM_ICU=TRUE
8852     AC_LANG_PUSH([C++])
8853     AC_MSG_CHECKING([for unicode/rbbi.h])
8854     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
8855     AC_LANG_POP([C++])
8857     if test "$cross_compiling" != "yes"; then
8858         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
8859         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
8860         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
8861         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
8862     fi
8864     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
8865         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
8866         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
8867         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
8868         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
8869         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
8870             AC_MSG_RESULT([yes])
8871         else
8872             AC_MSG_RESULT([no])
8873             if test "$with_system_icu_for_build" != "force"; then
8874                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
8875 You can use --with-system-icu-for-build=force to use it anyway.])
8876             fi
8877         fi
8878     fi
8880     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
8881         # using the system icu tools can lead to version confusion, use the
8882         # ones from the build environment when cross-compiling
8883         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
8884         if test -z "$SYSTEM_GENBRK"; then
8885             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
8886         fi
8887         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8888         if test -z "$SYSTEM_GENCCODE"; then
8889             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
8890         fi
8891         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8892         if test -z "$SYSTEM_GENCMN"; then
8893             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
8894         fi
8895         if test "$ICU_MAJOR" -ge "49"; then
8896             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
8897             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
8898             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
8899         else
8900             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
8901             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
8902             ICU_RECLASSIFIED_HEBREW_LETTER=
8903         fi
8904     fi
8906     if test "$cross_compiling" = "yes"; then
8907         if test "$ICU_MAJOR" -ge "50"; then
8908             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
8909             ICU_MINOR=""
8910         fi
8911     fi
8912 else
8913     AC_MSG_RESULT([internal])
8914     SYSTEM_ICU=
8915     BUILD_TYPE="$BUILD_TYPE ICU"
8916     # surprisingly set these only for "internal" (to be used by various other
8917     # external libs): the system icu-config is quite unhelpful and spits out
8918     # dozens of weird flags and also default path -I/usr/include
8919     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8920     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
8922 if test "$ICU_MAJOR" -ge "59"; then
8923     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
8924     # with -std=c++11 but not all external libraries can be built with that,
8925     # for those use a bit-compatible typedef uint16_t UChar; see
8926     # icu/source/common/unicode/umachine.h
8927     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
8928 else
8929     ICU_UCHAR_TYPE=""
8931 AC_SUBST(SYSTEM_ICU)
8932 AC_SUBST(SYSTEM_GENBRK)
8933 AC_SUBST(SYSTEM_GENCCODE)
8934 AC_SUBST(SYSTEM_GENCMN)
8935 AC_SUBST(ICU_MAJOR)
8936 AC_SUBST(ICU_MINOR)
8937 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
8938 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
8939 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
8940 AC_SUBST(ICU_CFLAGS)
8941 AC_SUBST(ICU_LIBS)
8942 AC_SUBST(ICU_UCHAR_TYPE)
8944 dnl ==================================================================
8945 dnl Breakpad
8946 dnl ==================================================================
8947 AC_MSG_CHECKING([whether to enable breakpad])
8948 if test "$enable_breakpad" != yes; then
8949     AC_MSG_RESULT([no])
8950 else
8951     AC_MSG_RESULT([yes])
8952     ENABLE_BREAKPAD="TRUE"
8953     AC_DEFINE(ENABLE_BREAKPAD)
8954     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
8955     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
8957     AC_MSG_CHECKING([for crashreport config])
8958     if test "$with_symbol_config" = "no"; then
8959         BREAKPAD_SYMBOL_CONFIG="invalid"
8960         AC_MSG_RESULT([no])
8961     else
8962         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
8963         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
8964         AC_MSG_RESULT([yes])
8965     fi
8966     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
8968 AC_SUBST(ENABLE_BREAKPAD)
8970 dnl ==================================================================
8971 dnl libfuzzer
8972 dnl ==================================================================
8973 AC_MSG_CHECKING([whether to enable fuzzers])
8974 if test "$enable_fuzzers" != yes; then
8975     AC_MSG_RESULT([no])
8976 else
8977     AC_MSG_RESULT([yes])
8978     ENABLE_FUZZERS="TRUE"
8979     AC_DEFINE(ENABLE_FUZZERS)
8980     BUILD_TYPE="$BUILD_TYPE FUZZERS"
8982 AC_SUBST(ENABLE_FUZZERS)
8984 dnl ===================================================================
8985 dnl Orcus
8986 dnl ===================================================================
8987 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.13 >= 0.13.0])
8988 if test "$with_system_orcus" != "yes"; then
8989     if test "$SYSTEM_BOOST" = "TRUE"; then
8990         # ===========================================================
8991         # Determine if we are going to need to link with Boost.System
8992         # ===========================================================
8993         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
8994         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
8995         dnl in documentation has no effect.
8996         AC_MSG_CHECKING([if we need to link with Boost.System])
8997         AC_LANG_PUSH([C++])
8998         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
8999                 @%:@include <boost/version.hpp>
9000             ]],[[
9001                 #if BOOST_VERSION >= 105000
9002                 #   error yes, we need to link with Boost.System
9003                 #endif
9004             ]])],[
9005                 AC_MSG_RESULT([no])
9006             ],[
9007                 AC_MSG_RESULT([yes])
9008                 AX_BOOST_SYSTEM
9009         ])
9010         AC_LANG_POP([C++])
9011     fi
9013 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9014 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9015 AC_SUBST([BOOST_SYSTEM_LIB])
9016 AC_SUBST(SYSTEM_LIBORCUS)
9018 dnl ===================================================================
9019 dnl HarfBuzz
9020 dnl ===================================================================
9021 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9022                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9023                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9025 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9026                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9027                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9029 if test "$COM" = "MSC"; then # override the above
9030     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9031     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9034 if test "$with_system_harfbuzz" = "yes"; then
9035     if test "$with_system_graphite" = "no"; then
9036         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9037     fi
9038     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9039     _save_libs="$LIBS"
9040     _save_cflags="$CFLAGS"
9041     LIBS="$LIBS $HARFBUZZ_LIBS"
9042     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9043     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9044     LIBS="$_save_libs"
9045     CFLAGS="$_save_cflags"
9046 else
9047     if test "$with_system_graphite" = "yes"; then
9048         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9049     fi
9052 AC_MSG_CHECKING([whether to use X11])
9053 dnl ***************************************
9054 dnl testing for X libraries and includes...
9055 dnl ***************************************
9056 if test "$USING_X11" = TRUE; then
9057     AC_DEFINE(HAVE_FEATURE_X11)
9059 AC_MSG_RESULT([$USING_X11])
9061 if test "$USING_X11" = TRUE; then
9062     AC_PATH_X
9063     AC_PATH_XTRA
9064     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9066     if test -z "$x_includes"; then
9067         x_includes="default_x_includes"
9068     fi
9069     if test -z "$x_libraries"; then
9070         x_libraries="default_x_libraries"
9071     fi
9072     CFLAGS="$CFLAGS $X_CFLAGS"
9073     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9074     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9075 else
9076     x_includes="no_x_includes"
9077     x_libraries="no_x_libraries"
9080 if test "$USING_X11" = TRUE; then
9081     dnl ===================================================================
9082     dnl Check for extension headers
9083     dnl ===================================================================
9084     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9085      [#include <X11/extensions/shape.h>])
9087     # vcl needs ICE and SM
9088     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9089     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9090         [AC_MSG_ERROR(ICE library not found)])
9091     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9092     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9093         [AC_MSG_ERROR(SM library not found)])
9096 dnl ===================================================================
9097 dnl Check for system Xrender
9098 dnl ===================================================================
9099 AC_MSG_CHECKING([whether to use Xrender])
9100 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9101     AC_MSG_RESULT([yes])
9102     PKG_CHECK_MODULES(XRENDER, xrender)
9103     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9104     FilterLibs "${XRENDER_LIBS}"
9105     XRENDER_LIBS="${filteredlibs}"
9106     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9107       [AC_MSG_ERROR(libXrender not found or functional)], [])
9108     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9109       [AC_MSG_ERROR(Xrender not found. install X)], [])
9110 else
9111     AC_MSG_RESULT([no])
9113 AC_SUBST(XRENDER_CFLAGS)
9114 AC_SUBST(XRENDER_LIBS)
9116 dnl ===================================================================
9117 dnl Check for XRandr
9118 dnl ===================================================================
9119 AC_MSG_CHECKING([whether to enable RandR support])
9120 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9121     AC_MSG_RESULT([yes])
9122     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9123     if test "$ENABLE_RANDR" != "TRUE"; then
9124         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9125                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9126         XRANDR_CFLAGS=" "
9127         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9128           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9129         XRANDR_LIBS="-lXrandr "
9130         ENABLE_RANDR="TRUE"
9131     fi
9132     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9133     FilterLibs "${XRANDR_LIBS}"
9134     XRANDR_LIBS="${filteredlibs}"
9135 else
9136     ENABLE_RANDR=""
9137     AC_MSG_RESULT([no])
9139 AC_SUBST(XRANDR_CFLAGS)
9140 AC_SUBST(XRANDR_LIBS)
9141 AC_SUBST(ENABLE_RANDR)
9143 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9144     WITH_WEBDAV="serf"
9146 if test $_os = iOS -o $_os = Android; then
9147     WITH_WEBDAV="no"
9149 AC_MSG_CHECKING([for webdav library])
9150 case "$WITH_WEBDAV" in
9151 serf)
9152     AC_MSG_RESULT([serf])
9153     # Check for system apr-util
9154     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9155                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9156                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9157     if test "$COM" = "MSC"; then
9158         APR_LIB_DIR="LibR"
9159         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9160         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9161     fi
9163     # Check for system serf
9164     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9165                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9166     if test "$COM" = "MSC"; then
9167         SERF_LIB_DIR="Release"
9168         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9169         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9170     fi
9171     ;;
9172 neon)
9173     AC_MSG_RESULT([neon])
9174     # Check for system neon
9175     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9176     if test "$with_system_neon" = "yes"; then
9177         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9178     else
9179         NEON_VERSION=0295
9180     fi
9181     AC_SUBST(NEON_VERSION)
9182     ;;
9184     AC_MSG_RESULT([none, disabled])
9185     WITH_WEBDAV=""
9186     ;;
9187 esac
9188 AC_SUBST(WITH_WEBDAV)
9190 dnl ===================================================================
9191 dnl Check for disabling cve_tests
9192 dnl ===================================================================
9193 AC_MSG_CHECKING([whether to execute CVE tests])
9194 # If not explicitly enabled or disabled, default
9195 if test -z "$enable_cve_tests"; then
9196     case "$OS" in
9197     WNT)
9198         # Default cves off for windows with its wild and wonderful
9199         # varienty of AV software kicking in and panicing
9200         enable_cve_tests=no
9201         ;;
9202     *)
9203         # otherwise yes
9204         enable_cve_tests=yes
9205         ;;
9206     esac
9208 if test "$enable_cve_tests" = "no"; then
9209     AC_MSG_RESULT([no])
9210     DISABLE_CVE_TESTS=TRUE
9211     AC_SUBST(DISABLE_CVE_TESTS)
9212 else
9213     AC_MSG_RESULT([yes])
9216 dnl ===================================================================
9217 dnl Check for enabling chart XShape tests
9218 dnl ===================================================================
9219 AC_MSG_CHECKING([whether to execute chart XShape tests])
9220 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9221     AC_MSG_RESULT([yes])
9222     ENABLE_CHART_TESTS=TRUE
9223     AC_SUBST(ENABLE_CHART_TESTS)
9224 else
9225     AC_MSG_RESULT([no])
9228 dnl ===================================================================
9229 dnl Check for system openssl
9230 dnl ===================================================================
9231 DISABLE_OPENSSL=
9232 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9233 if test "$enable_openssl" = "yes"; then
9234     AC_MSG_RESULT([no])
9235     if test "$_os" = Darwin ; then
9236         # OpenSSL is deprecated when building for 10.7 or later.
9237         #
9238         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9239         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9241         with_system_openssl=no
9242         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9243     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9244             && test "$with_system_openssl" != "no"; then
9245         with_system_openssl=yes
9246         SYSTEM_OPENSSL=TRUE
9247         OPENSSL_CFLAGS=
9248         OPENSSL_LIBS="-lssl -lcrypto"
9249     else
9250         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9251     fi
9252     if test "$with_system_openssl" = "yes"; then
9253         AC_MSG_CHECKING([whether openssl supports SHA512])
9254         AC_LANG_PUSH([C])
9255         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9256             SHA512_CTX context;
9257 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9258         AC_LANG_POP(C)
9259     fi
9260 else
9261     AC_MSG_RESULT([yes])
9262     DISABLE_OPENSSL=TRUE
9264     # warn that although OpenSSL is disabled, system libraries may depend on it
9265     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9266     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9269 AC_SUBST([DISABLE_OPENSSL])
9271 dnl ===================================================================
9272 dnl Check for building gnutls
9273 dnl ===================================================================
9274 AC_MSG_CHECKING([whether to use gnutls])
9275 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9276     AC_MSG_RESULT([yes])
9277     AM_PATH_LIBGCRYPT()
9278     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9279         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9280                       available in the system to use as replacement.]]))
9281     FilterLibs "${LIBGCRYPT_LIBS}"
9282     LIBGCRYPT_LIBS="${filteredlibs}"
9283 else
9284     AC_MSG_RESULT([no])
9287 AC_SUBST([LIBGCRYPT_CFLAGS])
9288 AC_SUBST([LIBGCRYPT_LIBS])
9290 dnl ===================================================================
9291 dnl Check for system redland
9292 dnl ===================================================================
9293 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9294 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9295 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9296 if test "$with_system_redland" = "yes"; then
9297     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9298             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9299 else
9300     RAPTOR_MAJOR="0"
9301     RASQAL_MAJOR="3"
9302     REDLAND_MAJOR="0"
9304 AC_SUBST(RAPTOR_MAJOR)
9305 AC_SUBST(RASQAL_MAJOR)
9306 AC_SUBST(REDLAND_MAJOR)
9308 dnl ===================================================================
9309 dnl Check for system hunspell
9310 dnl ===================================================================
9311 AC_MSG_CHECKING([which libhunspell to use])
9312 if test "$with_system_hunspell" = "yes"; then
9313     AC_MSG_RESULT([external])
9314     SYSTEM_HUNSPELL=TRUE
9315     AC_LANG_PUSH([C++])
9316     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9317     if test "$HUNSPELL_PC" != "TRUE"; then
9318         AC_CHECK_HEADER(hunspell.hxx, [],
9319             [
9320             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9321             [AC_MSG_ERROR(hunspell headers not found.)], [])
9322             ], [])
9323         AC_CHECK_LIB([hunspell], [main], [:],
9324            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9325         HUNSPELL_LIBS=-lhunspell
9326     fi
9327     AC_LANG_POP([C++])
9328     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9329     FilterLibs "${HUNSPELL_LIBS}"
9330     HUNSPELL_LIBS="${filteredlibs}"
9331 else
9332     AC_MSG_RESULT([internal])
9333     SYSTEM_HUNSPELL=
9334     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9335     if test "$COM" = "MSC"; then
9336         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9337     else
9338         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.6"
9339     fi
9340     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9342 AC_SUBST(SYSTEM_HUNSPELL)
9343 AC_SUBST(HUNSPELL_CFLAGS)
9344 AC_SUBST(HUNSPELL_LIBS)
9346 dnl ===================================================================
9347 dnl Checking for altlinuxhyph
9348 dnl ===================================================================
9349 AC_MSG_CHECKING([which altlinuxhyph to use])
9350 if test "$with_system_altlinuxhyph" = "yes"; then
9351     AC_MSG_RESULT([external])
9352     SYSTEM_HYPH=TRUE
9353     AC_CHECK_HEADER(hyphen.h, [],
9354        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9355     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9356        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9357        [#include <hyphen.h>])
9358     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9359         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9360     if test -z "$HYPHEN_LIB"; then
9361         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9362            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9363     fi
9364     if test -z "$HYPHEN_LIB"; then
9365         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9366            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9367     fi
9368 else
9369     AC_MSG_RESULT([internal])
9370     SYSTEM_HYPH=
9371     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9372     if test "$COM" = "MSC"; then
9373         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9374     else
9375         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9376     fi
9378 AC_SUBST(SYSTEM_HYPH)
9379 AC_SUBST(HYPHEN_LIB)
9381 dnl ===================================================================
9382 dnl Checking for mythes
9383 dnl ===================================================================
9384 AC_MSG_CHECKING([which mythes to use])
9385 if test "$with_system_mythes" = "yes"; then
9386     AC_MSG_RESULT([external])
9387     SYSTEM_MYTHES=TRUE
9388     AC_LANG_PUSH([C++])
9389     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9390     if test "$MYTHES_PKGCONFIG" = "no"; then
9391         AC_CHECK_HEADER(mythes.hxx, [],
9392             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9393         AC_CHECK_LIB([mythes-1.2], [main], [:],
9394             [ MYTHES_FOUND=no], [])
9395     if test "$MYTHES_FOUND" = "no"; then
9396         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9397                 [ MYTHES_FOUND=no], [])
9398     fi
9399     if test "$MYTHES_FOUND" = "no"; then
9400         AC_MSG_ERROR([mythes library not found!.])
9401     fi
9402     fi
9403     AC_LANG_POP([C++])
9404     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9405     FilterLibs "${MYTHES_LIBS}"
9406     MYTHES_LIBS="${filteredlibs}"
9407 else
9408     AC_MSG_RESULT([internal])
9409     SYSTEM_MYTHES=
9410     BUILD_TYPE="$BUILD_TYPE MYTHES"
9411     if test "$COM" = "MSC"; then
9412         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9413     else
9414         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9415     fi
9417 AC_SUBST(SYSTEM_MYTHES)
9418 AC_SUBST(MYTHES_CFLAGS)
9419 AC_SUBST(MYTHES_LIBS)
9421 dnl ===================================================================
9422 dnl How should we build the linear programming solver ?
9423 dnl ===================================================================
9425 ENABLE_COINMP=
9426 AC_MSG_CHECKING([whether to build with CoinMP])
9427 if test "$enable_coinmp" != "no"; then
9428     ENABLE_COINMP=TRUE
9429     AC_MSG_RESULT([yes])
9430     if test "$with_system_coinmp" = "yes"; then
9431         SYSTEM_COINMP=TRUE
9432         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9433         FilterLibs "${COINMP_LIBS}"
9434         COINMP_LIBS="${filteredlibs}"
9435     else
9436         BUILD_TYPE="$BUILD_TYPE COINMP"
9437     fi
9438 else
9439     AC_MSG_RESULT([no])
9441 AC_SUBST(ENABLE_COINMP)
9442 AC_SUBST(SYSTEM_COINMP)
9443 AC_SUBST(COINMP_CFLAGS)
9444 AC_SUBST(COINMP_LIBS)
9446 ENABLE_LPSOLVE=
9447 AC_MSG_CHECKING([whether to build with lpsolve])
9448 if test "$enable_lpsolve" != "no"; then
9449     ENABLE_LPSOLVE=TRUE
9450     AC_MSG_RESULT([yes])
9451 else
9452     AC_MSG_RESULT([no])
9454 AC_SUBST(ENABLE_LPSOLVE)
9456 if test "$ENABLE_LPSOLVE" = TRUE; then
9457     AC_MSG_CHECKING([which lpsolve to use])
9458     if test "$with_system_lpsolve" = "yes"; then
9459         AC_MSG_RESULT([external])
9460         SYSTEM_LPSOLVE=TRUE
9461         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9462            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9463         save_LIBS=$LIBS
9464         # some systems need this. Like Ubuntu....
9465         AC_CHECK_LIB(m, floor)
9466         AC_CHECK_LIB(dl, dlopen)
9467         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9468             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9469         LIBS=$save_LIBS
9470     else
9471         AC_MSG_RESULT([internal])
9472         SYSTEM_LPSOLVE=
9473         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9474     fi
9476 AC_SUBST(SYSTEM_LPSOLVE)
9478 dnl ===================================================================
9479 dnl Checking for libexttextcat
9480 dnl ===================================================================
9481 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9482 if test "$with_system_libexttextcat" = "yes"; then
9483     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9485 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9487 dnl ***************************************
9488 dnl testing libc version for Linux...
9489 dnl ***************************************
9490 if test "$_os" = "Linux"; then
9491     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9492     exec 6>/dev/null # no output
9493     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9494     exec 6>&1 # output on again
9495     if test "$HAVE_LIBC"; then
9496         AC_MSG_RESULT([yes])
9497     else
9498         AC_MSG_ERROR([no, upgrade libc])
9499     fi
9502 dnl =========================================
9503 dnl Check for uuidgen
9504 dnl =========================================
9505 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9506     # presence is already tested above in the WINDOWS_SDK_HOME check
9507     UUIDGEN=uuidgen.exe
9508     AC_SUBST(UUIDGEN)
9509 else
9510     AC_PATH_PROG([UUIDGEN], [uuidgen])
9511     if test -z "$UUIDGEN"; then
9512         AC_MSG_WARN([uuid is needed for building installation sets])
9513     fi
9516 dnl ***************************************
9517 dnl Checking for bison and flex
9518 dnl ***************************************
9519 AC_PATH_PROG(BISON, bison)
9520 if test -z "$BISON"; then
9521     AC_MSG_ERROR([no bison found in \$PATH, install it])
9522 else
9523     AC_MSG_CHECKING([the bison version])
9524     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9525     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9526     # Accept newer than 2.0
9527     if test "$_bison_longver" -lt 2000; then
9528         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9529     fi
9532 AC_PATH_PROG(FLEX, flex)
9533 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9534     FLEX=`cygpath -m $FLEX`
9536 if test -z "$FLEX"; then
9537     AC_MSG_ERROR([no flex found in \$PATH, install it])
9538 else
9539     AC_MSG_CHECKING([the flex version])
9540     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9541     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9542         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9543     fi
9545 AC_SUBST([FLEX])
9546 dnl ***************************************
9547 dnl Checking for patch
9548 dnl ***************************************
9549 AC_PATH_PROG(PATCH, patch)
9550 if test -z "$PATCH"; then
9551     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9554 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9555 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9556     if test -z "$with_gnu_patch"; then
9557         GNUPATCH=$PATCH
9558     else
9559         if test -x "$with_gnu_patch"; then
9560             GNUPATCH=$with_gnu_patch
9561         else
9562             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9563         fi
9564     fi
9566     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9567     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9568         AC_MSG_RESULT([yes])
9569     else
9570         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9571     fi
9572 else
9573     GNUPATCH=$PATCH
9576 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9577     GNUPATCH=`cygpath -m $GNUPATCH`
9580 dnl We also need to check for --with-gnu-cp
9582 if test -z "$with_gnu_cp"; then
9583     # check the place where the good stuff is hidden on Solaris...
9584     if test -x /usr/gnu/bin/cp; then
9585         GNUCP=/usr/gnu/bin/cp
9586     else
9587         AC_PATH_PROGS(GNUCP, gnucp cp)
9588     fi
9589     if test -z $GNUCP; then
9590         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9591     fi
9592 else
9593     if test -x "$with_gnu_cp"; then
9594         GNUCP=$with_gnu_cp
9595     else
9596         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9597     fi
9600 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9601     GNUCP=`cygpath -m $GNUCP`
9604 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9605 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9606     AC_MSG_RESULT([yes])
9607 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9608     AC_MSG_RESULT([yes])
9609 else
9610     case "$build_os" in
9611     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9612         x_GNUCP=[\#]
9613         GNUCP=''
9614         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9615         ;;
9616     *)
9617         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9618         ;;
9619     esac
9622 AC_SUBST(GNUPATCH)
9623 AC_SUBST(GNUCP)
9624 AC_SUBST(x_GNUCP)
9626 dnl ***************************************
9627 dnl testing assembler path
9628 dnl ***************************************
9629 ML_EXE=""
9630 if test "$_os" = "WINNT"; then
9631     if test "$BITNESS_OVERRIDE" = ""; then
9632         assembler=ml.exe
9633         assembler_bin=$CL_DIR
9634     else
9635         assembler=ml64.exe
9636         assembler_bin=$CL_DIR
9637     fi
9639     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9640     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9641         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9642         AC_MSG_RESULT([found])
9643         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9644     else
9645         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9646     fi
9648     PathFormat "$ASM_HOME"
9649     ASM_HOME="$formatted_path"
9650 else
9651     ASM_HOME=""
9654 AC_SUBST(ML_EXE)
9656 dnl ===================================================================
9657 dnl We need zip and unzip
9658 dnl ===================================================================
9659 AC_PATH_PROG(ZIP, zip)
9660 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9661 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9662     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],,)
9665 AC_PATH_PROG(UNZIP, unzip)
9666 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9668 dnl ===================================================================
9669 dnl Zip must be a specific type for different build types.
9670 dnl ===================================================================
9671 if test $build_os = cygwin; then
9672     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9673         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9674     fi
9677 dnl ===================================================================
9678 dnl We need touch with -h option support.
9679 dnl ===================================================================
9680 AC_PATH_PROG(TOUCH, touch)
9681 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
9682 touch warn
9683 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
9684     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],,)
9687 dnl ===================================================================
9688 dnl Check for system epoxy
9689 dnl ===================================================================
9690 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
9692 dnl ===================================================================
9693 dnl Set vcl option: coordinate device in double or sal_Int32
9694 dnl ===================================================================
9696 dnl disabled for now, we don't want subtle differences between OSs
9697 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
9698 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
9699 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
9700 dnl     AC_MSG_RESULT([double])
9701 dnl else
9702 dnl     AC_MSG_RESULT([sal_Int32])
9703 dnl fi
9705 dnl ===================================================================
9706 dnl Test which vclplugs have to be built.
9707 dnl ===================================================================
9708 R=""
9709 if test "$USING_X11" != TRUE; then
9710     enable_gtk=no
9711     enable_gtk3=no
9713 GTK3_CFLAGS=""
9714 GTK3_LIBS=""
9715 ENABLE_GTK3=""
9716 if test "x$enable_gtk3" = "xyes"; then
9717     if test "$with_system_cairo" = no; then
9718         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
9719     fi
9720     : ${with_system_cairo:=yes}
9721     PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.18 gtk+-unix-print-3.0 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo, ENABLE_GTK3="TRUE", ENABLE_GTK3="")
9722     if test "x$ENABLE_GTK3" = "xTRUE"; then
9723         R="gtk3"
9724         dnl Avoid installed by unpackaged files for now.
9725         if test -z "$PKGFORMAT"; then
9726             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
9727         fi
9728     else
9729         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
9730     fi
9731     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9732     FilterLibs "${GTK3_LIBS}"
9733     GTK3_LIBS="${filteredlibs}"
9735     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
9736     if test "$with_system_epoxy" != "yes"; then
9737         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
9738     fi
9740 AC_SUBST(GTK3_LIBS)
9741 AC_SUBST(GTK3_CFLAGS)
9742 AC_SUBST(ENABLE_GTK3)
9744 ENABLE_GTK=""
9745 if test "x$enable_gtk" = "xyes"; then
9746     if test "$with_system_cairo" = no; then
9747         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
9748     fi
9749     : ${with_system_cairo:=yes}
9750     ENABLE_GTK="TRUE"
9751     AC_DEFINE(ENABLE_GTK)
9752     R="gtk $R"
9754 AC_SUBST(ENABLE_GTK)
9756 ENABLE_KDE4=""
9757 if test "x$enable_kde4" = "xyes"; then
9758     ENABLE_KDE4="TRUE"
9759     AC_DEFINE(ENABLE_KDE4)
9760     R="$R kde4"
9762 AC_SUBST(ENABLE_KDE4)
9764 ENABLE_QT5=""
9765 if test "x$enable_qt5" = "xyes"; then
9766     ENABLE_QT5="TRUE"
9767     AC_DEFINE(ENABLE_QT5)
9768     R="$R qt5"
9770 AC_SUBST(ENABLE_QT5)
9772 build_vcl_plugins="$R"
9773 if test -z "$build_vcl_plugins"; then
9774     build_vcl_plugins="none"
9776 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
9778 dnl ===================================================================
9779 dnl check for dbus support
9780 dnl ===================================================================
9781 ENABLE_DBUS=""
9782 DBUS_CFLAGS=""
9783 DBUS_LIBS=""
9785 if test "$enable_dbus" = "no"; then
9786     test_dbus=no
9789 AC_MSG_CHECKING([whether to enable DBUS support])
9790 if test "$test_dbus" = "yes"; then
9791     ENABLE_DBUS="TRUE"
9792     AC_MSG_RESULT([yes])
9793     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
9794     AC_DEFINE(ENABLE_DBUS)
9795     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9796     FilterLibs "${DBUS_LIBS}"
9797     DBUS_LIBS="${filteredlibs}"
9798 else
9799     AC_MSG_RESULT([no])
9802 AC_SUBST(ENABLE_DBUS)
9803 AC_SUBST(DBUS_CFLAGS)
9804 AC_SUBST(DBUS_LIBS)
9806 AC_MSG_CHECKING([whether to enable Impress remote control])
9807 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
9808     AC_MSG_RESULT([yes])
9809     ENABLE_SDREMOTE=TRUE
9810     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
9812     # If not explicitly enabled or disabled, default
9813     if test -z "$enable_sdremote_bluetooth"; then
9814         case "$OS" in
9815         LINUX|MACOSX|WNT)
9816             # Default to yes for these
9817             enable_sdremote_bluetooth=yes
9818             ;;
9819         *)
9820             # otherwise no
9821             enable_sdremote_bluetooth=no
9822             ;;
9823         esac
9824     fi
9825     # $enable_sdremote_bluetooth is guaranteed non-empty now
9827     if test "$enable_sdremote_bluetooth" != "no"; then
9828         if test "$OS" = "LINUX"; then
9829             if test "$ENABLE_DBUS" = "TRUE"; then
9830                 AC_MSG_RESULT([yes])
9831                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
9832                 dnl ===================================================================
9833                 dnl Check for system bluez
9834                 dnl ===================================================================
9835                 AC_MSG_CHECKING([which Bluetooth header to use])
9836                 if test "$with_system_bluez" = "yes"; then
9837                     AC_MSG_RESULT([external])
9838                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
9839                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
9840                     SYSTEM_BLUEZ=TRUE
9841                 else
9842                     AC_MSG_RESULT([internal])
9843                     SYSTEM_BLUEZ=
9844                 fi
9845             else
9846                 AC_MSG_RESULT([no, dbus disabled])
9847                 ENABLE_SDREMOTE_BLUETOOTH=
9848                 SYSTEM_BLUEZ=
9849             fi
9850         else
9851             AC_MSG_RESULT([yes])
9852             ENABLE_SDREMOTE_BLUETOOTH=TRUE
9853             SYSTEM_BLUEZ=
9854         fi
9855     else
9856         AC_MSG_RESULT([no])
9857         ENABLE_SDREMOTE_BLUETOOTH=
9858         SYSTEM_BLUEZ=
9859     fi
9860 else
9861     ENABLE_SDREMOTE=
9862     SYSTEM_BLUEZ=
9863     AC_MSG_RESULT([no])
9865 AC_SUBST(ENABLE_SDREMOTE)
9866 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
9867 AC_SUBST(SYSTEM_BLUEZ)
9869 dnl ===================================================================
9870 dnl Check whether the gtk 2.0 libraries are available.
9871 dnl ===================================================================
9873 GTK_CFLAGS=""
9874 GTK_LIBS=""
9875 ENABLE_SYSTRAY_GTK=""
9876 if test  "$test_gtk" = "yes"; then
9878     if test "$ENABLE_GTK" = "TRUE"; then
9879         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]))
9880         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9881         FilterLibs "${GTK_LIBS}"
9882         GTK_LIBS="${filteredlibs}"
9883         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]))
9884         BUILD_TYPE="$BUILD_TYPE GTK"
9885         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9886         FilterLibs "${GTHREAD_LIBS}"
9887         GTHREAD_LIBS="${filteredlibs}"
9889         if test "x$enable_systray" = "xyes"; then
9890             ENABLE_SYSTRAY_GTK="TRUE"
9891         fi
9893         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
9894         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
9895                           [ENABLE_GTK_PRINT="TRUE"],
9896                           [ENABLE_GTK_PRINT=""])
9897         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9898         FilterLibs "${GTK_PRINT_LIBS}"
9899         GTK_PRINT_LIBS="${filteredlibs}"
9901         AC_MSG_CHECKING([whether to enable GIO support])
9902         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
9903             dnl Need at least 2.26 for the dbus support.
9904             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
9905                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
9906             if test "$ENABLE_GIO" = "TRUE"; then
9907                 AC_DEFINE(ENABLE_GIO)
9908                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9909                 FilterLibs "${GIO_LIBS}"
9910                 GIO_LIBS="${filteredlibs}"
9911             fi
9912         else
9913             AC_MSG_RESULT([no])
9914         fi
9915     fi
9917 AC_SUBST(ENABLE_GIO)
9918 AC_SUBST(GIO_CFLAGS)
9919 AC_SUBST(GIO_LIBS)
9920 AC_SUBST(ENABLE_SYSTRAY_GTK)
9921 AC_SUBST(GTK_CFLAGS)
9922 AC_SUBST(GTK_LIBS)
9923 AC_SUBST(GTHREAD_CFLAGS)
9924 AC_SUBST(GTHREAD_LIBS)
9925 AC_SUBST([ENABLE_GTK_PRINT])
9926 AC_SUBST([GTK_PRINT_CFLAGS])
9927 AC_SUBST([GTK_PRINT_LIBS])
9930 dnl ===================================================================
9932 SPLIT_APP_MODULES=""
9933 if test "$enable_split_app_modules" = "yes"; then
9934     SPLIT_APP_MODULES="TRUE"
9936 AC_SUBST(SPLIT_APP_MODULES)
9938 SPLIT_OPT_FEATURES=""
9939 if test "$enable_split_opt_features" = "yes"; then
9940     SPLIT_OPT_FEATURES="TRUE"
9942 AC_SUBST(SPLIT_OPT_FEATURES)
9944 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
9945     if test "$enable_cairo_canvas" = yes; then
9946         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
9947     fi
9948     enable_cairo_canvas=no
9949 elif test -z "$enable_cairo_canvas"; then
9950     enable_cairo_canvas=yes
9953 ENABLE_CAIRO_CANVAS=""
9954 if test "$enable_cairo_canvas" = "yes"; then
9955     test_cairo=yes
9956     ENABLE_CAIRO_CANVAS="TRUE"
9957     AC_DEFINE(ENABLE_CAIRO_CANVAS)
9959 AC_SUBST(ENABLE_CAIRO_CANVAS)
9961 dnl ===================================================================
9962 dnl Check whether the GStreamer libraries are available.
9963 dnl It's possible to build avmedia with both GStreamer backends!
9964 dnl ===================================================================
9966 ENABLE_GSTREAMER_1_0=""
9968 if test "$build_gstreamer_1_0" = "yes"; then
9970     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
9971     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
9972         ENABLE_GSTREAMER_1_0="TRUE"
9973         AC_MSG_RESULT([yes])
9974         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
9975         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9976         FilterLibs "${GSTREAMER_1_0_LIBS}"
9977         GSTREAMER_1_0_LIBS="${filteredlibs}"
9978     else
9979         AC_MSG_RESULT([no])
9980     fi
9982 AC_SUBST(GSTREAMER_1_0_CFLAGS)
9983 AC_SUBST(GSTREAMER_1_0_LIBS)
9984 AC_SUBST(ENABLE_GSTREAMER_1_0)
9987 ENABLE_GSTREAMER_0_10=""
9988 if test "$build_gstreamer_0_10" = "yes"; then
9990     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
9991     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
9992         ENABLE_GSTREAMER_0_10="TRUE"
9993         AC_MSG_RESULT([yes])
9994         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
9995             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
9996         ])
9997         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9998         FilterLibs "${GSTREAMER_0_10_LIBS}"
9999         GSTREAMER_0_10_LIBS="${filteredlibs}"
10000     else
10001         AC_MSG_RESULT([no])
10002     fi
10005 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10006 AC_SUBST(GSTREAMER_0_10_LIBS)
10007 AC_SUBST(ENABLE_GSTREAMER_0_10)
10009 dnl ===================================================================
10010 dnl Check whether to build the VLC avmedia backend
10011 dnl ===================================================================
10013 ENABLE_VLC=""
10015 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10016 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10017     ENABLE_VLC="TRUE"
10018     AC_MSG_RESULT([yes])
10019 else
10020     AC_MSG_RESULT([no])
10022 AC_SUBST(ENABLE_VLC)
10024 ENABLE_OPENGL_TRANSITIONS=
10025 ENABLE_OPENGL_CANVAS=
10026 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10027    : # disable
10028 elif test "$_os" = "Darwin"; then
10029     # We use frameworks on Mac OS X, no need for detail checks
10030     ENABLE_OPENGL_TRANSITIONS=TRUE
10031     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10032     ENABLE_OPENGL_CANVAS=TRUE
10033 elif test $_os = WINNT; then
10034     ENABLE_OPENGL_TRANSITIONS=TRUE
10035     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10036     ENABLE_OPENGL_CANVAS=TRUE
10037 else
10038     if test "$USING_X11" = TRUE; then
10039         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10040         ENABLE_OPENGL_TRANSITIONS=TRUE
10041         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10042         ENABLE_OPENGL_CANVAS=TRUE
10043     fi
10046 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10047 AC_SUBST(ENABLE_OPENGL_CANVAS)
10049 dnl =================================================
10050 dnl Check whether to build with OpenCL support.
10051 dnl =================================================
10053 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10054     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10055     # platform (optional at run-time, used through clew).
10056     BUILD_TYPE="$BUILD_TYPE OPENCL"
10057     AC_DEFINE(HAVE_FEATURE_OPENCL)
10060 dnl =================================================
10061 dnl Check whether to build with dconf support.
10062 dnl =================================================
10064 if test "$enable_dconf" != no; then
10065     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10066         if test "$enable_dconf" = yes; then
10067             AC_MSG_ERROR([dconf not found])
10068         else
10069             enable_dconf=no
10070         fi])
10072 AC_MSG_CHECKING([whether to enable dconf])
10073 if test "$enable_dconf" = no; then
10074     DCONF_CFLAGS=
10075     DCONF_LIBS=
10076     ENABLE_DCONF=
10077     AC_MSG_RESULT([no])
10078 else
10079     ENABLE_DCONF=TRUE
10080     AC_DEFINE(ENABLE_DCONF)
10081     AC_MSG_RESULT([yes])
10083 AC_SUBST([DCONF_CFLAGS])
10084 AC_SUBST([DCONF_LIBS])
10085 AC_SUBST([ENABLE_DCONF])
10087 # pdf import?
10088 AC_MSG_CHECKING([whether to build the PDF import feature])
10089 ENABLE_PDFIMPORT=
10090 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10091     AC_MSG_RESULT([yes])
10092     ENABLE_PDFIMPORT=TRUE
10093     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10095     dnl ===================================================================
10096     dnl Check for system poppler
10097     dnl ===================================================================
10098     AC_MSG_CHECKING([which PDF import backend to use])
10099     if test "$with_system_poppler" = "yes"; then
10100         AC_MSG_RESULT([external])
10101         SYSTEM_POPPLER=TRUE
10102         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10103         AC_LANG_PUSH([C++])
10104         save_CXXFLAGS=$CXXFLAGS
10105         save_CPPFLAGS=$CPPFLAGS
10106         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10107         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10108         AC_CHECK_HEADER([cpp/poppler-version.h],
10109             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10110             [])
10111         CXXFLAGS=$save_CXXFLAGS
10112         CPPFLAGS=$save_CPPFLAGS
10113         AC_LANG_POP([C++])
10114         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10116         FilterLibs "${POPPLER_LIBS}"
10117         POPPLER_LIBS="${filteredlibs}"
10118     else
10119         AC_MSG_RESULT([internal])
10120         SYSTEM_POPPLER=
10121         BUILD_TYPE="$BUILD_TYPE POPPLER"
10122         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10123     fi
10124     AC_DEFINE([ENABLE_PDFIMPORT],1)
10125 else
10126     AC_MSG_RESULT([no])
10128 AC_SUBST(ENABLE_PDFIMPORT)
10129 AC_SUBST(SYSTEM_POPPLER)
10130 AC_SUBST(POPPLER_CFLAGS)
10131 AC_SUBST(POPPLER_LIBS)
10133 # pdf import?
10134 AC_MSG_CHECKING([whether to build PDFium])
10135 ENABLE_PDFIUM=
10136 if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then
10137     AC_MSG_RESULT([yes])
10138     ENABLE_PDFIUM=TRUE
10139     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10140     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10141 else
10142     AC_MSG_RESULT([no])
10144 AC_SUBST(ENABLE_PDFIUM)
10146 SYSTEM_GPGMEPP=
10147 if test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10148     dnl ===================================================================
10149     dnl Check for system gpgme
10150     dnl ===================================================================
10151     AC_MSG_CHECKING([which gpgmepp to use])
10152     if test "$with_system_gpgmepp" = "yes"; then
10153         AC_MSG_RESULT([external])
10154         SYSTEM_GPGMEPP=TRUE
10156         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10157         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10158             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10159         # progress_callback is the only func with plain C linkage
10160         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10161         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10162             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10163         AC_CHECK_HEADER(gpgme.h, [],
10164             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10165     else
10166         AC_MSG_RESULT([internal])
10167         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10168         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10170         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10171         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10172         if test "$_os" != "WINNT"; then
10173             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10174             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10175         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10176             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10177         fi
10178     fi
10179     ENABLE_GPGMEPP=TRUE
10180     AC_DEFINE([HAVE_FEATURE_GPGME])
10181     AC_PATH_PROG(GPG, gpg)
10182     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10183     # so let's exclude that manually for the moment
10184     if test -n "$GPG" -a "$_os" != "WINNT"; then
10185         # make sure we not only have a working gpgme, but a full working
10186         # gpg installation to run OpenPGP signature verification
10187         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10188     fi
10190 AC_SUBST(ENABLE_GPGMEPP)
10191 AC_SUBST(SYSTEM_GPGMEPP)
10192 AC_SUBST(GPG_ERROR_CFLAGS)
10193 AC_SUBST(GPG_ERROR_LIBS)
10194 AC_SUBST(LIBASSUAN_CFLAGS)
10195 AC_SUBST(LIBASSUAN_LIBS)
10196 AC_SUBST(GPGMEPP_CFLAGS)
10197 AC_SUBST(GPGMEPP_LIBS)
10199 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10200 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10201     AC_MSG_RESULT([yes])
10202     ENABLE_MEDIAWIKI=TRUE
10203     BUILD_TYPE="$BUILD_TYPE XSLTML"
10204     if test  "x$with_java" = "xno"; then
10205         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10206     fi
10207 else
10208     AC_MSG_RESULT([no])
10209     ENABLE_MEDIAWIKI=
10210     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10212 AC_SUBST(ENABLE_MEDIAWIKI)
10214 AC_MSG_CHECKING([whether to build the Report Builder])
10215 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10216     AC_MSG_RESULT([yes])
10217     ENABLE_REPORTBUILDER=TRUE
10218     AC_MSG_CHECKING([which jfreereport libs to use])
10219     if test "$with_system_jfreereport" = "yes"; then
10220         SYSTEM_JFREEREPORT=TRUE
10221         AC_MSG_RESULT([external])
10222         if test -z $SAC_JAR; then
10223             SAC_JAR=/usr/share/java/sac.jar
10224         fi
10225         if ! test -f $SAC_JAR; then
10226              AC_MSG_ERROR(sac.jar not found.)
10227         fi
10229         if test -z $LIBXML_JAR; then
10230             if test -f /usr/share/java/libxml-1.0.0.jar; then
10231                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10232             elif test -f /usr/share/java/libxml.jar; then
10233                 LIBXML_JAR=/usr/share/java/libxml.jar
10234             else
10235                 AC_MSG_ERROR(libxml.jar replacement not found.)
10236             fi
10237         elif ! test -f $LIBXML_JAR; then
10238             AC_MSG_ERROR(libxml.jar not found.)
10239         fi
10241         if test -z $FLUTE_JAR; then
10242             if test -f/usr/share/java/flute-1.3.0.jar; then
10243                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10244             elif test -f /usr/share/java/flute.jar; then
10245                 FLUTE_JAR=/usr/share/java/flute.jar
10246             else
10247                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10248             fi
10249         elif ! test -f $FLUTE_JAR; then
10250             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10251         fi
10253         if test -z $JFREEREPORT_JAR; then
10254             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10255                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10256             elif test -f /usr/share/java/flow-engine.jar; then
10257                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10258             else
10259                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10260             fi
10261         elif ! test -f  $JFREEREPORT_JAR; then
10262                 AC_MSG_ERROR(jfreereport.jar not found.)
10263         fi
10265         if test -z $LIBLAYOUT_JAR; then
10266             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10267                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10268             elif test -f /usr/share/java/liblayout.jar; then
10269                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10270             else
10271                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10272             fi
10273         elif ! test -f $LIBLAYOUT_JAR; then
10274                 AC_MSG_ERROR(liblayout.jar not found.)
10275         fi
10277         if test -z $LIBLOADER_JAR; then
10278             if test -f /usr/share/java/libloader-1.0.0.jar; then
10279                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10280             elif test -f /usr/share/java/libloader.jar; then
10281                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10282             else
10283                 AC_MSG_ERROR(libloader.jar replacement not found.)
10284             fi
10285         elif ! test -f  $LIBLOADER_JAR; then
10286             AC_MSG_ERROR(libloader.jar not found.)
10287         fi
10289         if test -z $LIBFORMULA_JAR; then
10290             if test -f /usr/share/java/libformula-0.2.0.jar; then
10291                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10292             elif test -f /usr/share/java/libformula.jar; then
10293                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10294             else
10295                 AC_MSG_ERROR(libformula.jar replacement not found.)
10296             fi
10297         elif ! test -f $LIBFORMULA_JAR; then
10298                 AC_MSG_ERROR(libformula.jar not found.)
10299         fi
10301         if test -z $LIBREPOSITORY_JAR; then
10302             if test -f /usr/share/java/librepository-1.0.0.jar; then
10303                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10304             elif test -f /usr/share/java/librepository.jar; then
10305                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10306             else
10307                 AC_MSG_ERROR(librepository.jar replacement not found.)
10308             fi
10309         elif ! test -f $LIBREPOSITORY_JAR; then
10310             AC_MSG_ERROR(librepository.jar not found.)
10311         fi
10313         if test -z $LIBFONTS_JAR; then
10314             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10315                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10316             elif test -f /usr/share/java/libfonts.jar; then
10317                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10318             else
10319                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10320             fi
10321         elif ! test -f $LIBFONTS_JAR; then
10322                 AC_MSG_ERROR(libfonts.jar not found.)
10323         fi
10325         if test -z $LIBSERIALIZER_JAR; then
10326             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10327                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10328             elif test -f /usr/share/java/libserializer.jar; then
10329                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10330             else
10331                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10332             fi
10333         elif ! test -f $LIBSERIALIZER_JAR; then
10334                 AC_MSG_ERROR(libserializer.jar not found.)
10335         fi
10337         if test -z $LIBBASE_JAR; then
10338             if test -f /usr/share/java/libbase-1.0.0.jar; then
10339                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10340             elif test -f /usr/share/java/libbase.jar; then
10341                 LIBBASE_JAR=/usr/share/java/libbase.jar
10342             else
10343                 AC_MSG_ERROR(libbase.jar replacement not found.)
10344             fi
10345         elif ! test -f $LIBBASE_JAR; then
10346             AC_MSG_ERROR(libbase.jar not found.)
10347         fi
10349     else
10350         AC_MSG_RESULT([internal])
10351         SYSTEM_JFREEREPORT=
10352         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10353     fi
10354 else
10355     AC_MSG_RESULT([no])
10356     ENABLE_REPORTBUILDER=
10357     SYSTEM_JFREEREPORT=
10359 AC_SUBST(ENABLE_REPORTBUILDER)
10360 AC_SUBST(SYSTEM_JFREEREPORT)
10361 AC_SUBST(SAC_JAR)
10362 AC_SUBST(LIBXML_JAR)
10363 AC_SUBST(FLUTE_JAR)
10364 AC_SUBST(JFREEREPORT_JAR)
10365 AC_SUBST(LIBBASE_JAR)
10366 AC_SUBST(LIBLAYOUT_JAR)
10367 AC_SUBST(LIBLOADER_JAR)
10368 AC_SUBST(LIBFORMULA_JAR)
10369 AC_SUBST(LIBREPOSITORY_JAR)
10370 AC_SUBST(LIBFONTS_JAR)
10371 AC_SUBST(LIBSERIALIZER_JAR)
10373 # this has to be here because both the Wiki Publisher and the SRB use
10374 # commons-logging
10375 COMMONS_LOGGING_VERSION=1.2
10376 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10377     AC_MSG_CHECKING([which Apache commons-* libs to use])
10378     if test "$with_system_apache_commons" = "yes"; then
10379         SYSTEM_APACHE_COMMONS=TRUE
10380         AC_MSG_RESULT([external])
10381         if test -z $COMMONS_LOGGING_JAR; then
10382             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10383                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10384            elif test -f /usr/share/java/commons-logging.jar; then
10385                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
10386             else
10387                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
10388             fi
10389         elif ! test -f $COMMONS_LOGGING_JAR; then
10390             AC_MSG_ERROR(commons-logging.jar not found.)
10391         fi
10392     else
10393         AC_MSG_RESULT([internal])
10394         SYSTEM_APACHE_COMMONS=
10395         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
10396     fi
10398 AC_SUBST(SYSTEM_APACHE_COMMONS)
10399 AC_SUBST(COMMONS_LOGGING_JAR)
10400 AC_SUBST(COMMONS_LOGGING_VERSION)
10402 # scripting provider for BeanShell?
10403 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10404 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10405     AC_MSG_RESULT([yes])
10406     ENABLE_SCRIPTING_BEANSHELL=TRUE
10408     dnl ===================================================================
10409     dnl Check for system beanshell
10410     dnl ===================================================================
10411     AC_MSG_CHECKING([which beanshell to use])
10412     if test "$with_system_beanshell" = "yes"; then
10413         AC_MSG_RESULT([external])
10414         SYSTEM_BSH=TRUE
10415         if test -z $BSH_JAR; then
10416             BSH_JAR=/usr/share/java/bsh.jar
10417         fi
10418         if ! test -f $BSH_JAR; then
10419             AC_MSG_ERROR(bsh.jar not found.)
10420         fi
10421     else
10422         AC_MSG_RESULT([internal])
10423         SYSTEM_BSH=
10424         BUILD_TYPE="$BUILD_TYPE BSH"
10425     fi
10426 else
10427     AC_MSG_RESULT([no])
10428     ENABLE_SCRIPTING_BEANSHELL=
10429     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10431 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10432 AC_SUBST(SYSTEM_BSH)
10433 AC_SUBST(BSH_JAR)
10435 # scripting provider for JavaScript?
10436 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10437 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10438     AC_MSG_RESULT([yes])
10439     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10441     dnl ===================================================================
10442     dnl Check for system rhino
10443     dnl ===================================================================
10444     AC_MSG_CHECKING([which rhino to use])
10445     if test "$with_system_rhino" = "yes"; then
10446         AC_MSG_RESULT([external])
10447         SYSTEM_RHINO=TRUE
10448         if test -z $RHINO_JAR; then
10449             RHINO_JAR=/usr/share/java/js.jar
10450         fi
10451         if ! test -f $RHINO_JAR; then
10452             AC_MSG_ERROR(js.jar not found.)
10453         fi
10454     else
10455         AC_MSG_RESULT([internal])
10456         SYSTEM_RHINO=
10457         BUILD_TYPE="$BUILD_TYPE RHINO"
10458     fi
10459 else
10460     AC_MSG_RESULT([no])
10461     ENABLE_SCRIPTING_JAVASCRIPT=
10462     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10464 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10465 AC_SUBST(SYSTEM_RHINO)
10466 AC_SUBST(RHINO_JAR)
10468 # This is only used in KDE3/KDE4 checks to determine if /usr/lib64
10469 # paths should be added to library search path. So lets put all 64-bit
10470 # platforms there.
10471 supports_multilib=
10472 case "$host_cpu" in
10473 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
10474     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10475         supports_multilib="yes"
10476     fi
10477     ;;
10479     ;;
10480 esac
10482 dnl ===================================================================
10483 dnl KDE4 Integration
10484 dnl ===================================================================
10486 KDE4_CFLAGS=""
10487 KDE4_LIBS=""
10488 QMAKE4="qmake"
10489 MOC4="moc"
10490 KDE4_GLIB_CFLAGS=""
10491 KDE4_GLIB_LIBS=""
10492 KDE4_HAVE_GLIB=""
10493 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
10494     qt4_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
10495     qt4_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
10497     kde4_incdirs="/usr/include /usr/include/kde4 $x_includes"
10498     kde4_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
10500     if test -n "$supports_multilib"; then
10501         qt4_libdirs="$qt4_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
10502         kde4_libdirs="$kde4_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
10503     fi
10505     if test -n "$QTDIR"; then
10506         qt4_incdirs="$QTDIR/include $qt4_incdirs"
10507         if test -z "$supports_multilib"; then
10508             qt4_libdirs="$QTDIR/lib $qt4_libdirs"
10509         else
10510             qt4_libdirs="$QTDIR/lib64 $QTDIR/lib $qt4_libdirs"
10511         fi
10512     fi
10513     if test -n "$QT4DIR"; then
10514         qt4_incdirs="$QT4DIR/include $qt4_incdirs"
10515         if test -z "$supports_multilib"; then
10516             qt4_libdirs="$QT4DIR/lib $qt4_libdirs"
10517         else
10518             qt4_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt4_libdirs"
10519         fi
10520     fi
10522     if test -n "$KDEDIR"; then
10523         kde4_incdirs="$KDEDIR/include $kde4_incdirs"
10524         if test -z "$supports_multilib"; then
10525             kde4_libdirs="$KDEDIR/lib $kde4_libdirs"
10526         else
10527             kde4_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde4_libdirs"
10528         fi
10529     fi
10530     if test -n "$KDE4DIR"; then
10531         kde4_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde4_incdirs"
10532         if test -z "$supports_multilib"; then
10533             kde4_libdirs="$KDE4DIR/lib $kde4_libdirs"
10534         else
10535             kde4_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde4_libdirs"
10536         fi
10537     fi
10539     qt4_test_include="Qt/qobject.h"
10540     qt4_test_library="libQtNetwork.so"
10541     kde4_test_include="kwindowsystem.h"
10542     kde4_test_library="libsolid.so"
10544     AC_MSG_CHECKING([for Qt4 headers])
10545     qt4_header_dir="no"
10546     for inc_dir in $qt4_incdirs; do
10547         if test -r "$inc_dir/$qt4_test_include"; then
10548             qt4_header_dir="$inc_dir"
10549             break
10550         fi
10551     done
10553     AC_MSG_RESULT([$qt4_header_dir])
10554     if test "x$qt4_header_dir" = "xno"; then
10555         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10556     fi
10558     dnl Check for qmake
10559     AC_PATH_PROGS( QMAKE4, [qmake-qt4 qmake], no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
10560     if test "$QMAKE4" = "no"; then
10561         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10562     else
10563         qmake4_test_ver="`$QMAKE4 -v 2>&1 | sed -n -e '/^Using Qt version 4\./p'`"
10564         if test -z "$qmake4_test_ver"; then
10565             AC_MSG_ERROR([Wrong qmake for Qt4 found. Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
10566         fi
10567     fi
10569     qt4_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt4_libdirs"
10570     AC_MSG_CHECKING([for Qt4 libraries])
10571     qt4_lib_dir="no"
10572     for lib_dir in $qt4_libdirs; do
10573         if test -r "$lib_dir/$qt4_test_library"; then
10574             qt4_lib_dir="$lib_dir"
10575             PKG_CONFIG_PATH="$qt4_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
10576             break
10577         fi
10578     done
10580     AC_MSG_RESULT([$qt4_lib_dir])
10582     if test "x$qt4_lib_dir" = "xno"; then
10583         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10584     fi
10586     dnl Check for Meta Object Compiler
10588     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10589     MOC4="$MOCQT4"
10590     if test "$MOC4" = "no"; then
10591         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10592         if test "$MOC4" = "no"; then
10593             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10594 the root of your Qt installation by exporting QT4DIR before running "configure".])
10595         fi
10596     fi
10598     dnl Check for KDE4 headers
10599     AC_MSG_CHECKING([for KDE4 headers])
10600     kde4_incdir="no"
10601     for kde4_check in $kde4_incdirs; do
10602         if test -r "$kde4_check/$kde4_test_include"; then
10603             kde4_incdir="$kde4_check"
10604             break
10605         fi
10606     done
10607     AC_MSG_RESULT([$kde4_incdir])
10608     if test "x$kde4_incdir" = "xno"; then
10609         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10610     fi
10611     if test "$kde4_incdir" = "/usr/include"; then kde4_incdir=; fi
10613     dnl Check for KDE4 libraries
10614     AC_MSG_CHECKING([for KDE4 libraries])
10615     kde4_libdir="no"
10616     for kde4_check in $kde4_libdirs; do
10617         if test -r "$kde4_check/$kde4_test_library"; then
10618             kde4_libdir="$kde4_check"
10619             break
10620         fi
10621     done
10623     AC_MSG_RESULT([$kde4_libdir])
10624     if test "x$kde4_libdir" = "xno"; then
10625         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10626     fi
10628     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
10629     if ! test -z "$kde4_incdir"; then
10630         KDE4_CFLAGS="-I$kde4_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10631     else
10632         KDE4_CFLAGS="$QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10633     fi
10635     KDE4_LIBS="-L$kde4_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt4_lib_dir $QT4_LIBS"
10636     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10637     FilterLibs "$KDE4_LIBS"
10638     KDE4_LIBS="$filteredlibs"
10640     AC_LANG_PUSH([C++])
10641     save_CXXFLAGS=$CXXFLAGS
10642     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10643     AC_MSG_CHECKING([whether KDE is >= 4.2])
10644        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10645 #include <kdeversion.h>
10647 int main(int argc, char **argv) {
10648        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
10649        else return 1;
10651 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[AC_MSG_ERROR([KDE support not tested with cross-compilation])])
10652     CXXFLAGS=$save_CXXFLAGS
10653     AC_LANG_POP([C++])
10655     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
10656     # Sets also KDE4_GLIB_CFLAGS/KDE4_GLIB_LIBS if successful.
10657     PKG_CHECK_MODULES(KDE4_GLIB,[glib-2.0 >= 2.4],
10658         [
10659             KDE4_HAVE_GLIB=TRUE
10660             AC_DEFINE(KDE4_HAVE_GLIB,1)
10661             KDE4_GLIB_CFLAGS=$(printf '%s' "$KDE4_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10662             FilterLibs "${KDE4_GLIB_LIBS}"
10663             KDE4_GLIB_LIBS="${filteredlibs}"
10665             qt4_fix_warning=
10667             AC_LANG_PUSH([C++])
10668             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
10669             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
10670             #  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
10671             #               ^~~~~~~~~~~~~~~~~~~~~~~
10672             #               vptr for 'QObjectPrivate'
10673             save_CXX=$CXX
10674             CXX=$(printf %s "$CXX" \
10675                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
10676             save_CXXFLAGS=$CXXFLAGS
10677             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10678             save_LIBS=$LIBS
10679             LIBS="$LIBS $KDE4_LIBS"
10680             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
10682             # Prepare meta object data
10683             TSTBASE="tst_exclude_socket_notifiers"
10684             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
10685             ln -fs "${TSTMOC}.hxx"
10686             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10688             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10689 #include <cstdlib>
10690 #include "tst_exclude_socket_notifiers.moc"
10692 int main(int argc, char *argv[])
10694     QCoreApplication app(argc, argv);
10695     exit(tst_processEventsExcludeSocket());
10696     return 0;
10698             ]])],[
10699                 AC_MSG_RESULT([yes])
10700             ],[
10701                 AC_MSG_RESULT([no])
10702                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
10703                 if test -z "$qt4_fix_warning"; then
10704                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
10705                 fi
10706                 qt4_fix_warning=1
10707                 add_warning "  https://bugreports.qt.io/browse/QTBUG-37380 (needed)"
10708                 ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
10710             # Remove meta object data
10711             rm -f "${TSTBASE}."*
10713             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
10715             # Prepare meta object data
10716             TSTBASE="tst_exclude_posted_events"
10717             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
10718             ln -fs "${TSTMOC}.hxx"
10719             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10721             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10722 #include <cstdlib>
10723 #include "tst_exclude_posted_events.moc"
10725 int main(int argc, char *argv[])
10727     QCoreApplication app(argc, argv);
10728     exit(tst_excludePostedEvents());
10729     return 0;
10731             ]])],[
10732                 AC_MSG_RESULT([yes])
10733             ],[
10734                 AC_MSG_RESULT([no])
10735                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
10736                 if test -z "$qt4_fix_warning"; then
10737                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
10738                 fi
10739                 qt4_fix_warning=1
10740                 add_warning "  https://bugreports.qt.io/browse/QTBUG-34614 (needed)"
10741             ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
10743             # Remove meta object data
10744             rm -f "${TSTBASE}."*
10746             if test -n "$qt4_fix_warning"; then
10747                 add_warning "  https://bugreports.qt.io/browse/QTBUG-38585 (recommended)"
10748             fi
10750             LIBS=$save_LIBS
10751             CXXFLAGS=$save_CXXFLAGS
10752             CXX=$save_CXX
10753             AC_LANG_POP([C++])
10754         ],
10755         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
10757 AC_SUBST(KDE4_CFLAGS)
10758 AC_SUBST(KDE4_LIBS)
10759 AC_SUBST(MOC4)
10760 AC_SUBST(KDE4_GLIB_CFLAGS)
10761 AC_SUBST(KDE4_GLIB_LIBS)
10762 AC_SUBST(KDE4_HAVE_GLIB)
10764 dnl ===================================================================
10765 dnl QT5 Integration
10766 dnl ===================================================================
10768 QT5_CFLAGS=""
10769 QT5_LIBS=""
10770 QMAKE5="qmake"
10771 MOC5="moc"
10772 QT5_GLIB_CFLAGS=""
10773 QT5_GLIB_LIBS=""
10774 QT5_HAVE_GLIB=""
10775 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
10776         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \)
10777 then
10778     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
10779     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
10781     if test -n "$supports_multilib"; then
10782         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
10783     fi
10785     qt5_test_include="QtWidgets/qapplication.h"
10786     qt5_test_library="libQt5Widgets.so"
10788     dnl Check for qmake5
10789     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
10790     if test "$QMAKE5" = "no"; then
10791         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
10792     else
10793         qmake5_test_ver="`$QMAKE5 -v 2>&1 | sed -n -e '/^Using Qt version 5\./p'`"
10794         if test -z "$qmake5_test_ver"; then
10795             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
10796         fi
10797     fi
10799     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
10800     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
10802     AC_MSG_CHECKING([for Qt5 headers])
10803     qt5_incdir="no"
10804     for inc_dir in $qt5_incdirs; do
10805         if test -r "$inc_dir/$qt5_test_include"; then
10806             qt5_incdir="$inc_dir"
10807             break
10808         fi
10809     done
10810     AC_MSG_RESULT([$qt5_incdir])
10811     if test "x$qt5_incdir" = "xno"; then
10812         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
10813     fi
10815     AC_MSG_CHECKING([for Qt5 libraries])
10816     qt5_libdir="no"
10817     for lib_dir in $qt5_libdirs; do
10818         if test -r "$lib_dir/$qt5_test_library"; then
10819             qt5_libdir="$lib_dir"
10820             break
10821         fi
10822     done
10823     AC_MSG_RESULT([$qt5_libdir])
10824     if test "x$qt5_libdir" = "xno"; then
10825         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
10826     fi
10828     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10829     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
10831     dnl Check for Meta Object Compiler
10833     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
10834     if test "$MOC5" = "no"; then
10835         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10836 the root of your Qt installation by exporting QT5DIR before running "configure".])
10837     fi
10839     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
10840     # Sets also QT5_GLIB_CFLAGS/QT5_GLIB_LIBS if successful.
10841     PKG_CHECK_MODULES(QT5_GLIB,[glib-2.0 >= 2.4],
10842         [
10843             QT5_HAVE_GLIB=1
10844             AC_DEFINE(QT5_HAVE_GLIB,1)
10845         ],
10846         AC_MSG_WARN([[No Glib found, Qt5 support will not use native file pickers!]])
10847     )
10849 AC_SUBST(QT5_CFLAGS)
10850 AC_SUBST(QT5_LIBS)
10851 AC_SUBST(MOC5)
10852 AC_SUBST(QT5_GLIB_CFLAGS)
10853 AC_SUBST(QT5_GLIB_LIBS)
10854 AC_SUBST(QT5_HAVE_GLIB)
10856 dnl ===================================================================
10857 dnl KDE5 Integration
10858 dnl ===================================================================
10860 KF5_CFLAGS=""
10861 KF5_LIBS=""
10862 KF5_CONFIG="kf5-config"
10863 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
10864         \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \)
10865 then
10866     kf5_incdirs="$KF5INC /usr/include /usr/include/KF5 $x_includes"
10867     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $x_libraries"
10868     if test -n "$supports_multilib"; then
10869         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
10870     fi
10872     kf5_test_include="kcoreaddons_version.h"
10873     kf5_test_library="libKF5CoreAddons.so"
10874     kf5_libdirs="$qt5_libdir $kf5_libdirs"
10876     dnl kf5 KDE4 support compatibility installed
10877     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
10878     if test "$KF5_CONFIG" != "no"; then
10879         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
10880         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
10881     fi
10883     dnl Check for KF5 headers
10884     AC_MSG_CHECKING([for KF5 headers])
10885     kf5_incdir="no"
10886     for kf5_check in $kf5_incdirs; do
10887         if test -r "$kf5_check/$kf5_test_include"; then
10888             kf5_incdir="$kf5_check"
10889             break
10890         fi
10891     done
10892     AC_MSG_RESULT([$kf5_incdir])
10893     if test "x$kf5_incdir" = "xno"; then
10894         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
10895     fi
10897     dnl Check for KF5 libraries
10898     AC_MSG_CHECKING([for KF5 libraries])
10899     kf5_libdir="no"
10900     for kf5_check in $kf5_libdirs; do
10901         if test -r "$kf5_check/$kf5_test_library"; then
10902             kf5_libdir="$kf5_check"
10903             break
10904         fi
10905     done
10907     AC_MSG_RESULT([$kf5_libdir])
10908     if test "x$kf5_libdir" = "xno"; then
10909         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
10910     fi
10912     PKG_CHECK_MODULES(KF5_XCB,[xcb],,[AC_MSG_ERROR([XCB not installed])])
10914     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"
10915     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network -lQt5X11Extras $KF5_XCB_LIBS"
10916     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10918     AC_LANG_PUSH([C++])
10919     save_CXXFLAGS=$CXXFLAGS
10920     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
10921     AC_MSG_CHECKING([whether KDE is >= 5.0])
10922        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10923 #include <kcoreaddons_version.h>
10925 int main(int argc, char **argv) {
10926        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
10927        else return 1;
10929        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
10930     CXXFLAGS=$save_CXXFLAGS
10931     AC_LANG_POP([C++])
10933 AC_SUBST(KF5_CFLAGS)
10934 AC_SUBST(KF5_LIBS)
10936 dnl ===================================================================
10937 dnl Test whether to include Evolution 2 support
10938 dnl ===================================================================
10939 AC_MSG_CHECKING([whether to enable evolution 2 support])
10940 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
10941     AC_MSG_RESULT([yes])
10942     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
10943     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10944     FilterLibs "${GOBJECT_LIBS}"
10945     GOBJECT_LIBS="${filteredlibs}"
10946     ENABLE_EVOAB2="TRUE"
10947 else
10948     ENABLE_EVOAB2=""
10949     AC_MSG_RESULT([no])
10951 AC_SUBST(ENABLE_EVOAB2)
10952 AC_SUBST(GOBJECT_CFLAGS)
10953 AC_SUBST(GOBJECT_LIBS)
10955 dnl ===================================================================
10956 dnl Test which themes to include
10957 dnl ===================================================================
10958 AC_MSG_CHECKING([which themes to include])
10959 # if none given use default subset of available themes
10960 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
10961     with_theme="breeze breeze_dark elementary galaxy hicontrast sifr sifr_dark tango"
10962     # test -z "$ENABLE_RELEASE_BUILD" && with_theme="$with_theme tango_testing"
10965 WITH_THEMES=""
10966 if test "x$with_theme" != "xno"; then
10967     for theme in $with_theme; do
10968         case $theme in
10969         breeze|breeze_dark|crystal|elementary|galaxy|hicontrast|oxygen|sifr|sifr_dark|tango|tango_testing) real_theme="$theme" ;;
10970         default) real_theme=galaxy ;;
10971         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
10972         esac
10973         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
10974     done
10976 AC_MSG_RESULT([$WITH_THEMES])
10977 AC_SUBST([WITH_THEMES])
10978 # FIXME: remove this, and the convenience default->galaxy remapping after a crace period
10979 for theme in $with_theme; do
10980     case $theme in
10981     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=galaxy]) ;;
10982     *) ;;
10983     esac
10984 done
10986 dnl ===================================================================
10987 dnl Test whether to integrate helppacks into the product's installer
10988 dnl ===================================================================
10989 AC_MSG_CHECKING([for helppack integration])
10990 if test "$with_helppack_integration" = "no"; then
10991     WITH_HELPPACK_INTEGRATION=
10992     AC_MSG_RESULT([no integration])
10993 else
10994     WITH_HELPPACK_INTEGRATION=TRUE
10995     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
10996     AC_MSG_RESULT([integration])
10998 AC_SUBST(WITH_HELPPACK_INTEGRATION)
11000 ###############################################################################
11001 # Extensions checking
11002 ###############################################################################
11003 AC_MSG_CHECKING([for extensions integration])
11004 if test "x$enable_extension_integration" != "xno"; then
11005     WITH_EXTENSION_INTEGRATION=TRUE
11006     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11007     AC_MSG_RESULT([yes, use integration])
11008 else
11009     WITH_EXTENSION_INTEGRATION=
11010     AC_MSG_RESULT([no, do not integrate])
11012 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11014 dnl Should any extra extensions be included?
11015 dnl There are standalone tests for each of these below.
11016 WITH_EXTRA_EXTENSIONS=
11017 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11019 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11020 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11021 if test "x$with_java" != "xno"; then
11022     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11023     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11026 TEST_FONTS_MISSING=0
11028 # $1  = font family
11029 # $2+ = accepted font mappings
11030 test_font_map()
11032     FONT="$1" ; shift
11033     AC_MSG_CHECKING([font mapping for '$FONT'])
11034     FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
11035     FONTFILE_LOWER="$(echo $FONTFILE | $AWK '{print tolower($0)}')"
11037     TESTEXPR="'${FONTFILE_LOWER}' = '$(echo $FONT | $AWK '{print tolower($0)}').ttf'"
11038     while test "$#" -ge 1 ; do
11039         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
11040         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
11041     done
11042     if test $TESTEXPR
11043     then
11044         AC_MSG_RESULT([ok])
11045     else
11046         AC_MSG_WARN([unknown ($FONTFILE)])
11047         add_warning "unknown ($FONTFILE)"
11048         TEST_FONTS_MISSING=1
11049     fi
11052 dnl ===================================================================
11053 dnl Test whether to include fonts
11054 dnl ===================================================================
11055 AC_MSG_CHECKING([whether to include third-party fonts])
11056 if test "$with_fonts" != "no"; then
11057     AC_MSG_RESULT([yes])
11058     WITH_FONTS=TRUE
11059     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11060     AC_DEFINE(HAVE_MORE_FONTS)
11061 else
11062     AC_MSG_RESULT([no])
11063     WITH_FONTS=
11064     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11065     if test "$test_fontconfig" = "yes"; then
11066         AC_PATH_PROG([FCMATCH], [fc-match])
11067         if test -z "$FCMATCH"; then
11068             AC_MSG_WARN([Unable to query installed fonts - unit tests disabled.])
11069             TEST_FONTS_MISSING=1
11070         else
11071             test_font_map 'Calibri' 'Carlito'
11072             test_font_map 'DejaVuSans' 'DejaVuSans'
11073             if test ${TEST_FONTS_MISSING} -eq 1
11074             then
11075                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
11076                 add_warning "Unknown font mappings - unit tests disabled."
11077             fi
11078         fi
11079     else
11080         TEST_FONTS_MISSING=1
11081     fi
11083 AC_SUBST(WITH_FONTS)
11084 AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
11087 dnl ===================================================================
11088 dnl Test whether to enable online update service
11089 dnl ===================================================================
11090 AC_MSG_CHECKING([whether to enable online update])
11091 ENABLE_ONLINE_UPDATE=
11092 ENABLE_ONLINE_UPDATE_MAR=
11093 UPDATE_CONFIG=
11094 if test "$enable_online_update" = ""; then
11095     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11096         AC_MSG_RESULT([yes])
11097         ENABLE_ONLINE_UPDATE="TRUE"
11098     else
11099         AC_MSG_RESULT([no])
11100     fi
11101 else
11102     if test "$enable_online_update" = "mar"; then
11103         AC_MSG_RESULT([yes - MAR-based online update])
11104         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11105         if test "$with_update_config" = ""; then
11106             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11107         fi
11108         UPDATE_CONFIG="$with_update_config"
11109         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11110     elif test "$enable_online_update" = "yes"; then
11111         AC_MSG_RESULT([yes])
11112         ENABLE_ONLINE_UPDATE="TRUE"
11113     else
11114         AC_MSG_RESULT([no])
11115     fi
11117 AC_SUBST(ENABLE_ONLINE_UPDATE)
11118 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11119 AC_SUBST(UPDATE_CONFIG)
11121 dnl ===================================================================
11122 dnl Test whether we need bzip2
11123 dnl ===================================================================
11124 SYSTEM_BZIP2=
11125 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11126     AC_MSG_CHECKING([whether to use system bzip2])
11127     if test "$with_system_bzip2" = yes; then
11128         SYSTEM_BZIP2=TRUE
11129         AC_MSG_RESULT([yes])
11130         PKG_CHECK_MODULES(BZIP2, bzip2)
11131         FilterLibs "${BZIP2_LIBS}"
11132         BZIP2_LIBS="${filteredlibs}"
11133     else
11134         AC_MSG_RESULT([no])
11135         BUILD_TYPE="$BUILD_TYPE BZIP2"
11136     fi
11138 AC_SUBST(SYSTEM_BZIP2)
11139 AC_SUBST(BZIP2_CFLAGS)
11140 AC_SUBST(BZIP2_LIBS)
11142 dnl ===================================================================
11143 dnl Test whether to enable extension update
11144 dnl ===================================================================
11145 AC_MSG_CHECKING([whether to enable extension update])
11146 ENABLE_EXTENSION_UPDATE=
11147 if test "x$enable_extension_update" = "xno"; then
11148     AC_MSG_RESULT([no])
11149 else
11150     AC_MSG_RESULT([yes])
11151     ENABLE_EXTENSION_UPDATE="TRUE"
11152     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11153     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11155 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11158 dnl ===================================================================
11159 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11160 dnl ===================================================================
11161 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11162 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11163     AC_MSG_RESULT([no])
11164     ENABLE_SILENT_MSI=
11165 else
11166     AC_MSG_RESULT([yes])
11167     ENABLE_SILENT_MSI=TRUE
11168     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11170 AC_SUBST(ENABLE_SILENT_MSI)
11172 AC_MSG_CHECKING([whether and how to use Xinerama])
11173 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11174     if test "$x_libraries" = "default_x_libraries"; then
11175         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11176         if test "x$XINERAMALIB" = x; then
11177            XINERAMALIB="/usr/lib"
11178         fi
11179     else
11180         XINERAMALIB="$x_libraries"
11181     fi
11182     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11183         # we have both versions, let the user decide but use the dynamic one
11184         # per default
11185         USE_XINERAMA=TRUE
11186         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11187             XINERAMA_LINK=dynamic
11188         else
11189             XINERAMA_LINK=static
11190         fi
11191     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11192         # we have only the dynamic version
11193         USE_XINERAMA=TRUE
11194         XINERAMA_LINK=dynamic
11195     elif test -e "$XINERAMALIB/libXinerama.a"; then
11196         # static version
11197         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11198             USE_XINERAMA=TRUE
11199             XINERAMA_LINK=static
11200         else
11201             USE_XINERAMA=
11202             XINERAMA_LINK=none
11203         fi
11204     else
11205         # no Xinerama
11206         USE_XINERAMA=
11207         XINERAMA_LINK=none
11208     fi
11209     if test "$USE_XINERAMA" = "TRUE"; then
11210         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11211         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11212             [AC_MSG_ERROR(Xinerama header not found.)], [])
11213         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11214         if test "x$XEXTLIB" = x; then
11215            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11216         fi
11217         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11218         if test "$_os" = "FreeBSD"; then
11219             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11220         fi
11221         if test "$_os" = "Linux"; then
11222             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11223         fi
11224         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11225             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11226     else
11227         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11228     fi
11229 else
11230     USE_XINERAMA=
11231     XINERAMA_LINK=none
11232     AC_MSG_RESULT([no])
11234 AC_SUBST(USE_XINERAMA)
11235 AC_SUBST(XINERAMA_LINK)
11237 dnl ===================================================================
11238 dnl Test whether to build cairo or rely on the system version
11239 dnl ===================================================================
11241 if test "$USING_X11" = TRUE; then
11242     # Used in vcl/Library_vclplug_gen.mk
11243     test_cairo=yes
11246 if test "$test_cairo" = "yes"; then
11247     AC_MSG_CHECKING([whether to use the system cairo])
11249     : ${with_system_cairo:=$with_system_libs}
11250     if test "$with_system_cairo" = "yes"; then
11251         SYSTEM_CAIRO=TRUE
11252         AC_MSG_RESULT([yes])
11254         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11255         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11256         FilterLibs "${CAIRO_LIBS}"
11257         CAIRO_LIBS="${filteredlibs}"
11259         if test "$test_xrender" = "yes"; then
11260             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11261             AC_LANG_PUSH([C])
11262             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11263 #ifdef PictStandardA8
11264 #else
11265       return fail;
11266 #endif
11267 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11269             AC_LANG_POP([C])
11270         fi
11271     else
11272         SYSTEM_CAIRO=
11273         AC_MSG_RESULT([no])
11275         BUILD_TYPE="$BUILD_TYPE CAIRO"
11276     fi
11279 AC_SUBST(SYSTEM_CAIRO)
11280 AC_SUBST(CAIRO_CFLAGS)
11281 AC_SUBST(CAIRO_LIBS)
11283 dnl ===================================================================
11284 dnl Test whether to use avahi
11285 dnl ===================================================================
11286 if test "$_os" = "WINNT"; then
11287     # Windows uses bundled mDNSResponder
11288     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11289 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11290     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11291                       [ENABLE_AVAHI="TRUE"])
11292     AC_DEFINE(HAVE_FEATURE_AVAHI)
11293     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11294     FilterLibs "${AVAHI_LIBS}"
11295     AVAHI_LIBS="${filteredlibs}"
11298 AC_SUBST(ENABLE_AVAHI)
11299 AC_SUBST(AVAHI_CFLAGS)
11300 AC_SUBST(AVAHI_LIBS)
11302 dnl ===================================================================
11303 dnl Test whether to use liblangtag
11304 dnl ===================================================================
11305 SYSTEM_LIBLANGTAG=
11306 AC_MSG_CHECKING([whether to use system liblangtag])
11307 if test "$with_system_liblangtag" = yes; then
11308     SYSTEM_LIBLANGTAG=TRUE
11309     AC_MSG_RESULT([yes])
11310     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11311     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11312     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11313     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11314     FilterLibs "${LIBLANGTAG_LIBS}"
11315     LIBLANGTAG_LIBS="${filteredlibs}"
11316 else
11317     SYSTEM_LIBLANGTAG=
11318     AC_MSG_RESULT([no])
11319     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11320     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11321     if test "$COM" = "MSC"; then
11322         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11323     else
11324         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11325     fi
11327 AC_SUBST(SYSTEM_LIBLANGTAG)
11328 AC_SUBST(LIBLANGTAG_CFLAGS)
11329 AC_SUBST(LIBLANGTAG_LIBS)
11331 dnl ===================================================================
11332 dnl Test whether to build libpng or rely on the system version
11333 dnl ===================================================================
11335 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11337 dnl ===================================================================
11338 dnl Check for runtime JVM search path
11339 dnl ===================================================================
11340 if test "$ENABLE_JAVA" != ""; then
11341     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11342     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11343         AC_MSG_RESULT([yes])
11344         if ! test -d "$with_jvm_path"; then
11345             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11346         fi
11347         if ! test -d "$with_jvm_path"jvm; then
11348             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11349         fi
11350         JVM_ONE_PATH_CHECK="$with_jvm_path"
11351         AC_SUBST(JVM_ONE_PATH_CHECK)
11352     else
11353         AC_MSG_RESULT([no])
11354     fi
11357 dnl ===================================================================
11358 dnl Test for the presence of Ant and that it works
11359 dnl ===================================================================
11361 if test "$ENABLE_JAVA" != ""; then
11362     ANT_HOME=; export ANT_HOME
11363     WITH_ANT_HOME=; export WITH_ANT_HOME
11364     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11365         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11366             if test "$_os" = "WINNT"; then
11367                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11368             else
11369                 with_ant_home="$LODE_HOME/opt/ant"
11370             fi
11371         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11372             with_ant_home="$LODE_HOME/opt/ant"
11373         fi
11374     fi
11375     if test -z "$with_ant_home"; then
11376         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11377     else
11378         if test "$_os" = "WINNT"; then
11379             # AC_PATH_PROGS needs unix path
11380             with_ant_home=`cygpath -u "$with_ant_home"`
11381         fi
11382         AbsolutePath "$with_ant_home"
11383         with_ant_home=$absolute_path
11384         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11385         WITH_ANT_HOME=$with_ant_home
11386         ANT_HOME=$with_ant_home
11387     fi
11389     if test -z "$ANT"; then
11390         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11391     else
11392         # resolve relative or absolute symlink
11393         while test -h "$ANT"; do
11394             a_cwd=`pwd`
11395             a_basename=`basename "$ANT"`
11396             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11397             cd "`dirname "$ANT"`"
11398             cd "`dirname "$a_script"`"
11399             ANT="`pwd`"/"`basename "$a_script"`"
11400             cd "$a_cwd"
11401         done
11403         AC_MSG_CHECKING([if $ANT works])
11404         cat > conftest.java << EOF
11405         public class conftest {
11406             int testmethod(int a, int b) {
11407                     return a + b;
11408             }
11409         }
11412         cat > conftest.xml << EOF
11413         <project name="conftest" default="conftest">
11414         <target name="conftest">
11415             <javac srcdir="." includes="conftest.java">
11416             </javac>
11417         </target>
11418         </project>
11421         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11422         if test $? = 0 -a -f ./conftest.class; then
11423             AC_MSG_RESULT([Ant works])
11424             if test -z "$WITH_ANT_HOME"; then
11425                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11426                 if test -z "$ANT_HOME"; then
11427                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11428                 fi
11429             else
11430                 ANT_HOME="$WITH_ANT_HOME"
11431             fi
11432         else
11433             echo "configure: Ant test failed" >&5
11434             cat conftest.java >&5
11435             cat conftest.xml >&5
11436             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11437         fi
11438         rm -f conftest* core core.* *.core
11439     fi
11440     if test -z "$ANT_HOME"; then
11441         ANT_HOME="NO_ANT_HOME"
11442     else
11443         PathFormat "$ANT_HOME"
11444         ANT_HOME="$formatted_path"
11445         PathFormat "$ANT"
11446         ANT="$formatted_path"
11447     fi
11448     AC_SUBST(ANT_HOME)
11449     AC_SUBST(ANT)
11451     dnl Checking for ant.jar
11452     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11453         AC_MSG_CHECKING([Ant lib directory])
11454         if test -f $ANT_HOME/lib/ant.jar; then
11455             ANT_LIB="$ANT_HOME/lib"
11456         else
11457             if test -f $ANT_HOME/ant.jar; then
11458                 ANT_LIB="$ANT_HOME"
11459             else
11460                 if test -f /usr/share/java/ant.jar; then
11461                     ANT_LIB=/usr/share/java
11462                 else
11463                     if test -f /usr/share/ant-core/lib/ant.jar; then
11464                         ANT_LIB=/usr/share/ant-core/lib
11465                     else
11466                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11467                             ANT_LIB="$ANT_HOME/lib/ant"
11468                         else
11469                             if test -f /usr/share/lib/ant/ant.jar; then
11470                                 ANT_LIB=/usr/share/lib/ant
11471                             else
11472                                 AC_MSG_ERROR([Ant libraries not found!])
11473                             fi
11474                         fi
11475                     fi
11476                 fi
11477             fi
11478         fi
11479         PathFormat "$ANT_LIB"
11480         ANT_LIB="$formatted_path"
11481         AC_MSG_RESULT([Ant lib directory found.])
11482     fi
11483     AC_SUBST(ANT_LIB)
11485     ant_minver=1.6.0
11486     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11488     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11489     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11490     ant_version_major=`echo $ant_version | cut -d. -f1`
11491     ant_version_minor=`echo $ant_version | cut -d. -f2`
11492     echo "configure: ant_version $ant_version " >&5
11493     echo "configure: ant_version_major $ant_version_major " >&5
11494     echo "configure: ant_version_minor $ant_version_minor " >&5
11495     if test "$ant_version_major" -ge "2"; then
11496         AC_MSG_RESULT([yes, $ant_version])
11497     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11498         AC_MSG_RESULT([yes, $ant_version])
11499     else
11500         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11501     fi
11503     rm -f conftest* core core.* *.core
11506 OOO_JUNIT_JAR=
11507 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11508     AC_MSG_CHECKING([for JUnit 4])
11509     if test "$with_junit" = "yes"; then
11510         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
11511             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
11512         elif test -e /usr/share/java/junit4.jar; then
11513             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11514         else
11515            if test -e /usr/share/lib/java/junit.jar; then
11516               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11517            else
11518               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11519            fi
11520         fi
11521     else
11522         OOO_JUNIT_JAR=$with_junit
11523     fi
11524     if test "$_os" = "WINNT"; then
11525         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11526     fi
11527     printf 'import org.junit.Before;' > conftest.java
11528     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11529         AC_MSG_RESULT([$OOO_JUNIT_JAR])
11530     else
11531         AC_MSG_ERROR(
11532 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
11533  specify its pathname via --with-junit=..., or disable it via --without-junit])
11534     fi
11535     rm -f conftest.class conftest.java
11536     if test $OOO_JUNIT_JAR != ""; then
11537     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11538     fi
11540 AC_SUBST(OOO_JUNIT_JAR)
11542 HAMCREST_JAR=
11543 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11544     AC_MSG_CHECKING([for included Hamcrest])
11545     printf 'import org.hamcrest.BaseDescription;' > conftest.java
11546     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11547         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
11548     else
11549         AC_MSG_RESULT([Not included])
11550         AC_MSG_CHECKING([for standalone hamcrest jar.])
11551         if test "$with_hamcrest" = "yes"; then
11552             if test -e /usr/share/lib/java/hamcrest.jar; then
11553                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
11554             elif test -e /usr/share/java/hamcrest/core.jar; then
11555                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
11556             else
11557                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
11558             fi
11559         else
11560             HAMCREST_JAR=$with_hamcrest
11561         fi
11562         if test "$_os" = "WINNT"; then
11563             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
11564         fi
11565         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
11566             AC_MSG_RESULT([$HAMCREST_JAR])
11567         else
11568             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),
11569                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
11570         fi
11571     fi
11572     rm -f conftest.class conftest.java
11574 AC_SUBST(HAMCREST_JAR)
11577 AC_SUBST(SCPDEFS)
11580 # check for wget and curl
11582 WGET=
11583 CURL=
11585 if test "$enable_fetch_external" != "no"; then
11587 CURL=`which curl 2>/dev/null`
11589 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
11590     # wget new enough?
11591     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
11592     if test $? -eq 0; then
11593         WGET=$i
11594         break
11595     fi
11596 done
11598 if test -z "$WGET" -a -z "$CURL"; then
11599     AC_MSG_ERROR([neither wget nor curl found!])
11604 AC_SUBST(WGET)
11605 AC_SUBST(CURL)
11608 # check for sha256sum
11610 SHA256SUM=
11612 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
11613     eval "$i -a 256 --version" > /dev/null 2>&1
11614     ret=$?
11615     if test $ret -eq 0; then
11616         SHA256SUM="$i -a 256"
11617         break
11618     fi
11619 done
11621 if test -z "$SHA256SUM"; then
11622     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
11623         eval "$i --version" > /dev/null 2>&1
11624         ret=$?
11625         if test $ret -eq 0; then
11626             SHA256SUM=$i
11627             break
11628         fi
11629     done
11632 if test -z "$SHA256SUM"; then
11633     AC_MSG_ERROR([no sha256sum found!])
11636 AC_SUBST(SHA256SUM)
11638 dnl ===================================================================
11639 dnl Dealing with l10n options
11640 dnl ===================================================================
11641 AC_MSG_CHECKING([which languages to be built])
11642 # get list of all languages
11643 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
11644 # the sed command does the following:
11645 #   + if a line ends with a backslash, append the next line to it
11646 #   + adds " on the beginning of the value (after =)
11647 #   + adds " at the end of the value
11648 #   + removes en-US; we want to put it on the beginning
11649 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
11650 [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)]
11651 ALL_LANGS="en-US $completelangiso"
11652 # check the configured localizations
11653 WITH_LANG="$with_lang"
11654 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
11655     AC_MSG_RESULT([en-US])
11656 else
11657     AC_MSG_RESULT([$WITH_LANG])
11658     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
11659     if test -z "$MSGFMT"; then
11660         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
11661             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
11662         elif test -x "/opt/lo/bin/msgfmt"; then
11663             MSGFMT="/opt/lo/bin/msgfmt"
11664         else
11665             AC_CHECK_PROGS(MSGFMT, [msgfmt])
11666             if test -z "$MSGFMT"; then
11667                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
11668             fi
11669         fi
11670     fi
11671     if test -z "$MSGUNIQ"; then
11672         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
11673             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
11674         elif test -x "/opt/lo/bin/msguniq"; then
11675             MSGUNIQ="/opt/lo/bin/msguniq"
11676         else
11677             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
11678             if test -z "$MSGUNIQ"; then
11679                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
11680             fi
11681         fi
11682     fi
11684 AC_SUBST(MSGFMT)
11685 AC_SUBST(MSGUNIQ)
11686 # check that the list is valid
11687 for lang in $WITH_LANG; do
11688     test "$lang" = "ALL" && continue
11689     # need to check for the exact string, so add space before and after the list of all languages
11690     for vl in $ALL_LANGS; do
11691         if test "$vl" = "$lang"; then
11692            break
11693         fi
11694     done
11695     if test "$vl" != "$lang"; then
11696         # if you're reading this - you prolly quoted your languages remove the quotes ...
11697         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
11698     fi
11699 done
11700 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
11701     echo $WITH_LANG | grep -q en-US
11702     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
11704 # list with substituted ALL
11705 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
11706 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
11707 test "$WITH_LANG" = "en-US" && WITH_LANG=
11708 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
11709     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
11710     ALL_LANGS=`echo $ALL_LANGS qtz`
11712 AC_SUBST(ALL_LANGS)
11713 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
11714 AC_SUBST(WITH_LANG)
11715 AC_SUBST(WITH_LANG_LIST)
11716 AC_SUBST(GIT_NEEDED_SUBMODULES)
11718 WITH_POOR_HELP_LOCALIZATIONS=
11719 if test -d "$SRC_ROOT/translations/source"; then
11720     for l in `ls -1 $SRC_ROOT/translations/source`; do
11721         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
11722             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
11723         fi
11724     done
11726 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
11728 if test -n "$with_locales"; then
11729     WITH_LOCALES="$with_locales"
11731     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
11732     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
11733     # config_host/config_locales.h.in
11734     for locale in $WITH_LOCALES; do
11735         lang=${locale%_*}
11737         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
11739         case $lang in
11740         hi|mr*ne)
11741             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
11742             ;;
11743         bg|ru)
11744             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
11745             ;;
11746         esac
11747     done
11748 else
11749     AC_DEFINE(WITH_LOCALE_ALL)
11751 AC_SUBST(WITH_LOCALES)
11753 dnl git submodule update --reference
11754 dnl ===================================================================
11755 if test -n "${GIT_REFERENCE_SRC}"; then
11756     for repo in ${GIT_NEEDED_SUBMODULES}; do
11757         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
11758             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
11759         fi
11760     done
11762 AC_SUBST(GIT_REFERENCE_SRC)
11764 dnl git submodules linked dirs
11765 dnl ===================================================================
11766 if test -n "${GIT_LINK_SRC}"; then
11767     for repo in ${GIT_NEEDED_SUBMODULES}; do
11768         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
11769             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
11770         fi
11771     done
11773 AC_SUBST(GIT_LINK_SRC)
11775 dnl branding
11776 dnl ===================================================================
11777 AC_MSG_CHECKING([for alternative branding images directory])
11778 # initialize mapped arrays
11779 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
11780 brand_files="$BRAND_INTRO_IMAGES about.svg"
11782 if test -z "$with_branding" -o "$with_branding" = "no"; then
11783     AC_MSG_RESULT([none])
11784     DEFAULT_BRAND_IMAGES="$brand_files"
11785 else
11786     if ! test -d $with_branding ; then
11787         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
11788     else
11789         AC_MSG_RESULT([$with_branding])
11790         CUSTOM_BRAND_DIR="$with_branding"
11791         for lfile in $brand_files
11792         do
11793             if ! test -f $with_branding/$lfile ; then
11794                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
11795                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
11796             else
11797                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
11798             fi
11799         done
11800         check_for_progress="yes"
11801     fi
11803 AC_SUBST([BRAND_INTRO_IMAGES])
11804 AC_SUBST([CUSTOM_BRAND_DIR])
11805 AC_SUBST([CUSTOM_BRAND_IMAGES])
11806 AC_SUBST([DEFAULT_BRAND_IMAGES])
11809 AC_MSG_CHECKING([for 'intro' progress settings])
11810 PROGRESSBARCOLOR=
11811 PROGRESSSIZE=
11812 PROGRESSPOSITION=
11813 PROGRESSFRAMECOLOR=
11814 PROGRESSTEXTCOLOR=
11815 PROGRESSTEXTBASELINE=
11817 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
11818     source "$with_branding/progress.conf"
11819     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
11820 else
11821     AC_MSG_RESULT([none])
11824 AC_SUBST(PROGRESSBARCOLOR)
11825 AC_SUBST(PROGRESSSIZE)
11826 AC_SUBST(PROGRESSPOSITION)
11827 AC_SUBST(PROGRESSFRAMECOLOR)
11828 AC_SUBST(PROGRESSTEXTCOLOR)
11829 AC_SUBST(PROGRESSTEXTBASELINE)
11832 AC_MSG_CHECKING([for extra build ID])
11833 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
11834     EXTRA_BUILDID="$with_extra_buildid"
11836 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
11837 if test -n "$EXTRA_BUILDID" ; then
11838     AC_MSG_RESULT([$EXTRA_BUILDID])
11839 else
11840     AC_MSG_RESULT([not set])
11842 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
11844 OOO_VENDOR=
11845 AC_MSG_CHECKING([for vendor])
11846 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
11847     OOO_VENDOR="$USERNAME"
11849     if test -z "$OOO_VENDOR"; then
11850         OOO_VENDOR="$USER"
11851     fi
11853     if test -z "$OOO_VENDOR"; then
11854         OOO_VENDOR="`id -u -n`"
11855     fi
11857     AC_MSG_RESULT([not set, using $OOO_VENDOR])
11858 else
11859     OOO_VENDOR="$with_vendor"
11860     AC_MSG_RESULT([$OOO_VENDOR])
11862 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
11863 AC_SUBST(OOO_VENDOR)
11865 if test "$_os" = "Android" ; then
11866     ANDROID_PACKAGE_NAME=
11867     AC_MSG_CHECKING([for Android package name])
11868     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
11869         if test -n "$ENABLE_DEBUG"; then
11870             # Default to the package name that makes ndk-gdb happy.
11871             ANDROID_PACKAGE_NAME="org.libreoffice"
11872         else
11873             ANDROID_PACKAGE_NAME="org.example.libreoffice"
11874         fi
11876         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
11877     else
11878         ANDROID_PACKAGE_NAME="$with_android_package_name"
11879         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
11880     fi
11881     AC_SUBST(ANDROID_PACKAGE_NAME)
11884 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
11885 if test "$with_compat_oowrappers" = "yes"; then
11886     WITH_COMPAT_OOWRAPPERS=TRUE
11887     AC_MSG_RESULT(yes)
11888 else
11889     WITH_COMPAT_OOWRAPPERS=
11890     AC_MSG_RESULT(no)
11892 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
11894 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
11895 AC_MSG_CHECKING([for install dirname])
11896 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
11897     INSTALLDIRNAME="$with_install_dirname"
11899 AC_MSG_RESULT([$INSTALLDIRNAME])
11900 AC_SUBST(INSTALLDIRNAME)
11902 AC_MSG_CHECKING([for prefix])
11903 test "x$prefix" = xNONE && prefix=$ac_default_prefix
11904 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
11905 PREFIXDIR="$prefix"
11906 AC_MSG_RESULT([$PREFIXDIR])
11907 AC_SUBST(PREFIXDIR)
11909 LIBDIR=[$(eval echo $(eval echo $libdir))]
11910 AC_SUBST(LIBDIR)
11912 DATADIR=[$(eval echo $(eval echo $datadir))]
11913 AC_SUBST(DATADIR)
11915 MANDIR=[$(eval echo $(eval echo $mandir))]
11916 AC_SUBST(MANDIR)
11918 DOCDIR=[$(eval echo $(eval echo $docdir))]
11919 AC_SUBST(DOCDIR)
11921 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
11922 AC_SUBST(INSTALLDIR)
11924 TESTINSTALLDIR="${BUILDDIR}/test-install"
11925 AC_SUBST(TESTINSTALLDIR)
11928 # ===================================================================
11929 # OAuth2 id and secrets
11930 # ===================================================================
11932 AC_MSG_CHECKING([for Google Drive client id and secret])
11933 GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
11934 GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
11935 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
11936     GDRIVE_CLIENT_ID="\"\""
11939 if test "$with_gdrive_client_secret" = "no" -o -z "$with_gdrive_client_secret"; then
11940     GDRIVE_CLIENT_SECRET="\"\""
11943 if test -z "$GDRIVE_CLIENT_ID" -o -z "$GDRIVE_CLIENT_SECRET"; then
11944     AC_MSG_RESULT([not set])
11945 else
11946     AC_MSG_RESULT([set])
11949 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
11950 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
11952 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
11953 ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
11954 ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
11955 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
11956     ALFRESCO_CLOUD_CLIENT_ID="\"\""
11959 if test "$with_alfresco_cloud_client_secret" = "no" -o -z "$with_alfresco_cloud_client_secret"; then
11960     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
11963 if test -z "$ALFRESCO_CLOUD_CLIENT_ID" -o -z "$ALFRESCO_CLOUD_CLIENT_SECRET"; then
11964     AC_MSG_RESULT([not set])
11965 else
11966     AC_MSG_RESULT([set])
11968 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
11969 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
11971 AC_MSG_CHECKING([for OneDrive client id and secret])
11972 ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
11973 ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
11974 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
11975     ONEDRIVE_CLIENT_ID="\"\""
11978 if test "$with_onedrive_client_secret" = "no" -o -z "$with_onedrive_client_secret"; then
11979     ONEDRIVE_CLIENT_SECRET="\"\""
11982 if test -z "$ONEDRIVE_CLIENT_ID" -o -z "$ONEDRIVE_CLIENT_SECRET"; then
11983     AC_MSG_RESULT([not set])
11984 else
11985     AC_MSG_RESULT([set])
11987 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
11988 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
11991 dnl ===================================================================
11992 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
11993 dnl --enable-dependency-tracking configure option
11994 dnl ===================================================================
11995 AC_MSG_CHECKING([whether to enable dependency tracking])
11996 if test "$enable_dependency_tracking" = "no"; then
11997     nodep=TRUE
11998     AC_MSG_RESULT([no])
11999 else
12000     AC_MSG_RESULT([yes])
12002 AC_SUBST(nodep)
12004 dnl ===================================================================
12005 dnl Number of CPUs to use during the build
12006 dnl ===================================================================
12007 AC_MSG_CHECKING([for number of processors to use])
12008 # plain --with-parallelism is just the default
12009 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12010     if test "$with_parallelism" = "no"; then
12011         PARALLELISM=0
12012     else
12013         PARALLELISM=$with_parallelism
12014     fi
12015 else
12016     if test "$enable_icecream" = "yes"; then
12017         PARALLELISM="10"
12018     else
12019         case `uname -s` in
12021         Darwin|FreeBSD|NetBSD|OpenBSD)
12022             PARALLELISM=`sysctl -n hw.ncpu`
12023             ;;
12025         Linux)
12026             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12027         ;;
12028         # what else than above does profit here *and* has /proc?
12029         *)
12030             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12031             ;;
12032         esac
12034         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12035         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12036     fi
12039 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12040     if test -z "$with_parallelism"; then
12041             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12042             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12043             PARALLELISM="1"
12044     else
12045         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."
12046     fi
12049 if test $PARALLELISM -eq 0; then
12050     AC_MSG_RESULT([explicit make -j option needed])
12051 else
12052     AC_MSG_RESULT([$PARALLELISM])
12054 AC_SUBST(PARALLELISM)
12056 IWYU_PATH="$with_iwyu"
12057 AC_SUBST(IWYU_PATH)
12058 if test ! -z "$IWYU_PATH"; then
12059     if test ! -f "$IWYU_PATH"; then
12060         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12061     fi
12065 # Set up ILIB for MSVC build
12067 ILIB1=
12068 if test "$build_os" = "cygwin"; then
12069     ILIB="."
12070     if test -n "$JAVA_HOME"; then
12071         ILIB="$ILIB;$JAVA_HOME/lib"
12072     fi
12073     ILIB1=-link
12074     if test "$BITNESS_OVERRIDE" = 64; then
12075         if test $vcnum = "150"; then
12076             ILIB="$ILIB;$COMPATH/lib/x64"
12077             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12078         else
12079             ILIB="$ILIB;$COMPATH/lib/amd64"
12080             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/amd64"
12081         fi
12082         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12083         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12084         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12085             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12086             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12087         fi
12088         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12089         ucrtlibpath_formatted=$formatted_path
12090         ILIB="$ILIB;$ucrtlibpath_formatted"
12091         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12092     else
12093         if test $vcnum = "150"; then
12094             ILIB="$ILIB;$COMPATH/lib/x86"
12095             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12096         else
12097             ILIB="$ILIB;$COMPATH/lib"
12098             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib"
12099         fi
12100         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12101         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12102         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12103             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12104             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12105         fi
12106         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12107         ucrtlibpath_formatted=$formatted_path
12108         ILIB="$ILIB;$ucrtlibpath_formatted"
12109         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12110     fi
12111     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12112         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12113     else
12114         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12115     fi
12117     AC_SUBST(ILIB)
12120 dnl We should be able to drop the below check when bumping the GCC baseline to
12121 dnl 4.9, as <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54577>
12122 dnl "deque<T>::erase() still takes iterator instead of const_iterator" should be
12123 dnl fixed there with <https://gcc.gnu.org/git/?p=gcc.git;a=commit;
12124 dnl h=6b0e18ca48bb4b4c01e7b5be2b98849943fdcf91>:
12125 AC_MSG_CHECKING(
12126     [whether C++11 use of const_iterator in standard containers is broken])
12127 save_CXXFLAGS=$CXXFLAGS
12128 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12129 AC_LANG_PUSH([C++])
12130 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12131     #include <list>
12132     ]],[[
12133         std::list<int> l;
12134         l.erase(l.cbegin());
12135     ]])],
12136     [broken=no], [broken=yes])
12137 AC_LANG_POP([C++])
12138 CXXFLAGS=$save_CXXFLAGS
12139 AC_MSG_RESULT([$broken])
12140 if test "$broken" = yes; then
12141     AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
12145 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12146 save_CXXFLAGS=$CXXFLAGS
12147 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12148 save_LIBS=$LIBS
12149 if test -n "$ILIB1"; then
12150     LIBS="$LIBS $ILIB1"
12152 AC_LANG_PUSH([C++])
12153 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12154     // Exit with failure if the static initializer_list is stored on the
12155     // stack (as done by Clang < 3.4):
12156     #include <initializer_list>
12157     struct S {};
12158     bool g(void const * p1, void const * p2) {
12159         int n;
12160         return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12161     }
12162     bool f(void const * p1) {
12163         static std::initializer_list<S> s { S() };
12164         return g(p1, s.begin());
12165     }
12166     ]],[[
12167         int n;
12168         return f(&n) ? 0 : 1;
12169     ]])], [broken=no], [broken=yes],[broken='assuming not (cross-compiling)'])
12170 AC_LANG_POP([C++])
12171 LIBS=$save_LIBS
12172 CXXFLAGS=$save_CXXFLAGS
12173 AC_MSG_RESULT([$broken])
12174 if test "$broken" = yes -a "$_os" != "iOS"; then
12175     AC_MSG_ERROR([working support for static initializer_list needed])
12179 # ===================================================================
12180 # Creating bigger shared library to link against
12181 # ===================================================================
12182 AC_MSG_CHECKING([whether to create huge library])
12183 MERGELIBS=
12185 if test $_os = iOS -o $_os = Android; then
12186     # Never any point in mergelibs for these as we build just static
12187     # libraries anyway...
12188     enable_mergelibs=no
12191 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12192     if test $_os != Linux -a $_os != WINNT; then
12193         add_warning "--enable-mergelibs is not tested for this platform"
12194     fi
12195     MERGELIBS="TRUE"
12196     AC_MSG_RESULT([yes])
12197 else
12198     AC_MSG_RESULT([no])
12200 AC_SUBST([MERGELIBS])
12202 dnl ===================================================================
12203 dnl icerun is a wrapper that stops us spawning tens of processes
12204 dnl locally - for tools that can't be executed on the compile cluster
12205 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12206 dnl ===================================================================
12207 AC_MSG_CHECKING([whether to use icerun wrapper])
12208 ICECREAM_RUN=
12209 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12210     ICECREAM_RUN=icerun
12211     AC_MSG_RESULT([yes])
12212 else
12213     AC_MSG_RESULT([no])
12215 AC_SUBST(ICECREAM_RUN)
12217 dnl ===================================================================
12218 dnl Setup the ICECC_VERSION for the build the same way it was set for
12219 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12220 dnl ===================================================================
12221 x_ICECC_VERSION=[\#]
12222 if test -n "$ICECC_VERSION" ; then
12223     x_ICECC_VERSION=
12225 AC_SUBST(x_ICECC_VERSION)
12226 AC_SUBST(ICECC_VERSION)
12228 dnl ===================================================================
12230 AC_MSG_CHECKING([MPL subset])
12231 MPL_SUBSET=
12233 if test "$enable_mpl_subset" = "yes"; then
12234     warn_report=false
12235     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12236         warn_report=true
12237     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12238         warn_report=true
12239     fi
12240     if test "$warn_report" = "true"; then
12241         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12242     fi
12243     if test "x$enable_postgresql_sdbc" != "xno"; then
12244         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12245     fi
12246     if test "$enable_lotuswordpro" = "yes"; then
12247         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12248     fi
12249     if test "$WITH_WEBDAV" = "neon"; then
12250         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12251     fi
12252     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12253         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12254     fi
12255     if test -n "$ENABLE_PDFIMPORT"; then
12256         if test "x$SYSTEM_POPPLER" = "x"; then
12257             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12258         fi
12259     fi
12260     # cf. m4/libo_check_extension.m4
12261     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12262         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12263     fi
12264     for theme in $WITH_THEMES; do
12265         case $theme in
12266         breeze|crystal|default|hicontrast|oxygen|sifr)
12267             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12268         *) : ;;
12269         esac
12270     done
12272     ENABLE_OPENGL_TRANSITIONS=
12274     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12275         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12276     fi
12278     MPL_SUBSET="TRUE"
12279     AC_DEFINE(MPL_HAVE_SUBSET)
12280     AC_MSG_RESULT([only])
12281 else
12282     AC_MSG_RESULT([no restrictions])
12284 AC_SUBST(MPL_SUBSET)
12286 dnl ===================================================================
12288 AC_MSG_CHECKING([formula logger])
12289 ENABLE_FORMULA_LOGGER=
12291 if test "x$enable_formula_logger" = "xyes"; then
12292     AC_MSG_RESULT([yes])
12293     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12294     ENABLE_FORMULA_LOGGER=TRUE
12295 elif test -n "$ENABLE_DBGUTIL" ; then
12296     AC_MSG_RESULT([yes])
12297     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12298     ENABLE_FORMULA_LOGGER=TRUE
12299 else
12300     AC_MSG_RESULT([no])
12303 AC_SUBST(ENABLE_FORMULA_LOGGER)
12305 dnl ===================================================================
12306 dnl Setting up the environment.
12307 dnl ===================================================================
12308 AC_MSG_NOTICE([setting up the build environment variables...])
12310 AC_SUBST(COMPATH)
12312 if test "$build_os" = "cygwin"; then
12313     if test -d "$COMPATH/atlmfc/lib"; then
12314         ATL_LIB="$COMPATH/atlmfc/lib"
12315         ATL_INCLUDE="$COMPATH/atlmfc/include"
12316     else
12317         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12318         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12319     fi
12320     if test "$BITNESS_OVERRIDE" = 64; then
12321         if test $VCVER = "150"; then
12322             ATL_LIB="$ATL_LIB/x64"
12323         else
12324             ATL_LIB="$ATL_LIB/amd64"
12325         fi
12326     else
12327         if test $VCVER = "150"; then
12328             ATL_LIB="$ATL_LIB/x86"
12329         fi
12330     fi
12331     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12332     PathFormat "/usr/bin/find.exe"
12333     FIND="$formatted_path"
12334     PathFormat "/usr/bin/sort.exe"
12335     SORT="$formatted_path"
12336     PathFormat "/usr/bin/grep.exe"
12337     WIN_GREP="$formatted_path"
12338     PathFormat "/usr/bin/ls.exe"
12339     WIN_LS="$formatted_path"
12340     PathFormat "/usr/bin/touch.exe"
12341     WIN_TOUCH="$formatted_path"
12342 else
12343     FIND=find
12344     SORT=sort
12347 AC_SUBST(ATL_INCLUDE)
12348 AC_SUBST(ATL_LIB)
12349 AC_SUBST(FIND)
12350 AC_SUBST(SORT)
12351 AC_SUBST(WIN_GREP)
12352 AC_SUBST(WIN_LS)
12353 AC_SUBST(WIN_TOUCH)
12355 AC_SUBST(BUILD_TYPE)
12357 AC_SUBST(SOLARINC)
12359 PathFormat "$PERL"
12360 PERL="$formatted_path"
12361 AC_SUBST(PERL)
12363 if test -n "$TMPDIR"; then
12364     TEMP_DIRECTORY="$TMPDIR"
12365 else
12366     TEMP_DIRECTORY="/tmp"
12368 if test "$build_os" = "cygwin"; then
12369     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12371 AC_SUBST(TEMP_DIRECTORY)
12373 # setup the PATH for the environment
12374 if test -n "$LO_PATH_FOR_BUILD"; then
12375     LO_PATH="$LO_PATH_FOR_BUILD"
12376 else
12377     LO_PATH="$PATH"
12379     case "$host_os" in
12381     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12382         if test "$ENABLE_JAVA" != ""; then
12383             pathmunge "$JAVA_HOME/bin" "after"
12384         fi
12385         ;;
12387     cygwin*)
12388         # Win32 make needs native paths
12389         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12390             LO_PATH=`cygpath -p -m "$PATH"`
12391         fi
12392         if test "$BITNESS_OVERRIDE" = 64; then
12393             # needed for msi packaging
12394             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12395         fi
12396         # .NET 4.6 and higher don't have bin directory
12397         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12398             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12399         fi
12400         pathmunge "$ASM_HOME" "before"
12401         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12402         pathmunge "$CSC_PATH" "before"
12403         pathmunge "$MIDL_PATH" "before"
12404         pathmunge "$AL_PATH" "before"
12405         pathmunge "$MSPDB_PATH" "before"
12406         if test -n "$MSBUILD_PATH" ; then
12407             pathmunge "$MSBUILD_PATH" "before"
12408         fi
12409         if test "$BITNESS_OVERRIDE" = 64; then
12410             pathmunge "$COMPATH/bin/amd64" "before"
12411             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12412         else
12413             pathmunge "$COMPATH/bin" "before"
12414             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12415         fi
12416         if test "$ENABLE_JAVA" != ""; then
12417             if test -d "$JAVA_HOME/jre/bin/client"; then
12418                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12419             fi
12420             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12421                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12422             fi
12423             pathmunge "$JAVA_HOME/bin" "before"
12424         fi
12425         ;;
12427     solaris*)
12428         pathmunge "/usr/css/bin" "before"
12429         if test "$ENABLE_JAVA" != ""; then
12430             pathmunge "$JAVA_HOME/bin" "after"
12431         fi
12432         ;;
12433     esac
12436 AC_SUBST(LO_PATH)
12438 libo_FUZZ_SUMMARY
12440 # Generate a configuration sha256 we can use for deps
12441 if test -f config_host.mk; then
12442     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12444 if test -f config_host_lang.mk; then
12445     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12448 CFLAGS=$my_original_CFLAGS
12449 CXXFLAGS=$my_original_CXXFLAGS
12450 CPPFLAGS=$my_original_CPPFLAGS
12452 AC_CONFIG_FILES([config_host.mk
12453                  config_host_lang.mk
12454                  Makefile
12455                  lo.xcent
12456                  bin/bffvalidator.sh
12457                  bin/odfvalidator.sh
12458                  bin/officeotron.sh
12459                  instsetoo_native/util/openoffice.lst
12460                  sysui/desktop/macosx/Info.plist])
12461 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12462 AC_CONFIG_HEADERS([config_host/config_clang.h])
12463 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12464 AC_CONFIG_HEADERS([config_host/config_eot.h])
12465 AC_CONFIG_HEADERS([config_host/config_extension_update.h])
12466 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12467 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12468 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12469 AC_CONFIG_HEADERS([config_host/config_features.h])
12470 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12471 AC_CONFIG_HEADERS([config_host/config_folders.h])
12472 AC_CONFIG_HEADERS([config_host/config_gio.h])
12473 AC_CONFIG_HEADERS([config_host/config_global.h])
12474 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12475 AC_CONFIG_HEADERS([config_host/config_java.h])
12476 AC_CONFIG_HEADERS([config_host/config_langs.h])
12477 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12478 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12479 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12480 AC_CONFIG_HEADERS([config_host/config_locales.h])
12481 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12482 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12483 AC_CONFIG_HEADERS([config_host/config_qt5.h])
12484 AC_CONFIG_HEADERS([config_host/config_oox.h])
12485 AC_CONFIG_HEADERS([config_host/config_options.h])
12486 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12487 AC_CONFIG_HEADERS([config_host/config_test.h])
12488 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12489 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12490 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12491 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12492 AC_CONFIG_HEADERS([config_host/config_version.h])
12493 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12494 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12495 AC_CONFIG_HEADERS([config_host/config_python.h])
12496 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12497 AC_OUTPUT
12499 if test "$CROSS_COMPILING" = TRUE; then
12500     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12503 # touch the config timestamp file
12504 if test ! -f config_host.mk.stamp; then
12505     echo > config_host.mk.stamp
12506 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12507     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12508 else
12509     echo > config_host.mk.stamp
12512 # touch the config lang timestamp file
12513 if test ! -f config_host_lang.mk.stamp; then
12514     echo > config_host_lang.mk.stamp
12515 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12516     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12517 else
12518     echo > config_host_lang.mk.stamp
12522 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12524 cat << _EOS
12525 ****************************************************************************
12526 WARNING:
12527 Your make version is known to be horribly slow, and hard to debug
12528 problems with. To get a reasonably functional make please do:
12530 to install a pre-compiled binary make for Win32
12532  mkdir -p /opt/lo/bin
12533  cd /opt/lo/bin
12534  wget https://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
12535  cp make-85047eb-msvc.exe make
12536  chmod +x make
12538 to install from source:
12539 place yourself in a working directory of you choice.
12541  git clone git://git.savannah.gnu.org/make.git
12543  [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"]
12544  set PATH=%PATH%;C:\Cygwin\bin
12545  [or Cygwin64, if that is what you have]
12546  cd path-to-make-repo-you-cloned-above
12547  build_w32.bat --without-guile
12549 should result in a WinRel/gnumake.exe.
12550 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12552 Then re-run autogen.sh
12554 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12555 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12557 _EOS
12560 cat << _EOF
12561 ****************************************************************************
12563 To build, run:
12564 $GNUMAKE
12566 To view some help, run:
12567 $GNUMAKE help
12569 _EOF
12571 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12572     cat << _EOF
12573 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12574 _EOF
12576     if test $_os = Darwin; then
12577         echo open instdir/$PRODUCTNAME.app
12578     else
12579         echo instdir/program/soffice
12580     fi
12581     cat << _EOF
12583 If you want to run the smoketest, run:
12584 $GNUMAKE check
12586 _EOF
12589 if test -f warn; then
12590     cat warn
12591     rm warn
12594 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: