Fix 'unused parameter' warnings.
[LibreOffice.git] / configure.ac
blob23b1ff84ed5a525f04c54331175275c850bd6f06
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     PATH="$mac_path"
137     unset mac_path
138     unset git_mac_path
141 echo "********************************************************************"
142 echo "*"
143 echo "*   Running ${PACKAGE_NAME} build configuration."
144 echo "*"
145 echo "********************************************************************"
146 echo ""
148 dnl ===================================================================
149 dnl checks build and host OSes
150 dnl do this before argument processing to allow for platform dependent defaults
151 dnl ===================================================================
152 AC_CANONICAL_HOST
154 AC_MSG_CHECKING([for product name])
155 PRODUCTNAME="AC_PACKAGE_NAME"
156 if test -n "$with_product_name" -a "$with_product_name" != no; then
157     PRODUCTNAME="$with_product_name"
159 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
160     PRODUCTNAME="${PRODUCTNAME}Dev"
162 AC_MSG_RESULT([$PRODUCTNAME])
163 AC_SUBST(PRODUCTNAME)
164 PRODUCTNAME_WITHOUT_SPACES=${PRODUCTNAME// /}
165 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
167 dnl ===================================================================
168 dnl Our version is defined by the AC_INIT() at the top of this script.
169 dnl ===================================================================
171 AC_MSG_CHECKING([for package version])
172 if test -n "$with_package_version" -a "$with_package_version" != no; then
173     PACKAGE_VERSION="$with_package_version"
175 AC_MSG_RESULT([$PACKAGE_VERSION])
177 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
179 LIBO_VERSION_MAJOR=$1
180 LIBO_VERSION_MINOR=$2
181 LIBO_VERSION_MICRO=$3
182 LIBO_VERSION_PATCH=$4
184 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
185 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
186 # no way to encode that into an integer in general.
187 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
189 LIBO_VERSION_SUFFIX=$5
190 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
191 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
192 # they get undoubled before actually passed to sed.
193 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
194 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
195 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
196 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
198 AC_SUBST(LIBO_VERSION_MAJOR)
199 AC_SUBST(LIBO_VERSION_MINOR)
200 AC_SUBST(LIBO_VERSION_MICRO)
201 AC_SUBST(LIBO_VERSION_PATCH)
202 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
203 AC_SUBST(LIBO_VERSION_SUFFIX)
204 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
206 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
207 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
208 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
209 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
211 LIBO_THIS_YEAR=`date +%Y`
212 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
214 dnl ===================================================================
215 dnl Product version
216 dnl ===================================================================
217 AC_MSG_CHECKING([for product version])
218 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
219 AC_MSG_RESULT([$PRODUCTVERSION])
220 AC_SUBST(PRODUCTVERSION)
222 AC_PROG_EGREP
223 # AC_PROG_EGREP doesn't set GREP on all systems as well
224 AC_PATH_PROG(GREP, grep)
226 BUILDDIR=`pwd`
227 cd $srcdir
228 SRC_ROOT=`pwd`
229 cd $BUILDDIR
230 x_Cygwin=[\#]
232 dnl ======================================
233 dnl Required GObject introspection version
234 dnl ======================================
235 INTROSPECTION_REQUIRED_VERSION=1.32.0
237 dnl ===================================================================
238 dnl Search all the common names for GNU Make
239 dnl ===================================================================
240 AC_MSG_CHECKING([for GNU Make])
242 # try to use our own make if it is available and GNUMAKE was not already defined
243 if test -z "$GNUMAKE"; then
244     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
245         GNUMAKE="$LODE_HOME/opt/bin/make"
246     elif test -x "/opt/lo/bin/make"; then
247         GNUMAKE="/opt/lo/bin/make"
248     fi
251 GNUMAKE_WIN_NATIVE=
252 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
253     if test -n "$a"; then
254         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
255         if test $? -eq 0;  then
256             if test "$build_os" = "cygwin"; then
257                 if test -n "$($a -v | grep 'Built for Windows')" ; then
258                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
259                     GNUMAKE_WIN_NATIVE="TRUE"
260                 else
261                     GNUMAKE=`which $a`
262                 fi
263             else
264                 GNUMAKE=`which $a`
265             fi
266             break
267         fi
268     fi
269 done
270 AC_MSG_RESULT($GNUMAKE)
271 if test -z "$GNUMAKE"; then
272     AC_MSG_ERROR([not found. install GNU Make.])
273 else
274     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
275         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
276     fi
279 win_short_path_for_make()
281     local_short_path="$1"
282     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
283         cygpath -sm "$local_short_path"
284     else
285         cygpath -u "$(cygpath -d "$local_short_path")"
286     fi
290 if test "$build_os" = "cygwin"; then
291     PathFormat "$SRC_ROOT"
292     SRC_ROOT="$formatted_path"
293     PathFormat "$BUILDDIR"
294     BUILDDIR="$formatted_path"
295     x_Cygwin=
296     AC_MSG_CHECKING(for explicit COMSPEC)
297     if test -z "$COMSPEC"; then
298         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
299     else
300         AC_MSG_RESULT([found: $COMSPEC])
301     fi
304 AC_SUBST(SRC_ROOT)
305 AC_SUBST(BUILDDIR)
306 AC_SUBST(x_Cygwin)
307 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
308 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
310 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
311     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
314 # need sed in os checks...
315 AC_PATH_PROGS(SED, sed)
316 if test -z "$SED"; then
317     AC_MSG_ERROR([install sed to run this script])
320 # Set the ENABLE_LTO variable
321 # ===================================================================
322 AC_MSG_CHECKING([whether to use link-time optimization])
323 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
324     ENABLE_LTO="TRUE"
325     AC_MSG_RESULT([yes])
326     AC_DEFINE(STATIC_LINKING)
327 else
328     ENABLE_LTO=""
329     AC_MSG_RESULT([no])
331 AC_SUBST(ENABLE_LTO)
333 AC_ARG_ENABLE(fuzz-options,
334     AS_HELP_STRING([--enable-fuzz-options],
335         [Randomly enable or disable each of those configurable options
336          that are supposed to be freely selectable without interdependencies,
337          or where bad interaction from interdependencies is automatically avoided.])
340 dnl ===================================================================
341 dnl When building for Android, --with-android-ndk,
342 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
343 dnl mandatory
344 dnl ===================================================================
346 AC_ARG_WITH(android-ndk,
347     AS_HELP_STRING([--with-android-ndk],
348         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
351 AC_ARG_WITH(android-ndk-toolchain-version,
352     AS_HELP_STRING([--with-android-ndk-toolchain-version],
353         [Specify which toolchain version to use, of those present in the
354         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
355         with_android_ndk_toolchain_version=clang5.0)
357 AC_ARG_WITH(android-sdk,
358     AS_HELP_STRING([--with-android-sdk],
359         [Specify location of the Android SDK. Mandatory when building for Android.]),
362 ANDROID_NDK_HOME=
363 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
364     with_android_ndk="$SRC_ROOT/external/android-ndk"
366 if test -n "$with_android_ndk"; then
367     ANDROID_NDK_HOME=$with_android_ndk
369     # Set up a lot of pre-canned defaults
371     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
372         if test ! -f $ANDROID_NDK_HOME/source.properties; then
373             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
374         fi
375         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
376     else
377         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
378     fi
379     if test -z "$ANDROID_NDK_VERSION";  then
380         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
381     fi
382     case $ANDROID_NDK_VERSION in
383     r9*|r10*)
384         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 15.x*])
385         ;;
386     11.1.*|12.1.*|13.1.*|14.1.*)
387         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 15.x.*])
388         ;;
389     15.0.*|15.1.*)
390         ;;
391     *)
392         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.])
393         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."
394         ;;
395     esac
397     ANDROID_API_LEVEL=14
398     android_cpu=$host_cpu
399     ANDROID_ARCH=$android_cpu
400     if test $host_cpu = arm; then
401         android_platform_prefix=$android_cpu-linux-androideabi
402         android_gnu_prefix=$android_platform_prefix
403         LLVM_TRIPLE=armv7-none-linux-androideabi
404         ANDROID_APP_ABI=armeabi-v7a
405         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
406     elif test $host_cpu = aarch64; then
407         android_platform_prefix=$android_cpu-linux-android
408         android_gnu_prefix=$android_platform_prefix
409         LLVM_TRIPLE=aarch64-none-linux-android
410         # minimum android version that supports aarch64
411         ANDROID_API_LEVEL=21
412         ANDROID_APP_ABI=arm64-v8a
413         ANDROID_ARCH=arm64
414     elif test $host_cpu = mips; then
415         android_platform_prefix=mipsel-linux-android
416         android_gnu_prefix=$android_platform_prefix
417         LLVM_TRIPLE=mipsel-none-linux-android
418         ANDROID_APP_ABI=mips
419     else
420         # host_cpu is something like "i386" or "i686" I guess, NDK uses
421         # "x86" in some contexts
422         android_cpu=x86
423         android_platform_prefix=$android_cpu
424         android_gnu_prefix=i686-linux-android
425         LLVM_TRIPLE=i686-none-linux-android
426         ANDROID_APP_ABI=x86
427         ANDROIDCFLAGS="-march=atom"
428     fi
430     case "$with_android_ndk_toolchain_version" in
431     clang5.0)
432         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
433         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION
434         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm
435         ;;
436     *)
437         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
438     esac
440     if test ! -d $ANDROID_BINUTILS_DIR; then
441         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
442     elif test ! -d $ANDROID_COMPILER_DIR; then
443         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
444     fi
446     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
447     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
448     # manage to link the (app-specific) single huge .so that is built for the app in
449     # android/source/ if there is debug information in a significant part of the object files.
450     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
451     # all objects have been built with debug information.)
452     case $build_os in
453     linux-gnu*)
454         ndk_build_os=linux
455         ;;
456     darwin*)
457         ndk_build_os=darwin
458         ;;
459     *)
460         AC_MSG_ERROR([We only support building for Android from Linux or OS X])
461         ;;
462     esac
463     ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
464     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
466     test -z "$SYSBASE" && SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
467     test -z "$AR" && AR=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ar
468     test -z "$NM" && NM=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-nm
469     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-objdump
470     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ranlib
471     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-strip
473     ANDROIDCFLAGS="$ANDROIDCFLAGS -gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT -target $LLVM_TRIPLE -no-canonical-prefixes"
474     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$SYSBASE -ffunction-sections -fdata-sections -Qunused-arguments"
475     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/$ANDROID_GCC_TOOLCHAIN_VERSION/libs/$ANDROID_APP_ABI"
476     if test "$ENABLE_LTO" = TRUE; then
477         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
478         # $CC and $CXX when building external libraries
479         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
480     fi
482     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"
484     if test -z "$CC"; then
485         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
486     fi
487     if test -z "$CXX"; then
488         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
489     fi
491     # remember to download the ownCloud Android library later
492     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
494 AC_SUBST(ANDROID_NDK_HOME)
495 AC_SUBST(ANDROID_APP_ABI)
496 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
498 dnl ===================================================================
499 dnl --with-android-sdk
500 dnl ===================================================================
501 ANDROID_SDK_HOME=
502 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
503     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
505 if test -n "$with_android_sdk"; then
506     ANDROID_SDK_HOME=$with_android_sdk
507     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
509 AC_SUBST(ANDROID_SDK_HOME)
511 dnl ===================================================================
512 dnl The following is a list of supported systems.
513 dnl Sequential to keep the logic very simple
514 dnl These values may be checked and reset later.
515 dnl ===================================================================
516 #defaults unless the os test overrides this:
517 test_randr=yes
518 test_xrender=yes
519 test_cups=yes
520 test_dbus=yes
521 test_fontconfig=yes
522 test_cairo=no
524 # Default values, as such probably valid just for Linux, set
525 # differently below just for Mac OSX,but at least better than
526 # hardcoding these as we used to do. Much of this is duplicated also
527 # in solenv for old build system and for gbuild, ideally we should
528 # perhaps define stuff like this only here in configure.ac?
530 LINKFLAGSSHL="-shared"
531 PICSWITCH="-fpic"
532 DLLPOST=".so"
534 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
536 INSTROOTBASESUFFIX=
537 INSTROOTCONTENTSUFFIX=
538 SDKDIRNAME=sdk
540 case "$host_os" in
542 solaris*)
543     test_gtk=yes
544     build_gstreamer_1_0=yes
545     build_gstreamer_0_10=yes
546     test_freetype=yes
547     _os=SunOS
549     dnl ===========================================================
550     dnl Check whether we're using Solaris 10 - SPARC or Intel.
551     dnl ===========================================================
552     AC_MSG_CHECKING([the Solaris operating system release])
553     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
554     if test "$_os_release" -lt "10"; then
555         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
556     else
557         AC_MSG_RESULT([ok ($_os_release)])
558     fi
560     dnl Check whether we're using a SPARC or i386 processor
561     AC_MSG_CHECKING([the processor type])
562     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
563         AC_MSG_RESULT([ok ($host_cpu)])
564     else
565         AC_MSG_ERROR([only SPARC and i386 processors are supported])
566     fi
567     ;;
569 linux-gnu*|k*bsd*-gnu*)
570     test_gtk=yes
571     build_gstreamer_1_0=yes
572     build_gstreamer_0_10=yes
573     test_kde4=yes
574     test_qt5=yes
575     if test "$enable_fuzzers" != yes; then
576         test_freetype=yes
577         test_fontconfig=yes
578     else
579         test_freetype=no
580         test_fontconfig=no
581         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
582     fi
583     _os=Linux
584     ;;
586 gnu)
587     test_randr=no
588     test_xrender=no
589     _os=GNU
590      ;;
592 cygwin*|interix*)
594     # When building on Windows normally with MSVC under Cygwin,
595     # configure thinks that the host platform (the platform the
596     # built code will run on) is Cygwin, even if it obviously is
597     # Windows, which in Autoconf terminology is called
598     # "mingw32". (Which is misleading as MinGW is the name of the
599     # tool-chain, not an operating system.)
601     # Somewhat confusing, yes. But this configure script doesn't
602     # look at $host etc that much, it mostly uses its own $_os
603     # variable, set here in this case statement.
605     test_cups=no
606     test_dbus=no
607     test_randr=no
608     test_xrender=no
609     test_freetype=no
610     test_fontconfig=no
611     _os=WINNT
613     DLLPOST=".dll"
614     LINKFLAGSNOUNDEFS=
615     ;;
617 darwin*) # Mac OS X or iOS
618     test_gtk=yes
619     test_randr=no
620     test_xrender=no
621     test_freetype=no
622     test_fontconfig=no
623     test_dbus=no
624     if test -n "$LODE_HOME" ; then
625         mac_sanitize_path
626         AC_MSG_NOTICE([sanitized the PATH to $PATH])
627     fi
628     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
629         _os=iOS
630         test_gtk=no
631         test_cups=no
632         enable_mpl_subset=yes
633         enable_lotuswordpro=no
634         enable_coinmp=no
635         enable_lpsolve=no
636         enable_postgresql_sdbc=no
637         enable_extension_integration=no
638         enable_report_builder=no
639         with_theme="tango"
640         with_ppds=no
641         if test "$enable_ios_simulator" = "yes"; then
642             host=x86_64-apple-darwin
643         fi
644     else
645         _os=Darwin
646         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
647         INSTROOTCONTENTSUFFIX=/Contents
648         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
649     fi
650     enable_systray=no
651     # See comment above the case "$host_os"
652     LINKFLAGSSHL="-dynamiclib -single_module"
654     # -fPIC is default
655     PICSWITCH=""
657     DLLPOST=".dylib"
659     # -undefined error is the default
660     LINKFLAGSNOUNDEFS=""
663 freebsd*)
664     test_gtk=yes
665     build_gstreamer_1_0=yes
666     build_gstreamer_0_10=yes
667     test_kde4=yes
668     test_qt5=yes
669     test_freetype=yes
670     AC_MSG_CHECKING([the FreeBSD operating system release])
671     if test -n "$with_os_version"; then
672         OSVERSION="$with_os_version"
673     else
674         OSVERSION=`/sbin/sysctl -n kern.osreldate`
675     fi
676     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
677     AC_MSG_CHECKING([which thread library to use])
678     if test "$OSVERSION" -lt "500016"; then
679         PTHREAD_CFLAGS="-D_THREAD_SAFE"
680         PTHREAD_LIBS="-pthread"
681     elif test "$OSVERSION" -lt "502102"; then
682         PTHREAD_CFLAGS="-D_THREAD_SAFE"
683         PTHREAD_LIBS="-lc_r"
684     else
685         PTHREAD_CFLAGS=""
686         PTHREAD_LIBS="-pthread"
687     fi
688     AC_MSG_RESULT([$PTHREAD_LIBS])
689     _os=FreeBSD
690     ;;
692 *netbsd*)
693     test_gtk=yes
694     build_gstreamer_1_0=yes
695     build_gstreamer_0_10=yes
696     test_kde4=yes
697     test_qt5=yes
698     test_freetype=yes
699     PTHREAD_LIBS="-pthread -lpthread"
700     _os=NetBSD
701     ;;
703 aix*)
704     test_randr=no
705     test_freetype=yes
706     PTHREAD_LIBS=-pthread
707     _os=AIX
708     ;;
710 openbsd*)
711     test_gtk=yes
712     test_freetype=yes
713     PTHREAD_CFLAGS="-D_THREAD_SAFE"
714     PTHREAD_LIBS="-pthread"
715     _os=OpenBSD
716     ;;
718 dragonfly*)
719     test_gtk=yes
720     build_gstreamer_1_0=yes
721     build_gstreamer_0_10=yes
722     test_kde4=yes
723     test_qt5=yes
724     test_freetype=yes
725     PTHREAD_LIBS="-pthread"
726     _os=DragonFly
727     ;;
729 linux-android*)
730     build_gstreamer_1_0=no
731     build_gstreamer_0_10=no
732     enable_lotuswordpro=no
733     enable_mpl_subset=yes
734     enable_coinmp=yes
735     enable_lpsolve=no
736     enable_report_builder=no
737     enable_odk=no
738     enable_postgresql_sdbc=no
739     enable_python=no
740     with_theme="tango"
741     test_cups=no
742     test_dbus=no
743     test_fontconfig=no
744     test_freetype=no
745     test_gtk=no
746     test_kde4=no
747     test_qt5=no
748     test_randr=no
749     test_xrender=no
750     _os=Android
752     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
753     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
754     ;;
757     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
758     ;;
759 esac
761 if test "$_os" = "Android" ; then
762     # Verify that the NDK and SDK options are proper
763     if test -z "$with_android_ndk"; then
764         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
765     elif test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
766         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
767     fi
769     if test -z "$ANDROID_SDK_HOME"; then
770         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
771     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
772         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
773     fi
775     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
776     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
777         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
778                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
779                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
780         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
781         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
782         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
783     fi
784     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
785         AC_MSG_WARN([android support repository not found - install with
786                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
787                      to allow the build to download the specified version of the android support libraries])
788         add_warning "android support repository not found - install with"
789         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
790         add_warning "to allow the build to download the specified version of the android support libraries"
791     fi
794 if test "$_os" = "AIX"; then
795     AC_PATH_PROG(GAWK, gawk)
796     if test -z "$GAWK"; then
797         AC_MSG_ERROR([gawk not found in \$PATH])
798     fi
801 AC_SUBST(SDKDIRNAME)
803 AC_SUBST(PTHREAD_CFLAGS)
804 AC_SUBST(PTHREAD_LIBS)
806 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
807 # By default use the ones specified by our build system,
808 # but explicit override is possible.
809 AC_MSG_CHECKING(for explicit AFLAGS)
810 if test -n "$AFLAGS"; then
811     AC_MSG_RESULT([$AFLAGS])
812     x_AFLAGS=
813 else
814     AC_MSG_RESULT(no)
815     x_AFLAGS=[\#]
817 AC_MSG_CHECKING(for explicit CFLAGS)
818 if test -n "$CFLAGS"; then
819     AC_MSG_RESULT([$CFLAGS])
820     x_CFLAGS=
821 else
822     AC_MSG_RESULT(no)
823     x_CFLAGS=[\#]
825 AC_MSG_CHECKING(for explicit CXXFLAGS)
826 if test -n "$CXXFLAGS"; then
827     AC_MSG_RESULT([$CXXFLAGS])
828     x_CXXFLAGS=
829 else
830     AC_MSG_RESULT(no)
831     x_CXXFLAGS=[\#]
833 AC_MSG_CHECKING(for explicit OBJCFLAGS)
834 if test -n "$OBJCFLAGS"; then
835     AC_MSG_RESULT([$OBJCFLAGS])
836     x_OBJCFLAGS=
837 else
838     AC_MSG_RESULT(no)
839     x_OBJCFLAGS=[\#]
841 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
842 if test -n "$OBJCXXFLAGS"; then
843     AC_MSG_RESULT([$OBJCXXFLAGS])
844     x_OBJCXXFLAGS=
845 else
846     AC_MSG_RESULT(no)
847     x_OBJCXXFLAGS=[\#]
849 AC_MSG_CHECKING(for explicit LDFLAGS)
850 if test -n "$LDFLAGS"; then
851     AC_MSG_RESULT([$LDFLAGS])
852     x_LDFLAGS=
853 else
854     AC_MSG_RESULT(no)
855     x_LDFLAGS=[\#]
857 AC_SUBST(AFLAGS)
858 AC_SUBST(CFLAGS)
859 AC_SUBST(CXXFLAGS)
860 AC_SUBST(OBJCFLAGS)
861 AC_SUBST(OBJCXXFLAGS)
862 AC_SUBST(LDFLAGS)
863 AC_SUBST(x_AFLAGS)
864 AC_SUBST(x_CFLAGS)
865 AC_SUBST(x_CXXFLAGS)
866 AC_SUBST(x_OBJCFLAGS)
867 AC_SUBST(x_OBJCXXFLAGS)
868 AC_SUBST(x_LDFLAGS)
870 dnl These are potentially set for MSVC, in the code checking for UCRT below:
871 my_original_CFLAGS=$CFLAGS
872 my_original_CXXFLAGS=$CXXFLAGS
873 my_original_CPPFLAGS=$CPPFLAGS
875 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
876 dnl Needs to precede the AC_SEARCH_LIBS call below, which apparently calls
877 dnl AC_PROG_CC internally.
878 if test "$_os" != "WINNT"; then
879     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
880     save_CFLAGS=$CFLAGS
881     AC_PROG_CC
882     CFLAGS=$save_CFLAGS
885 if test $_os != "WINNT"; then
886     save_LIBS="$LIBS"
887     AC_SEARCH_LIBS([dlsym], [dl],
888         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
889         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
890     LIBS="$save_LIBS"
892 AC_SUBST(DLOPEN_LIBS)
894 ###############################################################################
895 # Extensions switches --enable/--disable
896 ###############################################################################
897 # By default these should be enabled unless having extra dependencies.
898 # If there is extra dependency over configure options then the enable should
899 # be automagic based on whether the requiring feature is enabled or not.
900 # All this options change anything only with --enable-extension-integration.
902 # The name of this option and its help string makes it sound as if
903 # extensions are built anyway, just not integrated in the installer,
904 # if you use --disable-extension-integration. Is that really the
905 # case?
907 AC_ARG_ENABLE(ios-simulator,
908     AS_HELP_STRING([--enable-ios-simulator],
909         [build i386 or x86_64 for ios simulator])
912 libo_FUZZ_ARG_ENABLE(extension-integration,
913     AS_HELP_STRING([--disable-extension-integration],
914         [Disable integration of the built extensions in the installer of the
915          product. Use this switch to disable the integration.])
918 AC_ARG_ENABLE(avmedia,
919     AS_HELP_STRING([--disable-avmedia],
920         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
923 AC_ARG_ENABLE(database-connectivity,
924     AS_HELP_STRING([--disable-database-connectivity],
925         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
928 # This doesn't mean not building (or "integrating") extensions
929 # (although it probably should; i.e. it should imply
930 # --disable-extension-integration I guess), it means not supporting
931 # any extension mechanism at all
932 libo_FUZZ_ARG_ENABLE(extensions,
933     AS_HELP_STRING([--disable-extensions],
934         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
937 AC_ARG_ENABLE(scripting,
938     AS_HELP_STRING([--disable-scripting],
939         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
942 # This is mainly for Android and iOS, but could potentially be used in some
943 # special case otherwise, too, so factored out as a separate setting
945 AC_ARG_ENABLE(dynamic-loading,
946     AS_HELP_STRING([--disable-dynamic-loading],
947         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
950 libo_FUZZ_ARG_ENABLE(ext-mariadb-connector,
951     AS_HELP_STRING([--enable-ext-mariadb-connector],
952         [Enable the build of the MariaDB/MySQL Connector extension.])
955 libo_FUZZ_ARG_ENABLE(report-builder,
956     AS_HELP_STRING([--disable-report-builder],
957         [Disable the Report Builder.])
960 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
961     AS_HELP_STRING([--enable-ext-wiki-publisher],
962         [Enable the Wiki Publisher extension.])
965 libo_FUZZ_ARG_ENABLE(lpsolve,
966     AS_HELP_STRING([--disable-lpsolve],
967         [Disable compilation of the lp solve solver ])
969 libo_FUZZ_ARG_ENABLE(coinmp,
970     AS_HELP_STRING([--disable-coinmp],
971         [Disable compilation of the CoinMP solver ])
974 libo_FUZZ_ARG_ENABLE(pdfimport,
975     AS_HELP_STRING([--disable-pdfimport],
976         [Disable building the PDF import feature.])
979 libo_FUZZ_ARG_ENABLE(pdfium,
980     AS_HELP_STRING([--disable-pdfium],
981         [Disable building PDFium.])
984 ###############################################################################
986 dnl ---------- *** ----------
988 libo_FUZZ_ARG_ENABLE(mergelibs,
989     AS_HELP_STRING([--enable-mergelibs],
990         [Merge several of the smaller libraries into one big, "merged", one.])
993 libo_FUZZ_ARG_ENABLE(breakpad,
994     AS_HELP_STRING([--enable-breakpad],
995         [Enables breakpad for crash reporting.])
998 AC_ARG_ENABLE(fetch-external,
999     AS_HELP_STRING([--disable-fetch-external],
1000         [Disables fetching external tarballs from web sources.])
1003 AC_ARG_ENABLE(fuzzers,
1004     AS_HELP_STRING([--enable-fuzzers],
1005         [Enables building libfuzzer targets for fuzz testing.])
1008 libo_FUZZ_ARG_ENABLE(pch,
1009     AS_HELP_STRING([--enable-pch],
1010         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1013 libo_FUZZ_ARG_ENABLE(epm,
1014     AS_HELP_STRING([--enable-epm],
1015         [LibreOffice includes self-packaging code, that requires epm, however epm is
1016          useless for large scale package building.])
1019 libo_FUZZ_ARG_ENABLE(odk,
1020     AS_HELP_STRING([--disable-odk],
1021         [LibreOffice includes an ODK, office development kit which some packagers may
1022          wish to build without.])
1025 AC_ARG_ENABLE(mpl-subset,
1026     AS_HELP_STRING([--enable-mpl-subset],
1027         [Don't compile any pieces which are not MPL or more liberally licensed])
1030 libo_FUZZ_ARG_ENABLE(evolution2,
1031     AS_HELP_STRING([--enable-evolution2],
1032         [Allows the built-in evolution 2 addressbook connectivity build to be
1033          enabled.])
1036 AC_ARG_ENABLE(avahi,
1037     AS_HELP_STRING([--enable-avahi],
1038         [Determines whether to use Avahi to advertise Impress to remote controls.])
1041 libo_FUZZ_ARG_ENABLE(werror,
1042     AS_HELP_STRING([--enable-werror],
1043         [Turn warnings to errors. (Has no effect in modules where the treating
1044          of warnings as errors is disabled explicitly.)]),
1047 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1048     AS_HELP_STRING([--enable-assert-always-abort],
1049         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1052 libo_FUZZ_ARG_ENABLE(dbgutil,
1053     AS_HELP_STRING([--enable-dbgutil],
1054         [Provide debugging support from --enable-debug and include additional debugging
1055          utilities such as object counting or more expensive checks.
1056          This is the recommended option for developers.
1057          Note that this makes the build ABI incompatible, it is not possible to mix object
1058          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1060 libo_FUZZ_ARG_ENABLE(debug,
1061     AS_HELP_STRING([--enable-debug],
1062         [Include debugging information, disable compiler optimization and inlining plus
1063          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1065 libo_FUZZ_ARG_ENABLE(sal-log,
1066     AS_HELP_STRING([--enable-sal-log],
1067         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1069 AC_ARG_ENABLE(selective-debuginfo,
1070     AS_HELP_STRING([--enable-selective-debuginfo],
1071         [If --enable-debug or --enable-dbgutil is used, build debugging information
1072          (-g compiler flag) only for the specified gbuild build targets
1073          (where all means everything, - prepended means not to enable, / appended means
1074          everything in the directory; there is no ordering, more specific overrides
1075          more general, and disabling takes precedence).
1076          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1078 libo_FUZZ_ARG_ENABLE(symbols,
1079     AS_HELP_STRING([--enable-symbols],
1080         [Generate debug information.
1081          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1082          otherwise.]))
1084 libo_FUZZ_ARG_ENABLE(optimized,
1085     AS_HELP_STRING([--disable-optimized],
1086         [Whether to compile with optimization flags.
1087          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1088          otherwise.]))
1090 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1091     AS_HELP_STRING([--disable-runtime-optimizations],
1092         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1093          JVM JIT) that are known to interact badly with certain dynamic analysis
1094          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1095          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1096          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1098 AC_ARG_WITH(valgrind,
1099     AS_HELP_STRING([--with-valgrind],
1100         [Make availability of Valgrind headers a hard requirement.]))
1102 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1103     AS_HELP_STRING([--enable-compiler-plugins],
1104         [Enable compiler plugins that will perform additional checks during
1105          building. Enabled automatically by --enable-dbgutil.]))
1107 libo_FUZZ_ARG_ENABLE(ooenv,
1108     AS_HELP_STRING([--disable-ooenv],
1109         [Disable ooenv for the instdir installation.]))
1111 AC_ARG_ENABLE(lto,
1112     AS_HELP_STRING([--enable-lto],
1113         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1114          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1115          linker. For MSVC, this option is broken at the moment. This is experimental work
1116          in progress that shouldn't be used unless you are working on it.)]))
1118 AC_ARG_ENABLE(python,
1119     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1120         [Enables or disables Python support at run-time and build-time.
1121          Also specifies what Python to use. 'auto' is the default.
1122          'fully-internal' even forces the internal version for uses of Python
1123          during the build.]))
1125 libo_FUZZ_ARG_ENABLE(gtk,
1126     AS_HELP_STRING([--disable-gtk],
1127         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1128 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1130 libo_FUZZ_ARG_ENABLE(gtk3,
1131     AS_HELP_STRING([--disable-gtk3],
1132         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.
1133          This is experimental and may not work.]),
1134 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1136 libo_FUZZ_ARG_ENABLE(systray,
1137     AS_HELP_STRING([--disable-systray],
1138         [Determines whether to build the systray quickstarter.]),
1139 ,test "${enable_systray+set}" = set || enable_systray=yes)
1141 AC_ARG_ENABLE(split-app-modules,
1142     AS_HELP_STRING([--enable-split-app-modules],
1143         [Split file lists for app modules, e.g. base, calc.
1144          Has effect only with make distro-pack-install]),
1147 AC_ARG_ENABLE(split-opt-features,
1148     AS_HELP_STRING([--enable-split-opt-features],
1149         [Split file lists for some optional features, e.g. pyuno, testtool.
1150          Has effect only with make distro-pack-install]),
1153 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1154     AS_HELP_STRING([--disable-cairo-canvas],
1155         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1158 libo_FUZZ_ARG_ENABLE(dbus,
1159     AS_HELP_STRING([--disable-dbus],
1160         [Determines whether to enable features that depend on dbus.
1161          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1162 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1164 libo_FUZZ_ARG_ENABLE(sdremote,
1165     AS_HELP_STRING([--disable-sdremote],
1166         [Determines whether to enable Impress remote control (i.e. the server component).]),
1167 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1169 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1170     AS_HELP_STRING([--disable-sdremote-bluetooth],
1171         [Determines whether to build sdremote with bluetooth support.
1172          Requires dbus on Linux.]))
1174 libo_FUZZ_ARG_ENABLE(gio,
1175     AS_HELP_STRING([--disable-gio],
1176         [Determines whether to use the GIO support.]),
1177 ,test "${enable_gio+set}" = set || enable_gio=yes)
1179 AC_ARG_ENABLE(kde4,
1180     AS_HELP_STRING([--enable-kde4],
1181         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1182          KDE4 are available.]),
1185 AC_ARG_ENABLE(qt5,
1186     AS_HELP_STRING([--enable-qt5],
1187         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1188          available.]),
1191 libo_FUZZ_ARG_ENABLE(gui,
1192     AS_HELP_STRING([--disable-gui],
1193         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1194          command-line option. Not related to LibreOffice Online functionality. Don't use
1195          unless you are certain you need to. Nobody will help you if you insist on trying
1196          this and run into problems.]),
1197 ,test "${enable_gui+set}" = set || enable_gui=yes)
1199 libo_FUZZ_ARG_ENABLE(randr,
1200     AS_HELP_STRING([--disable-randr],
1201         [Disable RandR support in the vcl project.]),
1202 ,test "${enable_randr+set}" = set || enable_randr=yes)
1204 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1205     AS_HELP_STRING([--disable-gstreamer-1-0],
1206         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1207 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1209 AC_ARG_ENABLE(gstreamer-0-10,
1210     AS_HELP_STRING([--enable-gstreamer-0-10],
1211         [Enable building with the gstreamer 0.10 avmedia backend.]),
1212 ,enable_gstreamer_0_10=no)
1214 libo_FUZZ_ARG_ENABLE(vlc,
1215     AS_HELP_STRING([--enable-vlc],
1216         [Enable building with the (experimental) VLC avmedia backend.]),
1217 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1219 libo_FUZZ_ARG_ENABLE(neon,
1220     AS_HELP_STRING([--disable-neon],
1221         [Disable neon and the compilation of webdav binding.]),
1224 libo_FUZZ_ARG_ENABLE([eot],
1225     [AS_HELP_STRING([--enable-eot],
1226         [Enable support for Embedded OpenType fonts.])],
1227 ,test "${enable_eot+set}" = set || enable_eot=no)
1229 libo_FUZZ_ARG_ENABLE(cve-tests,
1230     AS_HELP_STRING([--disable-cve-tests],
1231         [Prevent CVE tests to be executed]),
1234 libo_FUZZ_ARG_ENABLE(chart-tests,
1235     AS_HELP_STRING([--enable-chart-tests],
1236         [Executes chart XShape tests. In a perfect world these tests would be
1237          stable and everyone could run them, in reality it is best to run them
1238          only on a few machines that are known to work and maintained by people
1239          who can judge if a test failure is a regression or not.]),
1242 AC_ARG_ENABLE(build-unowinreg,
1243     AS_HELP_STRING([--enable-build-unowinreg],
1244         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1245          compiler is needed on Linux.]),
1248 AC_ARG_ENABLE(dependency-tracking,
1249     AS_HELP_STRING([--enable-dependency-tracking],
1250         [Do not reject slow dependency extractors.])[
1251   --disable-dependency-tracking
1252                           Disables generation of dependency information.
1253                           Speed up one-time builds.],
1256 AC_ARG_ENABLE(icecream,
1257     AS_HELP_STRING([--enable-icecream],
1258         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1259          It defaults to /opt/icecream for the location of the icecream gcc/g++
1260          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1263 libo_FUZZ_ARG_ENABLE(cups,
1264     AS_HELP_STRING([--disable-cups],
1265         [Do not build cups support.])
1268 AC_ARG_ENABLE(ccache,
1269     AS_HELP_STRING([--disable-ccache],
1270         [Do not try to use ccache automatically.
1271          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1272          CC/CXX are not yet set, and --enable-icecream is not given, we
1273          attempt to use ccache. --disable-ccache disables ccache completely.
1277 AC_ARG_ENABLE(64-bit,
1278     AS_HELP_STRING([--enable-64-bit],
1279         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1280          At the moment meaningful only for Windows.]), ,)
1282 libo_FUZZ_ARG_ENABLE(online-update,
1283     AS_HELP_STRING([--enable-online-update],
1284         [Enable the online update service that will check for new versions of
1285          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1286          If the value is "mar", the experimental Mozilla-like update will be
1287          enabled instead of the traditional update mechanism.]),
1290 AC_ARG_WITH(update-config,
1291     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1292                    [Path to the update config ini file]))
1294 libo_FUZZ_ARG_ENABLE(extension-update,
1295     AS_HELP_STRING([--disable-extension-update],
1296         [Disable possibility to update installed extensions.]),
1299 libo_FUZZ_ARG_ENABLE(release-build,
1300     AS_HELP_STRING([--enable-release-build],
1301         [Enable release build. Note that the "release build" choice is orthogonal to
1302          whether symbols are present, debug info is generated, or optimization
1303          is done.
1304          See http://wiki.documentfoundation.org/Development/DevBuild]),
1307 AC_ARG_ENABLE(windows-build-signing,
1308     AS_HELP_STRING([--enable-windows-build-signing],
1309         [Enable signing of windows binaries (*.exe, *.dll)]),
1312 AC_ARG_ENABLE(silent-msi,
1313     AS_HELP_STRING([--enable-silent-msi],
1314         [Enable MSI with LIMITUI=1 (silent install).]),
1317 AC_ARG_ENABLE(macosx-code-signing,
1318     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1319         [Sign executables, dylibs, frameworks and the app bundle. If you
1320          don't provide an identity the first suitable certificate
1321          in your keychain is used.]),
1324 AC_ARG_ENABLE(macosx-package-signing,
1325     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1326         [Create a .pkg suitable for uploading to the Mac App Store and sign
1327          it. If you don't provide an identity the first suitable certificate
1328          in your keychain is used.]),
1331 AC_ARG_ENABLE(macosx-sandbox,
1332     AS_HELP_STRING([--enable-macosx-sandbox],
1333         [Make the app bundle run in a sandbox. Requires code signing.
1334          Is required by apps distributed in the Mac App Store, and implies
1335          adherence to App Store rules.]),
1338 AC_ARG_WITH(macosx-bundle-identifier,
1339     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1340         [Define the OS X bundle identifier. Default is the somewhat weird
1341          org.libreoffice.script ("script", huh?).]),
1342 ,with_macosx_bundle_identifier=org.libreoffice.script)
1344 AC_ARG_WITH(product-name,
1345     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1346         [Define the product name. Default is AC_PACKAGE_NAME.]),
1347 ,with_product_name=$PRODUCTNAME)
1349 AC_ARG_WITH(package-version,
1350     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1351         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1354 libo_FUZZ_ARG_ENABLE(readonly-installset,
1355     AS_HELP_STRING([--enable-readonly-installset],
1356         [Prevents any attempts by LibreOffice to write into its installation. That means
1357          at least that no "system-wide" extensions can be added. Experimental work in
1358          progress.]),
1361 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1362     AS_HELP_STRING([--disable-postgresql-sdbc],
1363         [Disable the build of the PostgreSQL-SDBC driver.])
1366 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1367     AS_HELP_STRING([--disable-lotuswordpro],
1368         [Disable the build of the Lotus Word Pro filter.]),
1369 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1371 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1372     AS_HELP_STRING([--disable-firebird-sdbc],
1373         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1374 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1376 AC_ARG_ENABLE(bogus-pkg-config,
1377     AS_HELP_STRING([--enable-bogus-pkg-config],
1378         [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.]),
1381 AC_ARG_ENABLE(openssl,
1382     AS_HELP_STRING([--disable-openssl],
1383         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1384          components will either use GNUTLS or NSS. Work in progress,
1385          use only if you are hacking on it.]),
1386 ,enable_openssl=yes)
1388 AC_ARG_ENABLE(library-bin-tar,
1389     AS_HELP_STRING([--enable-library-bin-tar],
1390         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1391         Some libraries can save their build result in a tarball
1392         stored in TARFILE_LOCATION. That binary tarball is
1393         uniquely identified by the source tarball,
1394         the content of the config_host.mk file and the content
1395         of the top-level directory in core for that library
1396         If this option is enabled, then if such a tarfile exist, it will be untarred
1397         instead of the source tarfile, and the build step will be skipped for that
1398         library.
1399         If a proper tarfile does not exist, then the normal source-based
1400         build is done for that library and a proper binary tarfile is created
1401         for the next time.]),
1404 AC_ARG_ENABLE(dconf,
1405     AS_HELP_STRING([--disable-dconf],
1406         [Disable the dconf configuration backend (enabled by default where
1407          available).]))
1409 libo_FUZZ_ARG_ENABLE(formula-logger,
1410     AS_HELP_STRING(
1411         [--enable-formula-logger],
1412         [Enable formula logger for logging formula calculation flow in Calc.]
1413     )
1416 dnl ===================================================================
1417 dnl Optional Packages (--with/without-)
1418 dnl ===================================================================
1420 AC_ARG_WITH(gcc-home,
1421     AS_HELP_STRING([--with-gcc-home],
1422         [Specify the location of gcc/g++ manually. This can be used in conjunction
1423          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1424          non-default path.]),
1427 AC_ARG_WITH(gnu-patch,
1428     AS_HELP_STRING([--with-gnu-patch],
1429         [Specify location of GNU patch on Solaris or FreeBSD.]),
1432 AC_ARG_WITH(build-platform-configure-options,
1433     AS_HELP_STRING([--with-build-platform-configure-options],
1434         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1437 AC_ARG_WITH(gnu-cp,
1438     AS_HELP_STRING([--with-gnu-cp],
1439         [Specify location of GNU cp on Solaris or FreeBSD.]),
1442 AC_ARG_WITH(external-tar,
1443     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1444         [Specify an absolute path of where to find (and store) tarfiles.]),
1445     TARFILE_LOCATION=$withval ,
1448 AC_ARG_WITH(referenced-git,
1449     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1450         [Specify another checkout directory to reference. This makes use of
1451                  git submodule update --reference, and saves a lot of diskspace
1452                  when having multiple trees side-by-side.]),
1453     GIT_REFERENCE_SRC=$withval ,
1456 AC_ARG_WITH(linked-git,
1457     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1458         [Specify a directory where the repositories of submodules are located.
1459          This uses a method similar to git-new-workdir to get submodules.]),
1460     GIT_LINK_SRC=$withval ,
1463 AC_ARG_WITH(galleries,
1464     AS_HELP_STRING([--with-galleries],
1465         [Specify how galleries should be built. It is possible either to
1466          build these internally from source ("build"),
1467          or to disable them ("no")]),
1470 AC_ARG_WITH(theme,
1471     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1472         [Choose which themes to include. By default those themes with an '*' are included.
1473          Possible choices: *breeze, *breeze_dark, crystal, *elementary, *galaxy, *hicontrast, oxygen, *sifr, *sifr_dark, *tango, tango_testing.]),
1476 libo_FUZZ_ARG_WITH(helppack-integration,
1477     AS_HELP_STRING([--without-helppack-integration],
1478         [It will not integrate the helppacks to the installer
1479          of the product. Please use this switch to use the online help
1480          or separate help packages.]),
1483 libo_FUZZ_ARG_WITH(fonts,
1484     AS_HELP_STRING([--without-fonts],
1485         [LibreOffice includes some third-party fonts to provide a reliable basis for
1486          help content, templates, samples, etc. When these fonts are already
1487          known to be available on the system then you should use this option.]),
1490 AC_ARG_WITH(epm,
1491     AS_HELP_STRING([--with-epm],
1492         [Decides which epm to use. Default is to use the one from the system if
1493          one is built. When either this is not there or you say =internal epm
1494          will be built.]),
1497 AC_ARG_WITH(package-format,
1498     AS_HELP_STRING([--with-package-format],
1499         [Specify package format(s) for LibreOffice installation sets. The
1500          implicit --without-package-format leads to no installation sets being
1501          generated. Possible values: aix, archive, bsd, deb, dmg,
1502          installed, msi, pkg, and rpm.
1503          Example: --with-package-format='deb rpm']),
1506 AC_ARG_WITH(tls,
1507     AS_HELP_STRING([--with-tls],
1508         [Decides which TLS/SSL and cryptographic implementations to use for
1509          LibreOffice's code. Notice that this doesn't apply for depending
1510          libraries like "neon", for example. Default is to use OpenSSL
1511          although NSS is also possible. Notice that selecting NSS restricts
1512          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1513          restrict by now the usage of NSS in LO's code. Possible values:
1514          openssl, nss. Example: --with-tls="nss"]),
1517 AC_ARG_WITH(system-libs,
1518     AS_HELP_STRING([--with-system-libs],
1519         [Use libraries already on system -- enables all --with-system-* flags.]),
1522 AC_ARG_WITH(system-bzip2,
1523     AS_HELP_STRING([--with-system-bzip2],
1524         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1525     [with_system_bzip2="$with_system_libs"])
1527 AC_ARG_WITH(system-headers,
1528     AS_HELP_STRING([--with-system-headers],
1529         [Use headers already on system -- enables all --with-system-* flags for
1530          external packages whose headers are the only entities used i.e.
1531          boost/odbc/sane-header(s).]),,
1532     [with_system_headers="$with_system_libs"])
1534 AC_ARG_WITH(system-jars,
1535     AS_HELP_STRING([--without-system-jars],
1536         [When building with --with-system-libs, also the needed jars are expected
1537          on the system. Use this to disable that]),,
1538     [with_system_jars="$with_system_libs"])
1540 AC_ARG_WITH(system-cairo,
1541     AS_HELP_STRING([--with-system-cairo],
1542         [Use cairo libraries already on system.  Happens automatically for
1543          (implicit) --enable-gtk and for --enable-gtk3.]))
1545 AC_ARG_WITH(system-epoxy,
1546     AS_HELP_STRING([--with-system-epoxy],
1547         [Use epoxy libraries already on system.  Happens automatically for
1548          --enable-gtk3.]),,
1549        [with_system_epoxy="$with_system_libs"])
1551 AC_ARG_WITH(myspell-dicts,
1552     AS_HELP_STRING([--with-myspell-dicts],
1553         [Adds myspell dictionaries to the LibreOffice installation set]),
1556 AC_ARG_WITH(system-dicts,
1557     AS_HELP_STRING([--without-system-dicts],
1558         [Do not use dictionaries from system paths.]),
1561 AC_ARG_WITH(external-dict-dir,
1562     AS_HELP_STRING([--with-external-dict-dir],
1563         [Specify external dictionary dir.]),
1566 AC_ARG_WITH(external-hyph-dir,
1567     AS_HELP_STRING([--with-external-hyph-dir],
1568         [Specify external hyphenation pattern dir.]),
1571 AC_ARG_WITH(external-thes-dir,
1572     AS_HELP_STRING([--with-external-thes-dir],
1573         [Specify external thesaurus dir.]),
1576 AC_ARG_WITH(system-zlib,
1577     AS_HELP_STRING([--with-system-zlib],
1578         [Use zlib already on system.]),,
1579     [with_system_zlib=auto])
1581 AC_ARG_WITH(system-jpeg,
1582     AS_HELP_STRING([--with-system-jpeg],
1583         [Use jpeg already on system.]),,
1584     [with_system_jpeg="$with_system_libs"])
1586 AC_ARG_WITH(system-clucene,
1587     AS_HELP_STRING([--with-system-clucene],
1588         [Use clucene already on system.]),,
1589     [with_system_clucene="$with_system_libs"])
1591 AC_ARG_WITH(system-expat,
1592     AS_HELP_STRING([--with-system-expat],
1593         [Use expat already on system.]),,
1594     [with_system_expat="$with_system_libs"])
1596 AC_ARG_WITH(system-libxml,
1597     AS_HELP_STRING([--with-system-libxml],
1598         [Use libxml/libxslt already on system.]),,
1599     [with_system_libxml=auto])
1601 AC_ARG_WITH(system-icu,
1602     AS_HELP_STRING([--with-system-icu],
1603         [Use icu already on system.]),,
1604     [with_system_icu="$with_system_libs"])
1606 AC_ARG_WITH(system-ucpp,
1607     AS_HELP_STRING([--with-system-ucpp],
1608         [Use ucpp already on system.]),,
1609     [])
1611 AC_ARG_WITH(system-openldap,
1612     AS_HELP_STRING([--with-system-openldap],
1613         [Use the OpenLDAP LDAP SDK already on system.]),,
1614     [with_system_openldap="$with_system_libs"])
1616 AC_ARG_WITH(system-poppler,
1617     AS_HELP_STRING([--with-system-poppler],
1618         [Use system poppler (only needed for PDF import).]),,
1619     [with_system_poppler="$with_system_libs"])
1621 AC_ARG_WITH(system-gpgmepp,
1622     AS_HELP_STRING([--with-system-gpgmepp],
1623         [Use gpgmepp already on system]),,
1624     [with_system_gpgmepp="$with_system_libs"])
1626 AC_ARG_WITH(system-apache-commons,
1627     AS_HELP_STRING([--with-system-apache-commons],
1628         [Use Apache commons libraries already on system.]),,
1629     [with_system_apache_commons="$with_system_jars"])
1631 AC_ARG_WITH(system-mariadb,
1632     AS_HELP_STRING([--with-system-mariadb],
1633         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1634          extension.]),,
1635     [with_system_mariadb="$with_system_libs"])
1637 AC_ARG_ENABLE(bundle-mariadb,
1638     AS_HELP_STRING([--enable-bundle-mariadb],
1639         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1642 AC_ARG_WITH(system-mysql-cppconn,
1643     AS_HELP_STRING([--with-system-mysql-cppconn],
1644         [Use MySQL C++ Connector libraries already on system.]),,
1645     [with_system_mysql_cppconn="$with_system_libs"])
1647 AC_ARG_WITH(system-postgresql,
1648     AS_HELP_STRING([--with-system-postgresql],
1649         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1650          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1651     [with_system_postgresql="$with_system_libs"])
1653 AC_ARG_WITH(libpq-path,
1654     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1655         [Use this PostgreSQL C interface (libpq) installation for building
1656          the PostgreSQL-SDBC extension.]),
1659 AC_ARG_WITH(system-firebird,
1660     AS_HELP_STRING([--with-system-firebird],
1661         [Use Firebird libraries already on system, for building the Firebird-SDBC
1662          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1663     [with_system_firebird="$with_system_libs"])
1665 AC_ARG_WITH(system-libtommath,
1666             AS_HELP_STRING([--with-system-libtommath],
1667                            [Use libtommath already on system]),,
1668             [with_system_libtommath="$with_system_libs"])
1670 AC_ARG_WITH(system-hsqldb,
1671     AS_HELP_STRING([--with-system-hsqldb],
1672         [Use hsqldb already on system.]))
1674 AC_ARG_WITH(hsqldb-jar,
1675     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1676         [Specify path to jarfile manually.]),
1677     HSQLDB_JAR=$withval)
1679 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1680     AS_HELP_STRING([--disable-scripting-beanshell],
1681         [Disable support for scripts in BeanShell.]),
1685 AC_ARG_WITH(system-beanshell,
1686     AS_HELP_STRING([--with-system-beanshell],
1687         [Use beanshell already on system.]),,
1688     [with_system_beanshell="$with_system_jars"])
1690 AC_ARG_WITH(beanshell-jar,
1691     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1692         [Specify path to jarfile manually.]),
1693     BSH_JAR=$withval)
1695 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1696     AS_HELP_STRING([--disable-scripting-javascript],
1697         [Disable support for scripts in JavaScript.]),
1701 AC_ARG_WITH(system-rhino,
1702     AS_HELP_STRING([--with-system-rhino],
1703         [Use rhino already on system.]),,)
1704 #    [with_system_rhino="$with_system_jars"])
1705 # Above is not used as we have different debug interface
1706 # patched into internal rhino. This code needs to be fixed
1707 # before we can enable it by default.
1709 AC_ARG_WITH(rhino-jar,
1710     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1711         [Specify path to jarfile manually.]),
1712     RHINO_JAR=$withval)
1714 AC_ARG_WITH(commons-logging-jar,
1715     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1716         [Specify path to jarfile manually.]),
1717     COMMONS_LOGGING_JAR=$withval)
1719 AC_ARG_WITH(system-jfreereport,
1720     AS_HELP_STRING([--with-system-jfreereport],
1721         [Use JFreeReport already on system.]),,
1722     [with_system_jfreereport="$with_system_jars"])
1724 AC_ARG_WITH(sac-jar,
1725     AS_HELP_STRING([--with-sac-jar=JARFILE],
1726         [Specify path to jarfile manually.]),
1727     SAC_JAR=$withval)
1729 AC_ARG_WITH(libxml-jar,
1730     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1731         [Specify path to jarfile manually.]),
1732     LIBXML_JAR=$withval)
1734 AC_ARG_WITH(flute-jar,
1735     AS_HELP_STRING([--with-flute-jar=JARFILE],
1736         [Specify path to jarfile manually.]),
1737     FLUTE_JAR=$withval)
1739 AC_ARG_WITH(jfreereport-jar,
1740     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1741         [Specify path to jarfile manually.]),
1742     JFREEREPORT_JAR=$withval)
1744 AC_ARG_WITH(liblayout-jar,
1745     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1746         [Specify path to jarfile manually.]),
1747     LIBLAYOUT_JAR=$withval)
1749 AC_ARG_WITH(libloader-jar,
1750     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1751         [Specify path to jarfile manually.]),
1752     LIBLOADER_JAR=$withval)
1754 AC_ARG_WITH(libformula-jar,
1755     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1756         [Specify path to jarfile manually.]),
1757     LIBFORMULA_JAR=$withval)
1759 AC_ARG_WITH(librepository-jar,
1760     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1761         [Specify path to jarfile manually.]),
1762     LIBREPOSITORY_JAR=$withval)
1764 AC_ARG_WITH(libfonts-jar,
1765     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1766         [Specify path to jarfile manually.]),
1767     LIBFONTS_JAR=$withval)
1769 AC_ARG_WITH(libserializer-jar,
1770     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1771         [Specify path to jarfile manually.]),
1772     LIBSERIALIZER_JAR=$withval)
1774 AC_ARG_WITH(libbase-jar,
1775     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1776         [Specify path to jarfile manually.]),
1777     LIBBASE_JAR=$withval)
1779 AC_ARG_WITH(system-odbc,
1780     AS_HELP_STRING([--with-system-odbc],
1781         [Use the odbc headers already on system.]),,
1782     [with_system_odbc="auto"])
1784 AC_ARG_WITH(system-sane,
1785     AS_HELP_STRING([--with-system-sane],
1786         [Use sane.h already on system.]),,
1787     [with_system_sane="$with_system_headers"])
1789 AC_ARG_WITH(system-bluez,
1790     AS_HELP_STRING([--with-system-bluez],
1791         [Use bluetooth.h already on system.]),,
1792     [with_system_bluez="$with_system_headers"])
1794 AC_ARG_WITH(system-curl,
1795     AS_HELP_STRING([--with-system-curl],
1796         [Use curl already on system.]),,
1797     [with_system_curl=auto])
1799 AC_ARG_WITH(system-boost,
1800     AS_HELP_STRING([--with-system-boost],
1801         [Use boost already on system.]),,
1802     [with_system_boost="$with_system_headers"])
1804 AC_ARG_WITH(system-glm,
1805     AS_HELP_STRING([--with-system-glm],
1806         [Use glm already on system.]),,
1807     [with_system_glm="$with_system_headers"])
1809 AC_ARG_WITH(system-hunspell,
1810     AS_HELP_STRING([--with-system-hunspell],
1811         [Use libhunspell already on system.]),,
1812     [with_system_hunspell="$with_system_libs"])
1814 AC_ARG_WITH(system-mythes,
1815     AS_HELP_STRING([--with-system-mythes],
1816         [Use mythes already on system.]),,
1817     [with_system_mythes="$with_system_libs"])
1819 AC_ARG_WITH(system-altlinuxhyph,
1820     AS_HELP_STRING([--with-system-altlinuxhyph],
1821         [Use ALTLinuxhyph already on system.]),,
1822     [with_system_altlinuxhyph="$with_system_libs"])
1824 AC_ARG_WITH(system-lpsolve,
1825     AS_HELP_STRING([--with-system-lpsolve],
1826         [Use lpsolve already on system.]),,
1827     [with_system_lpsolve="$with_system_libs"])
1829 AC_ARG_WITH(system-coinmp,
1830     AS_HELP_STRING([--with-system-coinmp],
1831         [Use CoinMP already on system.]),,
1832     [with_system_coinmp="$with_system_libs"])
1834 AC_ARG_WITH(system-liblangtag,
1835     AS_HELP_STRING([--with-system-liblangtag],
1836         [Use liblangtag library already on system.]),,
1837     [with_system_liblangtag="$with_system_libs"])
1839 AC_ARG_WITH(webdav,
1840     AS_HELP_STRING([--with-webdav],
1841         [Specify which library to use for webdav implementation.
1842          Possible values: "neon", "serf", "no". The default value is "neon".
1843          Example: --with-webdav="serf"]),
1844     WITH_WEBDAV=$withval,
1845     WITH_WEBDAV="neon")
1847 AC_ARG_WITH(linker-hash-style,
1848     AS_HELP_STRING([--with-linker-hash-style],
1849         [Use linker with --hash-style=<style> when linking shared objects.
1850          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1851          if supported on the build system, and "sysv" otherwise.]))
1853 AC_ARG_WITH(jdk-home,
1854     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1855         [If you have installed JDK 1.6 or later on your system please supply the
1856          path here. Note that this is not the location of the java command but the
1857          location of the entire distribution.]),
1860 AC_ARG_WITH(help,
1861     AS_HELP_STRING([--with-help],
1862         [Enable the build of help. There is a special parameter "common" that
1863          can be used to bundle only the common part, .e.g help-specific icons.
1864          This is useful when you build the helpcontent separately.])
1865     [
1866                           Usage:     --with-help    build the entire local help
1867                                  --without-help     no local help (default)
1868                                  --with-help=common bundle common files for the local
1869                                                     help but do not build the whole help
1870     ],
1873 libo_FUZZ_ARG_WITH(java,
1874     AS_HELP_STRING([--with-java=<java command>],
1875         [Specify the name of the Java interpreter command. Typically "java"
1876          which is the default.
1878          To build without support for Java components, applets, accessibility
1879          or the XML filters written in Java, use --without-java or --with-java=no.]),
1880     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1881     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
1884 AC_ARG_WITH(jvm-path,
1885     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
1886         [Use a specific JVM search path at runtime.
1887          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
1890 AC_ARG_WITH(ant-home,
1891     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
1892         [If you have installed Jakarta Ant on your system, please supply the path here.
1893          Note that this is not the location of the Ant binary but the location
1894          of the entire distribution.]),
1897 AC_ARG_WITH(symbol-config,
1898     AS_HELP_STRING([--with-symbol-config],
1899         [Configuration for the crashreport symbol upload]),
1900         [],
1901         [with_symbol_config=no])
1903 AC_ARG_WITH(export-validation,
1904     AS_HELP_STRING([--without-export-validation],
1905         [Disable validating OOXML and ODF files as exported from in-tree tests.
1906          Use this option e.g. if your system only provides Java 5.]),
1907 ,with_export_validation=auto)
1909 AC_ARG_WITH(bffvalidator,
1910     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
1911         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
1912          Requires installed Microsoft Office Binary File Format Validator.
1913          Note: export-validation (--with-export-validation) is required to be turned on.
1914          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
1915 ,with_bffvalidator=no)
1917 libo_FUZZ_ARG_WITH(junit,
1918     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
1919         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
1920          --without-junit disables those tests. Not relevant in the --without-java case.]),
1921 ,with_junit=yes)
1923 AC_ARG_WITH(hamcrest,
1924     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
1925         [Specifies the hamcrest jar file to use for JUnit-based tests.
1926          --without-junit disables those tests. Not relevant in the --without-java case.]),
1927 ,with_hamcrest=yes)
1929 AC_ARG_WITH(perl-home,
1930     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
1931         [If you have installed Perl 5 Distribution, on your system, please
1932          supply the path here. Note that this is not the location of the Perl
1933          binary but the location of the entire distribution.]),
1936 libo_FUZZ_ARG_WITH(doxygen,
1937     AS_HELP_STRING(
1938         [--with-doxygen=<absolute path to doxygen executable>],
1939         [Specifies the doxygen executable to use when generating ODK C/C++
1940          documentation. --without-doxygen disables generation of ODK C/C++
1941          documentation. Not relevant in the --disable-odk case.]),
1942 ,with_doxygen=yes)
1944 AC_ARG_WITH(visual-studio,
1945     AS_HELP_STRING([--with-visual-studio=<2015/2017>],
1946         [Specify which Visual Studio version to use in case several are
1947          installed. If not specified, defaults to 2015.]),
1950 AC_ARG_WITH(windows-sdk,
1951     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
1952         [Specify which Windows SDK, or "Windows Kit", version to use
1953          in case the one that came with the selected Visual Studio
1954          is not what you want for some reason. Note that not all compiler/SDK
1955          combinations are supported. The intent is that this option should not
1956          be needed.]),
1959 AC_ARG_WITH(lang,
1960     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
1961         [Use this option to build LibreOffice with additional UI language support.
1962          English (US) is always included by default.
1963          Separate multiple languages with space.
1964          For all languages, use --with-lang=ALL.]),
1967 AC_ARG_WITH(locales,
1968     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
1969         [Use this option to limit the locale information built in.
1970          Separate multiple locales with space.
1971          Very experimental and might well break stuff.
1972          Just a desperate measure to shrink code and data size.
1973          By default all the locales available is included.
1974          This option is completely unrelated to --with-lang.])
1975     [
1976                           Affects also our character encoding conversion
1977                           tables for encodings mainly targeted for a
1978                           particular locale, like EUC-CN and EUC-TW for
1979                           zh, ISO-2022-JP for ja.
1981                           Affects also our add-on break iterator data for
1982                           some languages.
1984                           For the default, all locales, don't use this switch at all.
1985                           Specifying just the language part of a locale means all matching
1986                           locales will be included.
1987     ],
1990 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
1991 libo_FUZZ_ARG_WITH(krb5,
1992     AS_HELP_STRING([--with-krb5],
1993         [Enable MIT Kerberos 5 support in modules that support it.
1994          By default automatically enabled on platforms
1995          where a good system Kerberos 5 is available.]),
1998 libo_FUZZ_ARG_WITH(gssapi,
1999     AS_HELP_STRING([--with-gssapi],
2000         [Enable GSSAPI support in modules that support it.
2001          By default automatically enabled on platforms
2002          where a good system GSSAPI is available.]),
2005 AC_ARG_WITH(iwyu,
2006     AS_HELP_STRING([--with-iwyu],
2007         [Use given IWYU binary path to check unneeded includes instead of building.
2008          Use only if you are hacking on it.]),
2011 dnl ===================================================================
2012 dnl Branding
2013 dnl ===================================================================
2015 AC_ARG_WITH(branding,
2016     AS_HELP_STRING([--with-branding=/path/to/images],
2017         [Use given path to retrieve branding images set.])
2018     [
2019                           Search for intro.png about.svg and flat_logo.svg.
2020                           If any is missing, default ones will be used instead.
2022                           Search also progress.conf for progress
2023                           settings on intro screen :
2025                           PROGRESSBARCOLOR="255,255,255" Set color of
2026                           progress bar. Comma separated RGB decimal values.
2027                           PROGRESSSIZE="407,6" Set size of progress bar.
2028                           Comma separated decimal values (width, height).
2029                           PROGRESSPOSITION="61,317" Set position of progress
2030                           bar from left,top. Comma separated decimal values.
2031                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2032                           bar frame. Comma separated RGB decimal values.
2033                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2034                           bar text. Comma separated RGB decimal values.
2035                           PROGRESSTEXTBASELINE="287" Set vertical position of
2036                           progress bar text from top. Decimal value.
2038                           Default values will be used if not found.
2039     ],
2043 AC_ARG_WITH(extra-buildid,
2044     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2045         [Show addition build identification in about dialog.]),
2049 AC_ARG_WITH(vendor,
2050     AS_HELP_STRING([--with-vendor="John the Builder"],
2051         [Set vendor of the build.]),
2054 AC_ARG_WITH(android-package-name,
2055     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2056         [Set Android package name of the build.]),
2059 AC_ARG_WITH(compat-oowrappers,
2060     AS_HELP_STRING([--with-compat-oowrappers],
2061         [Install oo* wrappers in parallel with
2062          lo* ones to keep backward compatibility.
2063          Has effect only with make distro-pack-install]),
2066 AC_ARG_WITH(os-version,
2067     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2068         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2071 AC_ARG_WITH(mingw-cross-compiler,
2072     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2073         [Specify the MinGW cross-compiler to use.
2074          When building on the ODK on Unix and building unowinreg.dll,
2075          specify the MinGW C++ cross-compiler.]),
2078 AC_ARG_WITH(idlc-cpp,
2079     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2080         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2083 AC_ARG_WITH(build-version,
2084     AS_HELP_STRING([--with-build-version="Built by Jim"],
2085         [Allows the builder to add a custom version tag that will appear in the
2086          Help/About box for QA purposes.]),
2087 with_build_version=$withval,
2090 AC_ARG_WITH(alloc,
2091     AS_HELP_STRING([--with-alloc],
2092         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
2093          Note that on FreeBSD/NetBSD system==jemalloc]),
2096 AC_ARG_WITH(parallelism,
2097     AS_HELP_STRING([--with-parallelism],
2098         [Number of jobs to run simultaneously during build. Parallel builds can
2099         save a lot of time on multi-cpu machines. Defaults to the number of
2100         CPUs on the machine, unless you configure --enable-icecream - then to
2101         10.]),
2104 AC_ARG_WITH(all-tarballs,
2105     AS_HELP_STRING([--with-all-tarballs],
2106         [Download all external tarballs unconditionally]))
2108 AC_ARG_WITH(gdrive-client-id,
2109     AS_HELP_STRING([--with-gdrive-client-id],
2110         [Provides the client id of the application for OAuth2 authentication
2111         on Google Drive. If either this or --with-gdrive-client-secret is
2112         empty, the feature will be disabled]),
2115 AC_ARG_WITH(gdrive-client-secret,
2116     AS_HELP_STRING([--with-gdrive-client-secret],
2117         [Provides the client secret of the application for OAuth2
2118         authentication on Google Drive. If either this or
2119         --with-gdrive-client-id is empty, the feature will be disabled]),
2122 AC_ARG_WITH(alfresco-cloud-client-id,
2123     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2124         [Provides the client id of the application for OAuth2 authentication
2125         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2126         empty, the feature will be disabled]),
2129 AC_ARG_WITH(alfresco-cloud-client-secret,
2130     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2131         [Provides the client secret of the application for OAuth2
2132         authentication on Alfresco Cloud. If either this or
2133         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2136 AC_ARG_WITH(onedrive-client-id,
2137     AS_HELP_STRING([--with-onedrive-client-id],
2138         [Provides the client id of the application for OAuth2 authentication
2139         on OneDrive. If either this or --with-onedrive-client-secret is
2140         empty, the feature will be disabled]),
2143 AC_ARG_WITH(onedrive-client-secret,
2144     AS_HELP_STRING([--with-onedrive-client-secret],
2145         [Provides the client secret of the application for OAuth2
2146         authentication on OneDrive. If either this or
2147         --with-onedrive-client-id is empty, the feature will be disabled]),
2149 dnl ===================================================================
2150 dnl Do we want to use pre-build binary tarball for recompile
2151 dnl ===================================================================
2153 if test "$enable_library_bin_tar" = "yes" ; then
2154     USE_LIBRARY_BIN_TAR=TRUE
2155 else
2156     USE_LIBRARY_BIN_TAR=
2158 AC_SUBST(USE_LIBRARY_BIN_TAR)
2160 dnl ===================================================================
2161 dnl Test whether build target is Release Build
2162 dnl ===================================================================
2163 AC_MSG_CHECKING([whether build target is Release Build])
2164 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2165     AC_MSG_RESULT([no])
2166     ENABLE_RELEASE_BUILD=
2167 else
2168     AC_MSG_RESULT([yes])
2169     ENABLE_RELEASE_BUILD=TRUE
2171 AC_SUBST(ENABLE_RELEASE_BUILD)
2173 dnl ===================================================================
2174 dnl Test whether to sign Windows Build
2175 dnl ===================================================================
2176 AC_MSG_CHECKING([whether to sign windows build])
2177 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2178     AC_MSG_RESULT([yes])
2179     WINDOWS_BUILD_SIGNING="TRUE"
2180 else
2181     AC_MSG_RESULT([no])
2182     WINDOWS_BUILD_SIGNING="FALSE"
2184 AC_SUBST(WINDOWS_BUILD_SIGNING)
2186 dnl ===================================================================
2187 dnl MacOSX build and runtime environment options
2188 dnl ===================================================================
2190 AC_ARG_WITH(macosx-sdk,
2191     AS_HELP_STRING([--with-macosx-sdk=<version>],
2192         [Prefer a specific SDK for building.])
2193     [
2194                           If the requested SDK is not available, a search for the oldest one will be done.
2195                           With current Xcode versions, only the latest SDK is included, so this option is
2196                           not terribly useful. It works fine to build with a new SDK and run the result
2197                           on an older OS.
2199                           e. g.: --with-macosx-sdk=10.9
2201                           there are 3 options to control the MacOSX build:
2202                           --with-macosx-sdk (referred as 'sdk' below)
2203                           --with-macosx-version-min-required (referred as 'min' below)
2204                           --with-macosx-version-max-allowed (referred as 'max' below)
2206                           the connection between these value and the default they take is as follow:
2207                           ( ? means not specified on the command line, s means the SDK version found,
2208                           constraint: 8 <= x <= y <= z)
2210                           ==========================================
2211                            command line      || config result
2212                           ==========================================
2213                           min  | max  | sdk  || min  | max  | sdk  |
2214                           ?    | ?    | ?    || 10.9 | 10.s | 10.s |
2215                           ?    | ?    | 10.x || 10.9 | 10.x | 10.x |
2216                           ?    | 10.x | ?    || 10.9 | 10.s | 10.s |
2217                           ?    | 10.x | 10.y || 10.9 | 10.x | 10.y |
2218                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2219                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2220                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2221                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2224                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2225                           for a detailed technical explanation of these variables
2227                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2228     ],
2231 AC_ARG_WITH(macosx-version-min-required,
2232     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2233         [set the minimum OS version needed to run the built LibreOffice])
2234     [
2235                           e. g.: --with-macos-version-min-required=10.9
2236                           see --with-macosx-sdk for more info
2237     ],
2240 AC_ARG_WITH(macosx-version-max-allowed,
2241     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2242         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2243     [
2244                           e. g.: --with-macos-version-max-allowed=10.9
2245                           see --with-macosx-sdk for more info
2246     ],
2250 dnl ===================================================================
2251 dnl options for stuff used during cross-compilation build
2252 dnl Not quite superseded by --with-build-platform-configure-options.
2253 dnl TODO: check, if the "force" option is still needed anywhere.
2254 dnl ===================================================================
2256 AC_ARG_WITH(system-icu-for-build,
2257     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2258         [Use icu already on system for build tools (cross-compilation only).]))
2261 dnl ===================================================================
2262 dnl Check for incompatible options set by fuzzing, and reset those
2263 dnl automatically to working combinations
2264 dnl ===================================================================
2266 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2267         "$enable_dbus" != "$enable_avahi"; then
2268     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2269     enable_avahi=$enable_dbus
2272 dnl ===================================================================
2273 dnl check for required programs (grep, awk, sed, bash)
2274 dnl ===================================================================
2276 pathmunge ()
2278     if test -n "$1"; then
2279         if test "$build_os" = "cygwin"; then
2280             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2281                 PathFormat "$1"
2282                 new_path=`cygpath -sm "$formatted_path"`
2283             else
2284                 PathFormat "$1"
2285                 new_path=`cygpath -u "$formatted_path"`
2286             fi
2287         else
2288             new_path="$1"
2289         fi
2290         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2291             if test "$2" = "after"; then
2292                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2293             else
2294                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2295             fi
2296         fi
2297         unset new_path
2298     fi
2301 AC_PROG_AWK
2302 AC_PATH_PROG( AWK, $AWK)
2303 if test -z "$AWK"; then
2304     AC_MSG_ERROR([install awk to run this script])
2307 AC_PATH_PROG(BASH, bash)
2308 if test -z "$BASH"; then
2309     AC_MSG_ERROR([bash not found in \$PATH])
2311 AC_SUBST(BASH)
2313 AC_MSG_CHECKING([for GNU or BSD tar])
2314 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2315     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2316     if test $? -eq 0;  then
2317         GNUTAR=$a
2318         break
2319     fi
2320 done
2321 AC_MSG_RESULT($GNUTAR)
2322 if test -z "$GNUTAR"; then
2323     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2325 AC_SUBST(GNUTAR)
2327 AC_MSG_CHECKING([for tar's option to strip components])
2328 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2329 if test $? -eq 0; then
2330     STRIP_COMPONENTS="--strip-components"
2331 else
2332     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2333     if test $? -eq 0; then
2334         STRIP_COMPONENTS="--strip-path"
2335     else
2336         STRIP_COMPONENTS="unsupported"
2337     fi
2339 AC_MSG_RESULT($STRIP_COMPONENTS)
2340 if test x$STRIP_COMPONENTS = xunsupported; then
2341     AC_MSG_ERROR([you need a tar that is able to strip components.])
2343 AC_SUBST(STRIP_COMPONENTS)
2345 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2346 dnl desktop OSes from "mobile" ones.
2348 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2349 dnl In other words, that when building for an OS that is not a
2350 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2352 dnl Note the direction of the implication; there is no assumption that
2353 dnl cross-compiling would imply a non-desktop OS.
2355 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2356     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2357     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2358     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2361 # Whether to build "avmedia" functionality or not.
2363 if test -z "$enable_avmedia"; then
2364     enable_avmedia=yes
2367 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2368 if test "$enable_avmedia" = yes; then
2369     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2370 else
2371     USE_AVMEDIA_DUMMY='TRUE'
2373 AC_SUBST(USE_AVMEDIA_DUMMY)
2375 # Decide whether to build database connectivity stuff (including
2376 # Base) or not. We probably don't want to on non-desktop OSes.
2377 if test -z "$enable_database_connectivity"; then
2378     # --disable-database-connectivity is unfinished work in progress
2379     # and the iOS test app doesn't link if we actually try to use it.
2380     # if test $_os != iOS -a $_os != Android; then
2381     if test $_os != iOS; then
2382         enable_database_connectivity=yes
2383     fi
2386 if test "$enable_database_connectivity" = yes; then
2387     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2388     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2391 if test -z "$enable_extensions"; then
2392     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2393     if test $_os != iOS -a $_os != Android; then
2394         enable_extensions=yes
2395     fi
2398 if test "$enable_extensions" = yes; then
2399     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2400     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2403 if test -z "$enable_scripting"; then
2404     # Disable scripting for iOS unless specifically overridden
2405     # with --enable-scripting.
2406     if test $_os != iOS; then
2407         enable_scripting=yes
2408     fi
2411 DISABLE_SCRIPTING=''
2412 if test "$enable_scripting" = yes; then
2413     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2414     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2415 else
2416     DISABLE_SCRIPTING='TRUE'
2417     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2420 if test $_os = iOS -o $_os = Android; then
2421     # Disable dynamic_loading always for iOS and Android
2422     enable_dynamic_loading=no
2423 elif test -z "$enable_dynamic_loading"; then
2424     # Otherwise enable it unless speficically disabled
2425     enable_dynamic_loading=yes
2428 DISABLE_DYNLOADING=''
2429 if test "$enable_dynamic_loading" = yes; then
2430     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2431 else
2432     DISABLE_DYNLOADING='TRUE'
2434 AC_SUBST(DISABLE_DYNLOADING)
2436 # remenber SYSBASE value
2437 AC_SUBST(SYSBASE)
2439 dnl ===================================================================
2440 dnl  Sort out various gallery compilation options
2441 dnl ===================================================================
2442 AC_MSG_CHECKING([how to build and package galleries])
2443 if test -n "${with_galleries}"; then
2444     if test "$with_galleries" = "build"; then
2445         WITH_GALLERY_BUILD=TRUE
2446         AC_MSG_RESULT([build from source images internally])
2447     elif test "$with_galleries" = "no"; then
2448         WITH_GALLERY_BUILD=
2449         AC_MSG_RESULT([disable non-internal gallery build])
2450     else
2451         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2452     fi
2453 else
2454     if test $_os != iOS -a $_os != Android; then
2455         WITH_GALLERY_BUILD=TRUE
2456         AC_MSG_RESULT([internal src images for desktop])
2457     else
2458         WITH_GALLERY_BUILD=
2459         AC_MSG_RESULT([disable src image build])
2460     fi
2462 AC_SUBST(WITH_GALLERY_BUILD)
2464 dnl ===================================================================
2465 dnl  Checks if ccache is available
2466 dnl ===================================================================
2467 if test "$_os" = "WINNT"; then
2468     # on windows/VC build do not use ccache
2469     CCACHE=""
2470 elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2471     case "%$CC%$CXX%" in
2472     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2473     # assume that's good then
2474     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2475         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2476         ;;
2477     *)
2478         AC_PATH_PROG([CCACHE],[ccache],[not found])
2479         if test "$CCACHE" = "not found"; then
2480             CCACHE=""
2481         else
2482             # Need to check for ccache version: otherwise prevents
2483             # caching of the results (like "-x objective-c++" for Mac)
2484             if test $_os = Darwin -o $_os = iOS; then
2485                 # Check ccache version
2486                 AC_MSG_CHECKING([whether version of ccache is suitable])
2487                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2488                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2489                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2490                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2491                 else
2492                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2493                     CCACHE=""
2494                 fi
2495             fi
2496         fi
2497         ;;
2498     esac
2499 else
2500     CCACHE=""
2503 if test "$CCACHE" != ""; then
2504     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2505     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2506     if test "$ccache_size" = ""; then
2507         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2508         if test "$ccache_size" = ""; then
2509             ccache_size=0
2510         fi
2511         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2512         if test $ccache_size -lt 1024; then
2513             CCACHE=""
2514             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2515             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2516         else
2517             # warn that ccache may be too small for debug build
2518             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2519             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2520         fi
2521     else
2522         if test $ccache_size -lt 5; then
2523             #warn that ccache may be too small for debug build
2524             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2525             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2526         fi
2527     fi
2530 dnl ===================================================================
2531 dnl  Checks for C compiler,
2532 dnl  The check for the C++ compiler is later on.
2533 dnl ===================================================================
2534 if test "$_os" != "WINNT"; then
2535     GCC_HOME_SET="true"
2536     AC_MSG_CHECKING([gcc home])
2537     if test -z "$with_gcc_home"; then
2538         if test "$enable_icecream" = "yes"; then
2539             if test -d "/usr/lib/icecc/bin"; then
2540                 GCC_HOME="/usr/lib/icecc/"
2541             else
2542                 GCC_HOME="/opt/icecream/"
2543             fi
2544         else
2545             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2546             GCC_HOME_SET="false"
2547         fi
2548     else
2549         GCC_HOME="$with_gcc_home"
2550     fi
2551     AC_MSG_RESULT($GCC_HOME)
2552     AC_SUBST(GCC_HOME)
2554     if test "$GCC_HOME_SET" = "true"; then
2555         if test -z "$CC"; then
2556             CC="$GCC_HOME/bin/gcc"
2557         fi
2558         if test -z "$CXX"; then
2559             CXX="$GCC_HOME/bin/g++"
2560         fi
2561     fi
2564 COMPATH=`dirname "$CC"`
2565 if test "$COMPATH" = "."; then
2566     AC_PATH_PROGS(COMPATH, $CC)
2567     dnl double square bracket to get single because of M4 quote...
2568     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2570 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2572 dnl ===================================================================
2573 dnl Java support
2574 dnl ===================================================================
2575 AC_MSG_CHECKING([whether to build with Java support])
2576 if test "$with_java" != "no"; then
2577     if test "$DISABLE_SCRIPTING" = TRUE; then
2578         AC_MSG_RESULT([no, overridden by --disable-scripting])
2579         ENABLE_JAVA=""
2580         with_java=no
2581     else
2582         AC_MSG_RESULT([yes])
2583         ENABLE_JAVA="TRUE"
2584         AC_DEFINE(HAVE_FEATURE_JAVA)
2585     fi
2586 else
2587     AC_MSG_RESULT([no])
2588     ENABLE_JAVA=""
2591 AC_SUBST(ENABLE_JAVA)
2593 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2595 dnl ENABLE_JAVA="" indicate no Java support at all
2597 dnl ===================================================================
2598 dnl Check OS X SDK and compiler
2599 dnl ===================================================================
2601 if test $_os = Darwin -o $_os = iOS; then
2603     # If no --with-macosx-sdk option is given, look for one
2605     # The intent is that for "most" Mac-based developers, a suitable
2606     # SDK will be found automatically without any configure options.
2608     # For developers with a current Xcode, the lowest-numbered SDK
2609     # higher than or equal to the minimum required should be found.
2611     AC_MSG_CHECKING([what Mac OS X SDK to use])
2612     for _macosx_sdk in $with_macosx_sdk 10.13 10.12; do
2613         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2614         if test -d "$MACOSX_SDK_PATH"; then
2615             with_macosx_sdk="${_macosx_sdk}"
2616             break
2617         else
2618             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2619             if test -d "$MACOSX_SDK_PATH"; then
2620                 with_macosx_sdk="${_macosx_sdk}"
2621                 break
2622             fi
2623         fi
2624     done
2625     if test ! -d "$MACOSX_SDK_PATH"; then
2626         AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2627     fi
2629     if test $_os = iOS; then
2630         if test "$enable_ios_simulator" = "yes"; then
2631             useos=iphonesimulator
2632         else
2633             useos=iphoneos
2634         fi
2635         MACOSX_SDK_PATH=`xcrun --sdk ${useos} --show-sdk-path 2> /dev/null`
2636     fi
2637     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2640     case $with_macosx_sdk in
2641     10.9)
2642         MACOSX_SDK_VERSION=1090
2643         ;;
2644     10.10)
2645         MACOSX_SDK_VERSION=101000
2646         ;;
2647     10.11)
2648         MACOSX_SDK_VERSION=101100
2649         ;;
2650     10.12)
2651         MACOSX_SDK_VERSION=101200
2652         ;;
2653     10.13)
2654         MACOSX_SDK_VERSION=101300
2655         ;;
2656     *)
2657         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.9--13])
2658         ;;
2659     esac
2661     if test "$with_macosx_version_min_required" = "" ; then
2662         with_macosx_version_min_required="10.9";
2663     fi
2665     if test "$with_macosx_version_max_allowed" = "" ; then
2666         with_macosx_version_max_allowed="$with_macosx_sdk"
2667     fi
2669     # export this so that "xcrun" invocations later return matching values
2670     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2671     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2672     export DEVELOPER_DIR
2673     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2674     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2676     case "$with_macosx_version_min_required" in
2677     10.9)
2678         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2679         ;;
2680     10.10)
2681         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2682         ;;
2683     10.11)
2684         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2685         ;;
2686     10.12)
2687         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2688         ;;
2689     10.13)
2690         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2691         ;;
2692     *)
2693         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.9--13])
2694         ;;
2695     esac
2696     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2698     LIBTOOL=/usr/bin/libtool
2699     INSTALL_NAME_TOOL=install_name_tool
2700     if test -z "$save_CC"; then
2701         AC_MSG_CHECKING([what compiler to use])
2702         stdlib=-stdlib=libc++
2703         if test "$ENABLE_LTO" = TRUE; then
2704             lto=-flto
2705         fi
2706         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2707         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2708         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2709         AR=`xcrun -find ar`
2710         NM=`xcrun -find nm`
2711         STRIP=`xcrun -find strip`
2712         LIBTOOL=`xcrun -find libtool`
2713         RANLIB=`xcrun -find ranlib`
2714         AC_MSG_RESULT([$CC and $CXX])
2715     fi
2717     case "$with_macosx_version_max_allowed" in
2718     10.9)
2719         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2720         ;;
2721     10.10)
2722         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2723         ;;
2724     10.11)
2725         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2726         ;;
2727     10.12)
2728         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2729         ;;
2730     10.13)
2731         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2732         ;;
2733     *)
2734         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.9--13])
2735         ;;
2736     esac
2738     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2739     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2740         AC_MSG_RESULT([$MAC_OS_X_VERSION_MIN_REQUIRED])
2741         AC_MSG_RESULT([$MAC_OS_X_VERSION_MAX_REQUIRED])
2742         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2743     else
2744         AC_MSG_RESULT([ok])
2745     fi
2747     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2748     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2749         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2750     else
2751         AC_MSG_RESULT([ok])
2752     fi
2753     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2754     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2756     AC_MSG_CHECKING([whether to do code signing])
2758     if test "$enable_macosx_code_signing" = yes; then
2759         # By default use the first suitable certificate (?).
2761         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2762         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2763         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2764         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2765         # "Developer ID Application" one.
2767         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2768         if test -n "$identity"; then
2769             MACOSX_CODESIGNING_IDENTITY=$identity
2770             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2771             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2772         else
2773             AC_MSG_ERROR([cannot determine identity to use])
2774         fi
2775     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2776         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2777         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2778         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2779     else
2780         AC_MSG_RESULT([no])
2781     fi
2783     AC_MSG_CHECKING([whether to create a Mac App Store package])
2785     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2786         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2787     elif test "$enable_macosx_package_signing" = yes; then
2788         # By default use the first suitable certificate.
2789         # It should be a "3rd Party Mac Developer Installer" one
2791         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2792         if test -n "$identity"; then
2793             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2794             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2795             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2796         else
2797             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2798         fi
2799     elif test -n "$enable_macosx_package_signing"; then
2800         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2801         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2802         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2803     else
2804         AC_MSG_RESULT([no])
2805     fi
2807     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2808         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2809     fi
2811     AC_MSG_CHECKING([whether to sandbox the application])
2813     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2814         AC_MSG_ERROR([OS X sandboxing requires code signing])
2815     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2816         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2817     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2818         ENABLE_MACOSX_SANDBOX=TRUE
2819         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2820         AC_MSG_RESULT([yes])
2821     else
2822         AC_MSG_RESULT([no])
2823     fi
2825     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2826     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2827     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2829 AC_SUBST(MACOSX_SDK_PATH)
2830 AC_SUBST(MACOSX_SDK_VERSION)
2831 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2832 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2833 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
2834 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2835 AC_SUBST(INSTALL_NAME_TOOL)
2836 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2837 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2838 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2839 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2840 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2842 dnl ===================================================================
2843 dnl Check iOS SDK and compiler
2844 dnl ===================================================================
2846 if test $_os = iOS; then
2847     AC_MSG_CHECKING([what iOS SDK to use])
2848     current_sdk_ver=11.1
2849     if test "$enable_ios_simulator" = "yes"; then
2850         platform=iPhoneSimulator
2851         versionmin=-mios-simulator-version-min=$current_sdk_ver
2852     else
2853         platform=iPhoneOS
2854         versionmin=-miphoneos-version-min=$current_sdk_ver
2855     fi
2856     xcode_developer=`xcode-select -print-path`
2858     for sdkver in $current_sdk_ver; do
2859         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2860         if test -d $t; then
2861             ios_sdk=$sdkver
2862             sysroot=$t
2863             break
2864         fi
2865     done
2867     if test -z "$sysroot"; then
2868         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
2869     fi
2871     AC_MSG_RESULT($sysroot)
2873     IOS_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
2874     IOS_DEPLOYMENT_VERSION=$current_sdk_ver
2876     # LTO is not really recommended for iOS builds,
2877     # the link time will be astronomical
2878     if test "$ENABLE_LTO" = TRUE; then
2879         lto=-flto
2880     fi
2882     stdlib="-stdlib=libc++"
2884     CC="`xcrun -find clang` -arch $host_cpu -isysroot $sysroot $lto $versionmin"
2885     CXX="`xcrun -find clang++` -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
2887     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2888     AR=`xcrun -find ar`
2889     NM=`xcrun -find nm`
2890     STRIP=`xcrun -find strip`
2891     LIBTOOL=`xcrun -find libtool`
2892     RANLIB=`xcrun -find ranlib`
2895 AC_SUBST(IOS_SDK)
2896 AC_SUBST(IOS_DEPLOYMENT_VERSION)
2898 AC_MSG_CHECKING([whether to treat the installation as read-only])
2900 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
2901         "$enable_extensions" != yes; then
2902     enable_readonly_installset=yes
2904 if test "$enable_readonly_installset" = yes; then
2905     AC_MSG_RESULT([yes])
2906     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
2907 else
2908     AC_MSG_RESULT([no])
2911 dnl ===================================================================
2912 dnl Structure of install set
2913 dnl ===================================================================
2915 if test $_os = Darwin; then
2916     LIBO_BIN_FOLDER=MacOS
2917     LIBO_ETC_FOLDER=Resources
2918     LIBO_LIBEXEC_FOLDER=MacOS
2919     LIBO_LIB_FOLDER=Frameworks
2920     LIBO_LIB_PYUNO_FOLDER=Resources
2921     LIBO_SHARE_FOLDER=Resources
2922     LIBO_SHARE_HELP_FOLDER=Resources/help
2923     LIBO_SHARE_JAVA_FOLDER=Resources/java
2924     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
2925     LIBO_SHARE_READMES_FOLDER=Resources/readmes
2926     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
2927     LIBO_SHARE_SHELL_FOLDER=Resources/shell
2928     LIBO_URE_BIN_FOLDER=MacOS
2929     LIBO_URE_ETC_FOLDER=Resources/ure/etc
2930     LIBO_URE_LIB_FOLDER=Frameworks
2931     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
2932     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
2933 elif test $_os = WINNT; then
2934     LIBO_BIN_FOLDER=program
2935     LIBO_ETC_FOLDER=program
2936     LIBO_LIBEXEC_FOLDER=program
2937     LIBO_LIB_FOLDER=program
2938     LIBO_LIB_PYUNO_FOLDER=program
2939     LIBO_SHARE_FOLDER=share
2940     LIBO_SHARE_HELP_FOLDER=help
2941     LIBO_SHARE_JAVA_FOLDER=program/classes
2942     LIBO_SHARE_PRESETS_FOLDER=presets
2943     LIBO_SHARE_READMES_FOLDER=readmes
2944     LIBO_SHARE_RESOURCE_FOLDER=program/resource
2945     LIBO_SHARE_SHELL_FOLDER=program/shell
2946     LIBO_URE_BIN_FOLDER=program
2947     LIBO_URE_ETC_FOLDER=program
2948     LIBO_URE_LIB_FOLDER=program
2949     LIBO_URE_MISC_FOLDER=program
2950     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
2951 else
2952     LIBO_BIN_FOLDER=program
2953     LIBO_ETC_FOLDER=program
2954     LIBO_LIBEXEC_FOLDER=program
2955     LIBO_LIB_FOLDER=program
2956     LIBO_LIB_PYUNO_FOLDER=program
2957     LIBO_SHARE_FOLDER=share
2958     LIBO_SHARE_HELP_FOLDER=help
2959     LIBO_SHARE_JAVA_FOLDER=program/classes
2960     LIBO_SHARE_PRESETS_FOLDER=presets
2961     LIBO_SHARE_READMES_FOLDER=readmes
2962     if test "$enable_fuzzers" != yes; then
2963         LIBO_SHARE_RESOURCE_FOLDER=program/resource
2964     else
2965         LIBO_SHARE_RESOURCE_FOLDER=resource
2966     fi
2967     LIBO_SHARE_SHELL_FOLDER=program/shell
2968     LIBO_URE_BIN_FOLDER=program
2969     LIBO_URE_ETC_FOLDER=program
2970     LIBO_URE_LIB_FOLDER=program
2971     LIBO_URE_MISC_FOLDER=program
2972     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
2974 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
2975 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
2976 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
2977 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
2978 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
2979 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
2980 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
2981 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
2982 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
2983 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
2984 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
2985 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
2986 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
2987 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
2988 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
2989 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
2991 # Not all of them needed in config_host.mk, add more if need arises
2992 AC_SUBST(LIBO_BIN_FOLDER)
2993 AC_SUBST(LIBO_ETC_FOLDER)
2994 AC_SUBST(LIBO_LIB_FOLDER)
2995 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
2996 AC_SUBST(LIBO_SHARE_FOLDER)
2997 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
2998 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
2999 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3000 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3001 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3002 AC_SUBST(LIBO_URE_BIN_FOLDER)
3003 AC_SUBST(LIBO_URE_ETC_FOLDER)
3004 AC_SUBST(LIBO_URE_LIB_FOLDER)
3005 AC_SUBST(LIBO_URE_MISC_FOLDER)
3006 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3008 dnl ===================================================================
3009 dnl Windows specific tests and stuff
3010 dnl ===================================================================
3012 reg_get_value()
3014     # Return value: $regvalue
3015     unset regvalue
3017     local _regentry="/proc/registry${1}/${2}"
3018     if test -f "$_regentry"; then
3019         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3020         # Registry keys read via /proc/registry* are always \0 terminated!
3021         local _regvalue=$(tr -d '\0' < "$_regentry")
3022         if test $? -eq 0; then
3023             regvalue=$_regvalue
3024         fi
3025     fi
3028 # Get a value from the 32-bit side of the Registry
3029 reg_get_value_32()
3031     reg_get_value "32" "$1"
3034 # Get a value from the 64-bit side of the Registry
3035 reg_get_value_64()
3037     reg_get_value "64" "$1"
3040 if test "$_os" = "WINNT"; then
3041     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3042     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3043         AC_MSG_RESULT([no])
3044         WINDOWS_SDK_ARCH="x86"
3045     else
3046         AC_MSG_RESULT([yes])
3047         WINDOWS_SDK_ARCH="x64"
3048         BITNESS_OVERRIDE=64
3049     fi
3051 if test "$_os" = "iOS"; then
3052     cross_compiling="yes"
3055 if test "$cross_compiling" = "yes"; then
3056     export CROSS_COMPILING=TRUE
3057 else
3058     CROSS_COMPILING=
3059     BUILD_TYPE="$BUILD_TYPE NATIVE"
3061 AC_SUBST(CROSS_COMPILING)
3063 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3064 if test "$GCC" = "yes"; then
3065     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
3066     bsymbolic_functions_ldflags_save=$LDFLAGS
3067     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3068     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3069 #include <stdio.h>
3070         ],[
3071 printf ("hello world\n");
3072         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3073     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3074         AC_MSG_RESULT( found )
3075     else
3076         AC_MSG_RESULT( not found )
3077     fi
3078     LDFLAGS=$bsymbolic_functions_ldflags_save
3080 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3082 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3083 # NOTE: must _not_ be used for bundled external libraries!
3084 ISYSTEM=
3085 if test "$GCC" = "yes"; then
3086     AC_MSG_CHECKING( for -isystem )
3087     save_CFLAGS=$CFLAGS
3088     CFLAGS="$CFLAGS -Werror"
3089     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3090     CFLAGS=$save_CFLAGS
3091     if test -n "$ISYSTEM"; then
3092         AC_MSG_RESULT(yes)
3093     else
3094         AC_MSG_RESULT(no)
3095     fi
3097 if test -z "$ISYSTEM"; then
3098     # fall back to using -I
3099     ISYSTEM=-I
3101 AC_SUBST(ISYSTEM)
3103 dnl ===================================================================
3104 dnl  Check which Visual Studio compiler is used
3105 dnl ===================================================================
3107 map_vs_year_to_version()
3109     # Return value: $vsversion
3111     unset vsversion
3113     case $1 in
3114     2015)
3115         vsversion=14.0;;
3116     2017)
3117         vsversion=15.0;;
3118     *)
3119         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3120     esac
3123 vs_versions_to_check()
3125     # Args: $1 (optional) : versions to check, in the order of preference
3126     # Return value: $vsversions
3128     unset vsversions
3130     if test -n "$1"; then
3131         map_vs_year_to_version "$1"
3132         vsversions=$vsversion
3133     else
3134         # By default we prefer 2015/2017, in this order
3135         vsversions="14.0 15.0"
3136     fi
3139 win_get_env_from_vsvars32bat()
3141     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3142     if test $vcnum = "150"; then
3143       # Also seems to be located in another directory under the same name: vsvars32.bat
3144       # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3145       printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3146     else
3147       printf '@call "%s/../Common7/Tools/vsvars32.bat"\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3148     fi
3149     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3150     chmod +x $WRAPPERBATCHFILEPATH
3151     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3152     rm -f $WRAPPERBATCHFILEPATH
3153     printf '%s' "$_win_get_env_from_vsvars32bat"
3156 find_ucrt()
3158     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3159     if test -n "$regvalue"; then
3160         PathFormat "$regvalue"
3161         UCRTSDKDIR=$formatted_path
3162         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3163         UCRTVERSION=$regvalue
3164         # Rest if not exist
3165         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3166           UCRTSDKDIR=
3167         fi
3168     fi
3169     if test -z "$UCRTSDKDIR"; then
3170         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3171         if test "$vcnum" = "150"; then
3172           ide_env_file="${ide_env_dir}VsDevCmd.bat"
3173         else
3174           ide_env_file="${ide_env_dir}/vsvars32.bat"
3175         fi
3176         if test -f "$ide_env_file"; then
3177             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3178             UCRTSDKDIR=$formatted_path
3179             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3180             dnl Hack needed at least by tml:
3181             if test "$UCRTVERSION" = 10.0.15063.0 \
3182                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3183                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3184             then
3185                 UCRTVERSION=10.0.14393.0
3186             fi
3187         else
3188           AC_MSG_ERROR([No UCRT found])
3189         fi
3190     fi
3193 find_msvc()
3195     # Find Visual C++ 2015/2017
3196     # Args: $1 (optional) : The VS version year
3197     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3199     unset vctest vcnum vcnumwithdot vcbuildnumber
3201     vs_versions_to_check "$1"
3203     for ver in $vsversions; do
3204         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3205         if test -n "$regvalue"; then
3206             vctest=$regvalue
3207             break
3208         fi
3209         # As always MSVC 15.0 is special here
3210         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver
3211         if test -n "$regvalue"; then
3212             AC_MSG_RESULT([found: $regvalue])
3213             PathFormat "$regvalue"
3214             vctest=$formatted_path
3215             break
3216         fi
3217     done
3218     if test -n "$vctest"; then
3219         vcnumwithdot=$ver
3220         case "$vcnumwithdot" in
3221         14.0)
3222             vcyear=2015
3223             vcnum=140
3224             ;;
3225         15.0)
3226             vcyear=2017
3227             vcnum=150
3228             vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3229             ;;
3230         esac
3231     fi
3234 SOLARINC=
3235 MSBUILD_PATH=
3236 DEVENV=
3237 if test "$_os" = "WINNT"; then
3238     AC_MSG_CHECKING([Visual C++])
3240     find_msvc "$with_visual_studio"
3241     if test -z "$vctest"; then
3242         if test -n "$with_visual_studio"; then
3243             AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3244         else
3245             AC_MSG_ERROR([No Visual Studio 2015/2017 installation found])
3246         fi
3247     fi
3249     if test "$BITNESS_OVERRIDE" = ""; then
3250         if test -f "$vctest/bin/cl.exe"; then
3251             VC_PRODUCT_DIR=$vctest
3252         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3253             VC_PRODUCT_DIR=$vctest/VC
3254         else
3255             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3256         fi
3257     else
3258         if test -f "$vctest/bin/amd64/cl.exe"; then
3259             VC_PRODUCT_DIR=$vctest
3260         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3261             VC_PRODUCT_DIR=$vctest/VC
3262         else
3263             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])
3264         fi
3265     fi
3267     AC_MSG_CHECKING([for short pathname of VC product directory])
3268     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3269     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3271     UCRTSDKDIR=
3272     UCRTVERSION=
3274     AC_MSG_CHECKING([for UCRT location])
3275     find_ucrt
3276     # find_ucrt errors out if it doesn't find it
3277     AC_MSG_RESULT([found])
3278     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3279     ucrtincpath_formatted=$formatted_path
3280     # SOLARINC is used for external modules and must be set too.
3281     # And no, it's not sufficient to set SOLARINC only, as configure
3282     # itself doesn't honour it.
3283     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3284     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3285     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3286     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3288     AC_SUBST(UCRTSDKDIR)
3289     AC_SUBST(UCRTVERSION)
3291     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3292     # Find the proper version of MSBuild.exe to use based on the VS version
3293     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3294     if test -n "$regvalue" ; then
3295         AC_MSG_RESULT([found: $regvalue])
3296         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3297     else
3298         if test $vcnum = "150"; then
3299             if test "$BITNESS_OVERRIDE" = ""; then
3300                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3301             else
3302                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3303             fi
3304             MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3305         else
3306             AC_MSG_ERROR([No msbuild found, Visual Studio installation broken?])
3307         fi
3308         AC_MSG_RESULT([$regvalue])
3309     fi
3311     # Find the version of devenv.exe
3312     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3313     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3314     if test ! -e "$DEVENV"; then
3315         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3316     fi
3318     dnl ===========================================================
3319     dnl  Check for the corresponding mspdb*.dll
3320     dnl ===========================================================
3322     MSPDB_PATH=
3323     CL_DIR=
3324     CL_LIB=
3326     if test "$BITNESS_OVERRIDE" = ""; then
3327         if test "$vcnum" = "150"; then
3328             MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86"
3329             CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX86/x86
3330         else
3331             MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3332             CL_DIR=bin
3333         fi
3334     else
3335         if test "$vcnum" = "150"; then
3336             MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64"
3337             CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX64/x64
3338         else
3339             MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3340             CL_DIR=bin/amd64
3341         fi
3342     fi
3344     # MSVC 15.0 has libraries from 14.0?
3345     if test  "$vcnum" = "150"; then
3346         mspdbnum="140"
3347     else
3348         mspdbnum=$vcnum
3349     fi
3351     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3352         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3353     fi
3355     MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3356     MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3358     dnl The path needs to be added before cl is called
3359     PATH="$MSPDB_PATH:$PATH"
3361     AC_MSG_CHECKING([cl.exe])
3363     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3364     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3365     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3366     # is not enough?
3368     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3369     dnl needed when building CLR code:
3370     if test -z "$MSVC_CXX"; then
3371         if test "$BITNESS_OVERRIDE" = ""; then
3372             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3373                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3374             fi
3375         else
3376             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3377                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3378             fi
3379         fi
3381         # This gives us a posix path with 8.3 filename restrictions
3382         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3383     fi
3385     if test -z "$CC"; then
3386         CC=$MSVC_CXX
3387     fi
3388     if test "$BITNESS_OVERRIDE" = ""; then
3389         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3390         MSVC_CXX="$MSVC_CXX -arch:SSE"
3391     fi
3393     if test -n "$CC"; then
3394         # Remove /cl.exe from CC case insensitive
3395         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3396         if test "$BITNESS_OVERRIDE" = ""; then
3397            if test "$vcnum" = "150"; then
3398                COMPATH="$VC_PRODUCT_DIR"
3399            else
3400                COMPATH=`echo "$CC" | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3401            fi
3402         else
3403             if test -n "$VC_PRODUCT_DIR"; then
3404                 COMPATH=$VC_PRODUCT_DIR
3405             fi
3406         fi
3407         if test "$BITNESS_OVERRIDE" = ""; then
3408             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3409             CC="$CC -arch:SSE"
3410         fi
3412         if test "$vcnum" = "150"; then
3413             COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3414         fi
3416         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3418         PathFormat "$COMPATH"
3419         COMPATH="$formatted_path"
3421         VCVER=$vcnum
3422         MSVSVER=$vcyear
3424         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3425         # are always "better", we list them in reverse chronological order.
3427         case $vcnum in
3428         140)
3429             COMEX=19
3430             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3431             ;;
3432         150)
3433             COMEX=19
3434             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3435             ;;
3436         esac
3438         # The expectation is that --with-windows-sdk should not need to be used
3439         if test -n "$with_windows_sdk"; then
3440             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3441             *" "$with_windows_sdk" "*)
3442                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3443                 ;;
3444             *)
3445                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3446                 ;;
3447             esac
3448         fi
3450         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3451         ac_objext=obj
3452         ac_exeext=exe
3454     else
3455         AC_MSG_ERROR([Visual C++ not found after all, huh])
3456     fi
3458     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3459     # version of the Explorer extension (and maybe other small
3460     # bits, too) needed when installing a 32-bit LibreOffice on a
3461     # 64-bit OS. The 64-bit Explorer extension is a feature that
3462     # has been present since long in OOo. Don't confuse it with
3463     # building LibreOffice itself as 64-bit code.
3465     BUILD_X64=
3466     CXX_X64_BINARY=
3467     LINK_X64_BINARY=
3469     if test "$BITNESS_OVERRIDE" = ""; then
3470         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3471         if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3472             # Prefer native x64 compiler to cross-compiler, in case we are running
3473             # the build on a 64-bit OS.
3474             if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3475                 BUILD_X64=TRUE
3476                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3477                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3478             elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3479                 BUILD_X64=TRUE
3480                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3481                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3482             fi
3483         elif test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib"; then
3484             # nobody uses 32-bit OS to build, just pick the 64-bit compiler
3485             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3486                 BUILD_X64=TRUE
3487                 CXX_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"
3488                 LINK_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/link.exe"
3489             fi
3490         fi
3491         if test "$BUILD_X64" = TRUE; then
3492             AC_MSG_RESULT([found])
3493         else
3494             AC_MSG_RESULT([not found])
3495             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3496         fi
3497     fi
3498     AC_SUBST(BUILD_X64)
3500     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3501     AC_SUBST(CXX_X64_BINARY)
3502     AC_SUBST(LINK_X64_BINARY)
3504 AC_SUBST(VCVER)
3505 AC_SUBST(DEVENV)
3506 PathFormat "$MSPDB_PATH"
3507 MSPDB_PATH="$formatted_path"
3508 AC_SUBST(MSVC_CXX)
3511 # unowinreg.dll
3513 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3514 AC_SUBST(UNOWINREG_DLL)
3516 COM_IS_CLANG=
3517 AC_MSG_CHECKING([whether the compiler is actually Clang])
3518 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3519     #ifndef __clang__
3520     you lose
3521     #endif
3522     int foo=42;
3523     ]])],
3524     [AC_MSG_RESULT([yes])
3525      COM_IS_CLANG=TRUE],
3526     [AC_MSG_RESULT([no])])
3528 CC_PLAIN=$CC
3529 if test "$COM_IS_CLANG" = TRUE; then
3530     AC_MSG_CHECKING([the Clang version])
3531     if test "$_os" = WINNT; then
3532         dnl In which case, assume clang-cl:
3533         my_args="/EP /TC"
3534         dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3535         dnl clang-cl:
3536         CC_PLAIN=
3537         for i in $CC; do
3538             case $i in
3539             -FIIntrin.h)
3540                 ;;
3541             *)
3542                 CC_PLAIN="$CC_PLAIN $i"
3543                 ;;
3544             esac
3545         done
3546     else
3547         my_args="-E -P"
3548     fi
3549     clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args -`
3550     CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3551     CLANGVER=`echo $clang_version \
3552         | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3553     AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3554     AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3555     AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3557 AC_SUBST(COM_IS_CLANG)
3559 SHOWINCLUDES_PREFIX=
3560 if test "$_os" = WINNT; then
3561     dnl We need to guess the prefix of the -showIncludes output, it can be
3562     dnl localized
3563     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3564     echo "#include <stdlib.h>" > conftest.c
3565     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3566         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3567     rm -f conftest.c conftest.obj
3568     if test -z "$SHOWINCLUDES_PREFIX"; then
3569         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3570     else
3571         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3572     fi
3574 AC_SUBST(SHOWINCLUDES_PREFIX)
3577 # prefix C with ccache if needed
3579 if test "$CCACHE" != ""; then
3580     AC_MSG_CHECKING([whether $CC is already ccached])
3582     AC_LANG_PUSH([C])
3583     save_CFLAGS=$CFLAGS
3584     CFLAGS="$CFLAGS --ccache-skip -O2"
3585     dnl an empty program will do, we're checking the compiler flags
3586     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3587                       [use_ccache=yes], [use_ccache=no])
3588     if test $use_ccache = yes; then
3589         AC_MSG_RESULT([yes])
3590     else
3591         CC="$CCACHE $CC"
3592         AC_MSG_RESULT([no])
3593     fi
3594     CFLAGS=$save_CFLAGS
3595     AC_LANG_POP([C])
3598 # ===================================================================
3599 # check various GCC options that Clang does not support now but maybe
3600 # will somewhen in the future, check them even for GCC, so that the
3601 # flags are set
3602 # ===================================================================
3604 HAVE_GCC_GGDB2=
3605 HAVE_GCC_FINLINE_LIMIT=
3606 HAVE_GCC_FNO_INLINE=
3607 if test "$GCC" = "yes"; then
3608     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3609     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3610         # Option just ignored and silly warning that isn't a real
3611         # warning printed
3612         :
3613     else
3614         save_CFLAGS=$CFLAGS
3615         CFLAGS="$CFLAGS -Werror -ggdb2"
3616         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3617         CFLAGS=$save_CFLAGS
3618     fi
3619     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3620         AC_MSG_RESULT([yes])
3621     else
3622         AC_MSG_RESULT([no])
3623     fi
3625     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3626     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3627         # As above
3628         :
3629     else
3630         save_CFLAGS=$CFLAGS
3631         CFLAGS="$CFLAGS -Werror -finline-limit=0"
3632         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3633         CFLAGS=$save_CFLAGS
3634     fi
3635     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3636         AC_MSG_RESULT([yes])
3637     else
3638         AC_MSG_RESULT([no])
3639     fi
3641     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3642     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3643         # Ditto
3644         :
3645     else
3646         save_CFLAGS=$CFLAGS
3647         CFLAGS="$CFLAGS -Werror -fno-inline"
3648         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3649         CFLAGS=$save_CFLAGS
3650     fi
3651     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3652         AC_MSG_RESULT([yes])
3653     else
3654         AC_MSG_RESULT([no])
3655     fi
3657     if test "$host_cpu" = "m68k"; then
3658         AC_MSG_CHECKING([whether $CC supports -mlong-jump-table-offsets])
3659         save_CFLAGS=$CFLAGS
3660         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3661         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3662         CFLAGS=$save_CFLAGS
3663         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3664             AC_MSG_RESULT([yes])
3665         else
3666             AC_MSG_ERROR([no])
3667         fi
3668     fi
3670 AC_SUBST(HAVE_GCC_GGDB2)
3671 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3672 AC_SUBST(HAVE_GCC_FNO_INLINE)
3674 dnl ===================================================================
3675 dnl  Test the gcc version
3676 dnl ===================================================================
3677 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3678     AC_MSG_CHECKING([the GCC version])
3679     _gcc_version=`$CC -dumpversion`
3680     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3681         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3682     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3684     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3686     if test "$gcc_full_version" -lt 40801; then
3687         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.8.1])
3688     fi
3689 else
3690     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3691     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3692     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3693     # (which reports itself as GCC 4.2.1).
3694     GCC_VERSION=
3696 AC_SUBST(GCC_VERSION)
3698 dnl Set the ENABLE_DBGUTIL variable
3699 dnl ===================================================================
3700 AC_MSG_CHECKING([whether to build with additional debug utilities])
3701 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3702     ENABLE_DBGUTIL="TRUE"
3703     # this is an extra var so it can have different default on different MSVC
3704     # versions (in case there are version specific problems with it)
3705     MSVC_USE_DEBUG_RUNTIME="TRUE"
3707     AC_MSG_RESULT([yes])
3708     # cppunit and graphite expose STL in public headers
3709     if test "$with_system_cppunit" = "yes"; then
3710         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3711     else
3712         with_system_cppunit=no
3713     fi
3714     if test "$with_system_graphite" = "yes"; then
3715         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3716     else
3717         with_system_graphite=no
3718     fi
3719     if test "$with_system_mysql_cppconn" = "yes"; then
3720         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3721     else
3722         with_system_mysql_cppconn=no
3723     fi
3724     if test "$with_system_orcus" = "yes"; then
3725         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3726     else
3727         with_system_orcus=no
3728     fi
3729     if test "$with_system_libcmis" = "yes"; then
3730         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3731     else
3732         with_system_libcmis=no
3733     fi
3734     if test "$with_system_hunspell" = "yes"; then
3735         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3736     else
3737         with_system_hunspell=no
3738     fi
3739 else
3740     ENABLE_DBGUTIL=""
3741     MSVC_USE_DEBUG_RUNTIME=""
3742     AC_MSG_RESULT([no])
3744 AC_SUBST(ENABLE_DBGUTIL)
3745 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3747 dnl Set the ENABLE_DEBUG variable.
3748 dnl ===================================================================
3749 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3750     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3752 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3753     if test -z "$libo_fuzzed_enable_debug"; then
3754         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3755     else
3756         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3757         enable_debug=yes
3758     fi
3761 AC_MSG_CHECKING([whether to do a debug build])
3762 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3763     ENABLE_DEBUG="TRUE"
3764     if test -n "$ENABLE_DBGUTIL" ; then
3765         AC_MSG_RESULT([yes (dbgutil)])
3766     else
3767         AC_MSG_RESULT([yes])
3768     fi
3769 else
3770     ENABLE_DEBUG=""
3771     AC_MSG_RESULT([no])
3773 AC_SUBST(ENABLE_DEBUG)
3775 if test "$enable_sal_log" = yes; then
3776     ENABLE_SAL_LOG=TRUE
3778 AC_SUBST(ENABLE_SAL_LOG)
3780 dnl Selective debuginfo
3781 ENABLE_DEBUGINFO_FOR=
3782 if test -n "$ENABLE_DEBUG"; then
3783     AC_MSG_CHECKING([whether to use selective debuginfo])
3784     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3785         if test "$enable_selective_debuginfo" = "yes"; then
3786             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3787         fi
3788         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3789         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3790     else
3791         ENABLE_DEBUGINFO_FOR=all
3792         AC_MSG_RESULT([no, for all])
3793     fi
3794 else
3795     if test -n "$enable_selective_debuginfo"; then
3796         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
3797     fi
3799 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3801 dnl Check for enable symbols option
3802 dnl ===================================================================
3803 AC_MSG_CHECKING([whether to generate debug information])
3804 if test -z "$enable_symbols"; then
3805     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3806         enable_symbols=yes
3807     else
3808         enable_symbols=no
3809     fi
3811 if test "$enable_symbols" != no; then
3812     ENABLE_SYMBOLS=TRUE
3813     AC_MSG_RESULT([yes])
3814 else
3815     ENABLE_SYMBOLS=
3816     AC_MSG_RESULT([no])
3818 AC_SUBST(ENABLE_SYMBOLS)
3820 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
3821     # Building on Android with full symbols: without enough memory the linker never finishes currently.
3822     AC_MSG_CHECKING([whether enough memory is available for linking])
3823     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
3824     # Check for 15GB, as Linux reports a bit less than the physical memory size.
3825     if test -n "$mem_size" -a $mem_size -lt 15728640; then
3826         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
3827     else
3828         AC_MSG_RESULT([yes])
3829     fi
3832 AC_MSG_CHECKING([whether to compile with optimization flags])
3833 if test -z "$enable_optimized"; then
3834     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3835         enable_optimized=no
3836     else
3837         enable_optimized=yes
3838     fi
3840 if test "$enable_optimized" != no; then
3841     ENABLE_OPTIMIZED=TRUE
3842     AC_MSG_RESULT([yes])
3843 else
3844     ENABLE_OPTIMIZED=
3845     AC_MSG_RESULT([no])
3847 AC_SUBST(ENABLE_OPTIMIZED)
3850 # determine CPUNAME, OS, ...
3851 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
3853 case "$host_os" in
3855 aix*)
3856     COM=GCC
3857     CPUNAME=POWERPC
3858     USING_X11=TRUE
3859     OS=AIX
3860     RTL_OS=AIX
3861     RTL_ARCH=PowerPC
3862     PLATFORMID=aix_powerpc
3863     P_SEP=:
3864     ;;
3866 cygwin*)
3867     COM=MSC
3868     USING_X11=
3869     OS=WNT
3870     RTL_OS=Windows
3871     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3872         P_SEP=";"
3873     else
3874         P_SEP=:
3875     fi
3876     case "$host_cpu" in
3877     i*86|x86_64)
3878         if test "$BITNESS_OVERRIDE" = 64; then
3879             CPUNAME=X86_64
3880             RTL_ARCH=X86_64
3881             PLATFORMID=windows_x86_64
3882             WINDOWS_X64=1
3883             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
3884         else
3885             CPUNAME=INTEL
3886             RTL_ARCH=x86
3887             PLATFORMID=windows_x86
3888         fi
3889         ;;
3890     *)
3891         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3892         ;;
3893     esac
3894     SCPDEFS="$SCPDEFS -D_MSC_VER"
3895     ;;
3897 darwin*)
3898     COM=GCC
3899     USING_X11=
3900     OS=MACOSX
3901     RTL_OS=MacOSX
3902     P_SEP=:
3904     case "$host_cpu" in
3905     arm)
3906         AC_MSG_ERROR([Can't build 32-bit code for iOS])
3907         ;;
3908     arm64)
3909         OS=IOS
3910         if test "$enable_ios_simulator" = "yes"; then
3911             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
3912         else
3913             CPUNAME=ARM64
3914             RTL_ARCH=ARM_EABI
3915             PLATFORMID=ios_arm64
3916         fi
3917         ;;
3918     i*86)
3919         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
3920         ;;
3921     x86_64)
3922         if test "$enable_ios_simulator" = "yes"; then
3923             OS=IOS
3924         fi
3925         CPUNAME=X86_64
3926         RTL_ARCH=X86_64
3927         PLATFORMID=macosx_x86_64
3928         ;;
3929     *)
3930         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3931         ;;
3932     esac
3933     ;;
3935 dragonfly*)
3936     COM=GCC
3937     USING_X11=TRUE
3938     OS=DRAGONFLY
3939     RTL_OS=DragonFly
3940     P_SEP=:
3942     case "$host_cpu" in
3943     i*86)
3944         CPUNAME=INTEL
3945         RTL_ARCH=x86
3946         PLATFORMID=dragonfly_x86
3947         ;;
3948     x86_64)
3949         CPUNAME=X86_64
3950         RTL_ARCH=X86_64
3951         PLATFORMID=dragonfly_x86_64
3952         ;;
3953     *)
3954         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3955         ;;
3956     esac
3957     ;;
3959 freebsd*)
3960     COM=GCC
3961     USING_X11=TRUE
3962     RTL_OS=FreeBSD
3963     OS=FREEBSD
3964     P_SEP=:
3966     case "$host_cpu" in
3967     i*86)
3968         CPUNAME=INTEL
3969         RTL_ARCH=x86
3970         PLATFORMID=freebsd_x86
3971         ;;
3972     x86_64|amd64)
3973         CPUNAME=X86_64
3974         RTL_ARCH=X86_64
3975         PLATFORMID=freebsd_x86_64
3976         ;;
3977     *)
3978         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3979         ;;
3980     esac
3981     ;;
3983 kfreebsd*)
3984     COM=GCC
3985     USING_X11=TRUE
3986     OS=LINUX
3987     RTL_OS=kFreeBSD
3988     P_SEP=:
3990     case "$host_cpu" in
3992     i*86)
3993         CPUNAME=INTEL
3994         RTL_ARCH=x86
3995         PLATFORMID=kfreebsd_x86
3996         ;;
3997     x86_64)
3998         CPUNAME=X86_64
3999         RTL_ARCH=X86_64
4000         PLATFORMID=kfreebsd_x86_64
4001         ;;
4002     *)
4003         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4004         ;;
4005     esac
4006     ;;
4008 linux-gnu*)
4009     COM=GCC
4010     USING_X11=TRUE
4011     OS=LINUX
4012     RTL_OS=Linux
4013     P_SEP=:
4015     case "$host_cpu" in
4017     aarch64)
4018         CPUNAME=AARCH64
4019         PLATFORMID=linux_aarch64
4020         RTL_ARCH=AARCH64
4021         ;;
4022     alpha)
4023         CPUNAME=AXP
4024         RTL_ARCH=ALPHA
4025         PLATFORMID=linux_alpha
4026         ;;
4027     arm*)
4028         CPUNAME=ARM
4029         EPM_FLAGS="-a arm"
4030         RTL_ARCH=ARM_EABI
4031         PLATFORMID=linux_arm_eabi
4032         case "$host_cpu" in
4033         arm*-linux)
4034             RTL_ARCH=ARM_OABI
4035             PLATFORMID=linux_arm_oabi
4036             ;;
4037         esac
4038         ;;
4039     hppa)
4040         CPUNAME=HPPA
4041         RTL_ARCH=HPPA
4042         EPM_FLAGS="-a hppa"
4043         PLATFORMID=linux_hppa
4044         ;;
4045     i*86)
4046         CPUNAME=INTEL
4047         RTL_ARCH=x86
4048         PLATFORMID=linux_x86
4049         ;;
4050     ia64)
4051         CPUNAME=IA64
4052         RTL_ARCH=IA64
4053         PLATFORMID=linux_ia64
4054         ;;
4055     mips)
4056         CPUNAME=GODSON
4057         RTL_ARCH=MIPS_EB
4058         EPM_FLAGS="-a mips"
4059         PLATFORMID=linux_mips_eb
4060         ;;
4061     mips64)
4062         CPUNAME=GODSON64
4063         RTL_ARCH=MIPS64_EB
4064         EPM_FLAGS="-a mips64"
4065         PLATFORMID=linux_mips64_eb
4066         ;;
4067     mips64el)
4068         CPUNAME=GODSON64
4069         RTL_ARCH=MIPS64_EL
4070         EPM_FLAGS="-a mips64el"
4071         PLATFORMID=linux_mips64_el
4072         ;;
4073     mipsel)
4074         CPUNAME=GODSON
4075         RTL_ARCH=MIPS_EL
4076         EPM_FLAGS="-a mipsel"
4077         PLATFORMID=linux_mips_el
4078         ;;
4079     m68k)
4080         CPUNAME=M68K
4081         RTL_ARCH=M68K
4082         PLATFORMID=linux_m68k
4083         ;;
4084     powerpc)
4085         CPUNAME=POWERPC
4086         RTL_ARCH=PowerPC
4087         PLATFORMID=linux_powerpc
4088         ;;
4089     powerpc64)
4090         CPUNAME=POWERPC64
4091         RTL_ARCH=PowerPC_64
4092         PLATFORMID=linux_powerpc64
4093         ;;
4094     powerpc64le)
4095         CPUNAME=POWERPC64
4096         RTL_ARCH=PowerPC_64_LE
4097         PLATFORMID=linux_powerpc64_le
4098         ;;
4099     sparc)
4100         CPUNAME=SPARC
4101         RTL_ARCH=SPARC
4102         PLATFORMID=linux_sparc
4103         ;;
4104     sparc64)
4105         CPUNAME=SPARC64
4106         RTL_ARCH=SPARC64
4107         PLATFORMID=linux_sparc64
4108         ;;
4109     s390)
4110         CPUNAME=S390
4111         RTL_ARCH=S390
4112         PLATFORMID=linux_s390
4113         ;;
4114     s390x)
4115         CPUNAME=S390X
4116         RTL_ARCH=S390x
4117         PLATFORMID=linux_s390x
4118         ;;
4119     x86_64)
4120         CPUNAME=X86_64
4121         RTL_ARCH=X86_64
4122         PLATFORMID=linux_x86_64
4123         ;;
4124     *)
4125         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4126         ;;
4127     esac
4128     ;;
4130 linux-android*)
4131     COM=GCC
4132     USING_X11=
4133     OS=ANDROID
4134     RTL_OS=Android
4135     P_SEP=:
4137     case "$host_cpu" in
4139     arm|armel)
4140         CPUNAME=ARM
4141         RTL_ARCH=ARM_EABI
4142         PLATFORMID=android_arm_eabi
4143         ;;
4144     aarch64)
4145         CPUNAME=AARCH64
4146         RTL_ARCH=AARCH64
4147         PLATFORMID=android_aarch64
4148         ;;
4149     mips|mipsel)
4150         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4151         RTL_ARCH=MIPS_EL
4152         PLATFORMID=android_mips_el
4153         ;;
4154     i*86)
4155         CPUNAME=INTEL
4156         RTL_ARCH=x86
4157         PLATFORMID=android_x86
4158         ;;
4159     *)
4160         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4161         ;;
4162     esac
4163     ;;
4165 *netbsd*)
4166     COM=GCC
4167     USING_X11=TRUE
4168     OS=NETBSD
4169     RTL_OS=NetBSD
4170     P_SEP=:
4172     case "$host_cpu" in
4173     i*86)
4174         CPUNAME=INTEL
4175         RTL_ARCH=x86
4176         PLATFORMID=netbsd_x86
4177         ;;
4178     powerpc)
4179         CPUNAME=POWERPC
4180         RTL_ARCH=PowerPC
4181         PLATFORMID=netbsd_powerpc
4182         ;;
4183     sparc)
4184         CPUNAME=SPARC
4185         RTL_ARCH=SPARC
4186         PLATFORMID=netbsd_sparc
4187         ;;
4188     x86_64)
4189         CPUNAME=X86_64
4190         RTL_ARCH=X86_64
4191         PLATFORMID=netbsd_x86_64
4192         ;;
4193     *)
4194         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4195         ;;
4196     esac
4197     ;;
4199 openbsd*)
4200     COM=GCC
4201     USING_X11=TRUE
4202     OS=OPENBSD
4203     RTL_OS=OpenBSD
4204     P_SEP=:
4206     case "$host_cpu" in
4207     i*86)
4208         CPUNAME=INTEL
4209         RTL_ARCH=x86
4210         PLATFORMID=openbsd_x86
4211         ;;
4212     x86_64)
4213         CPUNAME=X86_64
4214         RTL_ARCH=X86_64
4215         PLATFORMID=openbsd_x86_64
4216         ;;
4217     *)
4218         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4219         ;;
4220     esac
4221     SOLARINC="$SOLARINC -I/usr/local/include"
4222     ;;
4224 solaris*)
4225     COM=GCC
4226     USING_X11=TRUE
4227     OS=SOLARIS
4228     RTL_OS=Solaris
4229     P_SEP=:
4231     case "$host_cpu" in
4232     i*86)
4233         CPUNAME=INTEL
4234         RTL_ARCH=x86
4235         PLATFORMID=solaris_x86
4236         ;;
4237     sparc)
4238         CPUNAME=SPARC
4239         RTL_ARCH=SPARC
4240         PLATFORMID=solaris_sparc
4241         ;;
4242     sparc64)
4243         CPUNAME=SPARC64
4244         RTL_ARCH=SPARC64
4245         PLATFORMID=solaris_sparc64
4246         ;;
4247     *)
4248         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4249         ;;
4250     esac
4251     SOLARINC="$SOLARINC -I/usr/local/include"
4252     ;;
4255     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4256     ;;
4257 esac
4259 if test "$with_x" = "no"; then
4260     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4263 ENABLE_HEADLESS=""
4264 if test "$enable_gui" = "no"; then
4265     if test "$USING_X11" != TRUE; then
4266         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4267     fi
4268     USING_X11=
4269     ENABLE_HEADLESS=TRUE
4270     AC_DEFINE(HAVE_FEATURE_UI,0)
4271     test_cairo=yes
4273 AC_SUBST(ENABLE_HEADLESS)
4275 WORKDIR="${BUILDDIR}/workdir"
4276 INSTDIR="${BUILDDIR}/instdir"
4277 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4278 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4279 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4280 AC_SUBST(COM)
4281 AC_SUBST(CPUNAME)
4282 AC_SUBST(RTL_OS)
4283 AC_SUBST(RTL_ARCH)
4284 AC_SUBST(EPM_FLAGS)
4285 AC_SUBST(USING_X11)
4286 AC_SUBST([INSTDIR])
4287 AC_SUBST([INSTROOT])
4288 AC_SUBST([INSTROOTBASE])
4289 AC_SUBST(OS)
4290 AC_SUBST(P_SEP)
4291 AC_SUBST(WORKDIR)
4292 AC_SUBST(PLATFORMID)
4293 AC_SUBST(WINDOWS_X64)
4294 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4296 dnl ===================================================================
4297 dnl Test which package format to use
4298 dnl ===================================================================
4299 AC_MSG_CHECKING([which package format to use])
4300 if test -n "$with_package_format" -a "$with_package_format" != no; then
4301     for i in $with_package_format; do
4302         case "$i" in
4303         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4304             ;;
4305         *)
4306             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4307 aix - AIX software distribution
4308 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4309 deb - Debian software distribution
4310 pkg - Solaris software distribution
4311 rpm - RedHat software distribution
4313 LibreOffice additionally supports:
4314 archive - .tar.gz or .zip
4315 dmg - Mac OS X .dmg
4316 installed - installation tree
4317 msi - Windows .msi
4318         ])
4319             ;;
4320         esac
4321     done
4322     PKGFORMAT="$with_package_format"
4323     AC_MSG_RESULT([$PKGFORMAT])
4324 else
4325     PKGFORMAT=
4326     AC_MSG_RESULT([none])
4328 AC_SUBST(PKGFORMAT)
4330 dnl ===================================================================
4331 dnl Set up a different compiler to produce tools to run on the build
4332 dnl machine when doing cross-compilation
4333 dnl ===================================================================
4335 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4336 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4337 if test "$cross_compiling" = "yes"; then
4338     AC_MSG_CHECKING([for BUILD platform configuration])
4339     echo
4340     rm -rf CONF-FOR-BUILD config_build.mk
4341     mkdir CONF-FOR-BUILD
4342     # Here must be listed all files needed when running the configure script. In particular, also
4343     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4344     # keep them in the same order as there.
4345     (cd $SRC_ROOT && tar cf - \
4346         config.guess \
4347         bin/get_config_variables \
4348         solenv/bin/getcompver.awk \
4349         solenv/inc/langlist.mk \
4350         download.lst \
4351         config_host.mk.in \
4352         config_host_lang.mk.in \
4353         Makefile.in \
4354         lo.xcent.in \
4355         bin/bffvalidator.sh.in \
4356         bin/odfvalidator.sh.in \
4357         bin/officeotron.sh.in \
4358         instsetoo_native/util/openoffice.lst.in \
4359         config_host/*.in \
4360         sysui/desktop/macosx/Info.plist.in) \
4361     | (cd CONF-FOR-BUILD && tar xf -)
4362     cp configure CONF-FOR-BUILD
4363     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4364     (
4365     unset COM USING_X11 OS CPUNAME
4366     unset CC CXX SYSBASE CFLAGS
4367     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4368     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4369     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4370     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4371     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4372     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4373     cd CONF-FOR-BUILD
4374     sub_conf_opts=""
4375     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4376     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4377     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4378     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4379     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4380     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4381     # Don't bother having configure look for stuff not needed for the build platform anyway
4382     ./configure \
4383         --disable-cups \
4384         --disable-gtk3 \
4385         --disable-pdfimport \
4386         --disable-postgresql-sdbc \
4387         --with-parallelism="$with_parallelism" \
4388         --without-doxygen \
4389         --without-java \
4390         $sub_conf_opts \
4391         --srcdir=$srcdir \
4392         2>&1 | sed -e 's/^/    /'
4393     test -f ./config_host.mk 2>/dev/null || exit
4394     cp config_host.mk ../config_build.mk
4395     cp config_host_lang.mk ../config_build_lang.mk
4396     mv config.log ../config.Build.log
4397     mkdir -p ../config_build
4398     mv config_host/*.h ../config_build
4399     . ./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
4401     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
4402         VV='$'$V
4403         VV=`eval "echo $VV"`
4404         if test -n "$VV"; then
4405             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4406             echo "$line" >>build-config
4407         fi
4408     done
4410     for V in INSTDIR INSTROOT WORKDIR; do
4411         VV='$'$V
4412         VV=`eval "echo $VV"`
4413         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4414         if test -n "$VV"; then
4415             line="${V}_FOR_BUILD='$VV'"
4416             echo "$line" >>build-config
4417         fi
4418     done
4420     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4421     echo "$line" >>build-config
4423     )
4424     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4425     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])
4426     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4427              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4429     eval `cat CONF-FOR-BUILD/build-config`
4431     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4433     rm -rf CONF-FOR-BUILD
4434 else
4435     OS_FOR_BUILD="$OS"
4436     CC_FOR_BUILD="$CC"
4437     CXX_FOR_BUILD="$CXX"
4438     INSTDIR_FOR_BUILD="$INSTDIR"
4439     INSTROOT_FOR_BUILD="$INSTROOT"
4440     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4441     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4442     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4443     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4444     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4445     WORKDIR_FOR_BUILD="$WORKDIR"
4447 AC_SUBST(OS_FOR_BUILD)
4448 AC_SUBST(INSTDIR_FOR_BUILD)
4449 AC_SUBST(INSTROOT_FOR_BUILD)
4450 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4451 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4452 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4453 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4454 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4455 AC_SUBST(WORKDIR_FOR_BUILD)
4457 dnl ===================================================================
4458 dnl Check for syslog header
4459 dnl ===================================================================
4460 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4462 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4463 dnl ===================================================================
4464 AC_MSG_CHECKING([whether to turn warnings to errors])
4465 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4466     ENABLE_WERROR="TRUE"
4467     AC_MSG_RESULT([yes])
4468 else
4469     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4470         ENABLE_WERROR="TRUE"
4471         AC_MSG_RESULT([yes])
4472     else
4473         AC_MSG_RESULT([no])
4474     fi
4476 AC_SUBST(ENABLE_WERROR)
4478 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4479 dnl ===================================================================
4480 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4481 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4482     ASSERT_ALWAYS_ABORT="TRUE"
4483     AC_MSG_RESULT([yes])
4484 else
4485     ASSERT_ALWAYS_ABORT="FALSE"
4486     AC_MSG_RESULT([no])
4488 AC_SUBST(ASSERT_ALWAYS_ABORT)
4490 # Determine whether to use ooenv for the instdir installation
4491 # ===================================================================
4492 if test $_os != "WINNT" -a $_os != "Darwin"; then
4493     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4494     if test "$enable_ooenv" = "no"; then
4495         AC_MSG_RESULT([no])
4496     else
4497         ENABLE_OOENV="TRUE"
4498         AC_MSG_RESULT([yes])
4499     fi
4501 AC_SUBST(ENABLE_OOENV)
4503 if test "$USING_X11" != TRUE; then
4504     # be sure to do not mess with unneeded stuff
4505     test_randr=no
4506     test_xrender=no
4507     test_cups=no
4508     test_dbus=no
4509     test_gtk=no
4510     build_gstreamer_1_0=no
4511     build_gstreamer_0_10=no
4512     test_kde4=no
4513     test_qt5=no
4514     enable_cairo_canvas=no
4517 dnl ===================================================================
4518 dnl check for cups support
4519 dnl ===================================================================
4520 ENABLE_CUPS=""
4522 if test "$enable_cups" = "no"; then
4523     test_cups=no
4526 AC_MSG_CHECKING([whether to enable CUPS support])
4527 if test "$test_cups" = "yes"; then
4528     ENABLE_CUPS="TRUE"
4529     AC_MSG_RESULT([yes])
4531     AC_MSG_CHECKING([whether cups support is present])
4532     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4533     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4534     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4535         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4536     fi
4538 else
4539     AC_MSG_RESULT([no])
4542 AC_SUBST(ENABLE_CUPS)
4544 # fontconfig checks
4545 if test "$test_fontconfig" = "yes"; then
4546     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4547     SYSTEM_FONTCONFIG=TRUE
4548     FilterLibs "${FONTCONFIG_LIBS}"
4549     FONTCONFIG_LIBS="${filteredlibs}"
4551 AC_SUBST(FONTCONFIG_CFLAGS)
4552 AC_SUBST(FONTCONFIG_LIBS)
4553 AC_SUBST([SYSTEM_FONTCONFIG])
4555 dnl whether to find & fetch external tarballs?
4556 dnl ===================================================================
4557 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4558    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4559        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4560    else
4561        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4562    fi
4564 if test -z "$TARFILE_LOCATION"; then
4565     if test -d "$SRC_ROOT/src" ; then
4566         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4567         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4568     fi
4569     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4570 else
4571     AbsolutePath "$TARFILE_LOCATION"
4572     PathFormat "${absolute_path}"
4573     TARFILE_LOCATION="${formatted_path}"
4575 AC_SUBST(TARFILE_LOCATION)
4577 AC_MSG_CHECKING([whether we want to fetch tarballs])
4578 if test "$enable_fetch_external" != "no"; then
4579     if test "$with_all_tarballs" = "yes"; then
4580         AC_MSG_RESULT([yes, all of them])
4581         DO_FETCH_TARBALLS="ALL"
4582     else
4583         AC_MSG_RESULT([yes, if we use them])
4584         DO_FETCH_TARBALLS="TRUE"
4585     fi
4586 else
4587     AC_MSG_RESULT([no])
4588     DO_FETCH_TARBALLS=
4590 AC_SUBST(DO_FETCH_TARBALLS)
4592 AC_MSG_CHECKING([whether to build help])
4593 HELP_COMMON_ONLY=FALSE
4594 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4595     BUILD_TYPE="$BUILD_TYPE HELP"
4596     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4597     if test "$with_help" = "common" ; then
4598         HELP_COMMON_ONLY=TRUE
4599         AC_MSG_RESULT([common only])
4600     else
4601         SCPDEFS="$SCPDEFS -DWITH_HELP"
4602         AC_MSG_RESULT([yes])
4603     fi
4604 else
4605     AC_MSG_RESULT([no])
4607 AC_SUBST(HELP_COMMON_ONLY)
4609 dnl Test whether to include MySpell dictionaries
4610 dnl ===================================================================
4611 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4612 if test "$with_myspell_dicts" = "yes"; then
4613     AC_MSG_RESULT([yes])
4614     WITH_MYSPELL_DICTS=TRUE
4615     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4616     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4617 else
4618     AC_MSG_RESULT([no])
4619     WITH_MYSPELL_DICTS=
4621 AC_SUBST(WITH_MYSPELL_DICTS)
4623 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4624 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4625     if test "$with_system_dicts" = yes; then
4626         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4627     fi
4628     with_system_dicts=no
4631 AC_MSG_CHECKING([whether to use dicts from external paths])
4632 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4633     AC_MSG_RESULT([yes])
4634     SYSTEM_DICTS=TRUE
4635     AC_MSG_CHECKING([for spelling dictionary directory])
4636     if test -n "$with_external_dict_dir"; then
4637         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4638     else
4639         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4640         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4641             DICT_SYSTEM_DIR=file:///usr/share/myspell
4642         fi
4643     fi
4644     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4645     AC_MSG_CHECKING([for hyphenation patterns directory])
4646     if test -n "$with_external_hyph_dir"; then
4647         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4648     else
4649         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4650     fi
4651     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4652     AC_MSG_CHECKING([for thesaurus directory])
4653     if test -n "$with_external_thes_dir"; then
4654         THES_SYSTEM_DIR=file://$with_external_thes_dir
4655     else
4656         THES_SYSTEM_DIR=file:///usr/share/mythes
4657     fi
4658     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4659 else
4660     AC_MSG_RESULT([no])
4661     SYSTEM_DICTS=
4663 AC_SUBST(SYSTEM_DICTS)
4664 AC_SUBST(DICT_SYSTEM_DIR)
4665 AC_SUBST(HYPH_SYSTEM_DIR)
4666 AC_SUBST(THES_SYSTEM_DIR)
4668 dnl ===================================================================
4669 dnl enable pch by default on windows
4670 dnl enable it explicitly otherwise
4671 ENABLE_PCH=""
4672 if test "$enable_pch" = yes -a "$enable_compiler_plugins" = yes; then
4673     if test -z "$libo_fuzzed_enable_pch"; then
4674         AC_MSG_ERROR([--enable-pch cannot be used with --enable-compiler-plugins])
4675     else
4676         AC_MSG_NOTICE([Resetting --enable-pch=no])
4677         enable_pch=no
4678     fi
4681 AC_MSG_CHECKING([whether to enable pch feature])
4682 if test "$enable_pch" != "no"; then
4683     if test "$_os" = "WINNT"; then
4684         ENABLE_PCH="TRUE"
4685         AC_MSG_RESULT([yes])
4686     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4687         ENABLE_PCH="TRUE"
4688         AC_MSG_RESULT([yes])
4689     elif test -n "$enable_pch"; then
4690         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4691     else
4692         AC_MSG_RESULT([no])
4693     fi
4694 else
4695     AC_MSG_RESULT([no])
4697 AC_SUBST(ENABLE_PCH)
4699 TAB=`printf '\t'`
4701 AC_MSG_CHECKING([the GNU Make version])
4702 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4703 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4704 if test "$_make_longver" -ge "038200"; then
4705     AC_MSG_RESULT([$GNUMAKE $_make_version])
4707 elif test "$_make_longver" -ge "038100"; then
4708     if test "$build_os" = "cygwin"; then
4709         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4710     fi
4711     AC_MSG_RESULT([$GNUMAKE $_make_version])
4713     dnl ===================================================================
4714     dnl Search all the common names for sha1sum
4715     dnl ===================================================================
4716     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4717     if test -z "$SHA1SUM"; then
4718         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
4719     elif test "$SHA1SUM" = "openssl"; then
4720         SHA1SUM="openssl sha1"
4721     fi
4722     AC_MSG_CHECKING([for GNU Make bug 20033])
4723     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4724     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4725 A := \$(wildcard *.a)
4727 .PHONY: all
4728 all: \$(A:.a=.b)
4729 <TAB>@echo survived bug20033.
4731 .PHONY: setup
4732 setup:
4733 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4735 define d1
4736 @echo lala \$(1)
4737 @sleep 1
4738 endef
4740 define d2
4741 @echo tyty \$(1)
4742 @sleep 1
4743 endef
4745 %.b : %.a
4746 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4747 <TAB>\$(call d1,\$(CHECKSUM)),\
4748 <TAB>\$(call d2,\$(CHECKSUM)))
4750     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4751         no_parallelism_make="YES"
4752         AC_MSG_RESULT([yes, disable parallelism])
4753     else
4754         AC_MSG_RESULT([no, keep parallelism enabled])
4755     fi
4756     rm -rf $TESTGMAKEBUG20033
4757 else
4758     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4761 # find if gnumake support file function
4762 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
4763 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4764 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4765     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
4767 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4768 \$(file >test.txt,Success )
4770 .PHONY: all
4771 all:
4772 <TAB>@cat test.txt
4775 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4776 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4777     HAVE_GNUMAKE_FILE_FUNC=TRUE
4778     AC_MSG_RESULT([yes])
4779 else
4780     AC_MSG_RESULT([no])
4782 rm -rf $TESTGMAKEFILEFUNC
4783 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4784 AC_SUBST(GNUMAKE_WIN_NATIVE)
4786 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
4787 STALE_MAKE=
4788 if test "$_make_ver_check" = ""; then
4789    STALE_MAKE=TRUE
4792 HAVE_LD_HASH_STYLE=FALSE
4793 WITH_LINKER_HASH_STYLE=
4794 AC_MSG_CHECKING([for --hash-style gcc linker support])
4795 if test "$GCC" = "yes"; then
4796     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4797         hash_styles="gnu sysv"
4798     elif test "$with_linker_hash_style" = "no"; then
4799         hash_styles=
4800     else
4801         hash_styles="$with_linker_hash_style"
4802     fi
4804     for hash_style in $hash_styles; do
4805         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4806         hash_style_ldflags_save=$LDFLAGS
4807         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
4809         AC_RUN_IFELSE([AC_LANG_PROGRAM(
4810             [
4811 #include <stdio.h>
4812             ],[
4813 printf ("");
4814             ])],
4815             [
4816                   HAVE_LD_HASH_STYLE=TRUE
4817                   WITH_LINKER_HASH_STYLE=$hash_style
4818             ],
4819             [HAVE_LD_HASH_STYLE=FALSE],
4820             [HAVE_LD_HASH_STYLE=FALSE])
4821         LDFLAGS=$hash_style_ldflags_save
4822     done
4824     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
4825         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
4826     else
4827         AC_MSG_RESULT( no )
4828     fi
4829     LDFLAGS=$hash_style_ldflags_save
4830 else
4831     AC_MSG_RESULT( no )
4833 AC_SUBST(HAVE_LD_HASH_STYLE)
4834 AC_SUBST(WITH_LINKER_HASH_STYLE)
4836 dnl ===================================================================
4837 dnl Check whether there's a Perl version available.
4838 dnl ===================================================================
4839 if test -z "$with_perl_home"; then
4840     AC_PATH_PROG(PERL, perl)
4841 else
4842     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
4843     _perl_path="$with_perl_home/bin/perl"
4844     if test -x "$_perl_path"; then
4845         PERL=$_perl_path
4846     else
4847         AC_MSG_ERROR([$_perl_path not found])
4848     fi
4851 dnl ===================================================================
4852 dnl Testing for Perl version 5 or greater.
4853 dnl $] is the Perl version variable, it is returned as an integer
4854 dnl ===================================================================
4855 if test "$PERL"; then
4856     AC_MSG_CHECKING([the Perl version])
4857     ${PERL} -e "exit($]);"
4858     _perl_version=$?
4859     if test "$_perl_version" -lt 5; then
4860         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
4861     fi
4862     AC_MSG_RESULT([Perl $_perl_version])
4863 else
4864     AC_MSG_ERROR([Perl not found, install Perl 5])
4867 dnl ===================================================================
4868 dnl Testing for required Perl modules
4869 dnl ===================================================================
4871 AC_MSG_CHECKING([for required Perl modules])
4872 if `$PERL -e 'use Cwd; use Digest::MD5'>/dev/null 2>&1`; then
4873     AC_MSG_RESULT([all modules found])
4874 else
4875     AC_MSG_RESULT([failed to find some modules])
4876     # Find out which modules are missing.
4877     if ! `$PERL -e 'use Cwd;'>/dev/null 2>&1`; then
4878         missing_perl_modules="$missing_perl_modules Cwd"
4879     fi
4880     if ! `$PERL -e 'use Digest::MD5;'>/dev/null 2>&1`; then
4881         missing_perl_modules="$missing_perl_modules Digest::MD5"
4882     fi
4883        AC_MSG_ERROR([
4884     The missing Perl modules are: $missing_perl_modules
4885     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
4888 dnl ===================================================================
4889 dnl Check for pkg-config
4890 dnl ===================================================================
4891 if test "$_os" != "WINNT"; then
4892     PKG_PROG_PKG_CONFIG
4895 if test "$_os" != "WINNT"; then
4897     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
4898     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
4899     # explicitly. Or put /path/to/compiler in PATH yourself.
4901     # Use wrappers for LTO
4902     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
4903         AC_CHECK_TOOL(AR,gcc-ar)
4904         AC_CHECK_TOOL(NM,gcc-nm)
4905         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
4906     else
4907         AC_CHECK_TOOL(AR,ar)
4908         AC_CHECK_TOOL(NM,nm)
4909         AC_CHECK_TOOL(RANLIB,ranlib)
4910     fi
4911     AC_CHECK_TOOL(OBJDUMP,objdump)
4912     AC_CHECK_TOOL(READELF,readelf)
4913     AC_CHECK_TOOL(STRIP,strip)
4914     if test "$_os" = "WINNT"; then
4915         AC_CHECK_TOOL(DLLTOOL,dlltool)
4916         AC_CHECK_TOOL(WINDRES,windres)
4917     fi
4919 AC_SUBST(AR)
4920 AC_SUBST(DLLTOOL)
4921 AC_SUBST(NM)
4922 AC_SUBST(OBJDUMP)
4923 AC_SUBST(PKG_CONFIG)
4924 AC_SUBST(RANLIB)
4925 AC_SUBST(READELF)
4926 AC_SUBST(STRIP)
4927 AC_SUBST(WINDRES)
4929 dnl ===================================================================
4930 dnl pkg-config checks on Mac OS X
4931 dnl ===================================================================
4933 if test $_os = Darwin; then
4934     AC_MSG_CHECKING([for bogus pkg-config])
4935     if test -n "$PKG_CONFIG"; then
4936         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
4937             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
4938         else
4939             if test "$enable_bogus_pkg_config" = "yes"; then
4940                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
4941             else
4942                 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.])
4943             fi
4944         fi
4945     else
4946         AC_MSG_RESULT([no, good])
4947     fi
4950 find_csc()
4952     # Return value: $csctest
4954     unset csctest
4956     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
4957     if test -n "$regvalue"; then
4958         csctest=$regvalue
4959         return
4960     fi
4963 find_al()
4965     # Return value: $altest
4967     unset altest
4969     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
4970         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
4971         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
4972             altest=$regvalue
4973             return
4974         fi
4975     done
4977     # We need this additional check to detect 4.6.1 or above.
4978     for ver in 4.7 4.6.2 4.6.1; do
4979         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
4980         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
4981             altest=$regvalue
4982             return
4983         fi
4985         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/WOW6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools"
4986         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
4987             altest=$regvalue
4988             return
4989         fi
4990     done
4993 find_dotnetsdk()
4995     # Return value: $frametest (that's a silly name...)
4997     unset frametest
4999     for ver in 1.1 2.0; do
5000         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
5001         if test -n "$regvalue"; then
5002             frametest=$regvalue
5003             return
5004         fi
5005     done
5008 find_dotnetsdk46()
5010     unset frametest
5012     for ver in 4.7 4.6.2 4.6.1 4.6; do
5013         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5014         if test -n "$regvalue"; then
5015             frametest=$regvalue
5016             return
5017         fi
5018         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5019         if test -n "$regvalue"; then
5020             frametest=$regvalue
5021             return
5022         fi
5023     done
5026 find_winsdk_version()
5028     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5029     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5031     unset winsdktest winsdkbinsubdir winsdklibsubdir
5033     case "$1" in
5034     7.*)
5035         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5036         if test -n "$regvalue"; then
5037             winsdktest=$regvalue
5038             winsdklibsubdir=.
5039             return
5040         fi
5041         ;;
5042     8.0|8.0A)
5043         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5044         if test -n "$regvalue"; then
5045             winsdktest=$regvalue
5046             winsdklibsubdir=win8
5047             return
5048         fi
5049         ;;
5050     8.1|8.1A)
5051         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5052         if test -n "$regvalue"; then
5053             winsdktest=$regvalue
5054             winsdklibsubdir=winv6.3
5055             return
5056         fi
5057         ;;
5058     10.0)
5059         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5060         if test -n "$regvalue"; then
5061             winsdktest=$regvalue
5062             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5063             if test -n "$regvalue"; then
5064                 winsdkbinsubdir="$regvalue".0
5065             fi
5066             winsdklibsubdir=$regvalue
5067             if test "$regvalue" = "10.0.14393"; then
5068                 winsdklibsubdir="10.0.14393.0"
5069             elif test "$regvalue" = "10.0.16299"; then
5070                 winsdklibsubdir="10.0.16299.0"
5071             elif test "$regvalue" = "10.0.15063"; then
5072                 winsdklibsubdir="10.0.15063.0"
5073                 dnl Hack needed at least by tml:
5074                 if test ! -f "${winsdktest}/Include/10.0.15063.0/um/sqlext.h" \
5075                     -a -f "${winsdktest}/Include/10.0.14393.0/um/sqlext.h"
5076                 then
5077                     winsdklibsubdir="10.0.14393.0"
5078                 fi
5079             fi
5080             return
5081         fi
5082         ;;
5083     esac
5086 find_winsdk()
5088     # Return value: From find_winsdk_version
5090     unset winsdktest
5092     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5093         find_winsdk_version $ver
5094         if test -n "$winsdktest"; then
5095             return
5096         fi
5097     done
5100 find_msms()
5102     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5103     if test $VCVER = 150; then
5104         my_msm_files="Microsoft_VC141_CRT_x86.msm ${my_msm_files}"
5105     fi
5106     AC_MSG_CHECKING([for ${my_msm_files}])
5107     msmdir=
5108     for ver in 14.0 15.0; do
5109         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5110         if test -n "$regvalue"; then
5111             for f in ${my_msm_files}; do
5112                 if test -e "$regvalue/${f}"; then
5113                     msmdir=$regvalue
5114                     break
5115                 fi
5116             done
5117         fi
5118     done
5119     dnl Is the following fallback really necessary, or was it added in response
5120     dnl to never having started Visual Studio on a given machine, so the
5121     dnl registry keys checked above had presumably not yet been created?
5122     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5123     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5124     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5125     dnl expanding to "C:\Program Files\Common Files"), which would need
5126     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5127     dnl obtain its value from cygwin:
5128     if test -z "$msmdir"; then
5129         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5130         for f in ${my_msm_files}; do
5131             if test -e "$my_msm_dir/${f}"; then
5132                 msmdir=$my_msm_dir
5133             fi
5134         done
5135     fi
5137     dnl Starting from MSVC 15.0, merge modules are located in different directory
5138     if test $VCVER = 150; then
5139         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5140             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])
5141             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5142             for f in ${my_msm_files}; do
5143                 if test -e "$my_msm_dir/${f}"; then
5144                     msmdir=$my_msm_dir
5145                     break
5146                 fi
5147             done
5148         done
5149     fi
5151     if test -n "$msmdir"; then
5152         msmdir=`cygpath -m "$msmdir"`
5153         AC_MSG_RESULT([$msmdir])
5154     else
5155         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5156             AC_MSG_ERROR([not found])
5157         else
5158             AC_MSG_WARN([not found])
5159             add_warning "MSM none of ${my_msm_files} found"
5160         fi
5161     fi
5164 find_msvc_x64_dlls()
5166     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5167     if test "$VCVER" = 150; then
5168         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5169             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT])
5170             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5171                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5172                 break
5173             fi
5174             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5175                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5176                 break
5177             fi
5178         done
5179     fi
5180     msvcdlls="msvcp140.dll vcruntime140.dll"
5181     for dll in $msvcdlls; do
5182         if ! test -f "$msvcdllpath/$dll"; then
5183             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5184         fi
5185     done
5188 dnl =========================================
5189 dnl Check for the Windows  SDK.
5190 dnl =========================================
5191 if test "$_os" = "WINNT"; then
5192     AC_MSG_CHECKING([for Windows SDK])
5193     if test "$build_os" = "cygwin"; then
5194         find_winsdk
5195         WINDOWS_SDK_HOME=$winsdktest
5197         # normalize if found
5198         if test -n "$WINDOWS_SDK_HOME"; then
5199             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5200             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5201         fi
5203         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5204     fi
5206     if test -n "$WINDOWS_SDK_HOME"; then
5207         # Remove a possible trailing backslash
5208         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5210         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5211              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5212              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5213             have_windows_sdk_headers=yes
5214         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5215              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5216              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5217             have_windows_sdk_headers=yes
5218         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5219              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5220              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5221             have_windows_sdk_headers=yes
5222         else
5223             have_windows_sdk_headers=no
5224         fi
5226         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5227             have_windows_sdk_libs=yes
5228         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5229             have_windows_sdk_libs=yes
5230         else
5231             have_windows_sdk_libs=no
5232         fi
5234         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5235             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5236 the  Windows SDK are installed.])
5237         fi
5238     fi
5240     if test -z "$WINDOWS_SDK_HOME"; then
5241         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5242     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
5243         WINDOWS_SDK_VERSION=70
5244         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
5245     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5246         WINDOWS_SDK_VERSION=80
5247         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5248     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5249         WINDOWS_SDK_VERSION=81
5250         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5251     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5252         WINDOWS_SDK_VERSION=10
5253         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5254     else
5255         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5256     fi
5257     PathFormat "$WINDOWS_SDK_HOME"
5258     WINDOWS_SDK_HOME="$formatted_path"
5259     if test "$build_os" = "cygwin"; then
5260         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5261         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5262             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5263         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5264             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5265         fi
5266     fi
5268     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5269     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5270     dnl but not in v8.0), so allow this to be overridden with a
5271     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5272     dnl and configuration error if no WiLangId.vbs is found would arguably be
5273     dnl better, but I do not know under which conditions exactly it is needed by
5274     dnl msiglobal.pm:
5275     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5276         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5277         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5278             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5279         fi
5280         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5281             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5282         fi
5283         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5284             AC_MSG_WARN([WiLangId.vbs not found - building translated packages will fail])
5285             add_warning "WiLangId.vbs not found - building translated packages will fail"
5286         fi
5287     fi
5289 AC_SUBST(WINDOWS_SDK_HOME)
5290 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5291 AC_SUBST(WINDOWS_SDK_VERSION)
5292 AC_SUBST(WINDOWS_SDK_WILANGID)
5294 if test "$build_os" = "cygwin"; then
5295     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5296     dnl dir, it also determines that dir's path w/o an arch segment if any,
5297     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5298     AC_MSG_CHECKING([for midl.exe])
5300     find_winsdk
5301     if test -n "$winsdkbinsubdir" \
5302         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5303     then
5304         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5305         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5306     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5307         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5308         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5309     elif test -f "$winsdktest/Bin/midl.exe"; then
5310         MIDL_PATH=$winsdktest/Bin
5311         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5312     fi
5313     if test ! -f "$MIDL_PATH/midl.exe"; then
5314         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5315     else
5316         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5317     fi
5319     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5320     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5322     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5323          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5324          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5325          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5326     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5327          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5328          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5329          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5330     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5331          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5332          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5333          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5334     else
5335         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5336     fi
5338     dnl Check csc.exe
5339     AC_MSG_CHECKING([for csc.exe])
5340     find_csc
5341     if test -f "$csctest/csc.exe"; then
5342         CSC_PATH="$csctest"
5343     fi
5344     if test ! -f "$CSC_PATH/csc.exe"; then
5345         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5346     else
5347         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5348     fi
5350     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5352     dnl Check al.exe
5353     AC_MSG_CHECKING([for al.exe])
5354     find_winsdk
5355     if test -n "$winsdkbinsubdir" \
5356         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5357     then
5358         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5359     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5360         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5361     elif test -f "$winsdktest/Bin/al.exe"; then
5362         AL_PATH="$winsdktest/Bin"
5363     fi
5365     if test -z "$AL_PATH"; then
5366         find_al
5367         if test -f "$altest/bin/al.exe"; then
5368             AL_PATH="$altest/bin"
5369         elif test -f "$altest/al.exe"; then
5370             AL_PATH="$altest"
5371         fi
5372     fi
5373     if test ! -f "$AL_PATH/al.exe"; then
5374         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5375     else
5376         AC_MSG_RESULT([$AL_PATH/al.exe])
5377     fi
5379     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5381     dnl Check mscoree.lib / .NET Framework dir
5382     AC_MSG_CHECKING(.NET Framework)
5383     find_dotnetsdk
5384     if test -f "$frametest/lib/mscoree.lib"; then
5385         DOTNET_FRAMEWORK_HOME="$frametest"
5386     else
5387         find_winsdk
5388         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5389             DOTNET_FRAMEWORK_HOME="$winsdktest"
5390         else
5391             find_dotnetsdk46
5392             PathFormat "$frametest"
5393             frametest="$formatted_path"
5394             if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5395                  DOTNET_FRAMEWORK_HOME="$frametest"
5396             fi
5397         fi
5398     fi
5400     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
5401         AC_MSG_ERROR([mscoree.lib not found])
5402     fi
5403     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5405     PathFormat "$MIDL_PATH"
5406     MIDL_PATH="$formatted_path"
5408     PathFormat "$AL_PATH"
5409     AL_PATH="$formatted_path"
5411     PathFormat "$DOTNET_FRAMEWORK_HOME"
5412     DOTNET_FRAMEWORK_HOME="$formatted_path"
5414     PathFormat "$CSC_PATH"
5415     CSC_PATH="$formatted_path"
5418 dnl ===================================================================
5419 dnl Check if stdc headers are available excluding MSVC.
5420 dnl ===================================================================
5421 if test "$_os" != "WINNT"; then
5422     AC_HEADER_STDC
5425 dnl ===================================================================
5426 dnl Testing for C++ compiler and version...
5427 dnl ===================================================================
5429 if test "$_os" != "WINNT"; then
5430     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5431     save_CXXFLAGS=$CXXFLAGS
5432     AC_PROG_CXX
5433     CXXFLAGS=$save_CXXFLAGS
5434 else
5435     if test -n "$CC" -a -z "$CXX"; then
5436         CXX="$CC"
5437     fi
5440 dnl At least MSVC 2015 Update 1 is known to sporadically emit warning C4592
5441 dnl ("implementation limitation" when defining OUStringLiteral variables in
5442 dnl vcl/source/app/IconThemeInfo.cxx), while Update 3 is known good, and it is
5443 dnl probably a good idea to require that anyway.  A reliable way to check for
5444 dnl MSVC 2015 Update 3 appears to be to check for support of C++17 nested
5445 dnl namespace definitions (which requires /std:c++latest to be enabled):
5446 if test "$COM" = MSC -a "$VCVER" = 140; then
5447     AC_MSG_CHECKING([whether MSVC 2015 compiler $MSVC_CXX is at least Update 3])
5448     save_CXX=$CXX
5449     save_CXXFLAGS=$CXXFLAGS
5450     CXX=$MSVC_CXX
5451     CXXFLAGS="$CXXFLAGS /std:c++latest"
5452     AC_LANG_PUSH([C++])
5453     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5454         namespace A::B {}
5455     ]])], [good=yes], [good=no])
5456     AC_LANG_POP([C++])
5457     CXX=$save_CXX
5458     CXXFLAGS=$save_CXXFLAGS
5459     AC_MSG_RESULT([$good])
5460     if test "$good" = no; then
5461         AC_MSG_ERROR([When using MSVC 2015, at least Update 3 must be installed])
5462     fi
5465 dnl check for GNU C++ compiler version
5466 if test "$GXX" = "yes"; then
5467     AC_MSG_CHECKING([the GNU C++ compiler version])
5469     _gpp_version=`$CXX -dumpversion`
5470     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5472     if test "$_gpp_majmin" -lt "401"; then
5473         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5474     else
5475         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5476     fi
5478     dnl see https://code.google.com/p/android/issues/detail?id=41770
5479     if test "$_gpp_majmin" -ge "401"; then
5480         glibcxx_threads=no
5481         AC_LANG_PUSH([C++])
5482         AC_REQUIRE_CPP
5483         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5484         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5485             #include <bits/c++config.h>]],[[
5486             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5487             && !defined(_GLIBCXX__PTHREADS) \
5488             && !defined(_GLIBCXX_HAS_GTHREADS)
5489             choke me
5490             #endif
5491         ]])],[AC_MSG_RESULT([yes])
5492         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5493         AC_LANG_POP([C++])
5494         if test $glibcxx_threads = yes; then
5495             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5496         fi
5497      fi
5499 AC_SUBST(BOOST_CXXFLAGS)
5502 # prefx CXX with ccache if needed
5504 if test "$CCACHE" != ""; then
5505     AC_MSG_CHECKING([whether $CXX is already ccached])
5506     AC_LANG_PUSH([C++])
5507     save_CXXFLAGS=$CXXFLAGS
5508     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5509     dnl an empty program will do, we're checking the compiler flags
5510     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5511                       [use_ccache=yes], [use_ccache=no])
5512     if test $use_ccache = yes; then
5513         AC_MSG_RESULT([yes])
5514     else
5515         CXX="$CCACHE $CXX"
5516         AC_MSG_RESULT([no])
5517     fi
5518     CXXFLAGS=$save_CXXFLAGS
5519     AC_LANG_POP([C++])
5522 dnl ===================================================================
5523 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5524 dnl ===================================================================
5526 if test "$_os" != "WINNT"; then
5527     AC_PROG_CXXCPP
5529     dnl Check whether there's a C pre-processor.
5530     AC_PROG_CPP
5534 dnl ===================================================================
5535 dnl Find integral type sizes and alignments
5536 dnl ===================================================================
5538 if test "$_os" != "WINNT"; then
5540 if test "$_os" == "iOS"; then
5541     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5542     ac_cv_sizeof_long=8
5543     ac_cv_sizeof_short=2
5544     ac_cv_sizeof_int=4
5545     ac_cv_sizeof_long_long=8
5546     ac_cv_sizeof_double=8
5547     ac_cv_sizeof_voidp=8
5548 else
5549     AC_CHECK_SIZEOF(long)
5550     AC_CHECK_SIZEOF(short)
5551     AC_CHECK_SIZEOF(int)
5552     AC_CHECK_SIZEOF(long long)
5553     AC_CHECK_SIZEOF(double)
5554     AC_CHECK_SIZEOF(void*)
5557     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5558     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5559     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5560     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5561     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5563     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5564     m4_pattern_allow([AC_CHECK_ALIGNOF])
5565     m4_ifdef([AC_CHECK_ALIGNOF],
5566         [
5567             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5568             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5569             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5570             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5571         ],
5572         [
5573             case "$_os-$host_cpu" in
5574             Linux-i686)
5575                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5576                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5577                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5578                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5579                 ;;
5580             Linux-x86_64)
5581                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5582                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5583                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5584                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5585                 ;;
5586             *)
5587                 if test -z "$ac_cv_alignof_short" -o \
5588                         -z "$ac_cv_alignof_int" -o \
5589                         -z "$ac_cv_alignof_long" -o \
5590                         -z "$ac_cv_alignof_double"; then
5591                    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.])
5592                 fi
5593                 ;;
5594             esac
5595         ])
5597     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5598     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5599     if test $ac_cv_sizeof_long -eq 8; then
5600         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5601     elif test $ac_cv_sizeof_double -eq 8; then
5602         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5603     else
5604         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5605     fi
5607     dnl Check for large file support
5608     AC_SYS_LARGEFILE
5609     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5610         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5611     fi
5612     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5613         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5614     fi
5615 else
5616     # Hardcode for MSVC
5617     SAL_TYPES_SIZEOFSHORT=2
5618     SAL_TYPES_SIZEOFINT=4
5619     SAL_TYPES_SIZEOFLONG=4
5620     SAL_TYPES_SIZEOFLONGLONG=8
5621     if test "$BITNESS_OVERRIDE" = ""; then
5622         SAL_TYPES_SIZEOFPOINTER=4
5623     else
5624         SAL_TYPES_SIZEOFPOINTER=8
5625     fi
5626     SAL_TYPES_ALIGNMENT2=2
5627     SAL_TYPES_ALIGNMENT4=4
5628     SAL_TYPES_ALIGNMENT8=8
5629     LFS_CFLAGS=''
5631 AC_SUBST(LFS_CFLAGS)
5633 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5634 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5635 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5636 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5637 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5638 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5639 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5640 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5642 dnl ===================================================================
5643 dnl Check whether to enable runtime optimizations
5644 dnl ===================================================================
5645 ENABLE_RUNTIME_OPTIMIZATIONS=
5646 AC_MSG_CHECKING([whether to enable runtime optimizations])
5647 if test -z "$enable_runtime_optimizations"; then
5648     for i in $CC; do
5649         case $i in
5650         -fsanitize=*)
5651             enable_runtime_optimizations=no
5652             break
5653             ;;
5654         esac
5655     done
5657 if test "$enable_runtime_optimizations" != no; then
5658     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5659     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5660     AC_MSG_RESULT([yes])
5661 else
5662     AC_MSG_RESULT([no])
5664 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5666 dnl ===================================================================
5667 dnl Check if valgrind headers are available
5668 dnl ===================================================================
5669 ENABLE_VALGRIND=
5670 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
5671     prev_cppflags=$CPPFLAGS
5672     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5673     # or where does it come from?
5674     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5675     AC_CHECK_HEADER([valgrind/valgrind.h],
5676         [ENABLE_VALGRIND=TRUE])
5677     CPPFLAGS=$prev_cppflags
5679 AC_SUBST([ENABLE_VALGRIND])
5680 if test -z "$ENABLE_VALGRIND"; then
5681     if test "$with_valgrind" = yes; then
5682         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
5683     fi
5684     VALGRIND_CFLAGS=
5686 AC_SUBST([VALGRIND_CFLAGS])
5689 dnl ===================================================================
5690 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5691 dnl ===================================================================
5693 # We need at least the sys/sdt.h include header.
5694 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5695 if test "$SDT_H_FOUND" = "TRUE"; then
5696     # Found sys/sdt.h header, now make sure the c++ compiler works.
5697     # Old g++ versions had problems with probes in constructors/destructors.
5698     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5699     AC_LANG_PUSH([C++])
5700     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5701     #include <sys/sdt.h>
5702     class ProbeClass
5703     {
5704     private:
5705       int& ref;
5706       const char *name;
5708     public:
5709       ProbeClass(int& v, const char *n) : ref(v), name(n)
5710       {
5711         DTRACE_PROBE2(_test_, cons, name, ref);
5712       }
5714       void method(int min)
5715       {
5716         DTRACE_PROBE3(_test_, meth, name, ref, min);
5717         ref -= min;
5718       }
5720       ~ProbeClass()
5721       {
5722         DTRACE_PROBE2(_test_, dest, name, ref);
5723       }
5724     };
5725     ]],[[
5726     int i = 64;
5727     DTRACE_PROBE1(_test_, call, i);
5728     ProbeClass inst = ProbeClass(i, "call");
5729     inst.method(24);
5730     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5731           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5732     AC_LANG_POP([C++])
5734 AC_CONFIG_HEADERS([config_host/config_probes.h])
5736 dnl ===================================================================
5737 dnl GCC features
5738 dnl ===================================================================
5739 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
5740     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5741     save_CFLAGS=$CFLAGS
5742     CFLAGS="$CFLAGS -Werror -mno-avx"
5743     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5744     CFLAGS=$save_CFLAGS
5745     if test "$HAVE_GCC_AVX" = "TRUE"; then
5746         AC_MSG_RESULT([yes])
5747     else
5748         AC_MSG_RESULT([no])
5749     fi
5751     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5752     save_CFLAGS=$CFLAGS
5753     CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
5754     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5755     CFLAGS=$save_CFLAGS
5756     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5757         AC_MSG_RESULT([yes])
5758     else
5759         AC_MSG_RESULT([no])
5760     fi
5762     AC_MSG_CHECKING([whether $CC supports atomic functions])
5763     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5764     int v = 0;
5765     if (__sync_add_and_fetch(&v, 1) != 1 ||
5766         __sync_sub_and_fetch(&v, 1) != 0)
5767         return 1;
5768     __sync_synchronize();
5769     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5770         v != 1)
5771         return 1;
5772     return 0;
5773 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5774     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5775         AC_MSG_RESULT([yes])
5776         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5777     else
5778         AC_MSG_RESULT([no])
5779     fi
5781     AC_MSG_CHECKING([whether $CC supports __builtin_ffs])
5782     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
5783     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
5784         AC_MSG_RESULT([yes])
5785         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
5786     else
5787         AC_MSG_RESULT([no])
5788     fi
5790     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5791     save_CFLAGS=$CFLAGS
5792     CFLAGS="$CFLAGS -Werror"
5793     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5794             __attribute__((deprecated("test"))) void f();
5795         ])], [
5796             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5797             AC_MSG_RESULT([yes])
5798         ], [AC_MSG_RESULT([no])])
5799     CFLAGS=$save_CFLAGS
5801     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
5802     AC_LANG_PUSH([C++])
5803     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5804             #include <cstddef>
5805             #include <cxxabi.h>
5806             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
5807         ])], [
5808             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
5809             AC_MSG_RESULT([yes])
5810         ], [AC_MSG_RESULT([no])])
5811     AC_LANG_POP([C++])
5813     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
5814     AC_LANG_PUSH([C++])
5815     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5816             #include <cstddef>
5817             #include <cxxabi.h>
5818             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
5819         ])], [
5820             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
5821             AC_MSG_RESULT([yes])
5822         ], [AC_MSG_RESULT([no])])
5823     AC_LANG_POP([C++])
5825     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
5826     AC_LANG_PUSH([C++])
5827     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5828             #include <cxxabi.h>
5829             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
5830         ])], [
5831             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
5832             AC_MSG_RESULT([yes])
5833         ], [AC_MSG_RESULT([no])])
5834     AC_LANG_POP([C++])
5836     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
5837     AC_LANG_PUSH([C++])
5838     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5839             #include <cstddef>
5840             #include <cxxabi.h>
5841             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
5842         ])], [
5843             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
5844             AC_MSG_RESULT([yes])
5845         ], [AC_MSG_RESULT([no])])
5846     AC_LANG_POP([C++])
5848     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
5849     AC_LANG_PUSH([C++])
5850     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5851             #include <cstddef>
5852             #include <cxxabi.h>
5853             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
5854         ])], [
5855             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
5856             AC_MSG_RESULT([yes])
5857         ], [AC_MSG_RESULT([no])])
5858     AC_LANG_POP([C++])
5860     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
5861     AC_LANG_PUSH([C++])
5862     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5863             #include <cxxabi.h>
5864             void * f() { return __cxxabiv1::__cxa_get_globals(); }
5865         ])], [
5866             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
5867             AC_MSG_RESULT([yes])
5868         ], [AC_MSG_RESULT([no])])
5869     AC_LANG_POP([C++])
5871     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
5872     AC_LANG_PUSH([C++])
5873     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5874             #include <cxxabi.h>
5875             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
5876         ])], [
5877             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
5878             AC_MSG_RESULT([yes])
5879         ], [AC_MSG_RESULT([no])])
5880     AC_LANG_POP([C++])
5882     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
5883     AC_LANG_PUSH([C++])
5884     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5885             #include <cstddef>
5886             #include <cxxabi.h>
5887             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
5888         ])], [
5889             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
5890             AC_MSG_RESULT([yes])
5891         ], [AC_MSG_RESULT([no])])
5892     AC_LANG_POP([C++])
5894     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
5895     AC_LANG_PUSH([C++])
5896     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5897             #include <cstddef>
5898             #include <cxxabi.h>
5899             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
5900         ])], [
5901             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
5902             AC_MSG_RESULT([yes])
5903         ], [AC_MSG_RESULT([no])])
5904     AC_LANG_POP([C++])
5906     dnl Available in GCC 4.9 and at least in Clang 3.4 (which is the baseline
5907     dnl for at least --enable-compiler-plugins according to README.md):
5908     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
5909     AC_LANG_PUSH([C++])
5910     save_CXXFLAGS=$CXXFLAGS
5911     CXXFLAGS="$CXXFLAGS -Werror -Wunknown-pragmas"
5912     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5913             struct __attribute__((warn_unused)) dummy {};
5914         ])], [
5915             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
5916             AC_MSG_RESULT([yes])
5917         ], [AC_MSG_RESULT([no])])
5918     CXXFLAGS=$save_CXXFLAGS
5919 AC_LANG_POP([C++])
5922 AC_SUBST(HAVE_GCC_AVX)
5923 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
5924 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
5925 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
5927 dnl ===================================================================
5928 dnl Identify the C++ library
5929 dnl ===================================================================
5931 AC_MSG_CHECKING([What the C++ library is])
5932 AC_LANG_PUSH([C++])
5933 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5934 #include <utility>
5935 #ifndef __GLIBCXX__
5936 foo bar
5937 #endif
5938 ]])],
5939     [CPP_LIBRARY=GLIBCXX
5940      cpp_library_name="GNU libstdc++"
5941     ],
5942     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5943 #include <utility>
5944 #ifndef _LIBCPP_VERSION
5945 foo bar
5946 #endif
5947 ]])],
5948     [CPP_LIBRARY=LIBCPP
5949      cpp_library_name="LLVM libc++"
5950     ],
5951     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5952 #include <utility>
5953 #ifndef _MSC_VER
5954 foo bar
5955 #endif
5956 ]])],
5957     [CPP_LIBRARY=MSVCRT
5958      cpp_library_name="Microsoft"
5959     ],
5960     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
5961 AC_MSG_RESULT([$cpp_library_name])
5962 AC_LANG_POP([C++])
5964 dnl ===================================================================
5965 dnl Check for gperf
5966 dnl ===================================================================
5967 AC_PATH_PROG(GPERF, gperf)
5968 if test -z "$GPERF"; then
5969     AC_MSG_ERROR([gperf not found but needed. Install it.])
5971 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5972     GPERF=`cygpath -m $GPERF`
5974 AC_MSG_CHECKING([gperf version])
5975 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
5976     AC_MSG_RESULT([OK])
5977 else
5978     AC_MSG_ERROR([too old, you need at least 3.0.0])
5980 AC_SUBST(GPERF)
5982 dnl ===================================================================
5983 dnl C++11
5984 dnl ===================================================================
5986 my_cxx17switches=
5987 libo_FUZZ_ARG_ENABLE(c++17,
5988     AS_HELP_STRING([--disable-c++17],
5989         [Do not attempt to run GCC/Clang in C++17 mode (needed for Coverity).])
5992 CXXFLAGS_CXX11=
5993 if test "$COM" = MSC; then
5994     AC_MSG_CHECKING([whether $CXX supports C++11])
5995     AC_MSG_RESULT(yes)
5996     # MSVC supports (a subset of) CXX11 without any switch
5997 elif test "$GCC" = "yes"; then
5998     HAVE_CXX11=
5999     AC_MSG_CHECKING([whether $CXX supports C++17, C++14, or C++11])
6000     dnl But only use C++17 if the gperf that is being used knows not to emit
6001     dnl "register" in C++ output:
6002     printf 'foo\n' | $GPERF -L C++ > conftest.inc
6003     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'
6004     if test "$enable_c__17" != no; then
6005         my_flags="-std=gnu++17 -std=gnu++1z -std=c++17 -std=c++1z $my_flags"
6006     fi
6007     for flag in $my_flags; do
6008         save_CXXFLAGS=$CXXFLAGS
6009         CXXFLAGS="$CXXFLAGS $flag -Werror"
6010         AC_LANG_PUSH([C++])
6011         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6012             #include <algorithm>
6013             #include <functional>
6014             #include <vector>
6016             #include <string.h>
6017             #pragma GCC diagnostic push
6018             #pragma GCC diagnostic ignored "-Wpragmas"
6019                 // make GCC not warn about next pragma
6020             #pragma GCC diagnostic ignored "-Wdeprecated-register"
6021                 // make Clang with -std < C++17 not even warn about register
6022             #include "conftest.inc"
6023             #pragma GCC diagnostic pop
6025             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6026                 std::sort(v.begin(), v.end(), fn);
6027             }
6028             ]])],[CXXFLAGS_CXX11=$flag])
6029         AC_LANG_POP([C++])
6030         CXXFLAGS=$save_CXXFLAGS
6031         if test -n "$CXXFLAGS_CXX11"; then
6032             HAVE_CXX11=TRUE
6033             break
6034         fi
6035     done
6036     rm conftest.inc
6037     if test "$HAVE_CXX11" = TRUE; then
6038         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6039     else
6040         AC_MSG_ERROR(no)
6041     fi
6044 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6045 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6046 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6047 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6048 dnl again towards 4.7.2:
6049 if test $CPP_LIBRARY = GLIBCXX; then
6050     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6051     AC_LANG_PUSH([C++])
6052     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6053 #include <list>
6054 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6055     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6056     //   GCC 4.7.0: 20120322
6057     //   GCC 4.7.1: 20120614
6058     // and using a range check is not possible as the mapping between
6059     // __GLIBCXX__ values and GCC versions is not monotonic
6060 /* ok */
6061 #else
6062 abi broken
6063 #endif
6064         ]])], [AC_MSG_RESULT(no, ok)],
6065         [AC_MSG_ERROR(yes)])
6066     AC_LANG_POP([C++])
6069 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6070 save_CXXFLAGS=$CXXFLAGS
6071 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6072 AC_LANG_PUSH([C++])
6074 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6075 #include <stddef.h>
6077 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6079 namespace
6081         struct b
6082         {
6083                 int i;
6084                 int j;
6085         };
6087 ]], [[
6088 struct a
6090         int i;
6091         int j;
6093 a thinga[]={{0,0}, {1,1}};
6094 b thingb[]={{0,0}, {1,1}};
6095 size_t i = sizeof(sal_n_array_size(thinga));
6096 size_t j = sizeof(sal_n_array_size(thingb));
6097 return !(i != 0 && j != 0);
6099     ], [ AC_MSG_RESULT(yes) ],
6100     [ AC_MSG_ERROR(no)])
6101 AC_LANG_POP([C++])
6102 CXXFLAGS=$save_CXXFLAGS
6104 dnl Clang 3.9 supports __float128 since
6105 dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6106 dnl __float128 in Clang and enable it on pertinent platforms":
6107 AC_MSG_CHECKING([whether $CXX supports C++11 without __float128 compile error])
6108 save_CXXFLAGS=$CXXFLAGS
6109 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6110 AC_LANG_PUSH([C++])
6112 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6113 #include <vector>
6114     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6115     // (__float128)
6117     ],[ AC_MSG_RESULT(yes) ],
6118     [
6119         AC_MSG_RESULT(no)
6120         # The only reason why libstdc++ headers fail with Clang in C++11 mode is because
6121         # they use the __float128 type that Clang doesn't know (libstdc++ checks whether
6122         # __float128 is available during its build, but it's usually built using GCC,
6123         # and so c++config.h hardcodes __float128 being supported). As the only place
6124         # where __float128 is actually used is in a template specialization,
6125         # -D__float128=void will avoid the problem there while still causing a problem
6126         # if somebody actually uses the type.
6127         AC_MSG_CHECKING([whether -D__float128=void workaround helps])
6128         CXXFLAGS="$CXXFLAGS -D__float128=void"
6129         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6130 #include <vector>
6131     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6132     // (__float128)
6134     ],
6135     [
6136      AC_MSG_RESULT(yes)
6137      CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -D__float128=void"
6138     ],
6139     [
6140      AC_MSG_ERROR(no)
6141     ])
6144 AC_LANG_POP([C++])
6145 CXXFLAGS=$save_CXXFLAGS
6147 AC_SUBST(CXXFLAGS_CXX11)
6149 AC_MSG_CHECKING([whether $CXX supports C++14 constexpr])
6150 save_CXXFLAGS=$CXXFLAGS
6151 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6152 AC_LANG_PUSH([C++])
6153 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6154     // A somewhat over-complicated way of checking for
6155     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6156     // in constexpr function":
6157     #include <cassert>
6158     template<typename T> inline constexpr T f(T x) { return x; }
6159     template<typename T> inline constexpr T g(T x) {
6160         assert(f(static_cast<int>(x)));
6161         return x;
6162     }
6163     enum E { e };
6164     auto v = g(E::e);
6166     struct S {
6167         int n_;
6168         constexpr bool f() {
6169             int n = n_;
6170             int i = 0;
6171             while (n > 0) { --n; ++i; }
6172             assert(i >= 0);
6173             return i == 0;
6174         }
6175     };
6176     constexpr auto v2 = S{10}.f();
6177     ]])], [cxx14_constexpr=yes], [cxx14_constexpr=no])
6178 AC_LANG_POP([C++])
6179 CXXFLAGS=$save_CXXFLAGS
6180 AC_MSG_RESULT([$cxx14_constexpr])
6181 if test "$cxx14_constexpr" = yes; then
6182     AC_DEFINE([HAVE_CXX14_CONSTEXPR])
6185 dnl _Pragma support (may require C++11)
6186 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6187     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6188     AC_LANG_PUSH([C++])
6189     save_CXXFLAGS=$CXXFLAGS
6190     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6191     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6192             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6193         ])], [
6194             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6195             AC_MSG_RESULT([yes])
6196         ], [AC_MSG_RESULT([no])])
6197     AC_LANG_POP([C++])
6198     CXXFLAGS=$save_CXXFLAGS
6201 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6202 if test "$GCC" = yes; then
6203     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6204     AC_LANG_PUSH([C++])
6205     save_CXXFLAGS=$CXXFLAGS
6206     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6207     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6208     CXXFLAGS=$save_CXXFLAGS
6209     AC_LANG_POP([C++])
6210     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6211         AC_MSG_RESULT([yes])
6212     else
6213         AC_MSG_RESULT([no])
6214     fi
6216 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6218 dnl ===================================================================
6219 dnl system stl sanity tests
6220 dnl ===================================================================
6221 if test "$_os" != "WINNT"; then
6223     AC_LANG_PUSH([C++])
6225     save_CPPFLAGS="$CPPFLAGS"
6226     if test -n "$MACOSX_SDK_PATH"; then
6227         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6228     fi
6230     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6231     # only.
6232     if test "$CPP_LIBRARY" = GLIBCXX; then
6233         dnl gcc#19664, gcc#22482, rhbz#162935
6234         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6235         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6236         AC_MSG_RESULT([$stlvisok])
6237         if test "$stlvisok" = "no"; then
6238             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6239         fi
6240     fi
6242     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6243     # when we don't make any dynamic libraries?
6244     if test "$DISABLE_DYNLOADING" = ""; then
6245         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6246         cat > conftestlib1.cc <<_ACEOF
6247 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6248 struct S2: S1<int> { virtual ~S2(); };
6249 S2::~S2() {}
6250 _ACEOF
6251         cat > conftestlib2.cc <<_ACEOF
6252 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6253 struct S2: S1<int> { virtual ~S2(); };
6254 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6255 _ACEOF
6256         gccvisinlineshiddenok=yes
6257         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6258             gccvisinlineshiddenok=no
6259         else
6260             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6261             dnl known to not work with -z defs (unsetting which makes the test
6262             dnl moot, though):
6263             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6264             if test "$COM_IS_CLANG" = TRUE; then
6265                 for i in $CXX $CXXFLAGS; do
6266                     case $i in
6267                     -fsanitize=*)
6268                         my_linkflagsnoundefs=
6269                         break
6270                         ;;
6271                     esac
6272                 done
6273             fi
6274             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6275                 gccvisinlineshiddenok=no
6276             fi
6277         fi
6279         rm -fr libconftest*
6280         AC_MSG_RESULT([$gccvisinlineshiddenok])
6281         if test "$gccvisinlineshiddenok" = "no"; then
6282             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6283         fi
6284     fi
6286    AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6287     cat >visibility.cxx <<_ACEOF
6288 #pragma GCC visibility push(hidden)
6289 struct __attribute__ ((visibility ("default"))) TestStruct {
6290   static void Init();
6292 __attribute__ ((visibility ("default"))) void TestFunc() {
6293   TestStruct::Init();
6295 _ACEOF
6296     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6297         gccvisbroken=yes
6298     else
6299         case "$host_cpu" in
6300         i?86|x86_64)
6301             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6302                 gccvisbroken=no
6303             else
6304                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6305                     gccvisbroken=no
6306                 else
6307                     gccvisbroken=yes
6308                 fi
6309             fi
6310             ;;
6311         *)
6312             gccvisbroken=no
6313             ;;
6314         esac
6315     fi
6316     rm -f visibility.s visibility.cxx
6318     AC_MSG_RESULT([$gccvisbroken])
6319     if test "$gccvisbroken" = "yes"; then
6320         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6321     fi
6323     CPPFLAGS="$save_CPPFLAGS"
6325     AC_LANG_POP([C++])
6328 dnl ===================================================================
6329 dnl  Clang++ tests
6330 dnl ===================================================================
6332 HAVE_GCC_FNO_DEFAULT_INLINE=
6333 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6334 if test "$GCC" = "yes"; then
6335     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6336     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6337         # Option just ignored and silly warning that isn't a real
6338         # warning printed
6339         :
6340     else
6341         AC_LANG_PUSH([C++])
6342         save_CXXFLAGS=$CXXFLAGS
6343         CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6344         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6345         CXXFLAGS=$save_CXXFLAGS
6346         AC_LANG_POP([C++])
6347     fi
6348     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6349         AC_MSG_RESULT([yes])
6350     else
6351         AC_MSG_RESULT([no])
6352     fi
6354     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6355     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6356         # As above
6357         :
6358     else
6359         AC_LANG_PUSH([C++])
6360         save_CXXFLAGS=$CXXFLAGS
6361         CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6362         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6363         CXXFLAGS=$save_CXXFLAGS
6364         AC_LANG_POP([C++])
6365     fi
6366     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6367         AC_MSG_RESULT([yes])
6368     else
6369         AC_MSG_RESULT([no])
6370     fi
6372 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6373 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6375 dnl ===================================================================
6376 dnl Compiler plugins
6377 dnl ===================================================================
6379 COMPILER_PLUGINS=
6380 # currently only Clang
6382 if test "$COM_IS_CLANG" != "TRUE"; then
6383     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6384         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6385         enable_compiler_plugins=no
6386     fi
6389 if test "$COM_IS_CLANG" = "TRUE"; then
6390     if test -n "$enable_compiler_plugins"; then
6391         compiler_plugins="$enable_compiler_plugins"
6392     elif test -n "$ENABLE_DBGUTIL"; then
6393         compiler_plugins=test
6394     else
6395         compiler_plugins=no
6396     fi
6397     if test "$compiler_plugins" != "no"; then
6398         dnl The prefix where Clang resides, override to where Clang resides if
6399         dnl using a source build:
6400         if test -z "$CLANGDIR"; then
6401             CLANGDIR=/usr
6402         fi
6403         AC_LANG_PUSH([C++])
6404         save_CPPFLAGS=$CPPFLAGS
6405         save_CXX=$CXX
6406         # compiler plugins must be built with "native" bitness of clang
6407         # because they link against clang libraries
6408         CXX=${COMPILER_PLUGINS_CXX-$(echo $CXX | sed -e s/-m64// -e s/-m32//)}
6409         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6410         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6411             [COMPILER_PLUGINS=TRUE],
6412             [
6413             if test "$compiler_plugins" = "yes"; then
6414                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6415             else
6416                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6417                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6418             fi
6419             ])
6420         CXX=$save_CXX
6421         CPPFLAGS=$save_CPPFLAGS
6422         AC_LANG_POP([C++])
6423     fi
6424 else
6425     if test "$enable_compiler_plugins" = "yes"; then
6426         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6427     fi
6429 AC_SUBST(COMPILER_PLUGINS)
6430 AC_SUBST(COMPILER_PLUGINS_CXX)
6431 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
6432 AC_SUBST(CLANGDIR)
6433 AC_SUBST(CLANGLIBDIR)
6435 # Plugin to help linker.
6436 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6437 # This makes --enable-lto build with clang work.
6438 AC_SUBST(LD_PLUGIN)
6440 dnl ===================================================================
6441 dnl allocator
6442 dnl ===================================================================
6443 AC_MSG_CHECKING([which memory allocator to use])
6444 if test "$with_alloc" = "system"; then
6445     AC_MSG_RESULT([system])
6446     ALLOC="SYS_ALLOC"
6448 if test "$with_alloc" = "tcmalloc"; then
6449     AC_MSG_RESULT(tcmalloc)
6450     if ! echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6451         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
6452     fi
6453     AC_CHECK_LIB([tcmalloc], [malloc], [:],
6454         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
6455     ALLOC="TCMALLOC"
6457 if test "$with_alloc" = "jemalloc"; then
6458     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
6459         AC_MSG_RESULT(jemalloc)
6460         save_CFLAGS=$CFLAGS
6461         CFLAGS="$CFLAGS -pthread"
6462         AC_CHECK_LIB([jemalloc], [malloc], [:],
6463             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
6464         ALLOC="JEMALLOC"
6465         CFLAGS=$save_CFLAGS
6466     else
6467         AC_MSG_RESULT([system])
6468         ALLOC="SYS_ALLOC"
6469     fi
6471 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6472     AC_MSG_RESULT([internal])
6474 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6475 AC_SUBST(HAVE_POSIX_FALLOCATE)
6476 AC_SUBST(ALLOC)
6478 dnl ===================================================================
6479 dnl Custom build version
6480 dnl ===================================================================
6482 AC_MSG_CHECKING([whether to add custom build version])
6483 if test "$with_build_version" != ""; then
6484     BUILD_VER_STRING=$with_build_version
6485     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6486 else
6487     BUILD_VER_STRING=
6488     AC_MSG_RESULT([no])
6490 AC_SUBST(BUILD_VER_STRING)
6492 JITC_PROCESSOR_TYPE=""
6493 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6494     # IBMs JDK needs this...
6495     JITC_PROCESSOR_TYPE=6
6496     export JITC_PROCESSOR_TYPE
6498 AC_SUBST([JITC_PROCESSOR_TYPE])
6500 # Misc Windows Stuff
6501 AC_ARG_WITH(ucrt-dir,
6502     AS_HELP_STRING([--with-ucrt-dir],
6503         [path to the directory with the arch-specific subdirectories of the Windows Universal CRT redistributables
6504         from the Windows 10 SDK for packaging into the installsets (without those the target system needs to install
6505         the Visual C++ Runtimes manually)]),
6507 UCRT_REDISTDIR="$with_ucrt_dir"
6508 if test $_os = "WINNT"; then
6509     find_msvc_x64_dlls
6510     find_msms
6511     MSVC_DLL_PATH="$msvcdllpath"
6512     MSVC_DLLS="$msvcdlls"
6513     MSM_PATH="$msmdir"
6514     SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6515     if test "$UCRT_REDISTDIR" = "no"; then
6516         dnl explicitly disabled
6517         UCRT_REDISTDIR=""
6518     else
6519         UCRT_REDISTDIR="$UCRT_REDISTDIR/$WINDOWS_SDK_ARCH"
6520         # https://blogs.msdn.microsoft.com/vcblog/2015/03/03/introducing-the-universal-crt/
6521         # "note that the set of DLLs are necessary is different on different
6522         #  versions of Windows, so you must include all of the DLLs in order for
6523         #  your program to run on all supported versions of Windows"
6524         if test -f "$UCRT_REDISTDIR/ucrtbase.dll"; then
6525             cd "$UCRT_REDISTDIR";
6526             UCRT_DLLS=$(ls *.dll | paste -d " " -s)
6527             cd -
6528         else
6529             UCRT_REDISTDIR=""
6530             if test -n "$PKGFORMAT"; then
6531                for i in "$PKGFORMAT"; do
6532                    case "$i" in
6533                    msi)
6534                        AC_MSG_WARN([--without-ucrt-dir not specified or dlls not found - installer will have runtime dependency])
6535                        add_warning "--without-ucrt-dir not specified or dlls not found - installer will have runtime dependency"
6536                        ;;
6537                    esac
6538                done
6539             fi
6540         fi
6541     fi
6544 AC_SUBST(UCRT_REDISTDIR)
6545 AC_SUBST(UCRT_DLLS)
6546 AC_SUBST(MSVC_DLL_PATH)
6547 AC_SUBST(MSVC_DLLS)
6548 AC_SUBST(MSM_PATH)
6550 dnl ===================================================================
6551 dnl Checks for Java
6552 dnl ===================================================================
6553 if test "$ENABLE_JAVA" != ""; then
6555     # Windows-specific tests
6556     if test "$build_os" = "cygwin"; then
6557         if test "$BITNESS_OVERRIDE" = 64; then
6558             bitness=64
6559         else
6560             bitness=32
6561         fi
6563         if test -z "$with_jdk_home"; then
6564             for ver in 1.8 1.7 1.6; do
6565                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6566                 if test -n "$regvalue"; then
6567                     _jdk_home=$regvalue
6568                     break
6569                 fi
6570             done
6571             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6572                 with_jdk_home="$_jdk_home"
6573                 howfound="found automatically"
6574             else
6575                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6576             fi
6577         else
6578             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6579             howfound="you passed"
6580         fi
6581     fi
6583     # 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.
6584     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6585     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6586         with_jdk_home=`/usr/libexec/java_home`
6587     fi
6589     JAVA_HOME=; export JAVA_HOME
6590     if test -z "$with_jdk_home"; then
6591         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6592     else
6593         _java_path="$with_jdk_home/bin/$with_java"
6594         dnl Check if there is a Java interpreter at all.
6595         if test -x "$_java_path"; then
6596             JAVAINTERPRETER=$_java_path
6597         else
6598             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6599         fi
6600     fi
6602     dnl Check that the JDK found is correct architecture (at least 2 reasons to
6603     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
6604     dnl loaded by java to run JunitTests:
6605     if test "$build_os" = "cygwin"; then
6606         shortjdkhome=`cygpath -d "$with_jdk_home"`
6607         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
6608             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6609             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6610         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
6611             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6612             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6613         fi
6615         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6616             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6617         fi
6618         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6619     elif test "$cross_compiling" != "yes"; then
6620         case $CPUNAME in
6621             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
6622                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6623                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6624                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6625                 fi
6626                 ;;
6627             *) # assumption: everything else 32-bit
6628                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6629                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6630                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6631                 fi
6632                 ;;
6633         esac
6634     fi
6637 HAVE_JAVA9=
6638 dnl ===================================================================
6639 dnl Checks for JDK.
6640 dnl ===================================================================
6642 # Note that JAVA_HOME as for now always means the *build* platform's
6643 # JAVA_HOME. Whether all the complexity here actually is needed any
6644 # more or not, no idea.
6646 if test "$ENABLE_JAVA" != ""; then
6647     _gij_longver=0
6648     AC_MSG_CHECKING([the installed JDK])
6649     if test -n "$JAVAINTERPRETER"; then
6650         dnl java -version sends output to stderr!
6651         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6652             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6653         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6654             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6655         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6656             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6657         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6658             JDK=ibm
6660             dnl IBM JDK specific tests
6661             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6662             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6664             if test "$_jdk_ver" -lt 10600; then
6665                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
6666             fi
6668             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6670             if test "$with_jdk_home" = ""; then
6671                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6672 you must use the "--with-jdk-home" configure option explicitly])
6673             fi
6675             JAVA_HOME=$with_jdk_home
6676         else
6677             JDK=sun
6679             dnl Sun JDK specific tests
6680             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6681             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6683             if test "$_jdk_ver" -lt 10600; then
6684                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
6685             fi
6686             if test "$_jdk_ver" -gt 10600; then
6687                 JAVA_CLASSPATH_NOT_SET=TRUE
6688             fi
6689             if test "$_jdk_ver" -ge 10900; then
6690                 HAVE_JAVA9=TRUE
6691             fi
6693             AC_MSG_RESULT([checked (JDK $_jdk)])
6694             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6695             if test "$_os" = "WINNT"; then
6696                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6697             fi
6699             # set to limit VM usage for JunitTests
6700             JAVAIFLAGS=-Xmx64M
6701             # set to limit VM usage for javac
6702             JAVAFLAGS=-J-Xmx128M
6703         fi
6704     else
6705         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
6706     fi
6707 else
6708     dnl Java disabled
6709     JAVA_HOME=
6710     export JAVA_HOME
6713 dnl ===================================================================
6714 dnl Set target Java bytecode version
6715 dnl ===================================================================
6716 if test "$ENABLE_JAVA" != ""; then
6717     if test "$HAVE_JAVA9" = "TRUE"; then
6718         _java_target_ver="1.6"
6719     else
6720         _java_target_ver="1.5"
6721     fi
6722     JAVA_SOURCE_VER="$_java_target_ver"
6723     JAVA_TARGET_VER="$_java_target_ver"
6726 dnl ===================================================================
6727 dnl Checks for javac
6728 dnl ===================================================================
6729 if test "$ENABLE_JAVA" != ""; then
6730     javacompiler="javac"
6731     if test -z "$with_jdk_home"; then
6732         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6733     else
6734         _javac_path="$with_jdk_home/bin/$javacompiler"
6735         dnl Check if there is a Java compiler at all.
6736         if test -x "$_javac_path"; then
6737             JAVACOMPILER=$_javac_path
6738         fi
6739     fi
6740     if test -z "$JAVACOMPILER"; then
6741         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6742     fi
6743     if test "$build_os" = "cygwin"; then
6744         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6745             JAVACOMPILER="${JAVACOMPILER}.exe"
6746         fi
6747         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
6748     fi
6751 dnl ===================================================================
6752 dnl Checks for javadoc
6753 dnl ===================================================================
6754 if test "$ENABLE_JAVA" != ""; then
6755     if test -z "$with_jdk_home"; then
6756         AC_PATH_PROG(JAVADOC, javadoc)
6757     else
6758         _javadoc_path="$with_jdk_home/bin/javadoc"
6759         dnl Check if there is a javadoc at all.
6760         if test -x "$_javadoc_path"; then
6761             JAVADOC=$_javadoc_path
6762         else
6763             AC_PATH_PROG(JAVADOC, javadoc)
6764         fi
6765     fi
6766     if test -z "$JAVADOC"; then
6767         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6768     fi
6769     if test "$build_os" = "cygwin"; then
6770         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6771             JAVADOC="${JAVADOC}.exe"
6772         fi
6773         JAVADOC=`win_short_path_for_make "$JAVADOC"`
6774     fi
6776     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6777     JAVADOCISGJDOC="yes"
6778     fi
6780 AC_SUBST(JAVADOCISGJDOC)
6782 if test "$ENABLE_JAVA" != ""; then
6783     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
6784     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
6785         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
6786            # try to recover first by looking whether we have a alternatives
6787            # system as in Debian or newer SuSEs where following /usr/bin/javac
6788            # over /etc/alternatives/javac leads to the right bindir where we
6789            # just need to strip a bit away to get a valid JAVA_HOME
6790            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
6791         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
6792             # maybe only one level of symlink (e.g. on Mac)
6793             JAVA_HOME=$(readlink $JAVACOMPILER)
6794             if test "$(dirname $JAVA_HOME)" = "."; then
6795                 # we've got no path to trim back
6796                 JAVA_HOME=""
6797             fi
6798         else
6799             # else warn
6800             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
6801             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
6802             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
6803             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
6804         fi
6805         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
6806         if test "$JAVA_HOME" != "/usr"; then
6807             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6808                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
6809                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
6810                 dnl Tiger already returns a JDK path..
6811                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
6812             else
6813                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
6814                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
6815                 dnl that checks which version to run
6816                 if test -f "$JAVA_HOME"; then
6817                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
6818                 fi
6819             fi
6820         fi
6821     fi
6822     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
6824     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
6825     if test -z "$JAVA_HOME"; then
6826         if test "x$with_jdk_home" = "x"; then
6827             cat > findhome.java <<_ACEOF
6828 [import java.io.File;
6830 class findhome
6832     public static void main(String args[])
6833     {
6834         String jrelocation = System.getProperty("java.home");
6835         File jre = new File(jrelocation);
6836         System.out.println(jre.getParent());
6837     }
6839 _ACEOF
6840             AC_MSG_CHECKING([if javac works])
6841             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
6842             AC_TRY_EVAL(javac_cmd)
6843             if test $? = 0 -a -f ./findhome.class; then
6844                 AC_MSG_RESULT([javac works])
6845             else
6846                 echo "configure: javac test failed" >&5
6847                 cat findhome.java >&5
6848                 AC_MSG_ERROR([javac does not work - java projects will not build!])
6849             fi
6850             AC_MSG_CHECKING([if gij knows its java.home])
6851             JAVA_HOME=`$JAVAINTERPRETER findhome`
6852             if test $? = 0 -a "$JAVA_HOME" != ""; then
6853                 AC_MSG_RESULT([$JAVA_HOME])
6854             else
6855                 echo "configure: java test failed" >&5
6856                 cat findhome.java >&5
6857                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
6858             fi
6859             # clean-up after ourselves
6860             rm -f ./findhome.java ./findhome.class
6861         else
6862             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
6863         fi
6864     fi
6866     # now check if $JAVA_HOME is really valid
6867     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6868         case "${JAVA_HOME}" in
6869             /Library/Java/JavaVirtualMachines/*)
6870                 ;;
6871             *)
6872                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
6873                 ;;
6874         esac
6875         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
6876             JAVA_HOME_OK="NO"
6877         fi
6878     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
6879         JAVA_HOME_OK="NO"
6880     fi
6881     if test "$JAVA_HOME_OK" = "NO"; then
6882         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
6883         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
6884         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
6885         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
6886         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
6887         add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
6888     fi
6889     PathFormat "$JAVA_HOME"
6890     JAVA_HOME="$formatted_path"
6893 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
6894     "$_os" != Darwin
6895 then
6896     AC_MSG_CHECKING([for JAWT lib])
6897     if test "$_os" = WINNT; then
6898         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
6899         JAWTLIB=jawt.lib
6900     else
6901         case "$host_cpu" in
6902         arm*)
6903             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
6904             JAVA_ARCH=$my_java_arch
6905             ;;
6906         i*86)
6907             my_java_arch=i386
6908             ;;
6909         m68k)
6910             my_java_arch=m68k
6911             ;;
6912         powerpc)
6913             my_java_arch=ppc
6914             ;;
6915         powerpc64)
6916             my_java_arch=ppc64
6917             ;;
6918         powerpc64le)
6919             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
6920             JAVA_ARCH=$my_java_arch
6921             ;;
6922         sparc64)
6923             my_java_arch=sparcv9
6924             ;;
6925         x86_64)
6926             my_java_arch=amd64
6927             ;;
6928         *)
6929             my_java_arch=$host_cpu
6930             ;;
6931         esac
6932         # This is where JDK9 puts the library
6933         if test -e "$JAVA_HOME/lib/libjawt.so"; then
6934             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
6935         else
6936             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
6937         fi
6938         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
6939     fi
6940     AC_MSG_RESULT([$JAWTLIB])
6942 AC_SUBST(JAWTLIB)
6944 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
6945     case "$host_os" in
6947     aix*)
6948         JAVAINC="-I$JAVA_HOME/include"
6949         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
6950         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6951         ;;
6953     cygwin*)
6954         JAVAINC="-I$JAVA_HOME/include/win32"
6955         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
6956         ;;
6958     darwin*)
6959         if test -d "$JAVA_HOME/include/darwin"; then
6960             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
6961         else
6962             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
6963         fi
6964         ;;
6966     dragonfly*)
6967         JAVAINC="-I$JAVA_HOME/include"
6968         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6969         ;;
6971     freebsd*)
6972         JAVAINC="-I$JAVA_HOME/include"
6973         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
6974         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
6975         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
6976         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6977         ;;
6979     k*bsd*-gnu*)
6980         JAVAINC="-I$JAVA_HOME/include"
6981         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
6982         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6983         ;;
6985     linux-gnu*)
6986         JAVAINC="-I$JAVA_HOME/include"
6987         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
6988         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6989         ;;
6991     *netbsd*)
6992         JAVAINC="-I$JAVA_HOME/include"
6993         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
6994         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6995        ;;
6997     openbsd*)
6998         JAVAINC="-I$JAVA_HOME/include"
6999         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7000         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7001         ;;
7003     solaris*)
7004         JAVAINC="-I$JAVA_HOME/include"
7005         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7006         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7007         ;;
7008     esac
7010 SOLARINC="$SOLARINC $JAVAINC"
7012 AC_SUBST(JAVACOMPILER)
7013 AC_SUBST(JAVADOC)
7014 AC_SUBST(JAVAINTERPRETER)
7015 AC_SUBST(JAVAIFLAGS)
7016 AC_SUBST(JAVAFLAGS)
7017 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7018 AC_SUBST(JAVA_HOME)
7019 AC_SUBST(JAVA_SOURCE_VER)
7020 AC_SUBST(JAVA_TARGET_VER)
7021 AC_SUBST(JDK)
7024 dnl ===================================================================
7025 dnl Export file validation
7026 dnl ===================================================================
7027 AC_MSG_CHECKING([whether to enable export file validation])
7028 if test "$with_export_validation" != "no"; then
7029     if test -z "$ENABLE_JAVA"; then
7030         if test "$with_export_validation" = "yes"; then
7031             AC_MSG_ERROR([requested, but Java is disabled])
7032         else
7033             AC_MSG_RESULT([no, as Java is disabled])
7034         fi
7035     elif test "$_jdk_ver" -lt 10800; then
7036         if test "$with_export_validation" = "yes"; then
7037             AC_MSG_ERROR([requested, but Java is too old, need Java 8])
7038         else
7039             AC_MSG_RESULT([no, as Java is too old, need Java 8])
7040         fi
7041     else
7042         AC_MSG_RESULT([yes])
7043         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7045         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7046         if test -z "$ODFVALIDATOR"; then
7047             # remember to download the ODF toolkit with validator later
7048             AC_MSG_NOTICE([no odfvalidator found, will download it])
7049             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7050             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7052             # and fetch name of odfvalidator jar name from download.lst
7053             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7054             AC_SUBST(ODFVALIDATOR_JAR)
7056             if test -z "$ODFVALIDATOR_JAR"; then
7057                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7058             fi
7059         fi
7060         if test "$build_os" = "cygwin"; then
7061             # In case of Cygwin it will be executed from Windows,
7062             # so we need to run bash and absolute path to validator
7063             # so instead of "odfvalidator" it will be
7064             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7065             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7066         else
7067             ODFVALIDATOR="sh $ODFVALIDATOR"
7068         fi
7069         AC_SUBST(ODFVALIDATOR)
7072         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7073         if test -z "$OFFICEOTRON"; then
7074             # remember to download the officeotron with validator later
7075             AC_MSG_NOTICE([no officeotron found, will download it])
7076             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7077             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7079             # and fetch name of officeotron jar name from download.lst
7080             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7081             AC_SUBST(OFFICEOTRON_JAR)
7083             if test -z "$OFFICEOTRON_JAR"; then
7084                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7085             fi
7086         else
7087             # check version of existing officeotron
7088             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7089             if test 0"$OFFICEOTRON_VER" -lt 704; then
7090                 AC_MSG_ERROR([officeotron too old])
7091             fi
7092         fi
7093         if test "$build_os" = "cygwin"; then
7094             # In case of Cygwin it will be executed from Windows,
7095             # so we need to run bash and absolute path to validator
7096             # so instead of "odfvalidator" it will be
7097             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7098             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7099         else
7100             OFFICEOTRON="sh $OFFICEOTRON"
7101         fi
7102     fi
7103     AC_SUBST(OFFICEOTRON)
7104 else
7105     AC_MSG_RESULT([no])
7108 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7109 if test "$with_bffvalidator" != "no"; then
7110     AC_DEFINE(HAVE_BFFVALIDATOR)
7112     if test "$with_export_validation" = "no"; then
7113         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7114     fi
7116     if test "$with_bffvalidator" = "yes"; then
7117         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7118     else
7119         BFFVALIDATOR="$with_bffvalidator"
7120     fi
7122     if test "$build_os" = "cygwin"; then
7123         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7124             AC_MSG_RESULT($BFFVALIDATOR)
7125         else
7126             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7127         fi
7128     elif test -n "$BFFVALIDATOR"; then
7129         # We are not in Cygwin but need to run Windows binary with wine
7130         AC_PATH_PROGS(WINE, wine)
7132         # so swap in a shell wrapper that converts paths transparently
7133         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7134         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7135         AC_SUBST(BFFVALIDATOR_EXE)
7136         AC_MSG_RESULT($BFFVALIDATOR)
7137     else
7138         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7139     fi
7140     AC_SUBST(BFFVALIDATOR)
7141 else
7142     AC_MSG_RESULT([no])
7145 dnl ===================================================================
7146 dnl Check for C preprocessor to use
7147 dnl ===================================================================
7148 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7149 if test -n "$with_idlc_cpp"; then
7150     AC_MSG_RESULT([$with_idlc_cpp])
7151     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7152 else
7153     AC_MSG_RESULT([ucpp])
7154     AC_MSG_CHECKING([which ucpp tp use])
7155     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7156         AC_MSG_RESULT([external])
7157         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7158     else
7159         AC_MSG_RESULT([internal])
7160         BUILD_TYPE="$BUILD_TYPE UCPP"
7161     fi
7163 AC_SUBST(SYSTEM_UCPP)
7165 dnl ===================================================================
7166 dnl Check for epm (not needed for Windows)
7167 dnl ===================================================================
7168 AC_MSG_CHECKING([whether to enable EPM for packing])
7169 if test "$enable_epm" = "yes"; then
7170     AC_MSG_RESULT([yes])
7171     if test "$_os" != "WINNT"; then
7172         if test $_os = Darwin; then
7173             EPM=internal
7174         elif test -n "$with_epm"; then
7175             EPM=$with_epm
7176         else
7177             AC_PATH_PROG(EPM, epm, no)
7178         fi
7179         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7180             AC_MSG_NOTICE([EPM will be built.])
7181             BUILD_TYPE="$BUILD_TYPE EPM"
7182             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7183         else
7184             # Gentoo has some epm which is something different...
7185             AC_MSG_CHECKING([whether the found epm is the right epm])
7186             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7187                 AC_MSG_RESULT([yes])
7188             else
7189                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7190             fi
7191             AC_MSG_CHECKING([epm version])
7192             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7193             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7194                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7195                 AC_MSG_RESULT([OK, >= 3.7])
7196             else
7197                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7198                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7199             fi
7200         fi
7201     fi
7203     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7204         AC_MSG_CHECKING([for rpm])
7205         for a in "$RPM" rpmbuild rpm; do
7206             $a --usage >/dev/null 2> /dev/null
7207             if test $? -eq 0; then
7208                 RPM=$a
7209                 break
7210             else
7211                 $a --version >/dev/null 2> /dev/null
7212                 if test $? -eq 0; then
7213                     RPM=$a
7214                     break
7215                 fi
7216             fi
7217         done
7218         if test -z "$RPM"; then
7219             AC_MSG_ERROR([not found])
7220         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7221             RPM_PATH=`which $RPM`
7222             AC_MSG_RESULT([$RPM_PATH])
7223             SCPDEFS="$SCPDEFS -DWITH_RPM"
7224         else
7225             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7226         fi
7227     fi
7228     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7229         AC_PATH_PROG(DPKG, dpkg, no)
7230         if test "$DPKG" = "no"; then
7231             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7232         fi
7233     fi
7234     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7235        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7236         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7237             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7238                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7239                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7240                     AC_MSG_RESULT([yes])
7241                 else
7242                     AC_MSG_RESULT([no])
7243                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7244                         _pt="rpm"
7245                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7246                         add_warning "the rpms will need to be installed with --nodeps"
7247                     else
7248                         _pt="pkg"
7249                     fi
7250                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
7251                     add_warning "the ${_pt}s will not be relocateable"
7252                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7253                                  relocation will work, you need to patch your epm with the
7254                                  patch in epm/epm-3.7.patch or build with
7255                                  --with-epm=internal which will build a suitable epm])
7256                 fi
7257             fi
7258         fi
7259     fi
7260     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7261         AC_PATH_PROG(PKGMK, pkgmk, no)
7262         if test "$PKGMK" = "no"; then
7263             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7264         fi
7265     fi
7266     AC_SUBST(RPM)
7267     AC_SUBST(DPKG)
7268     AC_SUBST(PKGMK)
7269 else
7270     for i in $PKGFORMAT; do
7271         case "$i" in
7272         aix | bsd | deb | pkg | rpm | native | portable)
7273             AC_MSG_ERROR(
7274                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7275             ;;
7276         esac
7277     done
7278     AC_MSG_RESULT([no])
7279     EPM=NO
7281 AC_SUBST(EPM)
7283 ENABLE_LWP=
7284 if test "$enable_lotuswordpro" = "yes"; then
7285     ENABLE_LWP="TRUE"
7287 AC_SUBST(ENABLE_LWP)
7289 dnl ===================================================================
7290 dnl Check for building ODK
7291 dnl ===================================================================
7292 if test "$enable_odk" = no; then
7293     unset DOXYGEN
7294 else
7295     if test "$with_doxygen" = no; then
7296         AC_MSG_CHECKING([for doxygen])
7297         unset DOXYGEN
7298         AC_MSG_RESULT([no])
7299     else
7300         if test "$with_doxygen" = yes; then
7301             AC_PATH_PROG([DOXYGEN], [doxygen])
7302             if test -z "$DOXYGEN"; then
7303                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7304             fi
7305         else
7306             AC_MSG_CHECKING([for doxygen])
7307             DOXYGEN=$with_doxygen
7308             AC_MSG_RESULT([$DOXYGEN])
7309         fi
7310         if test -n "$DOXYGEN"; then
7311             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7312             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7313             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7314                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7315             fi
7316         fi
7317     fi
7319 AC_SUBST([DOXYGEN])
7321 AC_MSG_CHECKING([whether to build the ODK])
7322 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7323     AC_MSG_RESULT([yes])
7325     if test "$with_java" != "no"; then
7326         AC_MSG_CHECKING([whether to build unowinreg.dll])
7327         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7328             # build on Win by default
7329             enable_build_unowinreg=yes
7330         fi
7331         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7332             AC_MSG_RESULT([no])
7333             BUILD_UNOWINREG=
7334         else
7335             AC_MSG_RESULT([yes])
7336             BUILD_UNOWINREG=TRUE
7337         fi
7338         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7339             if test -z "$with_mingw_cross_compiler"; then
7340                 dnl Guess...
7341                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7342             elif test -x "$with_mingw_cross_compiler"; then
7343                  MINGWCXX="$with_mingw_cross_compiler"
7344             else
7345                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7346             fi
7348             if test "$MINGWCXX" = "false"; then
7349                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7350             fi
7352             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7353             if test -x "$mingwstrip_test"; then
7354                 MINGWSTRIP="$mingwstrip_test"
7355             else
7356                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7357             fi
7359             if test "$MINGWSTRIP" = "false"; then
7360                 AC_MSG_ERROR(MinGW32 binutils not found.)
7361             fi
7362         fi
7363     fi
7364     BUILD_TYPE="$BUILD_TYPE ODK"
7365 else
7366     AC_MSG_RESULT([no])
7367     BUILD_UNOWINREG=
7369 AC_SUBST(BUILD_UNOWINREG)
7370 AC_SUBST(MINGWCXX)
7371 AC_SUBST(MINGWSTRIP)
7373 dnl ===================================================================
7374 dnl Check for system zlib
7375 dnl ===================================================================
7376 if test "$with_system_zlib" = "auto"; then
7377     case "$_os" in
7378     WINNT)
7379         with_system_zlib="$with_system_libs"
7380         ;;
7381     *)
7382         if test "$enable_fuzzers" != "yes"; then
7383             with_system_zlib=yes
7384         else
7385             with_system_zlib=no
7386         fi
7387         ;;
7388     esac
7391 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7392 dnl and has no pkg-config for it at least on some tinderboxes,
7393 dnl so leaving that out for now
7394 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7395 AC_MSG_CHECKING([which zlib to use])
7396 if test "$with_system_zlib" = "yes"; then
7397     AC_MSG_RESULT([external])
7398     SYSTEM_ZLIB=TRUE
7399     AC_CHECK_HEADER(zlib.h, [],
7400         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7401     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7402         [AC_MSG_ERROR(zlib not found or functional)], [])
7403 else
7404     AC_MSG_RESULT([internal])
7405     SYSTEM_ZLIB=
7406     BUILD_TYPE="$BUILD_TYPE ZLIB"
7407     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7408     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7410 AC_SUBST(ZLIB_CFLAGS)
7411 AC_SUBST(ZLIB_LIBS)
7412 AC_SUBST(SYSTEM_ZLIB)
7414 dnl ===================================================================
7415 dnl Check for system jpeg
7416 dnl ===================================================================
7417 AC_MSG_CHECKING([which libjpeg to use])
7418 if test "$with_system_jpeg" = "yes"; then
7419     AC_MSG_RESULT([external])
7420     SYSTEM_LIBJPEG=TRUE
7421     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7422         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7423     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7424         [AC_MSG_ERROR(jpeg library not found or fuctional)], [])
7425 else
7426     SYSTEM_LIBJPEG=
7427     AC_MSG_RESULT([internal, libjpeg-turbo])
7428     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
7429     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
7430     if test "$COM" = "MSC"; then
7431         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
7432     else
7433         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
7434     fi
7436     case "$host_cpu" in
7437     x86_64 | amd64 | i*86 | x86 | ia32)
7438         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7439         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7440             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7441                 NASM="$LODE_HOME/opt/bin/nasm"
7442             elif test -x "/opt/lo/bin/nasm"; then
7443                 NASM="/opt/lo/bin/nasm"
7444             fi
7445         fi
7447         if test -n "$NASM"; then
7448             AC_MSG_CHECKING([for object file format of host system])
7449             case "$host_os" in
7450               cygwin* | mingw* | pw32* | interix*)
7451                 case "$host_cpu" in
7452                   x86_64)
7453                     objfmt='Win64-COFF'
7454                     ;;
7455                   *)
7456                     objfmt='Win32-COFF'
7457                     ;;
7458                 esac
7459               ;;
7460               msdosdjgpp* | go32*)
7461                 objfmt='COFF'
7462               ;;
7463               os2-emx*)                 # not tested
7464                 objfmt='MSOMF'          # obj
7465               ;;
7466               linux*coff* | linux*oldld*)
7467                 objfmt='COFF'           # ???
7468               ;;
7469               linux*aout*)
7470                 objfmt='a.out'
7471               ;;
7472               linux*)
7473                 case "$host_cpu" in
7474                   x86_64)
7475                     objfmt='ELF64'
7476                     ;;
7477                   *)
7478                     objfmt='ELF'
7479                     ;;
7480                 esac
7481               ;;
7482               kfreebsd* | freebsd* | netbsd* | openbsd*)
7483                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
7484                   objfmt='BSD-a.out'
7485                 else
7486                   case "$host_cpu" in
7487                     x86_64 | amd64)
7488                       objfmt='ELF64'
7489                       ;;
7490                     *)
7491                       objfmt='ELF'
7492                       ;;
7493                   esac
7494                 fi
7495               ;;
7496               solaris* | sunos* | sysv* | sco*)
7497                 case "$host_cpu" in
7498                   x86_64)
7499                     objfmt='ELF64'
7500                     ;;
7501                   *)
7502                     objfmt='ELF'
7503                     ;;
7504                 esac
7505               ;;
7506               darwin* | rhapsody* | nextstep* | openstep* | macos*)
7507                 case "$host_cpu" in
7508                   x86_64)
7509                     objfmt='Mach-O64'
7510                     ;;
7511                   *)
7512                     objfmt='Mach-O'
7513                     ;;
7514                 esac
7515               ;;
7516               *)
7517                 objfmt='ELF ?'
7518               ;;
7519             esac
7521             AC_MSG_RESULT([$objfmt])
7522             if test "$objfmt" = 'ELF ?'; then
7523               objfmt='ELF'
7524               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
7525             fi
7527             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
7528             case "$objfmt" in
7529               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
7530               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
7531               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
7532               COFF)       NAFLAGS='-fcoff -DCOFF';;
7533               a.out)      NAFLAGS='-faout -DAOUT';;
7534               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
7535               ELF)        NAFLAGS='-felf -DELF';;
7536               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
7537               RDF)        NAFLAGS='-frdf -DRDF';;
7538               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
7539               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
7540             esac
7541             AC_MSG_RESULT([$NAFLAGS])
7543             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
7544             cat > conftest.asm << EOF
7545             [%line __oline__ "configure"
7546                     section .text
7547                     global  _main,main
7548             _main:
7549             main:   xor     eax,eax
7550                     ret
7551             ]
7553             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
7554             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
7555               AC_MSG_RESULT(yes)
7556             else
7557               echo "configure: failed program was:" >&AC_FD_CC
7558               cat conftest.asm >&AC_FD_CC
7559               rm -rf conftest*
7560               AC_MSG_RESULT(no)
7561               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
7562               NASM=""
7563             fi
7565         fi
7567         if test -z "$NASM"; then
7568 cat << _EOS
7569 ****************************************************************************
7570 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
7571 To get one please:
7573 _EOS
7574             if test "$build_os" = "cygwin"; then
7575 cat << _EOS
7576 install a pre-compiled binary for Win32
7578 mkdir -p /opt/lo/bin
7579 cd /opt/lo/bin
7580 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7581 chmod +x nasm
7583 or get and install one from http://www.nasm.us/
7585 Then re-run autogen.sh
7587 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7588 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7590 _EOS
7591             else
7592 cat << _EOS
7593 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
7595 _EOS
7596             fi
7597             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
7598             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
7599         fi
7600       ;;
7601     esac
7604 AC_SUBST(NASM)
7605 AC_SUBST(LIBJPEG_CFLAGS)
7606 AC_SUBST(LIBJPEG_LIBS)
7607 AC_SUBST(SYSTEM_LIBJPEG)
7609 dnl ===================================================================
7610 dnl Check for system clucene
7611 dnl ===================================================================
7612 dnl we should rather be using
7613 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7614 dnl but the contribs-lib check seems tricky
7615 AC_MSG_CHECKING([which clucene to use])
7616 if test "$with_system_clucene" = "yes"; then
7617     AC_MSG_RESULT([external])
7618     SYSTEM_CLUCENE=TRUE
7619     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7620     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7621     FilterLibs "${CLUCENE_LIBS}"
7622     CLUCENE_LIBS="${filteredlibs}"
7623     AC_LANG_PUSH([C++])
7624     save_CXXFLAGS=$CXXFLAGS
7625     save_CPPFLAGS=$CPPFLAGS
7626     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7627     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7628     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7629     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7630     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7631                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7632     CXXFLAGS=$save_CXXFLAGS
7633     CPPFLAGS=$save_CPPFLAGS
7634     AC_LANG_POP([C++])
7636     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7637 else
7638     AC_MSG_RESULT([internal])
7639     SYSTEM_CLUCENE=
7640     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7642 AC_SUBST(SYSTEM_CLUCENE)
7643 AC_SUBST(CLUCENE_CFLAGS)
7644 AC_SUBST(CLUCENE_LIBS)
7646 dnl ===================================================================
7647 dnl Check for system expat
7648 dnl ===================================================================
7649 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
7651 dnl ===================================================================
7652 dnl Check for system xmlsec
7653 dnl ===================================================================
7654 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24])
7656 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7657 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7658     ENABLE_EOT="TRUE"
7659     AC_DEFINE([ENABLE_EOT])
7660     AC_MSG_RESULT([yes])
7662     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7663 else
7664     ENABLE_EOT=
7665     AC_MSG_RESULT([no])
7667 AC_SUBST([ENABLE_EOT])
7669 dnl ===================================================================
7670 dnl Check for DLP libs
7671 dnl ===================================================================
7672 AS_IF([test "$COM" = "MSC"],
7673       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7674       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7676 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7678 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7680 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.0])
7681 AS_IF([test "$SYSTEM_EPUBGEN" = "TRUE"], [
7682     AC_MSG_CHECKING([whether libepubgen supports setting EPUB version])
7683     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
7684             #include <libepubgen/libepubgen.h>
7685         ], [
7686             const libepubgen::EPUBTextGenerator generator(nullptr, EPUB_SPLIT_METHOD_NONE, 30);
7687         ])],
7688         [
7689             AC_MSG_RESULT([yes])
7690             AC_DEFINE([LIBEPUBGEN_VERSION_SUPPORT])
7691         ],
7692         [
7693             AC_MSG_RESULT([no])
7694         ]
7695     )
7696 ], [
7697     AC_DEFINE([LIBEPUBGEN_VERSION_SUPPORT])
7700 AS_IF([test "$COM" = "MSC"],
7701       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7702       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7704 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7706 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7708 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7709 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.8])
7711 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7713 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7715 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7717 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
7718 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.13])
7720 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
7721 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.7])
7723 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7725 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
7726 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
7728 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7730 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7732 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
7734 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
7736 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
7737 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.4])
7739 dnl ===================================================================
7740 dnl Check for system libcmis
7741 dnl ===================================================================
7742 # libcmis requires curl and we can't build curl for iOS
7743 if test $_os != iOS; then
7744     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.0])
7745     ENABLE_LIBCMIS=TRUE
7746 else
7747     ENABLE_LIBCMIS=
7749 AC_SUBST(ENABLE_LIBCMIS)
7751 dnl ===================================================================
7752 dnl Check for system lcms2
7753 dnl ===================================================================
7754 if test "$with_system_lcms2" != "yes"; then
7755     SYSTEM_LCMS2=
7757 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7758 if test "$GCC" = "yes"; then
7759     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7761 if test "$COM" = "MSC"; then # override the above
7762     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7765 dnl ===================================================================
7766 dnl Check for system cppunit
7767 dnl ===================================================================
7768 if test "$cross_compiling" != "yes"; then
7769     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
7772 dnl ===================================================================
7773 dnl Check whether freetype is available
7774 dnl ===================================================================
7775 if test  "$test_freetype" = "yes"; then
7776     AC_MSG_CHECKING([whether freetype is available])
7777     # FreeType has 3 different kinds of versions
7778     # * release, like 2.4.10
7779     # * libtool, like 13.0.7 (this what pkg-config returns)
7780     # * soname
7781     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7782     #
7783     # 9.9.3 is 2.2.0
7784     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7785     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7786     FilterLibs "${FREETYPE_LIBS}"
7787     FREETYPE_LIBS="${filteredlibs}"
7788     SYSTEM_FREETYPE=TRUE
7789 else
7790     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
7791     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
7793 AC_SUBST(FREETYPE_CFLAGS)
7794 AC_SUBST(FREETYPE_LIBS)
7795 AC_SUBST([SYSTEM_FREETYPE])
7797 # ===================================================================
7798 # Check for system libxslt
7799 # to prevent incompatibilities between internal libxml2 and external libxslt,
7800 # or vice versa, use with_system_libxml here
7801 # ===================================================================
7802 if test "$with_system_libxml" = "auto"; then
7803     case "$_os" in
7804     WINNT|iOS|Android)
7805         with_system_libxml="$with_system_libs"
7806         ;;
7807     *)
7808         if test "$enable_fuzzers" != "yes"; then
7809             with_system_libxml=yes
7810         else
7811             with_system_libxml=no
7812         fi
7813         ;;
7814     esac
7817 AC_MSG_CHECKING([which libxslt to use])
7818 if test "$with_system_libxml" = "yes"; then
7819     AC_MSG_RESULT([external])
7820     SYSTEM_LIBXSLT=TRUE
7821     if test "$_os" = "Darwin"; then
7822         dnl make sure to use SDK path
7823         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7824         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7825         dnl omit -L/usr/lib
7826         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7827         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7828     else
7829         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7830         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7831         FilterLibs "${LIBXSLT_LIBS}"
7832         LIBXSLT_LIBS="${filteredlibs}"
7833         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7834         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7835         FilterLibs "${LIBEXSLT_LIBS}"
7836         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
7837     fi
7839     dnl Check for xsltproc
7840     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7841     if test "$XSLTPROC" = "no"; then
7842         AC_MSG_ERROR([xsltproc is required])
7843     fi
7844 else
7845     AC_MSG_RESULT([internal])
7846     SYSTEM_LIBXSLT=
7847     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
7849     if test "$cross_compiling" = "yes"; then
7850         AC_PATH_PROG(XSLTPROC, xsltproc, no)
7851         if test "$XSLTPROC" = "no"; then
7852             AC_MSG_ERROR([xsltproc is required])
7853         fi
7854     fi
7856 AC_SUBST(SYSTEM_LIBXSLT)
7857 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
7858     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
7860 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
7862 AC_SUBST(LIBEXSLT_CFLAGS)
7863 AC_SUBST(LIBEXSLT_LIBS)
7864 AC_SUBST(LIBXSLT_CFLAGS)
7865 AC_SUBST(LIBXSLT_LIBS)
7866 AC_SUBST(XSLTPROC)
7868 # ===================================================================
7869 # Check for system libxml
7870 # ===================================================================
7871 AC_MSG_CHECKING([which libxml to use])
7872 if test "$with_system_libxml" = "yes"; then
7873     AC_MSG_RESULT([external])
7874     SYSTEM_LIBXML=TRUE
7875     if test "$_os" = "Darwin"; then
7876         dnl make sure to use SDK path
7877         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7878         dnl omit -L/usr/lib
7879         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
7880     elif test $_os = iOS; then
7881         dnl make sure to use SDK path
7882         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
7883         LIBXML_CFLAGS="-I$usr/include/libxml2"
7884         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
7885     else
7886         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
7887         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7888         FilterLibs "${LIBXML_LIBS}"
7889         LIBXML_LIBS="${filteredlibs}"
7890     fi
7892     dnl Check for xmllint
7893     AC_PATH_PROG(XMLLINT, xmllint, no)
7894     if test "$XMLLINT" = "no"; then
7895         AC_MSG_ERROR([xmllint is required])
7896     fi
7897 else
7898     AC_MSG_RESULT([internal])
7899     SYSTEM_LIBXML=
7900     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
7901     if test "$COM" = "MSC"; then
7902         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
7903     fi
7904     if test "$COM" = "MSC"; then
7905         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
7906     else
7907         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
7908     fi
7909     BUILD_TYPE="$BUILD_TYPE LIBXML2"
7911 AC_SUBST(SYSTEM_LIBXML)
7912 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
7913     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
7915 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
7916 AC_SUBST(LIBXML_CFLAGS)
7917 AC_SUBST(LIBXML_LIBS)
7918 AC_SUBST(XMLLINT)
7920 # =====================================================================
7921 # Checking for a Python interpreter with version >= 2.6.
7922 # Build and runtime requires Python 3 compatible version (>= 2.6).
7923 # Optionally user can pass an option to configure, i. e.
7924 # ./configure PYTHON=/usr/bin/python
7925 # =====================================================================
7926 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
7927     # This allows a lack of system python with no error, we use internal one in that case.
7928     AM_PATH_PYTHON([2.6],, [:])
7929     # Clean PYTHON_VERSION checked below if cross-compiling
7930     PYTHON_VERSION=""
7931     if test "$PYTHON" != ":"; then
7932         PYTHON_FOR_BUILD=$PYTHON
7933     fi
7935 AC_SUBST(PYTHON_FOR_BUILD)
7937 # Checks for Python to use for Pyuno
7938 AC_MSG_CHECKING([which Python to use for Pyuno])
7939 case "$enable_python" in
7940 no|disable)
7941     if test -z $PYTHON_FOR_BUILD; then
7942         # Python is required to build LibreOffice. In theory we could separate the build-time Python
7943         # requirement from the choice whether to include Python stuff in the installer, but why
7944         # bother?
7945         AC_MSG_ERROR([Python is required at build time.])
7946     fi
7947     enable_python=no
7948     AC_MSG_RESULT([none])
7949     ;;
7950 ""|yes|auto)
7951     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
7952         AC_MSG_RESULT([no, overridden by --disable-scripting])
7953         enable_python=no
7954     elif test $build_os = cygwin; then
7955         dnl When building on Windows we don't attempt to use any installed
7956         dnl "system"  Python.
7957         AC_MSG_RESULT([fully internal])
7958         enable_python=internal
7959     elif test "$cross_compiling" = yes; then
7960         AC_MSG_RESULT([system])
7961         enable_python=system
7962     else
7963         # Unset variables set by the above AM_PATH_PYTHON so that
7964         # we actually do check anew.
7965         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
7966         AM_PATH_PYTHON([3.3],, [:])
7967         if test "$PYTHON" = ":"; then
7968             if test -z "$PYTHON_FOR_BUILD"; then
7969                 AC_MSG_RESULT([fully internal])
7970             else
7971                 AC_MSG_RESULT([internal])
7972             fi
7973             enable_python=internal
7974         else
7975             AC_MSG_RESULT([system])
7976             enable_python=system
7977         fi
7978     fi
7979     ;;
7980 internal)
7981     AC_MSG_RESULT([internal])
7982     ;;
7983 fully-internal)
7984     AC_MSG_RESULT([fully internal])
7985     enable_python=internal
7986     ;;
7987 system)
7988     AC_MSG_RESULT([system])
7989     ;;
7991     AC_MSG_ERROR([Incorrect --enable-python option])
7992     ;;
7993 esac
7995 if test $enable_python != no; then
7996     BUILD_TYPE="$BUILD_TYPE PYUNO"
7999 if test $enable_python = system; then
8000     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8001         python_version=2.7
8002         PYTHON=python$python_version
8003         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
8004             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
8005             PYTHON_LIBS="-framework Python"
8006         else
8007             PYTHON_CFLAGS="`$PYTHON-config --includes`"
8008             PYTHON_LIBS="`$PYTHON-config --libs`"
8009         fi
8010     fi
8011     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8012         # Fallback: Accept these in the environment, or as set above
8013         # for MacOSX.
8014         :
8015     elif test "$cross_compiling" != yes; then
8016         # Unset variables set by the above AM_PATH_PYTHON so that
8017         # we actually do check anew.
8018         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
8019         # This causes an error if no python command is found
8020         AM_PATH_PYTHON([3.3])
8021         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8022         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8023         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8024         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8025         if test -z "$PKG_CONFIG"; then
8026             PYTHON_CFLAGS="-I$python_include"
8027             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8028         elif $PKG_CONFIG --exists python-$python_version; then
8029             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8030             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8031         else
8032             PYTHON_CFLAGS="-I$python_include"
8033             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8034         fi
8035         FilterLibs "${PYTHON_LIBS}"
8036         PYTHON_LIBS="${filteredlibs}"
8037     else
8038         dnl How to find out the cross-compilation Python installation path?
8039         AC_MSG_CHECKING([for python version])
8040         AS_IF([test -n "$PYTHON_VERSION"],
8041               [AC_MSG_RESULT([$PYTHON_VERSION])],
8042               [AC_MSG_RESULT([not found])
8043                AC_MSG_ERROR([no usable python found])])
8044         test -n "$PYTHON_CFLAGS" && break
8045     fi
8046     # let the PYTHON_FOR_BUILD match the same python installation that
8047     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8048     # better for PythonTests.
8049     PYTHON_FOR_BUILD=$PYTHON
8052 dnl By now enable_python should be "system", "internal" or "no"
8053 case $enable_python in
8054 system)
8055     SYSTEM_PYTHON=TRUE
8057     dnl Check if the headers really work
8058     save_CPPFLAGS="$CPPFLAGS"
8059     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8060     AC_CHECK_HEADER(Python.h, [],
8061        [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
8062        [])
8063     CPPFLAGS="$save_CPPFLAGS"
8065     AC_LANG_PUSH(C)
8066     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8067     AC_MSG_CHECKING([for correct python library version])
8068        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8069 #include <Python.h>
8071 int main(int argc, char **argv) {
8072    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
8073        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8074    else return 1;
8076        ]])],[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])])
8077     CFLAGS=$save_CFLAGS
8078     AC_LANG_POP(C)
8080     dnl FIXME Check if the Python library can be linked with, too?
8081     ;;
8083 internal)
8084     SYSTEM_PYTHON=
8085     PYTHON_VERSION_MAJOR=3
8086     PYTHON_VERSION_MINOR=5
8087     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.4
8088     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8089         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8090     fi
8091     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8092     BUILD_TYPE="$BUILD_TYPE PYTHON"
8093     # Embedded Python dies without Home set
8094     if test "$HOME" = ""; then
8095         export HOME=""
8096     fi
8097     # bz2 tarball and bzip2 is not standard
8098     if test -z "$BZIP2"; then
8099         AC_PATH_PROG( BZIP2, bzip2)
8100         if test -z "$BZIP2"; then
8101             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
8102         fi
8103     fi
8104     ;;
8106     DISABLE_PYTHON=TRUE
8107     SYSTEM_PYTHON=
8108     ;;
8110     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8111     ;;
8112 esac
8114 AC_SUBST(DISABLE_PYTHON)
8115 AC_SUBST(SYSTEM_PYTHON)
8116 AC_SUBST(PYTHON_CFLAGS)
8117 AC_SUBST(PYTHON_LIBS)
8118 AC_SUBST(PYTHON_VERSION)
8119 AC_SUBST(PYTHON_VERSION_MAJOR)
8120 AC_SUBST(PYTHON_VERSION_MINOR)
8122 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8123 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8124     AC_MSG_RESULT([yes])
8125     ENABLE_MARIADBC=TRUE
8126     MARIADBC_MAJOR=1
8127     MARIADBC_MINOR=0
8128     MARIADBC_MICRO=2
8129     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8130 else
8131     AC_MSG_RESULT([no])
8132     ENABLE_MARIADBC=
8134 AC_SUBST(ENABLE_MARIADBC)
8135 AC_SUBST(MARIADBC_MAJOR)
8136 AC_SUBST(MARIADBC_MINOR)
8137 AC_SUBST(MARIADBC_MICRO)
8139 if test "$ENABLE_MARIADBC" = "TRUE"; then
8141     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8143     dnl ===================================================================
8144     dnl Check for system MariaDB
8145     dnl ===================================================================
8146     AC_MSG_CHECKING([which MariaDB to use])
8147     if test "$with_system_mariadb" = "yes"; then
8148         AC_MSG_RESULT([external])
8149         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8150         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8151         if test -z "$MARIADBCONFIG"; then
8152             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8153             if test -z "$MARIADBCONFIG"; then
8154                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8155                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8156             fi
8157         fi
8158         AC_MSG_CHECKING([MariaDB version])
8159         MARIADB_VERSION=`$MARIADBCONFIG --version`
8160         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8161         if test "$MARIADB_MAJOR" -ge "5"; then
8162             AC_MSG_RESULT([OK])
8163         else
8164             AC_MSG_ERROR([too old, use 5.0.x or later])
8165         fi
8166         AC_MSG_CHECKING([for MariaDB Client library])
8167         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8168         if test "$COM_IS_CLANG" = TRUE; then
8169             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8170         fi
8171         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8172         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8173         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8174         dnl linux32:
8175         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8176             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8177             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8178                 | sed -e 's|/lib64/|/lib/|')
8179         fi
8180         FilterLibs "${MARIADB_LIBS}"
8181         MARIADB_LIBS="${filteredlibs}"
8182         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8183         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8184         if test "$enable_bundle_mariadb" = "yes"; then
8185             AC_MSG_RESULT([yes])
8186             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8187             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8189 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8191 /g' | grep -E '(mysqlclient|mariadb)')
8192             if test "$_os" = "Darwin"; then
8193                 LIBMARIADB=${LIBMARIADB}.dylib
8194             elif test "$_os" = "WINNT"; then
8195                 LIBMARIADB=${LIBMARIADB}.dll
8196             else
8197                 LIBMARIADB=${LIBMARIADB}.so
8198             fi
8199             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8200             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8201             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8202                 AC_MSG_RESULT([found.])
8203                 PathFormat "$LIBMARIADB_PATH"
8204                 LIBMARIADB_PATH="$formatted_path"
8205             else
8206                 AC_MSG_ERROR([not found.])
8207             fi
8208         else
8209             AC_MSG_RESULT([no])
8210             BUNDLE_MARIADB_CONNECTOR_C=
8211         fi
8212     else
8213         AC_MSG_RESULT([internal])
8214         SYSTEM_MARIADB_CONNECTOR_C=
8215         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8216         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8217         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8218     fi
8220     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8221     AC_SUBST(MARIADB_CFLAGS)
8222     AC_SUBST(MARIADB_LIBS)
8223     AC_SUBST(LIBMARIADB)
8224     AC_SUBST(LIBMARIADB_PATH)
8225     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8227     AC_LANG_PUSH([C++])
8228     dnl ===================================================================
8229     dnl Check for system MySQL C++ Connector
8230     dnl ===================================================================
8231     # FIXME!
8232     # who thought this too-generic cppconn dir was a good idea?
8233     AC_MSG_CHECKING([MySQL Connector/C++])
8234     if test "$with_system_mysql_cppconn" = "yes"; then
8235         AC_MSG_RESULT([external])
8236         SYSTEM_MYSQL_CONNECTOR_CPP=TRUE
8237         AC_LANG_PUSH([C++])
8238         AC_CHECK_HEADER(mysql_driver.h, [],
8239                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8240         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8241                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8242         save_LIBS=$LIBS
8243         LIBS="$LIBS -lmysqlcppconn"
8244         AC_MSG_CHECKING([version])
8245         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8246 #include <mysql_driver.h>
8248 int main(int argc, char **argv) {
8249     sql::Driver *driver;
8250     driver = get_driver_instance();
8251     if (driver->getMajorVersion() > 1 || \
8252        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8253        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8254         return 0;
8255       else
8256         return 1;
8258       ]])],[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])])
8260         AC_LANG_POP([C++])
8261         LIBS=$save_LIBS
8262     else
8263         AC_MSG_RESULT([internal])
8264         BUILD_TYPE="$BUILD_TYPE MYSQL_CONNECTOR_CPP"
8265         SYSTEM_MYSQL_CONNECTOR_CPP=
8266     fi
8267     AC_LANG_POP([C++])
8269 AC_SUBST(SYSTEM_MYSQL_CONNECTOR_CPP)
8271 dnl ===================================================================
8272 dnl Check for system hsqldb
8273 dnl ===================================================================
8274 if test "$with_java" != "no"; then
8275     HSQLDB_USE_JDBC_4_1=
8276     AC_MSG_CHECKING([which hsqldb to use])
8277     if test "$with_system_hsqldb" = "yes"; then
8278         AC_MSG_RESULT([external])
8279         SYSTEM_HSQLDB=TRUE
8280         if test -z $HSQLDB_JAR; then
8281             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8282         fi
8283         if ! test -f $HSQLDB_JAR; then
8284                AC_MSG_ERROR(hsqldb.jar not found.)
8285         fi
8286         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8287         export HSQLDB_JAR
8288         if $PERL -e \
8289            'use Archive::Zip;
8290             my $file = "$ENV{'HSQLDB_JAR'}";
8291             my $zip = Archive::Zip->new( $file );
8292             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8293             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8294             {
8295                 push @l, split(/\n/, $mf);
8296                 foreach my $line (@l)
8297                 {
8298                     if ($line =~ m/Specification-Version:/)
8299                     {
8300                         ($t, $version) = split (/:/,$line);
8301                         $version =~ s/^\s//;
8302                         ($a, $b, $c, $d) = split (/\./,$version);
8303                         if ($c == "0" && $d > "8")
8304                         {
8305                             exit 0;
8306                         }
8307                         else
8308                         {
8309                             exit 1;
8310                         }
8311                     }
8312                 }
8313             }
8314             else
8315             {
8316                 exit 1;
8317             }'; then
8318             AC_MSG_RESULT([yes])
8319         else
8320             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8321         fi
8322     else
8323         AC_MSG_RESULT([internal])
8324         SYSTEM_HSQLDB=
8325         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8326         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8327         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8328         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8329             AC_MSG_RESULT([yes])
8330             HSQLDB_USE_JDBC_4_1=TRUE
8331         else
8332             AC_MSG_RESULT([no])
8333         fi
8334     fi
8335     AC_SUBST(SYSTEM_HSQLDB)
8336     AC_SUBST(HSQLDB_JAR)
8337     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8340 dnl ===================================================================
8341 dnl Check for PostgreSQL stuff
8342 dnl ===================================================================
8343 if test "x$enable_postgresql_sdbc" != "xno"; then
8344     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8346     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8347         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8348     fi
8349     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8350         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8351     fi
8353     postgres_interface=""
8354     if test "$with_system_postgresql" = "yes"; then
8355         postgres_interface="external PostgreSQL"
8356         SYSTEM_POSTGRESQL=TRUE
8357         if test "$_os" = Darwin; then
8358             supp_path=''
8359             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8360                 pg_supp_path="$P_SEP$d$pg_supp_path"
8361             done
8362         fi
8363         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8364         if test -z "$PGCONFIG"; then
8365             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8366         fi
8367         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8368         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8369         FilterLibs "${POSTGRESQL_LIB}"
8370         POSTGRESQL_LIB="${filteredlibs}"
8371     else
8372         # if/when anything else than PostgreSQL uses Kerberos,
8373         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8374         WITH_KRB5=
8375         WITH_GSSAPI=
8376         case "$_os" in
8377         Darwin)
8378             # MacOS X has system MIT Kerberos 5 since 10.4
8379             if test "$with_krb5" != "no"; then
8380                 WITH_KRB5=TRUE
8381                 save_LIBS=$LIBS
8382                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8383                 # that the libraries where these functions are located on macOS will change, is it?
8384                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8385                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8386                 KRB5_LIBS=$LIBS
8387                 LIBS=$save_LIBS
8388                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8389                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8390                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8391                 LIBS=$save_LIBS
8392             fi
8393             if test "$with_gssapi" != "no"; then
8394                 WITH_GSSAPI=TRUE
8395                 save_LIBS=$LIBS
8396                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8397                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8398                 GSSAPI_LIBS=$LIBS
8399                 LIBS=$save_LIBS
8400             fi
8401             ;;
8402         WINNT)
8403             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8404                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8405             fi
8406             ;;
8407         Linux|GNU|*BSD|DragonFly)
8408             if test "$with_krb5" != "no"; then
8409                 WITH_KRB5=TRUE
8410                 save_LIBS=$LIBS
8411                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8412                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8413                 KRB5_LIBS=$LIBS
8414                 LIBS=$save_LIBS
8415                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8416                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8417                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8418                 LIBS=$save_LIBS
8419             fi
8420             if test "$with_gssapi" != "no"; then
8421                 WITH_GSSAPI=TRUE
8422                 save_LIBS=$LIBS
8423                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8424                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8425                 GSSAPI_LIBS=$LIBS
8426                 LIBS=$save_LIBS
8427             fi
8428             ;;
8429         *)
8430             if test "$with_krb5" = "yes"; then
8431                 WITH_KRB5=TRUE
8432                 save_LIBS=$LIBS
8433                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8434                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8435                 KRB5_LIBS=$LIBS
8436                 LIBS=$save_LIBS
8437                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8438                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8439                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8440                 LIBS=$save_LIBS
8441             fi
8442             if test "$with_gssapi" = "yes"; then
8443                 WITH_GSSAPI=TRUE
8444                 save_LIBS=$LIBS
8445                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8446                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8447                 LIBS=$save_LIBS
8448                 GSSAPI_LIBS=$LIBS
8449             fi
8450         esac
8452         if test -n "$with_libpq_path"; then
8453             SYSTEM_POSTGRESQL=TRUE
8454             postgres_interface="external libpq"
8455             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8456             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8457         else
8458             SYSTEM_POSTGRESQL=
8459             postgres_interface="internal"
8460             POSTGRESQL_LIB=""
8461             POSTGRESQL_INC="%OVERRIDE_ME%"
8462             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8463         fi
8464     fi
8466     AC_MSG_CHECKING([PostgreSQL C interface])
8467     AC_MSG_RESULT([$postgres_interface])
8469     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8470         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8471         save_CFLAGS=$CFLAGS
8472         save_CPPFLAGS=$CPPFLAGS
8473         save_LIBS=$LIBS
8474         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8475         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8476         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8477         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8478             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8479         CFLAGS=$save_CFLAGS
8480         CPPFLAGS=$save_CPPFLAGS
8481         LIBS=$save_LIBS
8482     fi
8483     BUILD_POSTGRESQL_SDBC=TRUE
8485 AC_SUBST(WITH_KRB5)
8486 AC_SUBST(WITH_GSSAPI)
8487 AC_SUBST(GSSAPI_LIBS)
8488 AC_SUBST(KRB5_LIBS)
8489 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8490 AC_SUBST(SYSTEM_POSTGRESQL)
8491 AC_SUBST(POSTGRESQL_INC)
8492 AC_SUBST(POSTGRESQL_LIB)
8494 dnl ===================================================================
8495 dnl Check for Firebird stuff
8496 dnl ===================================================================
8497 ENABLE_FIREBIRD_SDBC=""
8498 if test "$enable_firebird_sdbc" = "yes" ; then
8499     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8501     dnl ===================================================================
8502     dnl Check for system Firebird
8503     dnl ===================================================================
8504     AC_MSG_CHECKING([which Firebird to use])
8505     if test "$with_system_firebird" = "yes"; then
8506         AC_MSG_RESULT([external])
8507         SYSTEM_FIREBIRD=TRUE
8508         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8509         if test -z "$FIREBIRDCONFIG"; then
8510             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8511             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8512                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8513             ])
8514             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8515         else
8516             AC_MSG_NOTICE([fb_config found])
8517             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8518             AC_MSG_CHECKING([for Firebird Client library])
8519             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8520             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8521             FilterLibs "${FIREBIRD_LIBS}"
8522             FIREBIRD_LIBS="${filteredlibs}"
8523         fi
8524         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8525         AC_MSG_CHECKING([Firebird version])
8526         if test -n "${FIREBIRD_VERSION}"; then
8527             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8528             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8529             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8530                 AC_MSG_RESULT([OK])
8531             else
8532                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
8533             fi
8534         else
8535             __save_CFLAGS="${CFLAGS}"
8536             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8537             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8538 #if defined(FB_API_VER) && FB_API_VER == 30
8539 int fb_api_is_30(void) { return 0; }
8540 #else
8541 #error "Wrong Firebird API version"
8542 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
8543             CFLAGS="${__save_CFLAGS}"
8544         fi
8545         ENABLE_FIREBIRD_SDBC="TRUE"
8546     elif test "$enable_database_connectivity" != yes; then
8547         AC_MSG_RESULT([none])
8548     elif test "$cross_compiling" = "yes"; then
8549         AC_MSG_RESULT([none])
8550     else
8551         dnl Embedded Firebird has version 3.0
8552         AC_DEFINE(HAVE_FIREBIRD_30, 1)
8553         dnl We need libatomic-ops for any non X86/X64 system
8554         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8555             dnl ===================================================================
8556             dnl Check for system libatomic-ops
8557             dnl ===================================================================
8558             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8559             if test "$with_system_libatomic_ops" = "yes"; then
8560                 SYSTEM_LIBATOMIC_OPS=TRUE
8561                 AC_CHECK_HEADERS(atomic_ops.h, [],
8562                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8563             else
8564                 SYSTEM_LIBATOMIC_OPS=
8565                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8566                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8567                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8568             fi
8569         fi
8571         AC_MSG_RESULT([internal])
8572         SYSTEM_FIREBIRD=
8573         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
8574         FIREBIRD_LIBS="-lfbclient"
8576         if test "$with_system_libtommath" = "yes"; then
8577             SYSTEM_LIBTOMMATH=TRUE
8578             dnl check for tommath presence
8579             save_LIBS=$LIBS
8580             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
8581             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
8582             LIBS=$save_LIBS
8583         else
8584             SYSTEM_LIBTOMMATH=
8585             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
8586             LIBTOMMATH_LIBS="-ltommath"
8587             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
8588         fi
8590         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8591         ENABLE_FIREBIRD_SDBC="TRUE"
8592     fi
8594 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8595 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8596 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8597 AC_SUBST(LIBATOMIC_OPS_LIBS)
8598 AC_SUBST(SYSTEM_FIREBIRD)
8599 AC_SUBST(FIREBIRD_CFLAGS)
8600 AC_SUBST(FIREBIRD_LIBS)
8601 AC_SUBST([TOMMATH_CFLAGS])
8602 AC_SUBST([TOMMATH_LIBS])
8604 dnl ===================================================================
8605 dnl Check for system curl
8606 dnl ===================================================================
8607 AC_MSG_CHECKING([which libcurl to use])
8608 if test "$with_system_curl" = "auto"; then
8609     with_system_curl="$with_system_libs"
8612 if test "$with_system_curl" = "yes"; then
8613     AC_MSG_RESULT([external])
8614     SYSTEM_CURL=TRUE
8616     # First try PKGCONFIG and then fall back
8617     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8619     if test -n "$CURL_PKG_ERRORS"; then
8620         AC_PATH_PROG(CURLCONFIG, curl-config)
8621         if test -z "$CURLCONFIG"; then
8622             AC_MSG_ERROR([curl development files not found])
8623         fi
8624         CURL_LIBS=`$CURLCONFIG --libs`
8625         FilterLibs "${CURL_LIBS}"
8626         CURL_LIBS="${filteredlibs}"
8627         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8628         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8630         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8631         case $curl_version in
8632         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8633         dnl so they need to be doubled to end up in the configure script
8634         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8635             AC_MSG_RESULT([yes])
8636             ;;
8637         *)
8638             AC_MSG_ERROR([no, you have $curl_version])
8639             ;;
8640         esac
8641     fi
8643     ENABLE_CURL=TRUE
8644 elif test $_os = iOS; then
8645     # Let's see if we need curl, I think not?
8646     AC_MSG_RESULT([none])
8647     ENABLE_CURL=
8648 else
8649     AC_MSG_RESULT([internal])
8650     SYSTEM_CURL=
8651     BUILD_TYPE="$BUILD_TYPE CURL"
8652     ENABLE_CURL=TRUE
8654 AC_SUBST(SYSTEM_CURL)
8655 AC_SUBST(CURL_CFLAGS)
8656 AC_SUBST(CURL_LIBS)
8657 AC_SUBST(ENABLE_CURL)
8659 dnl ===================================================================
8660 dnl Check for system boost
8661 dnl ===================================================================
8662 AC_MSG_CHECKING([which boost to use])
8663 if test "$with_system_boost" = "yes"; then
8664     AC_MSG_RESULT([external])
8665     SYSTEM_BOOST=TRUE
8666     AX_BOOST_BASE(1.47)
8667     AX_BOOST_DATE_TIME
8668     AX_BOOST_FILESYSTEM
8669     AX_BOOST_IOSTREAMS
8670     AX_BOOST_LOCALE
8671     AC_LANG_PUSH([C++])
8672     save_CXXFLAGS=$CXXFLAGS
8673     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8674     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8675        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8676     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8677        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8678     CXXFLAGS=$save_CXXFLAGS
8679     AC_LANG_POP([C++])
8680     # this is in m4/ax_boost_base.m4
8681     FilterLibs "${BOOST_LDFLAGS}"
8682     BOOST_LDFLAGS="${filteredlibs}"
8683 else
8684     AC_MSG_RESULT([internal])
8685     BUILD_TYPE="$BUILD_TYPE BOOST"
8686     SYSTEM_BOOST=
8687     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
8688         # use warning-suppressing wrapper headers
8689         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
8690     else
8691         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
8692     fi
8694 AC_SUBST(SYSTEM_BOOST)
8696 dnl ===================================================================
8697 dnl Check for system mdds
8698 dnl ===================================================================
8699 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.2 >= 1.2.3], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8701 dnl ===================================================================
8702 dnl Check for system glm
8703 dnl ===================================================================
8704 AC_MSG_CHECKING([which glm to use])
8705 if test "$with_system_glm" = "yes"; then
8706     AC_MSG_RESULT([external])
8707     SYSTEM_GLM=TRUE
8708     AC_LANG_PUSH([C++])
8709     AC_CHECK_HEADER([glm/glm.hpp], [],
8710        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8711     AC_LANG_POP([C++])
8712 else
8713     AC_MSG_RESULT([internal])
8714     BUILD_TYPE="$BUILD_TYPE GLM"
8715     SYSTEM_GLM=
8716     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8718 AC_SUBST([GLM_CFLAGS])
8719 AC_SUBST([SYSTEM_GLM])
8721 dnl ===================================================================
8722 dnl Check for system odbc
8723 dnl ===================================================================
8724 AC_MSG_CHECKING([which odbc headers to use])
8725 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
8726     AC_MSG_RESULT([external])
8727     SYSTEM_ODBC_HEADERS=TRUE
8729     if test "$build_os" = "cygwin"; then
8730         save_CPPFLAGS=$CPPFLAGS
8731         find_winsdk
8732         PathFormat "$winsdktest"
8733         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"
8734         AC_CHECK_HEADER(sqlext.h, [],
8735             [AC_MSG_ERROR(odbc not found. install odbc)],
8736             [#include <windows.h>])
8737         CPPFLAGS=$save_CPPFLAGS
8738     else
8739         AC_CHECK_HEADER(sqlext.h, [],
8740             [AC_MSG_ERROR(odbc not found. install odbc)],[])
8741     fi
8742 elif test "$enable_database_connectivity" != yes; then
8743     AC_MSG_RESULT([none])
8744 else
8745     AC_MSG_RESULT([internal])
8746     SYSTEM_ODBC_HEADERS=
8748 AC_SUBST(SYSTEM_ODBC_HEADERS)
8751 dnl ===================================================================
8752 dnl Check for system openldap
8753 dnl ===================================================================
8755 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8756 AC_MSG_CHECKING([which openldap library to use])
8757 if test "$with_system_openldap" = "yes"; then
8758     AC_MSG_RESULT([external])
8759     SYSTEM_OPENLDAP=TRUE
8760     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8761     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8762     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8763 else
8764     AC_MSG_RESULT([internal])
8765     SYSTEM_OPENLDAP=
8766     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8769 AC_SUBST(SYSTEM_OPENLDAP)
8771 dnl ===================================================================
8772 dnl Check for system NSS
8773 dnl ===================================================================
8774 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
8775     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8776     AC_DEFINE(HAVE_FEATURE_NSS)
8777     ENABLE_NSS="TRUE"
8778     AC_DEFINE(ENABLE_NSS)
8779 elif test $_os != iOS ; then
8780     with_tls=openssl
8782 AC_SUBST(ENABLE_NSS)
8784 dnl ===================================================================
8785 dnl Check for TLS/SSL and cryptographic implementation to use
8786 dnl ===================================================================
8787 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8788 if test -n "$with_tls"; then
8789     case $with_tls in
8790     openssl)
8791         AC_DEFINE(USE_TLS_OPENSSL)
8792         TLS=OPENSSL
8794         if test "$enable_openssl" != "yes"; then
8795             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8796         fi
8798         # warn that OpenSSL has been selected but not all TLS code has this option
8799         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
8800         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
8801         ;;
8802     nss)
8803         AC_DEFINE(USE_TLS_NSS)
8804         TLS=NSS
8805         ;;
8806     no)
8807         AC_MSG_WARN([Skipping TLS/SSL])
8808         ;;
8809     *)
8810         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8811 openssl - OpenSSL
8812 nss - Mozilla's Network Security Services (NSS)
8813     ])
8814         ;;
8815     esac
8816 else
8817     # default to using NSS, it results in smaller oox lib
8818     AC_DEFINE(USE_TLS_NSS)
8819     TLS=NSS
8821 AC_MSG_RESULT([$TLS])
8822 AC_SUBST(TLS)
8824 dnl ===================================================================
8825 dnl Check for system sane
8826 dnl ===================================================================
8827 AC_MSG_CHECKING([which sane header to use])
8828 if test "$with_system_sane" = "yes"; then
8829     AC_MSG_RESULT([external])
8830     AC_CHECK_HEADER(sane/sane.h, [],
8831       [AC_MSG_ERROR(sane not found. install sane)], [])
8832 else
8833     AC_MSG_RESULT([internal])
8834     BUILD_TYPE="$BUILD_TYPE SANE"
8837 dnl ===================================================================
8838 dnl Check for system icu
8839 dnl ===================================================================
8840 SYSTEM_GENBRK=
8841 SYSTEM_GENCCODE=
8842 SYSTEM_GENCMN=
8844 ICU_MAJOR=60
8845 ICU_MINOR=1
8846 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
8847 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
8848 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
8849 AC_MSG_CHECKING([which icu to use])
8850 if test "$with_system_icu" = "yes"; then
8851     AC_MSG_RESULT([external])
8852     SYSTEM_ICU=TRUE
8853     AC_LANG_PUSH([C++])
8854     AC_MSG_CHECKING([for unicode/rbbi.h])
8855     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
8856     AC_LANG_POP([C++])
8858     if test "$cross_compiling" != "yes"; then
8859         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
8860         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
8861         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
8862         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
8863     fi
8865     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
8866         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
8867         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
8868         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
8869         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
8870         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
8871             AC_MSG_RESULT([yes])
8872         else
8873             AC_MSG_RESULT([no])
8874             if test "$with_system_icu_for_build" != "force"; then
8875                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
8876 You can use --with-system-icu-for-build=force to use it anyway.])
8877             fi
8878         fi
8879     fi
8881     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
8882         # using the system icu tools can lead to version confusion, use the
8883         # ones from the build environment when cross-compiling
8884         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
8885         if test -z "$SYSTEM_GENBRK"; then
8886             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
8887         fi
8888         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8889         if test -z "$SYSTEM_GENCCODE"; then
8890             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
8891         fi
8892         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8893         if test -z "$SYSTEM_GENCMN"; then
8894             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
8895         fi
8896         if test "$ICU_MAJOR" -ge "49"; then
8897             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
8898             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
8899             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
8900         else
8901             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
8902             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
8903             ICU_RECLASSIFIED_HEBREW_LETTER=
8904         fi
8905     fi
8907     if test "$cross_compiling" = "yes"; then
8908         if test "$ICU_MAJOR" -ge "50"; then
8909             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
8910             ICU_MINOR=""
8911         fi
8912     fi
8913 else
8914     AC_MSG_RESULT([internal])
8915     SYSTEM_ICU=
8916     BUILD_TYPE="$BUILD_TYPE ICU"
8917     # surprisingly set these only for "internal" (to be used by various other
8918     # external libs): the system icu-config is quite unhelpful and spits out
8919     # dozens of weird flags and also default path -I/usr/include
8920     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8921     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
8923 if test "$ICU_MAJOR" -ge "59"; then
8924     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
8925     # with -std=c++11 but not all external libraries can be built with that,
8926     # for those use a bit-compatible typedef uint16_t UChar; see
8927     # icu/source/common/unicode/umachine.h
8928     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
8929 else
8930     ICU_UCHAR_TYPE=""
8932 AC_SUBST(SYSTEM_ICU)
8933 AC_SUBST(SYSTEM_GENBRK)
8934 AC_SUBST(SYSTEM_GENCCODE)
8935 AC_SUBST(SYSTEM_GENCMN)
8936 AC_SUBST(ICU_MAJOR)
8937 AC_SUBST(ICU_MINOR)
8938 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
8939 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
8940 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
8941 AC_SUBST(ICU_CFLAGS)
8942 AC_SUBST(ICU_LIBS)
8943 AC_SUBST(ICU_UCHAR_TYPE)
8945 dnl ==================================================================
8946 dnl Breakpad
8947 dnl ==================================================================
8948 AC_MSG_CHECKING([whether to enable breakpad])
8949 if test "$enable_breakpad" != yes; then
8950     AC_MSG_RESULT([no])
8951 else
8952     AC_MSG_RESULT([yes])
8953     ENABLE_BREAKPAD="TRUE"
8954     AC_DEFINE(ENABLE_BREAKPAD)
8955     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
8956     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
8958     AC_MSG_CHECKING([for crashreport config])
8959     if test "$with_symbol_config" = "no"; then
8960         BREAKPAD_SYMBOL_CONFIG="invalid"
8961         AC_MSG_RESULT([no])
8962     else
8963         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
8964         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
8965         AC_MSG_RESULT([yes])
8966     fi
8967     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
8969 AC_SUBST(ENABLE_BREAKPAD)
8971 dnl ==================================================================
8972 dnl libfuzzer
8973 dnl ==================================================================
8974 AC_MSG_CHECKING([whether to enable fuzzers])
8975 if test "$enable_fuzzers" != yes; then
8976     AC_MSG_RESULT([no])
8977 else
8978     AC_MSG_RESULT([yes])
8979     ENABLE_FUZZERS="TRUE"
8980     AC_DEFINE(ENABLE_FUZZERS)
8981     BUILD_TYPE="$BUILD_TYPE FUZZERS"
8983 AC_SUBST(ENABLE_FUZZERS)
8985 dnl ===================================================================
8986 dnl Orcus
8987 dnl ===================================================================
8988 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.13 >= 0.13.0])
8989 if test "$with_system_orcus" != "yes"; then
8990     if test "$SYSTEM_BOOST" = "TRUE"; then
8991         # ===========================================================
8992         # Determine if we are going to need to link with Boost.System
8993         # ===========================================================
8994         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
8995         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
8996         dnl in documentation has no effect.
8997         AC_MSG_CHECKING([if we need to link with Boost.System])
8998         AC_LANG_PUSH([C++])
8999         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9000                 @%:@include <boost/version.hpp>
9001             ]],[[
9002                 #if BOOST_VERSION >= 105000
9003                 #   error yes, we need to link with Boost.System
9004                 #endif
9005             ]])],[
9006                 AC_MSG_RESULT([no])
9007             ],[
9008                 AC_MSG_RESULT([yes])
9009                 AX_BOOST_SYSTEM
9010         ])
9011         AC_LANG_POP([C++])
9012     fi
9014 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9015 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9016 AC_SUBST([BOOST_SYSTEM_LIB])
9017 AC_SUBST(SYSTEM_LIBORCUS)
9019 dnl ===================================================================
9020 dnl HarfBuzz
9021 dnl ===================================================================
9022 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9023                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9024                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9026 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9027                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9028                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9030 if test "$COM" = "MSC"; then # override the above
9031     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9032     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9035 if test "$with_system_harfbuzz" = "yes"; then
9036     if test "$with_system_graphite" = "no"; then
9037         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9038     fi
9039     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9040     _save_libs="$LIBS"
9041     _save_cflags="$CFLAGS"
9042     LIBS="$LIBS $HARFBUZZ_LIBS"
9043     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9044     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9045     LIBS="$_save_libs"
9046     CFLAGS="$_save_cflags"
9047 else
9048     if test "$with_system_graphite" = "yes"; then
9049         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9050     fi
9053 AC_MSG_CHECKING([whether to use X11])
9054 dnl ***************************************
9055 dnl testing for X libraries and includes...
9056 dnl ***************************************
9057 if test "$USING_X11" = TRUE; then
9058     AC_DEFINE(HAVE_FEATURE_X11)
9060 AC_MSG_RESULT([$USING_X11])
9062 if test "$USING_X11" = TRUE; then
9063     AC_PATH_X
9064     AC_PATH_XTRA
9065     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9067     if test -z "$x_includes"; then
9068         x_includes="default_x_includes"
9069     fi
9070     if test -z "$x_libraries"; then
9071         x_libraries="default_x_libraries"
9072     fi
9073     CFLAGS="$CFLAGS $X_CFLAGS"
9074     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9075     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9076 else
9077     x_includes="no_x_includes"
9078     x_libraries="no_x_libraries"
9081 if test "$USING_X11" = TRUE; then
9082     dnl ===================================================================
9083     dnl Check for extension headers
9084     dnl ===================================================================
9085     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9086      [#include <X11/extensions/shape.h>])
9088     # vcl needs ICE and SM
9089     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9090     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9091         [AC_MSG_ERROR(ICE library not found)])
9092     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9093     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9094         [AC_MSG_ERROR(SM library not found)])
9097 dnl ===================================================================
9098 dnl Check for system Xrender
9099 dnl ===================================================================
9100 AC_MSG_CHECKING([whether to use Xrender])
9101 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9102     AC_MSG_RESULT([yes])
9103     PKG_CHECK_MODULES(XRENDER, xrender)
9104     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9105     FilterLibs "${XRENDER_LIBS}"
9106     XRENDER_LIBS="${filteredlibs}"
9107     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9108       [AC_MSG_ERROR(libXrender not found or functional)], [])
9109     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9110       [AC_MSG_ERROR(Xrender not found. install X)], [])
9111 else
9112     AC_MSG_RESULT([no])
9114 AC_SUBST(XRENDER_CFLAGS)
9115 AC_SUBST(XRENDER_LIBS)
9117 dnl ===================================================================
9118 dnl Check for XRandr
9119 dnl ===================================================================
9120 AC_MSG_CHECKING([whether to enable RandR support])
9121 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9122     AC_MSG_RESULT([yes])
9123     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9124     if test "$ENABLE_RANDR" != "TRUE"; then
9125         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9126                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9127         XRANDR_CFLAGS=" "
9128         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9129           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9130         XRANDR_LIBS="-lXrandr "
9131         ENABLE_RANDR="TRUE"
9132     fi
9133     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9134     FilterLibs "${XRANDR_LIBS}"
9135     XRANDR_LIBS="${filteredlibs}"
9136 else
9137     ENABLE_RANDR=""
9138     AC_MSG_RESULT([no])
9140 AC_SUBST(XRANDR_CFLAGS)
9141 AC_SUBST(XRANDR_LIBS)
9142 AC_SUBST(ENABLE_RANDR)
9144 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9145     WITH_WEBDAV="serf"
9147 if test $_os = iOS -o $_os = Android; then
9148     WITH_WEBDAV="no"
9150 AC_MSG_CHECKING([for webdav library])
9151 case "$WITH_WEBDAV" in
9152 serf)
9153     AC_MSG_RESULT([serf])
9154     # Check for system apr-util
9155     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9156                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9157                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9158     if test "$COM" = "MSC"; then
9159         APR_LIB_DIR="LibR"
9160         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9161         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9162     fi
9164     # Check for system serf
9165     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9166                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9167     if test "$COM" = "MSC"; then
9168         SERF_LIB_DIR="Release"
9169         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9170         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9171     fi
9172     ;;
9173 neon)
9174     AC_MSG_RESULT([neon])
9175     # Check for system neon
9176     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9177     if test "$with_system_neon" = "yes"; then
9178         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9179     else
9180         NEON_VERSION=0295
9181     fi
9182     AC_SUBST(NEON_VERSION)
9183     ;;
9185     AC_MSG_RESULT([none, disabled])
9186     WITH_WEBDAV=""
9187     ;;
9188 esac
9189 AC_SUBST(WITH_WEBDAV)
9191 dnl ===================================================================
9192 dnl Check for disabling cve_tests
9193 dnl ===================================================================
9194 AC_MSG_CHECKING([whether to execute CVE tests])
9195 # If not explicitly enabled or disabled, default
9196 if test -z "$enable_cve_tests"; then
9197     case "$OS" in
9198     WNT)
9199         # Default cves off for windows with its wild and wonderful
9200         # varienty of AV software kicking in and panicing
9201         enable_cve_tests=no
9202         ;;
9203     *)
9204         # otherwise yes
9205         enable_cve_tests=yes
9206         ;;
9207     esac
9209 if test "$enable_cve_tests" = "no"; then
9210     AC_MSG_RESULT([no])
9211     DISABLE_CVE_TESTS=TRUE
9212     AC_SUBST(DISABLE_CVE_TESTS)
9213 else
9214     AC_MSG_RESULT([yes])
9217 dnl ===================================================================
9218 dnl Check for enabling chart XShape tests
9219 dnl ===================================================================
9220 AC_MSG_CHECKING([whether to execute chart XShape tests])
9221 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9222     AC_MSG_RESULT([yes])
9223     ENABLE_CHART_TESTS=TRUE
9224     AC_SUBST(ENABLE_CHART_TESTS)
9225 else
9226     AC_MSG_RESULT([no])
9229 dnl ===================================================================
9230 dnl Check for system openssl
9231 dnl ===================================================================
9232 DISABLE_OPENSSL=
9233 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9234 if test "$enable_openssl" = "yes"; then
9235     AC_MSG_RESULT([no])
9236     if test "$_os" = Darwin ; then
9237         # OpenSSL is deprecated when building for 10.7 or later.
9238         #
9239         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9240         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9242         with_system_openssl=no
9243         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9244     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9245             && test "$with_system_openssl" != "no"; then
9246         with_system_openssl=yes
9247         SYSTEM_OPENSSL=TRUE
9248         OPENSSL_CFLAGS=
9249         OPENSSL_LIBS="-lssl -lcrypto"
9250     else
9251         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9252     fi
9253     if test "$with_system_openssl" = "yes"; then
9254         AC_MSG_CHECKING([whether openssl supports SHA512])
9255         AC_LANG_PUSH([C])
9256         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9257             SHA512_CTX context;
9258 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9259         AC_LANG_POP(C)
9260     fi
9261 else
9262     AC_MSG_RESULT([yes])
9263     DISABLE_OPENSSL=TRUE
9265     # warn that although OpenSSL is disabled, system libraries may depend on it
9266     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9267     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9270 AC_SUBST([DISABLE_OPENSSL])
9272 dnl ===================================================================
9273 dnl Check for building gnutls
9274 dnl ===================================================================
9275 AC_MSG_CHECKING([whether to use gnutls])
9276 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9277     AC_MSG_RESULT([yes])
9278     AM_PATH_LIBGCRYPT()
9279     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9280         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9281                       available in the system to use as replacement.]]))
9282     FilterLibs "${LIBGCRYPT_LIBS}"
9283     LIBGCRYPT_LIBS="${filteredlibs}"
9284 else
9285     AC_MSG_RESULT([no])
9288 AC_SUBST([LIBGCRYPT_CFLAGS])
9289 AC_SUBST([LIBGCRYPT_LIBS])
9291 dnl ===================================================================
9292 dnl Check for system redland
9293 dnl ===================================================================
9294 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9295 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9296 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9297 if test "$with_system_redland" = "yes"; then
9298     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9299             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9300 else
9301     RAPTOR_MAJOR="0"
9302     RASQAL_MAJOR="3"
9303     REDLAND_MAJOR="0"
9305 AC_SUBST(RAPTOR_MAJOR)
9306 AC_SUBST(RASQAL_MAJOR)
9307 AC_SUBST(REDLAND_MAJOR)
9309 dnl ===================================================================
9310 dnl Check for system hunspell
9311 dnl ===================================================================
9312 AC_MSG_CHECKING([which libhunspell to use])
9313 if test "$with_system_hunspell" = "yes"; then
9314     AC_MSG_RESULT([external])
9315     SYSTEM_HUNSPELL=TRUE
9316     AC_LANG_PUSH([C++])
9317     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9318     if test "$HUNSPELL_PC" != "TRUE"; then
9319         AC_CHECK_HEADER(hunspell.hxx, [],
9320             [
9321             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9322             [AC_MSG_ERROR(hunspell headers not found.)], [])
9323             ], [])
9324         AC_CHECK_LIB([hunspell], [main], [:],
9325            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9326         HUNSPELL_LIBS=-lhunspell
9327     fi
9328     AC_LANG_POP([C++])
9329     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9330     FilterLibs "${HUNSPELL_LIBS}"
9331     HUNSPELL_LIBS="${filteredlibs}"
9332 else
9333     AC_MSG_RESULT([internal])
9334     SYSTEM_HUNSPELL=
9335     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9336     if test "$COM" = "MSC"; then
9337         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9338     else
9339         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.6"
9340     fi
9341     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9343 AC_SUBST(SYSTEM_HUNSPELL)
9344 AC_SUBST(HUNSPELL_CFLAGS)
9345 AC_SUBST(HUNSPELL_LIBS)
9347 dnl ===================================================================
9348 dnl Checking for altlinuxhyph
9349 dnl ===================================================================
9350 AC_MSG_CHECKING([which altlinuxhyph to use])
9351 if test "$with_system_altlinuxhyph" = "yes"; then
9352     AC_MSG_RESULT([external])
9353     SYSTEM_HYPH=TRUE
9354     AC_CHECK_HEADER(hyphen.h, [],
9355        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9356     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9357        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9358        [#include <hyphen.h>])
9359     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9360         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9361     if test -z "$HYPHEN_LIB"; then
9362         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9363            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9364     fi
9365     if test -z "$HYPHEN_LIB"; then
9366         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9367            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9368     fi
9369 else
9370     AC_MSG_RESULT([internal])
9371     SYSTEM_HYPH=
9372     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9373     if test "$COM" = "MSC"; then
9374         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9375     else
9376         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9377     fi
9379 AC_SUBST(SYSTEM_HYPH)
9380 AC_SUBST(HYPHEN_LIB)
9382 dnl ===================================================================
9383 dnl Checking for mythes
9384 dnl ===================================================================
9385 AC_MSG_CHECKING([which mythes to use])
9386 if test "$with_system_mythes" = "yes"; then
9387     AC_MSG_RESULT([external])
9388     SYSTEM_MYTHES=TRUE
9389     AC_LANG_PUSH([C++])
9390     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9391     if test "$MYTHES_PKGCONFIG" = "no"; then
9392         AC_CHECK_HEADER(mythes.hxx, [],
9393             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9394         AC_CHECK_LIB([mythes-1.2], [main], [:],
9395             [ MYTHES_FOUND=no], [])
9396     if test "$MYTHES_FOUND" = "no"; then
9397         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9398                 [ MYTHES_FOUND=no], [])
9399     fi
9400     if test "$MYTHES_FOUND" = "no"; then
9401         AC_MSG_ERROR([mythes library not found!.])
9402     fi
9403     fi
9404     AC_LANG_POP([C++])
9405     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9406     FilterLibs "${MYTHES_LIBS}"
9407     MYTHES_LIBS="${filteredlibs}"
9408 else
9409     AC_MSG_RESULT([internal])
9410     SYSTEM_MYTHES=
9411     BUILD_TYPE="$BUILD_TYPE MYTHES"
9412     if test "$COM" = "MSC"; then
9413         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9414     else
9415         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9416     fi
9418 AC_SUBST(SYSTEM_MYTHES)
9419 AC_SUBST(MYTHES_CFLAGS)
9420 AC_SUBST(MYTHES_LIBS)
9422 dnl ===================================================================
9423 dnl How should we build the linear programming solver ?
9424 dnl ===================================================================
9426 ENABLE_COINMP=
9427 AC_MSG_CHECKING([whether to build with CoinMP])
9428 if test "$enable_coinmp" != "no"; then
9429     ENABLE_COINMP=TRUE
9430     AC_MSG_RESULT([yes])
9431     if test "$with_system_coinmp" = "yes"; then
9432         SYSTEM_COINMP=TRUE
9433         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9434         FilterLibs "${COINMP_LIBS}"
9435         COINMP_LIBS="${filteredlibs}"
9436     else
9437         BUILD_TYPE="$BUILD_TYPE COINMP"
9438     fi
9439 else
9440     AC_MSG_RESULT([no])
9442 AC_SUBST(ENABLE_COINMP)
9443 AC_SUBST(SYSTEM_COINMP)
9444 AC_SUBST(COINMP_CFLAGS)
9445 AC_SUBST(COINMP_LIBS)
9447 ENABLE_LPSOLVE=
9448 AC_MSG_CHECKING([whether to build with lpsolve])
9449 if test "$enable_lpsolve" != "no"; then
9450     ENABLE_LPSOLVE=TRUE
9451     AC_MSG_RESULT([yes])
9452 else
9453     AC_MSG_RESULT([no])
9455 AC_SUBST(ENABLE_LPSOLVE)
9457 if test "$ENABLE_LPSOLVE" = TRUE; then
9458     AC_MSG_CHECKING([which lpsolve to use])
9459     if test "$with_system_lpsolve" = "yes"; then
9460         AC_MSG_RESULT([external])
9461         SYSTEM_LPSOLVE=TRUE
9462         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9463            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9464         save_LIBS=$LIBS
9465         # some systems need this. Like Ubuntu....
9466         AC_CHECK_LIB(m, floor)
9467         AC_CHECK_LIB(dl, dlopen)
9468         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9469             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9470         LIBS=$save_LIBS
9471     else
9472         AC_MSG_RESULT([internal])
9473         SYSTEM_LPSOLVE=
9474         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9475     fi
9477 AC_SUBST(SYSTEM_LPSOLVE)
9479 dnl ===================================================================
9480 dnl Checking for libexttextcat
9481 dnl ===================================================================
9482 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9483 if test "$with_system_libexttextcat" = "yes"; then
9484     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9486 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9488 dnl ***************************************
9489 dnl testing libc version for Linux...
9490 dnl ***************************************
9491 if test "$_os" = "Linux"; then
9492     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9493     exec 6>/dev/null # no output
9494     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9495     exec 6>&1 # output on again
9496     if test "$HAVE_LIBC"; then
9497         AC_MSG_RESULT([yes])
9498     else
9499         AC_MSG_ERROR([no, upgrade libc])
9500     fi
9503 dnl =========================================
9504 dnl Check for uuidgen
9505 dnl =========================================
9506 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9507     # presence is already tested above in the WINDOWS_SDK_HOME check
9508     UUIDGEN=uuidgen.exe
9509     AC_SUBST(UUIDGEN)
9510 else
9511     AC_PATH_PROG([UUIDGEN], [uuidgen])
9512     if test -z "$UUIDGEN"; then
9513         AC_MSG_WARN([uuid is needed for building installation sets])
9514     fi
9517 dnl ***************************************
9518 dnl Checking for bison and flex
9519 dnl ***************************************
9520 AC_PATH_PROG(BISON, bison)
9521 if test -z "$BISON"; then
9522     AC_MSG_ERROR([no bison found in \$PATH, install it])
9523 else
9524     AC_MSG_CHECKING([the bison version])
9525     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9526     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9527     # Accept newer than 2.0
9528     if test "$_bison_longver" -lt 2000; then
9529         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9530     fi
9533 AC_PATH_PROG(FLEX, flex)
9534 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9535     FLEX=`cygpath -m $FLEX`
9537 if test -z "$FLEX"; then
9538     AC_MSG_ERROR([no flex found in \$PATH, install it])
9539 else
9540     AC_MSG_CHECKING([the flex version])
9541     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9542     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9543         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9544     fi
9546 AC_SUBST([FLEX])
9547 dnl ***************************************
9548 dnl Checking for patch
9549 dnl ***************************************
9550 AC_PATH_PROG(PATCH, patch)
9551 if test -z "$PATCH"; then
9552     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9555 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9556 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9557     if test -z "$with_gnu_patch"; then
9558         GNUPATCH=$PATCH
9559     else
9560         if test -x "$with_gnu_patch"; then
9561             GNUPATCH=$with_gnu_patch
9562         else
9563             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9564         fi
9565     fi
9567     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9568     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9569         AC_MSG_RESULT([yes])
9570     else
9571         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9572     fi
9573 else
9574     GNUPATCH=$PATCH
9577 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9578     GNUPATCH=`cygpath -m $GNUPATCH`
9581 dnl We also need to check for --with-gnu-cp
9583 if test -z "$with_gnu_cp"; then
9584     # check the place where the good stuff is hidden on Solaris...
9585     if test -x /usr/gnu/bin/cp; then
9586         GNUCP=/usr/gnu/bin/cp
9587     else
9588         AC_PATH_PROGS(GNUCP, gnucp cp)
9589     fi
9590     if test -z $GNUCP; then
9591         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9592     fi
9593 else
9594     if test -x "$with_gnu_cp"; then
9595         GNUCP=$with_gnu_cp
9596     else
9597         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9598     fi
9601 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9602     GNUCP=`cygpath -m $GNUCP`
9605 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9606 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9607     AC_MSG_RESULT([yes])
9608 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9609     AC_MSG_RESULT([yes])
9610 else
9611     case "$build_os" in
9612     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9613         x_GNUCP=[\#]
9614         GNUCP=''
9615         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9616         ;;
9617     *)
9618         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9619         ;;
9620     esac
9623 AC_SUBST(GNUPATCH)
9624 AC_SUBST(GNUCP)
9625 AC_SUBST(x_GNUCP)
9627 dnl ***************************************
9628 dnl testing assembler path
9629 dnl ***************************************
9630 ML_EXE=""
9631 if test "$_os" = "WINNT"; then
9632     if test "$BITNESS_OVERRIDE" = ""; then
9633         assembler=ml.exe
9634         assembler_bin=$CL_DIR
9635     else
9636         assembler=ml64.exe
9637         assembler_bin=$CL_DIR
9638     fi
9640     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9641     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9642         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9643         AC_MSG_RESULT([found])
9644         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9645     else
9646         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9647     fi
9649     PathFormat "$ASM_HOME"
9650     ASM_HOME="$formatted_path"
9651 else
9652     ASM_HOME=""
9655 AC_SUBST(ML_EXE)
9657 dnl ===================================================================
9658 dnl We need zip and unzip
9659 dnl ===================================================================
9660 AC_PATH_PROG(ZIP, zip)
9661 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9662 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9663     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],,)
9666 AC_PATH_PROG(UNZIP, unzip)
9667 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9669 dnl ===================================================================
9670 dnl Zip must be a specific type for different build types.
9671 dnl ===================================================================
9672 if test $build_os = cygwin; then
9673     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9674         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9675     fi
9678 dnl ===================================================================
9679 dnl We need touch with -h option support.
9680 dnl ===================================================================
9681 AC_PATH_PROG(TOUCH, touch)
9682 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
9683 touch warn
9684 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
9685     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],,)
9688 dnl ===================================================================
9689 dnl Check for system epoxy
9690 dnl ===================================================================
9691 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
9693 dnl ===================================================================
9694 dnl Set vcl option: coordinate device in double or sal_Int32
9695 dnl ===================================================================
9697 dnl disabled for now, we don't want subtle differences between OSs
9698 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
9699 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
9700 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
9701 dnl     AC_MSG_RESULT([double])
9702 dnl else
9703 dnl     AC_MSG_RESULT([sal_Int32])
9704 dnl fi
9706 dnl ===================================================================
9707 dnl Test which vclplugs have to be built.
9708 dnl ===================================================================
9709 R=""
9710 if test "$USING_X11" != TRUE; then
9711     enable_gtk=no
9712     enable_gtk3=no
9714 GTK3_CFLAGS=""
9715 GTK3_LIBS=""
9716 ENABLE_GTK3=""
9717 if test "x$enable_gtk3" = "xyes"; then
9718     if test "$with_system_cairo" = no; then
9719         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
9720     fi
9721     : ${with_system_cairo:=yes}
9722     PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.8 gtk+-unix-print-3.0 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo, ENABLE_GTK3="TRUE", ENABLE_GTK3="")
9723     if test "x$ENABLE_GTK3" = "xTRUE"; then
9724         R="gtk3"
9725         dnl Avoid installed by unpackaged files for now.
9726         if test -z "$PKGFORMAT"; then
9727             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
9728         fi
9729     else
9730         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
9731     fi
9732     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9733     FilterLibs "${GTK3_LIBS}"
9734     GTK3_LIBS="${filteredlibs}"
9736     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
9737     if test "$with_system_epoxy" != "yes"; then
9738         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
9739     fi
9741 AC_SUBST(GTK3_LIBS)
9742 AC_SUBST(GTK3_CFLAGS)
9743 AC_SUBST(ENABLE_GTK3)
9745 ENABLE_GTK=""
9746 if test "x$enable_gtk" = "xyes"; then
9747     if test "$with_system_cairo" = no; then
9748         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
9749     fi
9750     : ${with_system_cairo:=yes}
9751     ENABLE_GTK="TRUE"
9752     AC_DEFINE(ENABLE_GTK)
9753     R="gtk $R"
9755 AC_SUBST(ENABLE_GTK)
9757 ENABLE_KDE4=""
9758 if test "x$enable_kde4" = "xyes"; then
9759     ENABLE_KDE4="TRUE"
9760     AC_DEFINE(ENABLE_KDE4)
9761     R="$R kde4"
9763 AC_SUBST(ENABLE_KDE4)
9765 ENABLE_QT5=""
9766 if test "x$enable_qt5" = "xyes"; then
9767     ENABLE_QT5="TRUE"
9768     AC_DEFINE(ENABLE_QT5)
9769     R="$R qt5"
9771 AC_SUBST(ENABLE_QT5)
9773 build_vcl_plugins="$R"
9774 if test -z "$build_vcl_plugins"; then
9775     build_vcl_plugins="none"
9777 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
9779 dnl ===================================================================
9780 dnl check for dbus support
9781 dnl ===================================================================
9782 ENABLE_DBUS=""
9783 DBUS_CFLAGS=""
9784 DBUS_LIBS=""
9786 if test "$enable_dbus" = "no"; then
9787     test_dbus=no
9790 AC_MSG_CHECKING([whether to enable DBUS support])
9791 if test "$test_dbus" = "yes"; then
9792     ENABLE_DBUS="TRUE"
9793     AC_MSG_RESULT([yes])
9794     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
9795     AC_DEFINE(ENABLE_DBUS)
9796     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9797     FilterLibs "${DBUS_LIBS}"
9798     DBUS_LIBS="${filteredlibs}"
9799 else
9800     AC_MSG_RESULT([no])
9803 AC_SUBST(ENABLE_DBUS)
9804 AC_SUBST(DBUS_CFLAGS)
9805 AC_SUBST(DBUS_LIBS)
9807 AC_MSG_CHECKING([whether to enable Impress remote control])
9808 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
9809     AC_MSG_RESULT([yes])
9810     ENABLE_SDREMOTE=TRUE
9811     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
9813     # If not explicitly enabled or disabled, default
9814     if test -z "$enable_sdremote_bluetooth"; then
9815         case "$OS" in
9816         LINUX|MACOSX|WNT)
9817             # Default to yes for these
9818             enable_sdremote_bluetooth=yes
9819             ;;
9820         *)
9821             # otherwise no
9822             enable_sdremote_bluetooth=no
9823             ;;
9824         esac
9825     fi
9826     # $enable_sdremote_bluetooth is guaranteed non-empty now
9828     if test "$enable_sdremote_bluetooth" != "no"; then
9829         if test "$OS" = "LINUX"; then
9830             if test "$ENABLE_DBUS" = "TRUE"; then
9831                 AC_MSG_RESULT([yes])
9832                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
9833                 dnl ===================================================================
9834                 dnl Check for system bluez
9835                 dnl ===================================================================
9836                 AC_MSG_CHECKING([which Bluetooth header to use])
9837                 if test "$with_system_bluez" = "yes"; then
9838                     AC_MSG_RESULT([external])
9839                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
9840                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
9841                     SYSTEM_BLUEZ=TRUE
9842                 else
9843                     AC_MSG_RESULT([internal])
9844                     SYSTEM_BLUEZ=
9845                 fi
9846             else
9847                 AC_MSG_RESULT([no, dbus disabled])
9848                 ENABLE_SDREMOTE_BLUETOOTH=
9849                 SYSTEM_BLUEZ=
9850             fi
9851         else
9852             AC_MSG_RESULT([yes])
9853             ENABLE_SDREMOTE_BLUETOOTH=TRUE
9854             SYSTEM_BLUEZ=
9855         fi
9856     else
9857         AC_MSG_RESULT([no])
9858         ENABLE_SDREMOTE_BLUETOOTH=
9859         SYSTEM_BLUEZ=
9860     fi
9861 else
9862     ENABLE_SDREMOTE=
9863     SYSTEM_BLUEZ=
9864     AC_MSG_RESULT([no])
9866 AC_SUBST(ENABLE_SDREMOTE)
9867 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
9868 AC_SUBST(SYSTEM_BLUEZ)
9870 dnl ===================================================================
9871 dnl Check whether the gtk 2.0 libraries are available.
9872 dnl ===================================================================
9874 GTK_CFLAGS=""
9875 GTK_LIBS=""
9876 ENABLE_SYSTRAY_GTK=""
9877 if test  "$test_gtk" = "yes"; then
9879     if test "$ENABLE_GTK" = "TRUE"; then
9880         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]))
9881         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9882         FilterLibs "${GTK_LIBS}"
9883         GTK_LIBS="${filteredlibs}"
9884         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]))
9885         BUILD_TYPE="$BUILD_TYPE GTK"
9886         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9887         FilterLibs "${GTHREAD_LIBS}"
9888         GTHREAD_LIBS="${filteredlibs}"
9890         if test "x$enable_systray" = "xyes"; then
9891             ENABLE_SYSTRAY_GTK="TRUE"
9892         fi
9894         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
9895         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
9896                           [ENABLE_GTK_PRINT="TRUE"],
9897                           [ENABLE_GTK_PRINT=""])
9898         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9899         FilterLibs "${GTK_PRINT_LIBS}"
9900         GTK_PRINT_LIBS="${filteredlibs}"
9902         AC_MSG_CHECKING([whether to enable GIO support])
9903         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
9904             dnl Need at least 2.26 for the dbus support.
9905             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
9906                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
9907             if test "$ENABLE_GIO" = "TRUE"; then
9908                 AC_DEFINE(ENABLE_GIO)
9909                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9910                 FilterLibs "${GIO_LIBS}"
9911                 GIO_LIBS="${filteredlibs}"
9912             fi
9913         else
9914             AC_MSG_RESULT([no])
9915         fi
9916     fi
9918 AC_SUBST(ENABLE_GIO)
9919 AC_SUBST(GIO_CFLAGS)
9920 AC_SUBST(GIO_LIBS)
9921 AC_SUBST(ENABLE_SYSTRAY_GTK)
9922 AC_SUBST(GTK_CFLAGS)
9923 AC_SUBST(GTK_LIBS)
9924 AC_SUBST(GTHREAD_CFLAGS)
9925 AC_SUBST(GTHREAD_LIBS)
9926 AC_SUBST([ENABLE_GTK_PRINT])
9927 AC_SUBST([GTK_PRINT_CFLAGS])
9928 AC_SUBST([GTK_PRINT_LIBS])
9931 dnl ===================================================================
9933 SPLIT_APP_MODULES=""
9934 if test "$enable_split_app_modules" = "yes"; then
9935     SPLIT_APP_MODULES="TRUE"
9937 AC_SUBST(SPLIT_APP_MODULES)
9939 SPLIT_OPT_FEATURES=""
9940 if test "$enable_split_opt_features" = "yes"; then
9941     SPLIT_OPT_FEATURES="TRUE"
9943 AC_SUBST(SPLIT_OPT_FEATURES)
9945 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
9946     if test "$enable_cairo_canvas" = yes; then
9947         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
9948     fi
9949     enable_cairo_canvas=no
9950 elif test -z "$enable_cairo_canvas"; then
9951     enable_cairo_canvas=yes
9954 ENABLE_CAIRO_CANVAS=""
9955 if test "$enable_cairo_canvas" = "yes"; then
9956     test_cairo=yes
9957     ENABLE_CAIRO_CANVAS="TRUE"
9958     AC_DEFINE(ENABLE_CAIRO_CANVAS)
9960 AC_SUBST(ENABLE_CAIRO_CANVAS)
9962 dnl ===================================================================
9963 dnl Check whether the GStreamer libraries are available.
9964 dnl It's possible to build avmedia with both GStreamer backends!
9965 dnl ===================================================================
9967 ENABLE_GSTREAMER_1_0=""
9969 if test "$build_gstreamer_1_0" = "yes"; then
9971     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
9972     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
9973         ENABLE_GSTREAMER_1_0="TRUE"
9974         AC_MSG_RESULT([yes])
9975         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
9976         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9977         FilterLibs "${GSTREAMER_1_0_LIBS}"
9978         GSTREAMER_1_0_LIBS="${filteredlibs}"
9979     else
9980         AC_MSG_RESULT([no])
9981     fi
9983 AC_SUBST(GSTREAMER_1_0_CFLAGS)
9984 AC_SUBST(GSTREAMER_1_0_LIBS)
9985 AC_SUBST(ENABLE_GSTREAMER_1_0)
9988 ENABLE_GSTREAMER_0_10=""
9989 if test "$build_gstreamer_0_10" = "yes"; then
9991     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
9992     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
9993         ENABLE_GSTREAMER_0_10="TRUE"
9994         AC_MSG_RESULT([yes])
9995         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
9996             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
9997         ])
9998         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9999         FilterLibs "${GSTREAMER_0_10_LIBS}"
10000         GSTREAMER_0_10_LIBS="${filteredlibs}"
10001     else
10002         AC_MSG_RESULT([no])
10003     fi
10006 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10007 AC_SUBST(GSTREAMER_0_10_LIBS)
10008 AC_SUBST(ENABLE_GSTREAMER_0_10)
10010 dnl ===================================================================
10011 dnl Check whether to build the VLC avmedia backend
10012 dnl ===================================================================
10014 ENABLE_VLC=""
10016 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10017 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10018     ENABLE_VLC="TRUE"
10019     AC_MSG_RESULT([yes])
10020 else
10021     AC_MSG_RESULT([no])
10023 AC_SUBST(ENABLE_VLC)
10025 ENABLE_OPENGL_TRANSITIONS=
10026 ENABLE_OPENGL_CANVAS=
10027 if test $_os = iOS -o $_os = Android; then
10028    : # disable
10029 elif test "$_os" = "Darwin"; then
10030     # We use frameworks on Mac OS X, no need for detail checks
10031     ENABLE_OPENGL_TRANSITIONS=TRUE
10032     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10033     ENABLE_OPENGL_CANVAS=TRUE
10034 elif test $_os = WINNT; then
10035     ENABLE_OPENGL_TRANSITIONS=TRUE
10036     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10037     ENABLE_OPENGL_CANVAS=TRUE
10038 else
10039     if test "$USING_X11" = TRUE; then
10040         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10041         ENABLE_OPENGL_TRANSITIONS=TRUE
10042         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10043         ENABLE_OPENGL_CANVAS=TRUE
10044     fi
10047 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10048 AC_SUBST(ENABLE_OPENGL_CANVAS)
10050 dnl =================================================
10051 dnl Check whether to build with OpenCL support.
10052 dnl =================================================
10054 if test $_os != iOS -a $_os != Android; then
10055     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10056     # platform (optional at run-time, used through clew).
10057     BUILD_TYPE="$BUILD_TYPE OPENCL"
10058     AC_DEFINE(HAVE_FEATURE_OPENCL)
10061 dnl =================================================
10062 dnl Check whether to build with dconf support.
10063 dnl =================================================
10065 if test "$enable_dconf" != no; then
10066     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10067         if test "$enable_dconf" = yes; then
10068             AC_MSG_ERROR([dconf not found])
10069         else
10070             enable_dconf=no
10071         fi])
10073 AC_MSG_CHECKING([whether to enable dconf])
10074 if test "$enable_dconf" = no; then
10075     DCONF_CFLAGS=
10076     DCONF_LIBS=
10077     ENABLE_DCONF=
10078     AC_MSG_RESULT([no])
10079 else
10080     ENABLE_DCONF=TRUE
10081     AC_DEFINE(ENABLE_DCONF)
10082     AC_MSG_RESULT([yes])
10084 AC_SUBST([DCONF_CFLAGS])
10085 AC_SUBST([DCONF_LIBS])
10086 AC_SUBST([ENABLE_DCONF])
10088 # pdf import?
10089 AC_MSG_CHECKING([whether to build the PDF import feature])
10090 ENABLE_PDFIMPORT=
10091 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10092     AC_MSG_RESULT([yes])
10093     ENABLE_PDFIMPORT=TRUE
10094     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10096     dnl ===================================================================
10097     dnl Check for system poppler
10098     dnl ===================================================================
10099     AC_MSG_CHECKING([which PDF import backend to use])
10100     if test "$with_system_poppler" = "yes"; then
10101         AC_MSG_RESULT([external])
10102         SYSTEM_POPPLER=TRUE
10103         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10104         AC_LANG_PUSH([C++])
10105         save_CXXFLAGS=$CXXFLAGS
10106         save_CPPFLAGS=$CPPFLAGS
10107         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10108         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10109         AC_CHECK_HEADER([cpp/poppler-version.h],
10110             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10111             [])
10112         CXXFLAGS=$save_CXXFLAGS
10113         CPPFLAGS=$save_CPPFLAGS
10114         AC_LANG_POP([C++])
10115         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10117         FilterLibs "${POPPLER_LIBS}"
10118         POPPLER_LIBS="${filteredlibs}"
10119     else
10120         AC_MSG_RESULT([internal])
10121         SYSTEM_POPPLER=
10122         BUILD_TYPE="$BUILD_TYPE POPPLER"
10123         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10124     fi
10125     AC_DEFINE([ENABLE_PDFIMPORT],1)
10126 else
10127     AC_MSG_RESULT([no])
10129 AC_SUBST(ENABLE_PDFIMPORT)
10130 AC_SUBST(SYSTEM_POPPLER)
10131 AC_SUBST(POPPLER_CFLAGS)
10132 AC_SUBST(POPPLER_LIBS)
10134 # pdf import?
10135 AC_MSG_CHECKING([whether to build PDFium])
10136 ENABLE_PDFIUM=
10137 if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then
10138     AC_MSG_RESULT([yes])
10139     ENABLE_PDFIUM=TRUE
10140     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10141     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10142 else
10143     AC_MSG_RESULT([no])
10145 AC_SUBST(ENABLE_PDFIUM)
10147 SYSTEM_GPGMEPP=
10148 # need matching cygwin arch for building gpgme sadly, for the while
10149 if test "$_os" = "Linux" -o "$_os" = "Darwin" \
10150    -o \( "$_os" = "WINNT" -a "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x86" \) \
10151    -o \( "$_os" = "WINNT" -a "$host_cpu" = "x86_64" -a "$WINDOWS_SDK_ARCH" = "x64" \) ; then
10153     dnl ===================================================================
10154     dnl Check for system gpgme
10155     dnl ===================================================================
10156     AC_MSG_CHECKING([which gpgmepp to use])
10157     if test "$with_system_gpgmepp" = "yes"; then
10158         AC_MSG_RESULT([external])
10159         SYSTEM_GPGMEPP=TRUE
10161         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10162         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10163             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10164         # progress_callback is the only func with plain C linkage
10165         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10166         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10167             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10168         AC_CHECK_HEADER(gpgme.h, [],
10169             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10170     else
10171         AC_MSG_RESULT([internal])
10172         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10173         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10174         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10175         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10176         if test "$_os" != "WINNT"; then
10177             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10178             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10179         fi
10180     fi
10181     ENABLE_GPGMEPP=TRUE
10182     AC_DEFINE([GPGME_HAVE_GPGME])
10184 AC_SUBST(ENABLE_GPGMEPP)
10185 AC_SUBST(SYSTEM_GPGMEPP)
10186 AC_SUBST(GPG_ERROR_CFLAGS)
10187 AC_SUBST(GPG_ERROR_LIBS)
10188 AC_SUBST(LIBASSUAN_CFLAGS)
10189 AC_SUBST(LIBASSUAN_LIBS)
10190 AC_SUBST(GPGMEPP_CFLAGS)
10191 AC_SUBST(GPGMEPP_LIBS)
10193 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10194 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10195     AC_MSG_RESULT([yes])
10196     ENABLE_MEDIAWIKI=TRUE
10197     BUILD_TYPE="$BUILD_TYPE XSLTML"
10198     if test  "x$with_java" = "xno"; then
10199         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10200     fi
10201 else
10202     AC_MSG_RESULT([no])
10203     ENABLE_MEDIAWIKI=
10204     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10206 AC_SUBST(ENABLE_MEDIAWIKI)
10208 AC_MSG_CHECKING([whether to build the Report Builder])
10209 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10210     AC_MSG_RESULT([yes])
10211     ENABLE_REPORTBUILDER=TRUE
10212     AC_MSG_CHECKING([which jfreereport libs to use])
10213     if test "$with_system_jfreereport" = "yes"; then
10214         SYSTEM_JFREEREPORT=TRUE
10215         AC_MSG_RESULT([external])
10216         if test -z $SAC_JAR; then
10217             SAC_JAR=/usr/share/java/sac.jar
10218         fi
10219         if ! test -f $SAC_JAR; then
10220              AC_MSG_ERROR(sac.jar not found.)
10221         fi
10223         if test -z $LIBXML_JAR; then
10224             if test -f /usr/share/java/libxml-1.0.0.jar; then
10225                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10226             elif test -f /usr/share/java/libxml.jar; then
10227                 LIBXML_JAR=/usr/share/java/libxml.jar
10228             else
10229                 AC_MSG_ERROR(libxml.jar replacement not found.)
10230             fi
10231         elif ! test -f $LIBXML_JAR; then
10232             AC_MSG_ERROR(libxml.jar not found.)
10233         fi
10235         if test -z $FLUTE_JAR; then
10236             if test -f/usr/share/java/flute-1.3.0.jar; then
10237                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10238             elif test -f /usr/share/java/flute.jar; then
10239                 FLUTE_JAR=/usr/share/java/flute.jar
10240             else
10241                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10242             fi
10243         elif ! test -f $FLUTE_JAR; then
10244             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10245         fi
10247         if test -z $JFREEREPORT_JAR; then
10248             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10249                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10250             elif test -f /usr/share/java/flow-engine.jar; then
10251                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10252             else
10253                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10254             fi
10255         elif ! test -f  $JFREEREPORT_JAR; then
10256                 AC_MSG_ERROR(jfreereport.jar not found.)
10257         fi
10259         if test -z $LIBLAYOUT_JAR; then
10260             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10261                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10262             elif test -f /usr/share/java/liblayout.jar; then
10263                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10264             else
10265                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10266             fi
10267         elif ! test -f $LIBLAYOUT_JAR; then
10268                 AC_MSG_ERROR(liblayout.jar not found.)
10269         fi
10271         if test -z $LIBLOADER_JAR; then
10272             if test -f /usr/share/java/libloader-1.0.0.jar; then
10273                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10274             elif test -f /usr/share/java/libloader.jar; then
10275                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10276             else
10277                 AC_MSG_ERROR(libloader.jar replacement not found.)
10278             fi
10279         elif ! test -f  $LIBLOADER_JAR; then
10280             AC_MSG_ERROR(libloader.jar not found.)
10281         fi
10283         if test -z $LIBFORMULA_JAR; then
10284             if test -f /usr/share/java/libformula-0.2.0.jar; then
10285                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10286             elif test -f /usr/share/java/libformula.jar; then
10287                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10288             else
10289                 AC_MSG_ERROR(libformula.jar replacement not found.)
10290             fi
10291         elif ! test -f $LIBFORMULA_JAR; then
10292                 AC_MSG_ERROR(libformula.jar not found.)
10293         fi
10295         if test -z $LIBREPOSITORY_JAR; then
10296             if test -f /usr/share/java/librepository-1.0.0.jar; then
10297                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10298             elif test -f /usr/share/java/librepository.jar; then
10299                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10300             else
10301                 AC_MSG_ERROR(librepository.jar replacement not found.)
10302             fi
10303         elif ! test -f $LIBREPOSITORY_JAR; then
10304             AC_MSG_ERROR(librepository.jar not found.)
10305         fi
10307         if test -z $LIBFONTS_JAR; then
10308             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10309                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10310             elif test -f /usr/share/java/libfonts.jar; then
10311                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10312             else
10313                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10314             fi
10315         elif ! test -f $LIBFONTS_JAR; then
10316                 AC_MSG_ERROR(libfonts.jar not found.)
10317         fi
10319         if test -z $LIBSERIALIZER_JAR; then
10320             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10321                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10322             elif test -f /usr/share/java/libserializer.jar; then
10323                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10324             else
10325                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10326             fi
10327         elif ! test -f $LIBSERIALIZER_JAR; then
10328                 AC_MSG_ERROR(libserializer.jar not found.)
10329         fi
10331         if test -z $LIBBASE_JAR; then
10332             if test -f /usr/share/java/libbase-1.0.0.jar; then
10333                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10334             elif test -f /usr/share/java/libbase.jar; then
10335                 LIBBASE_JAR=/usr/share/java/libbase.jar
10336             else
10337                 AC_MSG_ERROR(libbase.jar replacement not found.)
10338             fi
10339         elif ! test -f $LIBBASE_JAR; then
10340             AC_MSG_ERROR(libbase.jar not found.)
10341         fi
10343     else
10344         AC_MSG_RESULT([internal])
10345         SYSTEM_JFREEREPORT=
10346         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10347     fi
10348 else
10349     AC_MSG_RESULT([no])
10350     ENABLE_REPORTBUILDER=
10351     SYSTEM_JFREEREPORT=
10353 AC_SUBST(ENABLE_REPORTBUILDER)
10354 AC_SUBST(SYSTEM_JFREEREPORT)
10355 AC_SUBST(SAC_JAR)
10356 AC_SUBST(LIBXML_JAR)
10357 AC_SUBST(FLUTE_JAR)
10358 AC_SUBST(JFREEREPORT_JAR)
10359 AC_SUBST(LIBBASE_JAR)
10360 AC_SUBST(LIBLAYOUT_JAR)
10361 AC_SUBST(LIBLOADER_JAR)
10362 AC_SUBST(LIBFORMULA_JAR)
10363 AC_SUBST(LIBREPOSITORY_JAR)
10364 AC_SUBST(LIBFONTS_JAR)
10365 AC_SUBST(LIBSERIALIZER_JAR)
10367 # this has to be here because both the Wiki Publisher and the SRB use
10368 # commons-logging
10369 COMMONS_LOGGING_VERSION=1.2
10370 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10371     AC_MSG_CHECKING([which Apache commons-* libs to use])
10372     if test "$with_system_apache_commons" = "yes"; then
10373         SYSTEM_APACHE_COMMONS=TRUE
10374         AC_MSG_RESULT([external])
10375         if test -z $COMMONS_LOGGING_JAR; then
10376             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10377                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10378            elif test -f /usr/share/java/commons-logging.jar; then
10379                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
10380             else
10381                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
10382             fi
10383         elif ! test -f $COMMONS_LOGGING_JAR; then
10384             AC_MSG_ERROR(commons-logging.jar not found.)
10385         fi
10386     else
10387         AC_MSG_RESULT([internal])
10388         SYSTEM_APACHE_COMMONS=
10389         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
10390     fi
10392 AC_SUBST(SYSTEM_APACHE_COMMONS)
10393 AC_SUBST(COMMONS_LOGGING_JAR)
10394 AC_SUBST(COMMONS_LOGGING_VERSION)
10396 # scripting provider for BeanShell?
10397 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10398 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10399     AC_MSG_RESULT([yes])
10400     ENABLE_SCRIPTING_BEANSHELL=TRUE
10402     dnl ===================================================================
10403     dnl Check for system beanshell
10404     dnl ===================================================================
10405     AC_MSG_CHECKING([which beanshell to use])
10406     if test "$with_system_beanshell" = "yes"; then
10407         AC_MSG_RESULT([external])
10408         SYSTEM_BSH=TRUE
10409         if test -z $BSH_JAR; then
10410             BSH_JAR=/usr/share/java/bsh.jar
10411         fi
10412         if ! test -f $BSH_JAR; then
10413             AC_MSG_ERROR(bsh.jar not found.)
10414         fi
10415     else
10416         AC_MSG_RESULT([internal])
10417         SYSTEM_BSH=
10418         BUILD_TYPE="$BUILD_TYPE BSH"
10419     fi
10420 else
10421     AC_MSG_RESULT([no])
10422     ENABLE_SCRIPTING_BEANSHELL=
10423     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10425 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10426 AC_SUBST(SYSTEM_BSH)
10427 AC_SUBST(BSH_JAR)
10429 # scripting provider for JavaScript?
10430 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10431 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10432     AC_MSG_RESULT([yes])
10433     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10435     dnl ===================================================================
10436     dnl Check for system rhino
10437     dnl ===================================================================
10438     AC_MSG_CHECKING([which rhino to use])
10439     if test "$with_system_rhino" = "yes"; then
10440         AC_MSG_RESULT([external])
10441         SYSTEM_RHINO=TRUE
10442         if test -z $RHINO_JAR; then
10443             RHINO_JAR=/usr/share/java/js.jar
10444         fi
10445         if ! test -f $RHINO_JAR; then
10446             AC_MSG_ERROR(js.jar not found.)
10447         fi
10448     else
10449         AC_MSG_RESULT([internal])
10450         SYSTEM_RHINO=
10451         BUILD_TYPE="$BUILD_TYPE RHINO"
10452     fi
10453 else
10454     AC_MSG_RESULT([no])
10455     ENABLE_SCRIPTING_JAVASCRIPT=
10456     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10458 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10459 AC_SUBST(SYSTEM_RHINO)
10460 AC_SUBST(RHINO_JAR)
10462 # This is only used in KDE3/KDE4 checks to determine if /usr/lib64
10463 # paths should be added to library search path. So lets put all 64-bit
10464 # platforms there.
10465 supports_multilib=
10466 case "$host_cpu" in
10467 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
10468     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10469         supports_multilib="yes"
10470     fi
10471     ;;
10473     ;;
10474 esac
10476 dnl ===================================================================
10477 dnl KDE4 Integration
10478 dnl ===================================================================
10480 KDE4_CFLAGS=""
10481 KDE4_LIBS=""
10482 QMAKE4="qmake"
10483 MOC4="moc"
10484 KDE4_GLIB_CFLAGS=""
10485 KDE4_GLIB_LIBS=""
10486 KDE4_HAVE_GLIB=""
10487 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
10488     qt4_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
10489     qt4_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
10491     kde4_incdirs="/usr/include /usr/include/kde4 $x_includes"
10492     kde4_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
10494     if test -n "$supports_multilib"; then
10495         qt4_libdirs="$qt4_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
10496         kde4_libdirs="$kde4_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
10497     fi
10499     if test -n "$QTDIR"; then
10500         qt4_incdirs="$QTDIR/include $qt4_incdirs"
10501         if test -z "$supports_multilib"; then
10502             qt4_libdirs="$QTDIR/lib $qt4_libdirs"
10503         else
10504             qt4_libdirs="$QTDIR/lib64 $QTDIR/lib $qt4_libdirs"
10505         fi
10506     fi
10507     if test -n "$QT4DIR"; then
10508         qt4_incdirs="$QT4DIR/include $qt4_incdirs"
10509         if test -z "$supports_multilib"; then
10510             qt4_libdirs="$QT4DIR/lib $qt4_libdirs"
10511         else
10512             qt4_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt4_libdirs"
10513         fi
10514     fi
10516     if test -n "$KDEDIR"; then
10517         kde4_incdirs="$KDEDIR/include $kde4_incdirs"
10518         if test -z "$supports_multilib"; then
10519             kde4_libdirs="$KDEDIR/lib $kde4_libdirs"
10520         else
10521             kde4_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde4_libdirs"
10522         fi
10523     fi
10524     if test -n "$KDE4DIR"; then
10525         kde4_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde4_incdirs"
10526         if test -z "$supports_multilib"; then
10527             kde4_libdirs="$KDE4DIR/lib $kde4_libdirs"
10528         else
10529             kde4_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde4_libdirs"
10530         fi
10531     fi
10533     qt4_test_include="Qt/qobject.h"
10534     qt4_test_library="libQtNetwork.so"
10535     kde4_test_include="kwindowsystem.h"
10536     kde4_test_library="libsolid.so"
10538     AC_MSG_CHECKING([for Qt4 headers])
10539     qt4_header_dir="no"
10540     for inc_dir in $qt4_incdirs; do
10541         if test -r "$inc_dir/$qt4_test_include"; then
10542             qt4_header_dir="$inc_dir"
10543             break
10544         fi
10545     done
10547     AC_MSG_RESULT([$qt4_header_dir])
10548     if test "x$qt4_header_dir" = "xno"; then
10549         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10550     fi
10552     dnl Check for qmake
10553     AC_PATH_PROGS( QMAKE4, [qmake-qt4 qmake], no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
10554     if test "$QMAKE4" = "no"; then
10555         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10556     else
10557         qmake4_test_ver="`$QMAKE4 -v 2>&1 | sed -n -e '/^Using Qt version 4\./p'`"
10558         if test -z "$qmake4_test_ver"; then
10559             AC_MSG_ERROR([Wrong qmake for Qt4 found. Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
10560         fi
10561     fi
10563     qt4_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt4_libdirs"
10564     AC_MSG_CHECKING([for Qt4 libraries])
10565     qt4_lib_dir="no"
10566     for lib_dir in $qt4_libdirs; do
10567         if test -r "$lib_dir/$qt4_test_library"; then
10568             qt4_lib_dir="$lib_dir"
10569             PKG_CONFIG_PATH="$qt4_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
10570             break
10571         fi
10572     done
10574     AC_MSG_RESULT([$qt4_lib_dir])
10576     if test "x$qt4_lib_dir" = "xno"; then
10577         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10578     fi
10580     dnl Check for Meta Object Compiler
10582     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10583     MOC4="$MOCQT4"
10584     if test "$MOC4" = "no"; then
10585         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10586         if test "$MOC4" = "no"; then
10587             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10588 the root of your Qt installation by exporting QT4DIR before running "configure".])
10589         fi
10590     fi
10592     dnl Check for KDE4 headers
10593     AC_MSG_CHECKING([for KDE4 headers])
10594     kde4_incdir="no"
10595     for kde4_check in $kde4_incdirs; do
10596         if test -r "$kde4_check/$kde4_test_include"; then
10597             kde4_incdir="$kde4_check"
10598             break
10599         fi
10600     done
10601     AC_MSG_RESULT([$kde4_incdir])
10602     if test "x$kde4_incdir" = "xno"; then
10603         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10604     fi
10605     if test "$kde4_incdir" = "/usr/include"; then kde4_incdir=; fi
10607     dnl Check for KDE4 libraries
10608     AC_MSG_CHECKING([for KDE4 libraries])
10609     kde4_libdir="no"
10610     for kde4_check in $kde4_libdirs; do
10611         if test -r "$kde4_check/$kde4_test_library"; then
10612             kde4_libdir="$kde4_check"
10613             break
10614         fi
10615     done
10617     AC_MSG_RESULT([$kde4_libdir])
10618     if test "x$kde4_libdir" = "xno"; then
10619         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10620     fi
10622     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
10623     if ! test -z "$kde4_incdir"; then
10624         KDE4_CFLAGS="-I$kde4_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10625     else
10626         KDE4_CFLAGS="$QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10627     fi
10629     KDE4_LIBS="-L$kde4_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt4_lib_dir $QT4_LIBS"
10630     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10631     FilterLibs "$KDE4_LIBS"
10632     KDE4_LIBS="$filteredlibs"
10634     AC_LANG_PUSH([C++])
10635     save_CXXFLAGS=$CXXFLAGS
10636     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10637     AC_MSG_CHECKING([whether KDE is >= 4.2])
10638        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10639 #include <kdeversion.h>
10641 int main(int argc, char **argv) {
10642        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
10643        else return 1;
10645 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[AC_MSG_ERROR([KDE support not tested with cross-compilation])])
10646     CXXFLAGS=$save_CXXFLAGS
10647     AC_LANG_POP([C++])
10649     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
10650     # Sets also KDE4_GLIB_CFLAGS/KDE4_GLIB_LIBS if successful.
10651     PKG_CHECK_MODULES(KDE4_GLIB,[glib-2.0 >= 2.4],
10652         [
10653             KDE4_HAVE_GLIB=TRUE
10654             AC_DEFINE(KDE4_HAVE_GLIB,1)
10655             KDE4_GLIB_CFLAGS=$(printf '%s' "$KDE4_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10656             FilterLibs "${KDE4_GLIB_LIBS}"
10657             KDE4_GLIB_LIBS="${filteredlibs}"
10659             qt4_fix_warning=
10661             AC_LANG_PUSH([C++])
10662             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
10663             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
10664             #  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
10665             #               ^~~~~~~~~~~~~~~~~~~~~~~
10666             #               vptr for 'QObjectPrivate'
10667             save_CXX=$CXX
10668             CXX=$(printf %s "$CXX" \
10669                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
10670             save_CXXFLAGS=$CXXFLAGS
10671             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10672             save_LIBS=$LIBS
10673             LIBS="$LIBS $KDE4_LIBS"
10674             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
10676             # Prepare meta object data
10677             TSTBASE="tst_exclude_socket_notifiers"
10678             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
10679             ln -fs "${TSTMOC}.hxx"
10680             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10682             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10683 #include <cstdlib>
10684 #include "tst_exclude_socket_notifiers.moc"
10686 int main(int argc, char *argv[])
10688     QCoreApplication app(argc, argv);
10689     exit(tst_processEventsExcludeSocket());
10690     return 0;
10692             ]])],[
10693                 AC_MSG_RESULT([yes])
10694             ],[
10695                 AC_MSG_RESULT([no])
10696                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
10697                 if test -z "$qt4_fix_warning"; then
10698                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
10699                 fi
10700                 qt4_fix_warning=1
10701                 add_warning "  https://bugreports.qt.io/browse/QTBUG-37380 (needed)"
10702                 ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
10704             # Remove meta object data
10705             rm -f "${TSTBASE}."*
10707             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
10709             # Prepare meta object data
10710             TSTBASE="tst_exclude_posted_events"
10711             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
10712             ln -fs "${TSTMOC}.hxx"
10713             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10715             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10716 #include <cstdlib>
10717 #include "tst_exclude_posted_events.moc"
10719 int main(int argc, char *argv[])
10721     QCoreApplication app(argc, argv);
10722     exit(tst_excludePostedEvents());
10723     return 0;
10725             ]])],[
10726                 AC_MSG_RESULT([yes])
10727             ],[
10728                 AC_MSG_RESULT([no])
10729                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
10730                 if test -z "$qt4_fix_warning"; then
10731                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
10732                 fi
10733                 qt4_fix_warning=1
10734                 add_warning "  https://bugreports.qt.io/browse/QTBUG-34614 (needed)"
10735             ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
10737             # Remove meta object data
10738             rm -f "${TSTBASE}."*
10740             if test -n "$qt4_fix_warning"; then
10741                 add_warning "  https://bugreports.qt.io/browse/QTBUG-38585 (recommended)"
10742             fi
10744             LIBS=$save_LIBS
10745             CXXFLAGS=$save_CXXFLAGS
10746             CXX=$save_CXX
10747             AC_LANG_POP([C++])
10748         ],
10749         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
10751 AC_SUBST(KDE4_CFLAGS)
10752 AC_SUBST(KDE4_LIBS)
10753 AC_SUBST(MOC4)
10754 AC_SUBST(KDE4_GLIB_CFLAGS)
10755 AC_SUBST(KDE4_GLIB_LIBS)
10756 AC_SUBST(KDE4_HAVE_GLIB)
10758 dnl ===================================================================
10759 dnl QT5 Integration
10760 dnl ===================================================================
10762 QT5_CFLAGS=""
10763 QT5_LIBS=""
10764 QMAKE5="qmake"
10765 MOC5="moc"
10766 QT5_GLIB_CFLAGS=""
10767 QT5_GLIB_LIBS=""
10768 QT5_HAVE_GLIB=""
10769 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
10770         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \)
10771 then
10772     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
10773     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
10775     if test -n "$supports_multilib"; then
10776         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
10777     fi
10779     qt5_test_include="QtWidgets/qapplication.h"
10780     qt5_test_library="libQt5Widgets.so"
10782     dnl Check for qmake5
10783     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
10784     if test "$QMAKE5" = "no"; then
10785         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
10786     else
10787         qmake5_test_ver="`$QMAKE5 -v 2>&1 | sed -n -e '/^Using Qt version 5\./p'`"
10788         if test -z "$qmake5_test_ver"; then
10789             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
10790         fi
10791     fi
10793     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
10794     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
10796     AC_MSG_CHECKING([for Qt5 headers])
10797     qt5_incdir="no"
10798     for inc_dir in $qt5_incdirs; do
10799         if test -r "$inc_dir/$qt5_test_include"; then
10800             qt5_incdir="$inc_dir"
10801             break
10802         fi
10803     done
10804     AC_MSG_RESULT([$qt5_incdir])
10805     if test "x$qt5_incdir" = "xno"; then
10806         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
10807     fi
10809     AC_MSG_CHECKING([for Qt5 libraries])
10810     qt5_libdir="no"
10811     for lib_dir in $qt5_libdirs; do
10812         if test -r "$lib_dir/$qt5_test_library"; then
10813             qt5_libdir="$lib_dir"
10814             break
10815         fi
10816     done
10817     AC_MSG_RESULT([$qt5_libdir])
10818     if test "x$qt5_libdir" = "xno"; then
10819         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
10820     fi
10822     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10823     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
10825     dnl Check for Meta Object Compiler
10827     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
10828     if test "$MOC5" = "no"; then
10829         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10830 the root of your Qt installation by exporting QT5DIR before running "configure".])
10831     fi
10833     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
10834     # Sets also QT5_GLIB_CFLAGS/QT5_GLIB_LIBS if successful.
10835     PKG_CHECK_MODULES(QT5_GLIB,[glib-2.0 >= 2.4],
10836         [
10837             QT5_HAVE_GLIB=1
10838             AC_DEFINE(QT5_HAVE_GLIB,1)
10839             QT5_GLIB_CFLAGS=$(printf '%s' "$QT5_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10840             FilterLibs "${QT5_GLIB_LIBS}"
10841             QT5_GLIB_LIBS="${filteredlibs}"
10843             qt5_fix_warning=
10845             AC_LANG_PUSH([C++])
10846             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QO
10847             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
10848             #  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
10849             #               ^~~~~~~~~~~~~~~~~~~~~~~
10850             #               vptr for 'QObjectPrivate'
10851             save_CXX=$CXX
10852             CXX=$(printf %s "$CXX" \
10853                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
10854             save_CXXFLAGS=$CXXFLAGS
10855             CXXFLAGS="$CXXFLAGS $QT5_CFLAGS"
10856             save_LIBS=$LIBS
10857             LIBS="$LIBS $QT5_LIBS"
10858             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
10859             # Prepare meta object data
10860             TSTBASE="tst_exclude_socket_notifiers"
10861             TSTMOC="${SRC_ROOT}/vcl/unx/qt5/${TSTBASE}"
10862             ln -fs "${TSTMOC}.hxx"
10863             $MOC5 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10865             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10866 #include <cstdlib>
10867 #include "tst_exclude_socket_notifiers.moc"
10869 int main(int argc, char *argv[])
10871     QCoreApplication app(argc, argv);
10872     exit(tst_processEventsExcludeSocket());
10873     return 0;
10875             ]])],[
10876                 AC_MSG_RESULT([yes])
10877             ],[
10878                 AC_MSG_RESULT([no])
10879                 AC_MSG_WARN([native Qt5 file pickers will be disabled at runtime])
10880                 if test -z "$qt5_fix_warning"; then
10881                     add_warning "native QT5 file pickers will be disabled at runtime, Qt5 fixes needed"
10882                 fi
10883                 qt5_fix_warning=1
10884                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-37380 (needed)"
10885             ])
10887             # Remove meta object data
10888             rm -f "${TSTBASE}."*
10890             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
10891             # Prepare meta object data
10892             TSTBASE="tst_exclude_posted_events"
10893             TSTMOC="${SRC_ROOT}/vcl/unx/qt5/${TSTBASE}"
10894             ln -fs "${TSTMOC}.hxx"
10895             $MOC5 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10897             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10898 #include <cstdlib>
10899 #include "tst_exclude_posted_events.moc"
10901 int main(int argc, char *argv[])
10903     QCoreApplication app(argc, argv);
10904     exit(tst_excludePostedEvents());
10905     return 0;
10907             ]])],[
10908                 AC_MSG_RESULT([yes])
10909             ],[
10910                 AC_MSG_RESULT([no])
10911                 AC_MSG_WARN([native QT5 file pickers will be disabled at runtime])
10912                 if test -z "$qt5_fix_warning"; then
10913                     add_warning "native QT5 file pickers will be disabled at runtime, Qt5 fixes needed"
10914                 fi
10915                 qt5_fix_warning=1
10916                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-34614 (needed)"
10917             ])
10919             # Remove meta object data
10920             rm -f "${TSTBASE}."*
10922             if test -n "$qt5_fix_warning"; then
10923                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-38585 (recommended)"
10924             fi
10926             LIBS=$save_LIBS
10927             CXXFLAGS=$save_CXXFLAGS
10928             CXX=$save_CXX
10929             AC_LANG_POP([C++])
10930         ],
10931         AC_MSG_WARN([[No Glib found, Qt5 support will not use native file pickers!]])
10932     )
10934 AC_SUBST(QT5_CFLAGS)
10935 AC_SUBST(QT5_LIBS)
10936 AC_SUBST(MOC5)
10937 AC_SUBST(QT5_GLIB_CFLAGS)
10938 AC_SUBST(QT5_GLIB_LIBS)
10939 AC_SUBST(QT5_HAVE_GLIB)
10941 dnl ===================================================================
10942 dnl KDE5 Integration
10943 dnl ===================================================================
10945 KF5_CFLAGS=""
10946 KF5_LIBS=""
10947 KF5_CONFIG="kf5-config"
10948 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
10949         \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \)
10950 then
10951     kf5_incdirs="$KF5INC /usr/include /usr/include/KF5 $x_includes"
10952     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $x_libraries"
10953     if test -n "$supports_multilib"; then
10954         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
10955     fi
10957     kf5_test_include="kcoreaddons_version.h"
10958     kf5_test_library="libKF5CoreAddons.so"
10959     kf5_libdirs="$qt5_libdir $kf5_libdirs"
10961     dnl kf5 KDE4 support compatibility installed
10962     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
10963     if test "$KF5_CONFIG" != "no"; then
10964         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
10965         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
10966     fi
10968     dnl Check for KF5 headers
10969     AC_MSG_CHECKING([for KF5 headers])
10970     kf5_incdir="no"
10971     for kf5_check in $kf5_incdirs; do
10972         if test -r "$kf5_check/$kf5_test_include"; then
10973             kf5_incdir="$kf5_check"
10974             break
10975         fi
10976     done
10977     AC_MSG_RESULT([$kf5_incdir])
10978     if test "x$kf5_incdir" = "xno"; then
10979         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
10980     fi
10982     dnl Check for KF5 libraries
10983     AC_MSG_CHECKING([for KF5 libraries])
10984     kf5_libdir="no"
10985     for kf5_check in $kf5_libdirs; do
10986         if test -r "$kf5_check/$kf5_test_library"; then
10987             kf5_libdir="$kf5_check"
10988             break
10989         fi
10990     done
10992     AC_MSG_RESULT([$kf5_libdir])
10993     if test "x$kf5_libdir" = "xno"; then
10994         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
10995     fi
10997     PKG_CHECK_MODULES(KF5_XCB,[xcb],,[AC_MSG_ERROR([XCB not installed])])
10999     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"
11000     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network -lQt5X11Extras $KF5_XCB_LIBS"
11001     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11003     AC_LANG_PUSH([C++])
11004     save_CXXFLAGS=$CXXFLAGS
11005     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11006     AC_MSG_CHECKING([whether KDE is >= 5.0])
11007        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11008 #include <kcoreaddons_version.h>
11010 int main(int argc, char **argv) {
11011        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11012        else return 1;
11014        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11015     CXXFLAGS=$save_CXXFLAGS
11016     AC_LANG_POP([C++])
11018 AC_SUBST(KF5_CFLAGS)
11019 AC_SUBST(KF5_LIBS)
11021 dnl ===================================================================
11022 dnl Test whether to include Evolution 2 support
11023 dnl ===================================================================
11024 AC_MSG_CHECKING([whether to enable evolution 2 support])
11025 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11026     AC_MSG_RESULT([yes])
11027     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11028     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11029     FilterLibs "${GOBJECT_LIBS}"
11030     GOBJECT_LIBS="${filteredlibs}"
11031     ENABLE_EVOAB2="TRUE"
11032 else
11033     ENABLE_EVOAB2=""
11034     AC_MSG_RESULT([no])
11036 AC_SUBST(ENABLE_EVOAB2)
11037 AC_SUBST(GOBJECT_CFLAGS)
11038 AC_SUBST(GOBJECT_LIBS)
11040 dnl ===================================================================
11041 dnl Test which themes to include
11042 dnl ===================================================================
11043 AC_MSG_CHECKING([which themes to include])
11044 # if none given use default subset of available themes
11045 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11046     with_theme="breeze breeze_dark elementary galaxy hicontrast sifr sifr_dark tango"
11047     # test -z "$ENABLE_RELEASE_BUILD" && with_theme="$with_theme tango_testing"
11050 WITH_THEMES=""
11051 if test "x$with_theme" != "xno"; then
11052     for theme in $with_theme; do
11053         case $theme in
11054         breeze|breeze_dark|crystal|elementary|galaxy|hicontrast|oxygen|sifr|sifr_dark|tango|tango_testing) real_theme="$theme" ;;
11055         default) real_theme=galaxy ;;
11056         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11057         esac
11058         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11059     done
11061 AC_MSG_RESULT([$WITH_THEMES])
11062 AC_SUBST([WITH_THEMES])
11063 # FIXME: remove this, and the convenience default->galaxy remapping after a crace period
11064 for theme in $with_theme; do
11065     case $theme in
11066     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=galaxy]) ;;
11067     *) ;;
11068     esac
11069 done
11071 dnl ===================================================================
11072 dnl Test whether to integrate helppacks into the product's installer
11073 dnl ===================================================================
11074 AC_MSG_CHECKING([for helppack integration])
11075 if test "$with_helppack_integration" = "no"; then
11076     WITH_HELPPACK_INTEGRATION=
11077     AC_MSG_RESULT([no integration])
11078 else
11079     WITH_HELPPACK_INTEGRATION=TRUE
11080     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11081     AC_MSG_RESULT([integration])
11083 AC_SUBST(WITH_HELPPACK_INTEGRATION)
11085 ###############################################################################
11086 # Extensions checking
11087 ###############################################################################
11088 AC_MSG_CHECKING([for extensions integration])
11089 if test "x$enable_extension_integration" != "xno"; then
11090     WITH_EXTENSION_INTEGRATION=TRUE
11091     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11092     AC_MSG_RESULT([yes, use integration])
11093 else
11094     WITH_EXTENSION_INTEGRATION=
11095     AC_MSG_RESULT([no, do not integrate])
11097 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11099 dnl Should any extra extensions be included?
11100 dnl There are standalone tests for each of these below.
11101 WITH_EXTRA_EXTENSIONS=
11102 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11104 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11105 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11106 if test "x$with_java" != "xno"; then
11107     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11108     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11111 TEST_FONTS_MISSING=0
11113 # $1  = font family
11114 # $2+ = accepted font mappings
11115 test_font_map()
11117     FONT="$1" ; shift
11118     AC_MSG_CHECKING([font mapping for '$FONT'])
11119     FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
11120     FONTFILE_LOWER="$(echo $FONTFILE | $AWK '{print tolower($0)}')"
11122     TESTEXPR="'${FONTFILE_LOWER}' = '$(echo $FONT | $AWK '{print tolower($0)}').ttf'"
11123     while test "$#" -ge 1 ; do
11124         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
11125         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
11126     done
11127     if test $TESTEXPR
11128     then
11129         AC_MSG_RESULT([ok])
11130     else
11131         AC_MSG_WARN([unknown ($FONTFILE)])
11132         add_warning "unknown ($FONTFILE)"
11133         TEST_FONTS_MISSING=1
11134     fi
11137 dnl ===================================================================
11138 dnl Test whether to include fonts
11139 dnl ===================================================================
11140 AC_MSG_CHECKING([whether to include third-party fonts])
11141 if test "$with_fonts" != "no"; then
11142     AC_MSG_RESULT([yes])
11143     WITH_FONTS=TRUE
11144     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11145     AC_DEFINE(HAVE_MORE_FONTS)
11146 else
11147     AC_MSG_RESULT([no])
11148     WITH_FONTS=
11149     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11150     if test "$test_fontconfig" = "yes"; then
11151         AC_PATH_PROG([FCMATCH], [fc-match])
11152         if test -z "$FCMATCH"; then
11153             AC_MSG_WARN([Unable to query installed fonts - unit tests disabled.])
11154             TEST_FONTS_MISSING=1
11155         else
11156             test_font_map 'Calibri' 'Carlito'
11157             test_font_map 'DejaVuSans' 'DejaVuSans'
11158             if test ${TEST_FONTS_MISSING} -eq 1
11159             then
11160                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
11161                 add_warning "Unknown font mappings - unit tests disabled."
11162             fi
11163         fi
11164     else
11165         TEST_FONTS_MISSING=1
11166     fi
11168 AC_SUBST(WITH_FONTS)
11169 AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
11172 dnl ===================================================================
11173 dnl Test whether to enable online update service
11174 dnl ===================================================================
11175 AC_MSG_CHECKING([whether to enable online update])
11176 ENABLE_ONLINE_UPDATE=
11177 ENABLE_ONLINE_UPDATE_MAR=
11178 UPDATE_CONFIG=
11179 if test "$enable_online_update" = ""; then
11180     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11181         AC_MSG_RESULT([yes])
11182         ENABLE_ONLINE_UPDATE="TRUE"
11183     else
11184         AC_MSG_RESULT([no])
11185     fi
11186 else
11187     if test "$enable_online_update" = "mar"; then
11188         AC_MSG_RESULT([yes - MAR-based online update])
11189         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11190         if test "$with_update_config" = ""; then
11191             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11192         fi
11193         UPDATE_CONFIG="$with_update_config"
11194         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11195     elif test "$enable_online_update" = "yes"; then
11196         AC_MSG_RESULT([yes])
11197         ENABLE_ONLINE_UPDATE="TRUE"
11198     else
11199         AC_MSG_RESULT([no])
11200     fi
11202 AC_SUBST(ENABLE_ONLINE_UPDATE)
11203 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11204 AC_SUBST(UPDATE_CONFIG)
11206 dnl ===================================================================
11207 dnl Test whether we need bzip2
11208 dnl ===================================================================
11209 SYSTEM_BZIP2=
11210 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11211     AC_MSG_CHECKING([whether to use system bzip2])
11212     if test "$with_system_bzip2" = yes; then
11213         SYSTEM_BZIP2=TRUE
11214         AC_MSG_RESULT([yes])
11215         PKG_CHECK_MODULES(BZIP2, bzip2)
11216         FilterLibs "${BZIP2_LIBS}"
11217         BZIP2_LIBS="${filteredlibs}"
11218     else
11219         AC_MSG_RESULT([no])
11220         BUILD_TYPE="$BUILD_TYPE BZIP2"
11221     fi
11223 AC_SUBST(SYSTEM_BZIP2)
11224 AC_SUBST(BZIP2_CFLAGS)
11225 AC_SUBST(BZIP2_LIBS)
11227 dnl ===================================================================
11228 dnl Test whether to enable extension update
11229 dnl ===================================================================
11230 AC_MSG_CHECKING([whether to enable extension update])
11231 ENABLE_EXTENSION_UPDATE=
11232 if test "x$enable_extension_update" = "xno"; then
11233     AC_MSG_RESULT([no])
11234 else
11235     AC_MSG_RESULT([yes])
11236     ENABLE_EXTENSION_UPDATE="TRUE"
11237     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11238     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11240 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11243 dnl ===================================================================
11244 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11245 dnl ===================================================================
11246 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11247 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11248     AC_MSG_RESULT([no])
11249     ENABLE_SILENT_MSI=
11250 else
11251     AC_MSG_RESULT([yes])
11252     ENABLE_SILENT_MSI=TRUE
11253     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11255 AC_SUBST(ENABLE_SILENT_MSI)
11257 AC_MSG_CHECKING([whether and how to use Xinerama])
11258 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11259     if test "$x_libraries" = "default_x_libraries"; then
11260         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11261         if test "x$XINERAMALIB" = x; then
11262            XINERAMALIB="/usr/lib"
11263         fi
11264     else
11265         XINERAMALIB="$x_libraries"
11266     fi
11267     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11268         # we have both versions, let the user decide but use the dynamic one
11269         # per default
11270         USE_XINERAMA=TRUE
11271         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11272             XINERAMA_LINK=dynamic
11273         else
11274             XINERAMA_LINK=static
11275         fi
11276     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11277         # we have only the dynamic version
11278         USE_XINERAMA=TRUE
11279         XINERAMA_LINK=dynamic
11280     elif test -e "$XINERAMALIB/libXinerama.a"; then
11281         # static version
11282         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11283             USE_XINERAMA=TRUE
11284             XINERAMA_LINK=static
11285         else
11286             USE_XINERAMA=
11287             XINERAMA_LINK=none
11288         fi
11289     else
11290         # no Xinerama
11291         USE_XINERAMA=
11292         XINERAMA_LINK=none
11293     fi
11294     if test "$USE_XINERAMA" = "TRUE"; then
11295         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11296         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11297             [AC_MSG_ERROR(Xinerama header not found.)], [])
11298         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11299         if test "x$XEXTLIB" = x; then
11300            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11301         fi
11302         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11303         if test "$_os" = "FreeBSD"; then
11304             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11305         fi
11306         if test "$_os" = "Linux"; then
11307             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11308         fi
11309         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11310             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11311     else
11312         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11313     fi
11314 else
11315     USE_XINERAMA=
11316     XINERAMA_LINK=none
11317     AC_MSG_RESULT([no])
11319 AC_SUBST(USE_XINERAMA)
11320 AC_SUBST(XINERAMA_LINK)
11322 dnl ===================================================================
11323 dnl Test whether to build cairo or rely on the system version
11324 dnl ===================================================================
11326 if test "$USING_X11" = TRUE; then
11327     # Used in vcl/Library_vclplug_gen.mk
11328     test_cairo=yes
11331 if test "$test_cairo" = "yes"; then
11332     AC_MSG_CHECKING([whether to use the system cairo])
11334     : ${with_system_cairo:=$with_system_libs}
11335     if test "$with_system_cairo" = "yes"; then
11336         SYSTEM_CAIRO=TRUE
11337         AC_MSG_RESULT([yes])
11339         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11340         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11341         FilterLibs "${CAIRO_LIBS}"
11342         CAIRO_LIBS="${filteredlibs}"
11344         if test "$test_xrender" = "yes"; then
11345             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11346             AC_LANG_PUSH([C])
11347             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11348 #ifdef PictStandardA8
11349 #else
11350       return fail;
11351 #endif
11352 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11354             AC_LANG_POP([C])
11355         fi
11356     else
11357         SYSTEM_CAIRO=
11358         AC_MSG_RESULT([no])
11360         BUILD_TYPE="$BUILD_TYPE CAIRO"
11361     fi
11364 AC_SUBST(SYSTEM_CAIRO)
11365 AC_SUBST(CAIRO_CFLAGS)
11366 AC_SUBST(CAIRO_LIBS)
11368 dnl ===================================================================
11369 dnl Test whether to use avahi
11370 dnl ===================================================================
11371 if test "$_os" = "WINNT"; then
11372     # Windows uses bundled mDNSResponder
11373     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11374 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11375     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11376                       [ENABLE_AVAHI="TRUE"])
11377     AC_DEFINE(HAVE_FEATURE_AVAHI)
11378     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11379     FilterLibs "${AVAHI_LIBS}"
11380     AVAHI_LIBS="${filteredlibs}"
11383 AC_SUBST(ENABLE_AVAHI)
11384 AC_SUBST(AVAHI_CFLAGS)
11385 AC_SUBST(AVAHI_LIBS)
11387 dnl ===================================================================
11388 dnl Test whether to use liblangtag
11389 dnl ===================================================================
11390 SYSTEM_LIBLANGTAG=
11391 AC_MSG_CHECKING([whether to use system liblangtag])
11392 if test "$with_system_liblangtag" = yes; then
11393     SYSTEM_LIBLANGTAG=TRUE
11394     AC_MSG_RESULT([yes])
11395     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11396     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11397     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11398     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11399     FilterLibs "${LIBLANGTAG_LIBS}"
11400     LIBLANGTAG_LIBS="${filteredlibs}"
11401 else
11402     SYSTEM_LIBLANGTAG=
11403     AC_MSG_RESULT([no])
11404     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11405     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11406     if test "$COM" = "MSC"; then
11407         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11408     else
11409         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11410     fi
11412 AC_SUBST(SYSTEM_LIBLANGTAG)
11413 AC_SUBST(LIBLANGTAG_CFLAGS)
11414 AC_SUBST(LIBLANGTAG_LIBS)
11416 dnl ===================================================================
11417 dnl Test whether to build libpng or rely on the system version
11418 dnl ===================================================================
11420 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11422 dnl ===================================================================
11423 dnl Check for runtime JVM search path
11424 dnl ===================================================================
11425 if test "$ENABLE_JAVA" != ""; then
11426     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11427     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11428         AC_MSG_RESULT([yes])
11429         if ! test -d "$with_jvm_path"; then
11430             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11431         fi
11432         if ! test -d "$with_jvm_path"jvm; then
11433             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11434         fi
11435         JVM_ONE_PATH_CHECK="$with_jvm_path"
11436         AC_SUBST(JVM_ONE_PATH_CHECK)
11437     else
11438         AC_MSG_RESULT([no])
11439     fi
11442 dnl ===================================================================
11443 dnl Test for the presence of Ant and that it works
11444 dnl ===================================================================
11446 if test "$ENABLE_JAVA" != ""; then
11447     ANT_HOME=; export ANT_HOME
11448     WITH_ANT_HOME=; export WITH_ANT_HOME
11449     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11450         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11451             if test "$_os" = "WINNT"; then
11452                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11453             else
11454                 with_ant_home="$LODE_HOME/opt/ant"
11455             fi
11456         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11457             with_ant_home="$LODE_HOME/opt/ant"
11458         fi
11459     fi
11460     if test -z "$with_ant_home"; then
11461         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11462     else
11463         if test "$_os" = "WINNT"; then
11464             # AC_PATH_PROGS needs unix path
11465             with_ant_home=`cygpath -u "$with_ant_home"`
11466         fi
11467         AbsolutePath "$with_ant_home"
11468         with_ant_home=$absolute_path
11469         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11470         WITH_ANT_HOME=$with_ant_home
11471         ANT_HOME=$with_ant_home
11472     fi
11474     if test -z "$ANT"; then
11475         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11476     else
11477         # resolve relative or absolute symlink
11478         while test -h "$ANT"; do
11479             a_cwd=`pwd`
11480             a_basename=`basename "$ANT"`
11481             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11482             cd "`dirname "$ANT"`"
11483             cd "`dirname "$a_script"`"
11484             ANT="`pwd`"/"`basename "$a_script"`"
11485             cd "$a_cwd"
11486         done
11488         AC_MSG_CHECKING([if $ANT works])
11489         cat > conftest.java << EOF
11490         public class conftest {
11491             int testmethod(int a, int b) {
11492                     return a + b;
11493             }
11494         }
11497         cat > conftest.xml << EOF
11498         <project name="conftest" default="conftest">
11499         <target name="conftest">
11500             <javac srcdir="." includes="conftest.java">
11501             </javac>
11502         </target>
11503         </project>
11506         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11507         if test $? = 0 -a -f ./conftest.class; then
11508             AC_MSG_RESULT([Ant works])
11509             if test -z "$WITH_ANT_HOME"; then
11510                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11511                 if test -z "$ANT_HOME"; then
11512                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11513                 fi
11514             else
11515                 ANT_HOME="$WITH_ANT_HOME"
11516             fi
11517         else
11518             echo "configure: Ant test failed" >&5
11519             cat conftest.java >&5
11520             cat conftest.xml >&5
11521             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11522         fi
11523         rm -f conftest* core core.* *.core
11524     fi
11525     if test -z "$ANT_HOME"; then
11526         ANT_HOME="NO_ANT_HOME"
11527     else
11528         PathFormat "$ANT_HOME"
11529         ANT_HOME="$formatted_path"
11530         PathFormat "$ANT"
11531         ANT="$formatted_path"
11532     fi
11533     AC_SUBST(ANT_HOME)
11534     AC_SUBST(ANT)
11536     dnl Checking for ant.jar
11537     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11538         AC_MSG_CHECKING([Ant lib directory])
11539         if test -f $ANT_HOME/lib/ant.jar; then
11540             ANT_LIB="$ANT_HOME/lib"
11541         else
11542             if test -f $ANT_HOME/ant.jar; then
11543                 ANT_LIB="$ANT_HOME"
11544             else
11545                 if test -f /usr/share/java/ant.jar; then
11546                     ANT_LIB=/usr/share/java
11547                 else
11548                     if test -f /usr/share/ant-core/lib/ant.jar; then
11549                         ANT_LIB=/usr/share/ant-core/lib
11550                     else
11551                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11552                             ANT_LIB="$ANT_HOME/lib/ant"
11553                         else
11554                             if test -f /usr/share/lib/ant/ant.jar; then
11555                                 ANT_LIB=/usr/share/lib/ant
11556                             else
11557                                 AC_MSG_ERROR([Ant libraries not found!])
11558                             fi
11559                         fi
11560                     fi
11561                 fi
11562             fi
11563         fi
11564         PathFormat "$ANT_LIB"
11565         ANT_LIB="$formatted_path"
11566         AC_MSG_RESULT([Ant lib directory found.])
11567     fi
11568     AC_SUBST(ANT_LIB)
11570     ant_minver=1.6.0
11571     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11573     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11574     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11575     ant_version_major=`echo $ant_version | cut -d. -f1`
11576     ant_version_minor=`echo $ant_version | cut -d. -f2`
11577     echo "configure: ant_version $ant_version " >&5
11578     echo "configure: ant_version_major $ant_version_major " >&5
11579     echo "configure: ant_version_minor $ant_version_minor " >&5
11580     if test "$ant_version_major" -ge "2"; then
11581         AC_MSG_RESULT([yes, $ant_version])
11582     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11583         AC_MSG_RESULT([yes, $ant_version])
11584     else
11585         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11586     fi
11588     rm -f conftest* core core.* *.core
11591 OOO_JUNIT_JAR=
11592 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11593     AC_MSG_CHECKING([for JUnit 4])
11594     if test "$with_junit" = "yes"; then
11595         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
11596             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
11597         elif test -e /usr/share/java/junit4.jar; then
11598             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11599         else
11600            if test -e /usr/share/lib/java/junit.jar; then
11601               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11602            else
11603               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11604            fi
11605         fi
11606     else
11607         OOO_JUNIT_JAR=$with_junit
11608     fi
11609     if test "$_os" = "WINNT"; then
11610         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11611     fi
11612     printf 'import org.junit.Before;' > conftest.java
11613     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11614         AC_MSG_RESULT([$OOO_JUNIT_JAR])
11615     else
11616         AC_MSG_ERROR(
11617 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
11618  specify its pathname via --with-junit=..., or disable it via --without-junit])
11619     fi
11620     rm -f conftest.class conftest.java
11621     if test $OOO_JUNIT_JAR != ""; then
11622     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11623     fi
11625 AC_SUBST(OOO_JUNIT_JAR)
11627 HAMCREST_JAR=
11628 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11629     AC_MSG_CHECKING([for included Hamcrest])
11630     printf 'import org.hamcrest.BaseDescription;' > conftest.java
11631     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11632         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
11633     else
11634         AC_MSG_RESULT([Not included])
11635         AC_MSG_CHECKING([for standalone hamcrest jar.])
11636         if test "$with_hamcrest" = "yes"; then
11637             if test -e /usr/share/lib/java/hamcrest.jar; then
11638                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
11639             elif test -e /usr/share/java/hamcrest/core.jar; then
11640                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
11641             else
11642                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
11643             fi
11644         else
11645             HAMCREST_JAR=$with_hamcrest
11646         fi
11647         if test "$_os" = "WINNT"; then
11648             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
11649         fi
11650         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
11651             AC_MSG_RESULT([$HAMCREST_JAR])
11652         else
11653             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),
11654                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
11655         fi
11656     fi
11657     rm -f conftest.class conftest.java
11659 AC_SUBST(HAMCREST_JAR)
11662 AC_SUBST(SCPDEFS)
11665 # check for wget and curl
11667 WGET=
11668 CURL=
11670 if test "$enable_fetch_external" != "no"; then
11672 CURL=`which curl 2>/dev/null`
11674 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
11675     # wget new enough?
11676     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
11677     if test $? -eq 0; then
11678         WGET=$i
11679         break
11680     fi
11681 done
11683 if test -z "$WGET" -a -z "$CURL"; then
11684     AC_MSG_ERROR([neither wget nor curl found!])
11689 AC_SUBST(WGET)
11690 AC_SUBST(CURL)
11693 # check for sha256sum
11695 SHA256SUM=
11697 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
11698     eval "$i -a 256 --version" > /dev/null 2>&1
11699     ret=$?
11700     if test $ret -eq 0; then
11701         SHA256SUM="$i -a 256"
11702         break
11703     fi
11704 done
11706 if test -z "$SHA256SUM"; then
11707     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
11708         eval "$i --version" > /dev/null 2>&1
11709         ret=$?
11710         if test $ret -eq 0; then
11711             SHA256SUM=$i
11712             break
11713         fi
11714     done
11717 if test -z "$SHA256SUM"; then
11718     AC_MSG_ERROR([no sha256sum found!])
11721 AC_SUBST(SHA256SUM)
11723 dnl ===================================================================
11724 dnl Dealing with l10n options
11725 dnl ===================================================================
11726 AC_MSG_CHECKING([which languages to be built])
11727 # get list of all languages
11728 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
11729 # the sed command does the following:
11730 #   + if a line ends with a backslash, append the next line to it
11731 #   + adds " on the beginning of the value (after =)
11732 #   + adds " at the end of the value
11733 #   + removes en-US; we want to put it on the beginning
11734 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
11735 [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)]
11736 ALL_LANGS="en-US $completelangiso"
11737 # check the configured localizations
11738 WITH_LANG="$with_lang"
11739 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
11740     AC_MSG_RESULT([en-US])
11741 else
11742     AC_MSG_RESULT([$WITH_LANG])
11743     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
11744     if test -z "$MSGFMT"; then
11745         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
11746             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
11747         elif test -x "/opt/lo/bin/msgfmt"; then
11748             MSGFMT="/opt/lo/bin/msgfmt"
11749         else
11750             AC_CHECK_PROGS(MSGFMT, [msgfmt])
11751             if test -z "$MSGFMT"; then
11752                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
11753             fi
11754         fi
11755     fi
11756     if test -z "$MSGUNIQ"; then
11757         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
11758             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
11759         elif test -x "/opt/lo/bin/msguniq"; then
11760             MSGUNIQ="/opt/lo/bin/msguniq"
11761         else
11762             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
11763             if test -z "$MSGUNIQ"; then
11764                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
11765             fi
11766         fi
11767     fi
11769 AC_SUBST(MSGFMT)
11770 AC_SUBST(MSGUNIQ)
11771 # check that the list is valid
11772 for lang in $WITH_LANG; do
11773     test "$lang" = "ALL" && continue
11774     # need to check for the exact string, so add space before and after the list of all languages
11775     for vl in $ALL_LANGS; do
11776         if test "$vl" = "$lang"; then
11777            break
11778         fi
11779     done
11780     if test "$vl" != "$lang"; then
11781         # if you're reading this - you prolly quoted your languages remove the quotes ...
11782         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
11783     fi
11784 done
11785 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
11786     echo $WITH_LANG | grep -q en-US
11787     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
11789 # list with substituted ALL
11790 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
11791 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
11792 test "$WITH_LANG" = "en-US" && WITH_LANG=
11793 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
11794     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
11795     ALL_LANGS=`echo $ALL_LANGS qtz`
11797 AC_SUBST(ALL_LANGS)
11798 AC_SUBST(WITH_LANG)
11799 AC_SUBST(WITH_LANG_LIST)
11800 AC_SUBST(GIT_NEEDED_SUBMODULES)
11802 WITH_POOR_HELP_LOCALIZATIONS=
11803 if test -d "$SRC_ROOT/translations/source"; then
11804     for l in `ls -1 $SRC_ROOT/translations/source`; do
11805         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
11806             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
11807         fi
11808     done
11810 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
11812 if test -n "$with_locales"; then
11813     WITH_LOCALES="$with_locales"
11815     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
11816     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
11817     # config_host/config_locales.h.in
11818     for locale in $WITH_LOCALES; do
11819         lang=${locale%_*}
11821         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
11823         case $lang in
11824         hi|mr*ne)
11825             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
11826             ;;
11827         bg|ru)
11828             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
11829             ;;
11830         esac
11831     done
11832 else
11833     AC_DEFINE(WITH_LOCALE_ALL)
11835 AC_SUBST(WITH_LOCALES)
11837 dnl git submodule update --reference
11838 dnl ===================================================================
11839 if test -n "${GIT_REFERENCE_SRC}"; then
11840     for repo in ${GIT_NEEDED_SUBMODULES}; do
11841         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
11842             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
11843         fi
11844     done
11846 AC_SUBST(GIT_REFERENCE_SRC)
11848 dnl git submodules linked dirs
11849 dnl ===================================================================
11850 if test -n "${GIT_LINK_SRC}"; then
11851     for repo in ${GIT_NEEDED_SUBMODULES}; do
11852         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
11853             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
11854         fi
11855     done
11857 AC_SUBST(GIT_LINK_SRC)
11859 dnl branding
11860 dnl ===================================================================
11861 AC_MSG_CHECKING([for alternative branding images directory])
11862 # initialize mapped arrays
11863 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
11864 brand_files="$BRAND_INTRO_IMAGES about.svg"
11866 if test -z "$with_branding" -o "$with_branding" = "no"; then
11867     AC_MSG_RESULT([none])
11868     DEFAULT_BRAND_IMAGES="$brand_files"
11869 else
11870     if ! test -d $with_branding ; then
11871         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
11872     else
11873         AC_MSG_RESULT([$with_branding])
11874         CUSTOM_BRAND_DIR="$with_branding"
11875         for lfile in $brand_files
11876         do
11877             if ! test -f $with_branding/$lfile ; then
11878                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
11879                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
11880             else
11881                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
11882             fi
11883         done
11884         check_for_progress="yes"
11885     fi
11887 AC_SUBST([BRAND_INTRO_IMAGES])
11888 AC_SUBST([CUSTOM_BRAND_DIR])
11889 AC_SUBST([CUSTOM_BRAND_IMAGES])
11890 AC_SUBST([DEFAULT_BRAND_IMAGES])
11893 AC_MSG_CHECKING([for 'intro' progress settings])
11894 PROGRESSBARCOLOR=
11895 PROGRESSSIZE=
11896 PROGRESSPOSITION=
11897 PROGRESSFRAMECOLOR=
11898 PROGRESSTEXTCOLOR=
11899 PROGRESSTEXTBASELINE=
11901 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
11902     source "$with_branding/progress.conf"
11903     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
11904 else
11905     AC_MSG_RESULT([none])
11908 AC_SUBST(PROGRESSBARCOLOR)
11909 AC_SUBST(PROGRESSSIZE)
11910 AC_SUBST(PROGRESSPOSITION)
11911 AC_SUBST(PROGRESSFRAMECOLOR)
11912 AC_SUBST(PROGRESSTEXTCOLOR)
11913 AC_SUBST(PROGRESSTEXTBASELINE)
11916 AC_MSG_CHECKING([for extra build ID])
11917 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
11918     EXTRA_BUILDID="$with_extra_buildid"
11920 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
11921 if test -n "$EXTRA_BUILDID" ; then
11922     AC_MSG_RESULT([$EXTRA_BUILDID])
11923 else
11924     AC_MSG_RESULT([not set])
11926 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
11928 OOO_VENDOR=
11929 AC_MSG_CHECKING([for vendor])
11930 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
11931     OOO_VENDOR="$USERNAME"
11933     if test -z "$OOO_VENDOR"; then
11934         OOO_VENDOR="$USER"
11935     fi
11937     if test -z "$OOO_VENDOR"; then
11938         OOO_VENDOR="`id -u -n`"
11939     fi
11941     AC_MSG_RESULT([not set, using $OOO_VENDOR])
11942 else
11943     OOO_VENDOR="$with_vendor"
11944     AC_MSG_RESULT([$OOO_VENDOR])
11946 AC_SUBST(OOO_VENDOR)
11948 if test "$_os" = "Android" ; then
11949     ANDROID_PACKAGE_NAME=
11950     AC_MSG_CHECKING([for Android package name])
11951     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
11952         if test -n "$ENABLE_DEBUG"; then
11953             # Default to the package name that makes ndk-gdb happy.
11954             ANDROID_PACKAGE_NAME="org.libreoffice"
11955         else
11956             ANDROID_PACKAGE_NAME="org.example.libreoffice"
11957         fi
11959         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
11960     else
11961         ANDROID_PACKAGE_NAME="$with_android_package_name"
11962         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
11963     fi
11964     AC_SUBST(ANDROID_PACKAGE_NAME)
11967 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
11968 if test "$with_compat_oowrappers" = "yes"; then
11969     WITH_COMPAT_OOWRAPPERS=TRUE
11970     AC_MSG_RESULT(yes)
11971 else
11972     WITH_COMPAT_OOWRAPPERS=
11973     AC_MSG_RESULT(no)
11975 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
11977 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
11978 AC_MSG_CHECKING([for install dirname])
11979 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
11980     INSTALLDIRNAME="$with_install_dirname"
11982 AC_MSG_RESULT([$INSTALLDIRNAME])
11983 AC_SUBST(INSTALLDIRNAME)
11985 AC_MSG_CHECKING([for prefix])
11986 test "x$prefix" = xNONE && prefix=$ac_default_prefix
11987 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
11988 PREFIXDIR="$prefix"
11989 AC_MSG_RESULT([$PREFIXDIR])
11990 AC_SUBST(PREFIXDIR)
11992 LIBDIR=[$(eval echo $(eval echo $libdir))]
11993 AC_SUBST(LIBDIR)
11995 DATADIR=[$(eval echo $(eval echo $datadir))]
11996 AC_SUBST(DATADIR)
11998 MANDIR=[$(eval echo $(eval echo $mandir))]
11999 AC_SUBST(MANDIR)
12001 DOCDIR=[$(eval echo $(eval echo $docdir))]
12002 AC_SUBST(DOCDIR)
12004 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12005 AC_SUBST(INSTALLDIR)
12007 TESTINSTALLDIR="${BUILDDIR}/test-install"
12008 AC_SUBST(TESTINSTALLDIR)
12011 # ===================================================================
12012 # OAuth2 id and secrets
12013 # ===================================================================
12015 AC_MSG_CHECKING([for Google Drive client id and secret])
12016 GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12017 GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12018 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12019     GDRIVE_CLIENT_ID="\"\""
12022 if test "$with_gdrive_client_secret" = "no" -o -z "$with_gdrive_client_secret"; then
12023     GDRIVE_CLIENT_SECRET="\"\""
12026 if test -z "$GDRIVE_CLIENT_ID" -o -z "$GDRIVE_CLIENT_SECRET"; then
12027     AC_MSG_RESULT([not set])
12028 else
12029     AC_MSG_RESULT([set])
12032 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12033 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12035 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12036 ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12037 ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12038 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12039     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12042 if test "$with_alfresco_cloud_client_secret" = "no" -o -z "$with_alfresco_cloud_client_secret"; then
12043     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12046 if test -z "$ALFRESCO_CLOUD_CLIENT_ID" -o -z "$ALFRESCO_CLOUD_CLIENT_SECRET"; then
12047     AC_MSG_RESULT([not set])
12048 else
12049     AC_MSG_RESULT([set])
12051 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12052 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12054 AC_MSG_CHECKING([for OneDrive client id and secret])
12055 ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12056 ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12057 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12058     ONEDRIVE_CLIENT_ID="\"\""
12061 if test "$with_onedrive_client_secret" = "no" -o -z "$with_onedrive_client_secret"; then
12062     ONEDRIVE_CLIENT_SECRET="\"\""
12065 if test -z "$ONEDRIVE_CLIENT_ID" -o -z "$ONEDRIVE_CLIENT_SECRET"; then
12066     AC_MSG_RESULT([not set])
12067 else
12068     AC_MSG_RESULT([set])
12070 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12071 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12074 dnl ===================================================================
12075 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12076 dnl --enable-dependency-tracking configure option
12077 dnl ===================================================================
12078 AC_MSG_CHECKING([whether to enable dependency tracking])
12079 if test "$enable_dependency_tracking" = "no"; then
12080     nodep=TRUE
12081     AC_MSG_RESULT([no])
12082 else
12083     AC_MSG_RESULT([yes])
12085 AC_SUBST(nodep)
12087 dnl ===================================================================
12088 dnl Number of CPUs to use during the build
12089 dnl ===================================================================
12090 AC_MSG_CHECKING([for number of processors to use])
12091 # plain --with-parallelism is just the default
12092 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12093     if test "$with_parallelism" = "no"; then
12094         PARALLELISM=0
12095     else
12096         PARALLELISM=$with_parallelism
12097     fi
12098 else
12099     if test "$enable_icecream" = "yes"; then
12100         PARALLELISM="10"
12101     else
12102         case `uname -s` in
12104         Darwin|FreeBSD|NetBSD|OpenBSD)
12105             PARALLELISM=`sysctl -n hw.ncpu`
12106             ;;
12108         Linux)
12109             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12110         ;;
12111         # what else than above does profit here *and* has /proc?
12112         *)
12113             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12114             ;;
12115         esac
12117         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12118         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12119     fi
12122 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12123     if test -z "$with_parallelism"; then
12124             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12125             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12126             PARALLELISM="1"
12127     else
12128         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."
12129     fi
12132 if test $PARALLELISM -eq 0; then
12133     AC_MSG_RESULT([explicit make -j option needed])
12134 else
12135     AC_MSG_RESULT([$PARALLELISM])
12137 AC_SUBST(PARALLELISM)
12139 IWYU_PATH="$with_iwyu"
12140 AC_SUBST(IWYU_PATH)
12141 if test ! -z "$IWYU_PATH"; then
12142     if test ! -f "$IWYU_PATH"; then
12143         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12144     fi
12148 # Set up ILIB for MSVC build
12150 ILIB1=
12151 if test "$build_os" = "cygwin"; then
12152     ILIB="."
12153     if test -n "$JAVA_HOME"; then
12154         ILIB="$ILIB;$JAVA_HOME/lib"
12155     fi
12156     ILIB1=-link
12157     if test "$BITNESS_OVERRIDE" = 64; then
12158         if test $vcnum = "150"; then
12159             ILIB="$ILIB;$COMPATH/lib/x64"
12160             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12161         else
12162             ILIB="$ILIB;$COMPATH/lib/amd64"
12163             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/amd64"
12164         fi
12165         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12166         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12167         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12168             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12169             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12170         fi
12171         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12172         ucrtlibpath_formatted=$formatted_path
12173         ILIB="$ILIB;$ucrtlibpath_formatted"
12174         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12175     else
12176         if test $vcnum = "150"; then
12177             ILIB="$ILIB;$COMPATH/lib/x86"
12178             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12179         else
12180             ILIB="$ILIB;$COMPATH/lib"
12181             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib"
12182         fi
12183         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12184         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12185         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12186             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12187             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12188         fi
12189         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12190         ucrtlibpath_formatted=$formatted_path
12191         ILIB="$ILIB;$ucrtlibpath_formatted"
12192         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12193     fi
12194     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12195         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12196     else
12197         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12198     fi
12200     AC_SUBST(ILIB)
12203 dnl We should be able to drop the below check when bumping the GCC baseline to
12204 dnl 4.9, as <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54577>
12205 dnl "deque<T>::erase() still takes iterator instead of const_iterator" should be
12206 dnl fixed there with <https://gcc.gnu.org/git/?p=gcc.git;a=commit;
12207 dnl h=6b0e18ca48bb4b4c01e7b5be2b98849943fdcf91>:
12208 AC_MSG_CHECKING(
12209     [whether C++11 use of const_iterator in standard containers is broken])
12210 save_CXXFLAGS=$CXXFLAGS
12211 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12212 AC_LANG_PUSH([C++])
12213 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12214     #include <list>
12215     ]],[[
12216         std::list<int> l;
12217         l.erase(l.cbegin());
12218     ]])],
12219     [broken=no], [broken=yes])
12220 AC_LANG_POP([C++])
12221 CXXFLAGS=$save_CXXFLAGS
12222 AC_MSG_RESULT([$broken])
12223 if test "$broken" = yes; then
12224     AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
12228 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12229 save_CXXFLAGS=$CXXFLAGS
12230 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12231 save_LIBS=$LIBS
12232 if test -n "$ILIB1"; then
12233     LIBS="$LIBS $ILIB1"
12235 AC_LANG_PUSH([C++])
12236 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12237     // Exit with failure if the static initializer_list is stored on the
12238     // stack (as done by Clang < 3.4):
12239     #include <initializer_list>
12240     struct S {};
12241     bool g(void const * p1, void const * p2) {
12242         int n;
12243         return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12244     }
12245     bool f(void const * p1) {
12246         static std::initializer_list<S> s { S() };
12247         return g(p1, s.begin());
12248     }
12249     ]],[[
12250         int n;
12251         return f(&n) ? 0 : 1;
12252     ]])], [broken=no], [broken=yes],[broken='assuming not (cross-compiling)'])
12253 AC_LANG_POP([C++])
12254 LIBS=$save_LIBS
12255 CXXFLAGS=$save_CXXFLAGS
12256 AC_MSG_RESULT([$broken])
12257 if test "$broken" = yes -a "$_os" != "iOS"; then
12258     AC_MSG_ERROR([working support for static initializer_list needed])
12262 # ===================================================================
12263 # Creating bigger shared library to link against
12264 # ===================================================================
12265 AC_MSG_CHECKING([whether to create huge library])
12266 MERGELIBS=
12268 if test $_os = iOS -o $_os = Android; then
12269     # Never any point in mergelibs for these as we build just static
12270     # libraries anyway...
12271     enable_mergelibs=no
12274 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12275     if test $_os != Linux -a $_os != WINNT; then
12276         add_warning "--enable-mergelibs is not tested for this platform"
12277     fi
12278     MERGELIBS="TRUE"
12279     AC_MSG_RESULT([yes])
12280 else
12281     AC_MSG_RESULT([no])
12283 AC_SUBST([MERGELIBS])
12285 dnl ===================================================================
12286 dnl icerun is a wrapper that stops us spawning tens of processes
12287 dnl locally - for tools that can't be executed on the compile cluster
12288 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12289 dnl ===================================================================
12290 AC_MSG_CHECKING([whether to use icerun wrapper])
12291 ICECREAM_RUN=
12292 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12293     ICECREAM_RUN=icerun
12294     AC_MSG_RESULT([yes])
12295 else
12296     AC_MSG_RESULT([no])
12298 AC_SUBST(ICECREAM_RUN)
12300 dnl ===================================================================
12301 dnl Setup the ICECC_VERSION for the build the same way it was set for
12302 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12303 dnl ===================================================================
12304 x_ICECC_VERSION=[\#]
12305 if test -n "$ICECC_VERSION" ; then
12306     x_ICECC_VERSION=
12308 AC_SUBST(x_ICECC_VERSION)
12309 AC_SUBST(ICECC_VERSION)
12311 dnl ===================================================================
12313 AC_MSG_CHECKING([MPL subset])
12314 MPL_SUBSET=
12316 if test "$enable_mpl_subset" = "yes"; then
12317     warn_report=false
12318     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12319         warn_report=true
12320     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12321         warn_report=true
12322     fi
12323     if test "$warn_report" = "true"; then
12324         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12325     fi
12326     if test "x$enable_postgresql_sdbc" != "xno"; then
12327         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12328     fi
12329     if test "$enable_lotuswordpro" = "yes"; then
12330         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12331     fi
12332     if test "$WITH_WEBDAV" = "neon"; then
12333         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12334     fi
12335     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12336         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12337     fi
12338     if test -n "$ENABLE_PDFIMPORT"; then
12339         if test "x$SYSTEM_POPPLER" = "x"; then
12340             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12341         fi
12342     fi
12343     # cf. m4/libo_check_extension.m4
12344     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12345         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12346     fi
12347     for theme in $WITH_THEMES; do
12348         case $theme in
12349         breeze|crystal|default|hicontrast|oxygen|sifr)
12350             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12351         *) : ;;
12352         esac
12353     done
12355     ENABLE_OPENGL_TRANSITIONS=
12357     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12358         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12359     fi
12361     MPL_SUBSET="TRUE"
12362     AC_DEFINE(MPL_HAVE_SUBSET)
12363     AC_MSG_RESULT([only])
12364 else
12365     AC_MSG_RESULT([no restrictions])
12367 AC_SUBST(MPL_SUBSET)
12369 dnl ===================================================================
12371 AC_MSG_CHECKING([formula logger])
12372 ENABLE_FORMULA_LOGGER=
12374 if test "x$enable_formula_logger" = "xyes"; then
12375     AC_MSG_RESULT([yes])
12376     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12377     ENABLE_FORMULA_LOGGER=TRUE
12378 elif test -n "$ENABLE_DBGUTIL" ; then
12379     AC_MSG_RESULT([yes])
12380     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12381     ENABLE_FORMULA_LOGGER=TRUE
12382 else
12383     AC_MSG_RESULT([no])
12386 AC_SUBST(ENABLE_FORMULA_LOGGER)
12388 dnl ===================================================================
12389 dnl Setting up the environment.
12390 dnl ===================================================================
12391 AC_MSG_NOTICE([setting up the build environment variables...])
12393 AC_SUBST(COMPATH)
12395 if test "$build_os" = "cygwin"; then
12396     if test -d "$COMPATH/atlmfc/lib"; then
12397         ATL_LIB="$COMPATH/atlmfc/lib"
12398         ATL_INCLUDE="$COMPATH/atlmfc/include"
12399     else
12400         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12401         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12402     fi
12403     if test "$BITNESS_OVERRIDE" = 64; then
12404         if test $VCVER = "150"; then
12405             ATL_LIB="$ATL_LIB/x64"
12406         else
12407             ATL_LIB="$ATL_LIB/amd64"
12408         fi
12409     else
12410         if test $VCVER = "150"; then
12411             ATL_LIB="$ATL_LIB/x86"
12412         fi
12413     fi
12414     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12415     PathFormat "/usr/bin/find.exe"
12416     FIND="$formatted_path"
12417     PathFormat "/usr/bin/sort.exe"
12418     SORT="$formatted_path"
12419     PathFormat "/usr/bin/grep.exe"
12420     WIN_GREP="$formatted_path"
12421     PathFormat "/usr/bin/ls.exe"
12422     WIN_LS="$formatted_path"
12423     PathFormat "/usr/bin/touch.exe"
12424     WIN_TOUCH="$formatted_path"
12425 else
12426     FIND=find
12427     SORT=sort
12430 AC_SUBST(ATL_INCLUDE)
12431 AC_SUBST(ATL_LIB)
12432 AC_SUBST(FIND)
12433 AC_SUBST(SORT)
12434 AC_SUBST(WIN_GREP)
12435 AC_SUBST(WIN_LS)
12436 AC_SUBST(WIN_TOUCH)
12438 AC_SUBST(BUILD_TYPE)
12440 AC_SUBST(SOLARINC)
12442 PathFormat "$PERL"
12443 PERL="$formatted_path"
12444 AC_SUBST(PERL)
12446 if test -n "$TMPDIR"; then
12447     TEMP_DIRECTORY="$TMPDIR"
12448 else
12449     TEMP_DIRECTORY="/tmp"
12451 if test "$build_os" = "cygwin"; then
12452     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12454 AC_SUBST(TEMP_DIRECTORY)
12456 # setup the PATH for the environment
12457 if test -n "$LO_PATH_FOR_BUILD"; then
12458     LO_PATH="$LO_PATH_FOR_BUILD"
12459 else
12460     LO_PATH="$PATH"
12462     case "$host_os" in
12464     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12465         if test "$ENABLE_JAVA" != ""; then
12466             pathmunge "$JAVA_HOME/bin" "after"
12467         fi
12468         ;;
12470     cygwin*)
12471         # Win32 make needs native paths
12472         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12473             LO_PATH=`cygpath -p -m "$PATH"`
12474         fi
12475         if test "$BITNESS_OVERRIDE" = 64; then
12476             # needed for msi packaging
12477             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12478         fi
12479         # .NET 4.6 and higher don't have bin directory
12480         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12481             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12482         fi
12483         pathmunge "$ASM_HOME" "before"
12484         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12485         pathmunge "$CSC_PATH" "before"
12486         pathmunge "$MIDL_PATH" "before"
12487         pathmunge "$AL_PATH" "before"
12488         pathmunge "$MSPDB_PATH" "before"
12489         if test -n "$MSBUILD_PATH" ; then
12490             pathmunge "$MSBUILD_PATH" "before"
12491         fi
12492         if test "$BITNESS_OVERRIDE" = 64; then
12493             pathmunge "$COMPATH/bin/amd64" "before"
12494             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12495         else
12496             pathmunge "$COMPATH/bin" "before"
12497             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12498         fi
12499         if test "$ENABLE_JAVA" != ""; then
12500             if test -d "$JAVA_HOME/jre/bin/client"; then
12501                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12502             fi
12503             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12504                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12505             fi
12506             pathmunge "$JAVA_HOME/bin" "before"
12507         fi
12508         ;;
12510     solaris*)
12511         pathmunge "/usr/css/bin" "before"
12512         if test "$ENABLE_JAVA" != ""; then
12513             pathmunge "$JAVA_HOME/bin" "after"
12514         fi
12515         ;;
12516     esac
12519 AC_SUBST(LO_PATH)
12521 libo_FUZZ_SUMMARY
12523 # Generate a configuration sha256 we can use for deps
12524 if test -f config_host.mk; then
12525     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12527 if test -f config_host_lang.mk; then
12528     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12531 CFLAGS=$my_original_CFLAGS
12532 CXXFLAGS=$my_original_CXXFLAGS
12533 CPPFLAGS=$my_original_CPPFLAGS
12535 AC_CONFIG_FILES([config_host.mk
12536                  config_host_lang.mk
12537                  Makefile
12538                  lo.xcent
12539                  bin/bffvalidator.sh
12540                  bin/odfvalidator.sh
12541                  bin/officeotron.sh
12542                  instsetoo_native/util/openoffice.lst
12543                  sysui/desktop/macosx/Info.plist])
12544 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12545 AC_CONFIG_HEADERS([config_host/config_clang.h])
12546 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12547 AC_CONFIG_HEADERS([config_host/config_eot.h])
12548 AC_CONFIG_HEADERS([config_host/config_extension_update.h])
12549 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12550 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12551 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12552 AC_CONFIG_HEADERS([config_host/config_features.h])
12553 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12554 AC_CONFIG_HEADERS([config_host/config_folders.h])
12555 AC_CONFIG_HEADERS([config_host/config_gio.h])
12556 AC_CONFIG_HEADERS([config_host/config_global.h])
12557 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12558 AC_CONFIG_HEADERS([config_host/config_java.h])
12559 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12560 AC_CONFIG_HEADERS([config_host/config_libepubgen.h])
12561 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12562 AC_CONFIG_HEADERS([config_host/config_locales.h])
12563 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12564 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12565 AC_CONFIG_HEADERS([config_host/config_qt5.h])
12566 AC_CONFIG_HEADERS([config_host/config_oox.h])
12567 AC_CONFIG_HEADERS([config_host/config_options.h])
12568 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12569 AC_CONFIG_HEADERS([config_host/config_test.h])
12570 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12571 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12572 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12573 AC_CONFIG_HEADERS([config_host/config_version.h])
12574 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12575 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12576 AC_CONFIG_HEADERS([config_host/config_python.h])
12577 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12578 AC_OUTPUT
12580 if test "$CROSS_COMPILING" = TRUE; then
12581     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12584 # touch the config timestamp file
12585 if test ! -f config_host.mk.stamp; then
12586     echo > config_host.mk.stamp
12587 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12588     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12589 else
12590     echo > config_host.mk.stamp
12593 # touch the config lang timestamp file
12594 if test ! -f config_host_lang.mk.stamp; then
12595     echo > config_host_lang.mk.stamp
12596 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12597     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12598 else
12599     echo > config_host_lang.mk.stamp
12603 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12605 cat << _EOS
12606 ****************************************************************************
12607 WARNING:
12608 Your make version is known to be horribly slow, and hard to debug
12609 problems with. To get a reasonably functional make please do:
12611 to install a pre-compiled binary make for Win32
12613  mkdir -p /opt/lo/bin
12614  cd /opt/lo/bin
12615  wget https://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
12616  cp make-85047eb-msvc.exe make
12617  chmod +x make
12619 to install from source:
12620 place yourself in a working directory of you choice.
12622  git clone git://git.savannah.gnu.org/make.git
12624  [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"]
12625  set PATH=%PATH%;C:\Cygwin\bin
12626  [or Cygwin64, if that is what you have]
12627  cd path-to-make-repo-you-cloned-above
12628  build_w32.bat --without-guile
12630 should result in a WinRel/gnumake.exe.
12631 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12633 Then re-run autogen.sh
12635 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12636 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12638 _EOS
12641 cat << _EOF
12642 ****************************************************************************
12644 To build, run:
12645 $GNUMAKE
12647 To view some help, run:
12648 $GNUMAKE help
12650 _EOF
12652 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12653     cat << _EOF
12654 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12655 _EOF
12657     if test $_os = Darwin; then
12658         echo open instdir/$PRODUCTNAME.app
12659     else
12660         echo instdir/program/soffice
12661     fi
12662     cat << _EOF
12664 If you want to run the smoketest, run:
12665 $GNUMAKE check
12667 _EOF
12670 if test -f warn; then
12671     cat warn
12672     rm warn
12675 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: