fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / configure.ac
blobc79a4895cc176f76f30c6e7aed75e31de887270a
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.6.1.0+],[],[],[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     enable_lotuswordpro=no
569     enable_neon=no
570     enable_mpl_subset=yes
571     enable_opengl=no
572     enable_lpsolve=no
573     with_theme="tango"
574     test_cups=no
575     test_dbus=no
576     test_fontconfig=no
577     test_freetype=no
578     test_gtk=no
579     test_tde=no
580     test_kde=no
581     test_kde4=no
582     test_randr=no
583     test_xrender=no
584     test_unix_quickstarter=no
585     _os=Android
587     if test -z "$with_android_ndk"; then
588         AC_MSG_ERROR([the --with-android-ndk option is mandatory])
589     fi
591     if test -z "$with_android_ndk_toolchain_version"; then
592         AC_MSG_ERROR([the --with-android-ndk-toolchain-version option is mandatory])
593     fi
595     if test -z "$with_android_sdk"; then
596         AC_MSG_ERROR([the --with-android-sdk option is mandatory])
597     fi
599     # Verify that the NDK and SDK options are proper
600     if test ! -f "$ANDROID_NDK_HOME/platforms/android-9/arch-arm/usr/lib/libc.a"; then
601         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
602     fi
604     if test ! -d "$ANDROID_SDK_HOME/platforms"; then
605         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
606     fi
608     BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
609     ;;
612     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
613     ;;
614 esac
616 if test "$_os" = "AIX"; then
617     AC_PATH_PROG(GAWK, gawk)
618     if test -z "$GAWK"; then
619         AC_MSG_ERROR([gawk not found in \$PATH])
620     fi
623 AC_SUBST(WITH_MINGW)
624 AC_SUBST(OSVERSION)
625 AC_SUBST(PTHREAD_CFLAGS)
626 AC_SUBST(PTHREAD_LIBS)
628 ###############################################################################
629 # Extensions switches --enable/--disable
630 ###############################################################################
631 # By default these should be enabled unless having extra dependencies.
632 # If there is extra dependency over configure options then the enable should
633 # be automagic based on whether the requiring feature is enabled or not.
634 # All this options change anything only with --enable-extension-integration.
636 # The name of this option and its help string makes it sound as if
637 # extensions are built anyway, just not integrated in the installer,
638 # if you use --disable-extension-integration. Is that really the
639 # case?
641 AC_ARG_ENABLE(extension-integration,
642     AS_HELP_STRING([--disable-extension-integration],
643         [Disable integration of the built extensions in the installer of the
644          product. Use this switch to disable the integration.])
647 AC_ARG_ENABLE(export,
648     AS_HELP_STRING([--disable-export],
649         [Disable (some) code for document export. Useful when building viewer-only apps that lack
650          save/export functionality, to avoid having an excessive amount of code and data used
651          only for exporrt linked in. Work in progress, use only if you are hacking on it.])
654 AC_ARG_ENABLE(database-connectivity,
655     AS_HELP_STRING([--disable-database-connectivity],
656         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
659 # This doesn't mean not building (or "integrating") extensions
660 # (although it probably should; i.e. it should imply
661 # --disable-extension-integration I guess), it means not supporting
662 # any extension mechanism at all
663 AC_ARG_ENABLE(extensions,
664     AS_HELP_STRING([--disable-extensions],
665         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
668 AC_ARG_ENABLE(scripting,
669     AS_HELP_STRING([--disable-scripting],
670         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
673 # This is mainly for Android and iOS, but could potentially be used in some
674 # special case otherwise, too, so factored out as a separate setting
676 AC_ARG_ENABLE(dynamic-loading,
677     AS_HELP_STRING([--disable-dynamic-loading],
678         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
681 AC_ARG_ENABLE(ext-mariadb-connector,
682     AS_HELP_STRING([--enable-ext-mariadb-connector],
683         [Enable the build of the MariaDB/MySQL Connector extension.])
686 AC_ARG_ENABLE(ext-presenter-minimizer,
687     AS_HELP_STRING([--disable-ext-presenter-minimizer],
688         [Disable the Presentation Minimizer extension.])
691 AC_ARG_ENABLE(report-builder,
692     AS_HELP_STRING([--disable-report-builder],
693         [Disable the Report Builder.])
696 AC_ARG_ENABLE(ext-wiki-publisher,
697     AS_HELP_STRING([--enable-ext-wiki-publisher],
698         [Enable the Wiki Publisher extension.])
701 AC_ARG_ENABLE(lpsolve,
702     AS_HELP_STRING([--disable-lpsolve],
703         [Disable compilation of the lp solve solver ])
706 ###############################################################################
708 dnl ---------- *** ----------
710 AC_ARG_ENABLE([hardlink-deliver],
711     AS_HELP_STRING([--enable-hardlink-deliver],
712         [Put files into deliver folder as hardlinks instead of copying them
713         over. Saves space and speeds up build.])
716 AC_ARG_ENABLE(mergelibs,
717     AS_HELP_STRING([--enable-mergelibs=<all/yes>],
718         [Enables linking of big, merged, library. Experimental feature tested
719         only on Linux and Android. All will link a lot more libraries into libmerged
720         while yes or no argument will simply enable a core set of libraries.])
723 AC_ARG_ENABLE(graphite,
724     AS_HELP_STRING([--enable-graphite],
725         [Enables the compilation of Graphite smart font rendering.])
728 AC_ARG_ENABLE(fetch-external,
729     AS_HELP_STRING([--disable-fetch-external],
730         [Disables fetching external tarballs from web sources.])
733 AC_ARG_ENABLE(lockdown,
734     AS_HELP_STRING([--disable-lockdown],
735         [Disables the gconf integration work in LibreOffice.]),
738 AC_ARG_ENABLE(vba,
739     AS_HELP_STRING([--disable-vba],
740         [Disables the vba compatibility feature.])
743 AC_ARG_ENABLE(pch,
744     AS_HELP_STRING([--enable-pch],
745         [Enables precompiled header support for C++.])
748 AC_ARG_ENABLE(win-mozab-driver,
749     AS_HELP_STRING([--enable-win-mozab-driver],
750         [LibreOffice includes a driver to connect to Mozilla
751          address books under Windows, to build with this version, use this option.])
754 AC_ARG_ENABLE(epm,
755     AS_HELP_STRING([--enable-epm],
756         [LibreOffice includes self-packaging code, that requires epm, however epm is
757          useless for large scale package building.])
760 AC_ARG_ENABLE(odk,
761     AS_HELP_STRING([--disable-odk],
762         [LibreOffice includes an ODK, office development kit which some packagers may
763          wish to build without.])
766 AC_ARG_ENABLE(mpl-subset,
767     AS_HELP_STRING([--enable-mpl-subset],
768         [Don't compile any pieces which are not MPL or more liberrally licensed])
771 AC_ARG_ENABLE(evolution2,
772     AS_HELP_STRING([--enable-evolution2],
773         [Allows the built-in evolution 2 addressbook connectivity build to be
774          enabled.])
777 AC_ARG_ENABLE(directx,
778     AS_HELP_STRING([--disable-directx],
779         [Remove DirectX implementation for the new XCanvas interface.
780          The DirectX support requires more stuff installed on Windows to
781          compile. (DirectX SDK, GDI+ libs)])
784 AC_ARG_ENABLE(activex,
785     AS_HELP_STRING([--disable-activex],
786         [Disable the use of ActiveX for a Windows build.
787         This switch is mandatory when using VC++ 2008 Express.])
790 AC_ARG_ENABLE(atl,
791     AS_HELP_STRING([--disable-atl],
792         [Disable the use of ATL for a Windows build.])
793     [
794                           This switch is mandatory when using VC++ 2008 Express.
795     ],
798 AC_ARG_ENABLE(werror,
799     AS_HELP_STRING([--enable-werror],
800         [Turn warnings to errors. (Has no effect in modules where the treating
801          of warnings as errors is disabled explicitly.)]),
804 AC_ARG_ENABLE(assert-always-abort,
805     AS_HELP_STRING([--enable-assert-always-abort],
806         [make assert() abort even in release code.]),
809 AC_ARG_ENABLE(dbgutil,
810     AS_HELP_STRING([--enable-dbgutil],
811         [Provide debugging support from --enable-debug and include additional debugging
812          utilities such as object counting or more expensive checks.
813          This is the recommended option for developers.
814          Note that this makes the build ABI incompatible, it is not possible to mix object
815          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
817 AC_ARG_ENABLE(debug,
818     AS_HELP_STRING([--enable-debug],
819         [Include debugging information, disable compiler optimization and inlining plus
820          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
822 AC_ARG_ENABLE(selective-debuginfo,
823     AS_HELP_STRING([--enable-selective-debuginfo],
824         [If --enable-debug or --enable-dbgutil is used, build debugging information
825          (-g compiler flag) only for the specified gbuild build targets
826          (where all means everything, - prepended means not to enable, / appended means
827          everything in the directory; there is no ordering, more specific overrides
828          more general, and disabling takes precedence).
829          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
831 AC_ARG_ENABLE(symbols,
832     AS_HELP_STRING([--enable-symbols],
833         [Include debugging symbols in output while preserve optimization.
834          This enables -g compiler flag for GCC or equivalent,
835          without changing anything else compared to productive code.]))
837 AC_ARG_ENABLE(compiler-plugins,
838     AS_HELP_STRING([--enable-compiler-plugins],
839         [Enable compiler plugins that will perform additional checks during
840          building. Enabled automatically by --enable-dbgutil.]))
842 AC_ARG_ENABLE(linkoo,
843     AS_HELP_STRING([--disable-linkoo],
844         [Disable linkoo for the smoketest installation.]))
846 AC_ARG_ENABLE(lto,
847     AS_HELP_STRING([--enable-lto],
848         [Enable link-time optimization. Suitable for product builds.
849          Building takes longer but libraries are optimized for speed.
850          (possible only with gcc-4.5 or later,
851           better to use gcc-4.6 and 'gold' as linker)]))
853 AC_ARG_ENABLE(crashdump,
854     AS_HELP_STRING([--enable-crashdump],
855         [Enable the crashdump feature.]))
857 AC_ARG_ENABLE(python,
858     AS_HELP_STRING([--enable-python=<no/auto/system/internal>],
859         [Enables or disables Python support at run-time and build-time.
860          Also specifies what Python to use. 'auto' is the
861          default. Note that Python can be disabled with
862          --disable-python or --enable-python=no only if no
863          translations are required.]))
865 AC_ARG_ENABLE(gtk,
866     AS_HELP_STRING([--disable-gtk],
867         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
868 ,enable_gtk=yes)
870 AC_ARG_ENABLE(gtk3,
871     AS_HELP_STRING([--enable-gtk3],
872         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
873 ,enable_gtk3=no)
875 AC_ARG_ENABLE(systray,
876     AS_HELP_STRING([--disable-systray],
877         [Determines whether to build the systray quickstarter.]),
878 ,enable_systray=yes)
880 AC_ARG_ENABLE(split-app-modules,
881     AS_HELP_STRING([--enable-split-app-modules],
882         [Split file lists for app modules, e.g. base, calc.
883          Has effect only with make distro-pack-install]),
886 AC_ARG_ENABLE(split-opt-features,
887     AS_HELP_STRING([--enable-split-opt-features],
888         [Split file lists for some optional features, .e.g. pyuno, testtool.
889          Has effect only with make distro-pack-install]),
892 AC_ARG_ENABLE(cairo-canvas,
893 [  --disable-cairo-canvas  Determines whether to build the Cairo canvas on
894                           platforms where Cairo is available.
897 AC_ARG_ENABLE(opengl,
898     AS_HELP_STRING([--disable-opengl],
899         [Determines whether to build the OpenGL 3D slide transitions component.]))
901 AC_ARG_ENABLE(dbus,
902     AS_HELP_STRING([--disable-dbus],
903         [Determines whether to enable features that depend on dbus.
904          e.g. Presentation mode screensaver control, bluetooth presentation control]),
905 ,enable_dbus=yes)
907 AC_ARG_ENABLE(packagekit,
908     AS_HELP_STRING([--enable-packagekit],
909         [Determines whether to enable features using packagekit.
910          Right now that is auto font install]),
913 AC_ARG_ENABLE(sdremote,
914     AS_HELP_STRING([--disable-sdremote],
915         [Determines whether to enable Impress remote control.]),
916 ,enable_sdremote=yes)
918 AC_ARG_ENABLE(sdremote-bluetooth,
919     AS_HELP_STRING([--disable-sdremote-bluetooth],
920         [Determines whether to build sdremote with bluetooth support.
921          Requires dbus on Linux.]))
923 AC_ARG_ENABLE(gconf,
924     AS_HELP_STRING([--disable-gconf],
925         [Determines whether to use the GConf support.]),
926 ,enable_gconf=yes)
928 AC_ARG_ENABLE(gnome-vfs,
929     AS_HELP_STRING([--enable-gnome-vfs],
930         [Determines whether to use the Gnome Virtual Filing System on platforms
931          where that VFS is available.]),
932 ,enable_gnome_vfs=no)
934 AC_ARG_ENABLE(gio,
935     AS_HELP_STRING([--disable-gio],
936         [Determines whether to use the GIO support.]),
937 ,enable_gio=yes)
939 AC_ARG_ENABLE(telepathy,
940     AS_HELP_STRING([--enable-telepathy],
941         [Determines whether to enable Telepathy for collaboration.]),
942 ,enable_telepathy=no)
944 AC_ARG_ENABLE(tde,
945     AS_HELP_STRING([--enable-tde],
946         [Determines whether to use TQt/TDE vclplug on platforms where TQt and
947          TDE are available.]),
950 AC_ARG_ENABLE(tdeab,
951     AS_HELP_STRING([--disable-tdeab],
952         [Disable the TDE address book support.]),
954     if test "$enable_tde" = "yes"; then
955         enable_tdeab=yes
956     fi
959 AC_ARG_ENABLE(kde,
960     AS_HELP_STRING([--enable-kde],
961         [Determines whether to use Qt3/KDE3 vclplug on platforms where Qt3 and
962          KDE3 are available.]),
965 AC_ARG_ENABLE(kdeab,
966     AS_HELP_STRING([--disable-kdeab],
967         [Disable the KDE3 address book support.]),
969     if test "$enable_kde" = "yes"; then
970         enable_kdeab=yes
971     fi
974 AC_ARG_ENABLE(kde4,
975     AS_HELP_STRING([--enable-kde4],
976         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
977          KDE4 are available. May be used with --enable-kde if you want to support
978          both KDE3 and KDE4.]),
981 AC_ARG_ENABLE(headless,
982     AS_HELP_STRING([--enable-headless],
983         [Disable building of GUIs to reduce dependencies. Useful for
984         server usage. Work in progress, use only if you are hacking on
985         it. Not related to the --headless option.]), ,)
987 AC_ARG_ENABLE(rpath,
988     AS_HELP_STRING([--disable-rpath],
989         [Disable the use of relative paths in shared libraries.]),
992 AC_ARG_ENABLE(randr,
993     AS_HELP_STRING([--disable-randr],
994         [Disable RandR support in the vcl project.]),
995 ,enable_randr=yes)
997 AC_ARG_ENABLE(randr-link,
998     AS_HELP_STRING([--disable-randr-link],
999         [Disable linking with libXrandr, instead dynamically open it at runtime.]),
1000 ,enable_randr_link=yes)
1002 AC_ARG_ENABLE(gstreamer,
1003     AS_HELP_STRING([--enable-gstreamer],
1004         [Enable building with the new gstreamer 1.0 avmedia backend.]),
1005 ,enable_gstreamer=no)
1007 AC_ARG_ENABLE(gstreamer-0-10,
1008     AS_HELP_STRING([--disable-gstreamer-0-10],
1009         [Disable building the gstreamer avmedia backend.]),
1010 ,enable_gstreamer_0_10=yes)
1012 AC_ARG_ENABLE(neon,
1013     AS_HELP_STRING([--disable-neon],
1014         [Disable neon and the compilation of webdav binding.]),
1017 AC_ARG_ENABLE(cve-tests,
1018     AS_HELP_STRING([--disable-cve-tests],
1019         [Prevent CVE tests to be executed]),
1022 AC_ARG_ENABLE(build-unowinreg,
1023     AS_HELP_STRING([--enable-build-unowinreg],
1024         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1025          compiler is needed on Linux.])
1026     [
1027                           Usage:     --enable-build-unowinreg
1028     ],
1031 AC_ARG_ENABLE(verbose,
1032     AS_HELP_STRING([--enable-verbose],
1033         [Increase build verbosity.])[
1034   --disable-verbose       Decrease build verbosity.],
1037 AC_ARG_ENABLE(dependency-tracking,
1038     AS_HELP_STRING([--enable-dependency-tracking],
1039         [Do not reject slow dependency extractors.])[
1040   --disable-dependency-tracking
1041                           Disables generation of dependency information.
1042                           Speed up one-time builds.],
1045 AC_ARG_ENABLE(icecream,
1046     AS_HELP_STRING([--enable-icecream],
1047         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1048          It defaults to /opt/icecream for the location of the icecream gcc/g++
1049          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1052 AC_ARG_ENABLE(cups,
1053     AS_HELP_STRING([--disable-cups],
1054         [Do not build cups support.])
1057 AC_ARG_ENABLE(ccache,
1058     AS_HELP_STRING([--disable-ccache],
1059         [Do not try to use ccache automatically.
1060          By default, we will try to detect if ccache is available; in that case if
1061          CC/CXX are not yet set, and --enable-icecream is not given, we
1062          attempt to use ccache. --disable-ccache disables ccache completely.
1066 AC_ARG_ENABLE(64-bit,
1067     AS_HELP_STRING([--enable-64-bit],
1068         [Build a 64-bit LibreOffice on platforms where the normal and only supported build
1069          is 32-bit. In other words, this option is experimental and possibly quite broken,
1070          use only if you are hacking on 64-bit support.]), ,)
1072 AC_ARG_ENABLE(extra-gallery,
1073     AS_HELP_STRING([--enable-extra-gallery],
1074         [Add extra gallery content.]),
1077 AC_ARG_ENABLE(extra-template,
1078     AS_HELP_STRING([--enable-extra-template],
1079         [Add extra template content.]),
1082 AC_ARG_ENABLE(extra-sample,
1083     AS_HELP_STRING([--enable-extra-sample],
1084         [Add extra sample content.]),
1087 AC_ARG_ENABLE(extra-font,
1088     AS_HELP_STRING([--enable-extra-font],
1089         [Add extra font content.]),
1092 AC_ARG_ENABLE(online-update,
1093     AS_HELP_STRING([--enable-online-update],
1094         [Enable the online update service that will check for new versions of
1095          LibreOffice. By default, it is on on Windows and Mac, and off on Linux.]),
1098 AC_ARG_ENABLE(release-build,
1099     AS_HELP_STRING([--enable-release-build],
1100         [Enable release build.
1101          See http://wiki.documentfoundation.org/DevBuild]),
1104 AC_ARG_ENABLE(windows-build-signing,
1105     AS_HELP_STRING([--enable-windows-build-signing],
1106         [Enable signing of windows binaries (*.exe, *.dll)]),
1109 AC_ARG_ENABLE(silent-msi,
1110     AS_HELP_STRING([--enable-silent-msi],
1111         [Enable MSI with LIMITUI=1 (silent install).]),
1114 AC_ARG_ENABLE(desktop-gui-elements,
1115     AS_HELP_STRING([--enable-desktop-gui-elements],
1116         [Enable display and use of desktop style GUI elements
1117          even on a non-desktop platform.]),
1120 AC_ARG_ENABLE(macosx-code-signing,
1121     AS_HELP_STRING([--enable-macosx-code-signing<=identity>],
1122         [Sign executables, dylibs, frameworks and the app bundle. The
1123          default is to do signing if there is a suitable certificate
1124          in your keychain, so if you don't want that, use the
1125          corresponding --disable option. Experimental work in
1126          progress, don't use unless you are working on this.]),
1129 AC_ARG_ENABLE(macosx-sandbox,
1130     AS_HELP_STRING([--enable-macosx-sandbox],
1131         [Make the app bundle run in a sandbox. Requires code signing.
1132          The default is to not do this. Experimental work in progress,
1133          don't use unless you are working on this.]),
1136 AC_ARG_WITH(macosx-bundle-identifier,
1137     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1138         [Define the OS X bundle identifier. Default is the somewhat weird
1139          org.libreoffice.script ("script", huh?).]),
1140 ,with_macosx_bundle_identifier=org.libreoffice.script)
1142 AC_ARG_ENABLE(ios-simulator,
1143     AS_HELP_STRING([--enable-ios-simulator],
1144         [Build for the iOS Simulator, not iOS device.]),
1147 AC_ARG_ENABLE(readonly-installset,
1148     AS_HELP_STRING([--enable-readonly-installset],
1149         [Prevents any attempts by LibreOffice to write into its installation. That means
1150          at least that no "system-wide" extensions can be added. Experimental work in
1151          progress.]),
1154 AC_ARG_ENABLE(postgresql-sdbc,
1155     AS_HELP_STRING([--disable-postgresql-sdbc],
1156         [Disable the build of the PostgreSQL-SDBC driver.])
1159 AC_ARG_ENABLE(lotuswordpro,
1160     AS_HELP_STRING([--disable-lotuswordpro],
1161         [Disable the build of the Lotus Word Pro filter.]),
1162 ,enable_lotuswordpro=yes)
1164 AC_ARG_ENABLE(coretext,
1165     AS_HELP_STRING([--enable-coretext],
1166         [Use CoreText framework on Mac (instead of ATSU).
1167         Known to not work properly, use only if you plan to work on that.]),
1170 AC_ARG_ENABLE(winegcc,
1171     AS_HELP_STRING([--enable-winegcc],
1172         [Enable use of winegcc during the build, in order to create msi* tools
1173          needed for MinGW cross-compilation.]),
1176 AC_ARG_ENABLE(liblangtag,
1177     AS_HELP_STRING([--disable-liblangtag],
1178         [Disable use of liblangtag, and instead use an own simple
1179          implementation.]),
1182 AC_ARG_ENABLE(bogus-pkg-config,
1183     AS_HELP_STRING([--enable-bogus-pkg-config],
1184         [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.]),
1187 AC_ARG_ENABLE(openssl,
1188     AS_HELP_STRING([--disable-openssl],
1189         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1190          components will either use GNUTLS or NSS. Work in progress,
1191          use only if you are hacking on it.]),
1192 ,enable_openssl=yes)
1194 dnl ===================================================================
1195 dnl Optional Packages (--with/without-)
1196 dnl ===================================================================
1198 AC_ARG_WITH(gnu-patch,
1199     AS_HELP_STRING([--with-gnu-patch],
1200         [Specify location of GNU patch on Solaris or FreeBSD.]),
1203 AC_ARG_WITH(build-platform-configure-options,
1204         [Specify options for the configure script run for the *build* platform in a cross-compilation])
1206 AC_ARG_WITH(gnu-cp,
1207     AS_HELP_STRING([--with-gnu-cp],
1208         [Specify location of GNU cp on Solaris or FreeBSD.]),
1211 AC_ARG_WITH(external-tar,
1212     AS_HELP_STRING([--with-external-tar=<TARFILE PATH>],
1213         [Specify path to tarfiles manually.]),
1214     TARFILE_LOCATION=$withval ,
1217 AC_ARG_WITH(solver-and-workdir-root,
1218     AS_HELP_STRING([--with-solver-and-workdir-root=<PATH>],
1219         [Specify path that contains SOLARVER and WORKDIR directories manually.])
1222 AC_ARG_WITH(referenced-git,
1223     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1224         [Specify another checkout directory to reference. This makes use of
1225                  git submodule update --reference, and saves a lot of diskspace
1226                  when having multiple trees side-by-side.]),
1227     GIT_REFERENCE_SRC=$withval ,
1230 AC_ARG_WITH(galleries,
1231     AS_HELP_STRING([--with-galleries],
1232         [Specify how galleries should be built. It is possible either to
1233          build these internally from source ("build"), or to (optionally
1234          download and) unpack them them from a package ("package"), or
1235          to disable them ("no")]),
1238 AC_ARG_WITH(theme,
1239     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1240         [Choose which themes to include. By default those themes with an '*' are included.
1241          Possible choices: *crystal, *default (galaxy), *hicontrast, human, industrial, *oxygen, *tango, *tango_testing.]),
1244 AC_ARG_WITH(helppack-integration,
1246   --without-helppack-integration      It will not integrate the helppacks to the installer
1247                           of the product.
1248                           Please use this switch to use the online help or separate help packages.],
1251 AC_ARG_WITH(fonts,
1252     AS_HELP_STRING([--without-fonts],
1253         [LibreOffice includes some third-party fonts to provide a reliable basis for
1254          help content, templates, samples, etc. When these fonts are already
1255          known to be available on the system then you should use this option.]),
1258 AC_ARG_WITH(ppds,
1259     AS_HELP_STRING([--without-ppds],
1260         [Removes Postscript Printer definition files from LibreOffice
1261          installation set, for people building for specific distributions where
1262          PPDs are known to be already available (every recent distro with CUPS backend).]),
1265 AC_ARG_WITH(afms,
1266     AS_HELP_STRING([--without-afms],
1267         [Removes bitmap font files from LibreOffice installation set, for people
1268          building for specific distributions where AFM files or TrueType Fonts
1269          are known to be available.]),
1272 AC_ARG_WITH(epm,
1273     AS_HELP_STRING([--with-epm],
1274         [Decides which epm to use. Default is to use the one from the system if
1275          one is built. When either this is not there or you say =internal epm
1276          will be built.]),
1279 AC_ARG_WITH(package-format,
1280     AS_HELP_STRING([--with-package-format],
1281         [Specify package format(s) for LibreOffice installsets. Default is the
1282          "normal" one of the OS/Distribution. Possible values: aix, bsd, deb,
1283          inst, tardist, osx, pkg, rpm, setld, native, portable, archive, dmg,
1284           installed, msi. Example: --with-package-format="deb dmg"]),
1287 AC_ARG_WITH(tls,
1288     AS_HELP_STRING([--with-tls],
1289         [Decides which TLS/SSL and cryptographic implementations to use for
1290          LibreOffice's code. Notice that this doesn't apply for depending
1291          libraries like "neon", for example. Default is to use OpenSSL
1292          although NSS is also possible. Notice that selecting NSS restricts
1293          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1294          restrict by now the usage of NSS in LO's code. Possible values:
1295          openssl, nss. Example: --with-tls="nss"]),
1298 AC_ARG_WITH(system-libs,
1299     AS_HELP_STRING([--with-system-libs],
1300         [Use libraries already on system -- enables all --with-system-* flags.]),
1303 AC_ARG_WITH(system-headers,
1304     AS_HELP_STRING([--with-system-headers],
1305         [Use headers already on system -- enables all --with-system-* flags for
1306          external packages whose headers are the only entities used i.e.
1307          boost/vigra/odbc/sane-header(s).]),,
1308     [with_system_headers="$with_system_libs"])
1310 AC_ARG_WITH(system-jars,
1311     AS_HELP_STRING([--without-system-jars],
1312         [When building with --with-system-libs, also the needed jars are expected
1313          on the system. Use this to disable that]),,
1314     [with_system_jars="$with_system_libs"])
1316 AC_ARG_WITH(system-cairo,
1317     AS_HELP_STRING([--with-system-cairo],
1318         [Use Cairo libraries already on system.]),,
1319     [with_system_cairo="$with_system_libs"])
1321 AC_ARG_WITH(myspell-dicts,
1322     AS_HELP_STRING([--with-myspell-dicts],
1323         [Adds myspell dictionaries to the LibreOffice installation set]),
1326 AC_ARG_WITH(system-dicts,
1327     AS_HELP_STRING([--without-system-dicts],
1328         [Do not use dictionaries from system paths.]),
1331 AC_ARG_WITH(external-dict-dir,
1332     AS_HELP_STRING([--with-external-dict-dir],
1333         [Specify external dictionary dir.]),
1336 AC_ARG_WITH(external-hyph-dir,
1337     AS_HELP_STRING([--with-external-hyph-dir],
1338         [Specify external hyphenation pattern dir.]),
1341 AC_ARG_WITH(external-thes-dir,
1342     AS_HELP_STRING([--with-external-thes-dir],
1343         [Specify external thesaurus dir.]),
1346 AC_ARG_WITH(system-zlib,
1347     AS_HELP_STRING([--with-system-zlib],
1348         [Use zlib already on system.]),,
1349     [with_system_zlib=auto])
1351 AC_ARG_WITH(system-jpeg,
1352     AS_HELP_STRING([--with-system-jpeg],
1353         [Use jpeg already on system.]),,
1354     [with_system_jpeg=auto])
1356 AC_ARG_WITH(system-clucene,
1357     AS_HELP_STRING([--with-system-clucene],
1358         [Use clucene already on system.]),,
1359     [with_system_clucene="$with_system_libs"])
1361 AC_ARG_WITH(system-expat,
1362     AS_HELP_STRING([--with-system-expat],
1363         [Use expat already on system.]),,
1364     [with_system_expat="$with_system_libs"])
1366 AC_ARG_WITH(system-libxml,
1367     AS_HELP_STRING([--with-system-libxml],
1368         [Use libxml/libxslt already on system.]),,
1369     [with_system_libxml=auto])
1371 AC_ARG_WITH(system-icu,
1372     AS_HELP_STRING([--with-system-icu],
1373         [Use icu already on system.]),,
1374     [with_system_icu="$with_system_libs"])
1376 AC_ARG_WITH(system-ucpp,
1377     AS_HELP_STRING([--with-system-ucpp],
1378         [Use ucpp already on system.]),,
1379     [])
1381 AC_ARG_WITH(system-openldap,
1382     AS_HELP_STRING([--with-system-openldap],
1383         [Use the OpenLDAP LDAP SDK already on system.]),,
1384     [with_system_openldap="$with_system_libs"])
1386 AC_ARG_WITH(system-poppler,
1387     AS_HELP_STRING([--with-system-poppler],
1388         [Use system poppler (only needed for PDF import).]),,
1389     [with_system_poppler="$with_system_libs"])
1391 AC_ARG_WITH(system-apache-commons,
1392     AS_HELP_STRING([--with-system-apache-commons],
1393         [Use Apache commons libraries already on system.]),,
1394     [with_system_apache_commons="$with_system_jars"])
1396 AC_ARG_WITH(system-mariadb,
1397     AS_HELP_STRING([--with-system-mariadb],
1398         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1399          extension.]),,
1400     [with_system_mariadb="$with_system_libs"])
1402 AC_ARG_ENABLE(bundle-mariadb,
1403     AS_HELP_STRING([--enable-bundle-mariadb],
1404         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1407 AC_ARG_WITH(system-mysql-cppconn,
1408     AS_HELP_STRING([--with-system-mysql-cppconn],
1409         [Use MySQL C++ Connector libraries already on system.]),,
1410     [with_system_mysql_cppconn="$with_system_libs"])
1412 AC_ARG_WITH(system-postgresql,
1413     AS_HELP_STRING([--with-system-postgresql],
1414         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1415          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1416     [with_system_postgresql="$with_system_libs"])
1418 AC_ARG_WITH(libpq-path,
1419     AS_HELP_STRING([--with-libpq-path],
1420         [Use this PostgreSQL C interface (libpq) installation for building
1421          the PostgreSQL-SDBC extension.])
1422     [
1423                           Usage:     --with-libpq-path=<absolute path to
1424                                                   your libpq installation>
1425     ],
1428 AC_ARG_WITH(system-hsqldb,
1429     AS_HELP_STRING([--with-system-hsqldb],
1430         [Use hsqldb already on system.]))
1432 AC_ARG_WITH(hsqldb-jar,
1433     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1434         [Specify path to jarfile manually.]),
1435     HSQLDB_JAR=$withval)
1437 AC_ARG_ENABLE(scripting-beanshell,
1438     AS_HELP_STRING([--disable-scripting-beanshell],
1439         [Disable support for scripts in BeanShell.]),
1443 AC_ARG_WITH(system-beanshell,
1444     AS_HELP_STRING([--with-system-beanshell],
1445         [Use beanshell already on system.]),,
1446     [with_system_beanshell="$with_system_jars"])
1448 AC_ARG_WITH(beanshell-jar,
1449     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1450         [Specify path to jarfile manually.]),
1451     BSH_JAR=$withval)
1453 AC_ARG_ENABLE(scripting-javascript,
1454     AS_HELP_STRING([--disable-scripting-javascript],
1455         [Disable support for scripts in JavaScript.]),
1459 AC_ARG_WITH(system-rhino,
1460     AS_HELP_STRING([--with-system-rhino],
1461         [Use rhino already on system.]),,)
1462 #    [with_system_rhino="$with_system_jars"])
1463 # Above is not used as we have different debug interface
1464 # patched into internal rhino. This code needs to be fixed
1465 # before we can enable it by default.
1467 AC_ARG_WITH(rhino-jar,
1468     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1469         [Specify path to jarfile manually.]),
1470     RHINO_JAR=$withval)
1472 AC_ARG_WITH(commons-codec-jar,
1473     AS_HELP_STRING([--with-commons-codec-jar=JARFILE],
1474         [Specify path to jarfile manually.]),
1475     COMMONS_CODEC_JAR=$withval)
1477 AC_ARG_WITH(commons-lang-jar,
1478     AS_HELP_STRING([--with-commons-lang-jar=JARFILE],
1479         [Specify path to jarfile manually.]),
1480     COMMONS_LANG_JAR=$withval)
1482 AC_ARG_WITH(commons-httpclient-jar,
1483     AS_HELP_STRING([--with-commons-httpclient-jar=JARFILE],
1484         [Specify path to jarfile manually.]),
1485     COMMONS_HTTPCLIENT_JAR=$withval)
1487 AC_ARG_WITH(commons-logging-jar,
1488     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1489         [Specify path to jarfile manually.]),
1490     COMMONS_LOGGING_JAR=$withval)
1492 AC_ARG_WITH(system-servlet-api,
1493     AS_HELP_STRING([--with-system-servlet-api],
1494         [Use servlet-api already on system.]),,
1495     [with_system_servlet_api="$with_system_jars"])
1497 AC_ARG_WITH(servlet-api-jar,
1498     AS_HELP_STRING([--with-servlet-api-jar=JARFILE],
1499         [Specify path to jarfile manually.]),
1500     SERVLETAPI_JAR=$withval)
1502 AC_ARG_WITH(system-jfreereport,
1503     AS_HELP_STRING([--with-system-jfreereport],
1504         [Use JFreeReport already on system.]),,
1505     [with_system_jfreereport="$with_system_jars"])
1507 AC_ARG_WITH(sac-jar,
1508     AS_HELP_STRING([--with-sac-jar=JARFILE],
1509         [Specify path to jarfile manually.]),
1510     SAC_JAR=$withval)
1512 AC_ARG_WITH(libxml-jar,
1513     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1514         [Specify path to jarfile manually.]),
1515     LIBXML_JAR=$withval)
1517 AC_ARG_WITH(flute-jar,
1518     AS_HELP_STRING([--with-flute-jar=JARFILE],
1519         [Specify path to jarfile manually.]),
1520     FLUTE_JAR=$withval)
1522 AC_ARG_WITH(jfreereport-jar,
1523     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1524         [Specify path to jarfile manually.]),
1525     JFREEREPORT_JAR=$withval)
1527 AC_ARG_WITH(liblayout-jar,
1528     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1529         [Specify path to jarfile manually.]),
1530     LIBLAYOUT_JAR=$withval)
1532 AC_ARG_WITH(libloader-jar,
1533     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1534         [Specify path to jarfile manually.]),
1535     LIBLOADER_JAR=$withval)
1537 AC_ARG_WITH(libloader-jar,
1538     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1539         [Specify path to jarfile manually.]),
1540     LIBLOADER_JAR=$withval)
1542 AC_ARG_WITH(libformula-jar,
1543     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1544         [Specify path to jarfile manually.]),
1545     LIBFORMULA_JAR=$withval)
1547 AC_ARG_WITH(librepository-jar,
1548     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1549         [Specify path to jarfile manually.]),
1550     LIBREPOSITORY_JAR=$withval)
1552 AC_ARG_WITH(libfonts-jar,
1553     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1554         [Specify path to jarfile manually.]),
1555     LIBFONTS_JAR=$withval)
1557 AC_ARG_WITH(libserializer-jar,
1558     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1559         [Specify path to jarfile manually.]),
1560     LIBSERIALIZER_JAR=$withval)
1562 AC_ARG_WITH(libbase-jar,
1563     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1564         [Specify path to jarfile manually.]),
1565     LIBBASE_JAR=$withval)
1567 AC_ARG_WITH(system-odbc,
1568     AS_HELP_STRING([--with-system-odbc],
1569         [Use the odbc headers already on system.]),,
1570     [with_system_odbc="$with_system_headers"])
1572 AC_ARG_WITH(system-sane,
1573     AS_HELP_STRING([--with-system-sane],
1574         [Use sane.h already on system.]),,
1575     [with_system_sane="$with_system_headers"])
1577 AC_ARG_WITH(system-bluez,
1578     AS_HELP_STRING([--with-system-bluez],
1579         [Use bluetooth.h already on system.]),,
1580     [with_system_bluez="$with_system_headers"])
1582 AC_ARG_WITH(system-xextensions-headers,
1583     AS_HELP_STRING([--with-system-xextensions-headers],
1584         [To build without system X11 extensions headers, use
1585          --without-system-xextensions-headers. This is possibly
1586          useful on legacy unix systems which ship with the libs
1587          but without the headers.]))
1589 AC_ARG_WITH(system-mesa-headers,
1590     AS_HELP_STRING([--with-system-mesa-headers],
1591         [Use Mesa headers already on system.]),,
1592     [with_system_mesa_headers="$with_system_headers"])
1594 AC_ARG_WITH(system-curl,
1595     AS_HELP_STRING([--with-system-curl],
1596         [Use curl already on system.]),,
1597     [with_system_curl=auto])
1599 AC_ARG_WITH(system-boost,
1600     AS_HELP_STRING([--with-system-boost],
1601         [Use boost already on system.]),,
1602     [with_system_boost="$with_system_headers"])
1604 AC_ARG_WITH(system-vigra,
1605     AS_HELP_STRING([--with-system-vigra],
1606         [Use vigra already on system.]),,
1607     [with_system_vigra="$with_system_headers"])
1609 AC_ARG_WITH(system-hunspell,
1610     AS_HELP_STRING([--with-system-hunspell],
1611         [Use libhunspell already on system.]),,
1612     [with_system_hunspell="$with_system_libs"])
1614 AC_ARG_WITH(system-mythes,
1615     AS_HELP_STRING([--with-system-mythes],
1616         [Use mythes already on system.]),,
1617     [with_system_mythes="$with_system_libs"])
1619 AC_ARG_WITH(system-altlinuxhyph,
1620     AS_HELP_STRING([--with-system-altlinuxhyph],
1621         [Use ALTLinuxhyph already on system.]),,
1622     [with_system_altlinuxhyph="$with_system_libs"])
1624 AC_ARG_WITH(system-lpsolve,
1625     AS_HELP_STRING([--with-system-lpsolve],
1626         [Use lpsolve already on system.]),,
1627     [with_system_lpsolve="$with_system_libs"])
1629 AC_ARG_WITH(system-liblangtag,
1630     AS_HELP_STRING([--with-system-liblangtag],
1631         [Use liblangtag library already on system.]),,
1632     [with_system_liblangtag="$with_system_libs"])
1634 AC_ARG_WITH(system-npapi-headers,
1635     AS_HELP_STRING([--with-system-npapi-headers],
1636         [Use NPAPI headers provided by system instead of bundled ones. Used in
1637          extensions/source/nsplugin (ENABLE_NPAPI_INTO_BROWSER=YES) and
1638          extensions/source/plugin (ENABLE_NPAPI_FROM_BROWSER=YES)]),,
1639     [with_system_npapi_headers="$with_system_headers"]
1642 AC_ARG_WITH(linker-hash-style,
1643     AS_HELP_STRING([--with-linker-hash-style],
1644         [Use linker with --hash-style=<style> when linking shared objects.
1645          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1646          if supported on the build system, and "sysv" otherwise.]))
1648 AC_ARG_WITH(jdk-home,
1649     AS_HELP_STRING([--with-jdk-home],
1650         [If you have installed JDK 1.3 or later on your system please supply the
1651          path here. Note that this is not the location of the java command but the
1652          location of the entire distribution.])
1653     [
1654                           Usage:     --with-jdk-home=<absolute path to JDK home>
1655     ],
1658 AC_ARG_WITH(help,
1659     AS_HELP_STRING([--with-help],
1660         [Enable the build of help.]))
1662 AC_ARG_WITH(java,
1663     AS_HELP_STRING([--with-java],
1664         [Specify the name of the Java interpreter command. Typically "java"
1665          which is the default.
1667          To build without support for Java components, applets, accessibility
1668          or the XML filters written in Java, use --without-java or --with-java=no.])
1669     [
1670                           Usage:     --with-java==<java command>
1671                                      --without-java
1672     ],
1673     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1674     [ with_java=java ]
1677 AC_ARG_WITH(jvm-path,
1678     AS_HELP_STRING([--with-jvm-path],
1679         [Use a specific JVM search path at runtime.])
1680     [
1681                           Usage:     --with-jvm-path=<absolute path to parent of jvm home>
1683                           e. g.: --with-jvm-path=/usr/lib/
1684                                  to find JRE/JDK in /usr/lib/jvm/
1685     ],
1688 AC_ARG_WITH(ant-home,
1689     AS_HELP_STRING([--with-ant-home],
1690         [If you have installed Jakarta Ant on your system, please supply the path here.
1691          Note that this is not the location of the Ant binary but the location
1692          of the entire distribution.])
1693     [
1694                           Usage:     --with-ant-home=<absolute path to Ant home>
1695     ],
1698 AC_ARG_WITH(junit,
1699     AS_HELP_STRING([--with-junit],
1700         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
1701          --without-junit disables those tests. Not relevant in the --without-java case.])
1702     [
1703                           Usage:     --with-junit=<absolute path to JUnit 4 jar>
1704     ],
1705 ,with_junit=yes)
1707 AC_ARG_WITH(perl-home,
1708     AS_HELP_STRING([--with-perl-home],
1709         [If you have installed Perl 5 Distribution, on your system, please
1710          supply the path here. Note that this is not the location of the Perl
1711          binary but the location of the entire distribution.])
1712     [
1713                           Usage:     --with-perl-home=<abs. path to Perl 5 home>
1714     ],
1717 AC_ARG_WITH(
1718     [doxygen],
1719     AS_HELP_STRING(
1720         [--with-doxygen],
1721         [Specifies the doxygen executable to use when generating ODK C/C++
1722          documentation. --without-doxygen disables generation of ODK C/C++
1723          documentation. Not relevant in the --disable-odk case.])
1724     [
1725                           Usage:     --with-doxygen=<absolute path to doxygen executable>
1726     ],,
1727     [with_doxygen=yes])
1729 AC_ARG_WITH(visual-studio,
1730     AS_HELP_STRING([--with-visual-studio=<2012/2010/2008>],
1731         [Specify which Visual Studio version to use in case several are
1732          are installed. If not specified, the order of preference is
1733          2012, 2010 and 2008 (including Express editions).])
1734     [
1735                           Usage:     --with-visual-studio=<2012/2010/2008>
1736     ],
1739 AC_ARG_WITH(windows-sdk,
1740     AS_HELP_STRING([--with-windows-sdk=<6.0(A)/7.0(A)/7.1(A)/8.0(A)>],
1741         [Specify which Windows SDK, or "Windows Kit", version to use
1742          in case the one that came with the selected Visual Studio
1743          is not what you want for some reason. Note that not all compiler/SDK
1744          combinations are supported. The intent is that this option should not
1745          be needed.])
1746     [
1747                           Usage:     --with-windows-sdk=6.0(A)/7.0(A)/7.1(A)/8.0(A)>
1748     ],
1751 AC_ARG_WITH(lang,
1752     AS_HELP_STRING([--with-lang],
1753         [Use this option to build LibreOffice with additional language support.
1754          English (US) is always included by default.
1755          Separate multiple languages with space.
1756          For all languages, use --with-lang=ALL.])
1757     [
1758                           Usage:     --with-lang="es sw tu cs sk"
1759     ],
1762 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
1763 AC_ARG_WITH(krb5,
1764     AS_HELP_STRING([--with-krb5],
1765         [Enable MIT Kerberos 5 support in modules that support it.
1766          By default automatically enabled on platforms
1767          where a good system Kerberos 5 is available.]),
1770 AC_ARG_WITH(gssapi,
1771     AS_HELP_STRING([--with-gssapi],
1772         [Enable GSSAPI support in modules that support it.
1773          By default automatically enabled on platforms
1774          where a good system GSSAPI is available.]),
1777 dnl ===================================================================
1778 dnl Branding
1779 dnl ===================================================================
1781 AC_ARG_WITH(branding,
1782     AS_HELP_STRING([--with-branding],
1783         [Use given path to retrieve branding images set.])
1784     [
1785                           Search for intro.png about.svg flat_logo.svg 
1786                           backing_left.png backing_right.png 
1787                           backing_rtl_left.png backing_rtl_right.png 
1788                           backing_space.png. If any is missing, default
1789                           ones will be used instead.
1791                           Search also progress.conf for progress 
1792                           settings on intro screen :
1794                           PROGRESSBARCOLOR="255,255,255" Set color of 
1795                           progress bar. Comma separated RGB decimal values.
1796                           PROGRESSSIZE="407,6" Set size of progress bar. 
1797                           Comma separated decimal values (width, height).
1798                           PROGRESSPOSITION="61,317" Set position of progress
1799                           bar from left,top. Comma separated decimal values.
1800                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
1801                           bar frame. Comma separated RGB decimal values.
1802                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress 
1803                           bar text. Comma separated RGB decimal values.
1804                           PROGRESSTEXTBASELINE="287" Set vertical position of 
1805                           progress bar text from top. Decimal value.
1807                           Default values will be used if not found.
1809                           Usage:     --with-branding=/path/to/images
1810     ],
1814 AC_ARG_WITH(extra-buildid,
1815     AS_HELP_STRING([--with-extra-buildid],
1816         [Show addition build identification in about dialog.])
1817     [
1818                           Usage:     --with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"
1819     ],
1823 AC_ARG_WITH(vendor,
1824     AS_HELP_STRING([--with-vendor],
1825         [Set vendor of the build.])
1826     [
1827                           Usage:     --with-vendor="John the Builder"
1828     ],
1831 AC_ARG_WITH(compat-oowrappers,
1832     AS_HELP_STRING([--with-compat-oowrappers],
1833         [Install oo* wrappers in parallel with
1834          lo* ones to keep backward compatibility.
1835          Has effect only with make distro-pack-install]),
1838 AC_ARG_WITH(os-version,
1839     AS_HELP_STRING([--with-os-version],
1840         [For FreeBSD users, use this option option to override the detected OSVERSION.])
1841     [
1842                           Usage:     --with-os-version=<OSVERSION>
1843     ],
1846 AC_ARG_WITH(mingw-cross-compiler,
1847     AS_HELP_STRING([--with-mingw-cross-compiler],
1848         [Specify the MinGW cross-compiler to use.])
1849     [
1850                           Usage:     --with-mingw-cross-compiler=<mingw32-g++ command>
1852                           When building on the ODK on Unix and building unowinreg.dll,
1853                           specify the MinGW C++ cross-compiler.
1854     ],
1857 AC_ARG_WITH(idlc-cpp,
1858     AS_HELP_STRING([--with-idlc-cpp],
1859         [Specify the C Preprocessor to use for idlc.])
1860     [
1861                           Usage:     --with-idlc-cpp=cpp
1863                           Default is ucpp.
1864     ]
1867 AC_ARG_WITH(build-version,
1868     AS_HELP_STRING([--with-build-version],
1869         [Allows the builder to add a custom version tag that will appear in the
1870          Help/About box for QA purposes.])
1871     [
1872                           Usage:     --with-build-version="Built by Jim"
1873     ],
1874     with_build_version=$withval ,
1877 AC_ARG_WITH(alloc,
1878     AS_HELP_STRING([--with-alloc],
1879         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
1880          Note that on FreeBSD/NetBSD system==jemalloc]),
1883 AC_ARG_WITH(sun-templates,
1884     AS_HELP_STRING([--with-sun-templates],
1885         [Integrate Sun template packages.]),
1888 AC_ARG_WITH(parallelism,
1889     AS_HELP_STRING([--with-parallelism],
1890         [Number of jobs to run simultaneously during build. Parallel builds can
1891         save a lot of time on multi-cpu machines. Defaults to the number of
1892         CPUs on the machine, unless you configure --enable-icecream - then to
1893         10.]),
1896 AC_ARG_WITH(check-jobs,
1897     AS_HELP_STRING([--with-check-jobs],
1898         [Maximum number of jobs that will be issued at the same time during 'make subsequenttest'.
1899          Default value is the same as 'parallelism'. Useful because the subsequent tests are very lightweight.]),
1902 AC_ARG_WITH(all-tarballs,
1903     AS_HELP_STRING([--with-all-tarballs],
1904         [Download all external tarballs unconditionally]))
1906 dnl ===================================================================
1907 dnl Test whether build target is Release Build
1908 dnl ===================================================================
1909 AC_MSG_CHECKING([whether build target is Release Build])
1910 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
1911     AC_MSG_RESULT([no])
1912     ENABLE_RELEASE_BUILD="FALSE"
1913 else
1914     AC_MSG_RESULT([yes])
1915     ENABLE_RELEASE_BUILD="TRUE"
1917 AC_SUBST(ENABLE_RELEASE_BUILD)
1919 dnl ===================================================================
1920 dnl Test whether to sign Windows Build
1921 dnl ===================================================================
1922 AC_MSG_CHECKING([whether to sign windows build])
1923 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT" -a "$WITH_MINGW" != "YES" ; then
1924     AC_MSG_RESULT([yes])
1925     WINDOWS_BUILD_SIGNING="TRUE"
1926 else
1927     AC_MSG_RESULT([no])
1928     WINDOWS_BUILD_SIGNING="FALSE"
1930 AC_SUBST(WINDOWS_BUILD_SIGNING)
1932 dnl ===================================================================
1933 dnl MacOSX build and runtime environment options
1934 dnl ===================================================================
1936 AC_ARG_WITH(macosx-sdk,
1937     AS_HELP_STRING([--with-macosx-sdk],
1938         [Use a specific SDK for building.])
1939     [
1940                           Usage:     --with-macosx-sdk=<version>
1942                           e. g.: --with-macosx-sdk=10.6
1944                           there are 3 options to control the MacOSX build:
1945                           --with-macosx-sdk (refered as 'sdk' below)
1946                           --with-macosx-version-min-required (refered as 'min' below)
1947                           --with-macosx-version-max-allowed (refered as 'max' below)
1949                           the connection between these value and the default they take is as follow:
1950                           ( ? means not specified on the command line, s means the SDK version found,
1951                           constraint: x <= y <= z)
1953                           ==========================================
1954                            command line      || config result
1955                           ==========================================
1956                           min  | max  | sdk  || min  | max  | sdk  |
1957                           ?    | ?    | ?    || 10.6 | 10.s | 10.s |
1958                           ?    | ?    | 10.x || 10.6 | 10.x | 10.x |
1959                           ?    | 10.x | ?    || 10.6 | 10.s | 10.s |
1960                           ?    | 10.x | 10.y || 10.6 | 10.x | 10.y |
1961                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
1962                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
1963                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
1964                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
1967                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
1968                           for a detailled technical explanation of these variables
1970                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
1972                           Note that even if in theory using a --with-macosx-version-max-allowed
1973                           (i.e. the MAC_OS_X_VERSION_MAX_ALLOWED macro) less than the SDK version
1974                           should work, in practice Apple doesn't seem to test that, and at least
1975                           compiling with -DMAC_OS_X_VERSION_MAX_ALLOWED=1060 against the 10.7 SDK
1976                           fails in a couple of places. Just because of oversights in ifdefs in the SDK
1977                           headers, but still.
1978     ],
1981 AC_ARG_WITH(macosx-version-min-required,
1982     AS_HELP_STRING([--with-macosx-version-min-required],
1983         [set the minimum OS version needed to run the built LibreOffice])
1984     [
1985                           Usage:     --with-macosx-version-min-required=<version>
1987                           e. g.: --with-macos-version-min-required=10.6
1988                           see --with-macosx-sdk for more info
1989     ],
1992 AC_ARG_WITH(macosx-version-max-allowed,
1993     AS_HELP_STRING([--with-macosx-version-max-allowed],
1994         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
1995     [
1996                           Usage:     --with-macosx-version-max-allowed=<version>
1998                           e. g.: --with-macos-version-max-allowed=10.6
1999                           see --with-macosx-sdk for more info
2000     ],
2004 dnl ===================================================================
2005 dnl options for stuff used during cross-compilation build
2006 dnl These are superseded by --with-build-platform-configure-options.
2007 dnl Or are they? Look for the complicated tests for "$cross_compiling" = "yes" -a \(
2008 dnl "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \)
2009 dnl far below. Could whoever understands MinGW cross-compilation clean up this please.
2010 dnl ===================================================================
2012 AC_ARG_WITH(system-boost-for-build,
2013     AS_HELP_STRING([--with-system-boost-for-build],
2014         [Use boost already on system for build tools (cross-compilation only).]))
2016 AC_ARG_WITH(system-cppunit-for-build,
2017     AS_HELP_STRING([--with-system-cppunit-for-build],
2018         [Use cppunit already on system for build tools (cross-compilation only).]))
2020 AC_ARG_WITH(system-expat-for-build,
2021     AS_HELP_STRING([--with-system-expat-for-build],
2022         [Use expat already on system for build tools (cross-compilation only).]))
2024 AC_ARG_WITH(system-icu-for-build,
2025     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2026         [Use icu already on system for build tools (cross-compilation only).]))
2028 AC_ARG_WITH(system-libxml-for-build,
2029     AS_HELP_STRING([--with-system-libxml-for-build],
2030         [Use libxml/libxslt already on system for build tools (cross-compilation only).]))
2033 dnl ===================================================================
2034 dnl check for required programs (grep, awk, sed, bash)
2035 dnl ===================================================================
2037 pathmunge ()
2039     if test -n "$1"; then
2040         if test "$build_os" = "cygwin"; then
2041             PathFormat "$1"
2042             new_path=`cygpath -u "$formatted_path"`
2043         else
2044             new_path="$1"
2045         fi
2046         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2047             if test "$2" = "after"; then
2048                 LO_PATH="$LO_PATH:$new_path"
2049             else
2050                 LO_PATH="$new_path:$LO_PATH"
2051             fi
2052         fi
2053         unset new_path
2054     fi
2057 AC_PROG_AWK
2058 AC_PATH_PROG( AWK, $AWK)
2059 if test -z "$AWK"; then
2060     AC_MSG_ERROR([install awk to run this script])
2063 AC_PATH_PROG(BASH, bash)
2064 if test -z "$BASH"; then
2065     AC_MSG_ERROR([bash not found in \$PATH])
2067 AC_SUBST(BASH)
2069 AC_MSG_CHECKING([for GNU or BSD tar])
2070 for a in $GNUTAR gtar gnutar tar /usr/sfw/bin/gtar; do
2071     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2072     if test $? -eq 0;  then
2073         GNUTAR=$a
2074         break
2075     fi
2076 done
2077 AC_MSG_RESULT($GNUTAR)
2078 if test -z "$GNUTAR"; then
2079     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2081 AC_SUBST(GNUTAR)
2083 AC_MSG_CHECKING([for tar's option to strip components])
2084 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2085 if test $? -eq 0; then
2086     STRIP_COMPONENTS="--strip-components"
2087 else
2088     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2089     if test $? -eq 0; then
2090         STRIP_COMPONENTS="--strip-path"
2091     else
2092         STRIP_COMPONENTS="unsupported"
2093     fi
2095 AC_MSG_RESULT($STRIP_COMPONENTS)
2096 if test x$STRIP_COMPONENTS == xunsupported; then
2097     AC_MSG_ERROR([you need a tar that is able to strip components.])
2099 AC_SUBST(STRIP_COMPONENTS)
2101 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2102 dnl desktop OSes from "mobile" ones.
2104 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2105 dnl In other words, that when building for an OS that is not a
2106 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2108 dnl Note the direction of the implication; there is no assumption that
2109 dnl cross-compiling would imply a non-desktop OS.
2111 if test $_os != iOS -a $_os != Android; then
2112     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2113     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2114     AC_DEFINE(HAVE_FEATURE_DESKTOP_GUI_ELEMENTS)
2115     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2116 elif test "$enable_desktop_gui_elements" = yes; then
2117     AC_DEFINE(HAVE_FEATURE_DESKTOP_GUI_ELEMENTS)
2120 DISABLE_EXPORT=''
2121 if test "$enable_export" != no; then
2122     BUILD_TYPE="$BUILD_TYPE EXPORT"
2123 else
2124     DISABLE_EXPORT='TRUE'
2125     SCPDEFS="$SCPDES -DDISABLE_EXPORT"
2127 AC_SUBST(DISABLE_EXPORT)
2129 dnl Decide whether to build database connectivity stuff (including
2130 dnl Base) or not. We probably don't want to on non-desktop OSes.
2132 if test -z "$enable_database_connectivity"; then
2133     # Do enable database connectivity for Android for now as otherwise
2134     # we presumably will get linking errors... We are not as far in
2135     # the work for iOS, so we might as well disable it for iOS already.
2137     # And actually, do enable it for iOS, too. Let's get back to
2138     # figuring out what to do with this later, if ever.
2140     # (Note that with "enable", I mean "enable building the related
2141     # code". Very likely little of it will make any sense at run-time
2142     # on Android or iOS and won't even be shipped with/linked into any
2143     # app.)
2145     #if test $_os != iOS; then
2146         enable_database_connectivity=yes
2147     #fi
2150 DISABLE_DBCONNECTIVITY=''
2151 if test "$enable_database_connectivity" = yes; then
2152     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2153 else
2154     DISABLE_DBCONNECTIVITY='TRUE'
2155     SCPDEFS="$SCPDEFS -DDISABLE_DBCONNECTIVITY"
2157 AC_SUBST(DISABLE_DBCONNECTIVITY)
2159 if test -z "$enable_extensions"; then
2160     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2161     if test $_os != iOS -a $_os != Android; then
2162         enable_extensions=yes
2163     fi
2166 if test "$enable_extensions" = yes; then
2167     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2168     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2171 if test -z "$enable_scripting"; then
2172     # Disable scripting for iOS unless specifically overridden
2173     # with --enable-scripting.
2174     if test $_os != iOS; then
2175         enable_scripting=yes
2176     fi
2179 DISABLE_SCRIPTING=''
2180 if test "$enable_scripting" = yes; then
2181     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2182 else
2183     DISABLE_SCRIPTING='TRUE'
2184     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2186 AC_SUBST(DISABLE_SCRIPTING)
2188 if test $_os = iOS -o $_os = Android; then
2189     # Disable dynamic_loading always for iOS and Android
2190     enable_dynamic_loading=no
2191 elif test -z "$enable_dynamic_loading"; then
2192     # Otherwise enable it unless speficically disabled
2193     enable_dynamic_loading=yes
2196 DISABLE_DYNLOADING=''
2197 if test "$enable_dynamic_loading" = yes; then
2198     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2199 else
2200     DISABLE_DYNLOADING='TRUE'
2201     SCPDEFS="$SCPDEFS -DDISABLE_DYNLOADING"
2203 AC_SUBST(DISABLE_DYNLOADING)
2205 if test -n "${with_solver_and_workdir_root}"; then
2206     if ! test -d ${with_solver_and_workdir_root}; then
2207       AC_MSG_ERROR([directory does not exist: ${with_solver_and_workdir_root}])
2208     fi
2209     PathFormat "${with_solver_and_workdir_root}"
2210     # IsValidFilePath in /sal/osl/w32/file_url.cxx rejects "X:\\" breaking idlc
2211     if echo ${formatted_path} | $GREP -q '/$'; then
2212         SOLARVER=${formatted_path}solver
2213     else
2214         SOLARVER=${formatted_path}/solver
2215     fi
2216 else
2217     SOLARVER=${BUILDDIR}/solver
2220 # remenber SYSBASE value
2221 AC_SUBST(SYSBASE)
2223 dnl ===================================================================
2224 dnl  Sort out various gallery compilation options
2225 dnl ===================================================================
2226 AC_MSG_CHECKING([how to build and package galleries])
2227 if test -n "${with_galleries}"; then
2228     if test "$with_galleries" = "build"; then
2229         WITH_GALLERY_BUILD=YES
2230         AC_MSG_RESULT([build from source images internally])
2231     elif test "$with_galleries" = "package"; then
2232         WITH_GALLERY_BUILD=PACKAGE
2233         AC_MSG_ERROR([FIXME - implement build from pre-compiled package])
2234     elif test "$with_galleries" = "no"; then
2235         WITH_GALLERY_BUILD=
2236         AC_MSG_RESULT([disable non-internal gallery build])
2237     else
2238         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2239     fi
2240 else
2241    if test $_os != iOS -a $_os != Android; then
2242         WITH_GALLERY_BUILD=YES
2243         AC_MSG_RESULT([internal src images for desktop])
2244    else
2245         WITH_GALLERY_BUILD=
2246         AC_MSG_RESULT([disable src imgage build])
2247    fi
2249 AC_SUBST(WITH_GALLERY_BUILD)
2251 dnl ===================================================================
2252 dnl  Checks if ccache is available
2253 dnl ===================================================================
2254 if test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2255     case "%$CC%$CXX%" in
2256     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some verison number etc),
2257     # assume that's good then
2258     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2259         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2260         ;;
2261     *)
2262         AC_PATH_PROG([CCACHE],[ccache],[not found])
2263         if test "$CCACHE" = "not found"; then
2264             CCACHE=""
2265         else
2266             # Need to check for ccache version: otherwise prevents
2267             # caching of the results (like "-x objective-c++" for Mac)
2268             if test $_os = Darwin -o $_os = iOS; then
2269                 # Check ccache version
2270                 AC_MSG_CHECKING([whether version of ccache is suitable])
2271                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2272                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2273                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2274                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2275                 else
2276                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2277                     CCACHE=""
2278                 fi
2279             fi
2280         fi
2281         ;;
2282     esac
2283 else
2284     CCACHE=""
2287 if test "$CCACHE" != ""; then
2288     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2289     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2290     if test "$ccache_size" = ""; then
2291         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2292         if test "$ccache_size" = ""; then
2293             ccache_size=0
2294         fi
2295         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2296         if test $ccache_size -lt 1024; then
2297             CCACHE=""
2298             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-producive: Disabling auto-ccache detection])
2299             add_warning "ccache's cache size is less than 1GB using it is counter-producive: auto-ccache detection disabled"
2300         else
2301             # warn that ccache may be too small for debug build
2302             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build])
2303             add_warning "ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build"
2304         fi
2305     else
2306         if test $ccache_size -lt 5; then
2307             #warn that ccache may be too small for debug build
2308             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build])
2309             add_warning "ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build"
2310         fi
2311     fi
2314 dnl ===================================================================
2315 dnl  Checks for C compiler,
2316 dnl  The check for the C++ compiler is later on.
2317 dnl ===================================================================
2318 if test "$_os" != "WINNT" -a "$WITH_MINGW" != "yes"; then
2319     GCC_HOME_SET="true"
2320     AC_MSG_CHECKING([gcc home])
2321     if test -z "$with_gcc_home"; then
2322         if test "$enable_icecream" = "yes"; then
2323             if test -d "/usr/lib/icecc/bin"; then
2324                 GCC_HOME="/usr/lib/icecc/"
2325             else
2326                 GCC_HOME="/opt/icecream/"
2327             fi
2328         else
2329             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2330             GCC_HOME_SET="false"
2331         fi
2332     else
2333         GCC_HOME="$with_gcc_home"
2334     fi
2335     AC_MSG_RESULT($GCC_HOME)
2336     AC_SUBST(GCC_HOME)
2338     if test "$GCC_HOME_SET" = "true"; then
2339         if test -z "$CC"; then
2340             CC="$GCC_HOME/bin/gcc"
2341         fi
2342         if test -z "$CXX"; then
2343             CXX="$GCC_HOME/bin/g++"
2344         fi
2345     fi
2348 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
2349 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
2350     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
2351     save_CFLAGS=$CFLAGS
2352     AC_PROG_CC
2353     CFLAGS=$save_CFLAGS
2356 COMPATH=`dirname "$CC"`
2357 if test "$COMPATH" = "."; then
2358     AC_PATH_PROGS(COMPATH, $CC)
2359     dnl double square bracket to get single because of M4 quote...
2360     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2362 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2364 dnl ===================================================================
2365 dnl  Test the Solaris compiler version
2366 dnl ===================================================================
2367 if test "$_os" = "SunOS"; then
2368     if test "$CC" = "cc"; then
2369         AC_PATH_PROGS(_cc, cc)
2370         COMPATH=`echo $_cc | $SED -n "s/\/bin\/cc//p"`
2371         AC_MSG_CHECKING([the SunStudio C/C++ compiler version])
2372         dnl cc -V outputs to standard error!!!!
2373         _sunstudio_string=`$CC -V 2>&1 | grep '^cc' | $SED -e 's/.* C //'`
2374         _sunstudio_version=`echo $_sunstudio_string | $AWK '{ print $1 }'`
2375         _sunstudio_major=`echo $_sunstudio_version | $AWK -F. '{ print $1 }'`
2376         if test "$_sunstudio_major" != "5"; then
2377             AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2378         else
2379             _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" }'`
2380             if test "$_sunstudio_minor" = "false"; then
2381                 AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2382             else
2383                 dnl compiler will do
2384                 AC_MSG_RESULT([checked])
2385             fi
2386         fi
2387     fi
2391 dnl ===================================================================
2392 dnl Check / find MacOSX SDK and compiler, version checks
2393 dnl ===================================================================
2394 if test "$_os" = "Darwin"; then
2396     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
2397         bitness=-m32
2398     else
2399         bitness=-m64
2400         BITNESS_OVERRIDE=64
2401     fi
2403     # If no --with-macosx-sdk option is given, look for 10.6, 10.7
2404     # and 10.8 SDKs, in that order. If not found in some (old)
2405     # default locations, try the xcode-select tool.
2407     # The intent is that for "most" Mac-based developers, a suitable
2408     # SDK will be found automatically without any configure options.
2410     # For developers still using Xcode 3, in /Developer, either
2411     # because it is the only Xcode they have, or they have that in
2412     # addition to Xcode 4 in /Applications/Xcode.app, the 10.6 SDK
2413     # should be found.
2415     # For developers with a current Xcode 4 installed from the Mac App
2416     # Store, the 10.6, 10.7 or 10.8 SDK should be found.
2418     AC_MSG_CHECKING([what Mac OS X SDK to use])
2420     if test -z "$with_macosx_sdk"; then
2421         if test -d /Developer/SDKs/MacOSX10.6.sdk; then
2422             with_macosx_sdk=10.6
2423         elif test -d /Developer-old/SDKs/MacOSX10.6.sdk; then
2424             with_macosx_sdk=10.6
2425         elif test -d /Xcode3/SDKs/MacOSX10.6.sdk; then
2426             with_macosx_sdk=10.6
2427         elif test -d /Developer/SDKs/MacOSX10.7.sdk; then
2428             with_macosx_sdk=10.7
2429         elif test -x /usr/bin/xcode-select; then
2430             xcodepath="`xcode-select -print-path`"
2431             if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk"; then
2432                 with_macosx_sdk=10.6
2433             elif test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"; then
2434                 with_macosx_sdk=10.7
2435             elif test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk"; then
2436                 with_macosx_sdk=10.8
2437             fi
2438         fi
2439         if test -z "$with_macosx_sdk"; then
2440             AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2441         fi
2442     fi
2444     case $with_macosx_sdk in
2445     10.6)
2446         MACOSX_SDK_VERSION=1060
2447         ;;
2448     10.7)
2449         MACOSX_SDK_VERSION=1070
2450         ;;
2451     10.8)
2452         MACOSX_SDK_VERSION=1080
2453         ;;
2454     *)
2455         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported value are 10.6--8])
2456         ;;
2457     esac
2459     # Next find it (again, if we deduced its version above by finding
2460     # it... but we need to look for it once more in case
2461     # --with-macosx-sdk was given so that the aboce search did not
2462     # happen).
2463     if test -z "$MACOSX_SDK_PATH"; then
2464         case $with_macosx_sdk in
2465         10.6)
2466             if test -d /Developer/SDKs/MacOSX10.6.sdk; then
2467                 MACOSX_SDK_PATH=/Developer/SDKs/MacOSX10.6.sdk
2468             elif test -d /Developer-old/SDKs/MacOSX10.6.sdk; then
2469                 MACOSX_SDK_PATH=/Developer-old/SDKs/MacOSX10.6.sdk
2470             elif test -d /Xcode3/SDKs/MacOSX10.6.sdk; then
2471                 MACOSX_SDK_PATH=/Xcode3/SDKs/MacOSX10.6.sdk
2472             elif test -x /usr/bin/xcode-select; then
2473                 xcodepath="`xcode-select -print-path`"
2474                 if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2475                     MACOSX_SDK_PATH="$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"
2476                 fi
2477             fi
2478             ;;
2479         10.7|10.8)
2480             if test -d /Developer/SDKs/MacOSX$with_macosx_sdk.sdk; then
2481                 MACOSX_SDK_PATH=/Developer/SDKs/MacOSX$with_macosx_sdk.sdk
2482             elif test -x /usr/bin/xcode-select; then
2483                 xcodepath="`xcode-select -print-path`"
2484                 if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2485                     MACOSX_SDK_PATH="$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"
2486                 fi
2487             fi
2488             ;;
2489         esac
2490         if test -z "$MACOSX_SDK_PATH"; then
2491             AC_MSG_ERROR([Could not figure out the location of Mac OS X $with_macosx_sdk SDK])
2492         fi
2493     fi
2494     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2496     if test "$with_macosx_version_min_required" = ""; then
2497         with_macosx_version_min_required="10.6"
2498     fi
2500     if test "$with_macosx_version_max_allowed" = ""; then
2501         with_macosx_version_max_allowed="$with_macosx_sdk"
2502     fi
2504     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2505     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2507     case "$with_macosx_version_min_required" in
2508     10.6)
2509         MAC_OS_X_VERSION_MIN_REQUIRED="1060"
2510         ;;
2511     10.7)
2512         MAC_OS_X_VERSION_MIN_REQUIRED="1070"
2513         ;;
2514     10.8)
2515         MAC_OS_X_VERSION_MIN_REQUIRED="1080"
2516         ;;
2517     *)
2518         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported value are 10.6--8])
2519         ;;
2520     esac
2522     if test "$BITNESS_OVERRIDE" = ""; then
2523         case "$with_macosx_version_min_required" in
2524         10.6)
2525             case "$with_macosx_sdk" in
2526             10.6)
2527                 ;;
2528             *)
2529                 AC_MSG_WARN([Building with a SDK > 10.6 possibly breaks 10.6 compatibility. Do not use for the TDF build])
2530                 add_warning "Building with a SDK > 10.6 possibly breaks 10.6 compatibility. Do not use for the TDF build"
2531                 ;;
2532             esac
2533             ;;
2534         *)
2535             AC_MSG_WARN([Building with a minimum version requirement > 10.6 breaks 10.6 compatibility. Do not use for the TDF build])
2536             add_warning "Building with a minimum version requirement > 10.6 breaks 10.6 compatibility. Do not use for the TDF build"
2537             ;;
2538         esac
2539     fi
2541     # If no CC and CXX environment vars, try to guess where the compiler is
2542     if test -z "$save_CC"; then
2543         AC_MSG_CHECKING([what compiler to use])
2544         case $with_macosx_sdk in
2545         10.6)
2546             # did someone copy her 10.6 sdk into xcode 4 (needed on Mountain Lion)?
2547             if test "$(echo $MACOSX_SDK_PATH | cut -c1-23)" = "/Applications/Xcode.app"; then
2548                 CC="`xcrun -find gcc` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2549                 CXX="`xcrun -find g++` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2550                 XCRUN=xcrun
2551             else
2552                 CC="gcc-4.2 $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2553                 CXX="g++-4.2 $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2554             fi
2555             ;;
2556         10.7|10.8)
2557             CC="`xcrun -find clang` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2558             CXX="`xcrun -find clang++` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2559             XCRUN=xcrun
2560             ;;
2561         esac
2562         AC_MSG_RESULT([$CC and $CXX])
2563     fi
2565     case "$with_macosx_version_max_allowed" in
2566     10.6)
2567         MAC_OS_X_VERSION_MAX_ALLOWED="1060"
2568         ;;
2569     10.7)
2570         MAC_OS_X_VERSION_MAX_ALLOWED="1070"
2571         ;;
2572     10.8)
2573         MAC_OS_X_VERSION_MAX_ALLOWED="1080"
2574         ;;
2575     *)
2576         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported value are 10.6--8])
2577         ;;
2578     esac
2580     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2581     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2582         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2583     else
2584         AC_MSG_RESULT([ok])
2585     fi
2587     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2588     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2589         AC_MSG_ERROR([the version maximum allowed cannot be greater thatn the sdk level])
2590     else
2591         AC_MSG_RESULT([ok])
2592     fi
2593     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2594     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2596     AC_MSG_CHECKING([whether to do code signing])
2598     if test "$enable_macosx_code_signing" = yes; then
2599         # By default use the first suitable certificate (?).
2601         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2602         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2603         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2604         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the the
2605         # "Developer ID Application" one.
2607         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | awk '{print $2}' |head -1`
2608         if test -n "$identity"; then
2609             MACOSX_CODESIGNING_IDENTITY=$identity
2610             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2611             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2612         fi
2613     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2614         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2615         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2616         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2617     else
2618         AC_MSG_RESULT([no])
2619     fi
2621     AC_MSG_CHECKING([whether to sandbox the application])
2623     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2624         AC_MSG_ERROR([OS X sandboxing requires code signing])
2625     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2626         ENABLE_MACOSX_SANDBOX=YES
2627         AC_MSG_RESULT([yes])
2628     else
2629         AC_MSG_RESULT([no])
2630     fi
2632     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2634     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2636     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2638 AC_SUBST(MACOSX_SDK_PATH)
2639 AC_SUBST(MACOSX_SDK_VERSION)
2640 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2641 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2642 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2643 AC_SUBST(XCRUN)
2644 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2645 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2646 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2648 dnl ===================================================================
2649 dnl Check / find iOS SDK and compiler, version checks
2650 dnl ===================================================================
2651 if test $_os = iOS; then
2653     AC_MSG_CHECKING([what iOS SDK to use])
2655     if test "$enable_ios_simulator" = yes; then
2656         platform=iPhoneSimulator
2657         versionmin=-mmacosx-version-min=10.7
2658         arch=i386
2659     else
2660         platform=iPhoneOS
2661         versionmin=-miphoneos-version-min=5.0
2662         arch=armv7
2663     fi
2665     pref_sdk_ver=6.1
2666     for I in 6.1 6.0; do
2667         t=/Applications/Xcode.app/Contents/Developer/Platforms/$platform.platform/Developer/SDKs/$platform$I.sdk
2668         if test -d $t; then
2669             sysroot=$t
2670             break
2671         fi
2672     done
2674     if test -z "$sysroot"; then
2675         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}])
2676     fi
2678     AC_MSG_RESULT($sysroot)
2680     CXX="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch $arch -isysroot $sysroot $versionmin"
2681     CC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch $arch -isysroot $sysroot $versionmin"
2684 AC_MSG_CHECKING([whether to treat the installation as read-only])
2686 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = YES \) -o \
2687         "$enable_extensions" != yes; then
2688     enable_readonly_installset=yes
2690 if test "$enable_readonly_installset" = yes; then
2691     AC_MSG_RESULT([yes])
2692     ENABLE_READONLY_INSTALLSET=YES
2693 else
2694     AC_MSG_RESULT([no])
2696 AC_SUBST(ENABLE_READONLY_INSTALLSET)
2698 dnl ===================================================================
2699 dnl Windows specific tests and stuff
2700 dnl ===================================================================
2702 reg_get_value()
2704     # Return value: $regvalue
2705     unset regvalue
2706     _regvalue=`cat "/proc/registry/$1" 2> /dev/null`
2708     if test $? -eq 0; then
2709         regvalue=$_regvalue
2710     fi
2714 if test "$_os" = "WINNT" -a "$WITH_MINGW" != yes; then
2715     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
2716     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
2717         AC_MSG_RESULT([no])
2718         WINDOWS_SDK_ARCH="x86"
2719     else
2720         AC_MSG_RESULT([yes])
2721         WINDOWS_SDK_ARCH="x64"
2722         BITNESS_OVERRIDE=64
2723     fi
2725     AC_MSG_CHECKING([whether to use DirectX])
2726     if test "$enable_directx" = "yes" -o "$enable_directx" = ""; then
2727         ENABLE_DIRECTX="TRUE"
2728         AC_MSG_RESULT([yes])
2729     else
2730         ENABLE_DIRECTX=""
2731         AC_MSG_RESULT([no])
2732     fi
2734     AC_MSG_CHECKING([whether to use ActiveX])
2735     if test "$enable_activex" = "yes" -o "$enable_activex" = ""; then
2736         DISABLE_ACTIVEX=""
2737         SCPDEFS="$SCPDEFS -DWITH_ACTIVEX_COMPONENT"
2738         AC_MSG_RESULT([yes])
2739     else
2740         DISABLE_ACTIVEX="TRUE"
2741         AC_MSG_RESULT([no])
2742     fi
2744     AC_MSG_CHECKING([whether to use ATL])
2745     if test "$enable_atl" = "yes" -o "$enable_atl" = ""; then
2746         DISABLE_ATL=""
2747         AC_MSG_RESULT([yes])
2748     else
2749         DISABLE_ATL="TRUE"
2750         AC_MSG_RESULT([no])
2751     fi
2752 else
2753     ENABLE_DIRECTX=""
2754     DISABLE_ACTIVEX="TRUE"
2755     DISABLE_ATL="TRUE"
2758 AC_SUBST(ENABLE_DIRECTX)
2759 AC_SUBST(DISABLE_ACTIVEX)
2760 AC_SUBST(DISABLE_ATL)
2762 if test "$cross_compiling" = "yes"; then
2763     CROSS_COMPILING=YES
2764     SCPDEFS="$SCPDEFS -DCROSS_COMPILING"
2765 else
2766     CROSS_COMPILING=
2767     BUILD_TYPE="$BUILD_TYPE NATIVE"
2769 AC_SUBST(CROSS_COMPILING)
2771 dnl ===================================================================
2772 dnl  Test the gcc version
2773 dnl ===================================================================
2774 if test "$GCC" = "yes"; then
2775     AC_MSG_CHECKING([the GCC version])
2776     _gcc_version=`$CC -dumpversion`
2777     _gcc_major=`echo $_gcc_version | $AWK -F. '{ print \$1 }'`
2778     GCCVER=`echo $_gcc_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2780     AC_MSG_RESULT([gcc $_gcc_version])
2781     if test "$GCCVER" -lt 040000; then
2782         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.0.0])
2783     fi
2786 dnl ===================================================================
2787 dnl  Is GCC actually Clang?
2788 dnl ===================================================================
2790 COM_GCC_IS_CLANG=
2791 if test "$GCC" = "yes"; then
2792     AC_MSG_CHECKING([whether GCC is actually Clang])
2793     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
2794         #ifndef __clang__
2795         you lose
2796         #endif
2797         int foo=42;
2798         ]])],
2799         [AC_MSG_RESULT([yes])
2800          COM_GCC_IS_CLANG=TRUE],
2801         [AC_MSG_RESULT([no])])
2803     if test "$COM_GCC_IS_CLANG" = TRUE; then
2804         AC_MSG_CHECKING([the Clang version])
2805         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC -E -P -`
2806         CLANG_FULL_VERSION=`echo __clang_version__ | $CC -E -P -`
2807         CLANGVER=`echo $clang_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2808         AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
2809         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
2810     fi
2812 AC_SUBST(COM_GCC_IS_CLANG)
2814 # ===================================================================
2815 # check various GCC options that Clang does not support now but maybe
2816 # will somewhen in the future, check them even for GCC, so that the
2817 # flags are set
2818 # ===================================================================
2820 HAVE_GCC_GGDB2=
2821 HAVE_GCC_FINLINE_LIMIT=
2822 HAVE_GCC_FNO_INLINE=
2823 if test "$GCC" = "yes"; then
2824     AC_MSG_CHECKING([whether $CC supports -ggdb2])
2825     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
2826         # Option just ignored and silly warning that isn't a real
2827         # warning printed
2828         :
2829     else
2830         save_CFLAGS=$CFLAGS
2831         CFLAGS="$CFLAGS -Werror -ggdb2"
2832         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
2833         CFLAGS=$save_CFLAGS
2834     fi
2835     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
2836         AC_MSG_RESULT([yes])
2837     else
2838         AC_MSG_RESULT([no])
2839     fi
2841     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
2842     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
2843         # As above
2844         :
2845     else
2846         save_CFLAGS=$CFLAGS
2847         CFLAGS="$CFLAGS -Werror -finline-limit=0"
2848         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
2849         CFLAGS=$save_CFLAGS
2850     fi
2851     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
2852         AC_MSG_RESULT([yes])
2853     else
2854         AC_MSG_RESULT([no])
2855     fi
2857     AC_MSG_CHECKING([whether $CC supports -fno-inline])
2858     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
2859         # Ditto
2860         :
2861     else
2862         save_CFLAGS=$CFLAGS
2863         CFLAGS="$CFLAGS -Werror -fno-inline"
2864         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
2865         CFLAGS=$save_CFLAGS
2866     fi
2867     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
2868         AC_MSG_RESULT([yes])
2869     else
2870         AC_MSG_RESULT([no])
2871     fi
2873 AC_SUBST(HAVE_GCC_GGDB2)
2874 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
2875 AC_SUBST(HAVE_GCC_FNO_INLINE)
2877 HAVE_LD_BSYMBOLIC_FUNCTIONS=
2878 if test "$GCC" = "yes"; then
2879     AC_MSG_CHECKING( for -Bsymbolic-functions linker support )
2880     bsymbolic_functions_ldflags_save=$LDFLAGS
2881     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
2882     AC_LINK_IFELSE([AC_LANG_PROGRAM([
2883 #include <stdio.h>
2884         ],[
2885 printf ("hello world\n");
2886         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
2887     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
2888         AC_MSG_RESULT( found )
2889     else
2890         AC_MSG_RESULT( not found )
2891     fi
2892     LDFLAGS=$bsymbolic_functions_ldflags_save
2894 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
2896 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
2897 # NOTE: must _not_ be used for bundled external libraries!
2898 ISYSTEM=
2899 if test "$GCC" = "yes"; then
2900     AC_MSG_CHECKING( for -isystem )
2901     save_CFLAGS=$CFLAGS
2902     CFLAGS="$CFLAGS -Werror"
2903     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM=-isystem ],[])
2904     CFLAGS=$save_CFLAGS
2905     if test -n "$ISYSTEM"; then
2906         AC_MSG_RESULT(yes)
2907     else
2908         AC_MSG_RESULT(no)
2909     fi
2911 if test -z "$ISYSTEM"; then
2912     # fall back to using -I
2913     ISYSTEM=-I
2915 AC_SUBST(ISYSTEM)
2917 dnl ===================================================================
2918 dnl  Check which Visual Studio or MinGW compiler is used
2919 dnl ===================================================================
2921 map_vs_year_to_version()
2923     # Return value: $vsversion
2925     unset vsversion
2927     case $1 in
2928     2008)
2929         vsversion=9.0;;
2930     2010)
2931         vsversion=10.0;;
2932     2012)
2933         vsversion=11.0;;
2934     *)
2935         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
2936     esac
2939 vs_versions_to_check()
2941     # Args: $1 (optional) : versions to check, in the order of preference
2942     # Return value: $vsversions
2944     unset vsversions
2946     if test -n "$1"; then
2947         map_vs_year_to_version "$1"
2948         vsversions=$vsversion
2949     else
2950         # By default we prefer 2012, then 2010, then 2008
2951         vsversions="11.0 10.0 9.0"
2952     fi
2955 find_msvs()
2957     # Find Visual Studio 2012/2010/2008
2958     # Args: $1 (optional) : versions to check, in the order of preference
2959     # Return value: $vstest
2961     unset vstest
2963     vs_versions_to_check "$1"
2965     for ver in $vsversions; do
2966         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/ProductDir
2967         if test -n "$regvalue"; then
2968             vstest=$regvalue
2969             break
2970         fi
2971         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VS/ProductDir
2972         if test -n "$regvalue"; then
2973             vstest=$regvalue
2974             break
2975         fi
2976     done
2979 find_msvc()
2981     # Find Visual C++ 2012/2010/2008
2982     # Args: $1 (optional) : The VS version year
2983     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot
2985     unset vctest vcnum vcnumwithdot
2987     vs_versions_to_check "$1"
2989     for ver in $vsversions; do
2990         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
2991         if test -n "$regvalue"; then
2992             vctest=$regvalue
2993             break
2994         fi
2995         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VC/ProductDir
2996         if test -n "$regvalue"; then
2997             vctest=$regvalue
2998             break
2999         fi
3000     done
3001     if test -n "$vctest"; then
3002         vcnumwithdot=$ver
3003         case "$vcnumwithdot" in
3004         9.0)
3005             vcyear=2008
3006             vcnum=90
3007             ;;
3008         10.0)
3009             vcyear=2010
3010             vcnum=100
3011             ;;
3012         11.0)
3013             vcyear=2012
3014             vcnum=110
3015             ;;
3016         esac
3017     fi
3020 SHOWINCLUDES_PREFIX=
3021 if test "$_os" = "WINNT"; then
3022     if test "$WITH_MINGW" != "yes"; then
3023         AC_MSG_CHECKING([Visual C++])
3025         find_msvc "$with_visual_studio"
3027         if test -z "$vctest"; then
3028             if test -n "$with_visual_studio"; then
3029                 AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3030             else
3031                 AC_MSG_ERROR([No Visual Studio 2012, 2010 or 2008 installation found])
3032             fi
3033         fi
3035         if test "$BITNESS_OVERRIDE" = ""; then
3036             if test -f "$vctest/bin/cl.exe"; then
3037                 VC_PRODUCT_DIR=$vctest
3038             else
3039                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3040             fi
3041         else
3042             # It makes sense, I think, to restrict 64-bit support to VS2010 or newer
3043             if test $vcnum -lt 100; then
3044                AC_MSG_ERROR([We have no plans to support building a 64-bit LibreOffice with VS 2008])
3045             fi
3047             if test -f "$vctest/bin/amd64/cl.exe"; then
3048                 VC_PRODUCT_DIR=$vctest
3049             else
3050                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/amd64/cl.exe])
3051             fi
3052         fi
3054         VC_PRODUCT_DIR=`cygpath -d "$VC_PRODUCT_DIR"`
3055         VC_PRODUCT_DIR=`cygpath -u "$VC_PRODUCT_DIR"`
3056         AC_MSG_RESULT([$VC_PRODUCT_DIR])
3058         dnl ===========================================================
3059         dnl  Check for the corresponding mspdb*.dll
3060         dnl ===========================================================
3062         MSPDB_PATH=
3064         if test "$BITNESS_OVERRIDE" == ""; then
3065             MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3066         else
3067             MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3068         fi
3070         case $vcnum in
3071         90)
3072             mspdbnum=80;;
3073         *)
3074             mspdbnum=$vcnum;;
3075         esac
3077         if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3078             AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3079         fi
3081         MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3082         MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3084         dnl The path needs to be added before cl is called
3085         PATH="$MSPDB_PATH:$PATH"
3087         AC_MSG_CHECKING([cl.exe])
3089         # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3090         # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3091         # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3092         # is not enough?
3094         if test -z "$CC"; then
3095             if test "$BITNESS_OVERRIDE" = ""; then
3096                 if test -f "$VC_PRODUCT_DIR/bin/cl.exe"; then
3097                     CC="$VC_PRODUCT_DIR/bin/cl.exe"
3098                 fi
3099             else
3100                 if test -f "$VC_PRODUCT_DIR/bin/amd64/cl.exe"; then
3101                     CC="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3102                 fi
3103             fi
3105             # This gives us a posix path with 8.3 filename restrictions
3106             CC=`cygpath -d "$CC"`
3107             CC=`cygpath -u "$CC"`
3108         fi
3110         if test -n "$CC"; then
3111             # Remove /cl.exe from CC case insensitive
3112             AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3113             if test "$BITNESS_OVERRIDE" = ""; then
3114                 COMPATH=`echo $CC | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3115             else
3116                 if test -n "$VC_PRODUCT_DIR"; then
3117                     # Huh, why not just an assignment?
3118                     COMPATH=`echo $VC_PRODUCT_DIR`
3119                 fi
3120             fi
3121             export INCLUDE=`cygpath -d "$COMPATH/Include"`
3123             PathFormat "$COMPATH"
3124             COMPATH="$formatted_path"
3126             VCVER=$vcnum
3127             MSVSVER=$vcyear
3129             # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3130             # are always "better", we list them in reverse chronological order.
3132             case $vcnum in
3133             90)
3134                 COMEX=12
3135                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="7.1A 7.1 7.0A 6.0A"
3136                 ;;
3137             100)
3138                 COMEX=13
3139                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="7.1A 7.1 7.0A 6.0A"
3140                 ;;
3141             110)
3142                 COMEX=14
3143                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="8.0 7.1A"
3144                 ;;
3145             esac
3147             # The expectation is that --with-windows-sdk should not need to be used
3148             if test -n "$with_windows_sdk"; then
3149                 case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3150                 *" "$with_windows_sdk" "*)
3151                     WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3152                     ;;
3153                 *)
3154                     AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work witn VS $MSVSVER])
3155                     ;;
3156                 esac
3157             fi
3158         else
3159             AC_MSG_ERROR([Visual C++ not found after all, huh])
3160         fi
3162         dnl We need to guess the prefix of the -showIncludes output, it can be
3163         dnl localized
3164         AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3165         echo "#include <stdlib.h>" > conftest.c
3166         SHOWINCLUDES_PREFIX=`$CC -c -showIncludes conftest.c 2>/dev/null | \
3167             grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3168         rm -f conftest.c conftest.obj
3169         if test -z "$SHOWINCLUDES_PREFIX"; then
3170             AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3171         else
3172             AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3173         fi
3175         # Check for 64-bit (cross-)compiler to use to build the 64-bit
3176         # version of the Explorer extension (and maybe other small
3177         # bits, too) needed when installing a 32-bit LibreOffice on a
3178         # 64-bit OS. The 64-bit Explorer extension is a feature that
3179         # has been present since long in OOo. Don't confuse it with
3180         # building LibreOffice itself as 64-bit code, which is
3181         # unfinished work and highly experimental.
3183         BUILD_X64=
3184         CXX_X64_BINARY=
3185         LINK_X64_BINARY=
3187         if test "$BITNESS_OVERRIDE" = ""; then
3188             AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3189             if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3190                 # Prefer native x64 compiler to cross-compiler, in case we are running
3191                 # the build on a 64-bit OS.
3192                 if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3193                     BUILD_X64=TRUE
3194                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3195                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3196                 elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3197                     BUILD_X64=TRUE
3198                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3199                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3200                 fi
3201             fi
3202             if test "$BUILD_X64" = TRUE; then
3203                 AC_MSG_RESULT([found])
3204             else
3205                 AC_MSG_RESULT([not found])
3206                 AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3207             fi
3208         fi
3209         AC_SUBST(BUILD_X64)
3211         # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3212         AC_SUBST(CXX_X64_BINARY)
3213         AC_SUBST(LINK_X64_BINARY)
3214     else
3215         AC_MSG_CHECKING([the compiler is MinGW])
3216         MACHINE_PREFIX=`$CC -dumpmachine`
3217         if echo $MACHINE_PREFIX | $GREP -q mingw32; then
3218             COMPATH=`echo "$COMPATH" | sed -e 's,/bin$,,'`
3219             AC_MSG_RESULT([yes])
3220         else
3221             AC_MSG_ERROR([Compiler is not MinGW.])
3222         fi
3223     fi
3225 AC_SUBST(COMEX)
3226 AC_SUBST(VCVER)
3227 PathFormat "$MSPDB_PATH"
3228 MSPDB_PATH="$formatted_path"
3229 AC_SUBST(SHOWINCLUDES_PREFIX)
3232 # dbghelp.dll
3234 if test "$_os" == "WINNT"; then
3235     BUILD_TYPE="$BUILD_TYPE DBGHELP"
3239 # unowinreg.dll
3241 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3242 AC_SUBST(UNOWINREG_DLL)
3245 # prefix C with ccache if needed
3247 if test "$CCACHE" != ""; then
3248     AC_MSG_CHECKING([whether $CC is already ccached])
3250     AC_LANG_PUSH([C])
3251     save_CFLAGS=$CFLAGS
3252     CFLAGS="$CFLAGS --ccache-skip -O2"
3253     dnl an empty program will do, we're checking the compiler flags
3254     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3255                       [use_ccache=yes], [use_ccache=no])
3256     if test $use_ccache = yes; then
3257         AC_MSG_RESULT([yes])
3258     else
3259         CC="$CCACHE $CC"
3260         AC_MSG_RESULT([no])
3261     fi
3262     CFLAGS=$save_CFLAGS
3263     AC_LANG_POP([C])
3266 dnl Set the ENABLE_DBGUTIL variable
3267 dnl ===================================================================
3268 AC_MSG_CHECKING([whether to build with additional debug utilities])
3269 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3270     ENABLE_DBGUTIL="TRUE"
3271     # this is an extra var so it can have different default on different MSVC
3272     # versions (in case there are version specific problems with it)
3273     MSVC_USE_DEBUG_RUNTIME="TRUE"
3274     PROEXT=""
3275     PRODUCT=""
3277     AC_MSG_RESULT([yes])
3278     # cppunit and graphite expose STL in public headers
3279     if test "$with_system_cppunit" = "yes"; then
3280         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3281     else
3282         with_system_cppunit=no
3283     fi
3284     if test "$with_system_graphite" = "yes"; then
3285         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3286     else
3287         with_system_graphite=no
3288     fi
3289     if test "$with_system_mysql_cppconn" = "yes"; then
3290         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3291     else
3292         with_system_mysql_cppconn=no
3293     fi
3294     if test "$with_system_orcus" = "yes"; then
3295         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3296     else
3297         with_system_orcus=no
3298     fi
3299     if test "$with_system_libcmis" = "yes"; then
3300         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3301     else
3302         with_system_libcmis=no
3303     fi
3304 else
3305     ENABLE_DBGUTIL=""
3306     MSVC_USE_DEBUG_RUNTIME=""
3307     # PRODUCT is old concept, still used by build.pl .
3308     PRODUCT="full"
3309     PROEXT=".pro"
3310     AC_MSG_RESULT([no])
3312 AC_SUBST(ENABLE_DBGUTIL)
3313 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3314 AC_SUBST(PRODUCT)
3315 AC_SUBST(PROEXT)
3317 dnl Set the ENABLE_DEBUG variable.
3318 dnl ===================================================================
3319 AC_MSG_CHECKING([whether to do a debug build])
3320 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3321     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3323 if test -n "$ENABLE_DBGUTIL"; then
3324     if test "$enable_debug" = "no"; then
3325         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3326     fi
3327     ENABLE_DEBUG="TRUE"
3328     AC_MSG_RESULT([yes (dbgutil)])
3329 elif test -n "$enable_debug" && test "$enable_debug" != "no"; then
3330     ENABLE_DEBUG="TRUE"
3331     AC_MSG_RESULT([yes])
3332 else
3333     ENABLE_DEBUG=""
3334     AC_MSG_RESULT([no])
3336 AC_SUBST(ENABLE_DEBUG)
3338 dnl Selective debuginfo
3339 ENABLE_DEBUGINFO_FOR=
3340 if test -n "$ENABLE_DEBUG"; then
3341     AC_MSG_CHECKING([whether to use selective debuginfo])
3342     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3343         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3344         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3345     else
3346         ENABLE_DEBUGINFO_FOR=all
3347         AC_MSG_RESULT([no, for all])
3348     fi
3350 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3352 dnl Check for enable symbols option
3353 dnl ===================================================================
3354 AC_MSG_CHECKING([whether to include symbols while preserve optimization])
3355 if test -n "$enable_symbols" -a "$enable_symbols" != "no"; then
3356     ENABLE_SYMBOLS="TRUE"
3357     if test -n "$ENABLE_DBGUTIL"; then
3358         AC_MSG_ERROR([--enable-dbgutil cannot be used with --enable-symbols])
3359     elif test -n "$ENABLE_DEBUG"; then
3360         AC_MSG_ERROR([--enable-debug cannot be used with --enable-symbols])
3361     fi
3362     AC_MSG_RESULT([yes])
3363 else
3364     if test -n "$enable_symbols" -a "$enable_symbols" = "no"; then
3365         ENABLE_SYMBOLS="FALSE"
3366     else
3367         ENABLE_SYMBOLS=
3368     fi
3369     AC_MSG_RESULT([no])
3371 AC_SUBST(ENABLE_SYMBOLS)
3373 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
3374 # By default use the ones specified by our build system,
3375 # but explicit override is possible.
3376 AC_MSG_CHECKING(for explicit AFLAGS)
3377 if test -n "$AFLAGS"; then
3378     AC_MSG_RESULT([$AFLAGS])
3379     x_AFLAGS=
3380 else
3381     AC_MSG_RESULT(no)
3382     x_AFLAGS=[\#]
3384 AC_MSG_CHECKING(for explicit CFLAGS)
3385 if test -n "$CFLAGS"; then
3386     AC_MSG_RESULT([$CFLAGS])
3387     x_CFLAGS=
3388 else
3389     AC_MSG_RESULT(no)
3390     x_CFLAGS=[\#]
3392 AC_MSG_CHECKING(for explicit CXXFLAGS)
3393 if test -n "$CXXFLAGS"; then
3394     AC_MSG_RESULT([$CXXFLAGS])
3395     x_CXXFLAGS=
3396 else
3397     AC_MSG_RESULT(no)
3398     x_CXXFLAGS=[\#]
3400 AC_MSG_CHECKING(for explicit OBJCFLAGS)
3401 if test -n "$OBJCFLAGS"; then
3402     AC_MSG_RESULT([$OBJCFLAGS])
3403     x_OBJCFLAGS=
3404 else
3405     AC_MSG_RESULT(no)
3406     x_OBJCFLAGS=[\#]
3408 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
3409 if test -n "$OBJCXXFLAGS"; then
3410     AC_MSG_RESULT([$OBJCXXFLAGS])
3411     x_OBJCXXFLAGS=
3412 else
3413     AC_MSG_RESULT(no)
3414     x_OBJCXXFLAGS=[\#]
3416 AC_MSG_CHECKING(for explicit LDFLAGS)
3417 if test -n "$LDFLAGS"; then
3418     AC_MSG_RESULT([$LDFLAGS])
3419     x_LDFLAGS=
3420 else
3421     AC_MSG_RESULT(no)
3422     x_LDFLAGS=[\#]
3424 AC_SUBST(AFLAGS)
3425 AC_SUBST(CFLAGS)
3426 AC_SUBST(CXXFLAGS)
3427 AC_SUBST(OBJCFLAGS)
3428 AC_SUBST(OBJCXXFLAGS)
3429 AC_SUBST(LDFLAGS)
3430 AC_SUBST(x_AFLAGS)
3431 AC_SUBST(x_CFLAGS)
3432 AC_SUBST(x_CXXFLAGS)
3433 AC_SUBST(x_OBJCFLAGS)
3434 AC_SUBST(x_OBJCXXFLAGS)
3435 AC_SUBST(x_LDFLAGS)
3438 # determine CPU, CPUNAME, GUI, GUIBASE, ...
3440 LIB64="lib"
3441 SOLARINC=
3443 case "$host_os" in
3445 aix*)
3446     COM=GCC
3447     CPU=P
3448     CPUNAME=POWERPC
3449     GUI=UNX
3450     GUIBASE=unx
3451     OS=AIX
3452     RTL_OS=AIX
3453     RTL_ARCH=PowerPC
3454     PLATFORMID=aix_powerpc
3455     OUTPATH=unxaigppc
3456     P_SEP=:
3457     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3458     ;;
3460 cygwin*)
3461     COM=MSC
3462     GUI=WNT
3463     GUIBASE=not-used
3464     OS=WNT
3465     RTL_OS=Windows
3466     P_SEP=";"
3468     case "$host_cpu" in
3469     i*86|x86_64)
3470         if test "$BITNESS_OVERRIDE" = 64; then
3471             CPU=X
3472             CPUNAME=X86_64
3473             RTL_ARCH=X86_64
3474             LIB64="lib/x64"
3475             PLATFORMID=windows_x86_64
3476             OUTPATH=wntmscx$COMEX
3477         else
3478             CPU=I
3479             CPUNAME=INTEL
3480             RTL_ARCH=x86
3481             PLATFORMID=windows_x86
3482             OUTPATH=wntmsci$COMEX
3483         fi
3484         ;;
3485     *)
3486         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3487         ;;
3488     esac
3489     SCPDEFS="$SCPDEFS -D_MSC_VER"
3490     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3491     ;;
3493 darwin*)
3494     COM=GCC
3495     GUI=UNX
3496     GUIBASE=not-used
3497     OS=MACOSX
3498     RTL_OS=MacOSX
3499     P_SEP=:
3501     case "$host_cpu" in
3502     arm*)
3503         CPU=R
3504         CPUNAME=ARM
3505         RTL_ARCH=ARM_EABI
3506         PLATFORMID=ios_arm
3507         OUTPATH=unxiosr
3508         OS=IOS
3509         SDKDIR=sdk
3510         ;;
3511     i*86)
3512         if test "$BITNESS_OVERRIDE" = 64; then
3513             AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
3514         fi
3515         CPU=I
3516         CPUNAME=INTEL
3517         RTL_ARCH=x86
3518         PLATFORMID=macosx_x86
3519         OUTPATH=unxmacxi
3520         ;;
3521     x86_64)
3522         if test "$BITNESS_OVERRIDE" = 64; then
3523             CPU=X
3524             CPUNAME=X86_64
3525             RTL_ARCH=X86_64
3526             PLATFORMID=macosx_x86_64
3527             OUTPATH=unxmacxx
3528         else
3529             CPU=I
3530             CPUNAME=INTEL
3531             RTL_ARCH=x86
3532             PLATFORMID=macosx_x86
3533             OUTPATH=unxmacxi
3534         fi
3535         ;;
3536     *)
3537         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3538         ;;
3539     esac
3540     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3541     ;;
3543 dragonfly*)
3544     COM=GCC
3545     GUI=UNX
3546     GUIBASE=unx
3547     OS=DRAGONFLY
3548     RTL_OS=DragonFly
3549     OUTPATH=unxdfly
3550     P_SEP=:
3552     case "$host_cpu" in
3553     i*86)
3554         CPU=I
3555         CPUNAME=INTEL
3556         RTL_ARCH=x86
3557         PLATFORMID=dragonfly_x86
3558         ;;
3559     x86_64)
3560         CPU=X
3561         CPUNAME=X86_64
3562         RTL_ARCH=X86_64
3563         PLATFORMID=dragonfly_x86_64
3564         ;;
3565     *)
3566         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3567         ;;
3568     esac
3569     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3570     ;;
3572 freebsd*)
3573     COM=GCC
3574     GUI=UNX
3575     GUIBASE=unx
3576     RTL_OS=FreeBSD
3577     OS=FREEBSD
3578     OUTPATH=unxfbsd
3579     P_SEP=:
3581     case "$host_cpu" in
3582     i*86)
3583         CPU=I
3584         CPUNAME=INTEL
3585         RTL_ARCH=x86
3586         PLATFORMID=freebsd_x86
3587         OUTPATH=unxfbsdi
3588         ;;
3589     x86_64)
3590         CPU=X
3591         CPUNAME=X86_64
3592         RTL_ARCH=X86_64
3593         PLATFORMID=freebsd_x86_64
3594         ;;
3595     *)
3596         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3597         ;;
3598     esac
3599     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3600     ;;
3602 kfreebsd*)
3603     COM=GCC
3604     GUI=UNX
3605     GUIBASE=unx
3606     OS=LINUX
3607     RTL_OS=kFreeBSD
3608     P_SEP=:
3610     case "$host_cpu" in
3612     i*86)
3613         CPU=I
3614         CPUNAME=INTEL
3615         RTL_ARCH=x86
3616         PLATFORMID=kfreebsd_x86
3617         OUTPATH=unxkfgi6
3618         ;;
3619     x86_64)
3620         CPU=X
3621         CPUNAME=X86_64
3622         RTL_ARCH=X86_64
3623         LIB64="lib64"
3624         PLATFORMID=kfreebsd_x86_64
3625         OUTPATH=unxkfgx6
3626         ;;
3627     *)
3628         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3629         ;;
3630     esac
3631     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3632     ;;
3634 linux-gnu*)
3635     COM=GCC
3636     GUI=UNX
3637     GUIBASE=unx
3638     OS=LINUX
3639     RTL_OS=Linux
3640     P_SEP=:
3642     case "$host_cpu" in
3644     alpha)
3645         CPU=L
3646         CPUNAME=AXP
3647         RTL_ARCH=ALPHA
3648         PLATFORMID=linux_alpha
3649         OUTPATH=unxlngaxp
3650         ;;
3651     arm*)
3652         CPU=R
3653         CPUNAME=ARM
3654         EPM_FLAGS="-a arm"
3655         OUTPATH=unxlngr
3656         RTL_ARCH=ARM_EABI
3657         PLATFORMID=linux_arm_eabi
3658         case "$host_cpu" in
3659         arm*-linux)
3660             RTL_ARCH=ARM_OABI
3661             PLATFORMID=linux_arm_oabi
3662             ;;
3663         esac
3664         ;;
3665     hppa)
3666         CPU=H
3667         CPUNAME=HPPA
3668         RTL_ARCH=HPPA
3669         EPM_FLAGS="-a hppa"
3670         PLATFORMID=linux_hppa
3671         OUTPATH=unxlnghppa
3672         ;;
3673     i*86)
3674         CPU=I
3675         CPUNAME=INTEL
3676         RTL_ARCH=x86
3677         PLATFORMID=linux_x86
3678         OUTPATH=unxlngi6
3679         ;;
3680     ia64)
3681         CPU=A
3682         CPUNAME=IA64
3683         RTL_ARCH=IA64
3684         PLATFORMID=linux_ia64
3685         OUTPATH=unxlnga
3686         ;;
3687     mips)
3688         CPU=M
3689         CPUNAME=GODSON
3690         RTL_ARCH=MIPS_EB
3691         EPM_FLAGS="-a mips"
3692         PLATFORMID=linux_mips_eb
3693         OUTPATH=unxlngmips
3694         ;;
3695     mips64)
3696         CPU=M
3697         CPUNAME=GODSON
3698         RTL_ARCH=MIPS_EB
3699         EPM_FLAGS="-a mips64"
3700         PLATFORMID=linux_mips_eb
3701         OUTPATH=unxlngmips
3702         ;;
3703     mips64el)
3704         CPU=M
3705         CPUNAME=GODSON
3706         RTL_ARCH=MIPS_EL
3707         EPM_FLAGS="-a mips64el"
3708         PLATFORMID=linux_mips_el
3709         OUTPATH=unxlngmips
3710         ;;
3711     mipsel)
3712         CPU=M
3713         CPUNAME=GODSON
3714         RTL_ARCH=MIPS_EL
3715         EPM_FLAGS="-a mipsel"
3716         PLATFORMID=linux_mips_el
3717         OUTPATH=unxlngmips
3718         ;;
3719     m68k)
3720         CPU=6
3721         CPUNAME=M68K
3722         RTL_ARCH=M68K
3723         PLATFORMID=linux_m68k
3724         OUTPATH=unxlngm68k
3725         ;;
3726     powerpc)
3727         CPU=P
3728         CPUNAME=POWERPC
3729         RTL_ARCH=PowerPC
3730         PLATFORMID=linux_powerpc
3731         OUTPATH=unxlngppc
3732         ;;
3733     powerpc64)
3734         CPU=P
3735         CPUNAME=POWERPC64
3736         RTL_ARCH=PowerPC_64
3737         LIB64="lib64"
3738         PLATFORMID=linux_powerpc_64
3739         OUTPATH=unxlngppc64
3740         ;;
3741     sparc)
3742         CPU=S
3743         CPUNAME=SPARC
3744         RTL_ARCH=SPARC
3745         PLATFORMID=linux_sparc
3746         OUTPATH=unxlngs
3747         ;;
3748     s390)
3749         CPU=3
3750         CPUNAME=S390
3751         RTL_ARCH=S390
3752         PLATFORMID=linux_s390
3753         OUTPATH=unxlngs390
3754         ;;
3755     s390x)
3756         CPU=3
3757         CPUNAME=S390X
3758         RTL_ARCH=S390x
3759         LIB64="lib64"
3760         PLATFORMID=linux_s390x
3761         OUTPATH=unxlngs390x
3762         ;;
3763     x86_64)
3764         CPU=X
3765         CPUNAME=X86_64
3766         RTL_ARCH=X86_64
3767         LIB64="lib64"
3768         PLATFORMID=linux_x86_64
3769         OUTPATH=unxlngx6
3770         ;;
3771     *)
3772         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3773         ;;
3774     esac
3775     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3776     ;;
3778 linux-android*)
3779     COM=GCC
3780     GUI=UNX
3781     GUIBASE=not-used
3782     OS=ANDROID
3783     RTL_OS=Android
3784     P_SEP=:
3786     case "$host_cpu" in
3788     arm|armel)
3789         CPU=R
3790         CPUNAME=ARM
3791         RTL_ARCH=ARM_EABI
3792         PLATFORMID=android_arm_eabi
3793         OUTPATH=unxandr
3794         ;;
3795     mips|mipsel)
3796         CPU=M
3797         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
3798         RTL_ARCH=MIPS_EL
3799         PLATFORMID=android_mips_el
3800         OUTPATH=unxandm
3801         ;;
3802     i*86)
3803         CPU=I
3804         CPUNAME=INTEL
3805         RTL_ARCH=x86
3806         PLATFORMID=android_x86
3807         OUTPATH=unxandi
3808         ;;
3809     *)
3810         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3811         ;;
3812     esac
3813     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3814     ;;
3816 mingw*)
3817     COM=GCC
3818     GUI=WNT
3819     GUIBASE=not-used
3820     OS=WNT
3821     RTL_OS=Windows
3822     P_SEP=:
3824     case "$host_cpu" in
3825     i*86|x86_64)
3826         if test "$BITNESS_OVERRIDE" = 64; then
3827             CPU=X
3828             CPUNAME=X86_64
3829             RTL_ARCH=X86_84
3830             PLATFORMID=windows_x86_64
3831             OUTPATH=wntgccx$COMEX
3832         else
3833             CPU=I
3834             CPUNAME=INTEL
3835             RTL_ARCH=x86
3836             PLATFORMID=windows_x86
3837             OUTPATH=wntgcci$COMEX
3838         fi
3839         ;;
3840     *)
3841         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3842         ;;
3843     esac
3844     SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgcci"
3845     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3846     ;;
3848 *netbsd*)
3850     COM=GCC
3851     GUI=UNX
3852     GUIBASE=unx
3853     OS=NETBSD
3854     RTL_OS=NetBSD
3855     OUTPATH=unxnbsd
3856     P_SEP=:
3858     case "$host_cpu" in
3859     i*86)
3860         CPU=I
3861         CPUNAME=INTEL
3862         RTL_ARCH=x86
3863         PLATFORMID=netbsd_x86
3864         ;;
3865     powerpc)
3866         CPU=P
3867         CPUNAME=POWERPC
3868         RTL_ARCH=PowerPC
3869         PLATFORMID=netbsd_powerpc
3870         ;;
3871     sparc)
3872         CPU=S
3873         CPUNAME=SPARC
3874         RTL_ARCH=SPARC
3875         PLATFORMID=netbsd_sparc
3876         ;;
3877     x86_64)
3878         CPU=X
3879         CPUNAME=X86_64
3880         RTL_ARCH=X86_64
3881         PLATFORMID=netbsd_x86_64
3882         ;;
3883     *)
3884         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3885         ;;
3886     esac
3887     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3888     ;;
3890 openbsd*)
3891     COM=GCC
3892     GUI=UNX
3893     GUIBASE=unx
3894     OS=OPENBSD
3895     RTL_OS=OpenBSD
3896     OUTPATH=unxobsd
3897     P_SEP=:
3899     case "$host_cpu" in
3900     i*86)
3901         CPU=I
3902         CPUNAME=INTEL
3903         RTL_ARCH=x86
3904         PLATFORMID=openbsd_x86
3905         ;;
3906     x86_64)
3907         CPU=X
3908         CPUNAME=X86_64
3909         RTL_ARCH=X86_64
3910         PLATFORMID=openbsd_x86_64
3911         ;;
3912     *)
3913         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3914         ;;
3915     esac
3916     SOLARINC="$SOLARINC -I/usr/local/include"
3917     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3918     SOLARLIB="$SOLARLIB -L/usr/local/lib"
3920     ;;
3922 solaris*)
3924     COM=GCC
3925     GUI=UNX
3926     GUIBASE=unx
3927     OS=SOLARIS
3928     RTL_OS=Solaris
3929     P_SEP=:
3931     case "$host_cpu" in
3932     i*86)
3933         CPU=I
3934         CPUNAME=INTEL
3935         RTL_ARCH=x86
3936         PLATFORMID=solaris_x86
3937         OUTPATH=unxsogi
3938         ;;
3939     sparc)
3940         CPU=S
3941         CPUNAME=SPARC
3942         RTL_ARCH=SPARC
3943         PLATFORMID=solaris_sparc
3944         OUTPATH=unxsogs
3945         ;;
3946     *)
3947         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3948         ;;
3949     esac
3950     SOLARINC="$SOLARINC -I/usr/local/include"
3951     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3952     SOLARLIB="$SOLARLIB -L$COMPATH/lib"
3953     SOLARLIB="$SOLARLIB -L/usr/local/bin -L/usr/dt/lib -L/usr/openwin/lib"
3954     ;;
3957     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
3958     ;;
3959 esac
3961 if test "$enable_headless" = "yes"; then
3962     if test "$GUIBASE" != "unx"; then
3963         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --enable-headless])
3964     fi
3965     GUIBASE=headless
3968 INPATH="${OUTPATH}${PROEXT}"
3969 if test -n "${with_solver_and_workdir_root}"; then
3970     PathFormat "${with_solver_and_workdir_root}"
3971     # IsValidFilePath in /sal/osl/w32/file_url.cxx rejects "X:\\" breaking idlc
3972     if echo ${formatted_path} | $GREP -q '/$'; then
3973         WORKDIR=${formatted_path}workdir/${INPATH}
3974         INSTDIR=${formatted_path}instdir/${INPATH}
3975     else
3976         WORKDIR=${formatted_path}/workdir/${INPATH}
3977         INSTDIR=${formatted_path}/instdir/${INPATH}
3978     fi
3979 else
3980     WORKDIR=${BUILDDIR}/workdir/${INPATH}
3981     INSTDIR=${BUILDDIR}/instdir/${INPATH}
3983 OUTDIR="${SOLARVER}/${INPATH}"
3984 SOLARINC="-I. -I$SRC_ROOT/include -I${SOLARVER}/$INPATH/inc/external -I${SOLARVER}/$INPATH/inc $SOLARINC"
3985 AC_SUBST(COM)
3986 AC_SUBST(CPU)
3987 AC_SUBST(CPUNAME)
3988 AC_SUBST(RTL_OS)
3989 AC_SUBST(RTL_ARCH)
3990 AC_SUBST(EPM_FLAGS)
3991 AC_SUBST(GUI)
3992 AC_SUBST(GUIBASE)
3993 AC_SUBST(INPATH)
3994 AC_SUBST([INSTDIR])
3995 AC_SUBST(OS)
3996 AC_SUBST(OUTDIR)
3997 AC_SUBST(OUTPATH)
3998 AC_SUBST(P_SEP)
3999 AC_SUBST(SOLARVER)
4000 AC_SUBST(WORKDIR)
4001 AC_SUBST(PLATFORMID)
4002 AC_DEFINE_UNQUOTED(OUTDIR,"$OUTDIR")
4003 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4005 dnl ===================================================================
4006 dnl Test which package format to use
4007 dnl ===================================================================
4008 AC_MSG_CHECKING([which package format to use])
4009 if test -n "$with_package_format"; then
4010     for i in $with_package_format; do
4011         case "$i" in
4012         aix | bsd | deb | inst | tardist | osx | pkg | rpm | setld | native | portable | archive | dmg | installed | msi)
4013             ;;
4014         *)
4015             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4016 aix - AIX software distribution
4017 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4018 deb - Debian software distribution
4019 inst or tardist - IRIX software distribution
4020 osx - MacOS X software distribution
4021 pkg - Solaris software distribution
4022 rpm - RedHat software distribution
4023 setld - Tru64 (setld) software distribution
4024 native - "Native" software distribution for the platform
4025 portable - Portable software distribution
4027 LibreOffice additionally supports:
4028 archive - .tar.gz or .zip
4029 dmg - Mac OS X .dmg
4030 installed - installation tree
4031 msi - Windows .msi
4032         ])
4033             ;;
4034         esac
4035     done
4036     PKGFORMAT="$with_package_format"
4037 elif test "$enable_epm" = "yes"; then
4038     # defaults
4039     case "$_os" in
4040     Darwin)
4041         PKGFORMAT=dmg
4042         ;;
4043     SunOS)
4044         PKGFORMAT=pkg
4045         ;;
4046     Linux)
4047         # if building on Debian, default should be deb...
4048         if test -e /etc/debian_version; then
4049             PKGFORMAT=deb
4050         else
4051             PKGFORMAT=rpm
4052         fi
4053         ;;
4054     AIX)
4055         PKGFORMAT=rpm
4056         ;;
4057     OpenBSD|DragonFly)
4058         PKGFORMAT=portable
4059         ;;
4060     *BSD)
4061         PKGFORMAT=bsd
4062         ;;
4063     WINNT)
4064         PKGFORMAT=msi
4065         ;;
4066     # we never should get here since we check the arciecture/os at the beginning,
4067     # but go sure...
4068     *)
4069         AC_MSG_ERROR([unknown system])
4070     esac
4071 else
4072     if test "$WITH_MINGW" = "yes"; then
4073         # when tested, we should default this to 'msi', instead of 'archive'
4074         PKGFORMAT=archive
4075     else
4076         PKGFORMAT=native
4077     fi
4079 AC_MSG_RESULT([$PKGFORMAT])
4080 AC_SUBST(PKGFORMAT)
4082 dnl ===================================================================
4083 dnl Set up a different compiler to produce tools to run on the build
4084 dnl machine when doing cross-compilation
4085 dnl ===================================================================
4087 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4088 if test "$cross_compiling" = "yes"; then
4089     AC_MSG_CHECKING([for BUILD platform configuration])
4090     echo
4091     rm -rf CONF-FOR-BUILD config_build.mk
4092     mkdir CONF-FOR-BUILD
4093     (cd $SRC_ROOT && tar cf - \
4094         config.guess \
4095         config_host.mk.in \
4096         Makefile.in \
4097         lo.xcent.in \
4098         config_host/*.in \
4099         bin/get_config_variables \
4100         solenv/bin/getcompver.awk \
4101         solenv/inc/langlist.mk \
4102         instsetoo_native/util/openoffice.lst.in) \
4103     | (cd CONF-FOR-BUILD && tar xf -)
4104     cp configure CONF-FOR-BUILD
4105     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host
4106     (
4107     unset COM GUI GUIBASE OS CPU CPUNAME
4108     unset CC CXX SYSBASE CFLAGS
4109     unset AR NM OBJDUMP PKG_CONFIG RANLIB STRIP
4110     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4111     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
4112     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4113     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4114     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4115     cd CONF-FOR-BUILD
4116     sub_conf_opts=""
4117     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4118     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4119     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4120     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4121     test -n "${with_solver_and_workdir_root}" && sub_conf_opts="$sub_conf_opts --with-solver-and-workdir-root=${with_solver_and_workdir_root}"
4122     test -n "$with_system_boost_for_build" && sub_conf_opts="$sub_conf_opts --with-system-boost"
4123     test -n "$with_system_cppunit_for_build" && sub_conf_opts="$sub_conf_opts --with-system-cppunit"
4124     test -n "$with_system_expat_for_build" && sub_conf_opts="$sub_conf_opts --with-system-expat"
4125     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4126     test -n "$with_system_libxml_for_build" && sub_conf_opts="$sub_conf_opts --with-system-libxml"
4127     # we need the msi build tools on mingw if we are creating the
4128     # installation set
4129     if test "$WITH_MINGW" = "yes"; then
4130         enable_winegcc_for_build=
4131         for pkgformat in $PKGFORMAT; do
4132             case "$pkgformat" in
4133                 msi|native) enable_winegcc_for_build=yes ;;
4134             esac
4135         done
4136         test -n "$enable_winegcc_for_build" && sub_conf_opts="$sub_conf_opts --enable-winegcc"
4137     fi
4138     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4139     # Don't bother having configure look for stuff not needed for the build platform anyway
4140     ./configure \
4141         --disable-graphite \
4142         --disable-postgresql-sdbc \
4143         --with-parallelism="$with_parallelism" \
4144         --without-doxygen \
4145         --without-java \
4146         ENABLE_PDFIMPORT=FALSE \
4147         $sub_conf_opts \
4148         --srcdir=$srcdir \
4149         2>&1 | sed -e 's/^/    /'
4150     test -f ./config_host.mk 2>/dev/null || exit
4151     cp config_host.mk ../config_build.mk
4152     mv config.log ../config.Build.log
4153     mkdir -p ../config_build
4154     mv config_host/*.h ../config_build
4155     . ./bin/get_config_variables OS PATH CC CXX INPATH SYSTEM_LIBXSLT OUTDIR WORKDIR
4157     for V in OS CC CXX INPATH SYSTEM_LIBXSLT; do
4158         VV='$'$V
4159         VV=`eval "echo $VV"`
4160         if test -n "$VV"; then
4161             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4162             echo "$line" >>build-config
4163         fi
4164     done
4166     for V in OUTDIR WORKDIR; do
4167         VV='$'$V
4168         VV=`eval "echo $VV"`
4169         VV=`echo $VV | sed -e 's,/CONF-FOR-BUILD,,g'`
4170         if test -n "$VV"; then
4171             line="${V}_FOR_BUILD='$VV'"
4172             echo "$line" >>build-config
4173         fi
4174     done
4176     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4177     echo "$line" >>build-config
4179     )
4180     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4181     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])
4182     perl -pi -e 's,/CONF-FOR-BUILD,,g' config_build.mk
4183     eval `cat CONF-FOR-BUILD/build-config`
4184     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4185     rm -rf CONF-FOR-BUILD
4186 else
4187     OS_FOR_BUILD="$OS"
4188     CC_FOR_BUILD="$CC"
4189     CXX_FOR_BUILD="$CXX"
4190     INPATH_FOR_BUILD="$INPATH"
4191     OUTDIR_FOR_BUILD="$OUTDIR"
4192     WORKDIR_FOR_BUILD="$WORKDIR"
4194 AC_SUBST(OS_FOR_BUILD)
4195 AC_SUBST(INPATH_FOR_BUILD)
4196 AC_SUBST(OUTDIR_FOR_BUILD)
4197 AC_SUBST(WORKDIR_FOR_BUILD)
4199 dnl ===================================================================
4200 dnl Our version is defined by the AC_INIT() at the top of this script.
4201 dnl ===================================================================
4203 set `echo AC_PACKAGE_VERSION | sed "s/\./ /g"`
4205 LIBO_VERSION_MAJOR=$1
4206 LIBO_VERSION_MINOR=$2
4207 LIBO_VERSION_MICRO=$3
4208 LIBO_VERSION_PATCH=$4
4210 LIBO_VERSION_SUFFIX=$5
4211 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
4212 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
4213 # they get undoubled before actually passed to sed.
4214 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
4215 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
4216 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
4217 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
4219 AC_SUBST(LIBO_VERSION_MAJOR)
4220 AC_SUBST(LIBO_VERSION_MINOR)
4221 AC_SUBST(LIBO_VERSION_MICRO)
4222 AC_SUBST(LIBO_VERSION_PATCH)
4223 AC_SUBST(LIBO_VERSION_SUFFIX)
4224 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
4226 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
4227 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
4228 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
4229 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
4231 LIBO_THIS_YEAR=`date +%Y`
4232 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
4234 # This UPD silly thing must go away soon
4235 UPD="${LIBO_VERSION_MAJOR}${LIBO_VERSION_MINOR}0"
4236 AC_SUBST(UPD)
4238 # This too should go away
4239 SOURCEVERSION="OOO$UPD"
4240 AC_SUBST(SOURCEVERSION)
4242 dnl ===================================================================
4243 dnl Check for syslog header
4244 dnl ===================================================================
4245 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4247 dnl ===================================================================
4248 dnl Set the ENABLE_CRASHDUMP variable.
4249 dnl ===================================================================
4250 AC_MSG_CHECKING([whether to enable crashdump feature])
4251 if test "$enable_crashdump" = "yes"; then
4252     ENABLE_CRASHDUMP="TRUE"
4253     BUILD_TYPE="$BUILD_TYPE CRASHREP"
4254     AC_MSG_RESULT([yes])
4255 else
4256     ENABLE_CRASHDUMP=""
4257     AC_MSG_RESULT([no])
4259 AC_SUBST(ENABLE_CRASHDUMP)
4262 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4263 dnl ===================================================================
4264 AC_MSG_CHECKING([whether to turn warnings to errors])
4265 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4266     EXTERNAL_WARNINGS_NOT_ERRORS="FALSE"
4267     AC_MSG_RESULT([yes])
4268 else
4269     EXTERNAL_WARNINGS_NOT_ERRORS="TRUE"
4270     AC_MSG_RESULT([no])
4272 AC_SUBST(EXTERNAL_WARNINGS_NOT_ERRORS)
4274 dnl Set the ASSERT_ALWAYS_ABORT variable. (Activate --enable-assert-always-abort)
4275 dnl ===================================================================
4276 AC_MSG_CHECKING([whether to have assert to abort in release code])
4277 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4278     ASSERT_ALWAYS_ABORT="TRUE"
4279     AC_MSG_RESULT([yes])
4280 else
4281     ASSERT_ALWAYS_ABORT="FALSE"
4282     AC_MSG_RESULT([no])
4284 AC_SUBST(ASSERT_ALWAYS_ABORT)
4286 dnl Determine whether to use linkoo for the smoketest installation
4287 dnl ===================================================================
4288 AC_MSG_CHECKING([whether to use linkoo for the smoketest installation])
4289 if test $_os = Darwin; then
4290     enable_linkoo=no
4293 if test "$enable_linkoo" = "no"; then
4294     DISABLE_LINKOO="TRUE"
4295     AC_MSG_RESULT([no])
4296 else
4297     DISABLE_LINKOO=
4298     AC_MSG_RESULT([yes])
4300 AC_SUBST(DISABLE_LINKOO)
4302 # Set the ENABLE_LTO variable
4303 # ===================================================================
4304 AC_MSG_CHECKING([whether to use link-time optimization])
4305 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
4306     ENABLE_LTO="TRUE"
4307     AC_MSG_RESULT([yes])
4308 else
4309     ENABLE_LTO=""
4310     AC_MSG_RESULT([no])
4312 AC_SUBST(ENABLE_LTO)
4314 if test "$enable_headless" = "yes"; then
4315     # be sure to do not mess with uneeded stuff
4316     test_randr=no
4317     test_xrender=no
4318     test_cups=no
4319     test_dbus=no
4320     test_fontconfig=yes
4321     test_gtk=no
4322     build_gstreamer=no
4323     build_gstreamer_0_10=no
4324     test_tde=no
4325     test_kde=no
4326     test_kde4=no
4327     enable_cairo_canvas=no
4328     enable_gnome_vfs=no
4331 dnl ===================================================================
4332 dnl check for cups support
4333 dnl ===================================================================
4334 ENABLE_CUPS=""
4336 if test "$enable_cups" = "no"; then
4337     test_cups=no
4340 AC_MSG_CHECKING([whether to enable CUPS support])
4341 if test "$test_cups" = "yes"; then
4342     ENABLE_CUPS="TRUE"
4343     AC_MSG_RESULT([yes])
4345     AC_MSG_CHECKING([whether cups support is present])
4346     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4347     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4348     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -a "$ac_cv_header_cups_cups_h" != "yes"; then
4349         AC_MSG_ERROR([Could not find CUPS. Install libcupsys2-dev or cups-devel.])
4350     fi
4352 else
4353     AC_MSG_RESULT([no])
4356 AC_SUBST(ENABLE_CUPS)
4358 # fontconfig checks
4359 if test "$test_fontconfig" = "yes"; then
4360     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.2.0])
4361 else
4362     case "$BUILD_TYPE" in
4363     *FONTCONFIG*)
4364         FONTCONFIG_LIBS="-lfontconfig"
4365         ;;
4366     esac
4368 AC_SUBST(FONTCONFIG_CFLAGS)
4369 AC_SUBST(FONTCONFIG_LIBS)
4371 dnl whether to find & fetch external tarballs?
4372 dnl ===================================================================
4373 if test -z "$TARFILE_LOCATION"; then
4374     TARFILE_LOCATION="$SRC_ROOT/src"
4376 AC_SUBST(TARFILE_LOCATION)
4378 AC_MSG_CHECKING([whether we want to fetch tarballs])
4379 if test "$enable_fetch_external" != "no"; then
4380     if test "$with_all_tarballs" = "yes"; then
4381         AC_MSG_RESULT(["yes, all of them"])
4382         DO_FETCH_TARBALLS="ALL"
4383     else
4384         AC_MSG_RESULT(["yes, if we use them"])
4385         DO_FETCH_TARBALLS="YES"
4386     fi
4387 else
4388     AC_MSG_RESULT([no])
4389     DO_FETCH_TARBALLS="NO"
4391 AC_SUBST(DO_FETCH_TARBALLS)
4393 AC_MSG_CHECKING([whether to build help])
4394 if test "$with_help" = "yes" -a $_os != iOS -a $_os != Android; then
4395     AC_MSG_RESULT([yes])
4396     BUILD_TYPE="$BUILD_TYPE HELP"
4397     SCPDEFS="$SCPDEFS -DWITH_HELP"
4398     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4399 else
4400     AC_MSG_RESULT([no])
4403 dnl Test whether to include MySpell dictionaries
4404 dnl ===================================================================
4405 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4406 if test "$with_myspell_dicts" = "yes"; then
4407     AC_MSG_RESULT([yes])
4408     WITH_MYSPELL_DICTS=YES
4409     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4410     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4411 else
4412     AC_MSG_RESULT([no])
4413     WITH_MYSPELL_DICTS=NO
4415 AC_SUBST(WITH_MYSPELL_DICTS)
4417 AC_MSG_CHECKING([whether to use dicts from external paths])
4418 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4419     AC_MSG_RESULT([yes])
4420     SYSTEM_DICTS=YES
4421     AC_MSG_CHECKING([for spelling dictionary directory])
4422     if test -n "$with_external_dict_dir"; then
4423         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4424     else
4425         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4426         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4427             DICT_SYSTEM_DIR=file:///usr/share/myspell
4428         fi
4429     fi
4430     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4431     AC_MSG_CHECKING([for hyphenation patterns directory])
4432     if test -n "$with_external_hyph_dir"; then
4433         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4434     else
4435         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4436     fi
4437     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4438     AC_MSG_CHECKING([for thesaurus directory])
4439     if test -n "$with_external_thes_dir"; then
4440         THES_SYSTEM_DIR=file://$with_external_thes_dir
4441     else
4442         THES_SYSTEM_DIR=file:///usr/share/mythes
4443     fi
4444     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4445 else
4446     AC_MSG_RESULT([no])
4447     SYSTEM_DICTS=NO
4449 AC_SUBST(SYSTEM_DICTS)
4450 AC_SUBST(DICT_SYSTEM_DIR)
4451 AC_SUBST(HYPH_SYSTEM_DIR)
4452 AC_SUBST(THES_SYSTEM_DIR)
4454 dnl ===================================================================
4455 AC_MSG_CHECKING([whether to enable pch feature])
4456 if test -n "$enable_pch" && test "$enable_pch" != "no"; then
4457     if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
4458         ENABLE_PCH="TRUE"
4459         AC_MSG_RESULT([yes])
4460     elif test "$GCC" = "yes"; then
4461         ENABLE_PCH="TRUE"
4462         AC_MSG_RESULT([yes])
4463     else
4464         ENABLE_PCH=""
4465         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4466     fi
4467 else
4468     ENABLE_PCH=""
4469     AC_MSG_RESULT([no])
4471 AC_SUBST(ENABLE_PCH)
4473 dnl ===================================================================
4474 dnl Search all the common names for GNU make
4475 dnl ===================================================================
4476 AC_MSG_CHECKING([for GNU make])
4478 # try to use our own make if it is available and GNUMAKE was not already defined
4479 if test -z "$GNUMAKE"; then
4480     if test -x "/opt/lo/bin/make"; then
4481         GNUMAKE="/opt/lo/bin/make"
4482     fi
4485 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
4486     if test -n "$a"; then
4487         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
4488         if test $? -eq 0;  then
4489             GNUMAKE=`which $a`
4490             break
4491         fi
4492     fi
4493 done
4494 AC_MSG_RESULT($GNUMAKE)
4495 if test -z "$GNUMAKE"; then
4496     AC_MSG_ERROR([not found. install GNU make.])
4499 TAB=`printf '\t'`
4501 AC_MSG_CHECKING([the GNU make version])
4502 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4503 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4504 if test "$_make_longver" -ge "038200"; then
4505     AC_MSG_RESULT([$GNUMAKE $_make_version])
4507 elif test "$_make_longver" -ge "038100"; then
4508     if test "$build_os" = "cygwin"; then
4509         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4510     fi
4511     AC_MSG_RESULT([$GNUMAKE $_make_version])
4513     dnl ===================================================================
4514     dnl Search all the common names for sha1sum
4515     dnl ===================================================================
4516     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4517     if test -z "$SHA1SUM"; then
4518         AC_MSG_ERROR([install the approproate SHA-1 checksumming program for this OS])
4519     elif test "$SHA1SUM" = "openssl"; then
4520         SHA1SUM="openssl sha1"
4521     fi
4522     AC_MSG_CHECKING([for GNU make bug 20033])
4523     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4524     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4525 A := \$(wildcard *.a)
4527 .PHONY: all
4528 all: \$(A:.a=.b)
4529 <TAB>@echo survived bug20033.
4531 .PHONY: setup
4532 setup:
4533 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4535 define d1
4536 @echo lala \$(1)
4537 @sleep 1
4538 endef
4540 define d2
4541 @echo tyty \$(1)
4542 @sleep 1
4543 endef
4545 %.b : %.a
4546 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4547 <TAB>\$(call d1,\$(CHECKSUM)),\
4548 <TAB>\$(call d2,\$(CHECKSUM)))
4550     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4551         no_parallelism_make="YES"
4552         AC_MSG_RESULT([yes, disable parallelism])
4553     else
4554         AC_MSG_RESULT([no, keep parallelism enabled])
4555     fi
4556     rm -rf $TESTGMAKEBUG20033
4557 else
4558     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4561 # find if gnumake support file function
4562 AC_MSG_CHECKING([whether GNU make supports the 'file' function])
4563 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4564 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4565 \$(file >test.txt,Success )
4567 .PHONY: all
4568 all:
4569 <TAB>@cat test.txt
4572 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4573 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4574     HAVE_GNUMAKE_FILE_FUNC="YES"
4575     AC_MSG_RESULT([yes])
4576 else
4577     AC_MSG_RESULT([no])
4579 rm -rf $TESTGMAKEFILEFUNC
4580 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4581 AC_SUBST(GNUMAKE)
4583 _make_ver_check=`$GNUMAKE --version | grep LibreOffice`
4584 STALE_MAKE=
4585 make_warning=
4586 if test "$_make_ver_check" = ""; then
4587    STALE_MAKE=TRUE
4590 HAVE_LD_HASH_STYLE=FALSE
4591 WITH_LINKER_HASH_STYLE=
4592 AC_MSG_CHECKING( for --hash-style gcc linker support )
4593 if test "$GCC" = "yes"; then
4594     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4595         hash_styles="gnu sysv"
4596     elif test "$with_linker_hash_style" = "no"; then
4597         hash_styles=
4598     else
4599         hash_styles="$with_linker_hash_style"
4600     fi
4602     for hash_style in $hash_styles; do
4603         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4604         hash_style_ldflags_save=$LDFLAGS
4605         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
4607         AC_LINK_IFELSE([AC_LANG_PROGRAM(
4608             [
4609 #include <stdio.h>
4610             ],[
4611 printf ("");
4612             ])],
4613             [ if ./conftest$EXEEXT; then
4614                   HAVE_LD_HASH_STYLE=TRUE
4615                   WITH_LINKER_HASH_STYLE=$hash_style
4616               fi],
4617             [HAVE_LD_HASH_STYLE=FALSE])
4618         LDFLAGS=$hash_style_ldflags_save
4619     done
4621     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
4622         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
4623     else
4624         AC_MSG_RESULT( no )
4625     fi
4626     LDFLAGS=$hash_style_ldflags_save
4627 else
4628     AC_MSG_RESULT( no )
4630 AC_SUBST(HAVE_LD_HASH_STYLE)
4631 AC_SUBST(WITH_LINKER_HASH_STYLE)
4633 dnl ===================================================================
4634 dnl Check whether there's a Perl version available.
4635 dnl ===================================================================
4636 if test -z "$with_perl_home"; then
4637     AC_PATH_PROG(PERL, perl)
4638 else
4639     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
4640     _perl_path="$with_perl_home/bin/perl"
4641     if test -x "$_perl_path"; then
4642         PERL=$_perl_path
4643     else
4644         AC_MSG_ERROR([$_perl_path not found])
4645     fi
4648 dnl ===================================================================
4649 dnl Testing for Perl version 5 or greater.
4650 dnl $] is the Perl version variable, it is returned as an integer
4651 dnl ===================================================================
4652 if test "$PERL"; then
4653     AC_MSG_CHECKING([the Perl version])
4654     ${PERL} -e "exit($]);"
4655     _perl_version=$?
4656     if test "$_perl_version" -lt 5; then
4657         AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
4658     fi
4659     AC_MSG_RESULT([checked (perl $_perl_version)])
4660 else
4661     AC_MSG_ERROR([Perl not found, install version 5 of Perl])
4664 dnl ===================================================================
4665 dnl Testing for required Perl modules
4666 dnl ===================================================================
4668 AC_MSG_CHECKING([for required Perl modules])
4669 if `$PERL -e 'use Archive::Zip; use Cwd; use Digest::MD5'`; then
4670     AC_MSG_RESULT([all modules found])
4671 else
4672     AC_MSG_ERROR([Failed to find some modules])
4676 dnl ===================================================================
4677 dnl Check for pkg-config
4678 dnl ===================================================================
4679 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
4680     PKG_PROG_PKG_CONFIG
4683 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
4685     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
4686     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
4687     # explicitly. Or put /path/to/compiler in PATH yourself.
4689     AC_CHECK_TOOL(AR,ar)
4690     AC_CHECK_TOOL(NM,nm)
4691     AC_CHECK_TOOL(OBJDUMP,objdump)
4692     AC_CHECK_TOOL(RANLIB,ranlib)
4693     AC_CHECK_TOOL(STRIP,strip)
4694     if test "$_os" = "WINNT"; then
4695         AC_CHECK_TOOL(DLLTOOL,dlltool)
4696         AC_CHECK_TOOL(WINDRES,windres)
4697     fi
4699 AC_SUBST(AR)
4700 AC_SUBST(DLLTOOL)
4701 AC_SUBST(NM)
4702 AC_SUBST(OBJDUMP)
4703 AC_SUBST(PKG_CONFIG)
4704 AC_SUBST(RANLIB)
4705 AC_SUBST(STRIP)
4706 AC_SUBST(WINDRES)
4708 dnl ===================================================================
4709 dnl pkg-config checks on Mac OS X
4710 dnl ===================================================================
4712 if test $_os = Darwin; then
4713     AC_MSG_CHECKING([for bogus pkg-config])
4714     if test -n "$PKG_CONFIG"; then
4715         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
4716             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
4717         else
4718             if test "$enable_bogus_pkg_config" = "yes"; then
4719                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
4720             else
4721                 AC_MSG_ERROR([yes, from unknown origin. This *will* break the build. Please remove or hide $PKG_CONFIG])
4722             fi
4723         fi
4724     else
4725         AC_MSG_RESULT([no, good])
4726     fi
4729 find_csc()
4731     # Return value: $csctest
4733     unset csctest
4735     if test $VCVER -eq 90; then
4736         reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v3.5/InstallPath"
4737         if test -n "$regvalue"; then
4738             csctest=$regvalue
4739             return
4740         fi
4741         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/InstallRoot
4742         if test -n "$regvalue"; then
4743             csctest=${regvalue}"v2.0.50727"
4744             return
4745         fi
4746     else
4747         reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
4748         if test -n "$regvalue"; then
4749             csctest=$regvalue
4750             return
4751         fi
4752     fi
4755 find_al()
4757     # Return value: $altest
4759     unset altest
4761     for x in `ls /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
4762         reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
4763         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
4764             altest=$regvalue
4765             return
4766         fi
4767     done
4770 find_dotnetsdk()
4772     # Return value: $frametest (that's a silly name...)
4774     unset frametest
4776     for ver in 1.1 2.0; do
4777         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
4778         if test -n "$regvalue"; then
4779             frametest=$regvalue
4780             return
4781         fi
4782     done
4785 find_winsdk_version()
4787     # Args: $1 : SDK version as in "6.0A", "7.0" etc
4788     # Return value: $winsdktest
4790     unset winsdktest
4792     # Why we look for them in this particular order I don't know. But OTOH I
4793     case "$1" in
4794     6.0*|7.*)
4795         reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
4796         if test -n "$regvalue"; then
4797             winsdktest=$regvalue
4798             return
4799         fi
4800         ;;
4801     8.*)
4802         reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
4803         if test -n "$regvalue"; then
4804             winsdktest=$regvalue
4805             return
4806         fi
4807         ;;
4808     esac
4811 find_winsdk()
4813     # Args: $1 (optional) : list of acceptable SDK versions
4814     # Return value: $winsdktest
4816     unset winsdktest
4818     if test -n "$1"; then
4819         sdkversions=$1
4820     else
4821         sdkversions="$WINDOWS_SDK_ACCEPTABLE_VERSIONS"
4822     fi
4824     for ver in $sdkversions; do
4825         find_winsdk_version $ver
4826         if test -n "$winsdktest"; then
4827             return
4828         fi
4829     done
4832 find_msms()
4834     for ver in 9.0 10.0 11.0; do
4835         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
4836         if test -n "$regvalue"; then
4837             if test -e "$regvalue/Microsoft_VC${VCVER}_CRT_x86.msm"; then
4838                 msmdir=$regvalue
4839                 break
4840             fi
4841         fi
4842     done
4843     if test -z "$msmdir"; then
4844         AC_MSG_NOTICE([no registry entry for Merge Module directory - trying "$COMMONPROGRAMFILES\Merge Modules"])
4845         msmdir="$COMMONPROGRAMFILES\Merge Modules"
4846     fi
4847     msmdir=`cygpath -d "$msmdir"`
4848     msmdir=`cygpath -u "$msmdir"`
4849     if test -z "$msmdir"; then
4850         AC_MSG_ERROR([Merge modules not found])
4851     fi
4853     msms="Microsoft_VC${VCVER}_CRT_x86.msm"
4855     if test "$VCVER" = "90"; then
4856         if test -e $msmdir/policy_9_0_Microsoft_VC90_CRT_x86.msm; then
4857             msms="$msms policy_9_0_Microsoft_VC90_CRT_x86.msm"
4858         else
4859             AC_MSG_ERROR([Merge module policy_9_0_Microsoft_VC90_CRT_x86.msm not found])
4860         fi
4861     fi
4863     if test "$BUILD_X64" = TRUE; then
4864         if test "$VCVER" = "90"; then
4865             if test -e $msmdir/policy_9_0_Microsoft_VC90_CRT_x86_x64.msm; then
4866                 msms="$msms policy_9_0_Microsoft_VC90_CRT_x86_x64.msm"
4867             else
4868                 AC_MSG_ERROR([Merge module policy_9_0_Microsoft_VC90_CRT_x86_x64.msm not found])
4869             fi
4870             if test -e $msmdir/Microsoft_VC90_CRT_x86_x64.msm; then
4871                 msms="$msms Microsoft_VC90_CRT_x86_x64.msm"
4872             else
4873                 AC_MSG_ERROR([Merge module Microsoft_VC90_CRT_x86_x64.msm not found])
4874             fi
4875         fi
4876     fi
4879 find_msvc_x64_dlls()
4881     if test "$VCVER" != "90"; then
4883         if test "$CPUNAME" = "INTEL"; then
4884            vsarch=x86
4885         else
4886            vsarch=x64
4887         fi
4889         msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
4890         MSVC_DEBUG_DLL_PATH="$VC_PRODUCT_DIR/redist/Debug_NonRedist/$vsarch/Microsoft.VC${VCVER}.DebugCRT"
4891         msvcdlls="msvcp${VCVER}.dll msvcr${VCVER}.dll"
4892         MSVC_DEBUG_DLLS="msvcp${VCVER}d.dll msvcr${VCVER}d.dll"
4893         for dll in $msvcdlls; do
4894             if ! test -f "$msvcdllpath/$dll"; then
4895                 AC_MSG_ERROR([can not find $dll in $msvcdllpath])
4896             fi
4897         done
4898         if test -n "$MSVC_USE_DEBUG_RUNTIME"; then
4899             for dll in $MSVC_DEBUG_DLLS; do
4900                 if ! test -f "$MSVC_DEBUG_DLL_PATH/$dll"; then
4901                     AC_MSG_ERROR([can not find $dll in $MSVC_DEBUG_DLL_PATH])
4902                 fi
4903             done
4904         fi
4905     fi
4908 if test "$build_os" = "cygwin"; then
4909     dnl Check midl.exe
4910     AC_MSG_CHECKING([for midl.exe])
4912     find_winsdk
4913     if test -f "$winsdktest/Bin/midl.exe"; then
4914         MIDL_PATH="$winsdktest/Bin"
4915     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
4916         MIDL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
4917     fi
4918     if test ! -f "$MIDL_PATH/midl.exe"; then
4919         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
4920     else
4921         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
4922     fi
4924     # Convert to posix path with 8.3 filename restrictions ( No spaces )
4925     MIDL_PATH=`cygpath -d "$MIDL_PATH"`
4926     MIDL_PATH=`cygpath -u "$MIDL_PATH"`
4928     dnl Check csc.exe
4929     AC_MSG_CHECKING([for csc.exe])
4930     find_csc
4931     if test -f "$csctest/csc.exe"; then
4932         CSC_PATH="$csctest"
4933     fi
4934     if test ! -f "$CSC_PATH/csc.exe"; then
4935         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
4936     else
4937         AC_MSG_RESULT([$CSC_PATH/csc.exe])
4938     fi
4940     CSC_PATH=`cygpath -d "$CSC_PATH"`
4941     CSC_PATH=`cygpath -u "$CSC_PATH"`
4943     dnl Check al.exe
4944     AC_MSG_CHECKING([for al.exe])
4945     find_winsdk
4946     if test -f "$winsdktest/Bin/al.exe"; then
4947         AL_PATH="$winsdktest/Bin"
4948     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
4949         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
4950     fi
4952     if test -z "$AL_PATH"; then
4953         find_al
4954         if test -f "$altest/bin/al.exe"; then
4955             AL_PATH="$altest/bin"
4956         elif test -f "$altest/al.exe"; then
4957             AL_PATH="$altest"
4958         fi
4959     fi
4960     if test ! -f "$AL_PATH/al.exe"; then
4961         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
4962     else
4963         AC_MSG_RESULT([$AL_PATH/al.exe])
4964     fi
4966     AL_PATH=`cygpath -d "$AL_PATH"`
4967     AL_PATH=`cygpath -u "$AL_PATH"`
4969     dnl Check mscoree.lib / .NET Framework dir
4970     AC_MSG_CHECKING(.NET Framework)
4971     find_dotnetsdk
4972     if test -f "$frametest/lib/mscoree.lib"; then
4973         DOTNET_FRAMEWORK_HOME="$frametest"
4974     else
4975         find_winsdk
4976         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/win8/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
4977             DOTNET_FRAMEWORK_HOME="$winsdktest"
4978         fi
4979     fi
4981     if test ! -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib" -a ! -f "$DOTNET_FRAMEWORK_HOME/lib/win8/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
4982         AC_MSG_ERROR([mscoree.lib (.NET Framework) not found])
4983     fi
4984     AC_MSG_RESULT(found)
4986     PathFormat "$MIDL_PATH"
4987     MIDL_PATH="$formatted_path"
4989     PathFormat "$AL_PATH"
4990     AL_PATH="$formatted_path"
4992     PathFormat "$DOTNET_FRAMEWORK_HOME"
4993     DOTNET_FRAMEWORK_HOME="$formatted_path"
4995     PathFormat "$CSC_PATH"
4996     CSC_PATH="$formatted_path"
4999 dnl ===================================================================
5000 dnl Check if stdc headers are available excluding MSVC.
5001 dnl ===================================================================
5002 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5003     AC_HEADER_STDC
5006 dnl ===================================================================
5007 dnl Testing for C++ compiler and version...
5008 dnl ===================================================================
5010 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5011     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5012     save_CXXFLAGS=$CXXFLAGS
5013     AC_PROG_CXX
5014     CXXFLAGS=$save_CXXFLAGS
5015 else
5016     if test -n "$CC" -a -z "$CXX"; then
5017         CXX="$CC"
5018     fi
5021 dnl check if we are using a buggy version of g++ (currently 3.4.0, 3.4.1 and trunk)
5022 if test "$GXX" = "yes"; then
5023     AC_MSG_CHECKING([the GNU C++ compiler version])
5025     _gpp_version=`$CXX -dumpversion`
5026     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5028     AC_MSG_RESULT([checked (g++ $_gpp_version)])
5030     if test "$_gpp_majmin" = "304"; then
5031         AC_MSG_CHECKING([whether $CXX has the enum bug])
5032         AC_RUN_IFELSE([AC_LANG_SOURCE([[
5033             extern "C" void abort (void);
5034             extern "C" void exit (int status);
5036             enum E { E0, E1, E2, E3, E4, E5 };
5038             void test (enum E e)
5039             {
5040                 if (e == E2 || e == E3 || e == E1)
5041                     exit (1);
5042             }
5044             int main (void)
5045             {
5046                 test (E4);
5047                 test (E5);
5048                 test (E0);
5049                 return 0;
5050             }
5051             ]])],[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])],[])
5052     fi
5053     dnl see https://code.google.com/p/android/issues/detail?id=41770
5054     if test "$_gpp_majmin" -ge "407"; then
5055             glibcxx_threads=no
5056             AC_LANG_PUSH([C++])
5057             AC_REQUIRE_CPP
5058             AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5059             AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5060                 #include <bits/c++config.h>]],[[
5061                 #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5062                 && !defined(_GLIBCXX__PTHREADS) \
5063                 && !defined(_GLIBCXX_HAS_GTHREADS)
5064                 choke me
5065                 #endif
5066             ]])],[AC_MSG_RESULT([yes])
5067             glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5068             AC_LANG_POP([C++])
5069             if test $glibcxx_threads = yes; then
5070                   BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5071             fi
5072      fi
5074 AC_SUBST(BOOST_CXXFLAGS)
5077 # prefx CXX with ccache if needed
5079 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5080     if test "$CCACHE" != ""; then
5081         AC_MSG_CHECKING([whether $CXX is already ccached])
5082         AC_LANG_PUSH([C++])
5083         save_CXXFLAGS=$CXXFLAGS
5084         CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5085         dnl an empty program will do, we're checking the compiler flags
5086         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5087                           [use_ccache=yes], [use_ccache=no])
5088         if test $use_ccache = yes; then
5089             AC_MSG_RESULT([yes])
5090         else
5091             CXX="$CCACHE $CXX"
5092             AC_MSG_RESULT([no])
5093         fi
5094         CXXFLAGS=$save_CXXFLAGS
5095         AC_LANG_POP([C++])
5096     fi
5099 dnl ===================================================================
5100 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5101 dnl ===================================================================
5103 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5104     AC_PROG_CXXCPP
5106     dnl Check whether there's a C pre-processor.
5107     dnl ===================================================================
5108     dnl When using SunStudio compiler, there is a bug with the cc
5109     dnl preprocessor, so use CC preprocessor as the cc preprocessor
5110     dnl See Issuezilla #445.
5111     dnl ===================================================================
5112     if test "$_os" = "SunOS"; then
5113         CPP=$CXXCPP
5114     else
5115         AC_PROG_CPP
5116     fi
5120 dnl ===================================================================
5121 dnl Find integral type sizes and alignments
5122 dnl ===================================================================
5124 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5126     AC_CHECK_SIZEOF(long)
5127     AC_CHECK_SIZEOF(short)
5128     AC_CHECK_SIZEOF(int)
5129     AC_CHECK_SIZEOF(long long)
5130     AC_CHECK_SIZEOF(double)
5131     AC_CHECK_SIZEOF(void*)
5133     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5134     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5135     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5136     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5137     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5139     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5140     m4_pattern_allow([AC_CHECK_ALIGNOF])
5141     m4_ifdef([AC_CHECK_ALIGNOF],
5142         [
5143             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5144             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5145             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5146             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5147         ],
5148         [
5149             case "$_os-$host_cpu" in
5150             Linux-i686)
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=4
5154                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5155                 ;;
5156             Linux-x86_64)
5157                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5158                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5159                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5160                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5161                 ;;
5162             *)
5163                 if test -z "$ac_cv_alignof_short" -o \
5164                         -z "$ac_cv_alignof_int" -o \
5165                         -z "$ac_cv_alignof_long" -o \
5166                         -z "$ac_cv_alignof_double"; then
5167                    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.])
5168                 fi
5169                 ;;
5170             esac
5171         ])
5173     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5174     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5175     if test $ac_cv_sizeof_long -eq 8; then
5176         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5177     elif test $ac_cv_sizeof_double -eq 8; then
5178         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5179     else
5180         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5181     fi
5183     AC_C_BIGENDIAN
5184     WORDS_BIGENDIAN=$ac_cv_c_bigendian
5186     dnl Check for large file support
5187     AC_SYS_LARGEFILE
5188     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5189         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5190     fi
5191     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5192         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5193     fi
5194 else
5195     # Hardcode for MSVC
5196     SAL_TYPES_SIZEOFSHORT=2
5197     SAL_TYPES_SIZEOFINT=4
5198     SAL_TYPES_SIZEOFLONG=4
5199     SAL_TYPES_SIZEOFLONGLONG=8
5200     if test "$BITNESS_OVERRIDE" = ""; then
5201         SAL_TYPES_SIZEOFPOINTER=4
5202     else
5203         SAL_TYPES_SIZEOFPOINTER=8
5204     fi
5205     SAL_TYPES_ALIGNMENT2=2
5206     SAL_TYPES_ALIGNMENT4=4
5207     SAL_TYPES_ALIGNMENT8=8
5208     WORDS_BIGENDIAN=no
5209     LFS_CFLAGS=''
5211 AC_SUBST(WORDS_BIGENDIAN)
5212 AC_SUBST(LFS_CFLAGS)
5214 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5215 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5216 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5217 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5218 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5219 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5220 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5221 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5223 dnl ===================================================================
5224 dnl Check if valgrind headers are available
5225 dnl ===================================================================
5226 if test "$cross_compiling" = yes; then
5227     ENABLE_VALGRIND=FALSE
5228 else
5229     prev_cppflags=$CPPFLAGS
5230     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5231     AC_CHECK_HEADER([valgrind/valgrind.h],
5232         [ENABLE_VALGRIND=TRUE],[ENABLE_VALGRIND=FALSE])
5233     CPPFLAGS=$prev_cppflags
5235 AC_SUBST([ENABLE_VALGRIND])
5236 if test "$ENABLE_VALGRIND" = FALSE; then
5237     VALGRIND_CFLAGS=
5239 AC_SUBST([VALGRIND_CFLAGS])
5241 dnl ===================================================================
5242 dnl Compiler plugins
5243 dnl ===================================================================
5245 COMPILER_PLUGINS=
5246 # currently only Clang
5247 if test "$COM_GCC_IS_CLANG" = "TRUE"; then
5248     if test -n "$enable_compiler_plugins"; then
5249         compiler_plugins="$enable_compiler_plugins"
5250     elif test -n "$ENABLE_DBGUTIL"; then
5251         compiler_plugins=test
5252     else
5253         compiler_plugins=no
5254     fi
5255     if test "$compiler_plugins" != "no"; then
5256         dnl The prefix where Clang resides, override to where Clang resides if
5257         dnl using a source build:
5258         if test -z "$CLANGDIR"; then
5259             CLANGDIR=/usr
5260         fi
5261         dnl The build directory (different from CLANGDIR if using a Clang out-
5262         dnl of-source build):
5263         if test -z "$CLANGBUILD"; then
5264             CLANGBUILD=/usr
5265         fi
5266         AC_LANG_PUSH([C++])
5267         save_CPPFLAGS=$CPPFLAGS
5268         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"
5269         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
5270             [COMPILER_PLUGINS=TRUE],
5271             [
5272             if test "$compiler_plugins" = "yes"; then
5273                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
5274             else
5275                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
5276                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
5277             fi
5278             ])
5279         CPPFLAGS=$save_CPPFLAGS
5280         AC_LANG_POP([C++])
5281     fi
5282 else
5283     if test "$enable_compiler_plugins" = "yes"; then
5284         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
5285     fi
5287 AC_SUBST(COMPILER_PLUGINS)
5288 AC_SUBST(CLANGDIR)
5289 AC_SUBST(CLANGBUILD)
5291 dnl ===================================================================
5292 dnl Set the MinGW sys-root
5293 dnl ===================================================================
5294 if test "$WITH_MINGW" = "yes"; then
5295     AC_MSG_CHECKING([for MinGW sysroot])
5296     sysroot=`$CC -print-sysroot`
5297     AS_IF([test -d "$sysroot"/mingw],
5298           [MINGW_SYSROOT="$sysroot"/mingw
5299            AC_MSG_RESULT([$MINGW_SYSROOT])],
5300           [AC_MSG_RESULT([not found])
5301            AC_MSG_ERROR([cannot determine MinGW sysroot])])
5303 AC_SUBST([MINGW_DLLS])
5304 AC_SUBST([MINGW_SYSROOT])
5306 dnl ===================================================================
5307 dnl Set the MinGW include directories
5308 dnl ===================================================================
5309 if test "$WITH_MINGW" = "yes"; then
5310     AC_MSG_CHECKING([for MinGW include path])
5311     cat >conftest.$ac_ext <<_ACEOF
5312 #include <stddef.h>
5313 #include <bits/c++config.h>
5314 _ACEOF
5315     _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`
5316     rm conftest.$ac_ext
5317     if test -z "$_mingw_lib_include_path"; then
5318         _mingw_lib_include_path="NO_LIB_INCLUDE"
5319         AC_MSG_RESULT([no MinGW include path])
5320     else
5321         AC_MSG_RESULT([$_mingw_lib_include_path])
5322     fi
5323     MINGW_LIB_INCLUDE_PATH="$_mingw_lib_include_path"
5324     AC_SUBST(MINGW_LIB_INCLUDE_PATH)
5326     AC_LANG_PUSH([C++])
5328     AC_MSG_CHECKING([for dynamic libgcc])
5329     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5330 #include <iostream>
5331 using namespace std;
5332 ]], [[ try { throw 42; } catch (int e) { cout << "Yep, " << e << endl; } ]])],[
5333             MINGW_GCCDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libgcc' | $SED -e 's@.*DLL Name: @@'`
5334             if test -n "$MINGW_GCCDLL"; then
5335                 MINGW_SHARED_GCCLIB=YES
5336                 AC_MSG_RESULT([ $MINGW_GCCDLL])
5337             else
5338                 MINGW_SHARED_GCCLIB=NO
5339                 AC_MSG_RESULT([no])
5340             fi
5341        ],[ AC_MSG_RESULT([no])
5343     ])
5345     AC_MSG_CHECKING([for dynamic libstdc++])
5346     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5347 #include <iostream>
5348 using namespace std;
5349 ]], [[ cout << "Hello there." << endl; ]])],[
5350             MINGW_GXXDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libstdc++' | $SED -e 's@.*DLL Name: @@'`
5351             if test -n "$MINGW_GXXDLL"; then
5352                 mingw_gxxdll_root=${MINGW_GXXDLL%.dll}
5353                 mingw_gxxdll_root=${mingw_gxxdll_root#lib}
5354                 if test "$CROSS_COMPILING" = "YES"; then
5355                     dnl m4 escaping!
5356                     mingw_gxxdll_root=${mingw_gxxdll_root%-[[0-9]]}
5357                 fi
5358                 MINGW_SHARED_LIBSTDCPP=-l$mingw_gxxdll_root
5359                 MINGW_SHARED_GXXLIB=YES
5360                 AC_MSG_RESULT([$MINGW_GXXDLL])
5361             else
5362                 MINGW_SHARED_GXXLIB=NO
5363                 AC_MSG_RESULT([no])
5364             fi
5365        ],[ AC_MSG_RESULT([no])
5367     ])
5369     AC_LANG_POP([C++])
5371     AC_SUBST(MINGW_SHARED_GCCLIB)
5372     AC_SUBST(MINGW_SHARED_GXXLIB)
5373     AC_SUBST(MINGW_SHARED_LIBSTDCPP)
5374     AC_SUBST(MINGW_GCCDLL)
5375     AC_SUBST(MINGW_GXXDLL)
5378 if test "$WITH_MINGW" = "yes"; then
5379     AC_MSG_CHECKING([for fMergeNeutralItems in SCRIPT_CONTROL])
5380     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
5381     [
5382     #include <usp10.h>
5383     ],
5384     [
5385     SCRIPT_CONTROL c;
5386     c.fMergeNeutralItems = 1;
5387     ])],
5388     [
5389     AC_MSG_RESULT(yes)
5390     AC_DEFINE(HAVE_FMERGENEUTRALITEMS)
5391     ],
5392     [AC_MSG_RESULT(no)])
5395 dnl ===================================================================
5396 dnl Extra checking for the SunOS compiler
5397 dnl ===================================================================
5398 if test "$_os" = "SunOS"; then
5399     dnl SunStudio C++ compiler packaged with SunStudio C compiler
5400     if test "$CC" = "cc"; then
5401     AC_MSG_CHECKING([SunStudio C++ Compiler])
5402         if test "$CXX" != "CC"; then
5403             AC_MSG_WARN([SunStudio C++ was not found])
5404             add_warning "SunStudio C++ was not found"
5405         else
5406             AC_MSG_RESULT([checked])
5407         fi
5408     fi
5411 dnl *************************************************************
5412 dnl Testing for exception handling - dwarf2 or sjlj exceptions...
5413 dnl *************************************************************
5414 if test "$WITH_MINGW" = "yes"; then
5415     AC_MSG_CHECKING([exception type])
5416     AC_LANG_PUSH([C++])
5417     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iostream>
5419         extern "C" void _Unwind_SjLj_RaiseException(void) __attribute__ ((__noreturn__));
5421         ]], [[_Unwind_SjLj_RaiseException() ]])],[exceptions_type="sjlj"],[exceptions_type="dwarf2"
5422     ])
5423     AC_MSG_RESULT($exceptions_type)
5424     AC_LANG_POP([C++])
5427 EXCEPTIONS="$exceptions_type"
5428 AC_SUBST(EXCEPTIONS)
5430 dnl ===================================================================
5431 dnl thread-safe statics
5432 dnl ===================================================================
5433 AC_MSG_CHECKING([whether $CXX supports thread safe statics])
5434 unset HAVE_THREADSAFE_STATICS
5435 if test "$GCC" = "yes"; then
5436     dnl -fthreadsafe-statics is available since GCC 4, so always available for
5437     dnl us.  However, some C++ runtimes use a single lock for all static
5438     dnl variables, which can cause deadlock in multi-threaded applications.
5439     dnl This is not easily tested here; for POSIX-based systems, if executing
5440     dnl the following C++ program does not terminate then the tool chain
5441     dnl apparently has this problem:
5442     dnl
5443     dnl   #include <pthread.h>
5444     dnl   int h() { return 0; }
5445     dnl   void * g(void * unused) {
5446     dnl     static int n = h();
5447     dnl     return &n;
5448     dnl   }
5449     dnl   int f() {
5450     dnl     pthread_t t;
5451     dnl     pthread_create(&t, 0, g, 0);
5452     dnl     pthread_join(t, 0);
5453     dnl     return 0;
5454     dnl   }
5455     dnl   int main() {
5456     dnl     static int n = f();
5457     dnl     return n;
5458     dnl   }
5459     dnl
5460     dnl Mac OS X up to at least 10.7.1 is known to have this problem, as is at
5461     dnl least one instance of GCC 4.2.4 (used on a "Linux ooobuild1.osuosl.org
5462     dnl 2.6.9-101.plus.c4smp #1 SMP Thu Jul 21 19:08:15 EDT 2011 i686 i686 i386
5463     dnl GNU/Linux" machine); see the definition of __cxa_guard_acquire in GCC's
5464     dnl libstdc++-v3/libsupc++/guard.cc for what #ifdefs actually make a
5465     dnl difference there.  Conservative advice from Jakub Jelinek is to assume
5466     dnl it working in GCC >= 4.3:
5467     if test "$_os" = "Darwin" -o $_os = Android -o "${GCCVER?}" -lt 040300; then
5468         AC_MSG_RESULT([broken (i.e., no)])
5469     else
5470         HAVE_THREADSAFE_STATICS=TRUE
5471         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5472         AC_MSG_RESULT([yes])
5473     fi
5474 else
5475     AC_MSG_RESULT([unknown (assuming no)])
5477 AC_SUBST(HAVE_THREADSAFE_STATICS)
5479 dnl ===================================================================
5480 dnl visibility and C++11 features
5481 dnl ===================================================================
5482 CXXFLAGS_CXX11=
5483 if test "$GCC" = "yes"; then
5484     AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
5485     save_CFLAGS=$CFLAGS
5486     CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
5487     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_VISIBILITY_FEATURE=TRUE ],[])
5488     CFLAGS=$save_CFLAGS
5490     if test "$COM_GCC_IS_CLANG" = TRUE -a $_os = Darwin; then
5491         # It seems that with Apple's Clang, visibility doesn't work as
5492         # we would want at least in the connectivity and dbaccess
5493         # modules. This might be because of something peculiar in
5494         # those modules? Whatever.
5495         HAVE_GCC_VISIBILITY_FEATURE=
5496     fi
5498     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5499         AC_MSG_RESULT([yes])
5500     else
5501         AC_MSG_RESULT([no])
5502     fi
5504     AC_MSG_CHECKING([whether $CC supports -Wno-long-double])
5505     save_CFLAGS=$CFLAGS
5506     CFLAGS="$CFLAGS -Werror -Wno-long-double"
5507     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_NO_LONG_DOUBLE=TRUE ],[])
5508     CFLAGS=$save_CFLAGS
5509     if test "$HAVE_GCC_NO_LONG_DOUBLE" = "TRUE"; then
5510         AC_MSG_RESULT([yes])
5511     else
5512         AC_MSG_RESULT([no])
5513     fi
5515     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5516     save_CFLAGS=$CFLAGS
5517     CFLAGS="$CFLAGS -Werror -mno-avx"
5518     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5519     CFLAGS=$save_CFLAGS
5520     if test "$HAVE_GCC_AVX" = "TRUE"; then
5521         AC_MSG_RESULT([yes])
5522     else
5523         AC_MSG_RESULT([no])
5524     fi
5526     AC_MSG_CHECKING([whether $CC supports atomic functions])
5527     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5528     int v = 0;
5529     if (__sync_add_and_fetch(&v, 1) != 1 ||
5530         __sync_sub_and_fetch(&v, 1) != 0)
5531         return 1;
5532     __sync_synchronize();
5533     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5534         v != 1)
5535         return 1;
5536     return 0;
5537 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5538     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5539         AC_MSG_RESULT([yes])
5540         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5541     else
5542         AC_MSG_RESULT([no])
5543     fi
5545     AC_MSG_CHECKING(
5546         [whether $CC supports pragma GCC diagnostic error/ignored/warning])
5547     save_CFLAGS=$CFLAGS
5548     CFLAGS="$CFLAGS -Werror -Wunknown-pragmas -Wunused-parameter"
5549     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5550             #pragma GCC diagnostic ignored "-Wunused-parameter"
5551             void dummy(int n) {}
5552         ])], [
5553             AC_DEFINE([HAVE_GCC_PRAGMA_DIAGNOSTIC_MODIFY],[1])
5554             AC_MSG_RESULT([yes])
5555         ], [AC_MSG_RESULT([no])])
5556     CFLAGS=$save_CFLAGS
5558     AC_MSG_CHECKING([whether $CC supports pragma GCC diagnostic push/pop])
5559     save_CFLAGS=$CFLAGS
5560     CFLAGS="$CFLAGS -Werror -Wunknown-pragmas -Wunused-parameter"
5561     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5562             #pragma GCC diagnostic push
5563             #pragma GCC diagnostic ignored "-Wunused-parameter"
5564             void dummy(int n) {}
5565             #pragma GCC diagnostic pop
5566         ])], [
5567             AC_DEFINE([HAVE_GCC_PRAGMA_DIAGNOSTIC_SCOPE],[1])
5568             AC_MSG_RESULT([yes])
5569         ], [AC_MSG_RESULT([no])])
5570     CFLAGS=$save_CFLAGS
5572     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5573 #if __GNUC__ == 4 && __GNUC_MINOR__ == 7 && (__GNUC_PATCHLEVEL__ == 0 || __GNUC_PATCHLEVEL__ == 1)
5574 #else
5575 abi ok
5576 #endif
5577 ]])],[HAVE_BROKEN_ABI=TRUE],[HAVE_BROKEN_ABI=FALSE])
5579     AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
5580     # This should check libstdc++ version, not gcc, but clang has incidentally C++11 support
5581     # disabled in this case by the __float128 case below.
5582     if test "$HAVE_BROKEN_ABI" = "TRUE"; then
5583         AC_MSG_NOTICE([Not using -std=gnu++0x on $CXX version 4.7.0/4.7.1 due to libstdc++ ABI breakage.])
5584     else
5585         save_CXXFLAGS=$CXXFLAGS
5586         CXXFLAGS="$CXXFLAGS -std=gnu++0x"
5587         AC_LANG_PUSH([C++])
5589         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5590 #include <stddef.h>
5592 #include <vector>
5593     // some Clang fail when compiling against GCC 4.7 headers with -std=gnu++0x
5594     // (__float128)
5596 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
5598 namespace
5600         struct b
5601         {
5602                 int i;
5603                 int j;
5604         };
5606 ]], [[
5607 struct a
5609         int i;
5610         int j;
5612 a thinga[]={{0,0}, {1,1}};
5613 b thingb[]={{0,0}, {1,1}};
5614 size_t i = sizeof(sal_n_array_size(thinga));
5615 size_t j = sizeof(sal_n_array_size(thingb));
5616 return !(i != 0 && j != 0);
5617 ]])],[HAVE_CXX0X=TRUE CXXFLAGS_CXX11=-std=gnu++0x],[])
5619         AC_LANG_POP([C++])
5620         CXXFLAGS=$save_CXXFLAGS
5621     fi
5622     if test "$HAVE_CXX0X" = "TRUE"; then
5623         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
5624     else
5625         AC_MSG_RESULT([no])
5626     fi
5629 AC_SUBST(CXXFLAGS_CXX11)
5630 AC_SUBST(HAVE_CXX0X)
5631 AC_SUBST(HAVE_GCC_NO_LONG_DOUBLE)
5632 AC_SUBST(HAVE_GCC_AVX)
5633 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
5635 dnl ==================================
5636 dnl Check for C++11 "= delete" support
5637 dnl ==================================
5639 AC_MSG_CHECKING([whether $CXX supports C++11 = delete syntax])
5640 if test "$HAVE_CXX0X" = "TRUE"; then
5641     save_CXXFLAGS=$CXXFLAGS
5642     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
5643     AC_LANG_PUSH([C++])
5644     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5645 struct A
5646     {
5647     void test() = delete;
5648     };
5649 ]])],[HAVE_CXX11_DELETE=TRUE],[])
5651     AC_LANG_POP([C++])
5652     CXXFLAGS=$save_CXXFLAGS
5653     if test "$HAVE_CXX11_DELETE" = "TRUE"; then
5654         AC_MSG_RESULT([yes])
5655         AC_DEFINE([HAVE_CXX11_DELETE])
5656     else
5657         AC_MSG_RESULT([no])
5658     fi
5659 else
5660     AC_MSG_RESULT([no])
5663 dnl ==================================
5664 dnl Check for C++11 "override" support
5665 dnl ==================================
5667 AC_MSG_CHECKING([whether $CXX supports C++11 "override" syntax])
5668 if test "$HAVE_CXX0X" = "TRUE"; then
5669     save_CXXFLAGS=$CXXFLAGS
5670     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
5671     AC_LANG_PUSH([C++])
5672     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5673 struct A
5675         virtual void test();
5678 struct B : A
5680         virtual void test() override;
5682 ]])],[HAVE_CXX11_OVERRIDE=TRUE],[])
5684     AC_LANG_POP([C++])
5685     CXXFLAGS=$save_CXXFLAGS
5686     if test "$HAVE_CXX11_OVERRIDE" = "TRUE"; then
5687         AC_MSG_RESULT([yes])
5688         AC_DEFINE([HAVE_CXX11_OVERRIDE])
5689     else
5690         AC_MSG_RESULT([no])
5691     fi
5692 else
5693     AC_MSG_RESULT([no])
5696 dnl ==================================
5697 dnl Check for C++11 "final" support
5698 dnl ==================================
5700 AC_MSG_CHECKING([whether $CXX supports C++11 "final" syntax])
5701 if test "$HAVE_CXX0X" = "TRUE"; then
5702     save_CXXFLAGS=$CXXFLAGS
5703     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
5704     AC_LANG_PUSH([C++])
5705     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5706 // First check that this correct program that uses "final" compiles
5707 struct A final
5711 struct B
5713         virtual void test();
5716 struct C : B
5718         void test() final;
5720 ]])],[have_final=yes],[])
5722     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5723 // Then check that the "final" works as expected,
5724 // that this program fails to compile
5725 struct A final
5729 struct B : A
5732 ]])],[],[final_class_works=yes])
5734     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5735 // Also this should fail to compile
5736 struct B
5738         virtual void test();
5741 struct C : B
5743         void test() final;
5746 struct D : C
5748         void test();
5750 ]])],[],[final_method_works=yes])
5751     AC_LANG_POP([C++])
5753     CXXFLAGS=$save_CXXFLAGS
5755     if test "$have_final" = yes -a "$final_class_works" = yes -a "$final_method_works" = yes; then
5756         AC_MSG_RESULT([yes])
5757         AC_DEFINE([HAVE_CXX11_FINAL])
5758     else
5759         AC_MSG_RESULT([no])
5760     fi
5761 else
5762     AC_MSG_RESULT([no])
5765 dnl ===================================================================
5766 dnl Check for C++11 perfect forwarding support
5767 dnl ===================================================================
5768 AC_MSG_CHECKING([whether $CXX supports C++11 perfect forwarding])
5769 save_CXXFLAGS=$CXXFLAGS
5770 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
5771 AC_LANG_PUSH([C++])
5772 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5773         #include <utility>
5774         template<typename T, typename... Args> T * f(Args &&... v) {
5775             return new T(std::forward<Args>(v)...);
5776         }
5777     ]], [[
5778         f<int>(0);
5779     ]])], [perfect_forwarding=yes], [perfect_forwarding=no])
5780 AC_LANG_POP([C++])
5781 CXXFLAGS=$save_CXXFLAGS
5782 AC_MSG_RESULT([$perfect_forwarding])
5783 if test "$perfect_forwarding" = yes; then
5784     AC_DEFINE([HAVE_CXX11_PERFECT_FORWARDING])
5787 dnl ===================================================================
5788 dnl system stl sanity tests
5789 dnl ===================================================================
5790 HAVE_GCC_VISIBILITY_BROKEN=
5791 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \); then
5793     AC_LANG_PUSH([C++])
5795     save_CPPFLAGS="$CPPFLAGS"
5796     if test -n "$MACOSX_SDK_PATH"; then
5797         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
5798     fi
5800     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5801         dnl gcc#19664, gcc#22482, rhbz#162935
5802         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
5803         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
5804         AC_MSG_RESULT([$stlvisok])
5805         if test "$stlvisok" = "no"; then
5806             AC_MSG_WARN([Your gcc STL headers are not visibility safe. Disabling visibility])
5807             add_warning "Your gcc STL headers are not visibility safe. Disabling visibility"
5808             unset HAVE_GCC_VISIBILITY_FEATURE
5809         fi
5810     fi
5812     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5813         sharedlink_ldflags_save=$LDFLAGS
5814         LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden $PICSWITCH $LINKFLAGSSHL"
5816         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
5817         AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5818 #include <sstream>
5819 using namespace std;
5820             ]], [[
5821 istringstream strm( "test" ); return 0;
5822             ]])],
5823             # Ugh, surely bad to assume an error message will contain
5824             # the word "unresolvable", a problem with
5825             # -fvisibility-inlines-hidden and STL headers might cause
5826             # some more obscure message on some platform, and anway,
5827             # the error message could be localised.
5828             [$EGREP -q unresolvable conftest.err;
5829             if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi],[gccvisok=no
5830         ])
5831         AC_MSG_RESULT([$gccvisok])
5832         if test "$gccvisok" = "no"; then
5833             AC_MSG_WARN([Your gcc is not -fvisibility-inlines-hidden safe, disabling that.])
5834             add_warning "Your gcc is not -fvisibility-inlines-hidden safe, disabling that."
5835             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
5836         fi
5838         LDFLAGS=$sharedlink_ldflags_save
5839     fi
5841     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
5842     # when we don't make any dynamic libraries?
5843     if test "$DISABLE_DYNLOADING" = "" -a "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$HAVE_GCC_VISIBILITY_BROKEN" != "TRUE"; then
5844         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
5845         cat > conftestlib1.cc <<_ACEOF
5846 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
5847 struct S2: S1<int> { virtual ~S2(); };
5848 S2::~S2() {}
5849 _ACEOF
5850         cat > conftestlib2.cc <<_ACEOF
5851 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
5852 struct S2: S1<int> { virtual ~S2(); };
5853 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
5854 _ACEOF
5855         gccvisinlineshiddenok=yes
5856         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
5857             gccvisinlineshiddenok=no
5858         else
5859             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $LINKFLAGSNOUNDEFS -o libconftest2$DLLPOST >/dev/null 2>&5; then
5860                 gccvisinlineshiddenok=no
5861             fi
5862         fi
5864         rm -fr libconftest*
5865         AC_MSG_RESULT([$gccvisinlineshiddenok])
5866         if test "$gccvisinlineshiddenok" = "no"; then
5867             AC_MSG_WARN([Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that.])
5868             add_warning "Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that."
5869             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
5870         fi
5871     fi
5873     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5874         AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
5875         cat >visibility.cxx <<_ACEOF
5876 #pragma GCC visibility push(hidden)
5877 struct __attribute__ ((visibility ("default"))) TestStruct {
5878   static void Init();
5880 __attribute__ ((visibility ("default"))) void TestFunc() {
5881   TestStruct::Init();
5883 _ACEOF
5884         if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx 2>/dev/null > /dev/null; then
5885             gccvisbroken=yes
5886         else
5887             case "$host_cpu" in
5888             i?86|x86_64)
5889                 if test "$_os" = "Darwin" -o "$WITH_MINGW" = "yes"; then
5890                     gccvisbroken=no
5891                 else
5892                     if $EGREP -q '@PLT|@GOT' visibility.s; then
5893                         gccvisbroken=no
5894                     else
5895                         gccvisbroken=yes
5896                     fi
5897                 fi
5898                 ;;
5899             *)
5900                 gccvisbroken=no
5901                 ;;
5902             esac
5903         fi
5904         rm -f visibility.s visibility.cxx
5906         AC_MSG_RESULT([$gccvisbroken])
5907         if test "$gccvisbroken" = "yes"; then
5908             AC_MSG_WARN([Your gcc is not -fvisibility=hidden safe. Disabling visibility])
5909             add_warning "Your gcc is not -fvisibility=hidden safe. Disabling visibility"
5910             unset HAVE_GCC_VISIBILITY_FEATURE
5911         fi
5912     fi
5914     CPPFLAGS="$save_CPPFLAGS"
5916     AC_LANG_POP([C++])
5919 AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE)
5920 AC_SUBST(HAVE_GCC_VISIBILITY_BROKEN)
5922 dnl ===================================================================
5923 dnl  Clang++ tests
5924 dnl ===================================================================
5926 HAVE_GCC_FNO_DEFAULT_INLINE=
5927 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
5928 if test "$GCC" = "yes"; then
5929     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
5930     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
5931         # Option just ignored and silly warning that isn't a real
5932         # warning printed
5933         :
5934     else
5935         AC_LANG_PUSH([C++])
5936         save_CXXFLAGS=$CXXFLAGS
5937         CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
5938         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
5939         CXXFLAGS=$save_CXXFLAGS
5940         AC_LANG_POP([C++])
5941     fi
5942     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
5943         AC_MSG_RESULT([yes])
5944     else
5945         AC_MSG_RESULT([no])
5946     fi
5948     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
5949     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
5950         # As above
5951         :
5952     else
5953         AC_LANG_PUSH([C++])
5954         save_CXXFLAGS=$CXXFLAGS
5955         CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
5956         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
5957         CXXFLAGS=$save_CXXFLAGS
5958         AC_LANG_POP([C++])
5959     fi
5960     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
5961         AC_MSG_RESULT([yes])
5962     else
5963         AC_MSG_RESULT([no])
5964     fi
5966 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
5967 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
5970 dnl ===================================================================
5971 dnl allocator
5972 dnl ===================================================================
5973 AC_MSG_CHECKING([which memory allocator to use])
5974 if test "$with_alloc" = "system"; then
5975     AC_MSG_RESULT([system])
5976     ALLOC="SYS_ALLOC"
5977     AC_CHECK_FUNCS([malloc realloc calloc free])
5979 if test "$with_alloc" = "tcmalloc"; then
5980     AC_MSG_RESULT(tcmalloc)
5981     if ! echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
5982         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
5983     fi
5984     AC_CHECK_LIB([tcmalloc], [malloc], [:],
5985         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
5986     ALLOC="TCMALLOC"
5988 if test "$with_alloc" = "jemalloc"; then
5989     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
5990         AC_MSG_RESULT(jemalloc)
5991         save_CFLAGS=$CFLAGS
5992         CFLAGS="$CFLAGS -pthread"
5993         AC_CHECK_LIB([jemalloc], [malloc], [:],
5994             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
5995         ALLOC="JEMALLOC"
5996         CFLAGS=$save_CFLAGS
5997     else
5998         AC_MSG_RESULT([system])
5999         ALLOC="SYS_ALLOC"
6000         AC_CHECK_FUNCS([malloc realloc calloc free])
6001     fi
6003 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6004     AC_MSG_RESULT([internal])
6006 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6007 AC_SUBST(HAVE_POSIX_FALLOCATE)
6008 AC_SUBST(ALLOC)
6010 dnl ===================================================================
6011 dnl Custom build version
6012 dnl ===================================================================
6014 AC_MSG_CHECKING([whether to add custom build version])
6015 if test "$with_build_version" != ""; then
6016     BUILD_VER_STRING=$with_build_version
6017     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6018 else
6019     BUILD_VER_STRING=
6020     AC_MSG_RESULT([no])
6022 AC_SUBST(BUILD_VER_STRING)
6024 dnl ===================================================================
6025 dnl Java support enable
6026 dnl ===================================================================
6027 AC_MSG_CHECKING([whether to build with Java support])
6028 if test "$with_java" != "no"; then
6029     if test "$DISABLE_SCRIPTING" = TRUE; then
6030         AC_MSG_RESULT([no, overridden by --disable-scripting])
6031         SOLAR_JAVA=""
6032         with_java=no
6033     else
6034         AC_MSG_RESULT([yes])
6035         SOLAR_JAVA="TRUE"
6036     fi
6037 else
6038     AC_MSG_RESULT([no])
6039     SOLAR_JAVA=""
6042 AC_SUBST(SOLAR_JAVA)
6044 dnl SOLAR_JAVA="YES" (yes, silly name, should rename) indicates whether we
6045 dnl want there to be *run-time* (and build-time) support for Java extensions in the
6046 dnl built LibreOffice.
6048 dnl SOLAR_JAVA="BUILD" is claimed to indicate build-time only support
6049 dnl (no runtime support). It doesn't seem to ever be set to this
6050 dnl value, though, and everywhere SOLAR_JAVA is only checked for being
6051 dnl empty or non-empty.
6053 dnl SOLAR_JAVA="" indicate no java support at all
6055 JITC_PROCESSOR_TYPE=""
6056 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6057     # IBMs JDK needs this...
6058     JITC_PROCESSOR_TYPE=6
6059     export JITC_PROCESSOR_TYPE
6061 AC_SUBST([JITC_PROCESSOR_TYPE])
6063 # Misc Windows Stuff
6064 if test $_os = "WINNT" -a "$WITH_MINGW" != yes; then
6065     find_msvc_x64_dlls
6066     find_msms
6067     MSVC_DLL_PATH="$msvcdllpath"
6068     MSVC_DLLS="$msvcdlls"
6069     MSM_PATH="$msmdir"
6070     MERGE_MODULES="$msms"
6071     SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6073 AC_SUBST(MSVC_DLL_PATH)
6074 AC_SUBST(MSVC_DLLS)
6075 AC_SUBST(MSVC_DEBUG_DLL_PATH)
6076 AC_SUBST(MSVC_DEBUG_DLLS)
6077 AC_SUBST(MSM_PATH)
6078 AC_SUBST(MERGE_MODULES)
6080 dnl ===================================================================
6081 dnl Checks for Java
6082 dnl ===================================================================
6083 if test "$SOLAR_JAVA" != ""; then
6085     # Windows-specific tests
6086     if test "$build_os" = "cygwin"; then
6087         if test "$BITNESS_OVERRIDE" = 64; then
6088             bitness="64-bit"
6089             otherbitness="32-bit"
6090         else
6091             bitness="32-bit"
6092             otherbitness="64-bit"
6093         fi
6095         if test -z "$with_jdk_home"; then
6096             # Currently only auto-detects 32-bit JDK
6097                         for ver in 1.7 1.6 1.5 1.4 1.3; do
6098                         reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6099                         if test -n "$regvalue"; then
6100                                 _jdk_home=$regvalue
6101                                 break
6102                         fi
6103                         done
6104             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6105                 with_jdk_home="$_jdk_home"
6106                 howfound="found automatically"
6107             else
6108                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness JDK])
6109             fi
6110         else
6111             test "$build_os" = "cygwin" && with_jdk_home=`cygpath -u "$with_jdk_home"`
6112             howfound="you passed"
6113         fi
6114     fi
6116     JAVA_HOME=; export JAVA_HOME
6117     if test -z "$with_jdk_home"; then
6118         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6119     else
6120         _java_path="$with_jdk_home/bin/$with_java"
6121         dnl Check if there is a Java interpreter at all.
6122         if test -x "$_java_path"; then
6123             JAVAINTERPRETER=$_java_path
6124         else
6125             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6126         fi
6127     fi
6129     if test "$build_os" = "cygwin"; then
6130         # Check that the JDK found is correct architecture
6131         # Why is this necessary, we don't link with any library from the JDK I think,
6133         shortjdkhome=`cygpath -d "$with_jdk_home"`
6134         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
6135             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6136             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6137         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
6138             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6139             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6140         fi
6142         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6143             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6144         fi
6145         JAVAINTERPRETER=`cygpath -d "$JAVAINTERPRETER"`
6146         JAVAINTERPRETER=`cygpath -u "$JAVAINTERPRETER"`
6147     elif test "$_os" = "Darwin"; then
6148         dnl HACK:  There currently is only a 32 bit version of LibreOffice for Mac OS X,
6149         dnl and Tiger Java complains about -d32 while Snow Leopard Java needs it
6150         dnl to run in 32 bit mode and be able to load LibreOffice jnilibs:
6151         AC_MSG_CHECKING([whether to pass -d32 to Java interpreter])
6152         if "$JAVAINTERPRETER" -d32 >&5 2>&5; then
6153             AC_MSG_RESULT([yes])
6154             JAVAIFLAGS=-d32
6155         else
6156             AC_MSG_RESULT([no])
6157         fi
6158     fi
6161 dnl ===================================================================
6162 dnl Checks for JDK.
6163 dnl ===================================================================
6165 # Note that JAVA_HOME as for now always means the *build* platform's
6166 # JAVA_HOME. Whether all the complexity here actually is needed any
6167 # more or not, no idea.
6169 if test "$SOLAR_JAVA" != ""; then
6170     _gij_longver=0
6171     AC_MSG_CHECKING([the installed JDK])
6172     if test -n "$JAVAINTERPRETER"; then
6173         dnl java -version sends output to stderr!
6174         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6175             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6176         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6177             JDK=gcj
6178             AC_MSG_RESULT([checked (gcj)])
6179             _gij_version=`$JAVAINTERPRETER --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6180             _gij_longver=`echo $_gij_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6182         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6183             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6184         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6185             JDK=ibm
6187             dnl IBM JDK specific tests
6188             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6189             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6191             if test "$_jdk_ver" -lt 10500; then
6192                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.5])
6193             fi
6195             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6197             if test "$with_jdk_home" = ""; then
6198                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6199 you must use the "--with-jdk-home" configure option explicitly])
6200             fi
6202            JAVA_HOME=$with_jdk_home
6204         else
6205             JDK=sun
6207             dnl Sun JDK specific tests
6208             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6209             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6211             if test "$_jdk_ver" -lt 10500; then
6212                 AC_MSG_ERROR([JDK is too old, you need at least 1.5])
6213             fi
6214             if test "$_jdk_ver" -gt 10600; then
6215                 JAVA_CLASSPATH_NOT_SET="1"
6216             fi
6218             AC_MSG_RESULT([checked (JDK $_jdk)])
6219             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6220             if test "$_os" = "WINNT"; then
6221                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6222             fi
6223         fi
6224     else
6225         AC_MSG_ERROR([Java not found. You need at least jdk-1.5, or gcj-4])
6226     fi
6227 else
6228     dnl Java disabled
6229     JAVA_HOME=NO_JAVA_HOME ; export JAVA_HOME
6232 dnl ===================================================================
6233 dnl Set target Java bytecode version
6234 dnl ===================================================================
6235 if test "$SOLAR_JAVA" != ""; then
6236     _java_target_ver="1.5"
6238     JAVA_SOURCE_VER="$_java_target_ver"
6239     JAVA_TARGET_VER="$_java_target_ver"
6242 dnl ===================================================================
6243 dnl Checks for javac
6244 dnl ===================================================================
6245 if test "$SOLAR_JAVA" != ""; then
6246     if test "$JDK" = "gcj"; then
6247         javacompiler=`echo $with_java | $SED -e "s/gij/gcj/g" | $SED -e "s/java/javac/g"`
6248     else
6249         javacompiler="javac"
6250     fi
6251     if test -z "$with_jdk_home"; then
6252         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6253     else
6254         _javac_path="$with_jdk_home/bin/$javacompiler"
6255         dnl Check if there is a Java compiler at all.
6256         if test -x "$_javac_path"; then
6257             JAVACOMPILER=$_javac_path
6258         fi
6259     fi
6260     if test -z "$JAVACOMPILER"; then
6261         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6262     fi
6263     if test "$build_os" = "cygwin"; then
6264         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6265             JAVACOMPILER="${JAVACOMPILER}.exe"
6266         fi
6267         JAVACOMPILER=`cygpath -d "$JAVACOMPILER"`
6268         JAVACOMPILER=`cygpath -u "$JAVACOMPILER"`
6269     fi
6271     if test `$JAVACOMPILER -version 2>&1 | $GREP -c "Eclipse Java Compiler"` -gt 0; then
6272         AC_MSG_CHECKING([re-checking JDK])
6273         JDK=gcj
6274         AC_MSG_RESULT([checked (ecj)])
6275         _gij_longver="40200"
6276     fi
6279 JAVACISGCJ=""
6280 dnl ===================================================================
6281 dnl Checks that javac is gcj
6282 dnl ===================================================================
6283 if test "$SOLAR_JAVA" != ""; then
6284     if test `$JAVACOMPILER --version 2>&1 | $GREP -c "GCC"` -gt 0; then
6285         JAVACISGCJ="yes"
6286     fi
6288 AC_SUBST(JAVACISGCJ)
6290 dnl ===================================================================
6291 dnl Checks for javadoc
6292 dnl ===================================================================
6293 if test "$SOLAR_JAVA" != ""; then
6294     if test -z "$with_jdk_home"; then
6295         AC_PATH_PROG(JAVADOC, javadoc)
6296     else
6297         _javadoc_path="$with_jdk_home/bin/javadoc"
6298         dnl Check if there is a javadoc at all.
6299         if test -x "$_javadoc_path"; then
6300             JAVADOC=$_javadoc_path
6301         else
6302             AC_PATH_PROG(JAVADOC, javadoc)
6303         fi
6304     fi
6305     if test -z "$JAVADOC"; then
6306         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6307     fi
6308     if test "$build_os" = "cygwin"; then
6309         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6310             JAVADOC="${JAVADOC}.exe"
6311         fi
6312         JAVADOC=`cygpath -d "$JAVADOC"`
6313         JAVADOC=`cygpath -u "$JAVADOC"`
6314     fi
6316     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6317     JAVADOCISGJDOC="yes"
6318     fi
6320 AC_SUBST(JAVADOCISGJDOC)
6322 if test "$SOLAR_JAVA" != ""; then
6323     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
6324     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
6325         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
6326            # try to recover first by looking whether we have a alternatives
6327            # system as in Debian or newer SuSEs where following /usr/bin/javac
6328            # over /etc/alternatives/javac leads to the right bindir where we
6329            # just need to strip a bit away to get a valid JAVA_HOME
6330            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
6331         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
6332             # maybe only one level of symlink (e.g. on Mac)
6333             JAVA_HOME=$(readlink $JAVACOMPILER)
6334             if test "$(dirname $JAVA_HOME)" = "."; then
6335                 # we've got no path to trim back
6336                 JAVA_HOME=""
6337             fi
6338         else
6339             # else warn
6340             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
6341             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
6342             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
6343             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
6344         fi
6345         dnl now that we have the path to the real javac, make a JAVA_HOME out of it..
6346         if test "$JAVA_HOME" != "/usr"; then
6347             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6348                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
6349                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
6350                 dnl Tiger already returns a JDK path..
6351                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
6352             else
6353                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
6354             fi
6355         fi
6356     fi
6357     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
6359     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
6360     if test -z "$JAVA_HOME"; then
6361         if test "x$with_jdk_home" = "x"; then
6362             cat > findhome.java <<_ACEOF
6363 [import java.io.File;
6365 class findhome
6367     public static void main(String args[])
6368     {
6369         String jrelocation = System.getProperty("java.home");
6370         File jre = new File(jrelocation);
6371         System.out.println(jre.getParent());
6372     }
6374 _ACEOF
6375             AC_MSG_CHECKING([if javac works])
6376             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
6377             AC_TRY_EVAL(javac_cmd)
6378             if test $? = 0 -a -f ./findhome.class; then
6379                 AC_MSG_RESULT([javac works])
6380             else
6381                 echo "configure: javac test failed" >&5
6382                 cat findhome.java >&5
6383                 AC_MSG_ERROR([javac does not work - java projects will not build!])
6384             fi
6385             AC_MSG_CHECKING([if gij knows its java.home])
6386             JAVA_HOME=`$JAVAINTERPRETER findhome`
6387             if test $? = 0 -a "$JAVA_HOME" != ""; then
6388                 AC_MSG_RESULT([$JAVA_HOME])
6389             else
6390                 echo "configure: java test failed" >&5
6391                 cat findhome.java >&5
6392                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
6393             fi
6394             # clean-up after ourselves
6395             rm -f ./findhome.java ./findhome.class
6396         else
6397             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
6398         fi
6399     fi
6401     dnl second sanity check JAVA_HOME if possible
6402     if test "$JDK" != "gcj" -o "$_gij_longver" -ge "40200"; then
6403         # now check if $JAVA_HOME is really valid
6404         if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6405             if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
6406                 JAVA_HOME_OK="NO"
6407             fi
6408         elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
6409             JAVA_HOME_OK="NO"
6410         fi
6411         if test "$JAVA_HOME_OK" = "NO"; then
6412             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
6413             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
6414             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
6415             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
6416             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
6417             add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
6418         fi
6419     fi
6420     PathFormat "$JAVA_HOME"
6421     JAVA_HOME="$formatted_path"
6424 AWTLIB=
6426 if test "$SOLAR_JAVA" != ""; then
6427     AC_MSG_CHECKING([for jawt lib name])
6428     if test "$JDK" = "gcj"; then
6429         save_CFLAGS=$CFLAGS
6430         save_LDFLAGS=$LDFLAGS
6431         CFLAGS="$CFLAGS -I$JAVA_HOME/include"
6432         LDFLAGS="$LDFLAGS -L$JAVA_HOME/lib -lgcj"
6433         exec 6>/dev/null # no output
6434         AC_CHECK_HEADER(jni.h, [],
6435                     [AC_MSG_ERROR([jni.h could not be found. Mismatch between gcc and libgcj or libgcj-devel missing?])], [])
6436         AC_CHECK_LIB(gcjawt, JAWT_GetAWT, [ AWTLIB="-lgcjawt -lgcj"] )
6437         exec 6>&1 # output on again
6438         CFLAGS=$save_CFLAGS
6439         LDFLAGS=$save_LDFLAGS
6440     fi
6441     # IBM SDK 1.5.0-sr5 includes libjawt.so with unresolved symbols.
6442     # A workaround is to link also against libpmawt.so
6443     if test "$JDK" = "ibm"; then
6444         save_CFLAGS=$CFLAGS
6445         save_LDFLAGS=$LDFLAGS
6446         save_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
6447         CFLAGS="$CFLAGS -I$JAVA_HOME/include"
6448         LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin"
6449         LD_LIBRARY_PATH=$JAVA_HOME/jre/bin:$JAVA_HOME/jre/bin/classic:$JAVA_HOME/jre/bin/xawt:$LD_LIBRARY_PATH
6450         export LD_LIBRARY_PATH
6451         exec 6>/dev/null # no output
6452         AC_CHECK_HEADER(jni.h, [],
6453                     [AC_MSG_ERROR([jni.h could not be found.])], [])
6454         AC_CHECK_LIB(jawt, JAWT_GetAWT, [ AWTLIB="-ljawt"] )
6455         if test -z "$AWTLIB"; then
6456             LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin/xawt -ljawt"
6457             AC_CHECK_LIB(mawt, JAWT_GetAWT, [ AWTLIB="-L$JAVA_HOME/jre/bin/xawt -ljawt -lmawt"])
6458         fi
6459         exec 6>&1 # output on again
6460         CFLAGS=$save_CFLAGS
6461         LDFLAGS=$save_LDFLAGS
6462         LD_LIBRARY_PATH=$save_LD_LIBRARY_PATH
6463     fi
6464     if test -z "$AWTLIB"; then
6465         if test $_os = WINNT -a "$WITH_MINGW" != yes; then
6466             AWTLIB=jawt.lib
6467         else
6468             AWTLIB=-ljawt
6469         fi
6470     fi
6471     AC_MSG_RESULT([$AWTLIB])
6472     AC_SUBST(AWTLIB)
6476 if test -n "$SOLAR_JAVA" -a \( -z "$JAVALIB" -o -z "$JAVAINC" \); then
6478 # Determine JAVALIB
6479 # If your platform follow the common pattern
6480 # just define JAVA_ARCH and JAVA_TOOLKIT for it
6481 # if not, leave JAVA_ARCH empty and define JAVALIB manually
6482 # if you don't want JAVALIB to be exported at all
6483 # define x_JAVALIB=[\#]
6485     JAVA_ARCH=
6486     JAVA_TOOLKIT=
6487     x_JAVALIB=
6488     x_JDKLIB=[\#]
6490     case "$host_os" in
6492     aix*)
6493         JAVA_ARCH="ppc"
6494         JAVA_TOOLKIT="classic"
6495         JAVAINC="-I$JAVA_HOME/include"
6496         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
6497         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6499         case "$JDK" in
6500         [Ii][Bb][Mm]*)
6501             JAVA_ARCH=
6502             JRE_BASE_DIR="$JAVA_HOME/jre/bin"
6503             JAVALIB="-L$JRE_BASE_DIR -L$JRE_BASE_DIR/classic"
6504             ;;
6505         *)
6506             ;;
6507         esac
6509         ;;
6511     cygwin*)
6512         x_JDKLIB=
6513         JDKLIB="$JAVA_HOME/lib"
6514         JAVAINC="-I$JAVA_HOME/include/win32"
6515         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
6516         ;;
6518     darwin*)
6519         x_JAVALIB=[\#]
6520         JAVAINC="${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers ${ISYSTEM}$FRAMEWORKSHOME/JavaVM/Headers"
6521         ;;
6523     dragonfly*)
6524         case "$host_cpu" in
6525         i*86)
6526             JAVA_ARCH="i386"
6527             JAVA_TOOLKIT="client"
6528             ;;
6529         x86_64)
6530             JAVA_ARCH="amd64"
6531             JAVA_TOOLKIT="server"
6532             ;;
6533         esac
6534         JAVAINC="-I$JAVA_HOME/include"
6535         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6536         ;;
6538     freebsd*)
6539         case "$host_cpu" in
6540         i*86)
6541             JAVA_ARCH="i386"
6542             JAVA_TOOLKIT="client"
6543             ;;
6544         x86_64)
6545             if test "`echo $JAVA_HOME | sed -e 's,.*/,,'`" = "linux"; then
6546                 JAVA_ARCH="i386"
6547                 JAVA_TOOLKIT="client"
6548             else
6549                 JAVA_ARCH="amd64"
6550                 JAVA_TOOLKIT="server"
6551             fi
6552             ;;
6553         esac
6554         JAVAINC="-I$JAVA_HOME/include"
6555         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
6556         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
6557         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
6558         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6559         ;;
6561     k*bsd*-gnu*)
6562         case "$host_cpu" in
6563         i*86)
6564             JAVA_ARCH="i386"
6565             JAVA_TOOLKIT="client"
6566             ;;
6567         x86_64)
6568             JAVA_ARCH="amd64"
6569             JAVA_TOOLKIT="server"
6570             ;;
6571         esac
6572         JAVAINC="-I$JAVA_HOME/include"
6573         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6574         ;;
6576     linux-gnu*)
6578         case "$host_cpu" in
6580         alpha)
6581             JAVA_ARCH="alpha"
6582             JAVA_TOOLKIT="server"
6583             ;;
6584         arm*)
6585             JAVA_ARCH="arm"
6586             JAVA_TOOLKIT="server"
6587             ;;
6588         hppa)
6589             JAVA_ARCH="hppa"
6590             JAVA_TOOLKIT="server"
6591             ;;
6592         i*86)
6593             JAVA_ARCH="i386"
6594             case "$JDK" in
6595             [Ii][Bb][Mm]*)
6596                 JAVA_ARCH=
6597                 JRE_BASE_DIR="$JAVA_HOME/jre/bin"
6598                 JAVALIB="-L$JAVA_HOME/$LIB64 -L$JRE_BASE_DIR -L$JRE_BASE_DIR/classic -L$JRE_BASE_DIR/native_thread"
6599                 ;;
6600             [Bb][Ee][Aa]*)
6601                 JAVA_TOOLKIT="jrockit"
6602                 ;;
6603             *)
6604                 JAVA_TOOLKIT="client"
6605                 ;;
6606             esac
6607             ;;
6608         ia64)
6609             JAVA_ARCH="ia64"
6610             JAVA_TOOLKIT="server"
6611             ;;
6612         m68k)
6613             JAVA_ARCH="mk68"
6614             JAVA_TOOLKIT="server"
6615             ;;
6616         mips|mips64|mipsel|mips64el)
6617             JAVA_ARCH="$host_cpu"
6618             JAVA_TOOLKIT="server"
6619             ;;
6620         mips32)
6621             JAVA_ARCH="$host_cpu"
6622             JAVA_TOOLKIT="client"
6623             ;;
6624         powerpc)
6625             JAVA_ARCH="ppc"
6626             case "$JDK" in
6627             [Ii][Bb][Mm]*)
6628                 JAVA_TOOLKIT="classic"
6629                 ;;
6630             gcj)
6631                 JAVA_TOOLKIT="client"
6632                 ;;
6633             *)
6634                 JAVA_TOOLKIT="server"
6635                 ;;
6636             esac
6637             ;;
6638         powerpc64)
6639             JAVA_ARCH="ppc64"
6640             if test "$JDK" = "gcj"; then
6641                 JAVA_TOOLKIT="client"
6642             else
6643                 JAVA_TOOLKIT="server"
6644             fi
6645             ;;
6646         sparc)
6647             JAVA_ARCH="sparc"
6648             JAVA_TOOLKIT="server"
6649             ;;
6650         s390)
6651             JAVA_ARCH="s390"
6652             JAVA_TOOLKIT="server"
6653             ;;
6654         s390x)
6655             JAVA_ARCH="s390x"
6656             JAVA_TOOLKIT="server"
6657             ;;
6658         x86_64)
6659             JAVA_ARCH="amd64"
6660             JAVA_TOOLKIT="server"
6661             ;;
6662         *)
6663             AC_MSG_ERROR([No JAVALIB definition host_cpu $host_cpu for host_os $host_os])
6664             ;;
6665         esac
6666         JAVAINC="-I$JAVA_HOME/include"
6667         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
6668         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6669         ;;
6671     linux-androideabi*)
6673         case "$host_cpu" in
6675     arm|armel)
6676             JAVA_ARCH="arm"
6677             JAVA_TOOLKIT="server"
6678             ;;
6679         esac
6680         ;;
6682     mingw*)
6683         x_JAVALIB=[\#]
6684         JAVAINC="-I$JAVA_HOME/include"
6685         ;;
6687     *netbsd*)
6689         case "$host_cpu" in
6690         i*86)
6691             JAVA_ARCH="i386"
6692             JAVA_TOOLKIT="client"
6693             ;;
6694         powerpc)
6695             JAVA_ARCH="pcc"
6696             JAVA_TOOLKIT="classic"
6697             ;;
6698         sparc)
6699             JAVA_ARCH="sparc"
6700             JAVA_TOOLKIT="client"
6701             ;;
6702         x86_64)
6703             JAVA_ARCH="amd64"
6704             JAVA_TOOLKIT="client"
6705             ;;
6706         esac
6707         JAVAINC="-I$JAVA_HOME/include"
6708         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
6709         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6710        ;;
6712     openbsd*)
6713         case "$host_cpu" in
6714         i*86)
6715             JAVA_ARCH="i386"
6716             JAVA_TOOLKIT="client"
6717             ;;
6718         x86_64)
6719             JAVA_ARCH="amd64"
6720             JAVA_TOOLKIT="server"
6721             ;;
6722         esac
6723         JAVAINC="-I$JAVA_HOME/include"
6724         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
6725         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6726         ;;
6728     solaris*)
6730         JAVA_TOOLKIT="xawt"
6731         case "$host_cpu" in
6732         i*86)
6733             JAVA_ARCH="i386"
6734             ;;
6735         sparc)
6736             JAVA_ARCH="sparc"
6737             ;;
6738         esac
6739         JAVAINC="-I$JAVA_HOME/include"
6740         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
6741         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6742         ;;
6743     esac
6745     if test -n "$JAVA_ARCH"; then
6746         JRE_BASE_DIR="$JAVA_HOME/jre/lib/$JAVA_ARCH"
6747         JAVALIB="-L$JAVA_HOME/$LIB64"
6748         test -d "$JRE_BASE_DIR" && JAVALIB="$JAVALIB -L$JRE_BASE_DIR"
6749         test -d "$JRE_BASE_DIR/$JAVA_TOOLKIT" && JAVALIB="$JAVALIB -L$JRE_BASE_DIR/$JAVA_TOOLKIT"
6750         test -d "$JRE_BASE_DIR/native_thread" && JAVALIB="$JAVALIB -L$JRE_BASE_DIR/native_thread"
6751     fi
6752 elif test -z "$SOLAR_JAVA"; then
6753     x_JAVALIB=[\#]
6754     x_JDKLIB=[\#]
6756 SOLARINC="$SOLARINC $JAVAINC"
6758 AC_SUBST(JAVALIB)
6759 AC_SUBST(JAVACOMPILER)
6760 AC_SUBST(JAVADOC)
6761 AC_SUBST(JAVAINTERPRETER)
6762 AC_SUBST(JAVAIFLAGS)
6763 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
6764 AC_SUBST(JAVA_HOME)
6765 AC_SUBST(JAVA_SOURCE_VER)
6766 AC_SUBST(JAVA_TARGET_VER)
6767 AC_SUBST(JDK)
6768 AC_SUBST(JDKLIB)
6769 AC_SUBST(x_JAVALIB)
6770 AC_SUBST(x_JDKLIB)
6773 AC_MSG_CHECKING([which C preprocessor to use in idlc])
6774 if test -n "$with_idlc_cpp"; then
6775     AC_MSG_RESULT([$with_idlc_cpp])
6776     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
6777 else
6778     AC_MSG_RESULT([ucpp])
6779     AC_MSG_CHECKING([which ucpp tp use])
6780     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
6781         AC_MSG_RESULT([external])
6782         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
6783     else
6784         AC_MSG_RESULT([internal])
6785         BUILD_TYPE="$BUILD_TYPE UCPP"
6786     fi
6788 AC_SUBST(SYSTEM_UCPP)
6790 dnl ===================================================================
6791 dnl Check for epm (not needed for Windows)
6792 dnl ===================================================================
6793 AC_MSG_CHECKING([whether to enable EPM for packing])
6794 if test "$enable_epm" = "yes"; then
6795     AC_MSG_RESULT([yes])
6796     if test "$_os" != "WINNT"; then
6797         if test -n "$with_epm"; then
6798             EPM=$with_epm
6799         else
6800             AC_PATH_PROG(EPM, epm, no)
6801         fi
6802         if test "$EPM" = "no" -o "$EPM" = "internal"; then
6803             echo "EPM will be built."
6804             BUILD_TYPE="$BUILD_TYPE EPM"
6805         else
6806             # Gentoo has some epm which is something different...
6807             AC_MSG_CHECKING([whether the found epm is the right epm])
6808             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
6809                 AC_MSG_RESULT([yes])
6810             else
6811                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
6812             fi
6813             AC_MSG_CHECKING([epm version])
6814             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
6815             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
6816                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
6817                 AC_MSG_RESULT([OK, >= 3.7])
6818                 if test "$_os" = "Darwin"; then
6819                     AC_MSG_CHECKING([which PackageMaker EPM thinks to use])
6820                     _pm=`strings $EPM | grep PackageMaker | cut -d" " -f1`
6821                     if test "$_pm" = "/Developer/Applications/PackageMaker.app/Contents/MacOS/PackageMaker"; then
6822                         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)])
6823                     elif test "$_pm" = "/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker"; then
6824                         AC_MSG_RESULT([$_pm, ok])
6825                     else # we never should get here, but go safe
6826                         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)])
6827                     fi
6828                 fi
6829             else
6830                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
6831                 echo "EPM will be built."
6832                 BUILD_TYPE="$BUILD_TYPE EPM"
6833             fi
6834         fi
6835     fi
6837     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
6838         AC_MSG_CHECKING([for rpm])
6839         for a in "$RPM" rpmbuild rpm; do
6840             $a --usage >/dev/null 2> /dev/null
6841             if test $? -eq 0; then
6842                 RPM=$a
6843                 break
6844             else
6845                 $a --version >/dev/null 2> /dev/null
6846                 if test $? -eq 0; then
6847                     RPM=$a
6848                     break
6849                 fi
6850             fi
6851         done
6852         if test -z "$RPM"; then
6853             AC_MSG_ERROR([not found])
6854         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
6855             RPM_PATH=`which $RPM`
6856             AC_MSG_RESULT([$RPM_PATH])
6857             SCPDEFS="$SCPDEFS -DWITH_RPM"
6858         else
6859             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
6860         fi
6861     fi
6862     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
6863         AC_PATH_PROG(DPKG, dpkg, no)
6864         if test "$DPKG" = "no"; then
6865             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
6866         fi
6867     fi
6868     if echo "$PKGFORMAT" | $EGREP osx 2>&1 >/dev/null; then
6869         if test "$_os" = "Darwin"; then
6870             AC_MSG_CHECKING([for PackageMaker availability])
6871             if ! test -x /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker; then
6872                 AC_MSG_ERROR([not installed. Please install Apples Dev Tools])
6873             else
6874                 AC_MSG_RESULT([ok])
6875             fi
6876         else
6877             AC_MSG_ERROR([PackageMaker needed to build OSX packages and you are not on OSX...])
6878         fi
6879     fi
6880     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
6881        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
6882         if test "$EPM" != "no" -a "$EPM" != "internal"; then
6883             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
6884                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
6885                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
6886                     AC_MSG_RESULT([yes])
6887                 else
6888                     AC_MSG_RESULT([no])
6889                     if echo "$PKGFORMAT" | $GREP -q rpm; then
6890                         _pt="rpm"
6891                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
6892                         add_warning "the rpms will need to be installed with --nodeps"
6893                     else
6894                         _pt="pkg"
6895                     fi
6896                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
6897                     add_warning "the ${_pt}s will not be relocateable"
6898                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
6899                                  relocation will work, you need to patch your epm with the
6900                                  patch in epm/epm-3.7.patch or build with
6901                                  --with-epm=internal which will build a suitable epm])
6902                 fi
6903             fi
6904         fi
6905     fi
6906     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
6907         AC_PATH_PROG(PKGMK, pkgmk, no)
6908         if test "$PKGMK" = "no"; then
6909             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
6910         fi
6911     fi
6912     AC_SUBST(RPM)
6913     AC_SUBST(DPKG)
6914     AC_SUBST(PKGMK)
6915 else
6916     AC_MSG_RESULT([no])
6917     EPM=NO
6919 AC_SUBST(EPM)
6921 dnl ===================================================================
6922 dnl We need winegcc when building MinGW build to be able to cross-build msi tools
6923 dnl ===================================================================
6924 WINEGCC=
6925 if test "$enable_winegcc" = "yes"; then
6926     AC_PATH_PROG(WINEGCC, winegcc)
6927     if test "$WINEGCC" = ""; then
6928         AC_MSG_ERROR([winegcc was not found, please install wine-devel, or wine-devel-32bit])
6929     fi
6930     CC_save="$CC"
6931     ac_exeext_save="$ac_exeext"
6932     CC="$WINEGCC -m32"
6933     ac_exeext=".exe"
6934     AC_LINK_IFELSE([AC_LANG_PROGRAM([
6935 #include <stdio.h>
6936         ],[
6937 printf ("hello world\n");
6938         ])],,
6939         [AC_MSG_ERROR([winegcc cannot build 32bit binaries, please install glibc-devel-32bit and gcc-32bit])]
6940     )
6941     CC="$CC_save"
6942     ac_exeext="$ac_exeext_save"
6944 AC_SUBST(WINEGCC)
6946 if test $_os = iOS; then
6947     enable_mpl_subset=yes
6948     enable_opengl=no
6949     enable_lotuswordpro=no
6950     enable_lpsolve=no
6951     enable_postgresql_sdbc=no
6952     enable_lotuswordpro=no
6953     enable_neon=no
6954     enable_extension_integration=no
6955     with_theme="tango"
6956     with_ppds=no
6959 ENABLE_LWP=
6960 if test "$enable_lotuswordpro" = "yes"; then
6961    ENABLE_LWP="TRUE"
6962    SCPDEFS="$SCPDEFS -DDISABLE_LWP"
6964 AC_SUBST(ENABLE_LWP)
6966 dnl ===================================================================
6967 dnl Check for gperf
6968 dnl ===================================================================
6969 AC_PATH_PROG(GPERF, gperf)
6970 if test -z "$GPERF"; then
6971     AC_MSG_ERROR([gperf not found but needed. Install it.])
6973 AC_MSG_CHECKING([gperf version])
6974 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
6975     AC_MSG_RESULT([OK])
6976 else
6977     AC_MSG_ERROR([too old, you need at least 3.0.0])
6979 AC_SUBST(GPERF)
6981 dnl ===================================================================
6982 dnl Check for building ODK
6983 dnl ===================================================================
6984 if test "$enable_odk" = no; then
6985     unset DOXYGEN
6986 else
6987     if test "$with_doxygen" = no; then
6988         AC_MSG_CHECKING([for doxygen])
6989         unset DOXYGEN
6990         AC_MSG_RESULT([no])
6991     else
6992         if test "$with_doxygen" = yes; then
6993             AC_PATH_PROG([DOXYGEN], [doxygen])
6994             if test -z "$DOXYGEN"; then
6995                 if test "$enable_odk" = "" ; then
6996                     enable_odk="no"
6997                 else
6998                     AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
6999                 fi
7000             fi
7001         else
7002             AC_MSG_CHECKING([for doxygen])
7003             DOXYGEN=$with_doxygen
7004             AC_MSG_RESULT([$DOXYGEN])
7005         fi
7006     fi
7008 AC_SUBST([DOXYGEN])
7010 AC_MSG_CHECKING([whether to build the ODK])
7011 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7012     AC_MSG_RESULT([yes])
7014     if test "$with_java" != "no"; then
7015         AC_MSG_CHECKING([whether to build unowinreg.dll])
7016         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7017             # build on Win by default
7018             enable_build_unowinreg=yes
7019         fi
7020         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7021             AC_MSG_RESULT([no])
7022             BUILD_UNOWINREG=NO
7023         else
7024             AC_MSG_RESULT([yes])
7025             BUILD_UNOWINREG=YES
7026         fi
7027         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "YES"; then
7028             if test -z "$with_mingw_cross_compiler"; then
7029                 dnl Guess...
7030                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7031             elif test -x "$with_mingw_cross_compiler"; then
7032                  MINGWCXX="$with_mingw_cross_compiler"
7033             else
7034                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7035             fi
7037             if test "$MINGWCXX" = "false"; then
7038                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7039             fi
7041             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7042             if test -x "$mingwstrip_test"; then
7043                 MINGWSTRIP="$mingwstrip_test"
7044             else
7045                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7046             fi
7048             if test "$MINGWSTRIP" = "false"; then
7049                 AC_MSG_ERROR(MinGW32 binutils not found.)
7050             fi
7051         fi
7052     fi
7053     BUILD_TYPE="$BUILD_TYPE ODK"
7054 else
7055     AC_MSG_RESULT([no])
7056     BUILD_UNOWINREG=NO
7058 AC_SUBST(BUILD_UNOWINREG)
7059 AC_SUBST(MINGWCXX)
7060 AC_SUBST(MINGWSTRIP)
7062 dnl ===================================================================
7063 dnl Check for system zlib
7064 dnl ===================================================================
7065 if test "$with_system_zlib" = "auto"; then
7066     case "$_os" in
7067     WINNT)
7068         with_system_zlib="$with_system_libs"
7069         ;;
7070     *)
7071         with_system_zlib=yes
7072         ;;
7073     esac
7076 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7077 dnl and has no pkg-config for it at least on some tinderboxes,
7078 dnl so leaving that out for now
7079 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7080 AC_MSG_CHECKING([which zlib to use])
7081 if test "$with_system_zlib" = "yes"; then
7082     AC_MSG_RESULT([external])
7083     SYSTEM_ZLIB=YES
7084     AC_CHECK_HEADER(zlib.h, [],
7085         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7086     AC_CHECK_LIB(z, deflate, [ ZLIB=-lz ],
7087         [AC_MSG_ERROR(zlib not found or functional)], [])
7088 else
7089     AC_MSG_RESULT([internal])
7090     SYSTEM_ZLIB=NO
7091     BUILD_TYPE="$BUILD_TYPE ZLIB"
7092     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7093     ZLIB_LIBS="-L${OUTDIR}/lib -lzlib"
7095 AC_SUBST(ZLIB_CFLAGS)
7096 AC_SUBST(ZLIB_LIBS)
7097 AC_SUBST(SYSTEM_ZLIB)
7099 dnl ===================================================================
7100 dnl Check for system jpeg
7101 dnl ===================================================================
7102 AC_MSG_CHECKING([which jpeg to use])
7103 if test "$with_system_jpeg" = "auto"; then
7104     case "$_os" in
7105     WINNT|Darwin|iOS|Android)
7106         with_system_jpeg="$with_system_libs"
7107         ;;
7108     *)
7109         with_system_jpeg=yes
7110         ;;
7111     esac
7114 if test "$with_system_jpeg" = "yes"; then
7115     AC_MSG_RESULT([external])
7116     SYSTEM_JPEG=YES
7117     AC_CHECK_HEADER(jpeglib.h, [],
7118         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7119     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ JPEG3RDLIB=-ljpeg ],
7120     [AC_MSG_CHECKING(jpeg library not found or fuctional)], [])
7121     AC_MSG_CHECKING([[libjpeg supports JERR_BAD_CROP_SPEC (jpeg-7 API)]])
7122         AC_COMPILE_IFELSE([ AC_LANG_SOURCE(
7123                           [[
7124 #include <stdio.h>
7125 #include <jerror.h>
7126 int main(int c, char**v) { printf("%d\n", JERR_BAD_CROP_SPEC); return 0; }
7127                           ]]) ],
7128                           [AC_MSG_RESULT(yes)],
7129                           [AC_MSG_RESULT(no)
7130                            AC_MSG_ERROR(jpeg library version >= 7 or jpeg-turbo version >= 1.1 required)
7131                           ])
7132     libo_MINGW_CHECK_DLL([libjpeg])
7133 else
7134     AC_MSG_RESULT([internal])
7135     SYSTEM_JPEG=NO
7136     BUILD_TYPE="$BUILD_TYPE JPEG"
7138 AC_SUBST(SYSTEM_JPEG)
7141 dnl ===================================================================
7142 dnl Check for system clucene
7143 dnl ===================================================================
7144 dnl we should rather be using
7145 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7146 dnl but the contribs-lib check seems tricky
7147 AC_MSG_CHECKING([which clucene to use])
7148 if test "$with_system_clucene" = "yes"; then
7149     AC_MSG_RESULT([external])
7150     SYSTEM_CLUCENE=YES
7151     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7152     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@')]
7153     AC_LANG_PUSH([C++])
7154     save_CXXFLAGS=$CXXFLAGS
7155     save_CPPFLAGS=$CPPFLAGS
7156     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7157     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7158     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7159     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7160     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7161                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7162     CXXFLAGS=$save_CXXFLAGS
7163     CPPFLAGS=$save_CPPFLAGS
7164     AC_LANG_POP([C++])
7166     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7167 else
7168     AC_MSG_RESULT([internal])
7169     SYSTEM_CLUCENE=NO
7170     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7172 AC_SUBST(SYSTEM_CLUCENE)
7173 AC_SUBST(CLUCENE_CFLAGS)
7174 AC_SUBST(CLUCENE_LIBS)
7176 dnl ===================================================================
7177 dnl Check for system expat
7178 dnl ===================================================================
7179 dnl we should use libo_CHECK_SYSTEM_MODULE, but e.g. the mingw tinderbox has no
7180 dnl proper pkg-config for it. It should really be fixed on the tinderbox though.
7181 AC_MSG_CHECKING([which expat to use])
7182 if test "$with_system_expat" = "yes"; then
7183     AC_MSG_RESULT([external])
7184     SYSTEM_EXPAT=YES
7185     AC_CHECK_HEADER(expat.h, [],
7186         [AC_MSG_ERROR(expat.h not found. install expat)], [])
7187     AC_CHECK_LIB([expat], [XML_ParserCreate], [:],
7188         [AC_MSG_RESULT(expat library not found or functional.)], [])
7189     libo_MINGW_CHECK_DLL([libexpat])
7190 else
7191     AC_MSG_RESULT([internal])
7192     SYSTEM_EXPAT=NO
7193     BUILD_TYPE="$BUILD_TYPE EXPAT"
7195 AC_SUBST(SYSTEM_EXPAT)
7197 dnl ===================================================================
7198 dnl Check for system libodfgen
7199 dnl ===================================================================
7200 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.0])
7202 dnl ===================================================================
7203 dnl Check for system libcdr
7204 dnl ===================================================================
7205 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.0 >= 0.0.5])
7207 dnl ===================================================================
7208 dnl Check for system libmspub
7209 dnl ===================================================================
7210 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.0])
7212 dnl ===================================================================
7213 dnl Check for system libmwaw
7214 dnl ===================================================================
7215 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.1])
7217 dnl ===================================================================
7218 dnl Check for system libvisio
7219 dnl ===================================================================
7220 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.0])
7222 dnl ===================================================================
7223 dnl Check for system libcmis
7224 dnl ===================================================================
7225 libo_CHECK_SYSTEM_MODULE([libcmis],[CMIS],[libcmis-0.3 >= 0.3.1])
7227 dnl ===================================================================
7228 dnl Check for system libwpd
7229 dnl ===================================================================
7230 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.9 >= 0.9.5 libwpd-stream-0.9 >= 0.9.5],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${OUTDIR}/lib -lwpdlib"])
7232 dnl ===================================================================
7233 dnl Check for system lcms2
7234 dnl ===================================================================
7235 if test "$with_system_lcms2" = "yes"; then
7236     libo_MINGW_CHECK_DLL([liblcms2])
7237 else
7238     SYSTEM_LCMS2=NO
7240 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${OUTDIR}/lib -llcms2"])
7241 if test "$GCC" = "yes"; then
7242     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7245 dnl ===================================================================
7246 dnl Check for system cppunit
7247 dnl ===================================================================
7248 libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.12.0])
7250 dnl ===================================================================
7251 dnl Check whether freetype is available
7252 dnl ===================================================================
7253 if test  "$test_freetype" = "yes"; then
7254     AC_MSG_CHECKING([whether freetype is available])
7255     # FreeType has 3 different kinds of versions
7256     # * release, like 2.4.10
7257     # * libtool, like 13.0.7 (this what pkg-config returns)
7258     # * soname
7259     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7260     #
7261     # 9.4.3 is 2.1.5; the first FreeType release to provide a freetype2.pc file
7262     # XXX: replace this with a real minimum required version
7263     PKG_CHECK_MODULES( FREETYPE, freetype2 >= 9.4.3 )
7264 else
7265     case "$BUILD_TYPE" in
7266     *FREETYPE*)
7267         FREETYPE_LIBS="-lfreetype"
7268         ;;
7269     esac
7271 AC_SUBST(FREETYPE_CFLAGS)
7272 AC_SUBST(FREETYPE_LIBS)
7274 dnl ===================================================================
7275 dnl Check for system libwps
7276 dnl ===================================================================
7277 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.2],["-I${OUTDIR}/inc/external"],["-L${OUTDIR}/lib -lwpslib"])
7279 dnl ===================================================================
7280 dnl Check for system libwpg
7281 dnl ===================================================================
7282 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.2],["-I${OUTDIR}/inc/external"],["-L${OUTDIR}/lib -lwpglib"])
7284 # ===================================================================
7285 # Check for system libxslt
7286 # to prevent incompatibilities between internal libxml2 and external libxslt,
7287 # or vice versa, use with_system_libxml here
7288 # ===================================================================
7289 if test "$with_system_libxml" = "auto"; then
7290     case "$_os" in
7291     WINNT|iOS|Android)
7292         with_system_libxml="$with_system_libs"
7293         ;;
7294     *)
7295         with_system_libxml=yes
7296         ;;
7297     esac
7300 AC_MSG_CHECKING([which libxslt to use])
7301 if test "$with_system_libxml" = "yes"; then
7302     AC_MSG_RESULT([external])
7303     SYSTEM_LIBXSLT=YES
7304     if test "$_os" = "Darwin"; then
7305         dnl make sure to use SDK path
7306         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7307         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7308         dnl omit -L/usr/lib
7309         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7310         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7311     else
7312         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7313         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7314     fi
7316     dnl Check for xsltproc
7317     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7318     if test "$XSLTPROC" = "no"; then
7319         AC_MSG_ERROR([xsltproc is required])
7320     fi
7322     libo_MINGW_CHECK_DLL([libxslt])
7323     libo_MINGW_CHECK_DLL([libexslt])
7324     libo_MINGW_TRY_DLL([iconv])
7325 else
7326     AC_MSG_RESULT([internal])
7327     SYSTEM_LIBXSLT=NO
7328     LIBXSLT_MAJOR=1
7329     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
7331     if test "$cross_compiling" = "yes"; then
7332         AC_PATH_PROG(XSLTPROC, xsltproc, no)
7333         if test "$XSLTPROC" = "no"; then
7334             AC_MSG_ERROR([xsltproc is required])
7335         fi
7336     fi
7338 AC_SUBST(SYSTEM_LIBXSLT)
7339 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
7340     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
7342 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
7344 AC_SUBST(LIBEXSLT_CFLAGS)
7345 AC_SUBST(LIBEXSLT_LIBS)
7346 AC_SUBST(LIBXSLT_CFLAGS)
7347 AC_SUBST(LIBXSLT_LIBS)
7348 AC_SUBST(LIBXSLT_MAJOR)
7349 AC_SUBST(XSLTPROC)
7351 # ===================================================================
7352 # Check for system libxml
7353 # ===================================================================
7354 AC_MSG_CHECKING([which libxml to use])
7355 if test "$with_system_libxml" = "yes"; then
7356     AC_MSG_RESULT([external])
7357     SYSTEM_LIBXML=YES
7358     if test "$_os" = "Darwin"; then
7359         dnl make sure to use SDK path
7360         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7361         dnl omit -L/usr/lib
7362         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
7363     elif test $_os = iOS; then
7364         dnl make sure to use SDK path
7365         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
7366         LIBXML_CFLAGS="-I$usr/include/libxml2"
7367         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
7368     else
7369         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
7370     fi
7372     dnl Check for xmllint
7373     AC_PATH_PROG(XMLLINT, xmllint, no)
7374     if test "$XMLLINT" = "no"; then
7375         AC_MSG_ERROR([xmllint is required])
7376     fi
7378     libo_MINGW_CHECK_DLL([libxml2])
7379     libo_MINGW_TRY_DLL([zlib1])
7380 else
7381     AC_MSG_RESULT([internal])
7382     SYSTEM_LIBXML=NO
7383     BUILD_TYPE="$BUILD_TYPE LIBXML2"
7385 AC_SUBST(SYSTEM_LIBXML)
7386 AC_SUBST(LIBXML_CFLAGS)
7387 AC_SUBST(LIBXML_LIBS)
7388 AC_SUBST(XMLLINT)
7390 # =====================================================================
7391 # Checking for a Python interpreter with version >= 2.5 needed to build LO.
7392 # runtime requires Python 3 compatible version (>= 2.6)
7393 # Optionally user can pass an option to configure, i. e.
7394 # ./configure PYTHON=/usr/bin/python
7395 # =====================================================================
7396 if test "$build_os" != "cygwin"; then
7397     # This allows a lack of system python with no error, we use internal one in that case.
7398     AM_PATH_PYTHON([2.5],, [:])
7399     # Clean PYTHON_VERSION checked below if cross-compiling
7400     PYTHON_VERSION=""
7401     if test "$PYTHON" != ":"; then
7402         PYTHON_FOR_BUILD=$PYTHON
7403     fi
7405 AC_SUBST(PYTHON_FOR_BUILD)
7407 # Checks for Python to use for Pyuno
7408 AC_MSG_CHECKING([which Python to use for Pyuno])
7409 case "$enable_python" in
7410 no|disable)
7411     if test -z $PYTHON_FOR_BUILD; then
7412         # Python is required to build LibreOffice. In theory we could separate the build-time Python
7413         # requirement from the choice whether to include Python stuff in the installer, but why
7414         # bother?
7415         AC_MSG_ERROR([Python is required at build time.])
7416     fi
7417     enable_python=no
7418     AC_MSG_RESULT([none])
7419     ;;
7420 ""|yes|auto)
7421     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
7422         AC_MSG_RESULT([no, overridden by --disable-scripting])
7423         enable_python=no
7424     elif test $build_os = cygwin; then
7425         dnl When building on Windows we don't attempt to use any installed
7426         dnl "system"  Python.
7427         dnl
7428         dnl (When cross-compiling to Windows from Linux using the mingw32-cross
7429         dnl compiler from OBS, use mingw32-python from OBS, and ditto for other
7430         dnl MinGW cross-compilation setups.)
7431         AC_MSG_RESULT([internal])
7432         enable_python=internal
7433     elif test "$cross_compiling" = yes; then
7434         AC_MSG_RESULT([system])
7435         enable_python=system
7436     else
7437         # Unset variables set by the above AM_PATH_PYTHON so that
7438         # we actually do check anew.
7439         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
7440         AM_PATH_PYTHON([3.3],, [:])
7441         if test "$PYTHON" = :; then
7442             AC_MSG_RESULT([internal])
7443             enable_python=internal
7444         else
7445             AC_MSG_RESULT([system])
7446             enable_python=system
7447         fi
7448     fi
7449     ;;
7450 internal)
7451     AC_MSG_RESULT([internal])
7452     ;;
7453 system)
7454     AC_MSG_RESULT([system])
7455     ;;
7457     AC_MSG_ERROR([Incorrect --enable-python option])
7458     ;;
7459 esac
7461 if test $enable_python != no; then
7462     BUILD_TYPE="$BUILD_TYPE PYUNO"
7465 if test $enable_python = system; then
7466     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
7467         # We already have logic above to make sure the system Python
7468         # is used only when building against SDK 10.6 or newer.
7470         # Make sure we use the 2.6 Python when building against the
7471         # 10.6 SDK.
7472         case $with_macosx_sdk in
7473         10.6)
7474             python_version=2.6;;
7475         10.7|10.8)
7476             python_version=2.7;;
7477         *)
7478             # ???
7479             python_version=2.7;;
7480         esac
7481         PYTHON=python$python_version
7482         PYTHON_CFLAGS="-I/Developer/SDKs/MacOSX${with_macosx_sdk}.sdk/System/Library/Frameworks/Python.framework/Versions/${python_version}/include/python${python_version}"
7483         PYTHON_LIBS="-framework Python"
7484     fi
7485     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
7486         # Fallback: Accept these in the environment, or as set above
7487         # for MacOSX.
7488         :
7489     elif test "$cross_compiling" != yes; then
7490         # Unset variables set by the above AM_PATH_PYTHON so that
7491         # we actually do check anew.
7492         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
7493         # This causes an error if no python command is found
7494         AM_PATH_PYTHON([3.3])
7495         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
7496         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
7497         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
7498         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
7499         if test -z "$PKG_CONFIG"; then
7500             PYTHON_CFLAGS="-I$python_include"
7501             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
7502         elif $PKG_CONFIG --exists python-$python_version; then
7503             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
7504             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
7505         else
7506             PYTHON_CFLAGS="-I$python_include"
7507             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
7508         fi
7509     else
7510         dnl How to find out the cross-compilation Python installation path?
7511         dnl Let's hardocode what we know for different distributions for now...
7512         for python_version in 2.6; do
7513             if test -f ${MINGW_SYSROOT}/include/python${python_version}/Python.h; then
7514                 PYTHON_CFLAGS="-I${MINGW_SYSROOT}/include/python$python_version"
7515                 PYTHON_LIBS="-L${MINGW_SYSROOT}/lib -lpython$python_version $python_libs"
7516                 AC_MSG_CHECKING([for python.exe])
7517                 libo_MINGW_CHECK_DLL([libpython$python_version])
7518                 libo_MINGW_CHECK_DLL([libreadline6])
7519                 libo_MINGW_CHECK_DLL([libtermcap])
7520                 # could we somehow extract the really mingw python version from
7521                 # actual distro package?
7522                 # 2.6.2 currently on OpenSUSE 12.1?
7523                 # rpm -q mingw32-python => mingw32-python-2.6.2-17.17.noarch
7524                 PYTHON_VERSION=$python_version.2
7525                 PYTHON_VERSION_MAJOR=`echo $python_version | cut -d . -f 1`
7526                 PYTHON_VERSION_MINOR=`echo $python_version | cut -d . -f 2`
7527                 break
7528             fi
7529         done
7530         AC_MSG_CHECKING([for python version])
7531         AS_IF([test -n "$PYTHON_VERSION"],
7532               [AC_MSG_RESULT([$PYTHON_VERSION])],
7533               [AC_MSG_RESULT([not found])
7534                AC_MSG_ERROR([no usable python found])])
7535         test -n "$PYTHON_CFLAGS" && break
7536     fi
7537     # let the PYTHON_FOR_BUILD match the same python installation that
7538     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
7539     # better for PythonTests.
7540     PYTHON_FOR_BUILD=$PYTHON
7543 dnl By now enable_python should be "system", "internal" or "no"
7544 case $enable_python in
7545 system)
7546     SYSTEM_PYTHON=YES
7548     if test "$CROSS_COMPILING" != YES; then
7549         dnl Check if the headers really work
7550         save_CPPFLAGS="$CPPFLAGS"
7551         CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
7552         AC_CHECK_HEADER(Python.h, [],
7553            [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
7554            [])
7555         CPPFLAGS="$save_CPPFLAGS"
7557         AC_LANG_PUSH(C)
7558         CFLAGS="$CFLAGS $PYTHON_CFLAGS"
7559         AC_MSG_CHECKING([for correct python library version])
7560            AC_RUN_IFELSE([AC_LANG_SOURCE([[
7561 #include <Python.h>
7563 int main(int argc, char **argv) {
7564        if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
7565            (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
7566        else return 1;
7568            ]])],[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])],[])
7569         CFLAGS=$save_CFLAGS
7570         AC_LANG_POP(C)
7572         dnl FIXME Check if the Python library can be linked with, too?
7573     fi
7574     ;;
7576 internal)
7577     SYSTEM_PYTHON=NO
7578     PYTHON_VERSION_MAJOR=3
7579     PYTHON_VERSION_MINOR=3
7580     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.3
7581     BUILD_TYPE="$BUILD_TYPE PYTHON"
7582     # Embedded Python dies without Home set
7583     if test "$HOME" = ""; then
7584         export HOME=""
7585     fi
7586     # bz2 tarball and bzip2 is not standard
7587     if test -z "$BZIP2"; then
7588         AC_PATH_PROG( BZIP2, bzip2)
7589         if test -z "$BZIP2"; then
7590             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
7591         fi
7592     fi
7593     ;;
7595     DISABLE_PYTHON=TRUE
7596     SYSTEM_PYTHON=NO
7597     ;;
7599     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
7600     ;;
7601 esac
7603 AC_SUBST(DISABLE_PYTHON)
7604 AC_SUBST(SYSTEM_PYTHON)
7605 AC_SUBST(PYTHON_CFLAGS)
7606 AC_SUBST(PYTHON_LIBS)
7607 AC_SUBST(PYTHON_VERSION)
7608 AC_SUBST(PYTHON_VERSION_MAJOR)
7609 AC_SUBST(PYTHON_VERSION_MINOR)
7611 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
7612 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
7613     AC_MSG_RESULT([yes])
7614     ENABLE_MARIADBC=YES
7615     MARIADBC_MAJOR=1
7616     MARIADBC_MINOR=0
7617     MARIADBC_MICRO=2
7618     BUILD_TYPE="$BUILD_TYPE MARIADBC"
7619 else
7620     AC_MSG_RESULT([no])
7621     ENABLE_MARIADBC=NO
7623 AC_SUBST(ENABLE_MARIADBC)
7624 AC_SUBST(MARIADBC_MAJOR)
7625 AC_SUBST(MARIADBC_MINOR)
7626 AC_SUBST(MARIADBC_MICRO)
7628 if test "$ENABLE_MARIADBC" = "YES"; then
7630     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
7632     dnl ===================================================================
7633     dnl Check for system MariaDB
7634     dnl ===================================================================
7635     AC_MSG_CHECKING([which MariaDB to use])
7636     if test "$with_system_mariadb" = "yes"; then
7637         AC_MSG_RESULT([external])
7638         SYSTEM_MARIADB=YES
7639         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
7640         if test -z "$MARIADBCONFIG"; then
7641             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
7642             if test -z "$MARIADBCONFIG"; then
7643                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL package.])
7644                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
7645             fi
7646         fi
7647         AC_MSG_CHECKING([MariaDB version])
7648         MARIADB_VERSION=`$MARIADBCONFIG --version`
7649         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
7650         if test "$MARIADB_MAJOR" -ge "5"; then
7651             AC_MSG_RESULT([OK])
7652         else
7653             AC_MSG_ERROR([too old, use 5.0.x or later])
7654         fi
7655         AC_MSG_CHECKING([for MariaDB Client library])
7656         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
7657         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
7658         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
7659         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
7660         if test "$enable_bundle_mariadb" = "yes"; then
7661             AC_MSG_RESULT([yes])
7662             BUNDLE_MARIADB=YES
7663             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\+-l/\n/g' | grep -E '(mysqlclient|mariadb)')
7664             if test "$_os" = "Darwin"; then
7665                 LIBMARIADB=${LIBMARIADB}.dylib
7666             elif test "$_os" = "WINNT"; then
7667                 LIBMARIADB=${LIBMARIADB}.dll
7668             else
7669                 LIBMARIADB=${LIBMARIADB}.so
7670             fi
7671             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
7672             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
7673             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
7674                 AC_MSG_RESULT([found.])
7675                 PathFormat "$LIBMARIADB_PATH"
7676                 LIBMARIADB_PATH="$formatted_path"
7677             else
7678                 AC_MSG_ERROR([not found.])
7679             fi
7680         else
7681             AC_MSG_RESULT([no])
7682             BUNDLE_MARIADB=NO
7683         fi
7684     else
7685         AC_MSG_RESULT([internal])
7686         AC_MSG_ERROR([libmariadb is known to be broken as of 2013-10; use libmysqlclient])
7687         SYSTEM_MARIADB=NO
7688         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb/include"
7689         MARIADB_LIBS="-L${OUTDIR}/lib -lmariadblib"
7690         BUILD_TYPE="$BUILD_TYPE MARIADB"
7691     fi
7693     AC_SUBST(SYSTEM_MARIADB)
7694     AC_SUBST(MARIADB_CFLAGS)
7695     AC_SUBST(MARIADB_LIBS)
7696     AC_SUBST(LIBMARIADB)
7697     AC_SUBST(LIBMARIADB_PATH)
7698     AC_SUBST(BUNDLE_MARIADB)
7700     AC_LANG_PUSH([C++])
7701     dnl ===================================================================
7702     dnl Check for system MySQL C++ Connector
7703     dnl ===================================================================
7704     # FIXME!
7705     # who thought this too-generic cppconn dir was a good idea?
7706     AC_MSG_CHECKING([MySQL Connector/C++])
7707     if test "$with_system_mysql_cppconn" = "yes"; then
7708         AC_MSG_RESULT([external])
7709         SYSTEM_MYSQL_CPPCONN=YES
7710         AC_LANG_PUSH([C++])
7711         AC_CHECK_HEADER(mysql_driver.h, [],
7712                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
7713         AC_CHECK_LIB([mysqlcppconn], [main], [:],
7714                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
7715         save_LIBS=$LIBS
7716         LIBS="$LIBS -lmysqlcppconn"
7717         AC_MSG_CHECKING([version])
7718         AC_RUN_IFELSE([AC_LANG_SOURCE([[
7719 #include <mysql_driver.h>
7721 int main(int argc, char **argv) {
7722     sql::Driver *driver;
7723     driver = get_driver_instance();
7724     if (driver->getMajorVersion() > 1 || \
7725        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
7726        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
7727         return 0;
7728       else
7729         return 1;
7731       ]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR([not suitable, we need >= 1.0.6])],[])
7733         AC_LANG_POP([C++])
7734         LIBS=$save_LIBS
7735     else
7736         AC_MSG_RESULT([internal])
7737         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
7738         SYSTEM_MYSQL_CPPCONN=NO
7739     fi
7740     AC_LANG_POP([C++])
7742 AC_SUBST(SYSTEM_MYSQL_CPPCONN)
7744 dnl ===================================================================
7745 dnl Check for system hsqldb
7746 dnl ===================================================================
7747 if test "$with_java" != "no"; then
7748 HSQLDB_USE_JDBC_4_1=
7749 AC_MSG_CHECKING([which hsqldb to use])
7750 if test "$with_system_hsqldb" = "yes"; then
7751     AC_MSG_RESULT([external])
7752     SYSTEM_HSQLDB=YES
7753     if test -z $HSQLDB_JAR; then
7754         HSQLDB_JAR=/usr/share/java/hsqldb.jar
7755     fi
7756     AC_CHECK_FILE($HSQLDB_JAR, [],
7757                [AC_MSG_ERROR(hsqldb.jar not found.)], [])
7758     AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
7759     export HSQLDB_JAR
7760     if $PERL -e 'use Archive::Zip;
7761             my $file = "$ENV{'HSQLDB_JAR'}";
7762             my $zip = Archive::Zip->new( $file );
7763             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
7764             if ( $mf =~ m/Specification-Version: 1.8.*/ ) {
7765                push @l, split(/\n/, $mf);
7766                foreach my $line (@l) {
7767                   if ($line =~ m/Specification-Version:/) {
7768                       ($t, $version) = split (/:/,$line);
7769                       $version =~ s/^\s//;
7770                       ($a, $b, $c, $d) = split (/\./,$version);
7771                       if ($c == "0" && $d > "8")  {
7772                           exit 0;
7773                       } else {
7774                           exit 1;
7775                       }
7776                   }
7777                }
7778             } else {
7779                 exit 1;
7780             }'; then
7781         AC_MSG_RESULT([yes])
7782     else
7783         AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
7784     fi
7785 else
7786     AC_MSG_RESULT([internal])
7787     SYSTEM_HSQLDB=NO
7788     BUILD_TYPE="$BUILD_TYPE HSQLDB"
7789     AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
7790     javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
7791     if expr "$javanumver" '>=' 000100060000 > /dev/null; then
7792         AC_MSG_RESULT([yes])
7793         HSQLDB_USE_JDBC_4_1=YES
7794     else
7795         AC_MSG_RESULT([no])
7796     fi
7798 AC_SUBST(SYSTEM_HSQLDB)
7799 AC_SUBST(HSQLDB_JAR)
7800 AC_SUBST([HSQLDB_USE_JDBC_4_1])
7803 dnl ===================================================================
7804 dnl Check for PostgreSQL stuff
7805 dnl ===================================================================
7806 if test "x$enable_postgresql_sdbc" != "xno"; then
7807     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
7809     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
7810         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
7811     fi
7812     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
7813         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
7814     fi
7816     AC_MSG_CHECKING([PostgreSQL C interface])
7817     if test "$with_system_postgresql" = "yes"; then
7818         AC_MSG_RESULT([external PostgreSQL])
7819         SYSTEM_POSTGRESQL=YES
7820         if test "$_os" = Darwin; then
7821             supp_path=''
7822             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
7823                 pg_supp_path="$P_SEP$d$pg_supp_path"
7824             done
7825         fi
7826         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
7827         if test -z "$PGCONFIG"; then
7828             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
7829         fi
7830         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
7831         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
7832     else
7833         # if/when anything else than PostgreSQL uses Kerberos,
7834         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
7835         WITH_KRB5=NO
7836         WITH_GSSAPI=no
7837         case "$_os" in
7838         Darwin)
7839             # MacOS X has system MIT Kerberos 5 since 10.4
7840             if test "$with_krb5" != "no"; then
7841                 WITH_KRB5=YES
7842                 save_LIBS=$LIBS
7843                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
7844                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5, try installing libcom_err devel package])])
7845                 KRB5_LIBS=$LIBS
7846                 LIBS=$save_LIBS
7847                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
7848                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5, try installing krb5 devel package])])
7849                 KRB5_LIBS="$KRB5_LIBS $LIBS"
7850                 LIBS=$save_LIBS
7851             fi
7852             if test "$with_gssapi" != "no"; then
7853               WITH_GSSAPI=YES
7854               save_LIBS=$LIBS
7855               AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
7856                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
7857               GSSAPI_LIBS=$LIBS
7858               LIBS=$save_LIBS
7859             fi
7860             ;;
7861         WINNT)
7862             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
7863                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
7864             fi
7865             ;;
7866         Linux|GNU|*BSD|DragonFly)
7867             if test "$with_krb5" != "no"; then
7868                 WITH_KRB5=YES
7869                 save_LIBS=$LIBS
7870                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
7871                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
7872                 KRB5_LIBS=$LIBS
7873                 LIBS=$save_LIBS
7874                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
7875                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
7876                 KRB5_LIBS="$KRB5_LIBS $LIBS"
7877                 LIBS=$save_LIBS
7878             fi
7879             if test "$with_gssapi" != "no"; then
7880                 WITH_GSSAPI=YES
7881                 save_LIBS=$LIBS
7882                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
7883                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
7884                 GSSAPI_LIBS=$LIBS
7885                 LIBS=$save_LIBS
7886             fi
7887             ;;
7888         *)
7889             if test "$with_krb5" = "yes"; then
7890                 WITH_KRB5=YES
7891                 save_LIBS=$LIBS
7892                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
7893                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
7894                 KRB5_LIBS=$LIBS
7895                 LIBS=$save_LIBS
7896                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
7897                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
7898                 KRB5_LIBS="$KRB5_LIBS $LIBS"
7899                 LIBS=$save_LIBS
7900             fi
7901             if test "$with_gssapi" = "yes"; then
7902                 WITH_GSSAPI=YES
7903                 save_LIBS=$LIBS
7904                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
7905                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
7906                 LIBS=$save_LIBS
7907                 GSSAPI_LIBS=$LIBS
7908             fi
7909         esac
7911         if test -n "$with_libpq_path"; then
7912             SYSTEM_POSTGRESQL=YES
7913             AC_MSG_RESULT([external libpq])
7914             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
7915             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
7916         else
7917             SYSTEM_POSTGRESQL=NO
7918             AC_MSG_RESULT([internal])
7919             POSTGRESQL_LIB=""
7920             POSTGRESQL_INC="%OVERRIDE_ME%"
7921             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
7922         fi
7923     fi
7924     if test "${SYSTEM_POSTGRESQL}" = "YES"; then
7925         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
7926         save_CFLAGS=$CFLAGS
7927         save_CPPFLAGS=$CPPFLAGS
7928         save_LIBS=$LIBS
7929         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
7930         LIBS="${LIBS} ${POSTGRESQL_LIB}"
7931         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
7932         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
7933             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
7934         CFLAGS=$save_CFLAGS
7935         CPPFLAGS=$save_CPPFLAGS
7936         LIBS=$save_LIBS
7937     fi
7938     BUILD_POSTGRESQL_SDBC=YES
7940 AC_SUBST(WITH_KRB5)
7941 AC_SUBST(WITH_GSSAPI)
7942 AC_SUBST(GSSAPI_LIBS)
7943 AC_SUBST(KRB5_LIBS)
7944 AC_SUBST(BUILD_POSTGRESQL_SDBC)
7945 AC_SUBST(SYSTEM_POSTGRESQL)
7946 AC_SUBST(POSTGRESQL_INC)
7947 AC_SUBST(POSTGRESQL_LIB)
7949 dnl ===================================================================
7950 dnl Check for system curl
7951 dnl ===================================================================
7952 AC_MSG_CHECKING([which libcurl to use])
7953 if test "$with_system_curl" = "auto"; then
7954     case "$_os" in
7955     Darwin)
7956         with_system_curl=yes
7957         ;;
7958     *)
7959         with_system_curl="$with_system_libs"
7960         ;;
7961     esac
7964 if test "$with_system_curl" = "yes"; then
7965     AC_MSG_RESULT([external])
7966     SYSTEM_CURL=YES
7968     curl_version=""
7969     if test "$cross_compiling" = "yes"; then
7970         dnl At least the OBS mingw32-libcurl-devel package
7971         dnl comes with a proper .pc file
7972         PKG_CHECK_MODULES(CURL, libcurl,, [:])
7973         if test -n "$CURL_PKG_ERRORS"; then
7974             AC_MSG_RESULT([no])
7975         else
7976             curl_version=`$PKG_CONFIG --modversion libcurl`
7977         fi
7978     fi
7979     if test -z "$curl_version"; then
7980         AC_PATH_PROG(CURLCONFIG, curl-config)
7981         if test -z "$CURLCONFIG"; then
7982             AC_MSG_ERROR([install the libcurl development package])
7983         fi
7984         CURL_LIBS=`$CURLCONFIG --libs`
7985         CURL_CFLAGS=`$CURLCONFIG --cflags`
7986         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
7987     fi
7989     AC_MSG_CHECKING([whether libcurl is >= 7.13.1])
7991     case $curl_version in
7992     dnl brackets doubled below because Autoconf uses them as m4 quote characters,
7993     dnl so they need to be doubled to end up in the configure script
7994     7.13.1|7.1[[4-9]].*|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
7995         AC_MSG_RESULT([yes, you have $curl_version])
7996         ;;
7997     *)
7998         AC_MSG_ERROR([no, you have $curl_version])
7999         ;;
8000     esac
8002     libo_MINGW_CHECK_DLL([libcurl])
8003     libo_MINGW_TRY_DLL([libintl])
8004     libo_MINGW_TRY_DLL([libidn])
8005     libo_MINGW_TRY_DLL([libnspr4])
8006     libo_MINGW_TRY_DLL([nssutil3])
8007     libo_MINGW_TRY_DLL([libplc4])
8008     libo_MINGW_TRY_DLL([libplds4])
8009     libo_MINGW_TRY_DLL([nss3])
8010     libo_MINGW_TRY_DLL([ssl3])
8011     libo_MINGW_TRY_DLL([libgpg-error])
8012     libo_MINGW_TRY_DLL([libgcrypt])
8013     libo_MINGW_TRY_DLL([libssh2])
8014 else
8015     AC_MSG_RESULT([internal])
8016     SYSTEM_CURL=NO
8017     BUILD_TYPE="$BUILD_TYPE CURL"
8019 AC_SUBST(SYSTEM_CURL)
8020 AC_SUBST(CURL_CFLAGS)
8021 AC_SUBST(CURL_LIBS)
8023 dnl ===================================================================
8024 dnl Check for system boost
8025 dnl ===================================================================
8026 AC_MSG_CHECKING([which boost to use])
8027 if test "$with_system_boost" = "yes"; then
8028     AC_MSG_RESULT([external])
8029     SYSTEM_BOOST=YES
8030     AX_BOOST_BASE
8031     AX_BOOST_DATE_TIME
8032     mingw_boost_date_time_dll=`echo $BOOST_DATE_TIME_LIB | sed -e 's/^-l//' -e 's/\.dll$//'`
8033     libo_MINGW_TRY_DLL([$mingw_boost_date_time_dll])
8034     if test -z "$MINGW_BOOST_DATE_TIME_DLL"; then
8035         # if not found, try again with 'lib' prefix
8036         libo_MINGW_CHECK_DLL([lib$mingw_boost_date_time_dll])
8037     fi
8038     AC_LANG_PUSH([C++])
8039     save_CXXFLAGS=$CXXFLAGS
8040     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS"
8041     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8042        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8043     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8044        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8045     AC_CHECK_HEADER(boost/function.hpp, [],
8046        [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
8047     CXXFLAGS="$CXXFLAGS -fno-exceptions"
8048     AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
8049     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp>
8050 ]], [[]])],[ac_cv_cxx_boost_no_exceptions_broken=no],[ac_cv_cxx_boost_no_exceptions_broken=yes])
8051     if test "$ac_cv_cxx_boost_no_exceptions_broken" = "yes"; then
8052         AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
8053     else
8054         AC_MSG_RESULT([yes])
8055     fi
8056     CXXFLAGS=$save_CXXFLAGS
8057     AC_LANG_POP([C++])
8058 else
8059     AC_MSG_RESULT([internal])
8060     BUILD_TYPE="$BUILD_TYPE BOOST"
8061     SYSTEM_BOOST=NO
8063 AC_SUBST(SYSTEM_BOOST)
8065 dnl ===================================================================
8066 dnl Check for system mdds
8067 dnl ===================================================================
8068 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds >= 0.8.1])
8070 dnl ===================================================================
8071 dnl Determine which hash container mdds shall use
8072 dnl ===================================================================
8073 AC_MSG_CHECKING([which hash container mdds shall use])
8074 if test "x$HAVE_CXX0X" = "xTRUE" -a "x$SYSTEM_MDDS" = "xYES"; then
8075     MDDS_CPPFLAGS=$CXXFLAGS_CXX11
8076     AC_MSG_RESULT([std::unordered_map])
8077 else
8078     MDDS_CPPFLAGS="-DMDDS_HASH_CONTAINER_BOOST"
8079     AC_MSG_RESULT([boost::unordered_map])
8081 AC_SUBST([MDDS_CPPFLAGS])
8083 dnl ===================================================================
8084 dnl Check for system vigra
8085 dnl ===================================================================
8086 AC_MSG_CHECKING([which vigra to use])
8087 if test "$with_system_vigra" = "yes"; then
8088     AC_MSG_RESULT([external])
8089     SYSTEM_VIGRA=YES
8090     AC_LANG_PUSH([C++])
8091     AC_CHECK_HEADER(vigra/copyimage.hxx, [],
8092        [AC_MSG_ERROR(vigra/copyimage.hxx not found. install vigra)], [])
8093     AC_LANG_POP([C++])
8094 else
8095     AC_MSG_RESULT([internal])
8096     BUILD_TYPE="$BUILD_TYPE VIGRA"
8097     SYSTEM_VIGRA=NO
8099 AC_SUBST(SYSTEM_VIGRA)
8101 dnl ===================================================================
8102 dnl Check for system odbc
8103 dnl ===================================================================
8104 AC_MSG_CHECKING([which odbc headers to use])
8105 if test "$with_system_odbc" = "yes"; then
8106     AC_MSG_RESULT([external])
8107     SYSTEM_ODBC_HEADERS=YES
8109     AC_CHECK_HEADER(sqlext.h, [],
8110       [AC_MSG_ERROR(odbc not found. install odbc)], [])
8111 elif test "$enable_database_connectivity" != yes; then
8112     AC_MSG_RESULT([none])
8113 else
8114     AC_MSG_RESULT([internal])
8115     SYSTEM_ODBC_HEADERS=NO
8117 AC_SUBST(SYSTEM_ODBC_HEADERS)
8120 dnl ===================================================================
8121 dnl Check for system openldap
8122 dnl ===================================================================
8124 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8125 AC_MSG_CHECKING([which openldap library to use])
8126 if test "$with_system_openldap" = "yes"; then
8127     AC_MSG_RESULT([external])
8128     SYSTEM_OPENLDAP=YES
8129     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8130     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8131     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8132 else
8133     AC_MSG_RESULT([internal])
8134     SYSTEM_OPENLDAP=NO
8135     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8138 AC_SUBST(SYSTEM_OPENLDAP)
8140 dnl ===================================================================
8141 dnl Check for mozilla ab connectivity for windows
8142 dnl ===================================================================
8144 if test "$_os" = "WINNT"; then
8145     AC_MSG_CHECKING([whether to enable build of Mozilla addressbook connectivity driver for Windows])
8146     if test "$enable_win_mozab_driver" = "yes" -a "$WITH_MINGW" != "YES" ; then
8147         WITH_MOZAB4WIN=YES
8148         AC_MSG_RESULT([yes, internal (old windows mozab driver)])
8149         BUILD_TYPE="$BUILD_TYPE MOZ"
8150         MSVC80_DLLS="msvcp80.dll msvcr80.dll Microsoft.VC80.CRT.manifest"
8151         MSVC80_DLL_PATH=`cygpath -u "$TARFILE_LOCATION"`
8152         for dll in $MSVC80_DLLS; do
8153             if ! test -f "$MSVC80_DLL_PATH/$dll"; then
8154                 AC_MSG_ERROR([can not find $dll in $MSVC80_DLL_PATH needed for the pre-built Mozilla libraries])
8155             fi
8156         done
8157     else
8158         AC_MSG_RESULT([no])
8159         WITH_MOZAB4WIN=NO
8160     fi
8162 AC_SUBST(WITH_MOZAB4WIN)
8163 AC_SUBST(MSVC80_DLLS)
8164 AC_SUBST(MSVC80_DLL_PATH)
8166 dnl ===================================================================
8167 dnl Check for TLS/SSL and cryptographic implementation to use
8168 dnl ===================================================================
8169 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8170 if test -n "$with_tls"; then
8171     case $with_tls in
8172     openssl)
8173         AC_DEFINE(USE_TLS_OPENSSL)
8174         TLS=OPENSSL
8176         if test "$enable_openssl" != "yes"; then
8177             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8178         fi
8180         # warn that OpenSSL has been selected but not all TLS code has this option
8181         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS])
8182         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS"
8183         ;;
8184     nss)
8185         AC_DEFINE(USE_TLS_NSS)
8186         TLS=NSS
8187         ;;
8188     *)
8189         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8190 openssl - OpenSSL
8191 nss - Mozilla's Network Security Services (NSS)
8192     ])
8193         ;;
8194     esac
8195 else
8196     if test "$enable_openssl" = "yes"; then
8197         AC_DEFINE(USE_TLS_OPENSSL)
8198         TLS=OPENSSL
8199     else
8200         AC_DEFINE(USE_TLS_NSS)
8201         TLS=NSS
8202     fi
8204 AC_MSG_RESULT([$TLS])
8205 AC_SUBST(TLS)
8207 dnl ===================================================================
8208 dnl Check for system NSS
8209 dnl ===================================================================
8210 libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8211 if test "$with_system_nss" = "yes"; then
8212     libo_MINGW_CHECK_DLL([libnspr4])
8213     libo_MINGW_CHECK_DLL([libplc4])
8214     libo_MINGW_CHECK_DLL([libplds4])
8215     libo_MINGW_CHECK_DLL([nss3])
8216     libo_MINGW_CHECK_DLL([nssutil3])
8217     libo_MINGW_CHECK_DLL([smime3])
8218     libo_MINGW_CHECK_DLL([ssl3])
8219 else
8220     NSS_MAJOR="3"
8221     NSS_MINOR="13"
8222     NSS_PATCH="5"
8224 AC_SUBST(NSS_MAJOR)
8225 AC_SUBST(NSS_MINOR)
8226 AC_SUBST(NSS_PATCH)
8228 dnl ===================================================================
8229 dnl Check for system mozilla headers
8230 dnl ===================================================================
8231 HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=
8232 AC_MSG_CHECKING([which NPAPI headers to use])
8234 if test "$with_system_npapi_headers" = "yes"; then
8235     AC_MSG_RESULT([external])
8236     SYSTEM_NPAPI_HEADERS=YES
8237     # First try npapi-sdk:
8238     PKG_CHECK_MODULES(NPAPI_HEADERS, npapi-sdk, [LOCATED=yes], [LOCATED=no])
8239     # Then go with libxul:
8240     if test "x$LOCATED" != "xyes"; then
8241         PKG_CHECK_MODULES(NPAPI_HEADERS, libxul, [LOCATED=yes], [LOCATED=no])
8242     fi
8243     if test "x$LOCATED" != "xyes"; then
8244         PKG_CHECK_MODULES(NPAPI_HEADERS, mozilla-plugin, [LOCATED=yes], [LOCATED=no])
8245     fi
8246     # if still not found bail out
8247     if test "x$LOCATED" != "xyes"; then
8248         AC_MSG_ERROR([npapi.h header file not found])
8249     fi
8251     AC_LANG_PUSH([C])
8252     save_CFLAGS=$CFLAGS
8253     CFLAGS="$CFLAGS $NPAPI_HEADERS_CFLAGS"
8254     AC_MSG_CHECKING([for NPP_GetMIMEDescription return type])
8255     AC_COMPILE_IFELSE(
8256         [AC_LANG_SOURCE([[
8257             #define XP_UNIX
8258             #include <npapi.h>
8259             const char* NPP_GetMIMEDescription(void) { return "foo"; }
8260             ]])],
8261         [AC_MSG_RESULT([const char*])],
8262         [
8263         AC_MSG_RESULT([char*])
8264         HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=TRUE
8265         ])
8266     CFLAGS=$save_CFLAGS
8267     AC_LANG_POP([C])
8268     NPAPI_HEADERS_CFLAGS="`echo $NPAPI_HEADERS_CFLAGS | sed -e \"s/-I/${ISYSTEM}/g\"`"
8269 else
8270     AC_MSG_RESULT([internal])
8271         dnl ...but will not be built/used unless ENABLE_NPAPI_FROM_BROWSER or
8272         dnl ENABLE_NPAPI_INTO_BROWSER is YES
8273     SYSTEM_NPAPI_HEADERS=NO
8275 AC_SUBST(NPAPI_HEADERS_CFLAGS)
8276 AC_SUBST(SYSTEM_NPAPI_HEADERS)
8277 AC_SUBST(HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION)
8279 dnl ===================================================================
8280 dnl Check for system sane
8281 dnl ===================================================================
8282 AC_MSG_CHECKING([which sane header to use])
8283 if test "$with_system_sane" = "yes"; then
8284     AC_MSG_RESULT([external])
8285     AC_CHECK_HEADER(sane/sane.h, [],
8286       [AC_MSG_ERROR(sane not found. install sane)], [])
8287 else
8288     AC_MSG_RESULT([internal])
8289     BUILD_TYPE="$BUILD_TYPE SANE"
8292 dnl ===================================================================
8293 dnl Check for system icu
8294 dnl ===================================================================
8295 SYSTEM_GENBRK=
8296 SYSTEM_GENCCODE=
8297 SYSTEM_GENCMN=
8299 ICU_MAJOR=51
8300 ICU_MINOR=1
8301 ICU_RECLASSIFIED_CLOSE_PARENTHESIS="YES"
8302 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="YES"
8303 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="YES"
8304 ICU_RECLASSIFIED_HEBREW_LETTER="YES"
8305 AC_MSG_CHECKING([which icu to use])
8306 if test "$with_system_icu" = "yes"; then
8307     AC_MSG_RESULT([external])
8308     SYSTEM_ICU=YES
8309     AC_LANG_PUSH([C++])
8310     AC_MSG_CHECKING([for unicode/rbbi.h])
8311     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
8312     AC_LANG_POP([C++])
8314     if test "$cross_compiling" != "yes" -o "$WITH_MINGW" = "yes"; then
8315         ICUPATH="$PATH"
8316         if test "$WITH_MINGW" = "yes"; then
8317             ICUPATH=`$CC -print-sysroot`/mingw/bin:"$ICUPATH"
8318         fi
8319         AC_PATH_PROG(ICUCONFIG,icu-config,,[$ICUPATH])
8321         AC_MSG_CHECKING([ICU version])
8322         ICU_VERSION=`$ICUCONFIG --noverify --version 2>/dev/null || $ICUCONFIG --version`
8323         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
8324         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
8326         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "2" \); then
8327             AC_MSG_RESULT([OK, $ICU_VERSION])
8328         else
8329             AC_MSG_ERROR([not suitable, only >= 4.2 supported currently])
8330         fi
8331     fi
8333     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
8334         AC_PATH_PROG([ICUCONFIG_FOR_BUILD], [icu-config], [], [$PATH:/usr/sbin:/sbin])
8335         ICU_VERSION_FOR_BUILD=`$ICUCONFIG_FOR_BUILD --noverify --version 2>/dev/null || $ICUCONFIG_FOR_BUILD --version`
8336         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
8337         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
8338         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
8339         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
8340             AC_MSG_RESULT([yes])
8341         else
8342             AC_MSG_RESULT([no])
8343             if test "$with_system_icu_for_build" != "force"; then
8344                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
8345 You can use --with-system-icu-for-build=force to use it anyway.])
8346             fi
8347         fi
8348     fi
8350     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
8351         # using the system icu tools can lead to version confusion, use the
8352         # ones from the build environment when cross-compiling
8353         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
8354         if test -z "$SYSTEM_GENBRK"; then
8355             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
8356         fi
8357         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8358         if test -z "$SYSTEM_GENCCODE"; then
8359             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
8360         fi
8361         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8362         if test -z "$SYSTEM_GENCMN"; then
8363             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
8364         fi
8365         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "4" \); then
8366             ICU_RECLASSIFIED_CLOSE_PARENTHESIS="YES"
8367         else
8368             ICU_RECLASSIFIED_CLOSE_PARENTHESIS="NO"
8369         fi
8370         if test "$ICU_MAJOR" -ge "49"; then
8371             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="YES"
8372             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="YES"
8373             ICU_RECLASSIFIED_HEBREW_LETTER="YES"
8374         else
8375             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="NO"
8376             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="NO"
8377             ICU_RECLASSIFIED_HEBREW_LETTER="NO"
8378         fi
8379     fi
8381     if test "$cross_compiling" = "yes"; then
8382        if test "$ICU_MAJOR" -ge "50"; then
8383             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
8384             ICU_MINOR=""
8385        fi
8386     fi
8388     libo_MINGW_CHECK_DLL([icudata][$ICU_MAJOR][$ICU_MINOR])
8389     libo_MINGW_CHECK_DLL([icui18n][$ICU_MAJOR][$ICU_MINOR])
8390     libo_MINGW_CHECK_DLL([icuuc][$ICU_MAJOR][$ICU_MINOR])
8391 else
8392     AC_MSG_RESULT([internal])
8393     SYSTEM_ICU="NO"
8394     BUILD_TYPE="$BUILD_TYPE ICU"
8395     # surprisingly set these only for "internal" (to be used by various other
8396     # external libs): the system icu-config is quite unhelpful and spits out
8397     # dozens of weird flags and also default path -I/usr/include
8398     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8399     ICU_LIBS=""
8401 AC_SUBST(SYSTEM_ICU)
8402 AC_SUBST(SYSTEM_GENBRK)
8403 AC_SUBST(SYSTEM_GENCCODE)
8404 AC_SUBST(SYSTEM_GENCMN)
8405 AC_SUBST(ICU_MAJOR)
8406 AC_SUBST(ICU_MINOR)
8407 AC_SUBST(ICU_RECLASSIFIED_CLOSE_PARENTHESIS)
8408 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
8409 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
8410 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
8411 AC_SUBST(ICU_CFLAGS)
8412 AC_SUBST(ICU_LIBS)
8414 dnl ===================================================================
8415 dnl Graphite
8416 dnl ===================================================================
8418 AC_MSG_CHECKING([whether to enable graphite support])
8419 if test "$_os" = "WINNT" -o "$_os" = "Linux" && test "$enable_graphite" = "" -o "$enable_graphite" != "no"; then
8420     AC_MSG_RESULT([yes])
8421     ENABLE_GRAPHITE="TRUE"
8422     AC_DEFINE(ENABLE_GRAPHITE)
8423     libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
8424     if test "$with_system_graphite" = "yes"; then
8425         libo_MINGW_CHECK_DLL([libgraphite2])
8426     fi
8427 else
8428     AC_MSG_RESULT([no])
8430 AC_SUBST(ENABLE_GRAPHITE)
8432 dnl ===================================================================
8433 dnl HarfBuzz
8434 dnl ===================================================================
8435 AC_MSG_CHECKING([whether to enable HarfBuzz support])
8436 if test "$_os" != "WINNT" -a "$_os" != "Darwin"; then
8437     AC_MSG_RESULT([yes])
8438     ENABLE_HARFBUZZ="TRUE"
8439     if $PKG_CONFIG --atleast-version 0.9.18 harfbuzz; then
8440         libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.18])
8441     else
8442         libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz >= 0.9.10])
8443     fi
8444 else
8445     AC_MSG_RESULT([no])
8447 AC_SUBST(ENABLE_HARFBUZZ)
8449 dnl ===================================================================
8450 dnl Check for NPAPI interface to plug browser plugins into LibreOffice documents
8451 dnl ===================================================================
8452 AC_MSG_CHECKING([whether to plug browser plugins into LibreOffice documents])
8453 # Obviously no such thing on iOS or Android. Also not possible when building
8454 # 64-bit OS X code as the plugin code uses QuickTime and Carbon.
8455 if test "$_os" != Android -a "$_os" != iOS -a \( $_os != Darwin -o "$BITNESS_OVERRIDE" = "" \) -a \
8456         "$enable_headless" != yes
8457 then
8458     AC_MSG_RESULT([yes])
8459     ENABLE_NPAPI_FROM_BROWSER=YES
8460 else
8461     AC_MSG_RESULT([no])
8462     ENABLE_NPAPI_FROM_BROWSER=NO
8464 AC_SUBST(ENABLE_NPAPI_FROM_BROWSER)
8466 dnl ===================================================================
8467 dnl Check for NPAPI interface to plug LibreOffice into browser windows
8468 dnl ===================================================================
8469 AC_MSG_CHECKING([whether to plug LibreOffice into browser windows])
8470 if test "$_os" == WINNT -o "$_os" != Android -a "$_os" != Darwin -a "$_os" != iOS -a \
8471         "$enable_headless" != yes -a "$enable_gtk" != no
8472 then
8473     AC_MSG_RESULT([yes])
8474     ENABLE_NPAPI_INTO_BROWSER=YES
8475 else
8476     AC_MSG_RESULT([no])
8477     ENABLE_NPAPI_INTO_BROWSER=NO
8479 AC_SUBST(ENABLE_NPAPI_INTO_BROWSER)
8481 AC_MSG_CHECKING([whether to use X11])
8482 dnl ***************************************
8483 dnl testing for X libraries and includes...
8484 dnl ***************************************
8485 WANT_X11="no"
8486 if test $_os != Darwin -a $_os != WINNT -a $_os != Android -a $_os != iOS -a "$enable_headless" != "yes"; then
8487     WANT_X11="yes"
8489 AC_MSG_RESULT([$WANT_X11])
8491 if test "$WANT_X11" = "yes"; then
8492     AC_PATH_X
8493     AC_PATH_XTRA
8494     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
8496     if test -z "$x_includes"; then
8497         x_includes="default_x_includes"
8498     fi
8499     if test -z "$x_libraries"; then
8500         x_libraries="default_x_libraries"
8501     fi
8502     CFLAGS="$CFLAGS $X_CFLAGS"
8503     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
8504     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
8505 else
8506     x_includes="no_x_includes"
8507     x_libraries="no_x_libraries"
8510 if test "$WANT_X11" = "yes"; then
8511     dnl ===================================================================
8512     dnl Check for Composite.h for Mozilla plugin
8513     dnl ===================================================================
8514     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
8515      [#include <X11/Intrinsic.h>])
8517     dnl ===================================================================
8518     dnl Check for extension headers
8519     dnl ===================================================================
8520     AC_MSG_CHECKING([whether to use internal X11 extensions headers])
8521     if test "$with_system_xextensions_headers" != "no"; then
8522         AC_MSG_RESULT([no])
8523         AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
8524         [#include <X11/extensions/shape.h>])
8525     else
8526         AC_MSG_RESULT([yes])
8527         BUILD_TYPE="$BUILD_TYPE X11_EXTENSIONS"
8528     fi
8532 dnl ===================================================================
8533 dnl Check for system Xrender
8534 dnl ===================================================================
8535 AC_MSG_CHECKING([whether to use Xrender])
8536 if test "$WANT_X11" = "yes" -a  "$test_xrender" = "yes"; then
8537     AC_MSG_RESULT([yes])
8538     PKG_CHECK_MODULES(XRENDER, xrender)
8539     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
8540       [AC_MSG_ERROR(libXrender not found or functional)], [])
8541     AC_MSG_CHECKING([which Xrender headers to use])
8542     if test "$with_system_xextensions_headers" != "no"; then
8543         AC_MSG_RESULT([external])
8544         AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
8545           [AC_MSG_ERROR(Xrender not found. install X)], [])
8546     else
8547         AC_MSG_RESULT([internal])
8548     fi
8549 else
8550     AC_MSG_RESULT([no])
8552 AC_SUBST(XRENDER_CFLAGS)
8553 AC_SUBST(XRENDER_LIBS)
8555 dnl ===================================================================
8556 dnl Check for XRandr
8557 dnl ===================================================================
8558 AC_MSG_CHECKING([whether to enable RandR support])
8559 if test "$WANT_X11" = "yes" -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
8560     if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
8561         XRANDR_DLOPEN="TRUE"
8562         AC_MSG_RESULT([configured to dlopen libXrandr at runtime])
8563     else
8564         AC_MSG_RESULT([yes])
8565         XRANDR_DLOPEN="FALSE"
8566         PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
8567         if test "$ENABLE_RANDR" != "TRUE"; then
8568             AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
8569                         [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
8570             XRANDR_CFLAGS=" "
8571             AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
8572               [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
8573             XRANDR_LIBS="-lXrandr "
8574             ENABLE_RANDR="TRUE"
8575         fi
8576     fi
8577 else
8578     ENABLE_RANDR=""
8579     AC_MSG_RESULT([no])
8581 AC_SUBST(XRANDR_DLOPEN)
8582 AC_SUBST(XRANDR_CFLAGS)
8583 AC_SUBST(XRANDR_LIBS)
8584 AC_SUBST(ENABLE_RANDR)
8586 dnl ===================================================================
8587 dnl Check for building neon
8588 dnl ===================================================================
8589 AC_MSG_CHECKING([whether to use neon])
8590 if test "$enable_neon" = "no"; then
8591     AC_MSG_RESULT([no])
8592     DISABLE_NEON=TRUE
8593     AC_SUBST(DISABLE_NEON)
8594 else
8595     AC_MSG_RESULT([yes])
8596 dnl ===================================================================
8597 dnl Check for system neon
8598 dnl ===================================================================
8599 libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
8600 if test "$with_system_neon" = "yes"; then
8601     NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
8602     libo_MINGW_CHECK_DLL([libneon])
8603     libo_MINGW_TRY_DLL([libtasn1])
8604     libo_MINGW_TRY_DLL([libgnutls])
8605 else
8606     NEON_VERSION=0295
8608 AC_SUBST(NEON_VERSION)
8611 dnl ===================================================================
8612 dnl Check for disabling cve_tests
8613 dnl ===================================================================
8614 AC_MSG_CHECKING([whether to execute CVE tests])
8615 if test "$enable_cve_tests" = "no"; then
8616     AC_MSG_RESULT([no])
8617     DISABLE_CVE_TESTS=TRUE
8618     AC_SUBST(DISABLE_CVE_TESTS)
8619 else
8620     AC_MSG_RESULT([yes])
8623 dnl ===================================================================
8624 dnl Check for system openssl
8625 dnl ===================================================================
8626 DISABLE_OPENSSL="NO"
8627 AC_MSG_CHECKING([whether to disable OpenSSL usage])
8628 if test "$enable_openssl" = "yes"; then
8629     AC_MSG_RESULT([no])
8630     if test "$_os" = Darwin -a "${MAC_OS_X_VERSION_MIN_REQUIRED:-0}" -ge 1070; then
8631         # OpenSSL is deprecated when building for 10.7 or later.
8632         #
8633         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
8634         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
8635         #
8636         # They apparently got fed up with the unstable ABI of
8637         # OpenSSL, or something, and recommend you either move to
8638         # their "Common Crypto Architecture", or, if you have to stay
8639         # with OpenSSL, just build it yourself statically and bundle
8640         # with your application.
8642         with_system_openssl=no
8643         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
8644     elif test "$_os" = "Darwin" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o \
8645             "$_os" = "DragonFly" && test "$with_system_openssl" != "no"; then
8646         # Mac OS builds should get out without extra stuff is the Mac porters'
8647         # wish. And pkg-config is although Xcode ships a .pc for openssl
8648         with_system_openssl=yes
8649         SYSTEM_OPENSSL=YES
8650         OPENSSL_CFLAGS=
8651         OPENSSL_LIBS="-lssl -lcrypto"
8652     else
8653         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
8654     fi
8655     if test "$with_system_openssl" = "yes"; then
8656         libo_MINGW_CHECK_DLL([libssl])
8657         libo_MINGW_CHECK_DLL([libcrypto])
8658     fi
8659 else
8660     AC_MSG_RESULT([yes])
8661     DISABLE_OPENSSL=YES
8663     # warn that although OpenSSL is disabled, system libraries may be depending on it
8664     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
8665     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
8668 AC_SUBST([DISABLE_OPENSSL])
8670 dnl ===================================================================
8671 dnl Check for building gnutls
8672 dnl ===================================================================
8673 AC_MSG_CHECKING([whether to use gnutls])
8674 if test "$enable_neon" != "no" && test "$enable_openssl" = "no"; then
8675     AC_MSG_RESULT([yes])
8676     AM_PATH_LIBGCRYPT()
8677     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
8678         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
8679                       available in the system to use as replacement.]]))
8682 AC_SUBST([LIBGCRYPT_CFLAGS])
8683 AC_SUBST([LIBGCRYPT_LIBS])
8685 dnl ===================================================================
8686 dnl Check for system redland
8687 dnl ===================================================================
8688 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
8689 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
8690 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
8691 if test "$with_system_redland" = "yes"; then
8692     libo_MINGW_CHECK_DLL([librdf])
8693     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
8694             [AC_MSG_ERROR(librdf too old. Need >= 1.16)], [])
8695     libo_MINGW_TRY_DLL([libraptor])
8696     libo_MINGW_TRY_DLL([librasqal])
8697     libo_MINGW_TRY_DLL([libsqlite3])
8698 else
8699     RAPTOR_MAJOR="0"
8700     RASQAL_MAJOR="3"
8701     REDLAND_MAJOR="0"
8703 AC_SUBST(RAPTOR_MAJOR)
8704 AC_SUBST(RASQAL_MAJOR)
8705 AC_SUBST(REDLAND_MAJOR)
8707 dnl ===================================================================
8708 dnl Check for system orcus
8709 dnl ===================================================================
8710 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.6 >= 0.5.0])
8711 if test "$with_system_orcus" != "yes"; then
8712     if test "$SYSTEM_BOOST" = "YES"; then
8713         # ===========================================================
8714         # Determine if we are going to need to link with Boost.System
8715         # ===========================================================
8716         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
8717         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
8718         dnl in documentation has no effect.
8719         AC_MSG_CHECKING([if we need to link with Boost.System])
8720         AC_LANG_PUSH([C++])
8721         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
8722                 @%:@include <boost/version.hpp>
8723             ]],[[
8724                 #if BOOST_VERSION >= 105000
8725                 #   error yes, we need to link with Boost.System
8726                 #endif
8727             ]])],[
8728                 AC_MSG_RESULT([no])
8729             ],[
8730                 AC_MSG_RESULT([yes])
8731                 AX_BOOST_SYSTEM
8732         ])
8733         AC_LANG_POP([C++])
8734     fi
8736 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
8737 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
8738 AC_SUBST([BOOST_SYSTEM_LIB])
8739 AC_SUBST(SYSTEM_LIBORCUS)
8741 dnl ===================================================================
8742 dnl Check for system hunspell
8743 dnl ===================================================================
8744 AC_MSG_CHECKING([which libhunspell to use])
8745 if test "$with_system_hunspell" = "yes"; then
8746     AC_MSG_RESULT([external])
8747     SYSTEM_HUNSPELL=YES
8748     AC_LANG_PUSH([C++])
8749     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
8750     if test "$HUNSPELL_PC" != "TRUE"; then
8751         AC_CHECK_HEADER(hunspell.hxx, [],
8752             [
8753             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
8754             [AC_MSG_ERROR(hunspell headers not found.)], [])
8755             ], [])
8756         AC_CHECK_LIB([hunspell], [main], [:],
8757            [ AC_MSG_ERROR(hunspell library not found.) ], [])
8758         HUNSPELL_LIBS=-lhunspell
8759     fi
8760     AC_LANG_POP([C++])
8761     libo_MINGW_CHECK_DLL([libhunspell-1.3])
8762     HUNSPELL_CFLAGS="`echo $HUNSPELL_CFLAGS | sed -e \"s/-I/${ISYSTEM}/g\"`"
8763 else
8764     AC_MSG_RESULT([internal])
8765     SYSTEM_HUNSPELL=NO
8766     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
8767     HUNSPELL_LIBS="-L${OUTDIR}/lib -lhunspell"
8768     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
8770 AC_SUBST(SYSTEM_HUNSPELL)
8771 AC_SUBST(HUNSPELL_CFLAGS)
8772 AC_SUBST(HUNSPELL_LIBS)
8774 dnl ===================================================================
8775 dnl Checking for altlinuxhyph
8776 dnl ===================================================================
8777 AC_MSG_CHECKING([which altlinuxhyph to use])
8778 if test "$with_system_altlinuxhyph" = "yes"; then
8779     AC_MSG_RESULT([external])
8780     SYSTEM_HYPH=YES
8781     AC_CHECK_HEADER(hyphen.h, [],
8782        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
8783     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
8784        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
8785        [#include <hyphen.h>])
8786     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
8787         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
8788     if test -z "$HYPHEN_LIB"; then
8789         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
8790            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
8791     fi
8792     if test -z "$HYPHEN_LIB"; then
8793         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
8794            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
8795     fi
8796     libo_MINGW_CHECK_DLL([libhyphen])
8797 else
8798     AC_MSG_RESULT([internal])
8799     SYSTEM_HYPH=NO
8800     BUILD_TYPE="$BUILD_TYPE HYPHEN"
8802 AC_SUBST(SYSTEM_HYPH)
8803 AC_SUBST(HYPHEN_LIB)
8805 dnl ===================================================================
8806 dnl Checking for mythes
8807 dnl ===================================================================
8808 AC_MSG_CHECKING([which mythes to use])
8809 if test "$with_system_mythes" = "yes"; then
8810     AC_MSG_RESULT([external])
8811     SYSTEM_MYTHES=YES
8812     AC_LANG_PUSH([C++])
8813     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
8814     if test "$MYTHES_PKGCONFIG" = "no"; then
8815         AC_CHECK_HEADER(mythes.hxx, [],
8816             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
8817         AC_CHECK_LIB([mythes-1.2], [main], [:],
8818             [ MYTHES_FOUND=no], [])
8819     if test "$MYTHES_FOUND" = "no"; then
8820         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
8821                 [ MYTHES_FOUND=no], [])
8822     fi
8823     if test "$MYTHES_FOUND" = "no"; then
8824         AC_MSG_ERROR([mythes library not found!.])
8825     fi
8826     fi
8827     AC_LANG_POP([C++])
8828     libo_MINGW_CHECK_DLL([libmythes-1.2])
8829 else
8830     AC_MSG_RESULT([internal])
8831     SYSTEM_MYTHES=NO
8832     BUILD_TYPE="$BUILD_TYPE MYTHES"
8834 AC_SUBST(SYSTEM_MYTHES)
8835 AC_SUBST(MYTHES_CFLAGS)
8836 AC_SUBST(MYTHES_LIBS)
8838 dnl ===================================================================
8839 dnl How should we build the linear programming solver ?
8840 dnl ===================================================================
8841 ENABLE_LPSOLVE=
8842 AC_MSG_CHECKING([whether to build with lpsolve])
8843 if test "$enable_lpsolve" != "no"; then
8844     ENABLE_LPSOLVE=TRUE
8845     AC_MSG_RESULT([yes])
8846 else
8847     AC_MSG_RESULT([no])
8849 AC_SUBST(ENABLE_LPSOLVE)
8851 AC_MSG_CHECKING([which lpsolve to use])
8852 if test "$with_system_lpsolve" = "yes"; then
8853     AC_MSG_RESULT([external])
8854     SYSTEM_LPSOLVE=YES
8855     AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
8856        [ AC_MSG_ERROR(lpsolve headers not found.)], [])
8857     save_LIBS=$LIBS
8858     # some systems need this. Like Ubuntu....
8859     AC_CHECK_LIB(m, floor)
8860     AC_CHECK_LIB(dl, dlopen)
8861     AC_CHECK_LIB([lpsolve55], [make_lp], [:],
8862         [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
8863     LIBS=$save_LIBS
8864     libo_MINGW_CHECK_DLL([lpsolve55])
8865 else
8866     AC_MSG_RESULT([internal])
8867     SYSTEM_LPSOLVE=NO
8868     BUILD_TYPE="$BUILD_TYPE LPSOLVE"
8870 AC_SUBST(SYSTEM_LPSOLVE)
8874 dnl ===================================================================
8875 dnl Checking for libexttextcat
8876 dnl ===================================================================
8877 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.1.1])
8878 if test "$with_system_libexttextcat" = "yes"; then
8879     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
8881 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
8883 dnl ***************************************
8884 dnl testing libc version for Linux...
8885 dnl ***************************************
8886 if test "$_os" = "Linux"; then
8887     AC_MSG_CHECKING([whether libc is >= 2.1.1])
8888     exec 6>/dev/null # no output
8889     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
8890     exec 6>&1 # output on again
8891     if test "$HAVE_LIBC"; then
8892         AC_MSG_RESULT([yes])
8893     else
8894         AC_MSG_ERROR([no, upgrade libc])
8895     fi
8898 if test "$_os" != "WINNT"; then
8899     AC_CHECK_FUNCS(getopt, HAVE_GETOPT=YES, [HAVE_GETOPT=NO])
8900     AC_CHECK_FUNCS(readdir_r, HAVE_READDIR_R=YES, [HAVE_READDIR_R=NO])
8901     if test "$HAVE_GETOPT" = "YES" -a "$HAVE_READDIR_R" = "YES"; then
8902         SYSTEM_LIBC=YES
8903     fi
8904 else
8905     HAVE_GETOPT=NO
8906     HAVE_READDIR_R=NO
8907     SYSTEM_LIBC=YES
8910 if test "$HAVE_GETOPT" = NO -o "$HAVE_READDIR_R" = NO; then
8911     BUILD_TYPE="$BUILD_TYPE GLIBC"
8914 AC_SUBST(HAVE_GETOPT)
8915 AC_SUBST(HAVE_READDIR_R)
8916 AC_SUBST(SYSTEM_LIBC)
8918 dnl =========================================
8919 dnl Check for the Windows  SDK.
8920 dnl =========================================
8921 dnl FIXME: I don't know yet if the Windows SDK works with MinGW, keep it until I know better,
8922 dnl and add "-a \( "$WITH_MINGW" != "yes" \)" then
8923 if test "$_os" = "WINNT"; then
8924     AC_MSG_CHECKING([for Windows SDK])
8925     if test "$build_os" = "cygwin"; then
8926         find_winsdk
8927         WINDOWS_SDK_HOME=$winsdktest
8929         # normalize if found
8930         if test -n "$WINDOWS_SDK_HOME"; then
8931             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
8932             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
8933         fi
8934     fi
8936     if test -n "$WINDOWS_SDK_HOME"; then
8937         # Remove a possible trailing backslash
8938         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
8940         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
8941              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
8942              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
8943             have_windows_sdk_headers=yes
8944         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
8945              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
8946              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
8947             have_windows_sdk_headers=yes
8948         else
8949             have_windows_sdk_headers=no
8950         fi
8952         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
8953             have_windows_sdk_libs=yes
8954         elif test -f "$WINDOWS_SDK_HOME/lib/win8/um/$WINDOWS_SDK_ARCH/user32.lib"; then
8955             have_windows_sdk_libs=yes
8956         else
8957             have_windows_sdk_libs=no
8958         fi
8960         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
8961             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
8962 the  Windows SDK are installed.])
8963         fi
8965         if test ! -f "$WINDOWS_SDK_HOME/bin/msiinfo.exe" \
8966              -o ! -f "$WINDOWS_SDK_HOME/bin/msidb.exe" \
8967              -o ! -f "$WINDOWS_SDK_HOME/bin/uuidgen.exe" \
8968              -o ! -f "$WINDOWS_SDK_HOME/bin/msitran.exe"; then :
8969         elif test ! -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
8970              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
8971              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/uuidgen.exe" \
8972              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
8973         else
8974             AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
8975         fi
8976     fi
8978     if test -z "$WINDOWS_SDK_HOME"; then
8979         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
8980     elif echo $WINDOWS_SDK_HOME | grep "v6.0" >/dev/null 2>/dev/null; then
8981         WINDOWS_SDK_VERSION=60
8982         AC_MSG_RESULT([found Windows SDK 6.0 ($WINDOWS_SDK_HOME)])
8983     elif echo $WINDOWS_SDK_HOME | grep "v6.1" >/dev/null 2>/dev/null; then
8984         WINDOWS_SDK_VERSION=61
8985         AC_MSG_RESULT([found Windows SDK 6.1 ($WINDOWS_SDK_HOME)])
8986     elif echo $WINDOWS_SDK_HOME | grep "v7" >/dev/null 2>/dev/null; then
8987         WINDOWS_SDK_VERSION=70
8988         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
8989     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
8990         WINDOWS_SDK_VERSION=80
8991         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
8992         # compatibility warning if usind VS 2012 and not explicitly choosing the 80 SDK
8993         if test "$VCVER" = "110" -a -z "$with_windows_sdk"; then
8994             AC_MSG_WARN([If a build created with VS 2012 should run on Windows XP,])
8995             AC_MSG_WARN([use --with-windows-sdk=7.1A (requires VS 2012 Update 1 or newer)])
8996             add_warning "If a build created with VS 2012 should run on Windows XP,"
8997             add_warning "use --with-windows-sdk=7.1A (requires VS 2012 Update 1 or newer)"
8998         fi
8999     else
9000         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
9001     fi
9002     PathFormat "$WINDOWS_SDK_HOME"
9003     WINDOWS_SDK_HOME="$formatted_path"
9004     if test "$build_os" = "cygwin"; then
9005         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/include"
9006         if test -d "$WINDOWS_SDK_HOME/include/um"; then
9007             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
9008         fi
9009     fi
9011 AC_SUBST(WINDOWS_SDK_HOME)
9012 AC_SUBST(WINDOWS_SDK_VERSION)
9014 dnl =========================================
9015 dnl Check for uuidgen
9016 dnl =========================================
9017 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9018     if test "$WITH_MINGW" = "yes"; then
9019         AC_PATH_PROG([UUIDGEN], [uuid])
9020         if test -z "$UUIDGEN"; then
9021             AC_MSG_WARN([uuid is needed for dev-install])
9022         fi
9023     else
9024         # presence is already tested above in the WINDOWS_SDK_HOME check
9025         UUIDGEN=uuidgen.exe
9026         AC_SUBST(UUIDGEN)
9027     fi
9028 else
9029     AC_PATH_PROG([UUIDGEN], [uuidgen])
9030     if test -z "$UUIDGEN"; then
9031         AC_MSG_WARN([uuid is needed for dev-install])
9032     fi
9035 dnl =========================================
9036 dnl Check for the Microsoft DirectX SDK.
9037 dnl =========================================
9038 if test -n "$ENABLE_DIRECTX" -a "$_os" = "WINNT"; then
9039     AC_MSG_CHECKING([for DirectX SDK])
9040     if test "$build_os" = "cygwin"; then
9041         dnl A standard installation of the DirectX SDK sets $DXSDK_DIR
9042         if test -n "$DXSDK_DIR"; then
9043             DIRECTXSDK_HOME=`cygpath -d "$DXSDK_DIR"`
9044             DIRECTXSDK_HOME=`cygpath -u "$DIRECTXSDK_HOME"`
9045         fi
9046         # At this point $DIRECTXSDK_HOME might still be undefined. This will lead to
9047         # the "DirectX SDK not found" error later.
9048         # (Where?)
9050         # Remove a possible trailing backslash
9051         DIRECTXSDK_HOME=`echo $DIRECTXSDK_HOME | $SED 's/\/$//'`
9052     fi
9054     if test -f "$DIRECTXSDK_HOME/Include/ddraw.h" -o -f "$DIRECTXSDK_HOME/Include/d3d9.h"; then
9055         HAVE_DIRECTXSDK_H="yes"
9056     else
9057         HAVE_DIRECTXSDK_H="no"
9058     fi
9060     if test "$BITNESS_OVERRIDE" = 64; then
9061         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x64"
9062     else
9063         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x86"
9064     fi
9065     PathFormat "$DIRECTXSDK_LIB"
9066     DIRECTXSDK_LIB="$formatted_path"
9068     if test -f "$DIRECTXSDK_LIB/ddraw.lib" -o -f "$DIRECTXSDK_LIB/d3d9.lib"; then
9069         HAVE_DIRECTXSDK_LIB="yes"
9070     else
9071         HAVE_DIRECTXSDK_LIB="no"
9072     fi
9074     if test "$HAVE_DIRECTXSDK_H" = "yes" -a "$HAVE_DIRECTXSDK_LIB" = "yes"; then
9075         AC_MSG_RESULT([found])
9076     else
9077         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway])
9078     fi
9079     if test -n "$DIRECTXSDK_HOME"; then
9080         PathFormat "$DIRECTXSDK_HOME"
9081         DIRECTXSDK_HOME="$formatted_path"
9082         SOLARINC="$SOLARINC -I$DIRECTXSDK_HOME/include"
9083     fi
9085 AC_SUBST(DIRECTXSDK_HOME)
9087 dnl ***************************************
9088 dnl Checking for bison and flex
9089 dnl ***************************************
9090 AC_PATH_PROG(BISON, bison)
9091 ANCIENT_BISON="NO"
9092 if test -z "$BISON"; then
9093     AC_MSG_ERROR([no bison found in \$PATH, install it])
9094 else
9095     AC_MSG_CHECKING([the bison version])
9096     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9097     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9098     # Accept newer than 1.875 or older(equal) than 1.75
9099     if test "$_bison_longver" -ge 1875 -o "$_bison_longver" -le 1075; then
9100         if test "$_bison_version" = "1.875"; then
9101             AC_MSG_WARN([suspect ($BISON $_bison_version)])
9102             add_warning "Suspect ($BISON $_bison_version) suggest upgrade"
9103         else
9104             AC_MSG_RESULT([checked ($BISON $_bison_version)])
9105         fi
9106     else
9107         AC_MSG_ERROR([failed ($BISON $_bison_version need 1.875+ (or 1.75 and older))])
9108     fi
9109     if test "$_bison_longver" -lt 2000; then
9110         ANCIENT_BISON="YES"
9111     fi
9113 AC_SUBST(ANCIENT_BISON)
9115 AC_PATH_PROG(FLEX, flex)
9116 if test -z "$FLEX"; then
9117     AC_MSG_ERROR([no flex found in \$PATH, install it])
9119 AC_SUBST([FLEX])
9120 dnl ***************************************
9121 dnl Checking for patch
9122 dnl ***************************************
9123 AC_PATH_PROG(PATCH, patch)
9124 if test -z "$PATCH"; then
9125     AC_MSG_ERROR([\"patch\" not found in \$PATH, install it])
9128 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9129 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9130     if test -z "$with_gnu_patch"; then
9131         GNUPATCH=$PATCH
9132     else
9133         if test -x "$with_gnu_patch"; then
9134             GNUPATCH=$with_gnu_patch
9135         else
9136             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9137         fi
9138     fi
9140     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9141     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9142         AC_MSG_RESULT([yes])
9143     else
9144         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9145     fi
9146 else
9147     GNUPATCH=$PATCH
9150 dnl We also need to check for --with-gnu-cp
9152 if test -z "$with_gnu_cp"; then
9153     # check the place where the good stuff is hidden on Solaris...
9154     if test -x /usr/gnu/bin/cp; then
9155         GNUCP=/usr/gnu/bin/cp
9156     else
9157         AC_PATH_PROGS(GNUCP, gnucp cp)
9158     fi
9159     if test -z $GNUCP; then
9160         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9161     fi
9162 else
9163     if test -x "$with_gnu_cp"; then
9164         GNUCP=$with_gnu_cp
9165     else
9166         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9167     fi
9170 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9171 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9172     AC_MSG_RESULT([yes])
9173 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9174     AC_MSG_RESULT([yes])
9175 else
9176     case "$build_os" in
9177     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9178         x_GNUCP=[\#]
9179         GNUCP=''
9180         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9181         ;;
9182     *)
9183         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9184         ;;
9185     esac
9188 AC_SUBST(GNUPATCH)
9189 AC_SUBST(GNUCP)
9190 AC_SUBST(x_GNUCP)
9192 dnl ***************************************
9193 dnl testing assembler path
9194 dnl ***************************************
9195 ML_EXE=""
9196 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
9197     if test "$BITNESS_OVERRIDE" = ""; then
9198         assembler=ml.exe
9199         assembler_bin=bin
9200     else
9201         assembler=ml64.exe
9202         assembler_bin=bin/amd64
9203     fi
9205     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9206     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9207         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9208         AC_MSG_RESULT([found])
9209         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9210     else
9211         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9212     fi
9214     PathFormat "$ASM_HOME"
9215     ASM_HOME="$formatted_path"
9216 else
9217     ASM_HOME=""
9220 AC_SUBST(ML_EXE)
9222 dnl ===================================================================
9223 dnl We need zip and unzip
9224 dnl ===================================================================
9225 AC_PATH_PROG(ZIP, zip)
9226 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9227 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9228     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],,)
9231 AC_PATH_PROG(UNZIP, unzip)
9232 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9234 dnl ===================================================================
9235 dnl Zip must be a specific type for different build types.
9236 dnl ===================================================================
9237 if test $build_os = cygwin; then
9238     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9239         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9240     fi
9243 dnl ===================================================================
9244 dnl Test which vclplugs have to be built.
9245 dnl ===================================================================
9246 R=""
9247 GTK3_CFLAGS=""
9248 GTK3_LIBS=""
9249 ENABLE_GTK3=""
9250 if test "x$enable_gtk3" = "xyes"; then
9251     if test "$with_system_cairo" != yes; then
9252         AC_MSG_WARN([System cairo required for gtk3 support, please use --with-system-cairo])
9253         add_warning "System cairo required for gtk3 support, please use --with-system-cairo"
9254     fi
9255     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="")
9256     if test "x$ENABLE_GTK3" = "xTRUE"; then
9257         R="gtk3"
9258     else
9259         AC_MSG_ERROR([gtk3 libraries of the correct versions, not found])
9260     fi
9262 AC_SUBST(GTK3_LIBS)
9263 AC_SUBST(GTK3_CFLAGS)
9264 AC_SUBST(ENABLE_GTK3)
9266 AC_MSG_CHECKING([which VCLplugs shall be built])
9267 if test "$GUIBASE" != "unx" -o "$enable_headless" = "yes"; then
9268     enable_gtk=no
9270 ENABLE_GTK=""
9271 if test "x$enable_gtk" = "xyes"; then
9272     ENABLE_GTK="TRUE"
9273     AC_DEFINE(ENABLE_GTK)
9274     R="gtk $R"
9276 AC_SUBST(ENABLE_GTK)
9278 ENABLE_TDE=""
9279 if test "x$enable_tde" = "xyes"; then
9280     # Libs kab and tdeab in connectivity and kdeab and tdeab in shell
9281     # are built from the same sources. So we only allow one of them.
9282     if test "x$enable_kde" = "xyes"; then
9283         AC_MSG_ERROR([enabling both KDE and TDE is not supported])
9284     fi
9285     ENABLE_TDE="TRUE"
9286     AC_DEFINE(ENABLE_TDE)
9287     R="$R tde"
9289 AC_SUBST(ENABLE_TDE)
9291 ENABLE_KDE=""
9292 if test "x$enable_kde" = "xyes"; then
9293     ENABLE_KDE="TRUE"
9294     AC_DEFINE(ENABLE_KDE)
9295     R="$R kde"
9297 AC_SUBST(ENABLE_KDE)
9299 ENABLE_KDE4=""
9300 if test "x$enable_kde4" = "xyes"; then
9301     ENABLE_KDE4="TRUE"
9302     AC_DEFINE(ENABLE_KDE4)
9303     R="$R kde4"
9305 AC_SUBST(ENABLE_KDE4)
9307 ENABLE_HEADLESS=""
9308 if test "x$enable_headless" = "xyes"; then
9309     ENABLE_HEADLESS="TRUE"
9310     SCPDEFS="$SCPDEFS -DLIBO_HEADLESS"
9311     R="headless"
9313 AC_SUBST(ENABLE_HEADLESS)
9315 if test -z "$R"; then
9316     AC_MSG_RESULT([none])
9317 else
9318     AC_MSG_RESULT([$R])
9321 dnl ===================================================================
9322 dnl GCONF check
9323 dnl ===================================================================
9325 ENABLE_GCONF=""
9326 AC_MSG_CHECKING([whether to enable GConf support])
9327 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "iOS" -a "$enable_gconf" = "yes"; then
9328     ENABLE_GCONF="TRUE"
9329     AC_MSG_RESULT([yes])
9330     PKG_CHECK_MODULES( GCONF, gconf-2.0 gobject-2.0 )
9331 else
9332     AC_MSG_RESULT([no])
9334 AC_SUBST(GCONF_LIBS)
9335 AC_SUBST(GCONF_CFLAGS)
9336 AC_SUBST(ENABLE_GCONF)
9338 dnl ===================================================================
9339 dnl Gnome VFS check
9340 dnl ===================================================================
9342 ENABLE_GNOMEVFS=""
9343 AC_MSG_CHECKING([whether to enable GNOME VFS support])
9344 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes" -a "$enable_gconf" = "yes"; then
9345     ENABLE_GNOMEVFS="TRUE"
9346     AC_MSG_RESULT([yes])
9347     PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
9348     AC_DEFINE(ENABLE_GNOME_VFS)
9349 else
9350     AC_MSG_RESULT([no])
9352 AC_SUBST(GNOMEVFS_LIBS)
9353 AC_SUBST(GNOMEVFS_CFLAGS)
9354 AC_SUBST(ENABLE_GNOMEVFS)
9356 dnl ===================================================================
9357 dnl check for dbus support
9358 dnl ===================================================================
9359 ENABLE_DBUS=""
9360 DBUS_CFLAGS=""
9361 DBUS_LIBS=""
9363 if test "$enable_dbus" = "no"; then
9364     test_dbus=no
9367 AC_MSG_CHECKING([whether to enable DBUS support])
9368 if test "$test_dbus" = "yes"; then
9369     ENABLE_DBUS="TRUE"
9370     AC_MSG_RESULT([yes])
9371     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
9372 else
9373     AC_MSG_RESULT([no])
9376 AC_SUBST(ENABLE_DBUS)
9377 AC_SUBST(DBUS_CFLAGS)
9378 AC_SUBST(DBUS_LIBS)
9380 AC_MSG_CHECKING([whether to enable font install via packagekit])
9381 if test "$ENABLE_DBUS" = "TRUE"; then
9382     if test -n "$enable_packagekit" -a "$enable_packagekit" != "no"; then
9383         ENABLE_PACKAGEKIT=YES
9384         AC_MSG_RESULT([yes])
9385     else
9386         ENABLE_PACKAGEKIT=NO
9387         AC_MSG_RESULT([no])
9388     fi
9389 else
9390     AC_MSG_RESULT([no, dbus disabled.])
9392 AC_SUBST(ENABLE_PACKAGEKIT)
9394 AC_MSG_CHECKING([whether to enable Impress remote control])
9395 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
9396     AC_MSG_RESULT([yes])
9397     ENABLE_SDREMOTE=YES
9398     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
9400     # If not explicitly enabled or disabled, default
9401     if test -z "$enable_sdremote_bluetooth"; then
9402         case "$OS" in
9403         LINUX|MACOSX|WNT)
9404             # Default to yes for these
9405             enable_sdremote_bluetooth=yes
9406             ;;
9407         *)
9408             # otherwise no
9409             enable_sdremote_bluetooth=no
9410             ;;
9411         esac
9412     fi
9413     # $enable_sdremote_bluetooth is guaranteed non-empty now
9415     if test "$enable_sdremote_bluetooth" != "no"; then
9416         if test "$OS" = "LINUX"; then
9417             if test "$ENABLE_DBUS" = "TRUE"; then
9418                 AC_MSG_RESULT([yes])
9419                 ENABLE_SDREMOTE_BLUETOOTH=YES
9420                 dnl ===================================================================
9421                 dnl Check for system bluez
9422                 dnl ===================================================================
9423                 AC_MSG_CHECKING([which Bluetooth header to use])
9424                 if test "$with_system_bluez" = "yes"; then
9425                     AC_MSG_RESULT([external])
9426                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
9427                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
9428                 else
9429                     AC_MSG_RESULT([internal])
9430                     BUILD_TYPE="$BUILD_TYPE BLUEZ"
9431                 fi
9432             else
9433                 AC_MSG_RESULT([no, dbus disabled])
9434                 ENABLE_SDREMOTE_BLUETOOTH=NO
9435             fi
9436         else
9437             AC_MSG_RESULT([yes])
9438             ENABLE_SDREMOTE_BLUETOOTH=YES
9439         fi
9440     else
9441         AC_MSG_RESULT([no])
9442         ENABLE_SDREMOTE_BLUETOOTH=NO
9443     fi
9444 else
9445     ENABLE_SDREMOTE=NO
9446     AC_MSG_RESULT([no])
9448 AC_SUBST(ENABLE_SDREMOTE)
9449 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
9451 dnl ===================================================================
9452 dnl Check whether the gtk 2.0 libraries are available.
9453 dnl ===================================================================
9455 GTK_CFLAGS=""
9456 GTK_LIBS=""
9457 ENABLE_SYSTRAY_GTK=""
9458 if test  "$test_gtk" = "yes"; then
9460     if test "$ENABLE_GTK" = "TRUE"; then
9461         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]))
9462         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]))
9463         BUILD_TYPE="$BUILD_TYPE GTK"
9465     AC_MSG_CHECKING([whether to enable the systray quickstarter])
9466         if test "x$enable_systray" = "xyes"; then
9467         AC_MSG_RESULT([yes])
9468             PKG_CHECK_MODULES( GTK210, gtk+-2.0 >= 2.10.0,
9469                             [ ENABLE_SYSTRAY_GTK="TRUE" ],
9470                             [ ENABLE_SYSTRAY_GTK="" ])
9471         else
9472         AC_MSG_RESULT([no])
9473         fi
9475         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
9476         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
9477                           [ENABLE_GTK_PRINT="TRUE"],
9478                           [ENABLE_GTK_PRINT=""])
9480         AC_MSG_CHECKING([whether to enable GIO support])
9481         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
9482             if test "$ENABLE_GNOMEVFS" = "TRUE"; then
9483                 AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
9484             fi
9485             dnl Need at least 2.26 for the dbus support.
9486             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
9487                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
9488             if test "$ENABLE_GIO" = "TRUE"; then
9489                 AC_DEFINE(ENABLE_GIO)
9490             fi
9491         else
9492             AC_MSG_RESULT([no])
9493         fi
9494     fi
9496 AC_SUBST(ENABLE_GIO)
9497 AC_SUBST(GIO_CFLAGS)
9498 AC_SUBST(GIO_LIBS)
9499 AC_SUBST(ENABLE_SYSTRAY_GTK)
9500 AC_SUBST(GTK_CFLAGS)
9501 AC_SUBST(GTK_LIBS)
9502 AC_SUBST(GTHREAD_CFLAGS)
9503 AC_SUBST(GTHREAD_LIBS)
9504 AC_SUBST([ENABLE_GTK_PRINT])
9505 AC_SUBST([GTK_PRINT_CFLAGS])
9506 AC_SUBST([GTK_PRINT_LIBS])
9509 dnl ===================================================================
9510 dnl Check whether the Telepathy libraries are available.
9511 dnl ===================================================================
9513 ENABLE_TELEPATHY=""
9514 TELEPATHY_CFLAGS=""
9515 TELEPATHY_LIBS=""
9517 AC_MSG_CHECKING([whether to enable Telepathy support])
9518 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_telepathy" = "yes"; then
9519     ENABLE_TELEPATHY="TRUE"
9520     AC_DEFINE(ENABLE_TELEPATHY)
9521     AC_MSG_RESULT([yes])
9522     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 )
9523 else
9524     AC_MSG_RESULT([no])
9527 AC_SUBST(ENABLE_TELEPATHY)
9528 AC_SUBST(TELEPATHY_CFLAGS)
9529 AC_SUBST(TELEPATHY_LIBS)
9532 dnl ===================================================================
9534 SPLIT_APP_MODULES=""
9535 if test "$enable_split_app_modules" = "yes"; then
9536     SPLIT_APP_MODULES="YES"
9538 AC_SUBST(SPLIT_APP_MODULES)
9540 SPLIT_OPT_FEATURES=""
9541 if test "$enable_split_opt_features" = "yes"; then
9542     SPLIT_OPT_FEATURES="YES"
9544 AC_SUBST(SPLIT_OPT_FEATURES)
9546 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
9547     if test "$enable_cairo_canvas" = yes; then
9548         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
9549     fi
9550     enable_cairo_canvas=no
9551 elif test -z "$enable_cairo_canvas"; then
9552     enable_cairo_canvas=yes
9555 ENABLE_CAIRO_CANVAS=""
9556 if test "$enable_cairo_canvas" = "yes"; then
9557     test_cairo=yes
9558     ENABLE_CAIRO_CANVAS="TRUE"
9560 AC_SUBST(ENABLE_CAIRO_CANVAS)
9562 dnl ===================================================================
9563 dnl Check whether the GStreamer libraries are available.
9564 dnl ===================================================================
9566 ENABLE_GSTREAMER=""
9568 if test "$build_gstreamer" = "yes"; then
9570     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
9571     if test "x$enable_gstreamer" != "xno"; then
9572         ENABLE_GSTREAMER="TRUE"
9573         AC_MSG_RESULT([yes])
9574         PKG_CHECK_MODULES( GSTREAMER, gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-video-1.0 )
9575         GSTREAMER_CFLAGS="`echo $GSTREAMER_CFLAGS | sed -e \"s/-I/${ISYSTEM}/g\"`"
9576     else
9577         AC_MSG_RESULT([no])
9578     fi
9580 AC_SUBST(GSTREAMER_CFLAGS)
9581 AC_SUBST(GSTREAMER_LIBS)
9582 AC_SUBST(ENABLE_GSTREAMER)
9585 ENABLE_GSTREAMER_0_10=""
9586 if test "$build_gstreamer_0_10" = "yes"; then
9588     AC_MSG_CHECKING([whether to enable the GStreamer avmedia backend])
9589     if test "x$enable_gstreamer_0_10" != "xno"; then
9590         ENABLE_GSTREAMER_0_10="TRUE"
9591         AC_MSG_RESULT([yes])
9592         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-interfaces-0.10],, [
9593             PKG_CHECK_MODULES(  [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10] )
9594         ])
9595         GSTREAMER_0_10_CFLAGS="`echo $GSTREAMER_0_10_CFLAGS | sed -e \"s/-I/${ISYSTEM}/g\"`"
9596     else
9597         AC_MSG_RESULT([no])
9598     fi
9601 AC_SUBST(GSTREAMER_0_10_CFLAGS)
9602 AC_SUBST(GSTREAMER_0_10_LIBS)
9603 AC_SUBST(ENABLE_GSTREAMER_0_10)
9605 dnl ===================================================================
9606 dnl Check whether the OpenGL libraries are available
9607 dnl ===================================================================
9609 AC_MSG_CHECKING([whether to build the OpenGL Transitions component])
9610 ENABLE_OPENGL=
9612 if test -z "$enable_opengl"; then
9613     if test $_os = WINNT; then
9614         # By default disable the OpenGL transitions for Windows (the code compiles but works very
9615         # badly and crashes). In other words, use --enable-opengl only if you plan to hack on that
9616         # code for Windows.
9617         enable_opengl=no
9618     elif test $_os = iOS; then
9619         # As such with some suitable minor tweaks the Mac OpenGL transitions code would presumably
9620         # build fine for iOS, too, but let's leave that for later
9621         enable_opengl=no
9622     elif test "$enable_headless" = "yes"; then
9623         enable_opengl=no
9624     else
9625         enable_opengl=yes
9626     fi
9629 if test "x$enable_opengl" = "xno"; then
9630     AC_MSG_RESULT([no])
9631 elif test "$_os" = "Darwin"; then
9632     # We use frameworks on Mac OS X, no need for detail checks
9633     ENABLE_OPENGL=TRUE
9634     SYSTEM_MESA_HEADERS=YES
9635     AC_MSG_RESULT([yes])
9636 elif test $_os = WINNT; then
9637     # Experimental: try to use OpenGL on Windows
9638     ENABLE_OPENGL=TRUE
9639     # We need the internal "Mesa" headers.
9640     SYSTEM_MESA_HEADERS=NO
9641     BUILD_TYPE="$BUILD_TYPE MESA"
9642     AC_MSG_RESULT([yes])
9643 else
9644     save_LDFLAGS=$LDFLAGS
9645     LDFLAGS="$LDFLAGS -lm"
9646     AC_MSG_RESULT([yes])
9647     AC_CHECK_LIB([GL], [main], [:],
9648               [AC_MSG_ERROR(libGL not installed or functional)], [])
9649     LDFLAGS="$LDFLAGS -lGL"
9650     AC_CHECK_LIB([GLU], [main], [:],
9651               [AC_MSG_ERROR(libGLU not installed or functional)], [])
9652     ENABLE_OPENGL=TRUE
9653     LDFLAGS=$save_LDFLAGS
9655     dnl ===================================================================
9656     dnl Check for system Mesa
9657     dnl ===================================================================
9658     AC_MSG_CHECKING([which Mesa headers to use])
9659     if test "$with_system_mesa_headers" = "yes"; then
9660         AC_MSG_RESULT([external])
9661         SYSTEM_MESA_HEADERS=YES
9662         AC_LANG_PUSH(C)
9663         AC_CHECK_HEADER(GL/glxext.h, [],
9664            [ AC_MSG_ERROR(mesa headers not found.)], [#include <GL/glx.h>])
9665         AC_MSG_CHECKING([whether GL/glxext.h defines PFNGLXBINDTEXIMAGEEXTPROC])
9666         AC_EGREP_HEADER(PFNGLXBINDTEXIMAGEEXTPROC, GL/glxext.h, [AC_MSG_RESULT([yes])], AC_MSG_ERROR(no))
9667         AC_LANG_POP(C)
9668     else
9669         AC_MSG_RESULT([internal])
9670         SYSTEM_MESA_HEADERS=NO
9671         BUILD_TYPE="$BUILD_TYPE MESA"
9672     fi
9675 AC_SUBST(SYSTEM_MESA_HEADERS)
9676 AC_SUBST(ENABLE_OPENGL)
9678 # presenter minimizer extension?
9679 AC_MSG_CHECKING([whether to build the Presentation Minimizer extension])
9680 if test "x$enable_ext_presenter_minimizer" != "xno" -a "x$enable_extension_integration" != "xno"; then
9681    AC_MSG_RESULT([yes])
9682    ENABLE_MINIMIZER=YES
9683 else
9684    AC_MSG_RESULT([no])
9685    ENABLE_MINIMIZER=NO
9686    SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MINIMIZER"
9688 AC_SUBST(ENABLE_MINIMIZER)
9690 # pdf import?
9691 AC_MSG_CHECKING([whether to build the PDF import])
9692 if test "$_os" != Android -a "$_os" != iOS -a "$ENABLE_PDFIMPORT" != FALSE; then
9693   AC_MSG_RESULT([yes])
9694   ENABLE_PDFIMPORT=TRUE
9696   dnl ===================================================================
9697   dnl Check for system poppler
9698   dnl ===================================================================
9699   AC_MSG_CHECKING([which pdf backend to use])
9700   if test "$with_system_poppler" = "yes"; then
9701       AC_MSG_RESULT([external])
9702       SYSTEM_POPPLER=YES
9703       PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
9704       AC_LANG_PUSH([C++])
9705       save_CXXFLAGS=$CXXFLAGS
9706       save_CPPFLAGS=$CPPFLAGS
9707       CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
9708       CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
9709       AC_CHECK_HEADER([cpp/poppler-version.h], [],
9710                    [AC_MSG_ERROR([cpp/poppler-version.h not found. Install poppler])], [])
9711       CXXFLAGS=$save_CXXFLAGS
9712       CPPFLAGS=$save_CPPFLAGS
9713       AC_LANG_POP([C++])
9714       libo_MINGW_CHECK_DLL([libpoppler])
9715   else
9716       AC_MSG_RESULT([internal])
9717       SYSTEM_POPPLER=NO
9718       BUILD_TYPE="$BUILD_TYPE XPDF"
9719   fi
9720 else
9721   AC_MSG_RESULT([no])
9722   ENABLE_PDFIMPORT=FALSE
9724 AC_SUBST(ENABLE_PDFIMPORT)
9725 AC_SUBST(SYSTEM_POPPLER)
9726 AC_SUBST(POPPLER_CFLAGS)
9727 AC_SUBST(POPPLER_LIBS)
9729 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
9730 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
9731   AC_MSG_RESULT([yes])
9732   ENABLE_MEDIAWIKI=YES
9733   BUILD_TYPE="$BUILD_TYPE XSLTML"
9734   if test  "x$with_java" = "xno"; then
9735     AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
9736   fi
9737 else
9738   AC_MSG_RESULT([no])
9739   ENABLE_MEDIAWIKI=NO
9740   SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
9742 AC_SUBST(ENABLE_MEDIAWIKI)
9744 if test "$ENABLE_MEDIAWIKI" = "YES"; then
9745     AC_MSG_CHECKING([which Servlet API Jar to use])
9746     if test "$with_system_servlet_api" = "yes"; then
9747         AC_MSG_RESULT([external])
9748         SYSTEM_SERVLETAPI=YES
9749         if test -z "$SERVLETAPI_JAR"; then
9750             for version in '' -3.3 -3.2 -3.1 -3.0 -2.5 -2.4; do
9751                 if test -r "/usr/share/java/servlet-api${version}.jar"; then
9752                     SERVLETAPI_JAR=/usr/share/java/servlet-api${version}.jar
9753                 fi
9754             done
9755         fi
9756         AC_CHECK_FILE($SERVLETAPI_JAR, [],
9757               [AC_MSG_ERROR(servlet-api.jar not found.)], [])
9758     else
9759         AC_MSG_RESULT([internal])
9760         SYSTEM_SERVLETAPI=NO
9761         BUILD_TYPE="$BUILD_TYPE TOMCAT"
9762     fi
9764 AC_SUBST(SYSTEM_SERVLETAPI)
9765 AC_SUBST(SERVLETAPI_JAR)
9767 AC_MSG_CHECKING([whether to build the Report Builder extension])
9768 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
9769     AC_MSG_RESULT([yes])
9770     ENABLE_REPORTBUILDER=TRUE
9771     AC_MSG_CHECKING([which jfreereport libs to use])
9772     if test "$with_system_jfreereport" = "yes"; then
9773         SYSTEM_JFREEREPORT=YES
9774         AC_MSG_RESULT([external])
9775         if test -z $SAC_JAR; then
9776             SAC_JAR=/usr/share/java/sac.jar
9777         fi
9778         AC_CHECK_FILE($SAC_JAR, [],
9779              [AC_MSG_ERROR(sac.jar not found.)], [])
9781         if test -z $LIBXML_JAR; then
9782             AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
9783                 [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
9784                 [
9785                     AC_CHECK_FILE(/usr/share/java/libxml.jar,
9786                        [ LIBXML_JAR=/usr/share/java/libxml.jar ],
9787                        [AC_MSG_ERROR(libxml.jar replacement not found.)]
9788                     )
9789                 ]
9790             )
9791         else
9792             AC_CHECK_FILE($LIBXML_JAR, [],
9793                  [AC_MSG_ERROR(libxml.jar not found.)], [])
9794         fi
9796         if test -z $FLUTE_JAR; then
9797             AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
9798                 [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
9799                 [
9800                     AC_CHECK_FILE(/usr/share/java/flute.jar,
9801                         [ FLUTE_JAR=/usr/share/java/flute.jar ],
9802                         [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
9803                     )
9804                 ]
9805             )
9806         else
9807             AC_CHECK_FILE($FLUTE_JAR, [],
9808                  [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
9809         fi
9811         if test -z $JFREEREPORT_JAR; then
9812             AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
9813                 [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
9814                 [
9815                     AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
9816                         [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
9817                         [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
9818                     )
9819                 ]
9820             )
9821         else
9822             AC_CHECK_FILE($JFREEREPORT_JAR, [],
9823                  [AC_MSG_ERROR(jfreereport.jar not found.)], [])
9824         fi
9826         if test -z $LIBLAYOUT_JAR; then
9827             AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
9828                 [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
9829                 [
9830                     AC_CHECK_FILE(/usr/share/java/liblayout.jar,
9831                         [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
9832                         [AC_MSG_ERROR(liblayout.jar replacement not found.)]
9833                     )
9834                 ]
9835             )
9836         else
9837             AC_CHECK_FILE($LIBLAYOUT_JAR, [],
9838                  [AC_MSG_ERROR(liblayout.jar not found.)], [])
9839         fi
9841         if test -z $LIBLOADER_JAR; then
9842             AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
9843                 [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
9844                 [
9845                     AC_CHECK_FILE(/usr/share/java/libloader.jar,
9846                        [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
9847                        [AC_MSG_ERROR(libloader.jar replacement not found.)]
9848                     )
9849                 ]
9850             )
9851         else
9852             AC_CHECK_FILE($LIBLOADER_JAR, [],
9853                 [AC_MSG_ERROR(libloader.jar not found.)], [])
9854         fi
9856         if test -z $LIBFORMULA_JAR; then
9857             AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
9858                  [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
9859                  [
9860                      AC_CHECK_FILE(/usr/share/java/libformula.jar,
9861                          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
9862                          [AC_MSG_ERROR(libformula.jar replacement not found.)]
9863                      )
9864                  ]
9865             )
9866         else
9867             AC_CHECK_FILE($LIBFORMULA_JAR, [],
9868                 [AC_MSG_ERROR(libformula.jar not found.)], [])
9869         fi
9871         if test -z $LIBREPOSITORY_JAR; then
9872             AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
9873                 [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
9874                 [
9875                     AC_CHECK_FILE(/usr/share/java/librepository.jar,
9876                         [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
9877                         [AC_MSG_ERROR(librepository.jar replacement not found.)]
9878                     )
9879                 ]
9880             )
9881         else
9882             AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
9883                 [AC_MSG_ERROR(librepository.jar not found.)], [])
9884         fi
9886         if test -z $LIBFONTS_JAR; then
9887             AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
9888                 [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
9889                 [
9890                     AC_CHECK_FILE(/usr/share/java/libfonts.jar,
9891                         [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
9892                         [AC_MSG_ERROR(libfonts.jar replacement not found.)]
9893                     )
9894                 ]
9895             )
9896         else
9897             AC_CHECK_FILE($LIBFONTS_JAR, [],
9898                 [AC_MSG_ERROR(libfonts.jar not found.)], [])
9899         fi
9901         if test -z $LIBSERIALIZER_JAR; then
9902             AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
9903                 [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
9904                 [
9905                     AC_CHECK_FILE(/usr/share/java/libserializer.jar,
9906                         [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
9907                         [AC_MSG_ERROR(libserializer.jar replacement not found.)]
9908                     )
9909                 ]
9910             )
9911         else
9912             AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
9913                 [AC_MSG_ERROR(libserializer.jar not found.)], [])
9914         fi
9916         if test -z $LIBBASE_JAR; then
9917             AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
9918                 [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
9919                 [
9920                     AC_CHECK_FILE(/usr/share/java/libbase.jar,
9921                         [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
9922                         [AC_MSG_ERROR(libbase.jar replacement not found.)]
9923                     )
9924                 ]
9925             )
9926         else
9927             AC_CHECK_FILE($LIBBASE_JAR, [],
9928                 [AC_MSG_ERROR(libbase.jar not found.)], [])
9929         fi
9931     else
9932         AC_MSG_RESULT([internal])
9933         SYSTEM_JFREEREPORT=NO
9934         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
9935     fi
9936 else
9937     AC_MSG_RESULT([no])
9938     ENABLE_REPORTBUILDER=FALSE
9939     SYSTEM_JFREEREPORT=NO
9941 AC_SUBST(ENABLE_REPORTBUILDER)
9942 AC_SUBST(SYSTEM_JFREEREPORT)
9943 AC_SUBST(SAC_JAR)
9944 AC_SUBST(LIBXML_JAR)
9945 AC_SUBST(FLUTE_JAR)
9946 AC_SUBST(JFREEREPORT_JAR)
9947 AC_SUBST(LIBBASE_JAR)
9948 AC_SUBST(LIBLAYOUT_JAR)
9949 AC_SUBST(LIBLOADER_JAR)
9950 AC_SUBST(LIBFORMULA_JAR)
9951 AC_SUBST(LIBREPOSITORY_JAR)
9952 AC_SUBST(LIBFONTS_JAR)
9953 AC_SUBST(LIBSERIALIZER_JAR)
9955 # this has to be here because both the Wiki Publisher and the SRB use
9956 # commons-logging
9957 if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "TRUE"; then
9958     AC_MSG_CHECKING([which Apache commons-* libs to use])
9959     if test "$with_system_apache_commons" = "yes"; then
9960         SYSTEM_APACHE_COMMONS=YES
9961         AC_MSG_RESULT([external])
9962         if test "$ENABLE_MEDIAWIKI" = "YES"; then
9963             if test -z $COMMONS_CODEC_JAR; then
9964                 AC_CHECK_FILE(/usr/share/java/commons-codec-1.6.jar,
9965                     [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec-1.6.jar ],
9966                     [
9967                         AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
9968                             [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
9969                             [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
9970                         )
9971                     ]
9972                 )
9973             else
9974                 AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
9975                     [AC_MSG_ERROR(commons-codec.jar not found.)], [])
9976             fi
9978             if test -z $COMMONS_LANG_JAR; then
9979                 AC_CHECK_FILE(/usr/share/java/commons-lang-2.4.jar,
9980                     [ COMMONS_LANG_JAR=/usr/share/java/commons-lang-2.4.jar ],
9981                     [
9982                         AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
9983                             [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
9984                             [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
9985                             )
9986                     ]
9987                 )
9988             else
9989                 AC_CHECK_FILE($COMMONS_LANG_JAR, [],
9990                     [AC_MSG_ERROR(commons-lang.jar not found.)], [])
9991             fi
9993             if test -z $COMMONS_HTTPCLIENT_JAR; then
9994                 AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
9995                     [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
9996                     [
9997                         AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
9998                             [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
9999                             [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
10000                         )
10001                     ]
10002                 )
10003             else
10004                 AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
10005                     [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
10006             fi
10007         fi
10008         if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "TRUE"; then
10009             if test -z $COMMONS_LOGGING_JAR; then
10010                 AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.1.jar,
10011                    [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.1.jar ],
10012                    [
10013                         AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
10014                             [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
10015                             [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
10016                         )
10017                     ]
10018                 )
10019             else
10020                 AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
10021                     [AC_MSG_ERROR(commons-logging.jar not found.)], [])
10022             fi
10023         fi
10024     else
10025         AC_MSG_RESULT([internal])
10026         SYSTEM_APACHE_COMMONS=NO
10027         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
10028     fi
10030 AC_SUBST(SYSTEM_APACHE_COMMONS)
10031 AC_SUBST(COMMONS_CODEC_JAR)
10032 AC_SUBST(COMMONS_LANG_JAR)
10033 AC_SUBST(COMMONS_HTTPCLIENT_JAR)
10034 AC_SUBST(COMMONS_LOGGING_JAR)
10036 # scripting provider for BeanShell?
10037 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10038 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10039    AC_MSG_RESULT([yes])
10040    ENABLE_SCRIPTING_BEANSHELL=YES
10042    dnl ===================================================================
10043    dnl Check for system beanshell
10044    dnl ===================================================================
10045    AC_MSG_CHECKING([which beanshell to use])
10046    if test "$with_system_beanshell" = "yes"; then
10047        AC_MSG_RESULT([external])
10048        SYSTEM_BSH=YES
10049        if test -z $BSH_JAR; then
10050            BSH_JAR=/usr/share/java/bsh.jar
10051        fi
10052        AC_CHECK_FILE($BSH_JAR, [],
10053                   [AC_MSG_ERROR(bsh.jar not found.)], [])
10054    else
10055        AC_MSG_RESULT([internal])
10056        SYSTEM_BSH=NO
10057        BUILD_TYPE="$BUILD_TYPE BSH"
10058    fi
10059 else
10060    AC_MSG_RESULT([no])
10061    ENABLE_SCRIPTING_BEANSHELL=NO
10062    SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10064 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10065 AC_SUBST(SYSTEM_BSH)
10066 AC_SUBST(BSH_JAR)
10068 # scripting provider for JavaScript?
10069 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10070 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10071    AC_MSG_RESULT([yes])
10072    ENABLE_SCRIPTING_JAVASCRIPT=YES
10074    dnl ===================================================================
10075    dnl Check for system rhino
10076    dnl ===================================================================
10077    AC_MSG_CHECKING([which rhino to use])
10078    if test "$with_system_rhino" = "yes"; then
10079        AC_MSG_RESULT([external])
10080        SYSTEM_RHINO=YES
10081        if test -z $RHINO_JAR; then
10082            RHINO_JAR=/usr/share/java/js.jar
10083        fi
10084        AC_CHECK_FILE($RHINO_JAR, [],
10085                   [AC_MSG_ERROR(js.jar not found.)], [])
10086    else
10087        AC_MSG_RESULT([internal])
10088        SYSTEM_RHINO=NO
10089        BUILD_TYPE="$BUILD_TYPE RHINO"
10090    fi
10091 else
10092    AC_MSG_RESULT([no])
10093    ENABLE_SCRIPTING_JAVASCRIPT=NO
10094    SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10096 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10097 AC_SUBST(SYSTEM_RHINO)
10098 AC_SUBST(RHINO_JAR)
10100 supports_multilib=
10101 case "$host_cpu" in
10102 x86_64 | powerpc64 | s390x)
10103     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10104         supports_multilib="yes"
10105     fi
10106     ;;
10108     ;;
10109 esac
10111 dnl ===================================================================
10112 dnl Check whether the TQt and TDE libraries are available.
10113 dnl ===================================================================
10115 TDE_CFLAGS=""
10116 TDE_LIBS=""
10117 if test "$_os" != "OpenBSD"; then
10118     MOC="moc"
10120 if test "$test_tde" = "yes" -a "$ENABLE_TDE" = "TRUE"; then
10121     dnl Search paths for TQt and TDE
10122     if test -z "$supports_multilib"; then
10123         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"
10124         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"
10125     else
10126         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"
10127         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"
10128     fi
10129     if test -n "$TQTDIR"; then
10130         tqt_incdirs="$TQTDIR/include $tqt_incdirs"
10131         if test -z "$supports_multilib"; then
10132             tqt_libdirs="$TQTDIR/lib $tqt_libdirs"
10133         else
10134             tqt_libdirs="$TQTDIR/lib64 $TQTDIR/lib $tqt_libdirs"
10135         fi
10136     fi
10137     if test -z "$supports_multilib"; then
10138         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"
10139         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"
10140     else
10141         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"
10142         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"
10143     fi
10144     if test -n "$TDEDIR"; then
10145         tde_incdirs="$TDEDIR/include $tde_incdirs"
10146         if test -z "$supports_multilib"; then
10147             tde_libdirs="$TDEDIR/lib $tde_libdirs"
10148         else
10149             tde_libdirs="$TDEDIR/lib64 $TDEDIR/lib $tde_libdirs"
10150         fi
10151     fi
10153     dnl What to test
10154     tqt_test_include="ntqstyle.h"
10155     tde_test_include="kapp.h"
10157     if test "$_os" != "OpenBSD"; then
10158         tqt_test_library="libtqt-mt.so"
10159         tde_test_library="libDCOP.so"
10160     else
10161         tqt_test_library="libtqt-mt.so*"
10162         tde_test_library="libDCOP.so*"
10163     fi
10165     dnl Check for TQt headers
10166     AC_MSG_CHECKING([for TQt headers])
10167     tqt_incdir="no"
10168     for tde_check in $tqt_incdirs; do
10169         if test -r "$tde_check/$tqt_test_include"; then
10170             tqt_incdir="$tde_check"
10171             break
10172         fi
10173     done
10174     AC_MSG_RESULT([$tqt_incdir])
10175     if test "x$tqt_incdir" = "xno"; then
10176         AC_MSG_ERROR([TQt headers not found.  Please specify the root of
10177 your TQt installation by exporting TQTDIR before running "configure".])
10178     fi
10180     dnl Check for TQt libraries
10181     AC_MSG_CHECKING([for TQt libraries])
10182     tqt_libdir="no"
10183     for tqt_check in $tqt_libdirs; do
10184         if test -r "`ls $tqt_check/$tqt_test_library 2>/dev/null | head -1`"; then
10185             tqt_libdir="$tqt_check"
10186             break
10187         fi
10188     done
10189     AC_MSG_RESULT([$tqt_libdir])
10190     if test "x$tqt_libdir" = "xno"; then
10191         AC_MSG_ERROR([TQt libraries not found.  Please specify the root of
10192 your TQt installation by exporting TQTDIR before running "configure".])
10193     fi
10195     dnl Check for Meta Object Compiler
10196     AC_PATH_PROG( MOC, moc, no, [`dirname $tqt_libdir`/bin:$TQTDIR/bin:$PATH] )
10197     if test "$MOC" = "no"; then
10198         AC_MSG_ERROR([TQt Meta Object Compiler not found.  Please specify
10199 the root of your TQt installation by exporting TQTDIR before running "configure".])
10200     fi
10202     dnl Check for TDE headers
10203     AC_MSG_CHECKING([for TDE headers])
10204     tde_incdir="no"
10205     for tde_check in $tde_incdirs; do
10206         if test -r "$tde_check/$tde_test_include"; then
10207             tde_incdir="$tde_check"
10208             break
10209         fi
10210     done
10211     AC_MSG_RESULT([$tde_incdir])
10212     if test "x$tde_incdir" = "xno"; then
10213         AC_MSG_ERROR([TDE headers not found.  Please specify the root of
10214 your TDE installation by exporting TDEDIR before running "configure".])
10215     fi
10217     dnl Check for TDE libraries
10218     AC_MSG_CHECKING([for TDE libraries])
10219     tde_libdir="no"
10220     for tde_check in $tde_libdirs; do
10221         if test -r "`ls $tde_check/$tde_test_library 2>/dev/null | head -1`"; then
10222             tde_libdir="$tde_check"
10223             break
10224         fi
10225     done
10226     AC_MSG_RESULT([$tde_libdir])
10227     if test "x$tde_libdir" = "xno"; then
10228         AC_MSG_ERROR([TDE libraries not found.  Please specify the root of
10229 your TDE installation by exporting TDEDIR before running "configure".])
10230     fi
10232     dnl Set the variables
10233     TDE_CFLAGS="-I$tqt_incdir -I$tde_incdir -I/usr/include/tqt -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10234     TDE_LIBS="-L$tde_libdir -L$tqt_libdir -ltdeio -ltdeui -ltdecore -ltqt -ltqt-mt"
10236 AC_SUBST(TDE_CFLAGS)
10237 AC_SUBST(TDE_LIBS)
10238 AC_SUBST(MOC)
10240 dnl ===================================================================
10241 dnl Check whether the Qt3 and KDE3 libraries are available.
10242 dnl ===================================================================
10244 KDE_CFLAGS=""
10245 KDE_LIBS=""
10246 if test "$_os" != "OpenBSD"; then
10247     MOC="moc"
10249 if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE"; then
10250     dnl Search paths for Qt3 and KDE3
10251     if test -z "$supports_multilib"; then
10252         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"
10253         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"
10254     else
10255         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"
10256         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"
10257     fi
10258     if test -n "$QTDIR"; then
10259         qt_incdirs="$QTDIR/include $qt_incdirs"
10260         if test -z "$supports_multilib"; then
10261             qt_libdirs="$QTDIR/lib $qt_libdirs"
10262         else
10263             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
10264         fi
10265     fi
10266     if test -z "$supports_multilib"; then
10267         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"
10268         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"
10269     else
10270         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"
10271         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"
10272     fi
10273     if test -n "$KDEDIR"; then
10274         kde_incdirs="$KDEDIR/include $kde_incdirs"
10275         if test -z "$supports_multilib"; then
10276             kde_libdirs="$KDEDIR/lib $kde_libdirs"
10277         else
10278             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
10279         fi
10280     fi
10282     dnl What to test
10283     qt_test_include="qstyle.h"
10284     kde_test_include="kapp.h"
10286     if test "$_os" != "OpenBSD"; then
10287         qt_test_library="libqt-mt.so"
10288         kde_test_library="libDCOP.so"
10289     else
10290         qt_test_library="libqt-mt.so*"
10291         kde_test_library="libDCOP.so*"
10292     fi
10294     dnl Check for Qt3 headers
10295     AC_MSG_CHECKING([for Qt3 headers])
10296     qt_incdir="no"
10297     for kde_check in $qt_incdirs; do
10298         if test -r "$kde_check/$qt_test_include"; then
10299             qt_incdir="$kde_check"
10300             break
10301         fi
10302     done
10303     AC_MSG_RESULT([$qt_incdir])
10304     if test "x$qt_incdir" = "xno"; then
10305         AC_MSG_ERROR([Qt3 headers not found.  Please specify the root of
10306 your Qt3 installation by exporting QTDIR before running "configure".])
10307     fi
10309     dnl Check for Qt3 libraries
10310     AC_MSG_CHECKING([for Qt3 libraries])
10311     qt_libdir="no"
10312     for qt_check in $qt_libdirs; do
10313         if test -r "`ls $qt_check/$qt_test_library 2>/dev/null | head -1`"; then
10314             qt_libdir="$qt_check"
10315             break
10316         fi
10317     done
10318     AC_MSG_RESULT([$qt_libdir])
10319     if test "x$qt_libdir" = "xno"; then
10320         AC_MSG_ERROR([Qt3 libraries not found.  Please specify the root of
10321 your Qt3 installation by exporting QTDIR before running "configure".])
10322     fi
10324     dnl Check for Meta Object Compiler
10325     AC_PATH_PROG( MOC, moc, no, [`dirname $qt_libdir`/bin:$QTDIR/bin:$PATH] )
10326     if test "$MOC" = "no"; then
10327         AC_MSG_ERROR([Qt3 Meta Object Compiler not found.  Please specify
10328 the root of your Qt3 installation by exporting QTDIR before running "configure".])
10329     fi
10331     dnl Check for KDE3 headers
10332     AC_MSG_CHECKING([for KDE3 headers])
10333     kde_incdir="no"
10334     for kde_check in $kde_incdirs; do
10335         if test -r "$kde_check/$kde_test_include"; then
10336             kde_incdir="$kde_check"
10337             break
10338         fi
10339     done
10340     AC_MSG_RESULT([$kde_incdir])
10341     if test "x$kde_incdir" = "xno"; then
10342         AC_MSG_ERROR([KDE3 headers not found.  Please specify the root of
10343 your KDE3 installation by exporting KDEDIR before running "configure".])
10344     fi
10346     dnl Check for KDE3 libraries
10347     AC_MSG_CHECKING([for KDE3 libraries])
10348     kde_libdir="no"
10349     for kde_check in $kde_libdirs; do
10350         if test -r "`ls $kde_check/$kde_test_library 2>/dev/null | head -1`"; then
10351             kde_libdir="$kde_check"
10352             break
10353         fi
10354     done
10355     AC_MSG_RESULT([$kde_libdir])
10356     if test "x$kde_libdir" = "xno"; then
10357         AC_MSG_ERROR([KDE3 libraries not found.  Please specify the root of
10358 your KDE3 installation by exporting KDEDIR before running "configure".])
10359     fi
10361     dnl Set the variables
10362     KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10363     KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
10365 AC_SUBST(KDE_CFLAGS)
10366 AC_SUBST(KDE_LIBS)
10367 AC_SUBST(MOC)
10369 dnl ===================================================================
10370 dnl KDE4 Integration
10371 dnl ===================================================================
10373 KDE4_CFLAGS=""
10374 KDE4_LIBS=""
10375 QMAKE4="qmake"
10376 MOC4="moc"
10377 KDE_GLIB_CFLAGS=""
10378 KDE_GLIB_LIBS=""
10379 KDE_HAVE_GLIB=""
10380 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
10381     qt_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
10382     qt_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
10384     kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
10385     kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
10387     if test -n "$supports_multilib"; then
10388         qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
10389         kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
10390     fi
10392     if test -n "$QTDIR"; then
10393         qt_incdirs="$QTDIR/include $qt_incdirs"
10394         if test -z "$supports_multilib"; then
10395             qt_libdirs="$QTDIR/lib $qt_libdirs"
10396         else
10397             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
10398         fi
10399     fi
10400     if test -n "$QT4DIR"; then
10401         qt_incdirs="$QT4DIR/include $qt_incdirs"
10402         if test -z "$supports_multilib"; then
10403             qt_libdirs="$QT4DIR/lib $qt_libdirs"
10404         else
10405             qt_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt_libdirs"
10406         fi
10407     fi
10409     if test -n "$KDEDIR"; then
10410         kde_incdirs="$KDEDIR/include $kde_incdirs"
10411         if test -z "$supports_multilib"; then
10412             kde_libdirs="$KDEDIR/lib $kde_libdirs"
10413         else
10414             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
10415         fi
10416     fi
10417     if test -n "$KDE4DIR"; then
10418         kde_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde_incdirs"
10419         if test -z "$supports_multilib"; then
10420             kde_libdirs="$KDE4DIR/lib $kde_libdirs"
10421         else
10422             kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
10423         fi
10424     fi
10426     qt_test_include="Qt/qobject.h"
10427     qt_test_library="libQtCore.so"
10428     kde_test_include="kwindowsystem.h"
10429     kde_test_library="libsolid.so"
10431     AC_MSG_CHECKING([for Qt4 headers])
10432     qt_header_dir="no"
10433     for inc_dir in $qt_incdirs; do
10434         if test -r "$inc_dir/$qt_test_include"; then
10435             qt_header_dir="$inc_dir"
10436             break
10437         fi
10438     done
10440     AC_MSG_RESULT([$qt_header_dir])
10441     if test "x$qt_header_dir" = "xno"; then
10442         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10443     fi
10445     dnl Check for qmake
10446     AC_PATH_PROG( QMAKEQT4, qmake-qt4, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
10447     QMAKE4="$QMAKEQT4"
10448     if test "$QMAKE4" = "no"; then
10449         AC_PATH_PROG( QMAKE4, qmake, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
10450         if test "$QMAKE4" = "no"; then
10451             AC_MSG_ERROR([Qmake not found.  Please specify
10452 the root of your Qt installation by exporting QT4DIR before running "configure".])
10453         fi
10454     fi
10456     qt_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt_libdirs"
10457     AC_MSG_CHECKING([for Qt4 libraries])
10458     qt_lib_dir="no"
10459     for lib_dir in $qt_libdirs; do
10460         if test -r "$lib_dir/$qt_test_library"; then
10461             qt_lib_dir="$lib_dir"
10462             PKG_CONFIG_PATH="$qt_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
10463             break
10464         fi
10465     done
10467     AC_MSG_RESULT([$qt_lib_dir])
10469     if test "x$qt_lib_dir" = "xno"; then
10470         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10471     fi
10473     dnl Check for Meta Object Compiler
10475     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10476     MOC4="$MOCQT4"
10477     if test "$MOC4" = "no"; then
10478         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10479         if test "$MOC4" = "no"; then
10480             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10481 the root of your Qt installation by exporting QT4DIR before running "configure".])
10482         fi
10483     fi
10485     dnl Check for KDE4 headers
10486     AC_MSG_CHECKING([for KDE4 headers])
10487     kde_incdir="no"
10488     for kde_check in $kde_incdirs; do
10489         if test -r "$kde_check/$kde_test_include"; then
10490             kde_incdir="$kde_check"
10491             break
10492         fi
10493     done
10494     AC_MSG_RESULT([$kde_incdir])
10495     if test "x$kde_incdir" = "xno"; then
10496         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10497     fi
10499     dnl Check for KDE4 libraries
10500     AC_MSG_CHECKING([for KDE4 libraries])
10501     kde_libdir="no"
10502     for kde_check in $kde_libdirs; do
10503         if test -r "$kde_check/$kde_test_library"; then
10504             kde_libdir="$kde_check"
10505             break
10506         fi
10507     done
10509     AC_MSG_RESULT([$kde_libdir])
10510     if test "x$kde_libdir" = "xno"; then
10511         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10512     fi
10514     KDE4_CFLAGS="`pkg-config --cflags QtCore` `pkg-config --cflags QtGui` -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10515     KDE4_LIBS="-L$kde_libdir -L$qt_lib_dir -lkio -lkfile -lkdeui -lkdecore -lQtCore -lQtGui"
10517     AC_LANG_PUSH([C++])
10518     save_CXXFLAGS=$CXXFLAGS
10519     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10520     AC_MSG_CHECKING([whether KDE is >= 4.2])
10521        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10522 #include <kdeversion.h>
10524 int main(int argc, char **argv) {
10525        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
10526        else return 1;
10528        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
10529     CXXFLAGS=$save_CXXFLAGS
10530     AC_LANG_POP([C++])
10532     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
10533     # Sets also KDE_GLIB_CFLAGS/KDE_GLIB_LIBS if successful.
10534     PKG_CHECK_MODULES(KDE_GLIB,[glib-2.0 >= 2.4],
10535         [
10536         KDE_HAVE_GLIB=1
10537         AC_DEFINE(KDE_HAVE_GLIB,1)
10538         ],
10539         AC_MSG_WARN([[No Glib found, KDE4 support will not integrate with Qt's Glib event loop support]]))
10541 AC_SUBST(KDE4_CFLAGS)
10542 AC_SUBST(KDE4_LIBS)
10543 AC_SUBST(MOC4)
10544 AC_SUBST(KDE_GLIB_CFLAGS)
10545 AC_SUBST(KDE_GLIB_LIBS)
10546 AC_SUBST(KDE_HAVE_GLIB)
10548 dnl ===================================================================
10549 dnl Test for the enabling the lockdown pieces
10550 dnl ===================================================================
10551 AC_MSG_CHECKING([whether to enable the lockdown pieces])
10552 ENABLE_LOCKDOWN=""
10553 if test -n "$enable_lockdown" -a "$enable_lockdown" != "no"; then
10554     ENABLE_LOCKDOWN=YES
10555     AC_MSG_RESULT([yes])
10556 else
10557     AC_MSG_RESULT([no])
10559 AC_SUBST(ENABLE_LOCKDOWN)
10561 dnl ===================================================================
10562 dnl Test whether to include Evolution 2 support
10563 dnl ===================================================================
10564 AC_MSG_CHECKING([whether to enable evolution 2 support])
10565 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
10566     AC_MSG_RESULT([yes])
10567     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
10568     ENABLE_EVOAB2="TRUE"
10569 else
10570     ENABLE_EVOAB2=""
10571     AC_MSG_RESULT([no])
10573 AC_SUBST(ENABLE_EVOAB2)
10574 AC_SUBST(GOBJECT_CFLAGS)
10575 AC_SUBST(GOBJECT_LIBS)
10577 dnl ===================================================================
10578 dnl Test whether to include TDE AB support
10579 dnl ===================================================================
10580 AC_MSG_CHECKING([whether to enable TDE address book support])
10581 if test "$enable_tdeab" = "yes" -a "$enable_tde" = "yes"; then
10582     AC_MSG_RESULT([yes])
10583     AC_LANG_PUSH([C++])
10584     save_CXXFLAGS=$CXXFLAGS
10585     CXXFLAGS="$CXXFLAGS $TDE_CFLAGS"
10586     AC_MSG_CHECKING([whether TDE is at least R14.0])
10587        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10588 #include <tdeversion.h>
10590 int main(int argc, char **argv) {
10591        if (TDE_VERSION_MAJOR >= 14) return 0;
10592        else return 1;
10594        ]])],[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])],[])
10595     CXXFLAGS=$save_CXXFLAGS
10596     AC_LANG_POP([C++])
10597     ENABLE_TDEAB=TRUE
10598 else
10599     AC_MSG_RESULT([no])
10600     ENABLE_TDEAB=
10602 AC_SUBST(ENABLE_TDEAB)
10604 dnl ===================================================================
10605 dnl Test whether to include KDE AB support
10606 dnl ===================================================================
10607 AC_MSG_CHECKING([whether to enable KDE address book support])
10608 if test "$enable_kdeab" = "yes" -a "$enable_kde" = "yes"; then
10609     AC_MSG_RESULT([yes])
10610     AC_LANG_PUSH([C++])
10611     save_CXXFLAGS=$CXXFLAGS
10612     CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
10613     AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
10614        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10615 #include <kdeversion.h>
10617 int main(int argc, char **argv) {
10618        if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
10619        else return 1;
10621        ]])],[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])],[])
10622     CXXFLAGS=$save_CXXFLAGS
10623     AC_LANG_POP([C++])
10624     ENABLE_KAB=TRUE
10625 else
10626     AC_MSG_RESULT([no])
10627     ENABLE_KAB=
10629 AC_SUBST(ENABLE_KAB)
10631 dnl ===================================================================
10632 dnl Test which themes to include
10633 dnl ===================================================================
10634 AC_MSG_CHECKING([which themes to include])
10635 # if none given use default subset of available themes
10636 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
10637     with_theme="crystal default hicontrast oxygen tango"
10638     test "$ENABLE_RELEASE_BUILD" = "FALSE" && with_theme="$with_theme tango_testing"
10641 WITH_THEMES=""
10642 if test "x$with_theme" != "xno"; then
10643     for theme in $with_theme; do
10644         case $theme in
10645             crystal|default|galaxy|hicontrast|human|industrial|oxygen|tango|tango_testing) : ;;
10646             *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
10647         esac
10648         WITH_THEMES="$WITH_THEMES $theme"
10649         SCPDEFS="$SCPDEFS -DTHEME_`echo $theme|tr '[[:lower:]]' '[[:upper:]]'`"
10650     done
10652 AC_MSG_RESULT([$WITH_THEMES])
10653 AC_SUBST([WITH_THEMES])
10655 dnl ===================================================================
10656 dnl Test whether to integrate helppacks into the product's installer
10657 dnl ===================================================================
10658 AC_MSG_CHECKING([for helppack integration])
10659 if test "$with_helppack_integration" = "no"; then
10660     WITH_HELPPACK_INTEGRATION=NO
10661     AC_MSG_RESULT([no integration])
10662 else
10663     WITH_HELPPACK_INTEGRATION=YES
10664     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
10665     AC_MSG_RESULT([integration])
10667 AC_SUBST(WITH_HELPPACK_INTEGRATION)
10669 dnl ===================================================================
10670 dnl Test whether to use CoreText framework
10671 dnl ===================================================================
10672 ENABLE_CORETEXT=NO
10673 if test "$_os" = "Darwin"; then
10674     AC_MSG_CHECKING([whether to use CoreText framework])
10675     if test "$enable_coretext" != no -o "$BITNESS_OVERRIDE" = 64; then
10676         AC_MSG_RESULT([yes])
10677         ENABLE_CORETEXT=YES
10678     else
10679         AC_MSG_RESULT([no])
10680     fi
10682 AC_SUBST(ENABLE_CORETEXT)
10684 ###############################################################################
10685 # Extensions checking
10686 ###############################################################################
10687 AC_MSG_CHECKING([for extensions integration])
10688 if test "x$enable_extension_integration" != "xno"; then
10689     WITH_EXTENSION_INTEGRATION=YES
10690     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
10691     AC_MSG_RESULT([yes, use integration])
10692 else
10693     WITH_EXTENSION_INTEGRATION=NO
10694     AC_MSG_RESULT([no, do not integrate])
10696 AC_SUBST(WITH_EXTENSION_INTEGRATION)
10698 dnl Should any extra extensions be included?
10699 dnl There are standalone tests for each of these below.
10700 WITH_EXTRA_EXTENSIONS=
10701 AC_SUBST([WITH_EXTRA_EXTENSIONS])
10703 libo_CHECK_EXTENSION([Watch Window],[WATCH_WINDOW],[watch_window],[watch-window],[23bd75552206dfcd8fd4e29137dcac84-WatchWindow_1.2.0.0.oxt])
10704 libo_CHECK_EXTENSION([SmART Gallery (Diagram)],[DIAGRAM],[diagram],[diagram],[8d74685d41f8bffe8c3e71fe8deac09d-SmART_0.9.5.oxt])
10705 libo_CHECK_EXTENSION([Validator],[VALIDATOR],[validator],[validator],[bbdd5639ada63e3130761daaecae1a10-Validator_1.1.0.0.oxt])
10706 libo_CHECK_EXTENSION([Barcode],[BARCODE],[barcode],[barcode],[3ed18025a766f1e955707b969c8113a5-Barcode_1.3.5.0.oxt])
10707 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
10708 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
10709 libo_CHECK_EXTENSION([Hungarian Cross-reference Toolbar],[HUNART],[hunart],[hunart],[b632bdd25649cc4067bcb410bae23d2b-hunart_0.3.oxt])
10710 libo_CHECK_EXTENSION([Typography Toolbar],[TYPO],[typo],[typo],[9d60b6cfa3ef1926848710bbcd11115b-typo_0.4.2.oxt])
10711 libo_CHECK_EXTENSION([Google Docs],[GOOGLE_DOCS],[google_docs],[google-docs],[27211596cf0ad97cab7321239406fde0-gdocs_3.0.1_modified.oxt])
10712 if test "x$with_java" != "xno"; then
10713     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
10714     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
10717 dnl ===================================================================
10718 dnl Test whether to include Sun Professional Template Pack
10719 dnl ===================================================================
10720 AC_MSG_CHECKING([for Sun Professional Template Pack integration (only supported languages displayed)])
10721 if test "$with_sun_templates" = "" -o "$with_sun_templates" = "no"; then
10722     AC_MSG_RESULT([no integration])
10723 else
10724     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_SUN_TEMPLATE_PACK"
10725     sun_supported_langs="en-US de it fr es hu"
10726     if test "$with_sun_templates" = "yes"; then
10727         wanted_sun_templates="$sun_supported_langs"
10728     else
10729         # check whether the langs are supported by Sun
10730         wanted_sun_templates=
10731         for lang in $with_sun_templates; do
10732             if test -n "`echo $sun_supported_langs | grep "$lang"`"; then
10733                 wanted_sun_templates="$wanted_sun_templates $lang"
10734             fi
10735         done
10736     fi
10737     SUNTEMPLATES_LANG=
10738     SUNTEMPLATES_DE_PACK=
10739     SUNTEMPLATES_EN_US_PACK=
10740     SUNTEMPLATES_ES_PACK=
10741     SUNTEMPLATES_FR_PACK=
10742     SUNTEMPLATES_HU_PACK=
10743     SUNTEMPLATES_IT_PACK=
10744     # check whether the langs are requested at all
10745     for lang in $wanted_sun_templates; do
10746     if test "$with_lang" = "ALL" -o -n "`echo $with_lang | grep "$lang"`"; then
10747         SUNTEMPLATES_LANG="$SUNTEMPLATES_LANG $lang"
10748         case $lang in
10749         "de") SUNTEMPLATES_DE_PACK="53ca5e56ccd4cab3693ad32c6bd13343-Sun-ODF-Template-Pack-de_1.0.0.oxt";;
10750         "en-US") SUNTEMPLATES_EN_US_PACK="472ffb92d82cf502be039203c606643d-Sun-ODF-Template-Pack-en-US_1.0.0.oxt";;
10751         "es") SUNTEMPLATES_ES_PACK="4ad003e7bbda5715f5f38fde1f707af2-Sun-ODF-Template-Pack-es_1.0.0.oxt";;
10752         "fr") SUNTEMPLATES_FR_PACK="a53080dc876edcddb26eb4c3c7537469-Sun-ODF-Template-Pack-fr_1.0.0.oxt";;
10753         "hu") SUNTEMPLATES_HU_PACK="09ec2dac030e1dcd5ef7fa1692691dc0-Sun-ODF-Template-Pack-hu_1.0.0.oxt";;
10754         "it") SUNTEMPLATES_IT_PACK="b33775feda3bcf823cad7ac361fd49a6-Sun-ODF-Template-Pack-it_1.0.0.oxt";;
10755         esac
10756     fi
10757     done
10758     WITH_EXTRA_EXTENSIONS=YES
10759     AC_MSG_RESULT([$SUNTEMPLATES_LANG])
10761 AC_SUBST(SUNTEMPLATES_DE_PACK)
10762 AC_SUBST(SUNTEMPLATES_EN_US_PACK)
10763 AC_SUBST(SUNTEMPLATES_ES_PACK)
10764 AC_SUBST(SUNTEMPLATES_FR_PACK)
10765 AC_SUBST(SUNTEMPLATES_HU_PACK)
10766 AC_SUBST(SUNTEMPLATES_IT_PACK)
10768 dnl ===================================================================
10769 dnl Test whether to include fonts
10770 dnl ===================================================================
10771 AC_MSG_CHECKING([whether to include third-party fonts])
10772 if test "$with_fonts" != "no"; then
10773     AC_MSG_RESULT([yes])
10774     WITH_FONTS=YES
10775     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
10776 else
10777     AC_MSG_RESULT([no])
10778     WITH_FONTS=NO
10779     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
10781 AC_SUBST(WITH_FONTS)
10783 dnl ===================================================================
10784 dnl Test whether to include ppds
10785 dnl ===================================================================
10786 AC_MSG_CHECKING([whether to include PPDs])
10787 if test "$with_ppds" != "no"; then
10788     AC_MSG_RESULT([yes])
10789 else
10790     AC_MSG_RESULT([no])
10791     WITHOUT_PPDS=YES
10792     SCPDEFS="$SCPDEFS -DWITHOUT_PPDS"
10794 AC_SUBST(WITHOUT_PPDS)
10796 dnl ===================================================================
10797 dnl Test whether to include afms
10798 dnl ===================================================================
10799 AC_MSG_CHECKING([whether to include AFMs])
10800 if test "$with_afms" != "no"; then
10801     AC_MSG_RESULT([yes])
10802     BUILD_TYPE="$BUILD_TYPE AFMS"
10803 else
10804     AC_MSG_RESULT([no])
10805     WITHOUT_AFMS=YES
10806     SCPDEFS="$SCPDEFS -DWITHOUT_AFMS"
10808 AC_SUBST(WITHOUT_AFMS)
10810 dnl ===================================================================
10811 dnl Test whether to include extra galleries
10812 dnl ===================================================================
10813 AC_MSG_CHECKING([whether to include extra galleries])
10814 if test "$enable_extra_gallery" = "" -o "$enable_extra_gallery" = "no"; then
10815     AC_MSG_RESULT([no])
10816     WITH_EXTRA_GALLERY=NO
10817     OOOP_GALLERY_PACK=""
10818 else
10819     AC_MSG_RESULT([yes])
10820     WITH_EXTRA_GALLERY=YES
10821     BUILD_TYPE="$BUILD_TYPE EXTRA_GALLERY"
10822     SCPDEFS="$SCPDEFS -DWITH_EXTRA_GALLERY"
10823     OOOP_GALLERY_PACK="af9314c5972d95a5d6da23ffad818f68-OOOP-gallery-pack-2.8.0.0.zip"
10825 AC_SUBST(WITH_EXTRA_GALLERY)
10826 AC_SUBST(OOOP_GALLERY_PACK)
10828 dnl ===================================================================
10829 dnl Test whether to include extra templates
10830 dnl ===================================================================
10831 AC_MSG_CHECKING([whether to include extra templates])
10832 if test "$enable_extra_template" = "" -o "$enable_extra_template" = "no"; then
10833     AC_MSG_RESULT([no])
10834     WITH_EXTRA_TEMPLATE=NO
10835     OOOP_TEMPLATES_PACK=""
10836 else
10837     AC_MSG_RESULT([yes])
10838     WITH_EXTRA_TEMPLATE=YES
10839     BUILD_TYPE="$BUILD_TYPE EXTRA_TEMPLATE"
10840     SCPDEFS="$SCPDEFS -DWITH_EXTRA_TEMPLATE"
10841     OOOP_TEMPLATES_PACK="1be202fbbbc13f10592a98f70a4a87fb-OOOP-templates-pack-2.9.0.0.zip"
10843 AC_SUBST(WITH_EXTRA_TEMPLATE)
10844 AC_SUBST(OOOP_TEMPLATES_PACK)
10846 dnl ===================================================================
10847 dnl Test whether to include extra samples
10848 dnl ===================================================================
10849 AC_MSG_CHECKING([whether to include extra samples])
10850 if test "$enable_extra_sample" = "" -o "$enable_extra_sample" = "no"; then
10851     AC_MSG_RESULT([no])
10852     WITH_EXTRA_SAMPLE=NO
10853     OOOP_SAMPLES_PACK=""
10854 else
10855     AC_MSG_RESULT([yes])
10856     WITH_EXTRA_SAMPLE=YES
10857     BUILD_TYPE="$BUILD_TYPE EXTRA_SAMPLE"
10858     SCPDEFS="$SCPDEFS -DWITH_EXTRA_SAMPLE"
10859     OOOP_SAMPLES_PACK="a6bccacf44914969e6e7b2f8faf4132c-OOOP-samples-pack-2.7.0.0.zip"
10861 AC_SUBST(WITH_EXTRA_SAMPLE)
10862 AC_SUBST(OOOP_SAMPLES_PACK)
10864 dnl ===================================================================
10865 dnl Test whether to include extra fonts
10866 dnl ===================================================================
10867 AC_MSG_CHECKING([whether to include extra fonts])
10868 if test "$enable_extra_font" = "" -o "$enable_extra_font" = "no"; then
10869     AC_MSG_RESULT([no])
10870     WITH_EXTRA_FONT=NO
10871     OOOP_FONTS_PACK=""
10872 else
10873     AC_MSG_RESULT([yes])
10874     WITH_EXTRA_FONT=YES
10875     BUILD_TYPE="$BUILD_TYPE EXTRA_FONT"
10876     SCPDEFS="$SCPDEFS -DWITH_EXTRA_FONT"
10877     OOOP_FONTS_PACK="a10aa597411643326e27d7fc128af12d-OOOP-fonts-pack-2.9.0.0.zip"
10879 AC_SUBST(WITH_EXTRA_FONT)
10880 AC_SUBST(OOOP_FONTS_PACK)
10882 dnl ===================================================================
10883 dnl Test whether to enable online update service
10884 dnl ===================================================================
10885 AC_MSG_CHECKING([whether to enable online update])
10886 ENABLE_ONLINE_UPDATE=
10887 if test "$enable_online_update" = ""; then
10888     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
10889         AC_MSG_RESULT([yes])
10890         ENABLE_ONLINE_UPDATE="TRUE"
10891     else
10892         AC_MSG_RESULT([no])
10893     fi
10894 else
10895     if test "$enable_online_update" = "yes"; then
10896         AC_MSG_RESULT([yes])
10897         ENABLE_ONLINE_UPDATE="TRUE"
10898     else
10899         AC_MSG_RESULT([no])
10900     fi
10902 AC_SUBST(ENABLE_ONLINE_UPDATE)
10904 dnl ===================================================================
10905 dnl Test whether to create MSI with LIMITUI=1 (silent install)
10906 dnl ===================================================================
10907 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
10908 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
10909     AC_MSG_RESULT([no])
10910     ENABLE_SILENT_MSI="FALSE"
10911 else
10912     AC_MSG_RESULT([yes])
10913     ENABLE_SILENT_MSI="TRUE"
10914     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
10916 AC_SUBST(ENABLE_SILENT_MSI)
10918 AC_MSG_CHECKING([whether and how to use Xinerama])
10919 if test "$_os" = "Darwin"; then
10920     USE_XINERAMA=YES
10921     XINERAMA_LINK=dynamic
10922     AC_MSG_RESULT([yes])
10923 elif test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
10924     if test "$x_libraries" = "default_x_libraries"; then
10925         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
10926         if test "x$XINERAMALIB" = x; then
10927            XINERAMALIB="/usr/lib"
10928         fi
10929     else
10930         XINERAMALIB="$x_libraries"
10931     fi
10932     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
10933         # we have both versions, let the user decide but use the dynamic one
10934         # per default
10935         USE_XINERAMA=YES
10936         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
10937             XINERAMA_LINK=dynamic
10938         else
10939             XINERAMA_LINK=static
10940         fi
10941     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
10942         # we have only the dynamic version
10943         USE_XINERAMA=YES
10944         XINERAMA_LINK=dynamic
10945     elif test -e "$XINERAMALIB/libXinerama.a"; then
10946         # static version
10947         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
10948             USE_XINERAMA=YES
10949             XINERAMA_LINK=static
10950         else
10951             USE_XINERAMA=NO
10952             XINERAMA_LINK=none
10953         fi
10954     else
10955         # no Xinerama
10956         USE_XINERAMA=NO
10957         XINERAMA_LINK=none
10958     fi
10959     if test "$USE_XINERAMA" = "YES"; then
10960         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
10961         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
10962             [AC_MSG_ERROR(Xinerama header not found.)], [])
10963         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
10964         if test "x$XEXTLIB" = x; then
10965            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
10966         fi
10967         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
10968         if test "$_os" = "FreeBSD"; then
10969             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
10970         fi
10971         if test "$_os" = "Linux"; then
10972             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
10973         fi
10974         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
10975             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
10976     else
10977         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
10978     fi
10979 else
10980     USE_XINERAMA=NO
10981     XINERAMA_LINK=none
10982     AC_MSG_RESULT([no])
10984 AC_SUBST(USE_XINERAMA)
10985 AC_SUBST(XINERAMA_LINK)
10987 dnl ===================================================================
10988 dnl Test whether to build cairo or rely on the system version
10989 dnl ===================================================================
10991 if test "$GUIBASE" = "unx"; then
10992     # Used in vcl/Library_vclplug_gen.mk
10993     test_cairo=yes
10996 if test "$test_cairo" = "yes"; then
10997     AC_MSG_CHECKING([whether to use the system cairo])
10999     if test "$with_system_cairo" = "yes"; then
11000         SYSTEM_CAIRO=YES
11001         AC_MSG_RESULT([yes])
11003         PKG_CHECK_MODULES( CAIRO, cairo >= 1.0.2 )
11005         if test "$test_xrender" = "yes"; then
11006             if test "$with_system_xextensions_headers" != "no"; then
11007                 AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11008                 AC_LANG_PUSH([C])
11009                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11010 #ifdef PictStandardA8
11011 #else
11012       return fail;
11013 #endif
11014 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11016                 AC_LANG_POP([C])
11017             fi
11018         fi
11019         libo_MINGW_CHECK_DLL([libcairo])
11020         libo_MINGW_TRY_DLL([libfontconfig])
11021         libo_MINGW_TRY_DLL([libfreetype])
11022         libo_MINGW_TRY_DLL([libpixman])
11023         libo_MINGW_TRY_DLL([libpng15])
11024     else
11025         SYSTEM_CAIRO=NO
11026         AC_MSG_RESULT([no])
11028         BUILD_TYPE="$BUILD_TYPE CAIRO"
11029         SCPDEFS="$SCPDEFS -DNEED_CAIRO"
11030     fi
11033 AC_SUBST(SYSTEM_CAIRO)
11034 AC_SUBST(CAIRO_CFLAGS)
11035 AC_SUBST(CAIRO_LIBS)
11037 dnl ===================================================================
11038 dnl Test whether to use liblangtag
11039 dnl ===================================================================
11040 ENABLE_LIBLANGTAG=
11041 SYSTEM_LIBLANGTAG=
11042 AC_MSG_CHECKING([whether to use liblangtag])
11043 if test "$enable_liblangtag" = "yes" -o \( "$enable_liblangtag" = "" -a $_os != Android -a $_os != iOS \); then
11044     ENABLE_LIBLANGTAG=YES
11045     AC_MSG_RESULT([yes])
11046     AC_MSG_CHECKING([whether to use system liblangtag])
11047     if test "$with_system_liblangtag" = yes; then
11048         SYSTEM_LIBLANGTAG=YES
11049         AC_MSG_RESULT([yes])
11050         PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11051         libo_MINGW_CHECK_DLL([liblangtag])
11052     else
11053         SYSTEM_LIBLANGTAG=NO
11054         AC_MSG_RESULT([no])
11055         BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11056     fi
11057 else
11058     ENABLE_LIBLANGTAG=NO
11059     AC_MSG_RESULT([no])
11061 AC_SUBST(ENABLE_LIBLANGTAG)
11062 AC_SUBST(SYSTEM_LIBLANGTAG)
11063 AC_SUBST(LIBLANGTAG_CFLAGS)
11064 AC_SUBST(LIBLANGTAG_LIBS)
11066 dnl ===================================================================
11067 dnl Test whether to build libpng or rely on the system version
11068 dnl ===================================================================
11070 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/png"],["-L${OUTDIR}/lib -lpng"])
11072 dnl ===================================================================
11073 dnl Check for runtime JVM search path
11074 dnl ===================================================================
11075 if test "$SOLAR_JAVA" != ""; then
11076     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11077     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11078         AC_MSG_RESULT([yes])
11079         if ! test -d "$with_jvm_path"; then
11080             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11081         fi
11082         if ! test -d "$with_jvm_path"jvm; then
11083             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11084         fi
11085         JVM_ONE_PATH_CHECK="$with_jvm_path"
11086         AC_SUBST(JVM_ONE_PATH_CHECK)
11087     else
11088         AC_MSG_RESULT([no])
11089     fi
11092 dnl ===================================================================
11093 dnl Test for the presence of Ant and that it works
11094 dnl ===================================================================
11096 if test "$SOLAR_JAVA" != ""; then
11097     ANT_HOME=; export ANT_HOME
11098     WITH_ANT_HOME=; export WITH_ANT_HOME
11099     if test -z "$with_ant_home"; then
11100         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11101     else
11102         if test "$_os" = "WINNT"; then
11103             with_ant_home=`cygpath -u "$with_ant_home"`
11104         fi
11105         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11106         WITH_ANT_HOME=$with_ant_home
11107         ANT_HOME=$with_ant_home
11108     fi
11110     if test -z "$ANT"; then
11111         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11112     else
11113         # resolve relative or absolute symlink
11114         while test -h "$ANT"; do
11115             a_cwd=`pwd`
11116             a_basename=`basename "$ANT"`
11117             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11118             cd "`dirname "$ANT"`"
11119             cd "`dirname "$a_script"`"
11120             ANT="`pwd`"/"`basename "$a_script"`"
11121             cd "$a_cwd"
11122         done
11124         AC_MSG_CHECKING([if $ANT works])
11125         cat > conftest.java << EOF
11126         public class conftest {
11127             int testmethod(int a, int b) {
11128                     return a + b;
11129             }
11130         }
11133         cat > conftest.xml << EOF
11134         <project name="conftest" default="conftest">
11135         <target name="conftest">
11136             <javac srcdir="." includes="conftest.java">
11137             </javac>
11138         </target>
11139         </project>
11142         oldJAVA_HOME=$JAVA_HOME
11143         if test "$JAVACISGCJ" = "yes"; then
11144             JAVA_HOME=; export JAVA_HOME
11145             ant_gcj="-Dbuild.compiler=gcj"
11146         fi
11147         AC_TRY_COMMAND("$ANT" $ant_gcj -buildfile conftest.xml 1>&2)
11148         if test $? = 0 -a -f ./conftest.class; then
11149             AC_MSG_RESULT([Ant works])
11150             if test -z "$WITH_ANT_HOME"; then
11151                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11152                 if test -z "$ANT_HOME"; then
11153                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11154                 fi
11155             else
11156                 ANT_HOME="$WITH_ANT_HOME"
11157             fi
11158         else
11159             echo "configure: Ant test failed" >&5
11160             cat conftest.java >&5
11161             cat conftest.xml >&5
11162             AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
11163             ANT_HOME=""
11164             add_warning "Ant does not work - Some Java projects will not build!"
11165         fi
11166         JAVA_HOME=$oldJAVA_HOME
11167         rm -f conftest* core core.* *.core
11168     fi
11169     if test -z "$ANT_HOME"; then
11170         ANT_HOME="NO_ANT_HOME"
11171     else
11172         PathFormat "$ANT_HOME"
11173         ANT_HOME="$formatted_path"
11174         PathFormat "$ANT"
11175         ANT="$ANT"
11176     fi
11177     AC_SUBST(ANT_HOME)
11178     AC_SUBST(ANT)
11180     dnl Checking for ant.jar
11181     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11182         AC_MSG_CHECKING([Ant lib directory])
11183         if test -f $ANT_HOME/lib/ant.jar; then
11184             ANT_LIB="$ANT_HOME/lib"
11185         else
11186             if test -f $ANT_HOME/ant.jar; then
11187                 ANT_LIB="$ANT_HOME"
11188             else
11189                 if test -f /usr/share/java/ant.jar; then
11190                     ANT_LIB=/usr/share/java
11191                 else
11192                     if test -f /usr/share/ant-core/lib/ant.jar; then
11193                         ANT_LIB=/usr/share/ant-core/lib
11194                     else
11195                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11196                             ANT_LIB="$ANT_HOME/lib/ant"
11197                         else
11198                             if test -f /usr/share/lib/ant/ant.jar; then
11199                                 ANT_LIB=/usr/share/lib/ant
11200                             else
11201                                 AC_MSG_ERROR([Ant libraries not found!])
11202                             fi
11203                         fi
11204                     fi
11205                 fi
11206             fi
11207         fi
11208         PathFormat "$ANT_LIB"
11209         ANT_LIB="$formatted_path"
11210         AC_MSG_RESULT([Ant lib directory found.])
11211     fi
11212     AC_SUBST(ANT_LIB)
11214     ant_minver=1.6.0
11215     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11217     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11218     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11219     ant_version_major=`echo $ant_version | cut -d. -f1`
11220     ant_version_minor=`echo $ant_version | cut -d. -f2`
11221     echo "configure: ant_version $ant_version " >&5
11222     echo "configure: ant_version_major $ant_version_major " >&5
11223     echo "configure: ant_version_minor $ant_version_minor " >&5
11224     if test "$ant_version_major" -ge "2"; then
11225         AC_MSG_RESULT([yes, $ant_version])
11226     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11227         AC_MSG_RESULT([yes, $ant_version])
11228     else
11229         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11230     fi
11232     if test "$ENABLE_MEDIAWIKI" = "YES"; then
11233         AC_MSG_CHECKING([whether Ant supports mapper type="regexp"])
11234         rm -rf confdir
11235         mkdir confdir
11236         cat > conftest.java << EOF
11237             public class conftest {
11238                 int testmethod(int a, int b) {
11239                     return a + b;
11240                 }
11241             }
11244         cat > conftest.xml << EOF
11245             <project name="conftest" default="conftest">
11246             <target name="conftest" depends="copytest">
11247                 <javac srcdir="." includes="conftest.java">
11248                 </javac>
11249             </target>
11250             <target name="copytest">
11251                  <copy todir="confdir">
11252                  <fileset dir="confdir" includes="**/*.abc" casesensitive="yes"/>
11253                  <filterset/>
11254                  <mapper type="regexp" from="^(.*[/\\])foo([/\\].*)" to="\1baa\2"/>
11255                  </copy>
11256             </target>
11257             </project>
11260         if test "$JAVACISGCJ" = "yes"; then
11261             JAVA_HOME=; export JAVA_HOME
11262             ant_gcj="-Dbuild.compiler=gcj"
11263         fi
11264         AC_TRY_COMMAND("$ANT" $ant_gcj -buildfile conftest.xml 1>&2)
11265         if test $? = 0 -a -f ./conftest.class; then
11266             AC_MSG_RESULT([yes])
11267             rm -rf confdir
11268         else
11269             echo "configure: Ant test failed" >&5
11270             cat conftest.java >&5
11271             cat conftest.xml >&5
11272             rm -rf confdir
11273             AC_MSG_ERROR([no. Did you install ant-apache-regexp?])
11274         fi
11275     fi
11276     rm -f conftest* core core.* *.core
11279 OOO_JUNIT_JAR=
11280 if test "$SOLAR_JAVA" != "" -a "$with_junit" != "no"; then
11281     AC_MSG_CHECKING([for JUnit 4])
11282     if test "$with_junit" = "yes"; then
11283         if test -e /usr/share/java/junit4.jar; then
11284             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11285         else
11286            if test -e /usr/share/lib/java/junit.jar; then
11287               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11288            else
11289               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11290            fi
11291         fi
11292     else
11293         OOO_JUNIT_JAR=$with_junit
11294     fi
11295     if test "$_os" = "WINNT"; then
11296         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11297     fi
11298     "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" 2>&5 | \
11299         grep org/junit/Before.class > /dev/null 2>&5
11300     if test $? -eq 0; then
11301         # check if either class-path entry is available for hamcrest or
11302         # it's bundled
11303         if "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" |$GREP -q hamcrest || \
11304             "$UNZIP" -c "$OOO_JUNIT_JAR" META-INF/MANIFEST.MF |$GREP 'Class-Path:' | $GREP -q 'hamcrest'; then
11305             AC_MSG_RESULT([$OOO_JUNIT_JAR])
11306         else
11307             AC_MSG_ERROR([your junit jar neither sets a classpath nor includes hamcrest; please
11308 provide a full junit jar or use --without-junit])
11309         fi
11310     else
11311         AC_MSG_RESULT([no])
11312         AC_MSG_ERROR([cannot find JUnit 4 jar; please install one in the default
11313 location (/usr/share/java), specify its pathname via
11314 --with-junit=..., or disable it via --without-junit])
11315     fi
11316     if test $OOO_JUNIT_JAR != ""; then
11317     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11318     fi
11320 AC_SUBST(OOO_JUNIT_JAR)
11323 AC_SUBST(SCPDEFS)
11326 # check for wget and curl
11328 WGET=
11329 CURL=
11331 if test "$enable_fetch_external" != "no"; then
11333 CURL=`which curl 2>/dev/null`
11335 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
11336     eval "$i --version" > /dev/null 2>&1
11337     ret=$?
11338     if test $ret -eq 0; then
11339         WGET=$i
11340         break
11341     fi
11342 done
11344 if test -z "$WGET" -a -z "$CURL"; then
11345     AC_MSG_ERROR([neither wget nor curl found!])
11350 AC_SUBST(WGET)
11351 AC_SUBST(CURL)
11354 # check for md5sum
11356 MD5SUM=
11358 for i in md5 md5sum /usr/local/bin/md5sum gmd5sum /usr/sfw/bin/md5sum /opt/sfw/bin/gmd5sum /opt/local/bin/md5sum; do
11359     if test "$i" = "md5"; then
11360         eval "$i -x" > /dev/null 2>&1
11361     else
11362         eval "$i --version" > /dev/null 2>&1
11363     fi
11364     ret=$?
11365     if test $ret -eq 0; then
11366         MD5SUM=$i
11367         break
11368     fi
11369 done
11371 if test "$MD5SUM" = "md5"; then
11372     if md5 -r < /dev/null > /dev/null 2>/dev/null; then
11373         MD5SUM="$MD5SUM -r"
11374     elif md5 -n < /dev/null > /dev/null 2>/dev/null; then
11375         MD5SUM="$MD5SUM -n"
11376     fi
11379 if test -z "$MD5SUM"; then
11380     AC_MSG_ERROR([no md5sum: found!])
11383 AC_SUBST(MD5SUM)
11385 dnl ===================================================================
11386 dnl Product version
11387 dnl ===================================================================
11388 AC_MSG_CHECKING([for product version])
11389 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
11390 AC_MSG_RESULT([$PRODUCTVERSION])
11391 AC_SUBST(PRODUCTVERSION)
11393 dnl ===================================================================
11394 dnl Dealing with l10n options
11395 dnl ===================================================================
11396 AC_MSG_CHECKING([which languages to be built])
11397 # get list of all languages
11398 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
11399 # the sed command does the following:
11400 #   + if a line ends with a backslash, append the next line to it
11401 #   + adds " on the beginning of the value (after =)
11402 #   + adds " at the end of the value
11403 #   + removes en-US; we want to put it on the beginning
11404 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
11405 [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)]
11406 ALL_LANGS="en-US $completelangiso"
11407 # check the configured localizations
11408 WITH_LANG="$with_lang"
11409 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
11410     AC_MSG_RESULT([en-US])
11411 else
11412     AC_MSG_RESULT([$WITH_LANG])
11413     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
11415 # check that the list is valid
11416 for lang in $WITH_LANG; do
11417     test "$lang" = "ALL" && continue
11418     # need to check for the exact string, so add space before and after the list of all languages
11419     for vl in $ALL_LANGS; do
11420         if test "$vl" = "$lang"; then
11421            break
11422         fi
11423     done
11424     if test "$vl" != "$lang"; then
11425         # if you're reading this - you prolly quoted your languages remove the quotes ...
11426         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
11427     fi
11428 done
11429 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
11430     echo $WITH_LANG | grep -q en-US
11431     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
11433 # list with substituted ALL
11434 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
11435 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
11436 test "$WITH_LANG" = "en-US" && WITH_LANG=
11437 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
11438     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
11439     ALL_LANGS=`echo $ALL_LANGS qtz`
11441 AC_SUBST(ALL_LANGS)
11442 AC_SUBST(WITH_LANG)
11443 AC_SUBST(WITH_LANG_LIST)
11444 AC_SUBST(GIT_NEEDED_SUBMODULES)
11446 WITH_POOR_HELP_LOCALIZATIONS=
11447 if test -d "$SRC_ROOT/translations/source"; then
11448     for l in `ls -1 $SRC_ROOT/translations/source`; do
11449         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
11450             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
11451         fi
11452     done
11454 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
11456 dnl git submodule update --reference
11457 dnl ===================================================================
11458 if test -n "${GIT_REFERENCE_SRC}"; then
11459     for repo in ${GIT_NEEDED_SUBMODULES}; do
11460         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
11461             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
11462         fi
11463     done
11465 AC_SUBST(GIT_REFERENCE_SRC)
11467 dnl branding
11468 dnl ===================================================================
11469 AC_MSG_CHECKING([for alternative branding images directory])
11470 # initialize mapped arrays
11471 BRAND_INTRO_IMAGES="flat_logo.svg intro.png"
11472 brand_files="$BRAND_INTRO_IMAGES about.svg \
11473     backing_left.png backing_right.png \
11474     backing_rtl_left.png backing_rtl_right.png \
11475     backing_space.png"
11477 if test -z "$with_branding" -o "$with_branding" = "no"; then
11478     AC_MSG_RESULT([none])
11479     DEFAULT_BRAND_IMAGES="$brand_files"
11480 else
11481     if ! test -d $with_branding ; then
11482         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
11483     else
11484         AC_MSG_RESULT([$with_branding])
11485         CUSTOM_BRAND_DIR="$with_branding"
11486         for lfile in $brand_files
11487         do
11488             if ! test -f $with_branding/$lfile ; then
11489                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
11490                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
11491             else
11492                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
11493             fi
11494         done
11495         check_for_progress="yes"
11496     fi
11498 AC_SUBST([BRAND_INTRO_IMAGES])
11499 AC_SUBST([CUSTOM_BRAND_DIR])
11500 AC_SUBST([CUSTOM_BRAND_IMAGES])
11501 AC_SUBST([DEFAULT_BRAND_IMAGES])
11504 AC_MSG_CHECKING([for 'intro' progress settings])
11505 PROGRESSBARCOLOR=
11506 PROGRESSSIZE=
11507 PROGRESSPOSITION=
11508 PROGRESSFRAMECOLOR=
11509 PROGRESSTEXTCOLOR=
11510 PROGRESSTEXTBASELINE=
11512 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
11513     source "$with_branding/progress.conf"
11514     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
11515 else
11516     AC_MSG_RESULT([none])
11519 AC_SUBST(PROGRESSBARCOLOR)
11520 AC_SUBST(PROGRESSSIZE)
11521 AC_SUBST(PROGRESSPOSITION)
11522 AC_SUBST(PROGRESSFRAMECOLOR)
11523 AC_SUBST(PROGRESSTEXTCOLOR)
11524 AC_SUBST(PROGRESSTEXTBASELINE)
11527 AC_MSG_CHECKING([for extra build ID])
11528 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
11529     EXTRA_BUILDID="$with_extra_buildid"
11531 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
11532 if test -n "$EXTRA_BUILDID" ; then
11533     AC_MSG_RESULT([$EXTRA_BUILDID])
11534 else
11535     AC_MSG_RESULT([not set])
11537 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
11539 OOO_VENDOR=
11540 AC_MSG_CHECKING([for vendor])
11541 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
11542     OOO_VENDOR="$USERNAME"
11544     if test -z "$OOO_VENDOR"; then
11545         OOO_VENDOR="$USER"
11546     fi
11548     if test -z "$OOO_VENDOR"; then
11549         OOO_VENDOR="`id -u -n`"
11550     fi
11552     AC_MSG_RESULT([not set, using $OOO_VENDOR])
11553 else
11554     OOO_VENDOR="$with_vendor"
11555     AC_MSG_RESULT([$OOO_VENDOR])
11557 AC_SUBST(OOO_VENDOR)
11559 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
11560 if test "$with_compat_oowrappers" = "yes"; then
11561     WITH_COMPAT_OOWRAPPERS=YES
11562     AC_MSG_RESULT(yes)
11563 else
11564     WITH_COMPAT_OOWRAPPERS=
11565     AC_MSG_RESULT(no)
11567 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
11569 AC_MSG_CHECKING([for product name])
11570 PRODUCTNAME=AC_PACKAGE_NAME
11571 AC_MSG_RESULT([$PRODUCTNAME])
11572 AC_SUBST(PRODUCTNAME)
11574 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | tr '[[:upper:]]' '[[:lower:]]'`
11575 AC_MSG_CHECKING([for install dirname])
11576 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
11577    INSTALLDIRNAME="$with_install_dirname"
11579 AC_MSG_RESULT([$INSTALLDIRNAME])
11580 AC_SUBST(INSTALLDIRNAME)
11582 AC_MSG_CHECKING([for prefix])
11583 test "x$prefix" = xNONE && prefix=$ac_default_prefix
11584 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
11585 PREFIXDIR="$prefix"
11586 AC_MSG_RESULT([$PREFIXDIR])
11587 AC_SUBST(PREFIXDIR)
11589 LIBDIR=[$(eval echo $(eval echo $libdir))]
11590 AC_SUBST(LIBDIR)
11592 DATADIR=[$(eval echo $(eval echo $datadir))]
11593 AC_SUBST(DATADIR)
11595 MANDIR=[$(eval echo $(eval echo $mandir))]
11596 AC_SUBST(MANDIR)
11598 DOCDIR=[$(eval echo $(eval echo $docdir))]
11599 AC_SUBST(DOCDIR)
11601 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
11602 AC_SUBST(INSTALLDIR)
11604 DEVINSTALLDIR="$OUTDIR/installation"
11605 AC_SUBST(DEVINSTALLDIR)
11607 # ===================================================================
11608 # De- or increase default verbosity of build process
11609 # ===================================================================
11610 AC_MSG_CHECKING([build verbosity])
11611 if test -n "$enable_verbose"; then
11612     if test "$enable_verbose" = "yes"; then
11613         VERBOSE="TRUE"
11614         AC_MSG_RESULT([high])
11615     fi
11616     if test "$enable_verbose" = "no"; then
11617         VERBOSE="FALSE"
11618         AC_MSG_RESULT([low])
11619     fi
11620 else
11621     AC_MSG_RESULT([not set])
11623 AC_SUBST(VERBOSE)
11625 dnl ===================================================================
11626 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
11627 dnl --enable-dependency-tracking configure option
11628 dnl ===================================================================
11629 AC_MSG_CHECKING([whether to enable dependency tracking])
11630 if test "$enable_dependency_tracking" = "no"; then
11631     nodep=TRUE
11632     AC_MSG_RESULT([no])
11633 else
11634     AC_MSG_RESULT([yes])
11636 AC_SUBST(nodep)
11638 dnl ===================================================================
11639 dnl Number of CPUs to use during the build
11640 dnl ===================================================================
11641 AC_MSG_CHECKING([for number of processors to use])
11642 # plain --with-parallelism is just the default
11643 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
11644     if test "$with_parallelism" = "no"; then
11645         PARALLELISM=1
11646     else
11647         PARALLELISM=$with_parallelism
11648     fi
11649 else
11650     if test "$enable_icecream" = "yes"; then
11651         PARALLELISM="10"
11652     else
11653         case `uname -s` in
11655         Darwin|FreeBSD|NetBSD|OpenBSD)
11656             PARALLELISM=`sysctl -n hw.ncpu`
11657             ;;
11659         Linux)
11660             PARALLELISM=`getconf _NPROCESSORS_ONLN`
11661         ;;
11662         # what else than above does profit here *and* has /proc?
11663         *)
11664             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
11665             ;;
11666         esac
11668         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
11669         # unexpected format, 'wc -l' will have returned 0.
11670         if test "$PARALLELISM" -eq 0; then
11671             PARALLELISM=1
11672         fi
11673     fi
11676 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
11677     if test -z "$with_parallelism"; then
11678             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
11679             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
11680             PARALLELISM="1"
11681     else
11682         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."
11683     fi
11686 AC_MSG_RESULT([$PARALLELISM])
11687 AC_SUBST(PARALLELISM)
11689 # ===================================================================
11690 # Number of parallel jobs to be executed during subsequenttest
11691 # ===================================================================
11692 AC_MSG_CHECKING([for maximum no. of jobs during subsequenttest])
11693 CHECK_PARALLELISM=$PARALLELISM
11694 if test "$with_check_jobs" != ""; then
11695     CHECK_PARALLELISM="$with_check_jobs"
11697 AC_MSG_RESULT([$CHECK_PARALLELISM])
11698 AC_SUBST(CHECK_PARALLELISM)
11701 # Set up ILIB for MSVC build
11703 if test "$build_os" = "cygwin"; then
11704     ILIB=".;${SOLARVER}/$INPATH/lib"
11705     if test -n "$JAVA_HOME" -a "$JAVA_HOME" != "NO_JAVA_HOME"; then
11706         ILIB="$ILIB;$JAVA_HOME/lib"
11707     fi
11708     if test "$BITNESS_OVERRIDE" = 64; then
11709         ILIB="$ILIB;$COMPATH/lib/amd64"
11710         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
11711         if test "$WINDOWS_SDK_VERSION" = "80"; then
11712             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/win8/um/x64"
11713         fi
11714     else
11715         ILIB="$ILIB;$COMPATH/lib"
11716         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
11717         if test "$WINDOWS_SDK_VERSION" = "80"; then
11718             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/win8/um/x86"
11719         fi
11720     fi
11721     ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
11723     if test "$ENABLE_DIRECTX" = "TRUE"; then
11724         ILIB="$ILIB;$DIRECTXSDK_LIB"
11725     fi
11726     AC_SUBST(ILIB)
11730 # ===================================================================
11731 # Creating bigger shared library to link against
11732 # ===================================================================
11733 AC_MSG_CHECKING([whether to create huge library])
11734 MERGELIBS=
11736 if test $_os = iOS -o $_os = Android; then
11737     # Never any point in mergelibs for these as we build just static
11738     # libraries anyway...
11739     enable_mergelibs=no
11742 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
11743     if test $_os != Linux -a $_os != WINNT; then
11744         add_warning "--enable-mergelibs is not tested for this platform"
11745     fi
11746     if test "$enable_mergelibs" = "all"; then
11747         MERGELIBS="ALL"
11748         URELIBS="TRUE"
11749     else
11750         MERGELIBS="CORE"
11751     fi
11752     AC_MSG_RESULT([yes])
11753 else
11754     AC_MSG_RESULT([no])
11756 AC_SUBST([MERGELIBS])
11757 AC_SUBST([URELIBS])
11759 # ===================================================================
11760 # Create hardlinks on deliver instead of copying for smaller size and speed up
11761 # ===================================================================
11762 AC_MSG_CHECKING([whether to create hardlinks for delivering files])
11763 HARDLINKDELIVER=
11764 if test "$enable_hardlink_deliver" = "yes"; then
11765     HARDLINKDELIVER="TRUE"
11766     AC_MSG_RESULT([yes])
11767 else
11768     AC_MSG_RESULT([no])
11770 AC_SUBST(HARDLINKDELIVER)
11772 dnl ===================================================================
11773 dnl icerun is a wrapper that stops us spawning tens of processes
11774 dnl locally - for tools that can't be executed on the compile cluster
11775 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
11776 dnl ===================================================================
11777 AC_MSG_CHECKING([whether to use icerun wrapper])
11778 ICECREAM_RUN=
11779 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
11780     ICECREAM_RUN=icerun
11781     AC_MSG_RESULT([yes])
11782 else
11783     AC_MSG_RESULT([no])
11785 AC_SUBST(ICECREAM_RUN)
11787 dnl ===================================================================
11789 AC_MSG_CHECKING([MPL subset])
11790 MPL_SUBSET=
11792 if test "$enable_mpl_subset" = "yes"; then
11793    if test "x$enable_postgresql_sdbc" != "xno"; then
11794         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the postgress database backend.])
11795    fi
11796    if test "$enable_lotuswordpro" = "yes"; then
11797         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
11798    fi
11799    if test "$enable_neon" != "no" -o "x$DISABLE_NEON" != "xTRUE"; then
11800         AC_MSG_ERROR([need to --disable-neon - webdav support.])
11801    fi
11802    if test "x$enable_ext_mariadb_connector" = "xyes"; then
11803         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
11804    fi
11805    if test "x$ENABLE_PDFIMPORT" != "xFALSE"; then
11806         if test "x$SYSTEM_POPPLER" != "xNO"; then
11807                 AC_MSG_ERROR([need to disable PDF import via xpdf/poplar or use system library])
11808         fi
11809    fi
11810    # cf. m4/libo_check_extension.m4
11811    if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
11812         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
11813    fi
11814    for theme in $WITH_THEMES; do
11815         case $theme in
11816             crystal|default|hicontrast|human|oxygen)
11817                 AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
11818             *) : ;;
11819         esac
11820    done
11821    if test "$enable_opengl" != "no" -o "x$ENABLE_OPENGL" == "xTRUE"; then
11822         AC_MSG_ERROR([need to --disable-opengl - GL transitions support.])
11823    fi
11824    if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" == "xTRUE"; then
11825         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
11826    fi
11828    MPL_SUBSET="TRUE"
11829    AC_DEFINE(MPL_HAVE_SUBSET)
11830    AC_MSG_RESULT([only])
11831 else
11832    AC_MSG_RESULT([no restrictions])
11834 AC_SUBST(MPL_SUBSET)
11837 dnl ===================================================================
11838 dnl Setting up the environment.
11839 dnl ===================================================================
11840 echo "setting up the build environment variables..."
11842 AC_SUBST(COMPATH)
11844 if test "$build_os" = "cygwin"; then
11845     if test "$DISABLE_ACTIVEX" = "YES"; then
11846         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
11847         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
11848     else
11849         ATL_LIB="$COMPATH/atlmfc/lib"
11850         ATL_INCLUDE="$COMPATH/atlmfc/include"
11851     fi
11852     if test "$BITNESS_OVERRIDE" = 64; then
11853         ATL_LIB="$ATL_LIB/amd64"
11854     fi
11855     PathFormat "/usr/bin/grep.exe"
11856     WIN_GREP="$formatted_path"
11857     PathFormat "/usr/bin/find.exe"
11858     WIN_FIND="$formatted_path"
11859     PathFormat "/usr/bin/ls.exe"
11860     WIN_LS="$formatted_path"
11861     PathFormat "/usr/bin/touch.exe"
11862     WIN_TOUCH="$formatted_path"
11865 AC_SUBST(ATL_INCLUDE)
11866 AC_SUBST(ATL_LIB)
11867 AC_SUBST(WIN_FIND)
11868 AC_SUBST(WIN_GREP)
11869 AC_SUBST(WIN_LS)
11870 AC_SUBST(WIN_TOUCH)
11872 AC_SUBST(BUILD_TYPE)
11874 AC_SUBST(SOLARINC)
11875 AC_SUBST(SOLARLIB)
11877 PathFormat "$PERL"
11878 PERL="$formatted_path"
11879 AC_SUBST(PERL)
11881 if test -n "$TMPDIR"; then
11882     TEMP_DIRECTORY="$TMPDIR"
11883 else
11884     TEMP_DIRECTORY="/tmp"
11886 if test "$build_os" = "cygwin"; then
11887     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
11889 AC_SUBST(TEMP_DIRECTORY)
11891 # setup the PATH for the environment
11892 if test -n "$LO_PATH_FOR_BUILD"; then
11893     LO_PATH="$LO_PATH_FOR_BUILD"
11894 else
11895     LO_PATH="$PATH"
11897     case "$host_os" in
11899     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
11900         if test "$SOLAR_JAVA" != "" -a "$JDK"!="gcj"; then
11901             pathmunge "$JAVA_HOME/bin" "after"
11902         fi
11903         ;;
11905     cygwin*)
11906         pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
11907         pathmunge "$ASM_HOME" "before"
11908         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
11909         pathmunge "$CSC_PATH" "before"
11910         pathmunge "$MIDL_PATH" "before"
11911         pathmunge "$AL_PATH" "before"
11912         pathmunge "$MSPDB_PATH" "before"
11913         if test "$BITNESS_OVERRIDE" = 64; then
11914             pathmunge "$COMPATH/bin/amd64" "before"
11915             pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
11916         else
11917             pathmunge "$COMPATH/bin" "before"
11918             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
11919         fi
11920         if test "$SOLAR_JAVA" != "" -a "$JDK"!="gcj"; then
11921             if test -d "$JAVA_HOME/jre/bin/client"; then
11922                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
11923             fi
11924             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
11925                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
11926             fi
11927             pathmunge "$JAVA_HOME/bin" "before"
11928         fi
11929         ;;
11931     solaris*)
11932         pathmunge "/usr/css/bin" "before"
11933         if test "$SOLAR_JAVA" != "" -a "$JDK"!="gcj"; then
11934             pathmunge "$JAVA_HOME/bin" "after"
11935         fi
11936         ;;
11937     esac
11939     pathmunge "$SRC_ROOT/solenv/$OUTPATH/bin" "before"
11940     pathmunge "$SRC_ROOT/solenv/bin" "before"
11941     pathmunge "." "before"
11944 AC_SUBST(LO_PATH)
11946 # Generate a configuration md5 we can use for deps
11947 if test -f config_host.mk; then
11948     config_md5=`$MD5SUM config_host.mk | sed "s/ .*//"`
11951 AC_CONFIG_FILES([config_host.mk Makefile lo.xcent instsetoo_native/util/openoffice.lst])
11952 AC_CONFIG_HEADERS([config_host/config_buildid.h])
11953 AC_CONFIG_HEADERS([config_host/config_clang.h])
11954 AC_CONFIG_HEADERS([config_host/config_features.h])
11955 AC_CONFIG_HEADERS([config_host/config_global.h])
11956 AC_CONFIG_HEADERS([config_host/config_graphite.h])
11957 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
11958 AC_CONFIG_HEADERS([config_host/config_mpl.h])
11959 AC_CONFIG_HEADERS([config_host/config_kde4.h])
11960 AC_CONFIG_HEADERS([config_host/config_mingw.h])
11961 AC_CONFIG_HEADERS([config_host/config_oox.h])
11962 AC_CONFIG_HEADERS([config_host/config_telepathy.h])
11963 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
11964 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
11965 AC_CONFIG_HEADERS([config_host/config_version.h])
11966 AC_OUTPUT
11968 if test "$CROSS_COMPILING" = YES; then
11969     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
11972 # touch the config timestamp file
11973 if test ! -f config_host.mk.stamp; then
11974     echo > config_host.mk.stamp
11975 elif test "$config_md5" = `$MD5SUM config_host.mk | sed "s/ .*//"`; then
11976     echo "Configuration unchanged - avoiding scp2 stamp update"
11977 else
11978     echo > config_host.mk.stamp
11982 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
11983 cat << _EOS
11984 ****************************************************************************
11985 WARNING:
11986 Your make version is known to be horribly slow, and hard to debug
11987 problems with. To get a reasonably functional make please do:
11989 to install a pre-compiled binary make for cygwin
11991 mkdir -p /opt/lo/bin
11992 cd /opt/lo/bin
11993 wget http://dev-www.libreoffice.org/bin/cygwin/make
11994 chmod +x make
11996 to install from source:
11997 place yourself in a working directory of you choice.
11999 git clone git://anongit.freedesktop.org/libreoffice/contrib/dev-tools
12000 cd dev-tools/make-3.82-gbuild
12001 ./configure --prefix=/opt/lo
12002 make
12003 sudo make install
12005 Then re-run autogen.sh
12007 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12008 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12010 _EOS
12013 cat << _EOF
12014 ****************************************************************************
12015 To build, issue:
12016 $GNUMAKE
12018 run: $GNUMAKE help
12019 for details
12021 _EOF
12023 if test $_os != WINNT -a "$CROSS_COMPILING" != YES; then
12024     cat << _EOF
12026 To install when the build is finished, issue:
12027 $GNUMAKE install
12029 If you want to develop LibreOffice, you might prefer:
12030 $GNUMAKE dev-install
12032 If you want to run the smoketest, issue:
12033 $GNUMAKE check
12035 _EOF
12038 if test -f warn; then
12039     cat warn
12040     rm warn
12043 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: