bump product version to 4.1.0.0.beta1+
[LibreOffice.git] / configure.ac
blob889d4e72d67a4561aa05d9ce1fe965b6156d2b04
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.1.0.0.beta1+],[],[],[http://documentfoundation.org/])
14 AC_PREREQ([2.59])
15 save_CC=$CC
16 save_CXX=$CXX
18 BUILD_TYPE="LibO"
19 SCPDEFS=""
20 GIT_NEEDED_SUBMODULES=""
21 LO_PATH= # used by path_munge to construct a PATH variable
23 PathFormat()
25     formatted_path="$1"
26     if test "$build_os" = "cygwin"; then
27         pf_part1=
28         pf_conv_to_dos=
29         for pf_part in $formatted_path; do
30             if test -z "$pf_part1"; then
31                 pf_part1="$pf_part"
32             else
33                 pf_conv_to_dos="yes"
34             fi
35         done
36         if test "$pf_conv_to_dos" = "yes"; then
37             formatted_path=`cygpath -d "$formatted_path"`
38             if test $? -ne 0;  then
39                 AC_MSG_ERROR([path conversion failed for "$1".])
40             fi
41         fi
42         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
43         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
44         if test "$fp_count_slash$fp_count_colon" != "00"; then
45             if test "$fp_count_colon" = "0"; then
46                 formatted_path=`realpath "$formatted_path"`
47                 if test $? -ne 0;  then
48                     AC_MSG_ERROR([realpath failed for "$1".])
49                 fi
50             fi
51             formatted_path=`cygpath -m "$formatted_path"`
52             if test $? -ne 0;  then
53                 AC_MSG_ERROR([path conversion failed for "$1".])
54             fi
55         fi
56     fi
59 rm -f warn
60 have_WARNINGS="no"
61 add_warning()
63     if test "$have_WARNINGS" = "no"; then
64         echo "*************************************" > warn
65         have_WARNINGS="yes"
66         if which tput >/dev/null 2>/dev/null && test `tput colors` -ge 8; then
67             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
68             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
69         else
70             COLORWARN="* WARNING :"
71         fi
72     fi
73     echo "$COLORWARN $@" >> warn
76 if test -n "$SOLARENV"; then
77     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
80 echo "********************************************************************"
81 echo "*"
82 echo "*   Running ${PACKAGE_NAME} build configuration."
83 echo "*"
84 echo "********************************************************************"
85 echo ""
87 dnl ===================================================================
88 dnl checks build and host OSes
89 dnl do this before argument processing to allow for platform dependent defaults
90 dnl ===================================================================
91 AC_CANONICAL_HOST
93 AC_PROG_EGREP
94 # AC_PROG_EGREP doesn't set GREP on all systems as well
95 AC_PATH_PROG(GREP, grep)
97 BUILDDIR=`pwd`
98 cd $srcdir
99 SRC_ROOT=`pwd`
100 cd $BUILDDIR
101 EXEEXT_FOR_BUILD=
102 x_Cygwin=[\#]
104 if test "$build_os" = "cygwin"; then
105     EXEEXT_FOR_BUILD=.exe
106     PathFormat "$SRC_ROOT"
107     SRC_ROOT="$formatted_path"
108     PathFormat "$BUILDDIR"
109     BUILDDIR="$formatted_path"
110     x_Cygwin=
113 AC_SUBST(SRC_ROOT)
114 AC_SUBST(BUILDDIR)
115 AC_SUBST(EXEEXT_FOR_BUILD)
116 AC_SUBST(x_Cygwin)
117 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
118 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
120 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
121     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
124 # need sed in os checks...
125 AC_PATH_PROGS(SED, sed)
126 if test -z "$SED"; then
127     AC_MSG_ERROR([install sed to run this script])
130 dnl ===================================================================
131 dnl When building for Android, --with-android-ndk,
132 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
133 dnl mandatory
134 dnl ===================================================================
136 AC_ARG_WITH(android-ndk,
137     AS_HELP_STRING([--with-android-ndk],
138         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
141 AC_ARG_WITH(android-ndk-toolchain-version,
142     AS_HELP_STRING([--with-android-ndk-toolchain-version],
143         [Specify which toolchain version to use, of those present in the
144         Android NDK you are using. Mandatory if the NDK used has several
145         toolchain versions for the host architecture you are building for.]), ,)
147 AC_ARG_WITH(android-sdk,
148     AS_HELP_STRING([--with-android-sdk],
149         [Specify location of the Android SDK. Mandatory when building for Android.]),
152 ANDROID_NDK_HOME=
153 if test -n "$with_android_ndk"; then
154     ANDROID_NDK_HOME=$with_android_ndk
156     # Set up a lot of pre-canned defaults
158     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
159         AC_MSG_ERROR([Unrecognized Android NDK. Only r8* versions supported.])
160     fi
161     ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
163     case $ANDROID_NDK_VERSION in
164     r8*)
165         ;;
166     *)
167         AC_MSG_ERROR([Unsupported NDK version $ANDROID_NDK_VERSION, only r8* versions are supported])
168         ;;
169     esac
171     if test $host_cpu = arm; then
172         android_cpu=arm
173         android_platform_prefix=$android_cpu-linux-androideabi
174     elif test $host_cpu = mips; then
175         android_cpu=mips
176         android_platform_prefix=$android_cpu-linux-androideabi
177     else
178         # host_cpu is something like "i386" or "i686" I guess, NDK uses
179         # "x86" in some contexts
180         android_cpu=x86
181         android_platform_prefix=$android_cpu
182     fi
184     case "$with_android_ndk_toolchain_version" in
185     4.6|4.7)
186         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$with_android_ndk_toolchain_version
187         ANDROID_COMPILER_DIR=$ANDROID_BINUTILS_DIR
188         ;;
189     clang3.1|clang3.2)
190         AC_MSG_WARN([Building with the Clang tool-chain is known to break in the bridges module, fix that please])
191         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-4.6
192         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm-${with_android_ndk_toolchain_version#clang}
193         ANDROID_USING_CLANG=true
194         ;;
195     esac
197     if test ! -d $ANDROID_BINUTILS_DIR; then
198         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
199     elif test $ANDROID_COMPILER_DIR != $ANDROID_BINUTILS_DIR -a ! -d $ANDROID_COMPILER_DIR; then
200         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
201     fi
203     # Check if there is a 64-bit tool-chain. Google provides a NDK with 64-bit tool-chain binaries in
204     # NDK r8e, and for earlier NDKs it was possible to build one yourself. Using a 64-bit linker is
205     # required if you compile large parts of the code with -g. A 32-bit linker just won't manage to
206     # link the (app-specific) single huge .so that is built for the apps in android/experimental/* if
207     # there is debug information in a significant part of the object files. (A 64-bit ld.gold grows to
208     # much over 10 gigabytes of virtual space when linking such a .so if all objects have been built
209     # with debug information.)
210     toolchain_system='*'
211     if test $build_os = linux-gnu; then
212         ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/linux-x86/bin
213         ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/linux-x86
214         if test $build_cpu = x86_64; then
215             if test -d $ANDROID_COMPILER_DIR/prebuilt/linux-x86_64; then
216                 ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/linux-x86_64/bin
217             fi
218             if test -d $ANDROID_BINUTILS_DIR/prebuilt/linux-x86_64; then
219                 ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/linux-x86_64
220             fi
221         fi
222         ANDROID_BINUTILS_BIN=$ANDROID_BINUTILS_PREBUILT_ROOT/bin
223     fi
225     # This stays empty if there is just one version of the toolchain in the NDK
226     ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=
227     case "`echo $ANDROID_NDK_HOME/toolchains/$android_cpu*-*/prebuilt/*/bin`" in
228     */bin\ */bin*)
229         # Trailing slash intentional and necessary, compare to how this is used
230         if test -n "$ANDROID_USING_CLANG"; then
231             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=4.6/
232         else
233             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
234         fi
235         ;;
236     esac
238     if test $host_cpu = arm; then
239        android_gnu_prefix=arm-linux-androideabi
240     elif test $host_cpu = mips; then
241        android_gnu_prefix=mipsel-linux-android
242     elif test $ANDROID_NDK_VERSION = r8; then
243         # The prefix used for the x86 tool-chain changed between NDK r8 and r8b
244         android_gnu_prefix=i686-android-linux
245     else
246         android_gnu_prefix=i686-linux-android
247     fi
249     test -z "$SYSBASE" && export SYSBASE=$ANDROID_NDK_HOME/platforms/android-9/arch-$android_cpu
250     test -z "$AR" && AR=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ar
251     test -z "$NM" && NM=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-nm
252     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-objdump
253     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ranlib
254     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-strip
256     if test $host_cpu = arm; then
257         ANDROID_APP_ABI=armeabi-v7a
258         if test -n "$ANDROID_USING_CLANG"; then
259             ANDROIDCFLAGS="-gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT" 
260             ANDROIDCFLAGS="$ANDROIDCFLAGS -target armv7-none-linux-androideabi"
261             ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes"
262         else
263             :
264         fi
265         ANDROIDCFLAGS="$ANDROIDCFLAGS -mthumb"
266         ANDROIDCFLAGS="$ANDROIDCFLAGS -march=armv7-a -mfloat-abi=softfp -mfpu=neon"
267     elif test $host_cpu = mips; then
268         ANDROID_APP_ABI=mips
269         ANDROIDCFLAGS=""
270     else # x86
271         ANDROID_APP_ABI=x86
272         ANDROIDCFLAGS="-march=atom"
273     fi
274     ANDROIDCFLAGS="$ANDROIDCFLAGS -ffunction-sections"
275     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/$ANDROID_APP_ABI"
276     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot $ANDROID_NDK_HOME/platforms/android-9/arch-$android_cpu"
277     ANDROIDCFLAGS="$ANDROIDCFLAGS -Wl,--fix-cortex-a8"
279     if test -n "$ANDROID_USING_CLANG"; then
280         ANDROIDCFLAGS="$ANDROIDCFLAGS -Qunused-arguments"
281     else
282         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wno-psabi"
283     fi
285     # When using the 4.6 or newer toolchain, use the gold linker
286     case "$with_android_ndk_toolchain_version" in
287     4.[[6789]]*|[[56789]].*|clang*)
288         # The NDK doesn't have ld.gold for MIPS for some reason
289         if test "$host_cpu" != mips; then
290             ANDROIDCFLAGS="$ANDROIDCFLAGS -fuse-ld=gold"
291         fi
292         ;;
293     esac
295     # gdbserver can be in different locations
296     if test -f $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver; then
297         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver
298     elif test -f $ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver; then
299         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver
300     else
301         AC_MSG_ERROR([Can't find gdbserver for your Android target])
302     fi
304     if test $host_cpu = arm; then
305         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"
306     elif test $host_cpu = mips; then
307         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"
308     else # x86
309         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"
310     fi
312     if test -z "$CC"; then
313         case "$with_android_ndk_toolchain_version" in
314         4.*)
315             CC="$ANDROID_COMPILER_BIN/$android_gnu_prefix-gcc $ANDROIDCFLAGS"
316             ;;
317         clang*)
318             CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
319         esac
320     fi
321     if test -z "$CXX"; then
322         case "$with_android_ndk_toolchain_version" in
323         4.*)
324             CXX="$ANDROID_COMPILER_BIN/$android_gnu_prefix-g++ $ANDROIDCXXFLAGS"
325             ;;
326         clang*)
327             CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
328             ;;
329         esac
330     fi
332 AC_SUBST(ANDROID_NDK_GDBSERVER)
333 AC_SUBST(ANDROID_APP_ABI)
335 dnl ===================================================================
336 dnl Also --with-android-sdk is mandatory
337 dnl ===================================================================
338 ANDROID_SDK_HOME=
339 if test -n "$with_android_sdk"; then
340    ANDROID_SDK_HOME=$with_android_sdk
341    PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
343 AC_SUBST(ANDROID_SDK_HOME)
345 dnl ===================================================================
346 dnl The following is a list of supported systems.
347 dnl Sequential to keep the logic very simple
348 dnl These values may be checked and reset later.
349 dnl ===================================================================
350 #defaults unless the os test overrides this:
351 test_randr=yes
352 test_xrender=yes
353 test_cups=yes
354 test_dbus=yes
355 test_fontconfig=yes
356 test_cairo=no
358 # Default values, as such probably valid just for Linux, set
359 # differently below just for Mac OSX,but at least better than
360 # hardcoding these as we used to do. Much of this is duplicated also
361 # in solenv for old build system and for gbuild, ideally we should
362 # perhaps define stuff like this only here in configure.ac?
364 LINKFLAGSSHL="-shared"
365 PICSWITCH="-fpic"
366 DLLPOST=".so"
368 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
370 case "$host_os" in
372 solaris*)
373     test_gtk=yes
374     build_gstreamer=yes
375     build_gstreamer_0_10=yes
376     test_tde=yes
377     test_kde=yes
378     test_freetype=yes
379     test_gstreamer=yes
380     _os=SunOS
382     dnl ===========================================================
383     dnl Check whether we're using Solaris 10 - SPARC or Intel.
384     dnl ===========================================================
385     AC_MSG_CHECKING([the Solaris operating system release])
386     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
387     if test "$_os_release" -lt "10"; then
388         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
389     else
390         AC_MSG_RESULT([ok ($_os_release)])
391     fi
393     dnl Check whether we're using a SPARC or i386 processor
394     AC_MSG_CHECKING([the processor type])
395     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
396         AC_MSG_RESULT([ok ($host_cpu)])
397     else
398         AC_MSG_ERROR([only SPARC and i386 processors are supported])
399     fi
400     ;;
402 linux-gnu*|k*bsd*-gnu*)
403     test_gtk=yes
404     build_gstreamer=yes
405     build_gstreamer_0_10=yes
406     test_tde=yes
407     test_kde=yes
408     test_kde4=yes
409     test_freetype=yes
410     test_unix_quickstarter=yes
411     _os=Linux
412     ;;
414 gnu)
415     test_randr=no
416     test_xrender=no
417     _os=GNU
418      ;;
420 cygwin*|interix*|mingw32*)
422     # When building on Windows normally with MSVC under Cygwin,
423     # configure thinks that the host platform (the platform the
424     # built code will run on) is Cygwin, even if it obviously is
425     # Windows, which in Autoconf terminology is called
426     # "mingw32". (Which is misleading as MinGW is the name of the
427     # tool-chain, not an operating system.)
429     # Somewhat confusing, yes. But this configure script doesn't
430     # look at $host etc that much, it mostly uses its own $_os
431     # variable, set here in this case statement.
433     # When cross-compiling to Windows from Unix, the host platform
434     # is "mingw32" (because in that case it is the MinGW
435     # tool-chain that is used).
437     test_cups=no
438     test_dbus=no
439     test_randr=no
440     test_xrender=no
441     test_freetype=no
442     test_fontconfig=no
443     _os=WINNT
445     DLLPOST=".dll"
446     LINKFLAGSNOUNDEFS=
448     # If the host OS matches "mingw32*", that means we are using the
449     # MinGW cross-compiler, because we don't see the point in building
450     # LibreOffice using MinGW on Windows. If you want to build on
451     # Windows, use MSVC. If you want to use MinGW, surely you want to
452     # cross-compile (from Linux or some other Unix).
454     case "$host_os" in
455     mingw32*)
456         WITH_MINGW=yes
457         if test -z "$CC"; then
458             CC="$host_cpu-$host_vendor-$host_os-gcc"
459         fi
460         if test -z "$CXX"; then
461             CXX="$host_cpu-$host_vendor-$host_os-g++"
462         fi
463         ;;
464     esac
465     ;;
467 darwin*) # Mac OS X or iOS
468     test_gtk=yes
469     test_randr=no
470     test_xrender=no
471     test_freetype=no
472     test_fontconfig=no
473     test_dbus=no
474     if test "$host_cpu" = "arm"; then
475         _os=iOS
476         test_gtk=no
477         test_cups=no
478     else
479         _os=Darwin
480     fi
481     enable_systray=no
482     # See comment above the case "$host_os"
483     LINKFLAGSSHL="-dynamiclib -single_module"
485     # -fPIC is default
486     PICSWITCH=""
488     DLLPOST=".dylib"
490     # -undefined error is the default
491     LINKFLAGSNOUNDEFS=""
494 freebsd*)
495     test_gtk=yes
496     build_gstreamer=yes
497     build_gstreamer_0_10=yes
498     test_tde=yes
499     test_kde=yes
500     test_kde4=yes
501     test_freetype=yes
502     AC_MSG_CHECKING([the FreeBSD operating system release])
503     if test -n "$with_os_version"; then
504         OSVERSION="$with_os_version"
505     else
506         OSVERSION=`/sbin/sysctl -n kern.osreldate`
507     fi
508     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
509     AC_MSG_CHECKING([which thread library to use])
510     if test "$OSVERSION" -lt "500016"; then
511         PTHREAD_CFLAGS="-D_THREAD_SAFE"
512         PTHREAD_LIBS="-pthread"
513     elif test "$OSVERSION" -lt "502102"; then
514         PTHREAD_CFLAGS="-D_THREAD_SAFE"
515         PTHREAD_LIBS="-lc_r"
516     else
517         PTHREAD_CFLAGS=""
518         PTHREAD_LIBS="-pthread"
519     fi
520     AC_MSG_RESULT([$PTHREAD_LIBS])
521     _os=FreeBSD
522     ;;
524 *netbsd*)
525     test_gtk=yes
526     build_gstreamer=yes
527     build_gstreamer_0_10=yes
528     test_tde=no
529     test_kde=no
530     test_kde4=yes
531     test_freetype=yes
532     PTHREAD_LIBS="-pthread -lpthread"
533     _os=NetBSD
534     ;;
536 aix*)
537     test_randr=no
538     test_freetype=yes
539     PTHREAD_LIBS=-pthread
540     _os=AIX
541     ;;
543 openbsd*)
544     test_gtk=yes
545     test_tde=yes
546     test_kde=yes
547     test_freetype=yes
548     PTHREAD_CFLAGS="-D_THREAD_SAFE"
549     PTHREAD_LIBS="-pthread"
550     _os=OpenBSD
551     ;;
553 dragonfly*)
554     test_gtk=yes
555     build_gstreamer=yes
556     build_gstreamer_0_10=yes
557     test_tde=yes
558     test_kde=yes
559     test_kde4=yes
560     test_freetype=yes
561     PTHREAD_LIBS="-pthread"
562     _os=DragonFly
563     ;;
565 linux-android*)
566     build_gstreamer=no
567     build_gstreamer_0_10=no
568     test_cups=no
569     test_dbus=no
570     test_fontconfig=no
571     test_freetype=no
572     test_gtk=no
573     test_tde=no
574     test_kde=no
575     test_kde4=no
576     test_randr=no
577     test_xrender=no
578     test_unix_quickstarter=no
579     _os=Android
581     if test -z "$with_android_ndk"; then
582         AC_MSG_ERROR([the --with-android-ndk option is mandatory])
583     fi
585     if test -z "$with_android_ndk_toolchain_version"; then
586         AC_MSG_ERROR([the --with-android-ndk-toolchain-version option is mandatory])
587     fi
589     if test -z "$with_android_sdk"; then
590         AC_MSG_ERROR([the --with-android-sdk option is mandatory])
591     fi
593     # Verify that the NDK and SDK options are proper
594     if test ! -f "$ANDROID_NDK_HOME/platforms/android-9/arch-arm/usr/lib/libc.a"; then
595         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
596     fi
598     if test ! -d "$ANDROID_SDK_HOME/platforms"; then
599         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
600     fi
602     BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
603     ;;
606     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
607     ;;
608 esac
610 if test "$_os" = "AIX"; then
611     AC_PATH_PROG(GAWK, gawk)
612     if test -z "$GAWK"; then
613         AC_MSG_ERROR([gawk not found in \$PATH])
614     fi
617 AC_SUBST(WITH_MINGW)
618 AC_SUBST(OSVERSION)
619 AC_SUBST(PTHREAD_CFLAGS)
620 AC_SUBST(PTHREAD_LIBS)
622 ###############################################################################
623 # Extensions switches --enable/--disable
624 ###############################################################################
625 # By default these should be enabled unless having extra dependencies.
626 # If there is extra dependency over configure options then the enable should
627 # be automagic based on whether the requiring feature is enabled or not.
628 # All this options change anything only with --enable-extension-integration.
630 # The name of this option and its help string makes it sound as if
631 # extensions are built anyway, just not integrated in the installer,
632 # if you use --disable-extension-integration. Is that really the
633 # case?
635 AC_ARG_ENABLE(extension-integration,
636     AS_HELP_STRING([--disable-extension-integration],
637         [Disable integration of the built extensions in the installer of the
638          product. Use this switch to disable the integration.])
641 AC_ARG_ENABLE(export,
642     AS_HELP_STRING([--disable-export],
643         [Disable (some) code for document export. Useful when building viewer-only apps that lack
644          save/export functionality, to avoid having an excessive amount of code and data used
645          only for exporrt linked in. Work in progress, use only if you are hacking on it.])
648 AC_ARG_ENABLE(database-connectivity,
649     AS_HELP_STRING([--disable-database-connectivity],
650         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
653 # This doesn't mean not building (or "integrating") extensions
654 # (although it probably should; i.e. it should imply
655 # --disable-extension-integration I guess), it means not supporting
656 # any extension mechanism at all
657 AC_ARG_ENABLE(extensions,
658     AS_HELP_STRING([--disable-extensions],
659         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
662 AC_ARG_ENABLE(scripting,
663     AS_HELP_STRING([--disable-scripting],
664         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
667 # This is mainly for Android and iOS, but could potentially be used in some
668 # special case otherwise, too, so factored out as a separate setting
670 AC_ARG_ENABLE(dynamic-loading,
671     AS_HELP_STRING([--disable-dynamic-loading],
672         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
675 AC_ARG_ENABLE(ext-mariadb-connector,
676     AS_HELP_STRING([--enable-ext-mariadb-connector],
677         [Enable the build of the MariaDB/MySQL Connector extension.])
680 AC_ARG_ENABLE(ext-presenter-minimizer,
681     AS_HELP_STRING([--disable-ext-presenter-minimizer],
682         [Disable the Presentation Minimizer extension.])
685 AC_ARG_ENABLE(report-builder,
686     AS_HELP_STRING([--disable-report-builder],
687         [Disable the Report Builder.])
690 AC_ARG_ENABLE(ext-wiki-publisher,
691     AS_HELP_STRING([--enable-ext-wiki-publisher],
692         [Enable the Wiki Publisher extension.])
694 ###############################################################################
696 dnl ---------- *** ----------
698 AC_ARG_ENABLE([hardlink-deliver],
699     AS_HELP_STRING([--enable-hardlink-deliver],
700         [Put files into deliver folder as hardlinks instead of copying them
701         over. Saves space and speeds up build.])
704 AC_ARG_ENABLE(mergelibs,
705     AS_HELP_STRING([--enable-mergelibs=<all/yes>],
706         [Enables linking of big, merged, library. Experimental feature tested
707         only on Linux and Android. All will link a lot more libraries into libmerged
708         while yes or no argument will simply enable a core set of libraries.])
711 AC_ARG_ENABLE(graphite,
712     AS_HELP_STRING([--enable-graphite],
713         [Enables the compilation of Graphite smart font rendering.])
716 AC_ARG_ENABLE(fetch-external,
717     AS_HELP_STRING([--disable-fetch-external],
718         [Disables fetching external tarballs from web sources.])
721 AC_ARG_ENABLE(lockdown,
722     AS_HELP_STRING([--disable-lockdown],
723         [Disables the gconf integration work in LibreOffice.]),
726 AC_ARG_ENABLE(vba,
727     AS_HELP_STRING([--disable-vba],
728         [Disables the vba compatibility feature.])
731 AC_ARG_ENABLE(pch,
732     AS_HELP_STRING([--enable-pch],
733         [Enables precompiled header support for C++.])
736 AC_ARG_ENABLE(win-mozab-driver,
737     AS_HELP_STRING([--enable-win-mozab-driver],
738         [LibreOffice includes a driver to connect to Mozilla
739          address books under Windows, to build with this version, use this option.])
742 AC_ARG_ENABLE(epm,
743     AS_HELP_STRING([--enable-epm],
744         [LibreOffice includes self-packaging code, that requires epm, however epm is
745          useless for large scale package building.])
748 AC_ARG_ENABLE(odk,
749     AS_HELP_STRING([--disable-odk],
750         [LibreOffice includes an ODK, office development kit which some packagers may
751          wish to build without.])
754 AC_ARG_ENABLE(mpl-subset,
755     AS_HELP_STRING([--enable-mpl-subset],
756         [Don't compile any pieces which are not MPL or more liberrally licensed])
759 AC_ARG_ENABLE(evolution2,
760     AS_HELP_STRING([--enable-evolution2],
761         [Allows the built-in evolution 2 addressbook connectivity build to be
762          enabled.])
765 AC_ARG_ENABLE(directx,
766     AS_HELP_STRING([--disable-directx],
767         [Remove DirectX implementation for the new XCanvas interface.
768          The DirectX support requires more stuff installed on Windows to
769          compile. (DirectX SDK, GDI+ libs)])
772 AC_ARG_ENABLE(activex,
773     AS_HELP_STRING([--disable-activex],
774         [Disable the use of ActiveX for a Windows build.
775         This switch is mandatory when using VC++ 2008 Express.])
778 AC_ARG_ENABLE(atl,
779     AS_HELP_STRING([--disable-atl],
780         [Disable the use of ATL for a Windows build.])
781     [
782                           This switch is mandatory when using VC++ 2008 Express.
783     ],
786 AC_ARG_ENABLE(werror,
787     AS_HELP_STRING([--enable-werror],
788         [Turn warnings to errors. (Has no effect in modules where the treating
789          of warnings as errors is disabled explicitly.)]),
792 AC_ARG_ENABLE(assert-always-abort,
793     AS_HELP_STRING([--enable-assert-always-abort],
794         [make assert() abort even in release code.]),
797 AC_ARG_ENABLE(dbgutil,
798     AS_HELP_STRING([--enable-dbgutil],
799         [Provide debugging support from --enable-debug and include additional debugging
800          utilities such as object counting or more expensive checks.
801          This is the recommended option for developers.
802          Note that this makes the build ABI incompatible, it is not possible to mix object
803          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
805 AC_ARG_ENABLE(debug,
806     AS_HELP_STRING([--enable-debug],
807         [Include debugging information, disable compiler optimization and inlining plus
808          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
810 AC_ARG_ENABLE(selective-debuginfo,
811     AS_HELP_STRING([--enable-selective-debuginfo],
812         [If --enable-debug or --enable-dbgutil is used, build debugging information
813          (-g compiler flag) only for the specified gbuild build targets
814          (where all means everything, - prepended means not to enable, / appended means
815          everything in the directory; there is no ordering, more specific overrides
816          more general, and disabling takes precedence).
817          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
819 AC_ARG_ENABLE(symbols,
820     AS_HELP_STRING([--enable-symbols],
821         [Include debugging symbols in output while preserve optimization.
822          This enables -g compiler flag for GCC or equivalent,
823          without changing anything else compared to productive code.]))
825 AC_ARG_ENABLE(compiler-plugins,
826     AS_HELP_STRING([--enable-compiler-plugins],
827         [Enable compiler plugins that will perform additional checks during
828          building. Enabled automatically by --enable-dbgutil.]))
830 AC_ARG_ENABLE(linkoo,
831     AS_HELP_STRING([--disable-linkoo],
832         [Disable linkoo for the smoketest installation.]))
834 AC_ARG_ENABLE(lto,
835     AS_HELP_STRING([--enable-lto],
836         [Enable link-time optimization. Suitable for product builds.
837          Building takes longer but libraries are optimized for speed.
838          (possible only with gcc-4.5 or later,
839           better to use gcc-4.6 and 'gold' as linker)]))
841 AC_ARG_ENABLE(crashdump,
842     AS_HELP_STRING([--enable-crashdump],
843         [Enable the crashdump feature.]))
845 AC_ARG_ENABLE(python,
846     AS_HELP_STRING([--enable-python=<no/auto/system/internal>],
847         [Enables or disables Python support at run-time and build-time.
848          Also specifies what Python to use. 'auto' is the
849          default. Note that Python can be disabled with
850          --disable-python or --enable-python=no only if no
851          translations are required.]))
853 AC_ARG_ENABLE(gtk,
854     AS_HELP_STRING([--disable-gtk],
855         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
856 ,enable_gtk=yes)
858 AC_ARG_ENABLE(gtk3,
859     AS_HELP_STRING([--enable-gtk3],
860         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
861 ,enable_gtk3=no)
863 AC_ARG_ENABLE(systray,
864     AS_HELP_STRING([--disable-systray],
865         [Determines whether to build the systray quickstarter.]),
866 ,enable_systray=yes)
868 AC_ARG_ENABLE(split-app-modules,
869     AS_HELP_STRING([--enable-split-app-modules],
870         [Split file lists for app modules, e.g. base, calc.
871          Has effect only with make distro-pack-install]),
874 AC_ARG_ENABLE(split-opt-features,
875     AS_HELP_STRING([--enable-split-opt-features],
876         [Split file lists for some optional features, .e.g. pyuno, testtool.
877          Has effect only with make distro-pack-install]),
880 AC_ARG_ENABLE(cairo-canvas,
881 [  --disable-cairo-canvas  Determines whether to build the Cairo canvas on
882                           platforms where Cairo is available.
885 AC_ARG_ENABLE(opengl,
886     AS_HELP_STRING([--disable-opengl],
887         [Determines whether to build the OpenGL 3D slide transitions component.]))
889 AC_ARG_ENABLE(dbus,
890     AS_HELP_STRING([--disable-dbus],
891         [Determines whether to enable features that depend on dbus.
892          e.g. Presentation mode screensaver control, bluetooth presentation control]),
893 ,enable_dbus=yes)
895 AC_ARG_ENABLE(packagekit,
896     AS_HELP_STRING([--enable-packagekit],
897         [Determines whether to enable features using packagekit.
898          Right now that is auto font install]),
901 AC_ARG_ENABLE(sdremote,
902     AS_HELP_STRING([--disable-sdremote],
903         [Determines whether to enable Impress remote control.]),
904 ,enable_sdremote=yes)
906 AC_ARG_ENABLE(sdremote-bluetooth,
907     AS_HELP_STRING([--disable-sdremote-bluetooth],
908         [Determines whether to build sdremote with bluetooth support.
909          Requires dbus on Linux.]))
911 AC_ARG_ENABLE(gconf,
912     AS_HELP_STRING([--disable-gconf],
913         [Determines whether to use the GConf support.]),
914 ,enable_gconf=yes)
916 AC_ARG_ENABLE(gnome-vfs,
917     AS_HELP_STRING([--enable-gnome-vfs],
918         [Determines whether to use the Gnome Virtual Filing System on platforms
919          where that VFS is available.]),
920 ,enable_gnome_vfs=no)
922 AC_ARG_ENABLE(gio,
923     AS_HELP_STRING([--disable-gio],
924         [Determines whether to use the GIO support.]),
925 ,enable_gio=yes)
927 AC_ARG_ENABLE(telepathy,
928     AS_HELP_STRING([--enable-telepathy],
929         [Determines whether to enable Telepathy for collaboration.]),
930 ,enable_telepathy=no)
932 AC_ARG_ENABLE(tde,
933     AS_HELP_STRING([--enable-tde],
934         [Determines whether to use TQt/TDE vclplug on platforms where TQt and
935          TDE are available.]),
938 AC_ARG_ENABLE(tdeab,
939     AS_HELP_STRING([--disable-tdeab],
940         [Disable the TDE address book support.]),
942     if test "$enable_tde" = "yes"; then
943         enable_tdeab=yes
944     fi
947 AC_ARG_ENABLE(kde,
948     AS_HELP_STRING([--enable-kde],
949         [Determines whether to use Qt3/KDE3 vclplug on platforms where Qt3 and
950          KDE3 are available.]),
953 AC_ARG_ENABLE(kdeab,
954     AS_HELP_STRING([--disable-kdeab],
955         [Disable the KDE3 address book support.]),
957     if test "$enable_kde" = "yes"; then
958         enable_kdeab=yes
959     fi
962 AC_ARG_ENABLE(kde4,
963     AS_HELP_STRING([--enable-kde4],
964         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
965          KDE4 are available. May be used with --enable-kde if you want to support
966          both KDE3 and KDE4.]),
969 AC_ARG_ENABLE(headless,
970     AS_HELP_STRING([--enable-headless],
971         [Disable building of GUIs to reduce dependencies. Useful for
972         server usage. Work in progress, use only if you are hacking on
973         it. Not related to the --headless option.]), ,)
975 AC_ARG_ENABLE(rpath,
976     AS_HELP_STRING([--disable-rpath],
977         [Disable the use of relative paths in shared libraries.]),
980 AC_ARG_ENABLE(randr,
981     AS_HELP_STRING([--disable-randr],
982         [Disable RandR support in the vcl project.]),
983 ,enable_randr=yes)
985 AC_ARG_ENABLE(randr-link,
986     AS_HELP_STRING([--disable-randr-link],
987         [Disable linking with libXrandr, instead dynamically open it at runtime.]),
988 ,enable_randr_link=yes)
990 AC_ARG_ENABLE(gstreamer,
991     AS_HELP_STRING([--enable-gstreamer],
992         [Enable building with the new gstreamer 1.0 avmedia backend.]),
993 ,enable_gstreamer=no)
995 AC_ARG_ENABLE(gstreamer-0-10,
996     AS_HELP_STRING([--disable-gstreamer-0-10],
997         [Disable building the gstreamer avmedia backend.]),
998 ,enable_gstreamer_0_10=yes)
1000 AC_ARG_ENABLE(neon,
1001     AS_HELP_STRING([--disable-neon],
1002         [Disable neon and the compilation of webdav binding.]),
1005 AC_ARG_ENABLE(cve-tests,
1006     AS_HELP_STRING([--disable-cve-tests],
1007         [Prevent CVE tests to be executed]),
1010 AC_ARG_ENABLE(build-unowinreg,
1011     AS_HELP_STRING([--enable-build-unowinreg],
1012         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1013          compiler is needed on Linux.])
1014     [
1015                           Usage:     --enable-build-unowinreg
1016     ],
1019 AC_ARG_ENABLE(verbose,
1020     AS_HELP_STRING([--enable-verbose],
1021         [Increase build verbosity.])[
1022   --disable-verbose       Decrease build verbosity.],
1025 AC_ARG_ENABLE(dependency-tracking,
1026     AS_HELP_STRING([--enable-dependency-tracking],
1027         [Do not reject slow dependency extractors.])[
1028   --disable-dependency-tracking
1029                           Disables generation of dependency information.
1030                           Speed up one-time builds.],
1033 AC_ARG_ENABLE(icecream,
1034     AS_HELP_STRING([--enable-icecream],
1035         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1036          It defaults to /opt/icecream for the location of the icecream gcc/g++
1037          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1040 AC_ARG_ENABLE(cups,
1041     AS_HELP_STRING([--disable-cups],
1042         [Do not build cups support.])
1045 AC_ARG_ENABLE(ccache,
1046     AS_HELP_STRING([--disable-ccache],
1047         [Do not try to use ccache automatically.
1048          By default, we will try to detect if ccache is available; in that case if
1049          CC/CXX are not yet set, and --enable-icecream is not given, we
1050          attempt to use ccache. --disable-ccache disables ccache completely.
1054 AC_ARG_ENABLE(64-bit,
1055     AS_HELP_STRING([--enable-64-bit],
1056         [Build a 64-bit LibreOffice on platforms where the normal and only supported build
1057          is 32-bit. In other words, this option is experimental and possibly quite broken,
1058          use only if you are hacking on 64-bit support.]), ,)
1060 AC_ARG_ENABLE(extra-gallery,
1061     AS_HELP_STRING([--enable-extra-gallery],
1062         [Add extra gallery content.]),
1065 AC_ARG_ENABLE(extra-template,
1066     AS_HELP_STRING([--enable-extra-template],
1067         [Add extra template content.]),
1070 AC_ARG_ENABLE(extra-sample,
1071     AS_HELP_STRING([--enable-extra-sample],
1072         [Add extra sample content.]),
1075 AC_ARG_ENABLE(extra-font,
1076     AS_HELP_STRING([--enable-extra-font],
1077         [Add extra font content.]),
1080 AC_ARG_ENABLE(online-update,
1081     AS_HELP_STRING([--enable-online-update],
1082         [Enable the online update service that will check for new versions of
1083          LibreOffice. By default, it is on on Windows and Mac, and off on Linux.]),
1086 AC_ARG_ENABLE(release-build,
1087     AS_HELP_STRING([--enable-release-build],
1088         [Enable release build.
1089          See http://wiki.documentfoundation.org/DevBuild]),
1092 AC_ARG_ENABLE(windows-build-signing,
1093     AS_HELP_STRING([--enable-windows-build-signing],
1094         [Enable signing of windows binaries (*.exe, *.dll)]),
1097 AC_ARG_ENABLE(silent-msi,
1098     AS_HELP_STRING([--enable-silent-msi],
1099         [Enable MSI with LIMITUI=1 (silent install).]),
1102 AC_ARG_ENABLE(desktop-gui-elements,
1103     AS_HELP_STRING([--enable-desktop-gui-elements],
1104         [Enable display and use of desktop style GUI elements
1105          even on a non-desktop platform.]),
1108 AC_ARG_ENABLE(macosx-code-signing,
1109     AS_HELP_STRING([--enable-macosx-code-signing<=identity>],
1110         [Sign executables, dylibs, frameworks and the app bundle. The
1111          default is to do signing if there is a suitable certificate
1112          in your keychain, so if you don't want that, use the
1113          corresponding --disable option. Experimental work in
1114          progress, don't use unless you are working on this.]),
1117 AC_ARG_ENABLE(macosx-sandbox,
1118     AS_HELP_STRING([--enable-macosx-sandbox],
1119         [Make the app bundle run in a sandbox. Requires code signing.
1120          The default is to not do this. Experimental work in progress,
1121          don't use unless you are working on this.]),
1124 AC_ARG_WITH(macosx-bundle-identifier,
1125     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1126         [Define the OS X bundle identifier. Default is the somewhat weird
1127          org.libreoffice.script ("script", huh?).]),
1128 ,with_macosx_bundle_identifier=org.libreoffice.script)
1130 AC_ARG_ENABLE(ios-simulator,
1131     AS_HELP_STRING([--enable-ios-simulator],
1132         [Build for the iOS Simulator, not iOS device.]),
1135 AC_ARG_ENABLE(readonly-installset,
1136     AS_HELP_STRING([--enable-readonly-installset],
1137         [Prevents any attempts by LibreOffice to write into its installation. That means
1138          at least that no "system-wide" extensions can be added. Experimental work in
1139          progress.]),
1142 AC_ARG_ENABLE(postgresql-sdbc,
1143     AS_HELP_STRING([--disable-postgresql-sdbc],
1144         [Disable the build of the PostgreSQL-SDBC driver.])
1147 AC_ARG_ENABLE(lotuswordpro,
1148     AS_HELP_STRING([--disable-lotuswordpro],
1149         [Disable the build of the Lotus Word Pro filter.]),
1150 ,enable_lotuswordpro=yes)
1152 AC_ARG_ENABLE(coretext,
1153     AS_HELP_STRING([--enable-coretext],
1154         [Use CoreText framework on Mac (instead of ATSU).
1155         Known to not work properly, use only if you plan to work on that.]),
1158 AC_ARG_ENABLE(winegcc,
1159     AS_HELP_STRING([--enable-winegcc],
1160         [Enable use of winegcc during the build, in order to create msi* tools
1161          needed for MinGW cross-compilation.]),
1164 AC_ARG_ENABLE(liblangtag,
1165     AS_HELP_STRING([--disable-liblangtag],
1166         [Disable use of liblangtag, and instead use an own simple
1167          implementation.]),
1170 AC_ARG_ENABLE(bogus-pkg-config,
1171     AS_HELP_STRING([--enable-bogus-pkg-config],
1172         [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.]),
1175 AC_ARG_ENABLE(openssl,
1176     AS_HELP_STRING([--disable-openssl],
1177         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1178          components will either use GNUTLS or NSS. Work in progress,
1179          use only if you are hacking on it.]),
1180 ,enable_openssl=yes)
1182 dnl ===================================================================
1183 dnl Optional Packages (--with/without-)
1184 dnl ===================================================================
1186 AC_ARG_WITH(gnu-patch,
1187     AS_HELP_STRING([--with-gnu-patch],
1188         [Specify location of GNU patch on Solaris or FreeBSD.]),
1191 AC_ARG_WITH(build-platform-configure-options,
1192         [Specify options for the configure script run for the *build* platform in a cross-compilation])
1194 AC_ARG_WITH(gnu-cp,
1195     AS_HELP_STRING([--with-gnu-cp],
1196         [Specify location of GNU cp on Solaris or FreeBSD.]),
1199 AC_ARG_WITH(external-tar,
1200     AS_HELP_STRING([--with-external-tar=<TARFILE PATH>],
1201         [Specify path to tarfiles manually.]),
1202     TARFILE_LOCATION=$withval ,
1205 AC_ARG_WITH(solver-and-workdir-root,
1206     AS_HELP_STRING([--with-solver-and-workdir-root=<PATH>],
1207         [Specify path that contains SOLARVER and WORKDIR directories manually.])
1210 AC_ARG_WITH(referenced-git,
1211     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1212         [Specify another checkout directory to reference. This makes use of
1213                  git submodule update --reference, and saves a lot of diskspace
1214                  when having multiple trees side-by-side.]),
1215     GIT_REFERENCE_SRC=$withval ,
1218 AC_ARG_WITH(galleries,
1219     AS_HELP_STRING([--with-galleries],
1220         [Specify how galleries should be built. It is possible either to
1221          build these internally from source ("build"), or to (optionally
1222          download and) unpack them them from a package ("package"), or
1223          to disable them ("no")]),
1226 AC_ARG_WITH(theme,
1227     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1228         [Choose which themes to include. By default those themes with an '*' are included.
1229          Possible choices: *crystal, *default (galaxy), *hicontrast, human, industrial, *oxygen, *tango, *tango_testing.]),
1232 AC_ARG_WITH(helppack-integration,
1234   --without-helppack-integration      It will not integrate the helppacks to the installer
1235                           of the product.
1236                           Please use this switch to use the online help or separate help packages.],
1239 AC_ARG_WITH(fonts,
1240     AS_HELP_STRING([--without-fonts],
1241         [LibreOffice includes some third-party fonts to provide a reliable basis for
1242          help content, templates, samples, etc. When these fonts are already
1243          known to be available on the system then you should use this option.]),
1246 AC_ARG_WITH(ppds,
1247     AS_HELP_STRING([--without-ppds],
1248         [Removes Postscript Printer definition files from LibreOffice
1249          installation set, for people building for specific distributions where
1250          PPDs are known to be already available (every recent distro with CUPS backend).]),
1253 AC_ARG_WITH(afms,
1254     AS_HELP_STRING([--without-afms],
1255         [Removes bitmap font files from LibreOffice installation set, for people
1256          building for specific distributions where AFM files or TrueType Fonts
1257          are known to be available.]),
1260 AC_ARG_WITH(epm,
1261     AS_HELP_STRING([--with-epm],
1262         [Decides which epm to use. Default is to use the one from the system if
1263          one is built. When either this is not there or you say =internal epm
1264          will be built.]),
1267 AC_ARG_WITH(package-format,
1268     AS_HELP_STRING([--with-package-format],
1269         [Specify package format(s) for LibreOffice installsets. Default is the
1270          "normal" one of the OS/Distribution. Possible values: aix, bsd, deb,
1271          inst, tardist, osx, pkg, rpm, setld, native, portable, archive, dmg,
1272           installed, msi. Example: --with-package-format="deb dmg"]),
1275 AC_ARG_WITH(tls,
1276     AS_HELP_STRING([--with-tls],
1277         [Decides which TLS/SSL and cryptographic implementations to use for
1278          LibreOffice's code. Notice that this doesn't apply for depending
1279          libraries like "neon", for example. Default is to use OpenSSL
1280          although NSS is also possible. Notice that selecting NSS restricts
1281          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1282          restrict by now the usage of NSS in LO's code. Possible values:
1283          openssl, nss. Example: --with-tls="nss"]),
1286 AC_ARG_WITH(system-libs,
1287     AS_HELP_STRING([--with-system-libs],
1288         [Use libraries already on system -- enables all --with-system-* flags.]),
1291 AC_ARG_WITH(system-headers,
1292     AS_HELP_STRING([--with-system-headers],
1293         [Use headers already on system -- enables all --with-system-* flags for
1294          external packages whose headers are the only entities used i.e.
1295          boost/vigra/odbc/sane-header(s).]),,
1296     [with_system_headers="$with_system_libs"])
1298 AC_ARG_WITH(system-jars,
1299     AS_HELP_STRING([--without-system-jars],
1300         [When building with --with-system-libs, also the needed jars are expected
1301          on the system. Use this to disable that]),,
1302     [with_system_jars="$with_system_libs"])
1304 AC_ARG_WITH(system-cairo,
1305     AS_HELP_STRING([--with-system-cairo],
1306         [Use Cairo libraries already on system.]),,
1307     [with_system_cairo="$with_system_libs"])
1309 AC_ARG_WITH(myspell-dicts,
1310     AS_HELP_STRING([--with-myspell-dicts],
1311         [Adds myspell dictionaries to the LibreOffice installation set]),
1314 AC_ARG_WITH(system-dicts,
1315     AS_HELP_STRING([--without-system-dicts],
1316         [Do not use dictionaries from system paths.]),
1319 AC_ARG_WITH(external-dict-dir,
1320     AS_HELP_STRING([--with-external-dict-dir],
1321         [Specify external dictionary dir.]),
1324 AC_ARG_WITH(external-hyph-dir,
1325     AS_HELP_STRING([--with-external-hyph-dir],
1326         [Specify external hyphenation pattern dir.]),
1329 AC_ARG_WITH(external-thes-dir,
1330     AS_HELP_STRING([--with-external-thes-dir],
1331         [Specify external thesaurus dir.]),
1334 AC_ARG_WITH(system-zlib,
1335     AS_HELP_STRING([--with-system-zlib],
1336         [Use zlib already on system.]),,
1337     [with_system_zlib=auto])
1339 AC_ARG_WITH(system-jpeg,
1340     AS_HELP_STRING([--with-system-jpeg],
1341         [Use jpeg already on system.]),,
1342     [with_system_jpeg=auto])
1344 AC_ARG_WITH(system-clucene,
1345     AS_HELP_STRING([--with-system-clucene],
1346         [Use clucene already on system.]),,
1347     [with_system_clucene="$with_system_libs"])
1349 AC_ARG_WITH(system-expat,
1350     AS_HELP_STRING([--with-system-expat],
1351         [Use expat already on system.]),,
1352     [with_system_expat="$with_system_libs"])
1354 AC_ARG_WITH(system-libxml,
1355     AS_HELP_STRING([--with-system-libxml],
1356         [Use libxml/libxslt already on system.]),,
1357     [with_system_libxml=auto])
1359 AC_ARG_WITH(system-icu,
1360     AS_HELP_STRING([--with-system-icu],
1361         [Use icu already on system.]),,
1362     [with_system_icu="$with_system_libs"])
1364 AC_ARG_WITH(system-ucpp,
1365     AS_HELP_STRING([--with-system-ucpp],
1366         [Use ucpp already on system.]),,
1367     [])
1369 AC_ARG_WITH(system-openldap,
1370     AS_HELP_STRING([--with-system-openldap],
1371         [Use the OpenLDAP LDAP SDK already on system.]),,
1372     [with_system_openldap="$with_system_libs"])
1374 AC_ARG_WITH(system-poppler,
1375     AS_HELP_STRING([--with-system-poppler],
1376         [Use system poppler (only needed for PDF import).]),,
1377     [with_system_poppler="$with_system_libs"])
1379 AC_ARG_WITH(system-apache-commons,
1380     AS_HELP_STRING([--with-system-apache-commons],
1381         [Use Apache commons libraries already on system.]),,
1382     [with_system_apache_commons="$with_system_jars"])
1384 AC_ARG_WITH(system-mariadb,
1385     AS_HELP_STRING([--with-system-mariadb],
1386         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1387          extension.]),,
1388     [with_system_mariadb="$with_system_libs"])
1390 AC_ARG_WITH(system-mysql-cppconn,
1391     AS_HELP_STRING([--with-system-mysql-cppconn],
1392         [Use MySQL C++ Connector libraries already on system.]),,
1393     [with_system_mysql_cppconn="$with_system_libs"])
1395 AC_ARG_WITH(system-postgresql,
1396     AS_HELP_STRING([--with-system-postgresql],
1397         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1398          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1399     [with_system_postgresql="$with_system_libs"])
1401 AC_ARG_WITH(libpq-path,
1402     AS_HELP_STRING([--with-libpq-path],
1403         [Use this PostgreSQL C interface (libpq) installation for building
1404          the PostgreSQL-SDBC extension.])
1405     [
1406                           Usage:     --with-libpq-path=<absolute path to
1407                                                   your libpq installation>
1408     ],
1411 AC_ARG_WITH(system-hsqldb,
1412     AS_HELP_STRING([--with-system-hsqldb],
1413         [Use hsqldb already on system.]))
1415 AC_ARG_WITH(hsqldb-jar,
1416     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1417         [Specify path to jarfile manually.]),
1418     HSQLDB_JAR=$withval)
1420 AC_ARG_ENABLE(scripting-beanshell,
1421     AS_HELP_STRING([--disable-scripting-beanshell],
1422         [Disable support for scripts in BeanShell.]),
1426 AC_ARG_WITH(system-beanshell,
1427     AS_HELP_STRING([--with-system-beanshell],
1428         [Use beanshell already on system.]),,
1429     [with_system_beanshell="$with_system_jars"])
1431 AC_ARG_WITH(beanshell-jar,
1432     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1433         [Specify path to jarfile manually.]),
1434     BSH_JAR=$withval)
1436 AC_ARG_ENABLE(scripting-javascript,
1437     AS_HELP_STRING([--disable-scripting-javascript],
1438         [Disable support for scripts in JavaScript.]),
1442 AC_ARG_WITH(system-rhino,
1443     AS_HELP_STRING([--with-system-rhino],
1444         [Use rhino already on system.]),,)
1445 #    [with_system_rhino="$with_system_jars"])
1446 # Above is not used as we have different debug interface
1447 # patched into internal rhino. This code needs to be fixed
1448 # before we can enable it by default.
1450 AC_ARG_WITH(rhino-jar,
1451     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1452         [Specify path to jarfile manually.]),
1453     RHINO_JAR=$withval)
1455 AC_ARG_WITH(commons-codec-jar,
1456     AS_HELP_STRING([--with-commons-codec-jar=JARFILE],
1457         [Specify path to jarfile manually.]),
1458     COMMONS_CODEC_JAR=$withval)
1460 AC_ARG_WITH(commons-lang-jar,
1461     AS_HELP_STRING([--with-commons-lang-jar=JARFILE],
1462         [Specify path to jarfile manually.]),
1463     COMMONS_LANG_JAR=$withval)
1465 AC_ARG_WITH(commons-httpclient-jar,
1466     AS_HELP_STRING([--with-commons-httpclient-jar=JARFILE],
1467         [Specify path to jarfile manually.]),
1468     COMMONS_HTTPCLIENT_JAR=$withval)
1470 AC_ARG_WITH(commons-logging-jar,
1471     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1472         [Specify path to jarfile manually.]),
1473     COMMONS_LOGGING_JAR=$withval)
1475 AC_ARG_WITH(system-servlet-api,
1476     AS_HELP_STRING([--with-system-servlet-api],
1477         [Use servlet-api already on system.]),,
1478     [with_system_servlet_api="$with_system_jars"])
1480 AC_ARG_WITH(servlet-api-jar,
1481     AS_HELP_STRING([--with-servlet-api-jar=JARFILE],
1482         [Specify path to jarfile manually.]),
1483     SERVLETAPI_JAR=$withval)
1485 AC_ARG_WITH(system-jfreereport,
1486     AS_HELP_STRING([--with-system-jfreereport],
1487         [Use JFreeReport already on system.]),,
1488     [with_system_jfreereport="$with_system_jars"])
1490 AC_ARG_WITH(sac-jar,
1491     AS_HELP_STRING([--with-sac-jar=JARFILE],
1492         [Specify path to jarfile manually.]),
1493     SAC_JAR=$withval)
1495 AC_ARG_WITH(libxml-jar,
1496     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1497         [Specify path to jarfile manually.]),
1498     LIBXML_JAR=$withval)
1500 AC_ARG_WITH(flute-jar,
1501     AS_HELP_STRING([--with-flute-jar=JARFILE],
1502         [Specify path to jarfile manually.]),
1503     FLUTE_JAR=$withval)
1505 AC_ARG_WITH(jfreereport-jar,
1506     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1507         [Specify path to jarfile manually.]),
1508     JFREEREPORT_JAR=$withval)
1510 AC_ARG_WITH(liblayout-jar,
1511     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1512         [Specify path to jarfile manually.]),
1513     LIBLAYOUT_JAR=$withval)
1515 AC_ARG_WITH(libloader-jar,
1516     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1517         [Specify path to jarfile manually.]),
1518     LIBLOADER_JAR=$withval)
1520 AC_ARG_WITH(libloader-jar,
1521     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1522         [Specify path to jarfile manually.]),
1523     LIBLOADER_JAR=$withval)
1525 AC_ARG_WITH(libformula-jar,
1526     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1527         [Specify path to jarfile manually.]),
1528     LIBFORMULA_JAR=$withval)
1530 AC_ARG_WITH(librepository-jar,
1531     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1532         [Specify path to jarfile manually.]),
1533     LIBREPOSITORY_JAR=$withval)
1535 AC_ARG_WITH(libfonts-jar,
1536     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1537         [Specify path to jarfile manually.]),
1538     LIBFONTS_JAR=$withval)
1540 AC_ARG_WITH(libserializer-jar,
1541     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1542         [Specify path to jarfile manually.]),
1543     LIBSERIALIZER_JAR=$withval)
1545 AC_ARG_WITH(libbase-jar,
1546     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1547         [Specify path to jarfile manually.]),
1548     LIBBASE_JAR=$withval)
1550 AC_ARG_WITH(system-odbc,
1551     AS_HELP_STRING([--with-system-odbc],
1552         [Use the odbc headers already on system.]),,
1553     [with_system_odbc="$with_system_headers"])
1555 AC_ARG_WITH(system-sane,
1556     AS_HELP_STRING([--with-system-sane],
1557         [Use sane.h already on system.]),,
1558     [with_system_sane="$with_system_headers"])
1560 AC_ARG_WITH(system-bluez,
1561     AS_HELP_STRING([--with-system-bluez],
1562         [Use bluetooth.h already on system.]),,
1563     [with_system_bluez="$with_system_headers"])
1565 AC_ARG_WITH(system-xextensions-headers,
1566     AS_HELP_STRING([--with-system-xextensions-headers],
1567         [To build without system X11 extensions headers, use
1568          --without-system-xextensions-headers. This is possibly
1569          useful on legacy unix systems which ship with the libs
1570          but without the headers.]))
1572 AC_ARG_WITH(system-mesa-headers,
1573     AS_HELP_STRING([--with-system-mesa-headers],
1574         [Use Mesa headers already on system.]),,
1575     [with_system_mesa_headers="$with_system_headers"])
1577 AC_ARG_WITH(system-curl,
1578     AS_HELP_STRING([--with-system-curl],
1579         [Use curl already on system.]),,
1580     [with_system_curl=auto])
1582 AC_ARG_WITH(system-boost,
1583     AS_HELP_STRING([--with-system-boost],
1584         [Use boost already on system.]),,
1585     [with_system_boost="$with_system_headers"])
1587 AC_ARG_WITH(system-vigra,
1588     AS_HELP_STRING([--with-system-vigra],
1589         [Use vigra already on system.]),,
1590     [with_system_vigra="$with_system_headers"])
1592 AC_ARG_WITH(system-hunspell,
1593     AS_HELP_STRING([--with-system-hunspell],
1594         [Use libhunspell already on system.]),,
1595     [with_system_hunspell="$with_system_libs"])
1597 AC_ARG_WITH(system-mythes,
1598     AS_HELP_STRING([--with-system-mythes],
1599         [Use mythes already on system.]),,
1600     [with_system_mythes="$with_system_libs"])
1602 AC_ARG_WITH(system-altlinuxhyph,
1603     AS_HELP_STRING([--with-system-altlinuxhyph],
1604         [Use ALTLinuxhyph already on system.]),,
1605     [with_system_altlinuxhyph="$with_system_libs"])
1607 AC_ARG_WITH(system-lpsolve,
1608     AS_HELP_STRING([--with-system-lpsolve],
1609         [Use lpsolve already on system.]),,
1610     [with_system_lpsolve="$with_system_libs"])
1612 AC_ARG_WITH(system-liblangtag,
1613     AS_HELP_STRING([--with-system-liblangtag],
1614         [Use liblangtag library already on system.]),,
1615     [with_system_liblangtag="$with_system_libs"])
1617 AC_ARG_WITH(system-npapi-headers,
1618     AS_HELP_STRING([--with-system-npapi-headers],
1619         [Use NPAPI headers provided by system instead of bundled ones. Used in
1620          extensions/source/nsplugin (ENABLE_NPAPI_INTO_BROWSER=YES) and
1621          extensions/source/plugin (ENABLE_NPAPI_FROM_BROWSER=YES)]),,
1622     [with_system_npapi_headers="$with_system_headers"]
1625 AC_ARG_WITH(linker-hash-style,
1626     AS_HELP_STRING([--with-linker-hash-style],
1627         [Use linker with --hash-style=<style> when linking shared objects.
1628          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1629          if supported on the build system, and "sysv" otherwise.]))
1631 AC_ARG_WITH(jdk-home,
1632     AS_HELP_STRING([--with-jdk-home],
1633         [If you have installed JDK 1.3 or later on your system please supply the
1634          path here. Note that this is not the location of the java command but the
1635          location of the entire distribution.])
1636     [
1637                           Usage:     --with-jdk-home=<absolute path to JDK home>
1638     ],
1641 AC_ARG_WITH(help,
1642     AS_HELP_STRING([--with-help],
1643         [Enable the build of help.]))
1645 AC_ARG_WITH(java,
1646     AS_HELP_STRING([--with-java],
1647         [Specify the name of the Java interpreter command. Typically "java"
1648          which is the default.
1650          To build without support for Java components, applets, accessibility
1651          or the XML filters written in Java, use --without-java or --with-java=no.])
1652     [
1653                           Usage:     --with-java==<java command>
1654                                      --without-java
1655     ],
1656     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1657     [ with_java=java ]
1660 AC_ARG_WITH(jvm-path,
1661     AS_HELP_STRING([--with-jvm-path],
1662         [Use a specific JVM search path at runtime.])
1663     [
1664                           Usage:     --with-jvm-path=<absolute path to parent of jvm home>
1666                           e. g.: --with-jvm-path=/usr/lib/
1667                                  to find JRE/JDK in /usr/lib/jvm/
1668     ],
1671 AC_ARG_WITH(ant-home,
1672     AS_HELP_STRING([--with-ant-home],
1673         [If you have installed Jakarta Ant on your system, please supply the path here.
1674          Note that this is not the location of the Ant binary but the location
1675          of the entire distribution.])
1676     [
1677                           Usage:     --with-ant-home=<absolute path to Ant home>
1678     ],
1681 AC_ARG_WITH(junit,
1682     AS_HELP_STRING([--with-junit],
1683         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
1684          --without-junit disables those tests. Not relevant in the --without-java case.])
1685     [
1686                           Usage:     --with-junit=<absolute path to JUnit 4 jar>
1687     ],
1688 ,with_junit=yes)
1690 AC_ARG_WITH(perl-home,
1691     AS_HELP_STRING([--with-perl-home],
1692         [If you have installed Perl 5 Distribution, on your system, please
1693          supply the path here. Note that this is not the location of the Perl
1694          binary but the location of the entire distribution.])
1695     [
1696                           Usage:     --with-perl-home=<abs. path to Perl 5 home>
1697     ],
1700 AC_ARG_WITH(
1701     [doxygen],
1702     AS_HELP_STRING(
1703         [--with-doxygen],
1704         [Specifies the doxygen executable to use when generating ODK C/C++
1705          documentation. --without-doxygen disables generation of ODK C/C++
1706          documentation. Not relevant in the --disable-odk case.])
1707     [
1708                           Usage:     --with-doxygen=<absolute path to doxygen executable>
1709     ],,
1710     [with_doxygen=yes])
1712 AC_ARG_WITH(visual-studio,
1713     AS_HELP_STRING([--with-visual-studio=<2012/2010/2008>],
1714         [Specify which Visual Studio version to use in case several are
1715          are installed. If not specified, the order of preference is
1716          2012, 2010 and 2008 (including Express editions).])
1717     [
1718                           Usage:     --with-visual-studio=<2012/2010/2008>
1719     ],
1722 AC_ARG_WITH(windows-sdk,
1723     AS_HELP_STRING([--with-windows-sdk=<6.0(A)/7.0(A)/7.1(A)/8.0(A)>],
1724         [Specify which Windows SDK, or "Windows Kit", version to use
1725          in case the one that came with the selected Visual Studio
1726          is not what you want for some reason. Note that not all compiler/SDK
1727          combinations are supported. The intent is that this option should not
1728          be needed.])
1729     [
1730                           Usage:     --with-windows-sdk=6.0(A)/7.0(A)/7.1(A)/8.0(A)>
1731     ],
1734 AC_ARG_WITH(lang,
1735     AS_HELP_STRING([--with-lang],
1736         [Use this option to build LibreOffice with additional language support.
1737          English (US) is always included by default.
1738          Separate multiple languages with space.
1739          For all languages, use --with-lang=ALL.])
1740     [
1741                           Usage:     --with-lang="es sw tu cs sk"
1742     ],
1745 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
1746 AC_ARG_WITH(krb5,
1747     AS_HELP_STRING([--with-krb5],
1748         [Enable MIT Kerberos 5 support in modules that support it.
1749          By default automatically enabled on platforms
1750          where a good system Kerberos 5 is available.]),
1753 AC_ARG_WITH(gssapi,
1754     AS_HELP_STRING([--with-gssapi],
1755         [Enable GSSAPI support in modules that support it.
1756          By default automatically enabled on platforms
1757          where a good system GSSAPI is available.]),
1760 dnl ===================================================================
1761 dnl Branding
1762 dnl ===================================================================
1764 AC_ARG_WITH(branding,
1765     AS_HELP_STRING([--with-branding],
1766         [Use given path to retrieve branding images set.])
1767     [
1768                           Search for intro.png about.svg flat_logo.svg 
1769                           backing_left.png backing_right.png 
1770                           backing_rtl_left.png backing_rtl_right.png 
1771                           backing_space.png. If any is missing, default
1772                           ones will be used instead.
1774                           Search also progress.conf for progress 
1775                           settings on intro screen :
1777                           PROGRESSBARCOLOR="255,255,255" Set color of 
1778                           progress bar. Comma separated RGB decimal values.
1779                           PROGRESSSIZE="407,6" Set size of progress bar. 
1780                           Comma separated decimal values (width, height).
1781                           PROGRESSPOSITION="61,317" Set position of progress
1782                           bar from left,top. Comma separated decimal values.
1783                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
1784                           bar frame. Comma separated RGB decimal values.
1785                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress 
1786                           bar text. Comma separated RGB decimal values.
1787                           PROGRESSTEXTBASELINE="287" Set vertical position of 
1788                           progress bar text from top. Decimal value.
1790                           Default values will be used if not found.
1792                           Usage:     --with-branding=/path/to/images
1793     ],
1797 AC_ARG_WITH(extra-buildid,
1798     AS_HELP_STRING([--with-extra-buildid],
1799         [Show addition build identification in about dialog.])
1800     [
1801                           Usage:     --with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"
1802     ],
1806 AC_ARG_WITH(vendor,
1807     AS_HELP_STRING([--with-vendor],
1808         [Set vendor of the build.])
1809     [
1810                           Usage:     --with-vendor="John the Builder"
1811     ],
1814 AC_ARG_WITH(compat-oowrappers,
1815     AS_HELP_STRING([--with-compat-oowrappers],
1816         [Install oo* wrappers in parallel with
1817          lo* ones to keep backward compatibility.
1818          Has effect only with make distro-pack-install]),
1821 AC_ARG_WITH(os-version,
1822     AS_HELP_STRING([--with-os-version],
1823         [For FreeBSD users, use this option option to override the detected OSVERSION.])
1824     [
1825                           Usage:     --with-os-version=<OSVERSION>
1826     ],
1829 AC_ARG_WITH(mingw-cross-compiler,
1830     AS_HELP_STRING([--with-mingw-cross-compiler],
1831         [Specify the MinGW cross-compiler to use.])
1832     [
1833                           Usage:     --with-mingw-cross-compiler=<mingw32-g++ command>
1835                           When building on the ODK on Unix and building unowinreg.dll,
1836                           specify the MinGW C++ cross-compiler.
1837     ],
1840 AC_ARG_WITH(idlc-cpp,
1841     AS_HELP_STRING([--with-idlc-cpp],
1842         [Specify the C Preprocessor to use for idlc.])
1843     [
1844                           Usage:     --with-idlc-cpp=cpp
1846                           Default is ucpp.
1847     ]
1850 AC_ARG_WITH(build-version,
1851     AS_HELP_STRING([--with-build-version],
1852         [Allows the builder to add a custom version tag that will appear in the
1853          Help/About box for QA purposes.])
1854     [
1855                           Usage:     --with-build-version="Built by Jim"
1856     ],
1857     with_build_version=$withval ,
1860 AC_ARG_WITH(alloc,
1861     AS_HELP_STRING([--with-alloc],
1862         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
1863          Note that on FreeBSD/NetBSD system==jemalloc]),
1866 AC_ARG_WITH(sun-templates,
1867     AS_HELP_STRING([--with-sun-templates],
1868         [Integrate Sun template packages.]),
1871 AC_ARG_WITH(parallelism,
1872     AS_HELP_STRING([--with-parallelism],
1873         [Number of jobs to run simultaneously during build. Parallel builds can
1874         save a lot of time on multi-cpu machines. Defaults to the number of
1875         CPUs on the machine, unless you configure --enable-icecream - then to
1876         10.]),
1879 AC_ARG_WITH(check-jobs,
1880     AS_HELP_STRING([--with-check-jobs],
1881         [Maximum number of jobs that will be issued at the same time during 'make subsequenttest'.
1882          Default value is the same as 'parallelism'. Useful because the subsequent tests are very lightweight.]),
1885 AC_ARG_WITH(all-tarballs,
1886     AS_HELP_STRING([--with-all-tarballs],
1887         [Download all external tarballs unconditionally]))
1889 dnl ===================================================================
1890 dnl Test whether build target is Release Build
1891 dnl ===================================================================
1892 AC_MSG_CHECKING([whether build target is Release Build])
1893 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
1894     AC_MSG_RESULT([no])
1895     ENABLE_RELEASE_BUILD="FALSE"
1896 else
1897     AC_MSG_RESULT([yes])
1898     ENABLE_RELEASE_BUILD="TRUE"
1900 AC_SUBST(ENABLE_RELEASE_BUILD)
1902 dnl ===================================================================
1903 dnl Test whether to sign Windows Build
1904 dnl ===================================================================
1905 AC_MSG_CHECKING([whether to sign windows build])
1906 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT" -a "$WITH_MINGW" != "YES" ; then
1907     AC_MSG_RESULT([yes])
1908     WINDOWS_BUILD_SIGNING="TRUE"
1909 else
1910     AC_MSG_RESULT([no])
1911     WINDOWS_BUILD_SIGNING="FALSE"
1913 AC_SUBST(WINDOWS_BUILD_SIGNING)
1915 dnl ===================================================================
1916 dnl MacOSX build and runtime environment options
1917 dnl ===================================================================
1919 AC_ARG_WITH(macosx-sdk,
1920     AS_HELP_STRING([--with-macosx-sdk],
1921         [Use a specific SDK for building.])
1922     [
1923                           Usage:     --with-macosx-sdk=<version>
1925                           e. g.: --with-macosx-sdk=10.6
1927                           there are 3 options to control the MacOSX build:
1928                           --with-macosx-sdk (refered as 'sdk' below)
1929                           --with-macosx-version-min-required (refered as 'min' below)
1930                           --with-macosx-version-max-allowed (refered as 'max' below)
1932                           the connection between these value and the default they take is as follow:
1933                           ( ? means not specified on the command line, s means the SDK version found,
1934                           constraint: x <= y <= z)
1936                           ==========================================
1937                            command line      || config result
1938                           ==========================================
1939                           min  | max  | sdk  || min  | max  | sdk  |
1940                           ?    | ?    | ?    || 10.6 | 10.s | 10.s |
1941                           ?    | ?    | 10.x || 10.6 | 10.x | 10.x |
1942                           ?    | 10.x | ?    || 10.6 | 10.s | 10.s |
1943                           ?    | 10.x | 10.y || 10.6 | 10.x | 10.y |
1944                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
1945                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
1946                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
1947                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
1950                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
1951                           for a detailled technical explanation of these variables
1953                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
1955                           Note that even if in theory using a --with-macosx-version-max-allowed
1956                           (i.e. the MAC_OS_X_VERSION_MAX_ALLOWED macro) less than the SDK version
1957                           should work, in practice Apple doesn't seem to test that, and at least
1958                           compiling with -DMAC_OS_X_VERSION_MAX_ALLOWED=1060 against the 10.7 SDK
1959                           fails in a couple of places. Just because of oversights in ifdefs in the SDK
1960                           headers, but still.
1961     ],
1964 AC_ARG_WITH(macosx-version-min-required,
1965     AS_HELP_STRING([--with-macosx-version-min-required],
1966         [set the minimum OS version needed to run the built LibreOffice])
1967     [
1968                           Usage:     --with-macosx-version-min-required=<version>
1970                           e. g.: --with-macos-version-min-required=10.6
1971                           see --with-macosx-sdk for more info
1972     ],
1975 AC_ARG_WITH(macosx-version-max-allowed,
1976     AS_HELP_STRING([--with-macosx-version-max-allowed],
1977         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
1978     [
1979                           Usage:     --with-macosx-version-max-allowed=<version>
1981                           e. g.: --with-macos-version-max-allowed=10.6
1982                           see --with-macosx-sdk for more info
1983     ],
1987 dnl ===================================================================
1988 dnl options for stuff used during cross-compilation build
1989 dnl These are superseded by --with-build-platform-configure-options.
1990 dnl Or are they? Look for the complicated tests for "$cross_compiling" = "yes" -a \(
1991 dnl "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \)
1992 dnl far below. Could whoever understands MinGW cross-compilation clean up this please.
1993 dnl ===================================================================
1995 AC_ARG_WITH(system-boost-for-build,
1996     AS_HELP_STRING([--with-system-boost-for-build],
1997         [Use boost already on system for build tools (cross-compilation only).]))
1999 AC_ARG_WITH(system-cppunit-for-build,
2000     AS_HELP_STRING([--with-system-cppunit-for-build],
2001         [Use cppunit already on system for build tools (cross-compilation only).]))
2003 AC_ARG_WITH(system-expat-for-build,
2004     AS_HELP_STRING([--with-system-expat-for-build],
2005         [Use expat already on system for build tools (cross-compilation only).]))
2007 AC_ARG_WITH(system-icu-for-build,
2008     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2009         [Use icu already on system for build tools (cross-compilation only).]))
2011 AC_ARG_WITH(system-libxml-for-build,
2012     AS_HELP_STRING([--with-system-libxml-for-build],
2013         [Use libxml/libxslt already on system for build tools (cross-compilation only).]))
2016 dnl ===================================================================
2017 dnl check for required programs (grep, awk, sed, bash)
2018 dnl ===================================================================
2020 pathmunge ()
2022     if test -n "$1"; then
2023         if test "$build_os" = "cygwin"; then
2024             PathFormat "$1"
2025             new_path=`cygpath -u "$formatted_path"`
2026         else
2027             new_path="$1"
2028         fi
2029         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2030             if test "$2" = "after"; then
2031                 LO_PATH="$LO_PATH:$new_path"
2032             else
2033                 LO_PATH="$new_path:$LO_PATH"
2034             fi
2035         fi
2036         unset new_path
2037     fi
2040 AC_PROG_AWK
2041 AC_PATH_PROG( AWK, $AWK)
2042 if test -z "$AWK"; then
2043     AC_MSG_ERROR([install awk to run this script])
2046 AC_PATH_PROG(BASH, bash)
2047 if test -z "$BASH"; then
2048     AC_MSG_ERROR([bash not found in \$PATH])
2050 AC_SUBST(BASH)
2052 AC_MSG_CHECKING([for GNU or BSD tar])
2053 for a in $GNUTAR gtar gnutar tar /usr/sfw/bin/gtar; do
2054     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2055     if test $? -eq 0;  then
2056         GNUTAR=$a
2057         break
2058     fi
2059 done
2060 AC_MSG_RESULT($GNUTAR)
2061 if test -z "$GNUTAR"; then
2062     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2064 AC_SUBST(GNUTAR)
2066 AC_MSG_CHECKING([for tar's option to strip components])
2067 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2068 if test $? -eq 0; then
2069     STRIP_COMPONENTS="--strip-components"
2070 else
2071     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2072     if test $? -eq 0; then
2073         STRIP_COMPONENTS="--strip-path"
2074     else
2075         STRIP_COMPONENTS="unsupported"
2076     fi
2078 AC_MSG_RESULT($STRIP_COMPONENTS)
2079 if test x$STRIP_COMPONENTS == xunsupported; then
2080     AC_MSG_ERROR([you need a tar that is able to strip components.])
2082 AC_SUBST(STRIP_COMPONENTS)
2084 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2085 dnl desktop OSes from "mobile" ones.
2087 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2088 dnl In other words, that when building for an OS that is not a
2089 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2091 dnl Note the direction of the implication; there is no assumption that
2092 dnl cross-compiling would imply a non-desktop OS.
2094 if test $_os != iOS -a $_os != Android; then
2095     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2096     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2097     AC_DEFINE(HAVE_FEATURE_DESKTOP_GUI_ELEMENTS)
2098     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2099 elif test "$enable_desktop_gui_elements" = yes; then
2100     AC_DEFINE(HAVE_FEATURE_DESKTOP_GUI_ELEMENTS)
2103 DISABLE_EXPORT=''
2104 if test "$enable_export" != no; then
2105     BUILD_TYPE="$BUILD_TYPE EXPORT"
2106 else
2107     DISABLE_EXPORT='TRUE'
2108     SCPDEFS="$SCPDES -DDISABLE_EXPORT"
2110 AC_SUBST(DISABLE_EXPORT)
2112 dnl Decide whether to build database connectivity stuff (including
2113 dnl Base) or not. We probably don't want to on non-desktop OSes.
2115 if test -z "$enable_database_connectivity"; then
2116     # Do enable database connectivity for Android for now as otherwise
2117     # we presumably will get linking errors... We are not as far in
2118     # the work for iOS, so we might as well disable it for iOS already.
2120     # And actually, do enable it for iOS, too. Let's get back to
2121     # figuring out what to do with this later, if ever.
2123     # (Note that with "enable", I mean "enable building the related
2124     # code". Very likely little of it will make any sense at run-time
2125     # on Android or iOS and won't even be shipped with/linked into any
2126     # app.)
2128     #if test $_os != iOS; then
2129         enable_database_connectivity=yes
2130     #fi
2133 DISABLE_DBCONNECTIVITY=''
2134 if test "$enable_database_connectivity" = yes; then
2135     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2136 else
2137     DISABLE_DBCONNECTIVITY='TRUE'
2138     SCPDEFS="$SCPDEFS -DDISABLE_DBCONNECTIVITY"
2140 AC_SUBST(DISABLE_DBCONNECTIVITY)
2142 if test -z "$enable_extensions"; then
2143     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2144     if test $_os != iOS -a $_os != Android; then
2145         enable_extensions=yes
2146     fi
2149 if test "$enable_extensions" = yes; then
2150     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2151     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2154 if test -z "$enable_scripting"; then
2155     # Disable scripting for iOS unless specifically overridden
2156     # with --enable-scripting.
2157     if test $_os != iOS; then
2158         enable_scripting=yes
2159     fi
2162 DISABLE_SCRIPTING=''
2163 if test "$enable_scripting" = yes; then
2164     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2165 else
2166     DISABLE_SCRIPTING='TRUE'
2167     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2169 AC_SUBST(DISABLE_SCRIPTING)
2171 if test $_os = iOS -o $_os = Android; then
2172     # Disable dynamic_loading always for iOS and Android
2173     enable_dynamic_loading=no
2174 elif test -z "$enable_dynamic_loading"; then
2175     # Otherwise enable it unless speficically disabled
2176     enable_dynamic_loading=yes
2179 DISABLE_DYNLOADING=''
2180 if test "$enable_dynamic_loading" = yes; then
2181     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2182 else
2183     DISABLE_DYNLOADING='TRUE'
2184     SCPDEFS="$SCPDEFS -DDISABLE_DYNLOADING"
2186 AC_SUBST(DISABLE_DYNLOADING)
2188 if test -n "${with_solver_and_workdir_root}"; then
2189     if ! test -d ${with_solver_and_workdir_root}; then
2190       AC_MSG_ERROR([directory does not exist: ${with_solver_and_workdir_root}])
2191     fi
2192     PathFormat "${with_solver_and_workdir_root}"
2193     # IsValidFilePath in /sal/osl/w32/file_url.cxx rejects "X:\\" breaking idlc
2194     if echo ${formatted_path} | $GREP -q '/$'; then
2195         SOLARVER=${formatted_path}solver
2196     else
2197         SOLARVER=${formatted_path}/solver
2198     fi
2199 else
2200     SOLARVER=${BUILDDIR}/solver
2203 # remenber SYSBASE value
2204 AC_SUBST(SYSBASE)
2206 dnl ===================================================================
2207 dnl  Sort out various gallery compilation options
2208 dnl ===================================================================
2209 AC_MSG_CHECKING([how to build and package galleries])
2210 if test -n "${with_galleries}"; then
2211     if test "$with_galleries" = "build"; then
2212         WITH_GALLERY_BUILD=YES
2213         AC_MSG_RESULT([build from source images internally])
2214     elif test "$with_galleries" = "package"; then
2215         WITH_GALLERY_BUILD=PACKAGE
2216         AC_MSG_ERROR([FIXME - implement build from pre-compiled package])
2217     elif test "$with_galleries" = "no"; then
2218         WITH_GALLERY_BUILD=
2219         AC_MSG_RESULT([disable non-internal gallery build])
2220     else
2221         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2222     fi
2223 else
2224    if test $_os != iOS -a $_os != Android -a $_os != Darwin; then
2225         WITH_GALLERY_BUILD=YES
2226         AC_MSG_RESULT([internal src images for desktop])
2227    else
2228         WITH_GALLERY_BUILD=
2229         AC_MSG_RESULT([disable src imgage build])
2230    fi
2232 AC_SUBST(WITH_GALLERY_BUILD)
2234 dnl ===================================================================
2235 dnl  Checks if ccache is available
2236 dnl ===================================================================
2237 if test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2238     case "%$CC%$CXX%" in
2239     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some verison number etc),
2240     # assume that's good then
2241     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2242         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2243         ;;
2244     *)
2245         AC_PATH_PROG([CCACHE],[ccache],[not found])
2246         if test "$CCACHE" = "not found"; then
2247             CCACHE=""
2248         else
2249             # Need to check for ccache version: otherwise prevents
2250             # caching of the results (like "-x objective-c++" for Mac)
2251             if test $_os = Darwin -o $_os = iOS; then
2252                 # Check ccache version
2253                 AC_MSG_CHECKING([whether version of ccache is suitable])
2254                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2255                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2256                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2257                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2258                 else
2259                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2260                     CCACHE=""
2261                 fi
2262             fi
2263         fi
2264         ;;
2265     esac
2266 else
2267     CCACHE=""
2270 if test "$CCACHE" != ""; then
2271     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2272     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2273     if test "$ccache_size" = ""; then
2274         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2275         if test "$ccache_size" = ""; then
2276             ccache_size=0
2277         fi
2278         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2279         if test $ccache_size -lt 1024; then
2280             CCACHE=""
2281             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-producive: Disabling auto-ccache detection])
2282             add_warning "ccache's cache size is less than 1GB using it is counter-producive: auto-ccache detection disabled"
2283         else
2284             # warn that ccache may be too small for debug build
2285             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build])
2286             add_warning "ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build"
2287         fi
2288     else
2289         if test $ccache_size -lt 5; then
2290             #warn that ccache may be too small for debug build
2291             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build])
2292             add_warning "ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build"
2293         fi
2294     fi
2297 dnl ===================================================================
2298 dnl  Checks for C compiler,
2299 dnl  The check for the C++ compiler is later on.
2300 dnl ===================================================================
2301 if test "$_os" != "WINNT" -a "$WITH_MINGW" != "yes"; then
2302     GCC_HOME_SET="true"
2303     AC_MSG_CHECKING([gcc home])
2304     if test -z "$with_gcc_home"; then
2305         if test "$enable_icecream" = "yes"; then
2306             if test -d "/usr/lib/icecc/bin"; then
2307                 GCC_HOME="/usr/lib/icecc/"
2308             else
2309                 GCC_HOME="/opt/icecream/"
2310             fi
2311         else
2312             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2313             GCC_HOME_SET="false"
2314         fi
2315     else
2316         GCC_HOME="$with_gcc_home"
2317     fi
2318     AC_MSG_RESULT($GCC_HOME)
2319     AC_SUBST(GCC_HOME)
2321     if test "$GCC_HOME_SET" = "true"; then
2322         if test -z "$CC"; then
2323             CC="$GCC_HOME/bin/gcc"
2324         fi
2325         if test -z "$CXX"; then
2326             CXX="$GCC_HOME/bin/g++"
2327         fi
2328     fi
2331 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
2332 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
2333     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
2334     save_CFLAGS=$CFLAGS
2335     AC_PROG_CC
2336     CFLAGS=$save_CFLAGS
2339 COMPATH=`dirname "$CC"`
2340 if test "$COMPATH" = "."; then
2341     AC_PATH_PROGS(COMPATH, $CC)
2342     dnl double square bracket to get single because of M4 quote...
2343     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2345 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2347 dnl ===================================================================
2348 dnl  Test the Solaris compiler version
2349 dnl ===================================================================
2350 if test "$_os" = "SunOS"; then
2351     if test "$CC" = "cc"; then
2352         AC_PATH_PROGS(_cc, cc)
2353         COMPATH=`echo $_cc | $SED -n "s/\/bin\/cc//p"`
2354         AC_MSG_CHECKING([the SunStudio C/C++ compiler version])
2355         dnl cc -V outputs to standard error!!!!
2356         _sunstudio_string=`$CC -V 2>&1 | grep '^cc' | $SED -e 's/.* C //'`
2357         _sunstudio_version=`echo $_sunstudio_string | $AWK '{ print $1 }'`
2358         _sunstudio_major=`echo $_sunstudio_version | $AWK -F. '{ print $1 }'`
2359         if test "$_sunstudio_major" != "5"; then
2360             AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2361         else
2362             _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" }'`
2363             if test "$_sunstudio_minor" = "false"; then
2364                 AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2365             else
2366                 dnl compiler will do
2367                 AC_MSG_RESULT([checked])
2368             fi
2369         fi
2370     fi
2374 dnl ===================================================================
2375 dnl Check / find MacOSX SDK and compiler, version checks
2376 dnl ===================================================================
2377 if test "$_os" = "Darwin"; then
2379     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
2380         bitness=-m32
2381     else
2382         bitness=-m64
2383         BITNESS_OVERRIDE=64
2384     fi
2386     # If no --with-macosx-sdk option is given, look for 10.6, 10.7
2387     # and 10.8 SDKs, in that order. If not found in some (old)
2388     # default locations, try the xcode-select tool.
2390     # The intent is that for "most" Mac-based developers, a suitable
2391     # SDK will be found automatically without any configure options.
2393     # For developers still using Xcode 3, in /Developer, either
2394     # because it is the only Xcode they have, or they have that in
2395     # addition to Xcode 4 in /Applications/Xcode.app, the 10.6 SDK
2396     # should be found.
2398     # For developers with a current Xcode 4 installed from the Mac App
2399     # Store, the 10.6, 10.7 or 10.8 SDK should be found.
2401     AC_MSG_CHECKING([what Mac OS X SDK to use])
2403     if test -z "$with_macosx_sdk"; then
2404         if test -d /Developer/SDKs/MacOSX10.6.sdk; then
2405             with_macosx_sdk=10.6
2406         elif test -d /Developer-old/SDKs/MacOSX10.6.sdk; then
2407             with_macosx_sdk=10.6
2408         elif test -d /Xcode3/SDKs/MacOSX10.6.sdk; then
2409             with_macosx_sdk=10.6
2410         elif test -d /Developer/SDKs/MacOSX10.7.sdk; then
2411             with_macosx_sdk=10.7
2412         elif test -x /usr/bin/xcode-select; then
2413             xcodepath="`xcode-select -print-path`"
2414             if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk"; then
2415                 with_macosx_sdk=10.6
2416             elif test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"; then
2417                 with_macosx_sdk=10.7
2418             elif test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk"; then
2419                 with_macosx_sdk=10.8
2420             fi
2421         fi
2422         if test -z "$with_macosx_sdk"; then
2423             AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2424         fi
2425     fi
2427     case $with_macosx_sdk in
2428     10.6)
2429         MACOSX_SDK_VERSION=1060
2430         ;;
2431     10.7)
2432         MACOSX_SDK_VERSION=1070
2433         ;;
2434     10.8)
2435         MACOSX_SDK_VERSION=1080
2436         ;;
2437     *)
2438         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported value are 10.6--8])
2439         ;;
2440     esac
2442     # Next find it (again, if we deduced its version above by finding
2443     # it... but we need to look for it once more in case
2444     # --with-macosx-sdk was given so that the aboce search did not
2445     # happen).
2446     if test -z "$MACOSX_SDK_PATH"; then
2447         case $with_macosx_sdk in
2448         10.6)
2449             if test -d /Developer/SDKs/MacOSX10.6.sdk; then
2450                 MACOSX_SDK_PATH=/Developer/SDKs/MacOSX10.6.sdk
2451             elif test -d /Developer-old/SDKs/MacOSX10.6.sdk; then
2452                 MACOSX_SDK_PATH=/Developer-old/SDKs/MacOSX10.6.sdk
2453             elif test -d /Xcode3/SDKs/MacOSX10.6.sdk; then
2454                 MACOSX_SDK_PATH=/Xcode3/SDKs/MacOSX10.6.sdk
2455             elif test -x /usr/bin/xcode-select; then
2456                 xcodepath="`xcode-select -print-path`"
2457                 if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2458                     MACOSX_SDK_PATH="$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"
2459                 fi
2460             fi
2461             ;;
2462         10.7|10.8)
2463             if test -d /Developer/SDKs/MacOSX$with_macosx_sdk.sdk; then
2464                 MACOSX_SDK_PATH=/Developer/SDKs/MacOSX$with_macosx_sdk.sdk
2465             elif test -x /usr/bin/xcode-select; then
2466                 xcodepath="`xcode-select -print-path`"
2467                 if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2468                     MACOSX_SDK_PATH="$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"
2469                 fi
2470             fi
2471             ;;
2472         esac
2473         if test -z "$MACOSX_SDK_PATH"; then
2474             AC_MSG_ERROR([Could not figure out the location of Mac OS X $with_macosx_sdk SDK])
2475         fi
2476     fi
2477     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2479     if test "$with_macosx_version_min_required" = ""; then
2480         with_macosx_version_min_required="10.6"
2481     fi
2483     if test "$with_macosx_version_max_allowed" = ""; then
2484         with_macosx_version_max_allowed="$with_macosx_sdk"
2485     fi
2487     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2488     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2490     case "$with_macosx_version_min_required" in
2491     10.6)
2492         MAC_OS_X_VERSION_MIN_REQUIRED="1060"
2493         ;;
2494     10.7)
2495         MAC_OS_X_VERSION_MIN_REQUIRED="1070"
2496         ;;
2497     10.8)
2498         MAC_OS_X_VERSION_MIN_REQUIRED="1080"
2499         ;;
2500     *)
2501         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported value are 10.6--8])
2502         ;;
2503     esac
2505     if test "$BITNESS_OVERRIDE" = ""; then
2506         case "$with_macosx_version_min_required" in
2507         10.6)
2508             case "$with_macosx_sdk" in
2509             10.6)
2510                 ;;
2511             *)
2512                 AC_MSG_WARN([Building with a SDK > 10.6 possibly breaks 10.6 compatibility. Do not use for the TDF build])
2513                 add_warning "Building with a SDK > 10.6 possibly breaks 10.6 compatibility. Do not use for the TDF build"
2514                 ;;
2515             esac
2516             ;;
2517         *)
2518             AC_MSG_WARN([Building with a minimum version requirement > 10.6 breaks 10.6 compatibility. Do not use for the TDF build])
2519             add_warning "Building with a minimum version requirement > 10.6 breaks 10.6 compatibility. Do not use for the TDF build"
2520             ;;
2521         esac
2522     fi
2524     # If no CC and CXX environment vars, try to guess where the compiler is
2525     if test -z "$save_CC"; then
2526         AC_MSG_CHECKING([what compiler to use])
2527         case $with_macosx_sdk in
2528         10.6)
2529             # did someone copy her 10.6 sdk into xcode 4 (needed on Mountain Lion)?
2530             if test "$(echo $MACOSX_SDK_PATH | cut -c1-23)" = "/Applications/Xcode.app"; then
2531                 CC="`xcrun -find gcc` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2532                 CXX="`xcrun -find g++` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2533                 XCRUN=xcrun
2534             else
2535                 CC="gcc-4.2 $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2536                 CXX="g++-4.2 $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2537             fi
2538             ;;
2539         10.7|10.8)
2540             CC="`xcrun -find clang` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2541             CXX="`xcrun -find clang++` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2542             XCRUN=xcrun
2543             ;;
2544         esac
2545         AC_MSG_RESULT([$CC and $CXX])
2546     fi
2548     case "$with_macosx_version_max_allowed" in
2549     10.6)
2550         MAC_OS_X_VERSION_MAX_ALLOWED="1060"
2551         ;;
2552     10.7)
2553         MAC_OS_X_VERSION_MAX_ALLOWED="1070"
2554         ;;
2555     10.8)
2556         MAC_OS_X_VERSION_MAX_ALLOWED="1080"
2557         ;;
2558     *)
2559         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported value are 10.6--8])
2560         ;;
2561     esac
2563     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2564     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2565         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2566     else
2567         AC_MSG_RESULT([ok])
2568     fi
2570     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2571     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2572         AC_MSG_ERROR([the version maximum allowed cannot be greater thatn the sdk level])
2573     else
2574         AC_MSG_RESULT([ok])
2575     fi
2576     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2577     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2579     AC_MSG_CHECKING([whether to do code signing])
2581     if test "$enable_macosx_code_signing" = yes; then
2582         # By default use the first suitable certificate (?).
2584         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2585         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2586         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2587         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the the
2588         # "Developer ID Application" one.
2590         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | awk '{print $2}' |head -1`
2591         if test -n "$identity"; then
2592             MACOSX_CODESIGNING_IDENTITY=$identity
2593             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2594             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2595         fi
2596     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2597         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2598         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2599         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2600     else
2601         AC_MSG_RESULT([no])
2602     fi
2604     AC_MSG_CHECKING([whether to sandbox the application])
2606     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2607         AC_MSG_ERROR([OS X sandboxing requires code signing])
2608     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2609         ENABLE_MACOSX_SANDBOX=YES
2610         AC_MSG_RESULT([yes])
2611     else
2612         AC_MSG_RESULT([no])
2613     fi
2615     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2617     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2619     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2621 AC_SUBST(MACOSX_SDK_PATH)
2622 AC_SUBST(MACOSX_SDK_VERSION)
2623 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2624 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2625 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2626 AC_SUBST(XCRUN)
2627 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2628 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2629 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2631 dnl ===================================================================
2632 dnl Check / find iOS SDK and compiler, version checks
2633 dnl ===================================================================
2634 if test $_os = iOS; then
2636     AC_MSG_CHECKING([what iOS SDK to use])
2638     if test "$enable_ios_simulator" = yes; then
2639         platform=iPhoneSimulator
2640         versionmin=-mmacosx-version-min=10.7
2641         arch=i386
2642     else
2643         platform=iPhoneOS
2644         versionmin=-miphoneos-version-min=5.0
2645         arch=armv7
2646     fi
2648     pref_sdk_ver=6.1
2649     for I in 6.1 6.0; do
2650         t=/Applications/Xcode.app/Contents/Developer/Platforms/$platform.platform/Developer/SDKs/$platform$I.sdk
2651         if test -d $t; then
2652             sysroot=$t
2653             break
2654         fi
2655     done
2657     if test -z "$sysroot"; then
2658         AC_MSG_ERROR([Could not find iOS SDK, expected something like /Applications/Xcode.app/Contents/Developer/Platforms/$platform.platform/Developer/SDKs/${platform}${pref_sdk_ver}])
2659     fi
2661     AC_MSG_RESULT($sysroot)
2663     CXX="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch $arch -isysroot $sysroot $versionmin"
2664     CC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch $arch -isysroot $sysroot $versionmin"
2667 AC_MSG_CHECKING([whether to treat the installation as read-only])
2669 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = YES \) -o \
2670         "$enable_extensions" != yes; then
2671     enable_readonly_installset=yes
2673 if test "$enable_readonly_installset" = yes; then
2674     AC_MSG_RESULT([yes])
2675     ENABLE_READONLY_INSTALLSET=YES
2676 else
2677     AC_MSG_RESULT([no])
2679 AC_SUBST(ENABLE_READONLY_INSTALLSET)
2681 dnl ===================================================================
2682 dnl Windows specific tests and stuff
2683 dnl ===================================================================
2685 reg_get_value()
2687     # Return value: $regvalue
2688     unset regvalue
2689     _regvalue=`cat "/proc/registry/$1" 2> /dev/null`
2691     if test $? -eq 0; then
2692         regvalue=$_regvalue
2693     fi
2697 if test "$_os" = "WINNT" -a "$WITH_MINGW" != yes; then
2698     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
2699     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
2700         AC_MSG_RESULT([no])
2701         WINDOWS_SDK_ARCH="x86"
2702     else
2703         AC_MSG_RESULT([yes])
2704         WINDOWS_SDK_ARCH="x64"
2705         BITNESS_OVERRIDE=64
2706     fi
2708     AC_MSG_CHECKING([whether to use DirectX])
2709     if test "$enable_directx" = "yes" -o "$enable_directx" = ""; then
2710         ENABLE_DIRECTX="TRUE"
2711         AC_MSG_RESULT([yes])
2712     else
2713         ENABLE_DIRECTX=""
2714         AC_MSG_RESULT([no])
2715     fi
2717     AC_MSG_CHECKING([whether to use ActiveX])
2718     if test "$enable_activex" = "yes" -o "$enable_activex" = ""; then
2719         DISABLE_ACTIVEX=""
2720         SCPDEFS="$SCPDEFS -DWITH_ACTIVEX_COMPONENT"
2721         AC_MSG_RESULT([yes])
2722     else
2723         DISABLE_ACTIVEX="TRUE"
2724         AC_MSG_RESULT([no])
2725     fi
2727     AC_MSG_CHECKING([whether to use ATL])
2728     if test "$enable_atl" = "yes" -o "$enable_atl" = ""; then
2729         DISABLE_ATL=""
2730         AC_MSG_RESULT([yes])
2731     else
2732         DISABLE_ATL="TRUE"
2733         AC_MSG_RESULT([no])
2734     fi
2735 else
2736     ENABLE_DIRECTX=""
2737     DISABLE_ACTIVEX="TRUE"
2738     DISABLE_ATL="TRUE"
2741 AC_SUBST(ENABLE_DIRECTX)
2742 AC_SUBST(DISABLE_ACTIVEX)
2743 AC_SUBST(DISABLE_ATL)
2745 if test "$cross_compiling" = "yes"; then
2746     CROSS_COMPILING=YES
2747     SCPDEFS="$SCPDEFS -DCROSS_COMPILING"
2748 else
2749     CROSS_COMPILING=
2750     BUILD_TYPE="$BUILD_TYPE NATIVE"
2752 AC_SUBST(CROSS_COMPILING)
2754 dnl ===================================================================
2755 dnl  Test the gcc version
2756 dnl ===================================================================
2757 if test "$GCC" = "yes"; then
2758     AC_MSG_CHECKING([the GCC version])
2759     _gcc_version=`$CC -dumpversion`
2760     _gcc_major=`echo $_gcc_version | $AWK -F. '{ print \$1 }'`
2761     GCCVER=`echo $_gcc_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2763     AC_MSG_RESULT([gcc $_gcc_version])
2764     if test "$GCCVER" -lt 040000; then
2765         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.0.0])
2766     fi
2769 dnl ===================================================================
2770 dnl  Is GCC actually Clang?
2771 dnl ===================================================================
2773 COM_GCC_IS_CLANG=
2774 if test "$GCC" = "yes"; then
2775     AC_MSG_CHECKING([whether GCC is actually Clang])
2776     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
2777         #ifndef __clang__
2778         you lose
2779         #endif
2780         int foo=42;
2781         ]])],
2782         [AC_MSG_RESULT([yes])
2783          COM_GCC_IS_CLANG=TRUE],
2784         [AC_MSG_RESULT([no])])
2786     if test "$COM_GCC_IS_CLANG" = TRUE; then
2787         AC_MSG_CHECKING([the Clang version])
2788         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC -E -P -`
2789         CLANG_FULL_VERSION=`echo __clang_version__ | $CC -E -P -`
2790         CLANGVER=`echo $clang_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2791         AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
2792         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
2793     fi
2795 AC_SUBST(COM_GCC_IS_CLANG)
2797 # ===================================================================
2798 # check various GCC options that Clang does not support now but maybe
2799 # will somewhen in the future, check them even for GCC, so that the
2800 # flags are set
2801 # ===================================================================
2803 HAVE_GCC_GGDB2=
2804 HAVE_GCC_FINLINE_LIMIT=
2805 HAVE_GCC_FNO_INLINE=
2806 if test "$GCC" = "yes"; then
2807     AC_MSG_CHECKING([whether $CC supports -ggdb2])
2808     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
2809         # Option just ignored and silly warning that isn't a real
2810         # warning printed
2811         :
2812     else
2813         save_CFLAGS=$CFLAGS
2814         CFLAGS="$CFLAGS -Werror -ggdb2"
2815         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
2816         CFLAGS=$save_CFLAGS
2817     fi
2818     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
2819         AC_MSG_RESULT([yes])
2820     else
2821         AC_MSG_RESULT([no])
2822     fi
2824     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
2825     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
2826         # As above
2827         :
2828     else
2829         save_CFLAGS=$CFLAGS
2830         CFLAGS="$CFLAGS -Werror -finline-limit=0"
2831         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
2832         CFLAGS=$save_CFLAGS
2833     fi
2834     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
2835         AC_MSG_RESULT([yes])
2836     else
2837         AC_MSG_RESULT([no])
2838     fi
2840     AC_MSG_CHECKING([whether $CC supports -fno-inline])
2841     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
2842         # Ditto
2843         :
2844     else
2845         save_CFLAGS=$CFLAGS
2846         CFLAGS="$CFLAGS -Werror -fno-inline"
2847         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
2848         CFLAGS=$save_CFLAGS
2849     fi
2850     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
2851         AC_MSG_RESULT([yes])
2852     else
2853         AC_MSG_RESULT([no])
2854     fi
2856 AC_SUBST(HAVE_GCC_GGDB2)
2857 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
2858 AC_SUBST(HAVE_GCC_FNO_INLINE)
2860 HAVE_LD_BSYMBOLIC_FUNCTIONS=
2861 if test "$GCC" = "yes"; then
2862     AC_MSG_CHECKING( for -Bsymbolic-functions linker support )
2863     bsymbolic_functions_ldflags_save=$LDFLAGS
2864     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
2865     AC_LINK_IFELSE([AC_LANG_PROGRAM([
2866 #include <stdio.h>
2867         ],[
2868 printf ("hello world\n");
2869         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
2870     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
2871         AC_MSG_RESULT( found )
2872     else
2873         AC_MSG_RESULT( not found )
2874     fi
2875     LDFLAGS=$bsymbolic_functions_ldflags_save
2877 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
2879 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
2880 # NOTE: must _not_ be used for bundled external libraries!
2881 ISYSTEM=
2882 if test "$GCC" = "yes"; then
2883     AC_MSG_CHECKING( for -isystem )
2884     save_CFLAGS=$CFLAGS
2885     CFLAGS="$CFLAGS -Werror"
2886     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM=-isystem ],[])
2887     CFLAGS=$save_CFLAGS
2888     if test -n "$ISYSTEM"; then
2889         AC_MSG_RESULT(yes)
2890     else
2891         AC_MSG_RESULT(no)
2892     fi
2894 if test -z "$ISYSTEM"; then
2895     # fall back to using -I
2896     ISYSTEM=-I
2898 AC_SUBST(ISYSTEM)
2900 dnl ===================================================================
2901 dnl  Check which Visual Studio or MinGW compiler is used
2902 dnl ===================================================================
2904 map_vs_year_to_version()
2906     # Return value: $vsversion
2908     unset vsversion
2910     case $1 in
2911     2008)
2912         vsversion=9.0;;
2913     2010)
2914         vsversion=10.0;;
2915     2012)
2916         vsversion=11.0;;
2917     *)
2918         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
2919     esac
2922 vs_versions_to_check()
2924     # Args: $1 (optional) : versions to check, in the order of preference
2925     # Return value: $vsversions
2927     unset vsversions
2929     if test -n "$1"; then
2930         map_vs_year_to_version "$1"
2931         vsversions=$vsversion
2932     else
2933         # By default we prefer 2012, then 2010, then 2008
2934         vsversions="11.0 10.0 9.0"
2935     fi
2938 find_msvs()
2940     # Find Visual Studio 2012/2010/2008
2941     # Args: $1 (optional) : versions to check, in the order of preference
2942     # Return value: $vstest
2944     unset vstest
2946     vs_versions_to_check "$1"
2948     for ver in $vsversions; do
2949         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/ProductDir
2950         if test -n "$regvalue"; then
2951             vstest=$regvalue
2952             break
2953         fi
2954         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VS/ProductDir
2955         if test -n "$regvalue"; then
2956             vstest=$regvalue
2957             break
2958         fi
2959     done
2962 find_msvc()
2964     # Find Visual C++ 2012/2010/2008
2965     # Args: $1 (optional) : The VS version year
2966     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot
2968     unset vctest vcnum vcnumwithdot
2970     vs_versions_to_check "$1"
2972     for ver in $vsversions; do
2973         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
2974         if test -n "$regvalue"; then
2975             vctest=$regvalue
2976             break
2977         fi
2978         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VC/ProductDir
2979         if test -n "$regvalue"; then
2980             vctest=$regvalue
2981             break
2982         fi
2983     done
2984     if test -n "$vctest"; then
2985         vcnumwithdot=$ver
2986         case "$vcnumwithdot" in
2987         9.0)
2988             vcyear=2008
2989             vcnum=90
2990             ;;
2991         10.0)
2992             vcyear=2010
2993             vcnum=100
2994             ;;
2995         11.0)
2996             vcyear=2012
2997             vcnum=110
2998             ;;
2999         esac
3000     fi
3003 SHOWINCLUDES_PREFIX=
3004 if test "$_os" = "WINNT"; then
3005     if test "$WITH_MINGW" != "yes"; then
3006         AC_MSG_CHECKING([Visual C++])
3008         find_msvc "$with_visual_studio"
3010         if test -z "$vctest"; then
3011             if test -n "$with_visual_studio"; then
3012                 AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3013             else
3014                 AC_MSG_ERROR([No Visual Studio 2012, 2010 or 2008 installation found])
3015             fi
3016         fi
3018         if test "$BITNESS_OVERRIDE" = ""; then
3019             if test -f "$vctest/bin/cl.exe"; then
3020                 VC_PRODUCT_DIR=$vctest
3021             else
3022                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3023             fi
3024         else
3025             # It makes sense, I think, to restrict 64-bit support to VS2010 or newer
3026             if test $vcnum -lt 100; then
3027                AC_MSG_ERROR([We have no plans to support building a 64-bit LibreOffice with VS 2008])
3028             fi
3030             if test -f "$vctest/bin/amd64/cl.exe"; then
3031                 VC_PRODUCT_DIR=$vctest
3032             else
3033                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/amd64/cl.exe])
3034             fi
3035         fi
3037         VC_PRODUCT_DIR=`cygpath -d "$VC_PRODUCT_DIR"`
3038         VC_PRODUCT_DIR=`cygpath -u "$VC_PRODUCT_DIR"`
3039         AC_MSG_RESULT([$VC_PRODUCT_DIR])
3041         dnl ===========================================================
3042         dnl  Check for the corresponding mspdb*.dll
3043         dnl ===========================================================
3045         MSPDB_PATH=
3047         if test "$BITNESS_OVERRIDE" == ""; then
3048             MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3049         else
3050             MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3051         fi
3053         case $vcnum in
3054         90)
3055             mspdbnum=80;;
3056         *)
3057             mspdbnum=$vcnum;;
3058         esac
3060         if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3061             AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3062         fi
3064         MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3065         MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3067         dnl The path needs to be added before cl is called
3068         PATH="$MSPDB_PATH:$PATH"
3070         AC_MSG_CHECKING([cl.exe])
3072         # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3073         # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3074         # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3075         # is not enough?
3077         if test -z "$CC"; then
3078             if test "$BITNESS_OVERRIDE" = ""; then
3079                 if test -f "$VC_PRODUCT_DIR/bin/cl.exe"; then
3080                     CC="$VC_PRODUCT_DIR/bin/cl.exe"
3081                 fi
3082             else
3083                 if test -f "$VC_PRODUCT_DIR/bin/amd64/cl.exe"; then
3084                     CC="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3085                 fi
3086             fi
3088             # This gives us a posix path with 8.3 filename restrictions
3089             CC=`cygpath -d "$CC"`
3090             CC=`cygpath -u "$CC"`
3091         fi
3093         if test -n "$CC"; then
3094             # Remove /cl.exe from CC case insensitive
3095             AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3096             if test "$BITNESS_OVERRIDE" = ""; then
3097                 COMPATH=`echo $CC | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3098             else
3099                 if test -n "$VC_PRODUCT_DIR"; then
3100                     # Huh, why not just an assignment?
3101                     COMPATH=`echo $VC_PRODUCT_DIR`
3102                 fi
3103             fi
3104             export INCLUDE=`cygpath -d "$COMPATH/Include"`
3106             PathFormat "$COMPATH"
3107             COMPATH="$formatted_path"
3109             VCVER=$vcnum
3110             MSVSVER=$vcyear
3112             # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3113             # are always "better", we list them in reverse chronological order.
3115             case $vcnum in
3116             90)
3117                 COMEX=12
3118                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="7.1A 7.1 7.0A 6.0A"
3119                 ;;
3120             100)
3121                 COMEX=13
3122                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="7.1A 7.1 7.0A 6.0A"
3123                 ;;
3124             110)
3125                 COMEX=14
3126                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="8.0"
3127                 ;;
3128             esac
3130             # The expectation is that --with-windows-sdk should not need to be used
3131             if test -n "$with_windows_sdk"; then
3132                 case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3133                 *" "$with_windows_sdk" "*)
3134                     WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3135                     ;;
3136                 *)
3137                     AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work witn VS $MSVSVER])
3138                     ;;
3139                 esac
3140             fi
3141         else
3142             AC_MSG_ERROR([Visual C++ not found after all, huh])
3143         fi
3145         dnl We need to guess the prefix of the -showIncludes output, it can be
3146         dnl localized
3147         AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3148         echo "#include <stdlib.h>" > conftest.c
3149         SHOWINCLUDES_PREFIX=`$CC -c -showIncludes conftest.c 2>/dev/null | \
3150             grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3151         rm -f conftest.c conftest.obj
3152         if test -z "$SHOWINCLUDES_PREFIX"; then
3153             AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3154         else
3155             AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3156         fi
3158         # Check for 64-bit (cross-)compiler to use to build the 64-bit
3159         # version of the Explorer extension (and maybe other small
3160         # bits, too) needed when installing a 32-bit LibreOffice on a
3161         # 64-bit OS. The 64-bit Explorer extension is a feature that
3162         # has been present since long in OOo. Don't confuse it with
3163         # building LibreOffice itself as 64-bit code, which is
3164         # unfinished work and highly experimental.
3166         BUILD_X64=
3167         CXX_X64_BINARY=
3168         LINK_X64_BINARY=
3170         if test "$BITNESS_OVERRIDE" = ""; then
3171             AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3172             if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3173                 # Prefer native x64 compiler to cross-compiler, in case we are running
3174                 # the build on a 64-bit OS.
3175                 if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3176                     BUILD_X64=TRUE
3177                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3178                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3179                 elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3180                     BUILD_X64=TRUE
3181                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3182                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3183                 fi
3184             fi
3185             if test "$BUILD_X64" = TRUE; then
3186                 AC_MSG_RESULT([found])
3187             else
3188                 AC_MSG_RESULT([not found])
3189                 AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3190             fi
3191         fi
3192         AC_SUBST(BUILD_X64)
3194         # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3195         AC_SUBST(CXX_X64_BINARY)
3196         AC_SUBST(LINK_X64_BINARY)
3197     else
3198         AC_MSG_CHECKING([the compiler is MinGW])
3199         MACHINE_PREFIX=`$CC -dumpmachine`
3200         if echo $MACHINE_PREFIX | $GREP -q mingw32; then
3201             COMPATH=`echo "$COMPATH" | sed -e 's,/bin$,,'`
3202             AC_MSG_RESULT([yes])
3203         else
3204             AC_MSG_ERROR([Compiler is not MinGW.])
3205         fi
3206     fi
3208 AC_SUBST(COMEX)
3209 AC_SUBST(VCVER)
3210 PathFormat "$MSPDB_PATH"
3211 MSPDB_PATH="$formatted_path"
3212 AC_SUBST(SHOWINCLUDES_PREFIX)
3215 # dbghelp.dll
3217 if test "$_os" == "WINNT"; then
3218     BUILD_TYPE="$BUILD_TYPE DBGHELP"
3222 # unowinreg.dll
3224 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3225 AC_SUBST(UNOWINREG_DLL)
3228 # prefix C with ccache if needed
3230 if test "$CCACHE" != ""; then
3231     AC_MSG_CHECKING([whether $CC is already ccached])
3233     AC_LANG_PUSH([C])
3234     save_CFLAGS=$CFLAGS
3235     CFLAGS="$CFLAGS --ccache-skip -O2"
3236     dnl an empty program will do, we're checking the compiler flags
3237     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3238                       [use_ccache=yes], [use_ccache=no])
3239     if test $use_ccache = yes; then
3240         AC_MSG_RESULT([yes])
3241     else
3242         CC="$CCACHE $CC"
3243         AC_MSG_RESULT([no])
3244     fi
3245     CFLAGS=$save_CFLAGS
3246     AC_LANG_POP([C])
3249 dnl Set the ENABLE_DBGUTIL variable
3250 dnl ===================================================================
3251 AC_MSG_CHECKING([whether to build with additional debug utilities])
3252 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3253     ENABLE_DBGUTIL="TRUE"
3254     # this is an extra var so it can have different default on different MSVC
3255     # versions (in case there are version specific problems with it)
3256     MSVC_USE_DEBUG_RUNTIME="TRUE"
3257     PROEXT=""
3258     PRODUCT=""
3260     AC_MSG_RESULT([yes])
3261     # cppunit and graphite expose STL in public headers
3262     if test "$with_system_cppunit" = "yes"; then
3263         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3264     else
3265         with_system_cppunit=no
3266     fi
3267     if test "$with_system_graphite" = "yes"; then
3268         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3269     else
3270         with_system_graphite=no
3271     fi
3272     if test "$with_system_mysql_cppconn" = "yes"; then
3273         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3274     else
3275         with_system_mysql_cppconn=no
3276     fi
3277     if test "$with_system_orcus" = "yes"; then
3278         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3279     else
3280         with_system_orcus=no
3281     fi
3282     if test "$with_system_libcmis" = "yes"; then
3283         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3284     else
3285         with_system_libcmis=no
3286     fi
3287 else
3288     ENABLE_DBGUTIL=""
3289     MSVC_USE_DEBUG_RUNTIME=""
3290     # PRODUCT is old concept, still used by build.pl .
3291     PRODUCT="full"
3292     PROEXT=".pro"
3293     AC_MSG_RESULT([no])
3295 AC_SUBST(ENABLE_DBGUTIL)
3296 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3297 AC_SUBST(PRODUCT)
3298 AC_SUBST(PROEXT)
3300 dnl Set the ENABLE_DEBUG variable.
3301 dnl ===================================================================
3302 AC_MSG_CHECKING([whether to do a debug build])
3303 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3304     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3306 if test -n "$ENABLE_DBGUTIL"; then
3307     if test "$enable_debug" = "no"; then
3308         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3309     fi
3310     ENABLE_DEBUG="TRUE"
3311     AC_MSG_RESULT([yes (dbgutil)])
3312 elif test -n "$enable_debug" && test "$enable_debug" != "no"; then
3313     ENABLE_DEBUG="TRUE"
3314     AC_MSG_RESULT([yes])
3315 else
3316     ENABLE_DEBUG=""
3317     AC_MSG_RESULT([no])
3319 AC_SUBST(ENABLE_DEBUG)
3321 dnl Selective debuginfo
3322 ENABLE_DEBUGINFO_FOR=
3323 if test -n "$ENABLE_DEBUG"; then
3324     AC_MSG_CHECKING([whether to use selective debuginfo])
3325     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3326         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3327         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3328     else
3329         ENABLE_DEBUGINFO_FOR=all
3330         AC_MSG_RESULT([no, for all])
3331     fi
3333 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3335 dnl Check for enable symbols option
3336 dnl ===================================================================
3337 AC_MSG_CHECKING([whether to include symbols while preserve optimization])
3338 if test -n "$enable_symbols" -a "$enable_symbols" != "no"; then
3339     ENABLE_SYMBOLS="TRUE"
3340     if test -n "$ENABLE_DBGUTIL"; then
3341         AC_MSG_ERROR([--enable-dbgutil cannot be used with --enable-symbols])
3342     elif test -n "$ENABLE_DEBUG"; then
3343         AC_MSG_ERROR([--enable-debug cannot be used with --enable-symbols])
3344     fi
3345     AC_MSG_RESULT([yes])
3346 else
3347     if test -n "$enable_symbols" -a "$enable_symbols" = "no"; then
3348         ENABLE_SYMBOLS="FALSE"
3349     else
3350         ENABLE_SYMBOLS=
3351     fi
3352     AC_MSG_RESULT([no])
3354 AC_SUBST(ENABLE_SYMBOLS)
3356 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
3357 # By default use the ones specified by our build system,
3358 # but explicit override is possible.
3359 AC_MSG_CHECKING(for explicit AFLAGS)
3360 if test -n "$AFLAGS"; then
3361     AC_MSG_RESULT([$AFLAGS])
3362     x_AFLAGS=
3363 else
3364     AC_MSG_RESULT(no)
3365     x_AFLAGS=[\#]
3367 AC_MSG_CHECKING(for explicit CFLAGS)
3368 if test -n "$CFLAGS"; then
3369     AC_MSG_RESULT([$CFLAGS])
3370     x_CFLAGS=
3371 else
3372     AC_MSG_RESULT(no)
3373     x_CFLAGS=[\#]
3375 AC_MSG_CHECKING(for explicit CXXFLAGS)
3376 if test -n "$CXXFLAGS"; then
3377     AC_MSG_RESULT([$CXXFLAGS])
3378     x_CXXFLAGS=
3379 else
3380     AC_MSG_RESULT(no)
3381     x_CXXFLAGS=[\#]
3383 AC_MSG_CHECKING(for explicit OBJCFLAGS)
3384 if test -n "$OBJCFLAGS"; then
3385     AC_MSG_RESULT([$OBJCFLAGS])
3386     x_OBJCFLAGS=
3387 else
3388     AC_MSG_RESULT(no)
3389     x_OBJCFLAGS=[\#]
3391 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
3392 if test -n "$OBJCXXFLAGS"; then
3393     AC_MSG_RESULT([$OBJCXXFLAGS])
3394     x_OBJCXXFLAGS=
3395 else
3396     AC_MSG_RESULT(no)
3397     x_OBJCXXFLAGS=[\#]
3399 AC_MSG_CHECKING(for explicit LDFLAGS)
3400 if test -n "$LDFLAGS"; then
3401     AC_MSG_RESULT([$LDFLAGS])
3402     x_LDFLAGS=
3403 else
3404     AC_MSG_RESULT(no)
3405     x_LDFLAGS=[\#]
3407 AC_SUBST(AFLAGS)
3408 AC_SUBST(CFLAGS)
3409 AC_SUBST(CXXFLAGS)
3410 AC_SUBST(OBJCFLAGS)
3411 AC_SUBST(OBJCXXFLAGS)
3412 AC_SUBST(LDFLAGS)
3413 AC_SUBST(x_AFLAGS)
3414 AC_SUBST(x_CFLAGS)
3415 AC_SUBST(x_CXXFLAGS)
3416 AC_SUBST(x_OBJCFLAGS)
3417 AC_SUBST(x_OBJCXXFLAGS)
3418 AC_SUBST(x_LDFLAGS)
3421 # determine CPU, CPUNAME, GUI, GUIBASE, ...
3423 LIB64="lib"
3424 SOLARINC=
3426 case "$host_os" in
3428 aix*)
3429     COM=GCC
3430     CPU=P
3431     CPUNAME=POWERPC
3432     GUI=UNX
3433     GUIBASE=unx
3434     OS=AIX
3435     RTL_OS=AIX
3436     RTL_ARCH=PowerPC
3437     PLATFORMID=aix_powerpc
3438     OUTPATH=unxaigppc
3439     P_SEP=:
3440     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3441     ;;
3443 cygwin*)
3444     COM=MSC
3445     GUI=WNT
3446     GUIBASE=not-used
3447     OS=WNT
3448     RTL_OS=Windows
3449     P_SEP=";"
3451     case "$host_cpu" in
3452     i*86|x86_64)
3453         if test "$BITNESS_OVERRIDE" = 64; then
3454             CPU=X
3455             CPUNAME=X86_64
3456             RTL_ARCH=X86_64
3457             LIB64="lib/x64"
3458             PLATFORMID=windows_x86_64
3459             OUTPATH=wntmscx$COMEX
3460         else
3461             CPU=I
3462             CPUNAME=INTEL
3463             RTL_ARCH=x86
3464             PLATFORMID=windows_x86
3465             OUTPATH=wntmsci$COMEX
3466         fi
3467         ;;
3468     *)
3469         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3470         ;;
3471     esac
3472     SCPDEFS="$SCPDEFS -D_MSC_VER"
3473     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3474     ;;
3476 darwin*)
3477     COM=GCC
3478     GUI=UNX
3479     GUIBASE=not-used
3480     OS=MACOSX
3481     RTL_OS=MacOSX
3482     P_SEP=:
3484     case "$host_cpu" in
3485     arm*)
3486         CPU=R
3487         CPUNAME=ARM
3488         RTL_ARCH=ARM_EABI
3489         PLATFORMID=ios_arm
3490         OUTPATH=unxiosr
3491         OS=IOS
3492         SDKDIR=sdk
3493         ;;
3494     i*86)
3495         if test "$BITNESS_OVERRIDE" = 64; then
3496             AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
3497         fi
3498         CPU=I
3499         CPUNAME=INTEL
3500         RTL_ARCH=x86
3501         PLATFORMID=macosx_x86
3502         OUTPATH=unxmacxi
3503         ;;
3504     x86_64)
3505         if test "$BITNESS_OVERRIDE" = 64; then
3506             CPU=X
3507             CPUNAME=X86_64
3508             RTL_ARCH=X86_64
3509             PLATFORMID=macosx_x86_64
3510             OUTPATH=unxmacxx
3511         else
3512             CPU=I
3513             CPUNAME=INTEL
3514             RTL_ARCH=x86
3515             PLATFORMID=macosx_x86
3516             OUTPATH=unxmacxi
3517         fi
3518         ;;
3519     *)
3520         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3521         ;;
3522     esac
3523     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3524     ;;
3526 dragonfly*)
3527     COM=GCC
3528     GUI=UNX
3529     GUIBASE=unx
3530     OS=DRAGONFLY
3531     RTL_OS=DragonFly
3532     OUTPATH=unxdfly
3533     P_SEP=:
3535     case "$host_cpu" in
3536     i*86)
3537         CPU=I
3538         CPUNAME=INTEL
3539         RTL_ARCH=x86
3540         PLATFORMID=dragonfly_x86
3541         ;;
3542     x86_64)
3543         CPU=X
3544         CPUNAME=X86_64
3545         RTL_ARCH=X86_64
3546         PLATFORMID=dragonfly_x86_64
3547         ;;
3548     *)
3549         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3550         ;;
3551     esac
3552     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3553     ;;
3555 freebsd*)
3556     COM=GCC
3557     GUI=UNX
3558     GUIBASE=unx
3559     RTL_OS=FreeBSD
3560     OS=FREEBSD
3561     OUTPATH=unxfbsd
3562     P_SEP=:
3564     case "$host_cpu" in
3565     i*86)
3566         CPU=I
3567         CPUNAME=INTEL
3568         RTL_ARCH=x86
3569         PLATFORMID=freebsd_x86
3570         OUTPATH=unxfbsdi
3571         ;;
3572     x86_64)
3573         CPU=X
3574         CPUNAME=X86_64
3575         RTL_ARCH=X86_64
3576         PLATFORMID=freebsd_x86_64
3577         ;;
3578     *)
3579         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3580         ;;
3581     esac
3582     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3583     ;;
3585 kfreebsd*)
3586     COM=GCC
3587     GUI=UNX
3588     GUIBASE=unx
3589     OS=LINUX
3590     RTL_OS=kFreeBSD
3591     P_SEP=:
3593     case "$host_cpu" in
3595     i*86)
3596         CPU=I
3597         CPUNAME=INTEL
3598         RTL_ARCH=x86
3599         PLATFORMID=kfreebsd_x86
3600         OUTPATH=unxkfgi6
3601         ;;
3602     x86_64)
3603         CPU=X
3604         CPUNAME=X86_64
3605         RTL_ARCH=X86_64
3606         LIB64="lib64"
3607         PLATFORMID=kfreebsd_x86_64
3608         OUTPATH=unxkfgx6
3609         ;;
3610     *)
3611         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3612         ;;
3613     esac
3614     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3615     ;;
3617 linux-gnu*)
3618     COM=GCC
3619     GUI=UNX
3620     GUIBASE=unx
3621     OS=LINUX
3622     RTL_OS=Linux
3623     P_SEP=:
3625     case "$host_cpu" in
3627     alpha)
3628         CPU=L
3629         CPUNAME=AXP
3630         RTL_ARCH=ALPHA
3631         PLATFORMID=linux_alpha
3632         OUTPATH=unxlngaxp
3633         ;;
3634     arm*)
3635         CPU=R
3636         CPUNAME=ARM
3637         EPM_FLAGS="-a arm"
3638         OUTPATH=unxlngr
3639         RTL_ARCH=ARM_EABI
3640         PLATFORMID=linux_arm_eabi
3641         case "$host_cpu" in
3642         arm*-linux)
3643             RTL_ARCH=ARM_OABI
3644             PLATFORMID=linux_arm_oabi
3645             ;;
3646         esac
3647         ;;
3648     hppa)
3649         CPU=H
3650         CPUNAME=HPPA
3651         RTL_ARCH=HPPA
3652         EPM_FLAGS="-a hppa"
3653         PLATFORMID=linux_hppa
3654         OUTPATH=unxlnghppa
3655         ;;
3656     i*86)
3657         CPU=I
3658         CPUNAME=INTEL
3659         RTL_ARCH=x86
3660         PLATFORMID=linux_x86
3661         OUTPATH=unxlngi6
3662         ;;
3663     ia64)
3664         CPU=A
3665         CPUNAME=IA64
3666         RTL_ARCH=IA64
3667         PLATFORMID=linux_ia64
3668         OUTPATH=unxlnga
3669         ;;
3670     mips)
3671         CPU=M
3672         CPUNAME=GODSON
3673         RTL_ARCH=MIPS_EB
3674         EPM_FLAGS="-a mips"
3675         PLATFORMID=linux_mips_eb
3676         OUTPATH=unxlngmips
3677         ;;
3678     mips64)
3679         CPU=M
3680         CPUNAME=GODSON
3681         RTL_ARCH=MIPS_EB
3682         EPM_FLAGS="-a mips64"
3683         PLATFORMID=linux_mips_eb
3684         OUTPATH=unxlngmips
3685         ;;
3686     mips64el)
3687         CPU=M
3688         CPUNAME=GODSON
3689         RTL_ARCH=MIPS_EL
3690         EPM_FLAGS="-a mips64el"
3691         PLATFORMID=linux_mips_el
3692         OUTPATH=unxlngmips
3693         ;;
3694     mipsel)
3695         CPU=M
3696         CPUNAME=GODSON
3697         RTL_ARCH=MIPS_EL
3698         EPM_FLAGS="-a mipsel"
3699         PLATFORMID=linux_mips_el
3700         OUTPATH=unxlngmips
3701         ;;
3702     m68k)
3703         CPU=6
3704         CPUNAME=M68K
3705         RTL_ARCH=M68K
3706         PLATFORMID=linux_m68k
3707         OUTPATH=unxlngm68k
3708         ;;
3709     powerpc)
3710         CPU=P
3711         CPUNAME=POWERPC
3712         RTL_ARCH=PowerPC
3713         PLATFORMID=linux_powerpc
3714         OUTPATH=unxlngppc
3715         ;;
3716     powerpc64)
3717         CPU=P
3718         CPUNAME=POWERPC64
3719         RTL_ARCH=PowerPC_64
3720         LIB64="lib64"
3721         PLATFORMID=linux_powerpc_64
3722         OUTPATH=unxlngppc64
3723         ;;
3724     sparc)
3725         CPU=S
3726         CPUNAME=SPARC
3727         RTL_ARCH=SPARC
3728         PLATFORMID=linux_sparc
3729         OUTPATH=unxlngs
3730         ;;
3731     s390)
3732         CPU=3
3733         CPUNAME=S390
3734         RTL_ARCH=S390
3735         PLATFORMID=linux_s390
3736         OUTPATH=unxlngs390
3737         ;;
3738     s390x)
3739         CPU=3
3740         CPUNAME=S390X
3741         RTL_ARCH=S390x
3742         LIB64="lib64"
3743         PLATFORMID=linux_s390x
3744         OUTPATH=unxlngs390x
3745         ;;
3746     x86_64)
3747         CPU=X
3748         CPUNAME=X86_64
3749         RTL_ARCH=X86_64
3750         LIB64="lib64"
3751         PLATFORMID=linux_x86_64
3752         OUTPATH=unxlngx6
3753         ;;
3754     *)
3755         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3756         ;;
3757     esac
3758     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3759     ;;
3761 linux-android*)
3762     COM=GCC
3763     GUI=UNX
3764     GUIBASE=not-used
3765     OS=ANDROID
3766     RTL_OS=Android
3767     P_SEP=:
3769     case "$host_cpu" in
3771     arm|armel)
3772         CPU=R
3773         CPUNAME=ARM
3774         RTL_ARCH=ARM_EABI
3775         PLATFORMID=android_arm_eabi
3776         OUTPATH=unxandr
3777         ;;
3778     mips|mipsel)
3779         CPU=M
3780         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
3781         RTL_ARCH=MIPS_EL
3782         PLATFORMID=android_mips_el
3783         OUTPATH=unxandm
3784         ;;
3785     i*86)
3786         CPU=I
3787         CPUNAME=INTEL
3788         RTL_ARCH=x86
3789         PLATFORMID=android_x86
3790         OUTPATH=unxandi
3791         ;;
3792     *)
3793         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3794         ;;
3795     esac
3796     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3797     ;;
3799 mingw*)
3800     COM=GCC
3801     GUI=WNT
3802     GUIBASE=not-used
3803     OS=WNT
3804     RTL_OS=Windows
3805     P_SEP=:
3807     case "$host_cpu" in
3808     i*86|x86_64)
3809         if test "$BITNESS_OVERRIDE" = 64; then
3810             CPU=X
3811             CPUNAME=X86_64
3812             RTL_ARCH=X86_84
3813             PLATFORMID=windows_x86_64
3814             OUTPATH=wntgccx$COMEX
3815         else
3816             CPU=I
3817             CPUNAME=INTEL
3818             RTL_ARCH=x86
3819             PLATFORMID=windows_x86
3820             OUTPATH=wntgcci$COMEX
3821         fi
3822         ;;
3823     *)
3824         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3825         ;;
3826     esac
3827     SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgcci"
3828     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3829     ;;
3831 *netbsd*)
3833     COM=GCC
3834     GUI=UNX
3835     GUIBASE=unx
3836     OS=NETBSD
3837     RTL_OS=NetBSD
3838     OUTPATH=unxnbsd
3839     P_SEP=:
3841     case "$host_cpu" in
3842     i*86)
3843         CPU=I
3844         CPUNAME=INTEL
3845         RTL_ARCH=x86
3846         PLATFORMID=netbsd_x86
3847         ;;
3848     powerpc)
3849         CPU=P
3850         CPUNAME=POWERPC
3851         RTL_ARCH=PowerPC
3852         PLATFORMID=netbsd_powerpc
3853         ;;
3854     sparc)
3855         CPU=S
3856         CPUNAME=SPARC
3857         RTL_ARCH=SPARC
3858         PLATFORMID=netbsd_sparc
3859         ;;
3860     x86_64)
3861         CPU=X
3862         CPUNAME=X86_64
3863         RTL_ARCH=X86_64
3864         PLATFORMID=netbsd_x86_64
3865         ;;
3866     *)
3867         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3868         ;;
3869     esac
3870     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3871     ;;
3873 openbsd*)
3874     COM=GCC
3875     GUI=UNX
3876     GUIBASE=unx
3877     OS=OPENBSD
3878     RTL_OS=OpenBSD
3879     OUTPATH=unxobsd
3880     P_SEP=:
3882     case "$host_cpu" in
3883     i*86)
3884         CPU=I
3885         CPUNAME=INTEL
3886         RTL_ARCH=x86
3887         PLATFORMID=openbsd_x86
3888         ;;
3889     x86_64)
3890         CPU=X
3891         CPUNAME=X86_64
3892         RTL_ARCH=X86_64
3893         PLATFORMID=openbsd_x86_64
3894         ;;
3895     *)
3896         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3897         ;;
3898     esac
3899     SOLARINC="$SOLARINC -I/usr/local/include"
3900     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3901     SOLARLIB="$SOLARLIB -L/usr/local/lib"
3903     ;;
3905 solaris*)
3907     COM=GCC
3908     GUI=UNX
3909     GUIBASE=unx
3910     OS=SOLARIS
3911     RTL_OS=Solaris
3912     P_SEP=:
3914     case "$host_cpu" in
3915     i*86)
3916         CPU=I
3917         CPUNAME=INTEL
3918         RTL_ARCH=x86
3919         PLATFORMID=solaris_x86
3920         OUTPATH=unxsogi
3921         ;;
3922     sparc)
3923         CPU=S
3924         CPUNAME=SPARC
3925         RTL_ARCH=SPARC
3926         PLATFORMID=solaris_sparc
3927         OUTPATH=unxsogs
3928         ;;
3929     *)
3930         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3931         ;;
3932     esac
3933     SOLARINC="$SOLARINC -I/usr/local/include"
3934     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3935     SOLARLIB="$SOLARLIB -L$COMPATH/lib"
3936     SOLARLIB="$SOLARLIB -L/usr/local/bin -L/usr/dt/lib -L/usr/openwin/lib"
3937     ;;
3940     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
3941     ;;
3942 esac
3944 if test "$enable_headless" = "yes"; then
3945     if test "$GUIBASE" != "unx"; then
3946         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --enable-headless])
3947     fi
3948     GUIBASE=headless
3951 INPATH="${OUTPATH}${PROEXT}"
3952 if test -n "${with_solver_and_workdir_root}"; then
3953     PathFormat "${with_solver_and_workdir_root}"
3954     # IsValidFilePath in /sal/osl/w32/file_url.cxx rejects "X:\\" breaking idlc
3955     if echo ${formatted_path} | $GREP -q '/$'; then
3956         WORKDIR=${formatted_path}workdir/${INPATH}
3957         INSTDIR=${formatted_path}instdir/${INPATH}
3958     else
3959         WORKDIR=${formatted_path}/workdir/${INPATH}
3960         INSTDIR=${formatted_path}/instdir/${INPATH}
3961     fi
3962 else
3963     WORKDIR=${BUILDDIR}/workdir/${INPATH}
3964     INSTDIR=${BUILDDIR}/instdir/${INPATH}
3966 OUTDIR="${SOLARVER}/${INPATH}"
3967 SOLARINC="-I. -I$SRC_ROOT/include -I${SOLARVER}/$INPATH/inc/external -I${SOLARVER}/$INPATH/inc $SOLARINC"
3968 AC_SUBST(COM)
3969 AC_SUBST(CPU)
3970 AC_SUBST(CPUNAME)
3971 AC_SUBST(RTL_OS)
3972 AC_SUBST(RTL_ARCH)
3973 AC_SUBST(EPM_FLAGS)
3974 AC_SUBST(GUI)
3975 AC_SUBST(GUIBASE)
3976 AC_SUBST(INPATH)
3977 AC_SUBST([INSTDIR])
3978 AC_SUBST(OS)
3979 AC_SUBST(OUTDIR)
3980 AC_SUBST(OUTPATH)
3981 AC_SUBST(P_SEP)
3982 AC_SUBST(SOLARVER)
3983 AC_SUBST(WORKDIR)
3984 AC_SUBST(PLATFORMID)
3985 AC_DEFINE_UNQUOTED(OUTDIR,"$OUTDIR")
3986 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
3988 dnl ===================================================================
3989 dnl Test which package format to use
3990 dnl ===================================================================
3991 AC_MSG_CHECKING([which package format to use])
3992 if test -n "$with_package_format"; then
3993     for i in $with_package_format; do
3994         case "$i" in
3995         aix | bsd | deb | inst | tardist | osx | pkg | rpm | setld | native | portable | archive | dmg | installed | msi)
3996             ;;
3997         *)
3998             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
3999 aix - AIX software distribution
4000 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4001 deb - Debian software distribution
4002 inst or tardist - IRIX software distribution
4003 osx - MacOS X software distribution
4004 pkg - Solaris software distribution
4005 rpm - RedHat software distribution
4006 setld - Tru64 (setld) software distribution
4007 native - "Native" software distribution for the platform
4008 portable - Portable software distribution
4010 LibreOffice additionally supports:
4011 archive - .tar.gz or .zip
4012 dmg - Mac OS X .dmg
4013 installed - installation tree
4014 msi - Windows .msi
4015         ])
4016             ;;
4017         esac
4018     done
4019     PKGFORMAT="$with_package_format"
4020 elif test "$enable_epm" = "yes"; then
4021     # defaults
4022     case "$_os" in
4023     Darwin)
4024         PKGFORMAT=dmg
4025         ;;
4026     SunOS)
4027         PKGFORMAT=pkg
4028         ;;
4029     Linux)
4030         # if building on Debian, default should be deb...
4031         if test -e /etc/debian_version; then
4032             PKGFORMAT=deb
4033         else
4034             PKGFORMAT=rpm
4035         fi
4036         ;;
4037     AIX)
4038         PKGFORMAT=rpm
4039         ;;
4040     OpenBSD|DragonFly)
4041         PKGFORMAT=portable
4042         ;;
4043     *BSD)
4044         PKGFORMAT=bsd
4045         ;;
4046     WINNT)
4047         PKGFORMAT=msi
4048         ;;
4049     # we never should get here since we check the arciecture/os at the beginning,
4050     # but go sure...
4051     *)
4052         AC_MSG_ERROR([unknown system])
4053     esac
4054 else
4055     if test "$WITH_MINGW" = "yes"; then
4056         # when tested, we should default this to 'msi', instead of 'archive'
4057         PKGFORMAT=archive
4058     else
4059         PKGFORMAT=native
4060     fi
4062 AC_MSG_RESULT([$PKGFORMAT])
4063 AC_SUBST(PKGFORMAT)
4065 dnl ===================================================================
4066 dnl Set up a different compiler to produce tools to run on the build
4067 dnl machine when doing cross-compilation
4068 dnl ===================================================================
4070 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4071 if test "$cross_compiling" = "yes"; then
4072     AC_MSG_CHECKING([for BUILD platform configuration])
4073     echo
4074     rm -rf CONF-FOR-BUILD config_build.mk
4075     mkdir CONF-FOR-BUILD
4076     (cd $SRC_ROOT && tar cf - \
4077         config.guess \
4078         config_host.mk.in \
4079         Makefile.in \
4080         lo.xcent.in \
4081         config_host/*.in \
4082         bin/get_config_variables \
4083         solenv/bin/getcompver.awk \
4084         solenv/inc/langlist.mk \
4085         instsetoo_native/util/openoffice.lst.in) \
4086     | (cd CONF-FOR-BUILD && tar xf -)
4087     cp configure CONF-FOR-BUILD
4088     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host
4089     (
4090     unset COM GUI GUIBASE OS CPU CPUNAME
4091     unset CC CXX SYSBASE CFLAGS
4092     unset AR NM OBJDUMP PKG_CONFIG RANLIB STRIP
4093     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4094     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
4095     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4096     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4097     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4098     cd CONF-FOR-BUILD
4099     sub_conf_opts=""
4100     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4101     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4102     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4103     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4104     test -n "${with_solver_and_workdir_root}" && sub_conf_opts="$sub_conf_opts --with-solver-and-workdir-root=${with_solver_and_workdir_root}"
4105     test -n "$with_system_boost_for_build" && sub_conf_opts="$sub_conf_opts --with-system-boost"
4106     test -n "$with_system_cppunit_for_build" && sub_conf_opts="$sub_conf_opts --with-system-cppunit"
4107     test -n "$with_system_expat_for_build" && sub_conf_opts="$sub_conf_opts --with-system-expat"
4108     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4109     test -n "$with_system_libxml_for_build" && sub_conf_opts="$sub_conf_opts --with-system-libxml"
4110     # we need the msi build tools on mingw if we are creating the
4111     # installation set
4112     if test "$WITH_MINGW" = "yes"; then
4113         enable_winegcc_for_build=
4114         for pkgformat in $PKGFORMAT; do
4115             case "$pkgformat" in
4116                 msi|native) enable_winegcc_for_build=yes ;;
4117             esac
4118         done
4119         test -n "$enable_winegcc_for_build" && sub_conf_opts="$sub_conf_opts --enable-winegcc"
4120     fi
4121     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4122     # Don't bother having configure look for stuff not needed for the build platform anyway
4123     ./configure \
4124         --disable-graphite \
4125         --disable-postgresql-sdbc \
4126         --with-parallelism="$with_parallelism" \
4127         --without-doxygen \
4128         --without-java \
4129         ENABLE_PDFIMPORT=FALSE \
4130         $sub_conf_opts \
4131         --srcdir=$srcdir \
4132         2>&1 | sed -e 's/^/    /'
4133     test -f ./config_host.mk 2>/dev/null || exit
4134     cp config_host.mk ../config_build.mk
4135     mv config.log ../config.Build.log
4136     mkdir -p ../config_build
4137     mv config_host/*.h ../config_build
4138     . ./bin/get_config_variables OS PATH CC CXX INPATH SYSTEM_LIBXSLT OUTDIR WORKDIR
4140     for V in OS CC CXX INPATH SYSTEM_LIBXSLT; do
4141         VV='$'$V
4142         VV=`eval "echo $VV"`
4143         if test -n "$VV"; then
4144             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4145             echo "$line" >>build-config
4146         fi
4147     done
4149     for V in OUTDIR WORKDIR; do
4150         VV='$'$V
4151         VV=`eval "echo $VV"`
4152         VV=`echo $VV | sed -e 's,/CONF-FOR-BUILD,,g'`
4153         if test -n "$VV"; then
4154             line="${V}_FOR_BUILD='$VV'"
4155             echo "$line" >>build-config
4156         fi
4157     done
4159     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4160     echo "$line" >>build-config
4162     )
4163     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4164     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])
4165     perl -pi -e 's,/CONF-FOR-BUILD,,g' config_build.mk
4166     eval `cat CONF-FOR-BUILD/build-config`
4167     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4168     rm -rf CONF-FOR-BUILD
4169 else
4170     OS_FOR_BUILD="$OS"
4171     CC_FOR_BUILD="$CC"
4172     CXX_FOR_BUILD="$CXX"
4173     INPATH_FOR_BUILD="$INPATH"
4174     OUTDIR_FOR_BUILD="$OUTDIR"
4175     WORKDIR_FOR_BUILD="$WORKDIR"
4177 AC_SUBST(OS_FOR_BUILD)
4178 AC_SUBST(INPATH_FOR_BUILD)
4179 AC_SUBST(OUTDIR_FOR_BUILD)
4180 AC_SUBST(WORKDIR_FOR_BUILD)
4182 dnl ===================================================================
4183 dnl Our version is defined by the AC_INIT() at the top of this script.
4184 dnl ===================================================================
4186 set `echo AC_PACKAGE_VERSION | sed "s/\./ /g"`
4188 LIBO_VERSION_MAJOR=$1
4189 LIBO_VERSION_MINOR=$2
4190 LIBO_VERSION_MICRO=$3
4191 LIBO_VERSION_PATCH=$4
4193 LIBO_VERSION_SUFFIX=$5
4194 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
4195 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
4196 # they get undoubled before actually passed to sed.
4197 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
4198 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
4199 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
4200 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
4202 AC_SUBST(LIBO_VERSION_MAJOR)
4203 AC_SUBST(LIBO_VERSION_MINOR)
4204 AC_SUBST(LIBO_VERSION_MICRO)
4205 AC_SUBST(LIBO_VERSION_PATCH)
4206 AC_SUBST(LIBO_VERSION_SUFFIX)
4207 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
4209 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
4210 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
4211 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
4212 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
4214 LIBO_THIS_YEAR=`date +%Y`
4215 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
4217 # This UPD silly thing must go away soon
4218 UPD="${LIBO_VERSION_MAJOR}${LIBO_VERSION_MINOR}0"
4219 AC_SUBST(UPD)
4221 # This too should go away
4222 SOURCEVERSION="OOO$UPD"
4223 AC_SUBST(SOURCEVERSION)
4225 dnl ===================================================================
4226 dnl Check for syslog header
4227 dnl ===================================================================
4228 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4230 dnl ===================================================================
4231 dnl Set the ENABLE_CRASHDUMP variable.
4232 dnl ===================================================================
4233 AC_MSG_CHECKING([whether to enable crashdump feature])
4234 if test "$enable_crashdump" = "yes"; then
4235     ENABLE_CRASHDUMP="TRUE"
4236     BUILD_TYPE="$BUILD_TYPE CRASHREP"
4237     AC_MSG_RESULT([yes])
4238 else
4239     ENABLE_CRASHDUMP=""
4240     AC_MSG_RESULT([no])
4242 AC_SUBST(ENABLE_CRASHDUMP)
4245 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4246 dnl ===================================================================
4247 AC_MSG_CHECKING([whether to turn warnings to errors])
4248 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4249     EXTERNAL_WARNINGS_NOT_ERRORS="FALSE"
4250     AC_MSG_RESULT([yes])
4251 else
4252     EXTERNAL_WARNINGS_NOT_ERRORS="TRUE"
4253     AC_MSG_RESULT([no])
4255 AC_SUBST(EXTERNAL_WARNINGS_NOT_ERRORS)
4257 dnl Set the ASSERT_ALWAYS_ABORT variable. (Activate --enable-assert-always-abort)
4258 dnl ===================================================================
4259 AC_MSG_CHECKING([whether to have assert to abort in release code])
4260 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4261     ASSERT_ALWAYS_ABORT="TRUE"
4262     AC_MSG_RESULT([yes])
4263 else
4264     ASSERT_ALWAYS_ABORT="FALSE"
4265     AC_MSG_RESULT([no])
4267 AC_SUBST(ASSERT_ALWAYS_ABORT)
4269 dnl Determine whether to use linkoo for the smoketest installation
4270 dnl ===================================================================
4271 AC_MSG_CHECKING([whether to use linkoo for the smoketest installation])
4272 if test $_os = Darwin; then
4273     enable_linkoo=no
4276 if test "$enable_linkoo" = "no"; then
4277     DISABLE_LINKOO="TRUE"
4278     AC_MSG_RESULT([no])
4279 else
4280     DISABLE_LINKOO=
4281     AC_MSG_RESULT([yes])
4283 AC_SUBST(DISABLE_LINKOO)
4285 # Set the ENABLE_LTO variable
4286 # ===================================================================
4287 AC_MSG_CHECKING([whether to use link-time optimization])
4288 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
4289     ENABLE_LTO="TRUE"
4290     AC_MSG_RESULT([yes])
4291 else
4292     ENABLE_LTO=""
4293     AC_MSG_RESULT([no])
4295 AC_SUBST(ENABLE_LTO)
4297 if test "$enable_headless" = "yes"; then
4298     # be sure to do not mess with uneeded stuff
4299     test_randr=no
4300     test_xrender=no
4301     test_cups=no
4302     test_dbus=no
4303     test_fontconfig=yes
4304     test_gtk=no
4305     build_gstreamer=no
4306     build_gstreamer_0_10=no
4307     test_tde=no
4308     test_kde=no
4309     test_kde4=no
4310     enable_cairo_canvas=no
4311     enable_gnome_vfs=no
4314 dnl ===================================================================
4315 dnl check for cups support
4316 dnl ===================================================================
4317 ENABLE_CUPS=""
4319 if test "$enable_cups" = "no"; then
4320     test_cups=no
4323 AC_MSG_CHECKING([whether to enable CUPS support])
4324 if test "$test_cups" = "yes"; then
4325     ENABLE_CUPS="TRUE"
4326     AC_MSG_RESULT([yes])
4328     AC_MSG_CHECKING([whether cups support is present])
4329     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4330     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4331     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -a "$ac_cv_header_cups_cups_h" != "yes"; then
4332         AC_MSG_ERROR([Could not find CUPS. Install libcupsys2-dev or cups-devel.])
4333     fi
4335 else
4336     AC_MSG_RESULT([no])
4339 AC_SUBST(ENABLE_CUPS)
4341 # fontconfig checks
4342 if test "$test_fontconfig" = "yes"; then
4343     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.2.0])
4344 else
4345     case "$BUILD_TYPE" in
4346     *FONTCONFIG*)
4347         FONTCONFIG_LIBS="-lfontconfig"
4348         ;;
4349     esac
4351 AC_SUBST(FONTCONFIG_CFLAGS)
4352 AC_SUBST(FONTCONFIG_LIBS)
4354 dnl whether to find & fetch external tarballs?
4355 dnl ===================================================================
4356 if test -z "$TARFILE_LOCATION"; then
4357     TARFILE_LOCATION="$SRC_ROOT/src"
4359 AC_SUBST(TARFILE_LOCATION)
4361 AC_MSG_CHECKING([whether we want to fetch tarballs])
4362 if test "$enable_fetch_external" != "no"; then
4363     if test "$with_all_tarballs" = "yes"; then
4364         AC_MSG_RESULT(["yes, all of them"])
4365         DO_FETCH_TARBALLS="ALL"
4366     else
4367         AC_MSG_RESULT(["yes, if we use them"])
4368         DO_FETCH_TARBALLS="YES"
4369     fi
4370 else
4371     AC_MSG_RESULT([no])
4372     DO_FETCH_TARBALLS="NO"
4374 AC_SUBST(DO_FETCH_TARBALLS)
4376 AC_MSG_CHECKING([whether to build help])
4377 if test "$with_help" = "yes" -a $_os != iOS -a $_os != Android; then
4378     AC_MSG_RESULT([yes])
4379     BUILD_TYPE="$BUILD_TYPE HELP"
4380     SCPDEFS="$SCPDEFS -DWITH_HELP"
4381     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4382 else
4383     AC_MSG_RESULT([no])
4386 dnl Test whether to include MySpell dictionaries
4387 dnl ===================================================================
4388 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4389 if test "$with_myspell_dicts" = "yes"; then
4390     AC_MSG_RESULT([yes])
4391     WITH_MYSPELL_DICTS=YES
4392     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4393     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4394 else
4395     AC_MSG_RESULT([no])
4396     WITH_MYSPELL_DICTS=NO
4398 AC_SUBST(WITH_MYSPELL_DICTS)
4400 AC_MSG_CHECKING([whether to use dicts from external paths])
4401 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4402     AC_MSG_RESULT([yes])
4403     SYSTEM_DICTS=YES
4404     AC_MSG_CHECKING([for spelling dictionary directory])
4405     if test -n "$with_external_dict_dir"; then
4406         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4407     else
4408         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4409         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4410             DICT_SYSTEM_DIR=file:///usr/share/myspell
4411         fi
4412     fi
4413     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4414     AC_MSG_CHECKING([for hyphenation patterns directory])
4415     if test -n "$with_external_hyph_dir"; then
4416         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4417     else
4418         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4419     fi
4420     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4421     AC_MSG_CHECKING([for thesaurus directory])
4422     if test -n "$with_external_thes_dir"; then
4423         THES_SYSTEM_DIR=file://$with_external_thes_dir
4424     else
4425         THES_SYSTEM_DIR=file:///usr/share/mythes
4426     fi
4427     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4428 else
4429     AC_MSG_RESULT([no])
4430     SYSTEM_DICTS=NO
4432 AC_SUBST(SYSTEM_DICTS)
4433 AC_SUBST(DICT_SYSTEM_DIR)
4434 AC_SUBST(HYPH_SYSTEM_DIR)
4435 AC_SUBST(THES_SYSTEM_DIR)
4437 dnl ===================================================================
4438 AC_MSG_CHECKING([whether to enable pch feature])
4439 if test -n "$enable_pch" && test "$enable_pch" != "no"; then
4440     if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
4441         ENABLE_PCH="TRUE"
4442         AC_MSG_RESULT([yes])
4443     elif test "$GCC" = "yes"; then
4444         ENABLE_PCH="TRUE"
4445         AC_MSG_RESULT([yes])
4446     else
4447         ENABLE_PCH=""
4448         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4449     fi
4450 else
4451     ENABLE_PCH=""
4452     AC_MSG_RESULT([no])
4454 AC_SUBST(ENABLE_PCH)
4456 dnl ===================================================================
4457 dnl Search all the common names for GNU make
4458 dnl ===================================================================
4459 AC_MSG_CHECKING([for GNU make])
4461 # try to use our own make if it is available and GNUMAKE was not already defined
4462 if test -z "$GNUMAKE"; then
4463     if test -x "/opt/lo/bin/make"; then
4464         GNUMAKE="/opt/lo/bin/make"
4465     fi
4468 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
4469     if test -n "$a"; then
4470         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
4471         if test $? -eq 0;  then
4472             GNUMAKE=`which $a`
4473             break
4474         fi
4475     fi
4476 done
4477 AC_MSG_RESULT($GNUMAKE)
4478 if test -z "$GNUMAKE"; then
4479     AC_MSG_ERROR([not found. install GNU make.])
4482 TAB=`printf '\t'`
4484 AC_MSG_CHECKING([the GNU make version])
4485 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4486 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4487 if test "$_make_longver" -ge "038200"; then
4488     AC_MSG_RESULT([$GNUMAKE $_make_version])
4490 elif test "$_make_longver" -ge "038100"; then
4491     if test "$build_os" = "cygwin"; then
4492         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4493     fi
4494     AC_MSG_RESULT([$GNUMAKE $_make_version])
4496     dnl ===================================================================
4497     dnl Search all the common names for sha1sum
4498     dnl ===================================================================
4499     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4500     if test -z "$SHA1SUM"; then
4501         AC_MSG_ERROR([install the approproate SHA-1 checksumming program for this OS])
4502     elif test "$SHA1SUM" = "openssl"; then
4503         SHA1SUM="openssl sha1"
4504     fi
4505     AC_MSG_CHECKING([for GNU make bug 20033])
4506     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4507     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4508 A := \$(wildcard *.a)
4510 .PHONY: all
4511 all: \$(A:.a=.b)
4512 <TAB>@echo survived bug20033.
4514 .PHONY: setup
4515 setup:
4516 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4518 define d1
4519 @echo lala \$(1)
4520 @sleep 1
4521 endef
4523 define d2
4524 @echo tyty \$(1)
4525 @sleep 1
4526 endef
4528 %.b : %.a
4529 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4530 <TAB>\$(call d1,\$(CHECKSUM)),\
4531 <TAB>\$(call d2,\$(CHECKSUM)))
4533     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4534         no_parallelism_make="YES"
4535         AC_MSG_RESULT([yes, disable parallelism])
4536     else
4537         AC_MSG_RESULT([no, keep parallelism enabled])
4538     fi
4539     rm -rf $TESTGMAKEBUG20033
4540 else
4541     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4544 # find if gnumake support file function
4545 AC_MSG_CHECKING([whether GNU make supports the 'file' function])
4546 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4547 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4548 \$(file >test.txt,Success )
4550 .PHONY: all
4551 all:
4552 <TAB>@cat test.txt
4555 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4556 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4557     HAVE_GNUMAKE_FILE_FUNC="YES"
4558     AC_MSG_RESULT([yes])
4559 else
4560     AC_MSG_RESULT([no])
4562 rm -rf $TESTGMAKEFILEFUNC
4563 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4564 AC_SUBST(GNUMAKE)
4566 _make_ver_check=`$GNUMAKE --version | grep LibreOffice`
4567 STALE_MAKE=
4568 make_warning=
4569 if test "$_make_ver_check" = ""; then
4570    STALE_MAKE=TRUE
4573 HAVE_LD_HASH_STYLE=FALSE
4574 WITH_LINKER_HASH_STYLE=
4575 AC_MSG_CHECKING( for --hash-style gcc linker support )
4576 if test "$GCC" = "yes"; then
4577     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4578         hash_styles="gnu sysv"
4579     elif test "$with_linker_hash_style" = "no"; then
4580         hash_styles=
4581     else
4582         hash_styles="$with_linker_hash_style"
4583     fi
4585     for hash_style in $hash_styles; do
4586         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4587         hash_style_ldflags_save=$LDFLAGS
4588         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
4590         AC_LINK_IFELSE([AC_LANG_PROGRAM(
4591             [
4592 #include <stdio.h>
4593             ],[
4594 printf ("");
4595             ])],
4596             [ if ./conftest$EXEEXT; then
4597                   HAVE_LD_HASH_STYLE=TRUE
4598                   WITH_LINKER_HASH_STYLE=$hash_style
4599               fi],
4600             [HAVE_LD_HASH_STYLE=FALSE])
4601         LDFLAGS=$hash_style_ldflags_save
4602     done
4604     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
4605         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
4606     else
4607         AC_MSG_RESULT( no )
4608     fi
4609     LDFLAGS=$hash_style_ldflags_save
4610 else
4611     AC_MSG_RESULT( no )
4613 AC_SUBST(HAVE_LD_HASH_STYLE)
4614 AC_SUBST(WITH_LINKER_HASH_STYLE)
4616 dnl ===================================================================
4617 dnl Check whether there's a Perl version available.
4618 dnl ===================================================================
4619 if test -z "$with_perl_home"; then
4620     AC_PATH_PROG(PERL, perl)
4621 else
4622     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
4623     _perl_path="$with_perl_home/bin/perl"
4624     if test -x "$_perl_path"; then
4625         PERL=$_perl_path
4626     else
4627         AC_MSG_ERROR([$_perl_path not found])
4628     fi
4631 dnl ===================================================================
4632 dnl Testing for Perl version 5 or greater.
4633 dnl $] is the Perl version variable, it is returned as an integer
4634 dnl ===================================================================
4635 if test "$PERL"; then
4636     AC_MSG_CHECKING([the Perl version])
4637     ${PERL} -e "exit($]);"
4638     _perl_version=$?
4639     if test "$_perl_version" -lt 5; then
4640         AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
4641     fi
4642     AC_MSG_RESULT([checked (perl $_perl_version)])
4643 else
4644     AC_MSG_ERROR([Perl not found, install version 5 of Perl])
4647 dnl ===================================================================
4648 dnl Testing for required Perl modules
4649 dnl ===================================================================
4651 AC_MSG_CHECKING([for required Perl modules])
4652 if `$PERL -e 'use Archive::Zip; use Cwd; use Digest::MD5'`; then
4653     AC_MSG_RESULT([all modules found])
4654 else
4655     AC_MSG_ERROR([Failed to find some modules])
4659 dnl ===================================================================
4660 dnl Check for pkg-config
4661 dnl ===================================================================
4662 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
4663     PKG_PROG_PKG_CONFIG
4666 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
4668     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
4669     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
4670     # explicitly. Or put /path/to/compiler in PATH yourself.
4672     AC_CHECK_TOOL(AR,ar)
4673     AC_CHECK_TOOL(NM,nm)
4674     AC_CHECK_TOOL(OBJDUMP,objdump)
4675     AC_CHECK_TOOL(RANLIB,ranlib)
4676     AC_CHECK_TOOL(STRIP,strip)
4677     if test "$_os" = "WINNT"; then
4678         AC_CHECK_TOOL(DLLTOOL,dlltool)
4679         AC_CHECK_TOOL(WINDRES,windres)
4680     fi
4682 AC_SUBST(AR)
4683 AC_SUBST(DLLTOOL)
4684 AC_SUBST(NM)
4685 AC_SUBST(OBJDUMP)
4686 AC_SUBST(PKG_CONFIG)
4687 AC_SUBST(RANLIB)
4688 AC_SUBST(STRIP)
4689 AC_SUBST(WINDRES)
4691 dnl ===================================================================
4692 dnl pkg-config checks on Mac OS X
4693 dnl ===================================================================
4695 if test $_os = Darwin; then
4696     AC_MSG_CHECKING([for bogus pkg-config])
4697     if test -n "$PKG_CONFIG"; then
4698         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
4699             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
4700         else
4701             if test "$enable_bogus_pkg_config" = "yes"; then
4702                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
4703             else
4704                 AC_MSG_ERROR([yes, from unknown origin. This *will* break the build. Please remove or hide $PKG_CONFIG])
4705             fi
4706         fi
4707     else
4708         AC_MSG_RESULT([no, good])
4709     fi
4712 find_csc()
4714     # Return value: $csctest
4716     unset csctest
4718     if test $VCVER -eq 90; then
4719         reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v3.5/InstallPath"
4720         if test -n "$regvalue"; then
4721             csctest=$regvalue
4722             return
4723         fi
4724         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/InstallRoot
4725         if test -n "$regvalue"; then
4726             csctest=${regvalue}"v2.0.50727"
4727             return
4728         fi
4729     else
4730         reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
4731         if test -n "$regvalue"; then
4732             csctest=$regvalue
4733             return
4734         fi
4735     fi
4738 find_al()
4740     # Return value: $altest
4742     unset altest
4744     for x in `ls /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
4745         reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
4746         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
4747             altest=$regvalue
4748             return
4749         fi
4750     done
4753 find_dotnetsdk()
4755     # Return value: $frametest (that's a silly name...)
4757     unset frametest
4759     for ver in 1.1 2.0; do
4760         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
4761         if test -n "$regvalue"; then
4762             frametest=$regvalue
4763             return
4764         fi
4765     done
4768 find_winsdk_version()
4770     # Args: $1 : SDK version as in "6.0A", "7.0" etc
4771     # Return value: $winsdktest
4773     unset winsdktest
4775     # Why we look for them in this particular order I don't know. But OTOH I
4776     case "$1" in
4777     6.0*|7.*)
4778         reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
4779         if test -n "$regvalue"; then
4780             winsdktest=$regvalue
4781             return
4782         fi
4783         ;;
4784     8.*)
4785         reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
4786         if test -n "$regvalue"; then
4787             winsdktest=$regvalue
4788             return
4789         fi
4790         ;;
4791     esac
4794 find_winsdk()
4796     # Args: $1 (optional) : list of acceptable SDK versions
4797     # Return value: $winsdktest
4799     unset winsdktest
4801     if test -n "$1"; then
4802         sdkversions=$1
4803     else
4804         sdkversions="$WINDOWS_SDK_ACCEPTABLE_VERSIONS"
4805     fi
4807     for ver in $sdkversions; do
4808         find_winsdk_version $ver
4809         if test -n "$winsdktest"; then
4810             return
4811         fi
4812     done
4815 find_msms()
4817     for ver in 9.0 10.0 11.0; do
4818         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
4819         if test -n "$regvalue"; then
4820             if test -e "$regvalue/Microsoft_VC${VCVER}_CRT_x86.msm"; then
4821                 msmdir=$regvalue
4822                 break
4823             fi
4824         fi
4825     done
4826     if test -z "$msmdir"; then
4827         AC_MSG_NOTICE([no registry entry for Merge Module directory - trying "$COMMONPROGRAMFILES\Merge Modules"])
4828         msmdir="$COMMONPROGRAMFILES\Merge Modules"
4829     fi
4830     msmdir=`cygpath -d "$msmdir"`
4831     msmdir=`cygpath -u "$msmdir"`
4832     if test -z "$msmdir"; then
4833         AC_MSG_ERROR([Merge modules not found])
4834     fi
4836     msms="Microsoft_VC${VCVER}_CRT_x86.msm"
4838     if test "$VCVER" = "90"; then
4839         if test -e $msmdir/policy_9_0_Microsoft_VC90_CRT_x86.msm; then
4840             msms="$msms policy_9_0_Microsoft_VC90_CRT_x86.msm"
4841         else
4842             AC_MSG_ERROR([Merge module policy_9_0_Microsoft_VC90_CRT_x86.msm not found])
4843         fi
4844     fi
4846     if test "$BUILD_X64" = TRUE; then
4847         if test "$VCVER" = "90"; then
4848             if test -e $msmdir/policy_9_0_Microsoft_VC90_CRT_x86_x64.msm; then
4849                 msms="$msms policy_9_0_Microsoft_VC90_CRT_x86_x64.msm"
4850             else
4851                 AC_MSG_ERROR([Merge module policy_9_0_Microsoft_VC90_CRT_x86_x64.msm not found])
4852             fi
4853             if test -e $msmdir/Microsoft_VC90_CRT_x86_x64.msm; then
4854                 msms="$msms Microsoft_VC90_CRT_x86_x64.msm"
4855             else
4856                 AC_MSG_ERROR([Merge module Microsoft_VC90_CRT_x86_x64.msm not found])
4857             fi
4858         else
4859             if test -e $msmdir/Microsoft_VC${VCVER}_CRT_x64.msm; then
4860                 msms="$msms Microsoft_VC${VCVER}_CRT_x64.msm"
4861             else
4862                 AC_MSG_ERROR([Merge module Microsoft_VC${VCVER}_CRT_x64.msm not found])
4863             fi
4864         fi
4865     fi
4868 find_msvc_dlls()
4870     if test "$CPUNAME" = "INTEL"; then
4871         vsarch=x86
4872     elif test $VCVER = 9; then
4873         vsarch=amd64
4874     else
4875         vsarch=x64
4876     fi
4878     msvcdllpath="$VC_PRODUCT_DIR/redist/$vsarch/Microsoft.VC${VCVER}.CRT"
4879     MSVC_DEBUG_DLL_PATH="$VC_PRODUCT_DIR/redist/Debug_NonRedist/$vsarch/Microsoft.VC${VCVER}.DebugCRT"
4880     msvcdlls="msvcp${VCVER}.dll msvcr${VCVER}.dll"
4881     MSVC_DEBUG_DLLS="msvcp${VCVER}d.dll msvcr${VCVER}d.dll"
4882     if test "$VCVER" = "90"; then
4883         msvcdlls="$msvcdlls msvcm90.dll Microsoft.VC90.CRT.manifest"
4884         MSVC_DEBUG_DLLS="$MSVC_DEBUG_DLLS msvcm90d.dll Microsoft.VC90.DebugCRT.manifest"
4885     fi
4887     for dll in $msvcdlls; do
4888         if ! test -f "$msvcdllpath/$dll"; then
4889             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
4890         fi
4891     done
4892     if test -n "$MSVC_USE_DEBUG_RUNTIME"; then
4893         for dll in $MSVC_DEBUG_DLLS; do
4894             if ! test -f "$MSVC_DEBUG_DLL_PATH/$dll"; then
4895                 AC_MSG_ERROR([can not find $dll in $MSVC_DEBUG_DLL_PATH])
4896             fi
4897         done
4898     fi
4902 if test "$build_os" = "cygwin"; then
4903     dnl Check midl.exe
4904     AC_MSG_CHECKING([for midl.exe])
4906     find_winsdk
4907     if test -f "$winsdktest/Bin/midl.exe"; then
4908         MIDL_PATH="$winsdktest/Bin"
4909     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
4910         MIDL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
4911     fi
4912     if test ! -f "$MIDL_PATH/midl.exe"; then
4913         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
4914     else
4915         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
4916     fi
4918     # Convert to posix path with 8.3 filename restrictions ( No spaces )
4919     MIDL_PATH=`cygpath -d "$MIDL_PATH"`
4920     MIDL_PATH=`cygpath -u "$MIDL_PATH"`
4922     dnl Check csc.exe
4923     AC_MSG_CHECKING([for csc.exe])
4924     find_csc
4925     if test -f "$csctest/csc.exe"; then
4926         CSC_PATH="$csctest"
4927     fi
4928     if test ! -f "$CSC_PATH/csc.exe"; then
4929         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
4930     else
4931         AC_MSG_RESULT([$CSC_PATH/csc.exe])
4932     fi
4934     CSC_PATH=`cygpath -d "$CSC_PATH"`
4935     CSC_PATH=`cygpath -u "$CSC_PATH"`
4937     dnl Check al.exe
4938     AC_MSG_CHECKING([for al.exe])
4939     find_winsdk
4940     if test -f "$winsdktest/Bin/al.exe"; then
4941         AL_PATH="$winsdktest/Bin"
4942     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
4943         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
4944     fi
4946     if test -z "$AL_PATH"; then
4947         find_al
4948         if test -f "$altest/bin/al.exe"; then
4949             AL_PATH="$altest/bin"
4950         elif test -f "$altest/al.exe"; then
4951             AL_PATH="$altest"
4952         fi
4953     fi
4954     if test ! -f "$AL_PATH/al.exe"; then
4955         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
4956     else
4957         AC_MSG_RESULT([$AL_PATH/al.exe])
4958     fi
4960     AL_PATH=`cygpath -d "$AL_PATH"`
4961     AL_PATH=`cygpath -u "$AL_PATH"`
4963     dnl Check mscoree.lib / .NET Framework dir
4964     AC_MSG_CHECKING(.NET Framework)
4965     find_dotnetsdk
4966     if test -f "$frametest/lib/mscoree.lib"; then
4967         DOTNET_FRAMEWORK_HOME="$frametest"
4968     else
4969         find_winsdk
4970         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/win8/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
4971             DOTNET_FRAMEWORK_HOME="$winsdktest"
4972         fi
4973     fi
4975     if test ! -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib" -a ! -f "$DOTNET_FRAMEWORK_HOME/lib/win8/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
4976         AC_MSG_ERROR([mscoree.lib (.NET Framework) not found])
4977     fi
4978     AC_MSG_RESULT(found)
4980     PathFormat "$MIDL_PATH"
4981     MIDL_PATH="$formatted_path"
4983     PathFormat "$AL_PATH"
4984     AL_PATH="$formatted_path"
4986     PathFormat "$DOTNET_FRAMEWORK_HOME"
4987     DOTNET_FRAMEWORK_HOME="$formatted_path"
4989     PathFormat "$CSC_PATH"
4990     CSC_PATH="$formatted_path"
4993 dnl ===================================================================
4994 dnl Check if stdc headers are available excluding MSVC.
4995 dnl ===================================================================
4996 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
4997     AC_HEADER_STDC
5000 dnl ===================================================================
5001 dnl Testing for C++ compiler and version...
5002 dnl ===================================================================
5004 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5005     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5006     save_CXXFLAGS=$CXXFLAGS
5007     AC_PROG_CXX
5008     CXXFLAGS=$save_CXXFLAGS
5009 else
5010     if test -n "$CC" -a -z "$CXX"; then
5011         CXX="$CC"
5012     fi
5015 dnl check if we are using a buggy version of g++ (currently 3.4.0, 3.4.1 and trunk)
5016 if test "$GXX" = "yes"; then
5017     AC_MSG_CHECKING([the GNU C++ compiler version])
5019     _gpp_version=`$CXX -dumpversion`
5020     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5022     AC_MSG_RESULT([checked (g++ $_gpp_version)])
5024     if test "$_gpp_majmin" = "304"; then
5025         AC_MSG_CHECKING([whether $CXX has the enum bug])
5026         AC_RUN_IFELSE([AC_LANG_SOURCE([[
5027             extern "C" void abort (void);
5028             extern "C" void exit (int status);
5030             enum E { E0, E1, E2, E3, E4, E5 };
5032             void test (enum E e)
5033             {
5034                 if (e == E2 || e == E3 || e == E1)
5035                     exit (1);
5036             }
5038             int main (void)
5039             {
5040                 test (E4);
5041                 test (E5);
5042                 test (E0);
5043                 return 0;
5044             }
5045             ]])],[AC_MSG_ERROR([your version of the GNU C++ compile has a bug which prevents LibreOffice from being compiled correctly - please check http://gcc.gnu.org/ml/gcc-patches/2004-07/msg00968.html for details.])],[AC_MSG_RESULT([no])],[])
5046     fi
5047     dnl see https://code.google.com/p/android/issues/detail?id=41770
5048     if test "$_gpp_majmin" -ge "407"; then
5049             glibcxx_threads=no
5050             AC_LANG_PUSH([C++])
5051             AC_REQUIRE_CPP
5052             AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5053             AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5054                 #include <bits/c++config.h>]],[[
5055                 #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5056                 && !defined(_GLIBCXX__PTHREADS) \
5057                 && !defined(_GLIBCXX_HAS_GTHREADS)
5058                 choke me
5059                 #endif
5060             ]])],[AC_MSG_RESULT([yes])
5061             glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5062             AC_LANG_POP([C++])
5063             if test $glibcxx_threads = yes; then
5064                   BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5065             fi
5066      fi
5068 AC_SUBST(BOOST_CXXFLAGS)
5071 # prefx CXX with ccache if needed
5073 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5074     if test "$CCACHE" != ""; then
5075         AC_MSG_CHECKING([whether $CXX is already ccached])
5076         AC_LANG_PUSH([C++])
5077         save_CXXFLAGS=$CXXFLAGS
5078         CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5079         dnl an empty program will do, we're checking the compiler flags
5080         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5081                           [use_ccache=yes], [use_ccache=no])
5082         if test $use_ccache = yes; then
5083             AC_MSG_RESULT([yes])
5084         else
5085             CXX="$CCACHE $CXX"
5086             AC_MSG_RESULT([no])
5087         fi
5088         CXXFLAGS=$save_CXXFLAGS
5089         AC_LANG_POP([C++])
5090     fi
5093 dnl ===================================================================
5094 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5095 dnl ===================================================================
5097 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5098     AC_PROG_CXXCPP
5100     dnl Check whether there's a C pre-processor.
5101     dnl ===================================================================
5102     dnl When using SunStudio compiler, there is a bug with the cc
5103     dnl preprocessor, so use CC preprocessor as the cc preprocessor
5104     dnl See Issuezilla #445.
5105     dnl ===================================================================
5106     if test "$_os" = "SunOS"; then
5107         CPP=$CXXCPP
5108     else
5109         AC_PROG_CPP
5110     fi
5114 dnl ===================================================================
5115 dnl Find integral type sizes and alignments
5116 dnl ===================================================================
5118 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5120     AC_CHECK_SIZEOF(long)
5121     AC_CHECK_SIZEOF(short)
5122     AC_CHECK_SIZEOF(int)
5123     AC_CHECK_SIZEOF(long long)
5124     AC_CHECK_SIZEOF(double)
5125     AC_CHECK_SIZEOF(void*)
5127     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5128     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5129     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5130     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5131     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5133     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5134     m4_pattern_allow([AC_CHECK_ALIGNOF])
5135     m4_ifdef([AC_CHECK_ALIGNOF],
5136         [
5137             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5138             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5139             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5140             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5141         ],
5142         [
5143             case "$_os-$host_cpu" in
5144             Linux-i686)
5145                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5146                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5147                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5148                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5149                 ;;
5150             Linux-x86_64)
5151                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5152                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5153                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5154                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5155                 ;;
5156             *)
5157                 if test -z "$ac_cv_alignof_short" -o \
5158                         -z "$ac_cv_alignof_int" -o \
5159                         -z "$ac_cv_alignof_long" -o \
5160                         -z "$ac_cv_alignof_double"; then
5161                    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.])
5162                 fi
5163                 ;;
5164             esac
5165         ])
5167     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5168     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5169     if test $ac_cv_sizeof_long -eq 8; then
5170         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5171     elif test $ac_cv_sizeof_double -eq 8; then
5172         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5173     else
5174         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5175     fi
5177     AC_C_BIGENDIAN
5178     WORDS_BIGENDIAN=$ac_cv_c_bigendian
5180     dnl Check for large file support
5181     AC_SYS_LARGEFILE
5182     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5183         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5184     fi
5185     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5186         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5187     fi
5188 else
5189     # Hardcode for MSVC
5190     SAL_TYPES_SIZEOFSHORT=2
5191     SAL_TYPES_SIZEOFINT=4
5192     SAL_TYPES_SIZEOFLONG=4
5193     SAL_TYPES_SIZEOFLONGLONG=8
5194     if test "$BITNESS_OVERRIDE" = ""; then
5195         SAL_TYPES_SIZEOFPOINTER=4
5196     else
5197         SAL_TYPES_SIZEOFPOINTER=8
5198     fi
5199     SAL_TYPES_ALIGNMENT2=2
5200     SAL_TYPES_ALIGNMENT4=4
5201     SAL_TYPES_ALIGNMENT8=8
5202     WORDS_BIGENDIAN=no
5203     LFS_CFLAGS=''
5205 AC_SUBST(WORDS_BIGENDIAN)
5206 AC_SUBST(LFS_CFLAGS)
5208 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5209 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5210 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5211 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5212 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5213 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5214 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5215 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5217 dnl ===================================================================
5218 dnl Check if valgrind headers are available
5219 dnl ===================================================================
5220 if test "$cross_compiling" = yes; then
5221     ENABLE_VALGRIND=FALSE
5222 else
5223     prev_cppflags=$CPPFLAGS
5224     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5225     AC_CHECK_HEADER([valgrind/valgrind.h],
5226         [ENABLE_VALGRIND=TRUE],[ENABLE_VALGRIND=FALSE])
5227     CPPFLAGS=$prev_cppflags
5229 AC_SUBST([ENABLE_VALGRIND])
5230 if test "$ENABLE_VALGRIND" = FALSE; then
5231     VALGRIND_CFLAGS=
5233 AC_SUBST([VALGRIND_CFLAGS])
5235 dnl ===================================================================
5236 dnl Compiler plugins
5237 dnl ===================================================================
5239 COMPILER_PLUGINS=
5240 # currently only Clang
5241 if test "$COM_GCC_IS_CLANG" = "TRUE"; then
5242     if test -n "$enable_compiler_plugins"; then
5243         compiler_plugins="$enable_compiler_plugins"
5244     elif test -n "$ENABLE_DBGUTIL"; then
5245         compiler_plugins=test
5246     else
5247         compiler_plugins=no
5248     fi
5249     if test "$compiler_plugins" != "no"; then
5250         dnl The prefix where Clang resides, override to where Clang resides if
5251         dnl using a source build:
5252         if test -z "$CLANGDIR"; then
5253             CLANGDIR=/usr
5254         fi
5255         dnl The build directory (different from CLANGDIR if using a Clang out-
5256         dnl of-source build):
5257         if test -z "$CLANGBUILD"; then
5258             CLANGBUILD=/usr
5259         fi
5260         AC_LANG_PUSH([C++])
5261         save_CPPFLAGS=$CPPFLAGS
5262         CPPFLAGS="$CPPFLAGS -I$CLANGDIR/include -I$CLANGDIR/tools/clang/include -I$CLANGBUILD/include -I$CLANGBUILD/tools/clang/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
5263         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
5264             [COMPILER_PLUGINS=TRUE],
5265             [
5266             if test "$compiler_plugins" = "yes"; then
5267                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
5268             else
5269                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
5270                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
5271             fi
5272             ])
5273         CPPFLAGS=$save_CPPFLAGS
5274         AC_LANG_POP([C++])
5275     fi
5276 else
5277     if test "$enable_compiler_plugins" = "yes"; then
5278         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
5279     fi
5281 AC_SUBST(COMPILER_PLUGINS)
5282 AC_SUBST(CLANGDIR)
5283 AC_SUBST(CLANGBUILD)
5285 dnl ===================================================================
5286 dnl Set the MinGW sys-root
5287 dnl ===================================================================
5288 if test "$WITH_MINGW" = "yes"; then
5289     AC_MSG_CHECKING([for MinGW sysroot])
5290     sysroot=`$CC -print-sysroot`
5291     AS_IF([test -d "$sysroot"/mingw],
5292           [MINGW_SYSROOT="$sysroot"/mingw
5293            AC_MSG_RESULT([$MINGW_SYSROOT])],
5294           [AC_MSG_RESULT([not found])
5295            AC_MSG_ERROR([cannot determine MinGW sysroot])])
5297 AC_SUBST([MINGW_DLLS])
5298 AC_SUBST([MINGW_SYSROOT])
5300 dnl ===================================================================
5301 dnl Set the MinGW include directories
5302 dnl ===================================================================
5303 if test "$WITH_MINGW" = "yes"; then
5304     AC_MSG_CHECKING([for MinGW include path])
5305     cat >conftest.$ac_ext <<_ACEOF
5306 #include <stddef.h>
5307 #include <bits/c++config.h>
5308 _ACEOF
5309     _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`
5310     rm conftest.$ac_ext
5311     if test -z "$_mingw_lib_include_path"; then
5312         _mingw_lib_include_path="NO_LIB_INCLUDE"
5313         AC_MSG_RESULT([no MinGW include path])
5314     else
5315         AC_MSG_RESULT([$_mingw_lib_include_path])
5316     fi
5317     MINGW_LIB_INCLUDE_PATH="$_mingw_lib_include_path"
5318     AC_SUBST(MINGW_LIB_INCLUDE_PATH)
5320     AC_LANG_PUSH([C++])
5322     AC_MSG_CHECKING([for dynamic libgcc])
5323     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5324 #include <iostream>
5325 using namespace std;
5326 ]], [[ try { throw 42; } catch (int e) { cout << "Yep, " << e << endl; } ]])],[
5327             MINGW_GCCDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libgcc' | $SED -e 's@.*DLL Name: @@'`
5328             if test -n "$MINGW_GCCDLL"; then
5329                 MINGW_SHARED_GCCLIB=YES
5330                 AC_MSG_RESULT([ $MINGW_GCCDLL])
5331             else
5332                 MINGW_SHARED_GCCLIB=NO
5333                 AC_MSG_RESULT([no])
5334             fi
5335        ],[ AC_MSG_RESULT([no])
5337     ])
5339     AC_MSG_CHECKING([for dynamic libstdc++])
5340     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5341 #include <iostream>
5342 using namespace std;
5343 ]], [[ cout << "Hello there." << endl; ]])],[
5344             MINGW_GXXDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libstdc++' | $SED -e 's@.*DLL Name: @@'`
5345             if test -n "$MINGW_GXXDLL"; then
5346                 mingw_gxxdll_root=${MINGW_GXXDLL%.dll}
5347                 mingw_gxxdll_root=${mingw_gxxdll_root#lib}
5348                 if test "$CROSS_COMPILING" = "YES"; then
5349                     dnl m4 escaping!
5350                     mingw_gxxdll_root=${mingw_gxxdll_root%-[[0-9]]}
5351                 fi
5352                 MINGW_SHARED_LIBSTDCPP=-l$mingw_gxxdll_root
5353                 MINGW_SHARED_GXXLIB=YES
5354                 AC_MSG_RESULT([$MINGW_GXXDLL])
5355             else
5356                 MINGW_SHARED_GXXLIB=NO
5357                 AC_MSG_RESULT([no])
5358             fi
5359        ],[ AC_MSG_RESULT([no])
5361     ])
5363     AC_LANG_POP([C++])
5365     AC_SUBST(MINGW_SHARED_GCCLIB)
5366     AC_SUBST(MINGW_SHARED_GXXLIB)
5367     AC_SUBST(MINGW_SHARED_LIBSTDCPP)
5368     AC_SUBST(MINGW_GCCDLL)
5369     AC_SUBST(MINGW_GXXDLL)
5372 if test "$WITH_MINGW" = "yes"; then
5373     AC_MSG_CHECKING([for fMergeNeutralItems in SCRIPT_CONTROL])
5374     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
5375     [
5376     #include <usp10.h>
5377     ],
5378     [
5379     SCRIPT_CONTROL c;
5380     c.fMergeNeutralItems = 1;
5381     ])],
5382     [
5383     AC_MSG_RESULT(yes)
5384     AC_DEFINE(HAVE_FMERGENEUTRALITEMS)
5385     ],
5386     [AC_MSG_RESULT(no)])
5389 dnl ===================================================================
5390 dnl Extra checking for the SunOS compiler
5391 dnl ===================================================================
5392 if test "$_os" = "SunOS"; then
5393     dnl SunStudio C++ compiler packaged with SunStudio C compiler
5394     if test "$CC" = "cc"; then
5395     AC_MSG_CHECKING([SunStudio C++ Compiler])
5396         if test "$CXX" != "CC"; then
5397             AC_MSG_WARN([SunStudio C++ was not found])
5398             add_warning "SunStudio C++ was not found"
5399         else
5400             AC_MSG_RESULT([checked])
5401         fi
5402     fi
5405 dnl *************************************************************
5406 dnl Testing for exception handling - dwarf2 or sjlj exceptions...
5407 dnl *************************************************************
5408 if test "$WITH_MINGW" = "yes"; then
5409     AC_MSG_CHECKING([exception type])
5410     AC_LANG_PUSH([C++])
5411     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iostream>
5413         extern "C" void _Unwind_SjLj_RaiseException(void) __attribute__ ((__noreturn__));
5415         ]], [[_Unwind_SjLj_RaiseException() ]])],[exceptions_type="sjlj"],[exceptions_type="dwarf2"
5416     ])
5417     AC_MSG_RESULT($exceptions_type)
5418     AC_LANG_POP([C++])
5421 EXCEPTIONS="$exceptions_type"
5422 AC_SUBST(EXCEPTIONS)
5424 dnl ===================================================================
5425 dnl thread-safe statics
5426 dnl ===================================================================
5427 AC_MSG_CHECKING([whether $CXX supports thread safe statics])
5428 unset HAVE_THREADSAFE_STATICS
5429 if test "$GCC" = "yes"; then
5430     dnl -fthreadsafe-statics is available since GCC 4, so always available for
5431     dnl us.  However, some C++ runtimes use a single lock for all static
5432     dnl variables, which can cause deadlock in multi-threaded applications.
5433     dnl This is not easily tested here; for POSIX-based systems, if executing
5434     dnl the following C++ program does not terminate then the tool chain
5435     dnl apparently has this problem:
5436     dnl
5437     dnl   #include <pthread.h>
5438     dnl   int h() { return 0; }
5439     dnl   void * g(void * unused) {
5440     dnl     static int n = h();
5441     dnl     return &n;
5442     dnl   }
5443     dnl   int f() {
5444     dnl     pthread_t t;
5445     dnl     pthread_create(&t, 0, g, 0);
5446     dnl     pthread_join(t, 0);
5447     dnl     return 0;
5448     dnl   }
5449     dnl   int main() {
5450     dnl     static int n = f();
5451     dnl     return n;
5452     dnl   }
5453     dnl
5454     dnl Mac OS X up to at least 10.7.1 is known to have this problem, as is at
5455     dnl least one instance of GCC 4.2.4 (used on a "Linux ooobuild1.osuosl.org
5456     dnl 2.6.9-101.plus.c4smp #1 SMP Thu Jul 21 19:08:15 EDT 2011 i686 i686 i386
5457     dnl GNU/Linux" machine); see the definition of __cxa_guard_acquire in GCC's
5458     dnl libstdc++-v3/libsupc++/guard.cc for what #ifdefs actually make a
5459     dnl difference there.  Conservative advice from Jakub Jelinek is to assume
5460     dnl it working in GCC >= 4.3:
5461     if test "$_os" = "Darwin" -o $_os = Android -o "${GCCVER?}" -lt 040300; then
5462         AC_MSG_RESULT([broken (i.e., no)])
5463     else
5464         HAVE_THREADSAFE_STATICS=TRUE
5465         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5466         AC_MSG_RESULT([yes])
5467     fi
5468 else
5469     AC_MSG_RESULT([unknown (assuming no)])
5471 AC_SUBST(HAVE_THREADSAFE_STATICS)
5473 dnl ===================================================================
5474 dnl visibility and C++11 features
5475 dnl ===================================================================
5476 CXXFLAGS_CXX11=
5477 if test "$GCC" = "yes"; then
5478     AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
5479     save_CFLAGS=$CFLAGS
5480     CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
5481     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_VISIBILITY_FEATURE=TRUE ],[])
5482     CFLAGS=$save_CFLAGS
5484     if test "$COM_GCC_IS_CLANG" = TRUE -a $_os = Darwin; then
5485         # It seems that with Apple's Clang, visibility doesn't work as
5486         # we would want at least in the connectivity and dbaccess
5487         # modules. This might be because of something peculiar in
5488         # those modules? Whatever.
5489         HAVE_GCC_VISIBILITY_FEATURE=
5490     fi
5492     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5493         AC_MSG_RESULT([yes])
5494     else
5495         AC_MSG_RESULT([no])
5496     fi
5498     AC_MSG_CHECKING([whether $CC supports -Wno-long-double])
5499     save_CFLAGS=$CFLAGS
5500     CFLAGS="$CFLAGS -Werror -Wno-long-double"
5501     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_NO_LONG_DOUBLE=TRUE ],[])
5502     CFLAGS=$save_CFLAGS
5503     if test "$HAVE_GCC_NO_LONG_DOUBLE" = "TRUE"; then
5504         AC_MSG_RESULT([yes])
5505     else
5506         AC_MSG_RESULT([no])
5507     fi
5509     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5510     save_CFLAGS=$CFLAGS
5511     CFLAGS="$CFLAGS -Werror -mno-avx"
5512     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5513     CFLAGS=$save_CFLAGS
5514     if test "$HAVE_GCC_AVX" = "TRUE"; then
5515         AC_MSG_RESULT([yes])
5516     else
5517         AC_MSG_RESULT([no])
5518     fi
5520     AC_MSG_CHECKING([whether $CC supports atomic functions])
5521     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5522     int v = 0;
5523     if (__sync_add_and_fetch(&v, 1) != 1 ||
5524         __sync_sub_and_fetch(&v, 1) != 0)
5525         return 1;
5526     __sync_synchronize();
5527     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5528         v != 1)
5529         return 1;
5530     return 0;
5531 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5532     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5533         AC_MSG_RESULT([yes])
5534         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5535     else
5536         AC_MSG_RESULT([no])
5537     fi
5539     AC_MSG_CHECKING(
5540         [whether $CC supports pragma GCC diagnostic error/ignored/warning])
5541     save_CFLAGS=$CFLAGS
5542     CFLAGS="$CFLAGS -Werror -Wunknown-pragmas -Wunused-parameter"
5543     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5544             #pragma GCC diagnostic ignored "-Wunused-parameter"
5545             void dummy(int n) {}
5546         ])], [
5547             AC_DEFINE([HAVE_GCC_PRAGMA_DIAGNOSTIC_MODIFY],[1])
5548             AC_MSG_RESULT([yes])
5549         ], [AC_MSG_RESULT([no])])
5550     CFLAGS=$save_CFLAGS
5552     AC_MSG_CHECKING([whether $CC supports pragma GCC diagnostic push/pop])
5553     save_CFLAGS=$CFLAGS
5554     CFLAGS="$CFLAGS -Werror -Wunknown-pragmas -Wunused-parameter"
5555     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5556             #pragma GCC diagnostic push
5557             #pragma GCC diagnostic ignored "-Wunused-parameter"
5558             void dummy(int n) {}
5559             #pragma GCC diagnostic pop
5560         ])], [
5561             AC_DEFINE([HAVE_GCC_PRAGMA_DIAGNOSTIC_SCOPE],[1])
5562             AC_MSG_RESULT([yes])
5563         ], [AC_MSG_RESULT([no])])
5564     CFLAGS=$save_CFLAGS
5566     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5567 #if __GNUC__ == 4 && __GNUC_MINOR__ == 7 && (__GNUC_PATCHLEVEL__ == 0 || __GNUC_PATCHLEVEL__ == 1)
5568 #else
5569 abi ok
5570 #endif
5571 ]])],[HAVE_BROKEN_ABI=TRUE],[HAVE_BROKEN_ABI=FALSE])
5573     AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
5574     # This should check libstdc++ version, not gcc, but clang has incidentally C++11 support
5575     # disabled in this case by the __float128 case below.
5576     if test "$HAVE_BROKEN_ABI" = "TRUE"; then
5577         AC_MSG_NOTICE([Not using -std=gnu++0x on $CXX version 4.7.0/4.7.1 due to libstdc++ ABI breakage.])
5578     else
5579         save_CXXFLAGS=$CXXFLAGS
5580         CXXFLAGS="$CXXFLAGS -std=gnu++0x"
5581         AC_LANG_PUSH([C++])
5583         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5584 #include <stddef.h>
5586 #include <vector>
5587     // some Clang fail when compiling against GCC 4.7 headers with -std=gnu++0x
5588     // (__float128)
5590 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
5592 namespace
5594         struct b
5595         {
5596                 int i;
5597                 int j;
5598         };
5600 ]], [[
5601 struct a
5603         int i;
5604         int j;
5606 a thinga[]={{0,0}, {1,1}};
5607 b thingb[]={{0,0}, {1,1}};
5608 size_t i = sizeof(sal_n_array_size(thinga));
5609 size_t j = sizeof(sal_n_array_size(thingb));
5610 return !(i != 0 && j != 0);
5611 ]])],[HAVE_CXX0X=TRUE CXXFLAGS_CXX11=-std=gnu++0x],[])
5613         AC_LANG_POP([C++])
5614         CXXFLAGS=$save_CXXFLAGS
5615     fi
5616     if test "$HAVE_CXX0X" = "TRUE"; then
5617         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
5618     else
5619         AC_MSG_RESULT([no])
5620     fi
5623 AC_SUBST(CXXFLAGS_CXX11)
5624 AC_SUBST(HAVE_CXX0X)
5625 AC_SUBST(HAVE_GCC_NO_LONG_DOUBLE)
5626 AC_SUBST(HAVE_GCC_AVX)
5627 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
5629 dnl ==================================
5630 dnl Check for C++11 "= delete" support
5631 dnl ==================================
5633 AC_MSG_CHECKING([whether $CXX supports C++11 = delete syntax])
5634 if test "$HAVE_CXX0X" = "TRUE"; then
5635     save_CXXFLAGS=$CXXFLAGS
5636     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
5637     AC_LANG_PUSH([C++])
5638     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5639 struct A
5640     {
5641     void test() = delete;
5642     };
5643 ]])],[HAVE_CXX11_DELETE=TRUE],[])
5645     AC_LANG_POP([C++])
5646     CXXFLAGS=$save_CXXFLAGS
5647     if test "$HAVE_CXX11_DELETE" = "TRUE"; then
5648         AC_MSG_RESULT([yes])
5649         AC_DEFINE([HAVE_CXX11_DELETE])
5650     else
5651         AC_MSG_RESULT([no])
5652     fi
5653 else
5654     AC_MSG_RESULT([no])
5657 dnl ==================================
5658 dnl Check for C++11 "override" support
5659 dnl ==================================
5661 AC_MSG_CHECKING([whether $CXX supports C++11 "override" syntax])
5662 if test "$HAVE_CXX0X" = "TRUE"; then
5663     save_CXXFLAGS=$CXXFLAGS
5664     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
5665     AC_LANG_PUSH([C++])
5666     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5667 struct A
5669         virtual void test();
5672 struct B : A
5674         virtual void test() override;
5676 ]])],[HAVE_CXX11_OVERRIDE=TRUE],[])
5678     AC_LANG_POP([C++])
5679     CXXFLAGS=$save_CXXFLAGS
5680     if test "$HAVE_CXX11_OVERRIDE" = "TRUE"; then
5681         AC_MSG_RESULT([yes])
5682         AC_DEFINE([HAVE_CXX11_OVERRIDE])
5683     else
5684         AC_MSG_RESULT([no])
5685     fi
5686 else
5687     AC_MSG_RESULT([no])
5690 dnl ==================================
5691 dnl Check for C++11 "final" support
5692 dnl ==================================
5694 AC_MSG_CHECKING([whether $CXX supports C++11 "final" syntax])
5695 if test "$HAVE_CXX0X" = "TRUE"; then
5696     save_CXXFLAGS=$CXXFLAGS
5697     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
5698     AC_LANG_PUSH([C++])
5699     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5700 // First check that this correct program that uses "final" compiles
5701 struct A final
5705 struct B
5707         virtual void test();
5710 struct C : B
5712         void test() final;
5714 ]])],[have_final=yes],[])
5716     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5717 // Then check that the "final" works as expected,
5718 // that this program fails to compile
5719 struct A final
5723 struct B : A
5726 ]])],[],[final_class_works=yes])
5728     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5729 // Also this should fail to compile
5730 struct B
5732         virtual void test();
5735 struct C : B
5737         void test() final;
5740 struct D : C
5742         void test();
5744 ]])],[],[final_method_works=yes])
5745     AC_LANG_POP([C++])
5747     CXXFLAGS=$save_CXXFLAGS
5749     if test "$have_final" = yes -a "$final_class_works" = yes -a "$final_method_works" = yes; then
5750         AC_MSG_RESULT([yes])
5751         AC_DEFINE([HAVE_CXX11_FINAL])
5752     else
5753         AC_MSG_RESULT([no])
5754     fi
5755 else
5756     AC_MSG_RESULT([no])
5759 dnl ===================================================================
5760 dnl Check for C++11 perfect forwarding support
5761 dnl ===================================================================
5762 AC_MSG_CHECKING([whether $CXX supports C++11 perfect forwarding])
5763 save_CXXFLAGS=$CXXFLAGS
5764 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
5765 AC_LANG_PUSH([C++])
5766 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5767         #include <utility>
5768         template<typename T, typename... Args> T * f(Args &&... v) {
5769             return new T(std::forward<Args>(v)...);
5770         }
5771     ]], [[
5772         f<int>(0);
5773     ]])], [perfect_forwarding=yes], [perfect_forwarding=no])
5774 AC_LANG_POP([C++])
5775 CXXFLAGS=$save_CXXFLAGS
5776 AC_MSG_RESULT([$perfect_forwarding])
5777 if test "$perfect_forwarding" = yes; then
5778     AC_DEFINE([HAVE_CXX11_PERFECT_FORWARDING])
5781 dnl ===================================================================
5782 dnl system stl sanity tests
5783 dnl ===================================================================
5784 HAVE_GCC_VISIBILITY_BROKEN=
5785 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \); then
5787     AC_LANG_PUSH([C++])
5789     save_CPPFLAGS="$CPPFLAGS"
5790     if test -n "$MACOSX_SDK_PATH"; then
5791         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
5792     fi
5794     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5795         dnl gcc#19664, gcc#22482, rhbz#162935
5796         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
5797         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
5798         AC_MSG_RESULT([$stlvisok])
5799         if test "$stlvisok" = "no"; then
5800             AC_MSG_WARN([Your gcc STL headers are not visibility safe. Disabling visibility])
5801             add_warning "Your gcc STL headers are not visibility safe. Disabling visibility"
5802             unset HAVE_GCC_VISIBILITY_FEATURE
5803         fi
5804     fi
5806     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5807         sharedlink_ldflags_save=$LDFLAGS
5808         LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden $PICSWITCH $LINKFLAGSSHL"
5810         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
5811         AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5812 #include <sstream>
5813 using namespace std;
5814             ]], [[
5815 istringstream strm( "test" ); return 0;
5816             ]])],
5817             # Ugh, surely bad to assume an error message will contain
5818             # the word "unresolvable", a problem with
5819             # -fvisibility-inlines-hidden and STL headers might cause
5820             # some more obscure message on some platform, and anway,
5821             # the error message could be localised.
5822             [$EGREP -q unresolvable conftest.err;
5823             if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi],[gccvisok=no
5824         ])
5825         AC_MSG_RESULT([$gccvisok])
5826         if test "$gccvisok" = "no"; then
5827             AC_MSG_WARN([Your gcc is not -fvisibility-inlines-hidden safe, disabling that.])
5828             add_warning "Your gcc is not -fvisibility-inlines-hidden safe, disabling that."
5829             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
5830         fi
5832         LDFLAGS=$sharedlink_ldflags_save
5833     fi
5835     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
5836     # when we don't make any dynamic libraries?
5837     if test "$DISABLE_DYNLOADING" = "" -a "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$HAVE_GCC_VISIBILITY_BROKEN" != "TRUE"; then
5838         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
5839         cat > conftestlib1.cc <<_ACEOF
5840 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
5841 struct S2: S1<int> { virtual ~S2(); };
5842 S2::~S2() {}
5843 _ACEOF
5844         cat > conftestlib2.cc <<_ACEOF
5845 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
5846 struct S2: S1<int> { virtual ~S2(); };
5847 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
5848 _ACEOF
5849         gccvisinlineshiddenok=yes
5850         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
5851             gccvisinlineshiddenok=no
5852         else
5853             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $LINKFLAGSNOUNDEFS -o libconftest2$DLLPOST >/dev/null 2>&5; then
5854                 gccvisinlineshiddenok=no
5855             fi
5856         fi
5858         rm -fr libconftest*
5859         AC_MSG_RESULT([$gccvisinlineshiddenok])
5860         if test "$gccvisinlineshiddenok" = "no"; then
5861             AC_MSG_WARN([Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that.])
5862             add_warning "Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that."
5863             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
5864         fi
5865     fi
5867     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5868         AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
5869         cat >visibility.cxx <<_ACEOF
5870 #pragma GCC visibility push(hidden)
5871 struct __attribute__ ((visibility ("default"))) TestStruct {
5872   static void Init();
5874 __attribute__ ((visibility ("default"))) void TestFunc() {
5875   TestStruct::Init();
5877 _ACEOF
5878         if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx 2>/dev/null > /dev/null; then
5879             gccvisbroken=yes
5880         else
5881             case "$host_cpu" in
5882             i?86|x86_64)
5883                 if test "$_os" = "Darwin" -o "$WITH_MINGW" = "yes"; then
5884                     gccvisbroken=no
5885                 else
5886                     if $EGREP -q '@PLT|@GOT' visibility.s; then
5887                         gccvisbroken=no
5888                     else
5889                         gccvisbroken=yes
5890                     fi
5891                 fi
5892                 ;;
5893             *)
5894                 gccvisbroken=no
5895                 ;;
5896             esac
5897         fi
5898         rm -f visibility.s visibility.cxx
5900         AC_MSG_RESULT([$gccvisbroken])
5901         if test "$gccvisbroken" = "yes"; then
5902             AC_MSG_WARN([Your gcc is not -fvisibility=hidden safe. Disabling visibility])
5903             add_warning "Your gcc is not -fvisibility=hidden safe. Disabling visibility"
5904             unset HAVE_GCC_VISIBILITY_FEATURE
5905         fi
5906     fi
5908     CPPFLAGS="$save_CPPFLAGS"
5910     AC_LANG_POP([C++])
5913 AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE)
5914 AC_SUBST(HAVE_GCC_VISIBILITY_BROKEN)
5916 dnl ===================================================================
5917 dnl  Clang++ tests
5918 dnl ===================================================================
5920 HAVE_GCC_FNO_DEFAULT_INLINE=
5921 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
5922 if test "$GCC" = "yes"; then
5923     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
5924     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
5925         # Option just ignored and silly warning that isn't a real
5926         # warning printed
5927         :
5928     else
5929         AC_LANG_PUSH([C++])
5930         save_CXXFLAGS=$CXXFLAGS
5931         CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
5932         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
5933         CXXFLAGS=$save_CXXFLAGS
5934         AC_LANG_POP([C++])
5935     fi
5936     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
5937         AC_MSG_RESULT([yes])
5938     else
5939         AC_MSG_RESULT([no])
5940     fi
5942     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
5943     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
5944         # As above
5945         :
5946     else
5947         AC_LANG_PUSH([C++])
5948         save_CXXFLAGS=$CXXFLAGS
5949         CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
5950         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
5951         CXXFLAGS=$save_CXXFLAGS
5952         AC_LANG_POP([C++])
5953     fi
5954     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
5955         AC_MSG_RESULT([yes])
5956     else
5957         AC_MSG_RESULT([no])
5958     fi
5960 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
5961 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
5964 dnl ===================================================================
5965 dnl allocator
5966 dnl ===================================================================
5967 AC_MSG_CHECKING([which memory allocator to use])
5968 if test "$with_alloc" = "system"; then
5969     AC_MSG_RESULT([system])
5970     ALLOC="SYS_ALLOC"
5971     AC_CHECK_FUNCS([malloc realloc calloc free])
5973 if test "$with_alloc" = "tcmalloc"; then
5974     AC_MSG_RESULT(tcmalloc)
5975     if ! echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
5976         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
5977     fi
5978     AC_CHECK_LIB([tcmalloc], [malloc], [:],
5979         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
5980     ALLOC="TCMALLOC"
5982 if test "$with_alloc" = "jemalloc"; then
5983     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
5984         AC_MSG_RESULT(jemalloc)
5985         save_CFLAGS=$CFLAGS
5986         CFLAGS="$CFLAGS -pthread"
5987         AC_CHECK_LIB([jemalloc], [malloc], [:],
5988             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
5989         ALLOC="JEMALLOC"
5990         CFLAGS=$save_CFLAGS
5991     else
5992         AC_MSG_RESULT([system])
5993         ALLOC="SYS_ALLOC"
5994         AC_CHECK_FUNCS([malloc realloc calloc free])
5995     fi
5997 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
5998     AC_MSG_RESULT([internal])
6000 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6001 AC_SUBST(HAVE_POSIX_FALLOCATE)
6002 AC_SUBST(ALLOC)
6004 dnl ===================================================================
6005 dnl Custom build version
6006 dnl ===================================================================
6008 AC_MSG_CHECKING([whether to add custom build version])
6009 if test "$with_build_version" != ""; then
6010     BUILD_VER_STRING=$with_build_version
6011     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6012 else
6013     BUILD_VER_STRING=
6014     AC_MSG_RESULT([no])
6016 AC_SUBST(BUILD_VER_STRING)
6018 dnl ===================================================================
6019 dnl Java support enable
6020 dnl ===================================================================
6021 AC_MSG_CHECKING([whether to build with Java support])
6022 if test "$with_java" != "no"; then
6023     if test "$DISABLE_SCRIPTING" = TRUE; then
6024         AC_MSG_RESULT([no, overridden by --disable-scripting])
6025         SOLAR_JAVA=""
6026         with_java=no
6027     else
6028         AC_MSG_RESULT([yes])
6029         SOLAR_JAVA="TRUE"
6030     fi
6031 else
6032     AC_MSG_RESULT([no])
6033     SOLAR_JAVA=""
6036 AC_SUBST(SOLAR_JAVA)
6038 dnl SOLAR_JAVA="YES" (yes, silly name, should rename) indicates whether we
6039 dnl want there to be *run-time* (and build-time) support for Java extensions in the
6040 dnl built LibreOffice.
6042 dnl SOLAR_JAVA="BUILD" is claimed to indicate build-time only support
6043 dnl (no runtime support). It doesn't seem to ever be set to this
6044 dnl value, though, and everywhere SOLAR_JAVA is only checked for being
6045 dnl empty or non-empty.
6047 dnl SOLAR_JAVA="" indicate no java support at all
6049 JITC_PROCESSOR_TYPE=""
6050 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6051     # IBMs JDK needs this...
6052     JITC_PROCESSOR_TYPE=6
6053     export JITC_PROCESSOR_TYPE
6055 AC_SUBST([JITC_PROCESSOR_TYPE])
6057 # Misc Windows Stuff
6058 if test $_os = "WINNT" -a "$WITH_MINGW" != yes; then
6059     find_msvc_dlls
6060     find_msms
6061     MSVC_DLL_PATH="$msvcdllpath"
6062     MSVC_DLLS="$msvcdlls"
6063     MSM_PATH="$msmdir"
6064     MERGE_MODULES="$msms"
6065     SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6067 AC_SUBST(MSVC_DLL_PATH)
6068 AC_SUBST(MSVC_DLLS)
6069 AC_SUBST(MSVC_DEBUG_DLL_PATH)
6070 AC_SUBST(MSVC_DEBUG_DLLS)
6071 AC_SUBST(MSM_PATH)
6072 AC_SUBST(MERGE_MODULES)
6074 dnl ===================================================================
6075 dnl Checks for Java
6076 dnl ===================================================================
6077 if test "$SOLAR_JAVA" != ""; then
6079     # Windows-specific tests
6080     if test "$build_os" = "cygwin"; then
6081         if test "$BITNESS_OVERRIDE" = 64; then
6082             bitness="64-bit"
6083             otherbitness="32-bit"
6084         else
6085             bitness="32-bit"
6086             otherbitness="64-bit"
6087         fi
6089         if test -z "$with_jdk_home"; then
6090             # Currently only auto-detects 32-bit JDK
6091                         for ver in 1.7 1.6 1.5 1.4 1.3; do
6092                         reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6093                         if test -n "$regvalue"; then
6094                                 _jdk_home=$regvalue
6095                                 break
6096                         fi
6097                         done
6098             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6099                 with_jdk_home="$_jdk_home"
6100                 howfound="found automatically"
6101             else
6102                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness JDK])
6103             fi
6104         else
6105             test "$build_os" = "cygwin" && with_jdk_home=`cygpath -u "$with_jdk_home"`
6106             howfound="you passed"
6107         fi
6108     fi
6110     JAVA_HOME=; export JAVA_HOME
6111     if test -z "$with_jdk_home"; then
6112         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6113     else
6114         _java_path="$with_jdk_home/bin/$with_java"
6115         dnl Check if there is a Java interpreter at all.
6116         if test -x "$_java_path"; then
6117             JAVAINTERPRETER=$_java_path
6118         else
6119             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6120         fi
6121     fi
6123     if test "$build_os" = "cygwin"; then
6124         # Check that the JDK found is correct architecture
6125         # Why is this necessary, we don't link with any library from the JDK I think,
6127         shortjdkhome=`cygpath -d "$with_jdk_home"`
6128         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
6129             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6130             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6131         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
6132             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6133             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6134         fi
6136         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6137             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6138         fi
6139         JAVAINTERPRETER=`cygpath -d "$JAVAINTERPRETER"`
6140         JAVAINTERPRETER=`cygpath -u "$JAVAINTERPRETER"`
6141     elif test "$_os" = "Darwin"; then
6142         dnl HACK:  There currently is only a 32 bit version of LibreOffice for Mac OS X,
6143         dnl and Tiger Java complains about -d32 while Snow Leopard Java needs it
6144         dnl to run in 32 bit mode and be able to load LibreOffice jnilibs:
6145         AC_MSG_CHECKING([whether to pass -d32 to Java interpreter])
6146         if "$JAVAINTERPRETER" -d32 >&5 2>&5; then
6147             AC_MSG_RESULT([yes])
6148             JAVAIFLAGS=-d32
6149         else
6150             AC_MSG_RESULT([no])
6151         fi
6152     fi
6155 dnl ===================================================================
6156 dnl Checks for JDK.
6157 dnl ===================================================================
6159 # Note that JAVA_HOME as for now always means the *build* platform's
6160 # JAVA_HOME. Whether all the complexity here actually is needed any
6161 # more or not, no idea.
6163 if test "$SOLAR_JAVA" != ""; then
6164     _gij_longver=0
6165     AC_MSG_CHECKING([the installed JDK])
6166     if test -n "$JAVAINTERPRETER"; then
6167         dnl java -version sends output to stderr!
6168         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6169             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6170         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6171             JDK=gcj
6172             AC_MSG_RESULT([checked (gcj)])
6173             _gij_version=`$JAVAINTERPRETER --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6174             _gij_longver=`echo $_gij_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6176         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6177             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6178         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6179             JDK=ibm
6181             dnl IBM JDK specific tests
6182             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6183             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6185             if test "$_jdk_ver" -lt 10500; then
6186                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.5])
6187             fi
6189             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6191             if test "$with_jdk_home" = ""; then
6192                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6193 you must use the "--with-jdk-home" configure option explicitly])
6194             fi
6196            JAVA_HOME=$with_jdk_home
6198         else
6199             JDK=sun
6201             dnl Sun JDK specific tests
6202             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6203             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6205             if test "$_jdk_ver" -lt 10500; then
6206                 AC_MSG_ERROR([JDK is too old, you need at least 1.5])
6207             fi
6208             if test "$_jdk_ver" -gt 10600; then
6209                 JAVA_CLASSPATH_NOT_SET="1"
6210             fi
6212             AC_MSG_RESULT([checked (JDK $_jdk)])
6213             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6214             if test "$_os" = "WINNT"; then
6215                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6216             fi
6217         fi
6218     else
6219         AC_MSG_ERROR([Java not found. You need at least jdk-1.5, or gcj-4])
6220     fi
6221 else
6222     dnl Java disabled
6223     JAVA_HOME=NO_JAVA_HOME ; export JAVA_HOME
6226 dnl ===================================================================
6227 dnl Set target Java bytecode version
6228 dnl ===================================================================
6229 if test "$SOLAR_JAVA" != ""; then
6230     _java_target_ver="1.5"
6232     JAVA_SOURCE_VER="$_java_target_ver"
6233     JAVA_TARGET_VER="$_java_target_ver"
6236 dnl ===================================================================
6237 dnl Checks for javac
6238 dnl ===================================================================
6239 if test "$SOLAR_JAVA" != ""; then
6240     if test "$JDK" = "gcj"; then
6241         javacompiler=`echo $with_java | $SED -e "s/gij/gcj/g" | $SED -e "s/java/javac/g"`
6242     else
6243         javacompiler="javac"
6244     fi
6245     if test -z "$with_jdk_home"; then
6246         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6247     else
6248         _javac_path="$with_jdk_home/bin/$javacompiler"
6249         dnl Check if there is a Java compiler at all.
6250         if test -x "$_javac_path"; then
6251             JAVACOMPILER=$_javac_path
6252         fi
6253     fi
6254     if test -z "$JAVACOMPILER"; then
6255         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6256     fi
6257     if test "$build_os" = "cygwin"; then
6258         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6259             JAVACOMPILER="${JAVACOMPILER}.exe"
6260         fi
6261         JAVACOMPILER=`cygpath -d "$JAVACOMPILER"`
6262         JAVACOMPILER=`cygpath -u "$JAVACOMPILER"`
6263     fi
6265     if test `$JAVACOMPILER -version 2>&1 | $GREP -c "Eclipse Java Compiler"` -gt 0; then
6266         AC_MSG_CHECKING([re-checking JDK])
6267         JDK=gcj
6268         AC_MSG_RESULT([checked (ecj)])
6269         _gij_longver="40200"
6270     fi
6273 JAVACISGCJ=""
6274 dnl ===================================================================
6275 dnl Checks that javac is gcj
6276 dnl ===================================================================
6277 if test "$SOLAR_JAVA" != ""; then
6278     if test `$JAVACOMPILER --version 2>&1 | $GREP -c "GCC"` -gt 0; then
6279         JAVACISGCJ="yes"
6280     fi
6282 AC_SUBST(JAVACISGCJ)
6284 dnl ===================================================================
6285 dnl Checks for javadoc
6286 dnl ===================================================================
6287 if test "$SOLAR_JAVA" != ""; then
6288     if test -z "$with_jdk_home"; then
6289         AC_PATH_PROG(JAVADOC, javadoc)
6290     else
6291         _javadoc_path="$with_jdk_home/bin/javadoc"
6292         dnl Check if there is a javadoc at all.
6293         if test -x "$_javadoc_path"; then
6294             JAVADOC=$_javadoc_path
6295         else
6296             AC_PATH_PROG(JAVADOC, javadoc)
6297         fi
6298     fi
6299     if test -z "$JAVADOC"; then
6300         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6301     fi
6302     if test "$build_os" = "cygwin"; then
6303         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6304             JAVADOC="${JAVADOC}.exe"
6305         fi
6306         JAVADOC=`cygpath -d "$JAVADOC"`
6307         JAVADOC=`cygpath -u "$JAVADOC"`
6308     fi
6310     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6311     JAVADOCISGJDOC="yes"
6312     fi
6314 AC_SUBST(JAVADOCISGJDOC)
6316 if test "$SOLAR_JAVA" != ""; then
6317     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
6318     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
6319         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
6320            # try to recover first by looking whether we have a alternatives
6321            # system as in Debian or newer SuSEs where following /usr/bin/javac
6322            # over /etc/alternatives/javac leads to the right bindir where we
6323            # just need to strip a bit away to get a valid JAVA_HOME
6324            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
6325         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
6326             # maybe only one level of symlink (e.g. on Mac)
6327             JAVA_HOME=$(readlink $JAVACOMPILER)
6328             if test "$(dirname $JAVA_HOME)" = "."; then
6329                 # we've got no path to trim back
6330                 JAVA_HOME=""
6331             fi
6332         else
6333             # else warn
6334             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
6335             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
6336             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
6337             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
6338         fi
6339         dnl now that we have the path to the real javac, make a JAVA_HOME out of it..
6340         if test "$JAVA_HOME" != "/usr"; then
6341             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6342                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
6343                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
6344                 dnl Tiger already returns a JDK path..
6345                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
6346             else
6347                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
6348             fi
6349         fi
6350     fi
6351     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
6353     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
6354     if test -z "$JAVA_HOME"; then
6355         if test "x$with_jdk_home" = "x"; then
6356             cat > findhome.java <<_ACEOF
6357 [import java.io.File;
6359 class findhome
6361     public static void main(String args[])
6362     {
6363         String jrelocation = System.getProperty("java.home");
6364         File jre = new File(jrelocation);
6365         System.out.println(jre.getParent());
6366     }
6368 _ACEOF
6369             AC_MSG_CHECKING([if javac works])
6370             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
6371             AC_TRY_EVAL(javac_cmd)
6372             if test $? = 0 -a -f ./findhome.class; then
6373                 AC_MSG_RESULT([javac works])
6374             else
6375                 echo "configure: javac test failed" >&5
6376                 cat findhome.java >&5
6377                 AC_MSG_ERROR([javac does not work - java projects will not build!])
6378             fi
6379             AC_MSG_CHECKING([if gij knows its java.home])
6380             JAVA_HOME=`$JAVAINTERPRETER findhome`
6381             if test $? = 0 -a "$JAVA_HOME" != ""; then
6382                 AC_MSG_RESULT([$JAVA_HOME])
6383             else
6384                 echo "configure: java test failed" >&5
6385                 cat findhome.java >&5
6386                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
6387             fi
6388             # clean-up after ourselves
6389             rm -f ./findhome.java ./findhome.class
6390         else
6391             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
6392         fi
6393     fi
6395     dnl second sanity check JAVA_HOME if possible
6396     if test "$JDK" != "gcj" -o "$_gij_longver" -ge "40200"; then
6397         # now check if $JAVA_HOME is really valid
6398         if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6399             if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
6400                 JAVA_HOME_OK="NO"
6401             fi
6402         elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
6403             JAVA_HOME_OK="NO"
6404         fi
6405         if test "$JAVA_HOME_OK" = "NO"; then
6406             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
6407             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
6408             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
6409             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
6410             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
6411             add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
6412         fi
6413     fi
6414     PathFormat "$JAVA_HOME"
6415     JAVA_HOME="$formatted_path"
6418 AWTLIB=
6420 if test "$SOLAR_JAVA" != ""; then
6421     AC_MSG_CHECKING([for jawt lib name])
6422     if test "$JDK" = "gcj"; then
6423         save_CFLAGS=$CFLAGS
6424         save_LDFLAGS=$LDFLAGS
6425         CFLAGS="$CFLAGS -I$JAVA_HOME/include"
6426         LDFLAGS="$LDFLAGS -L$JAVA_HOME/lib -lgcj"
6427         exec 6>/dev/null # no output
6428         AC_CHECK_HEADER(jni.h, [],
6429                     [AC_MSG_ERROR([jni.h could not be found. Mismatch between gcc and libgcj or libgcj-devel missing?])], [])
6430         AC_CHECK_LIB(gcjawt, JAWT_GetAWT, [ AWTLIB="-lgcjawt -lgcj"] )
6431         exec 6>&1 # output on again
6432         CFLAGS=$save_CFLAGS
6433         LDFLAGS=$save_LDFLAGS
6434     fi
6435     # IBM SDK 1.5.0-sr5 includes libjawt.so with unresolved symbols.
6436     # A workaround is to link also against libpmawt.so
6437     if test "$JDK" = "ibm"; then
6438         save_CFLAGS=$CFLAGS
6439         save_LDFLAGS=$LDFLAGS
6440         save_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
6441         CFLAGS="$CFLAGS -I$JAVA_HOME/include"
6442         LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin"
6443         LD_LIBRARY_PATH=$JAVA_HOME/jre/bin:$JAVA_HOME/jre/bin/classic:$JAVA_HOME/jre/bin/xawt:$LD_LIBRARY_PATH
6444         export LD_LIBRARY_PATH
6445         exec 6>/dev/null # no output
6446         AC_CHECK_HEADER(jni.h, [],
6447                     [AC_MSG_ERROR([jni.h could not be found.])], [])
6448         AC_CHECK_LIB(jawt, JAWT_GetAWT, [ AWTLIB="-ljawt"] )
6449         if test -z "$AWTLIB"; then
6450             LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin/xawt -ljawt"
6451             AC_CHECK_LIB(mawt, JAWT_GetAWT, [ AWTLIB="-L$JAVA_HOME/jre/bin/xawt -ljawt -lmawt"])
6452         fi
6453         exec 6>&1 # output on again
6454         CFLAGS=$save_CFLAGS
6455         LDFLAGS=$save_LDFLAGS
6456         LD_LIBRARY_PATH=$save_LD_LIBRARY_PATH
6457     fi
6458     if test -z "$AWTLIB"; then
6459         if test $_os = WINNT -a "$WITH_MINGW" != yes; then
6460             AWTLIB=jawt.lib
6461         else
6462             AWTLIB=-ljawt
6463         fi
6464     fi
6465     AC_MSG_RESULT([$AWTLIB])
6466     AC_SUBST(AWTLIB)
6470 if test -n "$SOLAR_JAVA" -a \( -z "$JAVALIB" -o -z "$JAVAINC" \); then
6472 # Determine JAVALIB
6473 # If your platform follow the common pattern
6474 # just define JAVA_ARCH and JAVA_TOOLKIT for it
6475 # if not, leave JAVA_ARCH empty and define JAVALIB manually
6476 # if you don't want JAVALIB to be exported at all
6477 # define x_JAVALIB=[\#]
6479     JAVA_ARCH=
6480     JAVA_TOOLKIT=
6481     x_JAVALIB=
6482     x_JDKLIB=[\#]
6484     case "$host_os" in
6486     aix*)
6487         JAVA_ARCH="ppc"
6488         JAVA_TOOLKIT="classic"
6489         JAVAINC="-I$JAVA_HOME/include"
6490         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
6491         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6493         case "$JDK" in
6494         [Ii][Bb][Mm]*)
6495             JAVA_ARCH=
6496             JRE_BASE_DIR="$JAVA_HOME/jre/bin"
6497             JAVALIB="-L$JRE_BASE_DIR -L$JRE_BASE_DIR/classic"
6498             ;;
6499         *)
6500             ;;
6501         esac
6503         ;;
6505     cygwin*)
6506         x_JDKLIB=
6507         JDKLIB="$JAVA_HOME/lib"
6508         JAVAINC="-I$JAVA_HOME/include/win32"
6509         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
6510         ;;
6512     darwin*)
6513         x_JAVALIB=[\#]
6514         JAVAINC="${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers ${ISYSTEM}$FRAMEWORKSHOME/JavaVM/Headers"
6515         ;;
6517     dragonfly*)
6518         case "$host_cpu" in
6519         i*86)
6520             JAVA_ARCH="i386"
6521             JAVA_TOOLKIT="client"
6522             ;;
6523         x86_64)
6524             JAVA_ARCH="amd64"
6525             JAVA_TOOLKIT="server"
6526             ;;
6527         esac
6528         JAVAINC="-I$JAVA_HOME/include"
6529         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6530         ;;
6532     freebsd*)
6533         case "$host_cpu" in
6534         i*86)
6535             JAVA_ARCH="i386"
6536             JAVA_TOOLKIT="client"
6537             ;;
6538         x86_64)
6539             if test "`echo $JAVA_HOME | sed -e 's,.*/,,'`" = "linux"; then
6540                 JAVA_ARCH="i386"
6541                 JAVA_TOOLKIT="client"
6542             else
6543                 JAVA_ARCH="amd64"
6544                 JAVA_TOOLKIT="server"
6545             fi
6546             ;;
6547         esac
6548         JAVAINC="-I$JAVA_HOME/include"
6549         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
6550         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
6551         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
6552         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6553         ;;
6555     k*bsd*-gnu*)
6556         case "$host_cpu" in
6557         i*86)
6558             JAVA_ARCH="i386"
6559             JAVA_TOOLKIT="client"
6560             ;;
6561         x86_64)
6562             JAVA_ARCH="amd64"
6563             JAVA_TOOLKIT="server"
6564             ;;
6565         esac
6566         JAVAINC="-I$JAVA_HOME/include"
6567         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6568         ;;
6570     linux-gnu*)
6572         case "$host_cpu" in
6574         alpha)
6575             JAVA_ARCH="alpha"
6576             JAVA_TOOLKIT="server"
6577             ;;
6578         arm*)
6579             JAVA_ARCH="arm"
6580             JAVA_TOOLKIT="server"
6581             ;;
6582         hppa)
6583             JAVA_ARCH="hppa"
6584             JAVA_TOOLKIT="server"
6585             ;;
6586         i*86)
6587             JAVA_ARCH="i386"
6588             case "$JDK" in
6589             [Ii][Bb][Mm]*)
6590                 JAVA_ARCH=
6591                 JRE_BASE_DIR="$JAVA_HOME/jre/bin"
6592                 JAVALIB="-L$JAVA_HOME/$LIB64 -L$JRE_BASE_DIR -L$JRE_BASE_DIR/classic -L$JRE_BASE_DIR/native_thread"
6593                 ;;
6594             [Bb][Ee][Aa]*)
6595                 JAVA_TOOLKIT="jrockit"
6596                 ;;
6597             *)
6598                 JAVA_TOOLKIT="client"
6599                 ;;
6600             esac
6601             ;;
6602         ia64)
6603             JAVA_ARCH="ia64"
6604             JAVA_TOOLKIT="server"
6605             ;;
6606         m68k)
6607             JAVA_ARCH="mk68"
6608             JAVA_TOOLKIT="server"
6609             ;;
6610         mips|mips64|mipsel|mips64el)
6611             JAVA_ARCH="$host_cpu"
6612             JAVA_TOOLKIT="server"
6613             ;;
6614         mips32)
6615             JAVA_ARCH="$host_cpu"
6616             JAVA_TOOLKIT="client"
6617             ;;
6618         powerpc)
6619             JAVA_ARCH="ppc"
6620             case "$JDK" in
6621             [Ii][Bb][Mm]*)
6622                 JAVA_TOOLKIT="classic"
6623                 ;;
6624             gcj)
6625                 JAVA_TOOLKIT="client"
6626                 ;;
6627             *)
6628                 JAVA_TOOLKIT="server"
6629                 ;;
6630             esac
6631             ;;
6632         powerpc64)
6633             JAVA_ARCH="ppc64"
6634             if test "$JDK" = "gcj"; then
6635                 JAVA_TOOLKIT="client"
6636             else
6637                 JAVA_TOOLKIT="server"
6638             fi
6639             ;;
6640         sparc)
6641             JAVA_ARCH="sparc"
6642             JAVA_TOOLKIT="server"
6643             ;;
6644         s390)
6645             JAVA_ARCH="s390"
6646             JAVA_TOOLKIT="server"
6647             ;;
6648         s390x)
6649             JAVA_ARCH="s390x"
6650             JAVA_TOOLKIT="server"
6651             ;;
6652         x86_64)
6653             JAVA_ARCH="amd64"
6654             JAVA_TOOLKIT="server"
6655             ;;
6656         *)
6657             AC_MSG_ERROR([No JAVALIB definition host_cpu $host_cpu for host_os $host_os])
6658             ;;
6659         esac
6660         JAVAINC="-I$JAVA_HOME/include"
6661         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
6662         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6663         ;;
6665     linux-androideabi*)
6667         case "$host_cpu" in
6669     arm|armel)
6670             JAVA_ARCH="arm"
6671             JAVA_TOOLKIT="server"
6672             ;;
6673         esac
6674         ;;
6676     mingw*)
6677         x_JAVALIB=[\#]
6678         JAVAINC="-I$JAVA_HOME/include"
6679         ;;
6681     *netbsd*)
6683         case "$host_cpu" in
6684         i*86)
6685             JAVA_ARCH="i386"
6686             JAVA_TOOLKIT="client"
6687             ;;
6688         powerpc)
6689             JAVA_ARCH="pcc"
6690             JAVA_TOOLKIT="classic"
6691             ;;
6692         sparc)
6693             JAVA_ARCH="sparc"
6694             JAVA_TOOLKIT="client"
6695             ;;
6696         x86_64)
6697             JAVA_ARCH="amd64"
6698             JAVA_TOOLKIT="client"
6699             ;;
6700         esac
6701         JAVAINC="-I$JAVA_HOME/include"
6702         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
6703         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6704        ;;
6706     openbsd*)
6707         case "$host_cpu" in
6708         i*86)
6709             JAVA_ARCH="i386"
6710             JAVA_TOOLKIT="client"
6711             ;;
6712         x86_64)
6713             JAVA_ARCH="amd64"
6714             JAVA_TOOLKIT="server"
6715             ;;
6716         esac
6717         JAVAINC="-I$JAVA_HOME/include"
6718         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
6719         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6720         ;;
6722     solaris*)
6724         JAVA_TOOLKIT="xawt"
6725         case "$host_cpu" in
6726         i*86)
6727             JAVA_ARCH="i386"
6728             ;;
6729         sparc)
6730             JAVA_ARCH="sparc"
6731             ;;
6732         esac
6733         JAVAINC="-I$JAVA_HOME/include"
6734         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
6735         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6736         ;;
6737     esac
6739     if test -n "$JAVA_ARCH"; then
6740         JRE_BASE_DIR="$JAVA_HOME/jre/lib/$JAVA_ARCH"
6741         JAVALIB="-L$JAVA_HOME/$LIB64"
6742         test -d "$JRE_BASE_DIR" && JAVALIB="$JAVALIB -L$JRE_BASE_DIR"
6743         test -d "$JRE_BASE_DIR/$JAVA_TOOLKIT" && JAVALIB="$JAVALIB -L$JRE_BASE_DIR/$JAVA_TOOLKIT"
6744         test -d "$JRE_BASE_DIR/native_thread" && JAVALIB="$JAVALIB -L$JRE_BASE_DIR/native_thread"
6745     fi
6746 elif test -z "$SOLAR_JAVA"; then
6747     x_JAVALIB=[\#]
6748     x_JDKLIB=[\#]
6750 SOLARINC="$SOLARINC $JAVAINC"
6752 AC_SUBST(JAVALIB)
6753 AC_SUBST(JAVACOMPILER)
6754 AC_SUBST(JAVADOC)
6755 AC_SUBST(JAVAINTERPRETER)
6756 AC_SUBST(JAVAIFLAGS)
6757 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
6758 AC_SUBST(JAVA_HOME)
6759 AC_SUBST(JAVA_SOURCE_VER)
6760 AC_SUBST(JAVA_TARGET_VER)
6761 AC_SUBST(JDK)
6762 AC_SUBST(JDKLIB)
6763 AC_SUBST(x_JAVALIB)
6764 AC_SUBST(x_JDKLIB)
6767 AC_MSG_CHECKING([which C preprocessor to use in idlc])
6768 if test -n "$with_idlc_cpp"; then
6769     AC_MSG_RESULT([$with_idlc_cpp])
6770     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
6771 else
6772     AC_MSG_RESULT([ucpp])
6773     AC_MSG_CHECKING([which ucpp tp use])
6774     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
6775         AC_MSG_RESULT([external])
6776         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
6777     else
6778         AC_MSG_RESULT([internal])
6779         BUILD_TYPE="$BUILD_TYPE UCPP"
6780     fi
6782 AC_SUBST(SYSTEM_UCPP)
6784 dnl ===================================================================
6785 dnl Check for epm (not needed for Windows)
6786 dnl ===================================================================
6787 AC_MSG_CHECKING([whether to enable EPM for packing])
6788 if test "$enable_epm" = "yes"; then
6789     AC_MSG_RESULT([yes])
6790     if test "$_os" != "WINNT"; then
6791         if test -n "$with_epm"; then
6792             EPM=$with_epm
6793         else
6794             AC_PATH_PROG(EPM, epm, no)
6795         fi
6796         if test "$EPM" = "no" -o "$EPM" = "internal"; then
6797             echo "EPM will be built."
6798             BUILD_TYPE="$BUILD_TYPE EPM"
6799         else
6800             # Gentoo has some epm which is something different...
6801             AC_MSG_CHECKING([whether the found epm is the right epm])
6802             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
6803                 AC_MSG_RESULT([yes])
6804             else
6805                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
6806             fi
6807             AC_MSG_CHECKING([epm version])
6808             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
6809             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
6810                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
6811                 AC_MSG_RESULT([OK, >= 3.7])
6812                 if test "$_os" = "Darwin"; then
6813                     AC_MSG_CHECKING([which PackageMaker EPM thinks to use])
6814                     _pm=`strings $EPM | grep PackageMaker | cut -d" " -f1`
6815                     if test "$_pm" = "/Developer/Applications/PackageMaker.app/Contents/MacOS/PackageMaker"; then
6816                         AC_MSG_ERROR([$_pm; PackageMaker expected in wrong path. Either patch your epm with the right path (/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker) or use internal patched epm (--with-epm=internal)])
6817                     elif test "$_pm" = "/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker"; then
6818                         AC_MSG_RESULT([$_pm, ok])
6819                     else # we never should get here, but go safe
6820                         AC_MSG_ERROR([$_pm; PackageMaker expected in unknown path. Either patch your epm with the right path (/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker) or use internal patched epm (--with-epm=internal)])
6821                     fi
6822                 fi
6823             else
6824                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
6825                 echo "EPM will be built."
6826                 BUILD_TYPE="$BUILD_TYPE EPM"
6827             fi
6828         fi
6829     fi
6831     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
6832         AC_MSG_CHECKING([for rpm])
6833         for a in "$RPM" rpmbuild rpm; do
6834             $a --usage >/dev/null 2> /dev/null
6835             if test $? -eq 0; then
6836                 RPM=$a
6837                 break
6838             else
6839                 $a --version >/dev/null 2> /dev/null
6840                 if test $? -eq 0; then
6841                     RPM=$a
6842                     break
6843                 fi
6844             fi
6845         done
6846         if test -z "$RPM"; then
6847             AC_MSG_ERROR([not found])
6848         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
6849             RPM_PATH=`which $RPM`
6850             AC_MSG_RESULT([$RPM_PATH])
6851             SCPDEFS="$SCPDEFS -DWITH_RPM"
6852         else
6853             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
6854         fi
6855     fi
6856     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
6857         AC_PATH_PROG(DPKG, dpkg, no)
6858         if test "$DPKG" = "no"; then
6859             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
6860         fi
6861     fi
6862     if echo "$PKGFORMAT" | $EGREP osx 2>&1 >/dev/null; then
6863         if test "$_os" = "Darwin"; then
6864             AC_MSG_CHECKING([for PackageMaker availability])
6865             if ! test -x /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker; then
6866                 AC_MSG_ERROR([not installed. Please install Apples Dev Tools])
6867             else
6868                 AC_MSG_RESULT([ok])
6869             fi
6870         else
6871             AC_MSG_ERROR([PackageMaker needed to build OSX packages and you are not on OSX...])
6872         fi
6873     fi
6874     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
6875        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
6876         if test "$EPM" != "no" -a "$EPM" != "internal"; then
6877             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
6878                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
6879                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
6880                     AC_MSG_RESULT([yes])
6881                 else
6882                     AC_MSG_RESULT([no])
6883                     if echo "$PKGFORMAT" | $GREP -q rpm; then
6884                         _pt="rpm"
6885                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
6886                         add_warning "the rpms will need to be installed with --nodeps"
6887                     else
6888                         _pt="pkg"
6889                     fi
6890                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
6891                     add_warning "the ${_pt}s will not be relocateable"
6892                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
6893                                  relocation will work, you need to patch your epm with the
6894                                  patch in epm/epm-3.7.patch or build with
6895                                  --with-epm=internal which will build a suitable epm])
6896                 fi
6897             fi
6898         fi
6899     fi
6900     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
6901         AC_PATH_PROG(PKGMK, pkgmk, no)
6902         if test "$PKGMK" = "no"; then
6903             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
6904         fi
6905     fi
6906     AC_SUBST(RPM)
6907     AC_SUBST(DPKG)
6908     AC_SUBST(PKGMK)
6909 else
6910     AC_MSG_RESULT([no])
6911     EPM=NO
6913 AC_SUBST(EPM)
6915 dnl ===================================================================
6916 dnl We need winegcc when building MinGW build to be able to cross-build msi tools
6917 dnl ===================================================================
6918 WINEGCC=
6919 if test "$enable_winegcc" = "yes"; then
6920     AC_PATH_PROG(WINEGCC, winegcc)
6921     if test "$WINEGCC" = ""; then
6922         AC_MSG_ERROR([winegcc was not found, please install wine-devel, or wine-devel-32bit])
6923     fi
6924     CC_save="$CC"
6925     ac_exeext_save="$ac_exeext"
6926     CC="$WINEGCC -m32"
6927     ac_exeext=".exe"
6928     AC_LINK_IFELSE([AC_LANG_PROGRAM([
6929 #include <stdio.h>
6930         ],[
6931 printf ("hello world\n");
6932         ])],,
6933         [AC_MSG_ERROR([winegcc cannot build 32bit binaries, please install glibc-devel-32bit and gcc-32bit])]
6934     )
6935     CC="$CC_save"
6936     ac_exeext="$ac_exeext_save"
6938 AC_SUBST(WINEGCC)
6940 if test $_os = iOS; then
6941     enable_mpl_subset=yes
6942     enable_postgresql_sdbc=no
6943     enable_lotuswordpro=no
6944     enable_neon=no
6945     enable_extension_integration=no
6946     with_ppds=no
6949 ENABLE_LWP=
6950 if test "$enable_lotuswordpro" = "yes"; then
6951    ENABLE_LWP="TRUE"
6952    SCPDEFS="$SCPDEFS -DDISABLE_LWP"
6954 AC_SUBST(ENABLE_LWP)
6956 AC_MSG_CHECKING([MPL subset])
6957 MPL_SUBSET=
6959 if test "$enable_mpl_subset" = "yes"; then
6960    if test "x$enable_postgresql_sdbc" != "xno"; then
6961         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the postgress database backend.])
6962    fi
6963    if test "$enable_lotuswordpro" = "yes"; then
6964         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
6965    fi
6966    if test "$enable_neon" != "no"; then
6967         AC_MSG_ERROR([need to --disable-neon - webdav support.])
6968    fi
6970    MPL_SUBSET="TRUE"
6971    AC_DEFINE(MPL_HAVE_SUBSET)
6972    AC_MSG_RESULT([only])
6973 else
6974    AC_MSG_RESULT([no restrictions])
6976 AC_SUBST(MPL_SUBSET)
6978 dnl ===================================================================
6979 dnl Check for gperf
6980 dnl ===================================================================
6981 AC_PATH_PROG(GPERF, gperf)
6982 if test -z "$GPERF"; then
6983     AC_MSG_ERROR([gperf not found but needed. Install it.])
6985 AC_MSG_CHECKING([gperf version])
6986 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
6987     AC_MSG_RESULT([OK])
6988 else
6989     AC_MSG_ERROR([too old, you need at least 3.0.0])
6991 AC_SUBST(GPERF)
6993 dnl ===================================================================
6994 dnl Check for building ODK
6995 dnl ===================================================================
6996 if test "$enable_odk" = no; then
6997     unset DOXYGEN
6998 else
6999     if test "$with_doxygen" = no; then
7000         AC_MSG_CHECKING([for doxygen])
7001         unset DOXYGEN
7002         AC_MSG_RESULT([no])
7003     else
7004         if test "$with_doxygen" = yes; then
7005             AC_PATH_PROG([DOXYGEN], [doxygen])
7006             if test -z "$DOXYGEN"; then
7007                 if test "$enable_odk" = "" ; then
7008                     enable_odk="no"
7009                 else
7010                     AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7011                 fi
7012             fi
7013         else
7014             AC_MSG_CHECKING([for doxygen])
7015             DOXYGEN=$with_doxygen
7016             AC_MSG_RESULT([$DOXYGEN])
7017         fi
7018     fi
7020 AC_SUBST([DOXYGEN])
7022 AC_MSG_CHECKING([whether to build the ODK])
7023 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7024     AC_MSG_RESULT([yes])
7026     if test "$with_java" != "no"; then
7027         AC_MSG_CHECKING([whether to build unowinreg.dll])
7028         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7029             # build on Win by default
7030             enable_build_unowinreg=yes
7031         fi
7032         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7033             AC_MSG_RESULT([no])
7034             BUILD_UNOWINREG=NO
7035         else
7036             AC_MSG_RESULT([yes])
7037             BUILD_UNOWINREG=YES
7038         fi
7039         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "YES"; then
7040             if test -z "$with_mingw_cross_compiler"; then
7041                 dnl Guess...
7042                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7043             elif test -x "$with_mingw_cross_compiler"; then
7044                  MINGWCXX="$with_mingw_cross_compiler"
7045             else
7046                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7047             fi
7049             if test "$MINGWCXX" = "false"; then
7050                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7051             fi
7053             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7054             if test -x "$mingwstrip_test"; then
7055                 MINGWSTRIP="$mingwstrip_test"
7056             else
7057                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7058             fi
7060             if test "$MINGWSTRIP" = "false"; then
7061                 AC_MSG_ERROR(MinGW32 binutils not found.)
7062             fi
7063         fi
7064     fi
7065     BUILD_TYPE="$BUILD_TYPE ODK"
7066 else
7067     AC_MSG_RESULT([no])
7068     BUILD_UNOWINREG=NO
7070 AC_SUBST(BUILD_UNOWINREG)
7071 AC_SUBST(MINGWCXX)
7072 AC_SUBST(MINGWSTRIP)
7074 dnl ===================================================================
7075 dnl Check for system zlib
7076 dnl ===================================================================
7077 if test "$with_system_zlib" = "auto"; then
7078     case "$_os" in
7079     WINNT)
7080         with_system_zlib="$with_system_libs"
7081         ;;
7082     *)
7083         with_system_zlib=yes
7084         ;;
7085     esac
7088 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7089 dnl and has no pkg-config for it at least on some tinderboxes,
7090 dnl so leaving that out for now
7091 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7092 AC_MSG_CHECKING([which zlib to use])
7093 if test "$with_system_zlib" = "yes"; then
7094     AC_MSG_RESULT([external])
7095     SYSTEM_ZLIB=YES
7096     AC_CHECK_HEADER(zlib.h, [],
7097         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7098     AC_CHECK_LIB(z, deflate, [ ZLIB=-lz ],
7099         [AC_MSG_ERROR(zlib not found or functional)], [])
7100 else
7101     AC_MSG_RESULT([internal])
7102     SYSTEM_ZLIB=NO
7103     BUILD_TYPE="$BUILD_TYPE ZLIB"
7104     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7105     ZLIB_LIBS="-L${OUTDIR}/lib -lzlib"
7107 AC_SUBST(ZLIB_CFLAGS)
7108 AC_SUBST(ZLIB_LIBS)
7109 AC_SUBST(SYSTEM_ZLIB)
7111 dnl ===================================================================
7112 dnl Check for system jpeg
7113 dnl ===================================================================
7114 AC_MSG_CHECKING([which jpeg to use])
7115 if test "$with_system_jpeg" = "auto"; then
7116     case "$_os" in
7117     WINNT|Darwin|iOS|Android)
7118         with_system_jpeg="$with_system_libs"
7119         ;;
7120     *)
7121         with_system_jpeg=yes
7122         ;;
7123     esac
7126 if test "$with_system_jpeg" = "yes"; then
7127     AC_MSG_RESULT([external])
7128     SYSTEM_JPEG=YES
7129     AC_CHECK_HEADER(jpeglib.h, [],
7130         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7131     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ JPEG3RDLIB=-ljpeg ],
7132     [AC_MSG_CHECKING(jpeg library not found or fuctional)], [])
7133     AC_MSG_CHECKING([[libjpeg supports JERR_BAD_CROP_SPEC (jpeg-7 API)]])
7134         AC_COMPILE_IFELSE([ AC_LANG_SOURCE(
7135                           [[
7136 #include <stdio.h>
7137 #include <jerror.h>
7138 int main(int c, char**v) { printf("%d\n", JERR_BAD_CROP_SPEC); return 0; }
7139                           ]]) ],
7140                           [AC_MSG_RESULT(yes)],
7141                           [AC_MSG_RESULT(no)
7142                            AC_MSG_ERROR(jpeg library version >= 7 or jpeg-turbo version >= 1.1 required)
7143                           ])
7144     libo_MINGW_CHECK_DLL([libjpeg])
7145 else
7146     AC_MSG_RESULT([internal])
7147     SYSTEM_JPEG=NO
7148     BUILD_TYPE="$BUILD_TYPE JPEG"
7150 AC_SUBST(SYSTEM_JPEG)
7153 dnl ===================================================================
7154 dnl Check for system clucene
7155 dnl ===================================================================
7156 dnl we should rather be using
7157 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7158 dnl but the contribs-lib check seems tricky
7159 AC_MSG_CHECKING([which clucene to use])
7160 if test "$with_system_clucene" = "yes"; then
7161     AC_MSG_RESULT([external])
7162     SYSTEM_CLUCENE=YES
7163     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7164     AC_LANG_PUSH([C++])
7165     save_CXXFLAGS=$CXXFLAGS
7166     save_CPPFLAGS=$CPPFLAGS
7167     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7168     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7169     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7170     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7171     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7172                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7173     CXXFLAGS=$save_CXXFLAGS
7174     CPPFLAGS=$save_CPPFLAGS
7175     AC_LANG_POP([C++])
7177     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7178 else
7179     AC_MSG_RESULT([internal])
7180     SYSTEM_CLUCENE=NO
7181     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7183 AC_SUBST(SYSTEM_CLUCENE)
7184 AC_SUBST(CLUCENE_CFLAGS)
7185 AC_SUBST(CLUCENE_LIBS)
7187 dnl ===================================================================
7188 dnl Check for system expat
7189 dnl ===================================================================
7190 dnl we should use libo_CHECK_SYSTEM_MODULE, but e.g. the mingw tinderbox has no
7191 dnl proper pkg-config for it. It should really be fixed on the tinderbox though.
7192 AC_MSG_CHECKING([which expat to use])
7193 if test "$with_system_expat" = "yes"; then
7194     AC_MSG_RESULT([external])
7195     SYSTEM_EXPAT=YES
7196     AC_CHECK_HEADER(expat.h, [],
7197         [AC_MSG_ERROR(expat.h not found. install expat)], [])
7198     AC_CHECK_LIB([expat], [XML_ParserCreate], [:],
7199         [AC_MSG_RESULT(expat library not found or functional.)], [])
7200     libo_MINGW_CHECK_DLL([libexpat])
7201 else
7202     AC_MSG_RESULT([internal])
7203     SYSTEM_EXPAT=NO
7204     BUILD_TYPE="$BUILD_TYPE EXPAT"
7206 AC_SUBST(SYSTEM_EXPAT)
7208 dnl ===================================================================
7209 dnl Check for system libodfgen
7210 dnl ===================================================================
7211 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.0])
7213 dnl ===================================================================
7214 dnl Check for system libcdr
7215 dnl ===================================================================
7216 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.0 >= 0.0.5])
7218 dnl ===================================================================
7219 dnl Check for system libmspub
7220 dnl ===================================================================
7221 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.0])
7223 dnl ===================================================================
7224 dnl Check for system libmwaw
7225 dnl ===================================================================
7226 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.1])
7228 dnl ===================================================================
7229 dnl Check for system libvisio
7230 dnl ===================================================================
7231 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.0])
7233 dnl ===================================================================
7234 dnl Check for system libcmis
7235 dnl ===================================================================
7236 libo_CHECK_SYSTEM_MODULE([libcmis],[CMIS],[libcmis-0.3 >= 0.3.1])
7238 dnl ===================================================================
7239 dnl Check for system libwpd
7240 dnl ===================================================================
7241 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.9 libwpd-stream-0.9],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${OUTDIR}/lib -lwpdlib"])
7243 dnl ===================================================================
7244 dnl Check for system lcms2
7245 dnl ===================================================================
7246 if test "$with_system_lcms2" = "yes"; then
7247     libo_MINGW_CHECK_DLL([liblcms2])
7248 else
7249     SYSTEM_LCMS2=NO
7251 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${OUTDIR}/lib -llcms2"])
7252 if test "$GCC" = "yes"; then
7253     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7256 dnl ===================================================================
7257 dnl Check for system cppunit
7258 dnl ===================================================================
7259 libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.12.0])
7261 dnl ===================================================================
7262 dnl Check whether freetype is available
7263 dnl ===================================================================
7264 if test  "$test_freetype" = "yes"; then
7265     AC_MSG_CHECKING([whether freetype is available])
7266     # FreeType has 3 different kinds of versions
7267     # * release, like 2.4.10
7268     # * libtool, like 13.0.7 (this what pkg-config returns)
7269     # * soname
7270     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7271     #
7272     # 9.4.3 is 2.1.5; the first FreeType release to provide a freetype2.pc file
7273     # XXX: replace this with a real minimum required version
7274     PKG_CHECK_MODULES( FREETYPE, freetype2 >= 9.4.3 )
7275 else
7276     case "$BUILD_TYPE" in
7277     *FREETYPE*)
7278         FREETYPE_LIBS="-lfreetype"
7279         ;;
7280     esac
7282 AC_SUBST(FREETYPE_CFLAGS)
7283 AC_SUBST(FREETYPE_LIBS)
7285 dnl ===================================================================
7286 dnl Check for system libwps
7287 dnl ===================================================================
7288 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.2],["-I${OUTDIR}/inc/external"],["-L${OUTDIR}/lib -lwpslib"])
7290 dnl ===================================================================
7291 dnl Check for system libwpg
7292 dnl ===================================================================
7293 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.2],["-I${OUTDIR}/inc/external"],["-L${OUTDIR}/lib -lwpglib"])
7295 # ===================================================================
7296 # Check for system libxslt
7297 # to prevent incompatibilities between internal libxml2 and external libxslt,
7298 # or vice versa, use with_system_libxml here
7299 # ===================================================================
7300 if test "$with_system_libxml" = "auto"; then
7301     case "$_os" in
7302     WINNT|iOS|Android)
7303         with_system_libxml="$with_system_libs"
7304         ;;
7305     *)
7306         with_system_libxml=yes
7307         ;;
7308     esac
7311 AC_MSG_CHECKING([which libxslt to use])
7312 if test "$with_system_libxml" = "yes"; then
7313     AC_MSG_RESULT([external])
7314     SYSTEM_LIBXSLT=YES
7315     if test "$_os" = "Darwin"; then
7316         dnl make sure to use SDK path
7317         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7318         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7319         dnl omit -L/usr/lib
7320         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7321         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7322     else
7323         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7324         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7325     fi
7327     dnl Check for xsltproc
7328     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7329     if test "$XSLTPROC" = "no"; then
7330         AC_MSG_ERROR([xsltproc is required])
7331     fi
7333     libo_MINGW_CHECK_DLL([libxslt])
7334     libo_MINGW_CHECK_DLL([libexslt])
7335     libo_MINGW_TRY_DLL([iconv])
7336 else
7337     AC_MSG_RESULT([internal])
7338     SYSTEM_LIBXSLT=NO
7339     LIBXSLT_MAJOR=1
7340     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
7342     if test "$cross_compiling" = "yes"; then
7343         AC_PATH_PROG(XSLTPROC, xsltproc, no)
7344         if test "$XSLTPROC" = "no"; then
7345             AC_MSG_ERROR([xsltproc is required])
7346         fi
7347     fi
7349 AC_SUBST(SYSTEM_LIBXSLT)
7350 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
7351     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
7353 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
7355 AC_SUBST(LIBEXSLT_CFLAGS)
7356 AC_SUBST(LIBEXSLT_LIBS)
7357 AC_SUBST(LIBXSLT_CFLAGS)
7358 AC_SUBST(LIBXSLT_LIBS)
7359 AC_SUBST(LIBXSLT_MAJOR)
7360 AC_SUBST(XSLTPROC)
7362 # ===================================================================
7363 # Check for system libxml
7364 # ===================================================================
7365 AC_MSG_CHECKING([which libxml to use])
7366 if test "$with_system_libxml" = "yes"; then
7367     AC_MSG_RESULT([external])
7368     SYSTEM_LIBXML=YES
7369     if test "$_os" = "Darwin"; then
7370         dnl make sure to use SDK path
7371         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7372         dnl omit -L/usr/lib
7373         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
7374     elif test $_os = iOS; then
7375         dnl make sure to use SDK path
7376         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
7377         LIBXML_CFLAGS="-I$usr/include/libxml2"
7378         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
7379     else
7380         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
7381     fi
7383     dnl Check for xmllint
7384     AC_PATH_PROG(XMLLINT, xmllint, no)
7385     if test "$XMLLINT" = "no"; then
7386         AC_MSG_ERROR([xmllint is required])
7387     fi
7389     libo_MINGW_CHECK_DLL([libxml2])
7390     libo_MINGW_TRY_DLL([zlib1])
7391 else
7392     AC_MSG_RESULT([internal])
7393     SYSTEM_LIBXML=NO
7394     BUILD_TYPE="$BUILD_TYPE LIBXML2"
7396 AC_SUBST(SYSTEM_LIBXML)
7397 AC_SUBST(LIBXML_CFLAGS)
7398 AC_SUBST(LIBXML_LIBS)
7399 AC_SUBST(XMLLINT)
7401 # =====================================================================
7402 # Checking for a Python interpreter with version >= 2.5 needed to build LO.
7403 # runtime requires Python 3 compatible version (>= 2.6)
7404 # Optionally user can pass an option to configure, i. e.
7405 # ./configure PYTHON=/usr/bin/python
7406 # =====================================================================
7407 if test "$build_os" != "cygwin"; then
7408     # This allows a lack of system python with no error, we use internal one in that case.
7409     AM_PATH_PYTHON([2.5],, [:])
7410     # Clean PYTHON_VERSION checked below if cross-compiling
7411     PYTHON_VERSION=""
7412     if test "$PYTHON" != ":"; then
7413         PYTHON_FOR_BUILD=$PYTHON
7414     fi
7416 AC_SUBST(PYTHON_FOR_BUILD)
7418 # Checks for Python to use for Pyuno
7419 AC_MSG_CHECKING([which Python to use for Pyuno])
7420 case "$enable_python" in
7421 no|disable)
7422     if test -z $PYTHON_FOR_BUILD; then
7423         # Python is required to build LibreOffice. In theory we could separate the build-time Python
7424         # requirement from the choice whether to include Python stuff in the installer, but why
7425         # bother?
7426         AC_MSG_ERROR([Python is required at build time.])
7427     fi
7428     enable_python=no
7429     AC_MSG_RESULT([none])
7430     ;;
7431 ""|yes|auto)
7432     if test "$DISABLE_SCRIPTING" = TRUE -a -n $PYTHON_FOR_BUILD; then
7433         AC_MSG_RESULT([no, overridden by --disable-scripting])
7434         enable_python=no
7435     elif test $build_os = cygwin; then
7436         dnl When building on Windows we don't attempt to use any installed
7437         dnl "system"  Python.
7438         dnl
7439         dnl (When cross-compiling to Windows from Linux using the mingw32-cross
7440         dnl compiler from OBS, use mingw32-python from OBS, and ditto for other
7441         dnl MinGW cross-compilation setups.)
7442         AC_MSG_RESULT([internal])
7443         enable_python=internal
7444     elif test "$cross_compiling" = yes; then
7445         AC_MSG_RESULT([system])
7446         enable_python=system
7447     else
7448         # Unset variables set by the above AM_PATH_PYTHON so that
7449         # we actually do check anew.
7450         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
7451         AM_PATH_PYTHON([3.3],, [:])
7452         if test "$PYTHON" = :; then
7453             AC_MSG_RESULT([internal])
7454             enable_python=internal
7455         else
7456             AC_MSG_RESULT([system])
7457             enable_python=system
7458         fi
7459     fi
7460     ;;
7461 internal)
7462     AC_MSG_RESULT([internal])
7463     ;;
7464 system)
7465     AC_MSG_RESULT([system])
7466     ;;
7468     AC_MSG_ERROR([Incorrect --enable-python option])
7469     ;;
7470 esac
7472 if test $enable_python != no; then
7473     BUILD_TYPE="$BUILD_TYPE PYUNO"
7476 if test $enable_python = system; then
7477     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
7478         # We already have logic above to make sure the system Python
7479         # is used only when building against SDK 10.6 or newer.
7481         # Make sure we use the 2.6 Python when building against the
7482         # 10.6 SDK.
7483         case $with_macosx_sdk in
7484         10.6)
7485             python_version=2.6;;
7486         10.7|10.8)
7487             python_version=2.7;;
7488         *)
7489             # ???
7490             python_version=2.7;;
7491         esac
7492         PYTHON=python$python_version
7493         PYTHON_CFLAGS="-I/Developer/SDKs/MacOSX${with_macosx_sdk}.sdk/System/Library/Frameworks/Python.framework/Versions/${python_version}/include/python${python_version}"
7494         PYTHON_LIBS="-framework Python"
7495     fi
7496     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
7497         # Fallback: Accept these in the environment, or as set above
7498         # for MacOSX.
7499         :
7500     elif test "$cross_compiling" != yes; then
7501         # Unset variables set by the above AM_PATH_PYTHON so that
7502         # we actually do check anew.
7503         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
7504         # This causes an error if no python command is found
7505         AM_PATH_PYTHON([3.3])
7506         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
7507         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
7508         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
7509         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
7510         if test -z "$PKG_CONFIG"; then
7511             PYTHON_CFLAGS="-I$python_include"
7512             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
7513         elif $PKG_CONFIG --exists python-$python_version; then
7514             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
7515             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
7516         else
7517             PYTHON_CFLAGS="-I$python_include"
7518             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
7519         fi
7520     else
7521         dnl How to find out the cross-compilation Python installation path?
7522         dnl Let's hardocode what we know for different distributions for now...
7523         for python_version in 2.6; do
7524             if test -f ${MINGW_SYSROOT}/include/python${python_version}/Python.h; then
7525                 PYTHON_CFLAGS="-I${MINGW_SYSROOT}/include/python$python_version"
7526                 PYTHON_LIBS="-L${MINGW_SYSROOT}/lib -lpython$python_version $python_libs"
7527                 AC_MSG_CHECKING([for python.exe])
7528                 libo_MINGW_CHECK_DLL([libpython$python_version])
7529                 libo_MINGW_CHECK_DLL([libreadline6])
7530                 libo_MINGW_CHECK_DLL([libtermcap])
7531                 # could we somehow extract the really mingw python version from
7532                 # actual distro package?
7533                 # 2.6.2 currently on OpenSUSE 12.1?
7534                 # rpm -q mingw32-python => mingw32-python-2.6.2-17.17.noarch
7535                 PYTHON_VERSION=$python_version.2
7536                 PYTHON_VERSION_MAJOR=`echo $python_version | cut -d . -f 1`
7537                 PYTHON_VERSION_MINOR=`echo $python_version | cut -d . -f 2`
7538                 break
7539             fi
7540         done
7541         AC_MSG_CHECKING([for python version])
7542         AS_IF([test -n "$PYTHON_VERSION"],
7543               [AC_MSG_RESULT([$PYTHON_VERSION])],
7544               [AC_MSG_RESULT([not found])
7545                AC_MSG_ERROR([no usable python found])])
7546         test -n "$PYTHON_CFLAGS" && break
7547     fi
7548     # let the PYTHON_FOR_BUILD match the same python installation that
7549     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
7550     # better for PythonTests.
7551     PYTHON_FOR_BUILD=$PYTHON
7554 dnl By now enable_python should be "system", "internal" or "no"
7555 case $enable_python in
7556 system)
7557     SYSTEM_PYTHON=YES
7559     if test "$CROSS_COMPILING" != YES; then
7560         dnl Check if the headers really work
7561         save_CPPFLAGS="$CPPFLAGS"
7562         CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
7563         AC_CHECK_HEADER(Python.h, [],
7564            [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
7565            [])
7566         CPPFLAGS="$save_CPPFLAGS"
7568         AC_LANG_PUSH(C)
7569         CFLAGS="$CFLAGS $PYTHON_CFLAGS"
7570         AC_MSG_CHECKING([for correct python library version])
7571            AC_RUN_IFELSE([AC_LANG_SOURCE([[
7572 #include <Python.h>
7574 int main(int argc, char **argv) {
7575        if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
7576            (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
7577        else return 1;
7579            ]])],[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])],[])
7580         CFLAGS=$save_CFLAGS
7581         AC_LANG_POP(C)
7583         dnl FIXME Check if the Python library can be linked with, too?
7584     fi
7585     ;;
7587 internal)
7588     SYSTEM_PYTHON=NO
7589     PYTHON_VERSION_MAJOR=3
7590     PYTHON_VERSION_MINOR=3
7591     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.0
7592     BUILD_TYPE="$BUILD_TYPE PYTHON"
7593     # Embedded Python dies without Home set
7594     if test "$HOME" = ""; then
7595         export HOME=""
7596     fi
7597     # bz2 tarball and bzip2 is not standard
7598     if test -z "$BZIP2"; then
7599         AC_PATH_PROG( BZIP2, bzip2)
7600         if test -z "$BZIP2"; then
7601             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
7602         fi
7603     fi
7604     ;;
7606     DISABLE_PYTHON=TRUE
7607     SYSTEM_PYTHON=NO
7608     ;;
7610     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
7611     ;;
7612 esac
7614 AC_SUBST(DISABLE_PYTHON)
7615 AC_SUBST(SYSTEM_PYTHON)
7616 AC_SUBST(PYTHON_CFLAGS)
7617 AC_SUBST(PYTHON_LIBS)
7618 AC_SUBST(PYTHON_VERSION)
7619 AC_SUBST(PYTHON_VERSION_MAJOR)
7620 AC_SUBST(PYTHON_VERSION_MINOR)
7622 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
7623 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
7624     AC_MSG_RESULT([yes])
7625     ENABLE_MARIADBC=YES
7626     MARIADBC_MAJOR=1
7627     MARIADBC_MINOR=0
7628     MARIADBC_MICRO=2
7629     BUILD_TYPE="$BUILD_TYPE MARIADBC"
7630 else
7631     AC_MSG_RESULT([no])
7632     ENABLE_MARIADBC=NO
7634 AC_SUBST(ENABLE_MARIADBC)
7635 AC_SUBST(MARIADBC_MAJOR)
7636 AC_SUBST(MARIADBC_MINOR)
7637 AC_SUBST(MARIADBC_MICRO)
7639 if test "$ENABLE_MARIADBC" = "YES"; then
7641     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
7643     dnl ===================================================================
7644     dnl Check for system MariaDB
7645     dnl ===================================================================
7646     AC_MSG_CHECKING([which MariaDB to use])
7647     if test "$with_system_mariadb" = "yes"; then
7648         AC_MSG_RESULT([external])
7649         SYSTEM_MARIADB=YES
7650         AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
7651         if test -z "$MARIADBCONFIG"; then
7652             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
7653             if test -z "$MARIADBCONFIG"; then
7654                 AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL package.])
7655             fi
7656         fi
7657         AC_MSG_CHECKING([MariaDB version])
7658         MARIADB_VERSION=`$MARIADBCONFIG --version`
7659         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
7660         if test "$MARIADB_MAJOR" -ge "5"; then
7661             AC_MSG_RESULT([OK])
7662         else
7663             AC_MSG_ERROR([too old, use 5.0.x or later])
7664         fi
7665         AC_MSG_CHECKING([for MariaDB Client library])
7666         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
7667         MARIADB_LIBS=`$MARIADBCONFIG --libs`
7668         AC_MSG_RESULT([includes $MARIADB_CFLAGS, libraries $MARIADB_LIBS])
7669     else
7670         AC_MSG_RESULT([internal])
7671         SYSTEM_MARIADB=NO
7672         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb/include"
7673         MARIADB_LIBS="-L${OUTDIR}/lib -lmariadblib"
7674         BUILD_TYPE="$BUILD_TYPE MARIADB"
7675     fi
7677     AC_SUBST(SYSTEM_MARIADB)
7678     AC_SUBST(MARIADB_CFLAGS)
7679     AC_SUBST(MARIADB_LIBS)
7681     AC_LANG_PUSH([C++])
7682     dnl ===================================================================
7683     dnl Check for system MySQL C++ Connector
7684     dnl ===================================================================
7685     # FIXME!
7686     # who thought this too-generic cppconn dir was a good idea?
7687     AC_MSG_CHECKING([MySQL Connector/C++])
7688     if test "$with_system_mysql_cppconn" = "yes"; then
7689         AC_MSG_RESULT([external])
7690         SYSTEM_MYSQL_CPPCONN=YES
7691         AC_LANG_PUSH([C++])
7692         AC_CHECK_HEADER(mysql_driver.h, [],
7693                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
7694         AC_CHECK_LIB([mysqlcppconn], [main], [:],
7695                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
7696         save_LIBS=$LIBS
7697         LIBS="$LIBS -lmysqlcppconn"
7698         AC_MSG_CHECKING([version])
7699         AC_RUN_IFELSE([AC_LANG_SOURCE([[
7700 #include <mysql_driver.h>
7702 int main(int argc, char **argv) {
7703     sql::Driver *driver;
7704     driver = get_driver_instance();
7705     if (driver->getMajorVersion() > 1 || \
7706        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
7707        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
7708         return 0;
7709       else
7710         return 1;
7712       ]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR([not suitable, we need >= 1.0.6])],[])
7714         AC_LANG_POP([C++])
7715         LIBS=$save_LIBS
7716     else
7717         AC_MSG_RESULT([internal])
7718         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
7719         SYSTEM_MYSQL_CPPCONN=NO
7720     fi
7721     AC_LANG_POP([C++])
7723 AC_SUBST(SYSTEM_MYSQL_CPPCONN)
7725 dnl ===================================================================
7726 dnl Check for system hsqldb
7727 dnl ===================================================================
7728 if test "$with_java" != "no"; then
7729 HSQLDB_USE_JDBC_4_1=
7730 AC_MSG_CHECKING([which hsqldb to use])
7731 if test "$with_system_hsqldb" = "yes"; then
7732     AC_MSG_RESULT([external])
7733     SYSTEM_HSQLDB=YES
7734     if test -z $HSQLDB_JAR; then
7735         HSQLDB_JAR=/usr/share/java/hsqldb.jar
7736     fi
7737     AC_CHECK_FILE($HSQLDB_JAR, [],
7738                [AC_MSG_ERROR(hsqldb.jar not found.)], [])
7739     AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
7740     export HSQLDB_JAR
7741     if $PERL -e 'use Archive::Zip;
7742             my $file = "$ENV{'HSQLDB_JAR'}";
7743             my $zip = Archive::Zip->new( $file );
7744             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
7745             if ( $mf =~ m/Specification-Version: 1.8.*/ ) {
7746                push @l, split(/\n/, $mf);
7747                foreach my $line (@l) {
7748                   if ($line =~ m/Specification-Version:/) {
7749                       ($t, $version) = split (/:/,$line);
7750                       $version =~ s/^\s//;
7751                       ($a, $b, $c, $d) = split (/\./,$version);
7752                       if ($c == "0" && $d > "8")  {
7753                           exit 0;
7754                       } else {
7755                           exit 1;
7756                       }
7757                   }
7758                }
7759             } else {
7760                 exit 1;
7761             }'; then
7762         AC_MSG_RESULT([yes])
7763     else
7764         AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
7765     fi
7766 else
7767     AC_MSG_RESULT([internal])
7768     SYSTEM_HSQLDB=NO
7769     BUILD_TYPE="$BUILD_TYPE HSQLDB"
7770     AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
7771     javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
7772     if expr "$javanumver" '>=' 000100060000 > /dev/null; then
7773         AC_MSG_RESULT([yes])
7774         HSQLDB_USE_JDBC_4_1=YES
7775     else
7776         AC_MSG_RESULT([no])
7777     fi
7779 AC_SUBST(SYSTEM_HSQLDB)
7780 AC_SUBST(HSQLDB_JAR)
7781 AC_SUBST([HSQLDB_USE_JDBC_4_1])
7784 dnl ===================================================================
7785 dnl Check for PostgreSQL stuff
7786 dnl ===================================================================
7787 if test "x$enable_postgresql_sdbc" != "xno"; then
7788     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
7790     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
7791         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
7792     fi
7793     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
7794         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
7795     fi
7797     AC_MSG_CHECKING([PostgreSQL C interface])
7798     if test "$with_system_postgresql" = "yes"; then
7799         AC_MSG_RESULT([external PostgreSQL])
7800         SYSTEM_POSTGRESQL=YES
7801         if test "$_os" = Darwin; then
7802             supp_path=''
7803             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
7804                 pg_supp_path="$P_SEP$d$pg_supp_path"
7805             done
7806         fi
7807         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
7808         if test -z "$PGCONFIG"; then
7809             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
7810         fi
7811         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
7812         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
7813     else
7814         # if/when anything else than PostgreSQL uses Kerberos,
7815         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
7816         WITH_KRB5=NO
7817         WITH_GSSAPI=no
7818         case "$_os" in
7819         Darwin)
7820             # MacOS X has system MIT Kerberos 5 since 10.4
7821             if test "$with_krb5" != "no"; then
7822                 WITH_KRB5=YES
7823                 save_LIBS=$LIBS
7824                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
7825                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5, try installing libcom_err devel package])])
7826                 KRB5_LIBS=$LIBS
7827                 LIBS=$save_LIBS
7828                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
7829                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5, try installing krb5 devel package])])
7830                 KRB5_LIBS="$KRB5_LIBS $LIBS"
7831                 LIBS=$save_LIBS
7832             fi
7833             if test "$with_gssapi" != "no"; then
7834               WITH_GSSAPI=YES
7835               save_LIBS=$LIBS
7836               AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
7837                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
7838               GSSAPI_LIBS=$LIBS
7839               LIBS=$save_LIBS
7840             fi
7841             ;;
7842         WINNT)
7843             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
7844                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
7845             fi
7846             ;;
7847         Linux|GNU|*BSD|DragonFly)
7848             if test "$with_krb5" != "no"; then
7849                 WITH_KRB5=YES
7850                 save_LIBS=$LIBS
7851                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
7852                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
7853                 KRB5_LIBS=$LIBS
7854                 LIBS=$save_LIBS
7855                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
7856                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
7857                 KRB5_LIBS="$KRB5_LIBS $LIBS"
7858                 LIBS=$save_LIBS
7859             fi
7860             if test "$with_gssapi" != "no"; then
7861                 WITH_GSSAPI=YES
7862                 save_LIBS=$LIBS
7863                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
7864                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
7865                 GSSAPI_LIBS=$LIBS
7866                 LIBS=$save_LIBS
7867             fi
7868             ;;
7869         *)
7870             if test "$with_krb5" = "yes"; then
7871                 WITH_KRB5=YES
7872                 save_LIBS=$LIBS
7873                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
7874                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
7875                 KRB5_LIBS=$LIBS
7876                 LIBS=$save_LIBS
7877                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
7878                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
7879                 KRB5_LIBS="$KRB5_LIBS $LIBS"
7880                 LIBS=$save_LIBS
7881             fi
7882             if test "$with_gssapi" = "yes"; then
7883                 WITH_GSSAPI=YES
7884                 save_LIBS=$LIBS
7885                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
7886                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
7887                 LIBS=$save_LIBS
7888                 GSSAPI_LIBS=$LIBS
7889             fi
7890         esac
7892         if test -n "$with_libpq_path"; then
7893             SYSTEM_POSTGRESQL=YES
7894             AC_MSG_RESULT([external libpq])
7895             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
7896             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
7897         else
7898             SYSTEM_POSTGRESQL=NO
7899             AC_MSG_RESULT([internal])
7900             POSTGRESQL_LIB=""
7901             POSTGRESQL_INC="%OVERRIDE_ME%"
7902             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
7903         fi
7904     fi
7905     if test "${SYSTEM_POSTGRESQL}" = "YES"; then
7906         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
7907         save_CFLAGS=$CFLAGS
7908         save_CPPFLAGS=$CPPFLAGS
7909         save_LIBS=$LIBS
7910         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
7911         LIBS="${LIBS} ${POSTGRESQL_LIB}"
7912         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
7913         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
7914             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
7915         CFLAGS=$save_CFLAGS
7916         CPPFLAGS=$save_CPPFLAGS
7917         LIBS=$save_LIBS
7918     fi
7919     BUILD_POSTGRESQL_SDBC=YES
7921 AC_SUBST(WITH_KRB5)
7922 AC_SUBST(WITH_GSSAPI)
7923 AC_SUBST(GSSAPI_LIBS)
7924 AC_SUBST(KRB5_LIBS)
7925 AC_SUBST(BUILD_POSTGRESQL_SDBC)
7926 AC_SUBST(SYSTEM_POSTGRESQL)
7927 AC_SUBST(POSTGRESQL_INC)
7928 AC_SUBST(POSTGRESQL_LIB)
7930 dnl ===================================================================
7931 dnl Check for system curl
7932 dnl ===================================================================
7933 AC_MSG_CHECKING([which libcurl to use])
7934 if test "$with_system_curl" = "auto"; then
7935     case "$_os" in
7936     Darwin)
7937         with_system_curl=yes
7938         ;;
7939     *)
7940         with_system_curl="$with_system_libs"
7941         ;;
7942     esac
7945 if test "$with_system_curl" = "yes"; then
7946     AC_MSG_RESULT([external])
7947     SYSTEM_CURL=YES
7949     curl_version=""
7950     if test "$cross_compiling" = "yes"; then
7951         dnl At least the OBS mingw32-libcurl-devel package
7952         dnl comes with a proper .pc file
7953         PKG_CHECK_MODULES(CURL, libcurl,, [:])
7954         if test -n "$CURL_PKG_ERRORS"; then
7955             AC_MSG_RESULT([no])
7956         else
7957             curl_version=`$PKG_CONFIG --modversion libcurl`
7958         fi
7959     fi
7960     if test -z "$curl_version"; then
7961         AC_PATH_PROG(CURLCONFIG, curl-config)
7962         if test -z "$CURLCONFIG"; then
7963             AC_MSG_ERROR([install the libcurl development package])
7964         fi
7965         CURL_LIBS=`$CURLCONFIG --libs`
7966         CURL_CFLAGS=`$CURLCONFIG --cflags`
7967         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
7968     fi
7970     AC_MSG_CHECKING([whether libcurl is >= 7.13.1])
7972     case $curl_version in
7973     dnl brackets doubled below because Autoconf uses them as m4 quote characters,
7974     dnl so they need to be doubled to end up in the configure script
7975     7.13.1|7.1[[4-9]].*|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
7976         AC_MSG_RESULT([yes, you have $curl_version])
7977         ;;
7978     *)
7979         AC_MSG_ERROR([no, you have $curl_version])
7980         ;;
7981     esac
7983     libo_MINGW_CHECK_DLL([libcurl])
7984     libo_MINGW_TRY_DLL([libintl])
7985     libo_MINGW_TRY_DLL([libidn])
7986     libo_MINGW_TRY_DLL([libnspr4])
7987     libo_MINGW_TRY_DLL([nssutil3])
7988     libo_MINGW_TRY_DLL([libplc4])
7989     libo_MINGW_TRY_DLL([libplds4])
7990     libo_MINGW_TRY_DLL([nss3])
7991     libo_MINGW_TRY_DLL([ssl3])
7992     libo_MINGW_TRY_DLL([libgpg-error])
7993     libo_MINGW_TRY_DLL([libgcrypt])
7994     libo_MINGW_TRY_DLL([libssh2])
7995 else
7996     AC_MSG_RESULT([internal])
7997     SYSTEM_CURL=NO
7998     BUILD_TYPE="$BUILD_TYPE CURL"
8000 AC_SUBST(SYSTEM_CURL)
8001 AC_SUBST(CURL_CFLAGS)
8002 AC_SUBST(CURL_LIBS)
8004 dnl ===================================================================
8005 dnl Check for system boost
8006 dnl ===================================================================
8007 AC_MSG_CHECKING([which boost to use])
8008 if test "$with_system_boost" = "yes"; then
8009     AC_MSG_RESULT([external])
8010     SYSTEM_BOOST=YES
8011     AX_BOOST_BASE
8012     AX_BOOST_DATE_TIME
8013     mingw_boost_date_time_dll=`echo $BOOST_DATE_TIME_LIB | sed -e 's/^-l//' -e 's/\.dll$//'`
8014     libo_MINGW_TRY_DLL([$mingw_boost_date_time_dll])
8015     if test -z "$MINGW_BOOST_DATE_TIME_DLL"; then
8016         # if not found, try again with 'lib' prefix
8017         libo_MINGW_CHECK_DLL([lib$mingw_boost_date_time_dll])
8018     fi
8019     AC_LANG_PUSH([C++])
8020     save_CXXFLAGS=$CXXFLAGS
8021     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS"
8022     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8023        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8024     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8025        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8026     AC_CHECK_HEADER(boost/function.hpp, [],
8027        [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
8028     CXXFLAGS="$CXXFLAGS -fno-exceptions"
8029     AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
8030     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp>
8031 ]], [[]])],[ac_cv_cxx_boost_no_exceptions_broken=no],[ac_cv_cxx_boost_no_exceptions_broken=yes])
8032     if test "$ac_cv_cxx_boost_no_exceptions_broken" = "yes"; then
8033         AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
8034     else
8035         AC_MSG_RESULT([yes])
8036     fi
8037     CXXFLAGS=$save_CXXFLAGS
8038     AC_LANG_POP([C++])
8039 else
8040     AC_MSG_RESULT([internal])
8041     BUILD_TYPE="$BUILD_TYPE BOOST"
8042     SYSTEM_BOOST=NO
8044 AC_SUBST(SYSTEM_BOOST)
8046 dnl ===================================================================
8047 dnl Check for system mdds
8048 dnl ===================================================================
8049 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds >= 0.8.1])
8051 dnl ===================================================================
8052 dnl Determine which hash container mdds shall use
8053 dnl ===================================================================
8054 AC_MSG_CHECKING([which hash container mdds shall use])
8055 if test "x$HAVE_CXX0X" = "xTRUE" -a "x$SYSTEM_MDDS" = "xYES"; then
8056     MDDS_CPPFLAGS=$CXXFLAGS_CXX11
8057     AC_MSG_RESULT([std::unordered_map])
8058 else
8059     MDDS_CPPFLAGS="-DMDDS_HASH_CONTAINER_BOOST"
8060     AC_MSG_RESULT([boost::unordered_map])
8062 AC_SUBST([MDDS_CPPFLAGS])
8064 dnl ===================================================================
8065 dnl Check for system vigra
8066 dnl ===================================================================
8067 AC_MSG_CHECKING([which vigra to use])
8068 if test "$with_system_vigra" = "yes"; then
8069     AC_MSG_RESULT([external])
8070     SYSTEM_VIGRA=YES
8071     AC_LANG_PUSH([C++])
8072     AC_CHECK_HEADER(vigra/copyimage.hxx, [],
8073        [AC_MSG_ERROR(vigra/copyimage.hxx not found. install vigra)], [])
8074     AC_LANG_POP([C++])
8075 else
8076     AC_MSG_RESULT([internal])
8077     BUILD_TYPE="$BUILD_TYPE VIGRA"
8078     SYSTEM_VIGRA=NO
8080 AC_SUBST(SYSTEM_VIGRA)
8082 dnl ===================================================================
8083 dnl Check for system odbc
8084 dnl ===================================================================
8085 AC_MSG_CHECKING([which odbc headers to use])
8086 if test "$with_system_odbc" = "yes"; then
8087     AC_MSG_RESULT([external])
8088     SYSTEM_ODBC_HEADERS=YES
8090     AC_CHECK_HEADER(sqlext.h, [],
8091       [AC_MSG_ERROR(odbc not found. install odbc)], [])
8092 elif test "$enable_database_connectivity" != yes; then
8093     AC_MSG_RESULT([none])
8094 else
8095     AC_MSG_RESULT([internal])
8096     SYSTEM_ODBC_HEADERS=NO
8098 AC_SUBST(SYSTEM_ODBC_HEADERS)
8101 dnl ===================================================================
8102 dnl Check for system openldap
8103 dnl ===================================================================
8105 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8106 AC_MSG_CHECKING([which openldap library to use])
8107 if test "$with_system_openldap" = "yes"; then
8108     AC_MSG_RESULT([external])
8109     SYSTEM_OPENLDAP=YES
8110     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8111     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8112     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8113 else
8114     AC_MSG_RESULT([internal])
8115     SYSTEM_OPENLDAP=NO
8116     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8119 AC_SUBST(SYSTEM_OPENLDAP)
8121 dnl ===================================================================
8122 dnl Check for mozilla ab connectivity for windows
8123 dnl ===================================================================
8125 if test "$_os" = "WINNT"; then
8126     AC_MSG_CHECKING([whether to enable build of Mozilla addressbook connectivity driver for Windows])
8127     if test "$enable_win_mozab_driver" = "yes" -a "$WITH_MINGW" != "YES" ; then
8128         WITH_MOZAB4WIN=YES
8129         AC_MSG_RESULT([yes, internal (old windows mozab driver)])
8130         BUILD_TYPE="$BUILD_TYPE MOZ"
8131         MSVC80_DLLS="msvcp80.dll msvcr80.dll Microsoft.VC80.CRT.manifest"
8132         MSVC80_DLL_PATH=`cygpath -u "$TARFILE_LOCATION"`
8133         for dll in $MSVC80_DLLS; do
8134             if ! test -f "$MSVC80_DLL_PATH/$dll"; then
8135                 AC_MSG_ERROR([can not find $dll in $MSVC80_DLL_PATH needed for the pre-built Mozilla libraries])
8136             fi
8137         done
8138     else
8139         AC_MSG_RESULT([no])
8140         WITH_MOZAB4WIN=NO
8141     fi
8143 AC_SUBST(WITH_MOZAB4WIN)
8144 AC_SUBST(MSVC80_DLLS)
8145 AC_SUBST(MSVC80_DLL_PATH)
8147 dnl ===================================================================
8148 dnl Check for TLS/SSL and cryptographic implementation to use
8149 dnl ===================================================================
8150 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8151 if test -n "$with_tls"; then
8152     case $with_tls in
8153     openssl)
8154         AC_DEFINE(USE_TLS_OPENSSL)
8155         TLS=OPENSSL
8157         if test "$enable_openssl" != "yes"; then
8158             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8159         fi
8161         # warn that OpenSSL has been selected but not all TLS code has this option
8162         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS])
8163         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS"
8164         ;;
8165     nss)
8166         AC_DEFINE(USE_TLS_NSS)
8167         TLS=NSS
8168         ;;
8169     *)
8170         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8171 openssl - OpenSSL
8172 nss - Mozilla's Network Security Services (NSS)
8173     ])
8174         ;;
8175     esac
8176 else
8177     if test "$enable_openssl" = "yes"; then
8178         AC_DEFINE(USE_TLS_OPENSSL)
8179         TLS=OPENSSL
8180     else
8181         AC_DEFINE(USE_TLS_NSS)
8182         TLS=NSS
8183     fi
8185 AC_MSG_RESULT([$TLS])
8186 AC_SUBST(TLS)
8188 dnl ===================================================================
8189 dnl Check for system NSS
8190 dnl ===================================================================
8191 libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8192 if test "$with_system_nss" = "yes"; then
8193     libo_MINGW_CHECK_DLL([libnspr4])
8194     libo_MINGW_CHECK_DLL([libplc4])
8195     libo_MINGW_CHECK_DLL([libplds4])
8196     libo_MINGW_CHECK_DLL([nss3])
8197     libo_MINGW_CHECK_DLL([nssutil3])
8198     libo_MINGW_CHECK_DLL([smime3])
8199     libo_MINGW_CHECK_DLL([ssl3])
8200 else
8201     NSS_MAJOR="3"
8202     NSS_MINOR="13"
8203     NSS_PATCH="5"
8205 AC_SUBST(NSS_MAJOR)
8206 AC_SUBST(NSS_MINOR)
8207 AC_SUBST(NSS_PATCH)
8209 dnl ===================================================================
8210 dnl Check for system mozilla headers
8211 dnl ===================================================================
8212 HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=
8213 AC_MSG_CHECKING([which NPAPI headers to use])
8215 if test "$with_system_npapi_headers" = "yes"; then
8216     AC_MSG_RESULT([external])
8217     SYSTEM_NPAPI_HEADERS=YES
8218     # First try npapi-sdk:
8219     PKG_CHECK_MODULES(NPAPI_HEADERS, npapi-sdk, [LOCATED=yes], [LOCATED=no])
8220     # Then go with libxul:
8221     if test "x$LOCATED" != "xyes"; then
8222         PKG_CHECK_MODULES(NPAPI_HEADERS, libxul, [LOCATED=yes], [LOCATED=no])
8223     fi
8224     if test "x$LOCATED" != "xyes"; then
8225         PKG_CHECK_MODULES(NPAPI_HEADERS, mozilla-plugin, [LOCATED=yes], [LOCATED=no])
8226     fi
8227     # if still not found bail out
8228     if test "x$LOCATED" != "xyes"; then
8229         AC_MSG_ERROR([npapi.h header file not found])
8230     fi
8232     AC_LANG_PUSH([C])
8233     save_CFLAGS=$CFLAGS
8234     CFLAGS="$CFLAGS $NPAPI_HEADERS_CFLAGS"
8235     AC_MSG_CHECKING([for NPP_GetMIMEDescription return type])
8236     AC_COMPILE_IFELSE(
8237         [AC_LANG_SOURCE([[
8238             #define XP_UNIX
8239             #include <npapi.h>
8240             const char* NPP_GetMIMEDescription(void) { return "foo"; }
8241             ]])],
8242         [AC_MSG_RESULT([const char*])],
8243         [
8244         AC_MSG_RESULT([char*])
8245         HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=TRUE
8246         ])
8247     CFLAGS=$save_CFLAGS
8248     AC_LANG_POP([C])
8249     NPAPI_HEADERS_CFLAGS="`echo $NPAPI_HEADERS_CFLAGS | sed -e \"s/-I/${ISYSTEM}/g\"`"
8250 else
8251     AC_MSG_RESULT([internal])
8252         dnl ...but will not be built/used unless ENABLE_NPAPI_FROM_BROWSER or
8253         dnl ENABLE_NPAPI_INTO_BROWSER is YES
8254     SYSTEM_NPAPI_HEADERS=NO
8256 AC_SUBST(NPAPI_HEADERS_CFLAGS)
8257 AC_SUBST(SYSTEM_NPAPI_HEADERS)
8258 AC_SUBST(HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION)
8260 dnl ===================================================================
8261 dnl Check for system sane
8262 dnl ===================================================================
8263 AC_MSG_CHECKING([which sane header to use])
8264 if test "$with_system_sane" = "yes"; then
8265     AC_MSG_RESULT([external])
8266     AC_CHECK_HEADER(sane/sane.h, [],
8267       [AC_MSG_ERROR(sane not found. install sane)], [])
8268 else
8269     AC_MSG_RESULT([internal])
8270     BUILD_TYPE="$BUILD_TYPE SANE"
8273 dnl ===================================================================
8274 dnl Check for system icu
8275 dnl ===================================================================
8276 SYSTEM_GENBRK=
8277 SYSTEM_GENCCODE=
8278 SYSTEM_GENCMN=
8280 ICU_MAJOR=51
8281 ICU_MINOR=1
8282 ICU_RECLASSIFIED_CLOSE_PARENTHESIS="YES"
8283 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="YES"
8284 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="YES"
8285 ICU_RECLASSIFIED_HEBREW_LETTER="YES"
8286 AC_MSG_CHECKING([which icu to use])
8287 if test "$with_system_icu" = "yes"; then
8288     AC_MSG_RESULT([external])
8289     SYSTEM_ICU=YES
8290     AC_LANG_PUSH([C++])
8291     AC_MSG_CHECKING([for unicode/rbbi.h])
8292     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
8293     AC_LANG_POP([C++])
8295     if test "$cross_compiling" != "yes" -o "$WITH_MINGW" = "yes"; then
8296         ICUPATH="$PATH"
8297         if test "$WITH_MINGW" = "yes"; then
8298             ICUPATH=`$CC -print-sysroot`/mingw/bin:"$ICUPATH"
8299         fi
8300         AC_PATH_PROG(ICUCONFIG,icu-config,,[$ICUPATH])
8302         AC_MSG_CHECKING([ICU version])
8303         ICU_VERSION=`$ICUCONFIG --noverify --version 2>/dev/null || $ICUCONFIG --version`
8304         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
8305         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
8307         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "2" \); then
8308             AC_MSG_RESULT([OK, $ICU_VERSION])
8309         else
8310             AC_MSG_ERROR([not suitable, only >= 4.2 supported currently])
8311         fi
8312     fi
8314     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
8315         AC_PATH_PROG([ICUCONFIG_FOR_BUILD], [icu-config], [], [$PATH:/usr/sbin:/sbin])
8316         ICU_VERSION_FOR_BUILD=`$ICUCONFIG_FOR_BUILD --noverify --version 2>/dev/null || $ICUCONFIG_FOR_BUILD --version`
8317         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
8318         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
8319         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
8320         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
8321             AC_MSG_RESULT([yes])
8322         else
8323             AC_MSG_RESULT([no])
8324             if test "$with_system_icu_for_build" != "force"; then
8325                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
8326 You can use --with-system-icu-for-build=force to use it anyway.])
8327             fi
8328         fi
8329     fi
8331     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
8332         # using the system icu tools can lead to version confusion, use the
8333         # ones from the build environment when cross-compiling
8334         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
8335         if test -z "$SYSTEM_GENBRK"; then
8336             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
8337         fi
8338         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8339         if test -z "$SYSTEM_GENCCODE"; then
8340             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
8341         fi
8342         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8343         if test -z "$SYSTEM_GENCMN"; then
8344             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
8345         fi
8346         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "4" \); then
8347             ICU_RECLASSIFIED_CLOSE_PARENTHESIS="YES"
8348         else
8349             ICU_RECLASSIFIED_CLOSE_PARENTHESIS="NO"
8350         fi
8351         if test "$ICU_MAJOR" -ge "49"; then
8352             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="YES"
8353             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="YES"
8354             ICU_RECLASSIFIED_HEBREW_LETTER="YES"
8355         else
8356             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="NO"
8357             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="NO"
8358             ICU_RECLASSIFIED_HEBREW_LETTER="NO"
8359         fi
8360     fi
8362     if test "$cross_compiling" = "yes"; then
8363        if test "$ICU_MAJOR" -ge "50"; then
8364             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
8365             ICU_MINOR=""
8366        fi
8367     fi
8369     libo_MINGW_CHECK_DLL([icudata][$ICU_MAJOR][$ICU_MINOR])
8370     libo_MINGW_CHECK_DLL([icui18n][$ICU_MAJOR][$ICU_MINOR])
8371     libo_MINGW_CHECK_DLL([icuuc][$ICU_MAJOR][$ICU_MINOR])
8372 else
8373     AC_MSG_RESULT([internal])
8374     SYSTEM_ICU="NO"
8375     BUILD_TYPE="$BUILD_TYPE ICU"
8376     # surprisingly set these only for "internal" (to be used by various other
8377     # external libs): the system icu-config is quite unhelpful and spits out
8378     # dozens of weird flags and also default path -I/usr/include
8379     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8380     ICU_LIBS=""
8382 AC_SUBST(SYSTEM_ICU)
8383 AC_SUBST(SYSTEM_GENBRK)
8384 AC_SUBST(SYSTEM_GENCCODE)
8385 AC_SUBST(SYSTEM_GENCMN)
8386 AC_SUBST(ICU_MAJOR)
8387 AC_SUBST(ICU_MINOR)
8388 AC_SUBST(ICU_RECLASSIFIED_CLOSE_PARENTHESIS)
8389 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
8390 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
8391 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
8392 AC_SUBST(ICU_CFLAGS)
8393 AC_SUBST(ICU_LIBS)
8395 dnl ===================================================================
8396 dnl Graphite
8397 dnl ===================================================================
8399 AC_MSG_CHECKING([whether to enable graphite support])
8400 if test "$_os" = "WINNT" -o "$_os" = "Linux" && test "$enable_graphite" = "" -o "$enable_graphite" != "no"; then
8401     AC_MSG_RESULT([yes])
8402     ENABLE_GRAPHITE="TRUE"
8403     AC_DEFINE(ENABLE_GRAPHITE)
8404     libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
8405     if test "$with_system_graphite" = "yes"; then
8406         libo_MINGW_CHECK_DLL([libgraphite2])
8407     fi
8408 else
8409     AC_MSG_RESULT([no])
8411 AC_SUBST(ENABLE_GRAPHITE)
8413 dnl ===================================================================
8414 dnl HarfBuzz
8415 dnl ===================================================================
8416 AC_MSG_CHECKING([whether to enable HarfBuzz support])
8417 if test "$_os" != "WINNT" -a "$_os" != "Darwin"; then
8418     AC_MSG_RESULT([yes])
8419     ENABLE_HARFBUZZ="TRUE"
8420     libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz >= 0.9.10])
8421 else
8422     AC_MSG_RESULT([no])
8424 AC_SUBST(ENABLE_HARFBUZZ)
8426 dnl ===================================================================
8427 dnl Check for NPAPI interface to plug browser plugins into LibreOffice documents
8428 dnl ===================================================================
8429 AC_MSG_CHECKING([whether to plug browser plugins into LibreOffice documents])
8430 # Obviously no such thing on iOS or Android. Also not possible when building 
8431 # 64-bit OS X code as the plugin code uses QuickTime and Carbon.
8432 if test "$_os" != Android -a "$_os" != iOS -a \( $_os != Darwin -o "$BITNESS_OVERRIDE" = "" \) -a \
8433         "$enable_headless" != yes
8434 then
8435     AC_MSG_RESULT([yes])
8436     ENABLE_NPAPI_FROM_BROWSER=YES
8437 else
8438     AC_MSG_RESULT([no])
8439     ENABLE_NPAPI_FROM_BROWSER=NO
8441 AC_SUBST(ENABLE_NPAPI_FROM_BROWSER)
8443 dnl ===================================================================
8444 dnl Check for NPAPI interface to plug LibreOffice into browser windows
8445 dnl ===================================================================
8446 AC_MSG_CHECKING([whether to plug LibreOffice into browser windows])
8447 if test "$_os" == WINNT -o "$_os" != Android -a "$_os" != Darwin -a "$_os" != iOS -a \
8448         "$enable_headless" != yes -a "$enable_gtk" != no
8449 then
8450     AC_MSG_RESULT([yes])
8451     ENABLE_NPAPI_INTO_BROWSER=YES
8452 else
8453     AC_MSG_RESULT([no])
8454     ENABLE_NPAPI_INTO_BROWSER=NO
8456 AC_SUBST(ENABLE_NPAPI_INTO_BROWSER)
8458 AC_MSG_CHECKING([whether to use X11])
8459 dnl ***************************************
8460 dnl testing for X libraries and includes...
8461 dnl ***************************************
8462 WANT_X11="no"
8463 if test $_os != Darwin -a $_os != WINNT -a $_os != Android -a $_os != iOS -a "$enable_headless" != "yes"; then
8464     WANT_X11="yes"
8466 AC_MSG_RESULT([$WANT_X11])
8468 if test "$WANT_X11" = "yes"; then
8469     AC_PATH_X
8470     AC_PATH_XTRA
8471     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
8473     if test -z "$x_includes"; then
8474         x_includes="default_x_includes"
8475     fi
8476     if test -z "$x_libraries"; then
8477         x_libraries="default_x_libraries"
8478     fi
8479     CFLAGS="$CFLAGS $X_CFLAGS"
8480     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
8481     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
8482 else
8483     x_includes="no_x_includes"
8484     x_libraries="no_x_libraries"
8487 if test "$WANT_X11" = "yes"; then
8488     dnl ===================================================================
8489     dnl Check for Composite.h for Mozilla plugin
8490     dnl ===================================================================
8491     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
8492      [#include <X11/Intrinsic.h>])
8494     dnl ===================================================================
8495     dnl Check for extension headers
8496     dnl ===================================================================
8497     AC_MSG_CHECKING([whether to use internal X11 extensions headers])
8498     if test "$with_system_xextensions_headers" != "no"; then
8499         AC_MSG_RESULT([no])
8500         AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
8501         [#include <X11/extensions/shape.h>])
8502     else
8503         AC_MSG_RESULT([yes])
8504         BUILD_TYPE="$BUILD_TYPE X11_EXTENSIONS"
8505     fi
8509 dnl ===================================================================
8510 dnl Check for system Xrender
8511 dnl ===================================================================
8512 AC_MSG_CHECKING([whether to use Xrender])
8513 if test "$WANT_X11" = "yes" -a  "$test_xrender" = "yes"; then
8514     AC_MSG_RESULT([yes])
8515     PKG_CHECK_MODULES(XRENDER, xrender)
8516     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
8517       [AC_MSG_ERROR(libXrender not found or functional)], [])
8518     AC_MSG_CHECKING([which Xrender headers to use])
8519     if test "$with_system_xextensions_headers" != "no"; then
8520         AC_MSG_RESULT([external])
8521         AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
8522           [AC_MSG_ERROR(Xrender not found. install X)], [])
8523     else
8524         AC_MSG_RESULT([internal])
8525     fi
8526 else
8527     AC_MSG_RESULT([no])
8529 AC_SUBST(XRENDER_CFLAGS)
8530 AC_SUBST(XRENDER_LIBS)
8532 dnl ===================================================================
8533 dnl Check for XRandr
8534 dnl ===================================================================
8535 AC_MSG_CHECKING([whether to enable RandR support])
8536 if test "$WANT_X11" = "yes" -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
8537     if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
8538         XRANDR_DLOPEN="TRUE"
8539         AC_MSG_RESULT([configured to dlopen libXrandr at runtime])
8540     else
8541         AC_MSG_RESULT([yes])
8542         XRANDR_DLOPEN="FALSE"
8543         PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
8544         if test "$ENABLE_RANDR" != "TRUE"; then
8545             AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
8546                         [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
8547             XRANDR_CFLAGS=" "
8548             AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
8549               [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
8550             XRANDR_LIBS="-lXrandr "
8551             ENABLE_RANDR="TRUE"
8552         fi
8553     fi
8554 else
8555     ENABLE_RANDR=""
8556     AC_MSG_RESULT([no])
8558 AC_SUBST(XRANDR_DLOPEN)
8559 AC_SUBST(XRANDR_CFLAGS)
8560 AC_SUBST(XRANDR_LIBS)
8561 AC_SUBST(ENABLE_RANDR)
8563 dnl ===================================================================
8564 dnl Check for building neon
8565 dnl ===================================================================
8566 AC_MSG_CHECKING([whether to use neon])
8567 if test "$enable_neon" = "no"; then
8568     AC_MSG_RESULT([no])
8569     DISABLE_NEON=TRUE
8570     AC_SUBST(DISABLE_NEON)
8571 else
8572     AC_MSG_RESULT([yes])
8573 dnl ===================================================================
8574 dnl Check for system neon
8575 dnl ===================================================================
8576 libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
8577 if test "$with_system_neon" = "yes"; then
8578     NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
8579     libo_MINGW_CHECK_DLL([libneon])
8580     libo_MINGW_TRY_DLL([libtasn1])
8581     libo_MINGW_TRY_DLL([libgnutls])
8582 else
8583     NEON_VERSION=0295
8585 AC_SUBST(NEON_VERSION)
8588 dnl ===================================================================
8589 dnl Check for disabling cve_tests
8590 dnl ===================================================================
8591 AC_MSG_CHECKING([whether to execute CVE tests])
8592 if test "$enable_cve_tests" = "no"; then
8593     AC_MSG_RESULT([no])
8594     DISABLE_CVE_TESTS=TRUE
8595     AC_SUBST(DISABLE_CVE_TESTS)
8596 else
8597     AC_MSG_RESULT([yes])
8600 dnl ===================================================================
8601 dnl Check for system openssl
8602 dnl ===================================================================
8603 DISABLE_OPENSSL="NO"
8604 AC_MSG_CHECKING([whether to disable OpenSSL usage])
8605 if test "$enable_openssl" = "yes"; then
8606     AC_MSG_RESULT([no])
8607     if test "$_os" = Darwin -a "${MAC_OS_X_VERSION_MIN_REQUIRED:-0}" -ge 1070; then
8608         # OpenSSL is deprecated when building for 10.7 or later.
8609         #
8610         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
8611         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
8612         #
8613         # They apparently got fed up with the unstable ABI of
8614         # OpenSSL, or something, and recommend you either move to
8615         # their "Common Crypto Architecture", or, if you have to stay
8616         # with OpenSSL, just build it yourself statically and bundle
8617         # with your application.
8619         with_system_openssl=no
8620         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
8621     elif test "$_os" = "Darwin" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o \
8622             "$_os" = "DragonFly" && test "$with_system_openssl" != "no"; then
8623         # Mac OS builds should get out without extra stuff is the Mac porters'
8624         # wish. And pkg-config is although Xcode ships a .pc for openssl
8625         with_system_openssl=yes
8626         SYSTEM_OPENSSL=YES
8627         OPENSSL_CFLAGS=
8628         OPENSSL_LIBS="-lssl -lcrypto"
8629     else
8630         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
8631     fi
8632     if test "$with_system_openssl" = "yes"; then
8633         libo_MINGW_CHECK_DLL([libssl])
8634         libo_MINGW_CHECK_DLL([libcrypto])
8635     fi
8636 else
8637     AC_MSG_RESULT([yes])
8638     DISABLE_OPENSSL=YES
8640     # warn that although OpenSSL is disabled, system libraries may be depending on it
8641     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
8642     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
8645 AC_SUBST([DISABLE_OPENSSL])
8647 dnl ===================================================================
8648 dnl Check for building gnutls
8649 dnl ===================================================================
8650 AC_MSG_CHECKING([whether to use gnutls])
8651 if test "$enable_neon" != "no" && test "$enable_openssl" = "no"; then
8652     AC_MSG_RESULT([yes])
8653     AM_PATH_LIBGCRYPT()
8654     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
8655         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
8656                       available in the system to use as replacement.]]))
8659 AC_SUBST([LIBGCRYPT_CFLAGS])
8660 AC_SUBST([LIBGCRYPT_LIBS])
8662 dnl ===================================================================
8663 dnl Check for system redland
8664 dnl ===================================================================
8665 dnl versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
8666 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8])
8667 if test "$with_system_redland" = "yes"; then
8668     # need at least 2.0.7 for CVE-2012-0037
8669     PKG_CHECK_MODULES([RAPTOR2],[raptor2 >= 2.0.7])
8670     libo_MINGW_CHECK_DLL([librdf])
8671     libo_MINGW_TRY_DLL([libraptor])
8672     libo_MINGW_TRY_DLL([librasqal])
8673     libo_MINGW_TRY_DLL([libsqlite3])
8674 else
8675     RAPTOR_MAJOR="0"
8676     RASQAL_MAJOR="3"
8677     REDLAND_MAJOR="0"
8679 AC_SUBST(RAPTOR_MAJOR)
8680 AC_SUBST(RASQAL_MAJOR)
8681 AC_SUBST(REDLAND_MAJOR)
8683 dnl ===================================================================
8684 dnl Check for system orcus
8685 dnl ===================================================================
8686 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.6 >= 0.5.0])
8687 if test "$with_system_orcus" != "yes"; then
8688     if test "$SYSTEM_BOOST" = "YES"; then
8689         # ===========================================================
8690         # Determine if we are going to need to link with Boost.System
8691         # ===========================================================
8692         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
8693         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
8694         dnl in documentation has no effect.
8695         AC_MSG_CHECKING([if we need to link with Boost.System])
8696         AC_LANG_PUSH([C++])
8697         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
8698                 @%:@include <boost/version.hpp>
8699             ]],[[
8700                 #if BOOST_VERSION >= 105000
8701                 #   error yes, we need to link with Boost.System
8702                 #endif
8703             ]])],[
8704                 AC_MSG_RESULT([no])
8705             ],[
8706                 AC_MSG_RESULT([yes])
8707                 AX_BOOST_SYSTEM
8708         ])
8709         AC_LANG_POP([C++])
8710     fi
8712 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
8713 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
8714 AC_SUBST([BOOST_SYSTEM_LIB])
8715 AC_SUBST(SYSTEM_LIBORCUS)
8717 dnl ===================================================================
8718 dnl Check for system hunspell
8719 dnl ===================================================================
8720 AC_MSG_CHECKING([which libhunspell to use])
8721 if test "$with_system_hunspell" = "yes"; then
8722     AC_MSG_RESULT([external])
8723     SYSTEM_HUNSPELL=YES
8724     AC_LANG_PUSH([C++])
8725     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
8726     if test "$HUNSPELL_PC" != "TRUE"; then
8727         AC_CHECK_HEADER(hunspell.hxx, [],
8728             [
8729             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
8730             [AC_MSG_ERROR(hunspell headers not found.)], [])
8731             ], [])
8732         AC_CHECK_LIB([hunspell], [main], [:],
8733            [ AC_MSG_ERROR(hunspell library not found.) ], [])
8734         HUNSPELL_LIBS=-lhunspell
8735     fi
8736     AC_LANG_POP([C++])
8737     libo_MINGW_CHECK_DLL([libhunspell-1.3])
8738     HUNSPELL_CFLAGS="`echo $HUNSPELL_CFLAGS | sed -e \"s/-I/${ISYSTEM}/g\"`"
8739 else
8740     AC_MSG_RESULT([internal])
8741     SYSTEM_HUNSPELL=NO
8742     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
8743     HUNSPELL_LIBS="-L${OUTDIR}/lib -lhunspell"
8744     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
8746 AC_SUBST(SYSTEM_HUNSPELL)
8747 AC_SUBST(HUNSPELL_CFLAGS)
8748 AC_SUBST(HUNSPELL_LIBS)
8750 dnl ===================================================================
8751 dnl Checking for altlinuxhyph
8752 dnl ===================================================================
8753 AC_MSG_CHECKING([which altlinuxhyph to use])
8754 if test "$with_system_altlinuxhyph" = "yes"; then
8755     AC_MSG_RESULT([external])
8756     SYSTEM_HYPH=YES
8757     AC_CHECK_HEADER(hyphen.h, [],
8758        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
8759     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
8760        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
8761        [#include <hyphen.h>])
8762     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
8763         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
8764     if test -z "$HYPHEN_LIB"; then
8765         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
8766            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
8767     fi
8768     if test -z "$HYPHEN_LIB"; then
8769         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
8770            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
8771     fi
8772     libo_MINGW_CHECK_DLL([libhyphen])
8773 else
8774     AC_MSG_RESULT([internal])
8775     SYSTEM_HYPH=NO
8776     BUILD_TYPE="$BUILD_TYPE HYPHEN"
8778 AC_SUBST(SYSTEM_HYPH)
8779 AC_SUBST(HYPHEN_LIB)
8781 dnl ===================================================================
8782 dnl Checking for mythes
8783 dnl ===================================================================
8784 AC_MSG_CHECKING([which mythes to use])
8785 if test "$with_system_mythes" = "yes"; then
8786     AC_MSG_RESULT([external])
8787     SYSTEM_MYTHES=YES
8788     AC_LANG_PUSH([C++])
8789     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
8790     if test "$MYTHES_PKGCONFIG" = "no"; then
8791         AC_CHECK_HEADER(mythes.hxx, [],
8792             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
8793         AC_CHECK_LIB([mythes-1.2], [main], [:],
8794             [ MYTHES_FOUND=no], [])
8795     if test "$MYTHES_FOUND" = "no"; then
8796         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
8797                 [ MYTHES_FOUND=no], [])
8798     fi
8799     if test "$MYTHES_FOUND" = "no"; then
8800         AC_MSG_ERROR([mythes library not found!.])
8801     fi
8802     fi
8803     AC_LANG_POP([C++])
8804     libo_MINGW_CHECK_DLL([libmythes-1.2])
8805 else
8806     AC_MSG_RESULT([internal])
8807     SYSTEM_MYTHES=NO
8808     BUILD_TYPE="$BUILD_TYPE MYTHES"
8810 AC_SUBST(SYSTEM_MYTHES)
8811 AC_SUBST(MYTHES_CFLAGS)
8812 AC_SUBST(MYTHES_LIBS)
8814 dnl ===================================================================
8815 dnl Checking for lpsolve
8816 dnl ===================================================================
8817 AC_MSG_CHECKING([which lpsolve to use])
8818 if test "$with_system_lpsolve" = "yes"; then
8819     AC_MSG_RESULT([external])
8820     SYSTEM_LPSOLVE=YES
8821     AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
8822        [ AC_MSG_ERROR(lpsolve headers not found.)], [])
8823     save_LIBS=$LIBS
8824     # some systems need this. Like Ubuntu....
8825     AC_CHECK_LIB(m, floor)
8826     AC_CHECK_LIB(dl, dlopen)
8827     AC_CHECK_LIB([lpsolve55], [make_lp], [:],
8828         [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
8829     LIBS=$save_LIBS
8830     libo_MINGW_CHECK_DLL([lpsolve55])
8831 else
8832     AC_MSG_RESULT([internal])
8833     SYSTEM_LPSOLVE=NO
8834     BUILD_TYPE="$BUILD_TYPE LPSOLVE"
8836 AC_SUBST(SYSTEM_LPSOLVE)
8840 dnl ===================================================================
8841 dnl Checking for libexttextcat
8842 dnl ===================================================================
8843 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.1.1])
8844 if test "$with_system_libexttextcat" = "yes"; then
8845     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
8847 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
8849 dnl ***************************************
8850 dnl testing libc version for Linux...
8851 dnl ***************************************
8852 if test "$_os" = "Linux"; then
8853     AC_MSG_CHECKING([whether libc is >= 2.1.1])
8854     exec 6>/dev/null # no output
8855     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
8856     exec 6>&1 # output on again
8857     if test "$HAVE_LIBC"; then
8858         AC_MSG_RESULT([yes])
8859     else
8860         AC_MSG_ERROR([no, upgrade libc])
8861     fi
8864 if test "$_os" != "WINNT"; then
8865     AC_CHECK_FUNCS(getopt, HAVE_GETOPT=YES, [HAVE_GETOPT=NO])
8866     AC_CHECK_FUNCS(readdir_r, HAVE_READDIR_R=YES, [HAVE_READDIR_R=NO])
8867     if test "$HAVE_GETOPT" = "YES" -a "$HAVE_READDIR_R" = "YES"; then
8868         SYSTEM_LIBC=YES
8869     fi
8870 else
8871     HAVE_GETOPT=NO
8872     HAVE_READDIR_R=NO
8873     SYSTEM_LIBC=YES
8876 if test "$HAVE_GETOPT" = NO -o "$HAVE_READDIR_R" = NO; then
8877     BUILD_TYPE="$BUILD_TYPE GLIBC"
8880 AC_SUBST(HAVE_GETOPT)
8881 AC_SUBST(HAVE_READDIR_R)
8882 AC_SUBST(SYSTEM_LIBC)
8884 dnl =========================================
8885 dnl Check for the Windows  SDK.
8886 dnl =========================================
8887 dnl FIXME: I don't know yet if the Windows SDK works with MinGW, keep it until I know better,
8888 dnl and add "-a \( "$WITH_MINGW" != "yes" \)" then
8889 if test "$_os" = "WINNT"; then
8890     AC_MSG_CHECKING([for Windows SDK])
8891     if test "$build_os" = "cygwin"; then
8892         find_winsdk
8893         WINDOWS_SDK_HOME=$winsdktest
8895         # normalize if found
8896         if test -n "$WINDOWS_SDK_HOME"; then
8897             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
8898             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
8899         fi
8900     fi
8902     if test -n "$WINDOWS_SDK_HOME"; then
8903         # Remove a possible trailing backslash
8904         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
8906         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
8907              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
8908              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
8909             have_windows_sdk_headers=yes
8910         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
8911              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
8912              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
8913             have_windows_sdk_headers=yes
8914         else
8915             have_windows_sdk_headers=no
8916         fi
8918         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
8919             have_windows_sdk_libs=yes
8920         elif test -f "$WINDOWS_SDK_HOME/lib/win8/um/$WINDOWS_SDK_ARCH/user32.lib"; then
8921             have_windows_sdk_libs=yes
8922         else
8923             have_windows_sdk_libs=no
8924         fi
8926         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
8927             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
8928 the  Windows SDK are installed.])
8929         fi
8931         if test ! -f "$WINDOWS_SDK_HOME/bin/msiinfo.exe" \
8932              -o ! -f "$WINDOWS_SDK_HOME/bin/msidb.exe" \
8933              -o ! -f "$WINDOWS_SDK_HOME/bin/uuidgen.exe" \
8934              -o ! -f "$WINDOWS_SDK_HOME/bin/msitran.exe"; then :
8935         elif test ! -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
8936              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
8937              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/uuidgen.exe" \
8938              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
8939         else
8940             AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
8941         fi
8942     fi
8944     if test -z "$WINDOWS_SDK_HOME"; then
8945         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
8946     elif echo $WINDOWS_SDK_HOME | grep "v6.0" >/dev/null 2>/dev/null; then
8947         WINDOWS_SDK_VERSION=60
8948         AC_MSG_RESULT([found Windows SDK 6.0 ($WINDOWS_SDK_HOME)])
8949     elif echo $WINDOWS_SDK_HOME | grep "v6.1" >/dev/null 2>/dev/null; then
8950         WINDOWS_SDK_VERSION=61
8951         AC_MSG_RESULT([found Windows SDK 6.1 ($WINDOWS_SDK_HOME)])
8952     elif echo $WINDOWS_SDK_HOME | grep "v7" >/dev/null 2>/dev/null; then
8953         WINDOWS_SDK_VERSION=70
8954         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
8955     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
8956         WINDOWS_SDK_VERSION=80
8957         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
8958     else
8959         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
8960     fi
8961     PathFormat "$WINDOWS_SDK_HOME"
8962     WINDOWS_SDK_HOME="$formatted_path"
8963     if test "$build_os" = "cygwin"; then
8964         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/include"
8965         if test -d "$WINDOWS_SDK_HOME/include/um"; then
8966             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
8967         fi
8968     fi
8970 AC_SUBST(WINDOWS_SDK_HOME)
8971 AC_SUBST(WINDOWS_SDK_VERSION)
8973 dnl =========================================
8974 dnl Check for uuidgen
8975 dnl =========================================
8976 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
8977     if test "$WITH_MINGW" = "yes"; then
8978         AC_PATH_PROG([UUIDGEN], [uuid])
8979         if test -z "$UUIDGEN"; then
8980             AC_MSG_WARN([uuid is needed for dev-install])
8981         fi
8982     else
8983         # presence is already tested above in the WINDOWS_SDK_HOME check
8984         UUIDGEN=uuidgen.exe
8985         AC_SUBST(UUIDGEN)
8986     fi
8987 else
8988     AC_PATH_PROG([UUIDGEN], [uuidgen])
8989     if test -z "$UUIDGEN"; then
8990         AC_MSG_WARN([uuid is needed for dev-install])
8991     fi
8994 dnl =========================================
8995 dnl Check for the Microsoft DirectX SDK.
8996 dnl =========================================
8997 if test -n "$ENABLE_DIRECTX" -a "$_os" = "WINNT"; then
8998     AC_MSG_CHECKING([for DirectX SDK])
8999     if test "$build_os" = "cygwin"; then
9000         dnl A standard installation of the DirectX SDK sets $DXSDK_DIR
9001         if test -n "$DXSDK_DIR"; then
9002             DIRECTXSDK_HOME=`cygpath -d "$DXSDK_DIR"`
9003             DIRECTXSDK_HOME=`cygpath -u "$DIRECTXSDK_HOME"`
9004         fi
9005         # At this point $DIRECTXSDK_HOME might still be undefined. This will lead to
9006         # the "DirectX SDK not found" error later.
9007         # (Where?)
9009         # Remove a possible trailing backslash
9010         DIRECTXSDK_HOME=`echo $DIRECTXSDK_HOME | $SED 's/\/$//'`
9011     fi
9013     if test -f "$DIRECTXSDK_HOME/Include/ddraw.h" -o -f "$DIRECTXSDK_HOME/Include/d3d9.h"; then
9014         HAVE_DIRECTXSDK_H="yes"
9015     else
9016         HAVE_DIRECTXSDK_H="no"
9017     fi
9019     if test "$BITNESS_OVERRIDE" = 64; then
9020         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x64"
9021     else
9022         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x86"
9023     fi
9024     PathFormat "$DIRECTXSDK_LIB"
9025     DIRECTXSDK_LIB="$formatted_path"
9027     if test -f "$DIRECTXSDK_LIB/ddraw.lib" -o -f "$DIRECTXSDK_LIB/d3d9.lib"; then
9028         HAVE_DIRECTXSDK_LIB="yes"
9029     else
9030         HAVE_DIRECTXSDK_LIB="no"
9031     fi
9033     if test "$HAVE_DIRECTXSDK_H" = "yes" -a "$HAVE_DIRECTXSDK_LIB" = "yes"; then
9034         AC_MSG_RESULT([found])
9035     else
9036         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway])
9037     fi
9038     if test -n "$DIRECTXSDK_HOME"; then
9039         PathFormat "$DIRECTXSDK_HOME"
9040         DIRECTXSDK_HOME="$formatted_path"
9041         SOLARINC="$SOLARINC -I$DIRECTXSDK_HOME/include"
9042     fi
9044 AC_SUBST(DIRECTXSDK_HOME)
9046 dnl ***************************************
9047 dnl Checking for bison and flex
9048 dnl ***************************************
9049 AC_PATH_PROG(BISON, bison)
9050 ANCIENT_BISON="NO"
9051 if test -z "$BISON"; then
9052     AC_MSG_ERROR([no bison found in \$PATH, install it])
9053 else
9054     AC_MSG_CHECKING([the bison version])
9055     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9056     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9057     # Accept newer than 1.875 or older(equal) than 1.75
9058     if test "$_bison_longver" -ge 1875 -o "$_bison_longver" -le 1075; then
9059         if test "$_bison_version" = "1.875"; then
9060             AC_MSG_WARN([suspect ($BISON $_bison_version)])
9061             add_warning "Suspect ($BISON $_bison_version) suggest upgrade"
9062         else
9063             AC_MSG_RESULT([checked ($BISON $_bison_version)])
9064         fi
9065     else
9066         AC_MSG_ERROR([failed ($BISON $_bison_version need 1.875+ (or 1.75 and older))])
9067     fi
9068     if test "$_bison_longver" -lt 2000; then
9069         ANCIENT_BISON="YES"
9070     fi
9072 AC_SUBST(ANCIENT_BISON)
9074 AC_PATH_PROG(FLEX, flex)
9075 if test -z "$FLEX"; then
9076     AC_MSG_ERROR([no flex found in \$PATH, install it])
9078 AC_SUBST([FLEX])
9079 dnl ***************************************
9080 dnl Checking for patch
9081 dnl ***************************************
9082 AC_PATH_PROG(PATCH, patch)
9083 if test -z "$PATCH"; then
9084     AC_MSG_ERROR([\"patch\" not found in \$PATH, install it])
9087 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9088 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9089     if test -z "$with_gnu_patch"; then
9090         GNUPATCH=$PATCH
9091     else
9092         if test -x "$with_gnu_patch"; then
9093             GNUPATCH=$with_gnu_patch
9094         else
9095             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9096         fi
9097     fi
9099     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9100     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9101         AC_MSG_RESULT([yes])
9102     else
9103         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9104     fi
9105 else
9106     GNUPATCH=$PATCH
9109 dnl We also need to check for --with-gnu-cp
9111 if test -z "$with_gnu_cp"; then
9112     # check the place where the good stuff is hidden on Solaris...
9113     if test -x /usr/gnu/bin/cp; then
9114         GNUCP=/usr/gnu/bin/cp
9115     else
9116         AC_PATH_PROGS(GNUCP, gnucp cp)
9117     fi
9118     if test -z $GNUCP; then
9119         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9120     fi
9121 else
9122     if test -x "$with_gnu_cp"; then
9123         GNUCP=$with_gnu_cp
9124     else
9125         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9126     fi
9129 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9130 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9131     AC_MSG_RESULT([yes])
9132 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9133     AC_MSG_RESULT([yes])
9134 else
9135     case "$build_os" in
9136     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9137         x_GNUCP=[\#]
9138         GNUCP=''
9139         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9140         ;;
9141     *)
9142         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9143         ;;
9144     esac
9147 AC_SUBST(GNUPATCH)
9148 AC_SUBST(GNUCP)
9149 AC_SUBST(x_GNUCP)
9151 dnl ***************************************
9152 dnl testing assembler path
9153 dnl ***************************************
9154 ML_EXE=""
9155 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
9156     if test "$BITNESS_OVERRIDE" = ""; then
9157         assembler=ml.exe
9158         assembler_bin=bin
9159     else
9160         assembler=ml64.exe
9161         assembler_bin=bin/amd64
9162     fi
9164     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9165     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9166         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9167         AC_MSG_RESULT([found])
9168         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9169     else
9170         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9171     fi
9173     PathFormat "$ASM_HOME"
9174     ASM_HOME="$formatted_path"
9175 else
9176     ASM_HOME=""
9179 AC_SUBST(ML_EXE)
9181 dnl ===================================================================
9182 dnl We need zip and unzip
9183 dnl ===================================================================
9184 AC_PATH_PROG(ZIP, zip)
9185 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9186 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9187     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],,)
9190 AC_PATH_PROG(UNZIP, unzip)
9191 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9193 dnl ===================================================================
9194 dnl Zip must be a specific type for different build types.
9195 dnl ===================================================================
9196 if test $build_os = cygwin; then
9197     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9198         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9199     fi
9202 dnl ===================================================================
9203 dnl Test which vclplugs have to be built.
9204 dnl ===================================================================
9205 R=""
9206 GTK3_CFLAGS=""
9207 GTK3_LIBS=""
9208 ENABLE_GTK3=""
9209 if test "x$enable_gtk3" = "xyes"; then
9210     if test "$with_system_cairo" != yes; then
9211         AC_MSG_WARN([System cairo required for gtk3 support, please use --with-system-cairo])
9212         add_warning "System cairo required for gtk3 support, please use --with-system-cairo"
9213     fi
9214     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="")
9215     if test "x$ENABLE_GTK3" = "xTRUE"; then
9216         R="gtk3"
9217     else
9218         AC_MSG_ERROR([gtk3 libraries of the correct versions, not found])
9219     fi
9221 AC_SUBST(GTK3_LIBS)
9222 AC_SUBST(GTK3_CFLAGS)
9223 AC_SUBST(ENABLE_GTK3)
9225 AC_MSG_CHECKING([which VCLplugs shall be built])
9226 if test "$GUIBASE" != "unx" -o "$enable_headless" = "yes"; then
9227     enable_gtk=no
9229 ENABLE_GTK=""
9230 if test "x$enable_gtk" = "xyes"; then
9231     ENABLE_GTK="TRUE"
9232     AC_DEFINE(ENABLE_GTK)
9233     R="gtk $R"
9235 AC_SUBST(ENABLE_GTK)
9237 ENABLE_TDE=""
9238 if test "x$enable_tde" = "xyes"; then
9239     # Libs kab and tdeab in connectivity and kdeab and tdeab in shell
9240     # are built from the same sources. So we only allow one of them.
9241     if test "x$enable_kde" = "xyes"; then
9242         AC_MSG_ERROR([enabling both KDE and TDE is not supported])
9243     fi
9244     ENABLE_TDE="TRUE"
9245     AC_DEFINE(ENABLE_TDE)
9246     R="$R tde"
9248 AC_SUBST(ENABLE_TDE)
9250 ENABLE_KDE=""
9251 if test "x$enable_kde" = "xyes"; then
9252     ENABLE_KDE="TRUE"
9253     AC_DEFINE(ENABLE_KDE)
9254     R="$R kde"
9256 AC_SUBST(ENABLE_KDE)
9258 ENABLE_KDE4=""
9259 if test "x$enable_kde4" = "xyes"; then
9260     ENABLE_KDE4="TRUE"
9261     AC_DEFINE(ENABLE_KDE4)
9262     R="$R kde4"
9264 AC_SUBST(ENABLE_KDE4)
9266 ENABLE_HEADLESS=""
9267 if test "x$enable_headless" = "xyes"; then
9268     ENABLE_HEADLESS="TRUE"
9269     SCPDEFS="$SCPDEFS -DLIBO_HEADLESS"
9270     R="headless"
9272 AC_SUBST(ENABLE_HEADLESS)
9274 if test -z "$R"; then
9275     AC_MSG_RESULT([none])
9276 else
9277     AC_MSG_RESULT([$R])
9280 dnl ===================================================================
9281 dnl GCONF check
9282 dnl ===================================================================
9284 ENABLE_GCONF=""
9285 AC_MSG_CHECKING([whether to enable GConf support])
9286 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "iOS" -a "$enable_gconf" = "yes"; then
9287     ENABLE_GCONF="TRUE"
9288     AC_MSG_RESULT([yes])
9289     PKG_CHECK_MODULES( GCONF, gconf-2.0 gobject-2.0 )
9290 else
9291     AC_MSG_RESULT([no])
9293 AC_SUBST(GCONF_LIBS)
9294 AC_SUBST(GCONF_CFLAGS)
9295 AC_SUBST(ENABLE_GCONF)
9297 dnl ===================================================================
9298 dnl Gnome VFS check
9299 dnl ===================================================================
9301 ENABLE_GNOMEVFS=""
9302 AC_MSG_CHECKING([whether to enable GNOME VFS support])
9303 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes" -a "$enable_gconf" = "yes"; then
9304     ENABLE_GNOMEVFS="TRUE"
9305     AC_MSG_RESULT([yes])
9306     PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
9307     AC_DEFINE(ENABLE_GNOME_VFS)
9308 else
9309     AC_MSG_RESULT([no])
9311 AC_SUBST(GNOMEVFS_LIBS)
9312 AC_SUBST(GNOMEVFS_CFLAGS)
9313 AC_SUBST(ENABLE_GNOMEVFS)
9315 dnl ===================================================================
9316 dnl check for dbus support
9317 dnl ===================================================================
9318 ENABLE_DBUS=""
9319 DBUS_CFLAGS=""
9320 DBUS_LIBS=""
9322 if test "$enable_dbus" = "no"; then
9323     test_dbus=no
9326 AC_MSG_CHECKING([whether to enable DBUS support])
9327 if test "$test_dbus" = "yes"; then
9328     ENABLE_DBUS="TRUE"
9329     AC_MSG_RESULT([yes])
9330     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
9331 else
9332     AC_MSG_RESULT([no])
9335 AC_SUBST(ENABLE_DBUS)
9336 AC_SUBST(DBUS_CFLAGS)
9337 AC_SUBST(DBUS_LIBS)
9339 AC_MSG_CHECKING([whether to enable font install via packagekit])
9340 if test "$ENABLE_DBUS" = "TRUE"; then
9341     if test -n "$enable_packagekit" -a "$enable_packagekit" != "no"; then
9342         ENABLE_PACKAGEKIT=YES
9343         AC_MSG_RESULT([yes])
9344     else
9345         ENABLE_PACKAGEKIT=NO
9346         AC_MSG_RESULT([no])
9347     fi
9348 else
9349     AC_MSG_RESULT([no, dbus disabled.])
9351 AC_SUBST(ENABLE_PACKAGEKIT)
9353 AC_MSG_CHECKING([whether to enable Impress remote control])
9354 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
9355     AC_MSG_RESULT([yes])
9356     ENABLE_SDREMOTE=YES
9357     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
9359     # If not explicitly enabled or disabled, default
9360     if test -z "$enable_sdremote_bluetooth"; then
9361         case "$OS" in
9362         LINUX|MACOSX|WNT)
9363             # Default to yes for these
9364             enable_sdremote_bluetooth=yes
9365             ;;
9366         *)
9367             # otherwise no
9368             enable_sdremote_bluetooth=no
9369             ;;
9370         esac
9371     fi
9372     # $enable_sdremote_bluetooth is guaranteed non-empty now
9374     if test "$enable_sdremote_bluetooth" != "no"; then
9375         if test "$OS" = "LINUX"; then
9376             if test "$ENABLE_DBUS" = "TRUE"; then
9377                 AC_MSG_RESULT([yes])
9378                 ENABLE_SDREMOTE_BLUETOOTH=YES
9379                 dnl ===================================================================
9380                 dnl Check for system bluez
9381                 dnl ===================================================================
9382                 AC_MSG_CHECKING([which Bluetooth header to use])
9383                 if test "$with_system_bluez" = "yes"; then
9384                     AC_MSG_RESULT([external])
9385                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
9386                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
9387                 else
9388                     AC_MSG_RESULT([internal])
9389                     BUILD_TYPE="$BUILD_TYPE BLUEZ"
9390                 fi
9391             else
9392                 AC_MSG_RESULT([no, dbus disabled])
9393                 ENABLE_SDREMOTE_BLUETOOTH=NO
9394             fi
9395         else
9396             AC_MSG_RESULT([yes])
9397             ENABLE_SDREMOTE_BLUETOOTH=YES
9398         fi
9399     else
9400         AC_MSG_RESULT([no])
9401         ENABLE_SDREMOTE_BLUETOOTH=NO
9402     fi
9403 else
9404     ENABLE_SDREMOTE=NO
9405     AC_MSG_RESULT([no])
9407 AC_SUBST(ENABLE_SDREMOTE)
9408 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
9410 dnl ===================================================================
9411 dnl Check whether the gtk 2.0 libraries are available.
9412 dnl ===================================================================
9414 GTK_CFLAGS=""
9415 GTK_LIBS=""
9416 ENABLE_SYSTRAY_GTK=""
9417 if test  "$test_gtk" = "yes"; then
9419     if test "$ENABLE_GTK" = "TRUE"; then
9420         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]))
9421         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]))
9422         BUILD_TYPE="$BUILD_TYPE GTK"
9424     AC_MSG_CHECKING([whether to enable the systray quickstarter])
9425         if test "x$enable_systray" = "xyes"; then
9426         AC_MSG_RESULT([yes])
9427             PKG_CHECK_MODULES( GTK210, gtk+-2.0 >= 2.10.0,
9428                             [ ENABLE_SYSTRAY_GTK="TRUE" ],
9429                             [ ENABLE_SYSTRAY_GTK="" ])
9430         else
9431         AC_MSG_RESULT([no])
9432         fi
9434         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
9435         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
9436                           [ENABLE_GTK_PRINT="TRUE"],
9437                           [ENABLE_GTK_PRINT=""])
9439         AC_MSG_CHECKING([whether to enable GIO support])
9440         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
9441             if test "$ENABLE_GNOMEVFS" = "TRUE"; then
9442                 AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
9443             fi
9444             dnl Need at least 2.26 for the dbus support.
9445             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
9446                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
9447             if test "$ENABLE_GIO" = "TRUE"; then
9448                 AC_DEFINE(ENABLE_GIO)
9449             fi
9450         else
9451             AC_MSG_RESULT([no])
9452         fi
9453     fi
9455 AC_SUBST(ENABLE_GIO)
9456 AC_SUBST(GIO_CFLAGS)
9457 AC_SUBST(GIO_LIBS)
9458 AC_SUBST(ENABLE_SYSTRAY_GTK)
9459 AC_SUBST(GTK_CFLAGS)
9460 AC_SUBST(GTK_LIBS)
9461 AC_SUBST(GTHREAD_CFLAGS)
9462 AC_SUBST(GTHREAD_LIBS)
9463 AC_SUBST([ENABLE_GTK_PRINT])
9464 AC_SUBST([GTK_PRINT_CFLAGS])
9465 AC_SUBST([GTK_PRINT_LIBS])
9468 dnl ===================================================================
9469 dnl Check whether the Telepathy libraries are available.
9470 dnl ===================================================================
9472 ENABLE_TELEPATHY=""
9473 TELEPATHY_CFLAGS=""
9474 TELEPATHY_LIBS=""
9476 AC_MSG_CHECKING([whether to enable Telepathy support])
9477 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_telepathy" = "yes"; then
9478     ENABLE_TELEPATHY="TRUE"
9479     AC_DEFINE(ENABLE_TELEPATHY)
9480     AC_MSG_RESULT([yes])
9481     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 )
9482 else
9483     AC_MSG_RESULT([no])
9486 AC_SUBST(ENABLE_TELEPATHY)
9487 AC_SUBST(TELEPATHY_CFLAGS)
9488 AC_SUBST(TELEPATHY_LIBS)
9491 dnl ===================================================================
9493 SPLIT_APP_MODULES=""
9494 if test "$enable_split_app_modules" = "yes"; then
9495     SPLIT_APP_MODULES="YES"
9497 AC_SUBST(SPLIT_APP_MODULES)
9499 SPLIT_OPT_FEATURES=""
9500 if test "$enable_split_opt_features" = "yes"; then
9501     SPLIT_OPT_FEATURES="YES"
9503 AC_SUBST(SPLIT_OPT_FEATURES)
9505 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
9506     if test "$enable_cairo_canvas" = yes; then
9507         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
9508     fi
9509     enable_cairo_canvas=no
9510 elif test -z "$enable_cairo_canvas"; then
9511     enable_cairo_canvas=yes
9514 ENABLE_CAIRO_CANVAS=""
9515 if test "$enable_cairo_canvas" = "yes"; then
9516     test_cairo=yes
9517     ENABLE_CAIRO_CANVAS="TRUE"
9519 AC_SUBST(ENABLE_CAIRO_CANVAS)
9521 dnl ===================================================================
9522 dnl Check whether the GStreamer libraries are available.
9523 dnl ===================================================================
9525 ENABLE_GSTREAMER=""
9527 if test "$build_gstreamer" = "yes"; then
9529     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
9530     if test "x$enable_gstreamer" != "xno"; then
9531         ENABLE_GSTREAMER="TRUE"
9532         AC_MSG_RESULT([yes])
9533         PKG_CHECK_MODULES( GSTREAMER, gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-video-1.0 )
9534     else
9535         AC_MSG_RESULT([no])
9536     fi
9538 AC_SUBST(GSTREAMER_CFLAGS)
9539 AC_SUBST(GSTREAMER_LIBS)
9540 AC_SUBST(ENABLE_GSTREAMER)
9543 ENABLE_GSTREAMER_0_10=""
9544 if test "$build_gstreamer_0_10" = "yes"; then
9546     AC_MSG_CHECKING([whether to enable the GStreamer avmedia backend])
9547     if test "x$enable_gstreamer_0_10" != "xno"; then
9548         ENABLE_GSTREAMER_0_10="TRUE"
9549         AC_MSG_RESULT([yes])
9550         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-interfaces-0.10],, [
9551             PKG_CHECK_MODULES(  [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10] )
9552         ])
9553     else
9554         AC_MSG_RESULT([no])
9555     fi
9558 AC_SUBST(GSTREAMER_0_10_CFLAGS)
9559 AC_SUBST(GSTREAMER_0_10_LIBS)
9560 AC_SUBST(ENABLE_GSTREAMER_0_10)
9562 dnl ===================================================================
9563 dnl Check whether the OpenGL libraries are available
9564 dnl ===================================================================
9566 AC_MSG_CHECKING([whether to build the OpenGL Transitions component])
9567 ENABLE_OPENGL=
9569 if test -z "$enable_opengl"; then
9570     if test $_os = WINNT; then
9571         # By default disable the OpenGL transitions for Windows (the code compiles but works very
9572         # badly and crashes). In other words, use --enable-opengl only if you plan to hack on that
9573         # code for Windows.
9574         enable_opengl=no
9575     elif test $_os = iOS; then
9576         # As such with some suitable minor tweaks the Mac OpenGL transitions code would presumably
9577         # build fine for iOS, too, but let's leave that for later
9578         enable_opengl=no
9579     elif test "$enable_headless" = "yes"; then
9580         enable_opengl=no
9581     else
9582         enable_opengl=yes
9583     fi
9586 if test "x$enable_opengl" = "xno"; then
9587     AC_MSG_RESULT([no])
9588 elif test "$_os" = "Darwin"; then
9589     # We use frameworks on Mac OS X, no need for detail checks
9590     ENABLE_OPENGL=TRUE
9591     SYSTEM_MESA_HEADERS=YES
9592     AC_MSG_RESULT([yes])
9593 elif test $_os = WINNT; then
9594     # Experimental: try to use OpenGL on Windows
9595     ENABLE_OPENGL=TRUE
9596     # We need the internal "Mesa" headers.
9597     SYSTEM_MESA_HEADERS=NO
9598     BUILD_TYPE="$BUILD_TYPE MESA"
9599     AC_MSG_RESULT([yes])
9600 else
9601     save_LDFLAGS=$LDFLAGS
9602     LDFLAGS="$LDFLAGS -lm"
9603     AC_MSG_RESULT([yes])
9604     AC_CHECK_LIB([GL], [main], [:],
9605               [AC_MSG_ERROR(libGL not installed or functional)], [])
9606     LDFLAGS="$LDFLAGS -lGL"
9607     AC_CHECK_LIB([GLU], [main], [:],
9608               [AC_MSG_ERROR(libGLU not installed or functional)], [])
9609     ENABLE_OPENGL=TRUE
9610     LDFLAGS=$save_LDFLAGS
9612     dnl ===================================================================
9613     dnl Check for system Mesa
9614     dnl ===================================================================
9615     AC_MSG_CHECKING([which Mesa headers to use])
9616     if test "$with_system_mesa_headers" = "yes"; then
9617         AC_MSG_RESULT([external])
9618         SYSTEM_MESA_HEADERS=YES
9619         AC_LANG_PUSH(C)
9620         AC_CHECK_HEADER(GL/glxext.h, [],
9621            [ AC_MSG_ERROR(mesa headers not found.)], [#include <GL/glx.h>])
9622         AC_MSG_CHECKING([whether GL/glxext.h defines PFNGLXBINDTEXIMAGEEXTPROC])
9623         AC_EGREP_HEADER(PFNGLXBINDTEXIMAGEEXTPROC, GL/glxext.h, [AC_MSG_RESULT([yes])], AC_MSG_ERROR(no))
9624         AC_LANG_POP(C)
9625     else
9626         AC_MSG_RESULT([internal])
9627         SYSTEM_MESA_HEADERS=NO
9628         BUILD_TYPE="$BUILD_TYPE MESA"
9629     fi
9632 AC_SUBST(SYSTEM_MESA_HEADERS)
9633 AC_SUBST(ENABLE_OPENGL)
9635 # presenter minimizer extension?
9636 AC_MSG_CHECKING([whether to build the Presentation Minimizer extension])
9637 if test "x$enable_ext_presenter_minimizer" != "xno" -a "x$enable_extension_integration" != "xno"; then
9638    AC_MSG_RESULT([yes])
9639    ENABLE_MINIMIZER=YES
9640 else
9641    AC_MSG_RESULT([no])
9642    ENABLE_MINIMIZER=NO
9643    SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MINIMIZER"
9645 AC_SUBST(ENABLE_MINIMIZER)
9647 # pdf import?
9648 AC_MSG_CHECKING([whether to build the PDF import])
9649 if test "$_os" != Android -a "$_os" != iOS -a "$ENABLE_PDFIMPORT" != FALSE; then
9650   AC_MSG_RESULT([yes])
9651   ENABLE_PDFIMPORT=TRUE
9653   dnl ===================================================================
9654   dnl Check for system poppler
9655   dnl ===================================================================
9656   AC_MSG_CHECKING([which pdf backend to use])
9657   if test "$with_system_poppler" = "yes"; then
9658       AC_MSG_RESULT([external])
9659       SYSTEM_POPPLER=YES
9660       PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
9661       AC_LANG_PUSH([C++])
9662       save_CXXFLAGS=$CXXFLAGS
9663       save_CPPFLAGS=$CPPFLAGS
9664       CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
9665       CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
9666       AC_CHECK_HEADER([cpp/poppler-version.h], [],
9667                    [AC_MSG_ERROR([cpp/poppler-version.h not found. Install poppler])], [])
9668       CXXFLAGS=$save_CXXFLAGS
9669       CPPFLAGS=$save_CPPFLAGS
9670       AC_LANG_POP([C++])
9671       libo_MINGW_CHECK_DLL([libpoppler])
9672   else
9673       AC_MSG_RESULT([internal])
9674       SYSTEM_POPPLER=NO
9675       BUILD_TYPE="$BUILD_TYPE XPDF"
9676   fi
9677 else
9678   AC_MSG_RESULT([no])
9679   ENABLE_PDFIMPORT=FALSE
9681 AC_SUBST(ENABLE_PDFIMPORT)
9682 AC_SUBST(SYSTEM_POPPLER)
9683 AC_SUBST(POPPLER_CFLAGS)
9684 AC_SUBST(POPPLER_LIBS)
9686 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
9687 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
9688   AC_MSG_RESULT([yes])
9689   ENABLE_MEDIAWIKI=YES
9690   BUILD_TYPE="$BUILD_TYPE XSLTML"
9691   if test  "x$with_java" = "xno"; then
9692     AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
9693   fi
9694 else
9695   AC_MSG_RESULT([no])
9696   ENABLE_MEDIAWIKI=NO
9697   SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
9699 AC_SUBST(ENABLE_MEDIAWIKI)
9701 if test "$ENABLE_MEDIAWIKI" = "YES"; then
9702     AC_MSG_CHECKING([which Servlet API Jar to use])
9703     if test "$with_system_servlet_api" = "yes"; then
9704         AC_MSG_RESULT([external])
9705         SYSTEM_SERVLETAPI=YES
9706         if test -z "$SERVLETAPI_JAR"; then
9707             for version in '' -3.3 -3.2 -3.1 -3.0 -2.5 -2.4; do
9708                 if test -r "/usr/share/java/servlet-api${version}.jar"; then
9709                     SERVLETAPI_JAR=/usr/share/java/servlet-api${version}.jar
9710                 fi
9711             done
9712         fi
9713         AC_CHECK_FILE($SERVLETAPI_JAR, [],
9714               [AC_MSG_ERROR(servlet-api.jar not found.)], [])
9715     else
9716         AC_MSG_RESULT([internal])
9717         SYSTEM_SERVLETAPI=NO
9718         BUILD_TYPE="$BUILD_TYPE TOMCAT"
9719     fi
9721 AC_SUBST(SYSTEM_SERVLETAPI)
9722 AC_SUBST(SERVLETAPI_JAR)
9724 AC_MSG_CHECKING([whether to build the Report Builder extension])
9725 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
9726     AC_MSG_RESULT([yes])
9727     ENABLE_REPORTBUILDER=TRUE
9728     AC_MSG_CHECKING([which jfreereport libs to use])
9729     if test "$with_system_jfreereport" = "yes"; then
9730         SYSTEM_JFREEREPORT=YES
9731         AC_MSG_RESULT([external])
9732         if test -z $SAC_JAR; then
9733             SAC_JAR=/usr/share/java/sac.jar
9734         fi
9735         AC_CHECK_FILE($SAC_JAR, [],
9736              [AC_MSG_ERROR(sac.jar not found.)], [])
9738         if test -z $LIBXML_JAR; then
9739             AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
9740                 [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
9741                 [
9742                     AC_CHECK_FILE(/usr/share/java/libxml.jar,
9743                        [ LIBXML_JAR=/usr/share/java/libxml.jar ],
9744                        [AC_MSG_ERROR(libxml.jar replacement not found.)]
9745                     )
9746                 ]
9747             )
9748         else
9749             AC_CHECK_FILE($LIBXML_JAR, [],
9750                  [AC_MSG_ERROR(libxml.jar not found.)], [])
9751         fi
9753         if test -z $FLUTE_JAR; then
9754             AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
9755                 [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
9756                 [
9757                     AC_CHECK_FILE(/usr/share/java/flute.jar,
9758                         [ FLUTE_JAR=/usr/share/java/flute.jar ],
9759                         [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
9760                     )
9761                 ]
9762             )
9763         else
9764             AC_CHECK_FILE($FLUTE_JAR, [],
9765                  [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
9766         fi
9768         if test -z $JFREEREPORT_JAR; then
9769             AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
9770                 [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
9771                 [
9772                     AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
9773                         [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
9774                         [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
9775                     )
9776                 ]
9777             )
9778         else
9779             AC_CHECK_FILE($JFREEREPORT_JAR, [],
9780                  [AC_MSG_ERROR(jfreereport.jar not found.)], [])
9781         fi
9783         if test -z $LIBLAYOUT_JAR; then
9784             AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
9785                 [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
9786                 [
9787                     AC_CHECK_FILE(/usr/share/java/liblayout.jar,
9788                         [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
9789                         [AC_MSG_ERROR(liblayout.jar replacement not found.)]
9790                     )
9791                 ]
9792             )
9793         else
9794             AC_CHECK_FILE($LIBLAYOUT_JAR, [],
9795                  [AC_MSG_ERROR(liblayout.jar not found.)], [])
9796         fi
9798         if test -z $LIBLOADER_JAR; then
9799             AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
9800                 [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
9801                 [
9802                     AC_CHECK_FILE(/usr/share/java/libloader.jar,
9803                        [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
9804                        [AC_MSG_ERROR(libloader.jar replacement not found.)]
9805                     )
9806                 ]
9807             )
9808         else
9809             AC_CHECK_FILE($LIBLOADER_JAR, [],
9810                 [AC_MSG_ERROR(libloader.jar not found.)], [])
9811         fi
9813         if test -z $LIBFORMULA_JAR; then
9814             AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
9815                  [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
9816                  [
9817                      AC_CHECK_FILE(/usr/share/java/libformula.jar,
9818                          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
9819                          [AC_MSG_ERROR(libformula.jar replacement not found.)]
9820                      )
9821                  ]
9822             )
9823         else
9824             AC_CHECK_FILE($LIBFORMULA_JAR, [],
9825                 [AC_MSG_ERROR(libformula.jar not found.)], [])
9826         fi
9828         if test -z $LIBREPOSITORY_JAR; then
9829             AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
9830                 [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
9831                 [
9832                     AC_CHECK_FILE(/usr/share/java/librepository.jar,
9833                         [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
9834                         [AC_MSG_ERROR(librepository.jar replacement not found.)]
9835                     )
9836                 ]
9837             )
9838         else
9839             AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
9840                 [AC_MSG_ERROR(librepository.jar not found.)], [])
9841         fi
9843         if test -z $LIBFONTS_JAR; then
9844             AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
9845                 [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
9846                 [
9847                     AC_CHECK_FILE(/usr/share/java/libfonts.jar,
9848                         [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
9849                         [AC_MSG_ERROR(libfonts.jar replacement not found.)]
9850                     )
9851                 ]
9852             )
9853         else
9854             AC_CHECK_FILE($LIBFONTS_JAR, [],
9855                 [AC_MSG_ERROR(libfonts.jar not found.)], [])
9856         fi
9858         if test -z $LIBSERIALIZER_JAR; then
9859             AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
9860                 [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
9861                 [
9862                     AC_CHECK_FILE(/usr/share/java/libserializer.jar,
9863                         [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
9864                         [AC_MSG_ERROR(libserializer.jar replacement not found.)]
9865                     )
9866                 ]
9867             )
9868         else
9869             AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
9870                 [AC_MSG_ERROR(libserializer.jar not found.)], [])
9871         fi
9873         if test -z $LIBBASE_JAR; then
9874             AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
9875                 [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
9876                 [
9877                     AC_CHECK_FILE(/usr/share/java/libbase.jar,
9878                         [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
9879                         [AC_MSG_ERROR(libbase.jar replacement not found.)]
9880                     )
9881                 ]
9882             )
9883         else
9884             AC_CHECK_FILE($LIBBASE_JAR, [],
9885                 [AC_MSG_ERROR(libbase.jar not found.)], [])
9886         fi
9888     else
9889         AC_MSG_RESULT([internal])
9890         SYSTEM_JFREEREPORT=NO
9891         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
9892     fi
9893 else
9894     AC_MSG_RESULT([no])
9895     ENABLE_REPORTBUILDER=FALSE
9896     SYSTEM_JFREEREPORT=NO
9898 AC_SUBST(ENABLE_REPORTBUILDER)
9899 AC_SUBST(SYSTEM_JFREEREPORT)
9900 AC_SUBST(SAC_JAR)
9901 AC_SUBST(LIBXML_JAR)
9902 AC_SUBST(FLUTE_JAR)
9903 AC_SUBST(JFREEREPORT_JAR)
9904 AC_SUBST(LIBBASE_JAR)
9905 AC_SUBST(LIBLAYOUT_JAR)
9906 AC_SUBST(LIBLOADER_JAR)
9907 AC_SUBST(LIBFORMULA_JAR)
9908 AC_SUBST(LIBREPOSITORY_JAR)
9909 AC_SUBST(LIBFONTS_JAR)
9910 AC_SUBST(LIBSERIALIZER_JAR)
9912 # this has to be here because both the Wiki Publisher and the SRB use
9913 # commons-logging
9914 if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "TRUE"; then
9915     AC_MSG_CHECKING([which Apache commons-* libs to use])
9916     if test "$with_system_apache_commons" = "yes"; then
9917         SYSTEM_APACHE_COMMONS=YES
9918         AC_MSG_RESULT([external])
9919         if test "$ENABLE_MEDIAWIKI" = "YES"; then
9920             if test -z $COMMONS_CODEC_JAR; then
9921                 AC_CHECK_FILE(/usr/share/java/commons-codec-1.6.jar,
9922                     [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec-1.6.jar ],
9923                     [
9924                         AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
9925                             [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
9926                             [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
9927                         )
9928                     ]
9929                 )
9930             else
9931                 AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
9932                     [AC_MSG_ERROR(commons-codec.jar not found.)], [])
9933             fi
9935             if test -z $COMMONS_LANG_JAR; then
9936                 AC_CHECK_FILE(/usr/share/java/commons-lang-2.4.jar,
9937                     [ COMMONS_LANG_JAR=/usr/share/java/commons-lang-2.4.jar ],
9938                     [
9939                         AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
9940                             [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
9941                             [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
9942                             )
9943                     ]
9944                 )
9945             else
9946                 AC_CHECK_FILE($COMMONS_LANG_JAR, [],
9947                     [AC_MSG_ERROR(commons-lang.jar not found.)], [])
9948             fi
9950             if test -z $COMMONS_HTTPCLIENT_JAR; then
9951                 AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
9952                     [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
9953                     [
9954                         AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
9955                             [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
9956                             [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
9957                         )
9958                     ]
9959                 )
9960             else
9961                 AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
9962                     [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
9963             fi
9964         fi
9965         if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "TRUE"; then
9966             if test -z $COMMONS_LOGGING_JAR; then
9967                 AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.1.jar,
9968                    [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.1.jar ],
9969                    [
9970                         AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
9971                             [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
9972                             [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
9973                         )
9974                     ]
9975                 )
9976             else
9977                 AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
9978                     [AC_MSG_ERROR(commons-logging.jar not found.)], [])
9979             fi
9980         fi
9981     else
9982         AC_MSG_RESULT([internal])
9983         SYSTEM_APACHE_COMMONS=NO
9984         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
9985     fi
9987 AC_SUBST(SYSTEM_APACHE_COMMONS)
9988 AC_SUBST(COMMONS_CODEC_JAR)
9989 AC_SUBST(COMMONS_LANG_JAR)
9990 AC_SUBST(COMMONS_HTTPCLIENT_JAR)
9991 AC_SUBST(COMMONS_LOGGING_JAR)
9993 # scripting provider for BeanShell?
9994 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
9995 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
9996    AC_MSG_RESULT([yes])
9997    ENABLE_SCRIPTING_BEANSHELL=YES
9999    dnl ===================================================================
10000    dnl Check for system beanshell
10001    dnl ===================================================================
10002    AC_MSG_CHECKING([which beanshell to use])
10003    if test "$with_system_beanshell" = "yes"; then
10004        AC_MSG_RESULT([external])
10005        SYSTEM_BSH=YES
10006        if test -z $BSH_JAR; then
10007            BSH_JAR=/usr/share/java/bsh.jar
10008        fi
10009        AC_CHECK_FILE($BSH_JAR, [],
10010                   [AC_MSG_ERROR(bsh.jar not found.)], [])
10011    else
10012        AC_MSG_RESULT([internal])
10013        SYSTEM_BSH=NO
10014        BUILD_TYPE="$BUILD_TYPE BSH"
10015    fi
10016 else
10017    AC_MSG_RESULT([no])
10018    ENABLE_SCRIPTING_BEANSHELL=NO
10019    SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10021 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10022 AC_SUBST(SYSTEM_BSH)
10023 AC_SUBST(BSH_JAR)
10025 # scripting provider for JavaScript?
10026 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10027 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10028    AC_MSG_RESULT([yes])
10029    ENABLE_SCRIPTING_JAVASCRIPT=YES
10031    dnl ===================================================================
10032    dnl Check for system rhino
10033    dnl ===================================================================
10034    AC_MSG_CHECKING([which rhino to use])
10035    if test "$with_system_rhino" = "yes"; then
10036        AC_MSG_RESULT([external])
10037        SYSTEM_RHINO=YES
10038        if test -z $RHINO_JAR; then
10039            RHINO_JAR=/usr/share/java/js.jar
10040        fi
10041        AC_CHECK_FILE($RHINO_JAR, [],
10042                   [AC_MSG_ERROR(js.jar not found.)], [])
10043    else
10044        AC_MSG_RESULT([internal])
10045        SYSTEM_RHINO=NO
10046        BUILD_TYPE="$BUILD_TYPE RHINO"
10047    fi
10048 else
10049    AC_MSG_RESULT([no])
10050    ENABLE_SCRIPTING_JAVASCRIPT=NO
10051    SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10053 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10054 AC_SUBST(SYSTEM_RHINO)
10055 AC_SUBST(RHINO_JAR)
10057 supports_multilib=
10058 case "$host_cpu" in
10059 x86_64 | powerpc64 | s390x)
10060     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10061         supports_multilib="yes"
10062     fi
10063     ;;
10065     ;;
10066 esac
10068 dnl ===================================================================
10069 dnl Check whether the TQt and TDE libraries are available.
10070 dnl ===================================================================
10072 TDE_CFLAGS=""
10073 TDE_LIBS=""
10074 if test "$_os" != "OpenBSD"; then
10075     MOC="moc"
10077 if test "$test_tde" = "yes" -a "$ENABLE_TDE" = "TRUE"; then
10078     dnl Search paths for TQt and TDE
10079     if test -z "$supports_multilib"; then
10080         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"
10081         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"
10082     else
10083         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"
10084         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"
10085     fi
10086     if test -n "$TQTDIR"; then
10087         tqt_incdirs="$TQTDIR/include $tqt_incdirs"
10088         if test -z "$supports_multilib"; then
10089             tqt_libdirs="$TQTDIR/lib $tqt_libdirs"
10090         else
10091             tqt_libdirs="$TQTDIR/lib64 $TQTDIR/lib $tqt_libdirs"
10092         fi
10093     fi
10094     if test -z "$supports_multilib"; then
10095         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"
10096         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"
10097     else
10098         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"
10099         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"
10100     fi
10101     if test -n "$TDEDIR"; then
10102         tde_incdirs="$TDEDIR/include $tde_incdirs"
10103         if test -z "$supports_multilib"; then
10104             tde_libdirs="$TDEDIR/lib $tde_libdirs"
10105         else
10106             tde_libdirs="$TDEDIR/lib64 $TDEDIR/lib $tde_libdirs"
10107         fi
10108     fi
10110     dnl What to test
10111     tqt_test_include="ntqstyle.h"
10112     tde_test_include="kapp.h"
10114     if test "$_os" != "OpenBSD"; then
10115         tqt_test_library="libtqt-mt.so"
10116         tde_test_library="libDCOP.so"
10117     else
10118         tqt_test_library="libtqt-mt.so*"
10119         tde_test_library="libDCOP.so*"
10120     fi
10122     dnl Check for TQt headers
10123     AC_MSG_CHECKING([for TQt headers])
10124     tqt_incdir="no"
10125     for tde_check in $tqt_incdirs; do
10126         if test -r "$tde_check/$tqt_test_include"; then
10127             tqt_incdir="$tde_check"
10128             break
10129         fi
10130     done
10131     AC_MSG_RESULT([$tqt_incdir])
10132     if test "x$tqt_incdir" = "xno"; then
10133         AC_MSG_ERROR([TQt headers not found.  Please specify the root of
10134 your TQt installation by exporting TQTDIR before running "configure".])
10135     fi
10137     dnl Check for TQt libraries
10138     AC_MSG_CHECKING([for TQt libraries])
10139     tqt_libdir="no"
10140     for tqt_check in $tqt_libdirs; do
10141         if test -r "`ls $tqt_check/$tqt_test_library 2>/dev/null | head -1`"; then
10142             tqt_libdir="$tqt_check"
10143             break
10144         fi
10145     done
10146     AC_MSG_RESULT([$tqt_libdir])
10147     if test "x$tqt_libdir" = "xno"; then
10148         AC_MSG_ERROR([TQt libraries not found.  Please specify the root of
10149 your TQt installation by exporting TQTDIR before running "configure".])
10150     fi
10152     dnl Check for Meta Object Compiler
10153     AC_PATH_PROG( MOC, moc, no, [`dirname $tqt_libdir`/bin:$TQTDIR/bin:$PATH] )
10154     if test "$MOC" = "no"; then
10155         AC_MSG_ERROR([TQt Meta Object Compiler not found.  Please specify
10156 the root of your TQt installation by exporting TQTDIR before running "configure".])
10157     fi
10159     dnl Check for TDE headers
10160     AC_MSG_CHECKING([for TDE headers])
10161     tde_incdir="no"
10162     for tde_check in $tde_incdirs; do
10163         if test -r "$tde_check/$tde_test_include"; then
10164             tde_incdir="$tde_check"
10165             break
10166         fi
10167     done
10168     AC_MSG_RESULT([$tde_incdir])
10169     if test "x$tde_incdir" = "xno"; then
10170         AC_MSG_ERROR([TDE headers not found.  Please specify the root of
10171 your TDE installation by exporting TDEDIR before running "configure".])
10172     fi
10174     dnl Check for TDE libraries
10175     AC_MSG_CHECKING([for TDE libraries])
10176     tde_libdir="no"
10177     for tde_check in $tde_libdirs; do
10178         if test -r "`ls $tde_check/$tde_test_library 2>/dev/null | head -1`"; then
10179             tde_libdir="$tde_check"
10180             break
10181         fi
10182     done
10183     AC_MSG_RESULT([$tde_libdir])
10184     if test "x$tde_libdir" = "xno"; then
10185         AC_MSG_ERROR([TDE libraries not found.  Please specify the root of
10186 your TDE installation by exporting TDEDIR before running "configure".])
10187     fi
10189     dnl Set the variables
10190     TDE_CFLAGS="-I$tqt_incdir -I$tde_incdir -I/usr/include/tqt -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10191     TDE_LIBS="-L$tde_libdir -L$tqt_libdir -ltdeio -ltdeui -ltdecore -ltqt -ltqt-mt"
10193 AC_SUBST(TDE_CFLAGS)
10194 AC_SUBST(TDE_LIBS)
10195 AC_SUBST(MOC)
10197 dnl ===================================================================
10198 dnl Check whether the Qt3 and KDE3 libraries are available.
10199 dnl ===================================================================
10201 KDE_CFLAGS=""
10202 KDE_LIBS=""
10203 if test "$_os" != "OpenBSD"; then
10204     MOC="moc"
10206 if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE"; then
10207     dnl Search paths for Qt3 and KDE3
10208     if test -z "$supports_multilib"; then
10209         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"
10210         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"
10211     else
10212         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"
10213         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"
10214     fi
10215     if test -n "$QTDIR"; then
10216         qt_incdirs="$QTDIR/include $qt_incdirs"
10217         if test -z "$supports_multilib"; then
10218             qt_libdirs="$QTDIR/lib $qt_libdirs"
10219         else
10220             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
10221         fi
10222     fi
10223     if test -z "$supports_multilib"; then
10224         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"
10225         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"
10226     else
10227         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"
10228         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"
10229     fi
10230     if test -n "$KDEDIR"; then
10231         kde_incdirs="$KDEDIR/include $kde_incdirs"
10232         if test -z "$supports_multilib"; then
10233             kde_libdirs="$KDEDIR/lib $kde_libdirs"
10234         else
10235             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
10236         fi
10237     fi
10239     dnl What to test
10240     qt_test_include="qstyle.h"
10241     kde_test_include="kapp.h"
10243     if test "$_os" != "OpenBSD"; then
10244         qt_test_library="libqt-mt.so"
10245         kde_test_library="libDCOP.so"
10246     else
10247         qt_test_library="libqt-mt.so*"
10248         kde_test_library="libDCOP.so*"
10249     fi
10251     dnl Check for Qt3 headers
10252     AC_MSG_CHECKING([for Qt3 headers])
10253     qt_incdir="no"
10254     for kde_check in $qt_incdirs; do
10255         if test -r "$kde_check/$qt_test_include"; then
10256             qt_incdir="$kde_check"
10257             break
10258         fi
10259     done
10260     AC_MSG_RESULT([$qt_incdir])
10261     if test "x$qt_incdir" = "xno"; then
10262         AC_MSG_ERROR([Qt3 headers not found.  Please specify the root of
10263 your Qt3 installation by exporting QTDIR before running "configure".])
10264     fi
10266     dnl Check for Qt3 libraries
10267     AC_MSG_CHECKING([for Qt3 libraries])
10268     qt_libdir="no"
10269     for qt_check in $qt_libdirs; do
10270         if test -r "`ls $qt_check/$qt_test_library 2>/dev/null | head -1`"; then
10271             qt_libdir="$qt_check"
10272             break
10273         fi
10274     done
10275     AC_MSG_RESULT([$qt_libdir])
10276     if test "x$qt_libdir" = "xno"; then
10277         AC_MSG_ERROR([Qt3 libraries not found.  Please specify the root of
10278 your Qt3 installation by exporting QTDIR before running "configure".])
10279     fi
10281     dnl Check for Meta Object Compiler
10282     AC_PATH_PROG( MOC, moc, no, [`dirname $qt_libdir`/bin:$QTDIR/bin:$PATH] )
10283     if test "$MOC" = "no"; then
10284         AC_MSG_ERROR([Qt3 Meta Object Compiler not found.  Please specify
10285 the root of your Qt3 installation by exporting QTDIR before running "configure".])
10286     fi
10288     dnl Check for KDE3 headers
10289     AC_MSG_CHECKING([for KDE3 headers])
10290     kde_incdir="no"
10291     for kde_check in $kde_incdirs; do
10292         if test -r "$kde_check/$kde_test_include"; then
10293             kde_incdir="$kde_check"
10294             break
10295         fi
10296     done
10297     AC_MSG_RESULT([$kde_incdir])
10298     if test "x$kde_incdir" = "xno"; then
10299         AC_MSG_ERROR([KDE3 headers not found.  Please specify the root of
10300 your KDE3 installation by exporting KDEDIR before running "configure".])
10301     fi
10303     dnl Check for KDE3 libraries
10304     AC_MSG_CHECKING([for KDE3 libraries])
10305     kde_libdir="no"
10306     for kde_check in $kde_libdirs; do
10307         if test -r "`ls $kde_check/$kde_test_library 2>/dev/null | head -1`"; then
10308             kde_libdir="$kde_check"
10309             break
10310         fi
10311     done
10312     AC_MSG_RESULT([$kde_libdir])
10313     if test "x$kde_libdir" = "xno"; then
10314         AC_MSG_ERROR([KDE3 libraries not found.  Please specify the root of
10315 your KDE3 installation by exporting KDEDIR before running "configure".])
10316     fi
10318     dnl Set the variables
10319     KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10320     KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
10322 AC_SUBST(KDE_CFLAGS)
10323 AC_SUBST(KDE_LIBS)
10324 AC_SUBST(MOC)
10326 dnl ===================================================================
10327 dnl KDE4 Integration
10328 dnl ===================================================================
10330 KDE4_CFLAGS=""
10331 KDE4_LIBS=""
10332 QMAKE4="qmake"
10333 MOC4="moc"
10334 KDE_GLIB_CFLAGS=""
10335 KDE_GLIB_LIBS=""
10336 KDE_HAVE_GLIB=""
10337 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
10338     qt_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
10339     qt_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
10341     kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
10342     kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
10344     if test -n "$supports_multilib"; then
10345         qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
10346         kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
10347     fi
10349     if test -n "$QTDIR"; then
10350         qt_incdirs="$QTDIR/include $qt_incdirs"
10351         if test -z "$supports_multilib"; then
10352             qt_libdirs="$QTDIR/lib $qt_libdirs"
10353         else
10354             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
10355         fi
10356     fi
10357     if test -n "$QT4DIR"; then
10358         qt_incdirs="$QT4DIR/include $qt_incdirs"
10359         if test -z "$supports_multilib"; then
10360             qt_libdirs="$QT4DIR/lib $qt_libdirs"
10361         else
10362             qt_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt_libdirs"
10363         fi
10364     fi
10366     if test -n "$KDEDIR"; then
10367         kde_incdirs="$KDEDIR/include $kde_incdirs"
10368         if test -z "$supports_multilib"; then
10369             kde_libdirs="$KDEDIR/lib $kde_libdirs"
10370         else
10371             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
10372         fi
10373     fi
10374     if test -n "$KDE4DIR"; then
10375         kde_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde_incdirs"
10376         if test -z "$supports_multilib"; then
10377             kde_libdirs="$KDE4DIR/lib $kde_libdirs"
10378         else
10379             kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
10380         fi
10381     fi
10383     qt_test_include="Qt/qobject.h"
10384     qt_test_library="libQtCore.so"
10385     kde_test_include="kwindowsystem.h"
10386     kde_test_library="libsolid.so"
10388     AC_MSG_CHECKING([for Qt4 headers])
10389     qt_header_dir="no"
10390     for inc_dir in $qt_incdirs; do
10391         if test -r "$inc_dir/$qt_test_include"; then
10392             qt_header_dir="$inc_dir"
10393             break
10394         fi
10395     done
10397     AC_MSG_RESULT([$qt_header_dir])
10398     if test "x$qt_header_dir" = "xno"; then
10399         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10400     fi
10402     dnl Check for qmake
10403     AC_PATH_PROG( QMAKEQT4, qmake-qt4, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
10404     QMAKE4="$QMAKEQT4"
10405     if test "$QMAKE4" = "no"; then
10406         AC_PATH_PROG( QMAKE4, qmake, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
10407         if test "$QMAKE4" = "no"; then
10408             AC_MSG_ERROR([Qmake not found.  Please specify
10409 the root of your Qt installation by exporting QT4DIR before running "configure".])
10410         fi
10411     fi
10413     qt_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt_libdirs"
10414     AC_MSG_CHECKING([for Qt4 libraries])
10415     qt_lib_dir="no"
10416     for lib_dir in $qt_libdirs; do
10417         if test -r "$lib_dir/$qt_test_library"; then
10418             qt_lib_dir="$lib_dir"
10419             PKG_CONFIG_PATH="$qt_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
10420             break
10421         fi
10422     done
10424     AC_MSG_RESULT([$qt_lib_dir])
10426     if test "x$qt_lib_dir" = "xno"; then
10427         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10428     fi
10430     dnl Check for Meta Object Compiler
10432     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10433     MOC4="$MOCQT4"
10434     if test "$MOC4" = "no"; then
10435         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10436         if test "$MOC4" = "no"; then
10437             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10438 the root of your Qt installation by exporting QT4DIR before running "configure".])
10439         fi
10440     fi
10442     dnl Check for KDE4 headers
10443     AC_MSG_CHECKING([for KDE4 headers])
10444     kde_incdir="no"
10445     for kde_check in $kde_incdirs; do
10446         if test -r "$kde_check/$kde_test_include"; then
10447             kde_incdir="$kde_check"
10448             break
10449         fi
10450     done
10451     AC_MSG_RESULT([$kde_incdir])
10452     if test "x$kde_incdir" = "xno"; then
10453         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10454     fi
10456     dnl Check for KDE4 libraries
10457     AC_MSG_CHECKING([for KDE4 libraries])
10458     kde_libdir="no"
10459     for kde_check in $kde_libdirs; do
10460         if test -r "$kde_check/$kde_test_library"; then
10461             kde_libdir="$kde_check"
10462             break
10463         fi
10464     done
10466     AC_MSG_RESULT([$kde_libdir])
10467     if test "x$kde_libdir" = "xno"; then
10468         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10469     fi
10471     KDE4_CFLAGS="`pkg-config --cflags QtCore` `pkg-config --cflags QtGui` -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10472     KDE4_LIBS="-L$kde_libdir -L$qt_lib_dir -lkio -lkfile -lkdeui -lkdecore -lQtCore -lQtGui"
10474     AC_LANG_PUSH([C++])
10475     save_CXXFLAGS=$CXXFLAGS
10476     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10477     AC_MSG_CHECKING([whether KDE is >= 4.2])
10478        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10479 #include <kdeversion.h>
10481 int main(int argc, char **argv) {
10482        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
10483        else return 1;
10485        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
10486     CXXFLAGS=$save_CXXFLAGS
10487     AC_LANG_POP([C++])
10489     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
10490     # Sets also KDE_GLIB_CFLAGS/KDE_GLIB_LIBS if successful.
10491     PKG_CHECK_MODULES(KDE_GLIB,[glib-2.0 >= 2.4],
10492         [
10493         KDE_HAVE_GLIB=1
10494         AC_DEFINE(KDE_HAVE_GLIB,1)
10495         ],
10496         AC_MSG_WARN([[No Glib found, KDE4 support will not integrate with Qt's Glib event loop support]]))
10498 AC_SUBST(KDE4_CFLAGS)
10499 AC_SUBST(KDE4_LIBS)
10500 AC_SUBST(MOC4)
10501 AC_SUBST(KDE_GLIB_CFLAGS)
10502 AC_SUBST(KDE_GLIB_LIBS)
10503 AC_SUBST(KDE_HAVE_GLIB)
10505 dnl ===================================================================
10506 dnl Test for the enabling the lockdown pieces
10507 dnl ===================================================================
10508 AC_MSG_CHECKING([whether to enable the lockdown pieces])
10509 ENABLE_LOCKDOWN=""
10510 if test -n "$enable_lockdown" -a "$enable_lockdown" != "no"; then
10511     ENABLE_LOCKDOWN=YES
10512     AC_MSG_RESULT([yes])
10513 else
10514     AC_MSG_RESULT([no])
10516 AC_SUBST(ENABLE_LOCKDOWN)
10518 dnl ===================================================================
10519 dnl Test whether to include Evolution 2 support
10520 dnl ===================================================================
10521 AC_MSG_CHECKING([whether to enable evolution 2 support])
10522 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
10523     AC_MSG_RESULT([yes])
10524     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
10525     ENABLE_EVOAB2="TRUE"
10526 else
10527     ENABLE_EVOAB2=""
10528     AC_MSG_RESULT([no])
10530 AC_SUBST(ENABLE_EVOAB2)
10531 AC_SUBST(GOBJECT_CFLAGS)
10532 AC_SUBST(GOBJECT_LIBS)
10534 dnl ===================================================================
10535 dnl Test whether to include TDE AB support
10536 dnl ===================================================================
10537 AC_MSG_CHECKING([whether to enable TDE address book support])
10538 if test "$enable_tdeab" = "yes" -a "$enable_tde" = "yes"; then
10539     AC_MSG_RESULT([yes])
10540     AC_LANG_PUSH([C++])
10541     save_CXXFLAGS=$CXXFLAGS
10542     CXXFLAGS="$CXXFLAGS $TDE_CFLAGS"
10543     AC_MSG_CHECKING([whether TDE is at least R14.0])
10544        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10545 #include <tdeversion.h>
10547 int main(int argc, char **argv) {
10548        if (TDE_VERSION_MAJOR >= 14) return 0;
10549        else return 1;
10551        ]])],[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])],[])
10552     CXXFLAGS=$save_CXXFLAGS
10553     AC_LANG_POP([C++])
10554     ENABLE_TDEAB=TRUE
10555 else
10556     AC_MSG_RESULT([no])
10557     ENABLE_TDEAB=
10559 AC_SUBST(ENABLE_TDEAB)
10561 dnl ===================================================================
10562 dnl Test whether to include KDE AB support
10563 dnl ===================================================================
10564 AC_MSG_CHECKING([whether to enable KDE address book support])
10565 if test "$enable_kdeab" = "yes" -a "$enable_kde" = "yes"; then
10566     AC_MSG_RESULT([yes])
10567     AC_LANG_PUSH([C++])
10568     save_CXXFLAGS=$CXXFLAGS
10569     CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
10570     AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
10571        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10572 #include <kdeversion.h>
10574 int main(int argc, char **argv) {
10575        if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
10576        else return 1;
10578        ]])],[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])],[])
10579     CXXFLAGS=$save_CXXFLAGS
10580     AC_LANG_POP([C++])
10581     ENABLE_KAB=TRUE
10582 else
10583     AC_MSG_RESULT([no])
10584     ENABLE_KAB=
10586 AC_SUBST(ENABLE_KAB)
10588 dnl ===================================================================
10589 dnl Test which themes to include
10590 dnl ===================================================================
10591 AC_MSG_CHECKING([which themes to include])
10592 # if none given use default subset of available themes
10593 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
10594     with_theme="crystal default hicontrast oxygen tango"
10595     test "$ENABLE_RELEASE_BUILD" = "FALSE" && with_theme="$with_theme tango_testing"
10598 WITH_THEMES=""
10599 if test "x$with_theme" != "xno"; then
10600     for theme in $with_theme; do
10601         case $theme in
10602             crystal|default|galaxy|hicontrast|human|industrial|oxygen|tango|tango_testing) : ;;
10603             *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
10604         esac
10605         WITH_THEMES="$WITH_THEMES $theme"
10606         SCPDEFS="$SCPDEFS -DTHEME_`echo $theme|tr '[[:lower:]]' '[[:upper:]]'`"
10607     done
10609 AC_MSG_RESULT([$WITH_THEMES])
10610 AC_SUBST([WITH_THEMES])
10612 dnl ===================================================================
10613 dnl Test whether to integrate helppacks into the product's installer
10614 dnl ===================================================================
10615 AC_MSG_CHECKING([for helppack integration])
10616 if test "$with_helppack_integration" = "no"; then
10617     WITH_HELPPACK_INTEGRATION=NO
10618     AC_MSG_RESULT([no integration])
10619 else
10620     WITH_HELPPACK_INTEGRATION=YES
10621     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
10622     AC_MSG_RESULT([integration])
10624 AC_SUBST(WITH_HELPPACK_INTEGRATION)
10626 dnl ===================================================================
10627 dnl Test whether to use CoreText framework
10628 dnl ===================================================================
10629 ENABLE_CORETEXT=NO
10630 if test "$_os" = "Darwin"; then
10631     AC_MSG_CHECKING([whether to use CoreText framework])
10632     if test "$enable_coretext" != no -o "$BITNESS_OVERRIDE" = 64; then
10633         AC_MSG_RESULT([yes])
10634         ENABLE_CORETEXT=YES
10635     else
10636         AC_MSG_RESULT([no])
10637     fi
10639 AC_SUBST(ENABLE_CORETEXT)
10641 ###############################################################################
10642 # Extensions checking
10643 ###############################################################################
10644 AC_MSG_CHECKING([for extensions integration])
10645 if test "x$enable_extension_integration" != "xno"; then
10646     WITH_EXTENSION_INTEGRATION=YES
10647     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
10648     AC_MSG_RESULT([yes, use integration])
10649 else
10650     WITH_EXTENSION_INTEGRATION=NO
10651     AC_MSG_RESULT([no, do not integrate])
10653 AC_SUBST(WITH_EXTENSION_INTEGRATION)
10655 dnl Should any extra extensions be included?
10656 dnl There are standalone tests for each of these below.
10657 WITH_EXTRA_EXTENSIONS=
10658 AC_SUBST([WITH_EXTRA_EXTENSIONS])
10660 libo_CHECK_EXTENSION([Watch Window],[WATCH_WINDOW],[watch_window],[watch-window],[23bd75552206dfcd8fd4e29137dcac84-WatchWindow_1.2.0.0.oxt])
10661 libo_CHECK_EXTENSION([SmART Gallery (Diagram)],[DIAGRAM],[diagram],[diagram],[8d74685d41f8bffe8c3e71fe8deac09d-SmART_0.9.5.oxt])
10662 libo_CHECK_EXTENSION([Validator],[VALIDATOR],[validator],[validator],[bbdd5639ada63e3130761daaecae1a10-Validator_1.1.0.0.oxt])
10663 libo_CHECK_EXTENSION([Barcode],[BARCODE],[barcode],[barcode],[3ed18025a766f1e955707b969c8113a5-Barcode_1.3.5.0.oxt])
10664 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
10665 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
10666 libo_CHECK_EXTENSION([Hungarian Cross-reference Toolbar],[HUNART],[hunart],[hunart],[b632bdd25649cc4067bcb410bae23d2b-hunart_0.3.oxt])
10667 libo_CHECK_EXTENSION([Typography Toolbar],[TYPO],[typo],[typo],[9d60b6cfa3ef1926848710bbcd11115b-typo_0.4.2.oxt])
10668 libo_CHECK_EXTENSION([Google Docs],[GOOGLE_DOCS],[google_docs],[google-docs],[27211596cf0ad97cab7321239406fde0-gdocs_3.0.1_modified.oxt])
10669 if test "x$with_java" != "xno"; then
10670     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
10671     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
10674 dnl ===================================================================
10675 dnl Test whether to include Sun Professional Template Pack
10676 dnl ===================================================================
10677 AC_MSG_CHECKING([for Sun Professional Template Pack integration (only supported languages displayed)])
10678 if test "$with_sun_templates" = "" -o "$with_sun_templates" = "no"; then
10679     AC_MSG_RESULT([no integration])
10680 else
10681     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_SUN_TEMPLATE_PACK"
10682     sun_supported_langs="en-US de it fr es hu"
10683     if test "$with_sun_templates" = "yes"; then
10684         wanted_sun_templates="$sun_supported_langs"
10685     else
10686         # check whether the langs are supported by Sun
10687         wanted_sun_templates=
10688         for lang in $with_sun_templates; do
10689             if test -n "`echo $sun_supported_langs | grep "$lang"`"; then
10690                 wanted_sun_templates="$wanted_sun_templates $lang"
10691             fi
10692         done
10693     fi
10694     SUNTEMPLATES_LANG=
10695     SUNTEMPLATES_DE_PACK=
10696     SUNTEMPLATES_EN_US_PACK=
10697     SUNTEMPLATES_ES_PACK=
10698     SUNTEMPLATES_FR_PACK=
10699     SUNTEMPLATES_HU_PACK=
10700     SUNTEMPLATES_IT_PACK=
10701     # check whether the langs are requested at all
10702     for lang in $wanted_sun_templates; do
10703     if test "$with_lang" = "ALL" -o -n "`echo $with_lang | grep "$lang"`"; then
10704         SUNTEMPLATES_LANG="$SUNTEMPLATES_LANG $lang"
10705         case $lang in
10706         "de") SUNTEMPLATES_DE_PACK="53ca5e56ccd4cab3693ad32c6bd13343-Sun-ODF-Template-Pack-de_1.0.0.oxt";;
10707         "en-US") SUNTEMPLATES_EN_US_PACK="472ffb92d82cf502be039203c606643d-Sun-ODF-Template-Pack-en-US_1.0.0.oxt";;
10708         "es") SUNTEMPLATES_ES_PACK="4ad003e7bbda5715f5f38fde1f707af2-Sun-ODF-Template-Pack-es_1.0.0.oxt";;
10709         "fr") SUNTEMPLATES_FR_PACK="a53080dc876edcddb26eb4c3c7537469-Sun-ODF-Template-Pack-fr_1.0.0.oxt";;
10710         "hu") SUNTEMPLATES_HU_PACK="09ec2dac030e1dcd5ef7fa1692691dc0-Sun-ODF-Template-Pack-hu_1.0.0.oxt";;
10711         "it") SUNTEMPLATES_IT_PACK="b33775feda3bcf823cad7ac361fd49a6-Sun-ODF-Template-Pack-it_1.0.0.oxt";;
10712         esac
10713     fi
10714     done
10715     WITH_EXTRA_EXTENSIONS=YES
10716     AC_MSG_RESULT([$SUNTEMPLATES_LANG])
10718 AC_SUBST(SUNTEMPLATES_DE_PACK)
10719 AC_SUBST(SUNTEMPLATES_EN_US_PACK)
10720 AC_SUBST(SUNTEMPLATES_ES_PACK)
10721 AC_SUBST(SUNTEMPLATES_FR_PACK)
10722 AC_SUBST(SUNTEMPLATES_HU_PACK)
10723 AC_SUBST(SUNTEMPLATES_IT_PACK)
10725 dnl ===================================================================
10726 dnl Test whether to include fonts
10727 dnl ===================================================================
10728 AC_MSG_CHECKING([whether to include third-party fonts])
10729 if test "$with_fonts" != "no"; then
10730     AC_MSG_RESULT([yes])
10731     WITH_FONTS=YES
10732     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
10733 else
10734     AC_MSG_RESULT([no])
10735     WITH_FONTS=NO
10736     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
10738 AC_SUBST(WITH_FONTS)
10740 dnl ===================================================================
10741 dnl Test whether to include ppds
10742 dnl ===================================================================
10743 AC_MSG_CHECKING([whether to include PPDs])
10744 if test "$with_ppds" != "no"; then
10745     AC_MSG_RESULT([yes])
10746 else
10747     AC_MSG_RESULT([no])
10748     WITHOUT_PPDS=YES
10749     SCPDEFS="$SCPDEFS -DWITHOUT_PPDS"
10751 AC_SUBST(WITHOUT_PPDS)
10753 dnl ===================================================================
10754 dnl Test whether to include afms
10755 dnl ===================================================================
10756 AC_MSG_CHECKING([whether to include AFMs])
10757 if test "$with_afms" != "no"; then
10758     AC_MSG_RESULT([yes])
10759     BUILD_TYPE="$BUILD_TYPE AFMS"
10760 else
10761     AC_MSG_RESULT([no])
10762     WITHOUT_AFMS=YES
10763     SCPDEFS="$SCPDEFS -DWITHOUT_AFMS"
10765 AC_SUBST(WITHOUT_AFMS)
10767 dnl ===================================================================
10768 dnl Test whether to include extra galleries
10769 dnl ===================================================================
10770 AC_MSG_CHECKING([whether to include extra galleries])
10771 if test "$enable_extra_gallery" = "" -o "$enable_extra_gallery" = "no"; then
10772     AC_MSG_RESULT([no])
10773     WITH_EXTRA_GALLERY=NO
10774     OOOP_GALLERY_PACK=""
10775 else
10776     AC_MSG_RESULT([yes])
10777     WITH_EXTRA_GALLERY=YES
10778     BUILD_TYPE="$BUILD_TYPE EXTRA_GALLERY"
10779     SCPDEFS="$SCPDEFS -DWITH_EXTRA_GALLERY"
10780     OOOP_GALLERY_PACK="af9314c5972d95a5d6da23ffad818f68-OOOP-gallery-pack-2.8.0.0.zip"
10782 AC_SUBST(WITH_EXTRA_GALLERY)
10783 AC_SUBST(OOOP_GALLERY_PACK)
10785 dnl ===================================================================
10786 dnl Test whether to include extra templates
10787 dnl ===================================================================
10788 AC_MSG_CHECKING([whether to include extra templates])
10789 if test "$enable_extra_template" = "" -o "$enable_extra_template" = "no"; then
10790     AC_MSG_RESULT([no])
10791     WITH_EXTRA_TEMPLATE=NO
10792     OOOP_TEMPLATES_PACK=""
10793 else
10794     AC_MSG_RESULT([yes])
10795     WITH_EXTRA_TEMPLATE=YES
10796     BUILD_TYPE="$BUILD_TYPE EXTRA_TEMPLATE"
10797     SCPDEFS="$SCPDEFS -DWITH_EXTRA_TEMPLATE"
10798     OOOP_TEMPLATES_PACK="1be202fbbbc13f10592a98f70a4a87fb-OOOP-templates-pack-2.9.0.0.zip"
10800 AC_SUBST(WITH_EXTRA_TEMPLATE)
10801 AC_SUBST(OOOP_TEMPLATES_PACK)
10803 dnl ===================================================================
10804 dnl Test whether to include extra samples
10805 dnl ===================================================================
10806 AC_MSG_CHECKING([whether to include extra samples])
10807 if test "$enable_extra_sample" = "" -o "$enable_extra_sample" = "no"; then
10808     AC_MSG_RESULT([no])
10809     WITH_EXTRA_SAMPLE=NO
10810     OOOP_SAMPLES_PACK=""
10811 else
10812     AC_MSG_RESULT([yes])
10813     WITH_EXTRA_SAMPLE=YES
10814     BUILD_TYPE="$BUILD_TYPE EXTRA_SAMPLE"
10815     SCPDEFS="$SCPDEFS -DWITH_EXTRA_SAMPLE"
10816     OOOP_SAMPLES_PACK="a6bccacf44914969e6e7b2f8faf4132c-OOOP-samples-pack-2.7.0.0.zip"
10818 AC_SUBST(WITH_EXTRA_SAMPLE)
10819 AC_SUBST(OOOP_SAMPLES_PACK)
10821 dnl ===================================================================
10822 dnl Test whether to include extra fonts
10823 dnl ===================================================================
10824 AC_MSG_CHECKING([whether to include extra fonts])
10825 if test "$enable_extra_font" = "" -o "$enable_extra_font" = "no"; then
10826     AC_MSG_RESULT([no])
10827     WITH_EXTRA_FONT=NO
10828     OOOP_FONTS_PACK=""
10829 else
10830     AC_MSG_RESULT([yes])
10831     WITH_EXTRA_FONT=YES
10832     BUILD_TYPE="$BUILD_TYPE EXTRA_FONT"
10833     SCPDEFS="$SCPDEFS -DWITH_EXTRA_FONT"
10834     OOOP_FONTS_PACK="a10aa597411643326e27d7fc128af12d-OOOP-fonts-pack-2.9.0.0.zip"
10836 AC_SUBST(WITH_EXTRA_FONT)
10837 AC_SUBST(OOOP_FONTS_PACK)
10839 dnl ===================================================================
10840 dnl Test whether to enable online update service
10841 dnl ===================================================================
10842 AC_MSG_CHECKING([whether to enable online update])
10843 ENABLE_ONLINE_UPDATE=
10844 if test "$enable_online_update" = ""; then
10845     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
10846         AC_MSG_RESULT([yes])
10847         ENABLE_ONLINE_UPDATE="TRUE"
10848     else
10849         AC_MSG_RESULT([no])
10850     fi
10851 else
10852     if test "$enable_online_update" = "yes"; then
10853         AC_MSG_RESULT([yes])
10854         ENABLE_ONLINE_UPDATE="TRUE"
10855     else
10856         AC_MSG_RESULT([no])
10857     fi
10859 AC_SUBST(ENABLE_ONLINE_UPDATE)
10861 dnl ===================================================================
10862 dnl Test whether to create MSI with LIMITUI=1 (silent install)
10863 dnl ===================================================================
10864 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
10865 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
10866     AC_MSG_RESULT([no])
10867     ENABLE_SILENT_MSI="FALSE"
10868 else
10869     AC_MSG_RESULT([yes])
10870     ENABLE_SILENT_MSI="TRUE"
10871     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
10873 AC_SUBST(ENABLE_SILENT_MSI)
10875 AC_MSG_CHECKING([whether and how to use Xinerama])
10876 if test "$_os" = "Darwin"; then
10877     USE_XINERAMA=YES
10878     XINERAMA_LINK=dynamic
10879     AC_MSG_RESULT([yes])
10880 elif test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
10881     if test "$x_libraries" = "default_x_libraries"; then
10882         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
10883         if test "x$XINERAMALIB" = x; then
10884            XINERAMALIB="/usr/lib"
10885         fi
10886     else
10887         XINERAMALIB="$x_libraries"
10888     fi
10889     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
10890         # we have both versions, let the user decide but use the dynamic one
10891         # per default
10892         USE_XINERAMA=YES
10893         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
10894             XINERAMA_LINK=dynamic
10895         else
10896             XINERAMA_LINK=static
10897         fi
10898     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
10899         # we have only the dynamic version
10900         USE_XINERAMA=YES
10901         XINERAMA_LINK=dynamic
10902     elif test -e "$XINERAMALIB/libXinerama.a"; then
10903         # static version
10904         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
10905             USE_XINERAMA=YES
10906             XINERAMA_LINK=static
10907         else
10908             USE_XINERAMA=NO
10909             XINERAMA_LINK=none
10910         fi
10911     else
10912         # no Xinerama
10913         USE_XINERAMA=NO
10914         XINERAMA_LINK=none
10915     fi
10916     if test "$USE_XINERAMA" = "YES"; then
10917         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
10918         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
10919             [AC_MSG_ERROR(Xinerama header not found.)], [])
10920         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
10921         if test "x$XEXTLIB" = x; then
10922            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
10923         fi
10924         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
10925         if test "$_os" = "FreeBSD"; then
10926             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
10927         fi
10928         if test "$_os" = "Linux"; then
10929             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
10930         fi
10931         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
10932             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
10933     else
10934         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
10935     fi
10936 else
10937     USE_XINERAMA=NO
10938     XINERAMA_LINK=none
10939     AC_MSG_RESULT([no])
10941 AC_SUBST(USE_XINERAMA)
10942 AC_SUBST(XINERAMA_LINK)
10944 dnl ===================================================================
10945 dnl Test whether to build cairo or rely on the system version
10946 dnl ===================================================================
10948 if test "$GUIBASE" = "unx"; then
10949     # Used in vcl/Library_vclplug_gen.mk
10950     test_cairo=yes
10953 if test "$test_cairo" = "yes"; then
10954     AC_MSG_CHECKING([whether to use the system cairo])
10956     if test "$with_system_cairo" = "yes"; then
10957         SYSTEM_CAIRO=YES
10958         AC_MSG_RESULT([yes])
10960         PKG_CHECK_MODULES( CAIRO, cairo >= 1.0.2 )
10962         if test "$test_xrender" = "yes"; then
10963             if test "$with_system_xextensions_headers" != "no"; then
10964                 AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
10965                 AC_LANG_PUSH([C])
10966                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
10967 #ifdef PictStandardA8
10968 #else
10969       return fail;
10970 #endif
10971 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
10973                 AC_LANG_POP([C])
10974             fi
10975         fi
10976         libo_MINGW_CHECK_DLL([libcairo])
10977         libo_MINGW_TRY_DLL([libfontconfig])
10978         libo_MINGW_TRY_DLL([libfreetype])
10979         libo_MINGW_TRY_DLL([libpixman])
10980         libo_MINGW_TRY_DLL([libpng15])
10981     else
10982         SYSTEM_CAIRO=NO
10983         AC_MSG_RESULT([no])
10985         BUILD_TYPE="$BUILD_TYPE CAIRO"
10986         SCPDEFS="$SCPDEFS -DNEED_CAIRO"
10987     fi
10990 AC_SUBST(SYSTEM_CAIRO)
10991 AC_SUBST(CAIRO_CFLAGS)
10992 AC_SUBST(CAIRO_LIBS)
10994 dnl ===================================================================
10995 dnl Test whether to use liblangtag
10996 dnl ===================================================================
10997 ENABLE_LIBLANGTAG=
10998 SYSTEM_LIBLANGTAG=
10999 AC_MSG_CHECKING([whether to use liblangtag])
11000 if test "$enable_liblangtag" = "yes" -o \( "$enable_liblangtag" = "" -a $_os != Android -a $_os != iOS \); then
11001     ENABLE_LIBLANGTAG=YES
11002     AC_MSG_RESULT([yes])
11003     AC_MSG_CHECKING([whether to use system liblangtag])
11004     if test "$with_system_liblangtag" = yes; then
11005         SYSTEM_LIBLANGTAG=YES
11006         AC_MSG_RESULT([yes])
11007         PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11008         libo_MINGW_CHECK_DLL([liblangtag])
11009     else
11010         SYSTEM_LIBLANGTAG=NO
11011         AC_MSG_RESULT([no])
11012         BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11013     fi
11014 else
11015     ENABLE_LIBLANGTAG=NO
11016     AC_MSG_RESULT([no])
11018 AC_SUBST(ENABLE_LIBLANGTAG)
11019 AC_SUBST(SYSTEM_LIBLANGTAG)
11020 AC_SUBST(LIBLANGTAG_CFLAGS)
11021 AC_SUBST(LIBLANGTAG_LIBS)
11023 dnl ===================================================================
11024 dnl Test whether to build libpng or rely on the system version
11025 dnl ===================================================================
11027 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/png"],["-L${OUTDIR}/lib -lpng"])
11029 dnl ===================================================================
11030 dnl Check for runtime JVM search path
11031 dnl ===================================================================
11032 if test "$SOLAR_JAVA" != ""; then
11033     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11034     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11035         AC_MSG_RESULT([yes])
11036         if ! test -d "$with_jvm_path"; then
11037             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11038         fi
11039         if ! test -d "$with_jvm_path"jvm; then
11040             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11041         fi
11042         JVM_ONE_PATH_CHECK="$with_jvm_path"
11043         AC_SUBST(JVM_ONE_PATH_CHECK)
11044     else
11045         AC_MSG_RESULT([no])
11046     fi
11049 dnl ===================================================================
11050 dnl Test for the presence of Ant and that it works
11051 dnl ===================================================================
11053 if test "$SOLAR_JAVA" != ""; then
11054     ANT_HOME=; export ANT_HOME
11055     WITH_ANT_HOME=; export WITH_ANT_HOME
11056     if test -z "$with_ant_home"; then
11057         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11058     else
11059         if test "$_os" = "WINNT"; then
11060             with_ant_home=`cygpath -u "$with_ant_home"`
11061         fi
11062         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11063         WITH_ANT_HOME=$with_ant_home
11064         ANT_HOME=$with_ant_home
11065     fi
11067     if test -z "$ANT"; then
11068         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11069     else
11070         # resolve relative or absolute symlink
11071         while test -h "$ANT"; do
11072             a_cwd=`pwd`
11073             a_basename=`basename "$ANT"`
11074             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11075             cd "`dirname "$ANT"`"
11076             cd "`dirname "$a_script"`"
11077             ANT="`pwd`"/"`basename "$a_script"`"
11078             cd "$a_cwd"
11079         done
11081         AC_MSG_CHECKING([if $ANT works])
11082         cat > conftest.java << EOF
11083         public class conftest {
11084             int testmethod(int a, int b) {
11085                     return a + b;
11086             }
11087         }
11090         cat > conftest.xml << EOF
11091         <project name="conftest" default="conftest">
11092         <target name="conftest">
11093             <javac srcdir="." includes="conftest.java">
11094             </javac>
11095         </target>
11096         </project>
11099         oldJAVA_HOME=$JAVA_HOME
11100         if test "$JAVACISGCJ" = "yes"; then
11101             JAVA_HOME=; export JAVA_HOME
11102             ant_gcj="-Dbuild.compiler=gcj"
11103         fi
11104         AC_TRY_COMMAND("$ANT" $ant_gcj -buildfile conftest.xml 1>&2)
11105         if test $? = 0 -a -f ./conftest.class; then
11106             AC_MSG_RESULT([Ant works])
11107             if test -z "$WITH_ANT_HOME"; then
11108                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11109                 if test -z "$ANT_HOME"; then
11110                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11111                 fi
11112             else
11113                 ANT_HOME="$WITH_ANT_HOME"
11114             fi
11115         else
11116             echo "configure: Ant test failed" >&5
11117             cat conftest.java >&5
11118             cat conftest.xml >&5
11119             AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
11120             ANT_HOME=""
11121             add_warning "Ant does not work - Some Java projects will not build!"
11122         fi
11123         JAVA_HOME=$oldJAVA_HOME
11124         rm -f conftest* core core.* *.core
11125     fi
11126     if test -z "$ANT_HOME"; then
11127         ANT_HOME="NO_ANT_HOME"
11128     else
11129         PathFormat "$ANT_HOME"
11130         ANT_HOME="$formatted_path"
11131         PathFormat "$ANT"
11132         ANT="$ANT"
11133     fi
11134     AC_SUBST(ANT_HOME)
11135     AC_SUBST(ANT)
11137     dnl Checking for ant.jar
11138     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11139         AC_MSG_CHECKING([Ant lib directory])
11140         if test -f $ANT_HOME/lib/ant.jar; then
11141             ANT_LIB="$ANT_HOME/lib"
11142         else
11143             if test -f $ANT_HOME/ant.jar; then
11144                 ANT_LIB="$ANT_HOME"
11145             else
11146                 if test -f /usr/share/java/ant.jar; then
11147                     ANT_LIB=/usr/share/java
11148                 else
11149                     if test -f /usr/share/ant-core/lib/ant.jar; then
11150                         ANT_LIB=/usr/share/ant-core/lib
11151                     else
11152                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11153                             ANT_LIB="$ANT_HOME/lib/ant"
11154                         else
11155                             if test -f /usr/share/lib/ant/ant.jar; then
11156                                 ANT_LIB=/usr/share/lib/ant
11157                             else
11158                                 AC_MSG_ERROR([Ant libraries not found!])
11159                             fi
11160                         fi
11161                     fi
11162                 fi
11163             fi
11164         fi
11165         PathFormat "$ANT_LIB"
11166         ANT_LIB="$formatted_path"
11167         AC_MSG_RESULT([Ant lib directory found.])
11168     fi
11169     AC_SUBST(ANT_LIB)
11171     ant_minver=1.6.0
11172     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11174     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11175     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11176     ant_version_major=`echo $ant_version | cut -d. -f1`
11177     ant_version_minor=`echo $ant_version | cut -d. -f2`
11178     echo "configure: ant_version $ant_version " >&5
11179     echo "configure: ant_version_major $ant_version_major " >&5
11180     echo "configure: ant_version_minor $ant_version_minor " >&5
11181     if test "$ant_version_major" -ge "2"; then
11182         AC_MSG_RESULT([yes, $ant_version])
11183     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11184         AC_MSG_RESULT([yes, $ant_version])
11185     else
11186         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11187     fi
11189     if test "$ENABLE_MEDIAWIKI" = "YES"; then
11190         AC_MSG_CHECKING([whether Ant supports mapper type="regexp"])
11191         rm -rf confdir
11192         mkdir confdir
11193         cat > conftest.java << EOF
11194             public class conftest {
11195                 int testmethod(int a, int b) {
11196                     return a + b;
11197                 }
11198             }
11201         cat > conftest.xml << EOF
11202             <project name="conftest" default="conftest">
11203             <target name="conftest" depends="copytest">
11204                 <javac srcdir="." includes="conftest.java">
11205                 </javac>
11206             </target>
11207             <target name="copytest">
11208                  <copy todir="confdir">
11209                  <fileset dir="confdir" includes="**/*.abc" casesensitive="yes"/>
11210                  <filterset/>
11211                  <mapper type="regexp" from="^(.*[/\\])foo([/\\].*)" to="\1baa\2"/>
11212                  </copy>
11213             </target>
11214             </project>
11217         if test "$JAVACISGCJ" = "yes"; then
11218             JAVA_HOME=; export JAVA_HOME
11219             ant_gcj="-Dbuild.compiler=gcj"
11220         fi
11221         AC_TRY_COMMAND("$ANT" $ant_gcj -buildfile conftest.xml 1>&2)
11222         if test $? = 0 -a -f ./conftest.class; then
11223             AC_MSG_RESULT([yes])
11224             rm -rf confdir
11225         else
11226             echo "configure: Ant test failed" >&5
11227             cat conftest.java >&5
11228             cat conftest.xml >&5
11229             rm -rf confdir
11230             AC_MSG_ERROR([no. Did you install ant-apache-regexp?])
11231         fi
11232     fi
11233     rm -f conftest* core core.* *.core
11236 OOO_JUNIT_JAR=
11237 if test "$SOLAR_JAVA" != "" -a "$with_junit" != "no"; then
11238     AC_MSG_CHECKING([for JUnit 4])
11239     if test "$with_junit" = "yes"; then
11240         if test -e /usr/share/java/junit4.jar; then
11241             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11242         else
11243            if test -e /usr/share/lib/java/junit.jar; then
11244               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11245            else
11246               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11247            fi
11248         fi
11249     else
11250         OOO_JUNIT_JAR=$with_junit
11251     fi
11252     if test "$_os" = "WINNT"; then
11253         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11254     fi
11255     "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" 2>&5 | \
11256         grep org/junit/Before.class > /dev/null 2>&5
11257     if test $? -eq 0; then
11258         # check if either class-path entry is available for hamcrest or
11259         # it's bundled
11260         if "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" |$GREP -q hamcrest || \
11261             "$UNZIP" -c "$OOO_JUNIT_JAR" META-INF/MANIFEST.MF |$GREP 'Class-Path:' | $GREP -q 'hamcrest'; then
11262             AC_MSG_RESULT([$OOO_JUNIT_JAR])
11263         else
11264             AC_MSG_ERROR([your junit jar neither sets a classpath nor includes hamcrest; please
11265 provide a full junit jar or use --without-junit])
11266         fi
11267     else
11268         AC_MSG_RESULT([no])
11269         AC_MSG_ERROR([cannot find JUnit 4 jar; please install one in the default
11270 location (/usr/share/java), specify its pathname via
11271 --with-junit=..., or disable it via --without-junit])
11272     fi
11273     if test $OOO_JUNIT_JAR != ""; then
11274     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11275     fi
11277 AC_SUBST(OOO_JUNIT_JAR)
11280 AC_SUBST(SCPDEFS)
11283 # check for wget and md5sum
11285 WGET=
11286 MD5SUM=
11287 CURL=
11289 if test "$enable_fetch_external" != "no"; then
11291 CURL=`which curl 2>/dev/null`
11293 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
11294     eval "$i --version" > /dev/null 2>&1
11295     ret=$?
11296     if test $ret -eq 0; then
11297         WGET=$i
11298         break
11299     fi
11300 done
11302 if test -z "$WGET" -a -z "$CURL"; then
11303     AC_MSG_ERROR([neither wget nor curl found!])
11306 for i in md5 md5sum /usr/local/bin/md5sum gmd5sum /usr/sfw/bin/md5sum /opt/sfw/bin/gmd5sum /opt/local/bin/md5sum; do
11307     if test "$i" = "md5"; then
11308         eval "$i -x" > /dev/null 2>&1
11309     else
11310         eval "$i --version" > /dev/null 2>&1
11311     fi
11312     ret=$?
11313     if test $ret -eq 0; then
11314         MD5SUM=$i
11315         break
11316     fi
11317 done
11319 if test "$MD5SUM" = "md5"; then
11320     if md5 -r < /dev/null > /dev/null 2>/dev/null; then
11321         MD5SUM="$MD5SUM -r"
11322     elif md5 -n < /dev/null > /dev/null 2>/dev/null; then
11323         MD5SUM="$MD5SUM -n"
11324     fi
11327 if test -z "$MD5SUM"; then
11328     AC_MSG_ERROR([no md5sum: found!])
11333 AC_SUBST(WGET)
11334 AC_SUBST(CURL)
11335 AC_SUBST(MD5SUM)
11337 dnl ===================================================================
11338 dnl Product version
11339 dnl ===================================================================
11340 AC_MSG_CHECKING([for product version])
11341 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
11342 AC_MSG_RESULT([$PRODUCTVERSION])
11343 AC_SUBST(PRODUCTVERSION)
11345 dnl ===================================================================
11346 dnl Dealing with l10n options
11347 dnl ===================================================================
11348 AC_MSG_CHECKING([which languages to be built])
11349 # get list of all languages
11350 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
11351 # the sed command does the following:
11352 #   + if a line ends with a backslash, append the next line to it
11353 #   + adds " on the beginning of the value (after =)
11354 #   + adds " at the end of the value
11355 #   + removes en-US; we want to put it on the beginning
11356 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
11357 [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)]
11358 ALL_LANGS="en-US $completelangiso"
11359 # check the configured localizations
11360 WITH_LANG="$with_lang"
11361 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
11362     AC_MSG_RESULT([en-US])
11363 else
11364     AC_MSG_RESULT([$WITH_LANG])
11365     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
11367 # check that the list is valid
11368 for lang in $WITH_LANG; do
11369     test "$lang" = "ALL" && continue
11370     # need to check for the exact string, so add space before and after the list of all languages
11371     for vl in $ALL_LANGS; do
11372         if test "$vl" = "$lang"; then
11373            break
11374         fi
11375     done
11376     if test "$vl" != "$lang"; then
11377         # if you're reading this - you prolly quoted your languages remove the quotes ...
11378         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
11379     fi
11380 done
11381 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
11382     echo $WITH_LANG | grep -q en-US
11383     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
11385 # list with substituted ALL
11386 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
11387 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
11388 test "$WITH_LANG" = "en-US" && WITH_LANG=
11389 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
11390     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
11391     ALL_LANGS=`echo $ALL_LANGS qtz`
11393 AC_SUBST(ALL_LANGS)
11394 AC_SUBST(WITH_LANG)
11395 AC_SUBST(WITH_LANG_LIST)
11396 AC_SUBST(GIT_NEEDED_SUBMODULES)
11398 WITH_POOR_HELP_LOCALIZATIONS=
11399 if test -d "$SRC_ROOT/translations/source"; then
11400     for l in `ls -1 $SRC_ROOT/translations/source`; do
11401         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
11402             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
11403         fi
11404     done
11406 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
11408 dnl git submodule update --reference
11409 dnl ===================================================================
11410 if test -n "${GIT_REFERENCE_SRC}"; then
11411     for repo in ${GIT_NEEDED_SUBMODULES}; do
11412         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
11413             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
11414         fi
11415     done
11417 AC_SUBST(GIT_REFERENCE_SRC)
11419 dnl branding
11420 dnl ===================================================================
11421 AC_MSG_CHECKING([for alternative branding images directory])
11422 # initialize mapped arrays
11423 BRAND_INTRO_IMAGES="flat_logo.svg intro.png"
11424 brand_files="$BRAND_INTRO_IMAGES about.svg \
11425     backing_left.png backing_right.png \
11426     backing_rtl_left.png backing_rtl_right.png \
11427     backing_space.png"
11429 if test -z "$with_branding" -o "$with_branding" = "no"; then
11430     AC_MSG_RESULT([none])
11431     DEFAULT_BRAND_IMAGES="$brand_files"
11432 else
11433     if ! test -d $with_branding ; then
11434         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
11435     else
11436         AC_MSG_RESULT([$with_branding])
11437         CUSTOM_BRAND_DIR="$with_branding"
11438         for lfile in $brand_files
11439         do
11440             if ! test -f $with_branding/$lfile ; then
11441                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
11442                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
11443             else
11444                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
11445             fi
11446         done
11447         check_for_progress="yes"
11448     fi
11450 AC_SUBST([BRAND_INTRO_IMAGES])
11451 AC_SUBST([CUSTOM_BRAND_DIR])
11452 AC_SUBST([CUSTOM_BRAND_IMAGES])
11453 AC_SUBST([DEFAULT_BRAND_IMAGES])
11456 AC_MSG_CHECKING([for 'intro' progress settings])
11457 PROGRESSBARCOLOR=
11458 PROGRESSSIZE=
11459 PROGRESSPOSITION=
11460 PROGRESSFRAMECOLOR=
11461 PROGRESSTEXTCOLOR=
11462 PROGRESSTEXTBASELINE=
11464 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
11465     source "$with_branding/progress.conf"
11466     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
11467 else
11468     AC_MSG_RESULT([none])
11471 AC_SUBST(PROGRESSBARCOLOR)
11472 AC_SUBST(PROGRESSSIZE)
11473 AC_SUBST(PROGRESSPOSITION)
11474 AC_SUBST(PROGRESSFRAMECOLOR)
11475 AC_SUBST(PROGRESSTEXTCOLOR)
11476 AC_SUBST(PROGRESSTEXTBASELINE)
11479 EXTRA_BUILDID=
11480 AC_MSG_CHECKING([for extra build ID])
11481 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
11482     EXTRA_BUILDID="$with_extra_buildid"
11483     AC_MSG_RESULT([$EXTRA_BUILDID])
11484 else
11485     AC_MSG_RESULT([not set])
11487 AC_SUBST(EXTRA_BUILDID)
11489 OOO_VENDOR=
11490 AC_MSG_CHECKING([for vendor])
11491 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
11492     OOO_VENDOR="$USERNAME"
11494     if test -z "$OOO_VENDOR"; then
11495         OOO_VENDOR="$USER"
11496     fi
11498     if test -z "$OOO_VENDOR"; then
11499         OOO_VENDOR="`id -u -n`"
11500     fi
11502     AC_MSG_RESULT([not set, using $OOO_VENDOR])
11503 else
11504     OOO_VENDOR="$with_vendor"
11505     AC_MSG_RESULT([$OOO_VENDOR])
11507 AC_SUBST(OOO_VENDOR)
11509 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
11510 if test "$with_compat_oowrappers" = "yes"; then
11511     WITH_COMPAT_OOWRAPPERS=YES
11512     AC_MSG_RESULT(yes)
11513 else
11514     WITH_COMPAT_OOWRAPPERS=
11515     AC_MSG_RESULT(no)
11517 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
11519 AC_MSG_CHECKING([for product name])
11520 PRODUCTNAME=AC_PACKAGE_NAME
11521 AC_MSG_RESULT([$PRODUCTNAME])
11522 AC_SUBST(PRODUCTNAME)
11524 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | tr '[[:upper:]]' '[[:lower:]]'`
11525 AC_MSG_CHECKING([for install dirname])
11526 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
11527    INSTALLDIRNAME="$with_install_dirname"
11529 AC_MSG_RESULT([$INSTALLDIRNAME])
11530 AC_SUBST(INSTALLDIRNAME)
11532 AC_MSG_CHECKING([for prefix])
11533 test "x$prefix" = xNONE && prefix=$ac_default_prefix
11534 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
11535 PREFIXDIR="$prefix"
11536 AC_MSG_RESULT([$PREFIXDIR])
11537 AC_SUBST(PREFIXDIR)
11539 LIBDIR=[$(eval echo $(eval echo $libdir))]
11540 AC_SUBST(LIBDIR)
11542 DATADIR=[$(eval echo $(eval echo $datadir))]
11543 AC_SUBST(DATADIR)
11545 MANDIR=[$(eval echo $(eval echo $mandir))]
11546 AC_SUBST(MANDIR)
11548 DOCDIR=[$(eval echo $(eval echo $docdir))]
11549 AC_SUBST(DOCDIR)
11551 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
11552 AC_SUBST(INSTALLDIR)
11554 DEVINSTALLDIR="$OUTDIR/installation"
11555 AC_SUBST(DEVINSTALLDIR)
11557 # ===================================================================
11558 # De- or increase default verbosity of build process
11559 # ===================================================================
11560 AC_MSG_CHECKING([build verbosity])
11561 if test -n "$enable_verbose"; then
11562     if test "$enable_verbose" = "yes"; then
11563         VERBOSE="TRUE"
11564         AC_MSG_RESULT([high])
11565     fi
11566     if test "$enable_verbose" = "no"; then
11567         VERBOSE="FALSE"
11568         AC_MSG_RESULT([low])
11569     fi
11570 else
11571     AC_MSG_RESULT([not set])
11573 AC_SUBST(VERBOSE)
11575 dnl ===================================================================
11576 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
11577 dnl --enable-dependency-tracking configure option
11578 dnl ===================================================================
11579 AC_MSG_CHECKING([whether to enable dependency tracking])
11580 if test "$enable_dependency_tracking" = "no"; then
11581     nodep=TRUE
11582     AC_MSG_RESULT([no])
11583 else
11584     AC_MSG_RESULT([yes])
11586 AC_SUBST(nodep)
11588 dnl ===================================================================
11589 dnl Number of CPUs to use during the build
11590 dnl ===================================================================
11591 AC_MSG_CHECKING([for number of processors to use])
11592 # plain --with-parallelism is just the default
11593 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
11594     if test "$with_parallelism" = "no"; then
11595         PARALLELISM=1
11596     else
11597         PARALLELISM=$with_parallelism
11598     fi
11599 else
11600     if test "$enable_icecream" = "yes"; then
11601         PARALLELISM="10"
11602     else
11603         case `uname -s` in
11605         Darwin|FreeBSD|NetBSD|OpenBSD)
11606             PARALLELISM=`sysctl -n hw.ncpu`
11607             ;;
11609         Linux)
11610             PARALLELISM=`getconf _NPROCESSORS_ONLN`
11611         ;;
11612         # what else than above does profit here *and* has /proc?
11613         *)
11614             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
11615             ;;
11616         esac
11618         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
11619         # unexpected format, 'wc -l' will have returned 0.
11620         if test "$PARALLELISM" -eq 0; then
11621             PARALLELISM=1
11622         fi
11623     fi
11626 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
11627     if test -z "$with_parallelism"; then
11628             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
11629             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
11630             PARALLELISM="1"
11631     else
11632         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."
11633     fi
11636 AC_MSG_RESULT([$PARALLELISM])
11637 AC_SUBST(PARALLELISM)
11639 # ===================================================================
11640 # Number of parallel jobs to be executed during subsequenttest
11641 # ===================================================================
11642 AC_MSG_CHECKING([for maximum no. of jobs during subsequenttest])
11643 CHECK_PARALLELISM=$PARALLELISM
11644 if test "$with_check_jobs" != ""; then
11645     CHECK_PARALLELISM="$with_check_jobs"
11647 AC_MSG_RESULT([$CHECK_PARALLELISM])
11648 AC_SUBST(CHECK_PARALLELISM)
11651 # Set up ILIB for MSVC build
11653 if test "$build_os" = "cygwin"; then
11654     ILIB=".;${SOLARVER}/$INPATH/lib"
11655     if test -n "$JAVA_HOME" -a "$JAVA_HOME" != "NO_JAVA_HOME"; then
11656         ILIB="$ILIB;$JAVA_HOME/lib"
11657     fi
11658     if test "$BITNESS_OVERRIDE" = 64; then
11659         ILIB="$ILIB;$COMPATH/lib/amd64"
11660         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
11661         if test "$WINDOWS_SDK_VERSION" = "80"; then
11662             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/win8/um/x64"
11663         fi
11664     else
11665         ILIB="$ILIB;$COMPATH/lib"
11666         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
11667         if test "$WINDOWS_SDK_VERSION" = "80"; then
11668             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/win8/um/x86"
11669         fi
11670     fi
11671     ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
11673     if test "$ENABLE_DIRECTX" = "TRUE"; then
11674         ILIB="$ILIB;$DIRECTXSDK_LIB"
11675     fi
11676     AC_SUBST(ILIB)
11680 # ===================================================================
11681 # Creating bigger shared library to link against
11682 # ===================================================================
11683 AC_MSG_CHECKING([whether to create huge library])
11684 MERGELIBS=
11686 if test $_os = iOS -o $_os = Android; then
11687     # Never any point in mergelibs for these as we build just static
11688     # libraries anyway...
11689     enable_mergelibs=no
11692 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
11693     if test $_os != Linux -a $_os != WINNT; then
11694         add_warning "--enable-mergelibs is not tested for this platform"
11695     fi
11696     if test "$enable_mergelibs" = "all"; then
11697         MERGELIBS="ALL"
11698         URELIBS="TRUE"
11699     else
11700         MERGELIBS="CORE"
11701     fi
11702     AC_MSG_RESULT([yes])
11703 else
11704     AC_MSG_RESULT([no])
11706 AC_SUBST([MERGELIBS])
11707 AC_SUBST([URELIBS])
11709 # ===================================================================
11710 # Create hardlinks on deliver instead of copying for smaller size and speed up
11711 # ===================================================================
11712 AC_MSG_CHECKING([whether to create hardlinks for delivering files])
11713 HARDLINKDELIVER=
11714 if test "$enable_hardlink_deliver" = "yes"; then
11715     HARDLINKDELIVER="TRUE"
11716     AC_MSG_RESULT([yes])
11717 else
11718     AC_MSG_RESULT([no])
11720 AC_SUBST(HARDLINKDELIVER)
11722 dnl ===================================================================
11723 dnl icerun is a wrapper that stops us spawning tens of processes
11724 dnl locally - for tools that can't be executed on the compile cluster
11725 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
11726 dnl ===================================================================
11727 AC_MSG_CHECKING([whether to use icerun wrapper])
11728 ICECREAM_RUN=
11729 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
11730     ICECREAM_RUN=icerun
11731     AC_MSG_RESULT([yes])
11732 else
11733     AC_MSG_RESULT([no])
11735 AC_SUBST(ICECREAM_RUN)
11737 dnl ===================================================================
11738 dnl Setting up the environment.
11739 dnl ===================================================================
11740 echo "setting up the build environment variables..."
11742 AC_SUBST(COMPATH)
11744 if test "$build_os" = "cygwin"; then
11745     if test "$DISABLE_ACTIVEX" = "YES"; then
11746         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
11747         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
11748     else
11749         ATL_LIB="$COMPATH/atlmfc/lib"
11750         ATL_INCLUDE="$COMPATH/atlmfc/include"
11751     fi
11752     if test "$BITNESS_OVERRIDE" = 64; then
11753         ATL_LIB="$ATL_LIB/amd64"
11754     fi
11755     PathFormat "/usr/bin/grep.exe"
11756     WIN_GREP="$formatted_path"
11757     PathFormat "/usr/bin/find.exe"
11758     WIN_FIND="$formatted_path"
11759     PathFormat "/usr/bin/ls.exe"
11760     WIN_LS="$formatted_path"
11761     PathFormat "/usr/bin/touch.exe"
11762     WIN_TOUCH="$formatted_path"
11765 AC_SUBST(ATL_INCLUDE)
11766 AC_SUBST(ATL_LIB)
11767 AC_SUBST(WIN_FIND)
11768 AC_SUBST(WIN_GREP)
11769 AC_SUBST(WIN_LS)
11770 AC_SUBST(WIN_TOUCH)
11772 AC_SUBST(BUILD_TYPE)
11774 AC_SUBST(SOLARINC)
11775 AC_SUBST(SOLARLIB)
11777 PathFormat "$PERL"
11778 PERL="$formatted_path"
11779 AC_SUBST(PERL)
11781 if test -n "$TMPDIR"; then
11782     TEMP_DIRECTORY="$TMPDIR"
11783 else
11784     TEMP_DIRECTORY="/tmp"
11786 if test "$build_os" = "cygwin"; then
11787     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
11789 AC_SUBST(TEMP_DIRECTORY)
11791 # setup the PATH for the environment
11792 if test -n "$LO_PATH_FOR_BUILD"; then
11793     LO_PATH="$LO_PATH_FOR_BUILD"
11794 else
11795     LO_PATH="$PATH"
11797     case "$host_os" in
11799     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
11800         if test "$SOLAR_JAVA" != "" -a "$JDK"!="gcj"; then
11801             pathmunge "$JAVA_HOME/bin" "after"
11802         fi
11803         ;;
11805     cygwin*)
11806         pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
11807         pathmunge "$ASM_HOME" "before"
11808         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
11809         pathmunge "$CSC_PATH" "before"
11810         pathmunge "$MIDL_PATH" "before"
11811         pathmunge "$AL_PATH" "before"
11812         pathmunge "$MSPDB_PATH" "before"
11813         if test "$BITNESS_OVERRIDE" = 64; then
11814             pathmunge "$COMPATH/bin/amd64" "before"
11815             pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
11816         else
11817             pathmunge "$COMPATH/bin" "before"
11818             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
11819         fi
11820         if test "$SOLAR_JAVA" != "" -a "$JDK"!="gcj"; then
11821             if test -d "$JAVA_HOME/jre/bin/client"; then
11822                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
11823             fi
11824             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
11825                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
11826             fi
11827             pathmunge "$JAVA_HOME/bin" "before"
11828         fi
11829         ;;
11831     solaris*)
11832         pathmunge "/usr/css/bin" "before"
11833         if test "$SOLAR_JAVA" != "" -a "$JDK"!="gcj"; then
11834             pathmunge "$JAVA_HOME/bin" "after"
11835         fi
11836         ;;
11837     esac
11839     pathmunge "$SRC_ROOT/solenv/$OUTPATH/bin" "before"
11840     pathmunge "$SRC_ROOT/solenv/bin" "before"
11841     pathmunge "." "before"
11844 AC_SUBST(LO_PATH)
11846 # Generate a configuration md5 we can use for deps
11847 if test -f config_host.mk; then
11848     config_md5=`$MD5SUM config_host.mk | sed "s/ .*//"`
11851 AC_CONFIG_FILES([config_host.mk Makefile lo.xcent instsetoo_native/util/openoffice.lst])
11852 AC_CONFIG_HEADERS([config_host/config_clang.h])
11853 AC_CONFIG_HEADERS([config_host/config_features.h])
11854 AC_CONFIG_HEADERS([config_host/config_global.h])
11855 AC_CONFIG_HEADERS([config_host/config_graphite.h])
11856 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
11857 AC_CONFIG_HEADERS([config_host/config_kde4.h])
11858 AC_CONFIG_HEADERS([config_host/config_mingw.h])
11859 AC_CONFIG_HEADERS([config_host/config_oox.h])
11860 AC_CONFIG_HEADERS([config_host/config_telepathy.h])
11861 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
11862 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
11863 AC_CONFIG_HEADERS([config_host/config_version.h])
11864 AC_OUTPUT
11866 if test "$CROSS_COMPILING" = YES; then
11867     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
11870 # touch the config timestamp file
11871 if test ! -f config_host.mk.stamp; then
11872     echo > config_host.mk.stamp
11873 elif test "$config_md5" = `$MD5SUM config_host.mk | sed "s/ .*//"`; then
11874     echo "Configuration unchanged - avoiding scp2 stamp update"
11875 else
11876     echo > config_host.mk.stamp
11880 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
11881 cat << _EOS
11882 ****************************************************************************
11883 WARNING:
11884 Your make version is known to be horribly slow, and hard to debug
11885 problems with. To get a reasonably functional make please do:
11887 to install a pre-compiled binary make for cygwin
11889 mkdir -p /opt/lo/bin
11890 cd /opt/lo/bin
11891 wget http://dev-www.libreoffice.org/bin/cygwin/make
11892 chmod +x make
11894 to install from source:
11895 place yourself in a working directory of you choice.
11897 git clone git://anongit.freedesktop.org/libreoffice/contrib/dev-tools
11898 cd dev-tools/make-3.82-gbuild
11899 ./configure --prefix=/opt/lo
11900 make
11901 sudo make install
11903 Then re-run autogen.sh
11905 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
11906 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
11908 _EOS
11911 cat << _EOF
11912 ****************************************************************************
11913 To build, issue:
11914 $GNUMAKE
11916 run: $GNUMAKE help
11917 for details
11919 _EOF
11921 if test $_os != WINNT -a "$CROSS_COMPILING" != YES; then
11922     cat << _EOF
11924 To install when the build is finished, issue:
11925 $GNUMAKE install
11927 If you want to develop LibreOffice, you might prefer:
11928 $GNUMAKE dev-install
11930 If you want to run the smoketest, issue:
11931 $GNUMAKE check
11933 _EOF
11936 if test -f warn; then
11937     cat warn
11938     rm warn
11941 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: