bump product version to 4.4.0.0.alpha0+
[LibreOffice.git] / configure.ac
blob3591406301083f30b3ee993982b2b3f79aaef7fa
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 argumemnt 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],[4.4.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 PathFormat()
30     formatted_path="$1"
31     if test "$build_os" = "cygwin"; then
32         pf_part1=
33         pf_conv_to_dos=
34         for pf_part in $formatted_path; do
35             if test -z "$pf_part1"; then
36                 pf_part1="$pf_part"
37             else
38                 pf_conv_to_dos="yes"
39             fi
40         done
41         if test "$pf_conv_to_dos" = "yes"; then
42             formatted_path=`cygpath -d "$formatted_path"`
43             if test $? -ne 0;  then
44                 AC_MSG_ERROR([path conversion failed for "$1".])
45             fi
46         fi
47         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
48         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
49         if test "$fp_count_slash$fp_count_colon" != "00"; then
50             if test "$fp_count_colon" = "0"; then
51                 formatted_path=`realpath "$formatted_path"`
52                 if test $? -ne 0;  then
53                     AC_MSG_ERROR([realpath failed for "$1".])
54                 fi
55             fi
56             formatted_path=`cygpath -m "$formatted_path"`
57             if test $? -ne 0;  then
58                 AC_MSG_ERROR([path conversion failed for "$1".])
59             fi
60         fi
61     fi
64 AbsolutePath()
66     # There appears to be no simple and portable method to get an absolute and
67     # canonical path, so we try creating the directory if does not exist and
68     # utilizing the shell and pwd.
69     rel="$1"
70     absolute_path=""
71     test ! -e "$rel" && mkdir -p "$rel"
72     if test -d "$rel" ; then
73         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
74         absolute_path="$(pwd)"
75         cd - &> /dev/null
76     else
77         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
78     fi
81 rm -f warn
82 have_WARNINGS="no"
83 add_warning()
85     if test "$have_WARNINGS" = "no"; then
86         echo "*************************************" > warn
87         have_WARNINGS="yes"
88         if which tput >/dev/null 2>/dev/null && test `tput colors` -ge 8; then
89             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
90             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
91         else
92             COLORWARN="* WARNING :"
93         fi
94     fi
95     echo "$COLORWARN $@" >> warn
98 echo "********************************************************************"
99 echo "*"
100 echo "*   Running ${PACKAGE_NAME} build configuration."
101 echo "*"
102 echo "********************************************************************"
103 echo ""
105 dnl ===================================================================
106 dnl checks build and host OSes
107 dnl do this before argument processing to allow for platform dependent defaults
108 dnl ===================================================================
109 AC_CANONICAL_HOST
111 AC_MSG_CHECKING([for product name])
112 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
113     PRODUCTNAME=AC_PACKAGE_NAME"Dev"
114 else
115     PRODUCTNAME=AC_PACKAGE_NAME
117 AC_MSG_RESULT([$PRODUCTNAME])
118 AC_SUBST(PRODUCTNAME)
120 dnl ===================================================================
121 dnl Our version is defined by the AC_INIT() at the top of this script.
122 dnl ===================================================================
124 set `echo AC_PACKAGE_VERSION | sed "s/\./ /g"`
126 LIBO_VERSION_MAJOR=$1
127 LIBO_VERSION_MINOR=$2
128 LIBO_VERSION_MICRO=$3
129 LIBO_VERSION_PATCH=$4
131 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
132 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
133 # no way to encode that into an integer in general.
134 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
136 LIBO_VERSION_SUFFIX=$5
137 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
138 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
139 # they get undoubled before actually passed to sed.
140 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
141 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
142 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
143 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
145 AC_SUBST(LIBO_VERSION_MAJOR)
146 AC_SUBST(LIBO_VERSION_MINOR)
147 AC_SUBST(LIBO_VERSION_MICRO)
148 AC_SUBST(LIBO_VERSION_PATCH)
149 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
150 AC_SUBST(LIBO_VERSION_SUFFIX)
151 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
153 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
154 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
155 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
156 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
158 LIBO_THIS_YEAR=`date +%Y`
159 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
161 # This UPD silly thing must go away soon
162 UPD="${LIBO_VERSION_MAJOR}${LIBO_VERSION_MINOR}0"
163 AC_SUBST(UPD)
165 # This too should go away
166 SOURCEVERSION="OOO$UPD"
167 AC_SUBST(SOURCEVERSION)
169 dnl ===================================================================
170 dnl Product version
171 dnl ===================================================================
172 AC_MSG_CHECKING([for product version])
173 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
174 AC_MSG_RESULT([$PRODUCTVERSION])
175 AC_SUBST(PRODUCTVERSION)
177 AC_PROG_EGREP
178 # AC_PROG_EGREP doesn't set GREP on all systems as well
179 AC_PATH_PROG(GREP, grep)
181 BUILDDIR=`pwd`
182 cd $srcdir
183 SRC_ROOT=`pwd`
184 cd $BUILDDIR
185 x_Cygwin=[\#]
187 if test "$build_os" = "cygwin"; then
188     PathFormat "$SRC_ROOT"
189     SRC_ROOT="$formatted_path"
190     PathFormat "$BUILDDIR"
191     BUILDDIR="$formatted_path"
192     x_Cygwin=
195 AC_SUBST(SRC_ROOT)
196 AC_SUBST(BUILDDIR)
197 AC_SUBST(x_Cygwin)
198 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
199 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
201 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
202     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
205 # need sed in os checks...
206 AC_PATH_PROGS(SED, sed)
207 if test -z "$SED"; then
208     AC_MSG_ERROR([install sed to run this script])
211 # Set the ENABLE_LTO variable
212 # ===================================================================
213 AC_MSG_CHECKING([whether to use link-time optimization])
214 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
215     ENABLE_LTO="TRUE"
216     AC_MSG_RESULT([yes])
217     AC_DEFINE(STATIC_LINKING)
218 else
219     ENABLE_LTO=""
220     AC_MSG_RESULT([no])
222 AC_SUBST(ENABLE_LTO)
224 dnl ===================================================================
225 dnl When building for Android, --with-android-ndk,
226 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
227 dnl mandatory
228 dnl ===================================================================
230 AC_ARG_WITH(android-ndk,
231     AS_HELP_STRING([--with-android-ndk],
232         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
235 AC_ARG_WITH(android-ndk-toolchain-version,
236     AS_HELP_STRING([--with-android-ndk-toolchain-version],
237         [Specify which toolchain version to use, of those present in the
238         Android NDK you are using. Mandatory if the NDK used has several
239         toolchain versions for the host architecture you are building for.
240         Possible values are 4.6, 4.8, clang3.3 and clang3.4. Only 4.8 has been
241         tested for real...]), ,)
243 AC_ARG_WITH(android-sdk,
244     AS_HELP_STRING([--with-android-sdk],
245         [Specify location of the Android SDK. Mandatory when building for Android,
246         or when building the Impress Remote Android app.]),
249 ANDROID_NDK_HOME=
250 if test -n "$with_android_ndk"; then
251     ANDROID_NDK_HOME=$with_android_ndk
253     # Set up a lot of pre-canned defaults
255     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
256         AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT file in $ANDROID_NDK_HOME.])
257     fi
258     ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
260     case $ANDROID_NDK_VERSION in
261     r8*|r9*)
262         ;;
263     *)
264         AC_MSG_ERROR([Unsupported NDK version $ANDROID_NDK_VERSION, only r8* and r9* versions are supported])
265         ;;
266     esac
268     if test $host_cpu = arm; then
269         android_cpu=arm
270         android_platform_prefix=$android_cpu-linux-androideabi
271     elif test $host_cpu = mips; then
272         android_cpu=mips
273         android_platform_prefix=$android_cpu-linux-androideabi
274     else
275         # host_cpu is something like "i386" or "i686" I guess, NDK uses
276         # "x86" in some contexts
277         android_cpu=x86
278         android_platform_prefix=$android_cpu
279     fi
281     case "$with_android_ndk_toolchain_version" in
282     4.6|4.7|4.8)
283         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$with_android_ndk_toolchain_version
284         ANDROID_COMPILER_DIR=$ANDROID_BINUTILS_DIR
285         ;;
286     clang3.3|clang3.4)
287         AC_MSG_WARN([Building with the Clang tool-chain is known to break in the bridges module, fix that please])
288         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-4.8
289         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm-${with_android_ndk_toolchain_version#clang}
290         ANDROID_USING_CLANG=true
291         ;;
292     *)
293         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option])
294     esac
296     if test ! -d $ANDROID_BINUTILS_DIR; then
297         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
298     elif test $ANDROID_COMPILER_DIR != $ANDROID_BINUTILS_DIR -a ! -d $ANDROID_COMPILER_DIR; then
299         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
300     fi
302     # Check if there is a 64-bit tool-chain. Google provides a NDK with 64-bit tool-chain binaries in
303     # NDK r8e and later, and for earlier NDKs it was possible to build one yourself. Using a 64-bit
304     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
305     # manage to link the (app-specific) single huge .so that is built for the apps in
306     # android/experimental/* if there is debug information in a significant part of the object files.
307     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
308     # all objects have been built with debug information.)
309     toolchain_system='*'
310     if test $build_os = linux-gnu; then
311         ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/linux-x86/bin
312         ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/linux-x86
313         if test $build_cpu = x86_64; then
314             if test -d $ANDROID_COMPILER_DIR/prebuilt/linux-x86_64; then
315                 ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/linux-x86_64/bin
316             fi
317             if test -d $ANDROID_BINUTILS_DIR/prebuilt/linux-x86_64; then
318                 ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/linux-x86_64
319             fi
320         fi
321         ANDROID_BINUTILS_BIN=$ANDROID_BINUTILS_PREBUILT_ROOT/bin
322     fi
324     # This stays empty if there is just one version of the toolchain in the NDK
325     ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=
326     case "`echo $ANDROID_NDK_HOME/toolchains/$android_cpu*-*/prebuilt/*/bin`" in
327     */bin\ */bin*)
328         # Trailing slash intentional and necessary, compare to how this is used
329         if test -n "$ANDROID_USING_CLANG"; then
330             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=4.8/
331         else
332             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
333         fi
334         ;;
335     esac
337     if test $host_cpu = arm; then
338        android_gnu_prefix=arm-linux-androideabi
339     elif test $host_cpu = mips; then
340        android_gnu_prefix=mipsel-linux-android
341     elif test $ANDROID_NDK_VERSION = r8; then
342         # The prefix used for the x86 tool-chain changed between NDK r8 and r8b
343         android_gnu_prefix=i686-android-linux
344     else
345         android_gnu_prefix=i686-linux-android
346     fi
348     test -z "$SYSBASE" && export SYSBASE=$ANDROID_NDK_HOME/platforms/android-15/arch-$android_cpu
349     test -z "$AR" && AR=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ar
350     test -z "$NM" && NM=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-nm
351     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-objdump
352     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ranlib
353     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-strip
355     if test $host_cpu = arm; then
356         ANDROID_APP_ABI=armeabi-v7a
357         if test -n "$ANDROID_USING_CLANG"; then
358             ANDROIDCFLAGS="-gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT"
359             ANDROIDCFLAGS="$ANDROIDCFLAGS -target armv7-none-linux-androideabi"
360             ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes"
361         else
362             :
363         fi
364         ANDROIDCFLAGS="$ANDROIDCFLAGS -mthumb"
365         ANDROIDCFLAGS="$ANDROIDCFLAGS -march=armv7-a -mfloat-abi=softfp -mfpu=neon"
366     elif test $host_cpu = mips; then
367         ANDROID_APP_ABI=mips
368         ANDROIDCFLAGS=""
369     else # x86
370         ANDROID_APP_ABI=x86
371         ANDROIDCFLAGS="-march=atom"
372     fi
373     ANDROIDCFLAGS="$ANDROIDCFLAGS -ffunction-sections -fdata-sections"
374     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/$ANDROID_APP_ABI"
375     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot $ANDROID_NDK_HOME/platforms/android-15/arch-$android_cpu"
376     ANDROIDCFLAGS="$ANDROIDCFLAGS -Wl,--fix-cortex-a8"
378     if test -n "$ANDROID_USING_CLANG"; then
379         ANDROIDCFLAGS="$ANDROIDCFLAGS -Qunused-arguments"
380     else
381         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wno-psabi"
382     fi
384     # When using the 4.6 or newer toolchain, use the gold linker
385     case "$with_android_ndk_toolchain_version" in
386     4.[[6789]]*|[[56789]].*|clang*)
387         # The NDK doesn't have ld.gold for MIPS for some reason
388         if test "$host_cpu" != mips -a "$ENABLE_LTO" != TRUE; then
389             ANDROIDCFLAGS="$ANDROIDCFLAGS -fuse-ld=gold"
390         fi
391         ;;
392     esac
394     if test "$ENABLE_LTO" = TRUE; then
395         # -flto comes from com_GCC_degs.mk, too, but we need to make sure it gets passed as part of
396         # $CC and $CXX when building external libraries
397         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto"
398     fi
400     # gdbserver can be in different locations
401     if test -f $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver; then
402         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver
403     elif test -f $ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver; then
404         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver
405     else
406         AC_MSG_ERROR([Can't find gdbserver for your Android target])
407     fi
409     if test $host_cpu = arm; then
410         ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I $ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/armeabi-v7a/include"
411     elif test $host_cpu = mips; then
412         ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I $ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/mips/include"
413     else # x86
414         ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I $ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/x86/include"
415     fi
417     if test -z "$CC"; then
418         case "$with_android_ndk_toolchain_version" in
419         4.*)
420             CC="$ANDROID_COMPILER_BIN/$android_gnu_prefix-gcc $ANDROIDCFLAGS"
421             ;;
422         clang*)
423             CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
424         esac
425     fi
426     if test -z "$CXX"; then
427         case "$with_android_ndk_toolchain_version" in
428         4.*)
429             CXX="$ANDROID_COMPILER_BIN/$android_gnu_prefix-g++ $ANDROIDCXXFLAGS"
430             ;;
431         clang*)
432             CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
433             ;;
434         esac
435     fi
437 AC_SUBST(ANDROID_NDK_GDBSERVER)
438 AC_SUBST(ANDROID_APP_ABI)
440 dnl ===================================================================
441 dnl Also --with-android-sdk is mandatory
442 dnl ===================================================================
443 ANDROID_SDK_HOME=
444 if test -n "$with_android_sdk"; then
445     ANDROID_SDK_HOME=$with_android_sdk
446     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
448 AC_SUBST(ANDROID_SDK_HOME)
450 dnl ===================================================================
451 dnl The following is a list of supported systems.
452 dnl Sequential to keep the logic very simple
453 dnl These values may be checked and reset later.
454 dnl ===================================================================
455 #defaults unless the os test overrides this:
456 test_randr=yes
457 test_xrender=yes
458 test_cups=yes
459 test_dbus=yes
460 test_fontconfig=yes
461 test_cairo=no
463 # Default values, as such probably valid just for Linux, set
464 # differently below just for Mac OSX,but at least better than
465 # hardcoding these as we used to do. Much of this is duplicated also
466 # in solenv for old build system and for gbuild, ideally we should
467 # perhaps define stuff like this only here in configure.ac?
469 LINKFLAGSSHL="-shared"
470 PICSWITCH="-fpic"
471 DLLPOST=".so"
473 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
475 INSTROOTSUFFIX=
476 SDKDIRNAME=sdk
478 case "$host_os" in
480 solaris*)
481     test_gtk=yes
482     build_gstreamer=yes
483     build_gstreamer_0_10=yes
484     test_tde=yes
485     test_kde=yes
486     test_freetype=yes
487     test_gstreamer=yes
488     _os=SunOS
490     dnl ===========================================================
491     dnl Check whether we're using Solaris 10 - SPARC or Intel.
492     dnl ===========================================================
493     AC_MSG_CHECKING([the Solaris operating system release])
494     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
495     if test "$_os_release" -lt "10"; then
496         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
497     else
498         AC_MSG_RESULT([ok ($_os_release)])
499     fi
501     dnl Check whether we're using a SPARC or i386 processor
502     AC_MSG_CHECKING([the processor type])
503     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
504         AC_MSG_RESULT([ok ($host_cpu)])
505     else
506         AC_MSG_ERROR([only SPARC and i386 processors are supported])
507     fi
508     ;;
510 linux-gnu*|k*bsd*-gnu*)
511     test_gtk=yes
512     build_gstreamer=yes
513     build_gstreamer_0_10=yes
514     test_tde=yes
515     test_kde=yes
516     test_kde4=yes
517     test_freetype=yes
518     _os=Linux
519     ;;
521 gnu)
522     test_randr=no
523     test_xrender=no
524     _os=GNU
525      ;;
527 cygwin*|interix*|mingw32*)
529     # When building on Windows normally with MSVC under Cygwin,
530     # configure thinks that the host platform (the platform the
531     # built code will run on) is Cygwin, even if it obviously is
532     # Windows, which in Autoconf terminology is called
533     # "mingw32". (Which is misleading as MinGW is the name of the
534     # tool-chain, not an operating system.)
536     # Somewhat confusing, yes. But this configure script doesn't
537     # look at $host etc that much, it mostly uses its own $_os
538     # variable, set here in this case statement.
540     # When cross-compiling to Windows from Unix, the host platform
541     # is "mingw32" (because in that case it is the MinGW
542     # tool-chain that is used).
544     test_cups=no
545     test_dbus=no
546     test_randr=no
547     test_xrender=no
548     test_freetype=no
549     test_fontconfig=no
550     _os=WINNT
552     DLLPOST=".dll"
553     LINKFLAGSNOUNDEFS=
555     # If the host OS matches "mingw32*", that means we are using the
556     # MinGW cross-compiler, because we don't see the point in building
557     # LibreOffice using MinGW on Windows. If you want to build on
558     # Windows, use MSVC. If you want to use MinGW, surely you want to
559     # cross-compile (from Linux or some other Unix).
561     case "$host_os" in
562     mingw32*)
563         WITH_MINGW=yes
564         if test -z "$CC"; then
565             CC="$host_cpu-$host_vendor-$host_os-gcc"
566         fi
567         if test -z "$CXX"; then
568             CXX="$host_cpu-$host_vendor-$host_os-g++"
569         fi
570         ;;
571     esac
572     ;;
574 darwin*) # Mac OS X or iOS
575     test_gtk=yes
576     test_randr=no
577     test_xrender=no
578     test_freetype=no
579     test_fontconfig=no
580     test_dbus=no
581     if test "$host_cpu" = "arm"; then
582         _os=iOS
583         test_gtk=no
584         test_cups=no
585     else
586         _os=Darwin
587         INSTROOTSUFFIX=/$PRODUCTNAME.app/Contents
588         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
589     fi
590     enable_systray=no
591     # See comment above the case "$host_os"
592     LINKFLAGSSHL="-dynamiclib -single_module"
594     # -fPIC is default
595     PICSWITCH=""
597     DLLPOST=".dylib"
599     # -undefined error is the default
600     LINKFLAGSNOUNDEFS=""
603 freebsd*)
604     test_gtk=yes
605     build_gstreamer=yes
606     build_gstreamer_0_10=yes
607     test_tde=yes
608     test_kde=yes
609     test_kde4=yes
610     test_freetype=yes
611     AC_MSG_CHECKING([the FreeBSD operating system release])
612     if test -n "$with_os_version"; then
613         OSVERSION="$with_os_version"
614     else
615         OSVERSION=`/sbin/sysctl -n kern.osreldate`
616     fi
617     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
618     AC_MSG_CHECKING([which thread library to use])
619     if test "$OSVERSION" -lt "500016"; then
620         PTHREAD_CFLAGS="-D_THREAD_SAFE"
621         PTHREAD_LIBS="-pthread"
622     elif test "$OSVERSION" -lt "502102"; then
623         PTHREAD_CFLAGS="-D_THREAD_SAFE"
624         PTHREAD_LIBS="-lc_r"
625     else
626         PTHREAD_CFLAGS=""
627         PTHREAD_LIBS="-pthread"
628     fi
629     AC_MSG_RESULT([$PTHREAD_LIBS])
630     _os=FreeBSD
631     ;;
633 *netbsd*)
634     test_gtk=yes
635     build_gstreamer=yes
636     build_gstreamer_0_10=yes
637     test_tde=no
638     test_kde=no
639     test_kde4=yes
640     test_freetype=yes
641     PTHREAD_LIBS="-pthread -lpthread"
642     _os=NetBSD
643     ;;
645 aix*)
646     test_randr=no
647     test_freetype=yes
648     PTHREAD_LIBS=-pthread
649     _os=AIX
650     ;;
652 openbsd*)
653     test_gtk=yes
654     test_tde=yes
655     test_kde=yes
656     test_freetype=yes
657     PTHREAD_CFLAGS="-D_THREAD_SAFE"
658     PTHREAD_LIBS="-pthread"
659     _os=OpenBSD
660     ;;
662 dragonfly*)
663     test_gtk=yes
664     build_gstreamer=yes
665     build_gstreamer_0_10=yes
666     test_tde=yes
667     test_kde=yes
668     test_kde4=yes
669     test_freetype=yes
670     PTHREAD_LIBS="-pthread"
671     _os=DragonFly
672     ;;
674 linux-android*)
675     build_gstreamer=no
676     build_gstreamer_0_10=no
677     enable_lotuswordpro=no
678     enable_mpl_subset=yes
679     enable_opengl=no
680     enable_coinmp=yes
681     enable_lpsolve=no
682     enable_report_builder=no
683     with_theme="tango"
684     test_cups=no
685     test_dbus=no
686     test_fontconfig=no
687     test_freetype=no
688     test_gtk=no
689     test_tde=no
690     test_kde=no
691     test_kde4=no
692     test_randr=no
693     test_xrender=no
694     _os=Android
696     if test -z "$with_android_ndk"; then
697         AC_MSG_ERROR([the --with-android-ndk option is mandatory])
698     fi
700     if test -z "$with_android_ndk_toolchain_version"; then
701         AC_MSG_ERROR([the --with-android-ndk-toolchain-version option is mandatory])
702     fi
704     # Verify that the NDK and SDK options are proper
705     if test ! -f "$ANDROID_NDK_HOME/platforms/android-15/arch-arm/usr/lib/libc.a"; then
706         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
707     fi
709     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
710     BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
711     ;;
714     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
715     ;;
716 esac
718 if echo "$host_os" | grep -q linux-android || test "$enable_sdremote_android" = "yes"; then
719     if test -z "$with_android_sdk"; then
720         AC_MSG_ERROR([the --with-android-sdk option is mandatory])
721     fi
723     if test ! -d "$ANDROID_SDK_HOME/platforms"; then
724         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
725     fi
728 if test "$_os" = "AIX"; then
729     AC_PATH_PROG(GAWK, gawk)
730     if test -z "$GAWK"; then
731         AC_MSG_ERROR([gawk not found in \$PATH])
732     fi
735 AC_SUBST(SDKDIRNAME)
737 AC_SUBST(WITH_MINGW)
738 AC_SUBST(PTHREAD_CFLAGS)
739 AC_SUBST(PTHREAD_LIBS)
741 ###############################################################################
742 # Extensions switches --enable/--disable
743 ###############################################################################
744 # By default these should be enabled unless having extra dependencies.
745 # If there is extra dependency over configure options then the enable should
746 # be automagic based on whether the requiring feature is enabled or not.
747 # All this options change anything only with --enable-extension-integration.
749 # The name of this option and its help string makes it sound as if
750 # extensions are built anyway, just not integrated in the installer,
751 # if you use --disable-extension-integration. Is that really the
752 # case?
754 AC_ARG_ENABLE(extension-integration,
755     AS_HELP_STRING([--disable-extension-integration],
756         [Disable integration of the built extensions in the installer of the
757          product. Use this switch to disable the integration.])
760 AC_ARG_ENABLE(export,
761     AS_HELP_STRING([--disable-export],
762         [Disable (some) code for document export. Useful when building viewer-only apps that lack
763          save/export functionality, to avoid having an excessive amount of code and data used
764          only for exporrt linked in. Work in progress, use only if you are hacking on it.])
767 AC_ARG_ENABLE(avmedia,
768     AS_HELP_STRING([--disable-avmedia],
769         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
772 AC_ARG_ENABLE(database-connectivity,
773     AS_HELP_STRING([--disable-database-connectivity],
774         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
777 # This doesn't mean not building (or "integrating") extensions
778 # (although it probably should; i.e. it should imply
779 # --disable-extension-integration I guess), it means not supporting
780 # any extension mechanism at all
781 AC_ARG_ENABLE(extensions,
782     AS_HELP_STRING([--disable-extensions],
783         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
786 AC_ARG_ENABLE(scripting,
787     AS_HELP_STRING([--disable-scripting],
788         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
791 # This is mainly for Android and iOS, but could potentially be used in some
792 # special case otherwise, too, so factored out as a separate setting
794 AC_ARG_ENABLE(dynamic-loading,
795     AS_HELP_STRING([--disable-dynamic-loading],
796         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
799 AC_ARG_ENABLE(ext-mariadb-connector,
800     AS_HELP_STRING([--enable-ext-mariadb-connector],
801         [Enable the build of the MariaDB/MySQL Connector extension.])
804 AC_ARG_ENABLE(report-builder,
805     AS_HELP_STRING([--disable-report-builder],
806         [Disable the Report Builder.])
809 AC_ARG_ENABLE(ext-wiki-publisher,
810     AS_HELP_STRING([--enable-ext-wiki-publisher],
811         [Enable the Wiki Publisher extension.])
814 AC_ARG_ENABLE(lpsolve,
815     AS_HELP_STRING([--disable-lpsolve],
816         [Disable compilation of the lp solve solver ])
818 AC_ARG_ENABLE(coinmp,
819     AS_HELP_STRING([--disable-coinmp],
820         [Disable compilation of the CoinMP solver ])
823 AC_ARG_ENABLE(pdfimport,
824     AS_HELP_STRING([--disable-pdfimport],
825         [Disable building the PDF import feature.])
828 ###############################################################################
830 dnl ---------- *** ----------
832 AC_ARG_ENABLE([hardlink-deliver],
833     AS_HELP_STRING([--enable-hardlink-deliver],
834         [Put files into deliver folder as hardlinks instead of copying them
835         over. Saves space and speeds up build.])
838 AC_ARG_ENABLE(mergelibs,
839     AS_HELP_STRING([--enable-mergelibs=<all/yes>],
840         [Enables linking of big, merged, library. Experimental feature, tested
841         only for Linux at some stage in history, but possibly does not work even
842         for Linux any more. 'all' will link a lot of libraries into libmerged
843         while 'yes' will do it for just a core set of libraries.])
846 AC_ARG_ENABLE(graphite,
847     AS_HELP_STRING([--enable-graphite],
848         [Enables the compilation of Graphite smart font rendering.])
851 AC_ARG_ENABLE(orcus,
852     AS_HELP_STRING([--enable-orcus],
853         [Enables orcus for extra file import filters for Calc.])
856 AC_ARG_ENABLE(fetch-external,
857     AS_HELP_STRING([--disable-fetch-external],
858         [Disables fetching external tarballs from web sources.])
861 AC_ARG_ENABLE(lockdown,
862     AS_HELP_STRING([--disable-lockdown],
863         [Disables the gconf integration work in LibreOffice.]),
866 AC_ARG_ENABLE(vba,
867     AS_HELP_STRING([--disable-vba],
868         [Disables the vba compatibility feature.])
871 AC_ARG_ENABLE(pch,
872     AS_HELP_STRING([--enable-pch],
873         [Enables precompiled header support for C++.])
876 AC_ARG_ENABLE(win-mozab-driver,
877     AS_HELP_STRING([--enable-win-mozab-driver],
878         [LibreOffice includes a driver to connect to Mozilla
879          address books under Windows, to build with this version, use this option.])
882 AC_ARG_ENABLE(epm,
883     AS_HELP_STRING([--enable-epm],
884         [LibreOffice includes self-packaging code, that requires epm, however epm is
885          useless for large scale package building.])
888 AC_ARG_ENABLE(odk,
889     AS_HELP_STRING([--disable-odk],
890         [LibreOffice includes an ODK, office development kit which some packagers may
891          wish to build without.])
894 AC_ARG_ENABLE(mpl-subset,
895     AS_HELP_STRING([--enable-mpl-subset],
896         [Don't compile any pieces which are not MPL or more liberally licensed])
899 AC_ARG_ENABLE(evolution2,
900     AS_HELP_STRING([--enable-evolution2],
901         [Allows the built-in evolution 2 addressbook connectivity build to be
902          enabled.])
905 AC_ARG_ENABLE(directx,
906     AS_HELP_STRING([--disable-directx],
907         [Remove DirectX implementation for the new XCanvas interface.
908          The DirectX support requires more stuff installed on Windows to
909          compile. (DirectX SDK, GDI+ libs)])
912 AC_ARG_ENABLE(activex,
913     AS_HELP_STRING([--disable-activex],
914         [Disable the use of ActiveX for a Windows build.
915         This switch is mandatory when using an Express edition of Visual Studio.])
918 AC_ARG_ENABLE(atl,
919     AS_HELP_STRING([--disable-atl],
920         [Disable the use of ATL for a Windows build.])
921     [
922         This switch is mandatory when using an Express edition of Visual Studio.
923     ],
926 AC_ARG_ENABLE(avahi,
927     AS_HELP_STRING([--enable-avahi],
928         [Determines whether to use Avahi to advertise Impress to remote controls.]),
931 AC_ARG_ENABLE(werror,
932     AS_HELP_STRING([--enable-werror],
933         [Turn warnings to errors. (Has no effect in modules where the treating
934          of warnings as errors is disabled explicitly.)]),
937 AC_ARG_ENABLE(assert-always-abort,
938     AS_HELP_STRING([--enable-assert-always-abort],
939         [make assert() abort even in release code.]),
942 AC_ARG_ENABLE(dbgutil,
943     AS_HELP_STRING([--enable-dbgutil],
944         [Provide debugging support from --enable-debug and include additional debugging
945          utilities such as object counting or more expensive checks.
946          This is the recommended option for developers.
947          Note that this makes the build ABI incompatible, it is not possible to mix object
948          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
950 AC_ARG_ENABLE(debug,
951     AS_HELP_STRING([--enable-debug],
952         [Include debugging information, disable compiler optimization and inlining plus
953          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
955 AC_ARG_ENABLE(selective-debuginfo,
956     AS_HELP_STRING([--enable-selective-debuginfo],
957         [If --enable-debug or --enable-dbgutil is used, build debugging information
958          (-g compiler flag) only for the specified gbuild build targets
959          (where all means everything, - prepended means not to enable, / appended means
960          everything in the directory; there is no ordering, more specific overrides
961          more general, and disabling takes precedence).
962          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
964 AC_ARG_ENABLE(symbols,
965     AS_HELP_STRING([--enable-symbols],
966         [Include debugging symbols in output while preserve optimization.
967          This enables -g compiler flag for GCC or equivalent,
968          without changing anything else compared to productive code.]))
970 AC_ARG_ENABLE(runtime-optimizations,
971     AS_HELP_STRING([--disable-runtime-optimizations],
972         [Statically disable certain runtime optimizations (like rtl/alloc.h or
973          JVM JIT) that are known to interact badly with certain dynamic analysis
974          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
975          CC contains "-fsanitize=address".  (For Valgrind, those runtime
976          optimizations are typcially disabled dynamically via
977          RUNNING_ON_VALGRIND.)]))
979 AC_ARG_ENABLE(compiler-plugins,
980     AS_HELP_STRING([--enable-compiler-plugins],
981         [Enable compiler plugins that will perform additional checks during
982          building. Enabled automatically by --enable-dbgutil.]))
984 AC_ARG_ENABLE(ooenv,
985     AS_HELP_STRING([--disable-ooenv],
986         [Disable ooenv for the instdir installation.]))
988 AC_ARG_ENABLE(lto,
989     AS_HELP_STRING([--enable-lto],
990         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
991          longer but libraries and executables are optimized for speed. (For GCC, best to use GCC 4.6
992          or later and 'gold' linker. Works fine (and is turned on automatically in an optimising
993          build) for MSVC, otherwise experimental work in progress that shouldn't be used unless you
994          are working on it.)]))
996 AC_ARG_ENABLE(crashdump,
997     AS_HELP_STRING([--enable-crashdump],
998         [Enable the crashdump feature.]))
1000 AC_ARG_ENABLE(python,
1001     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1002         [Enables or disables Python support at run-time and build-time.
1003          Also specifies what Python to use. 'auto' is the default.
1004          'fully-internal' even forces the internal version for uses of Python
1005          during the build (for testing purposes, mainly).]))
1007 AC_ARG_ENABLE(gtk,
1008     AS_HELP_STRING([--disable-gtk],
1009         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1010 ,enable_gtk=yes)
1012 AC_ARG_ENABLE(gtk3,
1013     AS_HELP_STRING([--enable-gtk3],
1014         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1015 ,enable_gtk3=no)
1017 AC_ARG_ENABLE(systray,
1018     AS_HELP_STRING([--disable-systray],
1019         [Determines whether to build the systray quickstarter.]),
1020 ,enable_systray=yes)
1022 AC_ARG_ENABLE(split-app-modules,
1023     AS_HELP_STRING([--enable-split-app-modules],
1024         [Split file lists for app modules, e.g. base, calc.
1025          Has effect only with make distro-pack-install]),
1028 AC_ARG_ENABLE(split-opt-features,
1029     AS_HELP_STRING([--enable-split-opt-features],
1030         [Split file lists for some optional features, .e.g. pyuno, testtool.
1031          Has effect only with make distro-pack-install]),
1034 AC_ARG_ENABLE(cairo-canvas,
1035 [  --disable-cairo-canvas  Determines whether to build the Cairo canvas on
1036                           platforms where Cairo is available.
1039 AC_ARG_ENABLE(opengl,
1040     AS_HELP_STRING([--disable-opengl],
1041         [Determines whether to build the OpenGL 3D slide transitions and canvas component.]))
1043 AC_ARG_ENABLE(opencl,
1044     AS_HELP_STRING([--disable-opencl],
1045         [Determines whether to build with OpenCL support.]))
1047 AC_ARG_ENABLE(dbus,
1048     AS_HELP_STRING([--disable-dbus],
1049         [Determines whether to enable features that depend on dbus.
1050          e.g. Presentation mode screensaver control, bluetooth presentation control]),
1051 ,enable_dbus=yes)
1053 AC_ARG_ENABLE(packagekit,
1054     AS_HELP_STRING([--enable-packagekit],
1055         [Determines whether to enable features using packagekit.
1056          Right now that is auto font install]),
1059 AC_ARG_ENABLE(sdremote,
1060     AS_HELP_STRING([--disable-sdremote],
1061         [Determines whether to enable Impress remote control (i.e. the server component).]),
1062 ,enable_sdremote=yes)
1064 AC_ARG_ENABLE(sdremote-bluetooth,
1065     AS_HELP_STRING([--disable-sdremote-bluetooth],
1066         [Determines whether to build sdremote with bluetooth support.
1067          Requires dbus on Linux.]))
1069 AC_ARG_ENABLE(sdremote-android,
1070     AS_HELP_STRING([--enable-sdremote-android],
1071         [Determines whether to build the Impress Remote Android app -- requires
1072         a correctly configured android sdk.]),
1073 ,enable_sdremote_android=no)
1075 AC_ARG_ENABLE(gconf,
1076     AS_HELP_STRING([--disable-gconf],
1077         [Determines whether to use the GConf support.]),
1078 ,enable_gconf=yes)
1080 AC_ARG_ENABLE(gnome-vfs,
1081     AS_HELP_STRING([--enable-gnome-vfs],
1082         [Determines whether to use the Gnome Virtual Filing System on platforms
1083          where that VFS is available.]),
1084 ,enable_gnome_vfs=no)
1086 AC_ARG_ENABLE(gio,
1087     AS_HELP_STRING([--disable-gio],
1088         [Determines whether to use the GIO support.]),
1089 ,enable_gio=yes)
1091 AC_ARG_ENABLE(telepathy,
1092     AS_HELP_STRING([--enable-telepathy],
1093         [Determines whether to enable Telepathy for collaboration.]),
1094 ,enable_telepathy=no)
1096 AC_ARG_ENABLE(tde,
1097     AS_HELP_STRING([--enable-tde],
1098         [Determines whether to use TQt/TDE vclplug on platforms where TQt and
1099          TDE are available.]),
1102 AC_ARG_ENABLE(tdeab,
1103     AS_HELP_STRING([--disable-tdeab],
1104         [Disable the TDE address book support.]),
1106     if test "$enable_tde" = "yes"; then
1107         enable_tdeab=yes
1108     fi
1111 AC_ARG_ENABLE(kde,
1112     AS_HELP_STRING([--enable-kde],
1113         [Determines whether to use Qt3/KDE3 vclplug on platforms where Qt3 and
1114          KDE3 are available.]),
1117 AC_ARG_ENABLE(kdeab,
1118     AS_HELP_STRING([--disable-kdeab],
1119         [Disable the KDE3 address book support.]),
1121     if test "$enable_kde" = "yes"; then
1122         enable_kdeab=yes
1123     fi
1126 AC_ARG_ENABLE(kde4,
1127     AS_HELP_STRING([--enable-kde4],
1128         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1129          KDE4 are available. May be used with --enable-kde if you want to support
1130          both KDE3 and KDE4.]),
1133 AC_ARG_ENABLE(headless,
1134     AS_HELP_STRING([--enable-headless],
1135         [Disable building of GUIs to reduce dependencies. Useful for
1136         server usage. Work in progress, use only if you are hacking on
1137         it. Not related to the --headless option.]), ,)
1139 AC_ARG_ENABLE(randr,
1140     AS_HELP_STRING([--disable-randr],
1141         [Disable RandR support in the vcl project.]),
1142 ,enable_randr=yes)
1144 AC_ARG_ENABLE(randr-link,
1145     AS_HELP_STRING([--disable-randr-link],
1146         [Disable linking with libXrandr, instead dynamically open it at runtime.]),
1147 ,enable_randr_link=yes)
1149 AC_ARG_ENABLE(gstreamer,
1150     AS_HELP_STRING([--enable-gstreamer],
1151         [Enable building with the new gstreamer 1.0 avmedia backend.]),
1152 ,enable_gstreamer=no)
1154 AC_ARG_ENABLE(gstreamer-0-10,
1155     AS_HELP_STRING([--disable-gstreamer-0-10],
1156         [Disable building the gstreamer avmedia backend.]),
1157 ,enable_gstreamer_0_10=yes)
1159 AC_ARG_ENABLE(vlc,
1160     AS_HELP_STRING([--enable-vlc],
1161         [Enable building with the VLC avmedia backend.]),
1162 ,enable_vlc=no)
1164 AC_ARG_ENABLE(neon,
1165     AS_HELP_STRING([--disable-neon],
1166         [Disable neon and the compilation of webdav binding.]),
1169 AC_ARG_ENABLE([eot],
1170     [AS_HELP_STRING([--enable-eot],
1171         [Enable support for Embedded OpenType fonts.])],
1172 , [enable_eot=no])
1174 AC_ARG_ENABLE(cve-tests,
1175     AS_HELP_STRING([--disable-cve-tests],
1176         [Prevent CVE tests to be executed]),
1179 AC_ARG_ENABLE(chart-tests,
1180     AS_HELP_STRING([--enable-chart-tests],
1181         [Executes chart XShape tests]),
1184 AC_ARG_ENABLE(build-unowinreg,
1185     AS_HELP_STRING([--enable-build-unowinreg],
1186         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1187          compiler is needed on Linux.])
1188     [
1189                           Usage:     --enable-build-unowinreg
1190     ],
1193 AC_ARG_ENABLE(verbose,
1194     AS_HELP_STRING([--enable-verbose],
1195         [Increase build verbosity.])[
1196   --disable-verbose       Decrease build verbosity.],
1199 AC_ARG_ENABLE(dependency-tracking,
1200     AS_HELP_STRING([--enable-dependency-tracking],
1201         [Do not reject slow dependency extractors.])[
1202   --disable-dependency-tracking
1203                           Disables generation of dependency information.
1204                           Speed up one-time builds.],
1207 AC_ARG_ENABLE(icecream,
1208     AS_HELP_STRING([--enable-icecream],
1209         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1210          It defaults to /opt/icecream for the location of the icecream gcc/g++
1211          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1214 AC_ARG_ENABLE(cups,
1215     AS_HELP_STRING([--disable-cups],
1216         [Do not build cups support.])
1219 AC_ARG_ENABLE(ccache,
1220     AS_HELP_STRING([--disable-ccache],
1221         [Do not try to use ccache automatically.
1222          By default, we will try to detect if ccache is available; in that case if
1223          CC/CXX are not yet set, and --enable-icecream is not given, we
1224          attempt to use ccache. --disable-ccache disables ccache completely.
1228 AC_ARG_ENABLE(64-bit,
1229     AS_HELP_STRING([--enable-64-bit],
1230         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit. Works fine for OS
1231          X. In other cases this option is experimental and possibly quite broken, use only if you are
1232          hacking on 64-bit support.]), ,)
1234 AC_ARG_ENABLE(extra-gallery,
1235     AS_HELP_STRING([--enable-extra-gallery],
1236         [Add extra gallery content.]),
1239 AC_ARG_ENABLE(extra-template,
1240     AS_HELP_STRING([--enable-extra-template],
1241         [Add extra template content.]),
1244 AC_ARG_ENABLE(extra-sample,
1245     AS_HELP_STRING([--enable-extra-sample],
1246         [Add extra sample content.]),
1249 AC_ARG_ENABLE(extra-font,
1250     AS_HELP_STRING([--enable-extra-font],
1251         [Add extra font content.]),
1254 AC_ARG_ENABLE(online-update,
1255     AS_HELP_STRING([--enable-online-update],
1256         [Enable the online update service that will check for new versions of
1257          LibreOffice. By default, it is on on Windows and Mac, and off on Linux.]),
1260 AC_ARG_ENABLE(release-build,
1261     AS_HELP_STRING([--enable-release-build],
1262         [Enable release build.
1263          See http://wiki.documentfoundation.org/DevBuild]),
1266 AC_ARG_ENABLE(windows-build-signing,
1267     AS_HELP_STRING([--enable-windows-build-signing],
1268         [Enable signing of windows binaries (*.exe, *.dll)]),
1271 AC_ARG_ENABLE(silent-msi,
1272     AS_HELP_STRING([--enable-silent-msi],
1273         [Enable MSI with LIMITUI=1 (silent install).]),
1276 AC_ARG_ENABLE(macosx-retina,
1277     AS_HELP_STRING([--enable-macosx-retina],
1278         [Declare the application as High Resolution Capable. (retina display)
1279          ]),
1282 AC_ARG_ENABLE(macosx-code-signing,
1283     AS_HELP_STRING([--enable-macosx-code-signing<=identity>],
1284         [Sign executables, dylibs, frameworks and the app bundle. If you
1285          don't provide an identity the first suitable certificate
1286          in your keychain is used.]),
1289 AC_ARG_ENABLE(macosx-sandbox,
1290     AS_HELP_STRING([--enable-macosx-sandbox],
1291         [Make the app bundle run in a sandbox. Requires code signing.
1292          Is required by apps distributed in the Mac App Store, and implies
1293          adherence to App Store rules.]),
1296 AC_ARG_ENABLE(canonical-installation-tree-structure,
1297     AS_HELP_STRING([--enable-canonical-installation-tree-structure],
1298         [Make the installation tree structure be more canonical for
1299          the platform. Implemented only for OS X. Experimental and currently broken.]),
1303 AC_ARG_WITH(macosx-bundle-identifier,
1304     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1305         [Define the OS X bundle identifier. Default is the somewhat weird
1306          org.libreoffice.script ("script", huh?).]),
1307 ,with_macosx_bundle_identifier=org.libreoffice.script)
1309 AC_ARG_ENABLE(libc++,
1310     AS_HELP_STRING([--enable-libc++],
1311         [Use the libc++ C++ library instead of GNU libstdc++ on OS X. Only effective
1312          if --with-macosx-version-min-required is 10.7 or later.]),
1315 AC_ARG_ENABLE(ios-simulator,
1316     AS_HELP_STRING([--enable-ios-simulator],
1317         [Build for the iOS Simulator, not iOS device.]),
1320 AC_ARG_ENABLE(readonly-installset,
1321     AS_HELP_STRING([--enable-readonly-installset],
1322         [Prevents any attempts by LibreOffice to write into its installation. That means
1323          at least that no "system-wide" extensions can be added. Experimental work in
1324          progress.]),
1327 AC_ARG_ENABLE(postgresql-sdbc,
1328     AS_HELP_STRING([--disable-postgresql-sdbc],
1329         [Disable the build of the PostgreSQL-SDBC driver.])
1332 AC_ARG_ENABLE(lotuswordpro,
1333     AS_HELP_STRING([--disable-lotuswordpro],
1334         [Disable the build of the Lotus Word Pro filter.]),
1335 ,enable_lotuswordpro=yes)
1337 AC_ARG_ENABLE(firebird-sdbc,
1338     AS_HELP_STRING([--disable-firebird-sdbc],
1339         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1340 ,enable_firebird_sdbc=yes)
1342 AC_ARG_ENABLE(winegcc,
1343     AS_HELP_STRING([--enable-winegcc],
1344         [Enable use of winegcc during the build, in order to create msi* tools
1345          needed for MinGW cross-compilation.]),
1348 AC_ARG_ENABLE(liblangtag,
1349     AS_HELP_STRING([--disable-liblangtag],
1350         [Disable use of liblangtag, and instead use an own simple
1351          implementation.]),
1354 AC_ARG_ENABLE(bogus-pkg-config,
1355     AS_HELP_STRING([--enable-bogus-pkg-config],
1356         [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.]),
1359 AC_ARG_ENABLE(openssl,
1360     AS_HELP_STRING([--disable-openssl],
1361         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1362          components will either use GNUTLS or NSS. Work in progress,
1363          use only if you are hacking on it.]),
1364 ,enable_openssl=yes)
1366 AC_ARG_ENABLE(library-bin-tar,
1367     AS_HELP_STRING([--enable-library-bin-tar],
1368         [Enable the building and reused of tarball of binary build for some 'external' libraries
1369         Some libraries can save their build result in a tarball
1370         stored in TARFILE_LOCATION. that binary tarball is
1371         uniquely identified by the source tarbal,
1372         the content of the config_host.mk file and the content
1373         of the top-level directory in core for that library
1374         If this option is enabled, then if such a tarfile exist, it will be untarred
1375         isntead of the source tarfile, and the build step will be skipped for that
1376         library.
1377         If a proper tarfile does not exist, then the normal source-based
1378         build is done for taht library and a proper binary tarfile is created
1379         for the next time.]),
1382 AC_ARG_ENABLE(gltf,
1383     AS_HELP_STRING([--disable-gltf],
1384         [Determines whether to build libraries related to glTF 3D model rendering.]))
1386 dnl ===================================================================
1387 dnl Optional Packages (--with/without-)
1388 dnl ===================================================================
1390 AC_ARG_WITH(gnu-patch,
1391     AS_HELP_STRING([--with-gnu-patch],
1392         [Specify location of GNU patch on Solaris or FreeBSD.]),
1395 AC_ARG_WITH(build-platform-configure-options,
1396         [Specify options for the configure script run for the *build* platform in a cross-compilation])
1398 AC_ARG_WITH(gnu-cp,
1399     AS_HELP_STRING([--with-gnu-cp],
1400         [Specify location of GNU cp on Solaris or FreeBSD.]),
1403 AC_ARG_WITH(external-tar,
1404     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1405         [Specify an absolute path of where to find (and store) tarfiles.]),
1406     TARFILE_LOCATION=$withval ,
1409 AC_ARG_WITH(referenced-git,
1410     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1411         [Specify another checkout directory to reference. This makes use of
1412                  git submodule update --reference, and saves a lot of diskspace
1413                  when having multiple trees side-by-side.]),
1414     GIT_REFERENCE_SRC=$withval ,
1417 AC_ARG_WITH(linked-git,
1418     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1419         [Specify a directory where the repositories of submodules are located.
1420          This uses a method similar to git-new-workdir to get submodules.]),
1421     GIT_LINK_SRC=$withval ,
1424 AC_ARG_WITH(galleries,
1425     AS_HELP_STRING([--with-galleries],
1426         [Specify how galleries should be built. It is possible either to
1427          build these internally from source ("build"),
1428          or to disable them ("no")]),
1431 AC_ARG_WITH(theme,
1432     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1433         [Choose which themes to include. By default those themes with an '*' are included.
1434          Possible choices: *crystal, *default (galaxy), *hicontrast, human, industrial, *oxygen, *sifr, *tango, *tango_testing.]),
1437 AC_ARG_WITH(helppack-integration,
1439   --without-helppack-integration      It will not integrate the helppacks to the installer
1440                           of the product.
1441                           Please use this switch to use the online help or separate help packages.],
1444 AC_ARG_WITH(fonts,
1445     AS_HELP_STRING([--without-fonts],
1446         [LibreOffice includes some third-party fonts to provide a reliable basis for
1447          help content, templates, samples, etc. When these fonts are already
1448          known to be available on the system then you should use this option.]),
1451 AC_ARG_WITH(ppds,
1452     AS_HELP_STRING([--without-ppds],
1453         [Removes Postscript Printer definition files from LibreOffice
1454          installation set, for people building for specific distributions where
1455          PPDs are known to be already available (every recent distro with CUPS backend).]),
1458 AC_ARG_WITH(epm,
1459     AS_HELP_STRING([--with-epm],
1460         [Decides which epm to use. Default is to use the one from the system if
1461          one is built. When either this is not there or you say =internal epm
1462          will be built.]),
1465 AC_ARG_WITH(package-format,
1466     AS_HELP_STRING([--with-package-format],
1467         [Specify package format(s) for LibreOffice installation sets. The
1468          implicit --without-package-format leads to no installation sets being
1469          generated. Possible values: aix, archive, bsd, deb, dmg,
1470          installed, msi, native, osx, pkg, portable, and rpm.
1471          Example: --with-package-format='deb rpm']),
1474 AC_ARG_WITH(tls,
1475     AS_HELP_STRING([--with-tls],
1476         [Decides which TLS/SSL and cryptographic implementations to use for
1477          LibreOffice's code. Notice that this doesn't apply for depending
1478          libraries like "neon", for example. Default is to use OpenSSL
1479          although NSS is also possible. Notice that selecting NSS restricts
1480          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1481          restrict by now the usage of NSS in LO's code. Possible values:
1482          openssl, nss. Example: --with-tls="nss"]),
1485 AC_ARG_WITH(system-libs,
1486     AS_HELP_STRING([--with-system-libs],
1487         [Use libraries already on system -- enables all --with-system-* flags.]),
1490 AC_ARG_WITH(system-headers,
1491     AS_HELP_STRING([--with-system-headers],
1492         [Use headers already on system -- enables all --with-system-* flags for
1493          external packages whose headers are the only entities used i.e.
1494          boost/vigra/odbc/sane-header(s).]),,
1495     [with_system_headers="$with_system_libs"])
1497 AC_ARG_WITH(system-jars,
1498     AS_HELP_STRING([--without-system-jars],
1499         [When building with --with-system-libs, also the needed jars are expected
1500          on the system. Use this to disable that]),,
1501     [with_system_jars="$with_system_libs"])
1503 AC_ARG_WITH(system-cairo,
1504     AS_HELP_STRING([--with-system-cairo],
1505         [Use cairo libraries already on system.  Happens automatically for
1506          (implicit) --enable-gtk and for --enable-gtk3.]))
1508 AC_ARG_WITH(myspell-dicts,
1509     AS_HELP_STRING([--with-myspell-dicts],
1510         [Adds myspell dictionaries to the LibreOffice installation set]),
1513 AC_ARG_WITH(system-dicts,
1514     AS_HELP_STRING([--without-system-dicts],
1515         [Do not use dictionaries from system paths.]),
1518 AC_ARG_WITH(external-dict-dir,
1519     AS_HELP_STRING([--with-external-dict-dir],
1520         [Specify external dictionary dir.]),
1523 AC_ARG_WITH(external-hyph-dir,
1524     AS_HELP_STRING([--with-external-hyph-dir],
1525         [Specify external hyphenation pattern dir.]),
1528 AC_ARG_WITH(external-thes-dir,
1529     AS_HELP_STRING([--with-external-thes-dir],
1530         [Specify external thesaurus dir.]),
1533 AC_ARG_WITH(system-zlib,
1534     AS_HELP_STRING([--with-system-zlib],
1535         [Use zlib already on system.]),,
1536     [with_system_zlib=auto])
1538 AC_ARG_WITH(system-jpeg,
1539     AS_HELP_STRING([--with-system-jpeg],
1540         [Use jpeg already on system.]),,
1541     [with_system_jpeg=auto])
1543 AC_ARG_WITH(system-clucene,
1544     AS_HELP_STRING([--with-system-clucene],
1545         [Use clucene already on system.]),,
1546     [with_system_clucene="$with_system_libs"])
1548 AC_ARG_WITH(system-expat,
1549     AS_HELP_STRING([--with-system-expat],
1550         [Use expat already on system.]),,
1551     [with_system_expat="$with_system_libs"])
1553 AC_ARG_WITH(system-libxml,
1554     AS_HELP_STRING([--with-system-libxml],
1555         [Use libxml/libxslt already on system.]),,
1556     [with_system_libxml=auto])
1558 AC_ARG_WITH(system-icu,
1559     AS_HELP_STRING([--with-system-icu],
1560         [Use icu already on system.]),,
1561     [with_system_icu="$with_system_libs"])
1563 AC_ARG_WITH(system-ucpp,
1564     AS_HELP_STRING([--with-system-ucpp],
1565         [Use ucpp already on system.]),,
1566     [])
1568 AC_ARG_WITH(system-openldap,
1569     AS_HELP_STRING([--with-system-openldap],
1570         [Use the OpenLDAP LDAP SDK already on system.]),,
1571     [with_system_openldap="$with_system_libs"])
1573 AC_ARG_WITH(system-poppler,
1574     AS_HELP_STRING([--with-system-poppler],
1575         [Use system poppler (only needed for PDF import).]),,
1576     [with_system_poppler="$with_system_libs"])
1578 AC_ARG_WITH(system-apache-commons,
1579     AS_HELP_STRING([--with-system-apache-commons],
1580         [Use Apache commons libraries already on system.]),,
1581     [with_system_apache_commons="$with_system_jars"])
1583 AC_ARG_WITH(system-mariadb,
1584     AS_HELP_STRING([--with-system-mariadb],
1585         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1586          extension.]),,
1587     [with_system_mariadb="$with_system_libs"])
1589 AC_ARG_ENABLE(bundle-mariadb,
1590     AS_HELP_STRING([--enable-bundle-mariadb],
1591         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1594 AC_ARG_WITH(system-mysql-cppconn,
1595     AS_HELP_STRING([--with-system-mysql-cppconn],
1596         [Use MySQL C++ Connector libraries already on system.]),,
1597     [with_system_mysql_cppconn="$with_system_libs"])
1599 AC_ARG_WITH(system-postgresql,
1600     AS_HELP_STRING([--with-system-postgresql],
1601         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1602          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1603     [with_system_postgresql="$with_system_libs"])
1605 AC_ARG_WITH(libpq-path,
1606     AS_HELP_STRING([--with-libpq-path],
1607         [Use this PostgreSQL C interface (libpq) installation for building
1608          the PostgreSQL-SDBC extension.])
1609     [
1610                           Usage:     --with-libpq-path=<absolute path to
1611                                                   your libpq installation>
1612     ],
1615 AC_ARG_WITH(system-firebird,
1616     AS_HELP_STRING([--with-system-firebird],
1617         [Use Firebird libraries already on system, for building the Firebird-SDBC
1618          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1619     [with_system_firebird="$with_system_libs"])
1621 AC_ARG_WITH(system-hsqldb,
1622     AS_HELP_STRING([--with-system-hsqldb],
1623         [Use hsqldb already on system.]))
1625 AC_ARG_WITH(hsqldb-jar,
1626     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1627         [Specify path to jarfile manually.]),
1628     HSQLDB_JAR=$withval)
1630 AC_ARG_ENABLE(scripting-beanshell,
1631     AS_HELP_STRING([--disable-scripting-beanshell],
1632         [Disable support for scripts in BeanShell.]),
1636 AC_ARG_WITH(system-beanshell,
1637     AS_HELP_STRING([--with-system-beanshell],
1638         [Use beanshell already on system.]),,
1639     [with_system_beanshell="$with_system_jars"])
1641 AC_ARG_WITH(beanshell-jar,
1642     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1643         [Specify path to jarfile manually.]),
1644     BSH_JAR=$withval)
1646 AC_ARG_ENABLE(scripting-javascript,
1647     AS_HELP_STRING([--disable-scripting-javascript],
1648         [Disable support for scripts in JavaScript.]),
1652 AC_ARG_WITH(system-rhino,
1653     AS_HELP_STRING([--with-system-rhino],
1654         [Use rhino already on system.]),,)
1655 #    [with_system_rhino="$with_system_jars"])
1656 # Above is not used as we have different debug interface
1657 # patched into internal rhino. This code needs to be fixed
1658 # before we can enable it by default.
1660 AC_ARG_WITH(rhino-jar,
1661     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1662         [Specify path to jarfile manually.]),
1663     RHINO_JAR=$withval)
1665 AC_ARG_WITH(commons-codec-jar,
1666     AS_HELP_STRING([--with-commons-codec-jar=JARFILE],
1667         [Specify path to jarfile manually.]),
1668     COMMONS_CODEC_JAR=$withval)
1670 AC_ARG_WITH(commons-lang-jar,
1671     AS_HELP_STRING([--with-commons-lang-jar=JARFILE],
1672         [Specify path to jarfile manually.]),
1673     COMMONS_LANG_JAR=$withval)
1675 AC_ARG_WITH(commons-httpclient-jar,
1676     AS_HELP_STRING([--with-commons-httpclient-jar=JARFILE],
1677         [Specify path to jarfile manually.]),
1678     COMMONS_HTTPCLIENT_JAR=$withval)
1680 AC_ARG_WITH(commons-logging-jar,
1681     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1682         [Specify path to jarfile manually.]),
1683     COMMONS_LOGGING_JAR=$withval)
1685 AC_ARG_WITH(system-jfreereport,
1686     AS_HELP_STRING([--with-system-jfreereport],
1687         [Use JFreeReport already on system.]),,
1688     [with_system_jfreereport="$with_system_jars"])
1690 AC_ARG_WITH(sac-jar,
1691     AS_HELP_STRING([--with-sac-jar=JARFILE],
1692         [Specify path to jarfile manually.]),
1693     SAC_JAR=$withval)
1695 AC_ARG_WITH(libxml-jar,
1696     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1697         [Specify path to jarfile manually.]),
1698     LIBXML_JAR=$withval)
1700 AC_ARG_WITH(flute-jar,
1701     AS_HELP_STRING([--with-flute-jar=JARFILE],
1702         [Specify path to jarfile manually.]),
1703     FLUTE_JAR=$withval)
1705 AC_ARG_WITH(jfreereport-jar,
1706     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1707         [Specify path to jarfile manually.]),
1708     JFREEREPORT_JAR=$withval)
1710 AC_ARG_WITH(liblayout-jar,
1711     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1712         [Specify path to jarfile manually.]),
1713     LIBLAYOUT_JAR=$withval)
1715 AC_ARG_WITH(libloader-jar,
1716     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1717         [Specify path to jarfile manually.]),
1718     LIBLOADER_JAR=$withval)
1720 AC_ARG_WITH(libloader-jar,
1721     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1722         [Specify path to jarfile manually.]),
1723     LIBLOADER_JAR=$withval)
1725 AC_ARG_WITH(libformula-jar,
1726     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1727         [Specify path to jarfile manually.]),
1728     LIBFORMULA_JAR=$withval)
1730 AC_ARG_WITH(librepository-jar,
1731     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1732         [Specify path to jarfile manually.]),
1733     LIBREPOSITORY_JAR=$withval)
1735 AC_ARG_WITH(libfonts-jar,
1736     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1737         [Specify path to jarfile manually.]),
1738     LIBFONTS_JAR=$withval)
1740 AC_ARG_WITH(libserializer-jar,
1741     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1742         [Specify path to jarfile manually.]),
1743     LIBSERIALIZER_JAR=$withval)
1745 AC_ARG_WITH(libbase-jar,
1746     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1747         [Specify path to jarfile manually.]),
1748     LIBBASE_JAR=$withval)
1750 AC_ARG_WITH(system-odbc,
1751     AS_HELP_STRING([--with-system-odbc],
1752         [Use the odbc headers already on system.]),,
1753     [with_system_odbc="$with_system_headers"])
1755 AC_ARG_WITH(system-sane,
1756     AS_HELP_STRING([--with-system-sane],
1757         [Use sane.h already on system.]),,
1758     [with_system_sane="$with_system_headers"])
1760 AC_ARG_WITH(system-bluez,
1761     AS_HELP_STRING([--with-system-bluez],
1762         [Use bluetooth.h already on system.]),,
1763     [with_system_bluez="$with_system_headers"])
1765 AC_ARG_WITH(system-mesa-headers,
1766     AS_HELP_STRING([--with-system-mesa-headers],
1767         [Use Mesa headers already on system.]),,
1768     [with_system_mesa_headers="$with_system_headers"])
1770 AC_ARG_WITH(system-curl,
1771     AS_HELP_STRING([--with-system-curl],
1772         [Use curl already on system.]),,
1773     [with_system_curl=auto])
1775 AC_ARG_WITH(system-boost,
1776     AS_HELP_STRING([--with-system-boost],
1777         [Use boost already on system.]),,
1778     [with_system_boost="$with_system_headers"])
1780 AC_ARG_WITH(system-glm,
1781     AS_HELP_STRING([--with-system-glm],
1782         [Use glm already on system.]),,
1783     [with_system_glm="$with_system_headers"])
1785 AC_ARG_WITH(system-vigra,
1786     AS_HELP_STRING([--with-system-vigra],
1787         [Use vigra already on system.]),,
1788     [with_system_vigra="$with_system_headers"])
1790 AC_ARG_WITH(system-hunspell,
1791     AS_HELP_STRING([--with-system-hunspell],
1792         [Use libhunspell already on system.]),,
1793     [with_system_hunspell="$with_system_libs"])
1795 AC_ARG_WITH(system-mythes,
1796     AS_HELP_STRING([--with-system-mythes],
1797         [Use mythes already on system.]),,
1798     [with_system_mythes="$with_system_libs"])
1800 AC_ARG_WITH(system-altlinuxhyph,
1801     AS_HELP_STRING([--with-system-altlinuxhyph],
1802         [Use ALTLinuxhyph already on system.]),,
1803     [with_system_altlinuxhyph="$with_system_libs"])
1805 AC_ARG_WITH(system-lpsolve,
1806     AS_HELP_STRING([--with-system-lpsolve],
1807         [Use lpsolve already on system.]),,
1808     [with_system_lpsolve="$with_system_libs"])
1810 AC_ARG_WITH(system-liblangtag,
1811     AS_HELP_STRING([--with-system-liblangtag],
1812         [Use liblangtag library already on system.]),,
1813     [with_system_liblangtag="$with_system_libs"])
1815 AC_ARG_WITH(system-npapi-headers,
1816     AS_HELP_STRING([--with-system-npapi-headers],
1817         [Use NPAPI headers provided by system instead of bundled ones. Used in
1818          extensions/source/nsplugin (ENABLE_NPAPI_INTO_BROWSER=TRUE) and
1819          extensions/source/plugin (ENABLE_NPAPI_FROM_BROWSER=TRUE)]),,
1820     [with_system_npapi_headers="$with_system_headers"]
1823 AC_ARG_WITH(webdav,
1824     AS_HELP_STRING([--with-webdav],
1825         [Specify which library to use for webdav implementation.
1826          Possible values: "neon", "serf", "no". The default value is "neon".
1827          Example: --with-webdav="serf"]),
1828     WITH_WEBDAV=$withval,
1829     WITH_WEBDAV="neon")
1831 AC_ARG_WITH(linker-hash-style,
1832     AS_HELP_STRING([--with-linker-hash-style],
1833         [Use linker with --hash-style=<style> when linking shared objects.
1834          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1835          if supported on the build system, and "sysv" otherwise.]))
1837 AC_ARG_WITH(jdk-home,
1838     AS_HELP_STRING([--with-jdk-home],
1839         [If you have installed JDK 1.3 or later on your system please supply the
1840          path here. Note that this is not the location of the java command but the
1841          location of the entire distribution.])
1842     [
1843                           Usage:     --with-jdk-home=<absolute path to JDK home>
1844     ],
1847 AC_ARG_WITH(help,
1848     AS_HELP_STRING([--with-help],
1849         [Enable the build of help. There is a special parameter "common" that
1850          can be used to bundle only the common part, .e.g help-specific icons.
1851          This is useful when you build the helpcontent separately.])
1852     [
1853                           Usage:     --with-help    build the entire local help
1854                                  --without-help     no local help (default)
1855                                  --with-help=common bundle common files for the local
1856                                                     help but do not build the whole help
1857     ],
1860 AC_ARG_WITH(java,
1861     AS_HELP_STRING([--with-java],
1862         [Specify the name of the Java interpreter command. Typically "java"
1863          which is the default.
1865          To build without support for Java components, applets, accessibility
1866          or the XML filters written in Java, use --without-java or --with-java=no.])
1867     [
1868                           Usage:     --with-java==<java command>
1869                                      --without-java
1870     ],
1871     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1872     [ with_java=java ]
1875 AC_ARG_WITH(jvm-path,
1876     AS_HELP_STRING([--with-jvm-path],
1877         [Use a specific JVM search path at runtime.])
1878     [
1879                           Usage:     --with-jvm-path=<absolute path to parent of jvm home>
1881                           e. g.: --with-jvm-path=/usr/lib/
1882                                  to find JRE/JDK in /usr/lib/jvm/
1883     ],
1886 AC_ARG_WITH(ant-home,
1887     AS_HELP_STRING([--with-ant-home],
1888         [If you have installed Jakarta Ant on your system, please supply the path here.
1889          Note that this is not the location of the Ant binary but the location
1890          of the entire distribution.])
1891     [
1892                           Usage:     --with-ant-home=<absolute path to Ant home>
1893     ],
1896 AC_ARG_WITH(export-validation,
1897     AS_HELP_STRING([--with-export-validation],
1898         [If you want the exported files to be validated. Right now limited to OOXML files in calc export tests.
1899          Note: You need an executable script officeotron that takes the path to the file.])
1900     [
1901                             Usage: --with-export-validation
1902     ],
1905 AC_ARG_WITH(junit,
1906     AS_HELP_STRING([--with-junit],
1907         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
1908          --without-junit disables those tests. Not relevant in the --without-java case.])
1909     [
1910                           Usage:     --with-junit=<absolute path to JUnit 4 jar>
1911     ],
1912 ,with_junit=yes)
1914 AC_ARG_WITH(perl-home,
1915     AS_HELP_STRING([--with-perl-home],
1916         [If you have installed Perl 5 Distribution, on your system, please
1917          supply the path here. Note that this is not the location of the Perl
1918          binary but the location of the entire distribution.])
1919     [
1920                           Usage:     --with-perl-home=<abs. path to Perl 5 home>
1921     ],
1924 AC_ARG_WITH(
1925     [doxygen],
1926     AS_HELP_STRING(
1927         [--with-doxygen],
1928         [Specifies the doxygen executable to use when generating ODK C/C++
1929          documentation. --without-doxygen disables generation of ODK C/C++
1930          documentation. Not relevant in the --disable-odk case.])
1931     [
1932                           Usage:     --with-doxygen=<absolute path to doxygen executable>
1933     ],,
1934     [with_doxygen=yes])
1936 AC_ARG_WITH(visual-studio,
1937     AS_HELP_STRING([--with-visual-studio=<2012/2010/2013>],
1938         [Specify which Visual Studio version to use in case several are
1939          are installed. If not specified, the order of preference is
1940          2012, 2010, 2013 (including Express editions).])
1941     [
1942                           Usage:     --with-visual-studio=<2012/2010/2013>
1943     ],
1946 AC_ARG_WITH(windows-sdk,
1947     AS_HELP_STRING([--with-windows-sdk=<6.0(A)/7.0(A)/7.1(A)/8.0(A)>],
1948         [Specify which Windows SDK, or "Windows Kit", version to use
1949          in case the one that came with the selected Visual Studio
1950          is not what you want for some reason. Note that not all compiler/SDK
1951          combinations are supported. The intent is that this option should not
1952          be needed.])
1953     [
1954                           Usage:     --with-windows-sdk=6.0(A)/7.0(A)/7.1(A)/8.0(A)>
1955     ],
1958 AC_ARG_WITH(lang,
1959     AS_HELP_STRING([--with-lang],
1960         [Use this option to build LibreOffice with additional UI language support.
1961          English (US) is always included by default.
1962          Separate multiple languages with space.
1963          For all languages, use --with-lang=ALL.])
1964     [
1965                           Usage:     --with-lang="es sw tu cs sk"
1966     ],
1969 AC_ARG_WITH(locales,
1970     AS_HELP_STRING([--with-locales],
1971         [Use this option to limit the locale information built in.
1972          Separate multiple locales with space.
1973          Very experimental and might well break stuff.
1974          Just a desperate measure to shrink code and data size.
1975          By default all the locales available is included.
1976          This option is completely unrelated to --with-lang.])
1977     [
1978                           Affects also our character encoding conversion
1979                           tables for encodings mainly targeted for a
1980                           particular locale, like EUC-CN and EUC-TW for
1981                           zh, ISO-2022-JP for ja.
1983                           Affects also our add-on break iterator data for
1984                           some languages.
1986                           For the default, all locales, don't use this switch at all.
1987                           Specifying just the language part of a locale means all matching
1988                           locales will be included.
1990                           Usage:     --with-locales="en es pt fr zh kr ja"
1991     ],
1994 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
1995 AC_ARG_WITH(krb5,
1996     AS_HELP_STRING([--with-krb5],
1997         [Enable MIT Kerberos 5 support in modules that support it.
1998          By default automatically enabled on platforms
1999          where a good system Kerberos 5 is available.]),
2002 AC_ARG_WITH(gssapi,
2003     AS_HELP_STRING([--with-gssapi],
2004         [Enable GSSAPI support in modules that support it.
2005          By default automatically enabled on platforms
2006          where a good system GSSAPI is available.]),
2009 dnl ===================================================================
2010 dnl Branding
2011 dnl ===================================================================
2013 AC_ARG_WITH(branding,
2014     AS_HELP_STRING([--with-branding],
2015         [Use given path to retrieve branding images set.])
2016     [
2017                           Search for intro.png about.svg and flat_logo.svg.
2018                           If any is missing, default ones will be used instead.
2020                           Search also progress.conf for progress
2021                           settings on intro screen :
2023                           PROGRESSBARCOLOR="255,255,255" Set color of
2024                           progress bar. Comma separated RGB decimal values.
2025                           PROGRESSSIZE="407,6" Set size of progress bar.
2026                           Comma separated decimal values (width, height).
2027                           PROGRESSPOSITION="61,317" Set position of progress
2028                           bar from left,top. Comma separated decimal values.
2029                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2030                           bar frame. Comma separated RGB decimal values.
2031                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2032                           bar text. Comma separated RGB decimal values.
2033                           PROGRESSTEXTBASELINE="287" Set vertical position of
2034                           progress bar text from top. Decimal value.
2036                           Default values will be used if not found.
2038                           Usage:     --with-branding=/path/to/images
2039     ],
2043 AC_ARG_WITH(extra-buildid,
2044     AS_HELP_STRING([--with-extra-buildid],
2045         [Show addition build identification in about dialog.])
2046     [
2047                           Usage:     --with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"
2048     ],
2052 AC_ARG_WITH(vendor,
2053     AS_HELP_STRING([--with-vendor],
2054         [Set vendor of the build.])
2055     [
2056                           Usage:     --with-vendor="John the Builder"
2057     ],
2060 AC_ARG_WITH(compat-oowrappers,
2061     AS_HELP_STRING([--with-compat-oowrappers],
2062         [Install oo* wrappers in parallel with
2063          lo* ones to keep backward compatibility.
2064          Has effect only with make distro-pack-install]),
2067 AC_ARG_WITH(os-version,
2068     AS_HELP_STRING([--with-os-version],
2069         [For FreeBSD users, use this option option to override the detected OSVERSION.])
2070     [
2071                           Usage:     --with-os-version=<OSVERSION>
2072     ],
2075 AC_ARG_WITH(mingw-cross-compiler,
2076     AS_HELP_STRING([--with-mingw-cross-compiler],
2077         [Specify the MinGW cross-compiler to use.])
2078     [
2079                           Usage:     --with-mingw-cross-compiler=<mingw32-g++ command>
2081                           When building on the ODK on Unix and building unowinreg.dll,
2082                           specify the MinGW C++ cross-compiler.
2083     ],
2086 AC_ARG_WITH(idlc-cpp,
2087     AS_HELP_STRING([--with-idlc-cpp],
2088         [Specify the C Preprocessor to use for idlc.])
2089     [
2090                           Usage:     --with-idlc-cpp=cpp
2092                           Default is ucpp.
2093     ]
2096 AC_ARG_WITH(build-version,
2097     AS_HELP_STRING([--with-build-version],
2098         [Allows the builder to add a custom version tag that will appear in the
2099          Help/About box for QA purposes.])
2100     [
2101                           Usage:     --with-build-version="Built by Jim"
2102     ],
2103     with_build_version=$withval ,
2106 AC_ARG_WITH(alloc,
2107     AS_HELP_STRING([--with-alloc],
2108         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
2109          Note that on FreeBSD/NetBSD system==jemalloc]),
2112 AC_ARG_WITH(sun-templates,
2113     AS_HELP_STRING([--with-sun-templates],
2114         [Integrate Sun template packages.]),
2117 AC_ARG_WITH(parallelism,
2118     AS_HELP_STRING([--with-parallelism],
2119         [Number of jobs to run simultaneously during build. Parallel builds can
2120         save a lot of time on multi-cpu machines. Defaults to the number of
2121         CPUs on the machine, unless you configure --enable-icecream - then to
2122         10.]),
2125 AC_ARG_WITH(all-tarballs,
2126     AS_HELP_STRING([--with-all-tarballs],
2127         [Download all external tarballs unconditionally]))
2129 AC_ARG_WITH(gdrive-client-id,
2130     AS_HELP_STRING([--with-gdrive-client-id],
2131         [Provides the client id of the application for OAuth2 authentication
2132         on Google Drive. If either this or --with-gdrive-client-secret is
2133         empty, the feature will be disabled]),
2136 AC_ARG_WITH(gdrive-client-secret,
2137     AS_HELP_STRING([--with-gdrive-client-secret],
2138         [Provides the client secret of the application for OAuth2
2139         authentication on Google Drive. If either this or
2140         --with-gdrive-client-id is empty, the feature will be disabled]),
2143 AC_ARG_WITH(alfresco-cloud-client-id,
2144     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2145         [Provides the client id of the application for OAuth2 authentication
2146         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2147         empty, the feature will be disabled]),
2150 AC_ARG_WITH(alfresco-cloud-client-secret,
2151     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2152         [Provides the client secret of the application for OAuth2
2153         authentication on Alfresco Cloud. If either this or
2154         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2157 dnl ===================================================================
2158 dnl Do we want to use pre-build binary tarball for recompile
2159 dnl ===================================================================
2161 if test "$enable_library_bin_tar" = "yes" ; then
2162    USE_LIBRARY_BIN_TAR=TRUE
2163 else
2164    USE_LIBRARY_BIN_TAR=
2166 AC_SUBST(USE_LIBRARY_BIN_TAR)
2168 dnl ===================================================================
2169 dnl Test whether build target is Release Build
2170 dnl ===================================================================
2171 AC_MSG_CHECKING([whether build target is Release Build])
2172 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2173     AC_MSG_RESULT([no])
2174     ENABLE_RELEASE_BUILD=
2175 else
2176     AC_MSG_RESULT([yes])
2177     ENABLE_RELEASE_BUILD=TRUE
2179 AC_SUBST(ENABLE_RELEASE_BUILD)
2181 dnl ===================================================================
2182 dnl Test whether to sign Windows Build
2183 dnl ===================================================================
2184 AC_MSG_CHECKING([whether to sign windows build])
2185 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT" -a "$WITH_MINGW" != "YES" ; then
2186     AC_MSG_RESULT([yes])
2187     WINDOWS_BUILD_SIGNING="TRUE"
2188 else
2189     AC_MSG_RESULT([no])
2190     WINDOWS_BUILD_SIGNING="FALSE"
2192 AC_SUBST(WINDOWS_BUILD_SIGNING)
2194 dnl ===================================================================
2195 dnl MacOSX build and runtime environment options
2196 dnl ===================================================================
2198 AC_ARG_WITH(macosx-sdk,
2199     AS_HELP_STRING([--with-macosx-sdk],
2200         [Use a specific SDK for building.])
2201     [
2202                           Usage:     --with-macosx-sdk=<version>
2204                           e. g.: --with-macosx-sdk=10.6
2206                           there are 3 options to control the MacOSX build:
2207                           --with-macosx-sdk (refered as 'sdk' below)
2208                           --with-macosx-version-min-required (refered as 'min' below)
2209                           --with-macosx-version-max-allowed (refered as 'max' below)
2211                           the connection between these value and the default they take is as follow:
2212                           ( ? means not specified on the command line, s means the SDK version found,
2213                           constraint: x <= y <= z)
2215                           ==========================================
2216                            command line      || config result
2217                           ==========================================
2218                           min  | max  | sdk  || min  | max  | sdk  |
2219                           ?    | ?    | ?    || 10.6 | 10.s | 10.s |
2220                           ?    | ?    | 10.x || 10.6 | 10.x | 10.x |
2221                           ?    | 10.x | ?    || 10.6 | 10.s | 10.s |
2222                           ?    | 10.x | 10.y || 10.6 | 10.x | 10.y |
2223                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2224                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2225                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2226                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2229                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2230                           for a detailled technical explanation of these variables
2232                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2234                           Note that even if in theory using a --with-macosx-version-max-allowed
2235                           (i.e. the MAC_OS_X_VERSION_MAX_ALLOWED macro) less than the SDK version
2236                           should work, in practice Apple doesn't seem to test that, and at least
2237                           compiling with -DMAC_OS_X_VERSION_MAX_ALLOWED=1060 against the 10.7 SDK
2238                           fails in a couple of places. Just because of oversights in ifdefs in the SDK
2239                           headers, but still.
2240     ],
2243 AC_ARG_WITH(macosx-version-min-required,
2244     AS_HELP_STRING([--with-macosx-version-min-required],
2245         [set the minimum OS version needed to run the built LibreOffice])
2246     [
2247                           Usage:     --with-macosx-version-min-required=<version>
2249                           e. g.: --with-macos-version-min-required=10.6
2250                           see --with-macosx-sdk for more info
2251     ],
2254 AC_ARG_WITH(macosx-version-max-allowed,
2255     AS_HELP_STRING([--with-macosx-version-max-allowed],
2256         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2257     [
2258                           Usage:     --with-macosx-version-max-allowed=<version>
2260                           e. g.: --with-macos-version-max-allowed=10.6
2261                           see --with-macosx-sdk for more info
2262     ],
2266 dnl ===================================================================
2267 dnl options for stuff used during cross-compilation build
2268 dnl These are superseded by --with-build-platform-configure-options.
2269 dnl Or are they? Look for the complicated tests for "$cross_compiling" = "yes" -a \(
2270 dnl "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \)
2271 dnl far below. Could whoever understands MinGW cross-compilation clean up this please.
2272 dnl ===================================================================
2274 AC_ARG_WITH(system-boost-for-build,
2275     AS_HELP_STRING([--with-system-boost-for-build],
2276         [Use boost already on system for build tools (cross-compilation only).]))
2278 AC_ARG_WITH(system-cppunit-for-build,
2279     AS_HELP_STRING([--with-system-cppunit-for-build],
2280         [Use cppunit already on system for build tools (cross-compilation only).]))
2282 AC_ARG_WITH(system-expat-for-build,
2283     AS_HELP_STRING([--with-system-expat-for-build],
2284         [Use expat already on system for build tools (cross-compilation only).]))
2286 AC_ARG_WITH(system-icu-for-build,
2287     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2288         [Use icu already on system for build tools (cross-compilation only).]))
2290 AC_ARG_WITH(system-libxml-for-build,
2291     AS_HELP_STRING([--with-system-libxml-for-build],
2292         [Use libxml/libxslt already on system for build tools (cross-compilation only).]))
2295 dnl ===================================================================
2296 dnl check for required programs (grep, awk, sed, bash)
2297 dnl ===================================================================
2299 pathmunge ()
2301     if test -n "$1"; then
2302         if test "$build_os" = "cygwin"; then
2303             PathFormat "$1"
2304             new_path=`cygpath -u "$formatted_path"`
2305         else
2306             new_path="$1"
2307         fi
2308         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2309             if test "$2" = "after"; then
2310                 LO_PATH="$LO_PATH:$new_path"
2311             else
2312                 LO_PATH="$new_path:$LO_PATH"
2313             fi
2314         fi
2315         unset new_path
2316     fi
2319 AC_PROG_AWK
2320 AC_PATH_PROG( AWK, $AWK)
2321 if test -z "$AWK"; then
2322     AC_MSG_ERROR([install awk to run this script])
2325 AC_PATH_PROG(BASH, bash)
2326 if test -z "$BASH"; then
2327     AC_MSG_ERROR([bash not found in \$PATH])
2329 AC_SUBST(BASH)
2331 AC_MSG_CHECKING([for GNU or BSD tar])
2332 for a in $GNUTAR gtar gnutar tar /usr/sfw/bin/gtar; do
2333     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2334     if test $? -eq 0;  then
2335         GNUTAR=$a
2336         break
2337     fi
2338 done
2339 AC_MSG_RESULT($GNUTAR)
2340 if test -z "$GNUTAR"; then
2341     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2343 AC_SUBST(GNUTAR)
2345 AC_MSG_CHECKING([for tar's option to strip components])
2346 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2347 if test $? -eq 0; then
2348     STRIP_COMPONENTS="--strip-components"
2349 else
2350     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2351     if test $? -eq 0; then
2352         STRIP_COMPONENTS="--strip-path"
2353     else
2354         STRIP_COMPONENTS="unsupported"
2355     fi
2357 AC_MSG_RESULT($STRIP_COMPONENTS)
2358 if test x$STRIP_COMPONENTS = xunsupported; then
2359     AC_MSG_ERROR([you need a tar that is able to strip components.])
2361 AC_SUBST(STRIP_COMPONENTS)
2363 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2364 dnl desktop OSes from "mobile" ones.
2366 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2367 dnl In other words, that when building for an OS that is not a
2368 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2370 dnl Note the direction of the implication; there is no assumption that
2371 dnl cross-compiling would imply a non-desktop OS.
2373 if test $_os != iOS -a $_os != Android; then
2374     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2375     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2376     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2379 DISABLE_EXPORT=''
2380 if test "$enable_export" != no; then
2381     BUILD_TYPE="$BUILD_TYPE EXPORT"
2382 else
2383     DISABLE_EXPORT='TRUE'
2384     SCPDEFS="$SCPDES -DDISABLE_EXPORT"
2386 AC_SUBST(DISABLE_EXPORT)
2388 # Whether to build "avmedia" functionality or not.
2389 # We probably don't want it for non-desktop.
2391 if test -z "$enable_avmedia"; then
2392     if test $_os != iOS -a $_os != Android; then
2393         enable_avmedia=yes
2394     fi
2397 if test "$enable_avmedia" = yes; then
2398     BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2399     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2400 else
2401     SCPDEFS="$SCPDEFS -DDISABLE_AVMEDIA"
2404 # Decide whether to build database connectivity stuff (including
2405 # Base) or not. We probably don't want to on non-desktop OSes.
2407 if test -z "$enable_database_connectivity"; then
2408     # --disable-database-connectivity is unfinished work in progress
2409     # and the iOS test app doesn't link if we actually try to use it.
2410     # if test $_os != iOS -a $_os != Android; then
2411         enable_database_connectivity=yes
2412     # fi
2415 if test "$enable_database_connectivity" = yes; then
2416     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2417     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2420 if test -z "$enable_extensions"; then
2421     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2422     if test $_os != iOS -a $_os != Android; then
2423         enable_extensions=yes
2424     fi
2427 if test "$enable_extensions" = yes; then
2428     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2429     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2432 if test -z "$enable_scripting"; then
2433     # Disable scripting for iOS unless specifically overridden
2434     # with --enable-scripting.
2435     if test $_os != iOS; then
2436         enable_scripting=yes
2437     fi
2440 DISABLE_SCRIPTING=''
2441 if test "$enable_scripting" = yes; then
2442     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2443 else
2444     DISABLE_SCRIPTING='TRUE'
2445     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2447 AC_SUBST(DISABLE_SCRIPTING)
2449 if test $_os = iOS -o $_os = Android; then
2450     # Disable dynamic_loading always for iOS and Android
2451     enable_dynamic_loading=no
2452 elif test -z "$enable_dynamic_loading"; then
2453     # Otherwise enable it unless speficically disabled
2454     enable_dynamic_loading=yes
2457 DISABLE_DYNLOADING=''
2458 if test "$enable_dynamic_loading" = yes; then
2459     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2460 else
2461     DISABLE_DYNLOADING='TRUE'
2462     SCPDEFS="$SCPDEFS -DDISABLE_DYNLOADING"
2464 AC_SUBST(DISABLE_DYNLOADING)
2466 # remenber SYSBASE value
2467 AC_SUBST(SYSBASE)
2469 dnl ===================================================================
2470 dnl  Sort out various gallery compilation options
2471 dnl ===================================================================
2472 AC_MSG_CHECKING([how to build and package galleries])
2473 if test -n "${with_galleries}"; then
2474     if test "$with_galleries" = "build"; then
2475         WITH_GALLERY_BUILD=TRUE
2476         AC_MSG_RESULT([build from source images internally])
2477     elif test "$with_galleries" = "no"; then
2478         WITH_GALLERY_BUILD=
2479         AC_MSG_RESULT([disable non-internal gallery build])
2480     else
2481         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2482     fi
2483 else
2484     if test $_os != iOS -a $_os != Android; then
2485         WITH_GALLERY_BUILD=TRUE
2486         AC_MSG_RESULT([internal src images for desktop])
2487     else
2488         WITH_GALLERY_BUILD=
2489         AC_MSG_RESULT([disable src imgage build])
2490     fi
2492 AC_SUBST(WITH_GALLERY_BUILD)
2494 dnl ===================================================================
2495 dnl  Checks if ccache is available
2496 dnl ===================================================================
2497 if test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2498     case "%$CC%$CXX%" in
2499     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some verison number etc),
2500     # assume that's good then
2501     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2502         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2503         ;;
2504     *)
2505         AC_PATH_PROG([CCACHE],[ccache],[not found])
2506         if test "$CCACHE" = "not found"; then
2507             CCACHE=""
2508         else
2509             # Need to check for ccache version: otherwise prevents
2510             # caching of the results (like "-x objective-c++" for Mac)
2511             if test $_os = Darwin -o $_os = iOS; then
2512                 # Check ccache version
2513                 AC_MSG_CHECKING([whether version of ccache is suitable])
2514                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2515                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2516                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2517                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2518                 else
2519                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2520                     CCACHE=""
2521                 fi
2522             fi
2523         fi
2524         ;;
2525     esac
2526 else
2527     CCACHE=""
2530 if test "$CCACHE" != ""; then
2531     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2532     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2533     if test "$ccache_size" = ""; then
2534         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2535         if test "$ccache_size" = ""; then
2536             ccache_size=0
2537         fi
2538         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2539         if test $ccache_size -lt 1024; then
2540             CCACHE=""
2541             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2542             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2543         else
2544             # warn that ccache may be too small for debug build
2545             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2546             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2547         fi
2548     else
2549         if test $ccache_size -lt 5; then
2550             #warn that ccache may be too small for debug build
2551             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2552             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2553         fi
2554     fi
2557 dnl ===================================================================
2558 dnl  Checks for C compiler,
2559 dnl  The check for the C++ compiler is later on.
2560 dnl ===================================================================
2561 if test "$_os" != "WINNT" -a "$WITH_MINGW" != "yes"; then
2562     GCC_HOME_SET="true"
2563     AC_MSG_CHECKING([gcc home])
2564     if test -z "$with_gcc_home"; then
2565         if test "$enable_icecream" = "yes"; then
2566             if test -d "/usr/lib/icecc/bin"; then
2567                 GCC_HOME="/usr/lib/icecc/"
2568             else
2569                 GCC_HOME="/opt/icecream/"
2570             fi
2571         else
2572             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2573             GCC_HOME_SET="false"
2574         fi
2575     else
2576         GCC_HOME="$with_gcc_home"
2577     fi
2578     AC_MSG_RESULT($GCC_HOME)
2579     AC_SUBST(GCC_HOME)
2581     if test "$GCC_HOME_SET" = "true"; then
2582         if test -z "$CC"; then
2583             CC="$GCC_HOME/bin/gcc"
2584         fi
2585         if test -z "$CXX"; then
2586             CXX="$GCC_HOME/bin/g++"
2587         fi
2588     fi
2591 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
2592 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
2593     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
2594     save_CFLAGS=$CFLAGS
2595     AC_PROG_CC
2596     CFLAGS=$save_CFLAGS
2599 COMPATH=`dirname "$CC"`
2600 if test "$COMPATH" = "."; then
2601     AC_PATH_PROGS(COMPATH, $CC)
2602     dnl double square bracket to get single because of M4 quote...
2603     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2605 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2607 dnl ===================================================================
2608 dnl Java support
2609 dnl ===================================================================
2610 AC_MSG_CHECKING([whether to build with Java support])
2611 if test "$with_java" != "no"; then
2612     if test "$DISABLE_SCRIPTING" = TRUE; then
2613         AC_MSG_RESULT([no, overridden by --disable-scripting])
2614         ENABLE_JAVA=""
2615         with_java=no
2616     else
2617         AC_MSG_RESULT([yes])
2618         ENABLE_JAVA="TRUE"
2619         AC_DEFINE(HAVE_FEATURE_JAVA)
2620     fi
2621 else
2622     AC_MSG_RESULT([no])
2623     ENABLE_JAVA=""
2626 AC_SUBST(ENABLE_JAVA)
2628 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2630 dnl ENABLE_JAVA="" indicate no Java support at all
2632 dnl ===================================================================
2633 dnl Export file validation
2634 dnl ===================================================================
2635 AC_MSG_CHECKING([whether to enable export file validation])
2636 if test "$with_export_validation" = yes; then
2637     AC_MSG_RESULT([yes])
2638     AC_DEFINE(HAVE_EXPORT_VALIDATION)
2639 else
2640     AC_MSG_RESULT([no])
2643 dnl ===================================================================
2644 dnl  Test the Solaris compiler version
2645 dnl ===================================================================
2646 if test "$_os" = "SunOS"; then
2647     if test "$CC" = "cc"; then
2648         AC_PATH_PROGS(_cc, cc)
2649         COMPATH=`echo $_cc | $SED -n "s/\/bin\/cc//p"`
2650         AC_MSG_CHECKING([the SunStudio C/C++ compiler version])
2651         dnl cc -V outputs to standard error!!!!
2652         _sunstudio_string=`$CC -V 2>&1 | grep '^cc' | $SED -e 's/.* C //'`
2653         _sunstudio_version=`echo $_sunstudio_string | $AWK '{ print $1 }'`
2654         _sunstudio_major=`echo $_sunstudio_version | $AWK -F. '{ print $1 }'`
2655         if test "$_sunstudio_major" != "5"; then
2656             AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2657         else
2658             _sunstudio_minor=`echo $_sunstudio_version | $AWK -F. '{ if ($2 == 5) print "true"; else if ($2 == 7) print "true"; else if ($2 == 8) print "true"; else if ($2 == 9) print "true"; else print "false" }'`
2659             if test "$_sunstudio_minor" = "false"; then
2660                 AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2661             else
2662                 dnl compiler will do
2663                 AC_MSG_RESULT([checked])
2664             fi
2665         fi
2666     fi
2670 dnl ===================================================================
2671 dnl Check OS X SDK and compiler
2672 dnl ===================================================================
2674 if test $_os = Darwin; then
2676     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
2677         bitness=-m32
2678     else
2679         bitness=-m64
2680         BITNESS_OVERRIDE=64
2681     fi
2683     # If no --with-macosx-sdk option is given, look for 10.6,
2684     # 10.7, 10.8 and 10.9 SDKs, in that order. If not found
2685     # in some default locations, try the xcode-select tool.
2686     # 10.5 must be specified explicitely to be considered
2688     # The intent is that for "most" Mac-based developers, a suitable
2689     # SDK will be found automatically without any configure options.
2691     # For developers still using old Xcode in /Developer, either
2692     # because it is the only Xcode they have, or they have that in
2693     # addition to Xcode 4 in /Applications/Xcode.app, the 10.5 SDK
2694     # or 10.6 SDK should be found.
2696     # For developers with a current Xcode, the lowest-numbered SDK
2697     # should be found.
2699     AC_MSG_CHECKING([what Mac OS X SDK to use])
2701     if test -z "$with_macosx_sdk"; then
2702         if test -d /Developer/SDKs/MacOSX10.6.sdk; then
2703             with_macosx_sdk=10.6
2704         elif test -d /Developer-old/SDKs/MacOSX10.6.sdk; then
2705             with_macosx_sdk=10.6
2706         elif test -d /Xcode3/SDKs/MacOSX10.6.sdk; then
2707             with_macosx_sdk=10.6
2708         elif test -d /Developer/SDKs/MacOSX10.7.sdk; then
2709             with_macosx_sdk=10.7
2710         elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk"; then
2711             with_macosx_sdk=10.6
2712         elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"; then
2713             with_macosx_sdk=10.7
2714         elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk"; then
2715             with_macosx_sdk=10.8
2716         elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk"; then
2717             with_macosx_sdk=10.9
2718         elif test -x /usr/bin/xcode-select; then
2719             xcodepath="`xcode-select -print-path`"
2720             if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk"; then
2721                 with_macosx_sdk=10.6
2722             elif test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"; then
2723                 with_macosx_sdk=10.7
2724             elif test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk"; then
2725                 with_macosx_sdk=10.8
2726             elif test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk"; then
2727                 with_macosx_sdk=10.9
2728             fi
2729         fi
2730         if test -z "$with_macosx_sdk"; then
2731             AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2732         fi
2733     fi
2735     case $with_macosx_sdk in
2736     10.5)
2737         MACOSX_SDK_VERSION=1050
2738         ;;
2739     10.6)
2740         MACOSX_SDK_VERSION=1060
2741         ;;
2742     10.7)
2743         MACOSX_SDK_VERSION=1070
2744         ;;
2745     10.8)
2746         MACOSX_SDK_VERSION=1080
2747         ;;
2748     10.9)
2749         MACOSX_SDK_VERSION=1090
2750         ;;
2751     *)
2752         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.5--9])
2753         ;;
2754     esac
2756     # Next find it (again, if we deduced its version above by finding
2757     # it... but we need to look for it once more in case
2758     # --with-macosx-sdk was given so that the above search did not
2759     # happen).
2760     if test -z "$MACOSX_SDK_PATH"; then
2761         case $with_macosx_sdk in
2762         10.5)
2763             if test -x /usr/bin/xcode-select; then
2764                 xcodepath="`xcode-select -print-path`"
2765                 if test -d "$xcodepath/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2766                     MACOSX_SDK_PATH="$xcodepath/SDKs/MacOSX$with_macosx_sdk.sdk"
2767                 fi
2768             elif test -d /Developer/SDKs/MacOSX10.5.sdk; then
2769                 MACOSX_SDK_PATH=/Developer/SDKs/MacOSX10.5.sdk
2770             elif test -d /Developer-old/SDKs/MacOSX10.5.sdk; then
2771                 MACOSX_SDK_PATH=/Developer-old/SDKs/MacOSX10.5.sdk
2772             elif test -d /Xcode3/SDKs/MacOSX10.5.sdk; then
2773                 MACOSX_SDK_PATH=/Xcode3/SDKs/MacOSX10.5.sdk
2774             fi
2775             ;;
2776         10.6)
2777             if test -d /Developer/SDKs/MacOSX10.6.sdk; then
2778                 MACOSX_SDK_PATH=/Developer/SDKs/MacOSX10.6.sdk
2779             elif test -d /Developer-old/SDKs/MacOSX10.6.sdk; then
2780                 MACOSX_SDK_PATH=/Developer-old/SDKs/MacOSX10.6.sdk
2781             elif test -d /Xcode3/SDKs/MacOSX10.6.sdk; then
2782                 MACOSX_SDK_PATH=/Xcode3/SDKs/MacOSX10.6.sdk
2783             elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2784                 MACOSX_SDK_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk
2785             elif test -x /usr/bin/xcode-select; then
2786                 xcodepath="`xcode-select -print-path`"
2787                 if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2788                     MACOSX_SDK_PATH="$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"
2789                 fi
2790             fi
2791             ;;
2792         10.7)
2793             if test -d /Developer/SDKs/MacOSX$with_macosx_sdk.sdk; then
2794                 MACOSX_SDK_PATH=/Developer/SDKs/MacOSX$with_macosx_sdk.sdk
2795             elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2796                 MACOSX_SDK_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk
2797             elif test -x /usr/bin/xcode-select; then
2798                 xcodepath="`xcode-select -print-path`"
2799                 if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2800                     MACOSX_SDK_PATH="$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"
2801                 fi
2802             fi
2803             ;;
2804         10.8|10.9)
2805             xcodepath="`xcode-select -print-path`"
2806             if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2807                 MACOSX_SDK_PATH="$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"
2808             fi
2809             ;;
2810         esac
2811         if test -z "$MACOSX_SDK_PATH"; then
2812             AC_MSG_ERROR([Could not figure out the location of Mac OS X $with_macosx_sdk SDK])
2813         fi
2814     fi
2815     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2817     if test "$with_macosx_version_min_required" = ""; then
2818         case $with_macosx_sdk in
2819         10.5)
2820             with_macosx_version_min_required="10.5";;
2821         *)
2822             with_macosx_version_min_required="10.6";;
2823         esac
2824     fi
2826     if test "$with_macosx_version_max_allowed" = ""; then
2827         with_macosx_version_max_allowed="$with_macosx_sdk"
2828     fi
2830     # export this so that "xcrun" invocations later return matching values
2831     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2832     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2833     export DEVELOPER_DIR
2834     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2835     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2837     case "$with_macosx_version_min_required" in
2838     10.5)
2839         MAC_OS_X_VERSION_MIN_REQUIRED="1050"
2840         ;;
2841     10.6)
2842         MAC_OS_X_VERSION_MIN_REQUIRED="1060"
2843         ;;
2844     10.7)
2845         MAC_OS_X_VERSION_MIN_REQUIRED="1070"
2846         ;;
2847     10.8)
2848         MAC_OS_X_VERSION_MIN_REQUIRED="1080"
2849         ;;
2850     10.9)
2851         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2852         ;;
2853     *)
2854         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.5--9])
2855         ;;
2856     esac
2858     if test "$BITNESS_OVERRIDE" = ""; then
2859         case "$with_macosx_version_min_required" in
2860         10.5)
2861             case "$with_macosx_sdk" in
2862             10.5)
2863                 ;;
2864             *)
2865                 AC_MSG_WARN([Building with a SDK > 10.5 possibly breaks 10.5 compatibility.])
2866                 add_warning "Building with a SDK > 10.5 possibly breaks 10.5 compatibility."
2867                 ;;
2868             esac
2869             ;;
2870         10.6)
2871             case "$with_macosx_sdk" in
2872             10.6)
2873                 ;;
2874             *)
2875                 AC_MSG_WARN([Building with a SDK > 10.6 possibly breaks 10.6 compatibility. Do not use for the TDF build])
2876                 add_warning "Building with a SDK > 10.6 possibly breaks 10.6 compatibility. Do not use for the TDF build"
2877                 ;;
2878             esac
2879             ;;
2880         *)
2881             AC_MSG_WARN([Building with a minimum version requirement > 10.6 breaks 10.6 compatibility. Do not use for the TDF build])
2882             add_warning "Building with a minimum version requirement > 10.6 breaks 10.6 compatibility. Do not use for the TDF build"
2883             ;;
2884         esac
2885     fi
2887     # If no CC and CXX environment vars, try to guess where the compiler is
2888     LIBTOOL=libtool
2889     INSTALL_NAME_TOOL=install_name_tool
2890     if test -z "$save_CC"; then
2891         AC_MSG_CHECKING([what compiler to use])
2892         case $with_macosx_sdk in
2893         10.5)
2894             if test "$enable_libc__" = yes; then
2895                 AC_MSG_ERROR([--enable-libc++ requires --with-macosx-version-min-required >= 10.7])
2896             fi
2897             CC="${gccprefix}gcc-4.2 $arch -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2898             CXX="${gccprefix}g++-4.2 $arch -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2899             INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2900             ;;
2901         10.6)
2902             if test "$enable_libc__" = yes; then
2903                 AC_MSG_ERROR([--enable-libc++ requires --with-macosx-version-min-required >= 10.7])
2904             fi
2905             # did someone copy her 10.6 sdk into xcode 4 (needed on Mountain Lion)?
2906             if test "$(echo $MACOSX_SDK_PATH | cut -c1-23)" = "/Applications/Xcode.app"; then
2907                 CC="`xcrun -find gcc` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2908                 CXX="`xcrun -find g++` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2909             else
2910                 CC="gcc-4.2 $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2911                 CXX="g++-4.2 $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2912             fi
2913             INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2914             LIBTOOL=libtool
2915             ;;
2916         10.7|10.8|10.9)
2917             if test "$enable_libc__" = yes; then
2918                 if test "$with_macosx_version_min_required" = 10.6; then
2919                     AC_MSG_ERROR([--enable-libc++ requires --with-macosx-version-min-required >= 10.7])
2920                 fi
2921                 # Use libc++ instead of libstdc++ when possible
2922                 stdlib=-stdlib=libc++
2923             fi
2924             if test "$ENABLE_LTO" = TRUE; then
2925                 lto=-flto
2926             fi
2927             CC="`xcrun -find clang` $bitness $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2928             CXX="`xcrun -find clang++` $bitness $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2929             INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2930             AR=`xcrun -find ar`
2931             NM=`xcrun -find nm`
2932             STRIP=`xcrun -find strip`
2933             LIBTOOL=`xcrun -find libtool`
2934             RANLIB=`xcrun -find ranlib`
2935             ;;
2936         esac
2937         AC_MSG_RESULT([$CC and $CXX])
2938     fi
2940     case "$with_macosx_version_max_allowed" in
2941     10.5)
2942         MAC_OS_X_VERSION_MAX_ALLOWED="1050"
2943         ;;
2944     10.6)
2945         MAC_OS_X_VERSION_MAX_ALLOWED="1060"
2946         ;;
2947     10.7)
2948         MAC_OS_X_VERSION_MAX_ALLOWED="1070"
2949         ;;
2950     10.8)
2951         MAC_OS_X_VERSION_MAX_ALLOWED="1080"
2952         ;;
2953     10.9)
2954         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2955         ;;
2956     *)
2957         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.5--9])
2958         ;;
2959     esac
2961     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2962     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2963         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2964     else
2965         AC_MSG_RESULT([ok])
2966     fi
2968     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2969     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2970         AC_MSG_ERROR([the version maximum allowed cannot be greater thatn the sdk level])
2971     else
2972         AC_MSG_RESULT([ok])
2973     fi
2974     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2975     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2977     AC_MSG_CHECKING([whether to do code signing])
2979     if test "$enable_macosx_code_signing" = yes; then
2980         # By default use the first suitable certificate (?).
2982         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2983         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2984         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2985         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the the
2986         # "Developer ID Application" one.
2988         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2989         if test -n "$identity"; then
2990             MACOSX_CODESIGNING_IDENTITY=$identity
2991             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2992             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2993         fi
2994     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2995         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2996         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2997         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2998     else
2999         AC_MSG_RESULT([no])
3000     fi
3002     AC_MSG_CHECKING([whether to sandbox the application])
3004     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3005         AC_MSG_ERROR([OS X sandboxing requires code signing])
3006     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3007         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
3008     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3009         ENABLE_MACOSX_SANDBOX=TRUE
3010         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3011         AC_MSG_RESULT([yes])
3012     else
3013         AC_MSG_RESULT([no])
3014     fi
3016     AC_MSG_CHECKING([what OS X app bundle identifier to use])
3018     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3020     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3022     AC_MSG_CHECKING([build with mac retina support])
3023     if test "$enable_macosx_retina" = yes ; then
3024         MACOSX_HIGH_RESOLUTION_VALUE=true
3025     else
3026         MACOSX_HIGH_RESOLUTION_VALUE=false
3027     fi
3028     AC_MSG_RESULT([$MACOSX_HIGH_RESOLUTION_VALUE])
3030 AC_SUBST(MACOSX_SDK_PATH)
3031 AC_SUBST(MACOSX_SDK_VERSION)
3032 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3033 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3034 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3035 AC_SUBST(INSTALL_NAME_TOOL)
3036 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
3037 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3038 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3039 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3040 AC_SUBST(MACOSX_HIGH_RESOLUTION_VALUE)
3042 dnl ===================================================================
3043 dnl Check iOS SDK and compiler
3044 dnl ===================================================================
3046 if test $_os = iOS; then
3048     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3049         :
3050     else
3051         BITNESS_OVERRIDE=64
3052     fi
3054     AC_MSG_CHECKING([what iOS SDK to use])
3056     if test "$enable_ios_simulator" = yes; then
3057         platform=iPhoneSimulator
3058     else
3059         platform=iPhoneOS
3060     fi
3062     xcode_developer=`xcode-select -print-path`
3064     pref_sdk_ver=7.0
3065     for sdkver in 7.1 7.0 6.1 6.0; do
3066         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3067         if test -d $t; then
3068             ios_sdk=$sdkver
3069             sysroot=$t
3070             break
3071         fi
3072     done
3074     if test -z "$sysroot"; then
3075         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${pref_sdk_ver}])
3076     fi
3078     AC_MSG_RESULT($sysroot)
3080     if test "$enable_ios_simulator" = yes; then
3081         if test "$BITNESS_OVERRIDE" = 64; then
3082             XCODE_ARCHS=x86_64
3083             versionmin=-mios-simulator-version-min=7.0
3084         else
3085             XCODE_ARCHS=i386
3086             case $sdkver in
3087             7.*)
3088                 versionmin=-mios-simulator-version-min=6.1
3089                 ;;
3090             *)
3091                 versionmin=-mmacosx-version-min=10.7
3092                 ;;
3093             esac
3094         fi
3095     else
3096         platform=iPhoneOS
3097         if test "$BITNESS_OVERRIDE" = 64; then
3098             XCODE_ARCHS=arm64
3099             versionmin=-miphoneos-version-min=7.0
3100         else
3101             XCODE_ARCHS=armv7
3102             versionmin=-miphoneos-version-min=6.1
3103         fi
3104     fi
3106     # LTO is not really recommended for iOS builds,
3107     # the link time will be astronomical
3108     if test "$ENABLE_LTO" = TRUE; then
3109         lto=-flto
3110     fi
3111     # Just add -fvisibility=hidden to CC and CXX directly so that the 3rd-party libs also
3112     # get compiled with it, to avoid ld warnings when linking all that together into one
3113     # executable.
3115     # Use libc++ for iOS 7 SDK and libstdc++ for earlier (but we don't really expect anybody to
3116     # be be using an earlier SDK)
3118     XCODE_CLANG_CXX_LIBRARY=libstdc++
3119     case $ios_sdk in
3120     6.*)
3121         if test "$enable_libc__" = yes; then
3122             AC_MSG_ERROR([--enable-libc++ requires using Xcode 5 and iOS SDK 7 or newer it seems])
3123         fi
3124         ;;
3125     *)
3126         if test "$enable_libc__" = no; then
3127             AC_MSG_ERROR([--disable-libc++ not allowed])
3128         fi
3129         XCODE_CLANG_CXX_LIBRARY=libc++
3130         ;;
3131     esac
3133     stdlib="-stdlib=$XCODE_CLANG_CXX_LIBRARY"
3135     CC="`xcrun -find clang` -arch $XCODE_ARCHS -fvisibility=hidden -isysroot $sysroot $lto $versionmin"
3136     CXX="`xcrun -find clang++` -arch $XCODE_ARCHS -fvisibility=hidden $stdlib -isysroot $sysroot $lto $versionmin"
3138     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3139     AR=`xcrun -find ar`
3140     NM=`xcrun -find nm`
3141     STRIP=`xcrun -find strip`
3142     LIBTOOL=`xcrun -find libtool`
3143     RANLIB=`xcrun -find ranlib`
3146 AC_SUBST(XCODE_CLANG_CXX_LIBRARY)
3147 AC_SUBST(XCODE_ARCHS)
3149 AC_MSG_CHECKING([whether to treat the installation as read-only])
3151 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3152         "$enable_extensions" != yes; then
3153     enable_readonly_installset=yes
3155 if test "$enable_readonly_installset" = yes; then
3156     AC_MSG_RESULT([yes])
3157     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3158 else
3159     AC_MSG_RESULT([no])
3162 dnl ===================================================================
3163 dnl Structure of install set
3164 dnl ===================================================================
3166 if test $_os = Darwin -a "$enable_canonical_installation_tree_structure" = yes; then
3167     LIBO_BIN_FOLDER=MacOS
3168     LIBO_ETC_FOLDER=Resources
3169     LIBO_LIBEXEC_FOLDER=MacOS
3170     LIBO_LIB_FOLDER=Frameworks
3171     LIBO_SHARE_FOLDER=Resources
3172     LIBO_SHARE_HELP_FOLDER=Resources/help
3173     LIBO_SHARE_JAVA_FOLDER=Resources/java
3174     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3175     LIBO_LIB_PYUNO_FOLDER=Resources
3176     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3177     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3178     LIBO_URE_BIN_FOLDER=MacOS
3179     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3180     LIBO_URE_LIB_FOLDER=Frameworks
3181     LIBO_URE_SHARE_FOLDER=Resources/ure/share
3182     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3183     ENABLE_MACOSX_MACLIKE_APP_STRUCTURE=TRUE
3184     AC_DEFINE(HAVE_FEATURE_MACOSX_MACLIKE_APP_STRUCTURE)
3185 elif test $_os = Darwin; then
3186     LIBO_BIN_FOLDER=MacOS
3187     LIBO_ETC_FOLDER=MacOS
3188     LIBO_LIBEXEC_FOLDER=MacOS
3189     LIBO_LIB_FOLDER=MacOS
3190     LIBO_LIB_PYUNO_FOLDER=MacOS
3191     LIBO_SHARE_FOLDER=share
3192     LIBO_SHARE_HELP_FOLDER=help
3193     LIBO_SHARE_JAVA_FOLDER=MacOS/classes
3194     LIBO_SHARE_PRESETS_FOLDER=presets
3195     LIBO_SHARE_RESOURCE_FOLDER=MacOS/resource
3196     LIBO_SHARE_SHELL_FOLDER=MacOS/shell
3197     LIBO_URE_BIN_FOLDER=ure-link/bin
3198     LIBO_URE_ETC_FOLDER=ure-link/lib
3199     LIBO_URE_LIB_FOLDER=ure-link/lib
3200     LIBO_URE_SHARE_FOLDER=ure-link/share
3201     LIBO_URE_SHARE_JAVA_FOLDER=ure-link/share/java
3202 elif test $_os = WINNT; then
3203     LIBO_BIN_FOLDER=program
3204     LIBO_ETC_FOLDER=program
3205     LIBO_LIBEXEC_FOLDER=program
3206     LIBO_LIB_FOLDER=program
3207     LIBO_LIB_PYUNO_FOLDER=program
3208     LIBO_SHARE_FOLDER=share
3209     LIBO_SHARE_HELP_FOLDER=help
3210     LIBO_SHARE_JAVA_FOLDER=program/classes
3211     LIBO_SHARE_PRESETS_FOLDER=presets
3212     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3213     LIBO_SHARE_SHELL_FOLDER=program/shell
3214     LIBO_URE_BIN_FOLDER=URE/bin
3215     LIBO_URE_ETC_FOLDER=URE/bin
3216     LIBO_URE_LIB_FOLDER=URE/bin
3217     LIBO_URE_SHARE_FOLDER=URE
3218     LIBO_URE_SHARE_JAVA_FOLDER=URE/java
3219 else
3220     LIBO_BIN_FOLDER=program
3221     LIBO_ETC_FOLDER=program
3222     LIBO_LIBEXEC_FOLDER=program
3223     LIBO_LIB_FOLDER=program
3224     LIBO_LIB_PYUNO_FOLDER=program
3225     LIBO_SHARE_FOLDER=share
3226     LIBO_SHARE_HELP_FOLDER=help
3227     LIBO_SHARE_JAVA_FOLDER=program/classes
3228     LIBO_SHARE_PRESETS_FOLDER=presets
3229     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3230     LIBO_SHARE_SHELL_FOLDER=program/shell
3231     LIBO_URE_BIN_FOLDER=ure/bin
3232     LIBO_URE_ETC_FOLDER=ure/lib
3233     LIBO_URE_LIB_FOLDER=ure/lib
3234     LIBO_URE_SHARE_FOLDER=ure/share
3235     LIBO_URE_SHARE_JAVA_FOLDER=ure/share/java
3237 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3238 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3239 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3240 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3241 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3242 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3243 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3244 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3245 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3246 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3247 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3248 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3249 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3250 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3251 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_FOLDER,"$LIBO_URE_SHARE_FOLDER")
3252 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3254 # Not all of them needed in config_host.mk, add more if need arises
3255 AC_SUBST(LIBO_BIN_FOLDER)
3256 AC_SUBST(LIBO_ETC_FOLDER)
3257 AC_SUBST(LIBO_LIB_FOLDER)
3258 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3259 AC_SUBST(LIBO_SHARE_FOLDER)
3260 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3261 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3262 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3263 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3264 AC_SUBST(LIBO_URE_BIN_FOLDER)
3265 AC_SUBST(LIBO_URE_ETC_FOLDER)
3266 AC_SUBST(LIBO_URE_LIB_FOLDER)
3267 AC_SUBST(LIBO_URE_SHARE_FOLDER)
3268 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3269 AC_SUBST(ENABLE_MACOSX_MACLIKE_APP_STRUCTURE)
3271 dnl ===================================================================
3272 dnl Windows specific tests and stuff
3273 dnl ===================================================================
3275 # Get a value from the 32-bit side of the Registry
3276 reg_get_value_32()
3278     # Return value: $regvalue
3279     unset regvalue
3280     _regvalue=`cat "/proc/registry32/$1" 2> /dev/null`
3282     if test $? -eq 0; then
3283         regvalue=$_regvalue
3284     fi
3287 # Get a value from the 64-bit side of the Registry
3288 reg_get_value_64()
3290     # Return value: $regvalue
3291     unset regvalue
3292     _regvalue=`cat "/proc/registry64/$1" 2> /dev/null`
3294     if test $? -eq 0; then
3295         regvalue=$_regvalue
3296     fi
3299 if test "$_os" = "WINNT"; then
3300     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3301     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3302         AC_MSG_RESULT([no])
3303         WINDOWS_SDK_ARCH="x86"
3304     else
3305         AC_MSG_RESULT([yes])
3306         WINDOWS_SDK_ARCH="x64"
3307         BITNESS_OVERRIDE=64
3308     fi
3311 if test "$_os" = "WINNT" -a "$WITH_MINGW" != yes; then
3312     AC_MSG_CHECKING([whether to use DirectX])
3313     if test "$enable_directx" = "yes" -o "$enable_directx" = ""; then
3314         ENABLE_DIRECTX="TRUE"
3315         AC_MSG_RESULT([yes])
3316     else
3317         ENABLE_DIRECTX=""
3318         AC_MSG_RESULT([no])
3319     fi
3321     AC_MSG_CHECKING([whether to use ActiveX])
3322     if test "$enable_activex" = "yes" -o "$enable_activex" = ""; then
3323         DISABLE_ACTIVEX=""
3324         AC_MSG_RESULT([yes])
3325     else
3326         DISABLE_ACTIVEX="TRUE"
3327         AC_MSG_RESULT([no])
3328     fi
3330     AC_MSG_CHECKING([whether to use ATL])
3331     if test "$enable_atl" = "yes" -o "$enable_atl" = ""; then
3332         DISABLE_ATL=""
3333         AC_MSG_RESULT([yes])
3334     else
3335         DISABLE_ATL="TRUE"
3336         AC_MSG_RESULT([no])
3337     fi
3338 else
3339     ENABLE_DIRECTX=""
3340     DISABLE_ACTIVEX="TRUE"
3341     DISABLE_ATL="TRUE"
3344 AC_SUBST(ENABLE_DIRECTX)
3345 AC_SUBST(DISABLE_ACTIVEX)
3346 AC_SUBST(DISABLE_ATL)
3348 if test "$cross_compiling" = "yes"; then
3349     export CROSS_COMPILING=TRUE
3350     SCPDEFS="$SCPDEFS -DCROSS_COMPILING"
3351 else
3352     CROSS_COMPILING=
3353     BUILD_TYPE="$BUILD_TYPE NATIVE"
3355 AC_SUBST(CROSS_COMPILING)
3357 dnl ===================================================================
3358 dnl  Is GCC actually Clang?
3359 dnl ===================================================================
3361 COM_GCC_IS_CLANG=
3362 if test "$GCC" = "yes"; then
3363     AC_MSG_CHECKING([whether GCC is actually Clang])
3364     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3365         #ifndef __clang__
3366         you lose
3367         #endif
3368         int foo=42;
3369         ]])],
3370         [AC_MSG_RESULT([yes])
3371          COM_GCC_IS_CLANG=TRUE],
3372         [AC_MSG_RESULT([no])])
3374     if test "$COM_GCC_IS_CLANG" = TRUE; then
3375         AC_MSG_CHECKING([the Clang version])
3376         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC -E -P -`
3377         CLANG_FULL_VERSION=`echo __clang_version__ | $CC -E -P -`
3378         CLANGVER=`echo $clang_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3379         AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3380         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3381     fi
3383 AC_SUBST(COM_GCC_IS_CLANG)
3385 if test "$CCACHE" != "" -a "$COM_GCC_IS_CLANG" = TRUE; then
3386     if test -z "$CCACHE_CPP2"; then
3387             AC_MSG_WARN([Using ccache with Clang without CCACHE_CPP2 set causes spurious warnings.])
3388             add_warning "Using ccache with Clang without CCACHE_CPP2 set causes spurious warnings."
3389     fi
3392 dnl ===================================================================
3393 dnl  Test the gcc version
3394 dnl ===================================================================
3395 if test "$GCC" = "yes" -a -z "$COM_GCC_IS_CLANG"; then
3396     AC_MSG_CHECKING([the GCC version])
3397     _gcc_version=`$CC -dumpversion`
3398     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3400     if test "$_os" = "Darwin"; then
3401         if test "$with_macosx_sdk" = "10.5"; then
3402             # use gcc 4.2 for OS X SDK 10.5
3403             if test -z "$save_CC" -a -x "$GCC_HOME/bin/gcc-4.2"; then
3404                 export CC="$GCC_HOME/bin/gcc-4.2" # make CC finally available to config.guess
3405             fi
3406             AC_MSG_RESULT([using CC=$CC])
3407         fi
3408     else
3409         AC_MSG_RESULT([gcc $_gcc_version])
3410     fi
3412     if test "$GCC_VERSION" -lt 0401; then
3413         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.1.0])
3414     fi
3415 else
3416     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3417     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3418     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3419     # (which reports itself as GCC 4.2.1).
3420     GCC_VERSION=
3422 AC_SUBST(GCC_VERSION)
3424 # ===================================================================
3425 # check various GCC options that Clang does not support now but maybe
3426 # will somewhen in the future, check them even for GCC, so that the
3427 # flags are set
3428 # ===================================================================
3430 HAVE_GCC_GGDB2=
3431 HAVE_GCC_FINLINE_LIMIT=
3432 HAVE_GCC_FNO_INLINE=
3433 if test "$GCC" = "yes"; then
3434     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3435     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3436         # Option just ignored and silly warning that isn't a real
3437         # warning printed
3438         :
3439     else
3440         save_CFLAGS=$CFLAGS
3441         CFLAGS="$CFLAGS -Werror -ggdb2"
3442         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3443         CFLAGS=$save_CFLAGS
3444     fi
3445     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3446         AC_MSG_RESULT([yes])
3447     else
3448         AC_MSG_RESULT([no])
3449     fi
3451     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3452     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3453         # As above
3454         :
3455     else
3456         save_CFLAGS=$CFLAGS
3457         CFLAGS="$CFLAGS -Werror -finline-limit=0"
3458         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3459         CFLAGS=$save_CFLAGS
3460     fi
3461     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3462         AC_MSG_RESULT([yes])
3463     else
3464         AC_MSG_RESULT([no])
3465     fi
3467     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3468     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3469         # Ditto
3470         :
3471     else
3472         save_CFLAGS=$CFLAGS
3473         CFLAGS="$CFLAGS -Werror -fno-inline"
3474         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3475         CFLAGS=$save_CFLAGS
3476     fi
3477     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3478         AC_MSG_RESULT([yes])
3479     else
3480         AC_MSG_RESULT([no])
3481     fi
3483 AC_SUBST(HAVE_GCC_GGDB2)
3484 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3485 AC_SUBST(HAVE_GCC_FNO_INLINE)
3487 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3488 if test "$GCC" = "yes"; then
3489     AC_MSG_CHECKING( for -Bsymbolic-functions linker support )
3490     bsymbolic_functions_ldflags_save=$LDFLAGS
3491     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3492     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3493 #include <stdio.h>
3494         ],[
3495 printf ("hello world\n");
3496         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3497     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3498         AC_MSG_RESULT( found )
3499     else
3500         AC_MSG_RESULT( not found )
3501     fi
3502     LDFLAGS=$bsymbolic_functions_ldflags_save
3504 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3506 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3507 # NOTE: must _not_ be used for bundled external libraries!
3508 ISYSTEM=
3509 if test "$GCC" = "yes"; then
3510     AC_MSG_CHECKING( for -isystem )
3511     save_CFLAGS=$CFLAGS
3512     CFLAGS="$CFLAGS -Werror"
3513     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM=-isystem ],[])
3514     CFLAGS=$save_CFLAGS
3515     if test -n "$ISYSTEM"; then
3516         AC_MSG_RESULT(yes)
3517     else
3518         AC_MSG_RESULT(no)
3519     fi
3521 if test -z "$ISYSTEM"; then
3522     # fall back to using -I
3523     ISYSTEM=-I
3525 AC_SUBST(ISYSTEM)
3527 dnl ===================================================================
3528 dnl  Check which Visual Studio or MinGW compiler is used
3529 dnl ===================================================================
3531 map_vs_year_to_version()
3533     # Return value: $vsversion
3535     unset vsversion
3537     case $1 in
3538     2010)
3539         vsversion=10.0;;
3540     2012)
3541         vsversion=11.0;;
3542     2013)
3543         vsversion=12.0;;
3544     *)
3545         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3546     esac
3549 vs_versions_to_check()
3551     # Args: $1 (optional) : versions to check, in the order of preference
3552     # Return value: $vsversions
3554     unset vsversions
3556     if test -n "$1"; then
3557         map_vs_year_to_version "$1"
3558         vsversions=$vsversion
3559     else
3560         # By default we prefer 2012, then 2010, then 2013
3561         vsversions="11.0 10.0 12.0"
3562     fi
3565 find_msvs()
3567     # Find Visual Studio 2012/2010/2013
3568     # Args: $1 (optional) : versions to check, in the order of preference
3569     # Return value: $vstest
3571     unset vstest
3573     vs_versions_to_check "$1"
3575     for ver in $vsversions; do
3576         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/ProductDir
3577         if test -n "$regvalue"; then
3578             vstest=$regvalue
3579             break
3580         fi
3581         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VS/ProductDir
3582         if test -n "$regvalue"; then
3583             vstest=$regvalue
3584             break
3585         fi
3586     done
3589 find_msvc()
3591     # Find Visual C++ 2012/2010/2013
3592     # Args: $1 (optional) : The VS version year
3593     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot
3595     unset vctest vcnum vcnumwithdot
3597     vs_versions_to_check "$1"
3599     for ver in $vsversions; do
3600         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3601         if test -n "$regvalue"; then
3602             vctest=$regvalue
3603             break
3604         fi
3605         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VC/ProductDir
3606         if test -n "$regvalue"; then
3607             vctest=$regvalue
3608             break
3609         fi
3610     done
3611     if test -n "$vctest"; then
3612         vcnumwithdot=$ver
3613         case "$vcnumwithdot" in
3614         10.0)
3615             vcyear=2010
3616             vcnum=100
3617             ;;
3618         11.0)
3619             vcyear=2012
3620             vcnum=110
3621             ;;
3622         12.0)
3623             vcyear=2013
3624             vcnum=120
3625             ;;
3626         esac
3627     fi
3630 SHOWINCLUDES_PREFIX=
3631 if test "$_os" = "WINNT"; then
3632     if test "$WITH_MINGW" != "yes"; then
3633         AC_MSG_CHECKING([Visual C++])
3635         find_msvc "$with_visual_studio"
3637         if test -z "$vctest"; then
3638             if test -n "$with_visual_studio"; then
3639                 AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3640             else
3641                 AC_MSG_ERROR([No Visual Studio 2012, 2010 or 2013 installation found])
3642             fi
3643         fi
3645         if test "$BITNESS_OVERRIDE" = ""; then
3646             if test -f "$vctest/bin/cl.exe"; then
3647                 VC_PRODUCT_DIR=$vctest
3648             else
3649                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3650             fi
3651         else
3652             if test -f "$vctest/bin/amd64/cl.exe"; then
3653                 VC_PRODUCT_DIR=$vctest
3654             else
3655                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/amd64/cl.exe])
3656             fi
3657         fi
3659         VC_PRODUCT_DIR=`cygpath -d "$VC_PRODUCT_DIR"`
3660         VC_PRODUCT_DIR=`cygpath -u "$VC_PRODUCT_DIR"`
3661         AC_MSG_RESULT([$VC_PRODUCT_DIR])
3663         dnl ===========================================================
3664         dnl  Check for the corresponding mspdb*.dll
3665         dnl ===========================================================
3667         MSPDB_PATH=
3669         if test "$BITNESS_OVERRIDE" = ""; then
3670             if test "$vcnum" = "120"; then
3671                 MSPDB_PATH="$VC_PRODUCT_DIR/../VC/bin"
3672             else
3673                 MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3674             fi
3675         else
3676             MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3677         fi
3679         mspdbnum=$vcnum
3681         if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3682             AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3683         fi
3685         MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3686         MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3688         dnl The path needs to be added before cl is called
3689         PATH="$MSPDB_PATH:$PATH"
3691         AC_MSG_CHECKING([cl.exe])
3693         # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3694         # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3695         # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3696         # is not enough?
3698         if test -z "$CC"; then
3699             if test "$BITNESS_OVERRIDE" = ""; then
3700                 if test -f "$VC_PRODUCT_DIR/bin/cl.exe"; then
3701                     CC="$VC_PRODUCT_DIR/bin/cl.exe"
3702                 fi
3703             else
3704                 if test -f "$VC_PRODUCT_DIR/bin/amd64/cl.exe"; then
3705                     CC="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3706                 fi
3707             fi
3709             # This gives us a posix path with 8.3 filename restrictions
3710             CC=`cygpath -d "$CC"`
3711             CC=`cygpath -u "$CC"`
3712         fi
3714         if test -n "$CC"; then
3715             # Remove /cl.exe from CC case insensitive
3716             AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3717             if test "$BITNESS_OVERRIDE" = ""; then
3718                 COMPATH=`echo $CC | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3719             else
3720                 if test -n "$VC_PRODUCT_DIR"; then
3721                     # Huh, why not just an assignment?
3722                     COMPATH=`echo $VC_PRODUCT_DIR`
3723                 fi
3724             fi
3725             export INCLUDE=`cygpath -d "$COMPATH/Include"`
3727             PathFormat "$COMPATH"
3728             COMPATH="$formatted_path"
3730             VCVER=$vcnum
3731             MSVSVER=$vcyear
3733             # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3734             # are always "better", we list them in reverse chronological order.
3736             case $vcnum in
3737             100)
3738                 COMEX=13
3739                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="7.1A 7.1 7.0A 6.0A"
3740                 if test "$ENABLE_LTO" = TRUE; then
3742                     AC_MSG_WARN([LTO is known to cause problems with MSVC 2010])
3743                     add_warning "LTO is known to cause problems with MSVC 2010"
3744                 fi
3745                 ;;
3746             110)
3747                 COMEX=14
3748                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="8.0 7.1A"
3749                 ;;
3750             120)
3751                 COMEX=15
3752                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="8.1A 8.1 8.0"
3753                 ;;
3754             esac
3756             # The expectation is that --with-windows-sdk should not need to be used
3757             if test -n "$with_windows_sdk"; then
3758                 case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3759                 *" "$with_windows_sdk" "*)
3760                     WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3761                     ;;
3762                 *)
3763                     AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work witn VS $MSVSVER])
3764                     ;;
3765                 esac
3766             fi
3768             # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3769             ac_objext=obj
3770             ac_exeext=exe
3772         else
3773             AC_MSG_ERROR([Visual C++ not found after all, huh])
3774         fi
3776         dnl We need to guess the prefix of the -showIncludes output, it can be
3777         dnl localized
3778         AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3779         echo "#include <stdlib.h>" > conftest.c
3780         SHOWINCLUDES_PREFIX=`$CC -c -showIncludes conftest.c 2>/dev/null | \
3781             grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3782         rm -f conftest.c conftest.obj
3783         if test -z "$SHOWINCLUDES_PREFIX"; then
3784             AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3785         else
3786             AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3787         fi
3789         # Check for 64-bit (cross-)compiler to use to build the 64-bit
3790         # version of the Explorer extension (and maybe other small
3791         # bits, too) needed when installing a 32-bit LibreOffice on a
3792         # 64-bit OS. The 64-bit Explorer extension is a feature that
3793         # has been present since long in OOo. Don't confuse it with
3794         # building LibreOffice itself as 64-bit code, which is
3795         # unfinished work and highly experimental.
3797         BUILD_X64=
3798         CXX_X64_BINARY=
3799         LINK_X64_BINARY=
3801         if test "$BITNESS_OVERRIDE" = ""; then
3802             AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3803             if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3804                 # Prefer native x64 compiler to cross-compiler, in case we are running
3805                 # the build on a 64-bit OS.
3806                 if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3807                     BUILD_X64=TRUE
3808                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3809                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3810                 elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3811                     BUILD_X64=TRUE
3812                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3813                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3814                 fi
3815             fi
3816             if test "$BUILD_X64" = TRUE; then
3817                 AC_MSG_RESULT([found])
3818             else
3819                 AC_MSG_RESULT([not found])
3820                 AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3821             fi
3822         fi
3823         AC_SUBST(BUILD_X64)
3825         # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3826         AC_SUBST(CXX_X64_BINARY)
3827         AC_SUBST(LINK_X64_BINARY)
3828     else
3829         AC_MSG_CHECKING([the compiler is MinGW])
3830         MACHINE_PREFIX=`$CC -dumpmachine`
3831         if echo $MACHINE_PREFIX | $GREP -q mingw32; then
3832             COMPATH=`echo "$COMPATH" | sed -e 's,/bin$,,'`
3833             AC_MSG_RESULT([yes])
3834         else
3835             AC_MSG_ERROR([Compiler is not MinGW.])
3836         fi
3837     fi
3839 AC_SUBST(VCVER)
3840 PathFormat "$MSPDB_PATH"
3841 MSPDB_PATH="$formatted_path"
3842 AC_SUBST(SHOWINCLUDES_PREFIX)
3845 # dbghelp.dll
3847 if test "$_os" = "WINNT"; then
3848     BUILD_TYPE="$BUILD_TYPE DBGHELP"
3852 # unowinreg.dll
3854 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3855 AC_SUBST(UNOWINREG_DLL)
3858 # prefix C with ccache if needed
3860 if test "$CCACHE" != ""; then
3861     AC_MSG_CHECKING([whether $CC is already ccached])
3863     AC_LANG_PUSH([C])
3864     save_CFLAGS=$CFLAGS
3865     CFLAGS="$CFLAGS --ccache-skip -O2"
3866     dnl an empty program will do, we're checking the compiler flags
3867     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3868                       [use_ccache=yes], [use_ccache=no])
3869     if test $use_ccache = yes; then
3870         AC_MSG_RESULT([yes])
3871     else
3872         CC="$CCACHE $CC"
3873         AC_MSG_RESULT([no])
3874     fi
3875     CFLAGS=$save_CFLAGS
3876     AC_LANG_POP([C])
3879 dnl Set the ENABLE_DBGUTIL variable
3880 dnl ===================================================================
3881 AC_MSG_CHECKING([whether to build with additional debug utilities])
3882 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3883     ENABLE_DBGUTIL="TRUE"
3884     # this is an extra var so it can have different default on different MSVC
3885     # versions (in case there are version specific problems with it)
3886     MSVC_USE_DEBUG_RUNTIME="TRUE"
3888     AC_MSG_RESULT([yes])
3889     # cppunit and graphite expose STL in public headers
3890     if test "$with_system_cppunit" = "yes"; then
3891         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3892     else
3893         with_system_cppunit=no
3894     fi
3895     if test "$with_system_graphite" = "yes"; then
3896         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3897     else
3898         with_system_graphite=no
3899     fi
3900     if test "$with_system_mysql_cppconn" = "yes"; then
3901         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3902     else
3903         with_system_mysql_cppconn=no
3904     fi
3905     if test "$with_system_orcus" = "yes"; then
3906         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3907     else
3908         with_system_orcus=no
3909     fi
3910     if test "$with_system_libcmis" = "yes"; then
3911         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3912     else
3913         with_system_libcmis=no
3914     fi
3915     if test "$enable_win_mozab_driver" = "yes"; then
3916         AC_MSG_ERROR([--enable-win-mozab-driver conflicts with --enable-dbgutil])
3917     fi
3918 else
3919     ENABLE_DBGUTIL=""
3920     MSVC_USE_DEBUG_RUNTIME=""
3921     AC_MSG_RESULT([no])
3923 AC_SUBST(ENABLE_DBGUTIL)
3924 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3926 dnl Set the ENABLE_DEBUG variable.
3927 dnl ===================================================================
3928 AC_MSG_CHECKING([whether to do a debug build])
3929 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3930     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3932 if test -n "$ENABLE_DBGUTIL"; then
3933     if test "$enable_debug" = "no"; then
3934         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3935     fi
3936     ENABLE_DEBUG="TRUE"
3937     AC_MSG_RESULT([yes (dbgutil)])
3938 elif test -n "$enable_debug" && test "$enable_debug" != "no"; then
3939     ENABLE_DEBUG="TRUE"
3940     AC_MSG_RESULT([yes])
3941 else
3942     ENABLE_DEBUG=""
3943     AC_MSG_RESULT([no])
3945 AC_SUBST(ENABLE_DEBUG)
3947 dnl Selective debuginfo
3948 ENABLE_DEBUGINFO_FOR=
3949 if test -n "$ENABLE_DEBUG"; then
3950     AC_MSG_CHECKING([whether to use selective debuginfo])
3951     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3952         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3953         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3954     else
3955         ENABLE_DEBUGINFO_FOR=all
3956         AC_MSG_RESULT([no, for all])
3957     fi
3959 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3961 dnl Check for enable symbols option
3962 dnl ===================================================================
3963 AC_MSG_CHECKING([whether to include symbols while preserve optimization])
3964 if test -n "$enable_symbols" -a "$enable_symbols" != "no"; then
3965     ENABLE_SYMBOLS="TRUE"
3966     if test -n "$ENABLE_DBGUTIL"; then
3967         AC_MSG_ERROR([--enable-dbgutil cannot be used with --enable-symbols])
3968     elif test -n "$ENABLE_DEBUG"; then
3969         AC_MSG_ERROR([--enable-debug cannot be used with --enable-symbols])
3970     fi
3971     AC_MSG_RESULT([yes])
3972 else
3973     if test -n "$enable_symbols" -a "$enable_symbols" = "no"; then
3974         ENABLE_SYMBOLS="FALSE"
3975     else
3976         ENABLE_SYMBOLS=
3977     fi
3978     AC_MSG_RESULT([no])
3980 AC_SUBST(ENABLE_SYMBOLS)
3982 # Debug information format for iOS. Running dsymutil takes a long time... you really need a separate
3983 # .dSYM only if running Instruments, I think. (Not for normal debugging in Xcode.) To enable a
3984 # separate .dSYM, either use --enable-release-build or change manually to "DWARF with DSYM" in Xcode.
3985 XCODE_DEBUG_INFORMATION_FORMAT=dwarf-with-dsym
3986 if test "$enable_release_build" != yes -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \); then
3987     XCODE_DEBUG_INFORMATION_FORMAT=dwarf
3989 AC_SUBST(XCODE_DEBUG_INFORMATION_FORMAT)
3991 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
3992 # By default use the ones specified by our build system,
3993 # but explicit override is possible.
3994 AC_MSG_CHECKING(for explicit AFLAGS)
3995 if test -n "$AFLAGS"; then
3996     AC_MSG_RESULT([$AFLAGS])
3997     x_AFLAGS=
3998 else
3999     AC_MSG_RESULT(no)
4000     x_AFLAGS=[\#]
4002 AC_MSG_CHECKING(for explicit CFLAGS)
4003 if test -n "$CFLAGS"; then
4004     AC_MSG_RESULT([$CFLAGS])
4005     x_CFLAGS=
4006 else
4007     AC_MSG_RESULT(no)
4008     x_CFLAGS=[\#]
4010 AC_MSG_CHECKING(for explicit CXXFLAGS)
4011 if test -n "$CXXFLAGS"; then
4012     AC_MSG_RESULT([$CXXFLAGS])
4013     x_CXXFLAGS=
4014 else
4015     AC_MSG_RESULT(no)
4016     x_CXXFLAGS=[\#]
4018 AC_MSG_CHECKING(for explicit OBJCFLAGS)
4019 if test -n "$OBJCFLAGS"; then
4020     AC_MSG_RESULT([$OBJCFLAGS])
4021     x_OBJCFLAGS=
4022 else
4023     AC_MSG_RESULT(no)
4024     x_OBJCFLAGS=[\#]
4026 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
4027 if test -n "$OBJCXXFLAGS"; then
4028     AC_MSG_RESULT([$OBJCXXFLAGS])
4029     x_OBJCXXFLAGS=
4030 else
4031     AC_MSG_RESULT(no)
4032     x_OBJCXXFLAGS=[\#]
4034 AC_MSG_CHECKING(for explicit LDFLAGS)
4035 if test -n "$LDFLAGS"; then
4036     AC_MSG_RESULT([$LDFLAGS])
4037     x_LDFLAGS=
4038 else
4039     AC_MSG_RESULT(no)
4040     x_LDFLAGS=[\#]
4042 AC_SUBST(AFLAGS)
4043 AC_SUBST(CFLAGS)
4044 AC_SUBST(CXXFLAGS)
4045 AC_SUBST(OBJCFLAGS)
4046 AC_SUBST(OBJCXXFLAGS)
4047 AC_SUBST(LDFLAGS)
4048 AC_SUBST(x_AFLAGS)
4049 AC_SUBST(x_CFLAGS)
4050 AC_SUBST(x_CXXFLAGS)
4051 AC_SUBST(x_OBJCFLAGS)
4052 AC_SUBST(x_OBJCXXFLAGS)
4053 AC_SUBST(x_LDFLAGS)
4056 # determine CPUNAME, GUIBASE, ...
4058 LIB64="lib"
4059 SOLARINC=
4061 case "$host_os" in
4063 aix*)
4064     COM=GCC
4065     CPUNAME=POWERPC
4066     GUIBASE=unx
4067     OS=AIX
4068     RTL_OS=AIX
4069     RTL_ARCH=PowerPC
4070     PLATFORMID=aix_powerpc
4071     OUTPATH=unxaigppc
4072     P_SEP=:
4073     ;;
4075 cygwin*)
4076     COM=MSC
4077     GUIBASE=not-used
4078     OS=WNT
4079     RTL_OS=Windows
4080     P_SEP=";"
4082     case "$host_cpu" in
4083     i*86|x86_64)
4084         if test "$BITNESS_OVERRIDE" = 64; then
4085             CPUNAME=X86_64
4086             RTL_ARCH=X86_64
4087             LIB64="lib/x64"
4088             PLATFORMID=windows_x86_64
4089             OUTPATH=wntmscx$COMEX
4090         else
4091             CPUNAME=INTEL
4092             RTL_ARCH=x86
4093             PLATFORMID=windows_x86
4094             OUTPATH=wntmsci$COMEX
4095         fi
4096         ;;
4097     *)
4098         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4099         ;;
4100     esac
4101     SCPDEFS="$SCPDEFS -D_MSC_VER"
4102     ;;
4104 darwin*)
4105     COM=GCC
4106     GUIBASE=not-used
4107     OS=MACOSX
4108     RTL_OS=MacOSX
4109     P_SEP=:
4111     case "$host_cpu" in
4112     arm*)
4113         CPUNAME=ARM
4114         RTL_ARCH=ARM_EABI
4115         PLATFORMID=ios_arm
4116         OUTPATH=unxiosr
4117         OS=IOS
4118         SDKDIR=sdk
4119         ;;
4120     powerpc*)
4121         CPUNAME=POWERPC
4122         RTL_ARCH=PowerPC
4123         PLATFORMID=macosx_powerpc
4124         OUTPATH=unxmacxp
4125         ;;
4126     i*86)
4127         if test "$BITNESS_OVERRIDE" = 64; then
4128             AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4129         fi
4130         CPUNAME=INTEL
4131         RTL_ARCH=x86
4132         PLATFORMID=macosx_x86
4133         OUTPATH=unxmacxi
4134         ;;
4135     x86_64)
4136         if test "$BITNESS_OVERRIDE" = 64; then
4137             CPUNAME=X86_64
4138             RTL_ARCH=X86_64
4139             PLATFORMID=macosx_x86_64
4140             OUTPATH=unxmacxx
4141         else
4142             CPUNAME=INTEL
4143             RTL_ARCH=x86
4144             PLATFORMID=macosx_x86
4145             OUTPATH=unxmacxi
4146         fi
4147         ;;
4148     *)
4149         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4150         ;;
4151     esac
4152     ;;
4154 dragonfly*)
4155     COM=GCC
4156     GUIBASE=unx
4157     OS=DRAGONFLY
4158     RTL_OS=DragonFly
4159     OUTPATH=unxdfly
4160     P_SEP=:
4162     case "$host_cpu" in
4163     i*86)
4164         CPUNAME=INTEL
4165         RTL_ARCH=x86
4166         PLATFORMID=dragonfly_x86
4167         ;;
4168     x86_64)
4169         CPUNAME=X86_64
4170         RTL_ARCH=X86_64
4171         PLATFORMID=dragonfly_x86_64
4172         ;;
4173     *)
4174         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4175         ;;
4176     esac
4177     ;;
4179 freebsd*)
4180     COM=GCC
4181     GUIBASE=unx
4182     RTL_OS=FreeBSD
4183     OS=FREEBSD
4184     OUTPATH=unxfbsd
4185     P_SEP=:
4187     case "$host_cpu" in
4188     i*86)
4189         CPUNAME=INTEL
4190         RTL_ARCH=x86
4191         PLATFORMID=freebsd_x86
4192         OUTPATH=unxfbsdi
4193         ;;
4194     x86_64)
4195         CPUNAME=X86_64
4196         RTL_ARCH=X86_64
4197         PLATFORMID=freebsd_x86_64
4198         ;;
4199     *)
4200         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4201         ;;
4202     esac
4203     ;;
4205 kfreebsd*)
4206     COM=GCC
4207     GUIBASE=unx
4208     OS=LINUX
4209     RTL_OS=kFreeBSD
4210     P_SEP=:
4212     case "$host_cpu" in
4214     i*86)
4215         CPUNAME=INTEL
4216         RTL_ARCH=x86
4217         PLATFORMID=kfreebsd_x86
4218         OUTPATH=unxkfgi6
4219         ;;
4220     x86_64)
4221         CPUNAME=X86_64
4222         RTL_ARCH=X86_64
4223         LIB64="lib64"
4224         PLATFORMID=kfreebsd_x86_64
4225         OUTPATH=unxkfgx6
4226         ;;
4227     *)
4228         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4229         ;;
4230     esac
4231     ;;
4233 linux-gnu*)
4234     COM=GCC
4235     GUIBASE=unx
4236     OS=LINUX
4237     RTL_OS=Linux
4238     P_SEP=:
4240     case "$host_cpu" in
4242     alpha)
4243         CPUNAME=AXP
4244         RTL_ARCH=ALPHA
4245         PLATFORMID=linux_alpha
4246         OUTPATH=unxlngaxp
4247         ;;
4248     arm*)
4249         CPUNAME=ARM
4250         EPM_FLAGS="-a arm"
4251         OUTPATH=unxlngr
4252         RTL_ARCH=ARM_EABI
4253         PLATFORMID=linux_arm_eabi
4254         case "$host_cpu" in
4255         arm*-linux)
4256             RTL_ARCH=ARM_OABI
4257             PLATFORMID=linux_arm_oabi
4258             ;;
4259         esac
4260         ;;
4261     hppa)
4262         CPUNAME=HPPA
4263         RTL_ARCH=HPPA
4264         EPM_FLAGS="-a hppa"
4265         PLATFORMID=linux_hppa
4266         OUTPATH=unxlnghppa
4267         ;;
4268     i*86)
4269         CPUNAME=INTEL
4270         RTL_ARCH=x86
4271         PLATFORMID=linux_x86
4272         OUTPATH=unxlngi6
4273         ;;
4274     ia64)
4275         CPUNAME=IA64
4276         RTL_ARCH=IA64
4277         PLATFORMID=linux_ia64
4278         OUTPATH=unxlnga
4279         ;;
4280     mips)
4281         CPUNAME=GODSON
4282         RTL_ARCH=MIPS_EB
4283         EPM_FLAGS="-a mips"
4284         PLATFORMID=linux_mips_eb
4285         OUTPATH=unxlngmips
4286         ;;
4287     mips64)
4288         CPUNAME=GODSON
4289         RTL_ARCH=MIPS_EB
4290         EPM_FLAGS="-a mips64"
4291         PLATFORMID=linux_mips_eb
4292         OUTPATH=unxlngmips
4293         ;;
4294     mips64el)
4295         CPUNAME=GODSON
4296         RTL_ARCH=MIPS_EL
4297         EPM_FLAGS="-a mips64el"
4298         PLATFORMID=linux_mips_el
4299         OUTPATH=unxlngmips
4300         ;;
4301     mipsel)
4302         CPUNAME=GODSON
4303         RTL_ARCH=MIPS_EL
4304         EPM_FLAGS="-a mipsel"
4305         PLATFORMID=linux_mips_el
4306         OUTPATH=unxlngmips
4307         ;;
4308     m68k)
4309         CPUNAME=M68K
4310         RTL_ARCH=M68K
4311         PLATFORMID=linux_m68k
4312         OUTPATH=unxlngm68k
4313         ;;
4314     powerpc)
4315         CPUNAME=POWERPC
4316         RTL_ARCH=PowerPC
4317         PLATFORMID=linux_powerpc
4318         OUTPATH=unxlngppc
4319         ;;
4320     powerpc64)
4321         CPUNAME=POWERPC64
4322         RTL_ARCH=PowerPC_64
4323         LIB64="lib64"
4324         PLATFORMID=linux_powerpc64
4325         OUTPATH=unxlngppc64
4326         ;;
4327     sparc)
4328         CPUNAME=SPARC
4329         RTL_ARCH=SPARC
4330         PLATFORMID=linux_sparc
4331         OUTPATH=unxlngs
4332         ;;
4333     s390)
4334         CPUNAME=S390
4335         RTL_ARCH=S390
4336         PLATFORMID=linux_s390
4337         OUTPATH=unxlngs390
4338         ;;
4339     s390x)
4340         CPUNAME=S390X
4341         RTL_ARCH=S390x
4342         LIB64="lib64"
4343         PLATFORMID=linux_s390x
4344         OUTPATH=unxlngs390x
4345         ;;
4346     x86_64)
4347         CPUNAME=X86_64
4348         RTL_ARCH=X86_64
4349         LIB64="lib64"
4350         PLATFORMID=linux_x86_64
4351         OUTPATH=unxlngx6
4352         ;;
4353     *)
4354         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4355         ;;
4356     esac
4357     ;;
4359 linux-android*)
4360     COM=GCC
4361     GUIBASE=not-used
4362     OS=ANDROID
4363     RTL_OS=Android
4364     P_SEP=:
4366     case "$host_cpu" in
4368     arm|armel)
4369         CPUNAME=ARM
4370         RTL_ARCH=ARM_EABI
4371         PLATFORMID=android_arm_eabi
4372         OUTPATH=unxandr
4373         ;;
4374     mips|mipsel)
4375         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4376         RTL_ARCH=MIPS_EL
4377         PLATFORMID=android_mips_el
4378         OUTPATH=unxandm
4379         ;;
4380     i*86)
4381         CPUNAME=INTEL
4382         RTL_ARCH=x86
4383         PLATFORMID=android_x86
4384         OUTPATH=unxandi
4385         ;;
4386     *)
4387         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4388         ;;
4389     esac
4390     ;;
4392 mingw*)
4393     COM=GCC
4394     GUIBASE=not-used
4395     OS=WNT
4396     RTL_OS=Windows
4397     P_SEP=:
4399     case "$host_cpu" in
4400     i*86|x86_64)
4401         if test "$BITNESS_OVERRIDE" = 64; then
4402             CPUNAME=X86_64
4403             RTL_ARCH=X86_84
4404             PLATFORMID=windows_x86_64
4405             OUTPATH=wntgccx$COMEX
4406             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgccx"
4407         else
4408             CPUNAME=INTEL
4409             RTL_ARCH=x86
4410             PLATFORMID=windows_x86
4411             OUTPATH=wntgcci$COMEX
4412             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgcci"
4413         fi
4414         ;;
4415     *)
4416         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4417         ;;
4418     esac
4419     ;;
4421 *netbsd*)
4423     COM=GCC
4424     GUIBASE=unx
4425     OS=NETBSD
4426     RTL_OS=NetBSD
4427     OUTPATH=unxnbsd
4428     P_SEP=:
4430     case "$host_cpu" in
4431     i*86)
4432         CPUNAME=INTEL
4433         RTL_ARCH=x86
4434         PLATFORMID=netbsd_x86
4435         ;;
4436     powerpc)
4437         CPUNAME=POWERPC
4438         RTL_ARCH=PowerPC
4439         PLATFORMID=netbsd_powerpc
4440         ;;
4441     sparc)
4442         CPUNAME=SPARC
4443         RTL_ARCH=SPARC
4444         PLATFORMID=netbsd_sparc
4445         ;;
4446     x86_64)
4447         CPUNAME=X86_64
4448         RTL_ARCH=X86_64
4449         PLATFORMID=netbsd_x86_64
4450         ;;
4451     *)
4452         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4453         ;;
4454     esac
4455     ;;
4457 openbsd*)
4458     COM=GCC
4459     GUIBASE=unx
4460     OS=OPENBSD
4461     RTL_OS=OpenBSD
4462     OUTPATH=unxobsd
4463     P_SEP=:
4465     case "$host_cpu" in
4466     i*86)
4467         CPUNAME=INTEL
4468         RTL_ARCH=x86
4469         PLATFORMID=openbsd_x86
4470         ;;
4471     x86_64)
4472         CPUNAME=X86_64
4473         RTL_ARCH=X86_64
4474         PLATFORMID=openbsd_x86_64
4475         ;;
4476     *)
4477         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4478         ;;
4479     esac
4480     SOLARINC="$SOLARINC -I/usr/local/include"
4481     ;;
4483 solaris*)
4485     COM=GCC
4486     GUIBASE=unx
4487     OS=SOLARIS
4488     RTL_OS=Solaris
4489     P_SEP=:
4491     case "$host_cpu" in
4492     i*86)
4493         CPUNAME=INTEL
4494         RTL_ARCH=x86
4495         PLATFORMID=solaris_x86
4496         OUTPATH=unxsogi
4497         ;;
4498     sparc)
4499         CPUNAME=SPARC
4500         RTL_ARCH=SPARC
4501         PLATFORMID=solaris_sparc
4502         OUTPATH=unxsogs
4503         ;;
4504     sparc64)
4505         CPUNAME=SPARC64
4506         RTL_ARCH=SPARC64
4507         PLATFORMID=solaris_sparc64
4508         OUTPATH=unxsogu
4509         ;;
4510     *)
4511         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4512         ;;
4513     esac
4514     SOLARINC="$SOLARINC -I/usr/local/include"
4515     ;;
4518     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4519     ;;
4520 esac
4522 if test "$enable_headless" = "yes"; then
4523     if test "$GUIBASE" != "unx"; then
4524         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --enable-headless])
4525     fi
4526     GUIBASE=not-used
4529 WORKDIR="${BUILDDIR}/workdir"
4530 INSTDIR="${BUILDDIR}/instdir"
4531 INSTROOT="${INSTDIR}${INSTROOTSUFFIX}"
4532 SOLARINC="-I. -I$SRC_ROOT/include $SOLARINC"
4533 AC_SUBST(COM)
4534 AC_SUBST(CPUNAME)
4535 AC_SUBST(RTL_OS)
4536 AC_SUBST(RTL_ARCH)
4537 AC_SUBST(EPM_FLAGS)
4538 AC_SUBST(GUIBASE)
4539 AC_SUBST([INSTDIR])
4540 AC_SUBST([INSTROOT])
4541 AC_SUBST(OS)
4542 AC_SUBST(OUTPATH)
4543 AC_SUBST(P_SEP)
4544 AC_SUBST(WORKDIR)
4545 AC_SUBST(PLATFORMID)
4546 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4548 dnl ===================================================================
4549 dnl Test which package format to use
4550 dnl ===================================================================
4551 AC_MSG_CHECKING([which package format to use])
4552 if test -n "$with_package_format" -a "$with_package_format" != no; then
4553     for i in $with_package_format; do
4554         case "$i" in
4555         aix | bsd | deb | osx | pkg | rpm | native | portable | archive | dmg | installed | msi)
4556             ;;
4557         *)
4558             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4559 aix - AIX software distribution
4560 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4561 deb - Debian software distribution
4562 osx - MacOS X software distribution
4563 pkg - Solaris software distribution
4564 rpm - RedHat software distribution
4565 native - "Native" software distribution for the platform
4566 portable - Portable software distribution
4568 LibreOffice additionally supports:
4569 archive - .tar.gz or .zip
4570 dmg - Mac OS X .dmg
4571 installed - installation tree
4572 msi - Windows .msi
4573         ])
4574             ;;
4575         esac
4576     done
4577     PKGFORMAT="$with_package_format"
4578     AC_MSG_RESULT([$PKGFORMAT])
4579 else
4580     PKGFORMAT=
4581     AC_MSG_RESULT([none])
4583 AC_SUBST(PKGFORMAT)
4585 dnl ===================================================================
4586 dnl Set up a different compiler to produce tools to run on the build
4587 dnl machine when doing cross-compilation
4588 dnl ===================================================================
4590 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4591 if test "$cross_compiling" = "yes"; then
4592     AC_MSG_CHECKING([for BUILD platform configuration])
4593     echo
4594     rm -rf CONF-FOR-BUILD config_build.mk
4595     mkdir CONF-FOR-BUILD
4596     # Here must be listed all files needed when running the configure script. In particular, also
4597     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4598     # keep them in the same order as there.
4599     (cd $SRC_ROOT && tar cf - \
4600         config.guess \
4601         bin/get_config_variables \
4602         solenv/bin/getcompver.awk \
4603         solenv/inc/langlist.mk \
4604         config_host.mk.in \
4605         Makefile.in \
4606         lo.xcent.in \
4607         instsetoo_native/util/openoffice.lst.in \
4608         config_host/*.in \
4609         sysui/desktop/macosx/Info.plist.in \
4610         ios/lo.xcconfig.in) \
4611     | (cd CONF-FOR-BUILD && tar xf -)
4612     cp configure CONF-FOR-BUILD
4613     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4614     (
4615     unset COM GUIBASE OS CPUNAME
4616     unset CC CXX SYSBASE CFLAGS
4617     unset AR NM OBJDUMP PKG_CONFIG RANLIB STRIP
4618     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4619     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
4620     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4621     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4622     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4623     cd CONF-FOR-BUILD
4624     sub_conf_opts=""
4625     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4626     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4627     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4628     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4629     test -n "$with_system_boost_for_build" && sub_conf_opts="$sub_conf_opts --with-system-boost"
4630     test -n "$with_system_cppunit_for_build" && sub_conf_opts="$sub_conf_opts --with-system-cppunit"
4631     test -n "$with_system_expat_for_build" && sub_conf_opts="$sub_conf_opts --with-system-expat"
4632     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4633     test -n "$with_system_libxml_for_build" && sub_conf_opts="$sub_conf_opts --with-system-libxml"
4634     # we need the msi build tools on mingw if we are creating the
4635     # installation set
4636     if test "$WITH_MINGW" = "yes"; then
4637         enable_winegcc_for_build=
4638         for pkgformat in $PKGFORMAT; do
4639             case "$pkgformat" in
4640             msi|native) enable_winegcc_for_build=yes ;;
4641             esac
4642         done
4643         test -n "$enable_winegcc_for_build" && sub_conf_opts="$sub_conf_opts --enable-winegcc"
4644     fi
4645     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4646     # Don't bother having configure look for stuff not needed for the build platform anyway
4647     ./configure \
4648         --disable-graphite \
4649         --disable-pdfimport \
4650         --disable-postgresql-sdbc \
4651         --with-parallelism="$with_parallelism" \
4652         --without-doxygen \
4653         --without-java \
4654         $sub_conf_opts \
4655         --srcdir=$srcdir \
4656         2>&1 | sed -e 's/^/    /'
4657     test -f ./config_host.mk 2>/dev/null || exit
4658     cp config_host.mk ../config_build.mk
4659     mv config.log ../config.Build.log
4660     mkdir -p ../config_build
4661     mv config_host/*.h ../config_build
4662     . ./bin/get_config_variables CC CXX INSTDIR INSTROOT LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER OS PATH SDKDIRNAME SYSTEM_LIBXSLT WORKDIR
4664     for V in CC CXX LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER OS SDKDIRNAME SYSTEM_LIBXSLT; do
4665         VV='$'$V
4666         VV=`eval "echo $VV"`
4667         if test -n "$VV"; then
4668             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4669             echo "$line" >>build-config
4670         fi
4671     done
4673     for V in INSTDIR INSTROOT WORKDIR; do
4674         VV='$'$V
4675         VV=`eval "echo $VV"`
4676         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4677         if test -n "$VV"; then
4678             line="${V}_FOR_BUILD='$VV'"
4679             echo "$line" >>build-config
4680         fi
4681     done
4683     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4684     echo "$line" >>build-config
4686     )
4687     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4688     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])
4689     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4690              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4692     eval `cat CONF-FOR-BUILD/build-config`
4694     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4696     rm -rf CONF-FOR-BUILD
4697 else
4698     OS_FOR_BUILD="$OS"
4699     CC_FOR_BUILD="$CC"
4700     CXX_FOR_BUILD="$CXX"
4701     INSTDIR_FOR_BUILD="$INSTDIR"
4702     INSTROOT_FOR_BUILD="$INSTROOT"
4703     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4704     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4705     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4706     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4707     WORKDIR_FOR_BUILD="$WORKDIR"
4709 AC_SUBST(OS_FOR_BUILD)
4710 AC_SUBST(INSTDIR_FOR_BUILD)
4711 AC_SUBST(INSTROOT_FOR_BUILD)
4712 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4713 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4714 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4715 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4716 AC_SUBST(WORKDIR_FOR_BUILD)
4718 dnl ===================================================================
4719 dnl Check for syslog header
4720 dnl ===================================================================
4721 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4723 dnl ===================================================================
4724 dnl Set the ENABLE_CRASHDUMP variable.
4725 dnl ===================================================================
4726 AC_MSG_CHECKING([whether to enable crashdump feature])
4727 if test "$enable_crashdump" = "yes"; then
4728     ENABLE_CRASHDUMP="TRUE"
4729     BUILD_TYPE="$BUILD_TYPE CRASHREP"
4730     AC_MSG_RESULT([yes])
4731 else
4732     ENABLE_CRASHDUMP=""
4733     AC_MSG_RESULT([no])
4735 AC_SUBST(ENABLE_CRASHDUMP)
4738 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4739 dnl ===================================================================
4740 AC_MSG_CHECKING([whether to turn warnings to errors])
4741 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4742     ENABLE_WERROR="TRUE"
4743     AC_MSG_RESULT([yes])
4744 else
4745     AC_MSG_RESULT([no])
4747 AC_SUBST(ENABLE_WERROR)
4749 dnl Set the ASSERT_ALWAYS_ABORT variable. (Activate --enable-assert-always-abort)
4750 dnl ===================================================================
4751 AC_MSG_CHECKING([whether to have assert to abort in release code])
4752 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4753     ASSERT_ALWAYS_ABORT="TRUE"
4754     AC_MSG_RESULT([yes])
4755 else
4756     ASSERT_ALWAYS_ABORT="FALSE"
4757     AC_MSG_RESULT([no])
4759 AC_SUBST(ASSERT_ALWAYS_ABORT)
4761 # Determine whether to use ooenv for the instdir installation
4762 # ===================================================================
4763 if test $_os != "WINNT" -a $_os != "Darwin"; then
4764     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4765     if test "$enable_ooenv" = "no"; then
4766         AC_MSG_RESULT([no])
4767     else
4768         ENABLE_OOENV="TRUE"
4769         AC_MSG_RESULT([yes])
4770     fi
4772 AC_SUBST(ENABLE_OOENV)
4774 if test "$enable_headless" = "yes"; then
4775     # be sure to do not mess with uneeded stuff
4776     test_randr=no
4777     test_xrender=no
4778     test_cups=no
4779     test_dbus=no
4780     test_fontconfig=yes
4781     test_gtk=no
4782     build_gstreamer=no
4783     build_gstreamer_0_10=no
4784     test_tde=no
4785     test_kde=no
4786     test_kde4=no
4787     enable_cairo_canvas=no
4788     enable_gnome_vfs=no
4791 dnl ===================================================================
4792 dnl check for cups support
4793 dnl ===================================================================
4794 ENABLE_CUPS=""
4796 if test "$enable_cups" = "no"; then
4797     test_cups=no
4800 AC_MSG_CHECKING([whether to enable CUPS support])
4801 if test "$test_cups" = "yes"; then
4802     ENABLE_CUPS="TRUE"
4803     AC_MSG_RESULT([yes])
4805     AC_MSG_CHECKING([whether cups support is present])
4806     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4807     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4808     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4809         AC_MSG_ERROR([Could not find CUPS. Install libcupsys2-dev or cups-devel.])
4810     fi
4812 else
4813     AC_MSG_RESULT([no])
4816 AC_SUBST(ENABLE_CUPS)
4818 # fontconfig checks
4819 if test "$test_fontconfig" = "yes"; then
4820     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4821     SYSTEM_FONTCONFIG=TRUE
4823 AC_SUBST(FONTCONFIG_CFLAGS)
4824 AC_SUBST(FONTCONFIG_LIBS)
4825 AC_SUBST([SYSTEM_FONTCONFIG])
4827 dnl whether to find & fetch external tarballs?
4828 dnl ===================================================================
4829 if test -z "$TARFILE_LOCATION"; then
4830     if test -d "$SRC_ROOT/src" ; then
4831         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4832         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4833     fi
4834     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4835 else
4836     AbsolutePath "$TARFILE_LOCATION"
4837     TARFILE_LOCATION="${absolute_path}"
4839 AC_SUBST(TARFILE_LOCATION)
4841 AC_MSG_CHECKING([whether we want to fetch tarballs])
4842 if test "$enable_fetch_external" != "no"; then
4843     if test "$with_all_tarballs" = "yes"; then
4844         AC_MSG_RESULT(["yes, all of them"])
4845         DO_FETCH_TARBALLS="ALL"
4846     else
4847         AC_MSG_RESULT(["yes, if we use them"])
4848         DO_FETCH_TARBALLS="TRUE"
4849     fi
4850 else
4851     AC_MSG_RESULT([no])
4852     DO_FETCH_TARBALLS=
4854 AC_SUBST(DO_FETCH_TARBALLS)
4856 AC_MSG_CHECKING([whether to build help])
4857 HELP_COMMON_ONLY=FALSE
4858 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4859     BUILD_TYPE="$BUILD_TYPE HELP"
4860     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4861     if test "$with_help" = "common" ; then
4862         HELP_COMMON_ONLY=TRUE
4863         AC_MSG_RESULT([common only])
4864     else
4865         SCPDEFS="$SCPDEFS -DWITH_HELP"
4866         AC_MSG_RESULT([yes])
4867     fi
4868 else
4869     AC_MSG_RESULT([no])
4871 AC_SUBST(HELP_COMMON_ONLY)
4873 dnl Test whether to include MySpell dictionaries
4874 dnl ===================================================================
4875 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4876 if test "$with_myspell_dicts" = "yes"; then
4877     AC_MSG_RESULT([yes])
4878     WITH_MYSPELL_DICTS=TRUE
4879     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4880     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4881 else
4882     AC_MSG_RESULT([no])
4883     WITH_MYSPELL_DICTS=
4885 AC_SUBST(WITH_MYSPELL_DICTS)
4887 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4888 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4889     if test "$with_system_dicts" = yes; then
4890         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4891     fi
4892     with_system_dicts=no
4895 AC_MSG_CHECKING([whether to use dicts from external paths])
4896 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4897     AC_MSG_RESULT([yes])
4898     SYSTEM_DICTS=TRUE
4899     AC_MSG_CHECKING([for spelling dictionary directory])
4900     if test -n "$with_external_dict_dir"; then
4901         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4902     else
4903         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4904         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4905             DICT_SYSTEM_DIR=file:///usr/share/myspell
4906         fi
4907     fi
4908     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4909     AC_MSG_CHECKING([for hyphenation patterns directory])
4910     if test -n "$with_external_hyph_dir"; then
4911         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4912     else
4913         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4914     fi
4915     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4916     AC_MSG_CHECKING([for thesaurus directory])
4917     if test -n "$with_external_thes_dir"; then
4918         THES_SYSTEM_DIR=file://$with_external_thes_dir
4919     else
4920         THES_SYSTEM_DIR=file:///usr/share/mythes
4921     fi
4922     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4923 else
4924     AC_MSG_RESULT([no])
4925     SYSTEM_DICTS=
4927 AC_SUBST(SYSTEM_DICTS)
4928 AC_SUBST(DICT_SYSTEM_DIR)
4929 AC_SUBST(HYPH_SYSTEM_DIR)
4930 AC_SUBST(THES_SYSTEM_DIR)
4932 dnl ===================================================================
4933 AC_MSG_CHECKING([whether to enable pch feature])
4934 if test -n "$enable_pch" && test "$enable_pch" != "no"; then
4935     if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
4936         ENABLE_PCH="TRUE"
4937         AC_MSG_RESULT([yes])
4938     elif test "$GCC" = "yes"; then
4939         ENABLE_PCH="TRUE"
4940         AC_MSG_RESULT([yes])
4941     else
4942         ENABLE_PCH=""
4943         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4944     fi
4945 else
4946     ENABLE_PCH=""
4947     AC_MSG_RESULT([no])
4949 AC_SUBST(ENABLE_PCH)
4951 dnl ===================================================================
4952 dnl Search all the common names for GNU make
4953 dnl ===================================================================
4954 AC_MSG_CHECKING([for GNU make])
4956 # try to use our own make if it is available and GNUMAKE was not already defined
4957 if test -z "$GNUMAKE"; then
4958     if test -x "/opt/lo/bin/make"; then
4959         GNUMAKE="/opt/lo/bin/make"
4960     fi
4963 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
4964     if test -n "$a"; then
4965         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
4966         if test $? -eq 0;  then
4967             GNUMAKE=`which $a`
4968             break
4969         fi
4970     fi
4971 done
4972 AC_MSG_RESULT($GNUMAKE)
4973 if test -z "$GNUMAKE"; then
4974     AC_MSG_ERROR([not found. install GNU make.])
4977 TAB=`printf '\t'`
4979 AC_MSG_CHECKING([the GNU make version])
4980 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4981 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4982 if test "$_make_longver" -ge "038200"; then
4983     AC_MSG_RESULT([$GNUMAKE $_make_version])
4985 elif test "$_make_longver" -ge "038100"; then
4986     if test "$build_os" = "cygwin"; then
4987         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4988     fi
4989     AC_MSG_RESULT([$GNUMAKE $_make_version])
4991     dnl ===================================================================
4992     dnl Search all the common names for sha1sum
4993     dnl ===================================================================
4994     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4995     if test -z "$SHA1SUM"; then
4996         AC_MSG_ERROR([install the approproate SHA-1 checksumming program for this OS])
4997     elif test "$SHA1SUM" = "openssl"; then
4998         SHA1SUM="openssl sha1"
4999     fi
5000     AC_MSG_CHECKING([for GNU make bug 20033])
5001     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5002     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5003 A := \$(wildcard *.a)
5005 .PHONY: all
5006 all: \$(A:.a=.b)
5007 <TAB>@echo survived bug20033.
5009 .PHONY: setup
5010 setup:
5011 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5013 define d1
5014 @echo lala \$(1)
5015 @sleep 1
5016 endef
5018 define d2
5019 @echo tyty \$(1)
5020 @sleep 1
5021 endef
5023 %.b : %.a
5024 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5025 <TAB>\$(call d1,\$(CHECKSUM)),\
5026 <TAB>\$(call d2,\$(CHECKSUM)))
5028     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5029         no_parallelism_make="YES"
5030         AC_MSG_RESULT([yes, disable parallelism])
5031     else
5032         AC_MSG_RESULT([no, keep parallelism enabled])
5033     fi
5034     rm -rf $TESTGMAKEBUG20033
5035 else
5036     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5039 # find if gnumake support file function
5040 AC_MSG_CHECKING([whether GNU make supports the 'file' function])
5041 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5042 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5043 \$(file >test.txt,Success )
5045 .PHONY: all
5046 all:
5047 <TAB>@cat test.txt
5050 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5051 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5052     HAVE_GNUMAKE_FILE_FUNC=TRUE
5053     AC_MSG_RESULT([yes])
5054 else
5055     AC_MSG_RESULT([no])
5057 rm -rf $TESTGMAKEFILEFUNC
5058 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5059 AC_SUBST(GNUMAKE)
5061 _make_ver_check=`$GNUMAKE --version | grep LibreOffice`
5062 STALE_MAKE=
5063 make_warning=
5064 if test "$_make_ver_check" = ""; then
5065    STALE_MAKE=TRUE
5068 HAVE_LD_HASH_STYLE=FALSE
5069 WITH_LINKER_HASH_STYLE=
5070 AC_MSG_CHECKING( for --hash-style gcc linker support )
5071 if test "$GCC" = "yes"; then
5072     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5073         hash_styles="gnu sysv"
5074     elif test "$with_linker_hash_style" = "no"; then
5075         hash_styles=
5076     else
5077         hash_styles="$with_linker_hash_style"
5078     fi
5080     for hash_style in $hash_styles; do
5081         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5082         hash_style_ldflags_save=$LDFLAGS
5083         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5085         AC_LINK_IFELSE([AC_LANG_PROGRAM(
5086             [
5087 #include <stdio.h>
5088             ],[
5089 printf ("");
5090             ])],
5091             [ if ./conftest$EXEEXT; then
5092                   HAVE_LD_HASH_STYLE=TRUE
5093                   WITH_LINKER_HASH_STYLE=$hash_style
5094               fi],
5095             [HAVE_LD_HASH_STYLE=FALSE])
5096         LDFLAGS=$hash_style_ldflags_save
5097     done
5099     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5100         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5101     else
5102         AC_MSG_RESULT( no )
5103     fi
5104     LDFLAGS=$hash_style_ldflags_save
5105 else
5106     AC_MSG_RESULT( no )
5108 AC_SUBST(HAVE_LD_HASH_STYLE)
5109 AC_SUBST(WITH_LINKER_HASH_STYLE)
5111 dnl ===================================================================
5112 dnl Check whether there's a Perl version available.
5113 dnl ===================================================================
5114 if test -z "$with_perl_home"; then
5115     AC_PATH_PROG(PERL, perl)
5116 else
5117     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5118     _perl_path="$with_perl_home/bin/perl"
5119     if test -x "$_perl_path"; then
5120         PERL=$_perl_path
5121     else
5122         AC_MSG_ERROR([$_perl_path not found])
5123     fi
5126 dnl ===================================================================
5127 dnl Testing for Perl version 5 or greater.
5128 dnl $] is the Perl version variable, it is returned as an integer
5129 dnl ===================================================================
5130 if test "$PERL"; then
5131     AC_MSG_CHECKING([the Perl version])
5132     ${PERL} -e "exit($]);"
5133     _perl_version=$?
5134     if test "$_perl_version" -lt 5; then
5135         AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
5136     fi
5137     AC_MSG_RESULT([checked (perl $_perl_version)])
5138 else
5139     AC_MSG_ERROR([Perl not found, install version 5 of Perl])
5142 dnl ===================================================================
5143 dnl Testing for required Perl modules
5144 dnl ===================================================================
5146 AC_MSG_CHECKING([for required Perl modules])
5147 if `$PERL -e 'use Archive::Zip; use Cwd; use Digest::MD5'>/dev/null 2>&1`; then
5148     AC_MSG_RESULT([all modules found])
5149 else
5150     AC_MSG_RESULT([failed to find some modules])
5151     # Find out which modules are missing.
5152     missing_perl_modules=
5153     if ! `$PERL -e 'use Archive::Zip;'>/dev/null 2>&1`; then
5154        missing_perl_modules=Archive::Zip
5155     fi
5156     if ! `$PERL -e 'use Cwd;'>/dev/null 2>&1`; then
5157        missing_perl_modules="$missing_perl_modules Cwd"
5158     fi
5159     if ! `$PERL -e 'use Digest::MD5;'>/dev/null 2>&1`; then
5160        missing_perl_modules="$missing_perl_modules Digest::MD5"
5161     fi
5162        AC_MSG_ERROR([
5163     The missing Perl modules are: $missing_perl_modules
5164     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5167 dnl ===================================================================
5168 dnl Check for pkg-config
5169 dnl ===================================================================
5170 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5171     PKG_PROG_PKG_CONFIG
5174 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5176     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5177     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5178     # explicitly. Or put /path/to/compiler in PATH yourself.
5180     AC_CHECK_TOOL(AR,ar)
5181     AC_CHECK_TOOL(NM,nm)
5182     AC_CHECK_TOOL(OBJDUMP,objdump)
5183     AC_CHECK_TOOL(RANLIB,ranlib)
5184     AC_CHECK_TOOL(STRIP,strip)
5185     if test "$_os" = "WINNT"; then
5186         AC_CHECK_TOOL(DLLTOOL,dlltool)
5187         AC_CHECK_TOOL(WINDRES,windres)
5188     fi
5190 AC_SUBST(AR)
5191 AC_SUBST(DLLTOOL)
5192 AC_SUBST(NM)
5193 AC_SUBST(OBJDUMP)
5194 AC_SUBST(PKG_CONFIG)
5195 AC_SUBST(RANLIB)
5196 AC_SUBST(STRIP)
5197 AC_SUBST(WINDRES)
5199 dnl ===================================================================
5200 dnl pkg-config checks on Mac OS X
5201 dnl ===================================================================
5203 if test $_os = Darwin; then
5204     AC_MSG_CHECKING([for bogus pkg-config])
5205     if test -n "$PKG_CONFIG"; then
5206         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5207             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5208         else
5209             if test "$enable_bogus_pkg_config" = "yes"; then
5210                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5211             else
5212                 AC_MSG_ERROR([yes, from unknown origin. This *will* break the build. Please remove or hide $PKG_CONFIG])
5213             fi
5214         fi
5215     else
5216         AC_MSG_RESULT([no, good])
5217     fi
5220 find_csc()
5222     # Return value: $csctest
5224     unset csctest
5226     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5227     if test -n "$regvalue"; then
5228         csctest=$regvalue
5229         return
5230     fi
5233 find_al()
5235     # Return value: $altest
5237     unset altest
5239     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5240         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5241         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5242             altest=$regvalue
5243             return
5244         fi
5245     done
5248 find_dotnetsdk()
5250     # Return value: $frametest (that's a silly name...)
5252     unset frametest
5254     for ver in 1.1 2.0; do
5255         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
5256         if test -n "$regvalue"; then
5257             frametest=$regvalue
5258             return
5259         fi
5260     done
5263 find_winsdk_version()
5265     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5266     # Return value: $winsdktest
5268     unset winsdktest
5270     # Why we look for them in this particular order I don't know. But OTOH I
5271     case "$1" in
5272     6.0*|7.*)
5273         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5274         if test -n "$regvalue"; then
5275             winsdktest=$regvalue
5276             return
5277         fi
5278         ;;
5279     8.*)
5280         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5281         if test -n "$regvalue"; then
5282             winsdktest=$regvalue
5283             return
5284         fi
5285         ;;
5286     esac
5289 find_winsdk()
5291     # Args: $1 (optional) : list of acceptable SDK versions
5292     # Return value: $winsdktest
5294     unset winsdktest
5296     if test -n "$1"; then
5297         sdkversions=$1
5298     else
5299         sdkversions="$WINDOWS_SDK_ACCEPTABLE_VERSIONS"
5300     fi
5302     for ver in $sdkversions; do
5303         find_winsdk_version $ver
5304         if test -n "$winsdktest"; then
5305             return
5306         fi
5307     done
5310 find_msms()
5312     for ver in 10.0 11.0; do
5313         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5314         if test -n "$regvalue"; then
5315             if test -e "$regvalue/Microsoft_VC${VCVER}_CRT_x86.msm"; then
5316                 msmdir=$regvalue
5317                 break
5318             fi
5319         fi
5320     done
5321     if test -z "$msmdir"; then
5322         AC_MSG_NOTICE([no registry entry for Merge Module directory - trying "${COMMONPROGRAMFILES}/Merge Modules/"])
5323         msmdir="${COMMONPROGRAMFILES}/Merge Modules/"
5324     fi
5325     msmdir=`cygpath -m "$msmdir"`
5326     if test -z "$msmdir"; then
5327         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5328             AC_MSG_ERROR([Merge modules not found in $msmdir])
5329         else
5330             AC_MSG_WARN([Merge modules not found in $msmdir])
5331             msmdir=""
5332         fi
5333     fi
5336 find_msvc_x64_dlls()
5338     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5339     msvcdlls="msvcp${VCVER}.dll msvcr${VCVER}.dll"
5340     for dll in $msvcdlls; do
5341         if ! test -f "$msvcdllpath/$dll"; then
5342             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5343         fi
5344     done
5347 if test "$build_os" = "cygwin"; then
5348     dnl Check midl.exe
5349     AC_MSG_CHECKING([for midl.exe])
5351     find_winsdk
5352     if test -f "$winsdktest/Bin/midl.exe"; then
5353         MIDL_PATH="$winsdktest/Bin"
5354     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5355         MIDL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5356     fi
5357     if test ! -f "$MIDL_PATH/midl.exe"; then
5358         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5359     else
5360         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5361     fi
5363     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5364     MIDL_PATH=`cygpath -d "$MIDL_PATH"`
5365     MIDL_PATH=`cygpath -u "$MIDL_PATH"`
5367     dnl Check csc.exe
5368     AC_MSG_CHECKING([for csc.exe])
5369     find_csc
5370     if test -f "$csctest/csc.exe"; then
5371         CSC_PATH="$csctest"
5372     fi
5373     if test ! -f "$CSC_PATH/csc.exe"; then
5374         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5375     else
5376         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5377     fi
5379     CSC_PATH=`cygpath -d "$CSC_PATH"`
5380     CSC_PATH=`cygpath -u "$CSC_PATH"`
5382     dnl Check al.exe
5383     AC_MSG_CHECKING([for al.exe])
5384     find_winsdk
5385     if test -f "$winsdktest/Bin/al.exe"; then
5386         AL_PATH="$winsdktest/Bin"
5387     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5388         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5389     fi
5391     if test -z "$AL_PATH"; then
5392         find_al
5393         if test -f "$altest/bin/al.exe"; then
5394             AL_PATH="$altest/bin"
5395         elif test -f "$altest/al.exe"; then
5396             AL_PATH="$altest"
5397         fi
5398     fi
5399     if test ! -f "$AL_PATH/al.exe"; then
5400         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5401     else
5402         AC_MSG_RESULT([$AL_PATH/al.exe])
5403     fi
5405     AL_PATH=`cygpath -d "$AL_PATH"`
5406     AL_PATH=`cygpath -u "$AL_PATH"`
5408     dnl Check mscoree.lib / .NET Framework dir
5409     AC_MSG_CHECKING(.NET Framework)
5410     find_dotnetsdk
5411     if test -f "$frametest/lib/mscoree.lib"; then
5412         DOTNET_FRAMEWORK_HOME="$frametest"
5413     else
5414         find_winsdk
5415         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/win8/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5416             DOTNET_FRAMEWORK_HOME="$winsdktest"
5417         fi
5418     fi
5420     if test ! -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib" -a ! -f "$DOTNET_FRAMEWORK_HOME/lib/win8/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5421         AC_MSG_ERROR([mscoree.lib (.NET Framework) not found])
5422     fi
5423     AC_MSG_RESULT(found)
5425     PathFormat "$MIDL_PATH"
5426     MIDL_PATH="$formatted_path"
5428     PathFormat "$AL_PATH"
5429     AL_PATH="$formatted_path"
5431     PathFormat "$DOTNET_FRAMEWORK_HOME"
5432     DOTNET_FRAMEWORK_HOME="$formatted_path"
5434     PathFormat "$CSC_PATH"
5435     CSC_PATH="$formatted_path"
5438 dnl ===================================================================
5439 dnl Check if stdc headers are available excluding MSVC.
5440 dnl ===================================================================
5441 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5442     AC_HEADER_STDC
5445 dnl ===================================================================
5446 dnl Testing for C++ compiler and version...
5447 dnl ===================================================================
5449 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5450     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5451     save_CXXFLAGS=$CXXFLAGS
5452     AC_PROG_CXX
5453     CXXFLAGS=$save_CXXFLAGS
5454 else
5455     if test -n "$CC" -a -z "$CXX"; then
5456         CXX="$CC"
5457     fi
5460 dnl check for GNU C++ compiler version
5461 if test "$GXX" = "yes"; then
5462     AC_MSG_CHECKING([the GNU C++ compiler version])
5464     _gpp_version=`$CXX -dumpversion`
5465     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5467     if test "$_gpp_majmin" -lt "401"; then
5468         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5469     else
5470         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5471     fi
5473     dnl see https://code.google.com/p/android/issues/detail?id=41770
5474     if test "$_gpp_majmin" -ge "401"; then
5475         glibcxx_threads=no
5476         AC_LANG_PUSH([C++])
5477         AC_REQUIRE_CPP
5478         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5479         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5480             #include <bits/c++config.h>]],[[
5481             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5482             && !defined(_GLIBCXX__PTHREADS) \
5483             && !defined(_GLIBCXX_HAS_GTHREADS)
5484             choke me
5485             #endif
5486         ]])],[AC_MSG_RESULT([yes])
5487         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5488         AC_LANG_POP([C++])
5489         if test $glibcxx_threads = yes; then
5490               BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5491         fi
5492      fi
5494 AC_SUBST(BOOST_CXXFLAGS)
5497 # prefx CXX with ccache if needed
5499 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5500     if test "$CCACHE" != ""; then
5501         AC_MSG_CHECKING([whether $CXX is already ccached])
5502         AC_LANG_PUSH([C++])
5503         save_CXXFLAGS=$CXXFLAGS
5504         CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5505         dnl an empty program will do, we're checking the compiler flags
5506         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5507                           [use_ccache=yes], [use_ccache=no])
5508         if test $use_ccache = yes; then
5509             AC_MSG_RESULT([yes])
5510         else
5511             CXX="$CCACHE $CXX"
5512             AC_MSG_RESULT([no])
5513         fi
5514         CXXFLAGS=$save_CXXFLAGS
5515         AC_LANG_POP([C++])
5516     fi
5519 dnl ===================================================================
5520 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5521 dnl ===================================================================
5523 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5524     AC_PROG_CXXCPP
5526     dnl Check whether there's a C pre-processor.
5527     dnl ===================================================================
5528     dnl When using SunStudio compiler, there is a bug with the cc
5529     dnl preprocessor, so use CC preprocessor as the cc preprocessor
5530     dnl See Issuezilla #445.
5531     dnl ===================================================================
5532     if test "$_os" = "SunOS"; then
5533         CPP=$CXXCPP
5534     else
5535         AC_PROG_CPP
5536     fi
5540 dnl ===================================================================
5541 dnl Find integral type sizes and alignments
5542 dnl ===================================================================
5544 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5546     AC_CHECK_SIZEOF(long)
5547     AC_CHECK_SIZEOF(short)
5548     AC_CHECK_SIZEOF(int)
5549     AC_CHECK_SIZEOF(long long)
5550     AC_CHECK_SIZEOF(double)
5551     AC_CHECK_SIZEOF(void*)
5553     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5554     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5555     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5556     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5557     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5559     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5560     m4_pattern_allow([AC_CHECK_ALIGNOF])
5561     m4_ifdef([AC_CHECK_ALIGNOF],
5562         [
5563             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5564             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5565             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5566             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5567         ],
5568         [
5569             case "$_os-$host_cpu" in
5570             Linux-i686)
5571                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5572                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5573                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5574                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5575                 ;;
5576             Linux-x86_64)
5577                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5578                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5579                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5580                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5581                 ;;
5582             *)
5583                 if test -z "$ac_cv_alignof_short" -o \
5584                         -z "$ac_cv_alignof_int" -o \
5585                         -z "$ac_cv_alignof_long" -o \
5586                         -z "$ac_cv_alignof_double"; then
5587                    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.])
5588                 fi
5589                 ;;
5590             esac
5591         ])
5593     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5594     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5595     if test $ac_cv_sizeof_long -eq 8; then
5596         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5597     elif test $ac_cv_sizeof_double -eq 8; then
5598         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5599     else
5600         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5601     fi
5603     dnl Check for large file support
5604     AC_SYS_LARGEFILE
5605     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5606         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5607     fi
5608     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5609         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5610     fi
5611 else
5612     # Hardcode for MSVC
5613     SAL_TYPES_SIZEOFSHORT=2
5614     SAL_TYPES_SIZEOFINT=4
5615     SAL_TYPES_SIZEOFLONG=4
5616     SAL_TYPES_SIZEOFLONGLONG=8
5617     if test "$BITNESS_OVERRIDE" = ""; then
5618         SAL_TYPES_SIZEOFPOINTER=4
5619     else
5620         SAL_TYPES_SIZEOFPOINTER=8
5621     fi
5622     SAL_TYPES_ALIGNMENT2=2
5623     SAL_TYPES_ALIGNMENT4=4
5624     SAL_TYPES_ALIGNMENT8=8
5625     LFS_CFLAGS=''
5627 AC_SUBST(LFS_CFLAGS)
5629 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5630 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5631 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5632 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5633 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5634 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5635 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5636 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5638 dnl ===================================================================
5639 dnl Check whether to enable runtime optimizations
5640 dnl ===================================================================
5641 ENABLE_RUNTIME_OPTIMIZATIONS=
5642 AC_MSG_CHECKING([whether to enable runtime optimizations])
5643 if test -z "$enable_runtime_optimizations"; then
5644     for i in $CC; do
5645         case $i in
5646         -fsanitize=address)
5647             enable_runtime_optimizations=no
5648             break
5649             ;;
5650         esac
5651     done
5653 if test "$enable_runtime_optimizations" != no; then
5654     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5655     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5656     AC_MSG_RESULT([yes])
5657 else
5658     AC_MSG_RESULT([no])
5660 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5662 dnl ===================================================================
5663 dnl Check if valgrind headers are available
5664 dnl ===================================================================
5665 ENABLE_VALGRIND=
5666 if test "$cross_compiling" != yes; then
5667     prev_cppflags=$CPPFLAGS
5668     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5669     # or where does it come from?
5670     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5671     AC_CHECK_HEADER([valgrind/valgrind.h],
5672         [ENABLE_VALGRIND=TRUE])
5673     CPPFLAGS=$prev_cppflags
5675 AC_SUBST([ENABLE_VALGRIND])
5676 if test -z "$ENABLE_VALGRIND"; then
5677     VALGRIND_CFLAGS=
5679 AC_SUBST([VALGRIND_CFLAGS])
5682 dnl ===================================================================
5683 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5684 dnl ===================================================================
5686 # We need at least the sys/sdt.h include header.
5687 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5688 if test "$SDT_H_FOUND" = "TRUE"; then
5689   # Found sys/sdt.h header, now make sure the c++ compiler works.
5690   # Old g++ versions had problems with probes in constructors/destructors.
5691   AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5692   AC_LANG_PUSH([C++])
5693   AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5694     #include <sys/sdt.h>
5695     class ProbeClass
5696     {
5697     private:
5698       int& ref;
5699       const char *name;
5701     public:
5702       ProbeClass(int& v, const char *n) : ref(v), name(n)
5703       {
5704         DTRACE_PROBE2(_test_, cons, name, ref);
5705       }
5707       void method(int min)
5708       {
5709         DTRACE_PROBE3(_test_, meth, name, ref, min);
5710         ref -= min;
5711       }
5713       ~ProbeClass()
5714       {
5715         DTRACE_PROBE2(_test_, dest, name, ref);
5716       }
5717     };
5718   ]],[[
5719     int i = 64;
5720     DTRACE_PROBE1(_test_, call, i);
5721     ProbeClass inst = ProbeClass(i, "call");
5722     inst.method(24);
5723   ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5724         [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5725   AC_LANG_POP([C++])
5727 AC_CONFIG_HEADERS([config_host/config_probes.h])
5729 dnl ===================================================================
5730 dnl Set the MinGW sys-root
5731 dnl ===================================================================
5732 if test "$WITH_MINGW" = "yes"; then
5733     AC_MSG_CHECKING([for MinGW sysroot])
5734     sysroot=`$CC -print-sysroot`
5735     AS_IF([test -d "$sysroot"/mingw],
5736           [MINGW_SYSROOT="$sysroot"/mingw
5737            AC_MSG_RESULT([$MINGW_SYSROOT])],
5738           [AC_MSG_RESULT([not found])
5739            AC_MSG_ERROR([cannot determine MinGW sysroot])])
5741 AC_SUBST([MINGW_DLLS])
5742 AC_SUBST([MINGW_SYSROOT])
5744 dnl ===================================================================
5745 dnl Set the MinGW include directories
5746 dnl ===================================================================
5747 if test "$WITH_MINGW" = "yes"; then
5748     AC_MSG_CHECKING([for MinGW include path])
5749     cat >conftest.$ac_ext <<_ACEOF
5750 #include <stddef.h>
5751 #include <bits/c++config.h>
5752 _ACEOF
5753     _mingw_lib_include_path=`$CXX -E -xc++ conftest.$ac_ext | $SED -n -e '/.*1*"\(.*\)\/stddef.h".*/s//\1/p' -e '/.*1*"\(.*\)\/bits\/c++config.h".*/s//\1/p' | sort -u | xargs echo`
5754     rm conftest.$ac_ext
5755     if test -z "$_mingw_lib_include_path"; then
5756         _mingw_lib_include_path="NO_LIB_INCLUDE"
5757         AC_MSG_RESULT([no MinGW include path])
5758     else
5759         AC_MSG_RESULT([$_mingw_lib_include_path])
5760     fi
5761     MINGW_LIB_INCLUDE_PATH="$_mingw_lib_include_path"
5762     AC_SUBST(MINGW_LIB_INCLUDE_PATH)
5764     AC_LANG_PUSH([C++])
5766     AC_MSG_CHECKING([for dynamic libgcc])
5767     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5768 #include <iostream>
5769 using namespace std;
5770 ]], [[ try { throw 42; } catch (int e) { cout << "Yep, " << e << endl; } ]])],[
5771             MINGW_GCCDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libgcc' | $SED -e 's@.*DLL Name: @@'`
5772             if test -n "$MINGW_GCCDLL"; then
5773                 MINGW_SHARED_GCCLIB=TRUE
5774                 AC_MSG_RESULT([ $MINGW_GCCDLL])
5775             else
5776                 MINGW_SHARED_GCCLIB=
5777                 AC_MSG_RESULT([no])
5778             fi
5779        ],[ AC_MSG_RESULT([no])
5781     ])
5783     AC_MSG_CHECKING([for dynamic libstdc++])
5784     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5785 #include <iostream>
5786 using namespace std;
5787 ]], [[ cout << "Hello there." << endl; ]])],[
5788             MINGW_GXXDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libstdc++' | $SED -e 's@.*DLL Name: @@'`
5789             if test -n "$MINGW_GXXDLL"; then
5790                 mingw_gxxdll_root=${MINGW_GXXDLL%.dll}
5791                 mingw_gxxdll_root=${mingw_gxxdll_root#lib}
5792                 if test "$CROSS_COMPILING" = "TRUE"; then
5793                     dnl m4 escaping!
5794                     mingw_gxxdll_root=${mingw_gxxdll_root%-[[0-9]]}
5795                 fi
5796                 MINGW_SHARED_LIBSTDCPP=-l$mingw_gxxdll_root
5797                 MINGW_SHARED_GXXLIB=TRUE
5798                 AC_MSG_RESULT([$MINGW_GXXDLL])
5799             else
5800                 MINGW_SHARED_GXXLIB=
5801                 AC_MSG_RESULT([no])
5802             fi
5803        ],[ AC_MSG_RESULT([no])
5805     ])
5807     AC_LANG_POP([C++])
5809     AC_SUBST(MINGW_SHARED_GCCLIB)
5810     AC_SUBST(MINGW_SHARED_GXXLIB)
5811     AC_SUBST(MINGW_SHARED_LIBSTDCPP)
5812     AC_SUBST(MINGW_GCCDLL)
5813     AC_SUBST(MINGW_GXXDLL)
5816 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
5817     AC_DEFINE(HAVE_FMERGENEUTRALITEMS)
5820 if test "$WITH_MINGW" = "yes"; then
5821     AC_MSG_CHECKING([for fMergeNeutralItems in SCRIPT_CONTROL])
5822     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
5823     [
5824     #include <usp10.h>
5825     ],
5826     [
5827     SCRIPT_CONTROL c;
5828     c.fMergeNeutralItems = 1;
5829     ])],
5830     [
5831     AC_MSG_RESULT(yes)
5832     AC_DEFINE(HAVE_FMERGENEUTRALITEMS)
5833     ],
5834     [AC_MSG_RESULT(no)])
5837 dnl ===================================================================
5838 dnl Extra checking for the SunOS compiler
5839 dnl ===================================================================
5840 if test "$_os" = "SunOS"; then
5841     dnl SunStudio C++ compiler packaged with SunStudio C compiler
5842     if test "$CC" = "cc"; then
5843     AC_MSG_CHECKING([SunStudio C++ Compiler])
5844         if test "$CXX" != "CC"; then
5845             AC_MSG_WARN([SunStudio C++ was not found])
5846             add_warning "SunStudio C++ was not found"
5847         else
5848             AC_MSG_RESULT([checked])
5849         fi
5850     fi
5853 dnl *************************************************************
5854 dnl Testing for exception handling - dwarf2 or sjlj exceptions...
5855 dnl *************************************************************
5856 if test "$WITH_MINGW" = "yes"; then
5857     AC_MSG_CHECKING([exception type])
5858     AC_LANG_PUSH([C++])
5859     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iostream>
5861         extern "C" void _Unwind_SjLj_RaiseException(void) __attribute__ ((__noreturn__));
5863         ]], [[_Unwind_SjLj_RaiseException() ]])],[exceptions_type="sjlj"],[exceptions_type="dwarf2"
5864     ])
5865     AC_MSG_RESULT($exceptions_type)
5866     AC_LANG_POP([C++])
5869 EXCEPTIONS="$exceptions_type"
5870 AC_SUBST(EXCEPTIONS)
5872 dnl ===================================================================
5873 dnl thread-safe statics
5874 dnl ===================================================================
5875 AC_MSG_CHECKING([whether $CXX supports thread safe statics])
5876 unset HAVE_THREADSAFE_STATICS
5877 if test "$GCC" = "yes"; then
5878     dnl -fthreadsafe-statics is available since GCC 4, so always available for
5879     dnl us.  However, some C++ runtimes use a single lock for all static
5880     dnl variables, which can cause deadlock in multi-threaded applications.
5881     dnl This is not easily tested here; for POSIX-based systems, if executing
5882     dnl the following C++ program does not terminate then the tool chain
5883     dnl apparently has this problem:
5884     dnl
5885     dnl   #include <pthread.h>
5886     dnl   int h() { return 0; }
5887     dnl   void * g(void * unused) {
5888     dnl     static int n = h();
5889     dnl     return &n;
5890     dnl   }
5891     dnl   int f() {
5892     dnl     pthread_t t;
5893     dnl     pthread_create(&t, 0, g, 0);
5894     dnl     pthread_join(t, 0);
5895     dnl     return 0;
5896     dnl   }
5897     dnl   int main() {
5898     dnl     static int n = f();
5899     dnl     return n;
5900     dnl   }
5901     dnl
5902     dnl Mac OS X up to at least 10.7.1 is known to have this problem, as is at
5903     dnl least one instance of GCC 4.2.4 (used on a "Linux ooobuild1.osuosl.org
5904     dnl 2.6.9-101.plus.c4smp #1 SMP Thu Jul 21 19:08:15 EDT 2011 i686 i686 i386
5905     dnl GNU/Linux" machine); see the definition of __cxa_guard_acquire in GCC's
5906     dnl libstdc++-v3/libsupc++/guard.cc for what #ifdefs actually make a
5907     dnl difference there.  Conservative advice from Jakub Jelinek is to assume
5908     dnl it working in GCC >= 4.3, so conservative way to check here is to use
5909     dnl GCC_VERSION for GCC but resort to __GLIBCXX__ corresponding to libstdc++
5910     dnl shipped with GCC 4.3.0 (cf. <http://gcc.gnu.org/onlinedocs/libstdc++/
5911     dnl manual/abi.html#abi.versioning.history>; 4.3.0 is 20080306, 4.2.4 is
5912     dnl 20080519, 4.3.1 is 20080606) for Clang (for which GCC_VERSION is notoriously
5913     dnl "too old"):
5914     if test "$_os" != Darwin -a "$_os" != Android; then
5915         if test "$COM_GCC_IS_CLANG" = TRUE; then
5916             AC_LANG_PUSH([C++])
5917             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5918 #include <list>
5919 #if !defined __GLIBCXX__ ||(__GLIBCXX__ < 20080606 && __GLIBCXX__ != 20080306)
5920 #error
5921 #endif
5922                 ]])],[HAVE_THREADSAFE_STATICS=TRUE],[])
5923             AC_LANG_POP([C++])
5924         elif test "${GCC_VERSION?}" -ge 0403; then
5925             HAVE_THREADSAFE_STATICS=TRUE
5926         fi
5927     fi
5928     if test "$HAVE_THREADSAFE_STATICS" = TRUE; then
5929         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5930         AC_MSG_RESULT([yes])
5931     else
5932         AC_MSG_RESULT([broken (i.e., no)])
5933     fi
5934 else
5935     AC_MSG_RESULT([unknown (assuming no)])
5937 AC_SUBST(HAVE_THREADSAFE_STATICS)
5939 dnl ===================================================================
5940 dnl visibility and other gcc features
5941 dnl ===================================================================
5942 if test "$GCC" = "yes"; then
5943     AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
5944     save_CFLAGS=$CFLAGS
5945     CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
5946     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_VISIBILITY_FEATURE=TRUE ],[])
5947     CFLAGS=$save_CFLAGS
5949     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5950         AC_MSG_RESULT([yes])
5951     else
5952         AC_MSG_RESULT([no])
5953     fi
5955     AC_MSG_CHECKING([whether $CC supports -Wno-long-double])
5956     save_CFLAGS=$CFLAGS
5957     CFLAGS="$CFLAGS -Werror -Wno-long-double"
5958     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_NO_LONG_DOUBLE=TRUE ],[])
5959     CFLAGS=$save_CFLAGS
5960     if test "$HAVE_GCC_NO_LONG_DOUBLE" = "TRUE"; then
5961         AC_MSG_RESULT([yes])
5962     else
5963         AC_MSG_RESULT([no])
5964     fi
5966     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5967     save_CFLAGS=$CFLAGS
5968     CFLAGS="$CFLAGS -Werror -mno-avx"
5969     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5970     CFLAGS=$save_CFLAGS
5971     if test "$HAVE_GCC_AVX" = "TRUE"; then
5972         AC_MSG_RESULT([yes])
5973     else
5974         AC_MSG_RESULT([no])
5975     fi
5977     AC_MSG_CHECKING([whether $CC supports atomic functions])
5978     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5979     int v = 0;
5980     if (__sync_add_and_fetch(&v, 1) != 1 ||
5981         __sync_sub_and_fetch(&v, 1) != 0)
5982         return 1;
5983     __sync_synchronize();
5984     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5985         v != 1)
5986         return 1;
5987     return 0;
5988 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5989     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5990         AC_MSG_RESULT([yes])
5991         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5992     else
5993         AC_MSG_RESULT([no])
5994     fi
5996     AC_MSG_CHECKING(
5997         [whether $CC supports pragma GCC diagnostic error/ignored/warning])
5998     save_CFLAGS=$CFLAGS
5999     CFLAGS="$CFLAGS -Werror -Wunknown-pragmas -Wunused-parameter"
6000     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6001             #pragma GCC diagnostic ignored "-Wunused-parameter"
6002             void dummy(int n) {}
6003         ])], [
6004             AC_DEFINE([HAVE_GCC_PRAGMA_DIAGNOSTIC_MODIFY],[1])
6005             AC_MSG_RESULT([yes])
6006         ], [AC_MSG_RESULT([no])])
6007     CFLAGS=$save_CFLAGS
6009     AC_MSG_CHECKING([whether $CC supports pragma GCC diagnostic push/pop])
6010     save_CFLAGS=$CFLAGS
6011     CFLAGS="$CFLAGS -Werror -Wunknown-pragmas -Wunused-parameter"
6012     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6013             #pragma GCC diagnostic push
6014             #pragma GCC diagnostic ignored "-Wunused-parameter"
6015             void dummy(int n) {}
6016             #pragma GCC diagnostic pop
6017         ])], [
6018             AC_DEFINE([HAVE_GCC_PRAGMA_DIAGNOSTIC_SCOPE],[1])
6019             AC_MSG_RESULT([yes])
6020         ], [AC_MSG_RESULT([no])])
6021     CFLAGS=$save_CFLAGS
6023     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
6024     save_CFLAGS=$CFLAGS
6025     CFLAGS="$CFLAGS -Werror"
6026     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6027             __attribute__((deprecated("test"))) void f();
6028         ])], [
6029             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6030             AC_MSG_RESULT([yes])
6031         ], [AC_MSG_RESULT([no])])
6032     CFLAGS=$save_CFLAGS
6034     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
6035     AC_LANG_PUSH([C++])
6036     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6037             #include <cxxabi.h>
6038             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6039         ])], [
6040             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6041             AC_MSG_RESULT([yes])
6042         ], [AC_MSG_RESULT([no])])
6043     AC_LANG_POP([C++])
6045     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6046     AC_LANG_PUSH([C++])
6047     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6048             #include <cxxabi.h>
6049             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6050         ])], [
6051             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_GET_GLOBALS],[1])
6052             AC_MSG_RESULT([yes])
6053         ], [AC_MSG_RESULT([no])])
6054     AC_LANG_POP([C++])
6056     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6057     AC_LANG_PUSH([C++])
6058     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6059             #include <cxxabi.h>
6060             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6061         ])], [
6062             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_THROW],[1])
6063             AC_MSG_RESULT([yes])
6064         ], [AC_MSG_RESULT([no])])
6065     AC_LANG_POP([C++])
6067     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6068     AC_LANG_PUSH([C++])
6069     save_CXXFLAGS=$CXXFLAGS
6070     CXXFLAGS="$CFLAGS -Werror -Wunknown-pragmas"
6071     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6072             struct __attribute__((warn_unused)) dummy {};
6073         ])], [
6074             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6075             AC_MSG_RESULT([yes])
6076         ], [AC_MSG_RESULT([no])])
6077     CXXFLAGS=$save_CXXFLAGS
6078     AC_LANG_POP([C++])
6080     AC_MSG_CHECKING([whether STL uses __attribute__((warn_unused))])
6081     AC_LANG_PUSH([C++])
6082     save_CXXFLAGS=$CXXFLAGS
6083     CXXFLAGS="$CFLAGS -Werror -Wunused"
6084     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6085             #include <string>
6086             void f() { std::string s; }
6087         ])], [
6088             AC_MSG_RESULT([no])
6089         ], [
6090             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED_STL],[1])
6091             AC_MSG_RESULT([yes])])
6092     CXXFLAGS=$save_CXXFLAGS
6093     AC_LANG_POP([C++])
6096 AC_SUBST(HAVE_GCC_NO_LONG_DOUBLE)
6097 AC_SUBST(HAVE_GCC_AVX)
6098 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6100 dnl ===================================================================
6101 dnl Identify the C++ library
6102 dnl ===================================================================
6104 AC_MSG_CHECKING([What the C++ library is])
6105 AC_LANG_PUSH([C++])
6106 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6107 #include <utility>
6108 #ifndef __GLIBCXX__
6109 foo bar
6110 #endif
6111 ]])],
6112     [CPP_LIBRARY=GLIBCXX
6113      cpp_library_name="GNU libstdc++"
6114     ],
6115     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6116 #include <utility>
6117 #ifndef _LIBCPP_VERSION
6118 foo bar
6119 #endif
6120 ]])],
6121     [CPP_LIBRARY=LIBCPP
6122      cpp_library_name="LLVM libc++"
6123     ],
6124     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6125 #include <utility>
6126 #ifndef _MSC_VER
6127 foo bar
6128 #endif
6129 ]])],
6130     [CPP_LIBRARY=MSVCRT
6131      cpp_library_name="Microsoft"
6132     ],
6133     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6134 AC_MSG_RESULT([$cpp_library_name])
6135 AC_LANG_POP([C++])
6136 AC_SUBST(CPP_LIBRARY)
6138 dnl ===================================================================
6139 dnl C++11
6140 dnl ===================================================================
6142 CXXFLAGS_CXX11=
6143 HAVE_CXX11=
6144 if test "$COM" = MSC; then
6145     AC_MSG_CHECKING([whether $CXX supports C++11])
6146     AC_MSG_RESULT(yes)
6147     # MSVC supports (a subset of) CXX11 without any switch
6148     HAVE_CXX11=TRUE
6149     CXXFLAGS_CXX11=
6150 elif test "$GCC" = "yes"; then
6151     CXXFLAGS_CXX11=
6152     AC_MSG_CHECKING([whether $CXX supports C++11])
6153     for flag in -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x ; do
6154         save_CXXFLAGS=$CXXFLAGS
6155         CXXFLAGS="$CXXFLAGS $flag -Werror"
6156         AC_LANG_PUSH([C++])
6157         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[void f() {}]])],[CXXFLAGS_CXX11=$flag])
6158         AC_LANG_POP([C++])
6159         CXXFLAGS=$save_CXXFLAGS
6160         if test -n "$CXXFLAGS_CXX11"; then
6161             HAVE_CXX11=TRUE
6162             break
6163         fi
6164     done
6165     if test "$HAVE_CXX11" = TRUE; then
6166         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6167     else
6168         AC_MSG_RESULT(no)
6169     fi
6172 if test $CPP_LIBRARY = GLIBCXX -a "$HAVE_CXX11" = TRUE; then
6173     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6174     AC_LANG_PUSH([C++])
6175     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6176 #include <list>
6177 #if !defined(__GLIBCXX__)
6178 /* ok */
6179 #elif __GLIBCXX__ < 20111004
6180 /* before breakage */
6181 #elif __GLIBCXX__ > 20120703
6182 /* after breakage */
6183 #else
6184 abi broken
6185 #endif
6186         ]])], [AC_MSG_RESULT(no, ok)],
6187         [AC_MSG_RESULT(yes, disabling C++11)
6188          HAVE_CXX11=])
6189     AC_LANG_POP([C++])
6192 if test "$HAVE_CXX11" = TRUE; then
6193     AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6194     save_CXXFLAGS=$CXXFLAGS
6195     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6196     AC_LANG_PUSH([C++])
6198     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6199 #include <stddef.h>
6201 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6203 namespace
6205         struct b
6206         {
6207                 int i;
6208                 int j;
6209         };
6211 ]], [[
6212 struct a
6214         int i;
6215         int j;
6217 a thinga[]={{0,0}, {1,1}};
6218 b thingb[]={{0,0}, {1,1}};
6219 size_t i = sizeof(sal_n_array_size(thinga));
6220 size_t j = sizeof(sal_n_array_size(thingb));
6221 return !(i != 0 && j != 0);
6223         ], [ AC_MSG_RESULT(yes) ],
6224         [ AC_MSG_RESULT(no)
6225           HAVE_CXX11=
6226         ])
6227     AC_LANG_POP([C++])
6228     CXXFLAGS=$save_CXXFLAGS
6231 if test "$HAVE_CXX11" = TRUE; then
6232     AC_MSG_CHECKING([whether $CXX supports C++11 without __float128 compile error])
6233     save_CXXFLAGS=$CXXFLAGS
6234     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6235     AC_LANG_PUSH([C++])
6237     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6238 #include <vector>
6239     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6240     // (__float128)
6242     ],[ AC_MSG_RESULT(yes) ],
6243     [
6244         AC_MSG_RESULT(no)
6245         # The only reason why libstdc++ headers fail with Clang in C++11 mode is because
6246         # they use the __float128 type that Clang doesn't know (libstdc++ checks whether
6247         # __float128 is available during its build, but it's usually built using GCC,
6248         # and so c++config.h hardcodes __float128 being supported). As the only place
6249         # where __float128 is actually used is in a template specialization,
6250         # -D__float128=void will avoid the problem there while still causing a problem
6251         # if somebody actually uses the type.
6252         AC_MSG_CHECKING([whether -D__float128=void workaround helps])
6253         CXXFLAGS="$CXXFLAGS -D__float128=void"
6254         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6255 #include <vector>
6256     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6257     // (__float128)
6259         ],
6260         [
6261          AC_MSG_RESULT(yes)
6262          CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -D__float128=void"
6263         ],
6264         [
6265          AC_MSG_RESULT(no)
6266          HAVE_CXX11=
6267         ])
6268     ])
6270     AC_LANG_POP([C++])
6271     CXXFLAGS=$save_CXXFLAGS
6274 if test "$HAVE_CXX11" = "TRUE"; then
6275     AC_DEFINE(HAVE_CXX11)
6276 elif test -n "$CXXFLAGS_CXX11"; then
6277     AC_MSG_NOTICE([Disabling C++11 support])
6278     CXXFLAGS_CXX11=
6279 elif test "$CPP_LIBRARY" = LIBCPP -a $_os = Darwin; then
6280     AC_MSG_ERROR([Selected libc++ but C++11 support broken])
6283 AC_SUBST(CXXFLAGS_CXX11)
6284 AC_SUBST(HAVE_CXX11)
6286 AC_MSG_CHECKING([for std::shared_ptr])
6287 if test "$HAVE_CXX11" = "TRUE" -a "$GCC" = "yes"; then
6288     save_CXXFLAGS=$CXXFLAGS
6289     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6290     AC_LANG_PUSH([C++])
6291     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
6292         #include <memory>
6293         using std::shared_ptr;
6294         ])],
6295       [ have_std_shared_ptr=yes ],
6296       [ have_std_shared_ptr=no ]
6297     )
6298     AC_LANG_POP([C++])
6299     CXXFLAGS=$save_CXXFLAGS
6300 elif test "$COM" = "MSC"; then
6301     have_std_shared_ptr=yes
6302 else
6303     have_std_shared_ptr=no
6305 AC_MSG_RESULT([$have_std_shared_ptr])
6307 dnl ==================================
6308 dnl Check for C++11 "= delete" support
6309 dnl ==================================
6311 if test "$HAVE_CXX11" = "TRUE"; then
6312     AC_MSG_CHECKING([whether $CXX supports C++11 = delete syntax])
6313     save_CXXFLAGS=$CXXFLAGS
6314     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6315     AC_LANG_PUSH([C++])
6316     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6317 struct A
6318     {
6319     void test() = delete;
6320     };
6321 ]])],[HAVE_CXX11_DELETE=TRUE],[])
6323     AC_LANG_POP([C++])
6324     CXXFLAGS=$save_CXXFLAGS
6325     if test "$HAVE_CXX11_DELETE" = "TRUE"; then
6326         AC_MSG_RESULT([yes])
6327         AC_DEFINE([HAVE_CXX11_DELETE])
6328     else
6329         AC_MSG_RESULT([no])
6330     fi
6333 dnl ==================================
6334 dnl Check for C++11 "override" support
6335 dnl ==================================
6337 if test "$HAVE_CXX11" = "TRUE"; then
6338     AC_MSG_CHECKING([whether $CXX supports C++11 "override" syntax])
6339     save_CXXFLAGS=$CXXFLAGS
6340     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6341     AC_LANG_PUSH([C++])
6342     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6343 struct A
6345         virtual void test();
6348 struct B : A
6350         virtual void test() override;
6352 ]])],[HAVE_CXX11_OVERRIDE=TRUE],[])
6354     AC_LANG_POP([C++])
6355     CXXFLAGS=$save_CXXFLAGS
6356     if test "$HAVE_CXX11_OVERRIDE" = "TRUE"; then
6357         AC_MSG_RESULT([yes])
6358         AC_DEFINE([HAVE_CXX11_OVERRIDE])
6359     else
6360         AC_MSG_RESULT([no])
6361     fi
6364 dnl ==================================
6365 dnl Check for C++11 "final" support
6366 dnl ==================================
6368 if test "$HAVE_CXX11" = "TRUE"; then
6369     AC_MSG_CHECKING([whether $CXX supports C++11 "final" syntax])
6370     save_CXXFLAGS=$CXXFLAGS
6371     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6372     AC_LANG_PUSH([C++])
6373     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6374 // First check that this correct program that uses "final" compiles
6375 struct A final
6379 struct B
6381         virtual void test();
6384 struct C : B
6386         void test() final;
6388 ]])],[have_final=yes],[])
6390     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6391 // Then check that the "final" works as expected,
6392 // that this program fails to compile
6393 struct A final
6397 struct B : A
6400 ]])],[],[final_class_works=yes])
6402     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6403 // Also this should fail to compile
6404 struct B
6406         virtual void test();
6409 struct C : B
6411         void test() final;
6414 struct D : C
6416         void test();
6418 ]])],[],[final_method_works=yes])
6419     AC_LANG_POP([C++])
6421     CXXFLAGS=$save_CXXFLAGS
6423     if test "$have_final" = yes -a "$final_class_works" = yes -a "$final_method_works" = yes; then
6424         AC_MSG_RESULT([yes])
6425         AC_DEFINE([HAVE_CXX11_FINAL])
6426     else
6427         AC_MSG_RESULT([no])
6428     fi
6431 dnl ===================================================================
6432 dnl Check for C++11 perfect forwarding support
6433 dnl ===================================================================
6434 if test "$HAVE_CXX11" = "TRUE"; then
6435     AC_MSG_CHECKING([whether $CXX supports C++11 perfect forwarding])
6436     save_CXXFLAGS=$CXXFLAGS
6437     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6438     AC_LANG_PUSH([C++])
6439     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6440         #include <utility>
6441         template<typename T, typename... Args> T * f(Args &&... v) {
6442             return new T(std::forward<Args>(v)...);
6443         }
6444         ]], [[
6445         f<int>(0);
6446         ]])], [perfect_forwarding=yes], [perfect_forwarding=no])
6447     AC_LANG_POP([C++])
6448     CXXFLAGS=$save_CXXFLAGS
6449     AC_MSG_RESULT([$perfect_forwarding])
6450     if test "$perfect_forwarding" = yes; then
6451         AC_DEFINE([HAVE_CXX11_PERFECT_FORWARDING])
6452     fi
6455 HAVE_GCC_PRAGMA_OPERATOR=
6456 dnl _Pragma support (may require C++11)
6457 if test "$GCC" = "yes"; then
6458     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6459     AC_LANG_PUSH([C++])
6460     save_CXXFLAGS=$CXXFLAGS
6461     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6462     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6463             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6464         ])], [
6465             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6466             HAVE_GCC_PRAGMA_OPERATOR=1
6467             AC_MSG_RESULT([yes])
6468         ], [AC_MSG_RESULT([no])])
6469     AC_LANG_POP([C++])
6470     CXXFLAGS=$save_CXXFLAGS
6472 AC_SUBST(HAVE_GCC_PRAGMA_OPERATOR)
6474 dnl ===================================================================
6475 dnl system stl sanity tests
6476 dnl ===================================================================
6477 HAVE_GCC_VISIBILITY_BROKEN=
6478 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \); then
6480     AC_LANG_PUSH([C++])
6482     save_CPPFLAGS="$CPPFLAGS"
6483     if test -n "$MACOSX_SDK_PATH"; then
6484         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6485     fi
6487     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6488     # only.
6489     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$CPP_LIBRARY" = GLIBCXX; then
6490         dnl gcc#19664, gcc#22482, rhbz#162935
6491         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6492         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6493         AC_MSG_RESULT([$stlvisok])
6494         if test "$stlvisok" = "no"; then
6495             AC_MSG_WARN([Your libstdc++ headers are not visibility safe. Disabling visibility])
6496             add_warning "Your libstdc++ headers are not visibility safe. Disabling visibility"
6497             unset HAVE_GCC_VISIBILITY_FEATURE
6498         fi
6499     fi
6501     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
6502         sharedlink_ldflags_save=$LDFLAGS
6503         LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden $PICSWITCH $LINKFLAGSSHL"
6505         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
6506         AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6507 #include <sstream>
6508 using namespace std;
6509             ]], [[
6510 istringstream strm( "test" ); return 0;
6511             ]])],
6512             # Ugh, surely bad to assume an error message will contain
6513             # the word "unresolvable", a problem with
6514             # -fvisibility-inlines-hidden and STL headers might cause
6515             # some more obscure message on some platform, and anway,
6516             # the error message could be localised.
6517             [$EGREP -q unresolvable conftest.err;
6518             if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi],[gccvisok=no
6519         ])
6520         AC_MSG_RESULT([$gccvisok])
6521         if test "$gccvisok" = "no"; then
6522             AC_MSG_WARN([Your gcc is not -fvisibility-inlines-hidden safe, disabling that.])
6523             add_warning "Your gcc is not -fvisibility-inlines-hidden safe, disabling that."
6524             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
6525         fi
6527         LDFLAGS=$sharedlink_ldflags_save
6528     fi
6530     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6531     # when we don't make any dynamic libraries?
6532     if test "$DISABLE_DYNLOADING" = "" -a "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$HAVE_GCC_VISIBILITY_BROKEN" != "TRUE"; then
6533         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6534         cat > conftestlib1.cc <<_ACEOF
6535 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6536 struct S2: S1<int> { virtual ~S2(); };
6537 S2::~S2() {}
6538 _ACEOF
6539         cat > conftestlib2.cc <<_ACEOF
6540 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6541 struct S2: S1<int> { virtual ~S2(); };
6542 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6543 _ACEOF
6544         gccvisinlineshiddenok=yes
6545         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6546             gccvisinlineshiddenok=no
6547         else
6548             dnl At least Clang -fsanitize=address is known to not work with
6549             dnl -z defs (unsetting which makes the test moot, though):
6550             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6551             if test "$COM_GCC_IS_CLANG" = TRUE; then
6552                 for i in $CXX; do
6553                     case $i in
6554                     -fsanitize=address)
6555                         my_linkflagsnoundefs=
6556                         break
6557                         ;;
6558                     esac
6559                 done
6560             fi
6561             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6562                 gccvisinlineshiddenok=no
6563             fi
6564         fi
6566         rm -fr libconftest*
6567         AC_MSG_RESULT([$gccvisinlineshiddenok])
6568         if test "$gccvisinlineshiddenok" = "no"; then
6569             AC_MSG_WARN([Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that.])
6570             add_warning "Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that."
6571             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
6572         fi
6573     fi
6575     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
6576         AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6577         cat >visibility.cxx <<_ACEOF
6578 #pragma GCC visibility push(hidden)
6579 struct __attribute__ ((visibility ("default"))) TestStruct {
6580   static void Init();
6582 __attribute__ ((visibility ("default"))) void TestFunc() {
6583   TestStruct::Init();
6585 _ACEOF
6586         if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx 2>/dev/null > /dev/null; then
6587             gccvisbroken=yes
6588         else
6589             case "$host_cpu" in
6590             i?86|x86_64)
6591                 if test "$_os" = "Darwin" -o "$WITH_MINGW" = "yes"; then
6592                     gccvisbroken=no
6593                 else
6594                     if $EGREP -q '@PLT|@GOT' visibility.s; then
6595                         gccvisbroken=no
6596                     else
6597                         gccvisbroken=yes
6598                     fi
6599                 fi
6600                 ;;
6601             *)
6602                 gccvisbroken=no
6603                 ;;
6604             esac
6605         fi
6606         rm -f visibility.s visibility.cxx
6608         AC_MSG_RESULT([$gccvisbroken])
6609         if test "$gccvisbroken" = "yes"; then
6610             AC_MSG_WARN([Your gcc is not -fvisibility=hidden safe. Disabling visibility])
6611             add_warning "Your gcc is not -fvisibility=hidden safe. Disabling visibility"
6612             unset HAVE_GCC_VISIBILITY_FEATURE
6613         fi
6614     fi
6616     CPPFLAGS="$save_CPPFLAGS"
6618     AC_LANG_POP([C++])
6621 AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE)
6622 AC_SUBST(HAVE_GCC_VISIBILITY_BROKEN)
6624 dnl ===================================================================
6625 dnl  Clang++ tests
6626 dnl ===================================================================
6628 HAVE_GCC_FNO_DEFAULT_INLINE=
6629 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6630 if test "$GCC" = "yes"; then
6631     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6632     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6633         # Option just ignored and silly warning that isn't a real
6634         # warning printed
6635         :
6636     else
6637         AC_LANG_PUSH([C++])
6638         save_CXXFLAGS=$CXXFLAGS
6639         CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6640         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6641         CXXFLAGS=$save_CXXFLAGS
6642         AC_LANG_POP([C++])
6643     fi
6644     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6645         AC_MSG_RESULT([yes])
6646     else
6647         AC_MSG_RESULT([no])
6648     fi
6650     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6651     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6652         # As above
6653         :
6654     else
6655         AC_LANG_PUSH([C++])
6656         save_CXXFLAGS=$CXXFLAGS
6657         CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6658         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6659         CXXFLAGS=$save_CXXFLAGS
6660         AC_LANG_POP([C++])
6661     fi
6662     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6663         AC_MSG_RESULT([yes])
6664     else
6665         AC_MSG_RESULT([no])
6666     fi
6668 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6669 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6671 dnl ===================================================================
6672 dnl Compiler plugins
6673 dnl ===================================================================
6675 COMPILER_PLUGINS=
6676 # currently only Clang
6677 if test "$COM_GCC_IS_CLANG" = "TRUE"; then
6678     if test -n "$enable_compiler_plugins"; then
6679         compiler_plugins="$enable_compiler_plugins"
6680     elif test -n "$ENABLE_DBGUTIL"; then
6681         compiler_plugins=test
6682     else
6683         compiler_plugins=no
6684     fi
6685     if test "$compiler_plugins" != "no"; then
6686         dnl The prefix where Clang resides, override to where Clang resides if
6687         dnl using a source build:
6688         if test -z "$CLANGDIR"; then
6689             CLANGDIR=/usr
6690         fi
6691         AC_LANG_PUSH([C++])
6692         save_CPPFLAGS=$CPPFLAGS
6693         save_CXX=$CXX
6694         # compiler plugins must be built with "native" bitness of clang
6695         # because they link against clang libraries
6696         CXX=`echo $CXX | sed -e s/-m64// -e s/-m32//`
6697         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -I$CLANGDIR/tools/clang/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6698         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6699             [COMPILER_PLUGINS=TRUE],
6700             [
6701             if test "$compiler_plugins" = "yes"; then
6702                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6703             else
6704                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6705                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6706             fi
6707             ])
6708         CXX=$save_CXX
6709         CPPFLAGS=$save_CPPFLAGS
6710         AC_LANG_POP([C++])
6711     fi
6712 else
6713     if test "$enable_compiler_plugins" = "yes"; then
6714         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6715     fi
6717 AC_SUBST(COMPILER_PLUGINS)
6718 AC_SUBST(CLANGDIR)
6720 # Plugin to help linker.
6721 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6722 # This makes --enable-lto build with clang work.
6723 AC_SUBST(LD_PLUGIN)
6725 dnl ===================================================================
6726 dnl allocator
6727 dnl ===================================================================
6728 AC_MSG_CHECKING([which memory allocator to use])
6729 if test "$with_alloc" = "system"; then
6730     AC_MSG_RESULT([system])
6731     ALLOC="SYS_ALLOC"
6733 if test "$with_alloc" = "tcmalloc"; then
6734     AC_MSG_RESULT(tcmalloc)
6735     if ! echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6736         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
6737     fi
6738     AC_CHECK_LIB([tcmalloc], [malloc], [:],
6739         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
6740     ALLOC="TCMALLOC"
6742 if test "$with_alloc" = "jemalloc"; then
6743     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
6744         AC_MSG_RESULT(jemalloc)
6745         save_CFLAGS=$CFLAGS
6746         CFLAGS="$CFLAGS -pthread"
6747         AC_CHECK_LIB([jemalloc], [malloc], [:],
6748             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
6749         ALLOC="JEMALLOC"
6750         CFLAGS=$save_CFLAGS
6751     else
6752         AC_MSG_RESULT([system])
6753         ALLOC="SYS_ALLOC"
6754     fi
6756 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6757     AC_MSG_RESULT([internal])
6759 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6760 AC_SUBST(HAVE_POSIX_FALLOCATE)
6761 AC_SUBST(ALLOC)
6763 dnl ===================================================================
6764 dnl Custom build version
6765 dnl ===================================================================
6767 AC_MSG_CHECKING([whether to add custom build version])
6768 if test "$with_build_version" != ""; then
6769     BUILD_VER_STRING=$with_build_version
6770     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6771 else
6772     BUILD_VER_STRING=
6773     AC_MSG_RESULT([no])
6775 AC_SUBST(BUILD_VER_STRING)
6777 JITC_PROCESSOR_TYPE=""
6778 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6779     # IBMs JDK needs this...
6780     JITC_PROCESSOR_TYPE=6
6781     export JITC_PROCESSOR_TYPE
6783 AC_SUBST([JITC_PROCESSOR_TYPE])
6785 # Misc Windows Stuff
6786 if test $_os = "WINNT" -a "$WITH_MINGW" != yes; then
6787     find_msvc_x64_dlls
6788     find_msms
6789     MSVC_DLL_PATH="$msvcdllpath"
6790     MSVC_DLLS="$msvcdlls"
6791     MSM_PATH="$msmdir"
6792     SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6795 AC_SUBST(MSVC_DLL_PATH)
6796 AC_SUBST(MSVC_DLLS)
6797 AC_SUBST(MSM_PATH)
6799 dnl ===================================================================
6800 dnl Checks for Java
6801 dnl ===================================================================
6802 if test "$ENABLE_JAVA" != ""; then
6804     # Windows-specific tests
6805     if test "$build_os" = "cygwin"; then
6806         if test "$BITNESS_OVERRIDE" = 64; then
6807             bitness=64
6808         else
6809             bitness=32
6810         fi
6812         if test -z "$with_jdk_home"; then
6813             for ver in 1.8 1.7 1.6; do
6814                reg_get_value_$bitness "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6815                if test -n "$regvalue"; then
6816                    _jdk_home=$regvalue
6817                    break
6818                fi
6819             done
6820             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6821                 with_jdk_home="$_jdk_home"
6822                 howfound="found automatically"
6823             else
6824                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6825             fi
6826         else
6827             test "$build_os" = "cygwin" && with_jdk_home=`cygpath -u "$with_jdk_home"`
6828             howfound="you passed"
6829         fi
6830     fi
6832     JAVA_HOME=; export JAVA_HOME
6833     if test -z "$with_jdk_home"; then
6834         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6835     else
6836         _java_path="$with_jdk_home/bin/$with_java"
6837         dnl Check if there is a Java interpreter at all.
6838         if test -x "$_java_path"; then
6839             JAVAINTERPRETER=$_java_path
6840         else
6841             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6842         fi
6843     fi
6845     if test "$build_os" = "cygwin"; then
6846         # Check that the JDK found is correct architecture
6847         # Why is this necessary, we don't link with any library from the JDK I think,
6849         shortjdkhome=`cygpath -d "$with_jdk_home"`
6850         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
6851             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6852             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6853         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
6854             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6855             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6856         fi
6858         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6859             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6860         fi
6861         JAVAINTERPRETER=`cygpath -d "$JAVAINTERPRETER"`
6862         JAVAINTERPRETER=`cygpath -u "$JAVAINTERPRETER"`
6863     elif test $_os = Darwin -a "$BITNESS_OVERRIDE" = ""; then
6864         dnl HACK:  There currently is only a 32 bit version of LibreOffice for Mac OS X,
6865         dnl and Tiger Java complains about -d32 while Snow Leopard Java needs it
6866         dnl to run in 32 bit mode and be able to load LibreOffice jnilibs:
6867         AC_MSG_CHECKING([whether to pass -d32 to Java interpreter])
6868         if "$JAVAINTERPRETER" -d32 >&5 2>&5; then
6869             AC_MSG_RESULT([yes])
6870             JAVAIFLAGS=-d32
6871         else
6872             AC_MSG_RESULT([no])
6873         fi
6874     fi
6877 HAVE_JAVA6=
6878 dnl ===================================================================
6879 dnl Checks for JDK.
6880 dnl ===================================================================
6882 # Note that JAVA_HOME as for now always means the *build* platform's
6883 # JAVA_HOME. Whether all the complexity here actually is needed any
6884 # more or not, no idea.
6886 if test "$ENABLE_JAVA" != ""; then
6887     _gij_longver=0
6888     AC_MSG_CHECKING([the installed JDK])
6889     if test -n "$JAVAINTERPRETER"; then
6890         dnl java -version sends output to stderr!
6891         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6892             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6893         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6894             JDK=gcj
6895             AC_MSG_RESULT([checked (gcj)])
6896             _gij_version=`$JAVAINTERPRETER --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6897             _gij_longver=`echo $_gij_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6899         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6900             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6901         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6902             JDK=ibm
6904             dnl IBM JDK specific tests
6905             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6906             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6908             if test "$_jdk_ver" -lt 10500; then
6909                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.5])
6910             fi
6911             if test "$_jdk_ver" -ge 10600; then
6912                 HAVE_JAVA6=TRUE
6913             fi
6915             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6917             if test "$with_jdk_home" = ""; then
6918                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6919 you must use the "--with-jdk-home" configure option explicitly])
6920             fi
6922            JAVA_HOME=$with_jdk_home
6924         else
6925             JDK=sun
6927             dnl Sun JDK specific tests
6928             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6929             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6931             if test "$_jdk_ver" -lt 10500; then
6932                 AC_MSG_ERROR([JDK is too old, you need at least 1.5])
6933             fi
6934             if test "$_jdk_ver" -gt 10600; then
6935                 JAVA_CLASSPATH_NOT_SET="1"
6936             fi
6937             if test "$_jdk_ver" -ge 10600; then
6938                 HAVE_JAVA6=TRUE
6939             fi
6941             AC_MSG_RESULT([checked (JDK $_jdk)])
6942             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6943             if test "$_os" = "WINNT"; then
6944                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6945             fi
6946         fi
6947     else
6948         AC_MSG_ERROR([Java not found. You need at least jdk-1.5, or gcj-4])
6949     fi
6950 else
6951     dnl Java disabled
6952     JAVA_HOME=NO_JAVA_HOME ; export JAVA_HOME
6954 AC_SUBST([HAVE_JAVA6])
6956 dnl ===================================================================
6957 dnl Set target Java bytecode version
6958 dnl ===================================================================
6959 if test "$ENABLE_JAVA" != ""; then
6960     _java_target_ver="1.5"
6962     JAVA_SOURCE_VER="$_java_target_ver"
6963     JAVA_TARGET_VER="$_java_target_ver"
6966 dnl ===================================================================
6967 dnl Checks for javac
6968 dnl ===================================================================
6969 if test "$ENABLE_JAVA" != ""; then
6970     if test "$JDK" = "gcj"; then
6971         javacompiler=`echo $with_java | $SED -e "s/gij/gcj/g" | $SED -e "s/java/javac/g"`
6972     else
6973         javacompiler="javac"
6974     fi
6975     if test -z "$with_jdk_home"; then
6976         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6977     else
6978         _javac_path="$with_jdk_home/bin/$javacompiler"
6979         dnl Check if there is a Java compiler at all.
6980         if test -x "$_javac_path"; then
6981             JAVACOMPILER=$_javac_path
6982         fi
6983     fi
6984     if test -z "$JAVACOMPILER"; then
6985         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6986     fi
6987     if test "$build_os" = "cygwin"; then
6988         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6989             JAVACOMPILER="${JAVACOMPILER}.exe"
6990         fi
6991         JAVACOMPILER=`cygpath -d "$JAVACOMPILER"`
6992         JAVACOMPILER=`cygpath -u "$JAVACOMPILER"`
6993     fi
6995     if test `$JAVACOMPILER -version 2>&1 | $GREP -c "Eclipse Java Compiler"` -gt 0; then
6996         AC_MSG_CHECKING([re-checking JDK])
6997         JDK=gcj
6998         AC_MSG_RESULT([checked (ecj)])
6999         _gij_longver="40200"
7000     fi
7003 JAVACISGCJ=""
7004 dnl ===================================================================
7005 dnl Checks that javac is gcj
7006 dnl ===================================================================
7007 if test "$ENABLE_JAVA" != ""; then
7008     if test `$JAVACOMPILER --version 2>&1 | $GREP -c "GCC"` -gt 0; then
7009         JAVACISGCJ="yes"
7010     fi
7012 AC_SUBST(JAVACISGCJ)
7014 dnl ===================================================================
7015 dnl Checks for javadoc
7016 dnl ===================================================================
7017 if test "$ENABLE_JAVA" != ""; then
7018     if test -z "$with_jdk_home"; then
7019         AC_PATH_PROG(JAVADOC, javadoc)
7020     else
7021         _javadoc_path="$with_jdk_home/bin/javadoc"
7022         dnl Check if there is a javadoc at all.
7023         if test -x "$_javadoc_path"; then
7024             JAVADOC=$_javadoc_path
7025         else
7026             AC_PATH_PROG(JAVADOC, javadoc)
7027         fi
7028     fi
7029     if test -z "$JAVADOC"; then
7030         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7031     fi
7032     if test "$build_os" = "cygwin"; then
7033         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7034             JAVADOC="${JAVADOC}.exe"
7035         fi
7036         JAVADOC=`cygpath -d "$JAVADOC"`
7037         JAVADOC=`cygpath -u "$JAVADOC"`
7038     fi
7040     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7041     JAVADOCISGJDOC="yes"
7042     fi
7044 AC_SUBST(JAVADOCISGJDOC)
7046 if test "$ENABLE_JAVA" != ""; then
7047     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7048     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7049         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7050            # try to recover first by looking whether we have a alternatives
7051            # system as in Debian or newer SuSEs where following /usr/bin/javac
7052            # over /etc/alternatives/javac leads to the right bindir where we
7053            # just need to strip a bit away to get a valid JAVA_HOME
7054            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7055         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7056             # maybe only one level of symlink (e.g. on Mac)
7057             JAVA_HOME=$(readlink $JAVACOMPILER)
7058             if test "$(dirname $JAVA_HOME)" = "."; then
7059                 # we've got no path to trim back
7060                 JAVA_HOME=""
7061             fi
7062         else
7063             # else warn
7064             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7065             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7066             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7067             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7068         fi
7069         dnl now that we have the path to the real javac, make a JAVA_HOME out of it..
7070         if test "$JAVA_HOME" != "/usr"; then
7071             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7072                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7073                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7074                 dnl Tiger already returns a JDK path..
7075                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7076             else
7077                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7078             fi
7079         fi
7080     fi
7081     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7083     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7084     if test -z "$JAVA_HOME"; then
7085         if test "x$with_jdk_home" = "x"; then
7086             cat > findhome.java <<_ACEOF
7087 [import java.io.File;
7089 class findhome
7091     public static void main(String args[])
7092     {
7093         String jrelocation = System.getProperty("java.home");
7094         File jre = new File(jrelocation);
7095         System.out.println(jre.getParent());
7096     }
7098 _ACEOF
7099             AC_MSG_CHECKING([if javac works])
7100             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7101             AC_TRY_EVAL(javac_cmd)
7102             if test $? = 0 -a -f ./findhome.class; then
7103                 AC_MSG_RESULT([javac works])
7104             else
7105                 echo "configure: javac test failed" >&5
7106                 cat findhome.java >&5
7107                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7108             fi
7109             AC_MSG_CHECKING([if gij knows its java.home])
7110             JAVA_HOME=`$JAVAINTERPRETER findhome`
7111             if test $? = 0 -a "$JAVA_HOME" != ""; then
7112                 AC_MSG_RESULT([$JAVA_HOME])
7113             else
7114                 echo "configure: java test failed" >&5
7115                 cat findhome.java >&5
7116                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7117             fi
7118             # clean-up after ourselves
7119             rm -f ./findhome.java ./findhome.class
7120         else
7121             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7122         fi
7123     fi
7125     dnl second sanity check JAVA_HOME if possible
7126     if test "$JDK" != "gcj" -o "$_gij_longver" -ge "40200"; then
7127         # now check if $JAVA_HOME is really valid
7128         if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7129             if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7130                 JAVA_HOME_OK="NO"
7131             fi
7132         elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7133             JAVA_HOME_OK="NO"
7134         fi
7135         if test "$JAVA_HOME_OK" = "NO"; then
7136             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7137             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7138             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
7139             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7140             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7141             add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
7142         fi
7143     fi
7144     PathFormat "$JAVA_HOME"
7145     JAVA_HOME="$formatted_path"
7148 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7149     "$_os" != Darwin
7150 then
7151     AC_MSG_CHECKING([for JAWT lib])
7152     if test "$_os" = WINNT; then
7153         if test "$WITH_MINGW" = yes; then
7154             # The path is taken care of in gb_LinkTarget__use_jawt
7155             # in RepositoryExternal.mk:
7156             JAWTLIB=-ljawt
7157         else
7158             # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7159             JAWTLIB=jawt.lib
7160         fi
7161     else
7162         case "$host_cpu" in
7163         arm*)
7164             my_java_arch=arm
7165             ;;
7166         i*86)
7167             my_java_arch=i386
7168             ;;
7169         m68k)
7170             my_java_arch=mk68
7171             ;;
7172         powerpc)
7173             my_java_arch=ppc
7174             ;;
7175         powerpc64)
7176             my_java_arch=ppc64
7177             ;;
7178         x86_64)
7179             my_java_arch=amd64
7180             ;;
7181         *)
7182             my_java_arch=$host_cpu
7183             ;;
7184         esac
7185         JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7186     fi
7187     AC_MSG_RESULT([$JAWTLIB])
7189 AC_SUBST(JAWTLIB)
7191 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7192     case "$host_os" in
7194     aix*)
7195         JAVAINC="-I$JAVA_HOME/include"
7196         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7197         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7198         ;;
7200     cygwin*)
7201         JAVAINC="-I$JAVA_HOME/include/win32"
7202         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7203         ;;
7205     darwin*)
7206         JAVAINC="${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers ${ISYSTEM}$FRAMEWORKSHOME/JavaVM/Headers"
7207         ;;
7209     dragonfly*)
7210         JAVAINC="-I$JAVA_HOME/include"
7211         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7212         ;;
7214     freebsd*)
7215         JAVAINC="-I$JAVA_HOME/include"
7216         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7217         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7218         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7219         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7220         ;;
7222     k*bsd*-gnu*)
7223         JAVAINC="-I$JAVA_HOME/include"
7224         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7225         ;;
7227     linux-gnu*)
7228         JAVAINC="-I$JAVA_HOME/include"
7229         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7230         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7231         ;;
7233     mingw*)
7234         JAVAINC="-I$JAVA_HOME/include"
7235         ;;
7237     *netbsd*)
7238         JAVAINC="-I$JAVA_HOME/include"
7239         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7240         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7241        ;;
7243     openbsd*)
7244         JAVAINC="-I$JAVA_HOME/include"
7245         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7246         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7247         ;;
7249     solaris*)
7250         JAVAINC="-I$JAVA_HOME/include"
7251         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7252         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7253         ;;
7254     esac
7256 SOLARINC="$SOLARINC $JAVAINC"
7258 AC_SUBST(JAVACOMPILER)
7259 AC_SUBST(JAVADOC)
7260 AC_SUBST(JAVAINTERPRETER)
7261 AC_SUBST(JAVAIFLAGS)
7262 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7263 AC_SUBST(JAVA_HOME)
7264 AC_SUBST(JAVA_SOURCE_VER)
7265 AC_SUBST(JAVA_TARGET_VER)
7266 AC_SUBST(JDK)
7268 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7269 if test -n "$with_idlc_cpp"; then
7270     AC_MSG_RESULT([$with_idlc_cpp])
7271     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7272 else
7273     AC_MSG_RESULT([ucpp])
7274     AC_MSG_CHECKING([which ucpp tp use])
7275     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7276         AC_MSG_RESULT([external])
7277         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7278     else
7279         AC_MSG_RESULT([internal])
7280         BUILD_TYPE="$BUILD_TYPE UCPP"
7281     fi
7283 AC_SUBST(SYSTEM_UCPP)
7285 dnl ===================================================================
7286 dnl Check for epm (not needed for Windows)
7287 dnl ===================================================================
7288 AC_MSG_CHECKING([whether to enable EPM for packing])
7289 if test "$enable_epm" = "yes"; then
7290     AC_MSG_RESULT([yes])
7291     if test "$_os" != "WINNT"; then
7292         if test $_os = Darwin; then
7293             EPM=internal
7294         elif test -n "$with_epm"; then
7295             EPM=$with_epm
7296         else
7297             AC_PATH_PROG(EPM, epm, no)
7298         fi
7299         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7300             echo "EPM will be built."
7301             BUILD_TYPE="$BUILD_TYPE EPM"
7302             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7303         else
7304             # Gentoo has some epm which is something different...
7305             AC_MSG_CHECKING([whether the found epm is the right epm])
7306             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7307                 AC_MSG_RESULT([yes])
7308             else
7309                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7310             fi
7311             AC_MSG_CHECKING([epm version])
7312             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7313             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7314                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7315                 AC_MSG_RESULT([OK, >= 3.7])
7316             else
7317                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7318                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7319             fi
7320         fi
7321     fi
7323     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7324         AC_MSG_CHECKING([for rpm])
7325         for a in "$RPM" rpmbuild rpm; do
7326             $a --usage >/dev/null 2> /dev/null
7327             if test $? -eq 0; then
7328                 RPM=$a
7329                 break
7330             else
7331                 $a --version >/dev/null 2> /dev/null
7332                 if test $? -eq 0; then
7333                     RPM=$a
7334                     break
7335                 fi
7336             fi
7337         done
7338         if test -z "$RPM"; then
7339             AC_MSG_ERROR([not found])
7340         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7341             RPM_PATH=`which $RPM`
7342             AC_MSG_RESULT([$RPM_PATH])
7343             SCPDEFS="$SCPDEFS -DWITH_RPM"
7344         else
7345             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7346         fi
7347     fi
7348     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7349         AC_PATH_PROG(DPKG, dpkg, no)
7350         if test "$DPKG" = "no"; then
7351             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7352         fi
7353     fi
7354     if echo "$PKGFORMAT" | $EGREP osx 2>&1 >/dev/null; then
7355         if test "$_os" = "Darwin"; then
7356             AC_MSG_CHECKING([for PackageMaker availability])
7357             if ! test -x /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker; then
7358                 AC_MSG_ERROR([not installed. Please install Apples Dev Tools])
7359             else
7360                 AC_MSG_RESULT([ok])
7361             fi
7362         else
7363             AC_MSG_ERROR([PackageMaker needed to build OSX packages and you are not on OSX...])
7364         fi
7365     fi
7366     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7367        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7368         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7369             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7370                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7371                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7372                     AC_MSG_RESULT([yes])
7373                 else
7374                     AC_MSG_RESULT([no])
7375                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7376                         _pt="rpm"
7377                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7378                         add_warning "the rpms will need to be installed with --nodeps"
7379                     else
7380                         _pt="pkg"
7381                     fi
7382                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
7383                     add_warning "the ${_pt}s will not be relocateable"
7384                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7385                                  relocation will work, you need to patch your epm with the
7386                                  patch in epm/epm-3.7.patch or build with
7387                                  --with-epm=internal which will build a suitable epm])
7388                 fi
7389             fi
7390         fi
7391     fi
7392     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7393         AC_PATH_PROG(PKGMK, pkgmk, no)
7394         if test "$PKGMK" = "no"; then
7395             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7396         fi
7397     fi
7398     AC_SUBST(RPM)
7399     AC_SUBST(DPKG)
7400     AC_SUBST(PKGMK)
7401 else
7402     for i in $PKGFORMAT; do
7403         case "$i" in
7404         aix | bsd | deb | osx | pkg | rpm | native | portable)
7405             AC_MSG_ERROR(
7406                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7407             ;;
7408         esac
7409     done
7410     AC_MSG_RESULT([no])
7411     EPM=NO
7413 AC_SUBST(EPM)
7415 dnl ===================================================================
7416 dnl We need winegcc when building MinGW build to be able to cross-build msi tools
7417 dnl ===================================================================
7418 WINEGCC=
7419 if test "$enable_winegcc" = "yes"; then
7420     AC_PATH_PROG(WINEGCC, winegcc)
7421     if test "$WINEGCC" = ""; then
7422         AC_MSG_ERROR([winegcc was not found, please install wine-devel, or wine-devel-32bit])
7423     fi
7424     CC_save="$CC"
7425     ac_exeext_save="$ac_exeext"
7426     CC="$WINEGCC -m32"
7427     ac_exeext=".exe"
7428     AC_LINK_IFELSE([AC_LANG_PROGRAM([
7429 #include <stdio.h>
7430         ],[
7431 printf ("hello world\n");
7432         ])],,
7433         [AC_MSG_ERROR([winegcc cannot build 32bit binaries, please install glibc-devel-32bit and gcc-32bit])]
7434     )
7435     CC="$CC_save"
7436     ac_exeext="$ac_exeext_save"
7438 AC_SUBST(WINEGCC)
7440 if test $_os = iOS; then
7441     enable_mpl_subset=yes
7442     enable_opengl=no
7443     enable_lotuswordpro=no
7444     enable_coinmp=yes
7445     enable_lpsolve=no
7446     enable_postgresql_sdbc=no
7447     enable_extension_integration=no
7448     enable_report_builder=no
7449     with_theme="tango"
7450     with_ppds=no
7453 ENABLE_LWP=
7454 if test "$enable_lotuswordpro" = "yes"; then
7455     ENABLE_LWP="TRUE"
7456     SCPDEFS="$SCPDEFS -DDISABLE_LWP"
7458 AC_SUBST(ENABLE_LWP)
7460 dnl ===================================================================
7461 dnl Check for gperf
7462 dnl ===================================================================
7463 AC_PATH_PROG(GPERF, gperf)
7464 if test -z "$GPERF"; then
7465     AC_MSG_ERROR([gperf not found but needed. Install it.])
7467 AC_MSG_CHECKING([gperf version])
7468 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
7469     AC_MSG_RESULT([OK])
7470 else
7471     AC_MSG_ERROR([too old, you need at least 3.0.0])
7473 AC_SUBST(GPERF)
7475 dnl ===================================================================
7476 dnl Check for building ODK
7477 dnl ===================================================================
7478 if test "$enable_odk" = no; then
7479     unset DOXYGEN
7480 else
7481     if test "$with_doxygen" = no; then
7482         AC_MSG_CHECKING([for doxygen])
7483         unset DOXYGEN
7484         AC_MSG_RESULT([no])
7485     else
7486         if test "$with_doxygen" = yes; then
7487             AC_PATH_PROG([DOXYGEN], [doxygen])
7488             if test -z "$DOXYGEN"; then
7489                 if test "$enable_odk" = "" ; then
7490                     enable_odk="no"
7491                 else
7492                     AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7493                 fi
7494             fi
7495         else
7496             AC_MSG_CHECKING([for doxygen])
7497             DOXYGEN=$with_doxygen
7498             AC_MSG_RESULT([$DOXYGEN])
7499         fi
7500         if test -n "$DOXYGEN"; then
7501            DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7502            DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7503            if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7504               AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7505            fi
7506         fi
7507     fi
7509 AC_SUBST([DOXYGEN])
7511 AC_MSG_CHECKING([whether to build the ODK])
7512 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7513     AC_MSG_RESULT([yes])
7515     if test "$with_java" != "no"; then
7516         AC_MSG_CHECKING([whether to build unowinreg.dll])
7517         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7518             # build on Win by default
7519             enable_build_unowinreg=yes
7520         fi
7521         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7522             AC_MSG_RESULT([no])
7523             BUILD_UNOWINREG=
7524         else
7525             AC_MSG_RESULT([yes])
7526             BUILD_UNOWINREG=TRUE
7527         fi
7528         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7529             if test -z "$with_mingw_cross_compiler"; then
7530                 dnl Guess...
7531                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7532             elif test -x "$with_mingw_cross_compiler"; then
7533                  MINGWCXX="$with_mingw_cross_compiler"
7534             else
7535                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7536             fi
7538             if test "$MINGWCXX" = "false"; then
7539                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7540             fi
7542             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7543             if test -x "$mingwstrip_test"; then
7544                 MINGWSTRIP="$mingwstrip_test"
7545             else
7546                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7547             fi
7549             if test "$MINGWSTRIP" = "false"; then
7550                 AC_MSG_ERROR(MinGW32 binutils not found.)
7551             fi
7552         fi
7553     fi
7554     BUILD_TYPE="$BUILD_TYPE ODK"
7555 else
7556     AC_MSG_RESULT([no])
7557     BUILD_UNOWINREG=
7559 AC_SUBST(BUILD_UNOWINREG)
7560 AC_SUBST(MINGWCXX)
7561 AC_SUBST(MINGWSTRIP)
7563 dnl ===================================================================
7564 dnl Check for system zlib
7565 dnl ===================================================================
7566 if test "$with_system_zlib" = "auto"; then
7567     case "$_os" in
7568     WINNT)
7569         with_system_zlib="$with_system_libs"
7570         ;;
7571     *)
7572         with_system_zlib=yes
7573         ;;
7574     esac
7577 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7578 dnl and has no pkg-config for it at least on some tinderboxes,
7579 dnl so leaving that out for now
7580 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7581 AC_MSG_CHECKING([which zlib to use])
7582 if test "$with_system_zlib" = "yes"; then
7583     AC_MSG_RESULT([external])
7584     SYSTEM_ZLIB=TRUE
7585     AC_CHECK_HEADER(zlib.h, [],
7586         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7587     AC_CHECK_LIB(z, deflate, [ ZLIB=-lz ],
7588         [AC_MSG_ERROR(zlib not found or functional)], [])
7589 else
7590     AC_MSG_RESULT([internal])
7591     SYSTEM_ZLIB=
7592     BUILD_TYPE="$BUILD_TYPE ZLIB"
7593     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7594     ZLIB_LIBS="-lzlib"
7596 AC_SUBST(ZLIB_CFLAGS)
7597 AC_SUBST(ZLIB_LIBS)
7598 AC_SUBST(SYSTEM_ZLIB)
7600 dnl ===================================================================
7601 dnl Check for system jpeg
7602 dnl ===================================================================
7603 AC_MSG_CHECKING([which jpeg to use])
7604 if test "$with_system_jpeg" = "auto"; then
7605     case "$_os" in
7606     WINNT|Darwin|iOS|Android)
7607         with_system_jpeg="$with_system_libs"
7608         ;;
7609     *)
7610         with_system_jpeg=yes
7611         ;;
7612     esac
7615 if test "$with_system_jpeg" = "yes"; then
7616     AC_MSG_RESULT([external])
7617     SYSTEM_JPEG=TRUE
7618     AC_CHECK_HEADER(jpeglib.h, [],
7619         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7620     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ JPEG3RDLIB=-ljpeg ],
7621     [AC_MSG_CHECKING(jpeg library not found or fuctional)], [])
7622     libo_MINGW_CHECK_DLL([libjpeg])
7623 else
7624     AC_MSG_RESULT([internal])
7625     SYSTEM_JPEG=
7626     BUILD_TYPE="$BUILD_TYPE JPEG"
7628 AC_SUBST(SYSTEM_JPEG)
7631 dnl ===================================================================
7632 dnl Check for system clucene
7633 dnl ===================================================================
7634 dnl we should rather be using
7635 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7636 dnl but the contribs-lib check seems tricky
7637 AC_MSG_CHECKING([which clucene to use])
7638 if test "$with_system_clucene" = "yes"; then
7639     AC_MSG_RESULT([external])
7640     SYSTEM_CLUCENE=TRUE
7641     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7642     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7643     AC_LANG_PUSH([C++])
7644     save_CXXFLAGS=$CXXFLAGS
7645     save_CPPFLAGS=$CPPFLAGS
7646     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7647     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7648     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7649     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7650     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7651                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7652     CXXFLAGS=$save_CXXFLAGS
7653     CPPFLAGS=$save_CPPFLAGS
7654     AC_LANG_POP([C++])
7656     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7657 else
7658     AC_MSG_RESULT([internal])
7659     SYSTEM_CLUCENE=
7660     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7662 AC_SUBST(SYSTEM_CLUCENE)
7663 AC_SUBST(CLUCENE_CFLAGS)
7664 AC_SUBST(CLUCENE_LIBS)
7666 dnl ===================================================================
7667 dnl Check for system expat
7668 dnl ===================================================================
7669 dnl we should use libo_CHECK_SYSTEM_MODULE, but e.g. the mingw tinderbox has no
7670 dnl proper pkg-config for it. It should really be fixed on the tinderbox though.
7671 AC_MSG_CHECKING([which expat to use])
7672 if test "$with_system_expat" = "yes"; then
7673     AC_MSG_RESULT([external])
7674     SYSTEM_EXPAT=TRUE
7675     AC_CHECK_HEADER(expat.h, [],
7676         [AC_MSG_ERROR(expat.h not found. install expat)], [])
7677     AC_CHECK_LIB([expat], [XML_ParserCreate], [:],
7678         [AC_MSG_RESULT(expat library not found or functional.)], [])
7679     libo_MINGW_CHECK_DLL([libexpat])
7680 else
7681     AC_MSG_RESULT([internal])
7682     SYSTEM_EXPAT=
7683     BUILD_TYPE="$BUILD_TYPE EXPAT"
7685 AC_SUBST(SYSTEM_EXPAT)
7687 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7688 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7689     ENABLE_EOT="TRUE"
7690     AC_DEFINE([ENABLE_EOT])
7691     AC_MSG_RESULT([yes])
7693     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7694 else
7695     ENABLE_EOT=
7696     AC_MSG_RESULT([no])
7698 AC_SUBST([ENABLE_EOT])
7700 dnl ===================================================================
7701 dnl Check for system libe-book
7702 dnl ===================================================================
7703 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.0 >= 0.0.2],["-I${WORKDIR}/UnpackedTarball/libebook/inc"],["-L${WORKDIR}/UnpackedTarball/libebook/src/lib/.libs -le-book-0.0"])
7705 dnl ===================================================================
7706 dnl Check for system libetonyek
7707 dnl ===================================================================
7708 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.0],["-I${WORKDIR}/UnpackedTarball/libetonyek/inc"],["-L${WORKDIR}/UnpackedTarball/libetonyek/src/lib/.libs -letonyek-0.0"])
7710 dnl ===================================================================
7711 dnl Check for system libfreehand
7712 dnl ===================================================================
7713 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.0],["-I${WORKDIR}/UnpackedTarball/libfreehand/inc"],["-L${WORKDIR}/UnpackedTarball/libfreehand/src/lib/.libs -lfreehand-0.0"])
7715 dnl ===================================================================
7716 dnl Check for system libodfgen
7717 dnl ===================================================================
7718 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.0 >= 0.0.3])
7720 dnl ===================================================================
7721 dnl Check for system libcdr
7722 dnl ===================================================================
7723 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.0 >= 0.0.5])
7725 dnl ===================================================================
7726 dnl Check for system libmspub
7727 dnl ===================================================================
7728 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.0])
7730 dnl ===================================================================
7731 dnl Check for system libmwaw
7732 dnl ===================================================================
7733 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.2])
7735 dnl ===================================================================
7736 dnl Check for system libvisio
7737 dnl ===================================================================
7738 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.0])
7740 dnl ===================================================================
7741 dnl Check for system libcmis
7742 dnl ===================================================================
7743 # libcmis requires curl and we can't build curl for iOS
7744 if test $_os != iOS; then
7745     libo_CHECK_SYSTEM_MODULE([libcmis],[CMIS],[libcmis-0.4 >= 0.4.0])
7746     ENABLE_CMIS=TRUE
7747 else
7748     ENABLE_CMIS=
7750 AC_SUBST(ENABLE_CMIS)
7752 dnl ===================================================================
7753 dnl Check for system libwpd
7754 dnl ===================================================================
7755 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.9 >= 0.9.5 libwpd-stream-0.9 >= 0.9.5],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs -lwpd-0.9"])
7757 dnl ===================================================================
7758 dnl Check for system lcms2
7759 dnl ===================================================================
7760 if test "$with_system_lcms2" = "yes"; then
7761     libo_MINGW_CHECK_DLL([liblcms2])
7762 else
7763     SYSTEM_LCMS2=
7765 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7766 if test "$GCC" = "yes"; then
7767     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7769 if test "$COM" = "MSC"; then # override the above
7770     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7773 dnl ===================================================================
7774 dnl Check for system cppunit
7775 dnl ===================================================================
7776 if test "$cross_compiling" != "yes"; then
7777     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.12.0])
7780 dnl ===================================================================
7781 dnl Check whether freetype is available
7782 dnl ===================================================================
7783 if test  "$test_freetype" = "yes"; then
7784     AC_MSG_CHECKING([whether freetype is available])
7785     # FreeType has 3 different kinds of versions
7786     # * release, like 2.4.10
7787     # * libtool, like 13.0.7 (this what pkg-config returns)
7788     # * soname
7789     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7790     #
7791     # 9.9.3 is 2.2.0
7792     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7793     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7794     SYSTEM_FREETYPE=TRUE
7795     _save_libs="$LIBS"
7796     _save_cflags="$CFLAGS"
7797     LIBS="$LIBS $FREETYPE_LIBS"
7798     CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
7799     AC_CHECK_FUNC(FT_Face_GetCharVariantIndex, AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX), [])
7800     LIBS="$_save_libs"
7801     CFLAGS="$_save_cflags"
7803 AC_SUBST(FREETYPE_CFLAGS)
7804 AC_SUBST(FREETYPE_LIBS)
7805 AC_SUBST([SYSTEM_FREETYPE])
7807 dnl ===================================================================
7808 dnl Check for system libabw
7809 dnl ===================================================================
7810 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.0],["-I${WORKDIR}/UnpackedTarball/libabw/inc"],["-L${WORKDIR}/UnpackedTarball/libabw/src/lib/.libs -labw-0.0"])
7812 dnl ===================================================================
7813 dnl Check for system libwps
7814 dnl ===================================================================
7815 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.2],["-I${WORKDIR}/UnpackedTarball/libwps/inc"],["-L${WORKDIR}/UnpackedTarball/libwps/src/lib/.libs -lwps-0.2"])
7817 dnl ===================================================================
7818 dnl Check for system libwpg
7819 dnl ===================================================================
7820 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.2],["-I${WORKDIR}/UnpackedTarball/libwpg/inc"],["-L${WORKDIR}/UnpackedTarball/libwpg/src/lib/.libs -lwpg-0.2"])
7822 # ===================================================================
7823 # Check for system libxslt
7824 # to prevent incompatibilities between internal libxml2 and external libxslt,
7825 # or vice versa, use with_system_libxml here
7826 # ===================================================================
7827 if test "$with_system_libxml" = "auto"; then
7828     case "$_os" in
7829     WINNT|iOS|Android)
7830         with_system_libxml="$with_system_libs"
7831         ;;
7832     *)
7833         if test "$_os" = "Darwin" -a $MAC_OS_X_VERSION_MAX_ALLOWED -lt 1060; then
7834             with_system_libxml=no
7835         else
7836             with_system_libxml=yes
7837         fi
7838         ;;
7839     esac
7842 AC_MSG_CHECKING([which libxslt to use])
7843 if test "$with_system_libxml" = "yes"; then
7844     AC_MSG_RESULT([external])
7845     SYSTEM_LIBXSLT=TRUE
7846     if test "$_os" = "Darwin"; then
7847         dnl make sure to use SDK path
7848         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7849         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7850         dnl omit -L/usr/lib
7851         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7852         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7853     else
7854         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7855         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7856         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7857         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7858     fi
7860     dnl Check for xsltproc
7861     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7862     if test "$XSLTPROC" = "no"; then
7863         AC_MSG_ERROR([xsltproc is required])
7864     fi
7866     libo_MINGW_CHECK_DLL([libxslt])
7867     libo_MINGW_CHECK_DLL([libexslt])
7868     libo_MINGW_TRY_DLL([iconv])
7869 else
7870     AC_MSG_RESULT([internal])
7871     SYSTEM_LIBXSLT=
7872     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
7874     if test "$cross_compiling" = "yes"; then
7875         AC_PATH_PROG(XSLTPROC, xsltproc, no)
7876         if test "$XSLTPROC" = "no"; then
7877             AC_MSG_ERROR([xsltproc is required])
7878         fi
7879     fi
7881 AC_SUBST(SYSTEM_LIBXSLT)
7882 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
7883     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
7885 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
7887 AC_SUBST(LIBEXSLT_CFLAGS)
7888 AC_SUBST(LIBEXSLT_LIBS)
7889 AC_SUBST(LIBXSLT_CFLAGS)
7890 AC_SUBST(LIBXSLT_LIBS)
7891 AC_SUBST(XSLTPROC)
7893 # ===================================================================
7894 # Check for system libxml
7895 # ===================================================================
7896 AC_MSG_CHECKING([which libxml to use])
7897 if test "$with_system_libxml" = "yes"; then
7898     AC_MSG_RESULT([external])
7899     SYSTEM_LIBXML=TRUE
7900     if test "$_os" = "Darwin"; then
7901         dnl make sure to use SDK path
7902         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7903         dnl omit -L/usr/lib
7904         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
7905     elif test $_os = iOS; then
7906         dnl make sure to use SDK path
7907         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
7908         LIBXML_CFLAGS="-I$usr/include/libxml2"
7909         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
7910     else
7911         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
7912         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7913     fi
7915     dnl Check for xmllint
7916     AC_PATH_PROG(XMLLINT, xmllint, no)
7917     if test "$XMLLINT" = "no"; then
7918         AC_MSG_ERROR([xmllint is required])
7919     fi
7921     libo_MINGW_CHECK_DLL([libxml2])
7922     libo_MINGW_TRY_DLL([zlib1])
7923 else
7924     AC_MSG_RESULT([internal])
7925     SYSTEM_LIBXML=
7926     BUILD_TYPE="$BUILD_TYPE LIBXML2"
7928 AC_SUBST(SYSTEM_LIBXML)
7929 AC_SUBST(LIBXML_CFLAGS)
7930 AC_SUBST(LIBXML_LIBS)
7931 AC_SUBST(XMLLINT)
7933 # =====================================================================
7934 # Checking for a Python interpreter with version >= 2.5 needed to build LO.
7935 # runtime requires Python 3 compatible version (>= 2.6)
7936 # Optionally user can pass an option to configure, i. e.
7937 # ./configure PYTHON=/usr/bin/python
7938 # =====================================================================
7939 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
7940     # This allows a lack of system python with no error, we use internal one in that case.
7941     AM_PATH_PYTHON([2.5],, [:])
7942     # Clean PYTHON_VERSION checked below if cross-compiling
7943     PYTHON_VERSION=""
7944     if test "$PYTHON" != ":"; then
7945         PYTHON_FOR_BUILD=$PYTHON
7946     fi
7948 AC_SUBST(PYTHON_FOR_BUILD)
7950 # Checks for Python to use for Pyuno
7951 AC_MSG_CHECKING([which Python to use for Pyuno])
7952 case "$enable_python" in
7953 no|disable)
7954     if test -z $PYTHON_FOR_BUILD; then
7955         # Python is required to build LibreOffice. In theory we could separate the build-time Python
7956         # requirement from the choice whether to include Python stuff in the installer, but why
7957         # bother?
7958         AC_MSG_ERROR([Python is required at build time.])
7959     fi
7960     enable_python=no
7961     AC_MSG_RESULT([none])
7962     ;;
7963 ""|yes|auto)
7964     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
7965         AC_MSG_RESULT([no, overridden by --disable-scripting])
7966         enable_python=no
7967     elif test $build_os = cygwin; then
7968         dnl When building on Windows we don't attempt to use any installed
7969         dnl "system"  Python.
7970         dnl
7971         dnl (When cross-compiling to Windows from Linux using the mingw32-cross
7972         dnl compiler from OBS, use mingw32-python from OBS, and ditto for other
7973         dnl MinGW cross-compilation setups.)
7974         AC_MSG_RESULT([fully internal])
7975         enable_python=internal
7976     elif test "$cross_compiling" = yes; then
7977         AC_MSG_RESULT([system])
7978         enable_python=system
7979     else
7980         # Unset variables set by the above AM_PATH_PYTHON so that
7981         # we actually do check anew.
7982         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
7983         AM_PATH_PYTHON([3.3],, [:])
7984         if test "$PYTHON" = :; then
7985             AC_MSG_RESULT([internal])
7986             enable_python=internal
7987         else
7988             AC_MSG_RESULT([system])
7989             enable_python=system
7990         fi
7991     fi
7992     ;;
7993 internal)
7994     AC_MSG_RESULT([internal])
7995     ;;
7996 fully-internal)
7997     AC_MSG_RESULT([fully internal])
7998     enable_python=internal
7999     ;;
8000 system)
8001     AC_MSG_RESULT([system])
8002     ;;
8004     AC_MSG_ERROR([Incorrect --enable-python option])
8005     ;;
8006 esac
8008 if test $enable_python != no; then
8009     BUILD_TYPE="$BUILD_TYPE PYUNO"
8012 if test $enable_python = system; then
8013     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8014         # We already have logic above to make sure the system Python
8015         # is used only when building against SDK 10.6 or newer.
8017         # Make sure we use the 2.6 Python when building against the
8018         # 10.6 SDK.
8019         case $with_macosx_sdk in
8020         10.6)
8021             python_version=2.6;;
8022         10.7|10.8)
8023             python_version=2.7;;
8024         *)
8025             # ???
8026             python_version=2.7;;
8027         esac
8028         PYTHON=python$python_version
8029         PYTHON_CFLAGS="-I/Developer/SDKs/MacOSX${with_macosx_sdk}.sdk/System/Library/Frameworks/Python.framework/Versions/${python_version}/include/python${python_version}"
8030         PYTHON_LIBS="-framework Python"
8031     fi
8032     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8033         # Fallback: Accept these in the environment, or as set above
8034         # for MacOSX.
8035         :
8036     elif test "$cross_compiling" != yes; then
8037         # Unset variables set by the above AM_PATH_PYTHON so that
8038         # we actually do check anew.
8039         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
8040         # This causes an error if no python command is found
8041         AM_PATH_PYTHON([3.3])
8042         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8043         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8044         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8045         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8046         if test -z "$PKG_CONFIG"; then
8047             PYTHON_CFLAGS="-I$python_include"
8048             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8049         elif $PKG_CONFIG --exists python-$python_version; then
8050             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8051             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8052         else
8053             PYTHON_CFLAGS="-I$python_include"
8054             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8055         fi
8056     else
8057         dnl How to find out the cross-compilation Python installation path?
8058         dnl Let's hardocode what we know for different distributions for now...
8059         for python_version in 2.6; do
8060             if test -f ${MINGW_SYSROOT}/include/python${python_version}/Python.h; then
8061                 PYTHON_CFLAGS="-I${MINGW_SYSROOT}/include/python$python_version"
8062                 PYTHON_LIBS="-L${MINGW_SYSROOT}/lib -lpython$python_version $python_libs"
8063                 AC_MSG_CHECKING([for python.exe])
8064                 libo_MINGW_CHECK_DLL([libpython$python_version])
8065                 libo_MINGW_CHECK_DLL([libreadline6])
8066                 libo_MINGW_CHECK_DLL([libtermcap])
8067                 # could we somehow extract the really mingw python version from
8068                 # actual distro package?
8069                 # 2.6.2 currently on OpenSUSE 12.1?
8070                 # rpm -q mingw32-python => mingw32-python-2.6.2-17.17.noarch
8071                 PYTHON_VERSION=$python_version.2
8072                 PYTHON_VERSION_MAJOR=`echo $python_version | cut -d . -f 1`
8073                 PYTHON_VERSION_MINOR=`echo $python_version | cut -d . -f 2`
8074                 break
8075             fi
8076         done
8077         AC_MSG_CHECKING([for python version])
8078         AS_IF([test -n "$PYTHON_VERSION"],
8079               [AC_MSG_RESULT([$PYTHON_VERSION])],
8080               [AC_MSG_RESULT([not found])
8081                AC_MSG_ERROR([no usable python found])])
8082         test -n "$PYTHON_CFLAGS" && break
8083     fi
8084     # let the PYTHON_FOR_BUILD match the same python installation that
8085     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8086     # better for PythonTests.
8087     PYTHON_FOR_BUILD=$PYTHON
8090 dnl By now enable_python should be "system", "internal" or "no"
8091 case $enable_python in
8092 system)
8093     SYSTEM_PYTHON=TRUE
8095     if test "$CROSS_COMPILING" != TRUE; then
8096         dnl Check if the headers really work
8097         save_CPPFLAGS="$CPPFLAGS"
8098         CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8099         AC_CHECK_HEADER(Python.h, [],
8100            [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
8101            [])
8102         CPPFLAGS="$save_CPPFLAGS"
8104         AC_LANG_PUSH(C)
8105         CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8106         AC_MSG_CHECKING([for correct python library version])
8107            AC_RUN_IFELSE([AC_LANG_SOURCE([[
8108 #include <Python.h>
8110 int main(int argc, char **argv) {
8111        if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
8112            (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8113        else return 1;
8115            ]])],[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])],[])
8116         CFLAGS=$save_CFLAGS
8117         AC_LANG_POP(C)
8119         dnl FIXME Check if the Python library can be linked with, too?
8120     fi
8121     ;;
8123 internal)
8124     SYSTEM_PYTHON=
8125     PYTHON_VERSION_MAJOR=3
8126     PYTHON_VERSION_MINOR=3
8127     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.3
8128     BUILD_TYPE="$BUILD_TYPE PYTHON"
8129     # Embedded Python dies without Home set
8130     if test "$HOME" = ""; then
8131         export HOME=""
8132     fi
8133     # bz2 tarball and bzip2 is not standard
8134     if test -z "$BZIP2"; then
8135         AC_PATH_PROG( BZIP2, bzip2)
8136         if test -z "$BZIP2"; then
8137             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
8138         fi
8139     fi
8140     ;;
8142     DISABLE_PYTHON=TRUE
8143     SYSTEM_PYTHON=
8144     ;;
8146     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8147     ;;
8148 esac
8150 AC_SUBST(DISABLE_PYTHON)
8151 AC_SUBST(SYSTEM_PYTHON)
8152 AC_SUBST(PYTHON_CFLAGS)
8153 AC_SUBST(PYTHON_LIBS)
8154 AC_SUBST(PYTHON_VERSION)
8155 AC_SUBST(PYTHON_VERSION_MAJOR)
8156 AC_SUBST(PYTHON_VERSION_MINOR)
8158 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8159 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8160     AC_MSG_RESULT([yes])
8161     ENABLE_MARIADBC=TRUE
8162     MARIADBC_MAJOR=1
8163     MARIADBC_MINOR=0
8164     MARIADBC_MICRO=2
8165     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8166 else
8167     AC_MSG_RESULT([no])
8168     ENABLE_MARIADBC=
8170 AC_SUBST(ENABLE_MARIADBC)
8171 AC_SUBST(MARIADBC_MAJOR)
8172 AC_SUBST(MARIADBC_MINOR)
8173 AC_SUBST(MARIADBC_MICRO)
8175 if test "$ENABLE_MARIADBC" = "TRUE"; then
8177     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8179     dnl ===================================================================
8180     dnl Check for system MariaDB
8181     dnl ===================================================================
8182     AC_MSG_CHECKING([which MariaDB to use])
8183     if test "$with_system_mariadb" = "yes"; then
8184         AC_MSG_RESULT([external])
8185         SYSTEM_MARIADB=TRUE
8186         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8187         if test -z "$MARIADBCONFIG"; then
8188             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8189             if test -z "$MARIADBCONFIG"; then
8190                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL package.])
8191                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8192             fi
8193         fi
8194         AC_MSG_CHECKING([MariaDB version])
8195         MARIADB_VERSION=`$MARIADBCONFIG --version`
8196         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8197         if test "$MARIADB_MAJOR" -ge "5"; then
8198             AC_MSG_RESULT([OK])
8199         else
8200             AC_MSG_ERROR([too old, use 5.0.x or later])
8201         fi
8202         AC_MSG_CHECKING([for MariaDB Client library])
8203         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8204         if test "$COM_GCC_IS_CLANG" = TRUE; then
8205             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8206         fi
8207         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8208         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8209         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8210         dnl linux32:
8211         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8212             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8213             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8214                 | sed -e 's|/lib64/|/lib/|')
8215         fi
8216         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8217         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8218         if test "$enable_bundle_mariadb" = "yes"; then
8219             AC_MSG_RESULT([yes])
8220             BUNDLE_MARIADB=TRUE
8221             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\+-l/\n/g' | grep -E '(mysqlclient|mariadb)')
8222             if test "$_os" = "Darwin"; then
8223                 LIBMARIADB=${LIBMARIADB}.dylib
8224             elif test "$_os" = "WINNT"; then
8225                 LIBMARIADB=${LIBMARIADB}.dll
8226             else
8227                 LIBMARIADB=${LIBMARIADB}.so
8228             fi
8229             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8230             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8231             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8232                 AC_MSG_RESULT([found.])
8233                 PathFormat "$LIBMARIADB_PATH"
8234                 LIBMARIADB_PATH="$formatted_path"
8235             else
8236                 AC_MSG_ERROR([not found.])
8237             fi
8238         else
8239             AC_MSG_RESULT([no])
8240             BUNDLE_MARIADB=
8241         fi
8242     else
8243         AC_MSG_RESULT([internal])
8244         AC_MSG_ERROR([libmariadb is known to be broken as of 2013-10; use libmysqlclient])
8245         SYSTEM_MARIADB=
8246         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb/include"
8247         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadblib"
8248         BUILD_TYPE="$BUILD_TYPE MARIADB"
8249     fi
8251     AC_SUBST(SYSTEM_MARIADB)
8252     AC_SUBST(MARIADB_CFLAGS)
8253     AC_SUBST(MARIADB_LIBS)
8254     AC_SUBST(LIBMARIADB)
8255     AC_SUBST(LIBMARIADB_PATH)
8256     AC_SUBST(BUNDLE_MARIADB)
8258     AC_LANG_PUSH([C++])
8259     dnl ===================================================================
8260     dnl Check for system MySQL C++ Connector
8261     dnl ===================================================================
8262     # FIXME!
8263     # who thought this too-generic cppconn dir was a good idea?
8264     AC_MSG_CHECKING([MySQL Connector/C++])
8265     if test "$with_system_mysql_cppconn" = "yes"; then
8266         AC_MSG_RESULT([external])
8267         SYSTEM_MYSQL_CPPCONN=TRUE
8268         AC_LANG_PUSH([C++])
8269         AC_CHECK_HEADER(mysql_driver.h, [],
8270                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8271         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8272                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8273         save_LIBS=$LIBS
8274         LIBS="$LIBS -lmysqlcppconn"
8275         AC_MSG_CHECKING([version])
8276         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8277 #include <mysql_driver.h>
8279 int main(int argc, char **argv) {
8280     sql::Driver *driver;
8281     driver = get_driver_instance();
8282     if (driver->getMajorVersion() > 1 || \
8283        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8284        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8285         return 0;
8286       else
8287         return 1;
8289       ]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR([not suitable, we need >= 1.0.6])],[])
8291         AC_LANG_POP([C++])
8292         LIBS=$save_LIBS
8293     else
8294         AC_MSG_RESULT([internal])
8295         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
8296         SYSTEM_MYSQL_CPPCONN=
8297     fi
8298     AC_LANG_POP([C++])
8300 AC_SUBST(SYSTEM_MYSQL_CPPCONN)
8302 dnl ===================================================================
8303 dnl Check for system hsqldb
8304 dnl ===================================================================
8305 if test "$with_java" != "no"; then
8306 HSQLDB_USE_JDBC_4_1=
8307 AC_MSG_CHECKING([which hsqldb to use])
8308 if test "$with_system_hsqldb" = "yes"; then
8309     AC_MSG_RESULT([external])
8310     SYSTEM_HSQLDB=TRUE
8311     if test -z $HSQLDB_JAR; then
8312         HSQLDB_JAR=/usr/share/java/hsqldb.jar
8313     fi
8314     AC_CHECK_FILE($HSQLDB_JAR, [],
8315                [AC_MSG_ERROR(hsqldb.jar not found.)], [])
8316     AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8317     export HSQLDB_JAR
8318     if $PERL -e 'use Archive::Zip;
8319             my $file = "$ENV{'HSQLDB_JAR'}";
8320             my $zip = Archive::Zip->new( $file );
8321             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8322             if ( $mf =~ m/Specification-Version: 1.8.*/ ) {
8323                push @l, split(/\n/, $mf);
8324                foreach my $line (@l) {
8325                   if ($line =~ m/Specification-Version:/) {
8326                       ($t, $version) = split (/:/,$line);
8327                       $version =~ s/^\s//;
8328                       ($a, $b, $c, $d) = split (/\./,$version);
8329                       if ($c == "0" && $d > "8")  {
8330                           exit 0;
8331                       } else {
8332                           exit 1;
8333                       }
8334                   }
8335                }
8336             } else {
8337                 exit 1;
8338             }'; then
8339         AC_MSG_RESULT([yes])
8340     else
8341         AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8342     fi
8343 else
8344     AC_MSG_RESULT([internal])
8345     SYSTEM_HSQLDB=
8346     BUILD_TYPE="$BUILD_TYPE HSQLDB"
8347     AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8348     javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8349     if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8350         AC_MSG_RESULT([yes])
8351         HSQLDB_USE_JDBC_4_1=TRUE
8352     else
8353         AC_MSG_RESULT([no])
8354     fi
8356 AC_SUBST(SYSTEM_HSQLDB)
8357 AC_SUBST(HSQLDB_JAR)
8358 AC_SUBST([HSQLDB_USE_JDBC_4_1])
8361 dnl ===================================================================
8362 dnl Check for PostgreSQL stuff
8363 dnl ===================================================================
8364 if test "x$enable_postgresql_sdbc" != "xno"; then
8365     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8367     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8368         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8369     fi
8370     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8371         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8372     fi
8374     AC_MSG_CHECKING([PostgreSQL C interface])
8375     if test "$with_system_postgresql" = "yes"; then
8376         AC_MSG_RESULT([external PostgreSQL])
8377         SYSTEM_POSTGRESQL=TRUE
8378         if test "$_os" = Darwin; then
8379             supp_path=''
8380             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8381                 pg_supp_path="$P_SEP$d$pg_supp_path"
8382             done
8383         fi
8384         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8385         if test -z "$PGCONFIG"; then
8386             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8387         fi
8388         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8389         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8390     else
8391         # if/when anything else than PostgreSQL uses Kerberos,
8392         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8393         WITH_KRB5=
8394         WITH_GSSAPI=
8395         case "$_os" in
8396         Darwin)
8397             # MacOS X has system MIT Kerberos 5 since 10.4
8398             if test "$with_krb5" != "no"; then
8399                 WITH_KRB5=TRUE
8400                 save_LIBS=$LIBS
8401                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8402                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5, try installing libcom_err devel package])])
8403                 KRB5_LIBS=$LIBS
8404                 LIBS=$save_LIBS
8405                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8406                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5, try installing krb5 devel package])])
8407                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8408                 LIBS=$save_LIBS
8409             fi
8410             if test "$with_gssapi" != "no"; then
8411               WITH_GSSAPI=TRUE
8412               save_LIBS=$LIBS
8413               AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8414                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8415               GSSAPI_LIBS=$LIBS
8416               LIBS=$save_LIBS
8417             fi
8418             ;;
8419         WINNT)
8420             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8421                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8422             fi
8423             ;;
8424         Linux|GNU|*BSD|DragonFly)
8425             if test "$with_krb5" != "no"; then
8426                 WITH_KRB5=TRUE
8427                 save_LIBS=$LIBS
8428                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8429                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8430                 KRB5_LIBS=$LIBS
8431                 LIBS=$save_LIBS
8432                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8433                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8434                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8435                 LIBS=$save_LIBS
8436             fi
8437             if test "$with_gssapi" != "no"; then
8438                 WITH_GSSAPI=TRUE
8439                 save_LIBS=$LIBS
8440                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8441                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8442                 GSSAPI_LIBS=$LIBS
8443                 LIBS=$save_LIBS
8444             fi
8445             ;;
8446         *)
8447             if test "$with_krb5" = "yes"; then
8448                 WITH_KRB5=TRUE
8449                 save_LIBS=$LIBS
8450                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8451                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8452                 KRB5_LIBS=$LIBS
8453                 LIBS=$save_LIBS
8454                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8455                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8456                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8457                 LIBS=$save_LIBS
8458             fi
8459             if test "$with_gssapi" = "yes"; then
8460                 WITH_GSSAPI=TRUE
8461                 save_LIBS=$LIBS
8462                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8463                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8464                 LIBS=$save_LIBS
8465                 GSSAPI_LIBS=$LIBS
8466             fi
8467         esac
8469         if test -n "$with_libpq_path"; then
8470             SYSTEM_POSTGRESQL=TRUE
8471             AC_MSG_RESULT([external libpq])
8472             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8473             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8474         else
8475             SYSTEM_POSTGRESQL=
8476             AC_MSG_RESULT([internal])
8477             POSTGRESQL_LIB=""
8478             POSTGRESQL_INC="%OVERRIDE_ME%"
8479             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8480         fi
8481     fi
8482     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8483         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8484         save_CFLAGS=$CFLAGS
8485         save_CPPFLAGS=$CPPFLAGS
8486         save_LIBS=$LIBS
8487         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8488         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8489         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8490         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8491             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8492         CFLAGS=$save_CFLAGS
8493         CPPFLAGS=$save_CPPFLAGS
8494         LIBS=$save_LIBS
8495     fi
8496     BUILD_POSTGRESQL_SDBC=TRUE
8498 AC_SUBST(WITH_KRB5)
8499 AC_SUBST(WITH_GSSAPI)
8500 AC_SUBST(GSSAPI_LIBS)
8501 AC_SUBST(KRB5_LIBS)
8502 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8503 AC_SUBST(SYSTEM_POSTGRESQL)
8504 AC_SUBST(POSTGRESQL_INC)
8505 AC_SUBST(POSTGRESQL_LIB)
8507 dnl ===================================================================
8508 dnl Check for Firebird stuff
8509 dnl ===================================================================
8510 ENABLE_FIREBIRD_SDBC=""
8511 if test "x$enable_firebird_sdbc" = "xyes"; then
8512     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8514     dnl ===================================================================
8515     dnl Check for system Firebird
8516     dnl ===================================================================
8517     AC_MSG_CHECKING([which Firebird to use])
8518     if test "$with_system_firebird" = "yes"; then
8519         AC_MSG_RESULT([external])
8520         SYSTEM_FIREBIRD=TRUE
8521         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8522         if test -z "$FIREBIRDCONFIG"; then
8523             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8524             PKG_CHECK_MODULES(FIREBIRD, fbembed)
8525             FIREBIRD_VERSION=`pkg-config --modversion fbembed`
8526         else
8527             AC_MSG_NOTICE([fb_config found])
8528             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8529             AC_MSG_CHECKING([for Firebird Client library])
8530             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8531             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8532         fi
8533         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8534         AC_MSG_CHECKING([Firebird version])
8535         if test -n "${FIREBIRD_VERSION}"; then
8536             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8537             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8538             if test "$FIREBIRD_MAJOR" -eq "2" -a "$FIREBIRD_MINOR" -eq "5"; then
8539                 AC_MSG_RESULT([OK])
8540             else
8541                 AC_MSG_ERROR([Ensure firebird 2.5.x is installed])
8542             fi
8543         else
8544             __save_CFLAGS="${CFLAGS}"
8545             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8546             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8547 #if defined(FB_API_VER) && FB_API_VER == 25
8548 #else
8549 #error "Wrong Firebird API version"
8550 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 2.5.x is installed]))
8551             CFLAGS="${__save_CFLAGS}"
8552         fi
8553         ENABLE_FIREBIRD_SDBC="TRUE"
8554     elif test "$enable_database_connectivity" != yes; then
8555         AC_MSG_RESULT([none])
8556     elif test "$cross_compiling" = "yes"; then
8557         AC_MSG_RESULT([none])
8558     else
8559         dnl We need libatomic-ops for any non X86/X64 system
8560         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8561             dnl ===================================================================
8562             dnl Check for system libatomic-ops
8563             dnl ===================================================================
8564             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8565             if test "$with_system_libatomic_ops" = "yes"; then
8566                 SYSTEM_LIBATOMIC_OPS=TRUE
8567                 AC_CHECK_HEADERS(atomic_ops.h, [],
8568                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8569             else
8570                 SYSTEM_LIBATOMIC_OPS=
8571                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8572                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8573                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8574             fi
8575         fi
8577         AC_MSG_RESULT([internal])
8578         SYSTEM_FIREBIRD=
8579         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/include"
8580         FIREBIRD_LIBS="-lfbembed"
8582         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8583         ENABLE_FIREBIRD_SDBC="TRUE"
8584     fi
8587 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8588 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8589 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8590 AC_SUBST(LIBATOMIC_OPS_LIBS)
8591 AC_SUBST(SYSTEM_FIREBIRD)
8592 AC_SUBST(FIREBIRD_CFLAGS)
8593 AC_SUBST(FIREBIRD_LIBS)
8594 dnl AC_SUBST([TOMMATH_CFLAGS])
8595 dnl AC_SUBST([TOMMATH_LIBS])
8597 dnl ===================================================================
8598 dnl Check for system curl
8599 dnl ===================================================================
8600 AC_MSG_CHECKING([which libcurl to use])
8601 if test "$with_system_curl" = "auto"; then
8602     with_system_curl="$with_system_libs"
8605 if test "$with_system_curl" = "yes"; then
8606     AC_MSG_RESULT([external])
8607     SYSTEM_CURL=TRUE
8609     AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8611     # First try PKGCONFIG and then fall back
8612     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8614     if test -n "$CURL_PKG_ERRORS"; then
8615         AC_PATH_PROG(CURLCONFIG, curl-config)
8616         if test -z "$CURLCONFIG"; then
8617             AC_MSG_ERROR([curl developement files not found])
8618         fi
8619         CURL_LIBS=`$CURLCONFIG --libs`
8620         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8621         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8623         case $curl_version in
8624         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8625         dnl so they need to be doubled to end up in the configure script
8626         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8627             ;;
8628         *)
8629             AC_MSG_ERROR([no, you have $curl_version])
8630             ;;
8631         esac
8632     fi
8633     AC_MSG_RESULT([yes])
8635     libo_MINGW_CHECK_DLL([libcurl])
8636     libo_MINGW_TRY_DLL([libintl])
8637     libo_MINGW_TRY_DLL([libidn])
8638     libo_MINGW_TRY_DLL([libnspr4])
8639     libo_MINGW_TRY_DLL([nssutil3])
8640     libo_MINGW_TRY_DLL([libplc4])
8641     libo_MINGW_TRY_DLL([libplds4])
8642     libo_MINGW_TRY_DLL([nss3])
8643     libo_MINGW_TRY_DLL([ssl3])
8644     libo_MINGW_TRY_DLL([libgpg-error])
8645     libo_MINGW_TRY_DLL([libgcrypt])
8646     libo_MINGW_TRY_DLL([libssh2])
8647     ENABLE_CURL=TRUE
8648 elif test $_os = iOS; then
8649     # Let's see if we need curl, I think not?
8650     AC_MSG_RESULT([none])
8651     ENABLE_CURL=
8652 else
8653     AC_MSG_RESULT([internal])
8654     SYSTEM_CURL=
8655     BUILD_TYPE="$BUILD_TYPE CURL"
8656     ENABLE_CURL=TRUE
8658 AC_SUBST(SYSTEM_CURL)
8659 AC_SUBST(CURL_CFLAGS)
8660 AC_SUBST(CURL_LIBS)
8661 AC_SUBST(ENABLE_CURL)
8663 dnl ===================================================================
8664 dnl Check for system boost
8665 dnl ===================================================================
8666 AC_MSG_CHECKING([which boost to use])
8667 if test "$with_system_boost" = "yes"; then
8668     AC_MSG_RESULT([external])
8669     SYSTEM_BOOST=TRUE
8670     AX_BOOST_BASE(1.47)
8671     AX_BOOST_DATE_TIME
8672     AX_BOOST_IOSTREAMS
8673     mingw_boost_date_time_dll=`echo $BOOST_DATE_TIME_LIB | sed -e 's/^-l//' -e 's/\.dll$//'`
8674     libo_MINGW_TRY_DLL([$mingw_boost_date_time_dll])
8675     if test -z "$MINGW_BOOST_DATE_TIME_DLL"; then
8676         # if not found, try again with 'lib' prefix
8677         libo_MINGW_CHECK_DLL([lib$mingw_boost_date_time_dll])
8678     fi
8679     AC_LANG_PUSH([C++])
8680     save_CXXFLAGS=$CXXFLAGS
8681     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS"
8682     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8683        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8684     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8685        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8686     AC_CHECK_HEADER(boost/function.hpp, [],
8687        [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
8688     CXXFLAGS="$CXXFLAGS -fno-exceptions"
8689     AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
8690     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp>
8691 ]], [[]])],[ac_cv_cxx_boost_no_exceptions_broken=no],[ac_cv_cxx_boost_no_exceptions_broken=yes])
8692     if test "$ac_cv_cxx_boost_no_exceptions_broken" = "yes"; then
8693         AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
8694     else
8695         AC_MSG_RESULT([yes])
8696     fi
8697     CXXFLAGS=$save_CXXFLAGS
8698     AC_LANG_POP([C++])
8699 else
8700     AC_MSG_RESULT([internal])
8701     BUILD_TYPE="$BUILD_TYPE BOOST"
8702     SYSTEM_BOOST=
8704 AC_SUBST(SYSTEM_BOOST)
8706 dnl ===================================================================
8707 dnl Check for system mdds
8708 dnl ===================================================================
8709 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds >= 0.10.3], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8711 dnl ===================================================================
8712 dnl Check for system glm
8713 dnl ===================================================================
8714 AC_MSG_CHECKING([which glm to use])
8715 if test "$with_system_glm" = "yes"; then
8716     AC_MSG_RESULT([external])
8717     SYSTEM_GLM=TRUE
8718     AC_LANG_PUSH([C++])
8719     AC_CHECK_HEADER([glm/glm.hpp], [],
8720        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8721     AC_LANG_POP([C++])
8722 else
8723     AC_MSG_RESULT([internal])
8724     BUILD_TYPE="$BUILD_TYPE GLM"
8725     SYSTEM_GLM=
8727 AC_SUBST([SYSTEM_GLM])
8729 dnl ===================================================================
8730 dnl Check for system glew
8731 dnl ===================================================================
8732 libo_CHECK_SYSTEM_MODULE([glew], [GLEW], [glew >= 1.10.0])
8734 dnl ===================================================================
8735 dnl Check for system vigra
8736 dnl ===================================================================
8737 AC_MSG_CHECKING([which vigra to use])
8738 if test "$with_system_vigra" = "yes"; then
8739     AC_MSG_RESULT([external])
8740     SYSTEM_VIGRA=TRUE
8741     AC_LANG_PUSH([C++])
8742     AC_CHECK_HEADER(vigra/copyimage.hxx, [],
8743        [AC_MSG_ERROR(vigra/copyimage.hxx not found. install vigra)], [])
8744     AC_LANG_POP([C++])
8745 else
8746     AC_MSG_RESULT([internal])
8747     BUILD_TYPE="$BUILD_TYPE VIGRA"
8748     SYSTEM_VIGRA=
8750 AC_SUBST(SYSTEM_VIGRA)
8752 dnl ===================================================================
8753 dnl Check for system odbc
8754 dnl ===================================================================
8755 AC_MSG_CHECKING([which odbc headers to use])
8756 if test "$with_system_odbc" = "yes"; then
8757     AC_MSG_RESULT([external])
8758     SYSTEM_ODBC_HEADERS=TRUE
8760     AC_CHECK_HEADER(sqlext.h, [],
8761       [AC_MSG_ERROR(odbc not found. install odbc)], [])
8762 elif test "$enable_database_connectivity" != yes; then
8763     AC_MSG_RESULT([none])
8764 else
8765     AC_MSG_RESULT([internal])
8766     SYSTEM_ODBC_HEADERS=
8768 AC_SUBST(SYSTEM_ODBC_HEADERS)
8771 dnl ===================================================================
8772 dnl Check for system openldap
8773 dnl ===================================================================
8775 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8776 AC_MSG_CHECKING([which openldap library to use])
8777 if test "$with_system_openldap" = "yes"; then
8778     AC_MSG_RESULT([external])
8779     SYSTEM_OPENLDAP=TRUE
8780     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8781     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8782     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8783 else
8784     AC_MSG_RESULT([internal])
8785     SYSTEM_OPENLDAP=
8786     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8789 AC_SUBST(SYSTEM_OPENLDAP)
8791 dnl ===================================================================
8792 dnl Check for mozilla ab connectivity for windows
8793 dnl ===================================================================
8795 if test "$_os" = "WINNT"; then
8796     AC_MSG_CHECKING([whether to enable build of Mozilla addressbook connectivity driver for Windows])
8797     if test "$enable_win_mozab_driver" = "yes" -a "$WITH_MINGW" != "YES" ; then
8798         WITH_MOZAB4WIN=TRUE
8799         AC_MSG_RESULT([yes, internal (old windows mozab driver)])
8800         BUILD_TYPE="$BUILD_TYPE MOZ"
8801         MSVC80_DLLS="msvcp80.dll msvcr80.dll Microsoft.VC80.CRT.manifest"
8802         MSVC80_DLL_PATH=`cygpath -u "$TARFILE_LOCATION"`
8803         for dll in $MSVC80_DLLS; do
8804             if ! test -f "$MSVC80_DLL_PATH/$dll"; then
8805                 AC_MSG_ERROR([can not find $dll in $MSVC80_DLL_PATH needed for the pre-built Mozilla libraries])
8806             fi
8807         done
8808     else
8809         AC_MSG_RESULT([no])
8810         WITH_MOZAB4WIN=
8811     fi
8813 AC_SUBST(WITH_MOZAB4WIN)
8814 AC_SUBST(MSVC80_DLLS)
8815 AC_SUBST(MSVC80_DLL_PATH)
8817 dnl ===================================================================
8818 dnl Check for TLS/SSL and cryptographic implementation to use
8819 dnl ===================================================================
8820 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8821 if test -n "$with_tls"; then
8822     case $with_tls in
8823     openssl)
8824         AC_DEFINE(USE_TLS_OPENSSL)
8825         TLS=OPENSSL
8827         if test "$enable_openssl" != "yes"; then
8828             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8829         fi
8831         # warn that OpenSSL has been selected but not all TLS code has this option
8832         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS])
8833         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS"
8834         ;;
8835     nss)
8836         AC_DEFINE(USE_TLS_NSS)
8837         TLS=NSS
8838         ;;
8839     *)
8840         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8841 openssl - OpenSSL
8842 nss - Mozilla's Network Security Services (NSS)
8843     ])
8844         ;;
8845     esac
8846 elif test $_os = iOS -o $_os = Android; then
8847     # We don't build NSS for iOS and Android
8848     AC_DEFINE(USE_TLS_OPENSSL)
8849     TLS=OPENSSL
8850 else
8851     # default to using NSS, it results in smaller oox lib
8852     AC_DEFINE(USE_TLS_NSS)
8853     TLS=NSS
8855 AC_MSG_RESULT([$TLS])
8856 AC_SUBST(TLS)
8858 dnl ===================================================================
8859 dnl Check for system NSS
8860 dnl ===================================================================
8861 libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8862 if test "$with_system_nss" = "yes"; then
8863     libo_MINGW_CHECK_DLL([libnspr4])
8864     libo_MINGW_CHECK_DLL([libplc4])
8865     libo_MINGW_CHECK_DLL([libplds4])
8866     libo_MINGW_CHECK_DLL([nss3])
8867     libo_MINGW_CHECK_DLL([nssutil3])
8868     libo_MINGW_CHECK_DLL([smime3])
8869     libo_MINGW_CHECK_DLL([ssl3])
8872 dnl ===================================================================
8873 dnl Check for system mozilla headers
8874 dnl ===================================================================
8875 HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=
8876 AC_MSG_CHECKING([which NPAPI headers to use])
8878 if test "$with_system_npapi_headers" = "yes"; then
8879     AC_MSG_RESULT([external])
8880     SYSTEM_NPAPI_HEADERS=TRUE
8881     # First try npapi-sdk:
8882     PKG_CHECK_MODULES(NPAPI_HEADERS, npapi-sdk, [LOCATED=yes], [LOCATED=no])
8883     # Then go with libxul:
8884     if test "x$LOCATED" != "xyes"; then
8885         PKG_CHECK_MODULES(NPAPI_HEADERS, libxul, [LOCATED=yes], [LOCATED=no])
8886     fi
8887     if test "x$LOCATED" != "xyes"; then
8888         PKG_CHECK_MODULES(NPAPI_HEADERS, mozilla-plugin, [LOCATED=yes], [LOCATED=no])
8889     fi
8890     # if still not found bail out
8891     if test "x$LOCATED" != "xyes"; then
8892         AC_MSG_ERROR([npapi.h header file not found])
8893     fi
8895     AC_LANG_PUSH([C])
8896     save_CFLAGS=$CFLAGS
8897     CFLAGS="$CFLAGS $NPAPI_HEADERS_CFLAGS"
8898     AC_MSG_CHECKING([for NPP_GetMIMEDescription return type])
8899     AC_COMPILE_IFELSE(
8900         [AC_LANG_SOURCE([[
8901             #define XP_UNIX
8902             #include <npapi.h>
8903             const char* NPP_GetMIMEDescription(void) { return "foo"; }
8904             ]])],
8905         [AC_MSG_RESULT([const char*])],
8906         [
8907         AC_MSG_RESULT([char*])
8908         HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=TRUE
8909         ])
8910     CFLAGS=$save_CFLAGS
8911     AC_LANG_POP([C])
8912     NPAPI_HEADERS_CFLAGS=$(printf '%s' "$NPAPI_HEADERS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8913 else
8914     AC_MSG_RESULT([internal])
8915         dnl ...but will not be built/used unless ENABLE_NPAPI_FROM_BROWSER or
8916         dnl ENABLE_NPAPI_INTO_BROWSER is TRUE
8917     SYSTEM_NPAPI_HEADERS=
8919 AC_SUBST(NPAPI_HEADERS_CFLAGS)
8920 AC_SUBST(SYSTEM_NPAPI_HEADERS)
8921 AC_SUBST(HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION)
8923 dnl ===================================================================
8924 dnl Check for system sane
8925 dnl ===================================================================
8926 AC_MSG_CHECKING([which sane header to use])
8927 if test "$with_system_sane" = "yes"; then
8928     AC_MSG_RESULT([external])
8929     AC_CHECK_HEADER(sane/sane.h, [],
8930       [AC_MSG_ERROR(sane not found. install sane)], [])
8931 else
8932     AC_MSG_RESULT([internal])
8933     BUILD_TYPE="$BUILD_TYPE SANE"
8936 dnl ===================================================================
8937 dnl Check for system icu
8938 dnl ===================================================================
8939 SYSTEM_GENBRK=
8940 SYSTEM_GENCCODE=
8941 SYSTEM_GENCMN=
8943 ICU_MAJOR=53
8944 ICU_MINOR=1
8945 ICU_RECLASSIFIED_CLOSE_PARENTHESIS="TRUE"
8946 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
8947 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
8948 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
8949 AC_MSG_CHECKING([which icu to use])
8950 if test "$with_system_icu" = "yes"; then
8951     AC_MSG_RESULT([external])
8952     SYSTEM_ICU=TRUE
8953     AC_LANG_PUSH([C++])
8954     AC_MSG_CHECKING([for unicode/rbbi.h])
8955     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
8956     AC_LANG_POP([C++])
8958     if test "$cross_compiling" != "yes" -o "$WITH_MINGW" = "yes"; then
8959         ICUPATH="$PATH"
8960         if test "$WITH_MINGW" = "yes"; then
8961             ICUPATH=`$CC -print-sysroot`/mingw/bin:"$ICUPATH"
8962         fi
8963         AC_PATH_PROG(ICUCONFIG,icu-config,,[$ICUPATH])
8965         AC_MSG_CHECKING([ICU version])
8966         ICU_VERSION=`$ICUCONFIG --noverify --version 2>/dev/null || $ICUCONFIG --version`
8967         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
8968         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
8970         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "2" \); then
8971             AC_MSG_RESULT([OK, $ICU_VERSION])
8972         else
8973             AC_MSG_ERROR([not suitable, only >= 4.2 supported currently])
8974         fi
8975     fi
8977     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
8978         AC_PATH_PROG([ICUCONFIG_FOR_BUILD], [icu-config], [], [$PATH:/usr/sbin:/sbin])
8979         ICU_VERSION_FOR_BUILD=`$ICUCONFIG_FOR_BUILD --noverify --version 2>/dev/null || $ICUCONFIG_FOR_BUILD --version`
8980         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
8981         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
8982         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
8983         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
8984             AC_MSG_RESULT([yes])
8985         else
8986             AC_MSG_RESULT([no])
8987             if test "$with_system_icu_for_build" != "force"; then
8988                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
8989 You can use --with-system-icu-for-build=force to use it anyway.])
8990             fi
8991         fi
8992     fi
8994     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
8995         # using the system icu tools can lead to version confusion, use the
8996         # ones from the build environment when cross-compiling
8997         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
8998         if test -z "$SYSTEM_GENBRK"; then
8999             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9000         fi
9001         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9002         if test -z "$SYSTEM_GENCCODE"; then
9003             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9004         fi
9005         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9006         if test -z "$SYSTEM_GENCMN"; then
9007             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9008         fi
9009         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "4" \); then
9010             ICU_RECLASSIFIED_CLOSE_PARENTHESIS="TRUE"
9011         else
9012             ICU_RECLASSIFIED_CLOSE_PARENTHESIS=
9013         fi
9014         if test "$ICU_MAJOR" -ge "49"; then
9015             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9016             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9017             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9018         else
9019             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9020             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9021             ICU_RECLASSIFIED_HEBREW_LETTER=
9022         fi
9023     fi
9025     if test "$cross_compiling" = "yes"; then
9026        if test "$ICU_MAJOR" -ge "50"; then
9027             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9028             ICU_MINOR=""
9029        fi
9030     fi
9032     libo_MINGW_CHECK_DLL([icudata][$ICU_MAJOR][$ICU_MINOR])
9033     libo_MINGW_CHECK_DLL([icui18n][$ICU_MAJOR][$ICU_MINOR])
9034     libo_MINGW_CHECK_DLL([icuuc][$ICU_MAJOR][$ICU_MINOR])
9035 else
9036     AC_MSG_RESULT([internal])
9037     SYSTEM_ICU=
9038     BUILD_TYPE="$BUILD_TYPE ICU"
9039     # surprisingly set these only for "internal" (to be used by various other
9040     # external libs): the system icu-config is quite unhelpful and spits out
9041     # dozens of weird flags and also default path -I/usr/include
9042     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9043     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9045 AC_SUBST(SYSTEM_ICU)
9046 AC_SUBST(SYSTEM_GENBRK)
9047 AC_SUBST(SYSTEM_GENCCODE)
9048 AC_SUBST(SYSTEM_GENCMN)
9049 AC_SUBST(ICU_MAJOR)
9050 AC_SUBST(ICU_MINOR)
9051 AC_SUBST(ICU_RECLASSIFIED_CLOSE_PARENTHESIS)
9052 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9053 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9054 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9055 AC_SUBST(ICU_CFLAGS)
9056 AC_SUBST(ICU_LIBS)
9058 dnl ===================================================================
9059 dnl Graphite
9060 dnl ===================================================================
9062 AC_MSG_CHECKING([whether to enable graphite support])
9063 if test $_os != Darwin -a $_os != Android -a $_os != iOS -a \( -z "$enable_graphite" -o "$enable_graphite" != no \); then
9064     AC_MSG_RESULT([yes])
9065     ENABLE_GRAPHITE="TRUE"
9066     AC_DEFINE(ENABLE_GRAPHITE)
9067     libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
9068     if test "$with_system_graphite" = "yes"; then
9069         libo_MINGW_CHECK_DLL([libgraphite2])
9070     fi
9071 else
9072     AC_MSG_RESULT([no])
9074 AC_SUBST(ENABLE_GRAPHITE)
9076 dnl ===================================================================
9077 dnl Orcus
9078 dnl ===================================================================
9080 AC_MSG_CHECKING([whether to enable orcus])
9081 if test -z "$enable_orcus" -o "$enable_orcus" != no; then
9082     AC_MSG_RESULT([yes])
9083     ENABLE_ORCUS="TRUE"
9084     AC_DEFINE(ENABLE_ORCUS)
9086     libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.8 >= 0.7.0])
9087     if test "$with_system_orcus" != "yes"; then
9088         if test "$SYSTEM_BOOST" = "TRUE"; then
9089             # ===========================================================
9090             # Determine if we are going to need to link with Boost.System
9091             # ===========================================================
9092             dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9093             dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9094             dnl in documentation has no effect.
9095             AC_MSG_CHECKING([if we need to link with Boost.System])
9096             AC_LANG_PUSH([C++])
9097             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9098                     @%:@include <boost/version.hpp>
9099                 ]],[[
9100                     #if BOOST_VERSION >= 105000
9101                     #   error yes, we need to link with Boost.System
9102                     #endif
9103                 ]])],[
9104                     AC_MSG_RESULT([no])
9105                 ],[
9106                     AC_MSG_RESULT([yes])
9107                     AX_BOOST_SYSTEM
9108             ])
9109             AC_LANG_POP([C++])
9110         fi
9111     fi
9112     dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9113     SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9114     AC_SUBST([BOOST_SYSTEM_LIB])
9115     AC_SUBST(SYSTEM_LIBORCUS)
9117 else
9118     AC_MSG_RESULT([no])
9120 AC_SUBST(ENABLE_ORCUS)
9122 dnl ===================================================================
9123 dnl HarfBuzz
9124 dnl ===================================================================
9125 AC_MSG_CHECKING([whether to enable HarfBuzz support])
9126 if test $_os != WINNT -a $_os != Darwin -a $_os != iOS; then
9127     AC_MSG_RESULT([yes])
9128     ENABLE_HARFBUZZ="TRUE"
9129     if $PKG_CONFIG --atleast-version 0.9.18 harfbuzz; then
9130         libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.18],["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz -lharfbuzz-icu"])
9131     else
9132         libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz >= 0.9.10],[-I${WORKDIR}/UnpackedTarball/harfbuzz/src],["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz -lharfbuzz-icu"])
9133     fi
9134 else
9135     AC_MSG_RESULT([no])
9137 AC_SUBST(ENABLE_HARFBUZZ)
9139 dnl ===================================================================
9140 dnl Check for NPAPI interface to plug browser plugins into LibreOffice documents
9141 dnl ===================================================================
9142 AC_MSG_CHECKING([whether to plug browser plugins into LibreOffice documents])
9143 # Obviously no such thing on iOS or Android. Also not possible when building
9144 # 64-bit OS X code as the plugin code uses QuickTime and Carbon.
9145 if test "$_os" != Android -a "$_os" != iOS -a \( $_os != Darwin -o "$BITNESS_OVERRIDE" = "" \) -a \
9146         "$enable_headless" != yes -a "$enable_mpl_subset" != yes
9147 then
9148     AC_MSG_RESULT([yes])
9149     ENABLE_NPAPI_FROM_BROWSER=TRUE
9150 else
9151     AC_MSG_RESULT([no])
9152     ENABLE_NPAPI_FROM_BROWSER=
9154 AC_SUBST(ENABLE_NPAPI_FROM_BROWSER)
9156 dnl ===================================================================
9157 dnl Check for NPAPI interface to plug LibreOffice into browser windows
9158 dnl ===================================================================
9159 AC_MSG_CHECKING([whether to plug LibreOffice into browser windows])
9160 if test "$enable_mpl_subset" != yes -a \( "$_os" = WINNT -o "$_os" != Android -a "$_os" != Darwin -a "$_os" != iOS -a \
9161         "$enable_headless" != yes -a "$enable_gtk" != no \)
9162 then
9163     AC_MSG_RESULT([yes])
9164     ENABLE_NPAPI_INTO_BROWSER=TRUE
9165 else
9166     AC_MSG_RESULT([no])
9167     ENABLE_NPAPI_INTO_BROWSER=
9169 AC_SUBST(ENABLE_NPAPI_INTO_BROWSER)
9171 AC_MSG_CHECKING([whether to use X11])
9172 dnl ***************************************
9173 dnl testing for X libraries and includes...
9174 dnl ***************************************
9175 WANT_X11="no"
9176 if test $_os != Darwin -a $_os != WINNT -a $_os != Android -a $_os != iOS -a "$enable_headless" != "yes"; then
9177     WANT_X11="yes"
9178     AC_DEFINE(HAVE_FEATURE_X11)
9180 AC_MSG_RESULT([$WANT_X11])
9182 if test "$WANT_X11" = "yes"; then
9183     AC_PATH_X
9184     AC_PATH_XTRA
9185     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9187     if test -z "$x_includes"; then
9188         x_includes="default_x_includes"
9189     fi
9190     if test -z "$x_libraries"; then
9191         x_libraries="default_x_libraries"
9192     fi
9193     CFLAGS="$CFLAGS $X_CFLAGS"
9194     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9195     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9196 else
9197     x_includes="no_x_includes"
9198     x_libraries="no_x_libraries"
9201 if test "$WANT_X11" = "yes"; then
9202     dnl ===================================================================
9203     dnl Check for Composite.h for Mozilla plugin
9204     dnl ===================================================================
9205     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
9206      [#include <X11/Intrinsic.h>])
9208     # ENABLE_NPAPI_FROM_BROWSER requires Xt library
9209     AC_CHECK_LIB([Xt], [XtToolkitInitialize], [:],
9210         [AC_MSG_ERROR(Xt library not found)])
9212     dnl ===================================================================
9213     dnl Check for extension headers
9214     dnl ===================================================================
9215     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9216      [#include <X11/extensions/shape.h>])
9218     # vcl needs ICE and SM
9219     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9220     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9221         [AC_MSG_ERROR(ICE library not found)])
9222     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9223     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9224         [AC_MSG_ERROR(SM library not found)])
9227 dnl ===================================================================
9228 dnl Check for system Xrender
9229 dnl ===================================================================
9230 AC_MSG_CHECKING([whether to use Xrender])
9231 if test "$WANT_X11" = "yes" -a  "$test_xrender" = "yes"; then
9232     AC_MSG_RESULT([yes])
9233     PKG_CHECK_MODULES(XRENDER, xrender)
9234     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9235     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9236       [AC_MSG_ERROR(libXrender not found or functional)], [])
9237     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9238       [AC_MSG_ERROR(Xrender not found. install X)], [])
9239 else
9240     AC_MSG_RESULT([no])
9242 AC_SUBST(XRENDER_CFLAGS)
9243 AC_SUBST(XRENDER_LIBS)
9245 dnl ===================================================================
9246 dnl Check for XRandr
9247 dnl ===================================================================
9248 AC_MSG_CHECKING([whether to enable RandR support])
9249 if test "$WANT_X11" = "yes" -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9250     if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
9251         XRANDR_DLOPEN="TRUE"
9252         AC_MSG_RESULT([configured to dlopen libXrandr at runtime])
9253     else
9254         AC_MSG_RESULT([yes])
9255         XRANDR_DLOPEN="FALSE"
9256         PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9257         if test "$ENABLE_RANDR" != "TRUE"; then
9258             AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9259                         [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9260             XRANDR_CFLAGS=" "
9261             AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9262               [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9263             XRANDR_LIBS="-lXrandr "
9264             ENABLE_RANDR="TRUE"
9265         fi
9266         XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9267     fi
9268 else
9269     ENABLE_RANDR=""
9270     AC_MSG_RESULT([no])
9272 AC_SUBST(XRANDR_DLOPEN)
9273 AC_SUBST(XRANDR_CFLAGS)
9274 AC_SUBST(XRANDR_LIBS)
9275 AC_SUBST(ENABLE_RANDR)
9277 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9278     WITH_WEBDAV="serf"
9280 if test $_os = iOS -o $_os = Android; then
9281     WITH_WEBDAV="no"
9283 AC_MSG_CHECKING([for webdav library])
9284 case "$WITH_WEBDAV" in
9285 serf)
9286     AC_MSG_RESULT([serf])
9287     # Check for system apr-util
9288     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9289                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9290                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9291     if test "$COM" = "MSC"; then
9292         APR_LIB_DIR="LibR"
9293         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9294         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9295     fi
9297     # Check for system serf
9298     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9299                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9300     if test "$COM" = "MSC"; then
9301         SERF_LIB_DIR="Release"
9302         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9303         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9304     fi
9305     ;;
9306 neon)
9307     AC_MSG_RESULT([neon])
9308     # Check for system neon
9309     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9310     if test "$with_system_neon" = "yes"; then
9311         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9312         libo_MINGW_CHECK_DLL([libneon])
9313         libo_MINGW_TRY_DLL([libtasn1])
9314         libo_MINGW_TRY_DLL([libgnutls])
9315     else
9316         NEON_VERSION=0295
9317     fi
9318     AC_SUBST(NEON_VERSION)
9319     ;;
9321     AC_MSG_RESULT([none, disabled])
9322     WITH_WEBDAV=""
9323     ;;
9324 esac
9325 AC_SUBST(WITH_WEBDAV)
9327 dnl ===================================================================
9328 dnl Check for disabling cve_tests
9329 dnl ===================================================================
9330 AC_MSG_CHECKING([whether to execute CVE tests])
9331 if test "$enable_cve_tests" = "no"; then
9332     AC_MSG_RESULT([no])
9333     DISABLE_CVE_TESTS=TRUE
9334     AC_SUBST(DISABLE_CVE_TESTS)
9335 else
9336     AC_MSG_RESULT([yes])
9339 dnl ===================================================================
9340 dnl Check for enabling chart XShape tests
9341 dnl ===================================================================
9342 AC_MSG_CHECKING([whether to execute chart XShape tests])
9343 if test "$enable_chart_tests" = "yes"; then
9344     AC_MSG_RESULT([yes])
9345     ENABLE_CHART_TESTS=TRUE
9346     AC_SUBST(ENABLE_CHART_TESTS)
9347 else
9348     AC_MSG_RESULT([no])
9351 dnl ===================================================================
9352 dnl Check for system openssl
9353 dnl ===================================================================
9354 DISABLE_OPENSSL=
9355 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9356 if test "$enable_openssl" = "yes"; then
9357     AC_MSG_RESULT([no])
9358     if test "$_os" = Darwin -a "${MAC_OS_X_VERSION_MIN_REQUIRED:-0}" -ge 1070; then
9359         # OpenSSL is deprecated when building for 10.7 or later.
9360         #
9361         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9362         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9364         with_system_openssl=no
9365         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9366     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9367             && test "$with_system_openssl" != "no"; then
9368         with_system_openssl=yes
9369         SYSTEM_OPENSSL=TRUE
9370         OPENSSL_CFLAGS=
9371         OPENSSL_LIBS="-lssl -lcrypto"
9372     else
9373         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9374     fi
9375     if test "$with_system_openssl" = "yes"; then
9376         libo_MINGW_CHECK_DLL([libssl])
9377         libo_MINGW_CHECK_DLL([libcrypto])
9378         AC_MSG_CHECKING([whether openssl supports SHA512])
9379         AC_LANG_PUSH([C])
9380         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9381             SHA512_CTX context;
9382 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9383         AC_LANG_POP(C)
9384     fi
9385 else
9386     AC_MSG_RESULT([yes])
9387     DISABLE_OPENSSL=TRUE
9389     # warn that although OpenSSL is disabled, system libraries may be depending on it
9390     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9391     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9394 AC_SUBST([DISABLE_OPENSSL])
9396 dnl ===================================================================
9397 dnl Check for building gnutls
9398 dnl ===================================================================
9399 AC_MSG_CHECKING([whether to use gnutls])
9400 if test "$WITH_WEBDAV" = "neon" && test "$enable_openssl" = "no"; then
9401     AC_MSG_RESULT([yes])
9402     AM_PATH_LIBGCRYPT()
9403     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9404         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9405                       available in the system to use as replacement.]]))
9408 AC_SUBST([LIBGCRYPT_CFLAGS])
9409 AC_SUBST([LIBGCRYPT_LIBS])
9411 dnl ===================================================================
9412 dnl Check for system redland
9413 dnl ===================================================================
9414 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9415 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9416 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9417 if test "$with_system_redland" = "yes"; then
9418     libo_MINGW_CHECK_DLL([librdf])
9419     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9420             [AC_MSG_ERROR(librdf too old. Need >= 1.16)], [])
9421     libo_MINGW_TRY_DLL([libraptor])
9422     libo_MINGW_TRY_DLL([librasqal])
9423     libo_MINGW_TRY_DLL([libsqlite3])
9424 else
9425     RAPTOR_MAJOR="0"
9426     RASQAL_MAJOR="3"
9427     REDLAND_MAJOR="0"
9429 AC_SUBST(RAPTOR_MAJOR)
9430 AC_SUBST(RASQAL_MAJOR)
9431 AC_SUBST(REDLAND_MAJOR)
9433 dnl ===================================================================
9434 dnl Check for system hunspell
9435 dnl ===================================================================
9436 AC_MSG_CHECKING([which libhunspell to use])
9437 if test "$with_system_hunspell" = "yes"; then
9438     AC_MSG_RESULT([external])
9439     SYSTEM_HUNSPELL=TRUE
9440     AC_LANG_PUSH([C++])
9441     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9442     if test "$HUNSPELL_PC" != "TRUE"; then
9443         AC_CHECK_HEADER(hunspell.hxx, [],
9444             [
9445             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9446             [AC_MSG_ERROR(hunspell headers not found.)], [])
9447             ], [])
9448         AC_CHECK_LIB([hunspell], [main], [:],
9449            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9450         HUNSPELL_LIBS=-lhunspell
9451     fi
9452     AC_LANG_POP([C++])
9453     libo_MINGW_CHECK_DLL([libhunspell-1.3])
9454     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9455 else
9456     AC_MSG_RESULT([internal])
9457     SYSTEM_HUNSPELL=
9458     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9459     if test "$COM" = "MSC"; then
9460         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9461     else
9462         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.3"
9463     fi
9464     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9466 AC_SUBST(SYSTEM_HUNSPELL)
9467 AC_SUBST(HUNSPELL_CFLAGS)
9468 AC_SUBST(HUNSPELL_LIBS)
9470 dnl ===================================================================
9471 dnl Checking for altlinuxhyph
9472 dnl ===================================================================
9473 AC_MSG_CHECKING([which altlinuxhyph to use])
9474 if test "$with_system_altlinuxhyph" = "yes"; then
9475     AC_MSG_RESULT([external])
9476     SYSTEM_HYPH=TRUE
9477     AC_CHECK_HEADER(hyphen.h, [],
9478        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9479     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9480        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9481        [#include <hyphen.h>])
9482     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9483         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9484     if test -z "$HYPHEN_LIB"; then
9485         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9486            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9487     fi
9488     if test -z "$HYPHEN_LIB"; then
9489         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9490            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9491     fi
9492     libo_MINGW_CHECK_DLL([libhyphen])
9493 else
9494     AC_MSG_RESULT([internal])
9495     SYSTEM_HYPH=
9496     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9497     if test "$COM" = "MSC"; then
9498         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9499     else
9500         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9501     fi
9503 AC_SUBST(SYSTEM_HYPH)
9504 AC_SUBST(HYPHEN_LIB)
9506 dnl ===================================================================
9507 dnl Checking for mythes
9508 dnl ===================================================================
9509 AC_MSG_CHECKING([which mythes to use])
9510 if test "$with_system_mythes" = "yes"; then
9511     AC_MSG_RESULT([external])
9512     SYSTEM_MYTHES=TRUE
9513     AC_LANG_PUSH([C++])
9514     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9515     if test "$MYTHES_PKGCONFIG" = "no"; then
9516         AC_CHECK_HEADER(mythes.hxx, [],
9517             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9518         AC_CHECK_LIB([mythes-1.2], [main], [:],
9519             [ MYTHES_FOUND=no], [])
9520     if test "$MYTHES_FOUND" = "no"; then
9521         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9522                 [ MYTHES_FOUND=no], [])
9523     fi
9524     if test "$MYTHES_FOUND" = "no"; then
9525         AC_MSG_ERROR([mythes library not found!.])
9526     fi
9527     fi
9528     AC_LANG_POP([C++])
9529     libo_MINGW_CHECK_DLL([libmythes-1.2])
9530     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9531 else
9532     AC_MSG_RESULT([internal])
9533     SYSTEM_MYTHES=
9534     BUILD_TYPE="$BUILD_TYPE MYTHES"
9535     if test "$COM" = "MSC"; then
9536         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9537     else
9538         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9539     fi
9541 AC_SUBST(SYSTEM_MYTHES)
9542 AC_SUBST(MYTHES_CFLAGS)
9543 AC_SUBST(MYTHES_LIBS)
9545 dnl ===================================================================
9546 dnl How should we build the linear programming solver ?
9547 dnl ===================================================================
9549 ENABLE_COINMP=
9550 AC_MSG_CHECKING([whether to build with CoinMP])
9551 if test "$enable_coinmp" != "no"; then
9552     ENABLE_COINMP=TRUE
9553     AC_MSG_RESULT([yes])
9554     # Should we check for system CoinMP ? How to do that ?
9555     BUILD_TYPE="$BUILD_TYPE COINMP"
9556 else
9557     AC_MSG_RESULT([no])
9559 AC_SUBST(ENABLE_COINMP)
9561 ENABLE_LPSOLVE=
9562 AC_MSG_CHECKING([whether to build with lpsolve])
9563 if test "$enable_lpsolve" != "no"; then
9564     ENABLE_LPSOLVE=TRUE
9565     AC_MSG_RESULT([yes])
9566 else
9567     AC_MSG_RESULT([no])
9569 AC_SUBST(ENABLE_LPSOLVE)
9571 if test "$ENABLE_LPSOLVE" = TRUE; then
9572     AC_MSG_CHECKING([which lpsolve to use])
9573     if test "$with_system_lpsolve" = "yes"; then
9574         AC_MSG_RESULT([external])
9575         SYSTEM_LPSOLVE=TRUE
9576         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9577            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9578         save_LIBS=$LIBS
9579         # some systems need this. Like Ubuntu....
9580         AC_CHECK_LIB(m, floor)
9581         AC_CHECK_LIB(dl, dlopen)
9582         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9583             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9584         LIBS=$save_LIBS
9585         libo_MINGW_CHECK_DLL([lpsolve55])
9586     else
9587         AC_MSG_RESULT([internal])
9588         SYSTEM_LPSOLVE=
9589         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9590     fi
9592 AC_SUBST(SYSTEM_LPSOLVE)
9594 dnl ===================================================================
9595 dnl Checking for libexttextcat
9596 dnl ===================================================================
9597 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.1.1])
9598 if test "$with_system_libexttextcat" = "yes"; then
9599     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9601 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9603 dnl ***************************************
9604 dnl testing libc version for Linux...
9605 dnl ***************************************
9606 if test "$_os" = "Linux"; then
9607     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9608     exec 6>/dev/null # no output
9609     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9610     exec 6>&1 # output on again
9611     if test "$HAVE_LIBC"; then
9612         AC_MSG_RESULT([yes])
9613     else
9614         AC_MSG_ERROR([no, upgrade libc])
9615     fi
9618 dnl =========================================
9619 dnl Check for the Windows  SDK.
9620 dnl =========================================
9621 dnl FIXME: I don't know yet if the Windows SDK works with MinGW, keep it until I know better,
9622 dnl and add "-a \( "$WITH_MINGW" != "yes" \)" then
9623 if test "$_os" = "WINNT"; then
9624     AC_MSG_CHECKING([for Windows SDK])
9625     if test "$build_os" = "cygwin"; then
9626         find_winsdk
9627         WINDOWS_SDK_HOME=$winsdktest
9629         # normalize if found
9630         if test -n "$WINDOWS_SDK_HOME"; then
9631             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
9632             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
9633         fi
9634     fi
9636     if test -n "$WINDOWS_SDK_HOME"; then
9637         # Remove a possible trailing backslash
9638         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
9640         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
9641              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
9642              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
9643             have_windows_sdk_headers=yes
9644         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
9645              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
9646              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
9647             have_windows_sdk_headers=yes
9648         else
9649             have_windows_sdk_headers=no
9650         fi
9652         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
9653             have_windows_sdk_libs=yes
9654         elif test -f "$WINDOWS_SDK_HOME/lib/win8/um/$WINDOWS_SDK_ARCH/user32.lib"; then
9655             have_windows_sdk_libs=yes
9656         else
9657             have_windows_sdk_libs=no
9658         fi
9660         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
9661             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
9662 the  Windows SDK are installed.])
9663         fi
9665         if test ! -f "$WINDOWS_SDK_HOME/bin/msiinfo.exe" \
9666              -o ! -f "$WINDOWS_SDK_HOME/bin/msidb.exe" \
9667              -o ! -f "$WINDOWS_SDK_HOME/bin/uuidgen.exe" \
9668              -o ! -f "$WINDOWS_SDK_HOME/bin/msitran.exe"; then :
9669         elif test ! -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
9670              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
9671              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/uuidgen.exe" \
9672              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
9673         else
9674             AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
9675         fi
9676     fi
9678     if test -z "$WINDOWS_SDK_HOME"; then
9679         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
9680     elif echo $WINDOWS_SDK_HOME | grep "v6.0" >/dev/null 2>/dev/null; then
9681         WINDOWS_SDK_VERSION=60
9682         AC_MSG_RESULT([found Windows SDK 6.0 ($WINDOWS_SDK_HOME)])
9683     elif echo $WINDOWS_SDK_HOME | grep "v6.1" >/dev/null 2>/dev/null; then
9684         WINDOWS_SDK_VERSION=61
9685         AC_MSG_RESULT([found Windows SDK 6.1 ($WINDOWS_SDK_HOME)])
9686     elif echo $WINDOWS_SDK_HOME | grep "v7" >/dev/null 2>/dev/null; then
9687         WINDOWS_SDK_VERSION=70
9688         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
9689     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
9690         WINDOWS_SDK_VERSION=80
9691         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
9692         # compatibility warning if usind VS 2012 and not explicitly choosing the 80 SDK
9693         if test "$VCVER" = "110" -a -z "$with_windows_sdk"; then
9694             AC_MSG_WARN([If a build created with VS 2012 should run on Windows XP,])
9695             AC_MSG_WARN([use --with-windows-sdk=7.1A (requires VS 2012 Update 1 or newer)])
9696             add_warning "If a build created with VS 2012 should run on Windows XP,"
9697             add_warning "use --with-windows-sdk=7.1A (requires VS 2012 Update 1 or newer)"
9698         fi
9699     else
9700         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
9701     fi
9702     PathFormat "$WINDOWS_SDK_HOME"
9703     WINDOWS_SDK_HOME="$formatted_path"
9704     if test "$build_os" = "cygwin"; then
9705         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/include"
9706         if test -d "$WINDOWS_SDK_HOME/include/um"; then
9707             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
9708         fi
9709     fi
9711     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
9712     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
9713     dnl but not in v8.0), so allow this to be overridden with a
9714     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
9715     dnl and configuration error if no WiLangId.vbs is found would arguably be
9716     dnl better, but I do not know under which conditions exactly it is needed by
9717     dnl msiglobal.pm:
9718     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
9719         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
9720         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9721             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
9722         fi
9723         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9724             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.0/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
9725         fi
9726         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9727             AC_MSG_WARN([WiLangId.vbs not found - building translated packages will fail])
9728             add_warning "WiLangId.vbs not found - building translated packages will fail"
9729         fi
9730     fi
9732 AC_SUBST(WINDOWS_SDK_HOME)
9733 AC_SUBST(WINDOWS_SDK_VERSION)
9734 AC_SUBST(WINDOWS_SDK_WILANGID)
9736 dnl =========================================
9737 dnl Check for uuidgen
9738 dnl =========================================
9739 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9740     if test "$WITH_MINGW" = "yes"; then
9741         AC_PATH_PROG([UUIDGEN], [uuid])
9742         if test -z "$UUIDGEN"; then
9743             AC_MSG_WARN([uuid is needed for dev-install])
9744         fi
9745     else
9746         # presence is already tested above in the WINDOWS_SDK_HOME check
9747         UUIDGEN=uuidgen.exe
9748         AC_SUBST(UUIDGEN)
9749     fi
9750 else
9751     AC_PATH_PROG([UUIDGEN], [uuidgen])
9752     if test -z "$UUIDGEN"; then
9753         AC_MSG_WARN([uuid is needed for dev-install])
9754     fi
9757 dnl =========================================
9758 dnl Check for the Microsoft DirectX SDK.
9759 dnl =========================================
9760 if test -n "$ENABLE_DIRECTX" -a "$_os" = "WINNT"; then
9761     AC_MSG_CHECKING([for DirectX SDK])
9762     if test "$build_os" = "cygwin"; then
9763         dnl A standard installation of the DirectX SDK sets $DXSDK_DIR
9764         if test -n "$DXSDK_DIR"; then
9765             DIRECTXSDK_HOME=`cygpath -d "$DXSDK_DIR"`
9766             DIRECTXSDK_HOME=`cygpath -u "$DIRECTXSDK_HOME"`
9767         fi
9768         # At this point $DIRECTXSDK_HOME might still be undefined. This will lead to
9769         # the "DirectX SDK not found" error later.
9770         # (Where?)
9772         # Remove a possible trailing backslash
9773         DIRECTXSDK_HOME=`echo $DIRECTXSDK_HOME | $SED 's/\/$//'`
9774     fi
9776     if test -f "$DIRECTXSDK_HOME/Include/ddraw.h" -o -f "$DIRECTXSDK_HOME/Include/d3d9.h"; then
9777         HAVE_DIRECTXSDK_H="yes"
9778     else
9779         HAVE_DIRECTXSDK_H="no"
9780     fi
9782     if test "$BITNESS_OVERRIDE" = 64; then
9783         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x64"
9784     else
9785         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x86"
9786     fi
9787     PathFormat "$DIRECTXSDK_LIB"
9788     DIRECTXSDK_LIB="$formatted_path"
9790     if test -f "$DIRECTXSDK_LIB/ddraw.lib" -o -f "$DIRECTXSDK_LIB/d3d9.lib"; then
9791         HAVE_DIRECTXSDK_LIB="yes"
9792     else
9793         HAVE_DIRECTXSDK_LIB="no"
9794     fi
9796     if test "$HAVE_DIRECTXSDK_H" = "yes" -a "$HAVE_DIRECTXSDK_LIB" = "yes"; then
9797         AC_MSG_RESULT([found])
9798     else
9799         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway])
9800     fi
9801     if test -n "$DIRECTXSDK_HOME"; then
9802         PathFormat "$DIRECTXSDK_HOME"
9803         DIRECTXSDK_HOME="$formatted_path"
9804         SOLARINC="$SOLARINC -I$DIRECTXSDK_HOME/include"
9805     fi
9807 AC_SUBST(DIRECTXSDK_HOME)
9809 dnl ***************************************
9810 dnl Checking for bison and flex
9811 dnl ***************************************
9812 AC_PATH_PROG(BISON, bison)
9813 if test -z "$BISON"; then
9814     AC_MSG_ERROR([no bison found in \$PATH, install it])
9815 else
9816     AC_MSG_CHECKING([the bison version])
9817     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9818     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9819     # Accept newer than 2.0
9820     if test "$_bison_longver" -lt 2000; then
9821         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9822     fi
9825 AC_PATH_PROG(FLEX, flex)
9826 if test -z "$FLEX"; then
9827     AC_MSG_ERROR([no flex found in \$PATH, install it])
9828 else
9829     AC_MSG_CHECKING([the flex version])
9830     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9831     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9832         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9833     fi
9835 AC_SUBST([FLEX])
9836 dnl ***************************************
9837 dnl Checking for patch
9838 dnl ***************************************
9839 AC_PATH_PROG(PATCH, patch)
9840 if test -z "$PATCH"; then
9841     AC_MSG_ERROR([\"patch\" not found in \$PATH, install it])
9844 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9845 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9846     if test -z "$with_gnu_patch"; then
9847         GNUPATCH=$PATCH
9848     else
9849         if test -x "$with_gnu_patch"; then
9850             GNUPATCH=$with_gnu_patch
9851         else
9852             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9853         fi
9854     fi
9856     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9857     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9858         AC_MSG_RESULT([yes])
9859     else
9860         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9861     fi
9862 else
9863     GNUPATCH=$PATCH
9866 dnl We also need to check for --with-gnu-cp
9868 if test -z "$with_gnu_cp"; then
9869     # check the place where the good stuff is hidden on Solaris...
9870     if test -x /usr/gnu/bin/cp; then
9871         GNUCP=/usr/gnu/bin/cp
9872     else
9873         AC_PATH_PROGS(GNUCP, gnucp cp)
9874     fi
9875     if test -z $GNUCP; then
9876         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9877     fi
9878 else
9879     if test -x "$with_gnu_cp"; then
9880         GNUCP=$with_gnu_cp
9881     else
9882         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9883     fi
9886 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9887 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9888     AC_MSG_RESULT([yes])
9889 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9890     AC_MSG_RESULT([yes])
9891 else
9892     case "$build_os" in
9893     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9894         x_GNUCP=[\#]
9895         GNUCP=''
9896         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9897         ;;
9898     *)
9899         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9900         ;;
9901     esac
9904 AC_SUBST(GNUPATCH)
9905 AC_SUBST(GNUCP)
9906 AC_SUBST(x_GNUCP)
9908 dnl ***************************************
9909 dnl testing assembler path
9910 dnl ***************************************
9911 ML_EXE=""
9912 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
9913     if test "$BITNESS_OVERRIDE" = ""; then
9914         assembler=ml.exe
9915         assembler_bin=bin
9916     else
9917         assembler=ml64.exe
9918         assembler_bin=bin/amd64
9919     fi
9921     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9922     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9923         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9924         AC_MSG_RESULT([found])
9925         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9926     else
9927         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9928     fi
9930     PathFormat "$ASM_HOME"
9931     ASM_HOME="$formatted_path"
9932 else
9933     ASM_HOME=""
9936 AC_SUBST(ML_EXE)
9938 dnl ===================================================================
9939 dnl We need zip and unzip
9940 dnl ===================================================================
9941 AC_PATH_PROG(ZIP, zip)
9942 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9943 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9944     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],,)
9947 AC_PATH_PROG(UNZIP, unzip)
9948 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9950 dnl ===================================================================
9951 dnl Zip must be a specific type for different build types.
9952 dnl ===================================================================
9953 if test $build_os = cygwin; then
9954     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9955         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9956     fi
9959 dnl ===================================================================
9960 dnl We need touch with -h option support.
9961 dnl ===================================================================
9962 AC_PATH_PROG(TOUCH, touch)
9963 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
9964 touch warn
9965 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
9966     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],,)
9969 dnl ===================================================================
9970 dnl Test which vclplugs have to be built.
9971 dnl ===================================================================
9972 R=""
9973 GTK3_CFLAGS=""
9974 GTK3_LIBS=""
9975 ENABLE_GTK3=""
9976 if test "x$enable_gtk3" = "xyes"; then
9977     if test "$with_system_cairo" = no; then
9978         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
9979     fi
9980     : ${with_system_cairo:=yes}
9981     PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.2 gtk+-unix-print-3.0 gmodule-no-export-2.0 cairo, ENABLE_GTK3="TRUE", ENABLE_GTK3="")
9982     if test "x$ENABLE_GTK3" = "xTRUE"; then
9983         R="gtk3"
9984     else
9985         AC_MSG_ERROR([gtk3 libraries of the correct versions, not found])
9986     fi
9987     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9989 AC_SUBST(GTK3_LIBS)
9990 AC_SUBST(GTK3_CFLAGS)
9991 AC_SUBST(ENABLE_GTK3)
9993 AC_MSG_CHECKING([which VCLplugs shall be built])
9994 if test "$GUIBASE" != "unx" -o "$enable_headless" = "yes"; then
9995     enable_gtk=no
9997 ENABLE_GTK=""
9998 if test "x$enable_gtk" = "xyes"; then
9999     if test "$with_system_cairo" = no; then
10000         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
10001     fi
10002     : ${with_system_cairo:=yes}
10003     ENABLE_GTK="TRUE"
10004     AC_DEFINE(ENABLE_GTK)
10005     R="gtk $R"
10007 AC_SUBST(ENABLE_GTK)
10009 ENABLE_TDE=""
10010 if test "x$enable_tde" = "xyes"; then
10011     # Libs kab and tdeab in connectivity and kdeab and tdeab in shell
10012     # are built from the same sources. So we only allow one of them.
10013     if test "x$enable_kde" = "xyes"; then
10014         AC_MSG_ERROR([enabling both KDE and TDE is not supported])
10015     fi
10016     ENABLE_TDE="TRUE"
10017     AC_DEFINE(ENABLE_TDE)
10018     R="$R tde"
10020 AC_SUBST(ENABLE_TDE)
10022 ENABLE_KDE=""
10023 if test "x$enable_kde" = "xyes"; then
10024     ENABLE_KDE="TRUE"
10025     AC_DEFINE(ENABLE_KDE)
10026     R="$R kde"
10028 AC_SUBST(ENABLE_KDE)
10030 ENABLE_KDE4=""
10031 if test "x$enable_kde4" = "xyes"; then
10032     ENABLE_KDE4="TRUE"
10033     AC_DEFINE(ENABLE_KDE4)
10034     R="$R kde4"
10036 AC_SUBST(ENABLE_KDE4)
10038 ENABLE_HEADLESS=""
10039 if test "x$enable_headless" = "xyes"; then
10040     ENABLE_HEADLESS="TRUE"
10041     SCPDEFS="$SCPDEFS -DLIBO_HEADLESS"
10042     R="headless"
10044 AC_SUBST(ENABLE_HEADLESS)
10046 if test -z "$R"; then
10047     AC_MSG_RESULT([none])
10048 else
10049     AC_MSG_RESULT([$R])
10052 dnl ===================================================================
10053 dnl GCONF check
10054 dnl ===================================================================
10056 ENABLE_GCONF=
10057 AC_MSG_CHECKING([whether to enable GConf support])
10058 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "iOS" -a "$enable_gconf" = "yes"; then
10059     ENABLE_GCONF="TRUE"
10060     AC_MSG_RESULT([yes])
10061     PKG_CHECK_MODULES( GCONF, gconf-2.0 gobject-2.0 )
10062     GCONF_CFLAGS=$(printf '%s' "$GCONF_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10063 else
10064     AC_MSG_RESULT([no])
10066 AC_SUBST(GCONF_LIBS)
10067 AC_SUBST(GCONF_CFLAGS)
10068 AC_SUBST(ENABLE_GCONF)
10070 dnl ===================================================================
10071 dnl Gnome VFS check
10072 dnl ===================================================================
10074 ENABLE_GNOMEVFS=""
10075 AC_MSG_CHECKING([whether to enable GNOME VFS support])
10076 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes" -a "$enable_gconf" = "yes"; then
10077     ENABLE_GNOMEVFS="TRUE"
10078     AC_MSG_RESULT([yes])
10079     PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
10080     GNOMEVFS_CFLAGS=$(printf '%s' "$GNOMEVFS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10081     AC_DEFINE(ENABLE_GNOME_VFS)
10082 else
10083     AC_MSG_RESULT([no])
10085 AC_SUBST(GNOMEVFS_LIBS)
10086 AC_SUBST(GNOMEVFS_CFLAGS)
10087 AC_SUBST(ENABLE_GNOMEVFS)
10089 dnl ===================================================================
10090 dnl check for dbus support
10091 dnl ===================================================================
10092 ENABLE_DBUS=""
10093 DBUS_CFLAGS=""
10094 DBUS_LIBS=""
10096 if test "$enable_dbus" = "no"; then
10097     test_dbus=no
10100 AC_MSG_CHECKING([whether to enable DBUS support])
10101 if test "$test_dbus" = "yes"; then
10102     ENABLE_DBUS="TRUE"
10103     AC_MSG_RESULT([yes])
10104     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
10105     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10106 else
10107     AC_MSG_RESULT([no])
10110 AC_SUBST(ENABLE_DBUS)
10111 AC_SUBST(DBUS_CFLAGS)
10112 AC_SUBST(DBUS_LIBS)
10114 AC_MSG_CHECKING([whether to enable font install via packagekit])
10115 if test "$ENABLE_DBUS" = "TRUE"; then
10116     if test -n "$enable_packagekit" -a "$enable_packagekit" != "no"; then
10117         ENABLE_PACKAGEKIT=TRUE
10118         AC_MSG_RESULT([yes])
10119     else
10120         ENABLE_PACKAGEKIT=
10121         AC_MSG_RESULT([no])
10122     fi
10123 else
10124     AC_MSG_RESULT([no, dbus disabled.])
10126 AC_SUBST(ENABLE_PACKAGEKIT)
10128 AC_MSG_CHECKING([whether to enable Impress remote control])
10129 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10130     AC_MSG_RESULT([yes])
10131     ENABLE_SDREMOTE=TRUE
10132     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10134     # If not explicitly enabled or disabled, default
10135     if test -z "$enable_sdremote_bluetooth"; then
10136         case "$OS" in
10137         LINUX|MACOSX|WNT)
10138             # Default to yes for these
10139             enable_sdremote_bluetooth=yes
10140             ;;
10141         *)
10142             # otherwise no
10143             enable_sdremote_bluetooth=no
10144             ;;
10145         esac
10146     fi
10147     # $enable_sdremote_bluetooth is guaranteed non-empty now
10149     if test "$enable_sdremote_bluetooth" != "no"; then
10150         if test "$OS" = "LINUX"; then
10151             if test "$ENABLE_DBUS" = "TRUE"; then
10152                 AC_MSG_RESULT([yes])
10153                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10154                 dnl ===================================================================
10155                 dnl Check for system bluez
10156                 dnl ===================================================================
10157                 AC_MSG_CHECKING([which Bluetooth header to use])
10158                 if test "$with_system_bluez" = "yes"; then
10159                     AC_MSG_RESULT([external])
10160                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10161                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10162                     SYSTEM_BLUEZ=TRUE
10163                 else
10164                     AC_MSG_RESULT([internal])
10165                     SYSTEM_BLUEZ=
10166                 fi
10167             else
10168                 AC_MSG_RESULT([no, dbus disabled])
10169                 ENABLE_SDREMOTE_BLUETOOTH=
10170                 SYSTEM_BLUEZ=
10171             fi
10172         else
10173             AC_MSG_RESULT([yes])
10174             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10175             SYSTEM_BLUEZ=
10176         fi
10177     else
10178         AC_MSG_RESULT([no])
10179         ENABLE_SDREMOTE_BLUETOOTH=
10180         SYSTEM_BLUEZ=
10181     fi
10182 else
10183     ENABLE_SDREMOTE=
10184     SYSTEM_BLUEZ=
10185     AC_MSG_RESULT([no])
10187 AC_SUBST(ENABLE_SDREMOTE)
10188 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10189 AC_SUBST(SYSTEM_BLUEZ)
10191 AC_MSG_CHECKING([whether to enable Impress remote control android app])
10192 if echo "$host_os" | grep -q linux-android || test "$enable_sdremote_android" = "yes"; then
10193     AC_MSG_RESULT([yes])
10194     ENABLE_SDREMOTE_ANDROID=TRUE
10195 else
10196     AC_MSG_RESULT([no])
10197     ENABLE_SDREMOTE_ANDROID=
10199 AC_SUBST(ENABLE_SDREMOTE_ANDROID)
10201 dnl ===================================================================
10202 dnl Check whether the gtk 2.0 libraries are available.
10203 dnl ===================================================================
10205 GTK_CFLAGS=""
10206 GTK_LIBS=""
10207 ENABLE_SYSTRAY_GTK=""
10208 if test  "$test_gtk" = "yes"; then
10210     if test "$ENABLE_GTK" = "TRUE"; then
10211         PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4 gdk-pixbuf-xlib-2.0 >= 2.2 ,,AC_MSG_ERROR([requirements to build the gtk-plugin not met. Use --disable-gtk or install the missing packages]))
10212         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10213         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]))
10214         BUILD_TYPE="$BUILD_TYPE GTK"
10215         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10217     AC_MSG_CHECKING([whether to enable the systray quickstarter])
10218         if test "x$enable_systray" = "xyes"; then
10219             AC_MSG_RESULT([yes])
10220             PKG_CHECK_MODULES( GTK210, gtk+-2.0 >= 2.10.0,
10221                             [ ENABLE_SYSTRAY_GTK="TRUE" ],
10222                             [ ENABLE_SYSTRAY_GTK="" ])
10223         else
10224             AC_MSG_RESULT([no])
10225         fi
10227         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10228         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10229                           [ENABLE_GTK_PRINT="TRUE"],
10230                           [ENABLE_GTK_PRINT=""])
10231         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10233         AC_MSG_CHECKING([whether to enable GIO support])
10234         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10235             if test "$ENABLE_GNOMEVFS" = "TRUE"; then
10236                 AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
10237             fi
10238             dnl Need at least 2.26 for the dbus support.
10239             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10240                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10241             if test "$ENABLE_GIO" = "TRUE"; then
10242                 AC_DEFINE(ENABLE_GIO)
10243                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10244             fi
10245         else
10246             AC_MSG_RESULT([no])
10247         fi
10248     fi
10250 AC_SUBST(ENABLE_GIO)
10251 AC_SUBST(GIO_CFLAGS)
10252 AC_SUBST(GIO_LIBS)
10253 AC_SUBST(ENABLE_SYSTRAY_GTK)
10254 AC_SUBST(GTK_CFLAGS)
10255 AC_SUBST(GTK_LIBS)
10256 AC_SUBST(GTHREAD_CFLAGS)
10257 AC_SUBST(GTHREAD_LIBS)
10258 AC_SUBST([ENABLE_GTK_PRINT])
10259 AC_SUBST([GTK_PRINT_CFLAGS])
10260 AC_SUBST([GTK_PRINT_LIBS])
10263 dnl ===================================================================
10264 dnl Check whether the Telepathy libraries are available.
10265 dnl ===================================================================
10267 ENABLE_TELEPATHY=""
10268 TELEPATHY_CFLAGS=""
10269 TELEPATHY_LIBS=""
10271 AC_MSG_CHECKING([whether to enable Telepathy support])
10272 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_telepathy" = "yes"; then
10273     ENABLE_TELEPATHY="TRUE"
10274     AC_DEFINE(ENABLE_TELEPATHY)
10275     AC_MSG_RESULT([yes])
10276     PKG_CHECK_MODULES( TELEPATHY, telepathy-glib >= 0.18.0 glib-2.0 gobject-2.0 gthread-2.0 gio-2.0 gtk+-2.0 >= 2.4 )
10277     TELEPATHY_CFLAGS=$(printf '%s' "$TELEPATHY_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10278 else
10279     AC_MSG_RESULT([no])
10282 AC_SUBST(ENABLE_TELEPATHY)
10283 AC_SUBST(TELEPATHY_CFLAGS)
10284 AC_SUBST(TELEPATHY_LIBS)
10287 dnl ===================================================================
10289 SPLIT_APP_MODULES=""
10290 if test "$enable_split_app_modules" = "yes"; then
10291     SPLIT_APP_MODULES="TRUE"
10293 AC_SUBST(SPLIT_APP_MODULES)
10295 SPLIT_OPT_FEATURES=""
10296 if test "$enable_split_opt_features" = "yes"; then
10297     SPLIT_OPT_FEATURES="TRUE"
10299 AC_SUBST(SPLIT_OPT_FEATURES)
10301 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10302     if test "$enable_cairo_canvas" = yes; then
10303         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10304     fi
10305     enable_cairo_canvas=no
10306 elif test -z "$enable_cairo_canvas"; then
10307     enable_cairo_canvas=yes
10310 ENABLE_CAIRO_CANVAS=""
10311 if test "$enable_cairo_canvas" = "yes"; then
10312     test_cairo=yes
10313     ENABLE_CAIRO_CANVAS="TRUE"
10315 AC_SUBST(ENABLE_CAIRO_CANVAS)
10317 dnl ===================================================================
10318 dnl Check whether the GStreamer libraries are available.
10319 dnl ===================================================================
10321 ENABLE_GSTREAMER=""
10323 if test "$build_gstreamer" = "yes"; then
10325     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10326     if test "$enable_avmedia" = yes -a "$enable_gstreamer" != no; then
10327         ENABLE_GSTREAMER="TRUE"
10328         AC_MSG_RESULT([yes])
10329         PKG_CHECK_MODULES( GSTREAMER, gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-video-1.0 )
10330         GSTREAMER_CFLAGS=$(printf '%s' "$GSTREAMER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10331     else
10332         AC_MSG_RESULT([no])
10333     fi
10335 AC_SUBST(GSTREAMER_CFLAGS)
10336 AC_SUBST(GSTREAMER_LIBS)
10337 AC_SUBST(ENABLE_GSTREAMER)
10340 ENABLE_GSTREAMER_0_10=""
10341 if test "$build_gstreamer_0_10" = "yes"; then
10343     AC_MSG_CHECKING([whether to enable the GStreamer avmedia backend])
10344     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10345         ENABLE_GSTREAMER_0_10="TRUE"
10346         AC_MSG_RESULT([yes])
10347         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-interfaces-0.10],, [
10348             PKG_CHECK_MODULES(  [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10] )
10349         ])
10350         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10351     else
10352         AC_MSG_RESULT([no])
10353     fi
10356 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10357 AC_SUBST(GSTREAMER_0_10_LIBS)
10358 AC_SUBST(ENABLE_GSTREAMER_0_10)
10360 dnl ===================================================================
10361 dnl Check whether to build the VLC avmedia backend
10362 dnl ===================================================================
10364 ENABLE_VLC=""
10366 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10367 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10368     ENABLE_VLC="TRUE"
10369     AC_MSG_RESULT([yes])
10370 else
10371     AC_MSG_RESULT([no])
10373 AC_SUBST(ENABLE_VLC)
10375 dnl ===================================================================
10376 dnl Check whether the OpenGL libraries are available
10377 dnl ===================================================================
10379 AC_MSG_CHECKING([whether to build the OpenGL Transitions component])
10380 ENABLE_OPENGL=
10382 if test -z "$enable_opengl"; then
10383     if test $_os = WINNT; then
10384         # By default disable the OpenGL transitions for Windows (the code compiles but works very
10385         # badly and crashes). In other words, use --enable-opengl only if you plan to hack on that
10386         # code for Windows.
10387         enable_opengl=no
10388     elif test $_os = iOS; then
10389         # As such with some suitable minor tweaks the Mac OpenGL transitions code would presumably
10390         # build fine for iOS, too, but let's leave that for later
10391         enable_opengl=no
10392     elif test "$enable_headless" = "yes"; then
10393         enable_opengl=no
10394     else
10395         enable_opengl=yes
10396     fi
10399 if test "x$enable_opengl" = "xno"; then
10400     AC_MSG_RESULT([no])
10401 elif test "$_os" = "Darwin"; then
10402     # We use frameworks on Mac OS X, no need for detail checks
10403     ENABLE_OPENGL=TRUE
10404     ENABLE_OPENGL_CANVAS=
10405     add_warning "openGL canvas not adapted for Mac yet - disabling"
10406     SYSTEM_MESA_HEADERS=TRUE
10407     AC_MSG_RESULT([yes])
10408 elif test $_os = WINNT; then
10409     # Experimental: try to use OpenGL on Windows
10410     ENABLE_OPENGL=TRUE
10411     ENABLE_OPENGL_CANVAS=TRUE
10412     # We need the internal "Mesa" headers.
10413     SYSTEM_MESA_HEADERS=
10414     BUILD_TYPE="$BUILD_TYPE MESA"
10415     AC_MSG_RESULT([yes])
10416 else
10417     save_LDFLAGS=$LDFLAGS
10418     LDFLAGS="$LDFLAGS -lm"
10419     AC_MSG_RESULT([yes])
10420     AC_CHECK_LIB([GL], [main],
10421         [AC_CHECK_LIB([GL], [glCreateShader], [ENABLE_OPENGL_CANVAS=TRUE],
10422             [add_warning "no shader support in libGL - will enable openGL transitions, but not openGL canvas"
10423              AC_MSG_WARN([no shader support in libGL - will enable openGL transitions, but not openGL canvas])
10424              ENABLE_OPENGL_CANVAS=], [])],
10425         [AC_MSG_ERROR(libGL not installed or functional)], [])
10426     LDFLAGS="$LDFLAGS -lGL"
10427     AC_CHECK_LIB([GLU], [main], [:],
10428               [AC_MSG_ERROR(libGLU not installed or functional)], [])
10429     ENABLE_OPENGL=TRUE
10430     LDFLAGS=$save_LDFLAGS
10432     dnl ===================================================================
10433     dnl Check for system Mesa
10434     dnl ===================================================================
10435     AC_MSG_CHECKING([which Mesa headers to use])
10436     if test "$with_system_mesa_headers" = "yes"; then
10437         AC_MSG_RESULT([external])
10438         SYSTEM_MESA_HEADERS=TRUE
10439         AC_LANG_PUSH(C)
10440         AC_CHECK_HEADER(GL/glxext.h, [],
10441            [ AC_MSG_ERROR(mesa headers not found.)], [#include <GL/glx.h>])
10442         AC_MSG_CHECKING([whether GL/glxext.h defines PFNGLXBINDTEXIMAGEEXTPROC])
10443         AC_EGREP_HEADER(PFNGLXBINDTEXIMAGEEXTPROC, GL/glxext.h, [AC_MSG_RESULT([yes])], AC_MSG_ERROR(no))
10444         AC_LANG_POP(C)
10445     else
10446         AC_MSG_RESULT([internal])
10447         SYSTEM_MESA_HEADERS=
10448         BUILD_TYPE="$BUILD_TYPE MESA"
10449     fi
10452 AC_SUBST(SYSTEM_MESA_HEADERS)
10453 AC_SUBST(ENABLE_OPENGL)
10454 AC_SUBST(ENABLE_OPENGL_CANVAS)
10456 dnl =================================================
10457 dnl Check whether to build with OpenCL support.
10458 dnl =================================================
10460 AC_MSG_CHECKING([whether to build with the OpenCL support.])
10461 ENABLE_OPENCL=
10463 if test $_os != iOS -a $_os != Android -a "x$enable_opencl" != "xno"; then
10464     if test $_os = Darwin -a "$with_macosx_sdk" = "10.5"; then
10465         AC_MSG_RESULT([disabled on OS X 10.5])
10466     else
10467         AC_MSG_RESULT([yes])
10468         ENABLE_OPENCL=TRUE
10469         AC_DEFINE(HAVE_FEATURE_OPENCL)
10470     fi
10471 else
10472     AC_MSG_RESULT([no])
10475 AC_SUBST(ENABLE_OPENCL)
10477 dnl ===================================================================
10478 dnl Check whether to enable glTF support
10479 dnl ===================================================================
10481 ENABLE_GLTF=
10482 AC_MSG_CHECKING([whether to enable glTF support])
10483 if test "x$enable_gltf" != "xno"; then
10484     ENABLE_GLTF=TRUE
10485     AC_MSG_RESULT([yes])
10486     BUILD_TYPE="$BUILD_TYPE LIBGLTF"
10487     if test "$test_freetype" = "no"; then
10488         BUILD_TYPE="$BUILD_TYPE FREETYPE"
10489         if test "$COM" = "MSC"; then
10490             test -n "${MSVC_USE_DEBUG_RUNTIME}" && FREETYPE_LIB_DEBUGLIB_SUFFIX="_D"
10491             FREETYPE_LIBS="${WORKDIR}/UnpackedTarball/freetype/objs/win32/vc2010/freetype248$FREETYPE_LIB_DEBUGLIB_SUFFIX.lib"
10492         fi
10493     fi
10494     # otherwise build fails in collada2gltf external because of std::shared_ptr
10495     if test "$have_std_shared_ptr" = "yes"; then
10496         BUILD_TYPE="$BUILD_TYPE COLLADA2GLTF"
10497     fi
10498 else
10499     AC_MSG_RESULT([no])
10501 AC_SUBST(ENABLE_GLTF)
10503 # pdf import?
10504 AC_MSG_CHECKING([whether to build the PDF import feature])
10505 ENABLE_PDFIMPORT=
10506 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10507     AC_MSG_RESULT([yes])
10508     ENABLE_PDFIMPORT=TRUE
10510     dnl ===================================================================
10511     dnl Check for system poppler
10512     dnl ===================================================================
10513     AC_MSG_CHECKING([which PDF import backend to use])
10514     if test "$with_system_poppler" = "yes"; then
10515         AC_MSG_RESULT([external])
10516         SYSTEM_POPPLER=TRUE
10517         PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
10518         AC_LANG_PUSH([C++])
10519         save_CXXFLAGS=$CXXFLAGS
10520         save_CPPFLAGS=$CPPFLAGS
10521         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10522         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10523         AC_CHECK_HEADER([cpp/poppler-version.h], [],
10524                    [AC_MSG_ERROR([cpp/poppler-version.h not found. Install poppler])], [])
10525         CXXFLAGS=$save_CXXFLAGS
10526         CPPFLAGS=$save_CPPFLAGS
10527         AC_LANG_POP([C++])
10528         libo_MINGW_CHECK_DLL([libpoppler])
10529         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10530     else
10531         AC_MSG_RESULT([internal])
10532         SYSTEM_POPPLER=
10533         BUILD_TYPE="$BUILD_TYPE POPPLER"
10534     fi
10535 else
10536     AC_MSG_RESULT([no])
10538 AC_SUBST(ENABLE_PDFIMPORT)
10539 AC_SUBST(SYSTEM_POPPLER)
10540 AC_SUBST(POPPLER_CFLAGS)
10541 AC_SUBST(POPPLER_LIBS)
10543 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10544 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10545     AC_MSG_RESULT([yes])
10546     ENABLE_MEDIAWIKI=TRUE
10547     BUILD_TYPE="$BUILD_TYPE XSLTML"
10548     if test  "x$with_java" = "xno"; then
10549         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10550     fi
10551 else
10552     AC_MSG_RESULT([no])
10553     ENABLE_MEDIAWIKI=
10554     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10556 AC_SUBST(ENABLE_MEDIAWIKI)
10558 AC_MSG_CHECKING([whether to build the Report Builder])
10559 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10560     AC_MSG_RESULT([yes])
10561     ENABLE_REPORTBUILDER=TRUE
10562     AC_MSG_CHECKING([which jfreereport libs to use])
10563     if test "$with_system_jfreereport" = "yes"; then
10564         SYSTEM_JFREEREPORT=TRUE
10565         AC_MSG_RESULT([external])
10566         if test -z $SAC_JAR; then
10567             SAC_JAR=/usr/share/java/sac.jar
10568         fi
10569         AC_CHECK_FILE($SAC_JAR, [],
10570              [AC_MSG_ERROR(sac.jar not found.)], [])
10572         if test -z $LIBXML_JAR; then
10573             AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
10574                 [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
10575                 [
10576                     AC_CHECK_FILE(/usr/share/java/libxml.jar,
10577                        [ LIBXML_JAR=/usr/share/java/libxml.jar ],
10578                        [AC_MSG_ERROR(libxml.jar replacement not found.)]
10579                     )
10580                 ]
10581             )
10582         else
10583             AC_CHECK_FILE($LIBXML_JAR, [],
10584                  [AC_MSG_ERROR(libxml.jar not found.)], [])
10585         fi
10587         if test -z $FLUTE_JAR; then
10588             AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
10589                 [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
10590                 [
10591                     AC_CHECK_FILE(/usr/share/java/flute.jar,
10592                         [ FLUTE_JAR=/usr/share/java/flute.jar ],
10593                         [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
10594                     )
10595                 ]
10596             )
10597         else
10598             AC_CHECK_FILE($FLUTE_JAR, [],
10599                  [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
10600         fi
10602         if test -z $JFREEREPORT_JAR; then
10603             AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
10604                 [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
10605                 [
10606                     AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
10607                         [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
10608                         [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
10609                     )
10610                 ]
10611             )
10612         else
10613             AC_CHECK_FILE($JFREEREPORT_JAR, [],
10614                  [AC_MSG_ERROR(jfreereport.jar not found.)], [])
10615         fi
10617         if test -z $LIBLAYOUT_JAR; then
10618             AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
10619                 [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
10620                 [
10621                     AC_CHECK_FILE(/usr/share/java/liblayout.jar,
10622                         [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
10623                         [AC_MSG_ERROR(liblayout.jar replacement not found.)]
10624                     )
10625                 ]
10626             )
10627         else
10628             AC_CHECK_FILE($LIBLAYOUT_JAR, [],
10629                  [AC_MSG_ERROR(liblayout.jar not found.)], [])
10630         fi
10632         if test -z $LIBLOADER_JAR; then
10633             AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
10634                 [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
10635                 [
10636                     AC_CHECK_FILE(/usr/share/java/libloader.jar,
10637                        [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
10638                        [AC_MSG_ERROR(libloader.jar replacement not found.)]
10639                     )
10640                 ]
10641             )
10642         else
10643             AC_CHECK_FILE($LIBLOADER_JAR, [],
10644                 [AC_MSG_ERROR(libloader.jar not found.)], [])
10645         fi
10647         if test -z $LIBFORMULA_JAR; then
10648             AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
10649                  [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
10650                  [
10651                      AC_CHECK_FILE(/usr/share/java/libformula.jar,
10652                          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
10653                          [AC_MSG_ERROR(libformula.jar replacement not found.)]
10654                      )
10655                  ]
10656             )
10657         else
10658             AC_CHECK_FILE($LIBFORMULA_JAR, [],
10659                 [AC_MSG_ERROR(libformula.jar not found.)], [])
10660         fi
10662         if test -z $LIBREPOSITORY_JAR; then
10663             AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
10664                 [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
10665                 [
10666                     AC_CHECK_FILE(/usr/share/java/librepository.jar,
10667                         [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
10668                         [AC_MSG_ERROR(librepository.jar replacement not found.)]
10669                     )
10670                 ]
10671             )
10672         else
10673             AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
10674                 [AC_MSG_ERROR(librepository.jar not found.)], [])
10675         fi
10677         if test -z $LIBFONTS_JAR; then
10678             AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
10679                 [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
10680                 [
10681                     AC_CHECK_FILE(/usr/share/java/libfonts.jar,
10682                         [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
10683                         [AC_MSG_ERROR(libfonts.jar replacement not found.)]
10684                     )
10685                 ]
10686             )
10687         else
10688             AC_CHECK_FILE($LIBFONTS_JAR, [],
10689                 [AC_MSG_ERROR(libfonts.jar not found.)], [])
10690         fi
10692         if test -z $LIBSERIALIZER_JAR; then
10693             AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
10694                 [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
10695                 [
10696                     AC_CHECK_FILE(/usr/share/java/libserializer.jar,
10697                         [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
10698                         [AC_MSG_ERROR(libserializer.jar replacement not found.)]
10699                     )
10700                 ]
10701             )
10702         else
10703             AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
10704                 [AC_MSG_ERROR(libserializer.jar not found.)], [])
10705         fi
10707         if test -z $LIBBASE_JAR; then
10708             AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
10709                 [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
10710                 [
10711                     AC_CHECK_FILE(/usr/share/java/libbase.jar,
10712                         [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
10713                         [AC_MSG_ERROR(libbase.jar replacement not found.)]
10714                     )
10715                 ]
10716             )
10717         else
10718             AC_CHECK_FILE($LIBBASE_JAR, [],
10719                 [AC_MSG_ERROR(libbase.jar not found.)], [])
10720         fi
10722     else
10723         AC_MSG_RESULT([internal])
10724         SYSTEM_JFREEREPORT=
10725         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10726     fi
10727 else
10728     AC_MSG_RESULT([no])
10729     ENABLE_REPORTBUILDER=
10730     SYSTEM_JFREEREPORT=
10732 AC_SUBST(ENABLE_REPORTBUILDER)
10733 AC_SUBST(SYSTEM_JFREEREPORT)
10734 AC_SUBST(SAC_JAR)
10735 AC_SUBST(LIBXML_JAR)
10736 AC_SUBST(FLUTE_JAR)
10737 AC_SUBST(JFREEREPORT_JAR)
10738 AC_SUBST(LIBBASE_JAR)
10739 AC_SUBST(LIBLAYOUT_JAR)
10740 AC_SUBST(LIBLOADER_JAR)
10741 AC_SUBST(LIBFORMULA_JAR)
10742 AC_SUBST(LIBREPOSITORY_JAR)
10743 AC_SUBST(LIBFONTS_JAR)
10744 AC_SUBST(LIBSERIALIZER_JAR)
10746 # this has to be here because both the Wiki Publisher and the SRB use
10747 # commons-logging
10748 if test "$ENABLE_MEDIAWIKI" = "TRUE" -o "$ENABLE_REPORTBUILDER" = "TRUE"; then
10749     AC_MSG_CHECKING([which Apache commons-* libs to use])
10750     if test "$with_system_apache_commons" = "yes"; then
10751         SYSTEM_APACHE_COMMONS=TRUE
10752         AC_MSG_RESULT([external])
10753         if test "$ENABLE_MEDIAWIKI" = "TRUE"; then
10754             if test -z $COMMONS_CODEC_JAR; then
10755                 _commons_codec_path=""
10756                 if test "$HAVE_JAVA6" = "TRUE"; then
10757                     _commons_codec_path="/usr/share/java/commons-codec-1.9.jar"
10758                 else
10759                     _commons_codec_path="/usr/share/java/commons-codec-1.6.jar"
10760                 fi
10761                 AC_CHECK_FILE($_commons_codec_path,
10762                     [ COMMONS_CODEC_JAR=$_commons_codec_path ],
10763                     [
10764                         AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
10765                             [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
10766                             [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
10767                         )
10768                     ]
10769                 )
10770             else
10771                 AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
10772                     [AC_MSG_ERROR(commons-codec.jar not found.)], [])
10773             fi
10775             if test -z $COMMONS_LANG_JAR; then
10776                 _commons_lang_path=""
10777                 if test "$HAVE_JAVA6" = "TRUE"; then
10778                     _commons_lang_path="/usr/share/java/commons-lang3-3.3.1-src.tar.gz"
10779                 else
10780                     _commons_lang_path="/usr/share/java/commons-lang-2.4.jar"
10781                 fi
10782                 AC_CHECK_FILE($_commons_lang_path,
10783                     [ COMMONS_LANG_JAR=$commons_lang_path ],
10784                     [
10785                         AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
10786                             [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
10787                             [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
10788                             )
10789                     ]
10790                 )
10791             else
10792                 AC_CHECK_FILE($COMMONS_LANG_JAR, [],
10793                     [AC_MSG_ERROR(commons-lang.jar not found.)], [])
10794             fi
10796             if test -z $COMMONS_HTTPCLIENT_JAR; then
10797                 AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
10798                     [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
10799                     [
10800                         AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
10801                             [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
10802                             [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
10803                         )
10804                     ]
10805                 )
10806             else
10807                 AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
10808                     [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
10809             fi
10810         fi
10811         if test "$ENABLE_MEDIAWIKI" = "TRUE" -o "$ENABLE_REPORTBUILDER" = "TRUE"; then
10812             if test -z $COMMONS_LOGGING_JAR; then
10813                 AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.3.jar,
10814                    [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.3.jar ],
10815                    [
10816                         AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
10817                             [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
10818                             [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
10819                         )
10820                     ]
10821                 )
10822             else
10823                 AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
10824                     [AC_MSG_ERROR(commons-logging.jar not found.)], [])
10825             fi
10826         fi
10827     else
10828         AC_MSG_RESULT([internal])
10829         SYSTEM_APACHE_COMMONS=
10830         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
10831     fi
10833 AC_SUBST(SYSTEM_APACHE_COMMONS)
10834 AC_SUBST(COMMONS_CODEC_JAR)
10835 AC_SUBST(COMMONS_LANG_JAR)
10836 AC_SUBST(COMMONS_HTTPCLIENT_JAR)
10837 AC_SUBST(COMMONS_LOGGING_JAR)
10839 # scripting provider for BeanShell?
10840 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10841 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10842     AC_MSG_RESULT([yes])
10843     ENABLE_SCRIPTING_BEANSHELL=TRUE
10845     dnl ===================================================================
10846     dnl Check for system beanshell
10847     dnl ===================================================================
10848     AC_MSG_CHECKING([which beanshell to use])
10849     if test "$with_system_beanshell" = "yes"; then
10850         AC_MSG_RESULT([external])
10851         SYSTEM_BSH=TRUE
10852         if test -z $BSH_JAR; then
10853             BSH_JAR=/usr/share/java/bsh.jar
10854         fi
10855         AC_CHECK_FILE($BSH_JAR, [],
10856                    [AC_MSG_ERROR(bsh.jar not found.)], [])
10857     else
10858         AC_MSG_RESULT([internal])
10859         SYSTEM_BSH=
10860         BUILD_TYPE="$BUILD_TYPE BSH"
10861     fi
10862 else
10863     AC_MSG_RESULT([no])
10864     ENABLE_SCRIPTING_BEANSHELL=
10865     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10867 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10868 AC_SUBST(SYSTEM_BSH)
10869 AC_SUBST(BSH_JAR)
10871 # scripting provider for JavaScript?
10872 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10873 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10874     AC_MSG_RESULT([yes])
10875     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10877     dnl ===================================================================
10878     dnl Check for system rhino
10879     dnl ===================================================================
10880     AC_MSG_CHECKING([which rhino to use])
10881     if test "$with_system_rhino" = "yes"; then
10882         AC_MSG_RESULT([external])
10883         SYSTEM_RHINO=TRUE
10884         if test -z $RHINO_JAR; then
10885             RHINO_JAR=/usr/share/java/js.jar
10886         fi
10887         AC_CHECK_FILE($RHINO_JAR, [],
10888                    [AC_MSG_ERROR(js.jar not found.)], [])
10889     else
10890         AC_MSG_RESULT([internal])
10891         SYSTEM_RHINO=
10892         BUILD_TYPE="$BUILD_TYPE RHINO"
10893     fi
10894 else
10895     AC_MSG_RESULT([no])
10896     ENABLE_SCRIPTING_JAVASCRIPT=
10897     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10899 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10900 AC_SUBST(SYSTEM_RHINO)
10901 AC_SUBST(RHINO_JAR)
10903 supports_multilib=
10904 case "$host_cpu" in
10905 x86_64 | powerpc64 | s390x)
10906     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10907         supports_multilib="yes"
10908     fi
10909     ;;
10911     ;;
10912 esac
10914 dnl ===================================================================
10915 dnl Check whether the TQt and TDE libraries are available.
10916 dnl ===================================================================
10918 TDE_CFLAGS=""
10919 TDE_LIBS=""
10920 if test "$_os" != "OpenBSD"; then
10921     MOC="moc"
10923 if test "$test_tde" = "yes" -a "$ENABLE_TDE" = "TRUE"; then
10924     dnl Search paths for TQt and TDE
10925     if test -z "$supports_multilib"; then
10926         tqt_incdirs="$QTINC /usr/local/tqt3/include /usr/include/tqt3 /usr/include /usr/X11R6/include/X11/tqt3 /usr/X11R6/include/tqt3 /usr/lib/tqt3/include /usr/lib/tqt3/include /usr/share/tqt3/include /usr/local/include/X11/tqt3 $x_includes"
10927         tqt_libdirs="$QTLIB /usr/local/tqt3/lib /usr/lib/tqt3 /usr/lib /usr/X11R6/lib/X11/tqt3 /usr/X11R6/lib/tqt3 /usr/lib/tqt3/lib /usr/lib/tqt3/lib /usr/share/tqt3/lib /usr/local/lib/tqt3 $x_libraries"
10928     else
10929         tqt_incdirs="$QTINC /usr/local/tqt3/include /usr/include/tqt3 /usr/include /usr/X11R6/include/X11/tqt3 /usr/X11R6/include/tqt3 /usr/lib64/tqt3/include /usr/lib64/tqt3/include /usr/share/tqt3/include /usr/lib/tqt3/include /usr/lib/tqt3/include /usr/local/include/X11/tqt3 $x_includes"
10930         tqt_libdirs="$QTLIB /usr/local/tqt3/lib64 /usr/lib64/tqt3 /usr/lib64 /usr/X11R6/lib64/X11/tqt3 /usr/X11R6/lib64/tqt3 /usr/lib64/tqt3/lib64 /usr/lib64/tqt3/lib64 /usr/share/tqt3/lib64 /usr/local/tqt3/lib /usr/lib/tqt3 /usr/lib /usr/X11R6/lib/X11/tqt3 /usr/X11R6/lib/tqt3 /usr/lib/tqt3/lib /usr/lib/tqt3/lib /usr/share/tqt3/lib /usr/local/lib/tqt3 $x_libraries"
10931     fi
10932     if test -n "$TQTDIR"; then
10933         tqt_incdirs="$TQTDIR/include $tqt_incdirs"
10934         if test -z "$supports_multilib"; then
10935             tqt_libdirs="$TQTDIR/lib $tqt_libdirs"
10936         else
10937             tqt_libdirs="$TQTDIR/lib64 $TQTDIR/lib $tqt_libdirs"
10938         fi
10939     fi
10940     if test -z "$supports_multilib"; then
10941         tde_incdirs="/usr/lib/trinity/include /usr/local/trinity/include /usr/local/include /usr/trinity/include /usr/include/trinity /opt/trinity/include /opt/trinity/include $x_includes"
10942         tde_libdirs="/usr/lib/trinity/lib /usr/local/trinity/lib /usr/trinity/lib /usr/lib/trinity /usr/lib/trinity /usr/X11R6/lib /usr/local/lib /opt/trinity/lib /opt/trinity/lib /usr/X11R6/trinity/lib /usr/lib $x_libraries"
10943     else
10944         tde_incdirs="/usr/lib64/trinity/include /usr/lib/trinity/include /usr/local/trinity/include /usr/local/include /usr/trinity/include /usr/include/trinity /opt/trinity/include /opt/trinity/include $x_includes"
10945         tde_libdirs="/usr/lib64/trinity/lib64 /usr/local/trinity/lib64 /usr/trinity/lib64 /usr/lib64/trinity /usr/lib64/trinity /usr/X11R6/lib64 /usr/local/lib64 /opt/trinity/lib64 /opt/trinity/lib64 /usr/X11R6/trinity/lib64 /usr/lib/trinity/lib /usr/local/trinity/lib /usr/trinity/lib /usr/lib/trinity /usr/lib/trinity /usr/lib /usr/X11R6/lib /usr/local/lib /opt/trinity/lib /opt/trinity/lib /usr/X11R6/trinity/lib /usr/lib64 $x_libraries"
10946     fi
10947     if test -n "$TDEDIR"; then
10948         tde_incdirs="$TDEDIR/include $tde_incdirs"
10949         if test -z "$supports_multilib"; then
10950             tde_libdirs="$TDEDIR/lib $tde_libdirs"
10951         else
10952             tde_libdirs="$TDEDIR/lib64 $TDEDIR/lib $tde_libdirs"
10953         fi
10954     fi
10956     dnl What to test
10957     tqt_test_include="ntqstyle.h"
10958     tde_test_include="kapp.h"
10960     if test "$_os" != "OpenBSD"; then
10961         tqt_test_library="libtqt-mt.so"
10962         tde_test_library="libDCOP.so"
10963     else
10964         tqt_test_library="libtqt-mt.so*"
10965         tde_test_library="libDCOP.so*"
10966     fi
10968     dnl Check for TQt headers
10969     AC_MSG_CHECKING([for TQt headers])
10970     tqt_incdir="no"
10971     for tde_check in $tqt_incdirs; do
10972         if test -r "$tde_check/$tqt_test_include"; then
10973             tqt_incdir="$tde_check"
10974             break
10975         fi
10976     done
10977     AC_MSG_RESULT([$tqt_incdir])
10978     if test "x$tqt_incdir" = "xno"; then
10979         AC_MSG_ERROR([TQt headers not found.  Please specify the root of
10980 your TQt installation by exporting TQTDIR before running "configure".])
10981     fi
10983     dnl Check for TQt libraries
10984     AC_MSG_CHECKING([for TQt libraries])
10985     tqt_libdir="no"
10986     for tqt_check in $tqt_libdirs; do
10987         if test -r "`ls $tqt_check/$tqt_test_library 2>/dev/null | head -1`"; then
10988             tqt_libdir="$tqt_check"
10989             break
10990         fi
10991     done
10992     AC_MSG_RESULT([$tqt_libdir])
10993     if test "x$tqt_libdir" = "xno"; then
10994         AC_MSG_ERROR([TQt libraries not found.  Please specify the root of
10995 your TQt installation by exporting TQTDIR before running "configure".])
10996     fi
10998     dnl Check for Meta Object Compiler
10999     AC_PATH_PROG( MOC, moc, no, [`dirname $tqt_libdir`/bin:$TQTDIR/bin:$PATH] )
11000     if test "$MOC" = "no"; then
11001         AC_MSG_ERROR([TQt Meta Object Compiler not found.  Please specify
11002 the root of your TQt installation by exporting TQTDIR before running "configure".])
11003     fi
11005     dnl Check for TDE headers
11006     AC_MSG_CHECKING([for TDE headers])
11007     tde_incdir="no"
11008     for tde_check in $tde_incdirs; do
11009         if test -r "$tde_check/$tde_test_include"; then
11010             tde_incdir="$tde_check"
11011             break
11012         fi
11013     done
11014     AC_MSG_RESULT([$tde_incdir])
11015     if test "x$tde_incdir" = "xno"; then
11016         AC_MSG_ERROR([TDE headers not found.  Please specify the root of
11017 your TDE installation by exporting TDEDIR before running "configure".])
11018     fi
11020     dnl Check for TDE libraries
11021     AC_MSG_CHECKING([for TDE libraries])
11022     tde_libdir="no"
11023     for tde_check in $tde_libdirs; do
11024         if test -r "`ls $tde_check/$tde_test_library 2>/dev/null | head -1`"; then
11025             tde_libdir="$tde_check"
11026             break
11027         fi
11028     done
11029     AC_MSG_RESULT([$tde_libdir])
11030     if test "x$tde_libdir" = "xno"; then
11031         AC_MSG_ERROR([TDE libraries not found.  Please specify the root of
11032 your TDE installation by exporting TDEDIR before running "configure".])
11033     fi
11035     dnl Set the variables
11036     TDE_CFLAGS="-I$tqt_incdir -I$tde_incdir -I/usr/include/tqt -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11037     TDE_LIBS="-L$tde_libdir -L$tqt_libdir -ltdeio -ltdeui -ltdecore -ltqt -ltqt-mt"
11039 AC_SUBST(TDE_CFLAGS)
11040 AC_SUBST(TDE_LIBS)
11041 AC_SUBST(MOC)
11043 dnl ===================================================================
11044 dnl Check whether the Qt3 and KDE3 libraries are available.
11045 dnl ===================================================================
11047 KDE_CFLAGS=""
11048 KDE_LIBS=""
11049 if test "$_os" != "OpenBSD"; then
11050     MOC="moc"
11052 if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE"; then
11053     dnl Search paths for Qt3 and KDE3
11054     if test -z "$supports_multilib"; then
11055         qt_incdirs="$QTINC /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/lib/qt3/include /usr/lib/qt/include /usr/share/qt3/include /usr/local/include/X11/qt3 $x_includes"
11056         qt_libdirs="$QTLIB /usr/local/qt/lib /usr/lib/qt /usr/lib /usr/X11R6/lib/X11/qt /usr/X11R6/lib/qt /usr/lib/qt3/lib /usr/lib/qt/lib /usr/share/qt3/lib /usr/local/lib/qt3 $x_libraries"
11057     else
11058         qt_incdirs="$QTINC /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/lib64/qt3/include /usr/lib64/qt/include /usr/share/qt3/include /usr/lib/qt3/include /usr/lib/qt/include /usr/local/include/X11/qt3 $x_includes"
11059         qt_libdirs="$QTLIB /usr/local/qt/lib64 /usr/lib64/qt /usr/lib64 /usr/X11R6/lib64/X11/qt /usr/X11R6/lib64/qt /usr/lib64/qt3/lib64 /usr/lib64/qt/lib64 /usr/share/qt3/lib64 /usr/local/qt/lib /usr/lib/qt /usr/lib /usr/X11R6/lib/X11/qt /usr/X11R6/lib/qt /usr/lib/qt3/lib /usr/lib/qt/lib /usr/share/qt3/lib /usr/local/lib/qt3 $x_libraries"
11060     fi
11061     if test -n "$QTDIR"; then
11062         qt_incdirs="$QTDIR/include $qt_incdirs"
11063         if test -z "$supports_multilib"; then
11064             qt_libdirs="$QTDIR/lib $qt_libdirs"
11065         else
11066             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
11067         fi
11068     fi
11069     if test -z "$supports_multilib"; then
11070         kde_incdirs="/usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /opt/kde3/include /opt/kde/include $x_includes"
11071         kde_libdirs="/usr/lib/kde/lib /usr/local/kde/lib /usr/kde/lib /usr/lib/kde /usr/lib/kde3 /usr/X11R6/lib /usr/local/lib /opt/kde3/lib /opt/kde/lib /usr/X11R6/kde/lib /usr/lib $x_libraries"
11072     else
11073         kde_incdirs="/usr/lib64/kde/include /usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /opt/kde3/include /opt/kde/include $x_includes"
11074         kde_libdirs="/usr/lib64/kde/lib64 /usr/local/kde/lib64 /usr/kde/lib64 /usr/lib64/kde /usr/lib64/kde3 /usr/X11R6/lib64 /usr/local/lib64 /opt/kde3/lib64 /opt/kde/lib64 /usr/X11R6/kde/lib64 /usr/lib/kde/lib /usr/local/kde/lib /usr/kde/lib /usr/lib/kde /usr/lib/kde3 /usr/lib /usr/X11R6/lib /usr/local/lib /opt/kde3/lib /opt/kde/lib /usr/X11R6/kde/lib /usr/lib64 $x_libraries"
11075     fi
11076     if test -n "$KDEDIR"; then
11077         kde_incdirs="$KDEDIR/include $kde_incdirs"
11078         if test -z "$supports_multilib"; then
11079             kde_libdirs="$KDEDIR/lib $kde_libdirs"
11080         else
11081             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
11082         fi
11083     fi
11085     dnl What to test
11086     qt_test_include="qstyle.h"
11087     kde_test_include="kapp.h"
11089     if test "$_os" != "OpenBSD"; then
11090         qt_test_library="libqt-mt.so"
11091         kde_test_library="libDCOP.so"
11092     else
11093         qt_test_library="libqt-mt.so*"
11094         kde_test_library="libDCOP.so*"
11095     fi
11097     dnl Check for Qt3 headers
11098     AC_MSG_CHECKING([for Qt3 headers])
11099     qt_incdir="no"
11100     for kde_check in $qt_incdirs; do
11101         if test -r "$kde_check/$qt_test_include"; then
11102             qt_incdir="$kde_check"
11103             break
11104         fi
11105     done
11106     AC_MSG_RESULT([$qt_incdir])
11107     if test "x$qt_incdir" = "xno"; then
11108         AC_MSG_ERROR([Qt3 headers not found.  Please specify the root of
11109 your Qt3 installation by exporting QTDIR before running "configure".])
11110     fi
11112     dnl Check for Qt3 libraries
11113     AC_MSG_CHECKING([for Qt3 libraries])
11114     qt_libdir="no"
11115     for qt_check in $qt_libdirs; do
11116         if test -r "`ls $qt_check/$qt_test_library 2>/dev/null | head -1`"; then
11117             qt_libdir="$qt_check"
11118             break
11119         fi
11120     done
11121     AC_MSG_RESULT([$qt_libdir])
11122     if test "x$qt_libdir" = "xno"; then
11123         AC_MSG_ERROR([Qt3 libraries not found.  Please specify the root of
11124 your Qt3 installation by exporting QTDIR before running "configure".])
11125     fi
11127     dnl Check for Meta Object Compiler
11128     AC_PATH_PROG( MOC, moc, no, [`dirname $qt_libdir`/bin:$QTDIR/bin:$PATH] )
11129     if test "$MOC" = "no"; then
11130         AC_MSG_ERROR([Qt3 Meta Object Compiler not found.  Please specify
11131 the root of your Qt3 installation by exporting QTDIR before running "configure".])
11132     fi
11134     dnl Check for KDE3 headers
11135     AC_MSG_CHECKING([for KDE3 headers])
11136     kde_incdir="no"
11137     for kde_check in $kde_incdirs; do
11138         if test -r "$kde_check/$kde_test_include"; then
11139             kde_incdir="$kde_check"
11140             break
11141         fi
11142     done
11143     AC_MSG_RESULT([$kde_incdir])
11144     if test "x$kde_incdir" = "xno"; then
11145         AC_MSG_ERROR([KDE3 headers not found.  Please specify the root of
11146 your KDE3 installation by exporting KDEDIR before running "configure".])
11147     fi
11149     dnl Check for KDE3 libraries
11150     AC_MSG_CHECKING([for KDE3 libraries])
11151     kde_libdir="no"
11152     for kde_check in $kde_libdirs; do
11153         if test -r "`ls $kde_check/$kde_test_library 2>/dev/null | head -1`"; then
11154             kde_libdir="$kde_check"
11155             break
11156         fi
11157     done
11158     AC_MSG_RESULT([$kde_libdir])
11159     if test "x$kde_libdir" = "xno"; then
11160         AC_MSG_ERROR([KDE3 libraries not found.  Please specify the root of
11161 your KDE3 installation by exporting KDEDIR before running "configure".])
11162     fi
11164     dnl Set the variables
11165     KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11166     KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
11167     KDE_CFLAGS=$(printf '%s' "$KDE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11169 AC_SUBST(KDE_CFLAGS)
11170 AC_SUBST(KDE_LIBS)
11171 AC_SUBST(MOC)
11173 dnl ===================================================================
11174 dnl KDE4 Integration
11175 dnl ===================================================================
11177 KDE4_CFLAGS=""
11178 KDE4_LIBS=""
11179 QMAKE4="qmake"
11180 MOC4="moc"
11181 KDE_GLIB_CFLAGS=""
11182 KDE_GLIB_LIBS=""
11183 KDE_HAVE_GLIB=""
11184 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
11185     qt_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
11186     qt_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
11188     kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
11189     kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
11191     if test -n "$supports_multilib"; then
11192         qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
11193         kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
11194     fi
11196     if test -n "$QTDIR"; then
11197         qt_incdirs="$QTDIR/include $qt_incdirs"
11198         if test -z "$supports_multilib"; then
11199             qt_libdirs="$QTDIR/lib $qt_libdirs"
11200         else
11201             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
11202         fi
11203     fi
11204     if test -n "$QT4DIR"; then
11205         qt_incdirs="$QT4DIR/include $qt_incdirs"
11206         if test -z "$supports_multilib"; then
11207             qt_libdirs="$QT4DIR/lib $qt_libdirs"
11208         else
11209             qt_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt_libdirs"
11210         fi
11211     fi
11213     if test -n "$KDEDIR"; then
11214         kde_incdirs="$KDEDIR/include $kde_incdirs"
11215         if test -z "$supports_multilib"; then
11216             kde_libdirs="$KDEDIR/lib $kde_libdirs"
11217         else
11218             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
11219         fi
11220     fi
11221     if test -n "$KDE4DIR"; then
11222         kde_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde_incdirs"
11223         if test -z "$supports_multilib"; then
11224             kde_libdirs="$KDE4DIR/lib $kde_libdirs"
11225         else
11226             kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
11227         fi
11228     fi
11230     qt_test_include="Qt/qobject.h"
11231     qt_test_library="libQtNetwork.so"
11232     kde_test_include="kwindowsystem.h"
11233     kde_test_library="libsolid.so"
11235     AC_MSG_CHECKING([for Qt4 headers])
11236     qt_header_dir="no"
11237     for inc_dir in $qt_incdirs; do
11238         if test -r "$inc_dir/$qt_test_include"; then
11239             qt_header_dir="$inc_dir"
11240             break
11241         fi
11242     done
11244     AC_MSG_RESULT([$qt_header_dir])
11245     if test "x$qt_header_dir" = "xno"; then
11246         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11247     fi
11249     dnl Check for qmake
11250     AC_PATH_PROG( QMAKEQT4, qmake-qt4, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
11251     QMAKE4="$QMAKEQT4"
11252     if test "$QMAKE4" = "no"; then
11253         AC_PATH_PROG( QMAKE4, qmake, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
11254         if test "$QMAKE4" = "no"; then
11255             AC_MSG_ERROR([Qmake not found.  Please specify
11256 the root of your Qt installation by exporting QT4DIR before running "configure".])
11257         fi
11258     fi
11260     qt_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt_libdirs"
11261     AC_MSG_CHECKING([for Qt4 libraries])
11262     qt_lib_dir="no"
11263     for lib_dir in $qt_libdirs; do
11264         if test -r "$lib_dir/$qt_test_library"; then
11265             qt_lib_dir="$lib_dir"
11266             PKG_CONFIG_PATH="$qt_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
11267             break
11268         fi
11269     done
11271     AC_MSG_RESULT([$qt_lib_dir])
11273     if test "x$qt_lib_dir" = "xno"; then
11274         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11275     fi
11277     dnl Check for Meta Object Compiler
11279     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11280     MOC4="$MOCQT4"
11281     if test "$MOC4" = "no"; then
11282         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11283         if test "$MOC4" = "no"; then
11284             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11285 the root of your Qt installation by exporting QT4DIR before running "configure".])
11286         fi
11287     fi
11289     dnl Check for KDE4 headers
11290     AC_MSG_CHECKING([for KDE4 headers])
11291     kde_incdir="no"
11292     for kde_check in $kde_incdirs; do
11293         if test -r "$kde_check/$kde_test_include"; then
11294             kde_incdir="$kde_check"
11295             break
11296         fi
11297     done
11298     AC_MSG_RESULT([$kde_incdir])
11299     if test "x$kde_incdir" = "xno"; then
11300         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11301     fi
11303     dnl Check for KDE4 libraries
11304     AC_MSG_CHECKING([for KDE4 libraries])
11305     kde_libdir="no"
11306     for kde_check in $kde_libdirs; do
11307         if test -r "$kde_check/$kde_test_library"; then
11308             kde_libdir="$kde_check"
11309             break
11310         fi
11311     done
11313     AC_MSG_RESULT([$kde_libdir])
11314     if test "x$kde_libdir" = "xno"; then
11315         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11316     fi
11318     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
11319     KDE4_CFLAGS="-I$kde_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11320     KDE4_LIBS="-L$kde_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt_lib_dir $QT4_LIBS"
11321     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11323     AC_LANG_PUSH([C++])
11324     save_CXXFLAGS=$CXXFLAGS
11325     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11326     AC_MSG_CHECKING([whether KDE is >= 4.2])
11327        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11328 #include <kdeversion.h>
11330 int main(int argc, char **argv) {
11331        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
11332        else return 1;
11334        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11335     CXXFLAGS=$save_CXXFLAGS
11336     AC_LANG_POP([C++])
11338     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11339     # Sets also KDE_GLIB_CFLAGS/KDE_GLIB_LIBS if successful.
11340     PKG_CHECK_MODULES(KDE_GLIB,[glib-2.0 >= 2.4],
11341         [
11342             KDE_HAVE_GLIB=1
11343             AC_DEFINE(KDE_HAVE_GLIB,1)
11344             KDE_GLIB_CFLAGS=$(printf '%s' "$KDE_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11346             qt4_fix_warning=
11348             AC_LANG_PUSH([C++])
11349             save_CXXFLAGS=$CXXFLAGS
11350             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11351             save_LIBS=$LIBS
11352             LIBS="$LIBS $KDE4_LIBS"
11353             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
11355             # Prepare meta object data
11356             TSTBASE="tst_exclude_socket_notifiers"
11357             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11358             ln -fs "${TSTMOC}.hxx"
11359             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11361             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11362 #include "tst_exclude_socket_notifiers.moc"
11364 int main(int argc, char *argv[])
11366     QCoreApplication app(argc, argv);
11367     exit(tst_processEventsExcludeSocket());
11368     return 0;
11370             ]])],[
11371                 AC_MSG_RESULT([yes])
11372             ],[
11373                 AC_MSG_RESULT([no])
11374                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11375                 if test -z "$qt4_fix_warning"; then
11376                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11377                 fi
11378                 qt4_fix_warning=1
11379                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-37380 (needed)"
11380             ])
11382             # Remove meta object data
11383             rm -f "${TSTBASE}."*
11385             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
11387             # Prepare meta object data
11388             TSTBASE="tst_exclude_posted_events"
11389             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11390             ln -fs "${TSTMOC}.hxx"
11391             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11393             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11394 #include "tst_exclude_posted_events.moc"
11396 int main(int argc, char *argv[])
11398     QCoreApplication app(argc, argv);
11399     exit(tst_excludePostedEvents());
11400     return 0;
11402             ]])],[
11403                 AC_MSG_RESULT([yes])
11404             ],[
11405                 AC_MSG_RESULT([no])
11406                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11407                 if test -z "$qt4_fix_warning"; then
11408                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11409                 fi
11410                 qt4_fix_warning=1
11411                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-34614 (needed)"
11412             ])
11414             # Remove meta object data
11415             rm -f "${TSTBASE}."*
11417             if test -n "$qt4_fix_warning"; then
11418                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-38585 (recommended)"
11419             fi
11421             LIBS=$save_LIBS
11422             CXXFLAGS=$save_CXXFLAGS
11423             AC_LANG_POP([C++])
11424         ],
11425         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11427 AC_SUBST(KDE4_CFLAGS)
11428 AC_SUBST(KDE4_LIBS)
11429 AC_SUBST(MOC4)
11430 AC_SUBST(KDE_GLIB_CFLAGS)
11431 AC_SUBST(KDE_GLIB_LIBS)
11432 AC_SUBST(KDE_HAVE_GLIB)
11434 dnl ===================================================================
11435 dnl Test for the enabling the lockdown pieces
11436 dnl ===================================================================
11437 AC_MSG_CHECKING([whether to enable the lockdown pieces])
11438 ENABLE_LOCKDOWN=
11439 if test -n "$enable_lockdown" -a "$enable_lockdown" != "no"; then
11440     ENABLE_LOCKDOWN=TRUE
11441     AC_MSG_RESULT([yes])
11442 else
11443     AC_MSG_RESULT([no])
11445 AC_SUBST(ENABLE_LOCKDOWN)
11447 dnl ===================================================================
11448 dnl Test whether to include Evolution 2 support
11449 dnl ===================================================================
11450 AC_MSG_CHECKING([whether to enable evolution 2 support])
11451 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11452     AC_MSG_RESULT([yes])
11453     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11454     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11455     ENABLE_EVOAB2="TRUE"
11456 else
11457     ENABLE_EVOAB2=""
11458     AC_MSG_RESULT([no])
11460 AC_SUBST(ENABLE_EVOAB2)
11461 AC_SUBST(GOBJECT_CFLAGS)
11462 AC_SUBST(GOBJECT_LIBS)
11464 dnl ===================================================================
11465 dnl Test whether to include TDE AB support
11466 dnl ===================================================================
11467 AC_MSG_CHECKING([whether to enable TDE address book support])
11468 if test "$enable_tdeab" = "yes" -a "$enable_tde" = "yes"; then
11469     AC_MSG_RESULT([yes])
11470     AC_LANG_PUSH([C++])
11471     save_CXXFLAGS=$CXXFLAGS
11472     CXXFLAGS="$CXXFLAGS $TDE_CFLAGS"
11473     AC_MSG_CHECKING([whether TDE is at least R14.0])
11474        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11475 #include <tdeversion.h>
11477 int main(int argc, char **argv) {
11478        if (TDE_VERSION_MAJOR >= 14) return 0;
11479        else return 1;
11481        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([TDE version too old or too recent, please use another version of TDE or disable TDE address book support])],[])
11482     CXXFLAGS=$save_CXXFLAGS
11483     AC_LANG_POP([C++])
11484     ENABLE_TDEAB=TRUE
11485 else
11486     AC_MSG_RESULT([no])
11487     ENABLE_TDEAB=
11489 AC_SUBST(ENABLE_TDEAB)
11491 dnl ===================================================================
11492 dnl Test whether to include KDE AB support
11493 dnl ===================================================================
11494 AC_MSG_CHECKING([whether to enable KDE address book support])
11495 if test "$enable_kdeab" = "yes" -a "$enable_kde" = "yes"; then
11496     AC_MSG_RESULT([yes])
11497     AC_LANG_PUSH([C++])
11498     save_CXXFLAGS=$CXXFLAGS
11499     CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
11500     AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
11501        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11502 #include <kdeversion.h>
11504 int main(int argc, char **argv) {
11505        if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
11506        else return 1;
11508        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old or too recent, please use another version of KDE or disable KDE address book support])],[])
11509     CXXFLAGS=$save_CXXFLAGS
11510     AC_LANG_POP([C++])
11511     ENABLE_KAB=TRUE
11512 else
11513     AC_MSG_RESULT([no])
11514     ENABLE_KAB=
11516 AC_SUBST(ENABLE_KAB)
11518 dnl ===================================================================
11519 dnl Test which themes to include
11520 dnl ===================================================================
11521 AC_MSG_CHECKING([which themes to include])
11522 # if none given use default subset of available themes
11523 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11524     with_theme="crystal default hicontrast oxygen tango sifr"
11525     test -z "$ENABLE_RELEASE_BUILD" && with_theme="$with_theme tango_testing"
11528 WITH_THEMES=""
11529 if test "x$with_theme" != "xno"; then
11530     for theme in $with_theme; do
11531         case $theme in
11532         crystal|default|galaxy|hicontrast|human|industrial|oxygen|sifr|tango|tango_testing) : ;;
11533         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11534         esac
11535         WITH_THEMES="$WITH_THEMES $theme"
11536     done
11538 AC_MSG_RESULT([$WITH_THEMES])
11539 AC_SUBST([WITH_THEMES])
11541 dnl ===================================================================
11542 dnl Test whether to integrate helppacks into the product's installer
11543 dnl ===================================================================
11544 AC_MSG_CHECKING([for helppack integration])
11545 if test "$with_helppack_integration" = "no"; then
11546     WITH_HELPPACK_INTEGRATION=
11547     AC_MSG_RESULT([no integration])
11548 else
11549     WITH_HELPPACK_INTEGRATION=TRUE
11550     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11551     AC_MSG_RESULT([integration])
11553 AC_SUBST(WITH_HELPPACK_INTEGRATION)
11555 ###############################################################################
11556 # Extensions checking
11557 ###############################################################################
11558 AC_MSG_CHECKING([for extensions integration])
11559 if test "x$enable_extension_integration" != "xno"; then
11560     WITH_EXTENSION_INTEGRATION=TRUE
11561     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11562     AC_MSG_RESULT([yes, use integration])
11563 else
11564     WITH_EXTENSION_INTEGRATION=
11565     AC_MSG_RESULT([no, do not integrate])
11567 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11569 dnl Should any extra extensions be included?
11570 dnl There are standalone tests for each of these below.
11571 WITH_EXTRA_EXTENSIONS=
11572 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11574 libo_CHECK_EXTENSION([Watch Window],[WATCH_WINDOW],[watch_window],[watch-window],[23bd75552206dfcd8fd4e29137dcac84-WatchWindow_1.2.0.0.oxt])
11575 libo_CHECK_EXTENSION([SmART Gallery (Diagram)],[DIAGRAM],[diagram],[diagram],[8d74685d41f8bffe8c3e71fe8deac09d-SmART_0.9.5.oxt])
11576 libo_CHECK_EXTENSION([Validator],[VALIDATOR],[validator],[validator],[bbdd5639ada63e3130761daaecae1a10-Validator_1.1.0.0.oxt])
11577 libo_CHECK_EXTENSION([Barcode],[BARCODE],[barcode],[barcode],[3ed18025a766f1e955707b969c8113a5-Barcode_1.3.5.0.oxt])
11578 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11579 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11580 libo_CHECK_EXTENSION([Hungarian Cross-reference Toolbar],[HUNART],[hunart],[hunart],[b632bdd25649cc4067bcb410bae23d2b-hunart_0.3.oxt])
11581 libo_CHECK_EXTENSION([Typography Toolbar],[TYPO],[typo],[typo],[9d60b6cfa3ef1926848710bbcd11115b-typo_0.4.2.oxt])
11582 libo_CHECK_EXTENSION([Google Docs],[GOOGLE_DOCS],[google_docs],[google-docs],[27211596cf0ad97cab7321239406fde0-gdocs_3.0.1_modified.oxt])
11583 if test "x$with_java" != "xno"; then
11584     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11585     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11588 dnl ===================================================================
11589 dnl Test whether to include Sun Professional Template Pack
11590 dnl ===================================================================
11591 AC_MSG_CHECKING([for Sun Professional Template Pack integration (only supported languages displayed)])
11592 if test "$with_sun_templates" = "" -o "$with_sun_templates" = "no"; then
11593     AC_MSG_RESULT([no integration])
11594 else
11595     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_SUN_TEMPLATE_PACK"
11596     sun_supported_langs="en-US de it fr es hu"
11597     if test "$with_sun_templates" = "yes"; then
11598         wanted_sun_templates="$sun_supported_langs"
11599     else
11600         # check whether the langs are supported by Sun
11601         wanted_sun_templates=
11602         for lang in $with_sun_templates; do
11603             if test -n "`echo $sun_supported_langs | grep "$lang"`"; then
11604                 wanted_sun_templates="$wanted_sun_templates $lang"
11605             fi
11606         done
11607     fi
11608     SUNTEMPLATES_LANG=
11609     SUNTEMPLATES_DE_PACK=
11610     SUNTEMPLATES_EN_US_PACK=
11611     SUNTEMPLATES_ES_PACK=
11612     SUNTEMPLATES_FR_PACK=
11613     SUNTEMPLATES_HU_PACK=
11614     SUNTEMPLATES_IT_PACK=
11615     # check whether the langs are requested at all
11616     for lang in $wanted_sun_templates; do
11617     if test "$with_lang" = "ALL" -o -n "`echo $with_lang | grep "$lang"`"; then
11618         SUNTEMPLATES_LANG="$SUNTEMPLATES_LANG $lang"
11619         case $lang in
11620         "de") SUNTEMPLATES_DE_PACK="53ca5e56ccd4cab3693ad32c6bd13343-Sun-ODF-Template-Pack-de_1.0.0.oxt";;
11621         "en-US") SUNTEMPLATES_EN_US_PACK="472ffb92d82cf502be039203c606643d-Sun-ODF-Template-Pack-en-US_1.0.0.oxt";;
11622         "es") SUNTEMPLATES_ES_PACK="4ad003e7bbda5715f5f38fde1f707af2-Sun-ODF-Template-Pack-es_1.0.0.oxt";;
11623         "fr") SUNTEMPLATES_FR_PACK="a53080dc876edcddb26eb4c3c7537469-Sun-ODF-Template-Pack-fr_1.0.0.oxt";;
11624         "hu") SUNTEMPLATES_HU_PACK="09ec2dac030e1dcd5ef7fa1692691dc0-Sun-ODF-Template-Pack-hu_1.0.0.oxt";;
11625         "it") SUNTEMPLATES_IT_PACK="b33775feda3bcf823cad7ac361fd49a6-Sun-ODF-Template-Pack-it_1.0.0.oxt";;
11626         esac
11627     fi
11628     done
11629     WITH_EXTRA_EXTENSIONS=TRUE
11630     AC_MSG_RESULT([$SUNTEMPLATES_LANG])
11632 AC_SUBST(SUNTEMPLATES_DE_PACK)
11633 AC_SUBST(SUNTEMPLATES_EN_US_PACK)
11634 AC_SUBST(SUNTEMPLATES_ES_PACK)
11635 AC_SUBST(SUNTEMPLATES_FR_PACK)
11636 AC_SUBST(SUNTEMPLATES_HU_PACK)
11637 AC_SUBST(SUNTEMPLATES_IT_PACK)
11639 TEST_FONTS_MISSING=0
11641 # $1  = font family
11642 # $2+ = accepted font mappings
11643 test_font_map()
11645     FONT="$1" ; shift
11646     AC_MSG_CHECKING([font mapping for '$FONT'])
11647     FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
11648     FONTFILE_LOWER="$(echo $FONTFILE | $AWK '{print tolower($0)}')"
11650     TESTEXPR="'${FONTFILE_LOWER}' = '$(echo $FONT | $AWK '{print tolower($0)}').ttf'"
11651     while true ; do
11652         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
11653         test -n "$MAPPING" || break
11654         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
11655     done
11656     if test $TESTEXPR
11657     then
11658         AC_MSG_RESULT([ok])
11659     else
11660         AC_MSG_RESULT([unknown ($FONTFILE)])
11661         TEST_FONTS_MISSING=1
11662     fi
11665 dnl ===================================================================
11666 dnl Test whether to include fonts
11667 dnl ===================================================================
11668 AC_MSG_CHECKING([whether to include third-party fonts])
11669 if test "$with_fonts" != "no"; then
11670     AC_MSG_RESULT([yes])
11671     WITH_FONTS=TRUE
11672     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11673 else
11674     AC_MSG_RESULT([no])
11675     WITH_FONTS=
11676     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11677     if test "$test_fontconfig" = "yes"; then
11678         AC_PATH_PROG([FCMATCH], [fc-match])
11679         if test -z "$FCMATCH"; then
11680             AC_MSG_WARN([Unable to query installed fonts - unit tests disabled.])
11681             TEST_FONTS_MISSING=1
11682         else
11683             test_font_map 'Calibri' 'Carlito'
11684             if test ${TEST_FONTS_MISSING} -eq 1
11685             then
11686                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
11687             fi
11688         fi
11689     else
11690         TEST_FONTS_MISSING=0
11691     fi
11693 AC_SUBST(WITH_FONTS)
11694 AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
11696 dnl ===================================================================
11697 dnl Test whether to include ppds
11698 dnl ===================================================================
11699 AC_MSG_CHECKING([whether to include PPDs])
11700 if test "$with_ppds" != "no"; then
11701     AC_MSG_RESULT([yes])
11702     WITHOUT_PPDS=
11703 else
11704     AC_MSG_RESULT([no])
11705     WITHOUT_PPDS=TRUE
11706     SCPDEFS="$SCPDEFS -DWITHOUT_PPDS"
11708 AC_SUBST(WITHOUT_PPDS)
11710 dnl ===================================================================
11711 dnl Test whether to include extra galleries
11712 dnl ===================================================================
11713 AC_MSG_CHECKING([whether to include extra galleries])
11714 if test "$enable_extra_gallery" = "" -o "$enable_extra_gallery" = "no"; then
11715     AC_MSG_RESULT([no])
11716     WITH_EXTRA_GALLERY=
11717     OOOP_GALLERY_PACK=""
11718 else
11719     AC_MSG_RESULT([yes])
11720     WITH_EXTRA_GALLERY=TRUE
11721     BUILD_TYPE="$BUILD_TYPE EXTRA_GALLERY"
11722     SCPDEFS="$SCPDEFS -DWITH_EXTRA_GALLERY"
11723     OOOP_GALLERY_PACK="af9314c5972d95a5d6da23ffad818f68-OOOP-gallery-pack-2.8.0.0.zip"
11725 AC_SUBST(WITH_EXTRA_GALLERY)
11726 AC_SUBST(OOOP_GALLERY_PACK)
11728 dnl ===================================================================
11729 dnl Test whether to include extra templates
11730 dnl ===================================================================
11731 AC_MSG_CHECKING([whether to include extra templates])
11732 if test "$enable_extra_template" = "" -o "$enable_extra_template" = "no"; then
11733     AC_MSG_RESULT([no])
11734     WITH_EXTRA_TEMPLATE=
11735     OOOP_TEMPLATES_PACK=""
11736 else
11737     AC_MSG_RESULT([yes])
11738     WITH_EXTRA_TEMPLATE=TRUE
11739     BUILD_TYPE="$BUILD_TYPE EXTRA_TEMPLATE"
11740     SCPDEFS="$SCPDEFS -DWITH_EXTRA_TEMPLATE"
11741     OOOP_TEMPLATES_PACK="1be202fbbbc13f10592a98f70a4a87fb-OOOP-templates-pack-2.9.0.0.zip"
11743 AC_SUBST(WITH_EXTRA_TEMPLATE)
11744 AC_SUBST(OOOP_TEMPLATES_PACK)
11746 dnl ===================================================================
11747 dnl Test whether to include extra samples
11748 dnl ===================================================================
11749 AC_MSG_CHECKING([whether to include extra samples])
11750 if test "$enable_extra_sample" = "" -o "$enable_extra_sample" = "no"; then
11751     AC_MSG_RESULT([no])
11752     WITH_EXTRA_SAMPLE=
11753     OOOP_SAMPLES_PACK=""
11754 else
11755     AC_MSG_RESULT([yes])
11756     WITH_EXTRA_SAMPLE=TRUE
11757     BUILD_TYPE="$BUILD_TYPE EXTRA_SAMPLE"
11758     SCPDEFS="$SCPDEFS -DWITH_EXTRA_SAMPLE"
11759     OOOP_SAMPLES_PACK="a6bccacf44914969e6e7b2f8faf4132c-OOOP-samples-pack-2.7.0.0.zip"
11761 AC_SUBST(WITH_EXTRA_SAMPLE)
11762 AC_SUBST(OOOP_SAMPLES_PACK)
11764 dnl ===================================================================
11765 dnl Test whether to include extra fonts
11766 dnl ===================================================================
11767 AC_MSG_CHECKING([whether to include extra fonts])
11768 if test "$enable_extra_font" = "" -o "$enable_extra_font" = "no"; then
11769     AC_MSG_RESULT([no])
11770     WITH_EXTRA_FONT=
11771     OOOP_FONTS_PACK=""
11772 else
11773     AC_MSG_RESULT([yes])
11774     WITH_EXTRA_FONT=TRUE
11775     BUILD_TYPE="$BUILD_TYPE EXTRA_FONT"
11776     SCPDEFS="$SCPDEFS -DWITH_EXTRA_FONT"
11777     OOOP_FONTS_PACK="a10aa597411643326e27d7fc128af12d-OOOP-fonts-pack-2.9.0.0.zip"
11779 AC_SUBST(WITH_EXTRA_FONT)
11780 AC_SUBST(OOOP_FONTS_PACK)
11782 dnl ===================================================================
11783 dnl Test whether to enable online update service
11784 dnl ===================================================================
11785 AC_MSG_CHECKING([whether to enable online update])
11786 ENABLE_ONLINE_UPDATE=
11787 if test "$enable_online_update" = ""; then
11788     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11789         AC_MSG_RESULT([yes])
11790         ENABLE_ONLINE_UPDATE="TRUE"
11791     else
11792         AC_MSG_RESULT([no])
11793     fi
11794 else
11795     if test "$enable_online_update" = "yes"; then
11796         AC_MSG_RESULT([yes])
11797         ENABLE_ONLINE_UPDATE="TRUE"
11798     else
11799         AC_MSG_RESULT([no])
11800     fi
11802 AC_SUBST(ENABLE_ONLINE_UPDATE)
11804 dnl ===================================================================
11805 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11806 dnl ===================================================================
11807 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11808 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11809     AC_MSG_RESULT([no])
11810     ENABLE_SILENT_MSI=
11811 else
11812     AC_MSG_RESULT([yes])
11813     ENABLE_SILENT_MSI=TRUE
11814     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11816 AC_SUBST(ENABLE_SILENT_MSI)
11818 AC_MSG_CHECKING([whether and how to use Xinerama])
11819 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11820     if test "$x_libraries" = "default_x_libraries"; then
11821         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11822         if test "x$XINERAMALIB" = x; then
11823            XINERAMALIB="/usr/lib"
11824         fi
11825     else
11826         XINERAMALIB="$x_libraries"
11827     fi
11828     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11829         # we have both versions, let the user decide but use the dynamic one
11830         # per default
11831         USE_XINERAMA=TRUE
11832         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11833             XINERAMA_LINK=dynamic
11834         else
11835             XINERAMA_LINK=static
11836         fi
11837     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11838         # we have only the dynamic version
11839         USE_XINERAMA=TRUE
11840         XINERAMA_LINK=dynamic
11841     elif test -e "$XINERAMALIB/libXinerama.a"; then
11842         # static version
11843         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11844             USE_XINERAMA=TRUE
11845             XINERAMA_LINK=static
11846         else
11847             USE_XINERAMA=
11848             XINERAMA_LINK=none
11849         fi
11850     else
11851         # no Xinerama
11852         USE_XINERAMA=
11853         XINERAMA_LINK=none
11854     fi
11855     if test "$USE_XINERAMA" = "TRUE"; then
11856         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11857         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11858             [AC_MSG_ERROR(Xinerama header not found.)], [])
11859         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11860         if test "x$XEXTLIB" = x; then
11861            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11862         fi
11863         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11864         if test "$_os" = "FreeBSD"; then
11865             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11866         fi
11867         if test "$_os" = "Linux"; then
11868             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11869         fi
11870         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11871             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11872     else
11873         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11874     fi
11875 else
11876     USE_XINERAMA=
11877     XINERAMA_LINK=none
11878     AC_MSG_RESULT([no])
11880 AC_SUBST(USE_XINERAMA)
11881 AC_SUBST(XINERAMA_LINK)
11883 dnl ===================================================================
11884 dnl Test whether to build cairo or rely on the system version
11885 dnl ===================================================================
11887 if test "$GUIBASE" = "unx"; then
11888     # Used in vcl/Library_vclplug_gen.mk
11889     test_cairo=yes
11892 if test "$test_cairo" = "yes"; then
11893     AC_MSG_CHECKING([whether to use the system cairo])
11895     : ${with_system_cairo:=$with_system_libs}
11896     if test "$with_system_cairo" = "yes"; then
11897         SYSTEM_CAIRO=TRUE
11898         AC_MSG_RESULT([yes])
11900         PKG_CHECK_MODULES( CAIRO, cairo >= 1.0.2 )
11901         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11903         if test "$test_xrender" = "yes"; then
11904             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11905             AC_LANG_PUSH([C])
11906             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11907 #ifdef PictStandardA8
11908 #else
11909       return fail;
11910 #endif
11911 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11913             AC_LANG_POP([C])
11914         fi
11915         libo_MINGW_CHECK_DLL([libcairo])
11916         libo_MINGW_TRY_DLL([libfontconfig])
11917         libo_MINGW_TRY_DLL([libfreetype])
11918         libo_MINGW_TRY_DLL([libpixman])
11919         libo_MINGW_TRY_DLL([libpng15])
11920     else
11921         SYSTEM_CAIRO=
11922         AC_MSG_RESULT([no])
11924         BUILD_TYPE="$BUILD_TYPE CAIRO"
11925         SCPDEFS="$SCPDEFS -DNEED_CAIRO"
11926     fi
11929 AC_SUBST(SYSTEM_CAIRO)
11930 AC_SUBST(CAIRO_CFLAGS)
11931 AC_SUBST(CAIRO_LIBS)
11933 dnl ===================================================================
11934 dnl Test whether to use avahi
11935 dnl ===================================================================
11936 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11937     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11938                       [ENABLE_AVAHI="TRUE"])
11939     AC_DEFINE(HAVE_FEATURE_AVAHI)
11940     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11943 AC_SUBST(ENABLE_AVAHI)
11944 AC_SUBST(AVAHI_CFLAGS)
11945 AC_SUBST(AVAHI_LIBS)
11947 dnl ===================================================================
11948 dnl Test whether to use liblangtag
11949 dnl ===================================================================
11950 ENABLE_LIBLANGTAG=
11951 SYSTEM_LIBLANGTAG=
11952 AC_MSG_CHECKING([whether to use liblangtag])
11953 if test "$enable_liblangtag" = "yes" -o \( "$enable_liblangtag" = "" -a $_os != Android -a $_os != iOS \); then
11954     ENABLE_LIBLANGTAG=TRUE
11955     AC_MSG_RESULT([yes])
11956     AC_MSG_CHECKING([whether to use system liblangtag])
11957     if test "$with_system_liblangtag" = yes; then
11958         SYSTEM_LIBLANGTAG=TRUE
11959         AC_MSG_RESULT([yes])
11960         PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11961         LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11962         libo_MINGW_CHECK_DLL([liblangtag])
11963     else
11964         SYSTEM_LIBLANGTAG=
11965         AC_MSG_RESULT([no])
11966         BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11967         if test "$COM" = "MSC"; then
11968             LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs/liblangtag.lib"
11969         else
11970             LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs -llangtag"
11971         fi
11972     fi
11973 else
11974     AC_MSG_RESULT([no])
11976 AC_SUBST(ENABLE_LIBLANGTAG)
11977 AC_SUBST(SYSTEM_LIBLANGTAG)
11978 AC_SUBST(LIBLANGTAG_CFLAGS)
11979 AC_SUBST(LIBLANGTAG_LIBS)
11981 dnl ===================================================================
11982 dnl Test whether to build libpng or rely on the system version
11983 dnl ===================================================================
11985 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/png"],["-L${WORKDIR}/LinkTarget/StaticLibrary -lpng"])
11987 dnl ===================================================================
11988 dnl Check for runtime JVM search path
11989 dnl ===================================================================
11990 if test "$ENABLE_JAVA" != ""; then
11991     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11992     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11993         AC_MSG_RESULT([yes])
11994         if ! test -d "$with_jvm_path"; then
11995             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11996         fi
11997         if ! test -d "$with_jvm_path"jvm; then
11998             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11999         fi
12000         JVM_ONE_PATH_CHECK="$with_jvm_path"
12001         AC_SUBST(JVM_ONE_PATH_CHECK)
12002     else
12003         AC_MSG_RESULT([no])
12004     fi
12007 dnl ===================================================================
12008 dnl Test for the presence of Ant and that it works
12009 dnl ===================================================================
12011 if test "$ENABLE_JAVA" != ""; then
12012     ANT_HOME=; export ANT_HOME
12013     WITH_ANT_HOME=; export WITH_ANT_HOME
12014     if test -z "$with_ant_home"; then
12015         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
12016     else
12017         if test "$_os" = "WINNT"; then
12018             with_ant_home=`cygpath -u "$with_ant_home"`
12019         fi
12020         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
12021         WITH_ANT_HOME=$with_ant_home
12022         ANT_HOME=$with_ant_home
12023     fi
12025     if test -z "$ANT"; then
12026         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
12027     else
12028         # resolve relative or absolute symlink
12029         while test -h "$ANT"; do
12030             a_cwd=`pwd`
12031             a_basename=`basename "$ANT"`
12032             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
12033             cd "`dirname "$ANT"`"
12034             cd "`dirname "$a_script"`"
12035             ANT="`pwd`"/"`basename "$a_script"`"
12036             cd "$a_cwd"
12037         done
12039         AC_MSG_CHECKING([if $ANT works])
12040         cat > conftest.java << EOF
12041         public class conftest {
12042             int testmethod(int a, int b) {
12043                     return a + b;
12044             }
12045         }
12048         cat > conftest.xml << EOF
12049         <project name="conftest" default="conftest">
12050         <target name="conftest">
12051             <javac srcdir="." includes="conftest.java">
12052             </javac>
12053         </target>
12054         </project>
12057         oldJAVA_HOME=$JAVA_HOME
12058         if test "$JAVACISGCJ" = "yes"; then
12059             JAVA_HOME=; export JAVA_HOME
12060             ant_gcj="-Dbuild.compiler=gcj"
12061         fi
12062         AC_TRY_COMMAND("$ANT" $ant_gcj -buildfile conftest.xml 1>&2)
12063         if test $? = 0 -a -f ./conftest.class; then
12064             AC_MSG_RESULT([Ant works])
12065             if test -z "$WITH_ANT_HOME"; then
12066                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
12067                 if test -z "$ANT_HOME"; then
12068                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
12069                 fi
12070             else
12071                 ANT_HOME="$WITH_ANT_HOME"
12072             fi
12073         else
12074             echo "configure: Ant test failed" >&5
12075             cat conftest.java >&5
12076             cat conftest.xml >&5
12077             AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
12078             ANT_HOME=""
12079             add_warning "Ant does not work - Some Java projects will not build!"
12080         fi
12081         JAVA_HOME=$oldJAVA_HOME
12082         rm -f conftest* core core.* *.core
12083     fi
12084     if test -z "$ANT_HOME"; then
12085         ANT_HOME="NO_ANT_HOME"
12086     else
12087         PathFormat "$ANT_HOME"
12088         ANT_HOME="$formatted_path"
12089         PathFormat "$ANT"
12090         ANT="$ANT"
12091     fi
12092     AC_SUBST(ANT_HOME)
12093     AC_SUBST(ANT)
12095     dnl Checking for ant.jar
12096     if test "$ANT_HOME" != "NO_ANT_HOME"; then
12097         AC_MSG_CHECKING([Ant lib directory])
12098         if test -f $ANT_HOME/lib/ant.jar; then
12099             ANT_LIB="$ANT_HOME/lib"
12100         else
12101             if test -f $ANT_HOME/ant.jar; then
12102                 ANT_LIB="$ANT_HOME"
12103             else
12104                 if test -f /usr/share/java/ant.jar; then
12105                     ANT_LIB=/usr/share/java
12106                 else
12107                     if test -f /usr/share/ant-core/lib/ant.jar; then
12108                         ANT_LIB=/usr/share/ant-core/lib
12109                     else
12110                         if test -f $ANT_HOME/lib/ant/ant.jar; then
12111                             ANT_LIB="$ANT_HOME/lib/ant"
12112                         else
12113                             if test -f /usr/share/lib/ant/ant.jar; then
12114                                 ANT_LIB=/usr/share/lib/ant
12115                             else
12116                                 AC_MSG_ERROR([Ant libraries not found!])
12117                             fi
12118                         fi
12119                     fi
12120                 fi
12121             fi
12122         fi
12123         PathFormat "$ANT_LIB"
12124         ANT_LIB="$formatted_path"
12125         AC_MSG_RESULT([Ant lib directory found.])
12126     fi
12127     AC_SUBST(ANT_LIB)
12129     ant_minver=1.6.0
12130     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12132     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12133     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
12134     ant_version_major=`echo $ant_version | cut -d. -f1`
12135     ant_version_minor=`echo $ant_version | cut -d. -f2`
12136     echo "configure: ant_version $ant_version " >&5
12137     echo "configure: ant_version_major $ant_version_major " >&5
12138     echo "configure: ant_version_minor $ant_version_minor " >&5
12139     if test "$ant_version_major" -ge "2"; then
12140         AC_MSG_RESULT([yes, $ant_version])
12141     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12142         AC_MSG_RESULT([yes, $ant_version])
12143     else
12144         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12145     fi
12147     if test "$ENABLE_MEDIAWIKI" = "TRUE"; then
12148         AC_MSG_CHECKING([whether Ant supports mapper type="regexp"])
12149         rm -rf confdir
12150         mkdir confdir
12151         cat > conftest.java << EOF
12152             public class conftest {
12153                 int testmethod(int a, int b) {
12154                     return a + b;
12155                 }
12156             }
12159         cat > conftest.xml << EOF
12160             <project name="conftest" default="conftest">
12161             <target name="conftest" depends="copytest">
12162                 <javac srcdir="." includes="conftest.java">
12163                 </javac>
12164             </target>
12165             <target name="copytest">
12166                  <copy todir="confdir">
12167                  <fileset dir="confdir" includes="**/*.abc" casesensitive="yes"/>
12168                  <filterset/>
12169                  <mapper type="regexp" from="^(.*[/\\])foo([/\\].*)" to="\1baa\2"/>
12170                  </copy>
12171             </target>
12172             </project>
12175         if test "$JAVACISGCJ" = "yes"; then
12176             JAVA_HOME=; export JAVA_HOME
12177             ant_gcj="-Dbuild.compiler=gcj"
12178         fi
12179         AC_TRY_COMMAND("$ANT" $ant_gcj -buildfile conftest.xml 1>&2)
12180         if test $? = 0 -a -f ./conftest.class; then
12181             AC_MSG_RESULT([yes])
12182             rm -rf confdir
12183         else
12184             echo "configure: Ant test failed" >&5
12185             cat conftest.java >&5
12186             cat conftest.xml >&5
12187             rm -rf confdir
12188             AC_MSG_ERROR([no. Did you install ant-apache-regexp?])
12189         fi
12190     fi
12191     rm -f conftest* core core.* *.core
12194 OOO_JUNIT_JAR=
12195 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12196     AC_MSG_CHECKING([for JUnit 4])
12197     if test "$with_junit" = "yes"; then
12198         if test -e /usr/share/java/junit4.jar; then
12199             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12200         else
12201            if test -e /usr/share/lib/java/junit.jar; then
12202               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12203            else
12204               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12205            fi
12206         fi
12207     else
12208         OOO_JUNIT_JAR=$with_junit
12209     fi
12210     if test "$_os" = "WINNT"; then
12211         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12212     fi
12213     printf 'import org.junit.Before; import org.hamcrest.BaseDescription;' \
12214         > conftest.java
12215     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12216         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12217     else
12218         AC_MSG_ERROR(
12219 [cannot find JUnit 4 jar, or JUnit 4 jar does not provide Hamcrest; please
12220 install one in the default location (/usr/share/java), specify its pathname via
12221 --with-junit=..., or disable it via --without-junit])
12222     fi
12223     rm -f conftestj.class conftestj.java
12224     if test $OOO_JUNIT_JAR != ""; then
12225     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12226     fi
12228 AC_SUBST(OOO_JUNIT_JAR)
12231 AC_SUBST(SCPDEFS)
12234 # check for wget and curl
12236 WGET=
12237 CURL=
12239 if test "$enable_fetch_external" != "no"; then
12241 CURL=`which curl 2>/dev/null`
12243 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12244     eval "$i --version" > /dev/null 2>&1
12245     ret=$?
12246     if test $ret -eq 0; then
12247         WGET=$i
12248         break
12249     fi
12250 done
12252 if test -z "$WGET" -a -z "$CURL"; then
12253     AC_MSG_ERROR([neither wget nor curl found!])
12258 AC_SUBST(WGET)
12259 AC_SUBST(CURL)
12262 # check for md5sum
12264 MD5SUM=
12266 for i in md5 md5sum /usr/local/bin/md5sum gmd5sum /usr/sfw/bin/md5sum /opt/sfw/bin/gmd5sum /opt/local/bin/md5sum; do
12267     if test "$i" = "md5"; then
12268         eval "$i -x" > /dev/null 2>&1
12269     else
12270         eval "$i --version" > /dev/null 2>&1
12271     fi
12272     ret=$?
12273     if test $ret -eq 0; then
12274         MD5SUM=$i
12275         break
12276     fi
12277 done
12279 if test "$MD5SUM" = "md5"; then
12280     if md5 -r < /dev/null > /dev/null 2>/dev/null; then
12281         MD5SUM="$MD5SUM -r"
12282     elif md5 -n < /dev/null > /dev/null 2>/dev/null; then
12283         MD5SUM="$MD5SUM -n"
12284     fi
12287 if test -z "$MD5SUM"; then
12288     AC_MSG_ERROR([no md5sum: found!])
12291 AC_SUBST(MD5SUM)
12293 dnl ===================================================================
12294 dnl Dealing with l10n options
12295 dnl ===================================================================
12296 AC_MSG_CHECKING([which languages to be built])
12297 # get list of all languages
12298 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12299 # the sed command does the following:
12300 #   + if a line ends with a backslash, append the next line to it
12301 #   + adds " on the beginning of the value (after =)
12302 #   + adds " at the end of the value
12303 #   + removes en-US; we want to put it on the beginning
12304 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12305 [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)]
12306 ALL_LANGS="en-US $completelangiso"
12307 # check the configured localizations
12308 WITH_LANG="$with_lang"
12309 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12310     AC_MSG_RESULT([en-US])
12311 else
12312     AC_MSG_RESULT([$WITH_LANG])
12313     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12315 # check that the list is valid
12316 for lang in $WITH_LANG; do
12317     test "$lang" = "ALL" && continue
12318     # need to check for the exact string, so add space before and after the list of all languages
12319     for vl in $ALL_LANGS; do
12320         if test "$vl" = "$lang"; then
12321            break
12322         fi
12323     done
12324     if test "$vl" != "$lang"; then
12325         # if you're reading this - you prolly quoted your languages remove the quotes ...
12326         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12327     fi
12328 done
12329 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12330     echo $WITH_LANG | grep -q en-US
12331     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12333 # list with substituted ALL
12334 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12335 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12336 test "$WITH_LANG" = "en-US" && WITH_LANG=
12337 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12338     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12339     ALL_LANGS=`echo $ALL_LANGS qtz`
12341 AC_SUBST(ALL_LANGS)
12342 AC_SUBST(WITH_LANG)
12343 AC_SUBST(WITH_LANG_LIST)
12344 AC_SUBST(GIT_NEEDED_SUBMODULES)
12346 WITH_POOR_HELP_LOCALIZATIONS=
12347 if test -d "$SRC_ROOT/translations/source"; then
12348     for l in `ls -1 $SRC_ROOT/translations/source`; do
12349         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12350             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12351         fi
12352     done
12354 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12356 if test -n "$with_locales"; then
12357     WITH_LOCALES="$with_locales"
12359     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12360     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12361     # config_host/config_locales.h.in
12362     for locale in $WITH_LOCALES; do
12363         lang=${locale%_*}
12365         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12367         case $lang in
12368         hi|mr*ne)
12369             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12370             ;;
12371         bg|ru)
12372             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12373             ;;
12374         esac
12375     done
12376 else
12377     AC_DEFINE(WITH_LOCALE_ALL)
12379 AC_SUBST(WITH_LOCALES)
12381 dnl git submodule update --reference
12382 dnl ===================================================================
12383 if test -n "${GIT_REFERENCE_SRC}"; then
12384     for repo in ${GIT_NEEDED_SUBMODULES}; do
12385         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12386             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12387         fi
12388     done
12390 AC_SUBST(GIT_REFERENCE_SRC)
12392 dnl git submodules linked dirs
12393 dnl ===================================================================
12394 if test -n "${GIT_LINK_SRC}"; then
12395     for repo in ${GIT_NEEDED_SUBMODULES}; do
12396         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12397             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12398         fi
12399     done
12401 AC_SUBST(GIT_LINK_SRC)
12403 dnl branding
12404 dnl ===================================================================
12405 AC_MSG_CHECKING([for alternative branding images directory])
12406 # initialize mapped arrays
12407 BRAND_INTRO_IMAGES="flat_logo.svg intro.png"
12408 brand_files="$BRAND_INTRO_IMAGES about.svg"
12410 if test -z "$with_branding" -o "$with_branding" = "no"; then
12411     AC_MSG_RESULT([none])
12412     DEFAULT_BRAND_IMAGES="$brand_files"
12413 else
12414     if ! test -d $with_branding ; then
12415         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12416     else
12417         AC_MSG_RESULT([$with_branding])
12418         CUSTOM_BRAND_DIR="$with_branding"
12419         for lfile in $brand_files
12420         do
12421             if ! test -f $with_branding/$lfile ; then
12422                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12423                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12424             else
12425                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12426             fi
12427         done
12428         check_for_progress="yes"
12429     fi
12431 AC_SUBST([BRAND_INTRO_IMAGES])
12432 AC_SUBST([CUSTOM_BRAND_DIR])
12433 AC_SUBST([CUSTOM_BRAND_IMAGES])
12434 AC_SUBST([DEFAULT_BRAND_IMAGES])
12437 AC_MSG_CHECKING([for 'intro' progress settings])
12438 PROGRESSBARCOLOR=
12439 PROGRESSSIZE=
12440 PROGRESSPOSITION=
12441 PROGRESSFRAMECOLOR=
12442 PROGRESSTEXTCOLOR=
12443 PROGRESSTEXTBASELINE=
12445 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12446     source "$with_branding/progress.conf"
12447     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12448 else
12449     AC_MSG_RESULT([none])
12452 AC_SUBST(PROGRESSBARCOLOR)
12453 AC_SUBST(PROGRESSSIZE)
12454 AC_SUBST(PROGRESSPOSITION)
12455 AC_SUBST(PROGRESSFRAMECOLOR)
12456 AC_SUBST(PROGRESSTEXTCOLOR)
12457 AC_SUBST(PROGRESSTEXTBASELINE)
12460 AC_MSG_CHECKING([for extra build ID])
12461 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12462     EXTRA_BUILDID="$with_extra_buildid"
12464 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12465 if test -n "$EXTRA_BUILDID" ; then
12466     AC_MSG_RESULT([$EXTRA_BUILDID])
12467 else
12468     AC_MSG_RESULT([not set])
12470 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12472 OOO_VENDOR=
12473 AC_MSG_CHECKING([for vendor])
12474 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12475     OOO_VENDOR="$USERNAME"
12477     if test -z "$OOO_VENDOR"; then
12478         OOO_VENDOR="$USER"
12479     fi
12481     if test -z "$OOO_VENDOR"; then
12482         OOO_VENDOR="`id -u -n`"
12483     fi
12485     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12486 else
12487     OOO_VENDOR="$with_vendor"
12488     AC_MSG_RESULT([$OOO_VENDOR])
12490 AC_SUBST(OOO_VENDOR)
12492 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12493 if test "$with_compat_oowrappers" = "yes"; then
12494     WITH_COMPAT_OOWRAPPERS=TRUE
12495     AC_MSG_RESULT(yes)
12496 else
12497     WITH_COMPAT_OOWRAPPERS=
12498     AC_MSG_RESULT(no)
12500 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12502 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12503 AC_MSG_CHECKING([for install dirname])
12504 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12505     INSTALLDIRNAME="$with_install_dirname"
12507 AC_MSG_RESULT([$INSTALLDIRNAME])
12508 AC_SUBST(INSTALLDIRNAME)
12510 AC_MSG_CHECKING([for prefix])
12511 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12512 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12513 PREFIXDIR="$prefix"
12514 AC_MSG_RESULT([$PREFIXDIR])
12515 AC_SUBST(PREFIXDIR)
12517 LIBDIR=[$(eval echo $(eval echo $libdir))]
12518 AC_SUBST(LIBDIR)
12520 DATADIR=[$(eval echo $(eval echo $datadir))]
12521 AC_SUBST(DATADIR)
12523 MANDIR=[$(eval echo $(eval echo $mandir))]
12524 AC_SUBST(MANDIR)
12526 DOCDIR=[$(eval echo $(eval echo $docdir))]
12527 AC_SUBST(DOCDIR)
12529 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12530 AC_SUBST(INSTALLDIR)
12532 TESTINSTALLDIR="${BUILDDIR}/test-install"
12533 AC_SUBST(TESTINSTALLDIR)
12536 # ===================================================================
12537 # OAuth2 id and secrets
12538 # ===================================================================
12540 AC_MSG_CHECKING([for Google Drive client id and secret])
12541 GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12542 GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12543 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12544     GDRIVE_CLIENT_ID="\"\""
12547 if test "$with_gdrive_client_secret" = "no" -o -z "$with_gdrive_client_secret"; then
12548     GDRIVE_CLIENT_SECRET="\"\""
12551 if test -z "$GDRIVE_CLIENT_ID" -o -z "$GDRIVE_CLIENT_SECRET"; then
12552     AC_MSG_RESULT([not set])
12553 else
12554     AC_MSG_RESULT([set])
12557 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12558 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12560 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12561 ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12562 ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12563 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12564     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12567 if test "$with_alfresco_cloud_client_secret" = "no" -o -z "$with_alfresco_cloud_client_secret"; then
12568     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12571 if test -z "$ALFRESCO_CLOUD_CLIENT_ID" -o -z "$ALFRESCO_CLOUD_CLIENT_SECRET"; then
12572     AC_MSG_RESULT([not set])
12573 else
12574     AC_MSG_RESULT([set])
12576 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12577 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12579 # ===================================================================
12580 # De- or increase default verbosity of build process
12581 # ===================================================================
12582 AC_MSG_CHECKING([build verbosity])
12583 if test -n "$enable_verbose"; then
12584     if test "$enable_verbose" = "yes"; then
12585         VERBOSE="TRUE"
12586         AC_MSG_RESULT([high])
12587     fi
12588     if test "$enable_verbose" = "no"; then
12589         VERBOSE="FALSE"
12590         AC_MSG_RESULT([low])
12591     fi
12592 else
12593     AC_MSG_RESULT([not set])
12595 AC_SUBST(VERBOSE)
12597 dnl ===================================================================
12598 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12599 dnl --enable-dependency-tracking configure option
12600 dnl ===================================================================
12601 AC_MSG_CHECKING([whether to enable dependency tracking])
12602 if test "$enable_dependency_tracking" = "no"; then
12603     nodep=TRUE
12604     AC_MSG_RESULT([no])
12605 else
12606     AC_MSG_RESULT([yes])
12608 AC_SUBST(nodep)
12610 dnl ===================================================================
12611 dnl Number of CPUs to use during the build
12612 dnl ===================================================================
12613 AC_MSG_CHECKING([for number of processors to use])
12614 # plain --with-parallelism is just the default
12615 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12616     if test "$with_parallelism" = "no"; then
12617         PARALLELISM=0
12618     else
12619         PARALLELISM=$with_parallelism
12620     fi
12621 else
12622     if test "$enable_icecream" = "yes"; then
12623         PARALLELISM="10"
12624     else
12625         case `uname -s` in
12627         Darwin|FreeBSD|NetBSD|OpenBSD)
12628             PARALLELISM=`sysctl -n hw.ncpu`
12629             ;;
12631         Linux)
12632             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12633         ;;
12634         # what else than above does profit here *and* has /proc?
12635         *)
12636             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12637             ;;
12638         esac
12640         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12641         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12642     fi
12645 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12646     if test -z "$with_parallelism"; then
12647             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12648             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12649             PARALLELISM="1"
12650     else
12651         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."
12652     fi
12655 if test $PARALLELISM -eq 0; then
12656     AC_MSG_RESULT([explicit make -j option needed])
12657 else
12658     AC_MSG_RESULT([$PARALLELISM])
12660 AC_SUBST(PARALLELISM)
12663 # Set up ILIB for MSVC build
12665 if test "$build_os" = "cygwin"; then
12666     ILIB="."
12667     if test -n "$JAVA_HOME" -a "$JAVA_HOME" != "NO_JAVA_HOME"; then
12668         ILIB="$ILIB;$JAVA_HOME/lib"
12669     fi
12670     if test "$BITNESS_OVERRIDE" = 64; then
12671         ILIB="$ILIB;$COMPATH/lib/amd64"
12672         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12673         if test "$WINDOWS_SDK_VERSION" = "80"; then
12674             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/win8/um/x64"
12675         fi
12676     else
12677         ILIB="$ILIB;$COMPATH/lib"
12678         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12679         if test "$WINDOWS_SDK_VERSION" = "80"; then
12680             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/win8/um/x86"
12681         fi
12682     fi
12683     ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12685     if test "$ENABLE_DIRECTX" = "TRUE"; then
12686         ILIB="$ILIB;$DIRECTXSDK_LIB"
12687     fi
12688     AC_SUBST(ILIB)
12692 # ===================================================================
12693 # Creating bigger shared library to link against
12694 # ===================================================================
12695 AC_MSG_CHECKING([whether to create huge library])
12696 MERGELIBS=
12698 if test $_os = iOS -o $_os = Android; then
12699     # Never any point in mergelibs for these as we build just static
12700     # libraries anyway...
12701     enable_mergelibs=no
12704 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12705     if test $_os != Linux -a $_os != WINNT; then
12706         add_warning "--enable-mergelibs is not tested for this platform"
12707     fi
12708     if test "$enable_mergelibs" = "all"; then
12709         MERGELIBS="ALL"
12710         URELIBS="TRUE"
12711         AC_DEFINE(STATIC_LINKING)
12712     else
12713         MERGELIBS="CORE"
12714     fi
12715     AC_MSG_RESULT([yes])
12716 else
12717     AC_MSG_RESULT([no])
12719 AC_SUBST([MERGELIBS])
12720 AC_SUBST([URELIBS])
12722 # ===================================================================
12723 # Create hardlinks on deliver instead of copying for smaller size and speed up
12724 # ===================================================================
12725 AC_MSG_CHECKING([whether to create hardlinks for delivering files])
12726 HARDLINKDELIVER=
12727 if test "$enable_hardlink_deliver" = "yes"; then
12728     HARDLINKDELIVER="TRUE"
12729     AC_MSG_RESULT([yes])
12730 else
12731     AC_MSG_RESULT([no])
12733 AC_SUBST(HARDLINKDELIVER)
12735 dnl ===================================================================
12736 dnl icerun is a wrapper that stops us spawning tens of processes
12737 dnl locally - for tools that can't be executed on the compile cluster
12738 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12739 dnl ===================================================================
12740 AC_MSG_CHECKING([whether to use icerun wrapper])
12741 ICECREAM_RUN=
12742 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12743     ICECREAM_RUN=icerun
12744     AC_MSG_RESULT([yes])
12745 else
12746     AC_MSG_RESULT([no])
12748 AC_SUBST(ICECREAM_RUN)
12750 dnl ===================================================================
12752 AC_MSG_CHECKING([MPL subset])
12753 MPL_SUBSET=
12755 if test "$enable_mpl_subset" = "yes"; then
12756     warn_report=false
12757     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12758         warn_report=true
12759     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12760         warn_report=true
12761     fi
12762     if test "$warn_report" = "true"; then
12763         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12764     fi
12765     if test "x$enable_postgresql_sdbc" != "xno"; then
12766         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the postgress database backend.])
12767     fi
12768     if test "$enable_lotuswordpro" = "yes"; then
12769         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12770     fi
12771     if test "$WITH_WEBDAV" = "neon"; then
12772         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12773     fi
12774     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12775         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12776     fi
12777     if test -n "$ENABLE_PDFIMPORT"; then
12778         if test "x$SYSTEM_POPPLER" != "x"; then
12779             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12780         fi
12781     fi
12782     # cf. m4/libo_check_extension.m4
12783     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12784         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12785     fi
12786     for theme in $WITH_THEMES; do
12787         case $theme in
12788         crystal|default|hicontrast|human|oxygen|sifr)
12789             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12790         *) : ;;
12791         esac
12792     done
12793     if test "$enable_opengl" != "no" -o "x$ENABLE_OPENGL" = "xTRUE"; then
12794         AC_MSG_ERROR([need to --disable-opengl - GL transitions support.])
12795     fi
12796     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12797         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12798     fi
12800     MPL_SUBSET="TRUE"
12801     AC_DEFINE(MPL_HAVE_SUBSET)
12802     AC_MSG_RESULT([only])
12803 else
12804     AC_MSG_RESULT([no restrictions])
12806 AC_SUBST(MPL_SUBSET)
12809 dnl ===================================================================
12810 dnl Setting up the environment.
12811 dnl ===================================================================
12812 echo "setting up the build environment variables..."
12814 AC_SUBST(COMPATH)
12816 if test "$build_os" = "cygwin"; then
12817     if test "$DISABLE_ACTIVEX" = "TRUE"; then
12818         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12819         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12820     else
12821         ATL_LIB="$COMPATH/atlmfc/lib"
12822         ATL_INCLUDE="$COMPATH/atlmfc/include"
12823     fi
12824     if test "$BITNESS_OVERRIDE" = 64; then
12825         ATL_LIB="$ATL_LIB/amd64"
12826     fi
12827     PathFormat "/usr/bin/grep.exe"
12828     WIN_GREP="$formatted_path"
12829     PathFormat "/usr/bin/find.exe"
12830     WIN_FIND="$formatted_path"
12831     PathFormat "/usr/bin/ls.exe"
12832     WIN_LS="$formatted_path"
12833     PathFormat "/usr/bin/touch.exe"
12834     WIN_TOUCH="$formatted_path"
12837 AC_SUBST(ATL_INCLUDE)
12838 AC_SUBST(ATL_LIB)
12839 AC_SUBST(WIN_FIND)
12840 AC_SUBST(WIN_GREP)
12841 AC_SUBST(WIN_LS)
12842 AC_SUBST(WIN_TOUCH)
12844 AC_SUBST(BUILD_TYPE)
12846 AC_SUBST(SOLARINC)
12848 PathFormat "$PERL"
12849 PERL="$formatted_path"
12850 AC_SUBST(PERL)
12852 if test -n "$TMPDIR"; then
12853     TEMP_DIRECTORY="$TMPDIR"
12854 else
12855     TEMP_DIRECTORY="/tmp"
12857 if test "$build_os" = "cygwin"; then
12858     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12860 AC_SUBST(TEMP_DIRECTORY)
12862 # setup the PATH for the environment
12863 if test -n "$LO_PATH_FOR_BUILD"; then
12864     LO_PATH="$LO_PATH_FOR_BUILD"
12865 else
12866     LO_PATH="$PATH"
12868     case "$host_os" in
12870     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12871         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12872             pathmunge "$JAVA_HOME/bin" "after"
12873         fi
12874         ;;
12876     cygwin*)
12877         pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12878         pathmunge "$ASM_HOME" "before"
12879         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12880         pathmunge "$CSC_PATH" "before"
12881         pathmunge "$MIDL_PATH" "before"
12882         pathmunge "$AL_PATH" "before"
12883         pathmunge "$MSPDB_PATH" "before"
12884         if test "$BITNESS_OVERRIDE" = 64; then
12885             pathmunge "$COMPATH/bin/amd64" "before"
12886             pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
12887         else
12888             pathmunge "$COMPATH/bin" "before"
12889             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
12890         fi
12891         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12892             if test -d "$JAVA_HOME/jre/bin/client"; then
12893                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12894             fi
12895             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12896                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12897             fi
12898             pathmunge "$JAVA_HOME/bin" "before"
12899         fi
12900         ;;
12902     solaris*)
12903         pathmunge "/usr/css/bin" "before"
12904         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12905             pathmunge "$JAVA_HOME/bin" "after"
12906         fi
12907         ;;
12908     esac
12910     pathmunge "$SRC_ROOT/solenv/bin" "before"
12911     pathmunge "." "before"
12914 AC_SUBST(LO_PATH)
12916 # Generate a configuration md5 we can use for deps
12917 if test -f config_host.mk; then
12918     config_md5=`$MD5SUM config_host.mk | sed "s/ .*//"`
12921 AC_CONFIG_FILES([config_host.mk
12922                  Makefile
12923                  lo.xcent
12924                  instsetoo_native/util/openoffice.lst
12925                  sysui/desktop/macosx/Info.plist
12926                  ios/lo.xcconfig])
12927 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12928 AC_CONFIG_HEADERS([config_host/config_clang.h])
12929 AC_CONFIG_HEADERS([config_host/config_eot.h])
12930 AC_CONFIG_HEADERS([config_host/config_features.h])
12931 AC_CONFIG_HEADERS([config_host/config_folders.h])
12932 AC_CONFIG_HEADERS([config_host/config_gcc.h])
12933 AC_CONFIG_HEADERS([config_host/config_global.h])
12934 AC_CONFIG_HEADERS([config_host/config_graphite.h])
12935 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12936 AC_CONFIG_HEADERS([config_host/config_locales.h])
12937 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12938 AC_CONFIG_HEADERS([config_host/config_orcus.h])
12939 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12940 AC_CONFIG_HEADERS([config_host/config_mingw.h])
12941 AC_CONFIG_HEADERS([config_host/config_oox.h])
12942 AC_CONFIG_HEADERS([config_host/config_options.h])
12943 AC_CONFIG_HEADERS([config_host/config_test.h])
12944 AC_CONFIG_HEADERS([config_host/config_telepathy.h])
12945 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12946 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12947 AC_CONFIG_HEADERS([config_host/config_version.h])
12948 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12949 AC_OUTPUT
12951 if test "$CROSS_COMPILING" = TRUE; then
12952     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12955 # touch the config timestamp file
12956 if test ! -f config_host.mk.stamp; then
12957     echo > config_host.mk.stamp
12958 elif test "$config_md5" = `$MD5SUM config_host.mk | sed "s/ .*//"`; then
12959     echo "Configuration unchanged - avoiding scp2 stamp update"
12960 else
12961     echo > config_host.mk.stamp
12965 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12966 cat << _EOS
12967 ****************************************************************************
12968 WARNING:
12969 Your make version is known to be horribly slow, and hard to debug
12970 problems with. To get a reasonably functional make please do:
12972 to install a pre-compiled binary make for cygwin
12974 mkdir -p /opt/lo/bin
12975 cd /opt/lo/bin
12976 wget http://dev-www.libreoffice.org/bin/cygwin/make
12977 chmod +x make
12979 to install from source:
12980 place yourself in a working directory of you choice.
12982 git clone git://anongit.freedesktop.org/libreoffice/contrib/dev-tools
12983 cd dev-tools/make-3.82-gbuild
12984 ./configure --prefix=/opt/lo
12985 make
12986 make install
12988 Then re-run autogen.sh
12990 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12991 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12993 _EOS
12996 cat << _EOF
12997 ****************************************************************************
12999 To build, issue:
13000 $GNUMAKE
13002 For details, run:
13003 $GNUMAKE help
13005 _EOF
13007 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13008     cat << _EOF
13009 After the build has finished, you can immediately run it using:
13010 instdir/program/soffice
13012 If you want to run the smoketest, issue:
13013 $GNUMAKE check
13015 _EOF
13018 if test -f warn; then
13019     cat warn
13020     rm warn
13023 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: