Updated core
[LibreOffice.git] / configure.ac
blob86d0f7527e54d59cb29079fa56c1e0ef94979435
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 102 -*-
2 dnl configure.ac serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 # The version number in the second argumemnt to AC_INIT should be four numbers separated by
6 # periods. Some parts of the code requires the first one to be less than 128 and the others to be less
7 # than 256. The four numbers can optionally be followed by a period and a free-form string containing
8 # no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
9 # several non-alphanumeric characters, those are split off and used only for the
10 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
12 AC_INIT([LibreOffice],[4.1.0.0.alpha0+],[],[],[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_HOME)
333 AC_SUBST(ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR)
334 AC_SUBST(ANDROID_NDK_GDBSERVER)
335 AC_SUBST(ANDROID_APP_ABI)
337 dnl ===================================================================
338 dnl Also --with-android-sdk is mandatory
339 dnl ===================================================================
340 ANDROID_SDK_HOME=
341 if test -n "$with_android_sdk"; then
342    ANDROID_SDK_HOME=$with_android_sdk
343    PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
345 AC_SUBST(ANDROID_SDK_HOME)
347 dnl ===================================================================
348 dnl The following is a list of supported systems.
349 dnl Sequential to keep the logic very simple
350 dnl These values may be checked and reset later.
351 dnl ===================================================================
352 #defaults unless the os test overrides this:
353 test_randr=yes
354 test_xrender=yes
355 test_cups=yes
356 test_dbus=yes
357 test_fontconfig=yes
358 test_cairo=no
360 # Default values, as such probably valid just for Linux, set
361 # differently below just for Mac OSX,but at least better than
362 # hardcoding these as we used to do. Much of this is duplicated also
363 # in solenv for old build system and for gbuild, ideally we should
364 # perhaps define stuff like this only here in configure.ac?
366 LINKFLAGSSHL="-shared"
367 PICSWITCH="-fpic"
368 DLLPOST=".so"
370 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
372 case "$host_os" in
374 solaris*)
375     test_gtk=yes
376     build_gstreamer=yes
377     build_gstreamer_0_10=yes
378     test_tde=yes
379     test_kde=yes
380     test_freetype=yes
381     test_gstreamer=yes
382     _os=SunOS
384     dnl ===========================================================
385     dnl Check whether we're using Solaris 10 - SPARC or Intel.
386     dnl ===========================================================
387     AC_MSG_CHECKING([the Solaris operating system release])
388     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
389     if test "$_os_release" -lt "10"; then
390         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
391     else
392         AC_MSG_RESULT([ok ($_os_release)])
393     fi
395     dnl Check whether we're using a SPARC or i386 processor
396     AC_MSG_CHECKING([the processor type])
397     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
398         AC_MSG_RESULT([ok ($host_cpu)])
399     else
400         AC_MSG_ERROR([only SPARC and i386 processors are supported])
401     fi
402     ;;
404 linux-gnu*|k*bsd*-gnu*)
405     test_gtk=yes
406     build_gstreamer=yes
407     build_gstreamer_0_10=yes
408     test_tde=yes
409     test_kde=yes
410     test_kde4=yes
411     test_freetype=yes
412     test_unix_quickstarter=yes
413     _os=Linux
414     ;;
416 gnu)
417     test_randr=no
418     test_xrender=no
419     _os=GNU
420      ;;
422 cygwin*|interix*|mingw32*)
424     # When building on Windows normally with MSVC under Cygwin,
425     # configure thinks that the host platform (the platform the
426     # built code will run on) is Cygwin, even if it obviously is
427     # Windows, which in Autoconf terminology is called
428     # "mingw32". (Which is misleading as MinGW is the name of the
429     # tool-chain, not an operating system.)
431     # Somewhat confusing, yes. But this configure script doesn't
432     # look at $host etc that much, it mostly uses its own $_os
433     # variable, set here in this case statement.
435     # When cross-compiling to Windows from Unix, the host platform
436     # is "mingw32" (because in that case it is the MinGW
437     # tool-chain that is used).
439     test_cups=no
440     test_dbus=no
441     test_randr=no
442     test_xrender=no
443     test_freetype=no
444     test_fontconfig=no
445     _os=WINNT
446     use_shl_version="TRUE"
447     DYNAMIC_CRT="TRUE"
449     DLLPOST=".dll"
450     LINKFLAGSNOUNDEFS=
452     # If the host OS matches "mingw32*", that means we are using the
453     # MinGW cross-compiler, because we don't see the point in building
454     # LibreOffice using MinGW on Windows. If you want to build on
455     # Windows, use MSVC. If you want to use MinGW, surely you want to
456     # cross-compile (from Linux or some other Unix).
458     case "$host_os" in
459     mingw32*)
460         WITH_MINGW=yes
461         if test -z "$CC"; then
462             CC="$host_cpu-$host_vendor-$host_os-gcc"
463         fi
464         if test -z "$CXX"; then
465             CXX="$host_cpu-$host_vendor-$host_os-g++"
466         fi
467         ;;
468     esac
469     ;;
471 darwin*) # Mac OS X or iOS
472     test_gtk=yes
473     test_randr=no
474     test_xrender=no
475     test_freetype=no
476     test_fontconfig=no
477     test_dbus=no
478     if test "$host_cpu" = "arm"; then
479         _os=iOS
480         test_gtk=no
481         test_cups=no
482     else
483         _os=Darwin
484     fi
485     enable_systray=no
486     # See comment above the case "$host_os"
487     LINKFLAGSSHL="-dynamiclib -single_module"
489     # -fPIC is default
490     PICSWITCH=""
492     DLLPOST=".dylib"
494     # -undefined error is the default
495     LINKFLAGSNOUNDEFS=""
498 freebsd*)
499     test_gtk=yes
500     build_gstreamer=yes
501     build_gstreamer_0_10=yes
502     test_tde=yes
503     test_kde=yes
504     test_kde4=yes
505     test_freetype=yes
506     AC_MSG_CHECKING([the FreeBSD operating system release])
507     if test -n "$with_os_version"; then
508         OSVERSION="$with_os_version"
509     else
510         OSVERSION=`/sbin/sysctl -n kern.osreldate`
511     fi
512     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
513     AC_MSG_CHECKING([which thread library to use])
514     if test "$OSVERSION" -lt "500016"; then
515         PTHREAD_CFLAGS="-D_THREAD_SAFE"
516         PTHREAD_LIBS="-pthread"
517     elif test "$OSVERSION" -lt "502102"; then
518         PTHREAD_CFLAGS="-D_THREAD_SAFE"
519         PTHREAD_LIBS="-lc_r"
520     else
521         PTHREAD_CFLAGS=""
522         PTHREAD_LIBS="-pthread"
523     fi
524     AC_MSG_RESULT([$PTHREAD_LIBS])
525     _os=FreeBSD
526     ;;
528 *netbsd*)
529     test_gtk=yes
530     build_gstreamer=yes
531     build_gstreamer_0_10=yes
532     test_tde=no
533     test_kde=no
534     test_kde4=yes
535     test_freetype=yes
536     PTHREAD_LIBS="-pthread -lpthread"
537     _os=NetBSD
538     ;;
540 aix*)
541     test_randr=no
542     test_freetype=yes
543     PTHREAD_LIBS=-pthread
544     _os=AIX
545     ;;
547 openbsd*)
548     test_gtk=yes
549     test_tde=yes
550     test_kde=yes
551     test_freetype=yes
552     PTHREAD_CFLAGS="-D_THREAD_SAFE"
553     PTHREAD_LIBS="-pthread"
554     _os=OpenBSD
555     ;;
557 dragonfly*)
558     test_gtk=yes
559     build_gstreamer=yes
560     build_gstreamer_0_10=yes
561     test_tde=yes
562     test_kde=yes
563     test_kde4=yes
564     test_freetype=yes
565     PTHREAD_LIBS="-pthread"
566     _os=DragonFly
567     ;;
569 linux-android*)
570     build_gstreamer=no
571     build_gstreamer_0_10=no
572     test_cups=no
573     test_dbus=no
574     test_fontconfig=no
575     test_freetype=no
576     test_gtk=no
577     test_tde=no
578     test_kde=no
579     test_kde4=no
580     test_randr=no
581     test_xrender=no
582     test_unix_quickstarter=no
583     _os=Android
585     if test -z "$with_android_ndk"; then
586         AC_MSG_ERROR([the --with-android-ndk option is mandatory])
587     fi
589     if test -z "$with_android_ndk_toolchain_version"; then
590         AC_MSG_ERROR([the --with-android-ndk-toolchain-version option is mandatory])
591     fi
593     if test -z "$with_android_sdk"; then
594         AC_MSG_ERROR([the --with-android-sdk option is mandatory])
595     fi
597     # Verify that the NDK and SDK options are proper
598     if test ! -f "$ANDROID_NDK_HOME/platforms/android-9/arch-arm/usr/lib/libc.a"; then
599         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
600     fi
602     if test ! -d "$ANDROID_SDK_HOME/platforms"; then
603         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
604     fi
606     BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
607     ;;
610     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
611     ;;
612 esac
614 if test "$_os" = "AIX"; then
615     AC_PATH_PROG(GAWK, gawk)
616     if test -z "$GAWK"; then
617         AC_MSG_ERROR([gawk not found in \$PATH])
618     fi
621 AC_SUBST(use_shl_version)
622 AC_SUBST(DYNAMIC_CRT)
624 AC_SUBST(WITH_MINGW)
625 AC_SUBST(OSVERSION)
626 AC_SUBST(PTHREAD_CFLAGS)
627 AC_SUBST(PTHREAD_LIBS)
629 ###############################################################################
630 # Extensions switches --enable/--disable
631 ###############################################################################
632 # By default these should be enabled unless having extra dependencies.
633 # If there is extra dependency over configure options then the enable should
634 # be automagic based on whether the requiring feature is enabled or not.
635 # All this options change anything only with --enable-extension-integration.
637 # The name of this option and its help string makes it sound as if
638 # extensions are built anyway, just not integrated in the installer,
639 # if you use --disable-extension-integration. Is that really the
640 # case?
642 AC_ARG_ENABLE(extension-integration,
643     AS_HELP_STRING([--disable-extension-integration],
644         [Disable integration of the built extensions in the installer of the
645          product. Use this switch to disable the integration.])
648 AC_ARG_ENABLE(export,
649     AS_HELP_STRING([--disable-export],
650         [Disable (some) code for document export. Useful when building viewer-only apps that lack
651          save/export functionality, to avoid having an excessive amount of code and data used
652          only for exporrt linked in. Work in progress, use only if you are hacking on it.])
655 AC_ARG_ENABLE(database-connectivity,
656     AS_HELP_STRING([--disable-database-connectivity],
657         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
660 # This doesn't mean not building (or "integrating") extensions
661 # (although it probably should; i.e. it should imply
662 # --disable-extension-integration I guess), it means not supporting
663 # any extension mechanism at all
664 AC_ARG_ENABLE(extensions,
665     AS_HELP_STRING([--disable-extensions],
666         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
669 AC_ARG_ENABLE(scripting,
670     AS_HELP_STRING([--disable-scripting],
671         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
674 # This is mainly for Android and iOS, but could potentially be used in some
675 # special case otherwise, too, so factored out as a separate setting
677 AC_ARG_ENABLE(dynamic-loading,
678     AS_HELP_STRING([--disable-dynamic-loading],
679         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
682 AC_ARG_ENABLE(ext-mariadb-connector,
683     AS_HELP_STRING([--enable-ext-mariadb-connector],
684         [Enable the build of the MariaDB/MySQL Connector extension.])
687 AC_ARG_ENABLE(ext-presenter-minimizer,
688     AS_HELP_STRING([--disable-ext-presenter-minimizer],
689         [Disable the Presentation Minimizer extension.])
692 AC_ARG_ENABLE(report-builder,
693     AS_HELP_STRING([--disable-report-builder],
694         [Disable the Report Builder.])
697 AC_ARG_ENABLE(ext-wiki-publisher,
698     AS_HELP_STRING([--enable-ext-wiki-publisher],
699         [Enable the Wiki Publisher extension.])
701 ###############################################################################
703 dnl ---------- *** ----------
705 AC_ARG_ENABLE([hardlink-deliver],
706     AS_HELP_STRING([--enable-hardlink-deliver],
707         [Put files into deliver folder as hardlinks instead of copying them
708         over. Saves space and speeds up build.])
711 AC_ARG_ENABLE(mergelibs,
712     AS_HELP_STRING([--enable-mergelibs=<all/yes>],
713         [Enables linking of big, merged, library. Experimental feature tested
714         only on Linux and Android. All will link a lot more libraries into libmerged
715         while yes or no argument will simply enable a core set of libraries.])
718 AC_ARG_ENABLE(graphite,
719     AS_HELP_STRING([--enable-graphite],
720         [Enables the compilation of Graphite smart font rendering.])
723 AC_ARG_ENABLE(harfbuzz,
724     AS_HELP_STRING([--enable-harfbuzz],
725         [Determines whether to use HarfBuzz text layout engine.])
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(mathmldtd,
772     AS_HELP_STRING([--enable-mathmldtd],
773         [Enable bundling of (modified) MathML 1.01 DTD.])
776 AC_ARG_ENABLE(evolution2,
777     AS_HELP_STRING([--enable-evolution2],
778         [Allows the built-in evolution 2 addressbook connectivity build to be
779          enabled.])
782 AC_ARG_ENABLE(directx,
783     AS_HELP_STRING([--disable-directx],
784         [Remove DirectX implementation for the new XCanvas interface.
785          The DirectX support requires more stuff installed on Windows to
786          compile. (DirectX SDK, GDI+ libs)])
789 AC_ARG_ENABLE(activex,
790     AS_HELP_STRING([--disable-activex],
791         [Disable the use of ActiveX for a Windows build.
792         This switch is mandatory when using VC++ 2008 Express.])
795 AC_ARG_ENABLE(atl,
796     AS_HELP_STRING([--disable-atl],
797         [Disable the use of ATL for a Windows build.])
798     [
799                           This switch is mandatory when using VC++ 2008 Express.
800     ],
803 AC_ARG_ENABLE(werror,
804     AS_HELP_STRING([--enable-werror],
805         [Turn warnings to errors. (Has no effect in modules where the treating
806          of warnings as errors is disabled explicitly.)]),
809 AC_ARG_ENABLE(assert-always-abort,
810     AS_HELP_STRING([--enable-assert-always-abort],
811         [make assert() abort even in release code.]),
814 AC_ARG_ENABLE(dbgutil,
815     AS_HELP_STRING([--enable-dbgutil],
816         [Provide debugging support from --enable-debug and include additional debugging
817          utilities such as object counting or more expensive checks.
818          This is the recommended option for developers.
819          Note that this makes the build ABI incompatible, it is not possible to mix object
820          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
822 AC_ARG_ENABLE(debug,
823     AS_HELP_STRING([--enable-debug],
824         [Include debugging information, disable compiler optimization and inlining plus
825          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
827 AC_ARG_ENABLE(selective-debuginfo,
828     AS_HELP_STRING([--enable-selective-debuginfo],
829         [If --enable-debug or --enable-dbgutil is used, build debugging information
830          (-g compiler flag) only for the specified gbuild build targets
831          (where all means everything, - prepended means not to enable, / appended means
832          everything in the directory; there is no ordering, more specific overrides
833          more general, and disabling takes precedence).
834          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
836 AC_ARG_ENABLE(symbols,
837     AS_HELP_STRING([--enable-symbols],
838         [Include debugging symbols in output while preserve optimization.
839          This enables -g compiler flag for GCC or equivalent,
840          without changing anything else compared to productive code.]))
842 AC_ARG_ENABLE(compiler-plugins,
843     AS_HELP_STRING([--enable-compiler-plugins],
844         [Enable compiler plugins that will perform additional checks during
845          building. Enabled automatically by --enable-dbgutil.]))
847 AC_ARG_ENABLE(linkoo,
848     AS_HELP_STRING([--disable-linkoo],
849         [Disable linkoo for the smoketest installation.]))
851 AC_ARG_ENABLE(lto,
852     AS_HELP_STRING([--enable-lto],
853         [Enable link-time optimization. Suitable for product builds.
854          Building takes longer but libraries are optimized for speed.
855          (possible only with gcc-4.5 or later,
856           better to use gcc-4.6 and 'gold' as linker)]))
858 AC_ARG_ENABLE(crashdump,
859     AS_HELP_STRING([--enable-crashdump],
860         [Enable the crashdump feature.]))
862 AC_ARG_ENABLE(python,
863     AS_HELP_STRING([--enable-python=<no/auto/system/internal>],
864         [Enables or disables Python support at run-time and build-time.
865          Also specifies what Python to use. 'auto' is the
866          default. Note that Python can be disabled with
867          --disable-python or --enable-python=no only if no
868          translations are required.]))
870 AC_ARG_ENABLE(gtk,
871     AS_HELP_STRING([--disable-gtk],
872         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
873 ,enable_gtk=yes)
875 AC_ARG_ENABLE(gtk3,
876     AS_HELP_STRING([--enable-gtk3],
877         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
878 ,enable_gtk3=no)
880 AC_ARG_ENABLE(systray,
881     AS_HELP_STRING([--disable-systray],
882         [Determines whether to build the systray quickstarter.]),
883 ,enable_systray=yes)
885 AC_ARG_ENABLE(split-app-modules,
886     AS_HELP_STRING([--enable-split-app-modules],
887         [Split file lists for app modules, e.g. base, calc.
888          Has effect only with make distro-pack-install]),
891 AC_ARG_ENABLE(split-opt-features,
892     AS_HELP_STRING([--enable-split-opt-features],
893         [Split file lists for some optional features, .e.g. pyuno, testtool.
894          Has effect only with make distro-pack-install]),
897 AC_ARG_ENABLE(cairo-canvas,
898 [  --disable-cairo-canvas  Determines whether to build the Cairo canvas on
899                           platforms where Cairo is available.
902 AC_ARG_ENABLE(opengl,
903     AS_HELP_STRING([--disable-opengl],
904         [Determines whether to build the OpenGL 3D slide transitions component.]))
906 AC_ARG_ENABLE(dbus,
907     AS_HELP_STRING([--disable-dbus],
908         [Determines whether to enable features that depend on dbus.
909          e.g. Presentation mode screensaver control, bluetooth presentation control]),
910 ,enable_dbus=yes)
912 AC_ARG_ENABLE(packagekit,
913     AS_HELP_STRING([--enable-packagekit],
914         [Determines whether to enable features using packagekit.
915          Right now that is auto font install]),
918 AC_ARG_ENABLE(sdremote,
919     AS_HELP_STRING([--disable-sdremote],
920         [Determines whether to enable Impress remote control.]),
921 ,enable_sdremote=yes)
923 AC_ARG_ENABLE(sdremote-bluetooth,
924     AS_HELP_STRING([--disable-sdremote-bluetooth],
925         [Determines whether to build sdremote with bluetooth support.
926          Requires dbus on Linux.]))
928 AC_ARG_ENABLE(gconf,
929     AS_HELP_STRING([--disable-gconf],
930         [Determines whether to use the GConf support.]),
931 ,enable_gconf=yes)
933 AC_ARG_ENABLE(gnome-vfs,
934     AS_HELP_STRING([--enable-gnome-vfs],
935         [Determines whether to use the Gnome Virtual Filing System on platforms
936          where that VFS is available.]),
937 ,enable_gnome_vfs=no)
939 AC_ARG_ENABLE(gio,
940     AS_HELP_STRING([--disable-gio],
941         [Determines whether to use the GIO support.]),
942 ,enable_gio=yes)
944 AC_ARG_ENABLE(telepathy,
945     AS_HELP_STRING([--enable-telepathy],
946         [Determines whether to enable Telepathy for collaboration.]),
947 ,enable_telepathy=no)
949 AC_ARG_ENABLE(tde,
950     AS_HELP_STRING([--enable-tde],
951         [Determines whether to use TQt/TDE vclplug on platforms where TQt and
952          TDE are available.]),
955 AC_ARG_ENABLE(tdeab,
956     AS_HELP_STRING([--disable-tdeab],
957         [Disable the TDE address book support.]),
959     if test "$enable_tde" = "yes"; then
960         enable_tdeab=yes
961     fi
964 AC_ARG_ENABLE(kde,
965     AS_HELP_STRING([--enable-kde],
966         [Determines whether to use Qt3/KDE3 vclplug on platforms where Qt3 and
967          KDE3 are available.]),
970 AC_ARG_ENABLE(kdeab,
971     AS_HELP_STRING([--disable-kdeab],
972         [Disable the KDE3 address book support.]),
974     if test "$enable_kde" = "yes"; then
975         enable_kdeab=yes
976     fi
979 AC_ARG_ENABLE(kde4,
980     AS_HELP_STRING([--enable-kde4],
981         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
982          KDE4 are available. May be used with --enable-kde if you want to support
983          both KDE3 and KDE4.]),
986 AC_ARG_ENABLE(headless,
987     AS_HELP_STRING([--enable-headless],
988         [Disable building of GUIs to reduce dependencies. Useful for
989         server usage. Work in progress, use only if you are hacking on
990         it. Not related to the --headless option.]), ,)
992 AC_ARG_ENABLE(unix-qstart-libpng,
993     AS_HELP_STRING([--disable-unix-qstart-libpng],
994         [On UNIX systems, we have a faster splash app, that can use libpng to
995          render its splash, if we can safely link to the system libpng then
996          enabling this is a good idea (ie. for Linux Distro packaging).]),
997 ,enable_unix_qstart_libpng=yes)
999 AC_ARG_ENABLE(rpath,
1000     AS_HELP_STRING([--disable-rpath],
1001         [Disable the use of relative paths in shared libraries.]),
1004 AC_ARG_ENABLE(randr,
1005     AS_HELP_STRING([--disable-randr],
1006         [Disable RandR support in the vcl project.]),
1007 ,enable_randr=yes)
1009 AC_ARG_ENABLE(randr-link,
1010     AS_HELP_STRING([--disable-randr-link],
1011         [Disable linking with libXrandr, instead dynamically open it at runtime.]),
1012 ,enable_randr_link=yes)
1014 AC_ARG_ENABLE(gstreamer,
1015     AS_HELP_STRING([--enable-gstreamer],
1016         [Enable building with the new gstreamer 1.0 avmedia backend.]),
1017 ,enable_gstreamer=no)
1019 AC_ARG_ENABLE(gstreamer-0-10,
1020     AS_HELP_STRING([--disable-gstreamer-0-10],
1021         [Disable building the gstreamer avmedia backend.]),
1022 ,enable_gstreamer_0_10=yes)
1024 AC_ARG_ENABLE(neon,
1025     AS_HELP_STRING([--disable-neon],
1026         [Disable neon and the compilation of webdav binding.]),
1029 AC_ARG_ENABLE(cve-tests,
1030     AS_HELP_STRING([--disable-cve-tests],
1031         [Prevent CVE tests to be executed]),
1034 AC_ARG_ENABLE(build-unowinreg,
1035     AS_HELP_STRING([--enable-build-unowinreg],
1036         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1037          compiler is needed on Linux.])
1038     [
1039                           Usage:     --enable-build-unowinreg
1040     ],
1043 AC_ARG_ENABLE(verbose,
1044     AS_HELP_STRING([--enable-verbose],
1045         [Increase build verbosity.])[
1046   --disable-verbose       Decrease build verbosity.],
1049 AC_ARG_ENABLE(dependency-tracking,
1050     AS_HELP_STRING([--enable-dependency-tracking],
1051         [Do not reject slow dependency extractors.])[
1052   --disable-dependency-tracking
1053                           Disables generation of dependency information.
1054                           Speed up one-time builds.],
1057 AC_ARG_ENABLE(icecream,
1058     AS_HELP_STRING([--enable-icecream],
1059         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1060          It defaults to /opt/icecream for the location of the icecream gcc/g++
1061          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1064 AC_ARG_ENABLE(cups,
1065     AS_HELP_STRING([--disable-cups],
1066         [Do not build cups support.])
1069 AC_ARG_ENABLE(ccache,
1070     AS_HELP_STRING([--disable-ccache],
1071         [Do not try to use ccache automatically.
1072          By default, we will try to detect if ccache is available; in that case if
1073          CC/CXX are not yet set, and --enable-icecream is not given, we
1074          attempt to use ccache. --disable-ccache disables ccache completely.
1078 AC_ARG_ENABLE(64-bit,
1079     AS_HELP_STRING([--enable-64-bit],
1080         [Build a 64-bit LibreOffice on platforms where the normal and only supported build
1081          is 32-bit. In other words, this option is experimental and possibly quite broken,
1082          use only if you are hacking on 64-bit support.]), ,)
1084 AC_ARG_ENABLE(extra-gallery,
1085     AS_HELP_STRING([--enable-extra-gallery],
1086         [Add extra gallery content.]),
1089 AC_ARG_ENABLE(extra-template,
1090     AS_HELP_STRING([--enable-extra-template],
1091         [Add extra template content.]),
1094 AC_ARG_ENABLE(extra-sample,
1095     AS_HELP_STRING([--enable-extra-sample],
1096         [Add extra sample content.]),
1099 AC_ARG_ENABLE(extra-font,
1100     AS_HELP_STRING([--enable-extra-font],
1101         [Add extra font content.]),
1104 AC_ARG_ENABLE(online-update,
1105     AS_HELP_STRING([--enable-online-update],
1106         [Enable the online update service that will check for new versions of
1107          LibreOffice. By default, it is on on Windows and Mac, and off on Linux.]),
1110 AC_ARG_ENABLE(release-build,
1111     AS_HELP_STRING([--enable-release-build],
1112         [Enable release build.
1113          See http://wiki.documentfoundation.org/DevBuild]),
1116 AC_ARG_ENABLE(windows-build-signing,
1117     AS_HELP_STRING([--enable-windows-build-signing],
1118         [Enable signing of windows binaries (*.exe, *.dll)]),
1121 AC_ARG_ENABLE(silent-msi,
1122     AS_HELP_STRING([--enable-silent-msi],
1123         [Enable MSI with LIMITUI=1 (silent install).]),
1126 AC_ARG_ENABLE(desktop-gui-elements,
1127     AS_HELP_STRING([--enable-desktop-gui-elements],
1128         [Enable display and use of desktop style GUI elements
1129          even on a non-desktop platform.]),
1132 AC_ARG_ENABLE(macosx-code-signing,
1133     AS_HELP_STRING([--enable-macosx-code-signing<=identity>],
1134         [Sign executables, dylibs, frameworks and the app bundle. The
1135          default is to do signing if there is a suitable certificate
1136          in your keychain, so if you don't want that, use the
1137          corresponding --disable option. Experimental work in
1138          progress, don't use unless you are working on this.]),
1141 AC_ARG_ENABLE(macosx-sandbox,
1142     AS_HELP_STRING([--enable-macosx-sandbox],
1143         [Make the app bundle run in a sandbox. Requires code signing.
1144          The default is to not do this. Experimental work in progress,
1145          don't use unless you are working on this.]),
1148 AC_ARG_WITH(macosx-bundle-identifier,
1149     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1150         [Define the OS X bundle identifier. Default is the somewhat weird
1151          org.libreoffice.script ("script", huh?).]),
1152 ,with_macosx_bundle_identifier=org.libreoffice.script)
1154 AC_ARG_ENABLE(ios-simulator,
1155     AS_HELP_STRING([--enable-ios-simulator],
1156         [Build for the iOS Simulator, not iOS device.]),
1159 AC_ARG_ENABLE(readonly-installset,
1160     AS_HELP_STRING([--enable-readonly-installset],
1161         [Prevents any attempts by LibreOffice to write into its installation. That means
1162          at least that no "system-wide" extensions can be added. Experimental work in
1163          progress.]),
1166 AC_ARG_ENABLE(postgresql-sdbc,
1167     AS_HELP_STRING([--disable-postgresql-sdbc],
1168         [Disable the build of the PostgreSQL-SDBC driver.])
1171 AC_ARG_ENABLE(lotuswordpro,
1172     AS_HELP_STRING([--disable-lotuswordpro],
1173         [Disable the build of the Lotus Word Pro filter.]),
1174 ,enable_lotuswordpro=yes)
1176 AC_ARG_ENABLE(coretext,
1177     AS_HELP_STRING([--enable-coretext],
1178         [Use CoreText framework on Mac (instead of ATSU).
1179         Known to not work properly, use only if you plan to work on that.]),
1182 AC_ARG_ENABLE(winegcc,
1183     AS_HELP_STRING([--enable-winegcc],
1184         [Enable use of winegcc during the build, in order to create msi* tools
1185          needed for MinGW cross-compilation.]),
1188 AC_ARG_ENABLE(liblangtag,
1189     AS_HELP_STRING([--disable-liblangtag],
1190         [Disable use of liblangtag, and instead use an own simple
1191          implementation.]),
1194 AC_ARG_ENABLE(bogus-pkg-config,
1195     AS_HELP_STRING([--enable-bogus-pkg-config],
1196         [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.]),
1199 AC_ARG_ENABLE(openssl,
1200     AS_HELP_STRING([--disable-openssl],
1201         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1202          components will either use GNUTLS or NSS. Work in progress,
1203          use only if you are hacking on it.]),
1204 ,enable_openssl=yes)
1206 dnl ===================================================================
1207 dnl Optional Packages (--with/without-)
1208 dnl ===================================================================
1210 AC_ARG_WITH(gnu-patch,
1211     AS_HELP_STRING([--with-gnu-patch],
1212         [Specify location of GNU patch on Solaris or FreeBSD.]),
1215 AC_ARG_WITH(build-platform-configure-options,
1216         [Specify options for the configure script run for the *build* platform in a cross-compilation])
1218 AC_ARG_WITH(gnu-cp,
1219     AS_HELP_STRING([--with-gnu-cp],
1220         [Specify location of GNU cp on Solaris or FreeBSD.]),
1223 AC_ARG_WITH(external-tar,
1224     AS_HELP_STRING([--with-external-tar=<TARFILE PATH>],
1225         [Specify path to tarfiles manually.]),
1226     TARFILE_LOCATION=$withval ,
1229 AC_ARG_WITH(solver-and-workdir-root,
1230     AS_HELP_STRING([--with-solver-and-workdir-root=<PATH>],
1231         [Specify path that contains SOLARVER and WORKDIR directories manually.])
1234 AC_ARG_WITH(referenced-git,
1235     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1236         [Specify another checkout directory to reference. This makes use of
1237                  git submodule update --reference, and saves a lot of diskspace
1238                  when having multiple trees side-by-side.]),
1239     GIT_REFERENCE_SRC=$withval ,
1242 AC_ARG_WITH(vba-package-format,
1243     AS_HELP_STRING([--with-vba-package-format],
1244         [Specify package format for vba compatibility api. Specifying  "builtin"
1245          means the api component and associated type library are  part of the
1246          installation set. Specifying "extn" creates an uno extension that is
1247          part of the installation set (located in the program directory) that
1248          MUST be optionally registered using either the unopkg executeable or the
1249          extension manager gui.])
1250     [
1251                           Note: "builtin" is the default, "extn" can cause
1252                           problems.
1254                           Usage:     --with-vba-package-format="builtin" or
1255                                      --with-vba-package-format="extn"
1256     ],
1259 AC_ARG_WITH(theme,
1260     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1261         [Choose which themes to include. By default those themes with an '*' are included.
1262          Possible choices: *crystal, *default (galaxy), *hicontrast, human, industrial, *oxygen, *tango, *tango_testing.]),
1265 AC_ARG_WITH(helppack-integration,
1267   --without-helppack-integration      It will not integrate the helppacks to the installer
1268                           of the product.
1269                           Please use this switch to use the online help or separate help packages.],
1272 AC_ARG_WITH(fonts,
1273     AS_HELP_STRING([--without-fonts],
1274         [LibreOffice includes some third-party fonts to provide a reliable basis for
1275          help content, templates, samples, etc. When these fonts are already
1276          known to be available on the system then you should use this option.]),
1279 AC_ARG_WITH(ppds,
1280     AS_HELP_STRING([--without-ppds],
1281         [Removes Postscript Printer definition files from LibreOffice
1282          installation set, for people building for specific distributions where
1283          PPDs are known to be already available (every recent distro with CUPS backend).]),
1286 AC_ARG_WITH(afms,
1287     AS_HELP_STRING([--without-afms],
1288         [Removes bitmap font files from LibreOffice installation set, for people
1289          building for specific distributions where AFM files or TrueType Fonts
1290          are known to be available.]),
1293 AC_ARG_WITH(epm,
1294     AS_HELP_STRING([--with-epm],
1295         [Decides which epm to use. Default is to use the one from the system if
1296          one is built. When either this is not there or you say =internal epm
1297          will be built.]),
1300 AC_ARG_WITH(package-format,
1301     AS_HELP_STRING([--with-package-format],
1302         [Specify package format(s) for LibreOffice installsets. Default is the
1303          "normal" one of the OS/Distribution. Possible values: aix, bsd, deb,
1304          inst, tardist, osx, pkg, rpm, setld, native, portable, archive, dmg,
1305           installed, msi. Example: --with-package-format="deb dmg"]),
1308 AC_ARG_WITH(tls,
1309     AS_HELP_STRING([--with-tls],
1310         [Decides which TLS/SSL and cryptographic implementations to use for
1311          LibreOffice's code. Notice that this doesn't apply for depending
1312          libraries like "neon", for example. Default is to use OpenSSL
1313          although NSS is also possible. Notice that selecting NSS restricts
1314          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1315          restrict by now the usage of NSS in LO's code. Possible values:
1316          openssl, nss. Example: --with-tls="nss"]),
1319 AC_ARG_WITH(system-libs,
1320     AS_HELP_STRING([--with-system-libs],
1321         [Use libraries already on system -- enables all --with-system-* flags.]),
1324 AC_ARG_WITH(system-headers,
1325     AS_HELP_STRING([--with-system-headers],
1326         [Use headers already on system -- enables all --with-system-* flags for
1327          external packages whose headers are the only entities used i.e.
1328          boost/vigra/odbc/sane-header(s).]),,
1329     [with_system_headers="$with_system_libs"])
1331 AC_ARG_WITH(system-jars,
1332     AS_HELP_STRING([--without-system-jars],
1333         [When building with --with-system-libs, also the needed jars are expected
1334          on the system. Use this to disable that]),,
1335     [with_system_jars="$with_system_libs"])
1337 AC_ARG_WITH(system-cairo,
1338     AS_HELP_STRING([--with-system-cairo],
1339         [Use Cairo libraries already on system.]),,
1340     [with_system_cairo="$with_system_libs"])
1342 AC_ARG_WITH(myspell-dicts,
1343     AS_HELP_STRING([--with-myspell-dicts],
1344         [Adds myspell dictionaries to the LibreOffice installation set]),
1347 AC_ARG_WITH(system-dicts,
1348     AS_HELP_STRING([--without-system-dicts],
1349         [Do not use dictionaries from system paths.]),
1352 AC_ARG_WITH(external-dict-dir,
1353     AS_HELP_STRING([--with-external-dict-dir],
1354         [Specify external dictionary dir.]),
1357 AC_ARG_WITH(external-hyph-dir,
1358     AS_HELP_STRING([--with-external-hyph-dir],
1359         [Specify external hyphenation pattern dir.]),
1362 AC_ARG_WITH(external-thes-dir,
1363     AS_HELP_STRING([--with-external-thes-dir],
1364         [Specify external thesaurus dir.]),
1367 AC_ARG_WITH(system-zlib,
1368     AS_HELP_STRING([--with-system-zlib],
1369         [Use zlib already on system.]),,
1370     [with_system_zlib=auto])
1372 AC_ARG_WITH(system-jpeg,
1373     AS_HELP_STRING([--with-system-jpeg],
1374         [Use jpeg already on system.]),,
1375     [with_system_jpeg=auto])
1377 AC_ARG_WITH(system-clucene,
1378     AS_HELP_STRING([--with-system-clucene],
1379         [Use clucene already on system.]),,
1380     [with_system_clucene="$with_system_libs"])
1382 AC_ARG_WITH(system-expat,
1383     AS_HELP_STRING([--with-system-expat],
1384         [Use expat already on system.]),,
1385     [with_system_expat="$with_system_libs"])
1387 AC_ARG_WITH(system-libxml,
1388     AS_HELP_STRING([--with-system-libxml],
1389         [Use libxml/libxslt already on system.]),,
1390     [with_system_libxml=auto])
1392 AC_ARG_WITH(system-icu,
1393     AS_HELP_STRING([--with-system-icu],
1394         [Use icu already on system.]),,
1395     [with_system_icu="$with_system_libs"])
1397 AC_ARG_WITH(system-ucpp,
1398     AS_HELP_STRING([--with-system-ucpp],
1399         [Use ucpp already on system.]),,
1400     [])
1402 AC_ARG_WITH(system-openldap,
1403     AS_HELP_STRING([--with-system-openldap],
1404         [Use the OpenLDAP LDAP SDK already on system.]),,
1405     [with_system_openldap="$with_system_libs"])
1407 AC_ARG_WITH(system-poppler,
1408     AS_HELP_STRING([--with-system-poppler],
1409         [Use system poppler (only needed for PDF import).]),,
1410     [with_system_poppler="$with_system_libs"])
1412 AC_ARG_WITH(system-apache-commons,
1413     AS_HELP_STRING([--with-system-apache-commons],
1414         [Use Apache commons libraries already on system.]),,
1415     [with_system_apache_commons="$with_system_jars"])
1417 AC_ARG_WITH(system-mariadb,
1418     AS_HELP_STRING([--with-system-mariadb],
1419         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1420          extension.]),,
1421     [with_system_mariadb="$with_system_libs"])
1423 AC_ARG_WITH(system-mysql-cppconn,
1424     AS_HELP_STRING([--with-system-mysql-cppconn],
1425         [Use MySQL C++ Connector libraries already on system.]),,
1426     [with_system_mysql_cppconn="$with_system_libs"])
1428 AC_ARG_WITH(system-postgresql,
1429     AS_HELP_STRING([--with-system-postgresql],
1430         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1431          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1432     [with_system_postgresql="$with_system_libs"])
1434 AC_ARG_WITH(libpq-path,
1435     AS_HELP_STRING([--with-libpq-path],
1436         [Use this PostgreSQL C interface (libpq) installation for building
1437          the PostgreSQL-SDBC extension.])
1438     [
1439                           Usage:     --with-libpq-path=<absolute path to
1440                                                   your libpq installation>
1441     ],
1444 AC_ARG_WITH(system-hsqldb,
1445     AS_HELP_STRING([--with-system-hsqldb],
1446         [Use hsqldb already on system.]))
1448 AC_ARG_WITH(hsqldb-jar,
1449     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1450         [Specify path to jarfile manually.]),
1451     HSQLDB_JAR=$withval)
1453 AC_ARG_ENABLE(scripting-beanshell,
1454     AS_HELP_STRING([--disable-scripting-beanshell],
1455         [Disable support for scripts in BeanShell.]),
1459 AC_ARG_WITH(system-beanshell,
1460     AS_HELP_STRING([--with-system-beanshell],
1461         [Use beanshell already on system.]),,
1462     [with_system_beanshell="$with_system_jars"])
1464 AC_ARG_WITH(beanshell-jar,
1465     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1466         [Specify path to jarfile manually.]),
1467     BSH_JAR=$withval)
1469 AC_ARG_ENABLE(scripting-javascript,
1470     AS_HELP_STRING([--disable-scripting-javascript],
1471         [Disable support for scripts in JavaScript.]),
1475 AC_ARG_WITH(system-rhino,
1476     AS_HELP_STRING([--with-system-rhino],
1477         [Use rhino already on system.]),,)
1478 #    [with_system_rhino="$with_system_jars"])
1479 # Above is not used as we have different debug interface
1480 # patched into internal rhino. This code needs to be fixed
1481 # before we can enable it by default.
1483 AC_ARG_WITH(rhino-jar,
1484     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1485         [Specify path to jarfile manually.]),
1486     RHINO_JAR=$withval)
1488 AC_ARG_WITH(commons-codec-jar,
1489     AS_HELP_STRING([--with-commons-codec-jar=JARFILE],
1490         [Specify path to jarfile manually.]),
1491     COMMONS_CODEC_JAR=$withval)
1493 AC_ARG_WITH(commons-lang-jar,
1494     AS_HELP_STRING([--with-commons-lang-jar=JARFILE],
1495         [Specify path to jarfile manually.]),
1496     COMMONS_LANG_JAR=$withval)
1498 AC_ARG_WITH(commons-httpclient-jar,
1499     AS_HELP_STRING([--with-commons-httpclient-jar=JARFILE],
1500         [Specify path to jarfile manually.]),
1501     COMMONS_HTTPCLIENT_JAR=$withval)
1503 AC_ARG_WITH(commons-logging-jar,
1504     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1505         [Specify path to jarfile manually.]),
1506     COMMONS_LOGGING_JAR=$withval)
1508 AC_ARG_WITH(system-servlet-api,
1509     AS_HELP_STRING([--with-system-servlet-api],
1510         [Use servlet-api already on system.]),,
1511     [with_system_servlet_api="$with_system_jars"])
1513 AC_ARG_WITH(servlet-api-jar,
1514     AS_HELP_STRING([--with-servlet-api-jar=JARFILE],
1515         [Specify path to jarfile manually.]),
1516     SERVLETAPI_JAR=$withval)
1518 AC_ARG_WITH(system-jfreereport,
1519     AS_HELP_STRING([--with-system-jfreereport],
1520         [Use JFreeReport already on system.]),,
1521     [with_system_jfreereport="$with_system_jars"])
1523 AC_ARG_WITH(sac-jar,
1524     AS_HELP_STRING([--with-sac-jar=JARFILE],
1525         [Specify path to jarfile manually.]),
1526     SAC_JAR=$withval)
1528 AC_ARG_WITH(libxml-jar,
1529     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1530         [Specify path to jarfile manually.]),
1531     LIBXML_JAR=$withval)
1533 AC_ARG_WITH(flute-jar,
1534     AS_HELP_STRING([--with-flute-jar=JARFILE],
1535         [Specify path to jarfile manually.]),
1536     FLUTE_JAR=$withval)
1538 AC_ARG_WITH(jfreereport-jar,
1539     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1540         [Specify path to jarfile manually.]),
1541     JFREEREPORT_JAR=$withval)
1543 AC_ARG_WITH(liblayout-jar,
1544     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1545         [Specify path to jarfile manually.]),
1546     LIBLAYOUT_JAR=$withval)
1548 AC_ARG_WITH(libloader-jar,
1549     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1550         [Specify path to jarfile manually.]),
1551     LIBLOADER_JAR=$withval)
1553 AC_ARG_WITH(libloader-jar,
1554     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1555         [Specify path to jarfile manually.]),
1556     LIBLOADER_JAR=$withval)
1558 AC_ARG_WITH(libformula-jar,
1559     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1560         [Specify path to jarfile manually.]),
1561     LIBFORMULA_JAR=$withval)
1563 AC_ARG_WITH(librepository-jar,
1564     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1565         [Specify path to jarfile manually.]),
1566     LIBREPOSITORY_JAR=$withval)
1568 AC_ARG_WITH(libfonts-jar,
1569     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1570         [Specify path to jarfile manually.]),
1571     LIBFONTS_JAR=$withval)
1573 AC_ARG_WITH(libserializer-jar,
1574     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1575         [Specify path to jarfile manually.]),
1576     LIBSERIALIZER_JAR=$withval)
1578 AC_ARG_WITH(libbase-jar,
1579     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1580         [Specify path to jarfile manually.]),
1581     LIBBASE_JAR=$withval)
1583 AC_ARG_WITH(system-odbc,
1584     AS_HELP_STRING([--with-system-odbc],
1585         [Use the odbc headers already on system.]),,
1586     [with_system_odbc="$with_system_headers"])
1588 AC_ARG_WITH(system-sane,
1589     AS_HELP_STRING([--with-system-sane],
1590         [Use sane.h already on system.]),,
1591     [with_system_sane="$with_system_headers"])
1593 AC_ARG_WITH(system-bluez,
1594     AS_HELP_STRING([--with-system-bluez],
1595         [Use bluetooth.h already on system.]),,
1596     [with_system_bluez="$with_system_headers"])
1598 AC_ARG_WITH(system-xextensions-headers,
1599     AS_HELP_STRING([--with-system-xextensions-headers],
1600         [To build without system X11 extensions headers, use
1601          --without-system-xextensions-headers. This is possibly
1602          useful on legacy unix systems which ship with the libs
1603          but without the headers.]))
1605 AC_ARG_WITH(system-mesa-headers,
1606     AS_HELP_STRING([--with-system-mesa-headers],
1607         [Use Mesa headers already on system.]),,
1608     [with_system_mesa_headers="$with_system_headers"])
1610 AC_ARG_WITH(system-curl,
1611     AS_HELP_STRING([--with-system-curl],
1612         [Use curl already on system.]),,
1613     [with_system_curl=auto])
1615 AC_ARG_WITH(system-boost,
1616     AS_HELP_STRING([--with-system-boost],
1617         [Use boost already on system.]),,
1618     [with_system_boost="$with_system_headers"])
1620 AC_ARG_WITH(system-mdds,
1621     AS_HELP_STRING([--with-system-mdds],
1622         [Use mdds already on system.]),,
1623     [with_system_mdds="$with_system_headers"])
1625 AC_ARG_WITH(system-vigra,
1626     AS_HELP_STRING([--with-system-vigra],
1627         [Use vigra already on system.]),,
1628     [with_system_vigra="$with_system_headers"])
1630 AC_ARG_WITH(system-hunspell,
1631     AS_HELP_STRING([--with-system-hunspell],
1632         [Use libhunspell already on system.]),,
1633     [with_system_hunspell="$with_system_libs"])
1635 AC_ARG_WITH(system-mythes,
1636     AS_HELP_STRING([--with-system-mythes],
1637         [Use mythes already on system.]),,
1638     [with_system_mythes="$with_system_libs"])
1640 AC_ARG_WITH(system-altlinuxhyph,
1641     AS_HELP_STRING([--with-system-altlinuxhyph],
1642         [Use ALTLinuxhyph already on system.]),,
1643     [with_system_altlinuxhyph="$with_system_libs"])
1645 AC_ARG_WITH(system-lpsolve,
1646     AS_HELP_STRING([--with-system-lpsolve],
1647         [Use lpsolve already on system.]),,
1648     [with_system_lpsolve="$with_system_libs"])
1650 AC_ARG_WITH(system-liblangtag,
1651     AS_HELP_STRING([--with-system-liblangtag],
1652         [Use liblangtag library already on system.]),,
1653     [with_system_liblangtag="$with_system_libs"])
1655 AC_ARG_WITH(system-npapi-headers,
1656     AS_HELP_STRING([--with-system-npapi-headers],
1657         [Use NPAPI headers provided by system instead of bundled ones. Used in
1658          extensions/source/nsplugin (ENABLE_NPAPI_INTO_BROWSER=YES) and
1659          extensions/source/plugin (ENABLE_NPAPI_FROM_BROWSER=YES)]),,
1660     [with_system_npapi_headers="$with_system_headers"]
1663 AC_ARG_WITH(system-libpng,
1664     AS_HELP_STRING([--with-system-libpng],
1665         [Use libpng already on system.]),,
1666     [with_system_libpng=auto])
1668 AC_ARG_WITH(linker-hash-style,
1669     AS_HELP_STRING([--with-linker-hash-style],
1670         [Use linker with --hash-style=<style> when linking shared objects.
1671          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1672          if supported on the build system, and "sysv" otherwise.]))
1674 AC_ARG_WITH(jdk-home,
1675     AS_HELP_STRING([--with-jdk-home],
1676         [If you have installed JDK 1.3 or later on your system please supply the
1677          path here. Note that this is not the location of the java command but the
1678          location of the entire distribution.])
1679     [
1680                           Usage:     --with-jdk-home=<absolute path to JDK home>
1681     ],
1684 AC_ARG_WITH(help,
1685     AS_HELP_STRING([--with-help],
1686         [Enable the build of help.]))
1688 AC_ARG_WITH(java,
1689     AS_HELP_STRING([--with-java],
1690         [Specify the name of the Java interpreter command. Typically "java"
1691          which is the default.
1693          To build without support for Java components, applets, accessibility
1694          or the XML filters written in Java, use --without-java or --with-java=no.])
1695     [
1696                           Usage:     --with-java==<java command>
1697                                      --without-java
1698     ],
1699     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1700     [ with_java=java ]
1703 AC_ARG_WITH(jvm-path,
1704     AS_HELP_STRING([--with-jvm-path],
1705         [Use a specific JVM search path at runtime.])
1706     [
1707                           Usage:     --with-jvm-path=<absolute path to parent of jvm home>
1709                           e. g.: --with-jvm-path=/usr/lib/
1710                                  to find JRE/JDK in /usr/lib/jvm/
1711     ],
1714 AC_ARG_WITH(ant-home,
1715     AS_HELP_STRING([--with-ant-home],
1716         [If you have installed Jakarta Ant on your system, please supply the path here.
1717          Note that this is not the location of the Ant binary but the location
1718          of the entire distribution.])
1719     [
1720                           Usage:     --with-ant-home=<absolute path to Ant home>
1721     ],
1724 AC_ARG_WITH(junit,
1725     AS_HELP_STRING([--with-junit],
1726         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
1727          --without-junit disables those tests. Not relevant in the --without-java case.])
1728     [
1729                           Usage:     --with-junit=<absolute path to JUnit 4 jar>
1730     ],
1731 ,with_junit=yes)
1733 AC_ARG_WITH(perl-home,
1734     AS_HELP_STRING([--with-perl-home],
1735         [If you have installed Perl 5 Distribution, on your system, please
1736          supply the path here. Note that this is not the location of the Perl
1737          binary but the location of the entire distribution.])
1738     [
1739                           Usage:     --with-perl-home=<abs. path to Perl 5 home>
1740     ],
1743 AC_ARG_WITH(
1744     [doxygen],
1745     AS_HELP_STRING(
1746         [--with-doxygen],
1747         [Specifies the doxygen executable to use when generating ODK C/C++
1748          documentation. --without-doxygen disables generation of ODK C/C++
1749          documentation. Not relevant in the --disable-odk case.])
1750     [
1751                           Usage:     --with-doxygen=<absolute path to doxygen executable>
1752     ],,
1753     [with_doxygen=yes])
1755 AC_ARG_WITH(visual-studio,
1756     AS_HELP_STRING([--with-visual-studio=<2012/2010/2008>],
1757         [Specify which Visual Studio version to use in case several are
1758          are installed. If not specified, the order of preference is
1759          2012, 2010 and 2008 (including Express editions).])
1760     [
1761                           Usage:     --with-visual-studio=<2012/2010/2008>
1762     ],
1765 AC_ARG_WITH(windows-sdk,
1766     AS_HELP_STRING([--with-windows-sdk=<6.0(A)/7.0(A)/7.1(A)/8.0(A)>],
1767         [Specify which Windows SDK, or "Windows Kit", version to use
1768          in case the one that came with the selected Visual Studio
1769          is not what you want for some reason. Note that not all compiler/SDK
1770          combinations are supported. The intent is that this option should not
1771          be needed.])
1772     [
1773                           Usage:     --with-windows-sdk=6.0(A)/7.0(A)/7.1(A)/8.0(A)>
1774     ],
1777 AC_ARG_WITH(lang,
1778     AS_HELP_STRING([--with-lang],
1779         [Use this option to build LibreOffice with additional language support.
1780          English (US) is always included by default.
1781          Separate multiple languages with space.
1782          For all languages, use --with-lang=ALL.])
1783     [
1784                           Usage:     --with-lang="es sw tu cs sk"
1785     ],
1788 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
1789 AC_ARG_WITH(krb5,
1790     AS_HELP_STRING([--with-krb5],
1791         [Enable MIT Kerberos 5 support in modules that support it.
1792          By default automatically enabled on platforms
1793          where a good system Kerberos 5 is available.]),
1796 AC_ARG_WITH(gssapi,
1797     AS_HELP_STRING([--with-gssapi],
1798         [Enable GSSAPI support in modules that support it.
1799          By default automatically enabled on platforms
1800          where a good system GSSAPI is available.]),
1803 dnl ===================================================================
1804 dnl Branding
1805 dnl ===================================================================
1807 AC_ARG_WITH(branding,
1808     AS_HELP_STRING([--with-branding],
1809         [Use given path to retrieve branding images set.])
1810     [
1811                           Search for intro.png about.svg flat_logo.svg 
1812                           backing_left.png backing_right.png 
1813                           backing_rtl_left.png backing_rtl_right.png 
1814                           backing_space.png. If any is missing, default
1815                           ones will be used instead.
1817                           Search also progress.conf for progress 
1818                           settings on intro screen :
1820                           PROGRESSBARCOLOR="255,255,255" Set color of 
1821                           progress bar. Comma separated RGB decimal values.
1822                           PROGRESSSIZE="407,6" Set size of progress bar. 
1823                           Comma separated decimal values (width, height).
1824                           PROGRESSPOSITION="61,317" Set position of progress
1825                           bar from left,top. Comma separated decimal values.
1826                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
1827                           bar frame. Comma separated RGB decimal values.
1828                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress 
1829                           bar text. Comma separated RGB decimal values.
1830                           PROGRESSTEXTBASELINE="287" Set vertical position of 
1831                           progress bar text from top. Decimal value.
1833                           Default values will be used if not found.
1835                           Usage:     --with-branding=/path/to/images
1836     ],
1840 AC_ARG_WITH(extra-buildid,
1841     AS_HELP_STRING([--with-extra-buildid],
1842         [Show addition build identification in about dialog.])
1843     [
1844                           Usage:     --with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"
1845     ],
1849 AC_ARG_WITH(vendor,
1850     AS_HELP_STRING([--with-vendor],
1851         [Set vendor of the build.])
1852     [
1853                           Usage:     --with-vendor="John the Builder"
1854     ],
1857 AC_ARG_WITH(unix-wrapper,
1858     AS_HELP_STRING([--with-unix-wrapper],
1859         [Redefines the name of the UNIX wrapper that will be used in the desktop
1860          files and in the desktop-integration RPMs.])
1861     [
1862                           Usage:     --with-unix-wrapper=ooffice
1863     ],
1866 AC_ARG_WITH(compat-oowrappers,
1867     AS_HELP_STRING([--with-compat-oowrappers],
1868         [Install oo* wrappers in parallel with
1869          lo* ones to keep backward compatibility.
1870          Has effect only with make distro-pack-install]),
1873 AC_ARG_WITH(os-version,
1874     AS_HELP_STRING([--with-os-version],
1875         [For FreeBSD users, use this option option to override the detected OSVERSION.])
1876     [
1877                           Usage:     --with-os-version=<OSVERSION>
1878     ],
1881 AC_ARG_WITH(mingw-cross-compiler,
1882     AS_HELP_STRING([--with-mingw-cross-compiler],
1883         [Specify the MinGW cross-compiler to use.])
1884     [
1885                           Usage:     --with-mingw-cross-compiler=<mingw32-g++ command>
1887                           When building on the ODK on Unix and building unowinreg.dll,
1888                           specify the MinGW C++ cross-compiler.
1889     ],
1892 AC_ARG_WITH(idlc-cpp,
1893     AS_HELP_STRING([--with-idlc-cpp],
1894         [Specify the C Preprocessor to use for idlc.])
1895     [
1896                           Usage:     --with-idlc-cpp=cpp
1898                           Default is ucpp.
1899     ]
1902 AC_ARG_WITH(build-version,
1903     AS_HELP_STRING([--with-build-version],
1904         [Allows the builder to add a custom version tag that will appear in the
1905          Help/About box for QA purposes.])
1906     [
1907                           Usage:     --with-build-version="Built by Jim"
1908     ],
1909     with_build_version=$withval ,
1912 AC_ARG_WITH(alloc,
1913     AS_HELP_STRING([--with-alloc],
1914         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
1915          Note that on FreeBSD/NetBSD system==jemalloc]),
1918 AC_ARG_WITH(sun-templates,
1919     AS_HELP_STRING([--with-sun-templates],
1920         [Integrate Sun template packages.]),
1923 AC_ARG_WITH(parallelism,
1924     AS_HELP_STRING([--with-parallelism],
1925         [Number of jobs to run simultaneously during build. Parallel builds can
1926         save a lot of time on multi-cpu machines. Defaults to the number of
1927         CPUs on the machine, unless you configure --enable-icecream - then to
1928         10.]),
1931 AC_ARG_WITH(check-jobs,
1932     AS_HELP_STRING([--with-check-jobs],
1933         [Maximum number of jobs that will be issued at the same time during 'make subsequenttest'.
1934          Default value is the same as 'parallelism'. Useful because the subsequent tests are very lightweight.]),
1937 AC_ARG_WITH(all-tarballs,
1938     AS_HELP_STRING([--with-all-tarballs],
1939         [Download all external tarballs unconditionally]))
1941 dnl ===================================================================
1942 dnl Test whether build target is Release Build
1943 dnl ===================================================================
1944 AC_MSG_CHECKING([whether build target is Release Build])
1945 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
1946     AC_MSG_RESULT([no])
1947     ENABLE_RELEASE_BUILD="FALSE"
1948 else
1949     AC_MSG_RESULT([yes])
1950     ENABLE_RELEASE_BUILD="TRUE"
1952 AC_SUBST(ENABLE_RELEASE_BUILD)
1954 dnl ===================================================================
1955 dnl Test whether to sign Windows Build
1956 dnl ===================================================================
1957 AC_MSG_CHECKING([whether to sign windows build])
1958 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT" -a "$WITH_MINGW" != "YES" ; then
1959     AC_MSG_RESULT([yes])
1960     WINDOWS_BUILD_SIGNING="TRUE"
1961 else
1962     AC_MSG_RESULT([no])
1963     WINDOWS_BUILD_SIGNING="FALSE"
1965 AC_SUBST(WINDOWS_BUILD_SIGNING)
1967 dnl ===================================================================
1968 dnl MacOSX build and runtime environment options
1969 dnl ===================================================================
1971 AC_ARG_WITH(macosx-sdk,
1972     AS_HELP_STRING([--with-macosx-sdk],
1973         [Use a specific SDK for building.])
1974     [
1975                           Usage:     --with-macosx-sdk=<version>
1977                           e. g.: --with-macosx-sdk=10.6
1979                           there are 3 options to control the MacOSX build:
1980                           --with-macosx-sdk (refered as 'sdk' below)
1981                           --with-macosx-version-min-required (refered as 'min' below)
1982                           --with-macosx-version-max-allowed (refered as 'max' below)
1984                           the connection between these value and the default they take is as follow:
1985                           ( ? means not specified on the command line, s means the SDK version found,
1986                           constraint: x <= y <= z)
1988                           ==========================================
1989                            command line      || config result
1990                           ==========================================
1991                           min  | max  | sdk  || min  | max  | sdk  |
1992                           ?    | ?    | ?    || 10.6 | 10.s | 10.s |
1993                           ?    | ?    | 10.x || 10.6 | 10.x | 10.x |
1994                           ?    | 10.x | ?    || 10.6 | 10.s | 10.s |
1995                           ?    | 10.x | 10.y || 10.6 | 10.x | 10.y |
1996                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
1997                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
1998                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
1999                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2002                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2003                           for a detailled technical explanation of these variables
2005                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2007                           Note that even if in theory using a --with-macosx-version-max-allowed
2008                           (i.e. the MAC_OS_X_VERSION_MAX_ALLOWED macro) less than the SDK version
2009                           should work, in practice Apple doesn't seem to test that, and at least
2010                           compiling with -DMAC_OS_X_VERSION_MAX_ALLOWED=1060 against the 10.7 SDK
2011                           fails in a couple of places. Just because of oversights in ifdefs in the SDK
2012                           headers, but still.
2013     ],
2016 AC_ARG_WITH(macosx-version-min-required,
2017     AS_HELP_STRING([--with-macosx-version-min-required],
2018         [set the minimum OS version needed to run the built LibreOffice])
2019     [
2020                           Usage:     --with-macosx-version-min-required=<version>
2022                           e. g.: --with-macos-version-min-required=10.6
2023                           see --with-macosx-sdk for more info
2024     ],
2027 AC_ARG_WITH(macosx-version-max-allowed,
2028     AS_HELP_STRING([--with-macosx-version-max-allowed],
2029         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2030     [
2031                           Usage:     --with-macosx-version-max-allowed=<version>
2033                           e. g.: --with-macos-version-max-allowed=10.6
2034                           see --with-macosx-sdk for more info
2035     ],
2039 dnl ===================================================================
2040 dnl options for stuff used during cross-compilation build
2041 dnl These are superseded by --with-build-platform-configure-options.
2042 dnl Or are they? Look for the complicated tests for "$cross_compiling" = "yes" -a \(
2043 dnl "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \)
2044 dnl far below. Could whoever understands MinGW cross-compilation clean up this please.
2045 dnl ===================================================================
2047 AC_ARG_WITH(system-boost-for-build,
2048     AS_HELP_STRING([--with-system-boost-for-build],
2049         [Use boost already on system for build tools (cross-compilation only).]))
2051 AC_ARG_WITH(system-cppunit-for-build,
2052     AS_HELP_STRING([--with-system-cppunit-for-build],
2053         [Use cppunit already on system for build tools (cross-compilation only).]))
2055 AC_ARG_WITH(system-expat-for-build,
2056     AS_HELP_STRING([--with-system-expat-for-build],
2057         [Use expat already on system for build tools (cross-compilation only).]))
2059 AC_ARG_WITH(system-icu-for-build,
2060     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2061         [Use icu already on system for build tools (cross-compilation only).]))
2063 AC_ARG_WITH(system-libxml-for-build,
2064     AS_HELP_STRING([--with-system-libxml-for-build],
2065         [Use libxml/libxslt already on system for build tools (cross-compilation only).]))
2068 dnl ===================================================================
2069 dnl check for required programs (grep, awk, sed, bash)
2070 dnl ===================================================================
2072 pathmunge ()
2074     if test -n "$1"; then
2075         if test "$build_os" = "cygwin"; then
2076             PathFormat "$1"
2077             new_path=`cygpath -u "$formatted_path"`
2078         else
2079             new_path="$1"
2080         fi
2081         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2082             if test "$2" = "after"; then
2083                 LO_PATH="$LO_PATH:$new_path"
2084             else
2085                 LO_PATH="$new_path:$LO_PATH"
2086             fi
2087         fi
2088         unset new_path
2089     fi
2092 AC_PROG_AWK
2093 AC_PATH_PROG( AWK, $AWK)
2094 if test -z "$AWK"; then
2095     AC_MSG_ERROR([install awk to run this script])
2098 AC_PATH_PROG(BASH, bash)
2099 if test -z "$BASH"; then
2100     AC_MSG_ERROR([bash not found in \$PATH])
2102 AC_SUBST(BASH)
2104 AC_MSG_CHECKING([for GNU or BSD tar])
2105 for a in $GNUTAR gtar gnutar tar /usr/sfw/bin/gtar; do
2106     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2107     if test $? -eq 0;  then
2108         GNUTAR=$a
2109         break
2110     fi
2111 done
2112 AC_MSG_RESULT($GNUTAR)
2113 if test -z "$GNUTAR"; then
2114     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2116 AC_SUBST(GNUTAR)
2118 AC_MSG_CHECKING([for tar's option to strip components])
2119 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2120 if test $? -eq 0; then
2121     STRIP_COMPONENTS="--strip-components"
2122 else
2123     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2124     if test $? -eq 0; then
2125         STRIP_COMPONENTS="--strip-path"
2126     else
2127         STRIP_COMPONENTS="unsupported"
2128     fi
2130 AC_MSG_RESULT($STRIP_COMPONENTS)
2131 if test x$STRIP_COMPONENTS == xunsupported; then
2132     AC_MSG_ERROR([you need a tar that is able to strip components.])
2134 AC_SUBST(STRIP_COMPONENTS)
2136 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2137 dnl desktop OSes from "mobile" ones.
2139 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2140 dnl In other words, that when building for an OS that is not a
2141 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2143 dnl Note the direction of the implication; there is no assumption that
2144 dnl cross-compiling would imply a non-desktop OS.
2146 if test $_os != iOS -a $_os != Android; then
2147     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2148     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2149     AC_DEFINE(HAVE_FEATURE_DESKTOP_GUI_ELEMENTS)
2150     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2151 elif test "$enable_desktop_gui_elements" = yes; then
2152     AC_DEFINE(HAVE_FEATURE_DESKTOP_GUI_ELEMENTS)
2155 DISABLE_EXPORT=''
2156 if test "$enable_export" != no; then
2157     BUILD_TYPE="$BUILD_TYPE EXPORT"
2158 else
2159     DISABLE_EXPORT='TRUE'
2160     SCPDEFS="$SCPDES -DDISABLE_EXPORT"
2162 AC_SUBST(DISABLE_EXPORT)
2164 dnl Decide whether to build database connectivity stuff (including
2165 dnl Base) or not. We probably don't want to on non-desktop OSes.
2167 if test -z "$enable_database_connectivity"; then
2168     # Do enable database connectivity for Android for now as otherwise
2169     # we presumably will get linking errors... We are not as far in
2170     # the work for iOS, so we might as well disable it for iOS already.
2172     # And actually, do enable it for iOS, too. Let's get back to
2173     # figuring out what to do with this later, if ever.
2175     # (Note that with "enable", I mean "enable building the related
2176     # code". Very likely little of it will make any sense at run-time
2177     # on Android or iOS and won't even be shipped with/linked into any
2178     # app.)
2180     #if test $_os != iOS; then
2181         enable_database_connectivity=yes
2182     #fi
2185 DISABLE_DBCONNECTIVITY=''
2186 if test "$enable_database_connectivity" = yes; then
2187     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2188 else
2189     DISABLE_DBCONNECTIVITY='TRUE'
2190     SCPDEFS="$SCPDEFS -DDISABLE_DBCONNECTIVITY"
2192 AC_SUBST(DISABLE_DBCONNECTIVITY)
2194 if test -z "$enable_extensions"; then
2195     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2196     if test $_os != iOS -a $_os != Android; then
2197         enable_extensions=yes
2198     fi
2201 if test "$enable_extensions" = yes; then
2202     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2203     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2206 if test -z "$enable_scripting"; then
2207     # Disable scripting for iOS unless specifically overridden
2208     # with --enable-scripting.
2209     if test $_os != iOS; then
2210         enable_scripting=yes
2211     fi
2214 DISABLE_SCRIPTING=''
2215 if test "$enable_scripting" = yes; then
2216     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2217 else
2218     DISABLE_SCRIPTING='TRUE'
2219     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2221 AC_SUBST(DISABLE_SCRIPTING)
2223 if test $_os = iOS -o $_os = Android; then
2224     # Disable dynamic_loading always for iOS and Android
2225     enable_dynamic_loading=no
2226 elif test -z "$enable_dynamic_loading"; then
2227     # Otherwise enable it unless speficically disabled
2228     enable_dynamic_loading=yes
2231 DISABLE_DYNLOADING=''
2232 if test "$enable_dynamic_loading" = yes; then
2233     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2234 else
2235     DISABLE_DYNLOADING='TRUE'
2236     SCPDEFS="$SCPDEFS -DDISABLE_DYNLOADING"
2238 AC_SUBST(DISABLE_DYNLOADING)
2240 if test -n "${with_solver_and_workdir_root}"; then
2241     if ! test -d ${with_solver_and_workdir_root}; then
2242       AC_MSG_ERROR([directory does not exist: ${with_solver_and_workdir_root}])
2243     fi
2244     PathFormat "${with_solver_and_workdir_root}"
2245     # IsValidFilePath in /sal/osl/w32/file_url.cxx rejects "X:\\" breaking idlc
2246     if echo ${formatted_path} | $GREP -q '/$'; then
2247         SOLARVER=${formatted_path}solver
2248     else
2249         SOLARVER=${formatted_path}/solver
2250     fi
2251 else
2252     SOLARVER=${BUILDDIR}/solver
2255 # remenber SYSBASE value
2256 AC_SUBST(SYSBASE)
2258 dnl ===================================================================
2259 dnl  Checks if ccache is available
2260 dnl ===================================================================
2261 if test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2262     case "%$CC%$CXX%" in
2263     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some verison number etc),
2264     # assume that's good then
2265     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2266         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2267         ;;
2268     *)
2269         AC_PATH_PROG([CCACHE],[ccache],[not found])
2270         if test "$CCACHE" = "not found"; then
2271             CCACHE=""
2272         else
2273             # Need to check for ccache version: otherwise prevents
2274             # caching of the results (like "-x objective-c++" for Mac)
2275             if test $_os = Darwin -o $_os = iOS; then
2276                 # Check ccache version
2277                 AC_MSG_CHECKING([whether version of ccache is suitable])
2278                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2279                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2280                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2281                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2282                 else
2283                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2284                     CCACHE=""
2285                 fi
2286             fi
2287         fi
2288         ;;
2289     esac
2290 else
2291     CCACHE=""
2294 if test "$CCACHE" != ""; then
2295     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2296     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2297     if test "$ccache_size" = ""; then
2298         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2299         if test "$ccache_size" = ""; then
2300             ccache_size=0
2301         fi
2302         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2303         if test $ccache_size -lt 1024; then
2304             CCACHE=""
2305             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-producive: Disabling auto-ccache detection])
2306             add_warning "ccache's cache size is less than 1GB using it is counter-producive: auto-ccache detection disabled"
2307         else
2308             # warn that ccache may be too small for debug build
2309             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build])
2310             add_warning "ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build"
2311         fi
2312     else
2313         if test $ccache_size -lt 5; then
2314             #warn that ccache may be too small for debug build
2315             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build])
2316             add_warning "ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build"
2317         fi
2318     fi
2321 dnl ===================================================================
2322 dnl  Checks for C compiler,
2323 dnl  The check for the C++ compiler is later on.
2324 dnl ===================================================================
2325 if test "$_os" != "WINNT" -a "$WITH_MINGW" != "yes"; then
2326         GCC_HOME_SET="true"
2327         AC_MSG_CHECKING([gcc home])
2328         if test -z "$with_gcc_home"; then
2329                 if test "$enable_icecream" = "yes"; then
2330                         if test -d "/usr/lib/icecc/bin"; then
2331                                 GCC_HOME="/usr/lib/icecc/"
2332                         else
2333                                 GCC_HOME="/opt/icecream/"
2334                         fi
2335                 else
2336                         GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2337                         GCC_HOME_SET="false"
2338                 fi
2339         else
2340                 GCC_HOME="$with_gcc_home"
2341         fi
2342         AC_MSG_RESULT($GCC_HOME)
2343         AC_SUBST(GCC_HOME)
2345         if test "$GCC_HOME_SET" = "true"; then
2346                 if test -z "$CC"; then
2347                         CC="$GCC_HOME/bin/gcc"
2348                 fi
2349                 if test -z "$CXX"; then
2350                         CXX="$GCC_HOME/bin/g++"
2351                 fi
2352         fi
2355 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
2356 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
2357     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
2358     save_CFLAGS=$CFLAGS
2359     AC_PROG_CC
2360     CFLAGS=$save_CFLAGS
2363 COMPATH=`dirname "$CC"`
2364 if test "$COMPATH" = "."; then
2365     AC_PATH_PROGS(COMPATH, $CC)
2366     dnl double square bracket to get single because of M4 quote...
2367     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2369 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2371 dnl ===================================================================
2372 dnl  Test the Solaris compiler version
2373 dnl ===================================================================
2374 if test "$_os" = "SunOS"; then
2375     if test "$CC" = "cc"; then
2376         AC_PATH_PROGS(_cc, cc)
2377         COMPATH=`echo $_cc | $SED -n "s/\/bin\/cc//p"`
2378         AC_MSG_CHECKING([the SunStudio C/C++ compiler version])
2379         dnl cc -V outputs to standard error!!!!
2380         _sunstudio_string=`$CC -V 2>&1 | grep '^cc' | $SED -e 's/.* C //'`
2381         _sunstudio_version=`echo $_sunstudio_string | $AWK '{ print $1 }'`
2382         _sunstudio_major=`echo $_sunstudio_version | $AWK -F. '{ print $1 }'`
2383         if test "$_sunstudio_major" != "5"; then
2384             AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2385         else
2386             _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" }'`
2387             if test "$_sunstudio_minor" = "false"; then
2388                 AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2389             else
2390                 dnl compiler will do
2391                 AC_MSG_RESULT([checked])
2392             fi
2393         fi
2394     fi
2398 dnl ===================================================================
2399 dnl Check / find MacOSX SDK and compiler, version checks
2400 dnl ===================================================================
2401 if test "$_os" = "Darwin"; then
2403     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
2404         bitness=-m32
2405     else
2406         bitness=-m64
2407         BITNESS_OVERRIDE=64
2408     fi
2410     # If no --with-macosx-sdk option is given, look for 10.6, 10.7
2411     # and 10.8 SDKs, in that order. If not found in some (old)
2412     # default locations, try the xcode-select tool.
2414     # The intent is that for "most" Mac-based developers, a suitable
2415     # SDK will be found automatically without any configure options.
2417     # For developers still using Xcode 3, in /Developer, either
2418     # because it is the only Xcode they have, or they have that in
2419     # addition to Xcode 4 in /Applications/Xcode.app, the 10.6 SDK
2420     # should be found.
2422     # For developers with a current Xcode 4 installed from the Mac App
2423     # Store, the 10.6, 10.7 or 10.8 SDK should be found.
2425     AC_MSG_CHECKING([what Mac OS X SDK to use])
2427     if test -z "$with_macosx_sdk"; then
2428         if test -d /Developer/SDKs/MacOSX10.6.sdk; then
2429             with_macosx_sdk=10.6
2430         elif test -d /Developer-old/SDKs/MacOSX10.6.sdk; then
2431             with_macosx_sdk=10.6
2432         elif test -d /Xcode3/SDKs/MacOSX10.6.sdk; then
2433             with_macosx_sdk=10.6
2434         elif test -d /Developer/SDKs/MacOSX10.7.sdk; then
2435             with_macosx_sdk=10.7
2436         elif test -x /usr/bin/xcode-select; then
2437             xcodepath="`xcode-select -print-path`"
2438             if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk"; then
2439                 with_macosx_sdk=10.6
2440             elif test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"; then
2441                 with_macosx_sdk=10.7
2442             elif test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk"; then
2443                 with_macosx_sdk=10.8
2444             fi
2445         fi
2446         if test -z "$with_macosx_sdk"; then
2447             AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2448         fi
2449     fi
2451     case $with_macosx_sdk in
2452     10.6)
2453         MACOSX_SDK_VERSION=1060
2454         ;;
2455     10.7)
2456         MACOSX_SDK_VERSION=1070
2457         ;;
2458     10.8)
2459         MACOSX_SDK_VERSION=1080
2460         ;;
2461     *)
2462         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported value are 10.6--8])
2463         ;;
2464     esac
2466     # Next find it (again, if we deduced its version above by finding
2467     # it... but we need to look for it once more in case
2468     # --with-macosx-sdk was given so that the aboce search did not
2469     # happen).
2470     if test -z "$MACOSX_SDK_PATH"; then
2471         case $with_macosx_sdk in
2472         10.6)
2473             if test -d /Developer/SDKs/MacOSX10.6.sdk; then
2474                 MACOSX_SDK_PATH=/Developer/SDKs/MacOSX10.6.sdk
2475             elif test -d /Developer-old/SDKs/MacOSX10.6.sdk; then
2476                 MACOSX_SDK_PATH=/Developer-old/SDKs/MacOSX10.6.sdk
2477             elif test -d /Xcode3/SDKs/MacOSX10.6.sdk; then
2478                 MACOSX_SDK_PATH=/Xcode3/SDKs/MacOSX10.6.sdk
2479             elif test -x /usr/bin/xcode-select; then
2480                 xcodepath="`xcode-select -print-path`"
2481                 if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2482                     MACOSX_SDK_PATH="$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"
2483                 fi
2484             fi
2485             ;;
2486         10.7|10.8)
2487             if test -d /Developer/SDKs/MacOSX$with_macosx_sdk.sdk; then
2488                 MACOSX_SDK_PATH=/Developer/SDKs/MacOSX$with_macosx_sdk.sdk
2489             elif test -x /usr/bin/xcode-select; then
2490                 xcodepath="`xcode-select -print-path`"
2491                 if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2492                     MACOSX_SDK_PATH="$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"
2493                 fi
2494             fi
2495             ;;
2496         esac
2497         if test -z "$MACOSX_SDK_PATH"; then
2498             AC_MSG_ERROR([Could not figure out the location of Mac OS X $with_macosx_sdk SDK])
2499         fi
2500     fi
2501     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2503     if test "$with_macosx_version_min_required" = ""; then
2504         with_macosx_version_min_required="10.6"
2505     fi
2507     if test "$with_macosx_version_max_allowed" = ""; then
2508         with_macosx_version_max_allowed="$with_macosx_sdk"
2509     fi
2511     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2512     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2514     case "$with_macosx_version_min_required" in
2515     10.6)
2516         MAC_OS_X_VERSION_MIN_REQUIRED="1060"
2517         ;;
2518     10.7)
2519         MAC_OS_X_VERSION_MIN_REQUIRED="1070"
2520         ;;
2521     10.8)
2522         MAC_OS_X_VERSION_MIN_REQUIRED="1080"
2523         ;;
2524     *)
2525         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported value are 10.6--8])
2526         ;;
2527     esac
2529     if test "$BITNESS_OVERRIDE" = ""; then
2530         case "$with_macosx_version_min_required" in
2531         10.6)
2532             case "$with_macosx_sdk" in
2533             10.6)
2534                 ;;
2535             *)
2536                 AC_MSG_WARN([Building with a SDK > 10.6 possibly breaks 10.6 compatibility. Do not use for the TDF build])
2537                 add_warning "Building with a SDK > 10.6 possibly breaks 10.6 compatibility. Do not use for the TDF build"
2538                 ;;
2539             esac
2540             ;;
2541         *)
2542             AC_MSG_WARN([Building with a minimum version requirement > 10.6 breaks 10.6 compatibility. Do not use for the TDF build])
2543             add_warning "Building with a minimum version requirement > 10.6 breaks 10.6 compatibility. Do not use for the TDF build"
2544             ;;
2545         esac
2546     fi
2548     # If no CC and CXX environment vars, try to guess where the compiler is
2549     if test -z "$save_CC"; then
2550         AC_MSG_CHECKING([what compiler to use])
2551         case $with_macosx_sdk in
2552         10.6)
2553             # did someone copy her 10.6 sdk into xcode 4 (needed on Mountain Lion)?
2554             if test "$(echo $MACOSX_SDK_PATH | cut -c1-23)" = "/Applications/Xcode.app"; then
2555                 CC="`xcrun -find gcc` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2556                 CXX="`xcrun -find g++` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2557                 XCRUN=xcrun
2558             else
2559                 CC="gcc-4.2 $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2560                 CXX="g++-4.2 $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2561             fi
2562             ;;
2563         10.7|10.8)
2564             CC="`xcrun -find clang` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2565             CXX="`xcrun -find clang++` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2566             XCRUN=xcrun
2567             ;;
2568         esac
2569         AC_MSG_RESULT([$CC and $CXX])
2570     fi
2572     case "$with_macosx_version_max_allowed" in
2573     10.6)
2574         MAC_OS_X_VERSION_MAX_ALLOWED="1060"
2575         ;;
2576     10.7)
2577         MAC_OS_X_VERSION_MAX_ALLOWED="1070"
2578         ;;
2579     10.8)
2580         MAC_OS_X_VERSION_MAX_ALLOWED="1080"
2581         ;;
2582     *)
2583         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported value are 10.6--8])
2584         ;;
2585     esac
2587     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2588     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2589         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2590     else
2591         AC_MSG_RESULT([ok])
2592     fi
2594     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2595     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2596         AC_MSG_ERROR([the version maximum allowed cannot be greater thatn the sdk level])
2597     else
2598         AC_MSG_RESULT([ok])
2599     fi
2600     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2601     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2603     AC_MSG_CHECKING([whether to do code signing])
2605     if test "$enable_macosx_code_signing" = yes; then
2606         # By default use the first suitable certificate (?).
2608         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2609         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2610         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2611         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the the
2612         # "Developer ID Application" one.
2614         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | awk '{print $2}' |head -1`
2615         if test -n "$identity"; then
2616             MACOSX_CODESIGNING_IDENTITY=$identity
2617             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2618             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2619         fi
2620     elif test -n "$enable_macosx_code_signing"; then
2621         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2622         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2623         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2624     else
2625         AC_MSG_RESULT([no])
2626     fi
2628     AC_MSG_CHECKING([whether to sandbox the application])
2630     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2631         AC_MSG_ERROR([OS X sandboxing requires code signing])
2632     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2633         ENABLE_MACOSX_SANDBOX=YES
2634         AC_MSG_RESULT([yes])
2635     else
2636         AC_MSG_RESULT([no])
2637     fi
2639     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2641     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2643     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2645 AC_SUBST(FRAMEWORKSHOME)
2646 AC_SUBST(MACOSX_SDK_PATH)
2647 AC_SUBST(MACOSX_SDK_VERSION)
2648 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2649 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2650 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2651 AC_SUBST(XCRUN)
2652 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2653 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2654 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2656 dnl ===================================================================
2657 dnl Check / find iOS SDK and compiler, version checks
2658 dnl ===================================================================
2659 if test $_os = iOS; then
2661     AC_MSG_CHECKING([what iOS SDK to use])
2663     if test "$enable_ios_simulator" = yes; then
2664         platform=iPhoneSimulator
2665         versionmin=-mmacosx-version-min=10.7
2666         arch=i386
2667     else
2668         platform=iPhoneOS
2669         versionmin=-miphoneos-version-min=5.0
2670         arch=armv7
2671     fi
2673     pref_sdk_ver=6.1
2674     for I in 6.1 6.0; do
2675         t=/Applications/Xcode.app/Contents/Developer/Platforms/$platform.platform/Developer/SDKs/$platform$I.sdk
2676         if test -d $t; then
2677             sysroot=$t
2678             break
2679         fi
2680     done
2682     if test -z "$sysroot"; then
2683         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}])
2684     fi
2686     AC_MSG_RESULT($sysroot)
2688     CXX="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch $arch -isysroot $sysroot $versionmin"
2689     CC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch $arch -isysroot $sysroot $versionmin"
2692 AC_MSG_CHECKING([whether to treat the installation as read-only])
2694 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = YES \) -o \
2695         "$enable_extensions" != yes; then
2696     enable_readonly_installset=yes
2698 if test "$enable_readonly_installset" = yes; then
2699     AC_MSG_RESULT([yes])
2700     ENABLE_READONLY_INSTALLSET=YES
2701 else
2702     AC_MSG_RESULT([no])
2704 AC_SUBST(ENABLE_READONLY_INSTALLSET)
2706 dnl ===================================================================
2707 dnl Windows specific tests and stuff
2708 dnl ===================================================================
2710 reg_get_value()
2712     # Return value: $regvalue
2713     unset regvalue
2714     _regvalue=`cat "/proc/registry/$1" 2> /dev/null`
2716     if test $? -eq 0; then
2717         regvalue=$_regvalue
2718     fi
2722 if test "$_os" = "WINNT" -a "$WITH_MINGW" != yes; then
2723     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
2724     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
2725         AC_MSG_RESULT([no])
2726         WINDOWS_SDK_ARCH="x86"
2727     else
2728         AC_MSG_RESULT([yes])
2729         WINDOWS_SDK_ARCH="x64"
2730         BITNESS_OVERRIDE=64
2731     fi
2733     AC_MSG_CHECKING([whether to use DirectX])
2734     if test "$enable_directx" = "yes" -o "$enable_directx" = ""; then
2735         ENABLE_DIRECTX="TRUE"
2736         AC_MSG_RESULT([yes])
2737     else
2738         ENABLE_DIRECTX=""
2739         AC_MSG_RESULT([no])
2740     fi
2742     AC_MSG_CHECKING([whether to use ActiveX])
2743     if test "$enable_activex" = "yes" -o "$enable_activex" = ""; then
2744         DISABLE_ACTIVEX=""
2745         SCPDEFS="$SCPDEFS -DWITH_ACTIVEX_COMPONENT"
2746         AC_MSG_RESULT([yes])
2747     else
2748         DISABLE_ACTIVEX="TRUE"
2749         AC_MSG_RESULT([no])
2750     fi
2752     AC_MSG_CHECKING([whether to use ATL])
2753     if test "$enable_atl" = "yes" -o "$enable_atl" = ""; then
2754         DISABLE_ATL=""
2755         AC_MSG_RESULT([yes])
2756     else
2757         DISABLE_ATL="TRUE"
2758         AC_MSG_RESULT([no])
2759     fi
2760 else
2761     ENABLE_DIRECTX=""
2762     DISABLE_ACTIVEX="TRUE"
2763     DISABLE_ATL="TRUE"
2766 AC_SUBST(ENABLE_DIRECTX)
2767 AC_SUBST(DISABLE_ACTIVEX)
2768 AC_SUBST(DISABLE_ATL)
2770 if test "$cross_compiling" = "yes"; then
2771     CROSS_COMPILING=YES
2772     SCPDEFS="$SCPDEFS -DCROSS_COMPILING"
2773 else
2774     CROSS_COMPILING=
2775     BUILD_TYPE="$BUILD_TYPE NATIVE"
2777 AC_SUBST(CROSS_COMPILING)
2779 dnl ===================================================================
2780 dnl  Test the gcc version
2781 dnl ===================================================================
2782 if test "$GCC" = "yes"; then
2783     AC_MSG_CHECKING([the GCC version])
2784     _gcc_version=`$CC -dumpversion`
2785     _gcc_major=`echo $_gcc_version | $AWK -F. '{ print \$1 }'`
2786     GCCVER=`echo $_gcc_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2788     AC_MSG_RESULT([gcc $_gcc_version])
2789     if test "$GCCVER" -lt 040000; then
2790         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.0.0])
2791     fi
2794 dnl ===================================================================
2795 dnl  Is GCC actually Clang?
2796 dnl ===================================================================
2798 COM_GCC_IS_CLANG=
2799 if test "$GCC" = "yes"; then
2800     AC_MSG_CHECKING([whether GCC is actually Clang])
2801     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
2802         #ifndef __clang__
2803         you lose
2804         #endif
2805         int foo=42;
2806         ]])],
2807         [AC_MSG_RESULT([yes])
2808          COM_GCC_IS_CLANG=TRUE],
2809         [AC_MSG_RESULT([no])])
2811     if test "$COM_GCC_IS_CLANG" = TRUE; then
2812         AC_MSG_CHECKING([the Clang version])
2813         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC -E -P -`
2814         CLANG_FULL_VERSION=`echo __clang_version__ | $CC -E -P -`
2815         CLANGVER=`echo $clang_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2816         AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
2817         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
2818     fi
2820 AC_SUBST(COM_GCC_IS_CLANG)
2822 # ===================================================================
2823 # check various GCC options that Clang does not support now but maybe
2824 # will somewhen in the future, check them even for GCC, so that the
2825 # flags are set
2826 # ===================================================================
2828 HAVE_GCC_GGDB2=
2829 HAVE_GCC_FINLINE_LIMIT=
2830 HAVE_GCC_FNO_INLINE=
2831 if test "$GCC" = "yes"; then
2832     AC_MSG_CHECKING([whether $CC supports -ggdb2])
2833     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
2834         # Option just ignored and silly warning that isn't a real
2835         # warning printed
2836         :
2837     else
2838         save_CFLAGS=$CFLAGS
2839         CFLAGS="$CFLAGS -Werror -ggdb2"
2840         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
2841         CFLAGS=$save_CFLAGS
2842     fi
2843     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
2844         AC_MSG_RESULT([yes])
2845     else
2846         AC_MSG_RESULT([no])
2847     fi
2849     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
2850     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
2851         # As above
2852         :
2853     else
2854         save_CFLAGS=$CFLAGS
2855         CFLAGS="$CFLAGS -Werror -finline-limit=0"
2856         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
2857         CFLAGS=$save_CFLAGS
2858     fi
2859     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
2860         AC_MSG_RESULT([yes])
2861     else
2862         AC_MSG_RESULT([no])
2863     fi
2865     AC_MSG_CHECKING([whether $CC supports -fno-inline])
2866     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
2867         # Ditto
2868         :
2869     else
2870         save_CFLAGS=$CFLAGS
2871         CFLAGS="$CFLAGS -Werror -fno-inline"
2872         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
2873         CFLAGS=$save_CFLAGS
2874     fi
2875     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
2876         AC_MSG_RESULT([yes])
2877     else
2878         AC_MSG_RESULT([no])
2879     fi
2881 AC_SUBST(HAVE_GCC_GGDB2)
2882 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
2883 AC_SUBST(HAVE_GCC_FNO_INLINE)
2885 HAVE_LD_BSYMBOLIC_FUNCTIONS=
2886 if test "$GCC" = "yes"; then
2887     AC_MSG_CHECKING( for -Bsymbolic-functions linker support )
2888     bsymbolic_functions_ldflags_save=$LDFLAGS
2889     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
2890     AC_LINK_IFELSE([AC_LANG_PROGRAM([
2891 #include <stdio.h>
2892         ],[
2893 printf ("hello world\n");
2894         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
2895     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
2896         AC_MSG_RESULT( found )
2897     else
2898         AC_MSG_RESULT( not found )
2899     fi
2900     LDFLAGS=$bsymbolic_functions_ldflags_save
2902 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
2904 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
2905 # NOTE: must _not_ be used for bundled external libraries!
2906 ISYSTEM=
2907 if test "$GCC" = "yes"; then
2908     AC_MSG_CHECKING( for -isystem )
2909     save_CFLAGS=$CFLAGS
2910     CFLAGS="$CFLAGS -Werror"
2911     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM=-isystem ],[])
2912     CFLAGS=$save_CFLAGS
2913     if test -n "$ISYSTEM"; then
2914         AC_MSG_RESULT(yes)
2915     else
2916         AC_MSG_RESULT(no)
2917     fi
2919 if test -z "$ISYSTEM"; then
2920     # fall back to using -I
2921     ISYSTEM=-I
2923 AC_SUBST(ISYSTEM)
2925 dnl ===================================================================
2926 dnl  Check which Visual Studio or MinGW compiler is used
2927 dnl ===================================================================
2929 map_vs_year_to_version()
2931     # Return value: $vsversion
2933     unset vsversion
2935     case $1 in
2936     2008)
2937         vsversion=9.0;;
2938     2010)
2939         vsversion=10.0;;
2940     2012)
2941         vsversion=11.0;;
2942     *)
2943         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
2944     esac
2947 vs_versions_to_check()
2949     # Args: $1 (optional) : versions to check, in the order of preference
2950     # Return value: $vsversions
2952     unset vsversions
2954     if test -n "$1"; then
2955         map_vs_year_to_version "$1"
2956         vsversions=$vsversion
2957     else
2958         # By default we prefer 2012, then 2010, then 2008
2959         vsversions="11.0 10.0 9.0"
2960     fi
2963 find_msvs()
2965     # Find Visual Studio 2012/2010/2008
2966     # Args: $1 (optional) : versions to check, in the order of preference
2967     # Return value: $vstest
2969     unset vstest
2971     vs_versions_to_check "$1"
2973     for ver in $vsversions; do
2974         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/ProductDir
2975         if test -n "$regvalue"; then
2976             vstest=$regvalue
2977             break
2978         fi
2979         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VS/ProductDir
2980         if test -n "$regvalue"; then
2981             vstest=$regvalue
2982             break
2983         fi
2984     done
2987 find_msvc()
2989     # Find Visual C++ 2012/2010/2008
2990     # Args: $1 (optional) : The VS version year
2991     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot
2993     unset vctest vcnum vcnumwithdot
2995     vs_versions_to_check "$1"
2997     for ver in $vsversions; do
2998         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
2999         if test -n "$regvalue"; then
3000             vctest=$regvalue
3001             break
3002         fi
3003         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VC/ProductDir
3004         if test -n "$regvalue"; then
3005             vctest=$regvalue
3006             break
3007         fi
3008     done
3009     if test -n "$vctest"; then
3010         vcnumwithdot=$ver
3011         case "$vcnumwithdot" in
3012         9.0)
3013             vcyear=2008
3014             vcnum=90
3015             ;;
3016         10.0)
3017             vcyear=2010
3018             vcnum=100
3019             ;;
3020         11.0)
3021             vcyear=2012
3022             vcnum=110
3023             ;;
3024         esac
3025     fi
3028 SHOWINCLUDES_PREFIX=
3029 if test "$_os" = "WINNT"; then
3030     if test "$WITH_MINGW" != "yes"; then
3031         AC_MSG_CHECKING([Visual C++])
3033         find_msvc "$with_visual_studio"
3035         if test -z "$vctest"; then
3036             if test -n "$with_visual_studio"; then
3037                 AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3038             else
3039                 AC_MSG_ERROR([No Visual Studio 2012, 2010 or 2008 installation found])
3040             fi
3041         fi
3043         if test "$BITNESS_OVERRIDE" = ""; then
3044             if test -f "$vctest/bin/cl.exe"; then
3045                 VC_PRODUCT_DIR=$vctest
3046             else
3047                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3048             fi
3049         else
3050             # It makes sense, I think, to restrict 64-bit support to VS2010 or newer
3051             if test $vcnum -lt 100; then
3052                AC_MSG_ERROR([We have no plans to support building a 64-bit LibreOffice with VS 2008])
3053             fi
3055             if test -f "$vctest/bin/amd64/cl.exe"; then
3056                 VC_PRODUCT_DIR=$vctest
3057             else
3058                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/amd64/cl.exe])
3059             fi
3060         fi
3062         VC_PRODUCT_DIR=`cygpath -d "$VC_PRODUCT_DIR"`
3063         VC_PRODUCT_DIR=`cygpath -u "$VC_PRODUCT_DIR"`
3064         AC_MSG_RESULT([$VC_PRODUCT_DIR])
3066         dnl ===========================================================
3067         dnl  Check for the corresponding mspdb*.dll
3068         dnl ===========================================================
3070         MSPDB_PATH=
3072         if test "$BITNESS_OVERRIDE" == ""; then
3073             MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3074         else
3075             MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3076         fi
3078         case $vcnum in
3079         90)
3080             mspdbnum=80;;
3081         *)
3082             mspdbnum=$vcnum;;
3083         esac
3085         if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3086             AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3087         fi
3089         MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3090         MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3092         dnl The path needs to be added before cl is called
3093         PATH="$MSPDB_PATH:$PATH"
3095         AC_MSG_CHECKING([cl.exe])
3097         # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3098         # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3099         # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3100         # is not enough?
3102         if test -z "$CC"; then
3103             if test "$BITNESS_OVERRIDE" = ""; then
3104                 if test -f "$VC_PRODUCT_DIR/bin/cl.exe"; then
3105                     CC="$VC_PRODUCT_DIR/bin/cl.exe"
3106                 fi
3107             else
3108                 if test -f "$VC_PRODUCT_DIR/bin/amd64/cl.exe"; then
3109                     CC="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3110                 fi
3111             fi
3113             # This gives us a posix path with 8.3 filename restrictions
3114             CC=`cygpath -d "$CC"`
3115             CC=`cygpath -u "$CC"`
3116         fi
3118         if test -n "$CC"; then
3119             # Remove /cl.exe from CC case insensitive
3120             AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3121             if test "$BITNESS_OVERRIDE" = ""; then
3122                 COMPATH=`echo $CC | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3123             else
3124                 if test -n "$VC_PRODUCT_DIR"; then
3125                     # Huh, why not just an assignment?
3126                     COMPATH=`echo $VC_PRODUCT_DIR`
3127                 fi
3128             fi
3129             export INCLUDE=`cygpath -d "$COMPATH/Include"`
3131             PathFormat "$COMPATH"
3132             COMPATH="$formatted_path"
3134             VCVER=$vcnum
3135             MSVSVER=$vcyear
3137             # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3138             # are always "better", we list them in reverse chronological order.
3140             case $vcnum in
3141             90)
3142                 COMEX=12
3143                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="7.1A 7.1 7.0A 6.0A"
3144                 ;;
3145             100)
3146                 COMEX=13
3147                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="7.1A 7.1 7.0A 6.0A"
3148                 ;;
3149             110)
3150                 COMEX=14
3151                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="8.0"
3152                 ;;
3153             esac
3155             # The expectation is that --with-windows-sdk should not need to be used
3156             if test -n "$with_windows_sdk"; then
3157                 case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3158                 *" "$with_windows_sdk" "*)
3159                     WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3160                     ;;
3161                 *)
3162                     AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work witn VS $MSVSVER])
3163                     ;;
3164                 esac
3165             fi
3166         else
3167             AC_MSG_ERROR([Visual C++ not found after all, huh])
3168         fi
3170         dnl We need to guess the prefix of the -showIncludes output, it can be
3171         dnl localized
3172         AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3173         echo "#include <stdlib.h>" > conftest.c
3174         SHOWINCLUDES_PREFIX=`$CC -c -showIncludes conftest.c 2>/dev/null | \
3175             grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3176         rm -f conftest.c conftest.obj
3177         if test -z "$SHOWINCLUDES_PREFIX"; then
3178             AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3179         else
3180             AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3181         fi
3183         # Check for 64-bit (cross-)compiler to use to build the 64-bit
3184         # version of the Explorer extension (and maybe other small
3185         # bits, too) needed when installing a 32-bit LibreOffice on a
3186         # 64-bit OS. The 64-bit Explorer extension is a feature that
3187         # has been present since long in OOo. Don't confuse it with
3188         # building LibreOffice itself as 64-bit code, which is
3189         # unfinished work and highly experimental.
3191         BUILD_X64=
3192         CXX_X64_BINARY=
3193         LINK_X64_BINARY=
3194         LIBMGR_X64_BINARY=
3196         if test "$BITNESS_OVERRIDE" = ""; then
3197             AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3198             if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3199                 # Prefer native x64 compiler to cross-compiler, in case we are running
3200                 # the build on a 64-bit OS.
3201                 if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3202                     BUILD_X64=TRUE
3203                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3204                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3205                     LIBMGR_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/lib.exe"
3206                 elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3207                     BUILD_X64=TRUE
3208                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3209                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3210                     LIBMGR_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/lib.exe"
3211                 fi
3212             fi
3213             if test "$BUILD_X64" = TRUE; then
3214                 AC_MSG_RESULT([found])
3215             else
3216                 AC_MSG_RESULT([not found])
3217                 AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3218             fi
3219         fi
3220         AC_SUBST(BUILD_X64)
3222         # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3223         AC_SUBST(CXX_X64_BINARY)
3224         AC_SUBST(LINK_X64_BINARY)
3225         AC_SUBST(LIBMGR_X64_BINARY)
3227     else
3228         AC_MSG_CHECKING([the compiler is MinGW])
3229         MACHINE_PREFIX=`$CC -dumpmachine`
3230         if echo $MACHINE_PREFIX | $GREP -q mingw32; then
3231             COMPATH=`echo "$COMPATH" | sed -e 's,/bin$,,'`
3232             AC_MSG_RESULT([yes])
3233         else
3234             AC_MSG_ERROR([Compiler is not MinGW.])
3235         fi
3236     fi
3238 AC_SUBST(COMEX)
3239 AC_SUBST(VCVER)
3240 PathFormat "$MSPDB_PATH"
3241 MSPDB_PATH="$formatted_path"
3242 AC_SUBST(SHOWINCLUDES_PREFIX)
3245 # dbghelp.dll
3247 if test "$_os" == "WINNT"; then
3248     BUILD_TYPE="$BUILD_TYPE DBGHELP"
3252 # unowinreg.dll
3254 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3255 AC_SUBST(UNOWINREG_DLL)
3258 # prefix C with ccache if needed
3260 if test "$CCACHE" != ""; then
3261     AC_MSG_CHECKING([whether $CC is already ccached])
3263     AC_LANG_PUSH([C])
3264     save_CFLAGS=$CFLAGS
3265     CFLAGS="$CFLAGS --ccache-skip -O2"
3266     dnl an empty program will do, we're checking the compiler flags
3267     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3268                       [use_ccache=yes], [use_ccache=no])
3269     if test $use_ccache = yes; then
3270         AC_MSG_RESULT([yes])
3271     else
3272         CC="$CCACHE $CC"
3273         AC_MSG_RESULT([no])
3274     fi
3275     CFLAGS=$save_CFLAGS
3276     AC_LANG_POP([C])
3279 dnl Set the ENABLE_DBGUTIL variable
3280 dnl ===================================================================
3281 AC_MSG_CHECKING([whether to build with additional debug utilities])
3282 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3283     ENABLE_DBGUTIL="TRUE"
3284     # this is an extra var so it can have different default on different MSVC
3285     # versions (in case there are version specific problems with it)
3286     MSVC_USE_DEBUG_RUNTIME="TRUE"
3287     PROEXT=""
3288     PRODUCT=""
3290     AC_MSG_RESULT([yes])
3291     # cppunit and graphite expose STL in public headers
3292     if test "$with_system_cppunit" = "yes"; then
3293         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3294     else
3295         with_system_cppunit=no
3296     fi
3297     if test "$with_system_graphite" = "yes"; then
3298         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3299     else
3300         with_system_graphite=no
3301     fi
3302     if test "$with_system_mysql_cppconn" = "yes"; then
3303         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3304     else
3305         with_system_mysql_cppconn=no
3306     fi
3307     if test "$with_system_orcus" = "yes"; then
3308         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3309     else
3310         with_system_orcus=no
3311     fi
3312     if test "$with_system_libcmis" = "yes"; then
3313         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3314     else
3315         with_system_libcmis=no
3316     fi
3317 else
3318     ENABLE_DBGUTIL=""
3319     MSVC_USE_DEBUG_RUNTIME=""
3320     # PRODUCT is old concept, still used by build.pl .
3321     PRODUCT="full"
3322     PROEXT=".pro"
3323     AC_MSG_RESULT([no])
3325 AC_SUBST(ENABLE_DBGUTIL)
3326 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3327 AC_SUBST(PRODUCT)
3328 AC_SUBST(PROEXT)
3330 dnl Set the ENABLE_DEBUG variable.
3331 dnl ===================================================================
3332 AC_MSG_CHECKING([whether to do a debug build])
3333 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3334     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3336 if test -n "$ENABLE_DBGUTIL"; then
3337     if test "$enable_debug" = "no"; then
3338         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3339     fi
3340     ENABLE_DEBUG="TRUE"
3341     AC_MSG_RESULT([yes (dbgutil)])
3342 elif test -n "$enable_debug" && test "$enable_debug" != "no"; then
3343     ENABLE_DEBUG="TRUE"
3344     AC_MSG_RESULT([yes])
3345 else
3346     ENABLE_DEBUG=""
3347     AC_MSG_RESULT([no])
3349 AC_SUBST(ENABLE_DEBUG)
3351 dnl Selective debuginfo
3352 ENABLE_DEBUGINFO_FOR=
3353 if test -n "$ENABLE_DEBUG"; then
3354     AC_MSG_CHECKING([whether to use selective debuginfo])
3355     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3356         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3357         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3358     else
3359         ENABLE_DEBUGINFO_FOR=all
3360         AC_MSG_RESULT([no, for all])
3361     fi
3363 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3365 dnl Check for enable symbols option
3366 dnl ===================================================================
3367 AC_MSG_CHECKING([whether to include symbols while preserve optimization])
3368 if test -n "$enable_symbols" -a "$enable_symbols" != "no"; then
3369     ENABLE_SYMBOLS="TRUE"
3370     if test -n "$ENABLE_DBGUTIL"; then
3371         AC_MSG_ERROR([--enable-dbgutil cannot be used with --enable-symbols])
3372     elif test -n "$ENABLE_DEBUG"; then
3373         AC_MSG_ERROR([--enable-debug cannot be used with --enable-symbols])
3374     fi
3375     AC_MSG_RESULT([yes])
3376 else
3377     if test -n "$enable_symbols" -a "$enable_symbols" = "no"; then
3378         ENABLE_SYMBOLS="FALSE"
3379     else
3380         ENABLE_SYMBOLS=
3381     fi
3382     AC_MSG_RESULT([no])
3384 AC_SUBST(ENABLE_SYMBOLS)
3386 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
3387 # By default use the ones specified by our build system,
3388 # but explicit override is possible.
3389 AC_MSG_CHECKING(for explicit AFLAGS)
3390 if test -n "$AFLAGS"; then
3391     AC_MSG_RESULT([$AFLAGS])
3392     x_AFLAGS=
3393 else
3394     AC_MSG_RESULT(no)
3395     x_AFLAGS=[\#]
3397 AC_MSG_CHECKING(for explicit CFLAGS)
3398 if test -n "$CFLAGS"; then
3399     AC_MSG_RESULT([$CFLAGS])
3400     x_CFLAGS=
3401 else
3402     AC_MSG_RESULT(no)
3403     x_CFLAGS=[\#]
3405 AC_MSG_CHECKING(for explicit CXXFLAGS)
3406 if test -n "$CXXFLAGS"; then
3407     AC_MSG_RESULT([$CXXFLAGS])
3408     x_CXXFLAGS=
3409 else
3410     AC_MSG_RESULT(no)
3411     x_CXXFLAGS=[\#]
3413 AC_MSG_CHECKING(for explicit OBJCFLAGS)
3414 if test -n "$OBJCFLAGS"; then
3415     AC_MSG_RESULT([$OBJCFLAGS])
3416     x_OBJCFLAGS=
3417 else
3418     AC_MSG_RESULT(no)
3419     x_OBJCFLAGS=[\#]
3421 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
3422 if test -n "$OBJCXXFLAGS"; then
3423     AC_MSG_RESULT([$OBJCXXFLAGS])
3424     x_OBJCXXFLAGS=
3425 else
3426     AC_MSG_RESULT(no)
3427     x_OBJCXXFLAGS=[\#]
3429 AC_MSG_CHECKING(for explicit LDFLAGS)
3430 if test -n "$LDFLAGS"; then
3431     AC_MSG_RESULT([$LDFLAGS])
3432     x_LDFLAGS=
3433 else
3434     AC_MSG_RESULT(no)
3435     x_LDFLAGS=[\#]
3437 AC_SUBST(AFLAGS)
3438 AC_SUBST(CFLAGS)
3439 AC_SUBST(CXXFLAGS)
3440 AC_SUBST(OBJCFLAGS)
3441 AC_SUBST(OBJCXXFLAGS)
3442 AC_SUBST(LDFLAGS)
3443 AC_SUBST(x_AFLAGS)
3444 AC_SUBST(x_CFLAGS)
3445 AC_SUBST(x_CXXFLAGS)
3446 AC_SUBST(x_OBJCFLAGS)
3447 AC_SUBST(x_OBJCXXFLAGS)
3448 AC_SUBST(x_LDFLAGS)
3451 # determine CPU, CPUNAME, GUI, GUIBASE, ...
3453 LIB64="lib"
3454 SOLARINC=
3456 case "$host_os" in
3458 aix*)
3459     COM=GCC
3460     CPU=P
3461     CPUNAME=POWERPC
3462     GUI=UNX
3463     GUIBASE=unx
3464     OS=AIX
3465     RTL_OS=AIX
3466     RTL_ARCH=PowerPC
3467     PLATFORMID=aix_powerpc
3468     OUTPATH=unxaigppc
3469     P_SEP=:
3470     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3471     ;;
3473 cygwin*)
3474     COM=MSC
3475     GUI=WNT
3476     GUIBASE=not-used
3477     OS=WNT
3478     RTL_OS=Windows
3479     P_SEP=";"
3481     case "$host_cpu" in
3482     i*86|x86_64)
3483         if test "$BITNESS_OVERRIDE" = 64; then
3484             CPU=X
3485             CPUNAME=X86_64
3486             RTL_ARCH=X86_64
3487             LIB64="lib/x64"
3488             PLATFORMID=windows_x86_64
3489             OUTPATH=wntmscx$COMEX
3490         else
3491             CPU=I
3492             CPUNAME=INTEL
3493             RTL_ARCH=x86
3494             PLATFORMID=windows_x86
3495             OUTPATH=wntmsci$COMEX
3496         fi
3497         ;;
3498     *)
3499         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3500         ;;
3501     esac
3502     SCPDEFS="$SCPDEFS -D_MSC_VER"
3503     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3504     ;;
3506 darwin*)
3507     COM=GCC
3508     GUI=UNX
3509     GUIBASE=not-used
3510     OS=MACOSX
3511     RTL_OS=MacOSX
3512     P_SEP=:
3514     case "$host_cpu" in
3515     arm*)
3516         CPU=R
3517         CPUNAME=ARM
3518         RTL_ARCH=ARM_EABI
3519         PLATFORMID=ios_arm
3520         OUTPATH=unxiosr
3521         OS=IOS
3522         SDKDIR=sdk
3523         ;;
3524     i*86)
3525         if test "$BITNESS_OVERRIDE" = 64; then
3526             AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
3527         fi
3528         CPU=I
3529         CPUNAME=INTEL
3530         RTL_ARCH=x86
3531         PLATFORMID=macosx_x86
3532         OUTPATH=unxmacxi
3533         ;;
3534     x86_64)
3535         if test "$BITNESS_OVERRIDE" = 64; then
3536             CPU=X
3537             CPUNAME=X86_64
3538             RTL_ARCH=X86_64
3539             PLATFORMID=macosx_x86_64
3540             OUTPATH=unxmacxx
3541         else
3542             CPU=I
3543             CPUNAME=INTEL
3544             RTL_ARCH=x86
3545             PLATFORMID=macosx_x86
3546             OUTPATH=unxmacxi
3547         fi
3548         ;;
3549     *)
3550         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3551         ;;
3552     esac
3553     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3554     ;;
3556 dragonfly*)
3557     COM=GCC
3558     GUI=UNX
3559     GUIBASE=unx
3560     OS=DRAGONFLY
3561     RTL_OS=DragonFly
3562     OUTPATH=unxdfly
3563     P_SEP=:
3565     case "$host_cpu" in
3566     i*86)
3567         CPU=I
3568         CPUNAME=INTEL
3569         RTL_ARCH=x86
3570         PLATFORMID=dragonfly_x86
3571         ;;
3572     x86_64)
3573         CPU=X
3574         CPUNAME=X86_64
3575         RTL_ARCH=X86_64
3576         PLATFORMID=dragonfly_x86_64
3577         ;;
3578     *)
3579         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3580         ;;
3581     esac
3582     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3583     ;;
3585 freebsd*)
3586     COM=GCC
3587     GUI=UNX
3588     GUIBASE=unx
3589     RTL_OS=FreeBSD
3590     OS=FREEBSD
3591     OUTPATH=unxfbsd
3592     P_SEP=:
3594     case "$host_cpu" in
3595     i*86)
3596         CPU=I
3597         CPUNAME=INTEL
3598         RTL_ARCH=x86
3599         PLATFORMID=freebsd_x86
3600         OUTPATH=unxfbsdi
3601         ;;
3602     x86_64)
3603         CPU=X
3604         CPUNAME=X86_64
3605         RTL_ARCH=X86_64
3606         PLATFORMID=freebsd_x86_64
3607         ;;
3608     *)
3609         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3610         ;;
3611     esac
3612     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3613     ;;
3615 kfreebsd*)
3616     COM=GCC
3617     GUI=UNX
3618     GUIBASE=unx
3619     OS=LINUX
3620     RTL_OS=kFreeBSD
3621     P_SEP=:
3623     case "$host_cpu" in
3625     i*86)
3626         CPU=I
3627         CPUNAME=INTEL
3628         RTL_ARCH=x86
3629         PLATFORMID=kfreebsd_x86
3630         OUTPATH=unxkfgi6
3631         ;;
3632     x86_64)
3633         CPU=X
3634         CPUNAME=X86_64
3635         RTL_ARCH=X86_64
3636         LIB64="lib64"
3637         PLATFORMID=kfreebsd_x86_64
3638         OUTPATH=unxkfgx6
3639         ;;
3640     *)
3641         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3642         ;;
3643     esac
3644     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3645     ;;
3647 linux-gnu*)
3648     COM=GCC
3649     GUI=UNX
3650     GUIBASE=unx
3651     OS=LINUX
3652     RTL_OS=Linux
3653     P_SEP=:
3655     case "$host_cpu" in
3657     alpha)
3658         CPU=L
3659         CPUNAME=AXP
3660         RTL_ARCH=ALPHA
3661         PLATFORMID=linux_alpha
3662         OUTPATH=unxlngaxp
3663         ;;
3664     arm*)
3665         CPU=R
3666         CPUNAME=ARM
3667         EPM_FLAGS="-a arm"
3668         OUTPATH=unxlngr
3669         RTL_ARCH=ARM_EABI
3670         PLATFORMID=linux_arm_eabi
3671         case "$host_cpu" in
3672         arm*-linux)
3673             RTL_ARCH=ARM_OABI
3674             PLATFORMID=linux_arm_oabi
3675             ;;
3676         esac
3677         ;;
3678     hppa)
3679         CPU=H
3680         CPUNAME=HPPA
3681         RTL_ARCH=HPPA
3682         EPM_FLAGS="-a hppa"
3683         PLATFORMID=linux_hppa
3684         OUTPATH=unxlnghppa
3685         ;;
3686     i*86)
3687         CPU=I
3688         CPUNAME=INTEL
3689         RTL_ARCH=x86
3690         PLATFORMID=linux_x86
3691         OUTPATH=unxlngi6
3692         ;;
3693     ia64)
3694         CPU=A
3695         CPUNAME=IA64
3696         RTL_ARCH=IA64
3697         PLATFORMID=linux_ia64
3698         OUTPATH=unxlnga
3699         ;;
3700     mips)
3701         CPU=M
3702         CPUNAME=GODSON
3703         RTL_ARCH=MIPS_EB
3704         EPM_FLAGS="-a mips"
3705         PLATFORMID=linux_mips_eb
3706         OUTPATH=unxlngmips
3707         ;;
3708     mips64)
3709         CPU=M
3710         CPUNAME=GODSON
3711         RTL_ARCH=MIPS_EB
3712         EPM_FLAGS="-a mips64"
3713         PLATFORMID=linux_mips_eb
3714         OUTPATH=unxlngmips
3715         ;;
3716     mips64el)
3717         CPU=M
3718         CPUNAME=GODSON
3719         RTL_ARCH=MIPS_EL
3720         EPM_FLAGS="-a mips64el"
3721         PLATFORMID=linux_mips_el
3722         OUTPATH=unxlngmips
3723         ;;
3724     mipsel)
3725         CPU=M
3726         CPUNAME=GODSON
3727         RTL_ARCH=MIPS_EL
3728         EPM_FLAGS="-a mipsel"
3729         PLATFORMID=linux_mips_el
3730         OUTPATH=unxlngmips
3731         ;;
3732     m68k)
3733         CPU=6
3734         CPUNAME=M68K
3735         RTL_ARCH=M68K
3736         PLATFORMID=linux_m68k
3737         OUTPATH=unxlngm68k
3738         ;;
3739     powerpc)
3740         CPU=P
3741         CPUNAME=POWERPC
3742         RTL_ARCH=PowerPC
3743         PLATFORMID=linux_powerpc
3744         OUTPATH=unxlngppc
3745         ;;
3746     powerpc64)
3747         CPU=P
3748         CPUNAME=POWERPC64
3749         RTL_ARCH=PowerPC_64
3750         LIB64="lib64"
3751         PLATFORMID=linux_powerpc_64
3752         OUTPATH=unxlngppc64
3753         ;;
3754     sparc)
3755         CPU=S
3756         CPUNAME=SPARC
3757         RTL_ARCH=SPARC
3758         PLATFORMID=linux_sparc
3759         OUTPATH=unxlngs
3760         ;;
3761     s390)
3762         CPU=3
3763         CPUNAME=S390
3764         RTL_ARCH=S390
3765         PLATFORMID=linux_s390
3766         OUTPATH=unxlngs390
3767         ;;
3768     s390x)
3769         CPU=3
3770         CPUNAME=S390X
3771         RTL_ARCH=S390x
3772         LIB64="lib64"
3773         PLATFORMID=linux_s390x
3774         OUTPATH=unxlngs390x
3775         ;;
3776     x86_64)
3777         CPU=X
3778         CPUNAME=X86_64
3779         RTL_ARCH=X86_64
3780         LIB64="lib64"
3781         PLATFORMID=linux_x86_64
3782         OUTPATH=unxlngx6
3783         ;;
3784     *)
3785         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3786         ;;
3787     esac
3788     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3789     ;;
3791 linux-android*)
3792     COM=GCC
3793     GUI=UNX
3794     GUIBASE=not-used
3795     OS=ANDROID
3796     RTL_OS=Android
3797     P_SEP=:
3799     case "$host_cpu" in
3801     arm|armel)
3802         CPU=R
3803         CPUNAME=ARM
3804         RTL_ARCH=ARM_EABI
3805         PLATFORMID=android_arm_eabi
3806         OUTPATH=unxandr
3807         ;;
3808     mips|mipsel)
3809         CPU=M
3810         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
3811         RTL_ARCH=MIPS_EL
3812         PLATFORMID=android_mips_el
3813         OUTPATH=unxandm
3814         ;;
3815     i*86)
3816         CPU=I
3817         CPUNAME=INTEL
3818         RTL_ARCH=x86
3819         PLATFORMID=android_x86
3820         OUTPATH=unxandi
3821         ;;
3822     *)
3823         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3824         ;;
3825     esac
3826     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3827     ;;
3829 mingw*)
3830     COM=GCC
3831     GUI=WNT
3832     GUIBASE=not-used
3833     OS=WNT
3834     RTL_OS=Windows
3835     P_SEP=:
3837     case "$host_cpu" in
3838     i*86|x86_64)
3839         if test "$BITNESS_OVERRIDE" = 64; then
3840             CPU=X
3841             CPUNAME=X86_64
3842             RTL_ARCH=X86_84
3843             PLATFORMID=windows_x86_64
3844             OUTPATH=wntgccx$COMEX
3845         else
3846             CPU=I
3847             CPUNAME=INTEL
3848             RTL_ARCH=x86
3849             PLATFORMID=windows_x86
3850             OUTPATH=wntgcci$COMEX
3851         fi
3852         ;;
3853     *)
3854         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3855         ;;
3856     esac
3857     SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgcci"
3858     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3859     ;;
3861 *netbsd*)
3863     COM=GCC
3864     GUI=UNX
3865     GUIBASE=unx
3866     OS=NETBSD
3867     RTL_OS=NetBSD
3868     OUTPATH=unxnbsd
3869     P_SEP=:
3871     case "$host_cpu" in
3872     i*86)
3873         CPU=I
3874         CPUNAME=INTEL
3875         RTL_ARCH=x86
3876         PLATFORMID=netbsd_x86
3877         ;;
3878     powerpc)
3879         CPU=P
3880         CPUNAME=POWERPC
3881         RTL_ARCH=PowerPC
3882         PLATFORMID=netbsd_powerpc
3883         ;;
3884     sparc)
3885         CPU=S
3886         CPUNAME=SPARC
3887         RTL_ARCH=SPARC
3888         PLATFORMID=netbsd_sparc
3889         ;;
3890     x86_64)
3891         CPU=X
3892         CPUNAME=X86_64
3893         RTL_ARCH=X86_64
3894         PLATFORMID=netbsd_x86_64
3895         ;;
3896     *)
3897         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3898         ;;
3899     esac
3900     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3901     ;;
3903 openbsd*)
3904     COM=GCC
3905     GUI=UNX
3906     GUIBASE=unx
3907     OS=OPENBSD
3908     RTL_OS=OpenBSD
3909     OUTPATH=unxobsd
3910     P_SEP=:
3912     case "$host_cpu" in
3913     i*86)
3914         CPU=I
3915         CPUNAME=INTEL
3916         RTL_ARCH=x86
3917         PLATFORMID=openbsd_x86
3918         ;;
3919     x86_64)
3920         CPU=X
3921         CPUNAME=X86_64
3922         RTL_ARCH=X86_64
3923         PLATFORMID=openbsd_x86_64
3924         ;;
3925     *)
3926         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3927         ;;
3928     esac
3929     SOLARINC="$SOLARINC -I/usr/local/include"
3930     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3931     SOLARLIB="$SOLARLIB -L/usr/local/lib"
3933     ;;
3935 solaris*)
3937     COM=GCC
3938     GUI=UNX
3939     GUIBASE=unx
3940     OS=SOLARIS
3941     RTL_OS=Solaris
3942     P_SEP=:
3944     case "$host_cpu" in
3945     i*86)
3946         CPU=I
3947         CPUNAME=INTEL
3948         RTL_ARCH=x86
3949         PLATFORMID=solaris_x86
3950         OUTPATH=unxsogi
3951         ;;
3952     sparc)
3953         CPU=S
3954         CPUNAME=SPARC
3955         RTL_ARCH=SPARC
3956         PLATFORMID=solaris_sparc
3957         OUTPATH=unxsogs
3958         ;;
3959     *)
3960         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3961         ;;
3962     esac
3963     SOLARINC="$SOLARINC -I/usr/local/include"
3964     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3965     SOLARLIB="$SOLARLIB -L$COMPATH/lib"
3966     SOLARLIB="$SOLARLIB -L/usr/local/bin -L/usr/dt/lib -L/usr/openwin/lib"
3967     ;;
3970     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
3971     ;;
3972 esac
3974 if test "$enable_headless" = "yes"; then
3975     if test "$GUIBASE" != "unx"; then
3976         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --enable-headless])
3977     fi
3978     GUIBASE=headless
3981 INPATH="${OUTPATH}${PROEXT}"
3982 if test -n "${with_solver_and_workdir_root}"; then
3983     PathFormat "${with_solver_and_workdir_root}"
3984     # IsValidFilePath in /sal/osl/w32/file_url.cxx rejects "X:\\" breaking idlc
3985     if echo ${formatted_path} | $GREP -q '/$'; then
3986         WORKDIR=${formatted_path}workdir/${INPATH}
3987         INSTDIR=${formatted_path}instdir/${INPATH}
3988     else
3989         WORKDIR=${formatted_path}/workdir/${INPATH}
3990         INSTDIR=${formatted_path}/instdir/${INPATH}
3991     fi
3992 else
3993     WORKDIR=${BUILDDIR}/workdir/${INPATH}
3994     INSTDIR=${BUILDDIR}/instdir/${INPATH}
3996 OUTDIR="${SOLARVER}/${INPATH}"
3997 SOLARINC="-I. -I$SRC_ROOT/include -I${SOLARVER}/$INPATH/inc/external -I${SOLARVER}/$INPATH/inc $SOLARINC"
3998 AC_SUBST(COM)
3999 AC_SUBST(CPU)
4000 AC_SUBST(CPUNAME)
4001 AC_SUBST(RTL_OS)
4002 AC_SUBST(RTL_ARCH)
4003 AC_SUBST(EPM_FLAGS)
4004 AC_SUBST(GUI)
4005 AC_SUBST(GUIBASE)
4006 AC_SUBST(INPATH)
4007 AC_SUBST([INSTDIR])
4008 AC_SUBST(OS)
4009 AC_SUBST(OUTDIR)
4010 AC_SUBST(OUTPATH)
4011 AC_SUBST(P_SEP)
4012 AC_SUBST(SOLARVER)
4013 AC_SUBST(WORKDIR)
4014 AC_SUBST(PLATFORMID)
4015 AC_DEFINE_UNQUOTED(OUTDIR,"$OUTDIR")
4016 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4018 dnl ===================================================================
4019 dnl Test which package format to use
4020 dnl ===================================================================
4021 AC_MSG_CHECKING([which package format to use])
4022 if test -n "$with_package_format"; then
4023     for i in $with_package_format; do
4024         case "$i" in
4025         aix | bsd | deb | inst | tardist | osx | pkg | rpm | setld | native | portable | archive | dmg | installed | msi)
4026             ;;
4027         *)
4028             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4029 aix - AIX software distribution
4030 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4031 deb - Debian software distribution
4032 inst or tardist - IRIX software distribution
4033 osx - MacOS X software distribution
4034 pkg - Solaris software distribution
4035 rpm - RedHat software distribution
4036 setld - Tru64 (setld) software distribution
4037 native - "Native" software distribution for the platform
4038 portable - Portable software distribution
4040 LibreOffice additionally supports:
4041 archive - .tar.gz or .zip
4042 dmg - Mac OS X .dmg
4043 installed - installation tree
4044 msi - Windows .msi
4045         ])
4046             ;;
4047         esac
4048     done
4049     PKGFORMAT="$with_package_format"
4050 elif test "$enable_epm" = "yes"; then
4051     # defaults
4052     case "$_os" in
4053     Darwin)
4054         PKGFORMAT=dmg
4055         ;;
4056     SunOS)
4057         PKGFORMAT=pkg
4058         ;;
4059     Linux)
4060         # if building on Debian, default should be deb...
4061         if test -e /etc/debian_version; then
4062             PKGFORMAT=deb
4063         else
4064             PKGFORMAT=rpm
4065         fi
4066         ;;
4067     AIX)
4068         PKGFORMAT=rpm
4069         ;;
4070     OpenBSD|DragonFly)
4071         PKGFORMAT=portable
4072         ;;
4073     *BSD)
4074         PKGFORMAT=bsd
4075         ;;
4076     WINNT)
4077         PKGFORMAT=msi
4078         ;;
4079     # we never should get here since we check the arciecture/os at the beginning,
4080     # but go sure...
4081     *)
4082         AC_MSG_ERROR([unknown system])
4083     esac
4084 else
4085     if test "$WITH_MINGW" = "yes"; then
4086         # when tested, we should default this to 'msi', instead of 'archive'
4087         PKGFORMAT=archive
4088     else
4089         PKGFORMAT=native
4090     fi
4092 AC_MSG_RESULT([$PKGFORMAT])
4093 AC_SUBST(PKGFORMAT)
4095 dnl ===================================================================
4096 dnl Set up a different compiler to produce tools to run on the build
4097 dnl machine when doing cross-compilation
4098 dnl ===================================================================
4100 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4101 if test "$cross_compiling" = "yes"; then
4102     AC_MSG_CHECKING([for BUILD platform configuration])
4103     echo
4104     rm -rf CONF-FOR-BUILD config_build.mk
4105     mkdir CONF-FOR-BUILD
4106     (cd $SRC_ROOT && tar cf - \
4107         config.guess \
4108         config_host.mk.in \
4109         Makefile.in \
4110         lo.xcent.in \
4111         config_host/*.in \
4112         bin/get_config_variables \
4113         solenv/bin/getcompver.awk \
4114         solenv/inc/langlist.mk \
4115         instsetoo_native/util/openoffice.lst.in) \
4116     | (cd CONF-FOR-BUILD && tar xf -)
4117     cp configure CONF-FOR-BUILD
4118     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host
4119     (
4120     unset COM GUI GUIBASE OS CPU CPUNAME
4121     unset CC CXX SYSBASE CFLAGS
4122     unset AR NM OBJDUMP PKG_CONFIG RANLIB STRIP
4123     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4124     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
4125     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4126     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4127     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4128     cd CONF-FOR-BUILD
4129     sub_conf_opts=""
4130     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4131     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4132     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4133     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4134     test -n "${with_solver_and_workdir_root}" && sub_conf_opts="$sub_conf_opts --with-solver-and-workdir-root=${with_solver_and_workdir_root}"
4135     test -n "$with_system_boost_for_build" && sub_conf_opts="$sub_conf_opts --with-system-boost"
4136     test -n "$with_system_cppunit_for_build" && sub_conf_opts="$sub_conf_opts --with-system-cppunit"
4137     test -n "$with_system_expat_for_build" && sub_conf_opts="$sub_conf_opts --with-system-expat"
4138     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4139     test -n "$with_system_libxml_for_build" && sub_conf_opts="$sub_conf_opts --with-system-libxml"
4140     # we need the msi build tools on mingw if we are creating the
4141     # installation set
4142     if test "$WITH_MINGW" = "yes"; then
4143         enable_winegcc_for_build=
4144         for pkgformat in $PKGFORMAT; do
4145             case "$pkgformat" in
4146                 msi|native) enable_winegcc_for_build=yes ;;
4147             esac
4148         done
4149         test -n "$enable_winegcc_for_build" && sub_conf_opts="$sub_conf_opts --enable-winegcc"
4150     fi
4151     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4152     # Don't bother having configure look for stuff not needed for the build platform anyway
4153     ./configure \
4154         --disable-graphite \
4155         --disable-postgresql-sdbc \
4156         --with-parallelism="$with_parallelism" \
4157         --without-doxygen \
4158         --without-java \
4159         ENABLE_PDFIMPORT=FALSE \
4160         $sub_conf_opts \
4161         --srcdir=$srcdir \
4162         2>&1 | sed -e 's/^/    /'
4163     test -f ./config_host.mk 2>/dev/null || exit
4164     cp config_host.mk ../config_build.mk
4165     mv config.log ../config.Build.log
4166     mkdir -p ../config_build
4167     mv config_host/*.h ../config_build
4168     . ./bin/get_config_variables OS PATH CC CXX INPATH SYSTEM_LIBXSLT OUTDIR WORKDIR
4170     for V in OS CC CXX INPATH SYSTEM_LIBXSLT; do
4171         VV='$'$V
4172         VV=`eval "echo $VV"`
4173         if test -n "$VV"; then
4174             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4175             echo "$line" >>build-config
4176         fi
4177     done
4179     for V in OUTDIR WORKDIR; do
4180         VV='$'$V
4181         VV=`eval "echo $VV"`
4182         VV=`echo $VV | sed -e 's,/CONF-FOR-BUILD,,g'`
4183         if test -n "$VV"; then
4184             line="${V}_FOR_BUILD='$VV'"
4185             echo "$line" >>build-config
4186         fi
4187     done
4189     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4190     echo "$line" >>build-config
4192     )
4193     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4194     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])
4195     perl -pi -e 's,/CONF-FOR-BUILD,,g' config_build.mk
4196     eval `cat CONF-FOR-BUILD/build-config`
4197     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4198     rm -rf CONF-FOR-BUILD
4199 else
4200     OS_FOR_BUILD="$OS"
4201     CC_FOR_BUILD="$CC"
4202     CXX_FOR_BUILD="$CXX"
4203     INPATH_FOR_BUILD="$INPATH"
4204     OUTDIR_FOR_BUILD="$OUTDIR"
4205     WORKDIR_FOR_BUILD="$WORKDIR"
4207 AC_SUBST(OS_FOR_BUILD)
4208 AC_SUBST(CC_FOR_BUILD)
4209 AC_SUBST(CXX_FOR_BUILD)
4210 AC_SUBST(INPATH_FOR_BUILD)
4211 AC_SUBST(OUTDIR_FOR_BUILD)
4212 AC_SUBST(WORKDIR_FOR_BUILD)
4214 dnl ===================================================================
4215 dnl Our version is defined by the AC_INIT() at the top of this script.
4216 dnl ===================================================================
4218 set `echo AC_PACKAGE_VERSION | sed "s/\./ /g"`
4220 LIBO_VERSION_MAJOR=$1
4221 LIBO_VERSION_MINOR=$2
4222 LIBO_VERSION_MICRO=$3
4223 LIBO_VERSION_PATCH=$4
4225 LIBO_VERSION_SUFFIX=$5
4226 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
4227 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
4228 # they get undoubled before actually passed to sed.
4229 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
4230 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
4231 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
4232 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
4234 AC_SUBST(LIBO_VERSION_MAJOR)
4235 AC_SUBST(LIBO_VERSION_MINOR)
4236 AC_SUBST(LIBO_VERSION_MICRO)
4237 AC_SUBST(LIBO_VERSION_PATCH)
4238 AC_SUBST(LIBO_VERSION_SUFFIX)
4239 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
4241 LIBO_THIS_YEAR=`date +%Y`
4242 AC_SUBST(LIBO_THIS_YEAR)
4244 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
4245 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
4246 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
4247 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
4248 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
4250 # This UPD silly thing must go away soon
4251 UPD="${LIBO_VERSION_MAJOR}${LIBO_VERSION_MINOR}0"
4252 AC_SUBST(UPD)
4254 # This too should go away
4255 SOURCEVERSION="OOO$UPD"
4256 AC_SUBST(SOURCEVERSION)
4258 dnl ===================================================================
4259 dnl Check for syslog header
4260 dnl ===================================================================
4261 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4263 dnl ===================================================================
4264 dnl Set the ENABLE_CRASHDUMP variable.
4265 dnl ===================================================================
4266 AC_MSG_CHECKING([whether to enable crashdump feature])
4267 if test "$enable_crashdump" = "yes"; then
4268     ENABLE_CRASHDUMP="TRUE"
4269     BUILD_TYPE="$BUILD_TYPE CRASHREP"
4270     AC_MSG_RESULT([yes])
4271 else
4272     ENABLE_CRASHDUMP=""
4273     AC_MSG_RESULT([no])
4275 AC_SUBST(ENABLE_CRASHDUMP)
4278 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4279 dnl ===================================================================
4280 AC_MSG_CHECKING([whether to turn warnings to errors])
4281 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4282     EXTERNAL_WARNINGS_NOT_ERRORS="FALSE"
4283     AC_MSG_RESULT([yes])
4284 else
4285     EXTERNAL_WARNINGS_NOT_ERRORS="TRUE"
4286     AC_MSG_RESULT([no])
4288 AC_SUBST(EXTERNAL_WARNINGS_NOT_ERRORS)
4290 dnl Set the ASSERT_ALWAYS_ABORT variable. (Activate --enable-assert-always-abort)
4291 dnl ===================================================================
4292 AC_MSG_CHECKING([whether to have assert to abort in release code])
4293 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4294     ASSERT_ALWAYS_ABORT="TRUE"
4295     AC_MSG_RESULT([yes])
4296 else
4297     ASSERT_ALWAYS_ABORT="FALSE"
4298     AC_MSG_RESULT([no])
4300 AC_SUBST(ASSERT_ALWAYS_ABORT)
4302 dnl Determine whether to use linkoo for the smoketest installation
4303 dnl ===================================================================
4304 AC_MSG_CHECKING([whether to use linkoo for the smoketest installation])
4305 if test $_os = Darwin; then
4306     enable_linkoo=no
4309 if test "$enable_linkoo" = "no"; then
4310     DISABLE_LINKOO="TRUE"
4311     AC_MSG_RESULT([no])
4312 else
4313     DISABLE_LINKOO=
4314     AC_MSG_RESULT([yes])
4316 AC_SUBST(DISABLE_LINKOO)
4318 # Set the ENABLE_LTO variable
4319 # ===================================================================
4320 AC_MSG_CHECKING([whether to use link-time optimization])
4321 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
4322     ENABLE_LTO="TRUE"
4323     AC_MSG_RESULT([yes])
4324 else
4325     ENABLE_LTO=""
4326     AC_MSG_RESULT([no])
4328 AC_SUBST(ENABLE_LTO)
4330 if test "$enable_headless" = "yes"; then
4331     # be sure to do not mess with uneeded stuff
4332     test_randr=no
4333     test_xrender=no
4334     test_cups=no
4335     test_dbus=no
4336     test_fontconfig=yes
4337     test_gtk=no
4338     build_gstreamer=no
4339     build_gstreamer_0_10=no
4340     test_tde=no
4341     test_kde=no
4342     test_kde4=no
4343     test_unix_quickstarter=no
4344     enable_cairo_canvas=no
4345     enable_gnome_vfs=no
4348 dnl ===================================================================
4349 dnl check for cups support
4350 dnl ===================================================================
4351 ENABLE_CUPS=""
4353 if test "$enable_cups" = "no"; then
4354     test_cups=no
4357 AC_MSG_CHECKING([whether to enable CUPS support])
4358 if test "$test_cups" = "yes"; then
4359     ENABLE_CUPS="TRUE"
4360     AC_MSG_RESULT([yes])
4362     AC_MSG_CHECKING([whether cups support is present])
4363     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4364     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4365     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -a "$ac_cv_header_cups_cups_h" != "yes"; then
4366         AC_MSG_ERROR([Could not find CUPS. Install libcupsys2-dev or cups-devel.])
4367     fi
4369 else
4370     AC_MSG_RESULT([no])
4373 AC_SUBST(ENABLE_CUPS)
4375 # fontconfig checks
4376 if test "$test_fontconfig" = "yes"; then
4377     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.2.0])
4378 else
4379     case "$BUILD_TYPE" in
4380     *FONTCONFIG*)
4381         FONTCONFIG_LIBS="-lfontconfig"
4382         ;;
4383     esac
4385 AC_SUBST(FONTCONFIG_CFLAGS)
4386 AC_SUBST(FONTCONFIG_LIBS)
4388 dnl whether to find & fetch external tarballs?
4389 dnl ===================================================================
4390 if test -z "$TARFILE_LOCATION"; then
4391     TARFILE_LOCATION="$SRC_ROOT/src"
4393 AC_SUBST(TARFILE_LOCATION)
4395 AC_MSG_CHECKING([whether we want to fetch tarballs])
4396 if test "$enable_fetch_external" != "no"; then
4397     if test "$with_all_tarballs" = "yes"; then
4398         AC_MSG_RESULT(["yes, all of them"])
4399         DO_FETCH_TARBALLS="ALL"
4400     else
4401         AC_MSG_RESULT(["yes, if we use them"])
4402         DO_FETCH_TARBALLS="YES"
4403     fi
4404 else
4405     AC_MSG_RESULT([no])
4406     DO_FETCH_TARBALLS="NO"
4408 AC_SUBST(DO_FETCH_TARBALLS)
4410 AC_MSG_CHECKING([whether to build help])
4411 if test "$with_help" = "yes" -a $_os != iOS -a $_os != Android; then
4412     AC_MSG_RESULT([yes])
4413     BUILD_TYPE="$BUILD_TYPE HELP"
4414     SCPDEFS="$SCPDEFS -DWITH_HELP"
4415     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4416 else
4417     AC_MSG_RESULT([no])
4420 dnl Test whether to include MySpell dictionaries
4421 dnl ===================================================================
4422 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4423 if test "$with_myspell_dicts" = "yes"; then
4424     AC_MSG_RESULT([yes])
4425     WITH_MYSPELL_DICTS=YES
4426     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4427     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4428 else
4429     AC_MSG_RESULT([no])
4430     WITH_MYSPELL_DICTS=NO
4432 AC_SUBST(WITH_MYSPELL_DICTS)
4434 AC_MSG_CHECKING([whether to use dicts from external paths])
4435 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4436     AC_MSG_RESULT([yes])
4437     SYSTEM_DICTS=YES
4438     AC_MSG_CHECKING([for spelling dictionary directory])
4439     if test -n "$with_external_dict_dir"; then
4440         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4441     else
4442         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4443         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4444             DICT_SYSTEM_DIR=file:///usr/share/myspell
4445         fi
4446     fi
4447     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4448     AC_MSG_CHECKING([for hyphenation patterns directory])
4449     if test -n "$with_external_hyph_dir"; then
4450         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4451     else
4452         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4453     fi
4454     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4455     AC_MSG_CHECKING([for thesaurus directory])
4456     if test -n "$with_external_thes_dir"; then
4457         THES_SYSTEM_DIR=file://$with_external_thes_dir
4458     else
4459         THES_SYSTEM_DIR=file:///usr/share/mythes
4460     fi
4461     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4462 else
4463     AC_MSG_RESULT([no])
4464     SYSTEM_DICTS=NO
4466 AC_SUBST(SYSTEM_DICTS)
4467 AC_SUBST(DICT_SYSTEM_DIR)
4468 AC_SUBST(HYPH_SYSTEM_DIR)
4469 AC_SUBST(THES_SYSTEM_DIR)
4471 dnl ===================================================================
4472 AC_MSG_CHECKING([whether to enable pch feature])
4473 if test -n "$enable_pch" && test "$enable_pch" != "no"; then
4474     if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
4475         ENABLE_PCH="TRUE"
4476         AC_MSG_RESULT([yes])
4477     elif test "$GCC" = "yes"; then
4478         ENABLE_PCH="TRUE"
4479         AC_MSG_RESULT([yes])
4480     else
4481         ENABLE_PCH=""
4482         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4483     fi
4484 else
4485     ENABLE_PCH=""
4486     AC_MSG_RESULT([no])
4488 AC_SUBST(ENABLE_PCH)
4490 dnl ===================================================================
4491 dnl Search all the common names for GNU make
4492 dnl ===================================================================
4493 AC_MSG_CHECKING([for GNU make])
4495 # try to use our own make if it is available and GNUMAKE was not already defined
4496 if test -z "$GNUMAKE"; then
4497     if test -x "/opt/lo/bin/make"; then
4498         GNUMAKE="/opt/lo/bin/make"
4499     fi
4502 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
4503     if test -n "$a"; then
4504         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
4505         if test $? -eq 0;  then
4506             GNUMAKE=`which $a`
4507             break
4508         fi
4509     fi
4510 done
4511 AC_MSG_RESULT($GNUMAKE)
4512 if test -z "$GNUMAKE"; then
4513     AC_MSG_ERROR([not found. install GNU make.])
4516 TAB=`printf '\t'`
4518 AC_MSG_CHECKING([the GNU make version])
4519 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4520 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4521 if test "$_make_longver" -ge "038200"; then
4522     AC_MSG_RESULT([$GNUMAKE $_make_version])
4524 elif test "$_make_longver" -ge "038100"; then
4525     if test "$build_os" = "cygwin"; then
4526         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4527     fi
4528     AC_MSG_RESULT([$GNUMAKE $_make_version])
4530     dnl ===================================================================
4531     dnl Search all the common names for sha1sum
4532     dnl ===================================================================
4533     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4534     if test -z "$SHA1SUM"; then
4535         AC_MSG_ERROR([install the approproate SHA-1 checksumming program for this OS])
4536     elif test "$SHA1SUM" = "openssl"; then
4537         SHA1SUM="openssl sha1"
4538     fi
4539     AC_MSG_CHECKING([for GNU make bug 20033])
4540     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4541     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4542 A := \$(wildcard *.a)
4544 .PHONY: all
4545 all: \$(A:.a=.b)
4546 <TAB>@echo survived bug20033.
4548 .PHONY: setup
4549 setup:
4550 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4552 define d1
4553 @echo lala \$(1)
4554 @sleep 1
4555 endef
4557 define d2
4558 @echo tyty \$(1)
4559 @sleep 1
4560 endef
4562 %.b : %.a
4563 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4564 <TAB>\$(call d1,\$(CHECKSUM)),\
4565 <TAB>\$(call d2,\$(CHECKSUM)))
4567     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4568         no_parallelism_make="YES"
4569         AC_MSG_RESULT([yes, disable parallelism])
4570     else
4571         AC_MSG_RESULT([no, keep parallelism enabled])
4572     fi
4573     rm -rf $TESTGMAKEBUG20033
4574 else
4575     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4578 # find if gnumake support file function
4579 AC_MSG_CHECKING([whether GNU make supports the 'file' function])
4580 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4581 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4582 \$(file >test.txt,Success )
4584 .PHONY: all
4585 all:
4586 <TAB>@cat test.txt
4589 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4590 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4591     HAVE_GNUMAKE_FILE_FUNC="YES"
4592     AC_MSG_RESULT([yes])
4593 else
4594     AC_MSG_RESULT([no])
4596 rm -rf $TESTGMAKEFILEFUNC
4597 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4598 AC_SUBST(GNUMAKE)
4600 _make_ver_check=`$GNUMAKE --version | grep LibreOffice`
4601 STALE_MAKE=
4602 make_warning=
4603 if test "$_make_ver_check" = ""; then
4604    STALE_MAKE=TRUE
4607 HAVE_LD_HASH_STYLE=FALSE
4608 WITH_LINKER_HASH_STYLE=
4609 AC_MSG_CHECKING( for --hash-style gcc linker support )
4610 if test "$GCC" = "yes"; then
4611     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4612         hash_styles="gnu sysv"
4613     elif test "$with_linker_hash_style" = "no"; then
4614         hash_styles=
4615     else
4616         hash_styles="$with_linker_hash_style"
4617     fi
4619     for hash_style in $hash_styles; do
4620         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4621         hash_style_ldflags_save=$LDFLAGS
4622         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
4624         AC_LINK_IFELSE([AC_LANG_PROGRAM(
4625             [
4626 #include <stdio.h>
4627             ],[
4628 printf ("");
4629             ])],
4630             [ if ./conftest$EXEEXT; then
4631                   HAVE_LD_HASH_STYLE=TRUE
4632                   WITH_LINKER_HASH_STYLE=$hash_style
4633               fi],
4634             [HAVE_LD_HASH_STYLE=FALSE])
4635         LDFLAGS=$hash_style_ldflags_save
4636     done
4638     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
4639         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
4640     else
4641         AC_MSG_RESULT( no )
4642     fi
4643     LDFLAGS=$hash_style_ldflags_save
4644 else
4645     AC_MSG_RESULT( no )
4647 AC_SUBST(HAVE_LD_HASH_STYLE)
4648 AC_SUBST(WITH_LINKER_HASH_STYLE)
4650 dnl ===================================================================
4651 dnl Check whether there's a Perl version available.
4652 dnl ===================================================================
4653 if test -z "$with_perl_home"; then
4654     AC_PATH_PROG(PERL, perl)
4655 else
4656     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
4657     _perl_path="$with_perl_home/bin/perl"
4658     if test -x "$_perl_path"; then
4659         PERL=$_perl_path
4660     else
4661         AC_MSG_ERROR([$_perl_path not found])
4662     fi
4665 dnl ===================================================================
4666 dnl Testing for Perl version 5 or greater.
4667 dnl $] is the Perl version variable, it is returned as an integer
4668 dnl ===================================================================
4669 if test "$PERL"; then
4670     AC_MSG_CHECKING([the Perl version])
4671     ${PERL} -e "exit($]);"
4672     _perl_version=$?
4673     if test "$_perl_version" -lt 5; then
4674         AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
4675     fi
4676     AC_MSG_RESULT([checked (perl $_perl_version)])
4677 else
4678     AC_MSG_ERROR([Perl not found, install version 5 of Perl])
4681 dnl ===================================================================
4682 dnl Testing for required Perl modules
4683 dnl ===================================================================
4685 AC_MSG_CHECKING([for required Perl modules])
4686 if `$PERL -e 'use Archive::Zip; use Cwd; use Digest::MD5'`; then
4687     AC_MSG_RESULT([all modules found])
4688 else
4689     AC_MSG_ERROR([Failed to find some modules])
4693 dnl ===================================================================
4694 dnl Check for pkg-config
4695 dnl ===================================================================
4696 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
4697     PKG_PROG_PKG_CONFIG
4700 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
4702     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
4703     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
4704     # explicitly. Or put /path/to/compiler in PATH yourself.
4706     AC_CHECK_TOOL(AR,ar)
4707     AC_CHECK_TOOL(NM,nm)
4708     AC_CHECK_TOOL(OBJDUMP,objdump)
4709     AC_CHECK_TOOL(RANLIB,ranlib)
4710     AC_CHECK_TOOL(STRIP,strip)
4711     if test "$_os" = "WINNT"; then
4712         AC_CHECK_TOOL(DLLTOOL,dlltool)
4713         AC_CHECK_TOOL(WINDRES,windres)
4714     fi
4716 AC_SUBST(AR)
4717 AC_SUBST(DLLTOOL)
4718 AC_SUBST(NM)
4719 AC_SUBST(OBJDUMP)
4720 AC_SUBST(PKG_CONFIG)
4721 AC_SUBST(RANLIB)
4722 AC_SUBST(STRIP)
4723 AC_SUBST(WINDRES)
4725 dnl ===================================================================
4726 dnl pkg-config checks on Mac OS X
4727 dnl ===================================================================
4729 if test $_os = Darwin; then
4730     AC_MSG_CHECKING([for bogus pkg-config])
4731     if test -n "$PKG_CONFIG"; then
4732         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
4733             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
4734         else
4735             if test "$enable_bogus_pkg_config" = "yes"; then
4736                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
4737             else
4738                 AC_MSG_ERROR([yes, from unknown origin. This *will* break the build. Please remove or hide $PKG_CONFIG])
4739             fi
4740         fi
4741     else
4742         AC_MSG_RESULT([no, good])
4743     fi
4746 find_csc()
4748     # Return value: $csctest
4750     unset csctest
4752     if test $VCVER -eq 90; then
4753         reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v3.5/InstallPath"
4754         if test -n "$regvalue"; then
4755             csctest=$regvalue
4756             return
4757         fi
4758         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/InstallRoot
4759         if test -n "$regvalue"; then
4760             csctest=${regvalue}"v2.0.50727"
4761             return
4762         fi
4763     else
4764         reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
4765         if test -n "$regvalue"; then
4766             csctest=$regvalue
4767             return
4768         fi
4769     fi
4772 find_al()
4774     # Return value: $altest
4776     unset altest
4778     for x in `ls /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
4779         reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
4780         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
4781             altest=$regvalue
4782             return
4783         fi
4784     done
4787 find_dotnetsdk()
4789     # Return value: $frametest (that's a silly name...)
4791     unset frametest
4793     for ver in 1.1 2.0; do
4794         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
4795         if test -n "$regvalue"; then
4796             frametest=$regvalue
4797             return
4798         fi
4799     done
4802 find_winsdk_version()
4804     # Args: $1 : SDK version as in "6.0A", "7.0" etc
4805     # Return value: $winsdktest
4807     unset winsdktest
4809     # Why we look for them in this particular order I don't know. But OTOH I
4810     case "$1" in
4811     6.0*|7.*)
4812         reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
4813         if test -n "$regvalue"; then
4814             winsdktest=$regvalue
4815             return
4816         fi
4817         ;;
4818     8.*)
4819         reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
4820         if test -n "$regvalue"; then
4821             winsdktest=$regvalue
4822             return
4823         fi
4824         ;;
4825     esac
4828 find_winsdk()
4830     # Args: $1 (optional) : list of acceptable SDK versions
4831     # Return value: $winsdktest
4833     unset winsdktest
4835     if test -n "$1"; then
4836         sdkversions=$1
4837     else
4838         sdkversions="$WINDOWS_SDK_ACCEPTABLE_VERSIONS"
4839     fi
4841     for ver in $sdkversions; do
4842         find_winsdk_version $ver
4843         if test -n "$winsdktest"; then
4844             return
4845         fi
4846     done
4849 find_msms()
4851     for ver in 9.0 10.0 11.0; do
4852         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
4853         if test -n "$regvalue"; then
4854             if test -e "$regvalue/Microsoft_VC${VCVER}_CRT_x86.msm"; then
4855                 msmdir=$regvalue
4856                 break
4857             fi
4858         fi
4859     done
4860     if test -z "$msmdir"; then
4861         AC_MSG_NOTICE([no registry entry for Merge Module directory - trying "$COMMONPROGRAMFILES\Merge Modules"])
4862         msmdir="$COMMONPROGRAMFILES\Merge Modules"
4863     fi
4864     msmdir=`cygpath -d "$msmdir"`
4865     msmdir=`cygpath -u "$msmdir"`
4866     if test -z "$msmdir"; then
4867         AC_MSG_ERROR([Merge modules not found])
4868     fi
4870     msms="Microsoft_VC${VCVER}_CRT_x86.msm"
4872     if test "$VCVER" = "90"; then
4873         if test -e $msmdir/policy_9_0_Microsoft_VC90_CRT_x86.msm; then
4874             msms="$msms policy_9_0_Microsoft_VC90_CRT_x86.msm"
4875         else
4876             AC_MSG_ERROR([Merge module policy_9_0_Microsoft_VC90_CRT_x86.msm not found])
4877         fi
4878     fi
4880     if test "$BUILD_X64" = TRUE; then
4881         if test "$VCVER" = "90"; then
4882             if test -e $msmdir/policy_9_0_Microsoft_VC90_CRT_x86_x64.msm; then
4883                 msms="$msms policy_9_0_Microsoft_VC90_CRT_x86_x64.msm"
4884             else
4885                 AC_MSG_ERROR([Merge module policy_9_0_Microsoft_VC90_CRT_x86_x64.msm not found])
4886             fi
4887             if test -e $msmdir/Microsoft_VC90_CRT_x86_x64.msm; then
4888                 msms="$msms Microsoft_VC90_CRT_x86_x64.msm"
4889             else
4890                 AC_MSG_ERROR([Merge module Microsoft_VC90_CRT_x86_x64.msm not found])
4891             fi
4892         else
4893             if test -e $msmdir/Microsoft_VC${VCVER}_CRT_x64.msm; then
4894                 msms="$msms Microsoft_VC${VCVER}_CRT_x64.msm"
4895             else
4896                 AC_MSG_ERROR([Merge module Microsoft_VC${VCVER}_CRT_x64.msm not found])
4897             fi
4898         fi
4899     fi
4902 find_msvc_dlls()
4904     if test "$CPUNAME" = "INTEL"; then
4905         vsarch=x86
4906     elif test $VCVER = 9; then
4907         vsarch=amd64
4908     else
4909         vsarch=x64
4910     fi
4912     msvcdllpath="$VC_PRODUCT_DIR/redist/$vsarch/Microsoft.VC${VCVER}.CRT"
4913     MSVC_DEBUG_DLL_PATH="$VC_PRODUCT_DIR/redist/Debug_NonRedist/$vsarch/Microsoft.VC${VCVER}.DebugCRT"
4914     msvcdlls="msvcp${VCVER}.dll msvcr${VCVER}.dll"
4915     MSVC_DEBUG_DLLS="msvcp${VCVER}d.dll msvcr${VCVER}d.dll"
4916     if test "$VCVER" = "90"; then
4917         msvcdlls="$msvcdlls msvcm90.dll Microsoft.VC90.CRT.manifest"
4918         MSVC_DEBUG_DLLS="$MSVC_DEBUG_DLLS msvcm90d.dll Microsoft.VC90.DebugCRT.manifest"
4919     fi
4921     for dll in $msvcdlls; do
4922         if ! test -f "$msvcdllpath/$dll"; then
4923             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
4924         fi
4925     done
4926     if test -n "$MSVC_USE_DEBUG_RUNTIME"; then
4927         for dll in $MSVC_DEBUG_DLLS; do
4928             if ! test -f "$MSVC_DEBUG_DLL_PATH/$dll"; then
4929                 AC_MSG_ERROR([can not find $dll in $MSVC_DEBUG_DLL_PATH])
4930             fi
4931         done
4932     fi
4936 if test "$build_os" = "cygwin"; then
4937     dnl Check midl.exe
4938     AC_MSG_CHECKING([for midl.exe])
4940     find_winsdk
4941     if test -f "$winsdktest/Bin/midl.exe"; then
4942         MIDL_PATH="$winsdktest/Bin"
4943     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
4944         MIDL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
4945     fi
4946     if test ! -f "$MIDL_PATH/midl.exe"; then
4947         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
4948     else
4949         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
4950     fi
4952     # Convert to posix path with 8.3 filename restrictions ( No spaces )
4953     MIDL_PATH=`cygpath -d "$MIDL_PATH"`
4954     MIDL_PATH=`cygpath -u "$MIDL_PATH"`
4956     dnl Check csc.exe
4957     AC_MSG_CHECKING([for csc.exe])
4958     find_csc
4959     if test -f "$csctest/csc.exe"; then
4960         CSC_PATH="$csctest"
4961     fi
4962     if test ! -f "$CSC_PATH/csc.exe"; then
4963         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
4964     else
4965         AC_MSG_RESULT([$CSC_PATH/csc.exe])
4966     fi
4968     CSC_PATH=`cygpath -d "$CSC_PATH"`
4969     CSC_PATH=`cygpath -u "$CSC_PATH"`
4971     dnl Check al.exe
4972     AC_MSG_CHECKING([for al.exe])
4973     find_winsdk
4974     if test -f "$winsdktest/Bin/al.exe"; then
4975         AL_PATH="$winsdktest/Bin"
4976     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
4977         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
4978     fi
4980     if test -z "$AL_PATH"; then
4981         find_al
4982         if test -f "$altest/bin/al.exe"; then
4983             AL_PATH="$altest/bin"
4984         elif test -f "$altest/al.exe"; then
4985             AL_PATH="$altest"
4986         fi
4987     fi
4988     if test ! -f "$AL_PATH/al.exe"; then
4989         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
4990     else
4991         AC_MSG_RESULT([$AL_PATH/al.exe])
4992     fi
4994     AL_PATH=`cygpath -d "$AL_PATH"`
4995     AL_PATH=`cygpath -u "$AL_PATH"`
4997     dnl Check mscoree.lib / .NET Framework dir
4998     AC_MSG_CHECKING(.NET Framework)
4999     find_dotnetsdk
5000     if test -f "$frametest/lib/mscoree.lib"; then
5001         DOTNET_FRAMEWORK_HOME="$frametest"
5002     else
5003         find_winsdk
5004         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/win8/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5005             DOTNET_FRAMEWORK_HOME="$winsdktest"
5006         fi
5007     fi
5009     if test ! -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib" -a ! -f "$DOTNET_FRAMEWORK_HOME/lib/win8/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5010         AC_MSG_ERROR([mscoree.lib (.NET Framework) not found])
5011     fi
5012     AC_MSG_RESULT(found)
5014     PathFormat "$MIDL_PATH"
5015     MIDL_PATH="$formatted_path"
5017     PathFormat "$AL_PATH"
5018     AL_PATH="$formatted_path"
5020     PathFormat "$DOTNET_FRAMEWORK_HOME"
5021     DOTNET_FRAMEWORK_HOME="$formatted_path"
5023     PathFormat "$CSC_PATH"
5024     CSC_PATH="$formatted_path"
5027 dnl ===================================================================
5028 dnl Check if stdc headers are available excluding MSVC.
5029 dnl ===================================================================
5030 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5031     AC_HEADER_STDC
5034 dnl ===================================================================
5035 dnl Testing for C++ compiler and version...
5036 dnl ===================================================================
5038 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5039     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5040     save_CXXFLAGS=$CXXFLAGS
5041     AC_PROG_CXX
5042     CXXFLAGS=$save_CXXFLAGS
5043 else
5044     if test -n "$CC" -a -z "$CXX"; then
5045         CXX="$CC"
5046     fi
5049 dnl check if we are using a buggy version of g++ (currently 3.4.0, 3.4.1 and trunk)
5050 if test "$GXX" = "yes"; then
5051     AC_MSG_CHECKING([the GNU C++ compiler version])
5053     _gpp_version=`$CXX -dumpversion`
5054     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5056     AC_MSG_RESULT([checked (g++ $_gpp_version)])
5058     if test "$_gpp_majmin" = "304"; then
5059         AC_MSG_CHECKING([whether $CXX has the enum bug])
5060         AC_RUN_IFELSE([AC_LANG_SOURCE([[
5061             extern "C" void abort (void);
5062             extern "C" void exit (int status);
5064             enum E { E0, E1, E2, E3, E4, E5 };
5066             void test (enum E e)
5067             {
5068                 if (e == E2 || e == E3 || e == E1)
5069                     exit (1);
5070             }
5072             int main (void)
5073             {
5074                 test (E4);
5075                 test (E5);
5076                 test (E0);
5077                 return 0;
5078             }
5079             ]])],[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])],[])
5080     fi
5081     dnl see https://code.google.com/p/android/issues/detail?id=41770
5082     if test "$_gpp_majmin" -ge "407"; then
5083             glibcxx_threads=no
5084             AC_LANG_PUSH([C++])
5085             AC_REQUIRE_CPP
5086             AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5087             AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5088                 #include <bits/c++config.h>]],[[
5089                 #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5090                 && !defined(_GLIBCXX__PTHREADS) \
5091                 && !defined(_GLIBCXX_HAS_GTHREADS)
5092                 choke me
5093                 #endif
5094             ]])],[AC_MSG_RESULT([yes])
5095             glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5096             AC_LANG_POP([C++])
5097             if test $glibcxx_threads = yes; then
5098                   BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5099             fi
5100      fi
5102 AC_SUBST(BOOST_CXXFLAGS)
5105 # prefx CXX with ccache if needed
5107 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5108     if test "$CCACHE" != ""; then
5109         AC_MSG_CHECKING([whether $CXX is already ccached])
5110         AC_LANG_PUSH([C++])
5111         save_CXXFLAGS=$CXXFLAGS
5112         CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5113         dnl an empty program will do, we're checking the compiler flags
5114         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5115                           [use_ccache=yes], [use_ccache=no])
5116         if test $use_ccache = yes; then
5117             AC_MSG_RESULT([yes])
5118         else
5119             CXX="$CCACHE $CXX"
5120             AC_MSG_RESULT([no])
5121         fi
5122         CXXFLAGS=$save_CXXFLAGS
5123         AC_LANG_POP([C++])
5124     fi
5127 dnl ===================================================================
5128 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5129 dnl ===================================================================
5131 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5132     AC_PROG_CXXCPP
5134     dnl Check whether there's a C pre-processor.
5135     dnl ===================================================================
5136     dnl When using SunStudio compiler, there is a bug with the cc
5137     dnl preprocessor, so use CC preprocessor as the cc preprocessor
5138     dnl See Issuezilla #445.
5139     dnl ===================================================================
5140     if test "$_os" = "SunOS"; then
5141         CPP=$CXXCPP
5142     else
5143         AC_PROG_CPP
5144     fi
5148 dnl ===================================================================
5149 dnl Find integral type sizes and alignments
5150 dnl ===================================================================
5152 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5154     AC_CHECK_SIZEOF(long)
5155     AC_CHECK_SIZEOF(short)
5156     AC_CHECK_SIZEOF(int)
5157     AC_CHECK_SIZEOF(long long)
5158     AC_CHECK_SIZEOF(double)
5159     AC_CHECK_SIZEOF(void*)
5161     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5162     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5163     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5164     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5165     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5167     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5168     m4_pattern_allow([AC_CHECK_ALIGNOF])
5169     m4_ifdef([AC_CHECK_ALIGNOF],
5170         [
5171             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5172             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5173             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5174             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5175         ],
5176         [
5177             case "$_os-$host_cpu" in
5178             Linux-i686)
5179                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5180                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5181                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5182                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5183                 ;;
5184             Linux-x86_64)
5185                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5186                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5187                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5188                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5189                 ;;
5190             *)
5191                 if test -z "$ac_cv_alignof_short" -o \
5192                         -z "$ac_cv_alignof_int" -o \
5193                         -z "$ac_cv_alignof_long" -o \
5194                         -z "$ac_cv_alignof_double"; then
5195                    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.])
5196                 fi
5197                 ;;
5198             esac
5199         ])
5201     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5202     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5203     if test $ac_cv_sizeof_long -eq 8; then
5204         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5205     elif test $ac_cv_sizeof_double -eq 8; then
5206         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5207     else
5208         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5209     fi
5211     AC_C_BIGENDIAN
5212     WORDS_BIGENDIAN=$ac_cv_c_bigendian
5214     dnl Check for large file support
5215     AC_SYS_LARGEFILE
5216     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5217         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5218     fi
5219     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5220         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5221     fi
5222 else
5223     # Hardcode for MSVC
5224     SAL_TYPES_SIZEOFSHORT=2
5225     SAL_TYPES_SIZEOFINT=4
5226     SAL_TYPES_SIZEOFLONG=4
5227     SAL_TYPES_SIZEOFLONGLONG=8
5228     if test "$BITNESS_OVERRIDE" = ""; then
5229         SAL_TYPES_SIZEOFPOINTER=4
5230     else
5231         SAL_TYPES_SIZEOFPOINTER=8
5232     fi
5233     SAL_TYPES_ALIGNMENT2=2
5234     SAL_TYPES_ALIGNMENT4=4
5235     SAL_TYPES_ALIGNMENT8=8
5236     WORDS_BIGENDIAN=no
5237     LFS_CFLAGS=''
5239 AC_SUBST(WORDS_BIGENDIAN)
5240 AC_SUBST(LFS_CFLAGS)
5242 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5243 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5244 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5245 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5246 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5247 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5248 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5249 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5251 dnl ===================================================================
5252 dnl Check if valgrind headers are available
5253 dnl ===================================================================
5254 if test "$cross_compiling" = yes -o "$ENABLE_DBGUTIL" != TRUE; then
5255     ENABLE_VALGRIND=FALSE
5256 else
5257     prev_cppflags=$CPPFLAGS
5258     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5259     AC_CHECK_HEADER([valgrind/valgrind.h],
5260         [ENABLE_VALGRIND=TRUE],[ENABLE_VALGRIND=FALSE])
5261     CPPFLAGS=$prev_cppflags
5263 AC_SUBST([ENABLE_VALGRIND])
5264 if test "$ENABLE_VALGRIND" = FALSE; then
5265     VALGRIND_CFLAGS=
5267 AC_SUBST([VALGRIND_CFLAGS])
5269 dnl ===================================================================
5270 dnl Compiler plugins
5271 dnl ===================================================================
5273 COMPILER_PLUGINS=
5274 # currently only Clang
5275 if test "$COM_GCC_IS_CLANG" = "TRUE"; then
5276     if test -n "$enable_compiler_plugins"; then
5277         compiler_plugins="$enable_compiler_plugins"
5278     elif test -n "$ENABLE_DBGUTIL"; then
5279         compiler_plugins=test
5280     else
5281         compiler_plugins=no
5282     fi
5283     if test "$compiler_plugins" != "no"; then
5284         dnl The prefix where Clang resides, override to where Clang resides if
5285         dnl using a source build:
5286         if test -z "$CLANGDIR"; then
5287             CLANGDIR=/usr
5288         fi
5289         dnl The build directory (different from CLANGDIR if using a Clang out-
5290         dnl of-source build):
5291         if test -z "$CLANGBUILD"; then
5292             CLANGBUILD=/usr
5293         fi
5294         AC_LANG_PUSH([C++])
5295         save_CPPFLAGS=$CPPFLAGS
5296         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"
5297         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
5298             [COMPILER_PLUGINS=TRUE],
5299             [
5300             if test "$compiler_plugins" = "yes"; then
5301                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
5302             else
5303                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
5304                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
5305             fi
5306             ])
5307         CPPFLAGS=$save_CPPFLAGS
5308         AC_LANG_POP([C++])
5309     fi
5310 else
5311     if test "$enable_compiler_plugins" = "yes"; then
5312         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
5313     fi
5315 AC_SUBST(COMPILER_PLUGINS)
5316 AC_SUBST(CLANGDIR)
5317 AC_SUBST(CLANGBUILD)
5319 dnl ===================================================================
5320 dnl Set the MinGW sys-root
5321 dnl ===================================================================
5322 if test "$WITH_MINGW" = "yes"; then
5323     AC_MSG_CHECKING([for MinGW sysroot])
5324     sysroot=`$CC -print-sysroot`
5325     AS_IF([test -d "$sysroot"/mingw],
5326           [MINGW_SYSROOT="$sysroot"/mingw
5327            AC_MSG_RESULT([$MINGW_SYSROOT])],
5328           [AC_MSG_RESULT([not found])
5329            AC_MSG_ERROR([cannot determine MinGW sysroot])])
5331 AC_SUBST([MINGW_DLLS])
5332 AC_SUBST([MINGW_SYSROOT])
5334 dnl ===================================================================
5335 dnl Set the MinGW include directories
5336 dnl ===================================================================
5337 if test "$WITH_MINGW" = "yes"; then
5338     AC_MSG_CHECKING([for MinGW include path])
5339     cat >conftest.$ac_ext <<_ACEOF
5340 #include <stddef.h>
5341 #include <bits/c++config.h>
5342 _ACEOF
5343     _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`
5344     rm conftest.$ac_ext
5345     if test -z "$_mingw_lib_include_path"; then
5346         _mingw_lib_include_path="NO_LIB_INCLUDE"
5347         AC_MSG_RESULT([no MinGW include path])
5348     else
5349         AC_MSG_RESULT([$_mingw_lib_include_path])
5350     fi
5351     MINGW_LIB_INCLUDE_PATH="$_mingw_lib_include_path"
5352     AC_SUBST(MINGW_LIB_INCLUDE_PATH)
5354     mingw_crtbegin=`$CC -print-file-name=crtbegin.o`
5355     MINGW_CLIB_DIR=`dirname $mingw_crtbegin`
5357     AC_LANG_PUSH([C++])
5359     AC_MSG_CHECKING([for dynamic libgcc])
5360     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5361 #include <iostream>
5362 using namespace std;
5363 ]], [[ try { throw 42; } catch (int e) { cout << "Yep, " << e << endl; } ]])],[
5364             MINGW_GCCDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libgcc' | $SED -e 's@.*DLL Name: @@'`
5365             if test -n "$MINGW_GCCDLL"; then
5366                 MINGW_SHARED_GCCLIB=YES
5367                 AC_MSG_RESULT([ $MINGW_GCCDLL])
5368             else
5369                 MINGW_SHARED_GCCLIB=NO
5370                 AC_MSG_RESULT([no])
5371             fi
5372        ],[ AC_MSG_RESULT([no])
5374     ])
5376     AC_MSG_CHECKING([for dynamic libstdc++])
5377     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5378 #include <iostream>
5379 using namespace std;
5380 ]], [[ cout << "Hello there." << endl; ]])],[
5381             MINGW_GXXDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libstdc++' | $SED -e 's@.*DLL Name: @@'`
5382             if test -n "$MINGW_GXXDLL"; then
5383                 mingw_gxxdll_root=${MINGW_GXXDLL%.dll}
5384                 mingw_gxxdll_root=${mingw_gxxdll_root#lib}
5385                 if test "$CROSS_COMPILING" = "YES"; then
5386                     dnl m4 escaping!
5387                     mingw_gxxdll_root=${mingw_gxxdll_root%-[[0-9]]}
5388                 fi
5389                 MINGW_SHARED_LIBSTDCPP=-l$mingw_gxxdll_root
5390                 MINGW_SHARED_GXXLIB=YES
5391                 AC_MSG_RESULT([$MINGW_GXXDLL])
5392             else
5393                 MINGW_SHARED_GXXLIB=NO
5394                 AC_MSG_RESULT([no])
5395             fi
5396        ],[ AC_MSG_RESULT([no])
5398     ])
5400     AC_LANG_POP([C++])
5402     AC_SUBST(MINGW_CLIB_DIR)
5403     AC_SUBST(MINGW_SHARED_GCCLIB)
5404     AC_SUBST(MINGW_SHARED_GXXLIB)
5405     AC_SUBST(MINGW_SHARED_LIBSTDCPP)
5406     AC_SUBST(MINGW_GCCDLL)
5407     AC_SUBST(MINGW_GXXDLL)
5410 if test "$WITH_MINGW" = "yes"; then
5411     AC_MSG_CHECKING([for fMergeNeutralItems in SCRIPT_CONTROL])
5412     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
5413     [
5414     #include <usp10.h>
5415     ],
5416     [
5417     SCRIPT_CONTROL c;
5418     c.fMergeNeutralItems = 1;
5419     ])],
5420     [
5421     AC_MSG_RESULT(yes)
5422     AC_DEFINE(HAVE_FMERGENEUTRALITEMS)
5423     ],
5424     [AC_MSG_RESULT(no)])
5427 dnl ===================================================================
5428 dnl Extra checking for the SunOS compiler
5429 dnl ===================================================================
5430 if test "$_os" = "SunOS"; then
5431     dnl SunStudio C++ compiler packaged with SunStudio C compiler
5432     if test "$CC" = "cc"; then
5433     AC_MSG_CHECKING([SunStudio C++ Compiler])
5434         if test "$CXX" != "CC"; then
5435             AC_MSG_WARN([SunStudio C++ was not found])
5436             add_warning "SunStudio C++ was not found"
5437         else
5438             AC_MSG_RESULT([checked])
5439         fi
5440     fi
5443 dnl *************************************************************
5444 dnl Testing for exception handling - dwarf2 or sjlj exceptions...
5445 dnl *************************************************************
5446 if test "$WITH_MINGW" = "yes"; then
5447     AC_MSG_CHECKING([exception type])
5448     AC_LANG_PUSH([C++])
5449     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iostream>
5451         extern "C" void _Unwind_SjLj_RaiseException(void) __attribute__ ((__noreturn__));
5453         ]], [[_Unwind_SjLj_RaiseException() ]])],[exceptions_type="sjlj"],[exceptions_type="dwarf2"
5454     ])
5455     AC_MSG_RESULT($exceptions_type)
5456     AC_LANG_POP([C++])
5459 EXCEPTIONS="$exceptions_type"
5460 AC_SUBST(EXCEPTIONS)
5462 dnl ===================================================================
5463 dnl thread-safe statics
5464 dnl ===================================================================
5465 AC_MSG_CHECKING([whether $CXX supports thread safe statics])
5466 unset HAVE_THREADSAFE_STATICS
5467 if test "$GCC" = "yes"; then
5468     dnl -fthreadsafe-statics is available since GCC 4, so always available for
5469     dnl us.  However, some C++ runtimes use a single lock for all static
5470     dnl variables, which can cause deadlock in multi-threaded applications.
5471     dnl This is not easily tested here; for POSIX-based systems, if executing
5472     dnl the following C++ program does not terminate then the tool chain
5473     dnl apparently has this problem:
5474     dnl
5475     dnl   #include <pthread.h>
5476     dnl   int h() { return 0; }
5477     dnl   void * g(void * unused) {
5478     dnl     static int n = h();
5479     dnl     return &n;
5480     dnl   }
5481     dnl   int f() {
5482     dnl     pthread_t t;
5483     dnl     pthread_create(&t, 0, g, 0);
5484     dnl     pthread_join(t, 0);
5485     dnl     return 0;
5486     dnl   }
5487     dnl   int main() {
5488     dnl     static int n = f();
5489     dnl     return n;
5490     dnl   }
5491     dnl
5492     dnl Mac OS X up to at least 10.7.1 is known to have this problem, as is at
5493     dnl least one instance of GCC 4.2.4 (used on a "Linux ooobuild1.osuosl.org
5494     dnl 2.6.9-101.plus.c4smp #1 SMP Thu Jul 21 19:08:15 EDT 2011 i686 i686 i386
5495     dnl GNU/Linux" machine); see the definition of __cxa_guard_acquire in GCC's
5496     dnl libstdc++-v3/libsupc++/guard.cc for what #ifdefs actually make a
5497     dnl difference there.  Conservative advice from Jakub Jelinek is to assume
5498     dnl it working in GCC >= 4.3:
5499     if test "$_os" = "Darwin" -o $_os = Android -o "${GCCVER?}" -lt 040300; then
5500         AC_MSG_RESULT([broken (i.e., no)])
5501     else
5502         HAVE_THREADSAFE_STATICS=TRUE
5503         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5504         AC_MSG_RESULT([yes])
5505     fi
5506 else
5507     AC_MSG_RESULT([unknown (assuming no)])
5509 AC_SUBST(HAVE_THREADSAFE_STATICS)
5511 dnl ===================================================================
5512 dnl visibility and C++11 features
5513 dnl ===================================================================
5514 CXXFLAGS_CXX11=
5515 if test "$GCC" = "yes"; then
5516     AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
5517     save_CFLAGS=$CFLAGS
5518     CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
5519     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_VISIBILITY_FEATURE=TRUE ],[])
5520     CFLAGS=$save_CFLAGS
5522     if test "$COM_GCC_IS_CLANG" = TRUE -a $_os = Darwin; then
5523         # It seems that with Apple's Clang, visibility doesn't work as
5524         # we would want at least in the connectivity and dbaccess
5525         # modules. This might be because of something peculiar in
5526         # those modules? Whatever.
5527         HAVE_GCC_VISIBILITY_FEATURE=
5528     fi
5530     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5531         AC_MSG_RESULT([yes])
5532     else
5533         AC_MSG_RESULT([no])
5534     fi
5536     AC_MSG_CHECKING([whether $CC supports -Wno-long-double])
5537     save_CFLAGS=$CFLAGS
5538     CFLAGS="$CFLAGS -Werror -Wno-long-double"
5539     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_NO_LONG_DOUBLE=TRUE ],[])
5540     CFLAGS=$save_CFLAGS
5541     if test "$HAVE_GCC_NO_LONG_DOUBLE" = "TRUE"; then
5542         AC_MSG_RESULT([yes])
5543     else
5544         AC_MSG_RESULT([no])
5545     fi
5547     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5548     save_CFLAGS=$CFLAGS
5549     CFLAGS="$CFLAGS -Werror -mno-avx"
5550     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5551     CFLAGS=$save_CFLAGS
5552     if test "$HAVE_GCC_AVX" = "TRUE"; then
5553         AC_MSG_RESULT([yes])
5554     else
5555         AC_MSG_RESULT([no])
5556     fi
5558     AC_MSG_CHECKING([whether $CC supports atomic functions])
5559     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5560     int v = 0;
5561     if (__sync_add_and_fetch(&v, 1) != 1 ||
5562         __sync_sub_and_fetch(&v, 1) != 0)
5563         return 1;
5564     __sync_synchronize();
5565     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5566         v != 1)
5567         return 1;
5568     return 0;
5569 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5570     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5571         AC_MSG_RESULT([yes])
5572         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5573     else
5574         AC_MSG_RESULT([no])
5575     fi
5577     AC_MSG_CHECKING(
5578         [whether $CC supports pragma GCC diagnostic error/ignored/warning])
5579     save_CFLAGS=$CFLAGS
5580     CFLAGS="$CFLAGS -Werror -Wunknown-pragmas -Wunused-parameter"
5581     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5582             #pragma GCC diagnostic ignored "-Wunused-parameter"
5583             void dummy(int n) {}
5584         ])], [
5585             AC_DEFINE([HAVE_GCC_PRAGMA_DIAGNOSTIC_MODIFY],[1])
5586             AC_MSG_RESULT([yes])
5587         ], [AC_MSG_RESULT([no])])
5588     CFLAGS=$save_CFLAGS
5590     AC_MSG_CHECKING([whether $CC supports pragma GCC diagnostic push/pop])
5591     save_CFLAGS=$CFLAGS
5592     CFLAGS="$CFLAGS -Werror -Wunknown-pragmas -Wunused-parameter"
5593     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5594             #pragma GCC diagnostic push
5595             #pragma GCC diagnostic ignored "-Wunused-parameter"
5596             void dummy(int n) {}
5597             #pragma GCC diagnostic pop
5598         ])], [
5599             AC_DEFINE([HAVE_GCC_PRAGMA_DIAGNOSTIC_SCOPE],[1])
5600             AC_MSG_RESULT([yes])
5601         ], [AC_MSG_RESULT([no])])
5602     CFLAGS=$save_CFLAGS
5604     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5605 #if __GNUC__ == 4 && __GNUC_MINOR__ == 7 && (__GNUC_PATCHLEVEL__ == 0 || __GNUC_PATCHLEVEL__ == 1)
5606 #else
5607 abi ok
5608 #endif
5609 ]])],[HAVE_BROKEN_ABI=TRUE],[HAVE_BROKEN_ABI=FALSE])
5611     AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
5612     # This should check libstdc++ version, not gcc, but clang has incidentally C++11 support
5613     # disabled in this case by the __float128 case below.
5614     if test "$HAVE_BROKEN_ABI" = "TRUE"; then
5615         AC_MSG_NOTICE([Not using -std=gnu++0x on $CXX version 4.7.0/4.7.1 due to libstdc++ ABI breakage.])
5616     else
5617         save_CXXFLAGS=$CXXFLAGS
5618         CXXFLAGS="$CXXFLAGS -std=gnu++0x"
5619         AC_LANG_PUSH([C++])
5621         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5622 #include <stddef.h>
5624 #include <vector>
5625     // some Clang fail when compiling against GCC 4.7 headers with -std=gnu++0x
5626     // (__float128)
5628 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
5630 namespace
5632         struct b
5633         {
5634                 int i;
5635                 int j;
5636         };
5638 ]], [[
5639 struct a
5641         int i;
5642         int j;
5644 a thinga[]={{0,0}, {1,1}};
5645 b thingb[]={{0,0}, {1,1}};
5646 size_t i = sizeof(sal_n_array_size(thinga));
5647 size_t j = sizeof(sal_n_array_size(thingb));
5648 return !(i != 0 && j != 0);
5649 ]])],[HAVE_CXX0X=TRUE CXXFLAGS_CXX11=-std=gnu++0x],[])
5651         AC_LANG_POP([C++])
5652         CXXFLAGS=$save_CXXFLAGS
5653     fi
5654     if test "$HAVE_CXX0X" = "TRUE"; then
5655         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
5656     else
5657         AC_MSG_RESULT([no])
5658     fi
5661 AC_SUBST(CXXFLAGS_CXX11)
5662 AC_SUBST(HAVE_CXX0X)
5663 AC_SUBST(HAVE_GCC_NO_LONG_DOUBLE)
5664 AC_SUBST(HAVE_GCC_AVX)
5665 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
5667 dnl ==================================
5668 dnl Check for C++11 "= delete" support
5669 dnl ==================================
5671 AC_MSG_CHECKING([whether $CXX supports C++11 = delete syntax])
5672 if test "$HAVE_CXX0X" = "TRUE"; then
5673     save_CXXFLAGS=$CXXFLAGS
5674     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
5675     AC_LANG_PUSH([C++])
5676     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5677 struct A
5678     {
5679     void test() = delete;
5680     };
5681 ]])],[HAVE_CXX11_DELETE=TRUE],[])
5683     AC_LANG_POP([C++])
5684     CXXFLAGS=$save_CXXFLAGS
5685     if test "$HAVE_CXX11_DELETE" = "TRUE"; then
5686         AC_MSG_RESULT([yes])
5687         AC_DEFINE([HAVE_CXX11_DELETE])
5688     else
5689         AC_MSG_RESULT([no])
5690     fi
5691 else
5692     AC_MSG_RESULT([no])
5695 dnl ==================================
5696 dnl Check for C++11 "override" support
5697 dnl ==================================
5699 AC_MSG_CHECKING([whether $CXX supports C++11 "override" syntax])
5700 if test "$HAVE_CXX0X" = "TRUE"; then
5701     save_CXXFLAGS=$CXXFLAGS
5702     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
5703     AC_LANG_PUSH([C++])
5704     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5705 struct A
5707         virtual void test();
5710 struct B : A
5712         virtual void test() override;
5714 ]])],[HAVE_CXX11_OVERRIDE=TRUE],[])
5716     AC_LANG_POP([C++])
5717     CXXFLAGS=$save_CXXFLAGS
5718     if test "$HAVE_CXX11_OVERRIDE" = "TRUE"; then
5719         AC_MSG_RESULT([yes])
5720         AC_DEFINE([HAVE_CXX11_OVERRIDE])
5721     else
5722         AC_MSG_RESULT([no])
5723     fi
5724 else
5725     AC_MSG_RESULT([no])
5728 dnl ==================================
5729 dnl Check for C++11 "final" support
5730 dnl ==================================
5732 AC_MSG_CHECKING([whether $CXX supports C++11 "final" syntax])
5733 if test "$HAVE_CXX0X" = "TRUE"; then
5734     save_CXXFLAGS=$CXXFLAGS
5735     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
5736     AC_LANG_PUSH([C++])
5737     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5738 // First check that this correct program that uses "final" compiles
5739 struct A final
5743 struct B
5745         virtual void test();
5748 struct C : B
5750         void test() final;
5752 ]])],[have_final=yes],[])
5754     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5755 // Then check that the "final" works as expected,
5756 // that this program fails to compile
5757 struct A final
5761 struct B : A
5764 ]])],[],[final_class_works=yes])
5766     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5767 // Also this should fail to compile
5768 struct B
5770         virtual void test();
5773 struct C : B
5775         void test() final;
5778 struct D : C
5780         void test();
5782 ]])],[],[final_method_works=yes])
5783     AC_LANG_POP([C++])
5785     CXXFLAGS=$save_CXXFLAGS
5787     if test "$have_final" = yes -a "$final_class_works" = yes -a "$final_method_works" = yes; then
5788         AC_MSG_RESULT([yes])
5789         AC_DEFINE([HAVE_CXX11_FINAL])
5790     else
5791         AC_MSG_RESULT([no])
5792     fi
5793 else
5794     AC_MSG_RESULT([no])
5797 dnl ===================================================================
5798 dnl Check for C++11 perfect forwarding support
5799 dnl ===================================================================
5800 AC_MSG_CHECKING([whether $CXX supports C++11 perfect forwarding])
5801 save_CXXFLAGS=$CXXFLAGS
5802 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
5803 AC_LANG_PUSH([C++])
5804 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5805         #include <utility>
5806         template<typename T, typename... Args> T * f(Args &&... v) {
5807             return new T(std::forward<Args>(v)...);
5808         }
5809     ]], [[
5810         f<int>(0);
5811     ]])], [perfect_forwarding=yes], [perfect_forwarding=no])
5812 AC_LANG_POP([C++])
5813 CXXFLAGS=$save_CXXFLAGS
5814 AC_MSG_RESULT([$perfect_forwarding])
5815 if test "$perfect_forwarding" = yes; then
5816     AC_DEFINE([HAVE_CXX11_PERFECT_FORWARDING])
5819 dnl ===================================================================
5820 dnl system stl sanity tests
5821 dnl ===================================================================
5822 HAVE_GCC_VISIBILITY_BROKEN=
5823 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \); then
5825     AC_LANG_PUSH([C++])
5827     save_CPPFLAGS="$CPPFLAGS"
5828     if test -n "$MACOSX_SDK_PATH"; then
5829         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
5830     fi
5832     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5833         dnl gcc#19664, gcc#22482, rhbz#162935
5834         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
5835         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
5836         AC_MSG_RESULT([$stlvisok])
5837         if test "$stlvisok" = "no"; then
5838             AC_MSG_WARN([Your gcc STL headers are not visibility safe. Disabling visibility])
5839             add_warning "Your gcc STL headers are not visibility safe. Disabling visibility"
5840             unset HAVE_GCC_VISIBILITY_FEATURE
5841         fi
5842     fi
5844     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5845         sharedlink_ldflags_save=$LDFLAGS
5846         LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden $PICSWITCH $LINKFLAGSSHL"
5848         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
5849         AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5850 #include <sstream>
5851 using namespace std;
5852             ]], [[
5853 istringstream strm( "test" ); return 0;
5854             ]])],
5855             # Ugh, surely bad to assume an error message will contain
5856             # the word "unresolvable", a problem with
5857             # -fvisibility-inlines-hidden and STL headers might cause
5858             # some more obscure message on some platform, and anway,
5859             # the error message could be localised.
5860             [$EGREP -q unresolvable conftest.err;
5861             if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi],[gccvisok=no
5862         ])
5863         AC_MSG_RESULT([$gccvisok])
5864         if test "$gccvisok" = "no"; then
5865             AC_MSG_WARN([Your gcc is not -fvisibility-inlines-hidden safe, disabling that.])
5866             add_warning "Your gcc is not -fvisibility-inlines-hidden safe, disabling that."
5867             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
5868         fi
5870         LDFLAGS=$sharedlink_ldflags_save
5871     fi
5873     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
5874     # when we don't make any dynamic libraries?
5875     if test "$DISABLE_DYNLOADING" = "" -a "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$HAVE_GCC_VISIBILITY_BROKEN" != "TRUE"; then
5876         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
5877         cat > conftestlib1.cc <<_ACEOF
5878 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
5879 struct S2: S1<int> { virtual ~S2(); };
5880 S2::~S2() {}
5881 _ACEOF
5882         cat > conftestlib2.cc <<_ACEOF
5883 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
5884 struct S2: S1<int> { virtual ~S2(); };
5885 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
5886 _ACEOF
5887         gccvisinlineshiddenok=yes
5888         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
5889             gccvisinlineshiddenok=no
5890         else
5891             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $LINKFLAGSNOUNDEFS -o libconftest2$DLLPOST >/dev/null 2>&5; then
5892                 gccvisinlineshiddenok=no
5893             fi
5894         fi
5896         rm -fr libconftest*
5897         AC_MSG_RESULT([$gccvisinlineshiddenok])
5898         if test "$gccvisinlineshiddenok" = "no"; then
5899             AC_MSG_WARN([Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that.])
5900             add_warning "Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that."
5901             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
5902         fi
5903     fi
5905     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5906         AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
5907         cat >visibility.cxx <<_ACEOF
5908 #pragma GCC visibility push(hidden)
5909 struct __attribute__ ((visibility ("default"))) TestStruct {
5910   static void Init();
5912 __attribute__ ((visibility ("default"))) void TestFunc() {
5913   TestStruct::Init();
5915 _ACEOF
5916         if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx 2>/dev/null > /dev/null; then
5917             gccvisbroken=yes
5918         else
5919             case "$host_cpu" in
5920             i?86|x86_64)
5921                 if test "$_os" = "Darwin" -o "$WITH_MINGW" = "yes"; then
5922                     gccvisbroken=no
5923                 else
5924                     if $EGREP -q '@PLT|@GOT' visibility.s; then
5925                         gccvisbroken=no
5926                     else
5927                         gccvisbroken=yes
5928                     fi
5929                 fi
5930                 ;;
5931             *)
5932                 gccvisbroken=no
5933                 ;;
5934             esac
5935         fi
5936         rm -f visibility.s visibility.cxx
5938         AC_MSG_RESULT([$gccvisbroken])
5939         if test "$gccvisbroken" = "yes"; then
5940             AC_MSG_WARN([Your gcc is not -fvisibility=hidden safe. Disabling visibility])
5941             add_warning "Your gcc is not -fvisibility=hidden safe. Disabling visibility"
5942             unset HAVE_GCC_VISIBILITY_FEATURE
5943         fi
5944     fi
5946     CPPFLAGS="$save_CPPFLAGS"
5948     AC_LANG_POP([C++])
5951 AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE)
5952 AC_SUBST(HAVE_GCC_VISIBILITY_BROKEN)
5954 dnl ===================================================================
5955 dnl  Clang++ tests
5956 dnl ===================================================================
5958 HAVE_GCC_FNO_DEFAULT_INLINE=
5959 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
5960 if test "$GCC" = "yes"; then
5961     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
5962     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
5963         # Option just ignored and silly warning that isn't a real
5964         # warning printed
5965         :
5966     else
5967         AC_LANG_PUSH([C++])
5968         save_CXXFLAGS=$CXXFLAGS
5969         CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
5970         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
5971         CXXFLAGS=$save_CXXFLAGS
5972         AC_LANG_POP([C++])
5973     fi
5974     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
5975         AC_MSG_RESULT([yes])
5976     else
5977         AC_MSG_RESULT([no])
5978     fi
5980     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
5981     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
5982         # As above
5983         :
5984     else
5985         AC_LANG_PUSH([C++])
5986         save_CXXFLAGS=$CXXFLAGS
5987         CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
5988         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
5989         CXXFLAGS=$save_CXXFLAGS
5990         AC_LANG_POP([C++])
5991     fi
5992     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
5993         AC_MSG_RESULT([yes])
5994     else
5995         AC_MSG_RESULT([no])
5996     fi
5998 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
5999 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6002 dnl ===================================================================
6003 dnl allocator
6004 dnl ===================================================================
6005 AC_MSG_CHECKING([which memory allocator to use])
6006 if test "$with_alloc" = "system"; then
6007     AC_MSG_RESULT([system])
6008     ALLOC="SYS_ALLOC"
6009     AC_CHECK_FUNCS([malloc realloc calloc free])
6011 if test "$with_alloc" = "tcmalloc"; then
6012     AC_MSG_RESULT(tcmalloc)
6013     if ! echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6014         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
6015     fi
6016     AC_CHECK_LIB([tcmalloc], [malloc], [:],
6017         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
6018     ALLOC="TCMALLOC"
6020 if test "$with_alloc" = "jemalloc"; then
6021     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
6022         AC_MSG_RESULT(jemalloc)
6023         save_CFLAGS=$CFLAGS
6024         CFLAGS="$CFLAGS -pthread"
6025         AC_CHECK_LIB([jemalloc], [malloc], [:],
6026             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
6027         ALLOC="JEMALLOC"
6028         CFLAGS=$save_CFLAGS
6029     else
6030         AC_MSG_RESULT([system])
6031         ALLOC="SYS_ALLOC"
6032         AC_CHECK_FUNCS([malloc realloc calloc free])
6033     fi
6035 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6036     AC_MSG_RESULT([internal])
6038 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6039 AC_SUBST(HAVE_POSIX_FALLOCATE)
6040 AC_SUBST(ALLOC)
6042 dnl ===================================================================
6043 dnl Custom build version
6044 dnl ===================================================================
6046 AC_MSG_CHECKING([whether to add custom build version])
6047 if test "$with_build_version" != ""; then
6048     BUILD_VER_STRING=$with_build_version
6049     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6050 else
6051     BUILD_VER_STRING=
6052     AC_MSG_RESULT([no])
6054 AC_SUBST(BUILD_VER_STRING)
6056 dnl ===================================================================
6057 dnl Java support enable
6058 dnl ===================================================================
6059 AC_MSG_CHECKING([whether to build with Java support])
6060 if test "$with_java" != "no"; then
6061     if test "$DISABLE_SCRIPTING" = TRUE; then
6062         AC_MSG_RESULT([no, overridden by --disable-scripting])
6063         SOLAR_JAVA=""
6064         with_java=no
6065     else
6066         AC_MSG_RESULT([yes])
6067         SOLAR_JAVA="TRUE"
6068     fi
6069 else
6070     AC_MSG_RESULT([no])
6071     SOLAR_JAVA=""
6074 AC_SUBST(SOLAR_JAVA)
6076 dnl SOLAR_JAVA="YES" (yes, silly name, should rename) indicates whether we
6077 dnl want there to be *run-time* (and build-time) support for Java extensions in the
6078 dnl built LibreOffice.
6080 dnl SOLAR_JAVA="BUILD" is claimed to indicate build-time only support
6081 dnl (no runtime support). It doesn't seem to ever be set to this
6082 dnl value, though, and everywhere SOLAR_JAVA is only checked for being
6083 dnl empty or non-empty.
6085 dnl SOLAR_JAVA="" indicate no java support at all
6087 JITC_PROCESSOR_TYPE=""
6088 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6089     # IBMs JDK needs this...
6090     JITC_PROCESSOR_TYPE=6
6091     export JITC_PROCESSOR_TYPE
6093 AC_SUBST([JITC_PROCESSOR_TYPE])
6095 # Misc Windows Stuff
6096 if test $_os = "WINNT" -a "$WITH_MINGW" != yes; then
6097     find_msvc_dlls
6098     find_msms
6099     MSVC_DLL_PATH="$msvcdllpath"
6100     MSVC_DLLS="$msvcdlls"
6101     MSM_PATH="$msmdir"
6102     MERGE_MODULES="$msms"
6103     SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6105 AC_SUBST(MSVC_DLL_PATH)
6106 AC_SUBST(MSVC_DLLS)
6107 AC_SUBST(MSVC_DEBUG_DLL_PATH)
6108 AC_SUBST(MSVC_DEBUG_DLLS)
6109 AC_SUBST(MSM_PATH)
6110 AC_SUBST(MERGE_MODULES)
6112 dnl ===================================================================
6113 dnl Checks for Java
6114 dnl ===================================================================
6115 if test "$SOLAR_JAVA" != ""; then
6117     # Windows-specific tests
6118     if test "$build_os" = "cygwin"; then
6119         if test "$BITNESS_OVERRIDE" = 64; then
6120             bitness="64-bit"
6121             otherbitness="32-bit"
6122         else
6123             bitness="32-bit"
6124             otherbitness="64-bit"
6125         fi
6127         if test -z "$with_jdk_home"; then
6128             # Currently only auto-detects 32-bit JDK
6129                         for ver in 1.7 1.6 1.5 1.4 1.3; do
6130                         reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6131                         if test -n "$regvalue"; then
6132                                 _jdk_home=$regvalue
6133                                 break
6134                         fi
6135                         done
6136             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6137                 with_jdk_home="$_jdk_home"
6138                 howfound="found automatically"
6139             else
6140                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness JDK])
6141             fi
6142         else
6143             test "$build_os" = "cygwin" && with_jdk_home=`cygpath -u "$with_jdk_home"`
6144             howfound="you passed"
6145         fi
6146     fi
6148     JAVA_HOME=; export JAVA_HOME
6149     if test -z "$with_jdk_home"; then
6150         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6151     else
6152         _java_path="$with_jdk_home/bin/$with_java"
6153         dnl Check if there is a Java interpreter at all.
6154         if test -x "$_java_path"; then
6155             JAVAINTERPRETER=$_java_path
6156         else
6157             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6158         fi
6159     fi
6161     if test "$build_os" = "cygwin"; then
6162         # Check that the JDK found is correct architecture
6163         # Why is this necessary, we don't link with any library from the JDK I think,
6165         shortjdkhome=`cygpath -d "$with_jdk_home"`
6166         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
6167             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6168             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6169         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
6170             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6171             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6172         fi
6174         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6175             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6176         fi
6177         JAVAINTERPRETER=`cygpath -d "$JAVAINTERPRETER"`
6178         JAVAINTERPRETER=`cygpath -u "$JAVAINTERPRETER"`
6179     elif test "$_os" = "Darwin"; then
6180         dnl HACK:  There currently is only a 32 bit version of LibreOffice for Mac OS X,
6181         dnl and Tiger Java complains about -d32 while Snow Leopard Java needs it
6182         dnl to run in 32 bit mode and be able to load LibreOffice jnilibs:
6183         AC_MSG_CHECKING([whether to pass -d32 to Java interpreter])
6184         if "$JAVAINTERPRETER" -d32 >&5 2>&5; then
6185             AC_MSG_RESULT([yes])
6186             JAVAIFLAGS=-d32
6187         else
6188             AC_MSG_RESULT([no])
6189         fi
6190     fi
6193 dnl ===================================================================
6194 dnl Checks for JDK.
6195 dnl ===================================================================
6197 # Note that JAVA_HOME as for now always means the *build* platform's
6198 # JAVA_HOME. Whether all the complexity here actually is needed any
6199 # more or not, no idea.
6201 if test "$SOLAR_JAVA" != ""; then
6202     _gij_longver=0
6203     AC_MSG_CHECKING([the installed JDK])
6204     if test -n "$JAVAINTERPRETER"; then
6205         dnl java -version sends output to stderr!
6206         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6207             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6208         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6209             JDK=gcj
6210             AC_MSG_RESULT([checked (gcj)])
6211             _gij_version=`$JAVAINTERPRETER --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6212             _gij_longver=`echo $_gij_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6214         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6215             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6216         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6217             JDK=ibm
6219             dnl IBM JDK specific tests
6220             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6221             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6223             if test "$_jdk_ver" -lt 10500; then
6224                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.5])
6225             fi
6227             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6229             if test "$with_jdk_home" = ""; then
6230                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6231 you must use the "--with-jdk-home" configure option explicitly])
6232             fi
6234            JAVA_HOME=$with_jdk_home
6236         else
6237             JDK=sun
6239             dnl Sun JDK specific tests
6240             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6241             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6243             if test "$_jdk_ver" -lt 10500; then
6244                 AC_MSG_ERROR([JDK is too old, you need at least 1.5])
6245             fi
6246             if test "$_jdk_ver" -gt 10600; then
6247                 JAVA_CLASSPATH_NOT_SET="1"
6248             fi
6250             AC_MSG_RESULT([checked (JDK $_jdk)])
6251             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6252             if test "$_os" = "WINNT"; then
6253                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6254             fi
6255         fi
6256     else
6257         AC_MSG_ERROR([Java not found. You need at least jdk-1.5, or gcj-4])
6258     fi
6259 else
6260     dnl Java disabled
6261     JAVA_HOME=NO_JAVA_HOME ; export JAVA_HOME
6264 dnl ===================================================================
6265 dnl Set target Java bytecode version
6266 dnl ===================================================================
6267 if test "$SOLAR_JAVA" != ""; then
6268     _java_target_ver="1.5"
6270     JAVA_SOURCE_VER="$_java_target_ver"
6271     JAVA_TARGET_VER="$_java_target_ver"
6274 dnl ===================================================================
6275 dnl Checks for javac
6276 dnl ===================================================================
6277 if test "$SOLAR_JAVA" != ""; then
6278     if test "$JDK" = "gcj"; then
6279         javacompiler=`echo $with_java | $SED -e "s/gij/gcj/g" | $SED -e "s/java/javac/g"`
6280     else
6281         javacompiler="javac"
6282     fi
6283     if test -z "$with_jdk_home"; then
6284         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6285     else
6286         _javac_path="$with_jdk_home/bin/$javacompiler"
6287         dnl Check if there is a Java compiler at all.
6288         if test -x "$_javac_path"; then
6289             JAVACOMPILER=$_javac_path
6290         fi
6291     fi
6292     if test -z "$JAVACOMPILER"; then
6293         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6294     fi
6295     if test "$build_os" = "cygwin"; then
6296         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6297             JAVACOMPILER="${JAVACOMPILER}.exe"
6298         fi
6299         JAVACOMPILER=`cygpath -d "$JAVACOMPILER"`
6300         JAVACOMPILER=`cygpath -u "$JAVACOMPILER"`
6301     fi
6303     if test `$JAVACOMPILER -version 2>&1 | $GREP -c "Eclipse Java Compiler"` -gt 0; then
6304         AC_MSG_CHECKING([re-checking JDK])
6305         JDK=gcj
6306         AC_MSG_RESULT([checked (ecj)])
6307         _gij_longver="40200"
6308     fi
6311 JAVACISGCJ=""
6312 dnl ===================================================================
6313 dnl Checks that javac is gcj
6314 dnl ===================================================================
6315 if test "$SOLAR_JAVA" != ""; then
6316     if test `$JAVACOMPILER --version 2>&1 | $GREP -c "GCC"` -gt 0; then
6317         JAVACISGCJ="yes"
6318     fi
6320 AC_SUBST(JAVACISGCJ)
6322 JAVACISKAFFE=""
6323 dnl ===================================================================
6324 dnl Checks that javac is kaffe
6325 dnl ===================================================================
6326 if test "$SOLAR_JAVA" != ""; then
6327     if test `$JAVACOMPILER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6328         JAVACISKAFFE="yes"
6329     fi
6331 AC_SUBST(JAVACISKAFFE)
6333 dnl ===================================================================
6334 dnl Checks for javadoc
6335 dnl ===================================================================
6336 if test "$SOLAR_JAVA" != ""; then
6337     if test -z "$with_jdk_home"; then
6338         AC_PATH_PROG(JAVADOC, javadoc)
6339     else
6340         _javadoc_path="$with_jdk_home/bin/javadoc"
6341         dnl Check if there is a javadoc at all.
6342         if test -x "$_javadoc_path"; then
6343             JAVADOC=$_javadoc_path
6344         else
6345             AC_PATH_PROG(JAVADOC, javadoc)
6346         fi
6347     fi
6348     if test -z "$JAVADOC"; then
6349         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6350     fi
6351     if test "$build_os" = "cygwin"; then
6352         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6353             JAVADOC="${JAVADOC}.exe"
6354         fi
6355         JAVADOC=`cygpath -d "$JAVADOC"`
6356         JAVADOC=`cygpath -u "$JAVADOC"`
6357     fi
6359     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6360         JAVADOCISGJDOC="yes"
6361     fi
6363 AC_SUBST(JAVADOCISGJDOC)
6365 if test "$SOLAR_JAVA" != ""; then
6366     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
6367     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
6368         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
6369            # try to recover first by looking whether we have a alternatives
6370            # system as in Debian or newer SuSEs where following /usr/bin/javac
6371            # over /etc/alternatives/javac leads to the right bindir where we
6372            # just need to strip a bit away to get a valid JAVA_HOME
6373            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
6374         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
6375             # maybe only one level of symlink (e.g. on Mac)
6376             JAVA_HOME=$(readlink $JAVACOMPILER)
6377             if test "$(dirname $JAVA_HOME)" = "."; then
6378                 # we've got no path to trim back
6379                 JAVA_HOME=""
6380             fi
6381         else
6382             # else warn
6383             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
6384             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
6385             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
6386             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
6387         fi
6388         dnl now that we have the path to the real javac, make a JAVA_HOME out of it..
6389         if test "$JAVA_HOME" != "/usr"; then
6390             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6391                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
6392                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
6393                 dnl Tiger already returns a JDK path..
6394                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
6395             else
6396                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
6397             fi
6398         fi
6399     fi
6400     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
6402     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
6403     if test -z "$JAVA_HOME"; then
6404         if test "x$with_jdk_home" = "x"; then
6405             cat > findhome.java <<_ACEOF
6406 [import java.io.File;
6408 class findhome
6410     public static void main(String args[])
6411     {
6412         String jrelocation = System.getProperty("java.home");
6413         File jre = new File(jrelocation);
6414         System.out.println(jre.getParent());
6415     }
6417 _ACEOF
6418             AC_MSG_CHECKING([if javac works])
6419             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
6420             AC_TRY_EVAL(javac_cmd)
6421             if test $? = 0 -a -f ./findhome.class; then
6422                 AC_MSG_RESULT([javac works])
6423             else
6424                 echo "configure: javac test failed" >&5
6425                 cat findhome.java >&5
6426                 AC_MSG_ERROR([javac does not work - java projects will not build!])
6427             fi
6428             AC_MSG_CHECKING([if gij knows its java.home])
6429             JAVA_HOME=`$JAVAINTERPRETER findhome`
6430             if test $? = 0 -a "$JAVA_HOME" != ""; then
6431                 AC_MSG_RESULT([$JAVA_HOME])
6432             else
6433                 echo "configure: java test failed" >&5
6434                 cat findhome.java >&5
6435                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
6436             fi
6437             # clean-up after ourselves
6438             rm -f ./findhome.java ./findhome.class
6439         else
6440             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
6441         fi
6442     fi
6444     dnl second sanity check JAVA_HOME if possible
6445     if test "$JDK" != "gcj" -o "$_gij_longver" -ge "40200"; then
6446         # now check if $JAVA_HOME is really valid
6447         if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6448             if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
6449                 JAVA_HOME_OK="NO"
6450             fi
6451         elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
6452             JAVA_HOME_OK="NO"
6453         fi
6454         if test "$JAVA_HOME_OK" = "NO"; then
6455             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
6456             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
6457             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
6458             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
6459             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
6460             add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
6461         fi
6462     fi
6463     PathFormat "$JAVA_HOME"
6464     JAVA_HOME="$formatted_path"
6467 AWTLIB=
6469 if test "$SOLAR_JAVA" != ""; then
6470     AC_MSG_CHECKING([for jawt lib name])
6471     if test "$JDK" = "gcj"; then
6472         save_CFLAGS=$CFLAGS
6473         save_LDFLAGS=$LDFLAGS
6474         CFLAGS="$CFLAGS -I$JAVA_HOME/include"
6475         LDFLAGS="$LDFLAGS -L$JAVA_HOME/lib -lgcj"
6476         exec 6>/dev/null # no output
6477         AC_CHECK_HEADER(jni.h, [],
6478                     [AC_MSG_ERROR([jni.h could not be found. Mismatch between gcc and libgcj or libgcj-devel missing?])], [])
6479         AC_CHECK_LIB(gcjawt, JAWT_GetAWT, [ AWTLIB="-lgcjawt -lgcj"] )
6480         exec 6>&1 # output on again
6481         CFLAGS=$save_CFLAGS
6482         LDFLAGS=$save_LDFLAGS
6483     fi
6484     # IBM SDK 1.5.0-sr5 includes libjawt.so with unresolved symbols.
6485     # A workaround is to link also against libpmawt.so
6486     if test "$JDK" = "ibm"; then
6487         save_CFLAGS=$CFLAGS
6488         save_LDFLAGS=$LDFLAGS
6489         save_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
6490         CFLAGS="$CFLAGS -I$JAVA_HOME/include"
6491         LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin"
6492         LD_LIBRARY_PATH=$JAVA_HOME/jre/bin:$JAVA_HOME/jre/bin/classic:$JAVA_HOME/jre/bin/xawt:$LD_LIBRARY_PATH
6493         export LD_LIBRARY_PATH
6494         exec 6>/dev/null # no output
6495         AC_CHECK_HEADER(jni.h, [],
6496                     [AC_MSG_ERROR([jni.h could not be found.])], [])
6497         AC_CHECK_LIB(jawt, JAWT_GetAWT, [ AWTLIB="-ljawt"] )
6498         if test -z "$AWTLIB"; then
6499             LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin/xawt -ljawt"
6500             AC_CHECK_LIB(mawt, JAWT_GetAWT, [ AWTLIB="-L$JAVA_HOME/jre/bin/xawt -ljawt -lmawt"])
6501         fi
6502         exec 6>&1 # output on again
6503         CFLAGS=$save_CFLAGS
6504         LDFLAGS=$save_LDFLAGS
6505         LD_LIBRARY_PATH=$save_LD_LIBRARY_PATH
6506     fi
6507     if test -z "$AWTLIB"; then
6508         if test $_os = WINNT -a "$WITH_MINGW" != yes; then
6509             AWTLIB=jawt.lib
6510         else
6511             AWTLIB=-ljawt
6512         fi
6513     fi
6514     AC_MSG_RESULT([$AWTLIB])
6515     AC_SUBST(AWTLIB)
6519 if test -n "$SOLAR_JAVA" -a \( -z "$JAVALIB" -o -z "$JAVAINC" \); then
6521 # Determine JAVALIB
6522 # If your platform follow the common pattern
6523 # just define JAVA_ARCH and JAVA_TOOLKIT for it
6524 # if not, leave JAVA_ARCH empty and define JAVALIB manually
6525 # if you don't want JAVALIB to be exported at all
6526 # define x_JAVALIB=[\#]
6528     JAVA_ARCH=
6529     JAVA_TOOLKIT=
6530     x_JAVALIB=
6531     x_JDKLIB=[\#]
6533     case "$host_os" in
6535     aix*)
6536         JAVA_ARCH="ppc"
6537         JAVA_TOOLKIT="classic"
6538         JAVAINC="-I$JAVA_HOME/include"
6539         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
6540         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6542         case "$JDK" in
6543         [Ii][Bb][Mm]*)
6544             JAVA_ARCH=
6545             JRE_BASE_DIR="$JAVA_HOME/jre/bin"
6546             JAVALIB="-L$JRE_BASE_DIR -L$JRE_BASE_DIR/classic"
6547             ;;
6548         *)
6549             ;;
6550         esac
6552         ;;
6554     cygwin*)
6555         x_JDKLIB=
6556         JDKLIB="$JAVA_HOME/lib"
6557         JAVAINC="-I$JAVA_HOME/include/win32"
6558         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
6559         ;;
6561     darwin*)
6562         x_JAVALIB=[\#]
6563         JAVAINC="${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers ${ISYSTEM}$FRAMEWORKSHOME/JavaVM/Headers"
6564         ;;
6566     dragonfly*)
6567         case "$host_cpu" in
6568         i*86)
6569             JAVA_ARCH="i386"
6570             JAVA_TOOLKIT="client"
6571             ;;
6572         x86_64)
6573             JAVA_ARCH="amd64"
6574             JAVA_TOOLKIT="server"
6575             ;;
6576         esac
6577         JAVAINC="-I$JAVA_HOME/include"
6578         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6579         ;;
6581     freebsd*)
6582         case "$host_cpu" in
6583         i*86)
6584             JAVA_ARCH="i386"
6585             JAVA_TOOLKIT="client"
6586             ;;
6587         x86_64)
6588             if test "`echo $JAVA_HOME | sed -e 's,.*/,,'`" = "linux"; then
6589                 JAVA_ARCH="i386"
6590                 JAVA_TOOLKIT="client"
6591             else
6592                 JAVA_ARCH="amd64"
6593                 JAVA_TOOLKIT="server"
6594             fi
6595             ;;
6596         esac
6597         JAVAINC="-I$JAVA_HOME/include"
6598         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
6599         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
6600         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
6601         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6602         ;;
6604     k*bsd*-gnu*)
6605         case "$host_cpu" in
6606         i*86)
6607             JAVA_ARCH="i386"
6608             JAVA_TOOLKIT="client"
6609             ;;
6610         x86_64)
6611             JAVA_ARCH="amd64"
6612             JAVA_TOOLKIT="server"
6613             ;;
6614         esac
6615         JAVAINC="-I$JAVA_HOME/include"
6616         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6617         ;;
6619     linux-gnu*)
6621         case "$host_cpu" in
6623         alpha)
6624             JAVA_ARCH="alpha"
6625             JAVA_TOOLKIT="server"
6626             ;;
6627         arm*)
6628             JAVA_ARCH="arm"
6629             JAVA_TOOLKIT="server"
6630             ;;
6631         hppa)
6632             JAVA_ARCH="hppa"
6633             JAVA_TOOLKIT="server"
6634             ;;
6635         i*86)
6636             JAVA_ARCH="i386"
6637             case "$JDK" in
6638             [Ii][Bb][Mm]*)
6639                 JAVA_ARCH=
6640                 JRE_BASE_DIR="$JAVA_HOME/jre/bin"
6641                 JAVALIB="-L$JAVA_HOME/$LIB64 -L$JRE_BASE_DIR -L$JRE_BASE_DIR/classic -L$JRE_BASE_DIR/native_thread"
6642                 ;;
6643             [Bb][Ee][Aa]*)
6644                 JAVA_TOOLKIT="jrockit"
6645                 ;;
6646             *)
6647                 JAVA_TOOLKIT="client"
6648                 ;;
6649             esac
6650             ;;
6651         ia64)
6652             JAVA_ARCH="ia64"
6653             JAVA_TOOLKIT="server"
6654             ;;
6655         m68k)
6656             JAVA_ARCH="mk68"
6657             JAVA_TOOLKIT="server"
6658             ;;
6659         mips|mips64|mipsel|mips64el)
6660             JAVA_ARCH="$host_cpu"
6661             JAVA_TOOLKIT="server"
6662             ;;
6663         mips32)
6664             JAVA_ARCH="$host_cpu"
6665             JAVA_TOOLKIT="client"
6666             ;;
6667         powerpc)
6668             JAVA_ARCH="ppc"
6669             case "$JDK" in
6670             [Ii][Bb][Mm]*)
6671                 JAVA_TOOLKIT="classic"
6672                 ;;
6673             gcj)
6674                 JAVA_TOOLKIT="client"
6675                 ;;
6676             *)
6677                 JAVA_TOOLKIT="server"
6678                 ;;
6679             esac
6680             ;;
6681         powerpc64)
6682             JAVA_ARCH="ppc64"
6683             if test "$JDK" = "gcj"; then
6684                 JAVA_TOOLKIT="client"
6685             else
6686                 JAVA_TOOLKIT="server"
6687             fi
6688             ;;
6689         sparc)
6690             JAVA_ARCH="sparc"
6691             JAVA_TOOLKIT="server"
6692             ;;
6693         s390)
6694             JAVA_ARCH="s390"
6695             JAVA_TOOLKIT="server"
6696             ;;
6697         s390x)
6698             JAVA_ARCH="s390x"
6699             JAVA_TOOLKIT="server"
6700             ;;
6701         x86_64)
6702             JAVA_ARCH="amd64"
6703             JAVA_TOOLKIT="server"
6704             ;;
6705         *)
6706             AC_MSG_ERROR([No JAVALIB definition host_cpu $host_cpu for host_os $host_os])
6707             ;;
6708         esac
6709         JAVAINC="-I$JAVA_HOME/include"
6710         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
6711         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6712         ;;
6714     linux-androideabi*)
6716         case "$host_cpu" in
6718     arm|armel)
6719             JAVA_ARCH="arm"
6720             JAVA_TOOLKIT="server"
6721             ;;
6722         esac
6723         ;;
6725     mingw*)
6726         x_JAVALIB=[\#]
6727         JAVAINC="-I$JAVA_HOME/include"
6728         ;;
6730     *netbsd*)
6732         case "$host_cpu" in
6733         i*86)
6734             JAVA_ARCH="i386"
6735             JAVA_TOOLKIT="client"
6736             ;;
6737         powerpc)
6738             JAVA_ARCH="pcc"
6739             JAVA_TOOLKIT="classic"
6740             ;;
6741         sparc)
6742             JAVA_ARCH="sparc"
6743             JAVA_TOOLKIT="client"
6744             ;;
6745         x86_64)
6746             JAVA_ARCH="amd64"
6747             JAVA_TOOLKIT="client"
6748             ;;
6749         esac
6750         JAVAINC="-I$JAVA_HOME/include"
6751         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
6752         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6753        ;;
6755     openbsd*)
6756         case "$host_cpu" in
6757         i*86)
6758             JAVA_ARCH="i386"
6759             JAVA_TOOLKIT="client"
6760             ;;
6761         x86_64)
6762             JAVA_ARCH="amd64"
6763             JAVA_TOOLKIT="server"
6764             ;;
6765         esac
6766         JAVAINC="-I$JAVA_HOME/include"
6767         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
6768         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6769         ;;
6771     solaris*)
6773         JAVA_TOOLKIT="xawt"
6774         case "$host_cpu" in
6775         i*86)
6776             JAVA_ARCH="i386"
6777             ;;
6778         sparc)
6779             JAVA_ARCH="sparc"
6780             ;;
6781         esac
6782         JAVAINC="-I$JAVA_HOME/include"
6783         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
6784         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6785         ;;
6786     esac
6788     if test -n "$JAVA_ARCH"; then
6789         JRE_BASE_DIR="$JAVA_HOME/jre/lib/$JAVA_ARCH"
6790         JAVALIB="-L$JAVA_HOME/$LIB64"
6791         test -d "$JRE_BASE_DIR" && JAVALIB="$JAVALIB -L$JRE_BASE_DIR"
6792         test -d "$JRE_BASE_DIR/$JAVA_TOOLKIT" && JAVALIB="$JAVALIB -L$JRE_BASE_DIR/$JAVA_TOOLKIT"
6793         test -d "$JRE_BASE_DIR/native_thread" && JAVALIB="$JAVALIB -L$JRE_BASE_DIR/native_thread"
6794     fi
6795 elif test -z "$SOLAR_JAVA"; then
6796     x_JAVALIB=[\#]
6797     x_JDKLIB=[\#]
6799 SOLARINC="$SOLARINC $JAVAINC"
6801 AC_SUBST(JAVALIB)
6802 AC_SUBST(JAVACOMPILER)
6803 AC_SUBST(JAVADOC)
6804 AC_SUBST(JAVAINTERPRETER)
6805 AC_SUBST(JAVAIFLAGS)
6806 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
6807 AC_SUBST(JAVA_HOME)
6808 AC_SUBST(JAVA_SOURCE_VER)
6809 AC_SUBST(JAVA_TARGET_VER)
6810 AC_SUBST(JDK)
6811 AC_SUBST(JDKLIB)
6812 AC_SUBST(x_JAVALIB)
6813 AC_SUBST(x_JDKLIB)
6816 AC_MSG_CHECKING([which C preprocessor to use in idlc])
6817 if test -n "$with_idlc_cpp"; then
6818     AC_MSG_RESULT([$with_idlc_cpp])
6819     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
6820 else
6821     AC_MSG_RESULT([ucpp])
6822     AC_MSG_CHECKING([which ucpp tp use])
6823     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
6824         AC_MSG_RESULT([external])
6825         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
6826     else
6827         AC_MSG_RESULT([internal])
6828         BUILD_TYPE="$BUILD_TYPE UCPP"
6829     fi
6831 AC_SUBST(SYSTEM_UCPP)
6833 dnl ===================================================================
6834 dnl Check for epm (not needed for Windows)
6835 dnl ===================================================================
6836 AC_MSG_CHECKING([whether to enable EPM for packing])
6837 if test "$enable_epm" = "yes"; then
6838     AC_MSG_RESULT([yes])
6839     if test "$_os" != "WINNT"; then
6840         if test -n "$with_epm"; then
6841             EPM=$with_epm
6842         else
6843             AC_PATH_PROG(EPM, epm, no)
6844         fi
6845         if test "$EPM" = "no" -o "$EPM" = "internal"; then
6846             echo "EPM will be built."
6847             BUILD_TYPE="$BUILD_TYPE EPM"
6848         else
6849             # Gentoo has some epm which is something different...
6850             AC_MSG_CHECKING([whether the found epm is the right epm])
6851             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
6852                 AC_MSG_RESULT([yes])
6853             else
6854                 AC_MSG_ERROR([no. Install ESP Package Manager (www.easysw.com/epm) and/or specify the path to the right epm])
6855             fi
6856             AC_MSG_CHECKING([epm version])
6857             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
6858             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
6859                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
6860                 AC_MSG_RESULT([OK, >= 3.7])
6861                 if test "$_os" = "Darwin"; then
6862                     AC_MSG_CHECKING([which PackageMaker EPM thinks to use])
6863                     _pm=`strings $EPM | grep PackageMaker | cut -d" " -f1`
6864                     if test "$_pm" = "/Developer/Applications/PackageMaker.app/Contents/MacOS/PackageMaker"; then
6865                         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)])
6866                     elif test "$_pm" = "/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker"; then
6867                         AC_MSG_RESULT([$_pm, ok])
6868                     else # we never should get here, but go safe
6869                         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)])
6870                     fi
6871                 fi
6872             else
6873                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
6874                 echo "EPM will be built."
6875                 BUILD_TYPE="$BUILD_TYPE EPM"
6876             fi
6877         fi
6878     fi
6880     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
6881         AC_MSG_CHECKING([for rpm])
6882         for a in "$RPM" rpmbuild rpm; do
6883             $a --usage >/dev/null 2> /dev/null
6884             if test $? -eq 0; then
6885                 RPM=$a
6886                 break
6887             else
6888                 $a --version >/dev/null 2> /dev/null
6889                 if test $? -eq 0; then
6890                     RPM=$a
6891                     break
6892                 fi
6893             fi
6894         done
6895         if test -z "$RPM"; then
6896             AC_MSG_ERROR([not found])
6897         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
6898             RPM_PATH=`which $RPM`
6899             AC_MSG_RESULT([$RPM_PATH])
6900             SCPDEFS="$SCPDEFS -DWITH_RPM"
6901         else
6902             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
6903         fi
6904     fi
6905     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
6906         AC_PATH_PROG(DPKG, dpkg, no)
6907         if test "$DPKG" = "no"; then
6908             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
6909         fi
6910     fi
6911     if echo "$PKGFORMAT" | $EGREP osx 2>&1 >/dev/null; then
6912         if test "$_os" = "Darwin"; then
6913             AC_MSG_CHECKING([for PackageMaker availability])
6914             if ! test -x /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker; then
6915                 AC_MSG_ERROR([not installed. Please install Apples Dev Tools])
6916             else
6917                 AC_MSG_RESULT([ok])
6918             fi
6919         else
6920             AC_MSG_ERROR([PackageMaker needed to build OSX packages and you are not on OSX...])
6921         fi
6922     fi
6923     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
6924        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
6925         if test "$EPM" != "no" -a "$EPM" != "internal"; then
6926             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
6927                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
6928                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
6929                     AC_MSG_RESULT([yes])
6930                 else
6931                     AC_MSG_RESULT([no])
6932                     if echo "$PKGFORMAT" | $GREP -q rpm; then
6933                         _pt="rpm"
6934                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
6935                         add_warning "the rpms will need to be installed with --nodeps"
6936                     else
6937                         _pt="pkg"
6938                     fi
6939                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
6940                     add_warning "the ${_pt}s will not be relocateable"
6941                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
6942                                  relocation will work, you need to patch your epm with the
6943                                  patch in epm/epm-3.7.patch or build with
6944                                  --with-epm=internal which will build a suitable epm])
6945                 fi
6946             fi
6947         fi
6948     fi
6949     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
6950         AC_PATH_PROG(PKGMK, pkgmk, no)
6951         if test "$PKGMK" = "no"; then
6952             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
6953         fi
6954     fi
6955     AC_SUBST(RPM)
6956     AC_SUBST(DPKG)
6957     AC_SUBST(PKGMK)
6958 else
6959     AC_MSG_RESULT([no])
6960     EPM=NO
6962 AC_SUBST(EPM)
6964 dnl ===================================================================
6965 dnl We need winegcc when building MinGW build to be able to cross-build msi tools
6966 dnl ===================================================================
6967 WINEGCC=
6968 if test "$enable_winegcc" = "yes"; then
6969     AC_PATH_PROG(WINEGCC, winegcc)
6970     if test "$WINEGCC" = ""; then
6971         AC_MSG_ERROR([winegcc was not found, please install wine-devel, or wine-devel-32bit])
6972     fi
6973     CC_save="$CC"
6974     ac_exeext_save="$ac_exeext"
6975     CC="$WINEGCC -m32"
6976     ac_exeext=".exe"
6977     AC_LINK_IFELSE([AC_LANG_PROGRAM([
6978 #include <stdio.h>
6979         ],[
6980 printf ("hello world\n");
6981         ])],,
6982         [AC_MSG_ERROR([winegcc cannot build 32bit binaries, please install glibc-devel-32bit and gcc-32bit])]
6983     )
6984     CC="$CC_save"
6985     ac_exeext="$ac_exeext_save"
6987 AC_SUBST(WINEGCC)
6989 if test $_os = iOS; then
6990     enable_mpl_subset=yes
6991     enable_postgresql_sdbc=no
6992     enable_lotuswordpro=no
6993     enable_neon=no
6994     enable_extension_integration=no
6995     with_ppds=no
6998 ENABLE_LWP=
6999 if test "$enable_lotuswordpro" = "yes"; then
7000    ENABLE_LWP="TRUE"
7001    SCPDEFS="$SCPDEFS -DDISABLE_LWP"
7003 AC_SUBST(ENABLE_LWP)
7005 AC_MSG_CHECKING([MPL subset])
7006 MPL_SUBSET=
7008 if test "$enable_mpl_subset" = "yes"; then
7009    if test "x$enable_postgresql_sdbc" != "xno"; then
7010         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the postgress database backend.])
7011    fi
7012    if test "$enable_lotuswordpro" = "yes"; then
7013         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
7014    fi
7015    if test "$enable_neon" != "no"; then
7016         AC_MSG_ERROR([need to --disable-neon - webdav support.])
7017    fi
7019    MPL_SUBSET="TRUE"
7020    AC_DEFINE(MPL_HAVE_SUBSET)
7021    AC_MSG_RESULT([only])
7022 else
7023    AC_MSG_RESULT([no restrictions])
7025 AC_SUBST(MPL_SUBSET)
7027 dnl ===================================================================
7028 dnl Check for gperf
7029 dnl ===================================================================
7030 AC_PATH_PROG(GPERF, gperf)
7031 if test -z "$GPERF"; then
7032     AC_MSG_ERROR([gperf not found but needed. Install it.])
7034 AC_MSG_CHECKING([gperf version])
7035 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
7036     AC_MSG_RESULT([OK])
7037 else
7038     AC_MSG_ERROR([too old, you need at least 3.0.0])
7040 AC_SUBST(GPERF)
7042 dnl ===================================================================
7043 dnl Check for building ODK
7044 dnl ===================================================================
7045 if test "$enable_odk" = no; then
7046     unset DOXYGEN
7047 else
7048     if test "$with_doxygen" = no; then
7049         AC_MSG_CHECKING([for doxygen])
7050         unset DOXYGEN
7051         AC_MSG_RESULT([no])
7052     else
7053         if test "$with_doxygen" = yes; then
7054             AC_PATH_PROG([DOXYGEN], [doxygen])
7055             if test -z "$DOXYGEN"; then
7056                 AC_MSG_RESULT([no])
7057                 if test "$enable_odk" = "" ; then
7058                     enable_odk="no"
7059                 else
7060                     AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7061                 fi
7062             fi
7063         else
7064             AC_MSG_CHECKING([for doxygen])
7065             DOXYGEN=$with_doxygen
7066             AC_MSG_RESULT([$DOXYGEN])
7067         fi
7068     fi
7070 AC_SUBST([DOXYGEN])
7072 AC_MSG_CHECKING([whether to build the ODK])
7073 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7074     AC_MSG_RESULT([yes])
7076     if test "$with_java" != "no"; then
7077         AC_MSG_CHECKING([whether to build unowinreg.dll])
7078         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7079             # build on Win by default
7080             enable_build_unowinreg=yes
7081         fi
7082         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7083             AC_MSG_RESULT([no])
7084             BUILD_UNOWINREG=NO
7085         else
7086             AC_MSG_RESULT([yes])
7087             BUILD_UNOWINREG=YES
7088         fi
7089         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "YES"; then
7090             if test -z "$with_mingw_cross_compiler"; then
7091                 dnl Guess...
7092                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7093             elif test -x "$with_mingw_cross_compiler"; then
7094                  MINGWCXX="$with_mingw_cross_compiler"
7095             else
7096                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7097             fi
7099             if test "$MINGWCXX" = "false"; then
7100                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7101             fi
7103             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7104             if test -x "$mingwstrip_test"; then
7105                 MINGWSTRIP="$mingwstrip_test"
7106             else
7107                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7108             fi
7110             if test "$MINGWSTRIP" = "false"; then
7111                 AC_MSG_ERROR(MinGW32 binutils not found.)
7112             fi
7113         fi
7114     fi
7115     BUILD_TYPE="$BUILD_TYPE ODK"
7116 else
7117     AC_MSG_RESULT([no])
7118     BUILD_UNOWINREG=NO
7120 AC_SUBST(BUILD_UNOWINREG)
7121 AC_SUBST(MINGWCXX)
7122 AC_SUBST(MINGWSTRIP)
7124 dnl ===================================================================
7125 dnl Check for system zlib
7126 dnl ===================================================================
7127 if test "$with_system_zlib" = "auto"; then
7128     case "$_os" in
7129     WINNT)
7130         with_system_zlib="$with_system_libs"
7131         ;;
7132     *)
7133         with_system_zlib=yes
7134         ;;
7135     esac
7138 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7139 dnl and has no pkg-config for it at least on some tinderboxes,
7140 dnl so leaving that out for now
7141 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7142 AC_MSG_CHECKING([which zlib to use])
7143 if test "$with_system_zlib" = "yes"; then
7144     AC_MSG_RESULT([external])
7145     SYSTEM_ZLIB=YES
7146     AC_CHECK_HEADER(zlib.h, [],
7147         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7148     AC_CHECK_LIB(z, deflate, [ ZLIB=-lz ],
7149         [AC_MSG_ERROR(zlib not found or functional)], [])
7150 else
7151     AC_MSG_RESULT([internal])
7152     SYSTEM_ZLIB=NO
7153     BUILD_TYPE="$BUILD_TYPE ZLIB"
7154     ZLIB_CFLAGS="-I${OUTDIR}/inc/external/zlib"
7155     ZLIB_LIBS="-L${OUTDIR}/lib -lzlib"
7157 AC_SUBST(ZLIB_CFLAGS)
7158 AC_SUBST(ZLIB_LIBS)
7159 AC_SUBST(SYSTEM_ZLIB)
7161 dnl ===================================================================
7162 dnl Check for system jpeg
7163 dnl ===================================================================
7164 AC_MSG_CHECKING([which jpeg to use])
7165 if test "$with_system_jpeg" = "auto"; then
7166     case "$_os" in
7167     WINNT|Darwin|iOS|Android)
7168         with_system_jpeg="$with_system_libs"
7169         ;;
7170     *)
7171         with_system_jpeg=yes
7172         ;;
7173     esac
7176 if test "$with_system_jpeg" = "yes"; then
7177     AC_MSG_RESULT([external])
7178     SYSTEM_JPEG=YES
7179     AC_CHECK_HEADER(jpeglib.h, [],
7180         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7181     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ JPEG3RDLIB=-ljpeg ],
7182     [AC_MSG_CHECKING(jpeg library not found or fuctional)], [])
7183     libo_MINGW_CHECK_DLL([libjpeg])
7184 else
7185     AC_MSG_RESULT([internal])
7186     SYSTEM_JPEG=NO
7187     BUILD_TYPE="$BUILD_TYPE JPEG"
7189 AC_SUBST(SYSTEM_JPEG)
7192 dnl ===================================================================
7193 dnl Check for system clucene
7194 dnl ===================================================================
7195 dnl we should rather be using
7196 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7197 dnl but the contribs-lib check seems tricky
7198 AC_MSG_CHECKING([which clucene to use])
7199 if test "$with_system_clucene" = "yes"; then
7200     AC_MSG_RESULT([external])
7201     SYSTEM_CLUCENE=YES
7202     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7203     AC_LANG_PUSH([C++])
7204     save_CXXFLAGS=$CXXFLAGS
7205     save_CPPFLAGS=$CPPFLAGS
7206     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7207     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7208     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7209     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7210     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7211                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7212     CXXFLAGS=$save_CXXFLAGS
7213     CPPFLAGS=$save_CPPFLAGS
7214     AC_LANG_POP([C++])
7216     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7217 else
7218     AC_MSG_RESULT([internal])
7219     SYSTEM_CLUCENE=NO
7220     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7222 AC_SUBST(SYSTEM_CLUCENE)
7223 AC_SUBST(CLUCENE_CFLAGS)
7224 AC_SUBST(CLUCENE_LIBS)
7226 dnl ===================================================================
7227 dnl Check for system expat
7228 dnl ===================================================================
7229 dnl we should use libo_CHECK_SYSTEM_MODULE, but e.g. the mingw tinderbox has no
7230 dnl proper pkg-config for it. It should really be fixed on the tinderbox though.
7231 AC_MSG_CHECKING([which expat to use])
7232 if test "$with_system_expat" = "yes"; then
7233     AC_MSG_RESULT([external])
7234     SYSTEM_EXPAT=YES
7235     AC_CHECK_HEADER(expat.h, [],
7236         [AC_MSG_ERROR(expat.h not found. install expat)], [])
7237     AC_CHECK_LIB([expat], [XML_ParserCreate], [:],
7238         [AC_MSG_RESULT(expat library not found or functional.)], [])
7239     libo_MINGW_CHECK_DLL([libexpat])
7240 else
7241     AC_MSG_RESULT([internal])
7242     SYSTEM_EXPAT=NO
7243     BUILD_TYPE="$BUILD_TYPE EXPAT"
7245 AC_SUBST(SYSTEM_EXPAT)
7247 dnl ===================================================================
7248 dnl Check for system libodfgen
7249 dnl ===================================================================
7250 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.0])
7252 dnl ===================================================================
7253 dnl Check for system libcdr
7254 dnl ===================================================================
7255 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.0 >= 0.0.5])
7257 dnl ===================================================================
7258 dnl Check for system libmspub
7259 dnl ===================================================================
7260 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.0])
7262 dnl ===================================================================
7263 dnl Check for system libmwaw
7264 dnl ===================================================================
7265 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.1])
7267 dnl ===================================================================
7268 dnl Check for system libvisio
7269 dnl ===================================================================
7270 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.0])
7272 dnl ===================================================================
7273 dnl Check for system libcmis
7274 dnl ===================================================================
7275 libo_CHECK_SYSTEM_MODULE([libcmis],[CMIS],[libcmis-0.3 >= 0.3.1])
7277 dnl ===================================================================
7278 dnl Check for system libwpd
7279 dnl ===================================================================
7280 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.9 libwpd-stream-0.9],["-I${OUTDIR}/inc/external"],["-L${OUTDIR}/lib -lwpdlib"])
7282 dnl ===================================================================
7283 dnl Check for system lcms2
7284 dnl ===================================================================
7285 if test "$with_system_lcms2" = "yes"; then
7286     libo_MINGW_CHECK_DLL([liblcms2])
7287 else
7288     SYSTEM_LCMS2=NO
7290 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${OUTDIR}/lib -llcms2"])
7291 if test "$GCC" = "yes"; then
7292     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7295 dnl ===================================================================
7296 dnl Check for system cppunit
7297 dnl ===================================================================
7298 libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.12.0])
7300 dnl ===================================================================
7301 dnl Check whether freetype is available
7302 dnl ===================================================================
7303 if test  "$test_freetype" = "yes"; then
7304     AC_MSG_CHECKING([whether freetype is available])
7305     PKG_CHECK_MODULES( FREETYPE, freetype2 >= 2.0 )
7306 else
7307     case "$BUILD_TYPE" in
7308     *FREETYPE*)
7309         FREETYPE_LIBS="-lfreetype"
7310         ;;
7311     esac
7313 AC_SUBST(FREETYPE_CFLAGS)
7314 AC_SUBST(FREETYPE_LIBS)
7316 dnl ===================================================================
7317 dnl Check for system libwps
7318 dnl ===================================================================
7319 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.2],["-I${OUTDIR}/inc/external"],["-L${OUTDIR}/lib -lwpslib"])
7321 dnl ===================================================================
7322 dnl Check for system libwpg
7323 dnl ===================================================================
7324 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.2],["-I${OUTDIR}/inc/external"],["-L${OUTDIR}/lib -lwpglib"])
7326 dnl ===================================================================
7327 dnl Check whether freetype2 supports emboldening
7328 dnl ===================================================================
7329 if test  "$test_freetype" = "yes"; then
7330     save_CPPFLAGS="$CPPFLAGS"
7331     save_LDFLAGS="$LDFLAGS"
7332     save_LIBS="$LIBS"
7333     CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
7334     LDFLAGS="$LDFLAGS $FREETYPE_LIBS"
7335     AC_CHECK_LIB(freetype, FT_GlyphSlot_Embolden,
7336                  [USE_FT_EMBOLDEN="YES"], [USE_FT_EMBOLDEN="NO"], [])
7337     LDFLAGS="$save_LDFLAGS"
7338     CPPFLAGS="$save_CPPFLAGS"
7339     LIBS="$save_LIBS"
7341 AC_SUBST(USE_FT_EMBOLDEN)
7343 # ===================================================================
7344 # Check for system libxslt
7345 # to prevent incompatibilities between internal libxml2 and external libxslt,
7346 # or vice versa, use with_system_libxml here
7347 # ===================================================================
7348 if test "$with_system_libxml" = "auto"; then
7349     case "$_os" in
7350     WINNT|iOS|Android)
7351         with_system_libxml="$with_system_libs"
7352         ;;
7353     *)
7354         with_system_libxml=yes
7355         ;;
7356     esac
7359 AC_MSG_CHECKING([which libxslt to use])
7360 if test "$with_system_libxml" = "yes"; then
7361     AC_MSG_RESULT([external])
7362     SYSTEM_LIBXSLT=YES
7363     if test "$_os" = "Darwin"; then
7364         dnl make sure to use SDK path
7365         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7366         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7367         dnl omit -L/usr/lib
7368         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7369         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7370     else
7371         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7372         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7373     fi
7375     dnl Check for xsltproc
7376     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7377     if test "$XSLTPROC" = "no"; then
7378         AC_MSG_ERROR([xsltproc is required])
7379     fi
7381     libo_MINGW_CHECK_DLL([libxslt])
7382     libo_MINGW_CHECK_DLL([libexslt])
7383     libo_MINGW_TRY_DLL([iconv])
7384 else
7385     AC_MSG_RESULT([internal])
7386     SYSTEM_LIBXSLT=NO
7387     LIBXSLT_MAJOR=1
7388     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
7390     if test "$cross_compiling" = "yes"; then
7391         AC_PATH_PROG(XSLTPROC, xsltproc, no)
7392         if test "$XSLTPROC" = "no"; then
7393             AC_MSG_ERROR([xsltproc is required])
7394         fi
7395     fi
7397 AC_SUBST(SYSTEM_LIBXSLT)
7398 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
7399     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
7401 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
7403 AC_SUBST(LIBEXSLT_CFLAGS)
7404 AC_SUBST(LIBEXSLT_LIBS)
7405 AC_SUBST(LIBXSLT_CFLAGS)
7406 AC_SUBST(LIBXSLT_LIBS)
7407 AC_SUBST(LIBXSLT_MAJOR)
7408 AC_SUBST(XSLTPROC)
7410 # ===================================================================
7411 # Check for system libxml
7412 # ===================================================================
7413 AC_MSG_CHECKING([which libxml to use])
7414 if test "$with_system_libxml" = "yes"; then
7415     AC_MSG_RESULT([external])
7416     SYSTEM_LIBXML=YES
7417     if test "$_os" = "Darwin"; then
7418         dnl make sure to use SDK path
7419         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7420         dnl omit -L/usr/lib
7421         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
7422     elif test $_os = iOS; then
7423         dnl make sure to use SDK path
7424         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
7425         LIBXML_CFLAGS="-I$usr/include/libxml2"
7426         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
7427     else
7428         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
7429     fi
7431     dnl Check for xmllint
7432     AC_PATH_PROG(XMLLINT, xmllint, no)
7433     if test "$XMLLINT" = "no"; then
7434         AC_MSG_ERROR([xmllint is required])
7435     fi
7437     libo_MINGW_CHECK_DLL([libxml2])
7438     libo_MINGW_TRY_DLL([zlib1])
7439 else
7440     AC_MSG_RESULT([internal])
7441     SYSTEM_LIBXML=NO
7442     BUILD_TYPE="$BUILD_TYPE LIBXML2"
7444 AC_SUBST(SYSTEM_LIBXML)
7445 AC_SUBST(LIBXML_CFLAGS)
7446 AC_SUBST(LIBXML_LIBS)
7447 AC_SUBST(XMLLINT)
7449 # =====================================================================
7450 # Checking for a Python interpreter with version >= 2.5 needed to build LO.
7451 # runtime requires Python 3 compatible version (>= 2.6)
7452 # Optionally user can pass an option to configure, i. e.
7453 # ./configure PYTHON=/usr/bin/python
7454 # =====================================================================
7455 if test "$build_os" != "cygwin"; then
7456     # This allows a lack of system python with no error, we use internal one in that case.
7457     AM_PATH_PYTHON([2.5],, [:])
7458     # Clean PYTHON_VERSION checked below if cross-compiling
7459     PYTHON_VERSION=""
7460     if test "$PYTHON" != ":"; then
7461         PYTHON_FOR_BUILD=$PYTHON
7462     fi
7464 AC_SUBST(PYTHON_FOR_BUILD)
7466 # Checks for Python to use for Pyuno
7467 AC_MSG_CHECKING([which Python to use for Pyuno])
7468 case "$enable_python" in
7469 no|disable)
7470     if test -z $PYTHON_FOR_BUILD; then
7471         # Python is required to build LibreOffice. In theory we could separate the build-time Python
7472         # requirement from the choice whether to include Python stuff in the installer, but why
7473         # bother?
7474         AC_MSG_ERROR([Python is required at build time.])
7475     fi
7476     enable_python=no
7477     AC_MSG_RESULT([none])
7478     ;;
7479 ""|yes|auto)
7480     if test "$DISABLE_SCRIPTING" = TRUE -a -n $PYTHON_FOR_BUILD; then
7481         AC_MSG_RESULT([no, overridden by --disable-scripting])
7482         enable_python=no
7483     elif test $build_os = cygwin; then
7484         dnl When building on Windows we don't attempt to use any installed
7485         dnl "system"  Python.
7486         dnl
7487         dnl (When cross-compiling to Windows from Linux using the mingw32-cross
7488         dnl compiler from OBS, use mingw32-python from OBS, and ditto for other
7489         dnl MinGW cross-compilation setups.)
7490         AC_MSG_RESULT([internal])
7491         enable_python=internal
7492     elif test "$cross_compiling" = yes; then
7493         AC_MSG_RESULT([system])
7494         enable_python=system
7495     else
7496         # Unset variables set by the above AM_PATH_PYTHON so that
7497         # we actually do check anew.
7498         unset PYTHON am_cv_pathless_PYTHON ac_cv_path_PYTHON
7499         AM_PATH_PYTHON([3.3],, [:])
7500         if test "$PYTHON" = :; then
7501             AC_MSG_RESULT([internal])
7502             enable_python=internal
7503         else
7504             AC_MSG_RESULT([system])
7505             enable_python=system
7506         fi
7507     fi
7508     ;;
7509 internal)
7510     AC_MSG_RESULT([internal])
7511     ;;
7512 system)
7513     AC_MSG_RESULT([system])
7514     ;;
7516     AC_MSG_ERROR([Incorrect --enable-python option])
7517     ;;
7518 esac
7520 if test $enable_python != no; then
7521     BUILD_TYPE="$BUILD_TYPE PYUNO"
7524 if test $enable_python = system; then
7525     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
7526         # We already have logic above to make sure the system Python
7527         # is used only when building against SDK 10.6 or newer.
7529         # Make sure we use the 2.6 Python when building against the
7530         # 10.6 SDK.
7531         case $with_macosx_sdk in
7532         10.6)
7533             python_version=2.6;;
7534         10.7|10.8)
7535             python_version=2.7;;
7536         *)
7537             # ???
7538             python_version=2.7;;
7539         esac
7540         PYTHON=python$python_version
7541         PYTHON_CFLAGS="-I/Developer/SDKs/MacOSX${with_macosx_sdk}.sdk/System/Library/Frameworks/Python.framework/Versions/${python_version}/include/python${python_version}"
7542         PYTHON_LIBS="-framework Python"
7543     fi
7544     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
7545         # Fallback: Accept these in the environment, or as set above
7546         # for MacOSX.
7547         :
7548     elif test "$cross_compiling" != yes; then
7549         # Unset variables set by the above AM_PATH_PYTHON so that
7550         # we actually do check anew.
7551         unset PYTHON am_cv_pathless_PYTHON ac_cv_path_PYTHON
7552         # This causes an error if no python command is found
7553         AM_PATH_PYTHON([3.3])
7554         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
7555         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
7556         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
7557         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
7558         if test -z "$PKG_CONFIG"; then
7559             PYTHON_CFLAGS="-I$python_include"
7560             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
7561         elif $PKG_CONFIG --exists python-$python_version; then
7562             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
7563             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
7564         else
7565             PYTHON_CFLAGS="-I$python_include"
7566             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
7567         fi
7568     else
7569         dnl How to find out the cross-compilation Python installation path?
7570         dnl Let's hardocode what we know for different distributions for now...
7571         for python_version in 2.6; do
7572             if test -f ${MINGW_SYSROOT}/include/python${python_version}/Python.h; then
7573                 PYTHON_CFLAGS="-I${MINGW_SYSROOT}/include/python$python_version"
7574                 PYTHON_LIBS="-L${MINGW_SYSROOT}/lib -lpython$python_version $python_libs"
7575                 AC_MSG_CHECKING([for python.exe])
7576                 AS_IF([test -f "$MINGW_SYSROOT/bin/python.exe"],
7577                       [AC_MSG_RESULT([$MINGW_SYSROOT/bin/python.exe])
7578                        MINGW_PYTHON_EXE=python.exe],
7579                       [AC_MSG_RESULT([not found])
7580                        AC_MSG_ERROR([could not find python.exe])])
7581                 libo_MINGW_CHECK_DLL([libpython$python_version])
7582                 libo_MINGW_CHECK_DLL([libreadline6])
7583                 libo_MINGW_CHECK_DLL([libtermcap])
7584                 # could we somehow extract the really mingw python version from
7585                 # actual distro package?
7586                 # 2.6.2 currently on OpenSUSE 12.1?
7587                 # rpm -q mingw32-python => mingw32-python-2.6.2-17.17.noarch
7588                 PYTHON_VERSION=$python_version.2
7589                 PYTHON_VERSION_MAJOR=`echo $python_version | cut -d . -f 1`
7590                 PYTHON_VERSION_MINOR=`echo $python_version | cut -d . -f 2`
7591                 break
7592             fi
7593         done
7594         AC_MSG_CHECKING([for python version])
7595         AS_IF([test -n "$PYTHON_VERSION"],
7596               [AC_MSG_RESULT([$PYTHON_VERSION])],
7597               [AC_MSG_RESULT([not found])
7598                AC_MSG_ERROR([no usable python found])])
7599         test -n "$PYTHON_CFLAGS" && break
7600     fi
7601     # let the PYTHON_FOR_BUILD match the same python installation that
7602     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
7603     # better for PythonTests.
7604     PYTHON_FOR_BUILD=$PYTHON
7607 dnl By now enable_python should be "system", "internal" or "no"
7608 case $enable_python in
7609 system)
7610     SYSTEM_PYTHON=YES
7612     if test "$CROSS_COMPILING" != YES; then
7613         dnl Check if the headers really work
7614         save_CPPFLAGS="$CPPFLAGS"
7615         CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
7616         AC_CHECK_HEADER(Python.h, [],
7617            [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
7618            [])
7619         CPPFLAGS="$save_CPPFLAGS"
7621         AC_LANG_PUSH(C)
7622         CFLAGS="$CFLAGS $PYTHON_CFLAGS"
7623         AC_MSG_CHECKING([for correct python library version])
7624            AC_RUN_IFELSE([AC_LANG_SOURCE([[
7625 #include <Python.h>
7627 int main(int argc, char **argv) {
7628        if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
7629            (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
7630        else return 1;
7632            ]])],[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])],[])
7633         CFLAGS=$save_CFLAGS
7634         AC_LANG_POP(C)
7636         dnl FIXME Check if the Python library can be linked with, too?
7637     fi
7638     ;;
7640 internal)
7641     SYSTEM_PYTHON=NO
7642     PYTHON_VERSION_MAJOR=3
7643     PYTHON_VERSION_MINOR=3
7644     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.0
7645     BUILD_TYPE="$BUILD_TYPE PYTHON"
7646     # Embedded Python dies without Home set
7647     if test "$HOME" = ""; then
7648         export HOME=""
7649     fi
7650     # bz2 tarball and bzip2 is not standard
7651     if test -z "$BZIP2"; then
7652         AC_PATH_PROG( BZIP2, bzip2)
7653         if test -z "$BZIP2"; then
7654             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
7655         fi
7656     fi
7657     ;;
7659     DISABLE_PYTHON=TRUE
7660     SYSTEM_PYTHON=NO
7661     ;;
7663     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
7664     ;;
7665 esac
7667 AC_SUBST(DISABLE_PYTHON)
7668 AC_SUBST(SYSTEM_PYTHON)
7669 AC_SUBST(PYTHON_CFLAGS)
7670 AC_SUBST(PYTHON_LIBS)
7671 AC_SUBST(PYTHON_VERSION)
7672 AC_SUBST(PYTHON_VERSION_MAJOR)
7673 AC_SUBST(PYTHON_VERSION_MINOR)
7674 AC_SUBST([MINGW_PYTHON_EXE])
7676 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
7677 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
7678     AC_MSG_RESULT([yes])
7679     ENABLE_MARIADBC=YES
7680     MARIADBC_MAJOR=1
7681     MARIADBC_MINOR=0
7682     MARIADBC_MICRO=2
7683     BUILD_TYPE="$BUILD_TYPE MARIADBC"
7684 else
7685     AC_MSG_RESULT([no])
7686     ENABLE_MARIADBC=NO
7688 AC_SUBST(ENABLE_MARIADBC)
7689 AC_SUBST(MARIADBC_MAJOR)
7690 AC_SUBST(MARIADBC_MINOR)
7691 AC_SUBST(MARIADBC_MICRO)
7693 if test "$ENABLE_MARIADBC" = "YES"; then
7695     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
7697     dnl ===================================================================
7698     dnl Check for system MariaDB
7699     dnl ===================================================================
7700     AC_MSG_CHECKING([which MariaDB to use])
7701     if test "$with_system_mariadb" = "yes"; then
7702         AC_MSG_RESULT([external])
7703         SYSTEM_MARIADB=YES
7704         AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
7705         if test -z "$MARIADBCONFIG"; then
7706             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
7707             if test -z "$MARIADBCONFIG"; then
7708                 AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL package.])
7709             fi
7710         fi
7711         AC_MSG_CHECKING([MariaDB version])
7712         MARIADB_VERSION=`$MARIADBCONFIG --version`
7713         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
7714         if test "$MARIADB_MAJOR" -ge "5"; then
7715             AC_MSG_RESULT([OK])
7716         else
7717             AC_MSG_ERROR([too old, use 5.0.x or later])
7718         fi
7719         AC_MSG_CHECKING([for MariaDB Client library])
7720         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
7721         MARIADB_LIBS=`$MARIADBCONFIG --libs`
7722         AC_MSG_RESULT([includes $MARIADB_CFLAGS, libraries $MARIADB_LIBS])
7723     else
7724         AC_MSG_RESULT([internal])
7725         SYSTEM_MARIADB=NO
7726         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb/include"
7727         MARIADB_LIBS="-L${OUTDIR}/lib -lmariadblib"
7728         BUILD_TYPE="$BUILD_TYPE MARIADB"
7729     fi
7731     AC_SUBST(SYSTEM_MARIADB)
7732     AC_SUBST(MARIADB_CFLAGS)
7733     AC_SUBST(MARIADB_LIBS)
7735     AC_LANG_PUSH([C++])
7736     dnl ===================================================================
7737     dnl Check for system MySQL C++ Connector
7738     dnl ===================================================================
7739     # FIXME!
7740     # who thought this too-generic cppconn dir was a good idea?
7741     AC_MSG_CHECKING([MySQL Connector/C++])
7742     if test "$with_system_mysql_cppconn" = "yes"; then
7743         AC_MSG_RESULT([external])
7744         SYSTEM_MYSQL_CPPCONN=YES
7745         AC_LANG_PUSH([C++])
7746         AC_CHECK_HEADER(mysql_driver.h, [],
7747                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
7748         AC_CHECK_LIB([mysqlcppconn], [main], [:],
7749                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
7750         save_LIBS=$LIBS
7751         LIBS="$LIBS -lmysqlcppconn"
7752         AC_MSG_CHECKING([version])
7753         AC_RUN_IFELSE([AC_LANG_SOURCE([[
7754 #include <mysql_driver.h>
7756 int main(int argc, char **argv) {
7757     sql::Driver *driver;
7758     driver = get_driver_instance();
7759     if (driver->getMajorVersion() > 1 || \
7760        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
7761        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
7762         return 0;
7763       else
7764         return 1;
7766       ]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR([not suitable, we need >= 1.0.6])],[])
7768         AC_LANG_POP([C++])
7769         LIBS=$save_LIBS
7770     else
7771         AC_MSG_RESULT([internal])
7772         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
7773         SYSTEM_MYSQL_CPPCONN=NO
7774     fi
7775     AC_LANG_POP([C++])
7777 AC_SUBST(SYSTEM_MYSQL_CPPCONN)
7779 dnl ===================================================================
7780 dnl Check for system hsqldb
7781 dnl ===================================================================
7782 if test "$with_java" != "no"; then
7783 HSQLDB_USE_JDBC_4_1=
7784 AC_MSG_CHECKING([which hsqldb to use])
7785 if test "$with_system_hsqldb" = "yes"; then
7786     AC_MSG_RESULT([external])
7787     SYSTEM_HSQLDB=YES
7788     if test -z $HSQLDB_JAR; then
7789         HSQLDB_JAR=/usr/share/java/hsqldb.jar
7790     fi
7791     AC_CHECK_FILE($HSQLDB_JAR, [],
7792                [AC_MSG_ERROR(hsqldb.jar not found.)], [])
7793     AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
7794     export HSQLDB_JAR
7795     if $PERL -e 'use Archive::Zip;
7796             my $file = "$ENV{'HSQLDB_JAR'}";
7797             my $zip = Archive::Zip->new( $file );
7798             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
7799             if ( $mf =~ m/Specification-Version: 1.8.*/ ) {
7800                push @l, split(/\n/, $mf);
7801                foreach my $line (@l) {
7802                   if ($line =~ m/Specification-Version:/) {
7803                       ($t, $version) = split (/:/,$line);
7804                       $version =~ s/^\s//;
7805                       ($a, $b, $c, $d) = split (/\./,$version);
7806                       if ($c == "0" && $d > "8")  {
7807                           exit 0;
7808                       } else {
7809                           exit 1;
7810                       }
7811                   }
7812                }
7813             } else {
7814                 exit 1;
7815             }'; then
7816         AC_MSG_RESULT([yes])
7817     else
7818         AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
7819     fi
7820 else
7821     AC_MSG_RESULT([internal])
7822     SYSTEM_HSQLDB=NO
7823     BUILD_TYPE="$BUILD_TYPE HSQLDB"
7824     AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
7825     javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
7826     if expr "$javanumver" '>=' 000100060000 > /dev/null; then
7827         AC_MSG_RESULT([yes])
7828         HSQLDB_USE_JDBC_4_1=YES
7829     else
7830         AC_MSG_RESULT([no])
7831     fi
7833 AC_SUBST(SYSTEM_HSQLDB)
7834 AC_SUBST(HSQLDB_JAR)
7835 AC_SUBST([HSQLDB_USE_JDBC_4_1])
7838 dnl ===================================================================
7839 dnl Check for PostgreSQL stuff
7840 dnl ===================================================================
7841 if test "x$enable_postgresql_sdbc" != "xno"; then
7842     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
7844     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
7845         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
7846     fi
7847     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
7848         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
7849     fi
7851     AC_MSG_CHECKING([PostgreSQL C interface])
7852     if test "$with_system_postgresql" = "yes"; then
7853         AC_MSG_RESULT([external PostgreSQL])
7854         SYSTEM_POSTGRESQL=YES
7855         if test "$_os" = Darwin; then
7856             supp_path=''
7857             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
7858                 pg_supp_path="$P_SEP$d$pg_supp_path"
7859             done
7860         fi
7861         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
7862         if test -z "$PGCONFIG"; then
7863             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
7864         fi
7865         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
7866         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
7867     else
7868         # if/when anything else than PostgreSQL uses Kerberos,
7869         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
7870         WITH_KRB5=NO
7871         WITH_GSSAPI=no
7872         case "$_os" in
7873         Darwin)
7874             # MacOS X has system MIT Kerberos 5 since 10.4
7875             if test "$with_krb5" != "no"; then
7876                 WITH_KRB5=YES
7877                 save_LIBS=$LIBS
7878                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
7879                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5, try installing libcom_err devel package])])
7880                 KRB5_LIBS=$LIBS
7881                 LIBS=$save_LIBS
7882                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
7883                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5, try installing krb5 devel package])])
7884                 KRB5_LIBS="$KRB5_LIBS $LIBS"
7885                 LIBS=$save_LIBS
7886             fi
7887             if test "$with_gssapi" != "no"; then
7888               WITH_GSSAPI=YES
7889               save_LIBS=$LIBS
7890               AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
7891                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
7892               GSSAPI_LIBS=$LIBS
7893               LIBS=$save_LIBS
7894             fi
7895             ;;
7896         WINNT)
7897             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
7898                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
7899             fi
7900             ;;
7901         Linux|GNU|*BSD|DragonFly)
7902             if test "$with_krb5" != "no"; then
7903                 WITH_KRB5=YES
7904                 save_LIBS=$LIBS
7905                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
7906                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
7907                 KRB5_LIBS=$LIBS
7908                 LIBS=$save_LIBS
7909                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
7910                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
7911                 KRB5_LIBS="$KRB5_LIBS $LIBS"
7912                 LIBS=$save_LIBS
7913             fi
7914             if test "$with_gssapi" != "no"; then
7915                 WITH_GSSAPI=YES
7916                 save_LIBS=$LIBS
7917                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
7918                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
7919                 GSSAPI_LIBS=$LIBS
7920                 LIBS=$save_LIBS
7921             fi
7922             ;;
7923         *)
7924             if test "$with_krb5" = "yes"; then
7925                 WITH_KRB5=YES
7926                 save_LIBS=$LIBS
7927                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
7928                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
7929                 KRB5_LIBS=$LIBS
7930                 LIBS=$save_LIBS
7931                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
7932                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
7933                 KRB5_LIBS="$KRB5_LIBS $LIBS"
7934                 LIBS=$save_LIBS
7935             fi
7936             if test "$with_gssapi" = "yes"; then
7937                 WITH_GSSAPI=YES
7938                 save_LIBS=$LIBS
7939                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
7940                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
7941                 LIBS=$save_LIBS
7942                 GSSAPI_LIBS=$LIBS
7943             fi
7944         esac
7946         if test -n "$with_libpq_path"; then
7947             SYSTEM_POSTGRESQL=YES
7948             AC_MSG_RESULT([external libpq])
7949             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
7950             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
7951         else
7952             SYSTEM_POSTGRESQL=NO
7953             AC_MSG_RESULT([internal])
7954             POSTGRESQL_LIB=""
7955             POSTGRESQL_INC="%OVERRIDE_ME%"
7956             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
7957         fi
7958     fi
7959     if test "${SYSTEM_POSTGRESQL}" = "YES"; then
7960         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
7961         save_CFLAGS=$CFLAGS
7962         save_CPPFLAGS=$CPPFLAGS
7963         save_LIBS=$LIBS
7964         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
7965         LIBS="${LIBS} ${POSTGRESQL_LIB}"
7966         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
7967         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
7968             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
7969         CFLAGS=$save_CFLAGS
7970         CPPFLAGS=$save_CPPFLAGS
7971         LIBS=$save_LIBS
7972     fi
7973     BUILD_POSTGRESQL_SDBC=YES
7975 AC_SUBST(WITH_KRB5)
7976 AC_SUBST(WITH_GSSAPI)
7977 AC_SUBST(GSSAPI_LIBS)
7978 AC_SUBST(KRB5_LIBS)
7979 AC_SUBST(BUILD_POSTGRESQL_SDBC)
7980 AC_SUBST(SYSTEM_POSTGRESQL)
7981 AC_SUBST(POSTGRESQL_INC)
7982 AC_SUBST(POSTGRESQL_LIB)
7984 dnl ===================================================================
7985 dnl Check for system curl
7986 dnl ===================================================================
7987 AC_MSG_CHECKING([which libcurl to use])
7988 if test "$with_system_curl" = "auto"; then
7989     case "$_os" in
7990     Darwin)
7991         with_system_curl=yes
7992         ;;
7993     *)
7994         with_system_curl="$with_system_libs"
7995         ;;
7996     esac
7999 if test "$with_system_curl" = "yes"; then
8000     AC_MSG_RESULT([external])
8001     SYSTEM_CURL=YES
8003     curl_version=""
8004     if test "$cross_compiling" = "yes"; then
8005         dnl At least the OBS mingw32-libcurl-devel package
8006         dnl comes with a proper .pc file
8007         PKG_CHECK_MODULES(CURL, libcurl,, [:])
8008         if test -n "$CURL_PKG_ERRORS"; then
8009             AC_MSG_RESULT([no])
8010         else
8011             curl_version=`$PKG_CONFIG --modversion libcurl`
8012         fi
8013     fi
8014     if test -z "$curl_version"; then
8015         AC_PATH_PROG(CURLCONFIG, curl-config)
8016         if test -z "$CURLCONFIG"; then
8017             AC_MSG_ERROR([install the libcurl development package])
8018         fi
8019         CURL_LIBS=`$CURLCONFIG --libs`
8020         CURL_CFLAGS=`$CURLCONFIG --cflags`
8021         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8022     fi
8024     AC_MSG_CHECKING([whether libcurl is >= 7.13.1])
8026     case $curl_version in
8027     dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8028     dnl so they need to be doubled to end up in the configure script
8029     7.13.1|7.1[[4-9]].*|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8030         AC_MSG_RESULT([yes, you have $curl_version])
8031         ;;
8032     *)
8033         AC_MSG_ERROR([no, you have $curl_version])
8034         ;;
8035     esac
8037     libo_MINGW_CHECK_DLL([libcurl])
8038     libo_MINGW_TRY_DLL([libintl])
8039     libo_MINGW_TRY_DLL([libidn])
8040     libo_MINGW_TRY_DLL([libnspr4])
8041     libo_MINGW_TRY_DLL([nssutil3])
8042     libo_MINGW_TRY_DLL([libplc4])
8043     libo_MINGW_TRY_DLL([libplds4])
8044     libo_MINGW_TRY_DLL([nss3])
8045     libo_MINGW_TRY_DLL([ssl3])
8046     libo_MINGW_TRY_DLL([libgpg-error])
8047     libo_MINGW_TRY_DLL([libgcrypt])
8048     libo_MINGW_TRY_DLL([libssh2])
8049 else
8050     AC_MSG_RESULT([internal])
8051     SYSTEM_CURL=NO
8052     BUILD_TYPE="$BUILD_TYPE CURL"
8054 AC_SUBST(SYSTEM_CURL)
8055 AC_SUBST(CURL_CFLAGS)
8056 AC_SUBST(CURL_LIBS)
8058 dnl ===================================================================
8059 dnl Check for system boost
8060 dnl ===================================================================
8061 AC_MSG_CHECKING([which boost to use])
8062 if test "$with_system_boost" = "yes"; then
8063     AC_MSG_RESULT([external])
8064     SYSTEM_BOOST=YES
8065     AX_BOOST_BASE
8066     AX_BOOST_DATE_TIME
8067     mingw_boost_date_time_dll=`echo $BOOST_DATE_TIME_LIB | sed -e 's/^-l//' -e 's/\.dll$//'`
8068     libo_MINGW_TRY_DLL([$mingw_boost_date_time_dll])
8069     if test -z "$MINGW_BOOST_DATE_TIME_DLL"; then
8070         # if not found, try again with 'lib' prefix
8071         libo_MINGW_CHECK_DLL([lib$mingw_boost_date_time_dll])
8072     fi
8073     AC_LANG_PUSH([C++])
8074     save_CXXFLAGS=$CXXFLAGS
8075     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS"
8076     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8077        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8078     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8079        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8080     AC_CHECK_HEADER(boost/function.hpp, [],
8081        [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
8082     CXXFLAGS="$CXXFLAGS -fno-exceptions"
8083     AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
8084     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp>
8085 ]], [[]])],[ac_cv_cxx_boost_no_exceptions_broken=no],[ac_cv_cxx_boost_no_exceptions_broken=yes])
8086     if test "$ac_cv_cxx_boost_no_exceptions_broken" = "yes"; then
8087         AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
8088     else
8089         AC_MSG_RESULT([yes])
8090     fi
8091     CXXFLAGS=$save_CXXFLAGS
8092     AC_LANG_POP([C++])
8093 else
8094     AC_MSG_RESULT([internal])
8095     BUILD_TYPE="$BUILD_TYPE BOOST"
8096     SYSTEM_BOOST=NO
8098 AC_SUBST(SYSTEM_BOOST)
8100 dnl ===================================================================
8101 dnl Check for system mdds
8102 dnl ===================================================================
8103 AC_MSG_CHECKING([which mdds to use])
8104 if test "$with_system_mdds" = "yes"; then
8105     AC_MSG_RESULT([external])
8106     SYSTEM_MDDS=YES
8108     dnl ===================================================================
8109     dnl Determine which hash container mdds shall use
8110     dnl ===================================================================
8111     AC_MSG_CHECKING([which hash container mdds shall use])
8112     if test "x$HAVE_CXX0X" = "xTRUE"; then
8113         MDDS_CPPFLAGS=$CXXFLAGS_CXX11
8114         AC_MSG_RESULT([std::unordered_map])
8115     else
8116         MDDS_CPPFLAGS="-DMDDS_HASH_CONTAINER_BOOST"
8117         AC_MSG_RESULT([boost::unordered_map])
8118     fi
8120     AC_LANG_PUSH([C++])
8121     save_CPPFLAGS="$CPPFLAGS"
8122     CPPFLAGS="$CPPFLAGS $MDDS_CPPFLAGS"
8123     AC_CHECK_HEADER(mdds/multi_type_vector.hpp, [],
8124         [AC_MSG_ERROR(mdds/multi_type_vector.hpp not found. Install mdds >= 0.7.0)], [])
8125     AC_CHECK_TYPE(mdds::multi_type_vector<int>::iterator, [],
8126         [AC_MSG_ERROR(mdds/multi_type_matrix.hpp does not define multi_type_vector::iterator. Install mdds >= 0.7.0)], [#include <mdds/multi_type_vector.hpp>])
8127     CPPFLAGS="$save_CPPFLAGS"
8128     AC_LANG_POP([C++])
8129 else
8130     AC_MSG_RESULT([internal])
8131     BUILD_TYPE="$BUILD_TYPE MDDS"
8132     SYSTEM_MDDS=NO
8134     dnl ===================================================================
8135     dnl Determine which hash container mdds shall use
8136     dnl ===================================================================
8137     AC_MSG_CHECKING([which hash container mdds shall use])
8138     MDDS_CPPFLAGS="-DMDDS_HASH_CONTAINER_BOOST"
8139     AC_MSG_RESULT([boost::unordered_map])
8141 AC_SUBST(SYSTEM_MDDS)
8142 AC_SUBST([MDDS_CPPFLAGS])
8144 dnl ===================================================================
8145 dnl Check for system vigra
8146 dnl ===================================================================
8147 AC_MSG_CHECKING([which vigra to use])
8148 if test "$with_system_vigra" = "yes"; then
8149     AC_MSG_RESULT([external])
8150     SYSTEM_VIGRA=YES
8151     AC_LANG_PUSH([C++])
8152     AC_CHECK_HEADER(vigra/copyimage.hxx, [],
8153        [AC_MSG_ERROR(vigra/copyimage.hxx not found. install vigra)], [])
8154     AC_LANG_POP([C++])
8155 else
8156     AC_MSG_RESULT([internal])
8157     BUILD_TYPE="$BUILD_TYPE VIGRA"
8158     SYSTEM_VIGRA=NO
8160 AC_SUBST(SYSTEM_VIGRA)
8162 dnl ===================================================================
8163 dnl Check for system odbc
8164 dnl ===================================================================
8165 AC_MSG_CHECKING([which odbc headers to use])
8166 if test "$with_system_odbc" = "yes"; then
8167     AC_MSG_RESULT([external])
8168     SYSTEM_ODBC_HEADERS=YES
8170     AC_CHECK_HEADER(sqlext.h, [],
8171       [AC_MSG_ERROR(odbc not found. install odbc)], [])
8172 elif test "$enable_database_connectivity" != yes; then
8173     AC_MSG_RESULT([none])
8174 else
8175     AC_MSG_RESULT([internal])
8176     SYSTEM_ODBC_HEADERS=NO
8178 AC_SUBST(SYSTEM_ODBC_HEADERS)
8181 dnl ===================================================================
8182 dnl Check for system openldap
8183 dnl ===================================================================
8185 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8186 AC_MSG_CHECKING([which openldap library to use])
8187 if test "$with_system_openldap" = "yes"; then
8188     AC_MSG_RESULT([external])
8189     SYSTEM_OPENLDAP=YES
8190     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8191     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8192     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8193 else
8194     AC_MSG_RESULT([internal])
8195     SYSTEM_OPENLDAP=NO
8196     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8199 AC_SUBST(SYSTEM_OPENLDAP)
8201 dnl ===================================================================
8202 dnl Check for mozilla ab connectivity for windows
8203 dnl ===================================================================
8205 if test "$_os" = "WINNT"; then
8206     AC_MSG_CHECKING([whether to enable build of Mozilla addressbook connectivity driver for Windows])
8207     if test "$enable_win_mozab_driver" = "yes" -a "$WITH_MINGW" != "YES" ; then
8208         WITH_MOZAB4WIN=YES
8209         AC_MSG_RESULT([yes, internal (old windows mozab driver)])
8210         BUILD_TYPE="$BUILD_TYPE MOZ"
8211         MSVC80_DLLS="msvcp80.dll msvcr80.dll Microsoft.VC80.CRT.manifest"
8212         MSVC80_DLL_PATH=`cygpath -u "$TARFILE_LOCATION"`
8213         for dll in $MSVC80_DLLS; do
8214             if ! test -f "$MSVC80_DLL_PATH/$dll"; then
8215                 AC_MSG_ERROR([can not find $dll in $MSVC80_DLL_PATH needed for the pre-built Mozilla libraries])
8216             fi
8217         done
8218     else
8219         AC_MSG_RESULT([no])
8220         WITH_MOZAB4WIN=NO
8221     fi
8223 AC_SUBST(WITH_MOZAB4WIN)
8224 AC_SUBST(MSVC80_DLLS)
8225 AC_SUBST(MSVC80_DLL_PATH)
8227 dnl ===================================================================
8228 dnl Check for TLS/SSL and cryptographic implementation to use
8229 dnl ===================================================================
8230 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8231 if test -n "$with_tls"; then
8232     case $with_tls in
8233     openssl)
8234         AC_DEFINE(USE_TLS_OPENSSL)
8235         TLS=OPENSSL
8237         if test "$enable_openssl" != "yes"; then
8238             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8239         fi
8241         # warn that OpenSSL has been selected but not all TLS code has this option
8242         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS])
8243         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS"
8244         ;;
8245     nss)
8246         AC_DEFINE(USE_TLS_NSS)
8247         TLS=NSS
8248         ;;
8249     *)
8250         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8251 openssl - OpenSSL
8252 nss - Mozilla's Network Security Services (NSS)
8253     ])
8254         ;;
8255     esac
8256 else
8257     if test "$enable_openssl" = "yes"; then
8258         AC_DEFINE(USE_TLS_OPENSSL)
8259         TLS=OPENSSL
8260     else
8261         AC_DEFINE(USE_TLS_NSS)
8262         TLS=NSS
8263     fi
8265 AC_MSG_RESULT([$TLS])
8266 AC_SUBST(TLS)
8268 dnl ===================================================================
8269 dnl Check for system NSS
8270 dnl ===================================================================
8271 libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8272 if test "$with_system_nss" = "yes"; then
8273     libo_MINGW_CHECK_DLL([libnspr4])
8274     libo_MINGW_CHECK_DLL([libplc4])
8275     libo_MINGW_CHECK_DLL([libplds4])
8276     libo_MINGW_CHECK_DLL([nss3])
8277     libo_MINGW_CHECK_DLL([nssutil3])
8278     libo_MINGW_CHECK_DLL([smime3])
8279     libo_MINGW_CHECK_DLL([ssl3])
8280 else
8281     NSS_MAJOR="3"
8282     NSS_MINOR="13"
8283     NSS_PATCH="5"
8285 AC_SUBST(NSS_MAJOR)
8286 AC_SUBST(NSS_MINOR)
8287 AC_SUBST(NSS_PATCH)
8289 dnl ===================================================================
8290 dnl Check for system mozilla headers
8291 dnl ===================================================================
8292 HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=
8293 AC_MSG_CHECKING([which NPAPI headers to use])
8295 if test "$with_system_npapi_headers" = "yes"; then
8296     AC_MSG_RESULT([external])
8297     SYSTEM_NPAPI_HEADERS=YES
8298     # First try npapi-sdk:
8299     PKG_CHECK_MODULES(NPAPI_HEADERS, npapi-sdk, [LOCATED=yes], [LOCATED=no])
8300     # Then go with libxul:
8301     if test "x$LOCATED" != "xyes"; then
8302         PKG_CHECK_MODULES(NPAPI_HEADERS, libxul, [LOCATED=yes], [LOCATED=no])
8303     fi
8304     if test "x$LOCATED" != "xyes"; then
8305         PKG_CHECK_MODULES(NPAPI_HEADERS, mozilla-plugin, [LOCATED=yes], [LOCATED=no])
8306     fi
8307     # if still not found bail out
8308     if test "x$LOCATED" != "xyes"; then
8309         AC_MSG_ERROR([npapi.h header file not found])
8310     fi
8312     AC_LANG_PUSH([C])
8313     save_CFLAGS=$CFLAGS
8314     CFLAGS="$CFLAGS $NPAPI_HEADERS_CFLAGS"
8315     AC_MSG_CHECKING([for NPP_GetMIMEDescription return type])
8316     AC_COMPILE_IFELSE(
8317         [AC_LANG_SOURCE([[
8318             #define XP_UNIX
8319             #include <npapi.h>
8320             const char* NPP_GetMIMEDescription(void) { return "foo"; }
8321             ]])],
8322         [AC_MSG_RESULT([const char*])],
8323         [
8324         AC_MSG_RESULT([char*])
8325         HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=TRUE
8326         ])
8327     CFLAGS=$save_CFLAGS
8328     AC_LANG_POP([C])
8329     NPAPI_HEADERS_CFLAGS="`echo $NPAPI_HEADERS_CFLAGS | sed -e \"s/-I/${ISYSTEM}/g\"`"
8330 else
8331     AC_MSG_RESULT([internal])
8332         dnl ...but will not be built/used unless ENABLE_NPAPI_FROM_BROWSER or
8333         dnl ENABLE_NPAPI_INTO_BROWSER is YES
8334     SYSTEM_NPAPI_HEADERS=NO
8336 AC_SUBST(NPAPI_HEADERS_CFLAGS)
8337 AC_SUBST(SYSTEM_NPAPI_HEADERS)
8338 AC_SUBST(HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION)
8340 dnl ===================================================================
8341 dnl Check for system sane
8342 dnl ===================================================================
8343 AC_MSG_CHECKING([which sane header to use])
8344 if test "$with_system_sane" = "yes"; then
8345     AC_MSG_RESULT([external])
8346     AC_CHECK_HEADER(sane/sane.h, [],
8347       [AC_MSG_ERROR(sane not found. install sane)], [])
8348 else
8349     AC_MSG_RESULT([internal])
8350     BUILD_TYPE="$BUILD_TYPE SANE"
8353 dnl ===================================================================
8354 dnl Check for system icu
8355 dnl ===================================================================
8356 SYSTEM_GENBRK=
8357 SYSTEM_GENCCODE=
8358 SYSTEM_GENCMN=
8360 ICU_MAJOR=51
8361 ICU_MINOR=1
8362 ICU_RECLASSIFIED_CLOSE_PARENTHESIS="YES"
8363 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="YES"
8364 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="YES"
8365 ICU_RECLASSIFIED_HEBREW_LETTER="YES"
8366 AC_MSG_CHECKING([which icu to use])
8367 if test "$with_system_icu" = "yes"; then
8368     AC_MSG_RESULT([external])
8369     SYSTEM_ICU=YES
8370     AC_LANG_PUSH([C++])
8371     AC_MSG_CHECKING([for unicode/rbbi.h])
8372     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
8373     AC_LANG_POP([C++])
8375     if test "$cross_compiling" != "yes" -o "$WITH_MINGW" = "yes"; then
8376         ICUPATH="$PATH"
8377         if test "$WITH_MINGW" = "yes"; then
8378             ICUPATH=`$CC -print-sysroot`/mingw/bin:"$ICUPATH"
8379         fi
8380         AC_PATH_PROG(ICUCONFIG,icu-config,,[$ICUPATH])
8382         AC_MSG_CHECKING([ICU version])
8383         ICU_VERSION=`$ICUCONFIG --noverify --version 2>/dev/null || $ICUCONFIG --version`
8384         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
8385         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
8387         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "2" \); then
8388             AC_MSG_RESULT([OK, $ICU_VERSION])
8389         else
8390             AC_MSG_ERROR([not suitable, only >= 4.2 supported currently])
8391         fi
8392     fi
8394     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
8395         AC_PATH_PROG([ICUCONFIG_FOR_BUILD], [icu-config], [], [$PATH:/usr/sbin:/sbin])
8396         ICU_VERSION_FOR_BUILD=`$ICUCONFIG_FOR_BUILD --noverify --version 2>/dev/null || $ICUCONFIG_FOR_BUILD --version`
8397         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
8398         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
8399         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
8400         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
8401             AC_MSG_RESULT([yes])
8402         else
8403             AC_MSG_RESULT([no])
8404             if test "$with_system_icu_for_build" != "force"; then
8405                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
8406 You can use --with-system-icu-for-build=force to use it anyway.])
8407             fi
8408         fi
8409     fi
8411     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
8412         # using the system icu tools can lead to version confusion, use the
8413         # ones from the build environment when cross-compiling
8414         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
8415         if test -z "$SYSTEM_GENBRK"; then
8416             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
8417         fi
8418         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8419         if test -z "$SYSTEM_GENCCODE"; then
8420             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
8421         fi
8422         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8423         if test -z "$SYSTEM_GENCMN"; then
8424             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
8425         fi
8426         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "4" \); then
8427             ICU_RECLASSIFIED_CLOSE_PARENTHESIS="YES"
8428         else
8429             ICU_RECLASSIFIED_CLOSE_PARENTHESIS="NO"
8430         fi
8431         if test "$ICU_MAJOR" -ge "49"; then
8432             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="YES"
8433             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="YES"
8434             ICU_RECLASSIFIED_HEBREW_LETTER="YES"
8435         else
8436             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="NO"
8437             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="NO"
8438             ICU_RECLASSIFIED_HEBREW_LETTER="NO"
8439         fi
8440     fi
8442     if test "$cross_compiling" = "yes"; then
8443        if test "$ICU_MAJOR" -ge "50"; then
8444             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
8445             ICU_MINOR=""
8446        fi
8447     fi
8449     libo_MINGW_CHECK_DLL([icudata][$ICU_MAJOR][$ICU_MINOR])
8450     libo_MINGW_CHECK_DLL([icui18n][$ICU_MAJOR][$ICU_MINOR])
8451     libo_MINGW_CHECK_DLL([icuuc][$ICU_MAJOR][$ICU_MINOR])
8452 else
8453     AC_MSG_RESULT([internal])
8454     SYSTEM_ICU="NO"
8455     BUILD_TYPE="$BUILD_TYPE ICU"
8457 AC_SUBST(SYSTEM_ICU)
8458 AC_SUBST(SYSTEM_GENBRK)
8459 AC_SUBST(SYSTEM_GENCCODE)
8460 AC_SUBST(SYSTEM_GENCMN)
8461 AC_SUBST(ICU_MAJOR)
8462 AC_SUBST(ICU_MINOR)
8463 AC_SUBST(ICU_RECLASSIFIED_CLOSE_PARENTHESIS)
8464 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
8465 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
8466 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
8468 dnl ===================================================================
8469 dnl Graphite
8470 dnl ===================================================================
8472 AC_MSG_CHECKING([whether to enable graphite support])
8473 if test "$_os" = "WINNT" -o "$_os" = "Linux" && test "$enable_graphite" = "" -o "$enable_graphite" != "no"; then
8474     AC_MSG_RESULT([yes])
8475     ENABLE_GRAPHITE="TRUE"
8476     AC_DEFINE(ENABLE_GRAPHITE)
8477     libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
8478     if test "$with_system_graphite" = "yes"; then
8479         libo_MINGW_CHECK_DLL([libgraphite2])
8480     fi
8481 else
8482     AC_MSG_RESULT([no])
8484 AC_SUBST(ENABLE_GRAPHITE)
8486 dnl ===================================================================
8487 dnl HarfBuzz
8488 dnl ===================================================================
8489 AC_MSG_CHECKING([whether to enable HarfBuzz support])
8490 if test "$_os" != "WINNT" -a "$_os" != "Darwin" && test "$enable_harfbuzz" = "" -o "$enable_harfbuzz" != "no"; then
8491     AC_MSG_RESULT([yes])
8492     ENABLE_HARFBUZZ="TRUE"
8493     AC_DEFINE(ENABLE_HARFBUZZ)
8494     libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz >= 0.9.10])
8495 else
8496     AC_MSG_RESULT([no])
8498 AC_SUBST(ENABLE_HARFBUZZ)
8500 dnl ===================================================================
8501 dnl Check for NPAPI interface to plug browser plugins into LibreOffice documents
8502 dnl ===================================================================
8503 AC_MSG_CHECKING([whether to plug browser plugins into LibreOffice documents])
8504 # Obviously no such thing on iOS or Android. Also not possible when building 
8505 # 64-bit OS X code as the plugin code uses QuickTime and Carbon.
8506 if test "$_os" != Android -a "$_os" != iOS -a \( $_os != Darwin -o "$BITNESS_OVERRIDE" = "" \)
8507 then
8508     AC_MSG_RESULT([yes])
8509     ENABLE_NPAPI_FROM_BROWSER=YES
8510 else
8511     AC_MSG_RESULT([no])
8512     ENABLE_NPAPI_FROM_BROWSER=NO
8514 AC_SUBST(ENABLE_NPAPI_FROM_BROWSER)
8516 dnl ===================================================================
8517 dnl Check for NPAPI interface to plug LibreOffice into browser windows
8518 dnl ===================================================================
8519 AC_MSG_CHECKING([whether to plug LibreOffice into browser windows])
8520 if test "$_os" == WINNT -o "$_os" != Android -a "$_os" != Darwin -a "$_os" != iOS -a \
8521         "$enable_headless" != yes -a "$enable_gtk" != no
8522 then
8523     AC_MSG_RESULT([yes])
8524     ENABLE_NPAPI_INTO_BROWSER=YES
8525 else
8526     AC_MSG_RESULT([no])
8527     ENABLE_NPAPI_INTO_BROWSER=NO
8529 AC_SUBST(ENABLE_NPAPI_INTO_BROWSER)
8531 AC_MSG_CHECKING([whether to use X11])
8532 dnl ***************************************
8533 dnl testing for X libraries and includes...
8534 dnl ***************************************
8535 WANT_X11="no"
8536 if test $_os != Darwin -a $_os != WINNT -a $_os != Android -a $_os != iOS -a "$enable_headless" != "yes"; then
8537     WANT_X11="yes"
8539 AC_MSG_RESULT([$WANT_X11])
8541 if test "$WANT_X11" = "yes"; then
8542     AC_PATH_X
8543     AC_PATH_XTRA
8544     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
8546     if test -z "$x_includes"; then
8547         x_includes="default_x_includes"
8548     fi
8549     if test -z "$x_libraries"; then
8550         x_libraries="default_x_libraries"
8551     fi
8552     CFLAGS="$CFLAGS $X_CFLAGS"
8553     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
8554     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
8555 else
8556     x_includes="no_x_includes"
8557     x_libraries="no_x_libraries"
8560 if test "$WANT_X11" = "yes"; then
8561     dnl ===================================================================
8562     dnl Check for Composite.h for Mozilla plugin
8563     dnl ===================================================================
8564     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
8565      [#include <X11/Intrinsic.h>])
8567     dnl ===================================================================
8568     dnl Check for extension headers
8569     dnl ===================================================================
8570     AC_MSG_CHECKING([whether to use internal X11 extensions headers])
8571     if test "$with_system_xextensions_headers" != "no"; then
8572         AC_MSG_RESULT([no])
8573         AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
8574         [#include <X11/extensions/shape.h>])
8575     else
8576         AC_MSG_RESULT([yes])
8577         BUILD_TYPE="$BUILD_TYPE X11_EXTENSIONS"
8578     fi
8582 dnl ===================================================================
8583 dnl Check for system Xrender
8584 dnl ===================================================================
8585 AC_MSG_CHECKING([whether to use Xrender])
8586 if test "$WANT_X11" = "yes" -a  "$test_xrender" = "yes"; then
8587     AC_MSG_RESULT([yes])
8588     PKG_CHECK_MODULES(XRENDER, xrender)
8589     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
8590       [AC_MSG_ERROR(libXrender not found or functional)], [])
8591     AC_MSG_CHECKING([which Xrender headers to use])
8592     if test "$with_system_xextensions_headers" != "no"; then
8593         AC_MSG_RESULT([external])
8594         AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
8595           [AC_MSG_ERROR(Xrender not found. install X)], [])
8596     else
8597         AC_MSG_RESULT([internal])
8598     fi
8599 else
8600     AC_MSG_RESULT([no])
8602 AC_SUBST(XRENDER_CFLAGS)
8603 AC_SUBST(XRENDER_LIBS)
8605 dnl ===================================================================
8606 dnl Check for XRandr
8607 dnl ===================================================================
8608 AC_MSG_CHECKING([whether to enable RandR support])
8609 if test "$WANT_X11" = "yes" -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
8610     if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
8611         XRANDR_DLOPEN="TRUE"
8612         AC_MSG_RESULT([configured to dlopen libXrandr at runtime])
8613     else
8614         AC_MSG_RESULT([yes])
8615         XRANDR_DLOPEN="FALSE"
8616         PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
8617         if test "$ENABLE_RANDR" != "TRUE"; then
8618             AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
8619                         [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
8620             XRANDR_CFLAGS=" "
8621             AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
8622               [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
8623             XRANDR_LIBS="-lXrandr "
8624             ENABLE_RANDR="TRUE"
8625         fi
8626     fi
8627 else
8628     ENABLE_RANDR=""
8629     AC_MSG_RESULT([no])
8631 AC_SUBST(XRANDR_DLOPEN)
8632 AC_SUBST(XRANDR_CFLAGS)
8633 AC_SUBST(XRANDR_LIBS)
8634 AC_SUBST(ENABLE_RANDR)
8636 dnl ===================================================================
8637 dnl Check for building neon
8638 dnl ===================================================================
8639 AC_MSG_CHECKING([whether to use neon])
8640 if test "$enable_neon" = "no"; then
8641     AC_MSG_RESULT([no])
8642     DISABLE_NEON=TRUE
8643     AC_SUBST(DISABLE_NEON)
8644 else
8645     AC_MSG_RESULT([yes])
8646 dnl ===================================================================
8647 dnl Check for system neon
8648 dnl ===================================================================
8649 libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
8650 if test "$with_system_neon" = "yes"; then
8651     NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
8652     libo_MINGW_CHECK_DLL([libneon])
8653     libo_MINGW_TRY_DLL([libtasn1])
8654     libo_MINGW_TRY_DLL([libgnutls])
8655 else
8656     NEON_VERSION=0295
8658 AC_SUBST(NEON_VERSION)
8661 dnl ===================================================================
8662 dnl Check for disabling cve_tests
8663 dnl ===================================================================
8664 AC_MSG_CHECKING([whether to execute CVE tests])
8665 if test "$enable_cve_tests" = "no"; then
8666     AC_MSG_RESULT([no])
8667     DISABLE_CVE_TESTS=TRUE
8668     AC_SUBST(DISABLE_CVE_TESTS)
8669 else
8670     AC_MSG_RESULT([yes])
8673 dnl ===================================================================
8674 dnl Check for system openssl
8675 dnl ===================================================================
8676 DISABLE_OPENSSL="NO"
8677 AC_MSG_CHECKING([whether to disable OpenSSL usage])
8678 if test "$enable_openssl" = "yes"; then
8679     AC_MSG_RESULT([no])
8680     if test "$_os" = "Darwin" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o \
8681             "$_os" = "DragonFly" && test "$with_system_openssl" != "no"; then
8682         # Mac OS builds should get out without extra stuff is the Mac porters'
8683         # wish. And pkg-config is although Xcode ships a .pc for openssl
8684         with_system_openssl=yes
8685         SYSTEM_OPENSSL=YES
8686         OPENSSL_CFLAGS=
8687         OPENSSL_LIBS="-lssl -lcrypto"
8688     else
8689         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
8690     fi
8691     if test "$with_system_openssl" = "yes"; then
8692         libo_MINGW_CHECK_DLL([libssl])
8693         libo_MINGW_CHECK_DLL([libcrypto])
8694     fi
8695 else
8696     AC_MSG_RESULT([yes])
8697     DISABLE_OPENSSL=YES
8699     # warn that although OpenSSL is disabled, system libraries may be depending on it
8700     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
8701     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
8704 AC_SUBST([DISABLE_OPENSSL])
8706 dnl ===================================================================
8707 dnl Check for building gnutls
8708 dnl ===================================================================
8709 AC_MSG_CHECKING([whether to use gnutls])
8710 if test "$enable_neon" != "no" && test "$enable_openssl" = "no"; then
8711     AC_MSG_RESULT([yes])
8712     AM_PATH_LIBGCRYPT()
8713     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
8714         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
8715                       available in the system to use as replacement.]]))
8718 AC_SUBST([LIBGCRYPT_CFLAGS])
8719 AC_SUBST([LIBGCRYPT_LIBS])
8721 dnl ===================================================================
8722 dnl Check for system redland
8723 dnl ===================================================================
8724 dnl versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
8725 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8])
8726 if test "$with_system_redland" = "yes"; then
8727     # need at least 2.0.7 for CVE-2012-0037
8728     PKG_CHECK_MODULES([RAPTOR2],[raptor2 >= 2.0.7])
8729     libo_MINGW_CHECK_DLL([librdf])
8730     libo_MINGW_TRY_DLL([libraptor])
8731     libo_MINGW_TRY_DLL([librasqal])
8732     libo_MINGW_TRY_DLL([libsqlite3])
8733 else
8734     RAPTOR_MAJOR="0"
8735     RASQAL_MAJOR="3"
8736     REDLAND_MAJOR="0"
8738 AC_SUBST(RAPTOR_MAJOR)
8739 AC_SUBST(RASQAL_MAJOR)
8740 AC_SUBST(REDLAND_MAJOR)
8742 dnl ===================================================================
8743 dnl Check for system orcus
8744 dnl ===================================================================
8745 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.6 >= 0.5.0])
8746 if test "$with_system_orcus" != "yes"; then
8747     if test "$SYSTEM_BOOST" = "YES"; then
8748         # ===========================================================
8749         # Determine if we are going to need to link with Boost.System
8750         # ===========================================================
8751         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
8752         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
8753         dnl in documentation has no effect.
8754         AC_MSG_CHECKING([if we need to link with Boost.System])
8755         AC_LANG_PUSH([C++])
8756         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
8757                 @%:@include <boost/version.hpp>
8758             ]],[[
8759                 #if BOOST_VERSION >= 105000
8760                 #   error yes, we need to link with Boost.System
8761                 #endif
8762             ]])],[
8763                 AC_MSG_RESULT([no])
8764             ],[
8765                 AC_MSG_RESULT([yes])
8766                 AX_BOOST_SYSTEM
8767         ])
8768         AC_LANG_POP([C++])
8769     fi
8771 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
8772 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
8773 AC_SUBST([BOOST_SYSTEM_LIB])
8774 AC_SUBST(SYSTEM_LIBORCUS)
8776 dnl ===================================================================
8777 dnl Check for system hunspell
8778 dnl ===================================================================
8779 AC_MSG_CHECKING([which libhunspell to use])
8780 if test "$with_system_hunspell" = "yes"; then
8781     AC_MSG_RESULT([external])
8782     SYSTEM_HUNSPELL=YES
8783     AC_LANG_PUSH([C++])
8784     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
8785     if test "$HUNSPELL_PC" != "TRUE"; then
8786         AC_CHECK_HEADER(hunspell.hxx, [],
8787             [
8788             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
8789             [AC_MSG_ERROR(hunspell headers not found.)], [])
8790             ], [])
8791         AC_CHECK_LIB([hunspell], [main], [:],
8792            [ AC_MSG_ERROR(hunspell library not found.) ], [])
8793         HUNSPELL_LIBS=-lhunspell
8794     fi
8795     AC_LANG_POP([C++])
8796     libo_MINGW_CHECK_DLL([libhunspell-1.3])
8797     HUNSPELL_CFLAGS="`echo $HUNSPELL_CFLAGS | sed -e \"s/-I/${ISYSTEM}/g\"`"
8798 else
8799     AC_MSG_RESULT([internal])
8800     SYSTEM_HUNSPELL=NO
8801     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
8802     HUNSPELL_LIBS="-L${OUTDIR}/lib -lhunspell"
8803     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
8805 AC_SUBST(SYSTEM_HUNSPELL)
8806 AC_SUBST(HUNSPELL_CFLAGS)
8807 AC_SUBST(HUNSPELL_LIBS)
8809 dnl ===================================================================
8810 dnl Checking for altlinuxhyph
8811 dnl ===================================================================
8812 AC_MSG_CHECKING([which altlinuxhyph to use])
8813 if test "$with_system_altlinuxhyph" = "yes"; then
8814     AC_MSG_RESULT([external])
8815     SYSTEM_HYPH=YES
8816     AC_CHECK_HEADER(hyphen.h, [],
8817        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
8818     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
8819        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
8820        [#include <hyphen.h>])
8821     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
8822         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
8823     if test -z "$HYPHEN_LIB"; then
8824         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
8825            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
8826     fi
8827     if test -z "$HYPHEN_LIB"; then
8828         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
8829            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
8830     fi
8831     libo_MINGW_CHECK_DLL([libhyphen])
8832 else
8833     AC_MSG_RESULT([internal])
8834     SYSTEM_HYPH=NO
8835     BUILD_TYPE="$BUILD_TYPE HYPHEN"
8837 AC_SUBST(SYSTEM_HYPH)
8838 AC_SUBST(HYPHEN_LIB)
8840 dnl ===================================================================
8841 dnl Checking for mythes
8842 dnl ===================================================================
8843 AC_MSG_CHECKING([which mythes to use])
8844 if test "$with_system_mythes" = "yes"; then
8845     AC_MSG_RESULT([external])
8846     SYSTEM_MYTHES=YES
8847     AC_LANG_PUSH([C++])
8848     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
8849     if test "$MYTHES_PKGCONFIG" = "no"; then
8850         AC_CHECK_HEADER(mythes.hxx, [],
8851             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
8852         AC_CHECK_LIB([mythes-1.2], [main], [:],
8853             [ MYTHES_FOUND=no], [])
8854     if test "$MYTHES_FOUND" = "no"; then
8855         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
8856                 [ MYTHES_FOUND=no], [])
8857     fi
8858     if test "$MYTHES_FOUND" = "no"; then
8859         AC_MSG_ERROR([mythes library not found!.])
8860     fi
8861     fi
8862     AC_LANG_POP([C++])
8863     libo_MINGW_CHECK_DLL([libmythes-1.2])
8864 else
8865     AC_MSG_RESULT([internal])
8866     SYSTEM_MYTHES=NO
8867     BUILD_TYPE="$BUILD_TYPE MYTHES"
8869 AC_SUBST(SYSTEM_MYTHES)
8870 AC_SUBST(MYTHES_CFLAGS)
8871 AC_SUBST(MYTHES_LIBS)
8873 dnl ===================================================================
8874 dnl Checking for lpsolve
8875 dnl ===================================================================
8876 AC_MSG_CHECKING([which lpsolve to use])
8877 if test "$with_system_lpsolve" = "yes"; then
8878     AC_MSG_RESULT([external])
8879     SYSTEM_LPSOLVE=YES
8880     AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
8881        [ AC_MSG_ERROR(lpsolve headers not found.)], [])
8882     save_LIBS=$LIBS
8883     # some systems need this. Like Ubuntu....
8884     AC_CHECK_LIB(m, floor)
8885     AC_CHECK_LIB(dl, dlopen)
8886     AC_CHECK_LIB([lpsolve55], [make_lp], [:],
8887         [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
8888     LIBS=$save_LIBS
8889     libo_MINGW_CHECK_DLL([lpsolve55])
8890 else
8891     AC_MSG_RESULT([internal])
8892     SYSTEM_LPSOLVE=NO
8893     BUILD_TYPE="$BUILD_TYPE LPSOLVE"
8895 AC_SUBST(SYSTEM_LPSOLVE)
8899 dnl ===================================================================
8900 dnl Checking for libexttextcat
8901 dnl ===================================================================
8902 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.1.1])
8903 if test "$with_system_libexttextcat" = "yes"; then
8904     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
8906 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
8908 dnl ***************************************
8909 dnl testing libc version for Linux...
8910 dnl ***************************************
8911 if test "$_os" = "Linux"; then
8912     AC_MSG_CHECKING([whether libc is >= 2.1.1])
8913     exec 6>/dev/null # no output
8914     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
8915     exec 6>&1 # output on again
8916     if test "$HAVE_LIBC"; then
8917         AC_MSG_RESULT([yes])
8918     else
8919         AC_MSG_ERROR([no, upgrade libc])
8920     fi
8923 if test "$_os" != "WINNT"; then
8924     AC_CHECK_FUNCS(getopt, HAVE_GETOPT=YES, [HAVE_GETOPT=NO])
8925     AC_CHECK_FUNCS(readdir_r, HAVE_READDIR_R=YES, [HAVE_READDIR_R=NO])
8926     if test "$HAVE_GETOPT" = "YES" -a "$HAVE_READDIR_R" = "YES"; then
8927         SYSTEM_LIBC=YES
8928     fi
8929 else
8930     HAVE_GETOPT=NO
8931     HAVE_READDIR_R=NO
8932     SYSTEM_LIBC=YES
8935 if test "$HAVE_GETOPT" = NO -o "$HAVE_READDIR_R" = NO; then
8936     BUILD_TYPE="$BUILD_TYPE GLIBC"
8939 AC_SUBST(HAVE_GETOPT)
8940 AC_SUBST(HAVE_READDIR_R)
8941 AC_SUBST(SYSTEM_LIBC)
8943 dnl =========================================
8944 dnl Check for the Windows  SDK.
8945 dnl =========================================
8946 dnl FIXME: I don't know yet if the Windows SDK works with MinGW, keep it until I know better,
8947 dnl and add "-a \( "$WITH_MINGW" != "yes" \)" then
8948 if test "$_os" = "WINNT"; then
8949     AC_MSG_CHECKING([for Windows SDK])
8950     if test "$build_os" = "cygwin"; then
8951         find_winsdk
8952         WINDOWS_SDK_HOME=$winsdktest
8954         # normalize if found
8955         if test -n "$WINDOWS_SDK_HOME"; then
8956             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
8957             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
8958         fi
8959     fi
8961     if test -n "$WINDOWS_SDK_HOME"; then
8962         # Remove a possible trailing backslash
8963         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
8965         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
8966              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
8967              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
8968             have_windows_sdk_headers=yes
8969         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
8970              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
8971              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
8972             have_windows_sdk_headers=yes
8973         else
8974             have_windows_sdk_headers=no
8975         fi
8977         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
8978             have_windows_sdk_libs=yes
8979         elif test -f "$WINDOWS_SDK_HOME/lib/win8/um/$WINDOWS_SDK_ARCH/user32.lib"; then
8980             have_windows_sdk_libs=yes
8981         else
8982             have_windows_sdk_libs=no
8983         fi
8985         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
8986             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
8987 the  Windows SDK are installed.])
8988         fi
8990         if test ! -f "$WINDOWS_SDK_HOME/bin/msiinfo.exe" \
8991              -o ! -f "$WINDOWS_SDK_HOME/bin/msidb.exe" \
8992              -o ! -f "$WINDOWS_SDK_HOME/bin/uuidgen.exe" \
8993              -o ! -f "$WINDOWS_SDK_HOME/bin/msitran.exe"; then :
8994         elif test ! -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
8995              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
8996              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/uuidgen.exe" \
8997              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
8998         else
8999             AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
9000         fi
9001     fi
9003     if test -z "$WINDOWS_SDK_HOME"; then
9004         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
9005     elif echo $WINDOWS_SDK_HOME | grep "v6.0" >/dev/null 2>/dev/null; then
9006         WINDOWS_SDK_VERSION=60
9007         AC_MSG_RESULT([found Windows SDK 6.0 ($WINDOWS_SDK_HOME)])
9008     elif echo $WINDOWS_SDK_HOME | grep "v6.1" >/dev/null 2>/dev/null; then
9009         WINDOWS_SDK_VERSION=61
9010         AC_MSG_RESULT([found Windows SDK 6.1 ($WINDOWS_SDK_HOME)])
9011     elif echo $WINDOWS_SDK_HOME | grep "v7" >/dev/null 2>/dev/null; then
9012         WINDOWS_SDK_VERSION=70
9013         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
9014     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
9015         WINDOWS_SDK_VERSION=80
9016         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
9017     else
9018         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
9019     fi
9020     PathFormat "$WINDOWS_SDK_HOME"
9021     WINDOWS_SDK_HOME="$formatted_path"
9022     if test "$build_os" = "cygwin"; then
9023         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/include"
9024         if test -d "$WINDOWS_SDK_HOME/include/um"; then
9025             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
9026         fi
9027     fi
9029 AC_SUBST(WINDOWS_SDK_HOME)
9030 AC_SUBST(WINDOWS_SDK_VERSION)
9032 dnl =========================================
9033 dnl Check for uuidgen
9034 dnl =========================================
9035 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9036     if test "$WITH_MINGW" = "yes"; then
9037         AC_PATH_PROG([UUIDGEN], [uuid])
9038         if test -z "$UUIDGEN"; then
9039             AC_MSG_WARN([uuid is needed for dev-install])
9040         fi
9041     else
9042         # presence is already tested above in the WINDOWS_SDK_HOME check
9043         UUIDGEN=uuidgen.exe
9044         AC_SUBST(UUIDGEN)
9045     fi
9046 else
9047     AC_PATH_PROG([UUIDGEN], [uuidgen])
9048     if test -z "$UUIDGEN"; then
9049         AC_MSG_WARN([uuid is needed for dev-install])
9050     fi
9053 dnl =========================================
9054 dnl Check for the Microsoft DirectX SDK.
9055 dnl =========================================
9056 if test -n "$ENABLE_DIRECTX" -a "$_os" = "WINNT"; then
9057     AC_MSG_CHECKING([for DirectX SDK])
9058     if test "$build_os" = "cygwin"; then
9059         dnl A standard installation of the DirectX SDK sets $DXSDK_DIR
9060         if test -n "$DXSDK_DIR"; then
9061             DIRECTXSDK_HOME=`cygpath -d "$DXSDK_DIR"`
9062             DIRECTXSDK_HOME=`cygpath -u "$DIRECTXSDK_HOME"`
9063         fi
9064         # At this point $DIRECTXSDK_HOME might still be undefined. This will lead to
9065         # the "DirectX SDK not found" error later.
9066         # (Where?)
9068         # Remove a possible trailing backslash
9069         DIRECTXSDK_HOME=`echo $DIRECTXSDK_HOME | $SED 's/\/$//'`
9070     fi
9072     if test -f "$DIRECTXSDK_HOME/Include/ddraw.h" -o -f "$DIRECTXSDK_HOME/Include/d3d9.h"; then
9073         HAVE_DIRECTXSDK_H="yes"
9074     else
9075         HAVE_DIRECTXSDK_H="no"
9076     fi
9078     if test "$BITNESS_OVERRIDE" = 64; then
9079         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x64"
9080     else
9081         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x86"
9082     fi
9083     PathFormat "$DIRECTXSDK_LIB"
9084     DIRECTXSDK_LIB="$formatted_path"
9086     if test -f "$DIRECTXSDK_LIB/ddraw.lib" -o -f "$DIRECTXSDK_LIB/d3d9.lib"; then
9087         HAVE_DIRECTXSDK_LIB="yes"
9088     else
9089         HAVE_DIRECTXSDK_LIB="no"
9090     fi
9092     if test "$HAVE_DIRECTXSDK_H" = "yes" -a "$HAVE_DIRECTXSDK_LIB" = "yes"; then
9093         AC_MSG_RESULT([found])
9094     else
9095         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway])
9096     fi
9097     if test -n "$DIRECTXSDK_HOME"; then
9098         PathFormat "$DIRECTXSDK_HOME"
9099         DIRECTXSDK_HOME="$formatted_path"
9100         SOLARINC="$SOLARINC -I$DIRECTXSDK_HOME/include"
9101     fi
9103 AC_SUBST(DIRECTXSDK_HOME)
9104 AC_SUBST(DIRECTXSDK_LIB)
9106 dnl ***************************************
9107 dnl Checking for bison and flex
9108 dnl ***************************************
9109 AC_PATH_PROG(BISON, bison)
9110 ANCIENT_BISON="NO"
9111 if test -z "$BISON"; then
9112     AC_MSG_ERROR([no bison found in \$PATH, install it])
9113 else
9114     AC_MSG_CHECKING([the bison version])
9115     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9116     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9117     # Accept newer than 1.875 or older(equal) than 1.75
9118     if test "$_bison_longver" -ge 1875 -o "$_bison_longver" -le 1075; then
9119         if test "$_bison_version" = "1.875"; then
9120             AC_MSG_WARN([suspect ($BISON $_bison_version)])
9121             add_warning "Suspect ($BISON $_bison_version) suggest upgrade"
9122         else
9123             AC_MSG_RESULT([checked ($BISON $_bison_version)])
9124         fi
9125     else
9126         AC_MSG_ERROR([failed ($BISON $_bison_version need 1.875+ (or 1.75 and older))])
9127     fi
9128     if test "$_bison_longver" -lt 2000; then
9129         ANCIENT_BISON="YES"
9130     fi
9132 AC_SUBST(ANCIENT_BISON)
9134 AC_PATH_PROG(FLEX, flex)
9135 if test -z "$FLEX"; then
9136     AC_MSG_ERROR([no flex found in \$PATH, install it])
9138 AC_SUBST([FLEX])
9139 dnl ***************************************
9140 dnl Checking for patch
9141 dnl ***************************************
9142 AC_PATH_PROG(PATCH, patch)
9143 if test -z "$PATCH"; then
9144     AC_MSG_ERROR([\"patch\" not found in \$PATH, install it])
9147 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9148 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9149     if test -z "$with_gnu_patch"; then
9150         GNUPATCH=$PATCH
9151     else
9152         if test -x "$with_gnu_patch"; then
9153             GNUPATCH=$with_gnu_patch
9154         else
9155             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9156         fi
9157     fi
9159     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9160     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9161         AC_MSG_RESULT([yes])
9162     else
9163         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9164     fi
9165 else
9166     GNUPATCH=$PATCH
9169 dnl We also need to check for --with-gnu-cp
9171 if test -z "$with_gnu_cp"; then
9172     # check the place where the good stuff is hidden on Solaris...
9173     if test -x /usr/gnu/bin/cp; then
9174         GNUCP=/usr/gnu/bin/cp
9175     else
9176         AC_PATH_PROGS(GNUCP, gnucp cp)
9177     fi
9178     if test -z $GNUCP; then
9179         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9180     fi
9181 else
9182     if test -x "$with_gnu_cp"; then
9183         GNUCP=$with_gnu_cp
9184     else
9185         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9186     fi
9189 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9190 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9191     AC_MSG_RESULT([yes])
9192 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9193     AC_MSG_RESULT([yes])
9194 else
9195     case "$build_os" in
9196     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9197         x_GNUCP=[\#]
9198         GNUCP=''
9199         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9200         ;;
9201     *)
9202         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9203         ;;
9204     esac
9207 AC_SUBST(GNUPATCH)
9208 AC_SUBST(GNUCP)
9209 AC_SUBST(x_GNUCP)
9211 dnl ***************************************
9212 dnl testing assembler path
9213 dnl ***************************************
9214 ML_EXE=""
9215 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
9216     if test "$BITNESS_OVERRIDE" = ""; then
9217         assembler=ml.exe
9218         assembler_bin=bin
9219     else
9220         assembler=ml64.exe
9221         assembler_bin=bin/amd64
9222     fi
9224     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9225     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9226         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9227         AC_MSG_RESULT([found])
9228         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9229     else
9230         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9231     fi
9233     PathFormat "$ASM_HOME"
9234     ASM_HOME="$formatted_path"
9235 else
9236     ASM_HOME=""
9239 AC_SUBST(ML_EXE)
9241 dnl ===================================================================
9242 dnl We need zip and unzip
9243 dnl ===================================================================
9244 AC_PATH_PROG(ZIP, zip)
9245 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9246 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9247     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],,)
9250 AC_PATH_PROG(UNZIP, unzip)
9251 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9253 dnl ===================================================================
9254 dnl Zip must be a specific type for different build types.
9255 dnl ===================================================================
9256 if test $build_os = cygwin; then
9257     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9258         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9259     fi
9262 dnl ===================================================================
9263 dnl Test which vclplugs have to be built.
9264 dnl ===================================================================
9265 R=""
9266 GTK3_CFLAGS=""
9267 GTK3_LIBS=""
9268 ENABLE_GTK3=""
9269 if test "x$enable_gtk3" = "xyes"; then
9270     if test "$with_system_cairo" != yes; then
9271         AC_MSG_WARN([System cairo required for gtk3 support, please use --with-system-cairo])
9272         add_warning "System cairo required for gtk3 support, please use --with-system-cairo"
9273     fi
9274     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="")
9275     if test "x$ENABLE_GTK3" = "xTRUE"; then
9276         R="gtk3"
9277     else
9278         AC_MSG_ERROR([gtk3 libraries of the correct versions, not found])
9279     fi
9281 AC_SUBST(GTK3_LIBS)
9282 AC_SUBST(GTK3_CFLAGS)
9283 AC_SUBST(ENABLE_GTK3)
9285 AC_MSG_CHECKING([which VCLplugs shall be built])
9286 if test "$GUIBASE" != "unx" -o "$enable_headless" = "yes"; then
9287     enable_gtk=no
9289 ENABLE_GTK=""
9290 if test "x$enable_gtk" = "xyes"; then
9291     ENABLE_GTK="TRUE"
9292     AC_DEFINE(ENABLE_GTK)
9293     R="gtk $R"
9295 AC_SUBST(ENABLE_GTK)
9297 ENABLE_TDE=""
9298 if test "x$enable_tde" = "xyes"; then
9299     # Libs kab and tdeab in connectivity and kdeab and tdeab in shell
9300     # are built from the same sources. So we only allow one of them.
9301     if test "x$enable_kde" = "xyes"; then
9302         AC_MSG_ERROR([enabling both KDE and TDE is not supported])
9303     fi
9304     ENABLE_TDE="TRUE"
9305     AC_DEFINE(ENABLE_TDE)
9306     R="$R tde"
9308 AC_SUBST(ENABLE_TDE)
9310 ENABLE_KDE=""
9311 if test "x$enable_kde" = "xyes"; then
9312     ENABLE_KDE="TRUE"
9313     AC_DEFINE(ENABLE_KDE)
9314     R="$R kde"
9316 AC_SUBST(ENABLE_KDE)
9318 ENABLE_KDE4=""
9319 if test "x$enable_kde4" = "xyes"; then
9320     ENABLE_KDE4="TRUE"
9321     AC_DEFINE(ENABLE_KDE4)
9322     R="$R kde4"
9324 AC_SUBST(ENABLE_KDE4)
9326 ENABLE_HEADLESS=""
9327 if test "x$enable_headless" = "xyes"; then
9328     ENABLE_HEADLESS="TRUE"
9329     SCPDEFS="$SCPDEFS -DLIBO_HEADLESS"
9330     R="headless"
9332 AC_SUBST(ENABLE_HEADLESS)
9334 if test -z "$R"; then
9335     AC_MSG_RESULT([none])
9336 else
9337     AC_MSG_RESULT([$R])
9340 dnl ===================================================================
9341 dnl GCONF check
9342 dnl ===================================================================
9344 ENABLE_GCONF=""
9345 AC_MSG_CHECKING([whether to enable GConf support])
9346 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "iOS" -a "$enable_gconf" = "yes"; then
9347     ENABLE_GCONF="TRUE"
9348     AC_MSG_RESULT([yes])
9349     PKG_CHECK_MODULES( GCONF, gconf-2.0 gobject-2.0 )
9350 else
9351     AC_MSG_RESULT([no])
9353 AC_SUBST(GCONF_LIBS)
9354 AC_SUBST(GCONF_CFLAGS)
9355 AC_SUBST(ENABLE_GCONF)
9357 dnl ===================================================================
9358 dnl Gnome VFS check
9359 dnl ===================================================================
9361 ENABLE_GNOMEVFS=""
9362 AC_MSG_CHECKING([whether to enable GNOME VFS support])
9363 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes" -a "$enable_gconf" = "yes"; then
9364     ENABLE_GNOMEVFS="TRUE"
9365     AC_MSG_RESULT([yes])
9366     PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
9367 else
9368     AC_MSG_RESULT([no])
9370 AC_SUBST(GNOMEVFS_LIBS)
9371 AC_SUBST(GNOMEVFS_CFLAGS)
9372 AC_SUBST(ENABLE_GNOMEVFS)
9374 dnl ===================================================================
9375 dnl check for dbus support
9376 dnl ===================================================================
9377 ENABLE_DBUS=""
9378 DBUS_CFLAGS=""
9379 DBUS_LIBS=""
9381 if test "$enable_dbus" = "no"; then
9382     test_dbus=no
9385 AC_MSG_CHECKING([whether to enable DBUS support])
9386 if test "$test_dbus" = "yes"; then
9387     ENABLE_DBUS="TRUE"
9388     AC_MSG_RESULT([yes])
9389     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
9390 else
9391     AC_MSG_RESULT([no])
9394 AC_SUBST(ENABLE_DBUS)
9395 AC_SUBST(DBUS_CFLAGS)
9396 AC_SUBST(DBUS_LIBS)
9398 AC_MSG_CHECKING([whether to enable font install via packagekit])
9399 if test "$ENABLE_DBUS" = "TRUE"; then
9400     if test -n "$enable_packagekit" -a "$enable_packagekit" != "no"; then
9401         ENABLE_PACKAGEKIT=YES
9402         AC_MSG_RESULT([yes])
9403     else
9404         ENABLE_PACKAGEKIT=NO
9405         AC_MSG_RESULT([no])
9406     fi
9407 else
9408     AC_MSG_RESULT([no, dbus disabled.])
9410 AC_SUBST(ENABLE_PACKAGEKIT)
9412 AC_MSG_CHECKING([whether to enable Impress remote control])
9413 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
9414     AC_MSG_RESULT([yes])
9415     ENABLE_SDREMOTE=YES
9416     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
9418     # If not explicitly enabled or disabled, default
9419     if test -z "$enable_sdremote_bluetooth"; then
9420         case "$OS" in
9421         LINUX|MACOSX|WNT)
9422             # Default to yes for these
9423             enable_sdremote_bluetooth=yes
9424             ;;
9425         *)
9426             # otherwise no
9427             enable_sdremote_bluetooth=no
9428             ;;
9429         esac
9430     fi
9431     # $enable_sdremote_bluetooth is guaranteed non-empty now
9433     if test "$enable_sdremote_bluetooth" != "no"; then
9434         if test "$OS" = "LINUX"; then
9435             if test "$ENABLE_DBUS" = "TRUE"; then
9436                 AC_MSG_RESULT([yes])
9437                 ENABLE_SDREMOTE_BLUETOOTH=YES
9438                 dnl ===================================================================
9439                 dnl Check for system bluez
9440                 dnl ===================================================================
9441                 AC_MSG_CHECKING([which Bluetooth header to use])
9442                 if test "$with_system_bluez" = "yes"; then
9443                     AC_MSG_RESULT([external])
9444                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
9445                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
9446                 else
9447                     AC_MSG_RESULT([internal])
9448                     BUILD_TYPE="$BUILD_TYPE BLUEZ"
9449                 fi
9450             else
9451                 AC_MSG_RESULT([no, dbus disabled])
9452                 ENABLE_SDREMOTE_BLUETOOTH=NO
9453             fi
9454         else
9455             AC_MSG_RESULT([yes])
9456             ENABLE_SDREMOTE_BLUETOOTH=YES
9457         fi
9458     else
9459         AC_MSG_RESULT([no])
9460         ENABLE_SDREMOTE_BLUETOOTH=NO
9461     fi
9462 else
9463     ENABLE_SDREMOTE=NO
9464     AC_MSG_RESULT([no])
9466 AC_SUBST(ENABLE_SDREMOTE)
9467 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
9469 dnl ===================================================================
9470 dnl Check whether the gtk 2.0 libraries are available.
9471 dnl ===================================================================
9473 GTK_CFLAGS=""
9474 GTK_LIBS=""
9475 ENABLE_SYSTRAY_GTK=""
9476 if test  "$test_gtk" = "yes"; then
9478     if test "$ENABLE_GTK" = "TRUE"; then
9479         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]))
9480         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]))
9481         BUILD_TYPE="$BUILD_TYPE GTK"
9483     AC_MSG_CHECKING([whether to enable the systray quickstarter])
9484         if test "x$enable_systray" = "xyes"; then
9485         AC_MSG_RESULT([yes])
9486             PKG_CHECK_MODULES( GTK210, gtk+-2.0 >= 2.10.0,
9487                             [ ENABLE_SYSTRAY_GTK="TRUE" ],
9488                             [ ENABLE_SYSTRAY_GTK="" ])
9489         else
9490         AC_MSG_RESULT([no])
9491         fi
9493         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
9494         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
9495                           [ENABLE_GTK_PRINT="TRUE"],
9496                           [ENABLE_GTK_PRINT=""])
9498         AC_MSG_CHECKING([whether to enable GIO support])
9499         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
9500             if test "$ENABLE_GNOMEVFS" = "TRUE"; then
9501                 AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
9502             fi
9503             ENABLE_GIO="TRUE"
9504             AC_MSG_RESULT([yes])
9505             PKG_CHECK_MODULES( GIO, gio-2.0 )
9506         else
9507             AC_MSG_RESULT([no])
9508         fi
9509     fi
9511 AC_SUBST(ENABLE_GIO)
9512 AC_SUBST(GIO_CFLAGS)
9513 AC_SUBST(GIO_LIBS)
9514 AC_SUBST(ENABLE_SYSTRAY_GTK)
9515 AC_SUBST(GTK_CFLAGS)
9516 AC_SUBST(GTK_LIBS)
9517 AC_SUBST(GTHREAD_CFLAGS)
9518 AC_SUBST(GTHREAD_LIBS)
9519 AC_SUBST([ENABLE_GTK_PRINT])
9520 AC_SUBST([GTK_PRINT_CFLAGS])
9521 AC_SUBST([GTK_PRINT_LIBS])
9524 dnl ===================================================================
9525 dnl Check whether the Telepathy libraries are available.
9526 dnl ===================================================================
9528 ENABLE_TELEPATHY=""
9529 TELEPATHY_CFLAGS=""
9530 TELEPATHY_LIBS=""
9532 AC_MSG_CHECKING([whether to enable Telepathy support])
9533 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_telepathy" = "yes"; then
9534     ENABLE_TELEPATHY="TRUE"
9535     AC_DEFINE(ENABLE_TELEPATHY)
9536     AC_MSG_RESULT([yes])
9537     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 )
9538 else
9539     AC_MSG_RESULT([no])
9542 AC_SUBST(ENABLE_TELEPATHY)
9543 AC_SUBST(TELEPATHY_CFLAGS)
9544 AC_SUBST(TELEPATHY_LIBS)
9547 dnl ===================================================================
9549 PKG_CHECK_MODULES( LIBPNG, libpng, ENABLE_QUICKSTART_LIBPNG="TRUE", ENABLE_QUICKSTART_LIBPNG="" )
9550 AC_SUBST(LIBPNG_LIBS)
9551 AC_SUBST(LIBPNG_CFLAGS)
9553 AC_MSG_CHECKING([whether to enable libpng linking in quickstarter])
9554 if test "x$enable_unix_qstart_libpng" != "xno"; then
9555     AC_MSG_RESULT([yes])
9556 else
9557     AC_MSG_RESULT([no])
9558     ENABLE_QUICKSTART_LIBPNG=""
9560 AC_SUBST(ENABLE_QUICKSTART_LIBPNG)
9562 SPLIT_APP_MODULES=""
9563 if test "$enable_split_app_modules" = "yes"; then
9564     SPLIT_APP_MODULES="YES"
9566 AC_SUBST(SPLIT_APP_MODULES)
9568 SPLIT_OPT_FEATURES=""
9569 if test "$enable_split_opt_features" = "yes"; then
9570     SPLIT_OPT_FEATURES="YES"
9572 AC_SUBST(SPLIT_OPT_FEATURES)
9574 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
9575     if test "$enable_cairo_canvas" = yes; then
9576         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
9577     fi
9578     enable_cairo_canvas=no
9579 elif test -z "$enable_cairo_canvas"; then
9580     enable_cairo_canvas=yes
9583 ENABLE_CAIRO_CANVAS=""
9584 if test "$enable_cairo_canvas" = "yes"; then
9585     test_cairo=yes
9586     ENABLE_CAIRO_CANVAS="TRUE"
9588 AC_SUBST(ENABLE_CAIRO_CANVAS)
9590 dnl ===================================================================
9591 dnl Check whether the GStreamer libraries are available.
9592 dnl ===================================================================
9594 ENABLE_GSTREAMER=""
9596 if test "$build_gstreamer" = "yes"; then
9598     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
9599     if test "x$enable_gstreamer" != "xno"; then
9600         ENABLE_GSTREAMER="TRUE"
9601         AC_MSG_RESULT([yes])
9602         PKG_CHECK_MODULES( GSTREAMER, gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-video-1.0 )
9603     else
9604         AC_MSG_RESULT([no])
9605     fi
9607 AC_SUBST(GSTREAMER_CFLAGS)
9608 AC_SUBST(GSTREAMER_LIBS)
9609 AC_SUBST(ENABLE_GSTREAMER)
9612 ENABLE_GSTREAMER_0_10=""
9613 if test "$build_gstreamer_0_10" = "yes"; then
9615     AC_MSG_CHECKING([whether to enable the GStreamer avmedia backend])
9616     if test "x$enable_gstreamer_0_10" != "xno"; then
9617         ENABLE_GSTREAMER_0_10="TRUE"
9618         AC_MSG_RESULT([yes])
9619         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-interfaces-0.10],, [
9620             PKG_CHECK_MODULES(  [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10] )
9621         ])
9622     else
9623         AC_MSG_RESULT([no])
9624     fi
9627 AC_SUBST(GSTREAMER_0_10_CFLAGS)
9628 AC_SUBST(GSTREAMER_0_10_LIBS)
9629 AC_SUBST(ENABLE_GSTREAMER_0_10)
9631 dnl ===================================================================
9632 dnl Check whether the OpenGL libraries are available
9633 dnl ===================================================================
9635 AC_MSG_CHECKING([whether to build the OpenGL Transitions component])
9636 ENABLE_OPENGL=
9638 if test -z "$enable_opengl"; then
9639     if test $_os = WINNT; then
9640         # By default disable the OpenGL transitions for Windows (the code compiles but works very
9641         # badly and crashes). In other words, use --enable-opengl only if you plan to hack on that
9642         # code for Windows.
9643         enable_opengl=no
9644     elif test $_os = iOS; then
9645         # As such with some suitable minor tweaks the Mac OpenGL transitions code would presumably
9646         # build fine for iOS, too, but let's leave that for later
9647         enable_opengl=no
9648     else
9649         enable_opengl=yes
9650     fi
9653 if test "x$enable_opengl" = "xno"; then
9654     AC_MSG_RESULT([no])
9655 elif test "$_os" = "Darwin"; then
9656     # We use frameworks on Mac OS X, no need for detail checks
9657     ENABLE_OPENGL=TRUE
9658     SYSTEM_MESA_HEADERS=YES
9659     AC_MSG_RESULT([yes])
9660 elif test $_os = WINNT; then
9661     # Experimental: try to use OpenGL on Windows
9662     ENABLE_OPENGL=TRUE
9663     # We need the internal "Mesa" headers.
9664     SYSTEM_MESA_HEADERS=NO
9665     BUILD_TYPE="$BUILD_TYPE MESA"
9666     AC_MSG_RESULT([yes])
9667 else
9668     save_LDFLAGS=$LDFLAGS
9669     LDFLAGS="$LDFLAGS -lm"
9670     AC_MSG_RESULT([yes])
9671     AC_CHECK_LIB([GL], [main], [:],
9672               [AC_MSG_ERROR(libGL not installed or functional)], [])
9673     LDFLAGS="$LDFLAGS -lGL"
9674     AC_CHECK_LIB([GLU], [main], [:],
9675               [AC_MSG_ERROR(libGLU not installed or functional)], [])
9676     ENABLE_OPENGL=TRUE
9677     LDFLAGS=$save_LDFLAGS
9679     dnl ===================================================================
9680     dnl Check for system Mesa
9681     dnl ===================================================================
9682     AC_MSG_CHECKING([which Mesa headers to use])
9683     if test "$with_system_mesa_headers" = "yes"; then
9684         AC_MSG_RESULT([external])
9685         SYSTEM_MESA_HEADERS=YES
9686         AC_LANG_PUSH(C)
9687         AC_CHECK_HEADER(GL/glxext.h, [],
9688            [ AC_MSG_ERROR(mesa headers not found.)], [#include <GL/glx.h>])
9689         AC_MSG_CHECKING([whether GL/glxext.h defines PFNGLXBINDTEXIMAGEEXTPROC])
9690         AC_EGREP_HEADER(PFNGLXBINDTEXIMAGEEXTPROC, GL/glxext.h, [AC_MSG_RESULT([yes])], AC_MSG_ERROR(no))
9691         AC_LANG_POP(C)
9692     else
9693         AC_MSG_RESULT([internal])
9694         SYSTEM_MESA_HEADERS=NO
9695         BUILD_TYPE="$BUILD_TYPE MESA"
9696     fi
9699 AC_SUBST(SYSTEM_MESA_HEADERS)
9700 AC_SUBST(ENABLE_OPENGL)
9702 # presenter minimizer extension?
9703 AC_MSG_CHECKING([whether to build the Presentation Minimizer extension])
9704 if test "x$enable_ext_presenter_minimizer" != "xno" -a "x$enable_extension_integration" != "xno"; then
9705    AC_MSG_RESULT([yes])
9706    ENABLE_MINIMIZER=YES
9707 else
9708    AC_MSG_RESULT([no])
9709    ENABLE_MINIMIZER=NO
9710    SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MINIMIZER"
9712 AC_SUBST(ENABLE_MINIMIZER)
9714 # pdf import?
9715 AC_MSG_CHECKING([whether to build the PDF import])
9716 if test "$_os" != Android -a "$_os" != iOS -a "$ENABLE_PDFIMPORT" != FALSE; then
9717   AC_MSG_RESULT([yes])
9718   ENABLE_PDFIMPORT=TRUE
9720   dnl ===================================================================
9721   dnl Check for system poppler
9722   dnl ===================================================================
9723   AC_MSG_CHECKING([which pdf backend to use])
9724   if test "$with_system_poppler" = "yes"; then
9725       AC_MSG_RESULT([external])
9726       SYSTEM_POPPLER=YES
9727       PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
9728       AC_LANG_PUSH([C++])
9729       save_CXXFLAGS=$CXXFLAGS
9730       save_CPPFLAGS=$CPPFLAGS
9731       CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
9732       CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
9733       AC_CHECK_HEADER([cpp/poppler-version.h], [],
9734                    [AC_MSG_ERROR([cpp/poppler-version.h not found. Install poppler])], [])
9735       CXXFLAGS=$save_CXXFLAGS
9736       CPPFLAGS=$save_CPPFLAGS
9737       AC_LANG_POP([C++])
9738       libo_MINGW_CHECK_DLL([libpoppler])
9739   else
9740       AC_MSG_RESULT([internal])
9741       SYSTEM_POPPLER=NO
9742       BUILD_TYPE="$BUILD_TYPE XPDF"
9743   fi
9744 else
9745   AC_MSG_RESULT([no])
9746   ENABLE_PDFIMPORT=FALSE
9748 AC_SUBST(ENABLE_PDFIMPORT)
9749 AC_SUBST(SYSTEM_POPPLER)
9750 AC_SUBST(POPPLER_CFLAGS)
9751 AC_SUBST(POPPLER_LIBS)
9753 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
9754 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
9755   AC_MSG_RESULT([yes])
9756   ENABLE_MEDIAWIKI=YES
9757   BUILD_TYPE="$BUILD_TYPE XSLTML"
9758   if test  "x$with_java" = "xno"; then
9759     AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
9760   fi
9761 else
9762   AC_MSG_RESULT([no])
9763   ENABLE_MEDIAWIKI=NO
9764   SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
9766 AC_SUBST(ENABLE_MEDIAWIKI)
9768 if test "$ENABLE_MEDIAWIKI" = "YES"; then
9769     AC_MSG_CHECKING([which Servlet API Jar to use])
9770     if test "$with_system_servlet_api" = "yes"; then
9771         AC_MSG_RESULT([external])
9772         SYSTEM_SERVLETAPI=YES
9773         if test -z "$SERVLETAPI_JAR"; then
9774             for version in '' -3.3 -3.2 -3.1 -3.0 -2.5 -2.4; do
9775                 if test -r "/usr/share/java/servlet-api${version}.jar"; then
9776                     SERVLETAPI_JAR=/usr/share/java/servlet-api${version}.jar
9777                 fi
9778             done
9779         fi
9780         AC_CHECK_FILE($SERVLETAPI_JAR, [],
9781               [AC_MSG_ERROR(servlet-api.jar not found.)], [])
9782     else
9783         AC_MSG_RESULT([internal])
9784         SYSTEM_SERVLETAPI=NO
9785         BUILD_TYPE="$BUILD_TYPE TOMCAT"
9786     fi
9788 AC_SUBST(SYSTEM_SERVLETAPI)
9789 AC_SUBST(SERVLETAPI_JAR)
9791 AC_MSG_CHECKING([whether to build the Report Builder extension])
9792 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
9793     AC_MSG_RESULT([yes])
9794     ENABLE_REPORTBUILDER=TRUE
9795     AC_MSG_CHECKING([which jfreereport libs to use])
9796     if test "$with_system_jfreereport" = "yes"; then
9797         SYSTEM_JFREEREPORT=YES
9798         AC_MSG_RESULT([external])
9799         if test -z $SAC_JAR; then
9800             SAC_JAR=/usr/share/java/sac.jar
9801         fi
9802         AC_CHECK_FILE($SAC_JAR, [],
9803              [AC_MSG_ERROR(sac.jar not found.)], [])
9805         if test -z $LIBXML_JAR; then
9806             AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
9807                 [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
9808                 [
9809                     AC_CHECK_FILE(/usr/share/java/libxml.jar,
9810                        [ LIBXML_JAR=/usr/share/java/libxml.jar ],
9811                        [AC_MSG_ERROR(libxml.jar replacement not found.)]
9812                     )
9813                 ]
9814             )
9815         else
9816             AC_CHECK_FILE($LIBXML_JAR, [],
9817                  [AC_MSG_ERROR(libxml.jar not found.)], [])
9818         fi
9820         if test -z $FLUTE_JAR; then
9821             AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
9822                 [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
9823                 [
9824                     AC_CHECK_FILE(/usr/share/java/flute.jar,
9825                         [ FLUTE_JAR=/usr/share/java/flute.jar ],
9826                         [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
9827                     )
9828                 ]
9829             )
9830         else
9831             AC_CHECK_FILE($FLUTE_JAR, [],
9832                  [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
9833         fi
9835         if test -z $JFREEREPORT_JAR; then
9836             AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
9837                 [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
9838                 [
9839                     AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
9840                         [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
9841                         [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
9842                     )
9843                 ]
9844             )
9845         else
9846             AC_CHECK_FILE($JFREEREPORT_JAR, [],
9847                  [AC_MSG_ERROR(jfreereport.jar not found.)], [])
9848         fi
9850         if test -z $LIBLAYOUT_JAR; then
9851             AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
9852                 [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
9853                 [
9854                     AC_CHECK_FILE(/usr/share/java/liblayout.jar,
9855                         [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
9856                         [AC_MSG_ERROR(liblayout.jar replacement not found.)]
9857                     )
9858                 ]
9859             )
9860         else
9861             AC_CHECK_FILE($LIBLAYOUT_JAR, [],
9862                  [AC_MSG_ERROR(liblayout.jar not found.)], [])
9863         fi
9865         if test -z $LIBLOADER_JAR; then
9866             AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
9867                 [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
9868                 [
9869                     AC_CHECK_FILE(/usr/share/java/libloader.jar,
9870                        [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
9871                        [AC_MSG_ERROR(libloader.jar replacement not found.)]
9872                     )
9873                 ]
9874             )
9875         else
9876             AC_CHECK_FILE($LIBLOADER_JAR, [],
9877                 [AC_MSG_ERROR(libloader.jar not found.)], [])
9878         fi
9880         if test -z $LIBFORMULA_JAR; then
9881             AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
9882                  [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
9883                  [
9884                      AC_CHECK_FILE(/usr/share/java/libformula.jar,
9885                          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
9886                          [AC_MSG_ERROR(libformula.jar replacement not found.)]
9887                      )
9888                  ]
9889             )
9890         else
9891             AC_CHECK_FILE($LIBFORMULA_JAR, [],
9892                 [AC_MSG_ERROR(libformula.jar not found.)], [])
9893         fi
9895         if test -z $LIBREPOSITORY_JAR; then
9896             AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
9897                 [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
9898                 [
9899                     AC_CHECK_FILE(/usr/share/java/librepository.jar,
9900                         [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
9901                         [AC_MSG_ERROR(librepository.jar replacement not found.)]
9902                     )
9903                 ]
9904             )
9905         else
9906             AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
9907                 [AC_MSG_ERROR(librepository.jar not found.)], [])
9908         fi
9910         if test -z $LIBFONTS_JAR; then
9911             AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
9912                 [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
9913                 [
9914                     AC_CHECK_FILE(/usr/share/java/libfonts.jar,
9915                         [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
9916                         [AC_MSG_ERROR(libfonts.jar replacement not found.)]
9917                     )
9918                 ]
9919             )
9920         else
9921             AC_CHECK_FILE($LIBFONTS_JAR, [],
9922                 [AC_MSG_ERROR(libfonts.jar not found.)], [])
9923         fi
9925         if test -z $LIBSERIALIZER_JAR; then
9926             AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
9927                 [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
9928                 [
9929                     AC_CHECK_FILE(/usr/share/java/libserializer.jar,
9930                         [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
9931                         [AC_MSG_ERROR(libserializer.jar replacement not found.)]
9932                     )
9933                 ]
9934             )
9935         else
9936             AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
9937                 [AC_MSG_ERROR(libserializer.jar not found.)], [])
9938         fi
9940         if test -z $LIBBASE_JAR; then
9941             AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
9942                 [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
9943                 [
9944                     AC_CHECK_FILE(/usr/share/java/libbase.jar,
9945                         [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
9946                         [AC_MSG_ERROR(libbase.jar replacement not found.)]
9947                     )
9948                 ]
9949             )
9950         else
9951             AC_CHECK_FILE($LIBBASE_JAR, [],
9952                 [AC_MSG_ERROR(libbase.jar not found.)], [])
9953         fi
9955     else
9956         AC_MSG_RESULT([internal])
9957         SYSTEM_JFREEREPORT=NO
9958         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
9959     fi
9960 else
9961     AC_MSG_RESULT([no])
9962     ENABLE_REPORTBUILDER=FALSE
9963     SYSTEM_JFREEREPORT=NO
9965 AC_SUBST(ENABLE_REPORTBUILDER)
9966 AC_SUBST(SYSTEM_JFREEREPORT)
9967 AC_SUBST(SAC_JAR)
9968 AC_SUBST(LIBXML_JAR)
9969 AC_SUBST(FLUTE_JAR)
9970 AC_SUBST(JFREEREPORT_JAR)
9971 AC_SUBST(LIBBASE_JAR)
9972 AC_SUBST(LIBLAYOUT_JAR)
9973 AC_SUBST(LIBLOADER_JAR)
9974 AC_SUBST(LIBFORMULA_JAR)
9975 AC_SUBST(LIBREPOSITORY_JAR)
9976 AC_SUBST(LIBFONTS_JAR)
9977 AC_SUBST(LIBSERIALIZER_JAR)
9979 # this has to be here because both the Wiki Publisher and the SRB use
9980 # commons-logging
9981 if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "TRUE"; then
9982     AC_MSG_CHECKING([which Apache commons-* libs to use])
9983     if test "$with_system_apache_commons" = "yes"; then
9984         SYSTEM_APACHE_COMMONS=YES
9985         AC_MSG_RESULT([external])
9986         if test "$ENABLE_MEDIAWIKI" = "YES"; then
9987             if test -z $COMMONS_CODEC_JAR; then
9988                 AC_CHECK_FILE(/usr/share/java/commons-codec-1.6.jar,
9989                     [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec-1.6.jar ],
9990                     [
9991                         AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
9992                             [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
9993                             [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
9994                         )
9995                     ]
9996                 )
9997             else
9998                 AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
9999                     [AC_MSG_ERROR(commons-codec.jar not found.)], [])
10000             fi
10002             if test -z $COMMONS_LANG_JAR; then
10003                 AC_CHECK_FILE(/usr/share/java/commons-lang-2.4.jar,
10004                     [ COMMONS_LANG_JAR=/usr/share/java/commons-lang-2.4.jar ],
10005                     [
10006                         AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
10007                             [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
10008                             [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
10009                             )
10010                     ]
10011                 )
10012             else
10013                 AC_CHECK_FILE($COMMONS_LANG_JAR, [],
10014                     [AC_MSG_ERROR(commons-lang.jar not found.)], [])
10015             fi
10017             if test -z $COMMONS_HTTPCLIENT_JAR; then
10018                 AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
10019                     [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
10020                     [
10021                         AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
10022                             [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
10023                             [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
10024                         )
10025                     ]
10026                 )
10027             else
10028                 AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
10029                     [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
10030             fi
10031         fi
10032         if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "TRUE"; then
10033             if test -z $COMMONS_LOGGING_JAR; then
10034                 AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.1.jar,
10035                    [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.1.jar ],
10036                    [
10037                         AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
10038                             [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
10039                             [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
10040                         )
10041                     ]
10042                 )
10043             else
10044                 AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
10045                     [AC_MSG_ERROR(commons-logging.jar not found.)], [])
10046             fi
10047         fi
10048     else
10049         AC_MSG_RESULT([internal])
10050         SYSTEM_APACHE_COMMONS=NO
10051         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
10052     fi
10054 AC_SUBST(SYSTEM_APACHE_COMMONS)
10055 AC_SUBST(COMMONS_CODEC_JAR)
10056 AC_SUBST(COMMONS_LANG_JAR)
10057 AC_SUBST(COMMONS_HTTPCLIENT_JAR)
10058 AC_SUBST(COMMONS_LOGGING_JAR)
10060 # scripting provider for BeanShell?
10061 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10062 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10063    AC_MSG_RESULT([yes])
10064    ENABLE_SCRIPTING_BEANSHELL=YES
10066    dnl ===================================================================
10067    dnl Check for system beanshell
10068    dnl ===================================================================
10069    AC_MSG_CHECKING([which beanshell to use])
10070    if test "$with_system_beanshell" = "yes"; then
10071        AC_MSG_RESULT([external])
10072        SYSTEM_BSH=YES
10073        if test -z $BSH_JAR; then
10074            BSH_JAR=/usr/share/java/bsh.jar
10075        fi
10076        AC_CHECK_FILE($BSH_JAR, [],
10077                   [AC_MSG_ERROR(bsh.jar not found.)], [])
10078    else
10079        AC_MSG_RESULT([internal])
10080        SYSTEM_BSH=NO
10081        BUILD_TYPE="$BUILD_TYPE BSH"
10082    fi
10083 else
10084    AC_MSG_RESULT([no])
10085    ENABLE_SCRIPTING_BEANSHELL=NO
10086    SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10088 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10089 AC_SUBST(SYSTEM_BSH)
10090 AC_SUBST(BSH_JAR)
10092 # scripting provider for JavaScript?
10093 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10094 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10095    AC_MSG_RESULT([yes])
10096    ENABLE_SCRIPTING_JAVASCRIPT=YES
10098    dnl ===================================================================
10099    dnl Check for system rhino
10100    dnl ===================================================================
10101    AC_MSG_CHECKING([which rhino to use])
10102    if test "$with_system_rhino" = "yes"; then
10103        AC_MSG_RESULT([external])
10104        SYSTEM_RHINO=YES
10105        if test -z $RHINO_JAR; then
10106            RHINO_JAR=/usr/share/java/js.jar
10107        fi
10108        AC_CHECK_FILE($RHINO_JAR, [],
10109                   [AC_MSG_ERROR(js.jar not found.)], [])
10110    else
10111        AC_MSG_RESULT([internal])
10112        SYSTEM_RHINO=NO
10113        BUILD_TYPE="$BUILD_TYPE RHINO"
10114    fi
10115 else
10116    AC_MSG_RESULT([no])
10117    ENABLE_SCRIPTING_JAVASCRIPT=NO
10118    SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10120 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10121 AC_SUBST(SYSTEM_RHINO)
10122 AC_SUBST(RHINO_JAR)
10124 supports_multilib=
10125 case "$host_cpu" in
10126 x86_64 | powerpc64 | s390x)
10127     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10128         supports_multilib="yes"
10129     fi
10130     ;;
10132     ;;
10133 esac
10135 dnl ===================================================================
10136 dnl Check whether the TQt and TDE libraries are available.
10137 dnl ===================================================================
10139 TDE_CFLAGS=""
10140 TDE_LIBS=""
10141 if test "$_os" != "OpenBSD"; then
10142     MOC="moc"
10144 if test "$test_tde" = "yes" -a "$ENABLE_TDE" = "TRUE"; then
10145     dnl Search paths for TQt and TDE
10146     if test -z "$supports_multilib"; then
10147         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"
10148         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"
10149     else
10150         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"
10151         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"
10152     fi
10153     if test -n "$TQTDIR"; then
10154         tqt_incdirs="$TQTDIR/include $tqt_incdirs"
10155         if test -z "$supports_multilib"; then
10156             tqt_libdirs="$TQTDIR/lib $tqt_libdirs"
10157         else
10158             tqt_libdirs="$TQTDIR/lib64 $TQTDIR/lib $tqt_libdirs"
10159         fi
10160     fi
10161     if test -z "$supports_multilib"; then
10162         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"
10163         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"
10164     else
10165         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"
10166         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"
10167     fi
10168     if test -n "$TDEDIR"; then
10169         tde_incdirs="$TDEDIR/include $tde_incdirs"
10170         if test -z "$supports_multilib"; then
10171             tde_libdirs="$TDEDIR/lib $tde_libdirs"
10172         else
10173             tde_libdirs="$TDEDIR/lib64 $TDEDIR/lib $tde_libdirs"
10174         fi
10175     fi
10177     dnl What to test
10178     tqt_test_include="ntqstyle.h"
10179     tde_test_include="kapp.h"
10181     if test "$_os" != "OpenBSD"; then
10182         tqt_test_library="libtqt-mt.so"
10183         tde_test_library="libDCOP.so"
10184     else
10185         tqt_test_library="libtqt-mt.so*"
10186         tde_test_library="libDCOP.so*"
10187     fi
10189     dnl Check for TQt headers
10190     AC_MSG_CHECKING([for TQt headers])
10191     tqt_incdir="no"
10192     for tde_check in $tqt_incdirs; do
10193         if test -r "$tde_check/$tqt_test_include"; then
10194             tqt_incdir="$tde_check"
10195             break
10196         fi
10197     done
10198     AC_MSG_RESULT([$tqt_incdir])
10199     if test "x$tqt_incdir" = "xno"; then
10200         AC_MSG_ERROR([TQt headers not found.  Please specify the root of
10201 your TQt installation by exporting TQTDIR before running "configure".])
10202     fi
10204     dnl Check for TQt libraries
10205     AC_MSG_CHECKING([for TQt libraries])
10206     tqt_libdir="no"
10207     for tqt_check in $tqt_libdirs; do
10208         if test -r "`ls $tqt_check/$tqt_test_library 2>/dev/null | head -1`"; then
10209             tqt_libdir="$tqt_check"
10210             break
10211         fi
10212     done
10213     AC_MSG_RESULT([$tqt_libdir])
10214     if test "x$tqt_libdir" = "xno"; then
10215         AC_MSG_ERROR([TQt libraries not found.  Please specify the root of
10216 your TQt installation by exporting TQTDIR before running "configure".])
10217     fi
10219     dnl Check for Meta Object Compiler
10220     AC_PATH_PROG( MOC, moc, no, [`dirname $tqt_libdir`/bin:$TQTDIR/bin:$PATH] )
10221     if test "$MOC" = "no"; then
10222         AC_MSG_ERROR([TQt Meta Object Compiler not found.  Please specify
10223 the root of your TQt installation by exporting TQTDIR before running "configure".])
10224     fi
10226     dnl Check for TDE headers
10227     AC_MSG_CHECKING([for TDE headers])
10228     tde_incdir="no"
10229     for tde_check in $tde_incdirs; do
10230         if test -r "$tde_check/$tde_test_include"; then
10231             tde_incdir="$tde_check"
10232             break
10233         fi
10234     done
10235     AC_MSG_RESULT([$tde_incdir])
10236     if test "x$tde_incdir" = "xno"; then
10237         AC_MSG_ERROR([TDE headers not found.  Please specify the root of
10238 your TDE installation by exporting TDEDIR before running "configure".])
10239     fi
10241     dnl Check for TDE libraries
10242     AC_MSG_CHECKING([for TDE libraries])
10243     tde_libdir="no"
10244     for tde_check in $tde_libdirs; do
10245         if test -r "`ls $tde_check/$tde_test_library 2>/dev/null | head -1`"; then
10246             tde_libdir="$tde_check"
10247             break
10248         fi
10249     done
10250     AC_MSG_RESULT([$tde_libdir])
10251     if test "x$tde_libdir" = "xno"; then
10252         AC_MSG_ERROR([TDE libraries not found.  Please specify the root of
10253 your TDE installation by exporting TDEDIR before running "configure".])
10254     fi
10256     dnl Set the variables
10257     TDE_CFLAGS="-I$tqt_incdir -I$tde_incdir -I/usr/include/tqt -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10258     TDE_LIBS="-L$tde_libdir -L$tqt_libdir -ltdeio -ltdeui -ltdecore -ltqt -ltqt-mt"
10260 AC_SUBST(TDE_CFLAGS)
10261 AC_SUBST(TDE_LIBS)
10262 AC_SUBST(MOC)
10264 dnl ===================================================================
10265 dnl Check whether the Qt3 and KDE3 libraries are available.
10266 dnl ===================================================================
10268 KDE_CFLAGS=""
10269 KDE_LIBS=""
10270 if test "$_os" != "OpenBSD"; then
10271     MOC="moc"
10273 if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE"; then
10274     dnl Search paths for Qt3 and KDE3
10275     if test -z "$supports_multilib"; then
10276         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"
10277         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"
10278     else
10279         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"
10280         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"
10281     fi
10282     if test -n "$QTDIR"; then
10283         qt_incdirs="$QTDIR/include $qt_incdirs"
10284         if test -z "$supports_multilib"; then
10285             qt_libdirs="$QTDIR/lib $qt_libdirs"
10286         else
10287             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
10288         fi
10289     fi
10290     if test -z "$supports_multilib"; then
10291         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"
10292         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"
10293     else
10294         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"
10295         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"
10296     fi
10297     if test -n "$KDEDIR"; then
10298         kde_incdirs="$KDEDIR/include $kde_incdirs"
10299         if test -z "$supports_multilib"; then
10300             kde_libdirs="$KDEDIR/lib $kde_libdirs"
10301         else
10302             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
10303         fi
10304     fi
10306     dnl What to test
10307     qt_test_include="qstyle.h"
10308     kde_test_include="kapp.h"
10310     if test "$_os" != "OpenBSD"; then
10311         qt_test_library="libqt-mt.so"
10312         kde_test_library="libDCOP.so"
10313     else
10314         qt_test_library="libqt-mt.so*"
10315         kde_test_library="libDCOP.so*"
10316     fi
10318     dnl Check for Qt3 headers
10319     AC_MSG_CHECKING([for Qt3 headers])
10320     qt_incdir="no"
10321     for kde_check in $qt_incdirs; do
10322         if test -r "$kde_check/$qt_test_include"; then
10323             qt_incdir="$kde_check"
10324             break
10325         fi
10326     done
10327     AC_MSG_RESULT([$qt_incdir])
10328     if test "x$qt_incdir" = "xno"; then
10329         AC_MSG_ERROR([Qt3 headers not found.  Please specify the root of
10330 your Qt3 installation by exporting QTDIR before running "configure".])
10331     fi
10333     dnl Check for Qt3 libraries
10334     AC_MSG_CHECKING([for Qt3 libraries])
10335     qt_libdir="no"
10336     for qt_check in $qt_libdirs; do
10337         if test -r "`ls $qt_check/$qt_test_library 2>/dev/null | head -1`"; then
10338             qt_libdir="$qt_check"
10339             break
10340         fi
10341     done
10342     AC_MSG_RESULT([$qt_libdir])
10343     if test "x$qt_libdir" = "xno"; then
10344         AC_MSG_ERROR([Qt3 libraries not found.  Please specify the root of
10345 your Qt3 installation by exporting QTDIR before running "configure".])
10346     fi
10348     dnl Check for Meta Object Compiler
10349     AC_PATH_PROG( MOC, moc, no, [`dirname $qt_libdir`/bin:$QTDIR/bin:$PATH] )
10350     if test "$MOC" = "no"; then
10351         AC_MSG_ERROR([Qt3 Meta Object Compiler not found.  Please specify
10352 the root of your Qt3 installation by exporting QTDIR before running "configure".])
10353     fi
10355     dnl Check for KDE3 headers
10356     AC_MSG_CHECKING([for KDE3 headers])
10357     kde_incdir="no"
10358     for kde_check in $kde_incdirs; do
10359         if test -r "$kde_check/$kde_test_include"; then
10360             kde_incdir="$kde_check"
10361             break
10362         fi
10363     done
10364     AC_MSG_RESULT([$kde_incdir])
10365     if test "x$kde_incdir" = "xno"; then
10366         AC_MSG_ERROR([KDE3 headers not found.  Please specify the root of
10367 your KDE3 installation by exporting KDEDIR before running "configure".])
10368     fi
10370     dnl Check for KDE3 libraries
10371     AC_MSG_CHECKING([for KDE3 libraries])
10372     kde_libdir="no"
10373     for kde_check in $kde_libdirs; do
10374         if test -r "`ls $kde_check/$kde_test_library 2>/dev/null | head -1`"; then
10375             kde_libdir="$kde_check"
10376             break
10377         fi
10378     done
10379     AC_MSG_RESULT([$kde_libdir])
10380     if test "x$kde_libdir" = "xno"; then
10381         AC_MSG_ERROR([KDE3 libraries not found.  Please specify the root of
10382 your KDE3 installation by exporting KDEDIR before running "configure".])
10383     fi
10385     dnl Set the variables
10386     KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10387     KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
10389 AC_SUBST(KDE_CFLAGS)
10390 AC_SUBST(KDE_LIBS)
10391 AC_SUBST(MOC)
10393 dnl ===================================================================
10394 dnl KDE4 Integration
10395 dnl ===================================================================
10397 KDE4_CFLAGS=""
10398 KDE4_LIBS=""
10399 QMAKE4="qmake"
10400 MOC4="moc"
10401 KDE_GLIB_CFLAGS=""
10402 KDE_GLIB_LIBS=""
10403 KDE_HAVE_GLIB=""
10404 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
10405     qt_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
10406     qt_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
10408     kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
10409     kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
10411     if test -n "$supports_multilib"; then
10412         qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
10413         kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
10414     fi
10416     if test -n "$QTDIR"; then
10417         qt_incdirs="$QTDIR/include $qt_incdirs"
10418         if test -z "$supports_multilib"; then
10419             qt_libdirs="$QTDIR/lib $qt_libdirs"
10420         else
10421             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
10422         fi
10423     fi
10424     if test -n "$QT4DIR"; then
10425         qt_incdirs="$QT4DIR/include $qt_incdirs"
10426         if test -z "$supports_multilib"; then
10427             qt_libdirs="$QT4DIR/lib $qt_libdirs"
10428         else
10429             qt_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt_libdirs"
10430         fi
10431     fi
10433     if test -n "$KDEDIR"; then
10434         kde_incdirs="$KDEDIR/include $kde_incdirs"
10435         if test -z "$supports_multilib"; then
10436             kde_libdirs="$KDEDIR/lib $kde_libdirs"
10437         else
10438             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
10439         fi
10440     fi
10441     if test -n "$KDE4DIR"; then
10442         kde_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde_incdirs"
10443         if test -z "$supports_multilib"; then
10444             kde_libdirs="$KDE4DIR/lib $kde_libdirs"
10445         else
10446             kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
10447         fi
10448     fi
10450     qt_test_include="Qt/qobject.h"
10451     qt_test_library="libQtCore.so"
10452     kde_test_include="kwindowsystem.h"
10453     kde_test_library="libsolid.so"
10455     AC_MSG_CHECKING([for Qt4 headers])
10456     qt_header_dir="no"
10457     for inc_dir in $qt_incdirs; do
10458         if test -r "$inc_dir/$qt_test_include"; then
10459             qt_header_dir="$inc_dir"
10460             break
10461         fi
10462     done
10464     AC_MSG_RESULT([$qt_header_dir])
10465     if test "x$qt_header_dir" = "xno"; then
10466         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10467     fi
10469     dnl Check for qmake
10470     AC_PATH_PROG( QMAKEQT4, qmake-qt4, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
10471     QMAKE4="$QMAKEQT4"
10472     if test "$QMAKE4" = "no"; then
10473         AC_PATH_PROG( QMAKE4, qmake, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
10474         if test "$QMAKE4" = "no"; then
10475             AC_MSG_ERROR([Qmake not found.  Please specify
10476 the root of your Qt installation by exporting QT4DIR before running "configure".])
10477         fi
10478     fi
10480     qt_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt_libdirs"
10481     AC_MSG_CHECKING([for Qt4 libraries])
10482     qt_lib_dir="no"
10483     for lib_dir in $qt_libdirs; do
10484         if test -r "$lib_dir/$qt_test_library"; then
10485             qt_lib_dir="$lib_dir"
10486             PKG_CONFIG_PATH="$qt_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
10487             break
10488         fi
10489     done
10491     AC_MSG_RESULT([$qt_lib_dir])
10493     if test "x$qt_lib_dir" = "xno"; then
10494         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10495     fi
10497     dnl Check for Meta Object Compiler
10499     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10500     MOC4="$MOCQT4"
10501     if test "$MOC4" = "no"; then
10502         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10503         if test "$MOC4" = "no"; then
10504             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10505 the root of your Qt installation by exporting QT4DIR before running "configure".])
10506         fi
10507     fi
10509     dnl Check for KDE4 headers
10510     AC_MSG_CHECKING([for KDE4 headers])
10511     kde_incdir="no"
10512     for kde_check in $kde_incdirs; do
10513         if test -r "$kde_check/$kde_test_include"; then
10514             kde_incdir="$kde_check"
10515             break
10516         fi
10517     done
10518     AC_MSG_RESULT([$kde_incdir])
10519     if test "x$kde_incdir" = "xno"; then
10520         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10521     fi
10523     dnl Check for KDE4 libraries
10524     AC_MSG_CHECKING([for KDE4 libraries])
10525     kde_libdir="no"
10526     for kde_check in $kde_libdirs; do
10527         if test -r "$kde_check/$kde_test_library"; then
10528             kde_libdir="$kde_check"
10529             break
10530         fi
10531     done
10533     AC_MSG_RESULT([$kde_libdir])
10534     if test "x$kde_libdir" = "xno"; then
10535         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10536     fi
10538     KDE4_CFLAGS="`pkg-config --cflags QtCore` `pkg-config --cflags QtGui` -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10539     KDE4_LIBS="-L$kde_libdir -L$qt_lib_dir -lkio -lkfile -lkdeui -lkdecore -lQtCore -lQtGui"
10541     AC_LANG_PUSH([C++])
10542     save_CXXFLAGS=$CXXFLAGS
10543     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10544     AC_MSG_CHECKING([whether KDE is >= 4.2])
10545        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10546 #include <kdeversion.h>
10548 int main(int argc, char **argv) {
10549        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
10550        else return 1;
10552        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
10553     CXXFLAGS=$save_CXXFLAGS
10554     AC_LANG_POP([C++])
10556     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
10557     # Sets also KDE_GLIB_CFLAGS/KDE_GLIB_LIBS if successful.
10558     PKG_CHECK_MODULES(KDE_GLIB,[glib-2.0 >= 2.4],
10559         [
10560         KDE_HAVE_GLIB=1
10561         AC_DEFINE(KDE_HAVE_GLIB,1)
10562         ],
10563         AC_MSG_WARN([[No Glib found, KDE4 support will not integrate with Qt's Glib event loop support]]))
10565 AC_SUBST(KDE4_CFLAGS)
10566 AC_SUBST(KDE4_LIBS)
10567 AC_SUBST(MOC4)
10568 AC_SUBST(KDE_GLIB_CFLAGS)
10569 AC_SUBST(KDE_GLIB_LIBS)
10570 AC_SUBST(KDE_HAVE_GLIB)
10572 dnl ===================================================================
10573 dnl Test for the enabling the lockdown pieces
10574 dnl ===================================================================
10575 AC_MSG_CHECKING([whether to enable the lockdown pieces])
10576 ENABLE_LOCKDOWN=""
10577 if test -n "$enable_lockdown" -a "$enable_lockdown" != "no"; then
10578     ENABLE_LOCKDOWN=YES
10579     AC_MSG_RESULT([yes])
10580 else
10581     AC_MSG_RESULT([no])
10583 AC_SUBST(ENABLE_LOCKDOWN)
10585 dnl ===================================================================
10586 dnl Test whether to include Evolution 2 support
10587 dnl ===================================================================
10588 AC_MSG_CHECKING([whether to enable evolution 2 support])
10589 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
10590     AC_MSG_RESULT([yes])
10591     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
10592     ENABLE_EVOAB2="TRUE"
10593 else
10594     ENABLE_EVOAB2=""
10595     AC_MSG_RESULT([no])
10597 AC_SUBST(ENABLE_EVOAB2)
10598 AC_SUBST(GOBJECT_CFLAGS)
10599 AC_SUBST(GOBJECT_LIBS)
10601 dnl ===================================================================
10602 dnl Test whether to include TDE AB support
10603 dnl ===================================================================
10604 AC_MSG_CHECKING([whether to enable TDE address book support])
10605 if test "$enable_tdeab" = "yes" -a "$enable_tde" = "yes"; then
10606     AC_MSG_RESULT([yes])
10607     AC_LANG_PUSH([C++])
10608     save_CXXFLAGS=$CXXFLAGS
10609     CXXFLAGS="$CXXFLAGS $TDE_CFLAGS"
10610     AC_MSG_CHECKING([whether TDE is at least R14.0])
10611        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10612 #include <tdeversion.h>
10614 int main(int argc, char **argv) {
10615        if (TDE_VERSION_MAJOR >= 14) return 0;
10616        else return 1;
10618        ]])],[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])],[])
10619     CXXFLAGS=$save_CXXFLAGS
10620     AC_LANG_POP([C++])
10621     ENABLE_TDEAB=TRUE
10622 else
10623     AC_MSG_RESULT([no])
10624     ENABLE_TDEAB=
10626 AC_SUBST(ENABLE_TDEAB)
10628 dnl ===================================================================
10629 dnl Test whether to include KDE AB support
10630 dnl ===================================================================
10631 AC_MSG_CHECKING([whether to enable KDE address book support])
10632 if test "$enable_kdeab" = "yes" -a "$enable_kde" = "yes"; then
10633     AC_MSG_RESULT([yes])
10634     AC_LANG_PUSH([C++])
10635     save_CXXFLAGS=$CXXFLAGS
10636     CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
10637     AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
10638        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10639 #include <kdeversion.h>
10641 int main(int argc, char **argv) {
10642        if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
10643        else return 1;
10645        ]])],[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])],[])
10646     CXXFLAGS=$save_CXXFLAGS
10647     AC_LANG_POP([C++])
10648     ENABLE_KAB=TRUE
10649 else
10650     AC_MSG_RESULT([no])
10651     ENABLE_KAB=
10653 AC_SUBST(ENABLE_KAB)
10655 dnl ===================================================================
10656 dnl Test whether to include MathMLDTD
10657 dnl ===================================================================
10658 AC_MSG_CHECKING([whether to include MathMLDTD])
10659 if test -n "$enable_mathmldtd"; then
10660     if test "$enable_mathmldtd" = "no"; then
10661         AC_MSG_RESULT([no])
10662         SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
10663     else
10664         AC_MSG_RESULT([yes])
10665         BUILD_TYPE="$BUILD_TYPE MATHMLDTD"
10666     fi
10667 else
10668     AC_MSG_RESULT([no])
10669     SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
10672 dnl ===================================================================
10673 dnl Test which themes to include
10674 dnl ===================================================================
10675 AC_MSG_CHECKING([which themes to include])
10676 # if none given use default subset of available themes
10677 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
10678     with_theme="crystal default hicontrast oxygen tango"
10679     test "$ENABLE_RELEASE_BUILD" = "FALSE" && with_theme="$with_theme tango_testing"
10682 WITH_THEMES=""
10683 if test "x$with_theme" != "xno"; then
10684     for theme in $with_theme; do
10685         case $theme in
10686             crystal|default|galaxy|hicontrast|human|industrial|oxygen|tango|tango_testing) : ;;
10687             *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
10688         esac
10689         WITH_THEMES="$WITH_THEMES $theme"
10690         SCPDEFS="$SCPDEFS -DTHEME_`echo $theme|tr '[[:lower:]]' '[[:upper:]]'`"
10691     done
10693 AC_MSG_RESULT([$WITH_THEMES])
10694 AC_SUBST([WITH_THEMES])
10696 dnl ===================================================================
10697 dnl Test whether to integrate helppacks into the product's installer
10698 dnl ===================================================================
10699 AC_MSG_CHECKING([for helppack integration])
10700 if test "$with_helppack_integration" = "no"; then
10701     WITH_HELPPACK_INTEGRATION=NO
10702     AC_MSG_RESULT([no integration])
10703 else
10704     WITH_HELPPACK_INTEGRATION=YES
10705     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
10706     AC_MSG_RESULT([integration])
10708 AC_SUBST(WITH_HELPPACK_INTEGRATION)
10710 dnl ===================================================================
10711 dnl Test whether to use CoreText framework
10712 dnl ===================================================================
10713 ENABLE_CORETEXT=NO
10714 if test "$_os" = "Darwin"; then
10715     AC_MSG_CHECKING([whether to use CoreText framework])
10716     if test "$enable_coretext" = yes -o "$BITNESS_OVERRIDE" = 64; then
10717         AC_MSG_RESULT([yes])
10718         ENABLE_CORETEXT=YES
10719     else
10720         AC_MSG_RESULT([no])
10721     fi
10723 AC_SUBST(ENABLE_CORETEXT)
10725 ###############################################################################
10726 # Extensions checking
10727 ###############################################################################
10728 AC_MSG_CHECKING([for extensions integration])
10729 if test "x$enable_extension_integration" != "xno"; then
10730     WITH_EXTENSION_INTEGRATION=YES
10731     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
10732     AC_MSG_RESULT([yes, use integration])
10733 else
10734     WITH_EXTENSION_INTEGRATION=NO
10735     AC_MSG_RESULT([no, do not integrate])
10737 AC_SUBST(WITH_EXTENSION_INTEGRATION)
10739 dnl Should any extra extensions be included?
10740 dnl There are standalone tests for each of these below.
10741 WITH_EXTRA_EXTENSIONS=
10742 AC_SUBST([WITH_EXTRA_EXTENSIONS])
10744 libo_CHECK_EXTENSION([Watch Window],[WATCH_WINDOW],[watch_window],[watch-window],[23bd75552206dfcd8fd4e29137dcac84-WatchWindow_1.2.0.0.oxt])
10745 libo_CHECK_EXTENSION([SmART Gallery (Diagram)],[DIAGRAM],[diagram],[diagram],[8d74685d41f8bffe8c3e71fe8deac09d-SmART_0.9.5.oxt])
10746 libo_CHECK_EXTENSION([Validator],[VALIDATOR],[validator],[validator],[bbdd5639ada63e3130761daaecae1a10-Validator_1.1.0.0.oxt])
10747 libo_CHECK_EXTENSION([Barcode],[BARCODE],[barcode],[barcode],[3ed18025a766f1e955707b969c8113a5-Barcode_1.3.5.0.oxt])
10748 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
10749 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
10750 libo_CHECK_EXTENSION([Hungarian Cross-reference Toolbar],[HUNART],[hunart],[hunart],[b632bdd25649cc4067bcb410bae23d2b-hunart_0.3.oxt])
10751 libo_CHECK_EXTENSION([Typography Toolbar],[TYPO],[typo],[typo],[9d60b6cfa3ef1926848710bbcd11115b-typo_0.4.2.oxt])
10752 libo_CHECK_EXTENSION([Google Docs],[GOOGLE_DOCS],[google_docs],[google-docs],[27211596cf0ad97cab7321239406fde0-gdocs_3.0.1_modified.oxt])
10753 if test "x$with_java" != "xno"; then
10754     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
10755     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
10758 dnl ===================================================================
10759 dnl Test whether to include Sun Professional Template Pack
10760 dnl ===================================================================
10761 AC_MSG_CHECKING([for Sun Professional Template Pack integration (only supported languages displayed)])
10762 if test "$with_sun_templates" = "" -o "$with_sun_templates" = "no"; then
10763     AC_MSG_RESULT([no integration])
10764 else
10765     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_SUN_TEMPLATE_PACK"
10766     sun_supported_langs="en-US de it fr es hu"
10767     if test "$with_sun_templates" = "yes"; then
10768         wanted_sun_templates="$sun_supported_langs"
10769     else
10770         # check whether the langs are supported by Sun
10771         wanted_sun_templates=
10772         for lang in $with_sun_templates; do
10773             if test -n "`echo $sun_supported_langs | grep "$lang"`"; then
10774                 wanted_sun_templates="$wanted_sun_templates $lang"
10775             fi
10776         done
10777     fi
10778     SUNTEMPLATES_LANG=
10779     SUNTEMPLATES_DE_PACK=
10780     SUNTEMPLATES_EN_US_PACK=
10781     SUNTEMPLATES_ES_PACK=
10782     SUNTEMPLATES_FR_PACK=
10783     SUNTEMPLATES_HU_PACK=
10784     SUNTEMPLATES_IT_PACK=
10785     # check whether the langs are requested at all
10786     for lang in $wanted_sun_templates; do
10787     if test "$with_lang" = "ALL" -o -n "`echo $with_lang | grep "$lang"`"; then
10788         SUNTEMPLATES_LANG="$SUNTEMPLATES_LANG $lang"
10789         case $lang in
10790         "de") SUNTEMPLATES_DE_PACK="53ca5e56ccd4cab3693ad32c6bd13343-Sun-ODF-Template-Pack-de_1.0.0.oxt";;
10791         "en-US") SUNTEMPLATES_EN_US_PACK="472ffb92d82cf502be039203c606643d-Sun-ODF-Template-Pack-en-US_1.0.0.oxt";;
10792         "es") SUNTEMPLATES_ES_PACK="4ad003e7bbda5715f5f38fde1f707af2-Sun-ODF-Template-Pack-es_1.0.0.oxt";;
10793         "fr") SUNTEMPLATES_FR_PACK="a53080dc876edcddb26eb4c3c7537469-Sun-ODF-Template-Pack-fr_1.0.0.oxt";;
10794         "hu") SUNTEMPLATES_HU_PACK="09ec2dac030e1dcd5ef7fa1692691dc0-Sun-ODF-Template-Pack-hu_1.0.0.oxt";;
10795         "it") SUNTEMPLATES_IT_PACK="b33775feda3bcf823cad7ac361fd49a6-Sun-ODF-Template-Pack-it_1.0.0.oxt";;
10796         esac
10797     fi
10798     done
10799     WITH_EXTRA_EXTENSIONS=YES
10800     AC_MSG_RESULT([$SUNTEMPLATES_LANG])
10802 AC_SUBST(SUNTEMPLATES_DE_PACK)
10803 AC_SUBST(SUNTEMPLATES_EN_US_PACK)
10804 AC_SUBST(SUNTEMPLATES_ES_PACK)
10805 AC_SUBST(SUNTEMPLATES_FR_PACK)
10806 AC_SUBST(SUNTEMPLATES_HU_PACK)
10807 AC_SUBST(SUNTEMPLATES_IT_PACK)
10809 dnl ===================================================================
10810 dnl Test whether to include fonts
10811 dnl ===================================================================
10812 AC_MSG_CHECKING([whether to include third-party fonts])
10813 if test "$with_fonts" != "no"; then
10814     AC_MSG_RESULT([yes])
10815     WITH_FONTS=YES
10816     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
10817 else
10818     AC_MSG_RESULT([no])
10819     WITH_FONTS=NO
10820     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
10822 AC_SUBST(WITH_FONTS)
10824 dnl ===================================================================
10825 dnl Test whether to include ppds
10826 dnl ===================================================================
10827 AC_MSG_CHECKING([whether to include PPDs])
10828 if test "$with_ppds" != "no"; then
10829     AC_MSG_RESULT([yes])
10830 else
10831     AC_MSG_RESULT([no])
10832     WITHOUT_PPDS=YES
10833     SCPDEFS="$SCPDEFS -DWITHOUT_PPDS"
10835 AC_SUBST(WITHOUT_PPDS)
10837 dnl ===================================================================
10838 dnl Test whether to include afms
10839 dnl ===================================================================
10840 AC_MSG_CHECKING([whether to include AFMs])
10841 if test "$with_afms" != "no"; then
10842     AC_MSG_RESULT([yes])
10843     BUILD_TYPE="$BUILD_TYPE AFMS"
10844 else
10845     AC_MSG_RESULT([no])
10846     WITHOUT_AFMS=YES
10847     SCPDEFS="$SCPDEFS -DWITHOUT_AFMS"
10849 AC_SUBST(WITHOUT_AFMS)
10851 dnl ===================================================================
10852 dnl Test whether to include extra galleries
10853 dnl ===================================================================
10854 AC_MSG_CHECKING([whether to include extra galleries])
10855 if test "$enable_extra_gallery" = "" -o "$enable_extra_gallery" = "no"; then
10856     AC_MSG_RESULT([no])
10857     WITH_EXTRA_GALLERY=NO
10858     OOOP_GALLERY_PACK=""
10859 else
10860     AC_MSG_RESULT([yes])
10861     WITH_EXTRA_GALLERY=YES
10862     BUILD_TYPE="$BUILD_TYPE EXTRA_GALLERY"
10863     SCPDEFS="$SCPDEFS -DWITH_EXTRA_GALLERY"
10864     OOOP_GALLERY_PACK="af9314c5972d95a5d6da23ffad818f68-OOOP-gallery-pack-2.8.0.0.zip"
10866 AC_SUBST(WITH_EXTRA_GALLERY)
10867 AC_SUBST(OOOP_GALLERY_PACK)
10869 dnl ===================================================================
10870 dnl Test whether to include extra templates
10871 dnl ===================================================================
10872 AC_MSG_CHECKING([whether to include extra templates])
10873 if test "$enable_extra_template" = "" -o "$enable_extra_template" = "no"; then
10874     AC_MSG_RESULT([no])
10875     WITH_EXTRA_TEMPLATE=NO
10876     OOOP_TEMPLATES_PACK=""
10877 else
10878     AC_MSG_RESULT([yes])
10879     WITH_EXTRA_TEMPLATE=YES
10880     BUILD_TYPE="$BUILD_TYPE EXTRA_TEMPLATE"
10881     SCPDEFS="$SCPDEFS -DWITH_EXTRA_TEMPLATE"
10882     OOOP_TEMPLATES_PACK="1be202fbbbc13f10592a98f70a4a87fb-OOOP-templates-pack-2.9.0.0.zip"
10884 AC_SUBST(WITH_EXTRA_TEMPLATE)
10885 AC_SUBST(OOOP_TEMPLATES_PACK)
10887 dnl ===================================================================
10888 dnl Test whether to include extra samples
10889 dnl ===================================================================
10890 AC_MSG_CHECKING([whether to include extra samples])
10891 if test "$enable_extra_sample" = "" -o "$enable_extra_sample" = "no"; then
10892     AC_MSG_RESULT([no])
10893     WITH_EXTRA_SAMPLE=NO
10894     OOOP_SAMPLES_PACK=""
10895 else
10896     AC_MSG_RESULT([yes])
10897     WITH_EXTRA_SAMPLE=YES
10898     BUILD_TYPE="$BUILD_TYPE EXTRA_SAMPLE"
10899     SCPDEFS="$SCPDEFS -DWITH_EXTRA_SAMPLE"
10900     OOOP_SAMPLES_PACK="a6bccacf44914969e6e7b2f8faf4132c-OOOP-samples-pack-2.7.0.0.zip"
10902 AC_SUBST(WITH_EXTRA_SAMPLE)
10903 AC_SUBST(OOOP_SAMPLES_PACK)
10905 dnl ===================================================================
10906 dnl Test whether to include extra fonts
10907 dnl ===================================================================
10908 AC_MSG_CHECKING([whether to include extra fonts])
10909 if test "$enable_extra_font" = "" -o "$enable_extra_font" = "no"; then
10910     AC_MSG_RESULT([no])
10911     WITH_EXTRA_FONT=NO
10912     OOOP_FONTS_PACK=""
10913 else
10914     AC_MSG_RESULT([yes])
10915     WITH_EXTRA_FONT=YES
10916     BUILD_TYPE="$BUILD_TYPE EXTRA_FONT"
10917     SCPDEFS="$SCPDEFS -DWITH_EXTRA_FONT"
10918     OOOP_FONTS_PACK="a10aa597411643326e27d7fc128af12d-OOOP-fonts-pack-2.9.0.0.zip"
10920 AC_SUBST(WITH_EXTRA_FONT)
10921 AC_SUBST(OOOP_FONTS_PACK)
10923 dnl ===================================================================
10924 dnl Test whether to enable online update service
10925 dnl ===================================================================
10926 AC_MSG_CHECKING([whether to enable online update])
10927 ENABLE_ONLINE_UPDATE=
10928 if test "$enable_online_update" = ""; then
10929     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
10930         AC_MSG_RESULT([yes])
10931         ENABLE_ONLINE_UPDATE="TRUE"
10932     else
10933         AC_MSG_RESULT([no])
10934     fi
10935 else
10936     if test "$enable_online_update" = "yes"; then
10937         AC_MSG_RESULT([yes])
10938         ENABLE_ONLINE_UPDATE="TRUE"
10939     else
10940         AC_MSG_RESULT([no])
10941     fi
10943 AC_SUBST(ENABLE_ONLINE_UPDATE)
10945 dnl ===================================================================
10946 dnl Test whether to create MSI with LIMITUI=1 (silent install)
10947 dnl ===================================================================
10948 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
10949 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
10950     AC_MSG_RESULT([no])
10951     ENABLE_SILENT_MSI="FALSE"
10952 else
10953     AC_MSG_RESULT([yes])
10954     ENABLE_SILENT_MSI="TRUE"
10955     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
10957 AC_SUBST(ENABLE_SILENT_MSI)
10959 AC_MSG_CHECKING([whether and how to use Xinerama])
10960 if test "$_os" = "Darwin"; then
10961     USE_XINERAMA=YES
10962     XINERAMA_LINK=dynamic
10963     AC_MSG_RESULT([yes])
10964 elif test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
10965     if test "$x_libraries" = "default_x_libraries"; then
10966         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
10967         if test "x$XINERAMALIB" = x; then
10968            XINERAMALIB="/usr/lib"
10969         fi
10970     else
10971         XINERAMALIB="$x_libraries"
10972     fi
10973     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
10974         # we have both versions, let the user decide but use the dynamic one
10975         # per default
10976         USE_XINERAMA=YES
10977         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
10978             XINERAMA_LINK=dynamic
10979         else
10980             XINERAMA_LINK=static
10981         fi
10982     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
10983         # we have only the dynamic version
10984         USE_XINERAMA=YES
10985         XINERAMA_LINK=dynamic
10986     elif test -e "$XINERAMALIB/libXinerama.a"; then
10987         # static version
10988         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
10989             USE_XINERAMA=YES
10990             XINERAMA_LINK=static
10991         else
10992             USE_XINERAMA=NO
10993             XINERAMA_LINK=none
10994         fi
10995     else
10996         # no Xinerama
10997         USE_XINERAMA=NO
10998         XINERAMA_LINK=none
10999     fi
11000     if test "$USE_XINERAMA" = "YES"; then
11001         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11002         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11003             [AC_MSG_ERROR(Xinerama header not found.)], [])
11004         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11005         if test "x$XEXTLIB" = x; then
11006            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11007         fi
11008         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11009         if test "$_os" = "FreeBSD"; then
11010             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11011         fi
11012         if test "$_os" = "Linux"; then
11013             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11014         fi
11015         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11016             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11017     else
11018         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11019     fi
11020 else
11021     USE_XINERAMA=NO
11022     XINERAMA_LINK=none
11023     AC_MSG_RESULT([no])
11025 AC_SUBST(USE_XINERAMA)
11026 AC_SUBST(XINERAMA_LINK)
11028 dnl ===================================================================
11029 dnl Test whether to build cairo or rely on the system version
11030 dnl ===================================================================
11032 if test "$GUIBASE" = "unx"; then
11033     # Used in vcl/Library_vclplug_gen.mk
11034     test_cairo=yes
11037 if test "$test_cairo" = "yes"; then
11038     AC_MSG_CHECKING([whether to use the system cairo])
11040     if test "$with_system_cairo" = "yes"; then
11041         SYSTEM_CAIRO=YES
11042         AC_MSG_RESULT([yes])
11044         PKG_CHECK_MODULES( CAIRO, cairo >= 1.0.2 )
11046         if test "$test_xrender" = "yes"; then
11047             if test "$with_system_xextensions_headers" != "no"; then
11048                 AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11049                 AC_LANG_PUSH([C])
11050                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11051 #ifdef PictStandardA8
11052 #else
11053       return fail;
11054 #endif
11055 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11057                 AC_LANG_POP([C])
11058             fi
11059         fi
11060         libo_MINGW_CHECK_DLL([libcairo])
11061         libo_MINGW_TRY_DLL([libfontconfig])
11062         libo_MINGW_TRY_DLL([libfreetype])
11063         libo_MINGW_TRY_DLL([libpixman])
11064         libo_MINGW_TRY_DLL([libpng15])
11065     else
11066         SYSTEM_CAIRO=NO
11067         AC_MSG_RESULT([no])
11069         BUILD_TYPE="$BUILD_TYPE CAIRO"
11070         SCPDEFS="$SCPDEFS -DNEED_CAIRO"
11071     fi
11074 AC_SUBST(SYSTEM_CAIRO)
11075 AC_SUBST(CAIRO_CFLAGS)
11076 AC_SUBST(CAIRO_LIBS)
11078 dnl ===================================================================
11079 dnl Test whether to use liblangtag
11080 dnl ===================================================================
11081 ENABLE_LIBLANGTAG=
11082 SYSTEM_LIBLANGTAG=
11083 AC_MSG_CHECKING([whether to use liblangtag])
11084 if test "$enable_liblangtag" = "yes" -o \( "$enable_liblangtag" = "" -a $_os != Android -a $_os != iOS \); then
11085     ENABLE_LIBLANGTAG=YES
11086     AC_MSG_RESULT([yes])
11087     AC_MSG_CHECKING([whether to use system liblangtag])
11088     if test "$with_system_liblangtag" = yes; then
11089         SYSTEM_LIBLANGTAG=YES
11090         AC_MSG_RESULT([yes])
11091         PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11092         libo_MINGW_CHECK_DLL([liblangtag])
11093     else
11094         SYSTEM_LIBLANGTAG=NO
11095         AC_MSG_RESULT([no])
11096         BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11097     fi
11098 else
11099     ENABLE_LIBLANGTAG=NO
11100     AC_MSG_RESULT([no])
11102 AC_SUBST(ENABLE_LIBLANGTAG)
11103 AC_SUBST(SYSTEM_LIBLANGTAG)
11104 AC_SUBST(LIBLANGTAG_CFLAGS)
11105 AC_SUBST(LIBLANGTAG_LIBS)
11107 dnl ===================================================================
11108 dnl Test whether to build libpng or rely on the system version
11109 dnl ===================================================================
11111 AC_MSG_CHECKING([whether to use the system libpng])
11113 dnl How should and does this interact with the checks for libpng
11114 dnl related to use of libpng in the quickstarter above? This needs to
11115 dnl be unified.
11117 if test "$with_system_libpng" = "auto"; then
11118     case "$_os" in
11119     WINNT|Darwin|iOS|Android)
11120         with_system_libpng="$with_system_libs"
11121         ;;
11122     *)
11123         with_system_libpng=yes
11124         ;;
11125     esac
11128 if test "$with_system_libpng" = yes; then
11129     SYSTEM_LIBPNG=YES
11130     AC_MSG_RESULT([yes])
11131 else
11132     SYSTEM_LIBPNG=NO
11133     BUILD_TYPE="$BUILD_TYPE LIBPNG"
11134     AC_MSG_RESULT([no])
11136 AC_SUBST(SYSTEM_LIBPNG)
11138 dnl ===================================================================
11139 dnl Check for runtime JVM search path
11140 dnl ===================================================================
11141 if test "$SOLAR_JAVA" != ""; then
11142     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11143     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11144         AC_MSG_RESULT([yes])
11145         if ! test -d "$with_jvm_path"; then
11146             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11147         fi
11148         if ! test -d "$with_jvm_path"jvm; then
11149             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11150         fi
11151         JVM_ONE_PATH_CHECK="$with_jvm_path"
11152         AC_SUBST(JVM_ONE_PATH_CHECK)
11153     else
11154         AC_MSG_RESULT([no])
11155     fi
11158 dnl ===================================================================
11159 dnl Test for the presence of Ant and that it works
11160 dnl ===================================================================
11162 if test "$SOLAR_JAVA" != ""; then
11163     ANT_HOME=; export ANT_HOME
11164     WITH_ANT_HOME=; export WITH_ANT_HOME
11165     if test -z "$with_ant_home"; then
11166         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11167     else
11168         if test "$_os" = "WINNT"; then
11169             with_ant_home=`cygpath -u "$with_ant_home"`
11170         fi
11171         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11172         WITH_ANT_HOME=$with_ant_home
11173         ANT_HOME=$with_ant_home
11174     fi
11176     if test -z "$ANT"; then
11177         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11178     else
11179         # resolve relative or absolute symlink
11180         while test -h "$ANT"; do
11181             a_cwd=`pwd`
11182             a_basename=`basename "$ANT"`
11183             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11184             cd "`dirname "$ANT"`"
11185             cd "`dirname "$a_script"`"
11186             ANT="`pwd`"/"`basename "$a_script"`"
11187             cd "$a_cwd"
11188         done
11190         AC_MSG_CHECKING([if $ANT works])
11191         cat > conftest.java << EOF
11192         public class conftest {
11193             int testmethod(int a, int b) {
11194                     return a + b;
11195             }
11196         }
11199         cat > conftest.xml << EOF
11200         <project name="conftest" default="conftest">
11201         <target name="conftest">
11202             <javac srcdir="." includes="conftest.java">
11203             </javac>
11204         </target>
11205         </project>
11208         oldJAVA_HOME=$JAVA_HOME
11209         if test "$JAVACISGCJ" = "yes"; then
11210             JAVA_HOME=; export JAVA_HOME
11211             ant_gcj="-Dbuild.compiler=gcj"
11212         fi
11213         AC_TRY_COMMAND("$ANT" $ant_gcj -buildfile conftest.xml 1>&2)
11214         if test $? = 0 -a -f ./conftest.class; then
11215             AC_MSG_RESULT([Ant works])
11216             if test -z "$WITH_ANT_HOME"; then
11217                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11218                 if test -z "$ANT_HOME"; then
11219                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11220                 fi
11221             else
11222                 ANT_HOME="$WITH_ANT_HOME"
11223             fi
11224         else
11225             echo "configure: Ant test failed" >&5
11226             cat conftest.java >&5
11227             cat conftest.xml >&5
11228             AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
11229             ANT_HOME=""
11230             add_warning "Ant does not work - Some Java projects will not build!"
11231         fi
11232         JAVA_HOME=$oldJAVA_HOME
11233         rm -f conftest* core core.* *.core
11234     fi
11235     if test -z "$ANT_HOME"; then
11236         ANT_HOME="NO_ANT_HOME"
11237     else
11238         PathFormat "$ANT_HOME"
11239         ANT_HOME="$formatted_path"
11240         PathFormat "$ANT"
11241         ANT="$ANT"
11242     fi
11243     AC_SUBST(ANT_HOME)
11244     AC_SUBST(ANT)
11246     dnl Checking for ant.jar
11247     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11248         AC_MSG_CHECKING([Ant lib directory])
11249         if test -f $ANT_HOME/lib/ant.jar; then
11250             ANT_LIB="$ANT_HOME/lib"
11251         else
11252             if test -f $ANT_HOME/ant.jar; then
11253                 ANT_LIB="$ANT_HOME"
11254             else
11255                 if test -f /usr/share/java/ant.jar; then
11256                     ANT_LIB=/usr/share/java
11257                 else
11258                     if test -f /usr/share/ant-core/lib/ant.jar; then
11259                         ANT_LIB=/usr/share/ant-core/lib
11260                     else
11261                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11262                             ANT_LIB="$ANT_HOME/lib/ant"
11263                         else
11264                             if test -f /usr/share/lib/ant/ant.jar; then
11265                                 ANT_LIB=/usr/share/lib/ant
11266                             else
11267                                 AC_MSG_ERROR([Ant libraries not found!])
11268                             fi
11269                         fi
11270                     fi
11271                 fi
11272             fi
11273         fi
11274         PathFormat "$ANT_LIB"
11275         ANT_LIB="$formatted_path"
11276         AC_MSG_RESULT([Ant lib directory found.])
11277     fi
11278     AC_SUBST(ANT_LIB)
11280     ant_minver=1.6.0
11281     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11283     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11284     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11285     ant_version_major=`echo $ant_version | cut -d. -f1`
11286     ant_version_minor=`echo $ant_version | cut -d. -f2`
11287     echo "configure: ant_version $ant_version " >&5
11288     echo "configure: ant_version_major $ant_version_major " >&5
11289     echo "configure: ant_version_minor $ant_version_minor " >&5
11290     if test "$ant_version_major" -ge "2"; then
11291         AC_MSG_RESULT([yes, $ant_version])
11292     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11293         AC_MSG_RESULT([yes, $ant_version])
11294     else
11295         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11296     fi
11298     if test "$ENABLE_MEDIAWIKI" = "YES"; then
11299         AC_MSG_CHECKING([whether Ant supports mapper type="regexp"])
11300         rm -rf confdir
11301         mkdir confdir
11302         cat > conftest.java << EOF
11303             public class conftest {
11304                 int testmethod(int a, int b) {
11305                     return a + b;
11306                 }
11307             }
11310         cat > conftest.xml << EOF
11311             <project name="conftest" default="conftest">
11312             <target name="conftest" depends="copytest">
11313                 <javac srcdir="." includes="conftest.java">
11314                 </javac>
11315             </target>
11316             <target name="copytest">
11317                  <copy todir="confdir">
11318                  <fileset dir="confdir" includes="**/*.abc" casesensitive="yes"/>
11319                  <filterset/>
11320                  <mapper type="regexp" from="^(.*[/\\])foo([/\\].*)" to="\1baa\2"/>
11321                  </copy>
11322             </target>
11323             </project>
11326         if test "$JAVACISGCJ" = "yes"; then
11327             JAVA_HOME=; export JAVA_HOME
11328             ant_gcj="-Dbuild.compiler=gcj"
11329         fi
11330         AC_TRY_COMMAND("$ANT" $ant_gcj -buildfile conftest.xml 1>&2)
11331         if test $? = 0 -a -f ./conftest.class; then
11332             AC_MSG_RESULT([yes])
11333             rm -rf confdir
11334         else
11335             echo "configure: Ant test failed" >&5
11336             cat conftest.java >&5
11337             cat conftest.xml >&5
11338             rm -rf confdir
11339             AC_MSG_ERROR([no. Did you install ant-apache-regexp?])
11340         fi
11341     fi
11342     rm -f conftest* core core.* *.core
11345 OOO_JUNIT_JAR=
11346 if test "$SOLAR_JAVA" != "" -a "$with_junit" != "no"; then
11347     AC_MSG_CHECKING([for JUnit 4])
11348     if test "$with_junit" = "yes"; then
11349         if test -e /usr/share/java/junit4.jar; then
11350             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11351         else
11352            if test -e /usr/share/lib/java/junit.jar; then
11353               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11354            else
11355               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11356            fi
11357         fi
11358     else
11359         OOO_JUNIT_JAR=$with_junit
11360     fi
11361     if test "$_os" = "WINNT"; then
11362         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11363     fi
11364     "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" 2>&5 | \
11365         grep org/junit/Before.class > /dev/null 2>&5
11366     if test $? -eq 0; then
11367         # check if either class-path entry is available for hamcrest or
11368         # it's bundled
11369         if "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" |$GREP -q hamcrest || \
11370             "$UNZIP" -c "$OOO_JUNIT_JAR" META-INF/MANIFEST.MF |$GREP 'Class-Path:' | $GREP -q 'hamcrest'; then
11371             AC_MSG_RESULT([$OOO_JUNIT_JAR])
11372         else
11373             AC_MSG_ERROR([your junit jar neither sets a classpath nor includes hamcrest; please
11374 provide a full junit jar or use --without-junit])
11375         fi
11376     else
11377         AC_MSG_RESULT([no])
11378         AC_MSG_ERROR([cannot find JUnit 4 jar; please install one in the default
11379 location (/usr/share/java), specify its pathname via
11380 --with-junit=..., or disable it via --without-junit])
11381     fi
11382     if test $OOO_JUNIT_JAR != ""; then
11383     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11384     fi
11386 AC_SUBST(OOO_JUNIT_JAR)
11389 AC_SUBST(SCPDEFS)
11392 # check for wget and md5sum
11394 WGET=
11395 MD5SUM=
11396 CURL=
11398 if test "$enable_fetch_external" != "no"; then
11400 CURL=`which curl 2>/dev/null`
11402 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
11403     eval "$i --version" > /dev/null 2>&1
11404     ret=$?
11405     if test $ret -eq 0; then
11406         WGET=$i
11407         break
11408     fi
11409 done
11411 if test -z "$WGET" -a -z "$CURL"; then
11412     AC_MSG_ERROR([neither wget nor curl found!])
11415 for i in md5 md5sum /usr/local/bin/md5sum gmd5sum /usr/sfw/bin/md5sum /opt/sfw/bin/gmd5sum /opt/local/bin/md5sum; do
11416     if test "$i" = "md5"; then
11417         eval "$i -x" > /dev/null 2>&1
11418     else
11419         eval "$i --version" > /dev/null 2>&1
11420     fi
11421     ret=$?
11422     if test $ret -eq 0; then
11423         MD5SUM=$i
11424         break
11425     fi
11426 done
11428 if test "$MD5SUM" = "md5"; then
11429     if md5 -r < /dev/null > /dev/null 2>/dev/null; then
11430         MD5SUM="$MD5SUM -r"
11431     elif md5 -n < /dev/null > /dev/null 2>/dev/null; then
11432         MD5SUM="$MD5SUM -n"
11433     fi
11436 if test -z "$MD5SUM"; then
11437     AC_MSG_ERROR([no md5sum: found!])
11442 AC_SUBST(WGET)
11443 AC_SUBST(CURL)
11444 AC_SUBST(MD5SUM)
11446 dnl ===================================================================
11447 dnl Product version
11448 dnl ===================================================================
11449 AC_MSG_CHECKING([for product version])
11450 PRODUCTVERSION=AC_PACKAGE_VERSION
11451 AC_MSG_RESULT([$PRODUCTVERSION])
11452 AC_SUBST(PRODUCTVERSION)
11454 dnl ===================================================================
11455 dnl Dealing with l10n options
11456 dnl ===================================================================
11457 AC_MSG_CHECKING([which languages to be built])
11458 # get list of all languages
11459 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
11460 # the sed command does the following:
11461 #   + if a line ends with a backslash, append the next line to it
11462 #   + adds " on the beginning of the value (after =)
11463 #   + adds " at the end of the value
11464 #   + removes en-US; we want to put it on the beginning
11465 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
11466 [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)]
11467 ALL_LANGS="en-US $completelangiso"
11468 # check the configured localizations
11469 WITH_LANG="$with_lang"
11470 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
11471     AC_MSG_RESULT([en-US])
11472 else
11473     AC_MSG_RESULT([$WITH_LANG])
11474     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
11476 # check that the list is valid
11477 for lang in $WITH_LANG; do
11478     test "$lang" = "ALL" && continue
11479     # need to check for the exact string, so add space before and after the list of all languages
11480     for vl in $ALL_LANGS; do
11481         if test "$vl" = "$lang"; then
11482            break
11483         fi
11484     done
11485     if test "$vl" != "$lang"; then
11486         AC_MSG_ERROR([invalid language: $lang; supported languages are: $ALL_LANGS])
11487     fi
11488 done
11489 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
11490     echo $WITH_LANG | grep -q en-US
11491     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
11493 # list with substituted ALL
11494 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
11495 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
11496 test "$WITH_LANG" = "en-US" && WITH_LANG=
11497 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
11498     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
11499     ALL_LANGS=`echo $ALL_LANGS qtz`
11501 AC_SUBST(ALL_LANGS)
11502 AC_SUBST(WITH_LANG)
11503 AC_SUBST(WITH_LANG_LIST)
11504 AC_SUBST(GIT_NEEDED_SUBMODULES)
11506 WITH_POOR_HELP_LOCALIZATIONS=
11507 if test -d "$SRC_ROOT/translations/source"; then
11508     for l in `ls -1 $SRC_ROOT/translations/source`; do
11509         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
11510             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
11511         fi
11512     done
11514 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
11516 dnl git submodule update --reference
11517 dnl ===================================================================
11518 if test -n "${GIT_REFERENCE_SRC}"; then
11519     for repo in ${GIT_NEEDED_SUBMODULES}; do
11520         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
11521             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
11522         fi
11523     done
11525 AC_SUBST(GIT_REFERENCE_SRC)
11527 dnl branding
11528 dnl ===================================================================
11529 AC_MSG_CHECKING([for alternative branding images directory])
11530 # initialize mapped arrays
11531 BRAND_INTRO_IMAGES="flat_logo.svg intro.png"
11532 brand_files="$BRAND_INTRO_IMAGES about.svg \
11533     backing_left.png backing_right.png \
11534     backing_rtl_left.png backing_rtl_right.png \
11535     backing_space.png"
11537 if test -z "$with_branding" -o "$with_branding" = "no"; then
11538     AC_MSG_RESULT([none])
11539     DEFAULT_BRAND_IMAGES="$brand_files"
11540 else
11541     if ! test -d $with_branding ; then
11542         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
11543     else
11544         AC_MSG_RESULT([$with_branding])
11545         CUSTOM_BRAND_DIR="$with_branding"
11546         for lfile in $brand_files
11547         do
11548             if ! test -f $with_branding/$lfile ; then
11549                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
11550                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
11551             else
11552                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
11553             fi
11554         done
11555         check_for_progress="yes"
11556     fi
11558 AC_SUBST([BRAND_INTRO_IMAGES])
11559 AC_SUBST([CUSTOM_BRAND_DIR])
11560 AC_SUBST([CUSTOM_BRAND_IMAGES])
11561 AC_SUBST([DEFAULT_BRAND_IMAGES])
11564 AC_MSG_CHECKING([for 'intro' progress settings])
11565 PROGRESSBARCOLOR=
11566 PROGRESSSIZE=
11567 PROGRESSPOSITION=
11568 PROGRESSFRAMECOLOR=
11569 PROGRESSTEXTCOLOR=
11570 PROGRESSTEXTBASELINE=
11572 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
11573     source "$with_branding/progress.conf"
11574     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
11575 else
11576     AC_MSG_RESULT([none])
11579 AC_SUBST(PROGRESSBARCOLOR)
11580 AC_SUBST(PROGRESSSIZE)
11581 AC_SUBST(PROGRESSPOSITION)
11582 AC_SUBST(PROGRESSFRAMECOLOR)
11583 AC_SUBST(PROGRESSTEXTCOLOR)
11584 AC_SUBST(PROGRESSTEXTBASELINE)
11587 EXTRA_BUILDID=
11588 AC_MSG_CHECKING([for extra build ID])
11589 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
11590     EXTRA_BUILDID="$with_extra_buildid"
11591     AC_MSG_RESULT([$EXTRA_BUILDID])
11592 else
11593     AC_MSG_RESULT([not set])
11595 AC_SUBST(EXTRA_BUILDID)
11597 OOO_VENDOR=
11598 AC_MSG_CHECKING([for vendor])
11599 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
11600     OOO_VENDOR="$USERNAME"
11602     if test -z "$OOO_VENDOR"; then
11603         OOO_VENDOR="$USER"
11604     fi
11606     if test -z "$OOO_VENDOR"; then
11607         OOO_VENDOR="`id -u -n`"
11608     fi
11610     AC_MSG_RESULT([not set, using $OOO_VENDOR])
11611 else
11612     OOO_VENDOR="$with_vendor"
11613     AC_MSG_RESULT([$OOO_VENDOR])
11615 AC_SUBST(OOO_VENDOR)
11617 UNIXWRAPPERNAME=
11618 AC_MSG_CHECKING([for UNIX wrapper name])
11619 if test -z "$with_unix_wrapper" -o "$with_unix_wrapper" = "no"  -o "$with_unix_wrapper" = "yes"; then
11620     AC_MSG_RESULT([not set])
11621 else
11622     UNIXWRAPPERNAME="$with_unix_wrapper"
11623     AC_MSG_RESULT([$UNIXWRAPPERNAME])
11625 AC_SUBST(UNIXWRAPPERNAME)
11627 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
11628 if test "$with_compat_oowrappers" = "yes"; then
11629     WITH_COMPAT_OOWRAPPERS=YES
11630     AC_MSG_RESULT(yes)
11631 else
11632     WITH_COMPAT_OOWRAPPERS=
11633     AC_MSG_RESULT(no)
11635 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
11637 AC_MSG_CHECKING([for product name])
11638 PRODUCTNAME=AC_PACKAGE_NAME
11639 AC_MSG_RESULT([$PRODUCTNAME])
11640 AC_SUBST(PRODUCTNAME)
11642 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | tr '[[:upper:]]' '[[:lower:]]'`
11643 AC_MSG_CHECKING([for install dirname])
11644 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
11645    INSTALLDIRNAME="$with_install_dirname"
11647 AC_MSG_RESULT([$INSTALLDIRNAME])
11648 AC_SUBST(INSTALLDIRNAME)
11650 AC_MSG_CHECKING([for prefix])
11651 test "x$prefix" = xNONE && prefix=$ac_default_prefix
11652 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
11653 PREFIXDIR="$prefix"
11654 AC_MSG_RESULT([$PREFIXDIR])
11655 AC_SUBST(PREFIXDIR)
11657 AC_MSG_CHECKING([for libdir])
11658 LIBDIR=[$(eval echo $(eval echo $libdir))]
11659 AC_MSG_RESULT([$LIBDIR])
11660 AC_SUBST(LIBDIR)
11662 AC_MSG_CHECKING([for data dir])
11663 DATADIR=[$(eval echo $(eval echo $datadir))]
11664 AC_MSG_RESULT([$DATADIR])
11665 AC_SUBST(DATADIR)
11667 AC_MSG_CHECKING([for man dir])
11668 MANDIR=[$(eval echo $(eval echo $mandir))]
11669 AC_MSG_RESULT([$MANDIR])
11670 AC_SUBST(MANDIR)
11672 AC_MSG_CHECKING([for doc dir])
11673 DOCDIR=[$(eval echo $(eval echo $docdir))]
11674 AC_MSG_RESULT([$DOCDIR])
11675 AC_SUBST(DOCDIR)
11677 AC_MSG_CHECKING([for install dir])
11678 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
11679 AC_MSG_RESULT([$INSTALLDIR])
11680 AC_SUBST(INSTALLDIR)
11682 AC_MSG_CHECKING([for dev-install dir])
11683 DEVINSTALLDIR="$OUTDIR/installation"
11684 AC_MSG_RESULT([$DEVINSTALLDIR])
11685 AC_SUBST(DEVINSTALLDIR)
11687 # ===================================================================
11688 # De- or increase default verbosity of build process
11689 # ===================================================================
11690 AC_MSG_CHECKING([build verbosity])
11691 if test -n "$enable_verbose"; then
11692     if test "$enable_verbose" = "yes"; then
11693         VERBOSE="TRUE"
11694         AC_MSG_RESULT([high])
11695     fi
11696     if test "$enable_verbose" = "no"; then
11697         VERBOSE="FALSE"
11698         AC_MSG_RESULT([low])
11699     fi
11700 else
11701     AC_MSG_RESULT([not set])
11703 AC_SUBST(VERBOSE)
11705 dnl ===================================================================
11706 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
11707 dnl --enable-dependency-tracking configure option
11708 dnl ===================================================================
11709 AC_MSG_CHECKING([whether to enable dependency tracking])
11710 if test "$enable_dependency_tracking" = "no"; then
11711     nodep=TRUE
11712     AC_MSG_RESULT([no])
11713 else
11714     AC_MSG_RESULT([yes])
11716 AC_SUBST(nodep)
11718 dnl ===================================================================
11719 dnl Number of CPUs to use during the build
11720 dnl ===================================================================
11721 AC_MSG_CHECKING([for number of processors to use])
11722 # plain --with-parallelism is just the default
11723 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
11724     if test "$with_parallelism" = "no"; then
11725         PARALLELISM=1
11726     else
11727         PARALLELISM=$with_parallelism
11728     fi
11729 else
11730     if test "$enable_icecream" = "yes"; then
11731         PARALLELISM="10"
11732     else
11733         case `uname -s` in
11735         Darwin|FreeBSD|NetBSD|OpenBSD)
11736             PARALLELISM=`sysctl -n hw.ncpu`
11737             ;;
11739         Linux)
11740             PARALLELISM=`getconf _NPROCESSORS_ONLN`
11741         ;;
11742         # what else than above does profit here *and* has /proc?
11743         *)
11744             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
11745             ;;
11746         esac
11748         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
11749         # unexpected format, 'wc -l' will have returned 0.
11750         if test "$PARALLELISM" -eq 0; then
11751             PARALLELISM=1
11752         fi
11753     fi
11756 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
11757     if test -z "$with_parallelism"; then
11758             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
11759             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
11760             PARALLELISM="1"
11761     else
11762         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."
11763     fi
11766 AC_MSG_RESULT([$PARALLELISM])
11767 AC_SUBST(PARALLELISM)
11769 # ===================================================================
11770 # Number of parallel jobs to be executed during subsequenttest
11771 # ===================================================================
11772 AC_MSG_CHECKING([for maximum no. of jobs during subsequenttest])
11773 CHECK_PARALLELISM=$PARALLELISM
11774 if test "$with_check_jobs" != ""; then
11775     CHECK_PARALLELISM="$with_check_jobs"
11777 AC_MSG_RESULT([$CHECK_PARALLELISM])
11778 AC_SUBST(CHECK_PARALLELISM)
11781 # Set up ILIB for MSVC build
11783 if test "$build_os" = "cygwin"; then
11784     ILIB=".;${SOLARVER}/$INPATH/lib"
11785     if test -n "$JAVA_HOME" -a "$JAVA_HOME" != "NO_JAVA_HOME"; then
11786         ILIB="$ILIB;$JAVA_HOME/lib"
11787     fi
11788     if test "$BITNESS_OVERRIDE" = 64; then
11789         ILIB="$ILIB;$COMPATH/lib/amd64"
11790         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
11791         if test "$WINDOWS_SDK_VERSION" = "80"; then
11792             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/win8/um/x64"
11793         fi
11794     else
11795         ILIB="$ILIB;$COMPATH/lib"
11796         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
11797         if test "$WINDOWS_SDK_VERSION" = "80"; then
11798             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/win8/um/x86"
11799         fi
11800     fi
11801     ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
11803     if test "$ENABLE_DIRECTX" = "TRUE"; then
11804         ILIB="$ILIB;$DIRECTXSDK_LIB"
11805     fi
11806     AC_SUBST(ILIB)
11810 # ===================================================================
11811 # Creating bigger shared library to link against
11812 # ===================================================================
11813 AC_MSG_CHECKING([whether to create huge library])
11814 MERGELIBS=
11816 if test $_os = iOS -o $_os = Android; then
11817     # Never any point in mergelibs for these as we build just static
11818     # libraries anyway...
11819     enable_mergelibs=no
11822 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
11823     if test $_os != Linux -a $_os != WINNT; then
11824         add_warning "--enable-mergelibs is not tested for this platform"
11825     fi
11826     if test "$enable_mergelibs" = "all"; then
11827         MERGELIBS="ALL"
11828         URELIBS="TRUE"
11829     else
11830         MERGELIBS="CORE"
11831     fi
11832     AC_MSG_RESULT([yes])
11833 else
11834     AC_MSG_RESULT([no])
11836 AC_SUBST([MERGELIBS])
11837 AC_SUBST([URELIBS])
11839 # ===================================================================
11840 # Create hardlinks on deliver instead of copying for smaller size and speed up
11841 # ===================================================================
11842 AC_MSG_CHECKING([whether to create hardlinks for delivering files])
11843 HARDLINKDELIVER=
11844 if test "$enable_hardlink_deliver" = "yes"; then
11845     HARDLINKDELIVER="TRUE"
11846     AC_MSG_RESULT([yes])
11847 else
11848     AC_MSG_RESULT([no])
11850 AC_SUBST(HARDLINKDELIVER)
11852 dnl ===================================================================
11853 dnl icerun is a wrapper that stops us spawning tens of processes
11854 dnl locally - for tools that can't be executed on the compile cluster
11855 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
11856 dnl ===================================================================
11857 AC_MSG_CHECKING([whether to use icerun wrapper])
11858 ICECREAM_RUN=
11859 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
11860     ICECREAM_RUN=icerun
11861     AC_MSG_RESULT([yes])
11862 else
11863     AC_MSG_RESULT([no])
11865 AC_SUBST(ICECREAM_RUN)
11867 dnl ===================================================================
11868 dnl Setting up the environment.
11869 dnl ===================================================================
11870 echo "setting up the build environment variables..."
11872 AC_SUBST(COMPATH)
11874 if test "$build_os" = "cygwin"; then
11875     if test "$DISABLE_ACTIVEX" = "YES"; then
11876         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
11877         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
11878         MFC_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
11879         MFC_INCLUDE="$WINDOWS_SDK_HOME/include/mfc"
11880     else
11881         ATL_LIB="$COMPATH/atlmfc/lib"
11882         ATL_INCLUDE="$COMPATH/atlmfc/include"
11883         MFC_LIB="$COMPATH/atlmfc/lib"
11884         MFC_INCLUDE="$WINDOWS_SDK_HOME/include/mfc"
11885     fi
11886     if test "$BITNESS_OVERRIDE" = 64; then
11887         ATL_LIB="$ATL_LIB/amd64"
11888         MFC_LIB="$MFC_LIB/amd64"
11889     fi
11890     PathFormat "/usr/bin/grep.exe"
11891     WIN_GREP="$formatted_path"
11892     PathFormat "/usr/bin/find.exe"
11893     WIN_FIND="$formatted_path"
11894     PathFormat "/usr/bin/ls.exe"
11895     WIN_LS="$formatted_path"
11896     PathFormat "/usr/bin/touch.exe"
11897     WIN_TOUCH="$formatted_path"
11900 AC_SUBST(ATL_INCLUDE)
11901 AC_SUBST(ATL_LIB)
11902 AC_SUBST(MFC_INCLUDE)
11903 AC_SUBST(MFC_LIB)
11904 AC_SUBST(WIN_FIND)
11905 AC_SUBST(WIN_GREP)
11906 AC_SUBST(WIN_LS)
11907 AC_SUBST(WIN_TOUCH)
11909 AC_SUBST(BUILD_TYPE)
11911 AC_SUBST(SOLARINC)
11912 AC_SUBST(SOLARLIB)
11914 PathFormat "$PERL"
11915 PERL="$formatted_path"
11916 AC_SUBST(PERL)
11918 if test "$build_os" = "cygwin"; then
11919     TEMP_DIRECTORY=`cygpath -m "/tmp"`
11920     if test -n "$TMP"; then
11921         TMP_DIRECTORY="$TMP"
11922     else
11923         TMP_DIRECTORY="$TEMP_DIRECTORY"
11924     fi
11925 else
11926     if test -n "$TMPDIR"; then
11927         TEMP_DIRECTORY="$TMPDIR"
11928     else
11929         TEMP_DIRECTORY="/tmp"
11930     fi
11932 AC_SUBST(TEMP_DIRECTORY)
11933 AC_SUBST(TMP_DIRECTORY)
11935 # setup the PATH for the environment
11936 if test -n "$LO_PATH_FOR_BUILD"; then
11937     LO_PATH="$LO_PATH_FOR_BUILD"
11938 else
11939     LO_PATH="$PATH"
11941     case "$host_os" in
11943     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
11944         if test "$SOLAR_JAVA" != "" -a "$JDK"!="gcj"; then
11945             pathmunge "$JAVA_HOME/bin" "after"
11946         fi
11947         ;;
11949     cygwin*)
11950         pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
11951         pathmunge "$ASM_HOME" "before"
11952         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
11953         pathmunge "$CSC_PATH" "before"
11954         pathmunge "$MIDL_PATH" "before"
11955         pathmunge "$AL_PATH" "before"
11956         pathmunge "$MSPDB_PATH" "before"
11957         if test "$BITNESS_OVERRIDE" = 64; then
11958             pathmunge "$COMPATH/bin/amd64" "before"
11959             pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
11960         else
11961             pathmunge "$COMPATH/bin" "before"
11962             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
11963         fi
11964         if test "$SOLAR_JAVA" != "" -a "$JDK"!="gcj"; then
11965             if test -d "$JAVA_HOME/jre/bin/client"; then
11966                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
11967             fi
11968             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
11969                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
11970             fi
11971             pathmunge "$JAVA_HOME/bin" "before"
11972         fi
11973         ;;
11975     solaris*)
11976         pathmunge "/usr/css/bin" "before"
11977         if test "$SOLAR_JAVA" != "" -a "$JDK"!="gcj"; then
11978             pathmunge "$JAVA_HOME/bin" "after"
11979         fi
11980         ;;
11981     esac
11983     pathmunge "$SRC_ROOT/solenv/$OUTPATH/bin" "before"
11984     pathmunge "$SRC_ROOT/solenv/bin" "before"
11985     pathmunge "." "before"
11988 AC_SUBST(LO_PATH)
11990 # Generate a configuration md5 we can use for deps
11991 if test -f config_host.mk; then
11992     config_md5=`$MD5SUM config_host.mk | sed "s/ .*//"`
11995 AC_CONFIG_FILES([config_host.mk Makefile lo.xcent instsetoo_native/util/openoffice.lst])
11996 AC_CONFIG_HEADERS([config_host/config_clang.h])
11997 AC_CONFIG_HEADERS([config_host/config_features.h])
11998 AC_CONFIG_HEADERS([config_host/config_global.h])
11999 AC_CONFIG_HEADERS([config_host/config_graphite.h])
12000 AC_CONFIG_HEADERS([config_host/config_harfbuzz.h])
12001 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12002 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12003 AC_CONFIG_HEADERS([config_host/config_mingw.h])
12004 AC_CONFIG_HEADERS([config_host/config_oox.h])
12005 AC_CONFIG_HEADERS([config_host/config_telepathy.h])
12006 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12007 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12008 AC_CONFIG_HEADERS([config_host/config_version.h])
12009 AC_OUTPUT
12011 if test "$CROSS_COMPILING" = YES; then
12012     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12015 # touch the config timestamp file
12016 if test ! -f config_host.mk.stamp; then
12017     echo > config_host.mk.stamp
12018 elif test "$config_md5" = `$MD5SUM config_host.mk | sed "s/ .*//"`; then
12019     echo "Configuration unchanged - avoiding scp2 stamp update"
12020 else
12021     echo > config_host.mk.stamp
12025 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12026 cat << _EOS
12027 ****************************************************************************
12028 WARNING:
12029 Your make version is known to be horribly slow, and hard to debug
12030 problems with. To get a reasonably functional make please do:
12032 to install a pre-compiled binary make for cygwin
12034 mkdir -p /opt/lo/bin
12035 cd /opt/lo/bin
12036 wget http://dev-www.libreoffice.org/bin/cygwin/make
12037 chmod +x make
12039 to install from source:
12040 place yourself in a working directory of you choice.
12042 git clone git://anongit.freedesktop.org/libreoffice/contrib/dev-tools
12043 cd dev-tools/make-3.82-gbuild
12044 ./configure --prefix=/opt/lo
12045 make
12046 sudo make install
12048 Then re-run autogen.sh
12050 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12051 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12053 _EOS
12056 cat << _EOF
12057 ****************************************************************************
12058 To build, issue:
12059 $GNUMAKE
12061 run: $GNUMAKE help
12062 for details
12064 _EOF
12066 if test $_os != WINNT -a "$CROSS_COMPILING" != YES; then
12067     cat << _EOF
12069 To install when the build is finished, issue:
12070 $GNUMAKE install
12072 If you want to develop LibreOffice, you might prefer:
12073 $GNUMAKE dev-install
12075 If you want to run the smoketest, issue:
12076 $GNUMAKE check
12078 _EOF
12081 if test -f warn; then
12082     cat warn
12083     rm warn
12086 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: