Updated core
[LibreOffice.git] / configure.ac
blobadd9ba292a45277b86bfda2f88aa6a40cae123ff
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.beta2+],[],[],[http://documentfoundation.org/])
14 AC_PREREQ([2.59])
15 save_CC=$CC
16 save_CXX=$CXX
18 BUILD_TYPE="LibO"
19 SCPDEFS=""
20 GIT_NEEDED_SUBMODULES=""
21 LO_PATH= # used by path_munge to construct a PATH variable
23 PathFormat()
25     formatted_path="$1"
26     if test "$build_os" = "cygwin"; then
27         pf_part1=
28         pf_conv_to_dos=
29         for pf_part in $formatted_path; do
30             if test -z "$pf_part1"; then
31                 pf_part1="$pf_part"
32             else
33                 pf_conv_to_dos="yes"
34             fi
35         done
36         if test "$pf_conv_to_dos" = "yes"; then
37             formatted_path=`cygpath -d "$formatted_path"`
38             if test $? -ne 0;  then
39                 AC_MSG_ERROR([path conversion failed for "$1".])
40             fi
41         fi
42         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
43         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
44         if test "$fp_count_slash$fp_count_colon" != "00"; then
45             if test "$fp_count_colon" = "0"; then
46                 formatted_path=`realpath "$formatted_path"`
47                 if test $? -ne 0;  then
48                     AC_MSG_ERROR([realpath failed for "$1".])
49                 fi
50             fi
51             formatted_path=`cygpath -m "$formatted_path"`
52             if test $? -ne 0;  then
53                 AC_MSG_ERROR([path conversion failed for "$1".])
54             fi
55         fi
56     fi
59 rm -f warn
60 have_WARNINGS="no"
61 add_warning()
63     if test "$have_WARNINGS" = "no"; then
64         echo "*************************************" > warn
65         have_WARNINGS="yes"
66         if which tput >/dev/null 2>/dev/null && test `tput colors` -ge 8; then
67             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
68             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
69         else
70             COLORWARN="* WARNING :"
71         fi
72     fi
73     echo "$COLORWARN $@" >> warn
76 if test -n "$SOLARENV"; then
77     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
80 echo "********************************************************************"
81 echo "*"
82 echo "*   Running ${PACKAGE_NAME} build configuration."
83 echo "*"
84 echo "********************************************************************"
85 echo ""
87 dnl ===================================================================
88 dnl checks build and host OSes
89 dnl do this before argument processing to allow for platform dependent defaults
90 dnl ===================================================================
91 AC_CANONICAL_HOST
93 AC_PROG_EGREP
94 # AC_PROG_EGREP doesn't set GREP on all systems as well
95 AC_PATH_PROG(GREP, grep)
97 BUILDDIR=`pwd`
98 cd $srcdir
99 SRC_ROOT=`pwd`
100 cd $BUILDDIR
101 EXEEXT_FOR_BUILD=
102 x_Cygwin=[\#]
104 if test "$build_os" = "cygwin"; then
105     EXEEXT_FOR_BUILD=.exe
106     PathFormat "$SRC_ROOT"
107     SRC_ROOT="$formatted_path"
108     PathFormat "$BUILDDIR"
109     BUILDDIR="$formatted_path"
110     x_Cygwin=
113 AC_SUBST(SRC_ROOT)
114 AC_SUBST(BUILDDIR)
115 AC_SUBST(EXEEXT_FOR_BUILD)
116 AC_SUBST(x_Cygwin)
117 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
118 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
120 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
121     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
124 # need sed in os checks...
125 AC_PATH_PROGS(SED, sed)
126 if test -z "$SED"; then
127     AC_MSG_ERROR([install sed to run this script])
130 dnl ===================================================================
131 dnl When building for Android, --with-android-ndk,
132 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
133 dnl mandatory
134 dnl ===================================================================
136 AC_ARG_WITH(android-ndk,
137     AS_HELP_STRING([--with-android-ndk],
138         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
141 AC_ARG_WITH(android-ndk-toolchain-version,
142     AS_HELP_STRING([--with-android-ndk-toolchain-version],
143         [Specify which toolchain version to use, of those present in the
144         Android NDK you are using. Mandatory if the NDK used has several
145         toolchain versions for the host architecture you are building for.]), ,)
147 AC_ARG_WITH(android-sdk,
148     AS_HELP_STRING([--with-android-sdk],
149         [Specify location of the Android SDK. Mandatory when building for Android.]),
152 ANDROID_NDK_HOME=
153 if test -n "$with_android_ndk"; then
154     ANDROID_NDK_HOME=$with_android_ndk
156     # Set up a lot of pre-canned defaults
158     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
159         AC_MSG_ERROR([Unrecognized Android NDK. Only r8* versions supported.])
160     fi
161     ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
163     case $ANDROID_NDK_VERSION in
164     r8*)
165         ;;
166     *)
167         AC_MSG_ERROR([Unsupported NDK version $ANDROID_NDK_VERSION, only r8* versions are supported])
168         ;;
169     esac
171     if test $host_cpu = arm; then
172         android_cpu=arm
173         android_platform_prefix=$android_cpu-linux-androideabi
174     elif test $host_cpu = mips; then
175         android_cpu=mips
176         android_platform_prefix=$android_cpu-linux-androideabi
177     else
178         # host_cpu is something like "i386" or "i686" I guess, NDK uses
179         # "x86" in some contexts
180         android_cpu=x86
181         android_platform_prefix=$android_cpu
182     fi
184     case "$with_android_ndk_toolchain_version" in
185     4.6|4.7)
186         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$with_android_ndk_toolchain_version
187         ANDROID_COMPILER_DIR=$ANDROID_BINUTILS_DIR
188         ;;
189     clang3.1|clang3.2)
190         AC_MSG_WARN([Building with the Clang tool-chain is known to break in the bridges module, fix that please])
191         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-4.6
192         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm-${with_android_ndk_toolchain_version#clang}
193         ANDROID_USING_CLANG=true
194         ;;
195     esac
197     if test ! -d $ANDROID_BINUTILS_DIR; then
198         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
199     elif test $ANDROID_COMPILER_DIR != $ANDROID_BINUTILS_DIR -a ! -d $ANDROID_COMPILER_DIR; then
200         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
201     fi
203     # Check if there is a 64-bit tool-chain. Google provides a NDK with 64-bit tool-chain binaries in
204     # NDK r8e, and for earlier NDKs it was possible to build one yourself. Using a 64-bit linker is
205     # required if you compile large parts of the code with -g. A 32-bit linker just won't manage to
206     # link the (app-specific) single huge .so that is built for the apps in android/experimental/* if
207     # there is debug information in a significant part of the object files. (A 64-bit ld.gold grows to
208     # much over 10 gigabytes of virtual space when linking such a .so if all objects have been built
209     # with debug information.)
210     toolchain_system='*'
211     if test $build_os = linux-gnu; then
212         ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/linux-x86/bin
213         ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/linux-x86
214         if test $build_cpu = x86_64; then
215             if test -d $ANDROID_COMPILER_DIR/prebuilt/linux-x86_64; then
216                 ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/linux-x86_64/bin
217             fi
218             if test -d $ANDROID_BINUTILS_DIR/prebuilt/linux-x86_64; then
219                 ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/linux-x86_64
220             fi
221         fi
222         ANDROID_BINUTILS_BIN=$ANDROID_BINUTILS_PREBUILT_ROOT/bin
223     fi
225     # This stays empty if there is just one version of the toolchain in the NDK
226     ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=
227     case "`echo $ANDROID_NDK_HOME/toolchains/$android_cpu*-*/prebuilt/*/bin`" in
228     */bin\ */bin*)
229         # Trailing slash intentional and necessary, compare to how this is used
230         if test -n "$ANDROID_USING_CLANG"; then
231             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=4.6/
232         else
233             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
234         fi
235         ;;
236     esac
238     if test $host_cpu = arm; then
239        android_gnu_prefix=arm-linux-androideabi
240     elif test $host_cpu = mips; then
241        android_gnu_prefix=mipsel-linux-android
242     elif test $ANDROID_NDK_VERSION = r8; then
243         # The prefix used for the x86 tool-chain changed between NDK r8 and r8b
244         android_gnu_prefix=i686-android-linux
245     else
246         android_gnu_prefix=i686-linux-android
247     fi
249     test -z "$SYSBASE" && export SYSBASE=$ANDROID_NDK_HOME/platforms/android-9/arch-$android_cpu
250     test -z "$AR" && AR=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ar
251     test -z "$NM" && NM=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-nm
252     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-objdump
253     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ranlib
254     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-strip
256     if test $host_cpu = arm; then
257         ANDROID_APP_ABI=armeabi-v7a
258         if test -n "$ANDROID_USING_CLANG"; then
259             ANDROIDCFLAGS="-gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT" 
260             ANDROIDCFLAGS="$ANDROIDCFLAGS -target armv7-none-linux-androideabi"
261             ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes"
262         else
263             :
264         fi
265         ANDROIDCFLAGS="$ANDROIDCFLAGS -mthumb"
266         ANDROIDCFLAGS="$ANDROIDCFLAGS -march=armv7-a -mfloat-abi=softfp -mfpu=neon"
267     elif test $host_cpu = mips; then
268         ANDROID_APP_ABI=mips
269         ANDROIDCFLAGS=""
270     else # x86
271         ANDROID_APP_ABI=x86
272         ANDROIDCFLAGS="-march=atom"
273     fi
274     ANDROIDCFLAGS="$ANDROIDCFLAGS -ffunction-sections"
275     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/$ANDROID_APP_ABI"
276     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot $ANDROID_NDK_HOME/platforms/android-9/arch-$android_cpu"
277     ANDROIDCFLAGS="$ANDROIDCFLAGS -Wl,--fix-cortex-a8"
279     if test -n "$ANDROID_USING_CLANG"; then
280         ANDROIDCFLAGS="$ANDROIDCFLAGS -Qunused-arguments"
281     else
282         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wno-psabi"
283     fi
285     # When using the 4.6 or newer toolchain, use the gold linker
286     case "$with_android_ndk_toolchain_version" in
287     4.[[6789]]*|[[56789]].*|clang*)
288         # The NDK doesn't have ld.gold for MIPS for some reason
289         if test "$host_cpu" != mips; then
290             ANDROIDCFLAGS="$ANDROIDCFLAGS -fuse-ld=gold"
291         fi
292         ;;
293     esac
295     # gdbserver can be in different locations
296     if test -f $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver; then
297         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver
298     elif test -f $ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver; then
299         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver
300     else
301         AC_MSG_ERROR([Can't find gdbserver for your Android target])
302     fi
304     if test $host_cpu = arm; then
305         ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I $ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/armeabi-v7a/include"
306     elif test $host_cpu = mips; then
307         ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I $ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/mips/include"
308     else # x86
309         ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I $ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/x86/include"
310     fi
312     if test -z "$CC"; then
313         case "$with_android_ndk_toolchain_version" in
314         4.*)
315             CC="$ANDROID_COMPILER_BIN/$android_gnu_prefix-gcc $ANDROIDCFLAGS"
316             ;;
317         clang*)
318             CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
319         esac
320     fi
321     if test -z "$CXX"; then
322         case "$with_android_ndk_toolchain_version" in
323         4.*)
324             CXX="$ANDROID_COMPILER_BIN/$android_gnu_prefix-g++ $ANDROIDCXXFLAGS"
325             ;;
326         clang*)
327             CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
328             ;;
329         esac
330     fi
332 AC_SUBST(ANDROID_NDK_GDBSERVER)
333 AC_SUBST(ANDROID_APP_ABI)
335 dnl ===================================================================
336 dnl Also --with-android-sdk is mandatory
337 dnl ===================================================================
338 ANDROID_SDK_HOME=
339 if test -n "$with_android_sdk"; then
340    ANDROID_SDK_HOME=$with_android_sdk
341    PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
343 AC_SUBST(ANDROID_SDK_HOME)
345 dnl ===================================================================
346 dnl The following is a list of supported systems.
347 dnl Sequential to keep the logic very simple
348 dnl These values may be checked and reset later.
349 dnl ===================================================================
350 #defaults unless the os test overrides this:
351 test_randr=yes
352 test_xrender=yes
353 test_cups=yes
354 test_dbus=yes
355 test_fontconfig=yes
356 test_cairo=no
358 # Default values, as such probably valid just for Linux, set
359 # differently below just for Mac OSX,but at least better than
360 # hardcoding these as we used to do. Much of this is duplicated also
361 # in solenv for old build system and for gbuild, ideally we should
362 # perhaps define stuff like this only here in configure.ac?
364 LINKFLAGSSHL="-shared"
365 PICSWITCH="-fpic"
366 DLLPOST=".so"
368 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
370 case "$host_os" in
372 solaris*)
373     test_gtk=yes
374     build_gstreamer=yes
375     build_gstreamer_0_10=yes
376     test_tde=yes
377     test_kde=yes
378     test_freetype=yes
379     test_gstreamer=yes
380     _os=SunOS
382     dnl ===========================================================
383     dnl Check whether we're using Solaris 10 - SPARC or Intel.
384     dnl ===========================================================
385     AC_MSG_CHECKING([the Solaris operating system release])
386     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
387     if test "$_os_release" -lt "10"; then
388         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
389     else
390         AC_MSG_RESULT([ok ($_os_release)])
391     fi
393     dnl Check whether we're using a SPARC or i386 processor
394     AC_MSG_CHECKING([the processor type])
395     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
396         AC_MSG_RESULT([ok ($host_cpu)])
397     else
398         AC_MSG_ERROR([only SPARC and i386 processors are supported])
399     fi
400     ;;
402 linux-gnu*|k*bsd*-gnu*)
403     test_gtk=yes
404     build_gstreamer=yes
405     build_gstreamer_0_10=yes
406     test_tde=yes
407     test_kde=yes
408     test_kde4=yes
409     test_freetype=yes
410     test_unix_quickstarter=yes
411     _os=Linux
412     ;;
414 gnu)
415     test_randr=no
416     test_xrender=no
417     _os=GNU
418      ;;
420 cygwin*|interix*|mingw32*)
422     # When building on Windows normally with MSVC under Cygwin,
423     # configure thinks that the host platform (the platform the
424     # built code will run on) is Cygwin, even if it obviously is
425     # Windows, which in Autoconf terminology is called
426     # "mingw32". (Which is misleading as MinGW is the name of the
427     # tool-chain, not an operating system.)
429     # Somewhat confusing, yes. But this configure script doesn't
430     # look at $host etc that much, it mostly uses its own $_os
431     # variable, set here in this case statement.
433     # When cross-compiling to Windows from Unix, the host platform
434     # is "mingw32" (because in that case it is the MinGW
435     # tool-chain that is used).
437     test_cups=no
438     test_dbus=no
439     test_randr=no
440     test_xrender=no
441     test_freetype=no
442     test_fontconfig=no
443     _os=WINNT
445     DLLPOST=".dll"
446     LINKFLAGSNOUNDEFS=
448     # If the host OS matches "mingw32*", that means we are using the
449     # MinGW cross-compiler, because we don't see the point in building
450     # LibreOffice using MinGW on Windows. If you want to build on
451     # Windows, use MSVC. If you want to use MinGW, surely you want to
452     # cross-compile (from Linux or some other Unix).
454     case "$host_os" in
455     mingw32*)
456         WITH_MINGW=yes
457         if test -z "$CC"; then
458             CC="$host_cpu-$host_vendor-$host_os-gcc"
459         fi
460         if test -z "$CXX"; then
461             CXX="$host_cpu-$host_vendor-$host_os-g++"
462         fi
463         ;;
464     esac
465     ;;
467 darwin*) # Mac OS X or iOS
468     test_gtk=yes
469     test_randr=no
470     test_xrender=no
471     test_freetype=no
472     test_fontconfig=no
473     test_dbus=no
474     if test "$host_cpu" = "arm"; then
475         _os=iOS
476         test_gtk=no
477         test_cups=no
478     else
479         _os=Darwin
480     fi
481     enable_systray=no
482     # See comment above the case "$host_os"
483     LINKFLAGSSHL="-dynamiclib -single_module"
485     # -fPIC is default
486     PICSWITCH=""
488     DLLPOST=".dylib"
490     # -undefined error is the default
491     LINKFLAGSNOUNDEFS=""
494 freebsd*)
495     test_gtk=yes
496     build_gstreamer=yes
497     build_gstreamer_0_10=yes
498     test_tde=yes
499     test_kde=yes
500     test_kde4=yes
501     test_freetype=yes
502     AC_MSG_CHECKING([the FreeBSD operating system release])
503     if test -n "$with_os_version"; then
504         OSVERSION="$with_os_version"
505     else
506         OSVERSION=`/sbin/sysctl -n kern.osreldate`
507     fi
508     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
509     AC_MSG_CHECKING([which thread library to use])
510     if test "$OSVERSION" -lt "500016"; then
511         PTHREAD_CFLAGS="-D_THREAD_SAFE"
512         PTHREAD_LIBS="-pthread"
513     elif test "$OSVERSION" -lt "502102"; then
514         PTHREAD_CFLAGS="-D_THREAD_SAFE"
515         PTHREAD_LIBS="-lc_r"
516     else
517         PTHREAD_CFLAGS=""
518         PTHREAD_LIBS="-pthread"
519     fi
520     AC_MSG_RESULT([$PTHREAD_LIBS])
521     _os=FreeBSD
522     ;;
524 *netbsd*)
525     test_gtk=yes
526     build_gstreamer=yes
527     build_gstreamer_0_10=yes
528     test_tde=no
529     test_kde=no
530     test_kde4=yes
531     test_freetype=yes
532     PTHREAD_LIBS="-pthread -lpthread"
533     _os=NetBSD
534     ;;
536 aix*)
537     test_randr=no
538     test_freetype=yes
539     PTHREAD_LIBS=-pthread
540     _os=AIX
541     ;;
543 openbsd*)
544     test_gtk=yes
545     test_tde=yes
546     test_kde=yes
547     test_freetype=yes
548     PTHREAD_CFLAGS="-D_THREAD_SAFE"
549     PTHREAD_LIBS="-pthread"
550     _os=OpenBSD
551     ;;
553 dragonfly*)
554     test_gtk=yes
555     build_gstreamer=yes
556     build_gstreamer_0_10=yes
557     test_tde=yes
558     test_kde=yes
559     test_kde4=yes
560     test_freetype=yes
561     PTHREAD_LIBS="-pthread"
562     _os=DragonFly
563     ;;
565 linux-android*)
566     build_gstreamer=no
567     build_gstreamer_0_10=no
568     enable_lotuswordpro=no
569     enable_neon=no
570     enable_mpl_subset=yes
571     enable_opengl=no
572     enable_lpsolve=no
573     with_theme="tango"
574     test_cups=no
575     test_dbus=no
576     test_fontconfig=no
577     test_freetype=no
578     test_gtk=no
579     test_tde=no
580     test_kde=no
581     test_kde4=no
582     test_randr=no
583     test_xrender=no
584     test_unix_quickstarter=no
585     _os=Android
587     if test -z "$with_android_ndk"; then
588         AC_MSG_ERROR([the --with-android-ndk option is mandatory])
589     fi
591     if test -z "$with_android_ndk_toolchain_version"; then
592         AC_MSG_ERROR([the --with-android-ndk-toolchain-version option is mandatory])
593     fi
595     if test -z "$with_android_sdk"; then
596         AC_MSG_ERROR([the --with-android-sdk option is mandatory])
597     fi
599     # Verify that the NDK and SDK options are proper
600     if test ! -f "$ANDROID_NDK_HOME/platforms/android-9/arch-arm/usr/lib/libc.a"; then
601         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
602     fi
604     if test ! -d "$ANDROID_SDK_HOME/platforms"; then
605         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
606     fi
608     BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
609     ;;
612     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
613     ;;
614 esac
616 if test "$_os" = "AIX"; then
617     AC_PATH_PROG(GAWK, gawk)
618     if test -z "$GAWK"; then
619         AC_MSG_ERROR([gawk not found in \$PATH])
620     fi
623 AC_SUBST(WITH_MINGW)
624 AC_SUBST(OSVERSION)
625 AC_SUBST(PTHREAD_CFLAGS)
626 AC_SUBST(PTHREAD_LIBS)
628 ###############################################################################
629 # Extensions switches --enable/--disable
630 ###############################################################################
631 # By default these should be enabled unless having extra dependencies.
632 # If there is extra dependency over configure options then the enable should
633 # be automagic based on whether the requiring feature is enabled or not.
634 # All this options change anything only with --enable-extension-integration.
636 # The name of this option and its help string makes it sound as if
637 # extensions are built anyway, just not integrated in the installer,
638 # if you use --disable-extension-integration. Is that really the
639 # case?
641 AC_ARG_ENABLE(extension-integration,
642     AS_HELP_STRING([--disable-extension-integration],
643         [Disable integration of the built extensions in the installer of the
644          product. Use this switch to disable the integration.])
647 AC_ARG_ENABLE(export,
648     AS_HELP_STRING([--disable-export],
649         [Disable (some) code for document export. Useful when building viewer-only apps that lack
650          save/export functionality, to avoid having an excessive amount of code and data used
651          only for exporrt linked in. Work in progress, use only if you are hacking on it.])
654 AC_ARG_ENABLE(database-connectivity,
655     AS_HELP_STRING([--disable-database-connectivity],
656         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
659 # This doesn't mean not building (or "integrating") extensions
660 # (although it probably should; i.e. it should imply
661 # --disable-extension-integration I guess), it means not supporting
662 # any extension mechanism at all
663 AC_ARG_ENABLE(extensions,
664     AS_HELP_STRING([--disable-extensions],
665         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
668 AC_ARG_ENABLE(scripting,
669     AS_HELP_STRING([--disable-scripting],
670         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
673 # This is mainly for Android and iOS, but could potentially be used in some
674 # special case otherwise, too, so factored out as a separate setting
676 AC_ARG_ENABLE(dynamic-loading,
677     AS_HELP_STRING([--disable-dynamic-loading],
678         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
681 AC_ARG_ENABLE(ext-mariadb-connector,
682     AS_HELP_STRING([--enable-ext-mariadb-connector],
683         [Enable the build of the MariaDB/MySQL Connector extension.])
686 AC_ARG_ENABLE(ext-presenter-minimizer,
687     AS_HELP_STRING([--disable-ext-presenter-minimizer],
688         [Disable the Presentation Minimizer extension.])
691 AC_ARG_ENABLE(report-builder,
692     AS_HELP_STRING([--disable-report-builder],
693         [Disable the Report Builder.])
696 AC_ARG_ENABLE(ext-wiki-publisher,
697     AS_HELP_STRING([--enable-ext-wiki-publisher],
698         [Enable the Wiki Publisher extension.])
701 AC_ARG_ENABLE(lpsolve,
702     AS_HELP_STRING([--disable-lpsolve],
703         [Disable compilation of the lp solve solver ])
706 ###############################################################################
708 dnl ---------- *** ----------
710 AC_ARG_ENABLE([hardlink-deliver],
711     AS_HELP_STRING([--enable-hardlink-deliver],
712         [Put files into deliver folder as hardlinks instead of copying them
713         over. Saves space and speeds up build.])
716 AC_ARG_ENABLE(mergelibs,
717     AS_HELP_STRING([--enable-mergelibs=<all/yes>],
718         [Enables linking of big, merged, library. Experimental feature tested
719         only on Linux and Android. All will link a lot more libraries into libmerged
720         while yes or no argument will simply enable a core set of libraries.])
723 AC_ARG_ENABLE(graphite,
724     AS_HELP_STRING([--enable-graphite],
725         [Enables the compilation of Graphite smart font rendering.])
728 AC_ARG_ENABLE(fetch-external,
729     AS_HELP_STRING([--disable-fetch-external],
730         [Disables fetching external tarballs from web sources.])
733 AC_ARG_ENABLE(lockdown,
734     AS_HELP_STRING([--disable-lockdown],
735         [Disables the gconf integration work in LibreOffice.]),
738 AC_ARG_ENABLE(vba,
739     AS_HELP_STRING([--disable-vba],
740         [Disables the vba compatibility feature.])
743 AC_ARG_ENABLE(pch,
744     AS_HELP_STRING([--enable-pch],
745         [Enables precompiled header support for C++.])
748 AC_ARG_ENABLE(win-mozab-driver,
749     AS_HELP_STRING([--enable-win-mozab-driver],
750         [LibreOffice includes a driver to connect to Mozilla
751          address books under Windows, to build with this version, use this option.])
754 AC_ARG_ENABLE(epm,
755     AS_HELP_STRING([--enable-epm],
756         [LibreOffice includes self-packaging code, that requires epm, however epm is
757          useless for large scale package building.])
760 AC_ARG_ENABLE(odk,
761     AS_HELP_STRING([--disable-odk],
762         [LibreOffice includes an ODK, office development kit which some packagers may
763          wish to build without.])
766 AC_ARG_ENABLE(mpl-subset,
767     AS_HELP_STRING([--enable-mpl-subset],
768         [Don't compile any pieces which are not MPL or more liberrally licensed])
771 AC_ARG_ENABLE(evolution2,
772     AS_HELP_STRING([--enable-evolution2],
773         [Allows the built-in evolution 2 addressbook connectivity build to be
774          enabled.])
777 AC_ARG_ENABLE(directx,
778     AS_HELP_STRING([--disable-directx],
779         [Remove DirectX implementation for the new XCanvas interface.
780          The DirectX support requires more stuff installed on Windows to
781          compile. (DirectX SDK, GDI+ libs)])
784 AC_ARG_ENABLE(activex,
785     AS_HELP_STRING([--disable-activex],
786         [Disable the use of ActiveX for a Windows build.
787         This switch is mandatory when using VC++ 2008 Express.])
790 AC_ARG_ENABLE(atl,
791     AS_HELP_STRING([--disable-atl],
792         [Disable the use of ATL for a Windows build.])
793     [
794                           This switch is mandatory when using VC++ 2008 Express.
795     ],
798 AC_ARG_ENABLE(werror,
799     AS_HELP_STRING([--enable-werror],
800         [Turn warnings to errors. (Has no effect in modules where the treating
801          of warnings as errors is disabled explicitly.)]),
804 AC_ARG_ENABLE(assert-always-abort,
805     AS_HELP_STRING([--enable-assert-always-abort],
806         [make assert() abort even in release code.]),
809 AC_ARG_ENABLE(dbgutil,
810     AS_HELP_STRING([--enable-dbgutil],
811         [Provide debugging support from --enable-debug and include additional debugging
812          utilities such as object counting or more expensive checks.
813          This is the recommended option for developers.
814          Note that this makes the build ABI incompatible, it is not possible to mix object
815          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
817 AC_ARG_ENABLE(debug,
818     AS_HELP_STRING([--enable-debug],
819         [Include debugging information, disable compiler optimization and inlining plus
820          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
822 AC_ARG_ENABLE(selective-debuginfo,
823     AS_HELP_STRING([--enable-selective-debuginfo],
824         [If --enable-debug or --enable-dbgutil is used, build debugging information
825          (-g compiler flag) only for the specified gbuild build targets
826          (where all means everything, - prepended means not to enable, / appended means
827          everything in the directory; there is no ordering, more specific overrides
828          more general, and disabling takes precedence).
829          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
831 AC_ARG_ENABLE(symbols,
832     AS_HELP_STRING([--enable-symbols],
833         [Include debugging symbols in output while preserve optimization.
834          This enables -g compiler flag for GCC or equivalent,
835          without changing anything else compared to productive code.]))
837 AC_ARG_ENABLE(compiler-plugins,
838     AS_HELP_STRING([--enable-compiler-plugins],
839         [Enable compiler plugins that will perform additional checks during
840          building. Enabled automatically by --enable-dbgutil.]))
842 AC_ARG_ENABLE(linkoo,
843     AS_HELP_STRING([--disable-linkoo],
844         [Disable linkoo for the smoketest installation.]))
846 AC_ARG_ENABLE(lto,
847     AS_HELP_STRING([--enable-lto],
848         [Enable link-time optimization. Suitable for product builds.
849          Building takes longer but libraries are optimized for speed.
850          (possible only with gcc-4.5 or later,
851           better to use gcc-4.6 and 'gold' as linker)]))
853 AC_ARG_ENABLE(crashdump,
854     AS_HELP_STRING([--enable-crashdump],
855         [Enable the crashdump feature.]))
857 AC_ARG_ENABLE(python,
858     AS_HELP_STRING([--enable-python=<no/auto/system/internal>],
859         [Enables or disables Python support at run-time and build-time.
860          Also specifies what Python to use. 'auto' is the
861          default. Note that Python can be disabled with
862          --disable-python or --enable-python=no only if no
863          translations are required.]))
865 AC_ARG_ENABLE(gtk,
866     AS_HELP_STRING([--disable-gtk],
867         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
868 ,enable_gtk=yes)
870 AC_ARG_ENABLE(gtk3,
871     AS_HELP_STRING([--enable-gtk3],
872         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
873 ,enable_gtk3=no)
875 AC_ARG_ENABLE(systray,
876     AS_HELP_STRING([--disable-systray],
877         [Determines whether to build the systray quickstarter.]),
878 ,enable_systray=yes)
880 AC_ARG_ENABLE(split-app-modules,
881     AS_HELP_STRING([--enable-split-app-modules],
882         [Split file lists for app modules, e.g. base, calc.
883          Has effect only with make distro-pack-install]),
886 AC_ARG_ENABLE(split-opt-features,
887     AS_HELP_STRING([--enable-split-opt-features],
888         [Split file lists for some optional features, .e.g. pyuno, testtool.
889          Has effect only with make distro-pack-install]),
892 AC_ARG_ENABLE(cairo-canvas,
893 [  --disable-cairo-canvas  Determines whether to build the Cairo canvas on
894                           platforms where Cairo is available.
897 AC_ARG_ENABLE(opengl,
898     AS_HELP_STRING([--disable-opengl],
899         [Determines whether to build the OpenGL 3D slide transitions component.]))
901 AC_ARG_ENABLE(dbus,
902     AS_HELP_STRING([--disable-dbus],
903         [Determines whether to enable features that depend on dbus.
904          e.g. Presentation mode screensaver control, bluetooth presentation control]),
905 ,enable_dbus=yes)
907 AC_ARG_ENABLE(packagekit,
908     AS_HELP_STRING([--enable-packagekit],
909         [Determines whether to enable features using packagekit.
910          Right now that is auto font install]),
913 AC_ARG_ENABLE(sdremote,
914     AS_HELP_STRING([--disable-sdremote],
915         [Determines whether to enable Impress remote control.]),
916 ,enable_sdremote=yes)
918 AC_ARG_ENABLE(sdremote-bluetooth,
919     AS_HELP_STRING([--disable-sdremote-bluetooth],
920         [Determines whether to build sdremote with bluetooth support.
921          Requires dbus on Linux.]))
923 AC_ARG_ENABLE(gconf,
924     AS_HELP_STRING([--disable-gconf],
925         [Determines whether to use the GConf support.]),
926 ,enable_gconf=yes)
928 AC_ARG_ENABLE(gnome-vfs,
929     AS_HELP_STRING([--enable-gnome-vfs],
930         [Determines whether to use the Gnome Virtual Filing System on platforms
931          where that VFS is available.]),
932 ,enable_gnome_vfs=no)
934 AC_ARG_ENABLE(gio,
935     AS_HELP_STRING([--disable-gio],
936         [Determines whether to use the GIO support.]),
937 ,enable_gio=yes)
939 AC_ARG_ENABLE(telepathy,
940     AS_HELP_STRING([--enable-telepathy],
941         [Determines whether to enable Telepathy for collaboration.]),
942 ,enable_telepathy=no)
944 AC_ARG_ENABLE(tde,
945     AS_HELP_STRING([--enable-tde],
946         [Determines whether to use TQt/TDE vclplug on platforms where TQt and
947          TDE are available.]),
950 AC_ARG_ENABLE(tdeab,
951     AS_HELP_STRING([--disable-tdeab],
952         [Disable the TDE address book support.]),
954     if test "$enable_tde" = "yes"; then
955         enable_tdeab=yes
956     fi
959 AC_ARG_ENABLE(kde,
960     AS_HELP_STRING([--enable-kde],
961         [Determines whether to use Qt3/KDE3 vclplug on platforms where Qt3 and
962          KDE3 are available.]),
965 AC_ARG_ENABLE(kdeab,
966     AS_HELP_STRING([--disable-kdeab],
967         [Disable the KDE3 address book support.]),
969     if test "$enable_kde" = "yes"; then
970         enable_kdeab=yes
971     fi
974 AC_ARG_ENABLE(kde4,
975     AS_HELP_STRING([--enable-kde4],
976         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
977          KDE4 are available. May be used with --enable-kde if you want to support
978          both KDE3 and KDE4.]),
981 AC_ARG_ENABLE(headless,
982     AS_HELP_STRING([--enable-headless],
983         [Disable building of GUIs to reduce dependencies. Useful for
984         server usage. Work in progress, use only if you are hacking on
985         it. Not related to the --headless option.]), ,)
987 AC_ARG_ENABLE(rpath,
988     AS_HELP_STRING([--disable-rpath],
989         [Disable the use of relative paths in shared libraries.]),
992 AC_ARG_ENABLE(randr,
993     AS_HELP_STRING([--disable-randr],
994         [Disable RandR support in the vcl project.]),
995 ,enable_randr=yes)
997 AC_ARG_ENABLE(randr-link,
998     AS_HELP_STRING([--disable-randr-link],
999         [Disable linking with libXrandr, instead dynamically open it at runtime.]),
1000 ,enable_randr_link=yes)
1002 AC_ARG_ENABLE(gstreamer,
1003     AS_HELP_STRING([--enable-gstreamer],
1004         [Enable building with the new gstreamer 1.0 avmedia backend.]),
1005 ,enable_gstreamer=no)
1007 AC_ARG_ENABLE(gstreamer-0-10,
1008     AS_HELP_STRING([--disable-gstreamer-0-10],
1009         [Disable building the gstreamer avmedia backend.]),
1010 ,enable_gstreamer_0_10=yes)
1012 AC_ARG_ENABLE(neon,
1013     AS_HELP_STRING([--disable-neon],
1014         [Disable neon and the compilation of webdav binding.]),
1017 AC_ARG_ENABLE(cve-tests,
1018     AS_HELP_STRING([--disable-cve-tests],
1019         [Prevent CVE tests to be executed]),
1022 AC_ARG_ENABLE(build-unowinreg,
1023     AS_HELP_STRING([--enable-build-unowinreg],
1024         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1025          compiler is needed on Linux.])
1026     [
1027                           Usage:     --enable-build-unowinreg
1028     ],
1031 AC_ARG_ENABLE(verbose,
1032     AS_HELP_STRING([--enable-verbose],
1033         [Increase build verbosity.])[
1034   --disable-verbose       Decrease build verbosity.],
1037 AC_ARG_ENABLE(dependency-tracking,
1038     AS_HELP_STRING([--enable-dependency-tracking],
1039         [Do not reject slow dependency extractors.])[
1040   --disable-dependency-tracking
1041                           Disables generation of dependency information.
1042                           Speed up one-time builds.],
1045 AC_ARG_ENABLE(icecream,
1046     AS_HELP_STRING([--enable-icecream],
1047         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1048          It defaults to /opt/icecream for the location of the icecream gcc/g++
1049          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1052 AC_ARG_ENABLE(cups,
1053     AS_HELP_STRING([--disable-cups],
1054         [Do not build cups support.])
1057 AC_ARG_ENABLE(ccache,
1058     AS_HELP_STRING([--disable-ccache],
1059         [Do not try to use ccache automatically.
1060          By default, we will try to detect if ccache is available; in that case if
1061          CC/CXX are not yet set, and --enable-icecream is not given, we
1062          attempt to use ccache. --disable-ccache disables ccache completely.
1066 AC_ARG_ENABLE(64-bit,
1067     AS_HELP_STRING([--enable-64-bit],
1068         [Build a 64-bit LibreOffice on platforms where the normal and only supported build
1069          is 32-bit. In other words, this option is experimental and possibly quite broken,
1070          use only if you are hacking on 64-bit support.]), ,)
1072 AC_ARG_ENABLE(extra-gallery,
1073     AS_HELP_STRING([--enable-extra-gallery],
1074         [Add extra gallery content.]),
1077 AC_ARG_ENABLE(extra-template,
1078     AS_HELP_STRING([--enable-extra-template],
1079         [Add extra template content.]),
1082 AC_ARG_ENABLE(extra-sample,
1083     AS_HELP_STRING([--enable-extra-sample],
1084         [Add extra sample content.]),
1087 AC_ARG_ENABLE(extra-font,
1088     AS_HELP_STRING([--enable-extra-font],
1089         [Add extra font content.]),
1092 AC_ARG_ENABLE(online-update,
1093     AS_HELP_STRING([--enable-online-update],
1094         [Enable the online update service that will check for new versions of
1095          LibreOffice. By default, it is on on Windows and Mac, and off on Linux.]),
1098 AC_ARG_ENABLE(release-build,
1099     AS_HELP_STRING([--enable-release-build],
1100         [Enable release build.
1101          See http://wiki.documentfoundation.org/DevBuild]),
1104 AC_ARG_ENABLE(windows-build-signing,
1105     AS_HELP_STRING([--enable-windows-build-signing],
1106         [Enable signing of windows binaries (*.exe, *.dll)]),
1109 AC_ARG_ENABLE(silent-msi,
1110     AS_HELP_STRING([--enable-silent-msi],
1111         [Enable MSI with LIMITUI=1 (silent install).]),
1114 AC_ARG_ENABLE(desktop-gui-elements,
1115     AS_HELP_STRING([--enable-desktop-gui-elements],
1116         [Enable display and use of desktop style GUI elements
1117          even on a non-desktop platform.]),
1120 AC_ARG_ENABLE(macosx-code-signing,
1121     AS_HELP_STRING([--enable-macosx-code-signing<=identity>],
1122         [Sign executables, dylibs, frameworks and the app bundle. The
1123          default is to do signing if there is a suitable certificate
1124          in your keychain, so if you don't want that, use the
1125          corresponding --disable option. Experimental work in
1126          progress, don't use unless you are working on this.]),
1129 AC_ARG_ENABLE(macosx-sandbox,
1130     AS_HELP_STRING([--enable-macosx-sandbox],
1131         [Make the app bundle run in a sandbox. Requires code signing.
1132          The default is to not do this. Experimental work in progress,
1133          don't use unless you are working on this.]),
1136 AC_ARG_WITH(macosx-bundle-identifier,
1137     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1138         [Define the OS X bundle identifier. Default is the somewhat weird
1139          org.libreoffice.script ("script", huh?).]),
1140 ,with_macosx_bundle_identifier=org.libreoffice.script)
1142 AC_ARG_ENABLE(ios-simulator,
1143     AS_HELP_STRING([--enable-ios-simulator],
1144         [Build for the iOS Simulator, not iOS device.]),
1147 AC_ARG_ENABLE(readonly-installset,
1148     AS_HELP_STRING([--enable-readonly-installset],
1149         [Prevents any attempts by LibreOffice to write into its installation. That means
1150          at least that no "system-wide" extensions can be added. Experimental work in
1151          progress.]),
1154 AC_ARG_ENABLE(postgresql-sdbc,
1155     AS_HELP_STRING([--disable-postgresql-sdbc],
1156         [Disable the build of the PostgreSQL-SDBC driver.])
1159 AC_ARG_ENABLE(lotuswordpro,
1160     AS_HELP_STRING([--disable-lotuswordpro],
1161         [Disable the build of the Lotus Word Pro filter.]),
1162 ,enable_lotuswordpro=yes)
1164 AC_ARG_ENABLE(coretext,
1165     AS_HELP_STRING([--enable-coretext],
1166         [Use CoreText framework on Mac (instead of ATSU).
1167         Known to not work properly, use only if you plan to work on that.]),
1170 AC_ARG_ENABLE(winegcc,
1171     AS_HELP_STRING([--enable-winegcc],
1172         [Enable use of winegcc during the build, in order to create msi* tools
1173          needed for MinGW cross-compilation.]),
1176 AC_ARG_ENABLE(liblangtag,
1177     AS_HELP_STRING([--disable-liblangtag],
1178         [Disable use of liblangtag, and instead use an own simple
1179          implementation.]),
1182 AC_ARG_ENABLE(bogus-pkg-config,
1183     AS_HELP_STRING([--enable-bogus-pkg-config],
1184         [MACOSX only: on MacOSX pkg-config can cause trouble. by default if one is found in the PATH, an error is issued. This flag turn that error into a warning.]),
1187 AC_ARG_ENABLE(openssl,
1188     AS_HELP_STRING([--disable-openssl],
1189         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1190          components will either use GNUTLS or NSS. Work in progress,
1191          use only if you are hacking on it.]),
1192 ,enable_openssl=yes)
1194 dnl ===================================================================
1195 dnl Optional Packages (--with/without-)
1196 dnl ===================================================================
1198 AC_ARG_WITH(gnu-patch,
1199     AS_HELP_STRING([--with-gnu-patch],
1200         [Specify location of GNU patch on Solaris or FreeBSD.]),
1203 AC_ARG_WITH(build-platform-configure-options,
1204         [Specify options for the configure script run for the *build* platform in a cross-compilation])
1206 AC_ARG_WITH(gnu-cp,
1207     AS_HELP_STRING([--with-gnu-cp],
1208         [Specify location of GNU cp on Solaris or FreeBSD.]),
1211 AC_ARG_WITH(external-tar,
1212     AS_HELP_STRING([--with-external-tar=<TARFILE PATH>],
1213         [Specify path to tarfiles manually.]),
1214     TARFILE_LOCATION=$withval ,
1217 AC_ARG_WITH(solver-and-workdir-root,
1218     AS_HELP_STRING([--with-solver-and-workdir-root=<PATH>],
1219         [Specify path that contains SOLARVER and WORKDIR directories manually.])
1222 AC_ARG_WITH(referenced-git,
1223     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1224         [Specify another checkout directory to reference. This makes use of
1225                  git submodule update --reference, and saves a lot of diskspace
1226                  when having multiple trees side-by-side.]),
1227     GIT_REFERENCE_SRC=$withval ,
1230 AC_ARG_WITH(galleries,
1231     AS_HELP_STRING([--with-galleries],
1232         [Specify how galleries should be built. It is possible either to
1233          build these internally from source ("build"), or to (optionally
1234          download and) unpack them them from a package ("package"), or
1235          to disable them ("no")]),
1238 AC_ARG_WITH(theme,
1239     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1240         [Choose which themes to include. By default those themes with an '*' are included.
1241          Possible choices: *crystal, *default (galaxy), *hicontrast, human, industrial, *oxygen, *tango, *tango_testing.]),
1244 AC_ARG_WITH(helppack-integration,
1246   --without-helppack-integration      It will not integrate the helppacks to the installer
1247                           of the product.
1248                           Please use this switch to use the online help or separate help packages.],
1251 AC_ARG_WITH(fonts,
1252     AS_HELP_STRING([--without-fonts],
1253         [LibreOffice includes some third-party fonts to provide a reliable basis for
1254          help content, templates, samples, etc. When these fonts are already
1255          known to be available on the system then you should use this option.]),
1258 AC_ARG_WITH(ppds,
1259     AS_HELP_STRING([--without-ppds],
1260         [Removes Postscript Printer definition files from LibreOffice
1261          installation set, for people building for specific distributions where
1262          PPDs are known to be already available (every recent distro with CUPS backend).]),
1265 AC_ARG_WITH(afms,
1266     AS_HELP_STRING([--without-afms],
1267         [Removes bitmap font files from LibreOffice installation set, for people
1268          building for specific distributions where AFM files or TrueType Fonts
1269          are known to be available.]),
1272 AC_ARG_WITH(epm,
1273     AS_HELP_STRING([--with-epm],
1274         [Decides which epm to use. Default is to use the one from the system if
1275          one is built. When either this is not there or you say =internal epm
1276          will be built.]),
1279 AC_ARG_WITH(package-format,
1280     AS_HELP_STRING([--with-package-format],
1281         [Specify package format(s) for LibreOffice installsets. Default is the
1282          "normal" one of the OS/Distribution. Possible values: aix, bsd, deb,
1283          inst, tardist, osx, pkg, rpm, setld, native, portable, archive, dmg,
1284           installed, msi. Example: --with-package-format="deb dmg"]),
1287 AC_ARG_WITH(tls,
1288     AS_HELP_STRING([--with-tls],
1289         [Decides which TLS/SSL and cryptographic implementations to use for
1290          LibreOffice's code. Notice that this doesn't apply for depending
1291          libraries like "neon", for example. Default is to use OpenSSL
1292          although NSS is also possible. Notice that selecting NSS restricts
1293          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1294          restrict by now the usage of NSS in LO's code. Possible values:
1295          openssl, nss. Example: --with-tls="nss"]),
1298 AC_ARG_WITH(system-libs,
1299     AS_HELP_STRING([--with-system-libs],
1300         [Use libraries already on system -- enables all --with-system-* flags.]),
1303 AC_ARG_WITH(system-headers,
1304     AS_HELP_STRING([--with-system-headers],
1305         [Use headers already on system -- enables all --with-system-* flags for
1306          external packages whose headers are the only entities used i.e.
1307          boost/vigra/odbc/sane-header(s).]),,
1308     [with_system_headers="$with_system_libs"])
1310 AC_ARG_WITH(system-jars,
1311     AS_HELP_STRING([--without-system-jars],
1312         [When building with --with-system-libs, also the needed jars are expected
1313          on the system. Use this to disable that]),,
1314     [with_system_jars="$with_system_libs"])
1316 AC_ARG_WITH(system-cairo,
1317     AS_HELP_STRING([--with-system-cairo],
1318         [Use Cairo libraries already on system.]),,
1319     [with_system_cairo="$with_system_libs"])
1321 AC_ARG_WITH(myspell-dicts,
1322     AS_HELP_STRING([--with-myspell-dicts],
1323         [Adds myspell dictionaries to the LibreOffice installation set]),
1326 AC_ARG_WITH(system-dicts,
1327     AS_HELP_STRING([--without-system-dicts],
1328         [Do not use dictionaries from system paths.]),
1331 AC_ARG_WITH(external-dict-dir,
1332     AS_HELP_STRING([--with-external-dict-dir],
1333         [Specify external dictionary dir.]),
1336 AC_ARG_WITH(external-hyph-dir,
1337     AS_HELP_STRING([--with-external-hyph-dir],
1338         [Specify external hyphenation pattern dir.]),
1341 AC_ARG_WITH(external-thes-dir,
1342     AS_HELP_STRING([--with-external-thes-dir],
1343         [Specify external thesaurus dir.]),
1346 AC_ARG_WITH(system-zlib,
1347     AS_HELP_STRING([--with-system-zlib],
1348         [Use zlib already on system.]),,
1349     [with_system_zlib=auto])
1351 AC_ARG_WITH(system-jpeg,
1352     AS_HELP_STRING([--with-system-jpeg],
1353         [Use jpeg already on system.]),,
1354     [with_system_jpeg=auto])
1356 AC_ARG_WITH(system-clucene,
1357     AS_HELP_STRING([--with-system-clucene],
1358         [Use clucene already on system.]),,
1359     [with_system_clucene="$with_system_libs"])
1361 AC_ARG_WITH(system-expat,
1362     AS_HELP_STRING([--with-system-expat],
1363         [Use expat already on system.]),,
1364     [with_system_expat="$with_system_libs"])
1366 AC_ARG_WITH(system-libxml,
1367     AS_HELP_STRING([--with-system-libxml],
1368         [Use libxml/libxslt already on system.]),,
1369     [with_system_libxml=auto])
1371 AC_ARG_WITH(system-icu,
1372     AS_HELP_STRING([--with-system-icu],
1373         [Use icu already on system.]),,
1374     [with_system_icu="$with_system_libs"])
1376 AC_ARG_WITH(system-ucpp,
1377     AS_HELP_STRING([--with-system-ucpp],
1378         [Use ucpp already on system.]),,
1379     [])
1381 AC_ARG_WITH(system-openldap,
1382     AS_HELP_STRING([--with-system-openldap],
1383         [Use the OpenLDAP LDAP SDK already on system.]),,
1384     [with_system_openldap="$with_system_libs"])
1386 AC_ARG_WITH(system-poppler,
1387     AS_HELP_STRING([--with-system-poppler],
1388         [Use system poppler (only needed for PDF import).]),,
1389     [with_system_poppler="$with_system_libs"])
1391 AC_ARG_WITH(system-apache-commons,
1392     AS_HELP_STRING([--with-system-apache-commons],
1393         [Use Apache commons libraries already on system.]),,
1394     [with_system_apache_commons="$with_system_jars"])
1396 AC_ARG_WITH(system-mariadb,
1397     AS_HELP_STRING([--with-system-mariadb],
1398         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1399          extension.]),,
1400     [with_system_mariadb="$with_system_libs"])
1402 AC_ARG_WITH(system-mysql-cppconn,
1403     AS_HELP_STRING([--with-system-mysql-cppconn],
1404         [Use MySQL C++ Connector libraries already on system.]),,
1405     [with_system_mysql_cppconn="$with_system_libs"])
1407 AC_ARG_WITH(system-postgresql,
1408     AS_HELP_STRING([--with-system-postgresql],
1409         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1410          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1411     [with_system_postgresql="$with_system_libs"])
1413 AC_ARG_WITH(libpq-path,
1414     AS_HELP_STRING([--with-libpq-path],
1415         [Use this PostgreSQL C interface (libpq) installation for building
1416          the PostgreSQL-SDBC extension.])
1417     [
1418                           Usage:     --with-libpq-path=<absolute path to
1419                                                   your libpq installation>
1420     ],
1423 AC_ARG_WITH(system-hsqldb,
1424     AS_HELP_STRING([--with-system-hsqldb],
1425         [Use hsqldb already on system.]))
1427 AC_ARG_WITH(hsqldb-jar,
1428     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1429         [Specify path to jarfile manually.]),
1430     HSQLDB_JAR=$withval)
1432 AC_ARG_ENABLE(scripting-beanshell,
1433     AS_HELP_STRING([--disable-scripting-beanshell],
1434         [Disable support for scripts in BeanShell.]),
1438 AC_ARG_WITH(system-beanshell,
1439     AS_HELP_STRING([--with-system-beanshell],
1440         [Use beanshell already on system.]),,
1441     [with_system_beanshell="$with_system_jars"])
1443 AC_ARG_WITH(beanshell-jar,
1444     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1445         [Specify path to jarfile manually.]),
1446     BSH_JAR=$withval)
1448 AC_ARG_ENABLE(scripting-javascript,
1449     AS_HELP_STRING([--disable-scripting-javascript],
1450         [Disable support for scripts in JavaScript.]),
1454 AC_ARG_WITH(system-rhino,
1455     AS_HELP_STRING([--with-system-rhino],
1456         [Use rhino already on system.]),,)
1457 #    [with_system_rhino="$with_system_jars"])
1458 # Above is not used as we have different debug interface
1459 # patched into internal rhino. This code needs to be fixed
1460 # before we can enable it by default.
1462 AC_ARG_WITH(rhino-jar,
1463     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1464         [Specify path to jarfile manually.]),
1465     RHINO_JAR=$withval)
1467 AC_ARG_WITH(commons-codec-jar,
1468     AS_HELP_STRING([--with-commons-codec-jar=JARFILE],
1469         [Specify path to jarfile manually.]),
1470     COMMONS_CODEC_JAR=$withval)
1472 AC_ARG_WITH(commons-lang-jar,
1473     AS_HELP_STRING([--with-commons-lang-jar=JARFILE],
1474         [Specify path to jarfile manually.]),
1475     COMMONS_LANG_JAR=$withval)
1477 AC_ARG_WITH(commons-httpclient-jar,
1478     AS_HELP_STRING([--with-commons-httpclient-jar=JARFILE],
1479         [Specify path to jarfile manually.]),
1480     COMMONS_HTTPCLIENT_JAR=$withval)
1482 AC_ARG_WITH(commons-logging-jar,
1483     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1484         [Specify path to jarfile manually.]),
1485     COMMONS_LOGGING_JAR=$withval)
1487 AC_ARG_WITH(system-servlet-api,
1488     AS_HELP_STRING([--with-system-servlet-api],
1489         [Use servlet-api already on system.]),,
1490     [with_system_servlet_api="$with_system_jars"])
1492 AC_ARG_WITH(servlet-api-jar,
1493     AS_HELP_STRING([--with-servlet-api-jar=JARFILE],
1494         [Specify path to jarfile manually.]),
1495     SERVLETAPI_JAR=$withval)
1497 AC_ARG_WITH(system-jfreereport,
1498     AS_HELP_STRING([--with-system-jfreereport],
1499         [Use JFreeReport already on system.]),,
1500     [with_system_jfreereport="$with_system_jars"])
1502 AC_ARG_WITH(sac-jar,
1503     AS_HELP_STRING([--with-sac-jar=JARFILE],
1504         [Specify path to jarfile manually.]),
1505     SAC_JAR=$withval)
1507 AC_ARG_WITH(libxml-jar,
1508     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1509         [Specify path to jarfile manually.]),
1510     LIBXML_JAR=$withval)
1512 AC_ARG_WITH(flute-jar,
1513     AS_HELP_STRING([--with-flute-jar=JARFILE],
1514         [Specify path to jarfile manually.]),
1515     FLUTE_JAR=$withval)
1517 AC_ARG_WITH(jfreereport-jar,
1518     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1519         [Specify path to jarfile manually.]),
1520     JFREEREPORT_JAR=$withval)
1522 AC_ARG_WITH(liblayout-jar,
1523     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1524         [Specify path to jarfile manually.]),
1525     LIBLAYOUT_JAR=$withval)
1527 AC_ARG_WITH(libloader-jar,
1528     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1529         [Specify path to jarfile manually.]),
1530     LIBLOADER_JAR=$withval)
1532 AC_ARG_WITH(libloader-jar,
1533     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1534         [Specify path to jarfile manually.]),
1535     LIBLOADER_JAR=$withval)
1537 AC_ARG_WITH(libformula-jar,
1538     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1539         [Specify path to jarfile manually.]),
1540     LIBFORMULA_JAR=$withval)
1542 AC_ARG_WITH(librepository-jar,
1543     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1544         [Specify path to jarfile manually.]),
1545     LIBREPOSITORY_JAR=$withval)
1547 AC_ARG_WITH(libfonts-jar,
1548     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1549         [Specify path to jarfile manually.]),
1550     LIBFONTS_JAR=$withval)
1552 AC_ARG_WITH(libserializer-jar,
1553     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1554         [Specify path to jarfile manually.]),
1555     LIBSERIALIZER_JAR=$withval)
1557 AC_ARG_WITH(libbase-jar,
1558     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1559         [Specify path to jarfile manually.]),
1560     LIBBASE_JAR=$withval)
1562 AC_ARG_WITH(system-odbc,
1563     AS_HELP_STRING([--with-system-odbc],
1564         [Use the odbc headers already on system.]),,
1565     [with_system_odbc="$with_system_headers"])
1567 AC_ARG_WITH(system-sane,
1568     AS_HELP_STRING([--with-system-sane],
1569         [Use sane.h already on system.]),,
1570     [with_system_sane="$with_system_headers"])
1572 AC_ARG_WITH(system-bluez,
1573     AS_HELP_STRING([--with-system-bluez],
1574         [Use bluetooth.h already on system.]),,
1575     [with_system_bluez="$with_system_headers"])
1577 AC_ARG_WITH(system-xextensions-headers,
1578     AS_HELP_STRING([--with-system-xextensions-headers],
1579         [To build without system X11 extensions headers, use
1580          --without-system-xextensions-headers. This is possibly
1581          useful on legacy unix systems which ship with the libs
1582          but without the headers.]))
1584 AC_ARG_WITH(system-mesa-headers,
1585     AS_HELP_STRING([--with-system-mesa-headers],
1586         [Use Mesa headers already on system.]),,
1587     [with_system_mesa_headers="$with_system_headers"])
1589 AC_ARG_WITH(system-curl,
1590     AS_HELP_STRING([--with-system-curl],
1591         [Use curl already on system.]),,
1592     [with_system_curl=auto])
1594 AC_ARG_WITH(system-boost,
1595     AS_HELP_STRING([--with-system-boost],
1596         [Use boost already on system.]),,
1597     [with_system_boost="$with_system_headers"])
1599 AC_ARG_WITH(system-vigra,
1600     AS_HELP_STRING([--with-system-vigra],
1601         [Use vigra already on system.]),,
1602     [with_system_vigra="$with_system_headers"])
1604 AC_ARG_WITH(system-hunspell,
1605     AS_HELP_STRING([--with-system-hunspell],
1606         [Use libhunspell already on system.]),,
1607     [with_system_hunspell="$with_system_libs"])
1609 AC_ARG_WITH(system-mythes,
1610     AS_HELP_STRING([--with-system-mythes],
1611         [Use mythes already on system.]),,
1612     [with_system_mythes="$with_system_libs"])
1614 AC_ARG_WITH(system-altlinuxhyph,
1615     AS_HELP_STRING([--with-system-altlinuxhyph],
1616         [Use ALTLinuxhyph already on system.]),,
1617     [with_system_altlinuxhyph="$with_system_libs"])
1619 AC_ARG_WITH(system-lpsolve,
1620     AS_HELP_STRING([--with-system-lpsolve],
1621         [Use lpsolve already on system.]),,
1622     [with_system_lpsolve="$with_system_libs"])
1624 AC_ARG_WITH(system-liblangtag,
1625     AS_HELP_STRING([--with-system-liblangtag],
1626         [Use liblangtag library already on system.]),,
1627     [with_system_liblangtag="$with_system_libs"])
1629 AC_ARG_WITH(system-npapi-headers,
1630     AS_HELP_STRING([--with-system-npapi-headers],
1631         [Use NPAPI headers provided by system instead of bundled ones. Used in
1632          extensions/source/nsplugin (ENABLE_NPAPI_INTO_BROWSER=YES) and
1633          extensions/source/plugin (ENABLE_NPAPI_FROM_BROWSER=YES)]),,
1634     [with_system_npapi_headers="$with_system_headers"]
1637 AC_ARG_WITH(linker-hash-style,
1638     AS_HELP_STRING([--with-linker-hash-style],
1639         [Use linker with --hash-style=<style> when linking shared objects.
1640          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1641          if supported on the build system, and "sysv" otherwise.]))
1643 AC_ARG_WITH(jdk-home,
1644     AS_HELP_STRING([--with-jdk-home],
1645         [If you have installed JDK 1.3 or later on your system please supply the
1646          path here. Note that this is not the location of the java command but the
1647          location of the entire distribution.])
1648     [
1649                           Usage:     --with-jdk-home=<absolute path to JDK home>
1650     ],
1653 AC_ARG_WITH(help,
1654     AS_HELP_STRING([--with-help],
1655         [Enable the build of help.]))
1657 AC_ARG_WITH(java,
1658     AS_HELP_STRING([--with-java],
1659         [Specify the name of the Java interpreter command. Typically "java"
1660          which is the default.
1662          To build without support for Java components, applets, accessibility
1663          or the XML filters written in Java, use --without-java or --with-java=no.])
1664     [
1665                           Usage:     --with-java==<java command>
1666                                      --without-java
1667     ],
1668     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1669     [ with_java=java ]
1672 AC_ARG_WITH(jvm-path,
1673     AS_HELP_STRING([--with-jvm-path],
1674         [Use a specific JVM search path at runtime.])
1675     [
1676                           Usage:     --with-jvm-path=<absolute path to parent of jvm home>
1678                           e. g.: --with-jvm-path=/usr/lib/
1679                                  to find JRE/JDK in /usr/lib/jvm/
1680     ],
1683 AC_ARG_WITH(ant-home,
1684     AS_HELP_STRING([--with-ant-home],
1685         [If you have installed Jakarta Ant on your system, please supply the path here.
1686          Note that this is not the location of the Ant binary but the location
1687          of the entire distribution.])
1688     [
1689                           Usage:     --with-ant-home=<absolute path to Ant home>
1690     ],
1693 AC_ARG_WITH(junit,
1694     AS_HELP_STRING([--with-junit],
1695         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
1696          --without-junit disables those tests. Not relevant in the --without-java case.])
1697     [
1698                           Usage:     --with-junit=<absolute path to JUnit 4 jar>
1699     ],
1700 ,with_junit=yes)
1702 AC_ARG_WITH(perl-home,
1703     AS_HELP_STRING([--with-perl-home],
1704         [If you have installed Perl 5 Distribution, on your system, please
1705          supply the path here. Note that this is not the location of the Perl
1706          binary but the location of the entire distribution.])
1707     [
1708                           Usage:     --with-perl-home=<abs. path to Perl 5 home>
1709     ],
1712 AC_ARG_WITH(
1713     [doxygen],
1714     AS_HELP_STRING(
1715         [--with-doxygen],
1716         [Specifies the doxygen executable to use when generating ODK C/C++
1717          documentation. --without-doxygen disables generation of ODK C/C++
1718          documentation. Not relevant in the --disable-odk case.])
1719     [
1720                           Usage:     --with-doxygen=<absolute path to doxygen executable>
1721     ],,
1722     [with_doxygen=yes])
1724 AC_ARG_WITH(visual-studio,
1725     AS_HELP_STRING([--with-visual-studio=<2012/2010/2008>],
1726         [Specify which Visual Studio version to use in case several are
1727          are installed. If not specified, the order of preference is
1728          2012, 2010 and 2008 (including Express editions).])
1729     [
1730                           Usage:     --with-visual-studio=<2012/2010/2008>
1731     ],
1734 AC_ARG_WITH(windows-sdk,
1735     AS_HELP_STRING([--with-windows-sdk=<6.0(A)/7.0(A)/7.1(A)/8.0(A)>],
1736         [Specify which Windows SDK, or "Windows Kit", version to use
1737          in case the one that came with the selected Visual Studio
1738          is not what you want for some reason. Note that not all compiler/SDK
1739          combinations are supported. The intent is that this option should not
1740          be needed.])
1741     [
1742                           Usage:     --with-windows-sdk=6.0(A)/7.0(A)/7.1(A)/8.0(A)>
1743     ],
1746 AC_ARG_WITH(lang,
1747     AS_HELP_STRING([--with-lang],
1748         [Use this option to build LibreOffice with additional language support.
1749          English (US) is always included by default.
1750          Separate multiple languages with space.
1751          For all languages, use --with-lang=ALL.])
1752     [
1753                           Usage:     --with-lang="es sw tu cs sk"
1754     ],
1757 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
1758 AC_ARG_WITH(krb5,
1759     AS_HELP_STRING([--with-krb5],
1760         [Enable MIT Kerberos 5 support in modules that support it.
1761          By default automatically enabled on platforms
1762          where a good system Kerberos 5 is available.]),
1765 AC_ARG_WITH(gssapi,
1766     AS_HELP_STRING([--with-gssapi],
1767         [Enable GSSAPI support in modules that support it.
1768          By default automatically enabled on platforms
1769          where a good system GSSAPI is available.]),
1772 dnl ===================================================================
1773 dnl Branding
1774 dnl ===================================================================
1776 AC_ARG_WITH(branding,
1777     AS_HELP_STRING([--with-branding],
1778         [Use given path to retrieve branding images set.])
1779     [
1780                           Search for intro.png about.svg flat_logo.svg 
1781                           backing_left.png backing_right.png 
1782                           backing_rtl_left.png backing_rtl_right.png 
1783                           backing_space.png. If any is missing, default
1784                           ones will be used instead.
1786                           Search also progress.conf for progress 
1787                           settings on intro screen :
1789                           PROGRESSBARCOLOR="255,255,255" Set color of 
1790                           progress bar. Comma separated RGB decimal values.
1791                           PROGRESSSIZE="407,6" Set size of progress bar. 
1792                           Comma separated decimal values (width, height).
1793                           PROGRESSPOSITION="61,317" Set position of progress
1794                           bar from left,top. Comma separated decimal values.
1795                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
1796                           bar frame. Comma separated RGB decimal values.
1797                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress 
1798                           bar text. Comma separated RGB decimal values.
1799                           PROGRESSTEXTBASELINE="287" Set vertical position of 
1800                           progress bar text from top. Decimal value.
1802                           Default values will be used if not found.
1804                           Usage:     --with-branding=/path/to/images
1805     ],
1809 AC_ARG_WITH(extra-buildid,
1810     AS_HELP_STRING([--with-extra-buildid],
1811         [Show addition build identification in about dialog.])
1812     [
1813                           Usage:     --with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"
1814     ],
1818 AC_ARG_WITH(vendor,
1819     AS_HELP_STRING([--with-vendor],
1820         [Set vendor of the build.])
1821     [
1822                           Usage:     --with-vendor="John the Builder"
1823     ],
1826 AC_ARG_WITH(compat-oowrappers,
1827     AS_HELP_STRING([--with-compat-oowrappers],
1828         [Install oo* wrappers in parallel with
1829          lo* ones to keep backward compatibility.
1830          Has effect only with make distro-pack-install]),
1833 AC_ARG_WITH(os-version,
1834     AS_HELP_STRING([--with-os-version],
1835         [For FreeBSD users, use this option option to override the detected OSVERSION.])
1836     [
1837                           Usage:     --with-os-version=<OSVERSION>
1838     ],
1841 AC_ARG_WITH(mingw-cross-compiler,
1842     AS_HELP_STRING([--with-mingw-cross-compiler],
1843         [Specify the MinGW cross-compiler to use.])
1844     [
1845                           Usage:     --with-mingw-cross-compiler=<mingw32-g++ command>
1847                           When building on the ODK on Unix and building unowinreg.dll,
1848                           specify the MinGW C++ cross-compiler.
1849     ],
1852 AC_ARG_WITH(idlc-cpp,
1853     AS_HELP_STRING([--with-idlc-cpp],
1854         [Specify the C Preprocessor to use for idlc.])
1855     [
1856                           Usage:     --with-idlc-cpp=cpp
1858                           Default is ucpp.
1859     ]
1862 AC_ARG_WITH(build-version,
1863     AS_HELP_STRING([--with-build-version],
1864         [Allows the builder to add a custom version tag that will appear in the
1865          Help/About box for QA purposes.])
1866     [
1867                           Usage:     --with-build-version="Built by Jim"
1868     ],
1869     with_build_version=$withval ,
1872 AC_ARG_WITH(alloc,
1873     AS_HELP_STRING([--with-alloc],
1874         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
1875          Note that on FreeBSD/NetBSD system==jemalloc]),
1878 AC_ARG_WITH(sun-templates,
1879     AS_HELP_STRING([--with-sun-templates],
1880         [Integrate Sun template packages.]),
1883 AC_ARG_WITH(parallelism,
1884     AS_HELP_STRING([--with-parallelism],
1885         [Number of jobs to run simultaneously during build. Parallel builds can
1886         save a lot of time on multi-cpu machines. Defaults to the number of
1887         CPUs on the machine, unless you configure --enable-icecream - then to
1888         10.]),
1891 AC_ARG_WITH(check-jobs,
1892     AS_HELP_STRING([--with-check-jobs],
1893         [Maximum number of jobs that will be issued at the same time during 'make subsequenttest'.
1894          Default value is the same as 'parallelism'. Useful because the subsequent tests are very lightweight.]),
1897 AC_ARG_WITH(all-tarballs,
1898     AS_HELP_STRING([--with-all-tarballs],
1899         [Download all external tarballs unconditionally]))
1901 dnl ===================================================================
1902 dnl Test whether build target is Release Build
1903 dnl ===================================================================
1904 AC_MSG_CHECKING([whether build target is Release Build])
1905 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
1906     AC_MSG_RESULT([no])
1907     ENABLE_RELEASE_BUILD="FALSE"
1908 else
1909     AC_MSG_RESULT([yes])
1910     ENABLE_RELEASE_BUILD="TRUE"
1912 AC_SUBST(ENABLE_RELEASE_BUILD)
1914 dnl ===================================================================
1915 dnl Test whether to sign Windows Build
1916 dnl ===================================================================
1917 AC_MSG_CHECKING([whether to sign windows build])
1918 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT" -a "$WITH_MINGW" != "YES" ; then
1919     AC_MSG_RESULT([yes])
1920     WINDOWS_BUILD_SIGNING="TRUE"
1921 else
1922     AC_MSG_RESULT([no])
1923     WINDOWS_BUILD_SIGNING="FALSE"
1925 AC_SUBST(WINDOWS_BUILD_SIGNING)
1927 dnl ===================================================================
1928 dnl MacOSX build and runtime environment options
1929 dnl ===================================================================
1931 AC_ARG_WITH(macosx-sdk,
1932     AS_HELP_STRING([--with-macosx-sdk],
1933         [Use a specific SDK for building.])
1934     [
1935                           Usage:     --with-macosx-sdk=<version>
1937                           e. g.: --with-macosx-sdk=10.6
1939                           there are 3 options to control the MacOSX build:
1940                           --with-macosx-sdk (refered as 'sdk' below)
1941                           --with-macosx-version-min-required (refered as 'min' below)
1942                           --with-macosx-version-max-allowed (refered as 'max' below)
1944                           the connection between these value and the default they take is as follow:
1945                           ( ? means not specified on the command line, s means the SDK version found,
1946                           constraint: x <= y <= z)
1948                           ==========================================
1949                            command line      || config result
1950                           ==========================================
1951                           min  | max  | sdk  || min  | max  | sdk  |
1952                           ?    | ?    | ?    || 10.6 | 10.s | 10.s |
1953                           ?    | ?    | 10.x || 10.6 | 10.x | 10.x |
1954                           ?    | 10.x | ?    || 10.6 | 10.s | 10.s |
1955                           ?    | 10.x | 10.y || 10.6 | 10.x | 10.y |
1956                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
1957                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
1958                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
1959                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
1962                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
1963                           for a detailled technical explanation of these variables
1965                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
1967                           Note that even if in theory using a --with-macosx-version-max-allowed
1968                           (i.e. the MAC_OS_X_VERSION_MAX_ALLOWED macro) less than the SDK version
1969                           should work, in practice Apple doesn't seem to test that, and at least
1970                           compiling with -DMAC_OS_X_VERSION_MAX_ALLOWED=1060 against the 10.7 SDK
1971                           fails in a couple of places. Just because of oversights in ifdefs in the SDK
1972                           headers, but still.
1973     ],
1976 AC_ARG_WITH(macosx-version-min-required,
1977     AS_HELP_STRING([--with-macosx-version-min-required],
1978         [set the minimum OS version needed to run the built LibreOffice])
1979     [
1980                           Usage:     --with-macosx-version-min-required=<version>
1982                           e. g.: --with-macos-version-min-required=10.6
1983                           see --with-macosx-sdk for more info
1984     ],
1987 AC_ARG_WITH(macosx-version-max-allowed,
1988     AS_HELP_STRING([--with-macosx-version-max-allowed],
1989         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
1990     [
1991                           Usage:     --with-macosx-version-max-allowed=<version>
1993                           e. g.: --with-macos-version-max-allowed=10.6
1994                           see --with-macosx-sdk for more info
1995     ],
1999 dnl ===================================================================
2000 dnl options for stuff used during cross-compilation build
2001 dnl These are superseded by --with-build-platform-configure-options.
2002 dnl Or are they? Look for the complicated tests for "$cross_compiling" = "yes" -a \(
2003 dnl "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \)
2004 dnl far below. Could whoever understands MinGW cross-compilation clean up this please.
2005 dnl ===================================================================
2007 AC_ARG_WITH(system-boost-for-build,
2008     AS_HELP_STRING([--with-system-boost-for-build],
2009         [Use boost already on system for build tools (cross-compilation only).]))
2011 AC_ARG_WITH(system-cppunit-for-build,
2012     AS_HELP_STRING([--with-system-cppunit-for-build],
2013         [Use cppunit already on system for build tools (cross-compilation only).]))
2015 AC_ARG_WITH(system-expat-for-build,
2016     AS_HELP_STRING([--with-system-expat-for-build],
2017         [Use expat already on system for build tools (cross-compilation only).]))
2019 AC_ARG_WITH(system-icu-for-build,
2020     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2021         [Use icu already on system for build tools (cross-compilation only).]))
2023 AC_ARG_WITH(system-libxml-for-build,
2024     AS_HELP_STRING([--with-system-libxml-for-build],
2025         [Use libxml/libxslt already on system for build tools (cross-compilation only).]))
2028 dnl ===================================================================
2029 dnl check for required programs (grep, awk, sed, bash)
2030 dnl ===================================================================
2032 pathmunge ()
2034     if test -n "$1"; then
2035         if test "$build_os" = "cygwin"; then
2036             PathFormat "$1"
2037             new_path=`cygpath -u "$formatted_path"`
2038         else
2039             new_path="$1"
2040         fi
2041         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2042             if test "$2" = "after"; then
2043                 LO_PATH="$LO_PATH:$new_path"
2044             else
2045                 LO_PATH="$new_path:$LO_PATH"
2046             fi
2047         fi
2048         unset new_path
2049     fi
2052 AC_PROG_AWK
2053 AC_PATH_PROG( AWK, $AWK)
2054 if test -z "$AWK"; then
2055     AC_MSG_ERROR([install awk to run this script])
2058 AC_PATH_PROG(BASH, bash)
2059 if test -z "$BASH"; then
2060     AC_MSG_ERROR([bash not found in \$PATH])
2062 AC_SUBST(BASH)
2064 AC_MSG_CHECKING([for GNU or BSD tar])
2065 for a in $GNUTAR gtar gnutar tar /usr/sfw/bin/gtar; do
2066     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2067     if test $? -eq 0;  then
2068         GNUTAR=$a
2069         break
2070     fi
2071 done
2072 AC_MSG_RESULT($GNUTAR)
2073 if test -z "$GNUTAR"; then
2074     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2076 AC_SUBST(GNUTAR)
2078 AC_MSG_CHECKING([for tar's option to strip components])
2079 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2080 if test $? -eq 0; then
2081     STRIP_COMPONENTS="--strip-components"
2082 else
2083     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2084     if test $? -eq 0; then
2085         STRIP_COMPONENTS="--strip-path"
2086     else
2087         STRIP_COMPONENTS="unsupported"
2088     fi
2090 AC_MSG_RESULT($STRIP_COMPONENTS)
2091 if test x$STRIP_COMPONENTS == xunsupported; then
2092     AC_MSG_ERROR([you need a tar that is able to strip components.])
2094 AC_SUBST(STRIP_COMPONENTS)
2096 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2097 dnl desktop OSes from "mobile" ones.
2099 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2100 dnl In other words, that when building for an OS that is not a
2101 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2103 dnl Note the direction of the implication; there is no assumption that
2104 dnl cross-compiling would imply a non-desktop OS.
2106 if test $_os != iOS -a $_os != Android; then
2107     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2108     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2109     AC_DEFINE(HAVE_FEATURE_DESKTOP_GUI_ELEMENTS)
2110     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2111 elif test "$enable_desktop_gui_elements" = yes; then
2112     AC_DEFINE(HAVE_FEATURE_DESKTOP_GUI_ELEMENTS)
2115 DISABLE_EXPORT=''
2116 if test "$enable_export" != no; then
2117     BUILD_TYPE="$BUILD_TYPE EXPORT"
2118 else
2119     DISABLE_EXPORT='TRUE'
2120     SCPDEFS="$SCPDES -DDISABLE_EXPORT"
2122 AC_SUBST(DISABLE_EXPORT)
2124 dnl Decide whether to build database connectivity stuff (including
2125 dnl Base) or not. We probably don't want to on non-desktop OSes.
2127 if test -z "$enable_database_connectivity"; then
2128     # Do enable database connectivity for Android for now as otherwise
2129     # we presumably will get linking errors... We are not as far in
2130     # the work for iOS, so we might as well disable it for iOS already.
2132     # And actually, do enable it for iOS, too. Let's get back to
2133     # figuring out what to do with this later, if ever.
2135     # (Note that with "enable", I mean "enable building the related
2136     # code". Very likely little of it will make any sense at run-time
2137     # on Android or iOS and won't even be shipped with/linked into any
2138     # app.)
2140     #if test $_os != iOS; then
2141         enable_database_connectivity=yes
2142     #fi
2145 DISABLE_DBCONNECTIVITY=''
2146 if test "$enable_database_connectivity" = yes; then
2147     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2148 else
2149     DISABLE_DBCONNECTIVITY='TRUE'
2150     SCPDEFS="$SCPDEFS -DDISABLE_DBCONNECTIVITY"
2152 AC_SUBST(DISABLE_DBCONNECTIVITY)
2154 if test -z "$enable_extensions"; then
2155     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2156     if test $_os != iOS -a $_os != Android; then
2157         enable_extensions=yes
2158     fi
2161 if test "$enable_extensions" = yes; then
2162     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2163     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2166 if test -z "$enable_scripting"; then
2167     # Disable scripting for iOS unless specifically overridden
2168     # with --enable-scripting.
2169     if test $_os != iOS; then
2170         enable_scripting=yes
2171     fi
2174 DISABLE_SCRIPTING=''
2175 if test "$enable_scripting" = yes; then
2176     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2177 else
2178     DISABLE_SCRIPTING='TRUE'
2179     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2181 AC_SUBST(DISABLE_SCRIPTING)
2183 if test $_os = iOS -o $_os = Android; then
2184     # Disable dynamic_loading always for iOS and Android
2185     enable_dynamic_loading=no
2186 elif test -z "$enable_dynamic_loading"; then
2187     # Otherwise enable it unless speficically disabled
2188     enable_dynamic_loading=yes
2191 DISABLE_DYNLOADING=''
2192 if test "$enable_dynamic_loading" = yes; then
2193     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2194 else
2195     DISABLE_DYNLOADING='TRUE'
2196     SCPDEFS="$SCPDEFS -DDISABLE_DYNLOADING"
2198 AC_SUBST(DISABLE_DYNLOADING)
2200 if test -n "${with_solver_and_workdir_root}"; then
2201     if ! test -d ${with_solver_and_workdir_root}; then
2202       AC_MSG_ERROR([directory does not exist: ${with_solver_and_workdir_root}])
2203     fi
2204     PathFormat "${with_solver_and_workdir_root}"
2205     # IsValidFilePath in /sal/osl/w32/file_url.cxx rejects "X:\\" breaking idlc
2206     if echo ${formatted_path} | $GREP -q '/$'; then
2207         SOLARVER=${formatted_path}solver
2208     else
2209         SOLARVER=${formatted_path}/solver
2210     fi
2211 else
2212     SOLARVER=${BUILDDIR}/solver
2215 # remenber SYSBASE value
2216 AC_SUBST(SYSBASE)
2218 dnl ===================================================================
2219 dnl  Sort out various gallery compilation options
2220 dnl ===================================================================
2221 AC_MSG_CHECKING([how to build and package galleries])
2222 if test -n "${with_galleries}"; then
2223     if test "$with_galleries" = "build"; then
2224         WITH_GALLERY_BUILD=YES
2225         AC_MSG_RESULT([build from source images internally])
2226     elif test "$with_galleries" = "package"; then
2227         WITH_GALLERY_BUILD=PACKAGE
2228         AC_MSG_ERROR([FIXME - implement build from pre-compiled package])
2229     elif test "$with_galleries" = "no"; then
2230         WITH_GALLERY_BUILD=
2231         AC_MSG_RESULT([disable non-internal gallery build])
2232     else
2233         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2234     fi
2235 else
2236    if test $_os != iOS -a $_os != Android; then
2237         WITH_GALLERY_BUILD=YES
2238         AC_MSG_RESULT([internal src images for desktop])
2239    else
2240         WITH_GALLERY_BUILD=
2241         AC_MSG_RESULT([disable src imgage build])
2242    fi
2244 AC_SUBST(WITH_GALLERY_BUILD)
2246 dnl ===================================================================
2247 dnl  Checks if ccache is available
2248 dnl ===================================================================
2249 if test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2250     case "%$CC%$CXX%" in
2251     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some verison number etc),
2252     # assume that's good then
2253     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2254         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2255         ;;
2256     *)
2257         AC_PATH_PROG([CCACHE],[ccache],[not found])
2258         if test "$CCACHE" = "not found"; then
2259             CCACHE=""
2260         else
2261             # Need to check for ccache version: otherwise prevents
2262             # caching of the results (like "-x objective-c++" for Mac)
2263             if test $_os = Darwin -o $_os = iOS; then
2264                 # Check ccache version
2265                 AC_MSG_CHECKING([whether version of ccache is suitable])
2266                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2267                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2268                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2269                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2270                 else
2271                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2272                     CCACHE=""
2273                 fi
2274             fi
2275         fi
2276         ;;
2277     esac
2278 else
2279     CCACHE=""
2282 if test "$CCACHE" != ""; then
2283     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2284     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2285     if test "$ccache_size" = ""; then
2286         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2287         if test "$ccache_size" = ""; then
2288             ccache_size=0
2289         fi
2290         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2291         if test $ccache_size -lt 1024; then
2292             CCACHE=""
2293             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-producive: Disabling auto-ccache detection])
2294             add_warning "ccache's cache size is less than 1GB using it is counter-producive: auto-ccache detection disabled"
2295         else
2296             # warn that ccache may be too small for debug build
2297             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build])
2298             add_warning "ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build"
2299         fi
2300     else
2301         if test $ccache_size -lt 5; then
2302             #warn that ccache may be too small for debug build
2303             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build])
2304             add_warning "ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build"
2305         fi
2306     fi
2309 dnl ===================================================================
2310 dnl  Checks for C compiler,
2311 dnl  The check for the C++ compiler is later on.
2312 dnl ===================================================================
2313 if test "$_os" != "WINNT" -a "$WITH_MINGW" != "yes"; then
2314     GCC_HOME_SET="true"
2315     AC_MSG_CHECKING([gcc home])
2316     if test -z "$with_gcc_home"; then
2317         if test "$enable_icecream" = "yes"; then
2318             if test -d "/usr/lib/icecc/bin"; then
2319                 GCC_HOME="/usr/lib/icecc/"
2320             else
2321                 GCC_HOME="/opt/icecream/"
2322             fi
2323         else
2324             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2325             GCC_HOME_SET="false"
2326         fi
2327     else
2328         GCC_HOME="$with_gcc_home"
2329     fi
2330     AC_MSG_RESULT($GCC_HOME)
2331     AC_SUBST(GCC_HOME)
2333     if test "$GCC_HOME_SET" = "true"; then
2334         if test -z "$CC"; then
2335             CC="$GCC_HOME/bin/gcc"
2336         fi
2337         if test -z "$CXX"; then
2338             CXX="$GCC_HOME/bin/g++"
2339         fi
2340     fi
2343 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
2344 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
2345     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
2346     save_CFLAGS=$CFLAGS
2347     AC_PROG_CC
2348     CFLAGS=$save_CFLAGS
2351 COMPATH=`dirname "$CC"`
2352 if test "$COMPATH" = "."; then
2353     AC_PATH_PROGS(COMPATH, $CC)
2354     dnl double square bracket to get single because of M4 quote...
2355     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2357 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2359 dnl ===================================================================
2360 dnl  Test the Solaris compiler version
2361 dnl ===================================================================
2362 if test "$_os" = "SunOS"; then
2363     if test "$CC" = "cc"; then
2364         AC_PATH_PROGS(_cc, cc)
2365         COMPATH=`echo $_cc | $SED -n "s/\/bin\/cc//p"`
2366         AC_MSG_CHECKING([the SunStudio C/C++ compiler version])
2367         dnl cc -V outputs to standard error!!!!
2368         _sunstudio_string=`$CC -V 2>&1 | grep '^cc' | $SED -e 's/.* C //'`
2369         _sunstudio_version=`echo $_sunstudio_string | $AWK '{ print $1 }'`
2370         _sunstudio_major=`echo $_sunstudio_version | $AWK -F. '{ print $1 }'`
2371         if test "$_sunstudio_major" != "5"; then
2372             AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2373         else
2374             _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" }'`
2375             if test "$_sunstudio_minor" = "false"; then
2376                 AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2377             else
2378                 dnl compiler will do
2379                 AC_MSG_RESULT([checked])
2380             fi
2381         fi
2382     fi
2386 dnl ===================================================================
2387 dnl Check / find MacOSX SDK and compiler, version checks
2388 dnl ===================================================================
2389 if test "$_os" = "Darwin"; then
2391     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
2392         bitness=-m32
2393     else
2394         bitness=-m64
2395         BITNESS_OVERRIDE=64
2396     fi
2398     # If no --with-macosx-sdk option is given, look for 10.6, 10.7
2399     # and 10.8 SDKs, in that order. If not found in some (old)
2400     # default locations, try the xcode-select tool.
2402     # The intent is that for "most" Mac-based developers, a suitable
2403     # SDK will be found automatically without any configure options.
2405     # For developers still using Xcode 3, in /Developer, either
2406     # because it is the only Xcode they have, or they have that in
2407     # addition to Xcode 4 in /Applications/Xcode.app, the 10.6 SDK
2408     # should be found.
2410     # For developers with a current Xcode 4 installed from the Mac App
2411     # Store, the 10.6, 10.7 or 10.8 SDK should be found.
2413     AC_MSG_CHECKING([what Mac OS X SDK to use])
2415     if test -z "$with_macosx_sdk"; then
2416         if test -d /Developer/SDKs/MacOSX10.6.sdk; then
2417             with_macosx_sdk=10.6
2418         elif test -d /Developer-old/SDKs/MacOSX10.6.sdk; then
2419             with_macosx_sdk=10.6
2420         elif test -d /Xcode3/SDKs/MacOSX10.6.sdk; then
2421             with_macosx_sdk=10.6
2422         elif test -d /Developer/SDKs/MacOSX10.7.sdk; then
2423             with_macosx_sdk=10.7
2424         elif test -x /usr/bin/xcode-select; then
2425             xcodepath="`xcode-select -print-path`"
2426             if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk"; then
2427                 with_macosx_sdk=10.6
2428             elif test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"; then
2429                 with_macosx_sdk=10.7
2430             elif test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk"; then
2431                 with_macosx_sdk=10.8
2432             fi
2433         fi
2434         if test -z "$with_macosx_sdk"; then
2435             AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2436         fi
2437     fi
2439     case $with_macosx_sdk in
2440     10.6)
2441         MACOSX_SDK_VERSION=1060
2442         ;;
2443     10.7)
2444         MACOSX_SDK_VERSION=1070
2445         ;;
2446     10.8)
2447         MACOSX_SDK_VERSION=1080
2448         ;;
2449     *)
2450         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported value are 10.6--8])
2451         ;;
2452     esac
2454     # Next find it (again, if we deduced its version above by finding
2455     # it... but we need to look for it once more in case
2456     # --with-macosx-sdk was given so that the aboce search did not
2457     # happen).
2458     if test -z "$MACOSX_SDK_PATH"; then
2459         case $with_macosx_sdk in
2460         10.6)
2461             if test -d /Developer/SDKs/MacOSX10.6.sdk; then
2462                 MACOSX_SDK_PATH=/Developer/SDKs/MacOSX10.6.sdk
2463             elif test -d /Developer-old/SDKs/MacOSX10.6.sdk; then
2464                 MACOSX_SDK_PATH=/Developer-old/SDKs/MacOSX10.6.sdk
2465             elif test -d /Xcode3/SDKs/MacOSX10.6.sdk; then
2466                 MACOSX_SDK_PATH=/Xcode3/SDKs/MacOSX10.6.sdk
2467             elif test -x /usr/bin/xcode-select; then
2468                 xcodepath="`xcode-select -print-path`"
2469                 if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2470                     MACOSX_SDK_PATH="$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"
2471                 fi
2472             fi
2473             ;;
2474         10.7|10.8)
2475             if test -d /Developer/SDKs/MacOSX$with_macosx_sdk.sdk; then
2476                 MACOSX_SDK_PATH=/Developer/SDKs/MacOSX$with_macosx_sdk.sdk
2477             elif test -x /usr/bin/xcode-select; then
2478                 xcodepath="`xcode-select -print-path`"
2479                 if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2480                     MACOSX_SDK_PATH="$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"
2481                 fi
2482             fi
2483             ;;
2484         esac
2485         if test -z "$MACOSX_SDK_PATH"; then
2486             AC_MSG_ERROR([Could not figure out the location of Mac OS X $with_macosx_sdk SDK])
2487         fi
2488     fi
2489     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2491     if test "$with_macosx_version_min_required" = ""; then
2492         with_macosx_version_min_required="10.6"
2493     fi
2495     if test "$with_macosx_version_max_allowed" = ""; then
2496         with_macosx_version_max_allowed="$with_macosx_sdk"
2497     fi
2499     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2500     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2502     case "$with_macosx_version_min_required" in
2503     10.6)
2504         MAC_OS_X_VERSION_MIN_REQUIRED="1060"
2505         ;;
2506     10.7)
2507         MAC_OS_X_VERSION_MIN_REQUIRED="1070"
2508         ;;
2509     10.8)
2510         MAC_OS_X_VERSION_MIN_REQUIRED="1080"
2511         ;;
2512     *)
2513         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported value are 10.6--8])
2514         ;;
2515     esac
2517     if test "$BITNESS_OVERRIDE" = ""; then
2518         case "$with_macosx_version_min_required" in
2519         10.6)
2520             case "$with_macosx_sdk" in
2521             10.6)
2522                 ;;
2523             *)
2524                 AC_MSG_WARN([Building with a SDK > 10.6 possibly breaks 10.6 compatibility. Do not use for the TDF build])
2525                 add_warning "Building with a SDK > 10.6 possibly breaks 10.6 compatibility. Do not use for the TDF build"
2526                 ;;
2527             esac
2528             ;;
2529         *)
2530             AC_MSG_WARN([Building with a minimum version requirement > 10.6 breaks 10.6 compatibility. Do not use for the TDF build])
2531             add_warning "Building with a minimum version requirement > 10.6 breaks 10.6 compatibility. Do not use for the TDF build"
2532             ;;
2533         esac
2534     fi
2536     # If no CC and CXX environment vars, try to guess where the compiler is
2537     if test -z "$save_CC"; then
2538         AC_MSG_CHECKING([what compiler to use])
2539         case $with_macosx_sdk in
2540         10.6)
2541             # did someone copy her 10.6 sdk into xcode 4 (needed on Mountain Lion)?
2542             if test "$(echo $MACOSX_SDK_PATH | cut -c1-23)" = "/Applications/Xcode.app"; then
2543                 CC="`xcrun -find gcc` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2544                 CXX="`xcrun -find g++` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2545                 XCRUN=xcrun
2546             else
2547                 CC="gcc-4.2 $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2548                 CXX="g++-4.2 $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2549             fi
2550             ;;
2551         10.7|10.8)
2552             CC="`xcrun -find clang` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2553             CXX="`xcrun -find clang++` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2554             XCRUN=xcrun
2555             ;;
2556         esac
2557         AC_MSG_RESULT([$CC and $CXX])
2558     fi
2560     case "$with_macosx_version_max_allowed" in
2561     10.6)
2562         MAC_OS_X_VERSION_MAX_ALLOWED="1060"
2563         ;;
2564     10.7)
2565         MAC_OS_X_VERSION_MAX_ALLOWED="1070"
2566         ;;
2567     10.8)
2568         MAC_OS_X_VERSION_MAX_ALLOWED="1080"
2569         ;;
2570     *)
2571         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported value are 10.6--8])
2572         ;;
2573     esac
2575     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2576     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2577         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2578     else
2579         AC_MSG_RESULT([ok])
2580     fi
2582     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2583     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2584         AC_MSG_ERROR([the version maximum allowed cannot be greater thatn the sdk level])
2585     else
2586         AC_MSG_RESULT([ok])
2587     fi
2588     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2589     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2591     AC_MSG_CHECKING([whether to do code signing])
2593     if test "$enable_macosx_code_signing" = yes; then
2594         # By default use the first suitable certificate (?).
2596         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2597         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2598         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2599         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the the
2600         # "Developer ID Application" one.
2602         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | awk '{print $2}' |head -1`
2603         if test -n "$identity"; then
2604             MACOSX_CODESIGNING_IDENTITY=$identity
2605             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2606             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2607         fi
2608     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2609         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2610         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2611         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2612     else
2613         AC_MSG_RESULT([no])
2614     fi
2616     AC_MSG_CHECKING([whether to sandbox the application])
2618     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2619         AC_MSG_ERROR([OS X sandboxing requires code signing])
2620     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2621         ENABLE_MACOSX_SANDBOX=YES
2622         AC_MSG_RESULT([yes])
2623     else
2624         AC_MSG_RESULT([no])
2625     fi
2627     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2629     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2631     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2633 AC_SUBST(MACOSX_SDK_PATH)
2634 AC_SUBST(MACOSX_SDK_VERSION)
2635 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2636 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2637 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2638 AC_SUBST(XCRUN)
2639 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2640 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2641 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2643 dnl ===================================================================
2644 dnl Check / find iOS SDK and compiler, version checks
2645 dnl ===================================================================
2646 if test $_os = iOS; then
2648     AC_MSG_CHECKING([what iOS SDK to use])
2650     if test "$enable_ios_simulator" = yes; then
2651         platform=iPhoneSimulator
2652         versionmin=-mmacosx-version-min=10.7
2653         arch=i386
2654     else
2655         platform=iPhoneOS
2656         versionmin=-miphoneos-version-min=5.0
2657         arch=armv7
2658     fi
2660     pref_sdk_ver=6.1
2661     for I in 6.1 6.0; do
2662         t=/Applications/Xcode.app/Contents/Developer/Platforms/$platform.platform/Developer/SDKs/$platform$I.sdk
2663         if test -d $t; then
2664             sysroot=$t
2665             break
2666         fi
2667     done
2669     if test -z "$sysroot"; then
2670         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}])
2671     fi
2673     AC_MSG_RESULT($sysroot)
2675     CXX="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch $arch -isysroot $sysroot $versionmin"
2676     CC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch $arch -isysroot $sysroot $versionmin"
2679 AC_MSG_CHECKING([whether to treat the installation as read-only])
2681 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = YES \) -o \
2682         "$enable_extensions" != yes; then
2683     enable_readonly_installset=yes
2685 if test "$enable_readonly_installset" = yes; then
2686     AC_MSG_RESULT([yes])
2687     ENABLE_READONLY_INSTALLSET=YES
2688 else
2689     AC_MSG_RESULT([no])
2691 AC_SUBST(ENABLE_READONLY_INSTALLSET)
2693 dnl ===================================================================
2694 dnl Windows specific tests and stuff
2695 dnl ===================================================================
2697 reg_get_value()
2699     # Return value: $regvalue
2700     unset regvalue
2701     _regvalue=`cat "/proc/registry/$1" 2> /dev/null`
2703     if test $? -eq 0; then
2704         regvalue=$_regvalue
2705     fi
2709 if test "$_os" = "WINNT" -a "$WITH_MINGW" != yes; then
2710     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
2711     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
2712         AC_MSG_RESULT([no])
2713         WINDOWS_SDK_ARCH="x86"
2714     else
2715         AC_MSG_RESULT([yes])
2716         WINDOWS_SDK_ARCH="x64"
2717         BITNESS_OVERRIDE=64
2718     fi
2720     AC_MSG_CHECKING([whether to use DirectX])
2721     if test "$enable_directx" = "yes" -o "$enable_directx" = ""; then
2722         ENABLE_DIRECTX="TRUE"
2723         AC_MSG_RESULT([yes])
2724     else
2725         ENABLE_DIRECTX=""
2726         AC_MSG_RESULT([no])
2727     fi
2729     AC_MSG_CHECKING([whether to use ActiveX])
2730     if test "$enable_activex" = "yes" -o "$enable_activex" = ""; then
2731         DISABLE_ACTIVEX=""
2732         SCPDEFS="$SCPDEFS -DWITH_ACTIVEX_COMPONENT"
2733         AC_MSG_RESULT([yes])
2734     else
2735         DISABLE_ACTIVEX="TRUE"
2736         AC_MSG_RESULT([no])
2737     fi
2739     AC_MSG_CHECKING([whether to use ATL])
2740     if test "$enable_atl" = "yes" -o "$enable_atl" = ""; then
2741         DISABLE_ATL=""
2742         AC_MSG_RESULT([yes])
2743     else
2744         DISABLE_ATL="TRUE"
2745         AC_MSG_RESULT([no])
2746     fi
2747 else
2748     ENABLE_DIRECTX=""
2749     DISABLE_ACTIVEX="TRUE"
2750     DISABLE_ATL="TRUE"
2753 AC_SUBST(ENABLE_DIRECTX)
2754 AC_SUBST(DISABLE_ACTIVEX)
2755 AC_SUBST(DISABLE_ATL)
2757 if test "$cross_compiling" = "yes"; then
2758     CROSS_COMPILING=YES
2759     SCPDEFS="$SCPDEFS -DCROSS_COMPILING"
2760 else
2761     CROSS_COMPILING=
2762     BUILD_TYPE="$BUILD_TYPE NATIVE"
2764 AC_SUBST(CROSS_COMPILING)
2766 dnl ===================================================================
2767 dnl  Test the gcc version
2768 dnl ===================================================================
2769 if test "$GCC" = "yes"; then
2770     AC_MSG_CHECKING([the GCC version])
2771     _gcc_version=`$CC -dumpversion`
2772     _gcc_major=`echo $_gcc_version | $AWK -F. '{ print \$1 }'`
2773     GCCVER=`echo $_gcc_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2775     AC_MSG_RESULT([gcc $_gcc_version])
2776     if test "$GCCVER" -lt 040000; then
2777         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.0.0])
2778     fi
2781 dnl ===================================================================
2782 dnl  Is GCC actually Clang?
2783 dnl ===================================================================
2785 COM_GCC_IS_CLANG=
2786 if test "$GCC" = "yes"; then
2787     AC_MSG_CHECKING([whether GCC is actually Clang])
2788     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
2789         #ifndef __clang__
2790         you lose
2791         #endif
2792         int foo=42;
2793         ]])],
2794         [AC_MSG_RESULT([yes])
2795          COM_GCC_IS_CLANG=TRUE],
2796         [AC_MSG_RESULT([no])])
2798     if test "$COM_GCC_IS_CLANG" = TRUE; then
2799         AC_MSG_CHECKING([the Clang version])
2800         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC -E -P -`
2801         CLANG_FULL_VERSION=`echo __clang_version__ | $CC -E -P -`
2802         CLANGVER=`echo $clang_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2803         AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
2804         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
2805     fi
2807 AC_SUBST(COM_GCC_IS_CLANG)
2809 # ===================================================================
2810 # check various GCC options that Clang does not support now but maybe
2811 # will somewhen in the future, check them even for GCC, so that the
2812 # flags are set
2813 # ===================================================================
2815 HAVE_GCC_GGDB2=
2816 HAVE_GCC_FINLINE_LIMIT=
2817 HAVE_GCC_FNO_INLINE=
2818 if test "$GCC" = "yes"; then
2819     AC_MSG_CHECKING([whether $CC supports -ggdb2])
2820     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
2821         # Option just ignored and silly warning that isn't a real
2822         # warning printed
2823         :
2824     else
2825         save_CFLAGS=$CFLAGS
2826         CFLAGS="$CFLAGS -Werror -ggdb2"
2827         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
2828         CFLAGS=$save_CFLAGS
2829     fi
2830     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
2831         AC_MSG_RESULT([yes])
2832     else
2833         AC_MSG_RESULT([no])
2834     fi
2836     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
2837     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
2838         # As above
2839         :
2840     else
2841         save_CFLAGS=$CFLAGS
2842         CFLAGS="$CFLAGS -Werror -finline-limit=0"
2843         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
2844         CFLAGS=$save_CFLAGS
2845     fi
2846     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
2847         AC_MSG_RESULT([yes])
2848     else
2849         AC_MSG_RESULT([no])
2850     fi
2852     AC_MSG_CHECKING([whether $CC supports -fno-inline])
2853     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
2854         # Ditto
2855         :
2856     else
2857         save_CFLAGS=$CFLAGS
2858         CFLAGS="$CFLAGS -Werror -fno-inline"
2859         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
2860         CFLAGS=$save_CFLAGS
2861     fi
2862     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
2863         AC_MSG_RESULT([yes])
2864     else
2865         AC_MSG_RESULT([no])
2866     fi
2868 AC_SUBST(HAVE_GCC_GGDB2)
2869 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
2870 AC_SUBST(HAVE_GCC_FNO_INLINE)
2872 HAVE_LD_BSYMBOLIC_FUNCTIONS=
2873 if test "$GCC" = "yes"; then
2874     AC_MSG_CHECKING( for -Bsymbolic-functions linker support )
2875     bsymbolic_functions_ldflags_save=$LDFLAGS
2876     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
2877     AC_LINK_IFELSE([AC_LANG_PROGRAM([
2878 #include <stdio.h>
2879         ],[
2880 printf ("hello world\n");
2881         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
2882     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
2883         AC_MSG_RESULT( found )
2884     else
2885         AC_MSG_RESULT( not found )
2886     fi
2887     LDFLAGS=$bsymbolic_functions_ldflags_save
2889 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
2891 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
2892 # NOTE: must _not_ be used for bundled external libraries!
2893 ISYSTEM=
2894 if test "$GCC" = "yes"; then
2895     AC_MSG_CHECKING( for -isystem )
2896     save_CFLAGS=$CFLAGS
2897     CFLAGS="$CFLAGS -Werror"
2898     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM=-isystem ],[])
2899     CFLAGS=$save_CFLAGS
2900     if test -n "$ISYSTEM"; then
2901         AC_MSG_RESULT(yes)
2902     else
2903         AC_MSG_RESULT(no)
2904     fi
2906 if test -z "$ISYSTEM"; then
2907     # fall back to using -I
2908     ISYSTEM=-I
2910 AC_SUBST(ISYSTEM)
2912 dnl ===================================================================
2913 dnl  Check which Visual Studio or MinGW compiler is used
2914 dnl ===================================================================
2916 map_vs_year_to_version()
2918     # Return value: $vsversion
2920     unset vsversion
2922     case $1 in
2923     2008)
2924         vsversion=9.0;;
2925     2010)
2926         vsversion=10.0;;
2927     2012)
2928         vsversion=11.0;;
2929     *)
2930         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
2931     esac
2934 vs_versions_to_check()
2936     # Args: $1 (optional) : versions to check, in the order of preference
2937     # Return value: $vsversions
2939     unset vsversions
2941     if test -n "$1"; then
2942         map_vs_year_to_version "$1"
2943         vsversions=$vsversion
2944     else
2945         # By default we prefer 2012, then 2010, then 2008
2946         vsversions="11.0 10.0 9.0"
2947     fi
2950 find_msvs()
2952     # Find Visual Studio 2012/2010/2008
2953     # Args: $1 (optional) : versions to check, in the order of preference
2954     # Return value: $vstest
2956     unset vstest
2958     vs_versions_to_check "$1"
2960     for ver in $vsversions; do
2961         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/ProductDir
2962         if test -n "$regvalue"; then
2963             vstest=$regvalue
2964             break
2965         fi
2966         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VS/ProductDir
2967         if test -n "$regvalue"; then
2968             vstest=$regvalue
2969             break
2970         fi
2971     done
2974 find_msvc()
2976     # Find Visual C++ 2012/2010/2008
2977     # Args: $1 (optional) : The VS version year
2978     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot
2980     unset vctest vcnum vcnumwithdot
2982     vs_versions_to_check "$1"
2984     for ver in $vsversions; do
2985         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
2986         if test -n "$regvalue"; then
2987             vctest=$regvalue
2988             break
2989         fi
2990         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VC/ProductDir
2991         if test -n "$regvalue"; then
2992             vctest=$regvalue
2993             break
2994         fi
2995     done
2996     if test -n "$vctest"; then
2997         vcnumwithdot=$ver
2998         case "$vcnumwithdot" in
2999         9.0)
3000             vcyear=2008
3001             vcnum=90
3002             ;;
3003         10.0)
3004             vcyear=2010
3005             vcnum=100
3006             ;;
3007         11.0)
3008             vcyear=2012
3009             vcnum=110
3010             ;;
3011         esac
3012     fi
3015 SHOWINCLUDES_PREFIX=
3016 if test "$_os" = "WINNT"; then
3017     if test "$WITH_MINGW" != "yes"; then
3018         AC_MSG_CHECKING([Visual C++])
3020         find_msvc "$with_visual_studio"
3022         if test -z "$vctest"; then
3023             if test -n "$with_visual_studio"; then
3024                 AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3025             else
3026                 AC_MSG_ERROR([No Visual Studio 2012, 2010 or 2008 installation found])
3027             fi
3028         fi
3030         if test "$BITNESS_OVERRIDE" = ""; then
3031             if test -f "$vctest/bin/cl.exe"; then
3032                 VC_PRODUCT_DIR=$vctest
3033             else
3034                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3035             fi
3036         else
3037             # It makes sense, I think, to restrict 64-bit support to VS2010 or newer
3038             if test $vcnum -lt 100; then
3039                AC_MSG_ERROR([We have no plans to support building a 64-bit LibreOffice with VS 2008])
3040             fi
3042             if test -f "$vctest/bin/amd64/cl.exe"; then
3043                 VC_PRODUCT_DIR=$vctest
3044             else
3045                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/amd64/cl.exe])
3046             fi
3047         fi
3049         VC_PRODUCT_DIR=`cygpath -d "$VC_PRODUCT_DIR"`
3050         VC_PRODUCT_DIR=`cygpath -u "$VC_PRODUCT_DIR"`
3051         AC_MSG_RESULT([$VC_PRODUCT_DIR])
3053         dnl ===========================================================
3054         dnl  Check for the corresponding mspdb*.dll
3055         dnl ===========================================================
3057         MSPDB_PATH=
3059         if test "$BITNESS_OVERRIDE" == ""; then
3060             MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3061         else
3062             MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3063         fi
3065         case $vcnum in
3066         90)
3067             mspdbnum=80;;
3068         *)
3069             mspdbnum=$vcnum;;
3070         esac
3072         if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3073             AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3074         fi
3076         MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3077         MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3079         dnl The path needs to be added before cl is called
3080         PATH="$MSPDB_PATH:$PATH"
3082         AC_MSG_CHECKING([cl.exe])
3084         # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3085         # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3086         # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3087         # is not enough?
3089         if test -z "$CC"; then
3090             if test "$BITNESS_OVERRIDE" = ""; then
3091                 if test -f "$VC_PRODUCT_DIR/bin/cl.exe"; then
3092                     CC="$VC_PRODUCT_DIR/bin/cl.exe"
3093                 fi
3094             else
3095                 if test -f "$VC_PRODUCT_DIR/bin/amd64/cl.exe"; then
3096                     CC="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3097                 fi
3098             fi
3100             # This gives us a posix path with 8.3 filename restrictions
3101             CC=`cygpath -d "$CC"`
3102             CC=`cygpath -u "$CC"`
3103         fi
3105         if test -n "$CC"; then
3106             # Remove /cl.exe from CC case insensitive
3107             AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3108             if test "$BITNESS_OVERRIDE" = ""; then
3109                 COMPATH=`echo $CC | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3110             else
3111                 if test -n "$VC_PRODUCT_DIR"; then
3112                     # Huh, why not just an assignment?
3113                     COMPATH=`echo $VC_PRODUCT_DIR`
3114                 fi
3115             fi
3116             export INCLUDE=`cygpath -d "$COMPATH/Include"`
3118             PathFormat "$COMPATH"
3119             COMPATH="$formatted_path"
3121             VCVER=$vcnum
3122             MSVSVER=$vcyear
3124             # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3125             # are always "better", we list them in reverse chronological order.
3127             case $vcnum in
3128             90)
3129                 COMEX=12
3130                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="7.1A 7.1 7.0A 6.0A"
3131                 ;;
3132             100)
3133                 COMEX=13
3134                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="7.1A 7.1 7.0A 6.0A"
3135                 ;;
3136             110)
3137                 COMEX=14
3138                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="8.0"
3139                 ;;
3140             esac
3142             # The expectation is that --with-windows-sdk should not need to be used
3143             if test -n "$with_windows_sdk"; then
3144                 case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3145                 *" "$with_windows_sdk" "*)
3146                     WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3147                     ;;
3148                 *)
3149                     AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work witn VS $MSVSVER])
3150                     ;;
3151                 esac
3152             fi
3153         else
3154             AC_MSG_ERROR([Visual C++ not found after all, huh])
3155         fi
3157         dnl We need to guess the prefix of the -showIncludes output, it can be
3158         dnl localized
3159         AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3160         echo "#include <stdlib.h>" > conftest.c
3161         SHOWINCLUDES_PREFIX=`$CC -c -showIncludes conftest.c 2>/dev/null | \
3162             grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3163         rm -f conftest.c conftest.obj
3164         if test -z "$SHOWINCLUDES_PREFIX"; then
3165             AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3166         else
3167             AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3168         fi
3170         # Check for 64-bit (cross-)compiler to use to build the 64-bit
3171         # version of the Explorer extension (and maybe other small
3172         # bits, too) needed when installing a 32-bit LibreOffice on a
3173         # 64-bit OS. The 64-bit Explorer extension is a feature that
3174         # has been present since long in OOo. Don't confuse it with
3175         # building LibreOffice itself as 64-bit code, which is
3176         # unfinished work and highly experimental.
3178         BUILD_X64=
3179         CXX_X64_BINARY=
3180         LINK_X64_BINARY=
3182         if test "$BITNESS_OVERRIDE" = ""; then
3183             AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3184             if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3185                 # Prefer native x64 compiler to cross-compiler, in case we are running
3186                 # the build on a 64-bit OS.
3187                 if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3188                     BUILD_X64=TRUE
3189                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3190                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3191                 elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3192                     BUILD_X64=TRUE
3193                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3194                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3195                 fi
3196             fi
3197             if test "$BUILD_X64" = TRUE; then
3198                 AC_MSG_RESULT([found])
3199             else
3200                 AC_MSG_RESULT([not found])
3201                 AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3202             fi
3203         fi
3204         AC_SUBST(BUILD_X64)
3206         # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3207         AC_SUBST(CXX_X64_BINARY)
3208         AC_SUBST(LINK_X64_BINARY)
3209     else
3210         AC_MSG_CHECKING([the compiler is MinGW])
3211         MACHINE_PREFIX=`$CC -dumpmachine`
3212         if echo $MACHINE_PREFIX | $GREP -q mingw32; then
3213             COMPATH=`echo "$COMPATH" | sed -e 's,/bin$,,'`
3214             AC_MSG_RESULT([yes])
3215         else
3216             AC_MSG_ERROR([Compiler is not MinGW.])
3217         fi
3218     fi
3220 AC_SUBST(COMEX)
3221 AC_SUBST(VCVER)
3222 PathFormat "$MSPDB_PATH"
3223 MSPDB_PATH="$formatted_path"
3224 AC_SUBST(SHOWINCLUDES_PREFIX)
3227 # dbghelp.dll
3229 if test "$_os" == "WINNT"; then
3230     BUILD_TYPE="$BUILD_TYPE DBGHELP"
3234 # unowinreg.dll
3236 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3237 AC_SUBST(UNOWINREG_DLL)
3240 # prefix C with ccache if needed
3242 if test "$CCACHE" != ""; then
3243     AC_MSG_CHECKING([whether $CC is already ccached])
3245     AC_LANG_PUSH([C])
3246     save_CFLAGS=$CFLAGS
3247     CFLAGS="$CFLAGS --ccache-skip -O2"
3248     dnl an empty program will do, we're checking the compiler flags
3249     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3250                       [use_ccache=yes], [use_ccache=no])
3251     if test $use_ccache = yes; then
3252         AC_MSG_RESULT([yes])
3253     else
3254         CC="$CCACHE $CC"
3255         AC_MSG_RESULT([no])
3256     fi
3257     CFLAGS=$save_CFLAGS
3258     AC_LANG_POP([C])
3261 dnl Set the ENABLE_DBGUTIL variable
3262 dnl ===================================================================
3263 AC_MSG_CHECKING([whether to build with additional debug utilities])
3264 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3265     ENABLE_DBGUTIL="TRUE"
3266     # this is an extra var so it can have different default on different MSVC
3267     # versions (in case there are version specific problems with it)
3268     MSVC_USE_DEBUG_RUNTIME="TRUE"
3269     PROEXT=""
3270     PRODUCT=""
3272     AC_MSG_RESULT([yes])
3273     # cppunit and graphite expose STL in public headers
3274     if test "$with_system_cppunit" = "yes"; then
3275         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3276     else
3277         with_system_cppunit=no
3278     fi
3279     if test "$with_system_graphite" = "yes"; then
3280         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3281     else
3282         with_system_graphite=no
3283     fi
3284     if test "$with_system_mysql_cppconn" = "yes"; then
3285         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3286     else
3287         with_system_mysql_cppconn=no
3288     fi
3289     if test "$with_system_orcus" = "yes"; then
3290         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3291     else
3292         with_system_orcus=no
3293     fi
3294     if test "$with_system_libcmis" = "yes"; then
3295         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3296     else
3297         with_system_libcmis=no
3298     fi
3299 else
3300     ENABLE_DBGUTIL=""
3301     MSVC_USE_DEBUG_RUNTIME=""
3302     # PRODUCT is old concept, still used by build.pl .
3303     PRODUCT="full"
3304     PROEXT=".pro"
3305     AC_MSG_RESULT([no])
3307 AC_SUBST(ENABLE_DBGUTIL)
3308 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3309 AC_SUBST(PRODUCT)
3310 AC_SUBST(PROEXT)
3312 dnl Set the ENABLE_DEBUG variable.
3313 dnl ===================================================================
3314 AC_MSG_CHECKING([whether to do a debug build])
3315 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3316     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3318 if test -n "$ENABLE_DBGUTIL"; then
3319     if test "$enable_debug" = "no"; then
3320         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3321     fi
3322     ENABLE_DEBUG="TRUE"
3323     AC_MSG_RESULT([yes (dbgutil)])
3324 elif test -n "$enable_debug" && test "$enable_debug" != "no"; then
3325     ENABLE_DEBUG="TRUE"
3326     AC_MSG_RESULT([yes])
3327 else
3328     ENABLE_DEBUG=""
3329     AC_MSG_RESULT([no])
3331 AC_SUBST(ENABLE_DEBUG)
3333 dnl Selective debuginfo
3334 ENABLE_DEBUGINFO_FOR=
3335 if test -n "$ENABLE_DEBUG"; then
3336     AC_MSG_CHECKING([whether to use selective debuginfo])
3337     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3338         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3339         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3340     else
3341         ENABLE_DEBUGINFO_FOR=all
3342         AC_MSG_RESULT([no, for all])
3343     fi
3345 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3347 dnl Check for enable symbols option
3348 dnl ===================================================================
3349 AC_MSG_CHECKING([whether to include symbols while preserve optimization])
3350 if test -n "$enable_symbols" -a "$enable_symbols" != "no"; then
3351     ENABLE_SYMBOLS="TRUE"
3352     if test -n "$ENABLE_DBGUTIL"; then
3353         AC_MSG_ERROR([--enable-dbgutil cannot be used with --enable-symbols])
3354     elif test -n "$ENABLE_DEBUG"; then
3355         AC_MSG_ERROR([--enable-debug cannot be used with --enable-symbols])
3356     fi
3357     AC_MSG_RESULT([yes])
3358 else
3359     if test -n "$enable_symbols" -a "$enable_symbols" = "no"; then
3360         ENABLE_SYMBOLS="FALSE"
3361     else
3362         ENABLE_SYMBOLS=
3363     fi
3364     AC_MSG_RESULT([no])
3366 AC_SUBST(ENABLE_SYMBOLS)
3368 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
3369 # By default use the ones specified by our build system,
3370 # but explicit override is possible.
3371 AC_MSG_CHECKING(for explicit AFLAGS)
3372 if test -n "$AFLAGS"; then
3373     AC_MSG_RESULT([$AFLAGS])
3374     x_AFLAGS=
3375 else
3376     AC_MSG_RESULT(no)
3377     x_AFLAGS=[\#]
3379 AC_MSG_CHECKING(for explicit CFLAGS)
3380 if test -n "$CFLAGS"; then
3381     AC_MSG_RESULT([$CFLAGS])
3382     x_CFLAGS=
3383 else
3384     AC_MSG_RESULT(no)
3385     x_CFLAGS=[\#]
3387 AC_MSG_CHECKING(for explicit CXXFLAGS)
3388 if test -n "$CXXFLAGS"; then
3389     AC_MSG_RESULT([$CXXFLAGS])
3390     x_CXXFLAGS=
3391 else
3392     AC_MSG_RESULT(no)
3393     x_CXXFLAGS=[\#]
3395 AC_MSG_CHECKING(for explicit OBJCFLAGS)
3396 if test -n "$OBJCFLAGS"; then
3397     AC_MSG_RESULT([$OBJCFLAGS])
3398     x_OBJCFLAGS=
3399 else
3400     AC_MSG_RESULT(no)
3401     x_OBJCFLAGS=[\#]
3403 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
3404 if test -n "$OBJCXXFLAGS"; then
3405     AC_MSG_RESULT([$OBJCXXFLAGS])
3406     x_OBJCXXFLAGS=
3407 else
3408     AC_MSG_RESULT(no)
3409     x_OBJCXXFLAGS=[\#]
3411 AC_MSG_CHECKING(for explicit LDFLAGS)
3412 if test -n "$LDFLAGS"; then
3413     AC_MSG_RESULT([$LDFLAGS])
3414     x_LDFLAGS=
3415 else
3416     AC_MSG_RESULT(no)
3417     x_LDFLAGS=[\#]
3419 AC_SUBST(AFLAGS)
3420 AC_SUBST(CFLAGS)
3421 AC_SUBST(CXXFLAGS)
3422 AC_SUBST(OBJCFLAGS)
3423 AC_SUBST(OBJCXXFLAGS)
3424 AC_SUBST(LDFLAGS)
3425 AC_SUBST(x_AFLAGS)
3426 AC_SUBST(x_CFLAGS)
3427 AC_SUBST(x_CXXFLAGS)
3428 AC_SUBST(x_OBJCFLAGS)
3429 AC_SUBST(x_OBJCXXFLAGS)
3430 AC_SUBST(x_LDFLAGS)
3433 # determine CPU, CPUNAME, GUI, GUIBASE, ...
3435 LIB64="lib"
3436 SOLARINC=
3438 case "$host_os" in
3440 aix*)
3441     COM=GCC
3442     CPU=P
3443     CPUNAME=POWERPC
3444     GUI=UNX
3445     GUIBASE=unx
3446     OS=AIX
3447     RTL_OS=AIX
3448     RTL_ARCH=PowerPC
3449     PLATFORMID=aix_powerpc
3450     OUTPATH=unxaigppc
3451     P_SEP=:
3452     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3453     ;;
3455 cygwin*)
3456     COM=MSC
3457     GUI=WNT
3458     GUIBASE=not-used
3459     OS=WNT
3460     RTL_OS=Windows
3461     P_SEP=";"
3463     case "$host_cpu" in
3464     i*86|x86_64)
3465         if test "$BITNESS_OVERRIDE" = 64; then
3466             CPU=X
3467             CPUNAME=X86_64
3468             RTL_ARCH=X86_64
3469             LIB64="lib/x64"
3470             PLATFORMID=windows_x86_64
3471             OUTPATH=wntmscx$COMEX
3472         else
3473             CPU=I
3474             CPUNAME=INTEL
3475             RTL_ARCH=x86
3476             PLATFORMID=windows_x86
3477             OUTPATH=wntmsci$COMEX
3478         fi
3479         ;;
3480     *)
3481         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3482         ;;
3483     esac
3484     SCPDEFS="$SCPDEFS -D_MSC_VER"
3485     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3486     ;;
3488 darwin*)
3489     COM=GCC
3490     GUI=UNX
3491     GUIBASE=not-used
3492     OS=MACOSX
3493     RTL_OS=MacOSX
3494     P_SEP=:
3496     case "$host_cpu" in
3497     arm*)
3498         CPU=R
3499         CPUNAME=ARM
3500         RTL_ARCH=ARM_EABI
3501         PLATFORMID=ios_arm
3502         OUTPATH=unxiosr
3503         OS=IOS
3504         SDKDIR=sdk
3505         ;;
3506     i*86)
3507         if test "$BITNESS_OVERRIDE" = 64; then
3508             AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
3509         fi
3510         CPU=I
3511         CPUNAME=INTEL
3512         RTL_ARCH=x86
3513         PLATFORMID=macosx_x86
3514         OUTPATH=unxmacxi
3515         ;;
3516     x86_64)
3517         if test "$BITNESS_OVERRIDE" = 64; then
3518             CPU=X
3519             CPUNAME=X86_64
3520             RTL_ARCH=X86_64
3521             PLATFORMID=macosx_x86_64
3522             OUTPATH=unxmacxx
3523         else
3524             CPU=I
3525             CPUNAME=INTEL
3526             RTL_ARCH=x86
3527             PLATFORMID=macosx_x86
3528             OUTPATH=unxmacxi
3529         fi
3530         ;;
3531     *)
3532         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3533         ;;
3534     esac
3535     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3536     ;;
3538 dragonfly*)
3539     COM=GCC
3540     GUI=UNX
3541     GUIBASE=unx
3542     OS=DRAGONFLY
3543     RTL_OS=DragonFly
3544     OUTPATH=unxdfly
3545     P_SEP=:
3547     case "$host_cpu" in
3548     i*86)
3549         CPU=I
3550         CPUNAME=INTEL
3551         RTL_ARCH=x86
3552         PLATFORMID=dragonfly_x86
3553         ;;
3554     x86_64)
3555         CPU=X
3556         CPUNAME=X86_64
3557         RTL_ARCH=X86_64
3558         PLATFORMID=dragonfly_x86_64
3559         ;;
3560     *)
3561         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3562         ;;
3563     esac
3564     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3565     ;;
3567 freebsd*)
3568     COM=GCC
3569     GUI=UNX
3570     GUIBASE=unx
3571     RTL_OS=FreeBSD
3572     OS=FREEBSD
3573     OUTPATH=unxfbsd
3574     P_SEP=:
3576     case "$host_cpu" in
3577     i*86)
3578         CPU=I
3579         CPUNAME=INTEL
3580         RTL_ARCH=x86
3581         PLATFORMID=freebsd_x86
3582         OUTPATH=unxfbsdi
3583         ;;
3584     x86_64)
3585         CPU=X
3586         CPUNAME=X86_64
3587         RTL_ARCH=X86_64
3588         PLATFORMID=freebsd_x86_64
3589         ;;
3590     *)
3591         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3592         ;;
3593     esac
3594     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3595     ;;
3597 kfreebsd*)
3598     COM=GCC
3599     GUI=UNX
3600     GUIBASE=unx
3601     OS=LINUX
3602     RTL_OS=kFreeBSD
3603     P_SEP=:
3605     case "$host_cpu" in
3607     i*86)
3608         CPU=I
3609         CPUNAME=INTEL
3610         RTL_ARCH=x86
3611         PLATFORMID=kfreebsd_x86
3612         OUTPATH=unxkfgi6
3613         ;;
3614     x86_64)
3615         CPU=X
3616         CPUNAME=X86_64
3617         RTL_ARCH=X86_64
3618         LIB64="lib64"
3619         PLATFORMID=kfreebsd_x86_64
3620         OUTPATH=unxkfgx6
3621         ;;
3622     *)
3623         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3624         ;;
3625     esac
3626     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3627     ;;
3629 linux-gnu*)
3630     COM=GCC
3631     GUI=UNX
3632     GUIBASE=unx
3633     OS=LINUX
3634     RTL_OS=Linux
3635     P_SEP=:
3637     case "$host_cpu" in
3639     alpha)
3640         CPU=L
3641         CPUNAME=AXP
3642         RTL_ARCH=ALPHA
3643         PLATFORMID=linux_alpha
3644         OUTPATH=unxlngaxp
3645         ;;
3646     arm*)
3647         CPU=R
3648         CPUNAME=ARM
3649         EPM_FLAGS="-a arm"
3650         OUTPATH=unxlngr
3651         RTL_ARCH=ARM_EABI
3652         PLATFORMID=linux_arm_eabi
3653         case "$host_cpu" in
3654         arm*-linux)
3655             RTL_ARCH=ARM_OABI
3656             PLATFORMID=linux_arm_oabi
3657             ;;
3658         esac
3659         ;;
3660     hppa)
3661         CPU=H
3662         CPUNAME=HPPA
3663         RTL_ARCH=HPPA
3664         EPM_FLAGS="-a hppa"
3665         PLATFORMID=linux_hppa
3666         OUTPATH=unxlnghppa
3667         ;;
3668     i*86)
3669         CPU=I
3670         CPUNAME=INTEL
3671         RTL_ARCH=x86
3672         PLATFORMID=linux_x86
3673         OUTPATH=unxlngi6
3674         ;;
3675     ia64)
3676         CPU=A
3677         CPUNAME=IA64
3678         RTL_ARCH=IA64
3679         PLATFORMID=linux_ia64
3680         OUTPATH=unxlnga
3681         ;;
3682     mips)
3683         CPU=M
3684         CPUNAME=GODSON
3685         RTL_ARCH=MIPS_EB
3686         EPM_FLAGS="-a mips"
3687         PLATFORMID=linux_mips_eb
3688         OUTPATH=unxlngmips
3689         ;;
3690     mips64)
3691         CPU=M
3692         CPUNAME=GODSON
3693         RTL_ARCH=MIPS_EB
3694         EPM_FLAGS="-a mips64"
3695         PLATFORMID=linux_mips_eb
3696         OUTPATH=unxlngmips
3697         ;;
3698     mips64el)
3699         CPU=M
3700         CPUNAME=GODSON
3701         RTL_ARCH=MIPS_EL
3702         EPM_FLAGS="-a mips64el"
3703         PLATFORMID=linux_mips_el
3704         OUTPATH=unxlngmips
3705         ;;
3706     mipsel)
3707         CPU=M
3708         CPUNAME=GODSON
3709         RTL_ARCH=MIPS_EL
3710         EPM_FLAGS="-a mipsel"
3711         PLATFORMID=linux_mips_el
3712         OUTPATH=unxlngmips
3713         ;;
3714     m68k)
3715         CPU=6
3716         CPUNAME=M68K
3717         RTL_ARCH=M68K
3718         PLATFORMID=linux_m68k
3719         OUTPATH=unxlngm68k
3720         ;;
3721     powerpc)
3722         CPU=P
3723         CPUNAME=POWERPC
3724         RTL_ARCH=PowerPC
3725         PLATFORMID=linux_powerpc
3726         OUTPATH=unxlngppc
3727         ;;
3728     powerpc64)
3729         CPU=P
3730         CPUNAME=POWERPC64
3731         RTL_ARCH=PowerPC_64
3732         LIB64="lib64"
3733         PLATFORMID=linux_powerpc_64
3734         OUTPATH=unxlngppc64
3735         ;;
3736     sparc)
3737         CPU=S
3738         CPUNAME=SPARC
3739         RTL_ARCH=SPARC
3740         PLATFORMID=linux_sparc
3741         OUTPATH=unxlngs
3742         ;;
3743     s390)
3744         CPU=3
3745         CPUNAME=S390
3746         RTL_ARCH=S390
3747         PLATFORMID=linux_s390
3748         OUTPATH=unxlngs390
3749         ;;
3750     s390x)
3751         CPU=3
3752         CPUNAME=S390X
3753         RTL_ARCH=S390x
3754         LIB64="lib64"
3755         PLATFORMID=linux_s390x
3756         OUTPATH=unxlngs390x
3757         ;;
3758     x86_64)
3759         CPU=X
3760         CPUNAME=X86_64
3761         RTL_ARCH=X86_64
3762         LIB64="lib64"
3763         PLATFORMID=linux_x86_64
3764         OUTPATH=unxlngx6
3765         ;;
3766     *)
3767         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3768         ;;
3769     esac
3770     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3771     ;;
3773 linux-android*)
3774     COM=GCC
3775     GUI=UNX
3776     GUIBASE=not-used
3777     OS=ANDROID
3778     RTL_OS=Android
3779     P_SEP=:
3781     case "$host_cpu" in
3783     arm|armel)
3784         CPU=R
3785         CPUNAME=ARM
3786         RTL_ARCH=ARM_EABI
3787         PLATFORMID=android_arm_eabi
3788         OUTPATH=unxandr
3789         ;;
3790     mips|mipsel)
3791         CPU=M
3792         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
3793         RTL_ARCH=MIPS_EL
3794         PLATFORMID=android_mips_el
3795         OUTPATH=unxandm
3796         ;;
3797     i*86)
3798         CPU=I
3799         CPUNAME=INTEL
3800         RTL_ARCH=x86
3801         PLATFORMID=android_x86
3802         OUTPATH=unxandi
3803         ;;
3804     *)
3805         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3806         ;;
3807     esac
3808     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3809     ;;
3811 mingw*)
3812     COM=GCC
3813     GUI=WNT
3814     GUIBASE=not-used
3815     OS=WNT
3816     RTL_OS=Windows
3817     P_SEP=:
3819     case "$host_cpu" in
3820     i*86|x86_64)
3821         if test "$BITNESS_OVERRIDE" = 64; then
3822             CPU=X
3823             CPUNAME=X86_64
3824             RTL_ARCH=X86_84
3825             PLATFORMID=windows_x86_64
3826             OUTPATH=wntgccx$COMEX
3827         else
3828             CPU=I
3829             CPUNAME=INTEL
3830             RTL_ARCH=x86
3831             PLATFORMID=windows_x86
3832             OUTPATH=wntgcci$COMEX
3833         fi
3834         ;;
3835     *)
3836         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3837         ;;
3838     esac
3839     SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgcci"
3840     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3841     ;;
3843 *netbsd*)
3845     COM=GCC
3846     GUI=UNX
3847     GUIBASE=unx
3848     OS=NETBSD
3849     RTL_OS=NetBSD
3850     OUTPATH=unxnbsd
3851     P_SEP=:
3853     case "$host_cpu" in
3854     i*86)
3855         CPU=I
3856         CPUNAME=INTEL
3857         RTL_ARCH=x86
3858         PLATFORMID=netbsd_x86
3859         ;;
3860     powerpc)
3861         CPU=P
3862         CPUNAME=POWERPC
3863         RTL_ARCH=PowerPC
3864         PLATFORMID=netbsd_powerpc
3865         ;;
3866     sparc)
3867         CPU=S
3868         CPUNAME=SPARC
3869         RTL_ARCH=SPARC
3870         PLATFORMID=netbsd_sparc
3871         ;;
3872     x86_64)
3873         CPU=X
3874         CPUNAME=X86_64
3875         RTL_ARCH=X86_64
3876         PLATFORMID=netbsd_x86_64
3877         ;;
3878     *)
3879         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3880         ;;
3881     esac
3882     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3883     ;;
3885 openbsd*)
3886     COM=GCC
3887     GUI=UNX
3888     GUIBASE=unx
3889     OS=OPENBSD
3890     RTL_OS=OpenBSD
3891     OUTPATH=unxobsd
3892     P_SEP=:
3894     case "$host_cpu" in
3895     i*86)
3896         CPU=I
3897         CPUNAME=INTEL
3898         RTL_ARCH=x86
3899         PLATFORMID=openbsd_x86
3900         ;;
3901     x86_64)
3902         CPU=X
3903         CPUNAME=X86_64
3904         RTL_ARCH=X86_64
3905         PLATFORMID=openbsd_x86_64
3906         ;;
3907     *)
3908         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3909         ;;
3910     esac
3911     SOLARINC="$SOLARINC -I/usr/local/include"
3912     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3913     SOLARLIB="$SOLARLIB -L/usr/local/lib"
3915     ;;
3917 solaris*)
3919     COM=GCC
3920     GUI=UNX
3921     GUIBASE=unx
3922     OS=SOLARIS
3923     RTL_OS=Solaris
3924     P_SEP=:
3926     case "$host_cpu" in
3927     i*86)
3928         CPU=I
3929         CPUNAME=INTEL
3930         RTL_ARCH=x86
3931         PLATFORMID=solaris_x86
3932         OUTPATH=unxsogi
3933         ;;
3934     sparc)
3935         CPU=S
3936         CPUNAME=SPARC
3937         RTL_ARCH=SPARC
3938         PLATFORMID=solaris_sparc
3939         OUTPATH=unxsogs
3940         ;;
3941     *)
3942         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3943         ;;
3944     esac
3945     SOLARINC="$SOLARINC -I/usr/local/include"
3946     SOLARLIB="-L${SOLARVER}/${OUTPATH}${PROEXT}/lib"
3947     SOLARLIB="$SOLARLIB -L$COMPATH/lib"
3948     SOLARLIB="$SOLARLIB -L/usr/local/bin -L/usr/dt/lib -L/usr/openwin/lib"
3949     ;;
3952     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
3953     ;;
3954 esac
3956 if test "$enable_headless" = "yes"; then
3957     if test "$GUIBASE" != "unx"; then
3958         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --enable-headless])
3959     fi
3960     GUIBASE=headless
3963 INPATH="${OUTPATH}${PROEXT}"
3964 if test -n "${with_solver_and_workdir_root}"; then
3965     PathFormat "${with_solver_and_workdir_root}"
3966     # IsValidFilePath in /sal/osl/w32/file_url.cxx rejects "X:\\" breaking idlc
3967     if echo ${formatted_path} | $GREP -q '/$'; then
3968         WORKDIR=${formatted_path}workdir/${INPATH}
3969         INSTDIR=${formatted_path}instdir/${INPATH}
3970     else
3971         WORKDIR=${formatted_path}/workdir/${INPATH}
3972         INSTDIR=${formatted_path}/instdir/${INPATH}
3973     fi
3974 else
3975     WORKDIR=${BUILDDIR}/workdir/${INPATH}
3976     INSTDIR=${BUILDDIR}/instdir/${INPATH}
3978 OUTDIR="${SOLARVER}/${INPATH}"
3979 SOLARINC="-I. -I$SRC_ROOT/include -I${SOLARVER}/$INPATH/inc/external -I${SOLARVER}/$INPATH/inc $SOLARINC"
3980 AC_SUBST(COM)
3981 AC_SUBST(CPU)
3982 AC_SUBST(CPUNAME)
3983 AC_SUBST(RTL_OS)
3984 AC_SUBST(RTL_ARCH)
3985 AC_SUBST(EPM_FLAGS)
3986 AC_SUBST(GUI)
3987 AC_SUBST(GUIBASE)
3988 AC_SUBST(INPATH)
3989 AC_SUBST([INSTDIR])
3990 AC_SUBST(OS)
3991 AC_SUBST(OUTDIR)
3992 AC_SUBST(OUTPATH)
3993 AC_SUBST(P_SEP)
3994 AC_SUBST(SOLARVER)
3995 AC_SUBST(WORKDIR)
3996 AC_SUBST(PLATFORMID)
3997 AC_DEFINE_UNQUOTED(OUTDIR,"$OUTDIR")
3998 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4000 dnl ===================================================================
4001 dnl Test which package format to use
4002 dnl ===================================================================
4003 AC_MSG_CHECKING([which package format to use])
4004 if test -n "$with_package_format"; then
4005     for i in $with_package_format; do
4006         case "$i" in
4007         aix | bsd | deb | inst | tardist | osx | pkg | rpm | setld | native | portable | archive | dmg | installed | msi)
4008             ;;
4009         *)
4010             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4011 aix - AIX software distribution
4012 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4013 deb - Debian software distribution
4014 inst or tardist - IRIX software distribution
4015 osx - MacOS X software distribution
4016 pkg - Solaris software distribution
4017 rpm - RedHat software distribution
4018 setld - Tru64 (setld) software distribution
4019 native - "Native" software distribution for the platform
4020 portable - Portable software distribution
4022 LibreOffice additionally supports:
4023 archive - .tar.gz or .zip
4024 dmg - Mac OS X .dmg
4025 installed - installation tree
4026 msi - Windows .msi
4027         ])
4028             ;;
4029         esac
4030     done
4031     PKGFORMAT="$with_package_format"
4032 elif test "$enable_epm" = "yes"; then
4033     # defaults
4034     case "$_os" in
4035     Darwin)
4036         PKGFORMAT=dmg
4037         ;;
4038     SunOS)
4039         PKGFORMAT=pkg
4040         ;;
4041     Linux)
4042         # if building on Debian, default should be deb...
4043         if test -e /etc/debian_version; then
4044             PKGFORMAT=deb
4045         else
4046             PKGFORMAT=rpm
4047         fi
4048         ;;
4049     AIX)
4050         PKGFORMAT=rpm
4051         ;;
4052     OpenBSD|DragonFly)
4053         PKGFORMAT=portable
4054         ;;
4055     *BSD)
4056         PKGFORMAT=bsd
4057         ;;
4058     WINNT)
4059         PKGFORMAT=msi
4060         ;;
4061     # we never should get here since we check the arciecture/os at the beginning,
4062     # but go sure...
4063     *)
4064         AC_MSG_ERROR([unknown system])
4065     esac
4066 else
4067     if test "$WITH_MINGW" = "yes"; then
4068         # when tested, we should default this to 'msi', instead of 'archive'
4069         PKGFORMAT=archive
4070     else
4071         PKGFORMAT=native
4072     fi
4074 AC_MSG_RESULT([$PKGFORMAT])
4075 AC_SUBST(PKGFORMAT)
4077 dnl ===================================================================
4078 dnl Set up a different compiler to produce tools to run on the build
4079 dnl machine when doing cross-compilation
4080 dnl ===================================================================
4082 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4083 if test "$cross_compiling" = "yes"; then
4084     AC_MSG_CHECKING([for BUILD platform configuration])
4085     echo
4086     rm -rf CONF-FOR-BUILD config_build.mk
4087     mkdir CONF-FOR-BUILD
4088     (cd $SRC_ROOT && tar cf - \
4089         config.guess \
4090         config_host.mk.in \
4091         Makefile.in \
4092         lo.xcent.in \
4093         config_host/*.in \
4094         bin/get_config_variables \
4095         solenv/bin/getcompver.awk \
4096         solenv/inc/langlist.mk \
4097         instsetoo_native/util/openoffice.lst.in) \
4098     | (cd CONF-FOR-BUILD && tar xf -)
4099     cp configure CONF-FOR-BUILD
4100     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host
4101     (
4102     unset COM GUI GUIBASE OS CPU CPUNAME
4103     unset CC CXX SYSBASE CFLAGS
4104     unset AR NM OBJDUMP PKG_CONFIG RANLIB STRIP
4105     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4106     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
4107     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4108     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4109     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4110     cd CONF-FOR-BUILD
4111     sub_conf_opts=""
4112     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4113     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4114     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4115     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4116     test -n "${with_solver_and_workdir_root}" && sub_conf_opts="$sub_conf_opts --with-solver-and-workdir-root=${with_solver_and_workdir_root}"
4117     test -n "$with_system_boost_for_build" && sub_conf_opts="$sub_conf_opts --with-system-boost"
4118     test -n "$with_system_cppunit_for_build" && sub_conf_opts="$sub_conf_opts --with-system-cppunit"
4119     test -n "$with_system_expat_for_build" && sub_conf_opts="$sub_conf_opts --with-system-expat"
4120     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4121     test -n "$with_system_libxml_for_build" && sub_conf_opts="$sub_conf_opts --with-system-libxml"
4122     # we need the msi build tools on mingw if we are creating the
4123     # installation set
4124     if test "$WITH_MINGW" = "yes"; then
4125         enable_winegcc_for_build=
4126         for pkgformat in $PKGFORMAT; do
4127             case "$pkgformat" in
4128                 msi|native) enable_winegcc_for_build=yes ;;
4129             esac
4130         done
4131         test -n "$enable_winegcc_for_build" && sub_conf_opts="$sub_conf_opts --enable-winegcc"
4132     fi
4133     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4134     # Don't bother having configure look for stuff not needed for the build platform anyway
4135     ./configure \
4136         --disable-graphite \
4137         --disable-postgresql-sdbc \
4138         --with-parallelism="$with_parallelism" \
4139         --without-doxygen \
4140         --without-java \
4141         ENABLE_PDFIMPORT=FALSE \
4142         $sub_conf_opts \
4143         --srcdir=$srcdir \
4144         2>&1 | sed -e 's/^/    /'
4145     test -f ./config_host.mk 2>/dev/null || exit
4146     cp config_host.mk ../config_build.mk
4147     mv config.log ../config.Build.log
4148     mkdir -p ../config_build
4149     mv config_host/*.h ../config_build
4150     . ./bin/get_config_variables OS PATH CC CXX INPATH SYSTEM_LIBXSLT OUTDIR WORKDIR
4152     for V in OS CC CXX INPATH SYSTEM_LIBXSLT; do
4153         VV='$'$V
4154         VV=`eval "echo $VV"`
4155         if test -n "$VV"; then
4156             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4157             echo "$line" >>build-config
4158         fi
4159     done
4161     for V in OUTDIR WORKDIR; do
4162         VV='$'$V
4163         VV=`eval "echo $VV"`
4164         VV=`echo $VV | sed -e 's,/CONF-FOR-BUILD,,g'`
4165         if test -n "$VV"; then
4166             line="${V}_FOR_BUILD='$VV'"
4167             echo "$line" >>build-config
4168         fi
4169     done
4171     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4172     echo "$line" >>build-config
4174     )
4175     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4176     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])
4177     perl -pi -e 's,/CONF-FOR-BUILD,,g' config_build.mk
4178     eval `cat CONF-FOR-BUILD/build-config`
4179     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4180     rm -rf CONF-FOR-BUILD
4181 else
4182     OS_FOR_BUILD="$OS"
4183     CC_FOR_BUILD="$CC"
4184     CXX_FOR_BUILD="$CXX"
4185     INPATH_FOR_BUILD="$INPATH"
4186     OUTDIR_FOR_BUILD="$OUTDIR"
4187     WORKDIR_FOR_BUILD="$WORKDIR"
4189 AC_SUBST(OS_FOR_BUILD)
4190 AC_SUBST(INPATH_FOR_BUILD)
4191 AC_SUBST(OUTDIR_FOR_BUILD)
4192 AC_SUBST(WORKDIR_FOR_BUILD)
4194 dnl ===================================================================
4195 dnl Our version is defined by the AC_INIT() at the top of this script.
4196 dnl ===================================================================
4198 set `echo AC_PACKAGE_VERSION | sed "s/\./ /g"`
4200 LIBO_VERSION_MAJOR=$1
4201 LIBO_VERSION_MINOR=$2
4202 LIBO_VERSION_MICRO=$3
4203 LIBO_VERSION_PATCH=$4
4205 LIBO_VERSION_SUFFIX=$5
4206 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
4207 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
4208 # they get undoubled before actually passed to sed.
4209 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
4210 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
4211 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
4212 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
4214 AC_SUBST(LIBO_VERSION_MAJOR)
4215 AC_SUBST(LIBO_VERSION_MINOR)
4216 AC_SUBST(LIBO_VERSION_MICRO)
4217 AC_SUBST(LIBO_VERSION_PATCH)
4218 AC_SUBST(LIBO_VERSION_SUFFIX)
4219 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
4221 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
4222 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
4223 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
4224 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
4226 LIBO_THIS_YEAR=`date +%Y`
4227 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
4229 # This UPD silly thing must go away soon
4230 UPD="${LIBO_VERSION_MAJOR}${LIBO_VERSION_MINOR}0"
4231 AC_SUBST(UPD)
4233 # This too should go away
4234 SOURCEVERSION="OOO$UPD"
4235 AC_SUBST(SOURCEVERSION)
4237 dnl ===================================================================
4238 dnl Check for syslog header
4239 dnl ===================================================================
4240 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4242 dnl ===================================================================
4243 dnl Set the ENABLE_CRASHDUMP variable.
4244 dnl ===================================================================
4245 AC_MSG_CHECKING([whether to enable crashdump feature])
4246 if test "$enable_crashdump" = "yes"; then
4247     ENABLE_CRASHDUMP="TRUE"
4248     BUILD_TYPE="$BUILD_TYPE CRASHREP"
4249     AC_MSG_RESULT([yes])
4250 else
4251     ENABLE_CRASHDUMP=""
4252     AC_MSG_RESULT([no])
4254 AC_SUBST(ENABLE_CRASHDUMP)
4257 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4258 dnl ===================================================================
4259 AC_MSG_CHECKING([whether to turn warnings to errors])
4260 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4261     EXTERNAL_WARNINGS_NOT_ERRORS="FALSE"
4262     AC_MSG_RESULT([yes])
4263 else
4264     EXTERNAL_WARNINGS_NOT_ERRORS="TRUE"
4265     AC_MSG_RESULT([no])
4267 AC_SUBST(EXTERNAL_WARNINGS_NOT_ERRORS)
4269 dnl Set the ASSERT_ALWAYS_ABORT variable. (Activate --enable-assert-always-abort)
4270 dnl ===================================================================
4271 AC_MSG_CHECKING([whether to have assert to abort in release code])
4272 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4273     ASSERT_ALWAYS_ABORT="TRUE"
4274     AC_MSG_RESULT([yes])
4275 else
4276     ASSERT_ALWAYS_ABORT="FALSE"
4277     AC_MSG_RESULT([no])
4279 AC_SUBST(ASSERT_ALWAYS_ABORT)
4281 dnl Determine whether to use linkoo for the smoketest installation
4282 dnl ===================================================================
4283 AC_MSG_CHECKING([whether to use linkoo for the smoketest installation])
4284 if test $_os = Darwin; then
4285     enable_linkoo=no
4288 if test "$enable_linkoo" = "no"; then
4289     DISABLE_LINKOO="TRUE"
4290     AC_MSG_RESULT([no])
4291 else
4292     DISABLE_LINKOO=
4293     AC_MSG_RESULT([yes])
4295 AC_SUBST(DISABLE_LINKOO)
4297 # Set the ENABLE_LTO variable
4298 # ===================================================================
4299 AC_MSG_CHECKING([whether to use link-time optimization])
4300 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
4301     ENABLE_LTO="TRUE"
4302     AC_MSG_RESULT([yes])
4303 else
4304     ENABLE_LTO=""
4305     AC_MSG_RESULT([no])
4307 AC_SUBST(ENABLE_LTO)
4309 if test "$enable_headless" = "yes"; then
4310     # be sure to do not mess with uneeded stuff
4311     test_randr=no
4312     test_xrender=no
4313     test_cups=no
4314     test_dbus=no
4315     test_fontconfig=yes
4316     test_gtk=no
4317     build_gstreamer=no
4318     build_gstreamer_0_10=no
4319     test_tde=no
4320     test_kde=no
4321     test_kde4=no
4322     enable_cairo_canvas=no
4323     enable_gnome_vfs=no
4326 dnl ===================================================================
4327 dnl check for cups support
4328 dnl ===================================================================
4329 ENABLE_CUPS=""
4331 if test "$enable_cups" = "no"; then
4332     test_cups=no
4335 AC_MSG_CHECKING([whether to enable CUPS support])
4336 if test "$test_cups" = "yes"; then
4337     ENABLE_CUPS="TRUE"
4338     AC_MSG_RESULT([yes])
4340     AC_MSG_CHECKING([whether cups support is present])
4341     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4342     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4343     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -a "$ac_cv_header_cups_cups_h" != "yes"; then
4344         AC_MSG_ERROR([Could not find CUPS. Install libcupsys2-dev or cups-devel.])
4345     fi
4347 else
4348     AC_MSG_RESULT([no])
4351 AC_SUBST(ENABLE_CUPS)
4353 # fontconfig checks
4354 if test "$test_fontconfig" = "yes"; then
4355     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.2.0])
4356 else
4357     case "$BUILD_TYPE" in
4358     *FONTCONFIG*)
4359         FONTCONFIG_LIBS="-lfontconfig"
4360         ;;
4361     esac
4363 AC_SUBST(FONTCONFIG_CFLAGS)
4364 AC_SUBST(FONTCONFIG_LIBS)
4366 dnl whether to find & fetch external tarballs?
4367 dnl ===================================================================
4368 if test -z "$TARFILE_LOCATION"; then
4369     TARFILE_LOCATION="$SRC_ROOT/src"
4371 AC_SUBST(TARFILE_LOCATION)
4373 AC_MSG_CHECKING([whether we want to fetch tarballs])
4374 if test "$enable_fetch_external" != "no"; then
4375     if test "$with_all_tarballs" = "yes"; then
4376         AC_MSG_RESULT(["yes, all of them"])
4377         DO_FETCH_TARBALLS="ALL"
4378     else
4379         AC_MSG_RESULT(["yes, if we use them"])
4380         DO_FETCH_TARBALLS="YES"
4381     fi
4382 else
4383     AC_MSG_RESULT([no])
4384     DO_FETCH_TARBALLS="NO"
4386 AC_SUBST(DO_FETCH_TARBALLS)
4388 AC_MSG_CHECKING([whether to build help])
4389 if test "$with_help" = "yes" -a $_os != iOS -a $_os != Android; then
4390     AC_MSG_RESULT([yes])
4391     BUILD_TYPE="$BUILD_TYPE HELP"
4392     SCPDEFS="$SCPDEFS -DWITH_HELP"
4393     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4394 else
4395     AC_MSG_RESULT([no])
4398 dnl Test whether to include MySpell dictionaries
4399 dnl ===================================================================
4400 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4401 if test "$with_myspell_dicts" = "yes"; then
4402     AC_MSG_RESULT([yes])
4403     WITH_MYSPELL_DICTS=YES
4404     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4405     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4406 else
4407     AC_MSG_RESULT([no])
4408     WITH_MYSPELL_DICTS=NO
4410 AC_SUBST(WITH_MYSPELL_DICTS)
4412 AC_MSG_CHECKING([whether to use dicts from external paths])
4413 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4414     AC_MSG_RESULT([yes])
4415     SYSTEM_DICTS=YES
4416     AC_MSG_CHECKING([for spelling dictionary directory])
4417     if test -n "$with_external_dict_dir"; then
4418         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4419     else
4420         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4421         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4422             DICT_SYSTEM_DIR=file:///usr/share/myspell
4423         fi
4424     fi
4425     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4426     AC_MSG_CHECKING([for hyphenation patterns directory])
4427     if test -n "$with_external_hyph_dir"; then
4428         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4429     else
4430         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4431     fi
4432     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4433     AC_MSG_CHECKING([for thesaurus directory])
4434     if test -n "$with_external_thes_dir"; then
4435         THES_SYSTEM_DIR=file://$with_external_thes_dir
4436     else
4437         THES_SYSTEM_DIR=file:///usr/share/mythes
4438     fi
4439     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4440 else
4441     AC_MSG_RESULT([no])
4442     SYSTEM_DICTS=NO
4444 AC_SUBST(SYSTEM_DICTS)
4445 AC_SUBST(DICT_SYSTEM_DIR)
4446 AC_SUBST(HYPH_SYSTEM_DIR)
4447 AC_SUBST(THES_SYSTEM_DIR)
4449 dnl ===================================================================
4450 AC_MSG_CHECKING([whether to enable pch feature])
4451 if test -n "$enable_pch" && test "$enable_pch" != "no"; then
4452     if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
4453         ENABLE_PCH="TRUE"
4454         AC_MSG_RESULT([yes])
4455     elif test "$GCC" = "yes"; then
4456         ENABLE_PCH="TRUE"
4457         AC_MSG_RESULT([yes])
4458     else
4459         ENABLE_PCH=""
4460         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4461     fi
4462 else
4463     ENABLE_PCH=""
4464     AC_MSG_RESULT([no])
4466 AC_SUBST(ENABLE_PCH)
4468 dnl ===================================================================
4469 dnl Search all the common names for GNU make
4470 dnl ===================================================================
4471 AC_MSG_CHECKING([for GNU make])
4473 # try to use our own make if it is available and GNUMAKE was not already defined
4474 if test -z "$GNUMAKE"; then
4475     if test -x "/opt/lo/bin/make"; then
4476         GNUMAKE="/opt/lo/bin/make"
4477     fi
4480 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
4481     if test -n "$a"; then
4482         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
4483         if test $? -eq 0;  then
4484             GNUMAKE=`which $a`
4485             break
4486         fi
4487     fi
4488 done
4489 AC_MSG_RESULT($GNUMAKE)
4490 if test -z "$GNUMAKE"; then
4491     AC_MSG_ERROR([not found. install GNU make.])
4494 TAB=`printf '\t'`
4496 AC_MSG_CHECKING([the GNU make version])
4497 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4498 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4499 if test "$_make_longver" -ge "038200"; then
4500     AC_MSG_RESULT([$GNUMAKE $_make_version])
4502 elif test "$_make_longver" -ge "038100"; then
4503     if test "$build_os" = "cygwin"; then
4504         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4505     fi
4506     AC_MSG_RESULT([$GNUMAKE $_make_version])
4508     dnl ===================================================================
4509     dnl Search all the common names for sha1sum
4510     dnl ===================================================================
4511     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4512     if test -z "$SHA1SUM"; then
4513         AC_MSG_ERROR([install the approproate SHA-1 checksumming program for this OS])
4514     elif test "$SHA1SUM" = "openssl"; then
4515         SHA1SUM="openssl sha1"
4516     fi
4517     AC_MSG_CHECKING([for GNU make bug 20033])
4518     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4519     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4520 A := \$(wildcard *.a)
4522 .PHONY: all
4523 all: \$(A:.a=.b)
4524 <TAB>@echo survived bug20033.
4526 .PHONY: setup
4527 setup:
4528 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4530 define d1
4531 @echo lala \$(1)
4532 @sleep 1
4533 endef
4535 define d2
4536 @echo tyty \$(1)
4537 @sleep 1
4538 endef
4540 %.b : %.a
4541 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4542 <TAB>\$(call d1,\$(CHECKSUM)),\
4543 <TAB>\$(call d2,\$(CHECKSUM)))
4545     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4546         no_parallelism_make="YES"
4547         AC_MSG_RESULT([yes, disable parallelism])
4548     else
4549         AC_MSG_RESULT([no, keep parallelism enabled])
4550     fi
4551     rm -rf $TESTGMAKEBUG20033
4552 else
4553     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4556 # find if gnumake support file function
4557 AC_MSG_CHECKING([whether GNU make supports the 'file' function])
4558 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4559 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4560 \$(file >test.txt,Success )
4562 .PHONY: all
4563 all:
4564 <TAB>@cat test.txt
4567 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4568 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4569     HAVE_GNUMAKE_FILE_FUNC="YES"
4570     AC_MSG_RESULT([yes])
4571 else
4572     AC_MSG_RESULT([no])
4574 rm -rf $TESTGMAKEFILEFUNC
4575 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4576 AC_SUBST(GNUMAKE)
4578 _make_ver_check=`$GNUMAKE --version | grep LibreOffice`
4579 STALE_MAKE=
4580 make_warning=
4581 if test "$_make_ver_check" = ""; then
4582    STALE_MAKE=TRUE
4585 HAVE_LD_HASH_STYLE=FALSE
4586 WITH_LINKER_HASH_STYLE=
4587 AC_MSG_CHECKING( for --hash-style gcc linker support )
4588 if test "$GCC" = "yes"; then
4589     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4590         hash_styles="gnu sysv"
4591     elif test "$with_linker_hash_style" = "no"; then
4592         hash_styles=
4593     else
4594         hash_styles="$with_linker_hash_style"
4595     fi
4597     for hash_style in $hash_styles; do
4598         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4599         hash_style_ldflags_save=$LDFLAGS
4600         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
4602         AC_LINK_IFELSE([AC_LANG_PROGRAM(
4603             [
4604 #include <stdio.h>
4605             ],[
4606 printf ("");
4607             ])],
4608             [ if ./conftest$EXEEXT; then
4609                   HAVE_LD_HASH_STYLE=TRUE
4610                   WITH_LINKER_HASH_STYLE=$hash_style
4611               fi],
4612             [HAVE_LD_HASH_STYLE=FALSE])
4613         LDFLAGS=$hash_style_ldflags_save
4614     done
4616     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
4617         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
4618     else
4619         AC_MSG_RESULT( no )
4620     fi
4621     LDFLAGS=$hash_style_ldflags_save
4622 else
4623     AC_MSG_RESULT( no )
4625 AC_SUBST(HAVE_LD_HASH_STYLE)
4626 AC_SUBST(WITH_LINKER_HASH_STYLE)
4628 dnl ===================================================================
4629 dnl Check whether there's a Perl version available.
4630 dnl ===================================================================
4631 if test -z "$with_perl_home"; then
4632     AC_PATH_PROG(PERL, perl)
4633 else
4634     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
4635     _perl_path="$with_perl_home/bin/perl"
4636     if test -x "$_perl_path"; then
4637         PERL=$_perl_path
4638     else
4639         AC_MSG_ERROR([$_perl_path not found])
4640     fi
4643 dnl ===================================================================
4644 dnl Testing for Perl version 5 or greater.
4645 dnl $] is the Perl version variable, it is returned as an integer
4646 dnl ===================================================================
4647 if test "$PERL"; then
4648     AC_MSG_CHECKING([the Perl version])
4649     ${PERL} -e "exit($]);"
4650     _perl_version=$?
4651     if test "$_perl_version" -lt 5; then
4652         AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
4653     fi
4654     AC_MSG_RESULT([checked (perl $_perl_version)])
4655 else
4656     AC_MSG_ERROR([Perl not found, install version 5 of Perl])
4659 dnl ===================================================================
4660 dnl Testing for required Perl modules
4661 dnl ===================================================================
4663 AC_MSG_CHECKING([for required Perl modules])
4664 if `$PERL -e 'use Archive::Zip; use Cwd; use Digest::MD5'`; then
4665     AC_MSG_RESULT([all modules found])
4666 else
4667     AC_MSG_ERROR([Failed to find some modules])
4671 dnl ===================================================================
4672 dnl Check for pkg-config
4673 dnl ===================================================================
4674 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
4675     PKG_PROG_PKG_CONFIG
4678 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
4680     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
4681     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
4682     # explicitly. Or put /path/to/compiler in PATH yourself.
4684     AC_CHECK_TOOL(AR,ar)
4685     AC_CHECK_TOOL(NM,nm)
4686     AC_CHECK_TOOL(OBJDUMP,objdump)
4687     AC_CHECK_TOOL(RANLIB,ranlib)
4688     AC_CHECK_TOOL(STRIP,strip)
4689     if test "$_os" = "WINNT"; then
4690         AC_CHECK_TOOL(DLLTOOL,dlltool)
4691         AC_CHECK_TOOL(WINDRES,windres)
4692     fi
4694 AC_SUBST(AR)
4695 AC_SUBST(DLLTOOL)
4696 AC_SUBST(NM)
4697 AC_SUBST(OBJDUMP)
4698 AC_SUBST(PKG_CONFIG)
4699 AC_SUBST(RANLIB)
4700 AC_SUBST(STRIP)
4701 AC_SUBST(WINDRES)
4703 dnl ===================================================================
4704 dnl pkg-config checks on Mac OS X
4705 dnl ===================================================================
4707 if test $_os = Darwin; then
4708     AC_MSG_CHECKING([for bogus pkg-config])
4709     if test -n "$PKG_CONFIG"; then
4710         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
4711             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
4712         else
4713             if test "$enable_bogus_pkg_config" = "yes"; then
4714                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
4715             else
4716                 AC_MSG_ERROR([yes, from unknown origin. This *will* break the build. Please remove or hide $PKG_CONFIG])
4717             fi
4718         fi
4719     else
4720         AC_MSG_RESULT([no, good])
4721     fi
4724 find_csc()
4726     # Return value: $csctest
4728     unset csctest
4730     if test $VCVER -eq 90; then
4731         reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v3.5/InstallPath"
4732         if test -n "$regvalue"; then
4733             csctest=$regvalue
4734             return
4735         fi
4736         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/InstallRoot
4737         if test -n "$regvalue"; then
4738             csctest=${regvalue}"v2.0.50727"
4739             return
4740         fi
4741     else
4742         reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
4743         if test -n "$regvalue"; then
4744             csctest=$regvalue
4745             return
4746         fi
4747     fi
4750 find_al()
4752     # Return value: $altest
4754     unset altest
4756     for x in `ls /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
4757         reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
4758         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
4759             altest=$regvalue
4760             return
4761         fi
4762     done
4765 find_dotnetsdk()
4767     # Return value: $frametest (that's a silly name...)
4769     unset frametest
4771     for ver in 1.1 2.0; do
4772         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
4773         if test -n "$regvalue"; then
4774             frametest=$regvalue
4775             return
4776         fi
4777     done
4780 find_winsdk_version()
4782     # Args: $1 : SDK version as in "6.0A", "7.0" etc
4783     # Return value: $winsdktest
4785     unset winsdktest
4787     # Why we look for them in this particular order I don't know. But OTOH I
4788     case "$1" in
4789     6.0*|7.*)
4790         reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
4791         if test -n "$regvalue"; then
4792             winsdktest=$regvalue
4793             return
4794         fi
4795         ;;
4796     8.*)
4797         reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
4798         if test -n "$regvalue"; then
4799             winsdktest=$regvalue
4800             return
4801         fi
4802         ;;
4803     esac
4806 find_winsdk()
4808     # Args: $1 (optional) : list of acceptable SDK versions
4809     # Return value: $winsdktest
4811     unset winsdktest
4813     if test -n "$1"; then
4814         sdkversions=$1
4815     else
4816         sdkversions="$WINDOWS_SDK_ACCEPTABLE_VERSIONS"
4817     fi
4819     for ver in $sdkversions; do
4820         find_winsdk_version $ver
4821         if test -n "$winsdktest"; then
4822             return
4823         fi
4824     done
4827 find_msms()
4829     for ver in 9.0 10.0 11.0; do
4830         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
4831         if test -n "$regvalue"; then
4832             if test -e "$regvalue/Microsoft_VC${VCVER}_CRT_x86.msm"; then
4833                 msmdir=$regvalue
4834                 break
4835             fi
4836         fi
4837     done
4838     if test -z "$msmdir"; then
4839         AC_MSG_NOTICE([no registry entry for Merge Module directory - trying "$COMMONPROGRAMFILES\Merge Modules"])
4840         msmdir="$COMMONPROGRAMFILES\Merge Modules"
4841     fi
4842     msmdir=`cygpath -d "$msmdir"`
4843     msmdir=`cygpath -u "$msmdir"`
4844     if test -z "$msmdir"; then
4845         AC_MSG_ERROR([Merge modules not found])
4846     fi
4848     msms="Microsoft_VC${VCVER}_CRT_x86.msm"
4850     if test "$VCVER" = "90"; then
4851         if test -e $msmdir/policy_9_0_Microsoft_VC90_CRT_x86.msm; then
4852             msms="$msms policy_9_0_Microsoft_VC90_CRT_x86.msm"
4853         else
4854             AC_MSG_ERROR([Merge module policy_9_0_Microsoft_VC90_CRT_x86.msm not found])
4855         fi
4856     fi
4858     if test "$BUILD_X64" = TRUE; then
4859         if test "$VCVER" = "90"; then
4860             if test -e $msmdir/policy_9_0_Microsoft_VC90_CRT_x86_x64.msm; then
4861                 msms="$msms policy_9_0_Microsoft_VC90_CRT_x86_x64.msm"
4862             else
4863                 AC_MSG_ERROR([Merge module policy_9_0_Microsoft_VC90_CRT_x86_x64.msm not found])
4864             fi
4865             if test -e $msmdir/Microsoft_VC90_CRT_x86_x64.msm; then
4866                 msms="$msms Microsoft_VC90_CRT_x86_x64.msm"
4867             else
4868                 AC_MSG_ERROR([Merge module Microsoft_VC90_CRT_x86_x64.msm not found])
4869             fi
4870         fi
4871     fi
4874 find_msvc_x64_dlls()
4876     if test "$VCVER" != "90"; then
4877         msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
4878         MSVC_DEBUG_DLL_PATH="$VC_PRODUCT_DIR/redist/Debug_NonRedist/$vsarch/Microsoft.VC${VCVER}.DebugCRT"
4879         msvcdlls="msvcp${VCVER}.dll msvcr${VCVER}.dll"
4880         MSVC_DEBUG_DLLS="msvcp${VCVER}d.dll msvcr${VCVER}d.dll"
4881         for dll in $msvcdlls; do
4882             if ! test -f "$msvcdllpath/$dll"; then
4883                 AC_MSG_ERROR([can not find $dll in $msvcdllpath])
4884             fi
4885         done
4886         if test -n "$MSVC_USE_DEBUG_RUNTIME"; then
4887             for dll in $MSVC_DEBUG_DLLS; do
4888                 if ! test -f "$MSVC_DEBUG_DLL_PATH/$dll"; then
4889                     AC_MSG_ERROR([can not find $dll in $MSVC_DEBUG_DLL_PATH])
4890                 fi
4891             done
4892         fi
4893     fi
4896 if test "$build_os" = "cygwin"; then
4897     dnl Check midl.exe
4898     AC_MSG_CHECKING([for midl.exe])
4900     find_winsdk
4901     if test -f "$winsdktest/Bin/midl.exe"; then
4902         MIDL_PATH="$winsdktest/Bin"
4903     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
4904         MIDL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
4905     fi
4906     if test ! -f "$MIDL_PATH/midl.exe"; then
4907         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
4908     else
4909         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
4910     fi
4912     # Convert to posix path with 8.3 filename restrictions ( No spaces )
4913     MIDL_PATH=`cygpath -d "$MIDL_PATH"`
4914     MIDL_PATH=`cygpath -u "$MIDL_PATH"`
4916     dnl Check csc.exe
4917     AC_MSG_CHECKING([for csc.exe])
4918     find_csc
4919     if test -f "$csctest/csc.exe"; then
4920         CSC_PATH="$csctest"
4921     fi
4922     if test ! -f "$CSC_PATH/csc.exe"; then
4923         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
4924     else
4925         AC_MSG_RESULT([$CSC_PATH/csc.exe])
4926     fi
4928     CSC_PATH=`cygpath -d "$CSC_PATH"`
4929     CSC_PATH=`cygpath -u "$CSC_PATH"`
4931     dnl Check al.exe
4932     AC_MSG_CHECKING([for al.exe])
4933     find_winsdk
4934     if test -f "$winsdktest/Bin/al.exe"; then
4935         AL_PATH="$winsdktest/Bin"
4936     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
4937         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
4938     fi
4940     if test -z "$AL_PATH"; then
4941         find_al
4942         if test -f "$altest/bin/al.exe"; then
4943             AL_PATH="$altest/bin"
4944         elif test -f "$altest/al.exe"; then
4945             AL_PATH="$altest"
4946         fi
4947     fi
4948     if test ! -f "$AL_PATH/al.exe"; then
4949         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
4950     else
4951         AC_MSG_RESULT([$AL_PATH/al.exe])
4952     fi
4954     AL_PATH=`cygpath -d "$AL_PATH"`
4955     AL_PATH=`cygpath -u "$AL_PATH"`
4957     dnl Check mscoree.lib / .NET Framework dir
4958     AC_MSG_CHECKING(.NET Framework)
4959     find_dotnetsdk
4960     if test -f "$frametest/lib/mscoree.lib"; then
4961         DOTNET_FRAMEWORK_HOME="$frametest"
4962     else
4963         find_winsdk
4964         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/win8/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
4965             DOTNET_FRAMEWORK_HOME="$winsdktest"
4966         fi
4967     fi
4969     if test ! -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib" -a ! -f "$DOTNET_FRAMEWORK_HOME/lib/win8/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
4970         AC_MSG_ERROR([mscoree.lib (.NET Framework) not found])
4971     fi
4972     AC_MSG_RESULT(found)
4974     PathFormat "$MIDL_PATH"
4975     MIDL_PATH="$formatted_path"
4977     PathFormat "$AL_PATH"
4978     AL_PATH="$formatted_path"
4980     PathFormat "$DOTNET_FRAMEWORK_HOME"
4981     DOTNET_FRAMEWORK_HOME="$formatted_path"
4983     PathFormat "$CSC_PATH"
4984     CSC_PATH="$formatted_path"
4987 dnl ===================================================================
4988 dnl Check if stdc headers are available excluding MSVC.
4989 dnl ===================================================================
4990 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
4991     AC_HEADER_STDC
4994 dnl ===================================================================
4995 dnl Testing for C++ compiler and version...
4996 dnl ===================================================================
4998 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
4999     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5000     save_CXXFLAGS=$CXXFLAGS
5001     AC_PROG_CXX
5002     CXXFLAGS=$save_CXXFLAGS
5003 else
5004     if test -n "$CC" -a -z "$CXX"; then
5005         CXX="$CC"
5006     fi
5009 dnl check if we are using a buggy version of g++ (currently 3.4.0, 3.4.1 and trunk)
5010 if test "$GXX" = "yes"; then
5011     AC_MSG_CHECKING([the GNU C++ compiler version])
5013     _gpp_version=`$CXX -dumpversion`
5014     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5016     AC_MSG_RESULT([checked (g++ $_gpp_version)])
5018     if test "$_gpp_majmin" = "304"; then
5019         AC_MSG_CHECKING([whether $CXX has the enum bug])
5020         AC_RUN_IFELSE([AC_LANG_SOURCE([[
5021             extern "C" void abort (void);
5022             extern "C" void exit (int status);
5024             enum E { E0, E1, E2, E3, E4, E5 };
5026             void test (enum E e)
5027             {
5028                 if (e == E2 || e == E3 || e == E1)
5029                     exit (1);
5030             }
5032             int main (void)
5033             {
5034                 test (E4);
5035                 test (E5);
5036                 test (E0);
5037                 return 0;
5038             }
5039             ]])],[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])],[])
5040     fi
5041     dnl see https://code.google.com/p/android/issues/detail?id=41770
5042     if test "$_gpp_majmin" -ge "407"; then
5043             glibcxx_threads=no
5044             AC_LANG_PUSH([C++])
5045             AC_REQUIRE_CPP
5046             AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5047             AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5048                 #include <bits/c++config.h>]],[[
5049                 #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5050                 && !defined(_GLIBCXX__PTHREADS) \
5051                 && !defined(_GLIBCXX_HAS_GTHREADS)
5052                 choke me
5053                 #endif
5054             ]])],[AC_MSG_RESULT([yes])
5055             glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5056             AC_LANG_POP([C++])
5057             if test $glibcxx_threads = yes; then
5058                   BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5059             fi
5060      fi
5062 AC_SUBST(BOOST_CXXFLAGS)
5065 # prefx CXX with ccache if needed
5067 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5068     if test "$CCACHE" != ""; then
5069         AC_MSG_CHECKING([whether $CXX is already ccached])
5070         AC_LANG_PUSH([C++])
5071         save_CXXFLAGS=$CXXFLAGS
5072         CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5073         dnl an empty program will do, we're checking the compiler flags
5074         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5075                           [use_ccache=yes], [use_ccache=no])
5076         if test $use_ccache = yes; then
5077             AC_MSG_RESULT([yes])
5078         else
5079             CXX="$CCACHE $CXX"
5080             AC_MSG_RESULT([no])
5081         fi
5082         CXXFLAGS=$save_CXXFLAGS
5083         AC_LANG_POP([C++])
5084     fi
5087 dnl ===================================================================
5088 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5089 dnl ===================================================================
5091 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5092     AC_PROG_CXXCPP
5094     dnl Check whether there's a C pre-processor.
5095     dnl ===================================================================
5096     dnl When using SunStudio compiler, there is a bug with the cc
5097     dnl preprocessor, so use CC preprocessor as the cc preprocessor
5098     dnl See Issuezilla #445.
5099     dnl ===================================================================
5100     if test "$_os" = "SunOS"; then
5101         CPP=$CXXCPP
5102     else
5103         AC_PROG_CPP
5104     fi
5108 dnl ===================================================================
5109 dnl Find integral type sizes and alignments
5110 dnl ===================================================================
5112 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5114     AC_CHECK_SIZEOF(long)
5115     AC_CHECK_SIZEOF(short)
5116     AC_CHECK_SIZEOF(int)
5117     AC_CHECK_SIZEOF(long long)
5118     AC_CHECK_SIZEOF(double)
5119     AC_CHECK_SIZEOF(void*)
5121     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5122     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5123     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5124     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5125     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5127     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5128     m4_pattern_allow([AC_CHECK_ALIGNOF])
5129     m4_ifdef([AC_CHECK_ALIGNOF],
5130         [
5131             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5132             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5133             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5134             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5135         ],
5136         [
5137             case "$_os-$host_cpu" in
5138             Linux-i686)
5139                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5140                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5141                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5142                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5143                 ;;
5144             Linux-x86_64)
5145                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5146                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5147                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5148                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5149                 ;;
5150             *)
5151                 if test -z "$ac_cv_alignof_short" -o \
5152                         -z "$ac_cv_alignof_int" -o \
5153                         -z "$ac_cv_alignof_long" -o \
5154                         -z "$ac_cv_alignof_double"; then
5155                    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.])
5156                 fi
5157                 ;;
5158             esac
5159         ])
5161     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5162     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5163     if test $ac_cv_sizeof_long -eq 8; then
5164         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5165     elif test $ac_cv_sizeof_double -eq 8; then
5166         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5167     else
5168         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5169     fi
5171     AC_C_BIGENDIAN
5172     WORDS_BIGENDIAN=$ac_cv_c_bigendian
5174     dnl Check for large file support
5175     AC_SYS_LARGEFILE
5176     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5177         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5178     fi
5179     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5180         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5181     fi
5182 else
5183     # Hardcode for MSVC
5184     SAL_TYPES_SIZEOFSHORT=2
5185     SAL_TYPES_SIZEOFINT=4
5186     SAL_TYPES_SIZEOFLONG=4
5187     SAL_TYPES_SIZEOFLONGLONG=8
5188     if test "$BITNESS_OVERRIDE" = ""; then
5189         SAL_TYPES_SIZEOFPOINTER=4
5190     else
5191         SAL_TYPES_SIZEOFPOINTER=8
5192     fi
5193     SAL_TYPES_ALIGNMENT2=2
5194     SAL_TYPES_ALIGNMENT4=4
5195     SAL_TYPES_ALIGNMENT8=8
5196     WORDS_BIGENDIAN=no
5197     LFS_CFLAGS=''
5199 AC_SUBST(WORDS_BIGENDIAN)
5200 AC_SUBST(LFS_CFLAGS)
5202 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5203 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5204 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5205 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5206 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5207 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5208 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5209 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5211 dnl ===================================================================
5212 dnl Check if valgrind headers are available
5213 dnl ===================================================================
5214 if test "$cross_compiling" = yes; then
5215     ENABLE_VALGRIND=FALSE
5216 else
5217     prev_cppflags=$CPPFLAGS
5218     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5219     AC_CHECK_HEADER([valgrind/valgrind.h],
5220         [ENABLE_VALGRIND=TRUE],[ENABLE_VALGRIND=FALSE])
5221     CPPFLAGS=$prev_cppflags
5223 AC_SUBST([ENABLE_VALGRIND])
5224 if test "$ENABLE_VALGRIND" = FALSE; then
5225     VALGRIND_CFLAGS=
5227 AC_SUBST([VALGRIND_CFLAGS])
5229 dnl ===================================================================
5230 dnl Compiler plugins
5231 dnl ===================================================================
5233 COMPILER_PLUGINS=
5234 # currently only Clang
5235 if test "$COM_GCC_IS_CLANG" = "TRUE"; then
5236     if test -n "$enable_compiler_plugins"; then
5237         compiler_plugins="$enable_compiler_plugins"
5238     elif test -n "$ENABLE_DBGUTIL"; then
5239         compiler_plugins=test
5240     else
5241         compiler_plugins=no
5242     fi
5243     if test "$compiler_plugins" != "no"; then
5244         dnl The prefix where Clang resides, override to where Clang resides if
5245         dnl using a source build:
5246         if test -z "$CLANGDIR"; then
5247             CLANGDIR=/usr
5248         fi
5249         dnl The build directory (different from CLANGDIR if using a Clang out-
5250         dnl of-source build):
5251         if test -z "$CLANGBUILD"; then
5252             CLANGBUILD=/usr
5253         fi
5254         AC_LANG_PUSH([C++])
5255         save_CPPFLAGS=$CPPFLAGS
5256         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"
5257         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
5258             [COMPILER_PLUGINS=TRUE],
5259             [
5260             if test "$compiler_plugins" = "yes"; then
5261                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
5262             else
5263                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
5264                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
5265             fi
5266             ])
5267         CPPFLAGS=$save_CPPFLAGS
5268         AC_LANG_POP([C++])
5269     fi
5270 else
5271     if test "$enable_compiler_plugins" = "yes"; then
5272         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
5273     fi
5275 AC_SUBST(COMPILER_PLUGINS)
5276 AC_SUBST(CLANGDIR)
5277 AC_SUBST(CLANGBUILD)
5279 dnl ===================================================================
5280 dnl Set the MinGW sys-root
5281 dnl ===================================================================
5282 if test "$WITH_MINGW" = "yes"; then
5283     AC_MSG_CHECKING([for MinGW sysroot])
5284     sysroot=`$CC -print-sysroot`
5285     AS_IF([test -d "$sysroot"/mingw],
5286           [MINGW_SYSROOT="$sysroot"/mingw
5287            AC_MSG_RESULT([$MINGW_SYSROOT])],
5288           [AC_MSG_RESULT([not found])
5289            AC_MSG_ERROR([cannot determine MinGW sysroot])])
5291 AC_SUBST([MINGW_DLLS])
5292 AC_SUBST([MINGW_SYSROOT])
5294 dnl ===================================================================
5295 dnl Set the MinGW include directories
5296 dnl ===================================================================
5297 if test "$WITH_MINGW" = "yes"; then
5298     AC_MSG_CHECKING([for MinGW include path])
5299     cat >conftest.$ac_ext <<_ACEOF
5300 #include <stddef.h>
5301 #include <bits/c++config.h>
5302 _ACEOF
5303     _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`
5304     rm conftest.$ac_ext
5305     if test -z "$_mingw_lib_include_path"; then
5306         _mingw_lib_include_path="NO_LIB_INCLUDE"
5307         AC_MSG_RESULT([no MinGW include path])
5308     else
5309         AC_MSG_RESULT([$_mingw_lib_include_path])
5310     fi
5311     MINGW_LIB_INCLUDE_PATH="$_mingw_lib_include_path"
5312     AC_SUBST(MINGW_LIB_INCLUDE_PATH)
5314     AC_LANG_PUSH([C++])
5316     AC_MSG_CHECKING([for dynamic libgcc])
5317     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5318 #include <iostream>
5319 using namespace std;
5320 ]], [[ try { throw 42; } catch (int e) { cout << "Yep, " << e << endl; } ]])],[
5321             MINGW_GCCDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libgcc' | $SED -e 's@.*DLL Name: @@'`
5322             if test -n "$MINGW_GCCDLL"; then
5323                 MINGW_SHARED_GCCLIB=YES
5324                 AC_MSG_RESULT([ $MINGW_GCCDLL])
5325             else
5326                 MINGW_SHARED_GCCLIB=NO
5327                 AC_MSG_RESULT([no])
5328             fi
5329        ],[ AC_MSG_RESULT([no])
5331     ])
5333     AC_MSG_CHECKING([for dynamic libstdc++])
5334     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5335 #include <iostream>
5336 using namespace std;
5337 ]], [[ cout << "Hello there." << endl; ]])],[
5338             MINGW_GXXDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libstdc++' | $SED -e 's@.*DLL Name: @@'`
5339             if test -n "$MINGW_GXXDLL"; then
5340                 mingw_gxxdll_root=${MINGW_GXXDLL%.dll}
5341                 mingw_gxxdll_root=${mingw_gxxdll_root#lib}
5342                 if test "$CROSS_COMPILING" = "YES"; then
5343                     dnl m4 escaping!
5344                     mingw_gxxdll_root=${mingw_gxxdll_root%-[[0-9]]}
5345                 fi
5346                 MINGW_SHARED_LIBSTDCPP=-l$mingw_gxxdll_root
5347                 MINGW_SHARED_GXXLIB=YES
5348                 AC_MSG_RESULT([$MINGW_GXXDLL])
5349             else
5350                 MINGW_SHARED_GXXLIB=NO
5351                 AC_MSG_RESULT([no])
5352             fi
5353        ],[ AC_MSG_RESULT([no])
5355     ])
5357     AC_LANG_POP([C++])
5359     AC_SUBST(MINGW_SHARED_GCCLIB)
5360     AC_SUBST(MINGW_SHARED_GXXLIB)
5361     AC_SUBST(MINGW_SHARED_LIBSTDCPP)
5362     AC_SUBST(MINGW_GCCDLL)
5363     AC_SUBST(MINGW_GXXDLL)
5366 if test "$WITH_MINGW" = "yes"; then
5367     AC_MSG_CHECKING([for fMergeNeutralItems in SCRIPT_CONTROL])
5368     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
5369     [
5370     #include <usp10.h>
5371     ],
5372     [
5373     SCRIPT_CONTROL c;
5374     c.fMergeNeutralItems = 1;
5375     ])],
5376     [
5377     AC_MSG_RESULT(yes)
5378     AC_DEFINE(HAVE_FMERGENEUTRALITEMS)
5379     ],
5380     [AC_MSG_RESULT(no)])
5383 dnl ===================================================================
5384 dnl Extra checking for the SunOS compiler
5385 dnl ===================================================================
5386 if test "$_os" = "SunOS"; then
5387     dnl SunStudio C++ compiler packaged with SunStudio C compiler
5388     if test "$CC" = "cc"; then
5389     AC_MSG_CHECKING([SunStudio C++ Compiler])
5390         if test "$CXX" != "CC"; then
5391             AC_MSG_WARN([SunStudio C++ was not found])
5392             add_warning "SunStudio C++ was not found"
5393         else
5394             AC_MSG_RESULT([checked])
5395         fi
5396     fi
5399 dnl *************************************************************
5400 dnl Testing for exception handling - dwarf2 or sjlj exceptions...
5401 dnl *************************************************************
5402 if test "$WITH_MINGW" = "yes"; then
5403     AC_MSG_CHECKING([exception type])
5404     AC_LANG_PUSH([C++])
5405     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iostream>
5407         extern "C" void _Unwind_SjLj_RaiseException(void) __attribute__ ((__noreturn__));
5409         ]], [[_Unwind_SjLj_RaiseException() ]])],[exceptions_type="sjlj"],[exceptions_type="dwarf2"
5410     ])
5411     AC_MSG_RESULT($exceptions_type)
5412     AC_LANG_POP([C++])
5415 EXCEPTIONS="$exceptions_type"
5416 AC_SUBST(EXCEPTIONS)
5418 dnl ===================================================================
5419 dnl thread-safe statics
5420 dnl ===================================================================
5421 AC_MSG_CHECKING([whether $CXX supports thread safe statics])
5422 unset HAVE_THREADSAFE_STATICS
5423 if test "$GCC" = "yes"; then
5424     dnl -fthreadsafe-statics is available since GCC 4, so always available for
5425     dnl us.  However, some C++ runtimes use a single lock for all static
5426     dnl variables, which can cause deadlock in multi-threaded applications.
5427     dnl This is not easily tested here; for POSIX-based systems, if executing
5428     dnl the following C++ program does not terminate then the tool chain
5429     dnl apparently has this problem:
5430     dnl
5431     dnl   #include <pthread.h>
5432     dnl   int h() { return 0; }
5433     dnl   void * g(void * unused) {
5434     dnl     static int n = h();
5435     dnl     return &n;
5436     dnl   }
5437     dnl   int f() {
5438     dnl     pthread_t t;
5439     dnl     pthread_create(&t, 0, g, 0);
5440     dnl     pthread_join(t, 0);
5441     dnl     return 0;
5442     dnl   }
5443     dnl   int main() {
5444     dnl     static int n = f();
5445     dnl     return n;
5446     dnl   }
5447     dnl
5448     dnl Mac OS X up to at least 10.7.1 is known to have this problem, as is at
5449     dnl least one instance of GCC 4.2.4 (used on a "Linux ooobuild1.osuosl.org
5450     dnl 2.6.9-101.plus.c4smp #1 SMP Thu Jul 21 19:08:15 EDT 2011 i686 i686 i386
5451     dnl GNU/Linux" machine); see the definition of __cxa_guard_acquire in GCC's
5452     dnl libstdc++-v3/libsupc++/guard.cc for what #ifdefs actually make a
5453     dnl difference there.  Conservative advice from Jakub Jelinek is to assume
5454     dnl it working in GCC >= 4.3:
5455     if test "$_os" = "Darwin" -o $_os = Android -o "${GCCVER?}" -lt 040300; then
5456         AC_MSG_RESULT([broken (i.e., no)])
5457     else
5458         HAVE_THREADSAFE_STATICS=TRUE
5459         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5460         AC_MSG_RESULT([yes])
5461     fi
5462 else
5463     AC_MSG_RESULT([unknown (assuming no)])
5465 AC_SUBST(HAVE_THREADSAFE_STATICS)
5467 dnl ===================================================================
5468 dnl visibility and C++11 features
5469 dnl ===================================================================
5470 CXXFLAGS_CXX11=
5471 if test "$GCC" = "yes"; then
5472     AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
5473     save_CFLAGS=$CFLAGS
5474     CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
5475     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_VISIBILITY_FEATURE=TRUE ],[])
5476     CFLAGS=$save_CFLAGS
5478     if test "$COM_GCC_IS_CLANG" = TRUE -a $_os = Darwin; then
5479         # It seems that with Apple's Clang, visibility doesn't work as
5480         # we would want at least in the connectivity and dbaccess
5481         # modules. This might be because of something peculiar in
5482         # those modules? Whatever.
5483         HAVE_GCC_VISIBILITY_FEATURE=
5484     fi
5486     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5487         AC_MSG_RESULT([yes])
5488     else
5489         AC_MSG_RESULT([no])
5490     fi
5492     AC_MSG_CHECKING([whether $CC supports -Wno-long-double])
5493     save_CFLAGS=$CFLAGS
5494     CFLAGS="$CFLAGS -Werror -Wno-long-double"
5495     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_NO_LONG_DOUBLE=TRUE ],[])
5496     CFLAGS=$save_CFLAGS
5497     if test "$HAVE_GCC_NO_LONG_DOUBLE" = "TRUE"; then
5498         AC_MSG_RESULT([yes])
5499     else
5500         AC_MSG_RESULT([no])
5501     fi
5503     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5504     save_CFLAGS=$CFLAGS
5505     CFLAGS="$CFLAGS -Werror -mno-avx"
5506     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5507     CFLAGS=$save_CFLAGS
5508     if test "$HAVE_GCC_AVX" = "TRUE"; then
5509         AC_MSG_RESULT([yes])
5510     else
5511         AC_MSG_RESULT([no])
5512     fi
5514     AC_MSG_CHECKING([whether $CC supports atomic functions])
5515     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5516     int v = 0;
5517     if (__sync_add_and_fetch(&v, 1) != 1 ||
5518         __sync_sub_and_fetch(&v, 1) != 0)
5519         return 1;
5520     __sync_synchronize();
5521     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5522         v != 1)
5523         return 1;
5524     return 0;
5525 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5526     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5527         AC_MSG_RESULT([yes])
5528         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5529     else
5530         AC_MSG_RESULT([no])
5531     fi
5533     AC_MSG_CHECKING(
5534         [whether $CC supports pragma GCC diagnostic error/ignored/warning])
5535     save_CFLAGS=$CFLAGS
5536     CFLAGS="$CFLAGS -Werror -Wunknown-pragmas -Wunused-parameter"
5537     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5538             #pragma GCC diagnostic ignored "-Wunused-parameter"
5539             void dummy(int n) {}
5540         ])], [
5541             AC_DEFINE([HAVE_GCC_PRAGMA_DIAGNOSTIC_MODIFY],[1])
5542             AC_MSG_RESULT([yes])
5543         ], [AC_MSG_RESULT([no])])
5544     CFLAGS=$save_CFLAGS
5546     AC_MSG_CHECKING([whether $CC supports pragma GCC diagnostic push/pop])
5547     save_CFLAGS=$CFLAGS
5548     CFLAGS="$CFLAGS -Werror -Wunknown-pragmas -Wunused-parameter"
5549     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5550             #pragma GCC diagnostic push
5551             #pragma GCC diagnostic ignored "-Wunused-parameter"
5552             void dummy(int n) {}
5553             #pragma GCC diagnostic pop
5554         ])], [
5555             AC_DEFINE([HAVE_GCC_PRAGMA_DIAGNOSTIC_SCOPE],[1])
5556             AC_MSG_RESULT([yes])
5557         ], [AC_MSG_RESULT([no])])
5558     CFLAGS=$save_CFLAGS
5560     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5561 #if __GNUC__ == 4 && __GNUC_MINOR__ == 7 && (__GNUC_PATCHLEVEL__ == 0 || __GNUC_PATCHLEVEL__ == 1)
5562 #else
5563 abi ok
5564 #endif
5565 ]])],[HAVE_BROKEN_ABI=TRUE],[HAVE_BROKEN_ABI=FALSE])
5567     AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
5568     # This should check libstdc++ version, not gcc, but clang has incidentally C++11 support
5569     # disabled in this case by the __float128 case below.
5570     if test "$HAVE_BROKEN_ABI" = "TRUE"; then
5571         AC_MSG_NOTICE([Not using -std=gnu++0x on $CXX version 4.7.0/4.7.1 due to libstdc++ ABI breakage.])
5572     else
5573         save_CXXFLAGS=$CXXFLAGS
5574         CXXFLAGS="$CXXFLAGS -std=gnu++0x"
5575         AC_LANG_PUSH([C++])
5577         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5578 #include <stddef.h>
5580 #include <vector>
5581     // some Clang fail when compiling against GCC 4.7 headers with -std=gnu++0x
5582     // (__float128)
5584 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
5586 namespace
5588         struct b
5589         {
5590                 int i;
5591                 int j;
5592         };
5594 ]], [[
5595 struct a
5597         int i;
5598         int j;
5600 a thinga[]={{0,0}, {1,1}};
5601 b thingb[]={{0,0}, {1,1}};
5602 size_t i = sizeof(sal_n_array_size(thinga));
5603 size_t j = sizeof(sal_n_array_size(thingb));
5604 return !(i != 0 && j != 0);
5605 ]])],[HAVE_CXX0X=TRUE CXXFLAGS_CXX11=-std=gnu++0x],[])
5607         AC_LANG_POP([C++])
5608         CXXFLAGS=$save_CXXFLAGS
5609     fi
5610     if test "$HAVE_CXX0X" = "TRUE"; then
5611         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
5612     else
5613         AC_MSG_RESULT([no])
5614     fi
5617 AC_SUBST(CXXFLAGS_CXX11)
5618 AC_SUBST(HAVE_CXX0X)
5619 AC_SUBST(HAVE_GCC_NO_LONG_DOUBLE)
5620 AC_SUBST(HAVE_GCC_AVX)
5621 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
5623 dnl ==================================
5624 dnl Check for C++11 "= delete" support
5625 dnl ==================================
5627 AC_MSG_CHECKING([whether $CXX supports C++11 = delete syntax])
5628 if test "$HAVE_CXX0X" = "TRUE"; then
5629     save_CXXFLAGS=$CXXFLAGS
5630     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
5631     AC_LANG_PUSH([C++])
5632     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5633 struct A
5634     {
5635     void test() = delete;
5636     };
5637 ]])],[HAVE_CXX11_DELETE=TRUE],[])
5639     AC_LANG_POP([C++])
5640     CXXFLAGS=$save_CXXFLAGS
5641     if test "$HAVE_CXX11_DELETE" = "TRUE"; then
5642         AC_MSG_RESULT([yes])
5643         AC_DEFINE([HAVE_CXX11_DELETE])
5644     else
5645         AC_MSG_RESULT([no])
5646     fi
5647 else
5648     AC_MSG_RESULT([no])
5651 dnl ==================================
5652 dnl Check for C++11 "override" support
5653 dnl ==================================
5655 AC_MSG_CHECKING([whether $CXX supports C++11 "override" syntax])
5656 if test "$HAVE_CXX0X" = "TRUE"; then
5657     save_CXXFLAGS=$CXXFLAGS
5658     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
5659     AC_LANG_PUSH([C++])
5660     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5661 struct A
5663         virtual void test();
5666 struct B : A
5668         virtual void test() override;
5670 ]])],[HAVE_CXX11_OVERRIDE=TRUE],[])
5672     AC_LANG_POP([C++])
5673     CXXFLAGS=$save_CXXFLAGS
5674     if test "$HAVE_CXX11_OVERRIDE" = "TRUE"; then
5675         AC_MSG_RESULT([yes])
5676         AC_DEFINE([HAVE_CXX11_OVERRIDE])
5677     else
5678         AC_MSG_RESULT([no])
5679     fi
5680 else
5681     AC_MSG_RESULT([no])
5684 dnl ==================================
5685 dnl Check for C++11 "final" support
5686 dnl ==================================
5688 AC_MSG_CHECKING([whether $CXX supports C++11 "final" syntax])
5689 if test "$HAVE_CXX0X" = "TRUE"; then
5690     save_CXXFLAGS=$CXXFLAGS
5691     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
5692     AC_LANG_PUSH([C++])
5693     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5694 // First check that this correct program that uses "final" compiles
5695 struct A final
5699 struct B
5701         virtual void test();
5704 struct C : B
5706         void test() final;
5708 ]])],[have_final=yes],[])
5710     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5711 // Then check that the "final" works as expected,
5712 // that this program fails to compile
5713 struct A final
5717 struct B : A
5720 ]])],[],[final_class_works=yes])
5722     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5723 // Also this should fail to compile
5724 struct B
5726         virtual void test();
5729 struct C : B
5731         void test() final;
5734 struct D : C
5736         void test();
5738 ]])],[],[final_method_works=yes])
5739     AC_LANG_POP([C++])
5741     CXXFLAGS=$save_CXXFLAGS
5743     if test "$have_final" = yes -a "$final_class_works" = yes -a "$final_method_works" = yes; then
5744         AC_MSG_RESULT([yes])
5745         AC_DEFINE([HAVE_CXX11_FINAL])
5746     else
5747         AC_MSG_RESULT([no])
5748     fi
5749 else
5750     AC_MSG_RESULT([no])
5753 dnl ===================================================================
5754 dnl Check for C++11 perfect forwarding support
5755 dnl ===================================================================
5756 AC_MSG_CHECKING([whether $CXX supports C++11 perfect forwarding])
5757 save_CXXFLAGS=$CXXFLAGS
5758 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
5759 AC_LANG_PUSH([C++])
5760 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5761         #include <utility>
5762         template<typename T, typename... Args> T * f(Args &&... v) {
5763             return new T(std::forward<Args>(v)...);
5764         }
5765     ]], [[
5766         f<int>(0);
5767     ]])], [perfect_forwarding=yes], [perfect_forwarding=no])
5768 AC_LANG_POP([C++])
5769 CXXFLAGS=$save_CXXFLAGS
5770 AC_MSG_RESULT([$perfect_forwarding])
5771 if test "$perfect_forwarding" = yes; then
5772     AC_DEFINE([HAVE_CXX11_PERFECT_FORWARDING])
5775 dnl ===================================================================
5776 dnl system stl sanity tests
5777 dnl ===================================================================
5778 HAVE_GCC_VISIBILITY_BROKEN=
5779 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \); then
5781     AC_LANG_PUSH([C++])
5783     save_CPPFLAGS="$CPPFLAGS"
5784     if test -n "$MACOSX_SDK_PATH"; then
5785         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
5786     fi
5788     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5789         dnl gcc#19664, gcc#22482, rhbz#162935
5790         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
5791         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
5792         AC_MSG_RESULT([$stlvisok])
5793         if test "$stlvisok" = "no"; then
5794             AC_MSG_WARN([Your gcc STL headers are not visibility safe. Disabling visibility])
5795             add_warning "Your gcc STL headers are not visibility safe. Disabling visibility"
5796             unset HAVE_GCC_VISIBILITY_FEATURE
5797         fi
5798     fi
5800     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5801         sharedlink_ldflags_save=$LDFLAGS
5802         LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden $PICSWITCH $LINKFLAGSSHL"
5804         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
5805         AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5806 #include <sstream>
5807 using namespace std;
5808             ]], [[
5809 istringstream strm( "test" ); return 0;
5810             ]])],
5811             # Ugh, surely bad to assume an error message will contain
5812             # the word "unresolvable", a problem with
5813             # -fvisibility-inlines-hidden and STL headers might cause
5814             # some more obscure message on some platform, and anway,
5815             # the error message could be localised.
5816             [$EGREP -q unresolvable conftest.err;
5817             if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi],[gccvisok=no
5818         ])
5819         AC_MSG_RESULT([$gccvisok])
5820         if test "$gccvisok" = "no"; then
5821             AC_MSG_WARN([Your gcc is not -fvisibility-inlines-hidden safe, disabling that.])
5822             add_warning "Your gcc is not -fvisibility-inlines-hidden safe, disabling that."
5823             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
5824         fi
5826         LDFLAGS=$sharedlink_ldflags_save
5827     fi
5829     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
5830     # when we don't make any dynamic libraries?
5831     if test "$DISABLE_DYNLOADING" = "" -a "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$HAVE_GCC_VISIBILITY_BROKEN" != "TRUE"; then
5832         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
5833         cat > conftestlib1.cc <<_ACEOF
5834 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
5835 struct S2: S1<int> { virtual ~S2(); };
5836 S2::~S2() {}
5837 _ACEOF
5838         cat > conftestlib2.cc <<_ACEOF
5839 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
5840 struct S2: S1<int> { virtual ~S2(); };
5841 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
5842 _ACEOF
5843         gccvisinlineshiddenok=yes
5844         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
5845             gccvisinlineshiddenok=no
5846         else
5847             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $LINKFLAGSNOUNDEFS -o libconftest2$DLLPOST >/dev/null 2>&5; then
5848                 gccvisinlineshiddenok=no
5849             fi
5850         fi
5852         rm -fr libconftest*
5853         AC_MSG_RESULT([$gccvisinlineshiddenok])
5854         if test "$gccvisinlineshiddenok" = "no"; then
5855             AC_MSG_WARN([Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that.])
5856             add_warning "Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that."
5857             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
5858         fi
5859     fi
5861     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5862         AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
5863         cat >visibility.cxx <<_ACEOF
5864 #pragma GCC visibility push(hidden)
5865 struct __attribute__ ((visibility ("default"))) TestStruct {
5866   static void Init();
5868 __attribute__ ((visibility ("default"))) void TestFunc() {
5869   TestStruct::Init();
5871 _ACEOF
5872         if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx 2>/dev/null > /dev/null; then
5873             gccvisbroken=yes
5874         else
5875             case "$host_cpu" in
5876             i?86|x86_64)
5877                 if test "$_os" = "Darwin" -o "$WITH_MINGW" = "yes"; then
5878                     gccvisbroken=no
5879                 else
5880                     if $EGREP -q '@PLT|@GOT' visibility.s; then
5881                         gccvisbroken=no
5882                     else
5883                         gccvisbroken=yes
5884                     fi
5885                 fi
5886                 ;;
5887             *)
5888                 gccvisbroken=no
5889                 ;;
5890             esac
5891         fi
5892         rm -f visibility.s visibility.cxx
5894         AC_MSG_RESULT([$gccvisbroken])
5895         if test "$gccvisbroken" = "yes"; then
5896             AC_MSG_WARN([Your gcc is not -fvisibility=hidden safe. Disabling visibility])
5897             add_warning "Your gcc is not -fvisibility=hidden safe. Disabling visibility"
5898             unset HAVE_GCC_VISIBILITY_FEATURE
5899         fi
5900     fi
5902     CPPFLAGS="$save_CPPFLAGS"
5904     AC_LANG_POP([C++])
5907 AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE)
5908 AC_SUBST(HAVE_GCC_VISIBILITY_BROKEN)
5910 dnl ===================================================================
5911 dnl  Clang++ tests
5912 dnl ===================================================================
5914 HAVE_GCC_FNO_DEFAULT_INLINE=
5915 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
5916 if test "$GCC" = "yes"; then
5917     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
5918     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
5919         # Option just ignored and silly warning that isn't a real
5920         # warning printed
5921         :
5922     else
5923         AC_LANG_PUSH([C++])
5924         save_CXXFLAGS=$CXXFLAGS
5925         CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
5926         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
5927         CXXFLAGS=$save_CXXFLAGS
5928         AC_LANG_POP([C++])
5929     fi
5930     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
5931         AC_MSG_RESULT([yes])
5932     else
5933         AC_MSG_RESULT([no])
5934     fi
5936     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
5937     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
5938         # As above
5939         :
5940     else
5941         AC_LANG_PUSH([C++])
5942         save_CXXFLAGS=$CXXFLAGS
5943         CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
5944         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
5945         CXXFLAGS=$save_CXXFLAGS
5946         AC_LANG_POP([C++])
5947     fi
5948     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
5949         AC_MSG_RESULT([yes])
5950     else
5951         AC_MSG_RESULT([no])
5952     fi
5954 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
5955 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
5958 dnl ===================================================================
5959 dnl allocator
5960 dnl ===================================================================
5961 AC_MSG_CHECKING([which memory allocator to use])
5962 if test "$with_alloc" = "system"; then
5963     AC_MSG_RESULT([system])
5964     ALLOC="SYS_ALLOC"
5965     AC_CHECK_FUNCS([malloc realloc calloc free])
5967 if test "$with_alloc" = "tcmalloc"; then
5968     AC_MSG_RESULT(tcmalloc)
5969     if ! echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
5970         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
5971     fi
5972     AC_CHECK_LIB([tcmalloc], [malloc], [:],
5973         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
5974     ALLOC="TCMALLOC"
5976 if test "$with_alloc" = "jemalloc"; then
5977     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
5978         AC_MSG_RESULT(jemalloc)
5979         save_CFLAGS=$CFLAGS
5980         CFLAGS="$CFLAGS -pthread"
5981         AC_CHECK_LIB([jemalloc], [malloc], [:],
5982             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
5983         ALLOC="JEMALLOC"
5984         CFLAGS=$save_CFLAGS
5985     else
5986         AC_MSG_RESULT([system])
5987         ALLOC="SYS_ALLOC"
5988         AC_CHECK_FUNCS([malloc realloc calloc free])
5989     fi
5991 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
5992     AC_MSG_RESULT([internal])
5994 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
5995 AC_SUBST(HAVE_POSIX_FALLOCATE)
5996 AC_SUBST(ALLOC)
5998 dnl ===================================================================
5999 dnl Custom build version
6000 dnl ===================================================================
6002 AC_MSG_CHECKING([whether to add custom build version])
6003 if test "$with_build_version" != ""; then
6004     BUILD_VER_STRING=$with_build_version
6005     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6006 else
6007     BUILD_VER_STRING=
6008     AC_MSG_RESULT([no])
6010 AC_SUBST(BUILD_VER_STRING)
6012 dnl ===================================================================
6013 dnl Java support enable
6014 dnl ===================================================================
6015 AC_MSG_CHECKING([whether to build with Java support])
6016 if test "$with_java" != "no"; then
6017     if test "$DISABLE_SCRIPTING" = TRUE; then
6018         AC_MSG_RESULT([no, overridden by --disable-scripting])
6019         SOLAR_JAVA=""
6020         with_java=no
6021     else
6022         AC_MSG_RESULT([yes])
6023         SOLAR_JAVA="TRUE"
6024     fi
6025 else
6026     AC_MSG_RESULT([no])
6027     SOLAR_JAVA=""
6030 AC_SUBST(SOLAR_JAVA)
6032 dnl SOLAR_JAVA="YES" (yes, silly name, should rename) indicates whether we
6033 dnl want there to be *run-time* (and build-time) support for Java extensions in the
6034 dnl built LibreOffice.
6036 dnl SOLAR_JAVA="BUILD" is claimed to indicate build-time only support
6037 dnl (no runtime support). It doesn't seem to ever be set to this
6038 dnl value, though, and everywhere SOLAR_JAVA is only checked for being
6039 dnl empty or non-empty.
6041 dnl SOLAR_JAVA="" indicate no java support at all
6043 JITC_PROCESSOR_TYPE=""
6044 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6045     # IBMs JDK needs this...
6046     JITC_PROCESSOR_TYPE=6
6047     export JITC_PROCESSOR_TYPE
6049 AC_SUBST([JITC_PROCESSOR_TYPE])
6051 # Misc Windows Stuff
6052 if test $_os = "WINNT" -a "$WITH_MINGW" != yes; then
6053     find_msvc_x64_dlls
6054     find_msms
6055     MSVC_DLL_PATH="$msvcdllpath"
6056     MSVC_DLLS="$msvcdlls"
6057     MSM_PATH="$msmdir"
6058     MERGE_MODULES="$msms"
6059     SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6061 AC_SUBST(MSVC_DLL_PATH)
6062 AC_SUBST(MSVC_DLLS)
6063 AC_SUBST(MSVC_DEBUG_DLL_PATH)
6064 AC_SUBST(MSVC_DEBUG_DLLS)
6065 AC_SUBST(MSM_PATH)
6066 AC_SUBST(MERGE_MODULES)
6068 dnl ===================================================================
6069 dnl Checks for Java
6070 dnl ===================================================================
6071 if test "$SOLAR_JAVA" != ""; then
6073     # Windows-specific tests
6074     if test "$build_os" = "cygwin"; then
6075         if test "$BITNESS_OVERRIDE" = 64; then
6076             bitness="64-bit"
6077             otherbitness="32-bit"
6078         else
6079             bitness="32-bit"
6080             otherbitness="64-bit"
6081         fi
6083         if test -z "$with_jdk_home"; then
6084             # Currently only auto-detects 32-bit JDK
6085                         for ver in 1.7 1.6 1.5 1.4 1.3; do
6086                         reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6087                         if test -n "$regvalue"; then
6088                                 _jdk_home=$regvalue
6089                                 break
6090                         fi
6091                         done
6092             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6093                 with_jdk_home="$_jdk_home"
6094                 howfound="found automatically"
6095             else
6096                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness JDK])
6097             fi
6098         else
6099             test "$build_os" = "cygwin" && with_jdk_home=`cygpath -u "$with_jdk_home"`
6100             howfound="you passed"
6101         fi
6102     fi
6104     JAVA_HOME=; export JAVA_HOME
6105     if test -z "$with_jdk_home"; then
6106         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6107     else
6108         _java_path="$with_jdk_home/bin/$with_java"
6109         dnl Check if there is a Java interpreter at all.
6110         if test -x "$_java_path"; then
6111             JAVAINTERPRETER=$_java_path
6112         else
6113             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6114         fi
6115     fi
6117     if test "$build_os" = "cygwin"; then
6118         # Check that the JDK found is correct architecture
6119         # Why is this necessary, we don't link with any library from the JDK I think,
6121         shortjdkhome=`cygpath -d "$with_jdk_home"`
6122         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
6123             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6124             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6125         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
6126             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6127             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6128         fi
6130         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6131             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6132         fi
6133         JAVAINTERPRETER=`cygpath -d "$JAVAINTERPRETER"`
6134         JAVAINTERPRETER=`cygpath -u "$JAVAINTERPRETER"`
6135     elif test "$_os" = "Darwin"; then
6136         dnl HACK:  There currently is only a 32 bit version of LibreOffice for Mac OS X,
6137         dnl and Tiger Java complains about -d32 while Snow Leopard Java needs it
6138         dnl to run in 32 bit mode and be able to load LibreOffice jnilibs:
6139         AC_MSG_CHECKING([whether to pass -d32 to Java interpreter])
6140         if "$JAVAINTERPRETER" -d32 >&5 2>&5; then
6141             AC_MSG_RESULT([yes])
6142             JAVAIFLAGS=-d32
6143         else
6144             AC_MSG_RESULT([no])
6145         fi
6146     fi
6149 dnl ===================================================================
6150 dnl Checks for JDK.
6151 dnl ===================================================================
6153 # Note that JAVA_HOME as for now always means the *build* platform's
6154 # JAVA_HOME. Whether all the complexity here actually is needed any
6155 # more or not, no idea.
6157 if test "$SOLAR_JAVA" != ""; then
6158     _gij_longver=0
6159     AC_MSG_CHECKING([the installed JDK])
6160     if test -n "$JAVAINTERPRETER"; then
6161         dnl java -version sends output to stderr!
6162         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6163             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6164         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6165             JDK=gcj
6166             AC_MSG_RESULT([checked (gcj)])
6167             _gij_version=`$JAVAINTERPRETER --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6168             _gij_longver=`echo $_gij_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6170         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6171             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6172         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6173             JDK=ibm
6175             dnl IBM JDK specific tests
6176             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6177             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6179             if test "$_jdk_ver" -lt 10500; then
6180                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.5])
6181             fi
6183             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6185             if test "$with_jdk_home" = ""; then
6186                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6187 you must use the "--with-jdk-home" configure option explicitly])
6188             fi
6190            JAVA_HOME=$with_jdk_home
6192         else
6193             JDK=sun
6195             dnl Sun JDK specific tests
6196             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6197             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6199             if test "$_jdk_ver" -lt 10500; then
6200                 AC_MSG_ERROR([JDK is too old, you need at least 1.5])
6201             fi
6202             if test "$_jdk_ver" -gt 10600; then
6203                 JAVA_CLASSPATH_NOT_SET="1"
6204             fi
6206             AC_MSG_RESULT([checked (JDK $_jdk)])
6207             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6208             if test "$_os" = "WINNT"; then
6209                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6210             fi
6211         fi
6212     else
6213         AC_MSG_ERROR([Java not found. You need at least jdk-1.5, or gcj-4])
6214     fi
6215 else
6216     dnl Java disabled
6217     JAVA_HOME=NO_JAVA_HOME ; export JAVA_HOME
6220 dnl ===================================================================
6221 dnl Set target Java bytecode version
6222 dnl ===================================================================
6223 if test "$SOLAR_JAVA" != ""; then
6224     _java_target_ver="1.5"
6226     JAVA_SOURCE_VER="$_java_target_ver"
6227     JAVA_TARGET_VER="$_java_target_ver"
6230 dnl ===================================================================
6231 dnl Checks for javac
6232 dnl ===================================================================
6233 if test "$SOLAR_JAVA" != ""; then
6234     if test "$JDK" = "gcj"; then
6235         javacompiler=`echo $with_java | $SED -e "s/gij/gcj/g" | $SED -e "s/java/javac/g"`
6236     else
6237         javacompiler="javac"
6238     fi
6239     if test -z "$with_jdk_home"; then
6240         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6241     else
6242         _javac_path="$with_jdk_home/bin/$javacompiler"
6243         dnl Check if there is a Java compiler at all.
6244         if test -x "$_javac_path"; then
6245             JAVACOMPILER=$_javac_path
6246         fi
6247     fi
6248     if test -z "$JAVACOMPILER"; then
6249         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6250     fi
6251     if test "$build_os" = "cygwin"; then
6252         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6253             JAVACOMPILER="${JAVACOMPILER}.exe"
6254         fi
6255         JAVACOMPILER=`cygpath -d "$JAVACOMPILER"`
6256         JAVACOMPILER=`cygpath -u "$JAVACOMPILER"`
6257     fi
6259     if test `$JAVACOMPILER -version 2>&1 | $GREP -c "Eclipse Java Compiler"` -gt 0; then
6260         AC_MSG_CHECKING([re-checking JDK])
6261         JDK=gcj
6262         AC_MSG_RESULT([checked (ecj)])
6263         _gij_longver="40200"
6264     fi
6267 JAVACISGCJ=""
6268 dnl ===================================================================
6269 dnl Checks that javac is gcj
6270 dnl ===================================================================
6271 if test "$SOLAR_JAVA" != ""; then
6272     if test `$JAVACOMPILER --version 2>&1 | $GREP -c "GCC"` -gt 0; then
6273         JAVACISGCJ="yes"
6274     fi
6276 AC_SUBST(JAVACISGCJ)
6278 dnl ===================================================================
6279 dnl Checks for javadoc
6280 dnl ===================================================================
6281 if test "$SOLAR_JAVA" != ""; then
6282     if test -z "$with_jdk_home"; then
6283         AC_PATH_PROG(JAVADOC, javadoc)
6284     else
6285         _javadoc_path="$with_jdk_home/bin/javadoc"
6286         dnl Check if there is a javadoc at all.
6287         if test -x "$_javadoc_path"; then
6288             JAVADOC=$_javadoc_path
6289         else
6290             AC_PATH_PROG(JAVADOC, javadoc)
6291         fi
6292     fi
6293     if test -z "$JAVADOC"; then
6294         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6295     fi
6296     if test "$build_os" = "cygwin"; then
6297         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6298             JAVADOC="${JAVADOC}.exe"
6299         fi
6300         JAVADOC=`cygpath -d "$JAVADOC"`
6301         JAVADOC=`cygpath -u "$JAVADOC"`
6302     fi
6304     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6305     JAVADOCISGJDOC="yes"
6306     fi
6308 AC_SUBST(JAVADOCISGJDOC)
6310 if test "$SOLAR_JAVA" != ""; then
6311     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
6312     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
6313         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
6314            # try to recover first by looking whether we have a alternatives
6315            # system as in Debian or newer SuSEs where following /usr/bin/javac
6316            # over /etc/alternatives/javac leads to the right bindir where we
6317            # just need to strip a bit away to get a valid JAVA_HOME
6318            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
6319         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
6320             # maybe only one level of symlink (e.g. on Mac)
6321             JAVA_HOME=$(readlink $JAVACOMPILER)
6322             if test "$(dirname $JAVA_HOME)" = "."; then
6323                 # we've got no path to trim back
6324                 JAVA_HOME=""
6325             fi
6326         else
6327             # else warn
6328             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
6329             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
6330             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
6331             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
6332         fi
6333         dnl now that we have the path to the real javac, make a JAVA_HOME out of it..
6334         if test "$JAVA_HOME" != "/usr"; then
6335             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6336                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
6337                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
6338                 dnl Tiger already returns a JDK path..
6339                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
6340             else
6341                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
6342             fi
6343         fi
6344     fi
6345     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
6347     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
6348     if test -z "$JAVA_HOME"; then
6349         if test "x$with_jdk_home" = "x"; then
6350             cat > findhome.java <<_ACEOF
6351 [import java.io.File;
6353 class findhome
6355     public static void main(String args[])
6356     {
6357         String jrelocation = System.getProperty("java.home");
6358         File jre = new File(jrelocation);
6359         System.out.println(jre.getParent());
6360     }
6362 _ACEOF
6363             AC_MSG_CHECKING([if javac works])
6364             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
6365             AC_TRY_EVAL(javac_cmd)
6366             if test $? = 0 -a -f ./findhome.class; then
6367                 AC_MSG_RESULT([javac works])
6368             else
6369                 echo "configure: javac test failed" >&5
6370                 cat findhome.java >&5
6371                 AC_MSG_ERROR([javac does not work - java projects will not build!])
6372             fi
6373             AC_MSG_CHECKING([if gij knows its java.home])
6374             JAVA_HOME=`$JAVAINTERPRETER findhome`
6375             if test $? = 0 -a "$JAVA_HOME" != ""; then
6376                 AC_MSG_RESULT([$JAVA_HOME])
6377             else
6378                 echo "configure: java test failed" >&5
6379                 cat findhome.java >&5
6380                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
6381             fi
6382             # clean-up after ourselves
6383             rm -f ./findhome.java ./findhome.class
6384         else
6385             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
6386         fi
6387     fi
6389     dnl second sanity check JAVA_HOME if possible
6390     if test "$JDK" != "gcj" -o "$_gij_longver" -ge "40200"; then
6391         # now check if $JAVA_HOME is really valid
6392         if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6393             if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
6394                 JAVA_HOME_OK="NO"
6395             fi
6396         elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
6397             JAVA_HOME_OK="NO"
6398         fi
6399         if test "$JAVA_HOME_OK" = "NO"; then
6400             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
6401             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
6402             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
6403             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
6404             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
6405             add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
6406         fi
6407     fi
6408     PathFormat "$JAVA_HOME"
6409     JAVA_HOME="$formatted_path"
6412 AWTLIB=
6414 if test "$SOLAR_JAVA" != ""; then
6415     AC_MSG_CHECKING([for jawt lib name])
6416     if test "$JDK" = "gcj"; then
6417         save_CFLAGS=$CFLAGS
6418         save_LDFLAGS=$LDFLAGS
6419         CFLAGS="$CFLAGS -I$JAVA_HOME/include"
6420         LDFLAGS="$LDFLAGS -L$JAVA_HOME/lib -lgcj"
6421         exec 6>/dev/null # no output
6422         AC_CHECK_HEADER(jni.h, [],
6423                     [AC_MSG_ERROR([jni.h could not be found. Mismatch between gcc and libgcj or libgcj-devel missing?])], [])
6424         AC_CHECK_LIB(gcjawt, JAWT_GetAWT, [ AWTLIB="-lgcjawt -lgcj"] )
6425         exec 6>&1 # output on again
6426         CFLAGS=$save_CFLAGS
6427         LDFLAGS=$save_LDFLAGS
6428     fi
6429     # IBM SDK 1.5.0-sr5 includes libjawt.so with unresolved symbols.
6430     # A workaround is to link also against libpmawt.so
6431     if test "$JDK" = "ibm"; then
6432         save_CFLAGS=$CFLAGS
6433         save_LDFLAGS=$LDFLAGS
6434         save_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
6435         CFLAGS="$CFLAGS -I$JAVA_HOME/include"
6436         LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin"
6437         LD_LIBRARY_PATH=$JAVA_HOME/jre/bin:$JAVA_HOME/jre/bin/classic:$JAVA_HOME/jre/bin/xawt:$LD_LIBRARY_PATH
6438         export LD_LIBRARY_PATH
6439         exec 6>/dev/null # no output
6440         AC_CHECK_HEADER(jni.h, [],
6441                     [AC_MSG_ERROR([jni.h could not be found.])], [])
6442         AC_CHECK_LIB(jawt, JAWT_GetAWT, [ AWTLIB="-ljawt"] )
6443         if test -z "$AWTLIB"; then
6444             LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin/xawt -ljawt"
6445             AC_CHECK_LIB(mawt, JAWT_GetAWT, [ AWTLIB="-L$JAVA_HOME/jre/bin/xawt -ljawt -lmawt"])
6446         fi
6447         exec 6>&1 # output on again
6448         CFLAGS=$save_CFLAGS
6449         LDFLAGS=$save_LDFLAGS
6450         LD_LIBRARY_PATH=$save_LD_LIBRARY_PATH
6451     fi
6452     if test -z "$AWTLIB"; then
6453         if test $_os = WINNT -a "$WITH_MINGW" != yes; then
6454             AWTLIB=jawt.lib
6455         else
6456             AWTLIB=-ljawt
6457         fi
6458     fi
6459     AC_MSG_RESULT([$AWTLIB])
6460     AC_SUBST(AWTLIB)
6464 if test -n "$SOLAR_JAVA" -a \( -z "$JAVALIB" -o -z "$JAVAINC" \); then
6466 # Determine JAVALIB
6467 # If your platform follow the common pattern
6468 # just define JAVA_ARCH and JAVA_TOOLKIT for it
6469 # if not, leave JAVA_ARCH empty and define JAVALIB manually
6470 # if you don't want JAVALIB to be exported at all
6471 # define x_JAVALIB=[\#]
6473     JAVA_ARCH=
6474     JAVA_TOOLKIT=
6475     x_JAVALIB=
6476     x_JDKLIB=[\#]
6478     case "$host_os" in
6480     aix*)
6481         JAVA_ARCH="ppc"
6482         JAVA_TOOLKIT="classic"
6483         JAVAINC="-I$JAVA_HOME/include"
6484         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
6485         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6487         case "$JDK" in
6488         [Ii][Bb][Mm]*)
6489             JAVA_ARCH=
6490             JRE_BASE_DIR="$JAVA_HOME/jre/bin"
6491             JAVALIB="-L$JRE_BASE_DIR -L$JRE_BASE_DIR/classic"
6492             ;;
6493         *)
6494             ;;
6495         esac
6497         ;;
6499     cygwin*)
6500         x_JDKLIB=
6501         JDKLIB="$JAVA_HOME/lib"
6502         JAVAINC="-I$JAVA_HOME/include/win32"
6503         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
6504         ;;
6506     darwin*)
6507         x_JAVALIB=[\#]
6508         JAVAINC="${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers ${ISYSTEM}$FRAMEWORKSHOME/JavaVM/Headers"
6509         ;;
6511     dragonfly*)
6512         case "$host_cpu" in
6513         i*86)
6514             JAVA_ARCH="i386"
6515             JAVA_TOOLKIT="client"
6516             ;;
6517         x86_64)
6518             JAVA_ARCH="amd64"
6519             JAVA_TOOLKIT="server"
6520             ;;
6521         esac
6522         JAVAINC="-I$JAVA_HOME/include"
6523         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6524         ;;
6526     freebsd*)
6527         case "$host_cpu" in
6528         i*86)
6529             JAVA_ARCH="i386"
6530             JAVA_TOOLKIT="client"
6531             ;;
6532         x86_64)
6533             if test "`echo $JAVA_HOME | sed -e 's,.*/,,'`" = "linux"; then
6534                 JAVA_ARCH="i386"
6535                 JAVA_TOOLKIT="client"
6536             else
6537                 JAVA_ARCH="amd64"
6538                 JAVA_TOOLKIT="server"
6539             fi
6540             ;;
6541         esac
6542         JAVAINC="-I$JAVA_HOME/include"
6543         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
6544         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
6545         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
6546         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6547         ;;
6549     k*bsd*-gnu*)
6550         case "$host_cpu" in
6551         i*86)
6552             JAVA_ARCH="i386"
6553             JAVA_TOOLKIT="client"
6554             ;;
6555         x86_64)
6556             JAVA_ARCH="amd64"
6557             JAVA_TOOLKIT="server"
6558             ;;
6559         esac
6560         JAVAINC="-I$JAVA_HOME/include"
6561         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6562         ;;
6564     linux-gnu*)
6566         case "$host_cpu" in
6568         alpha)
6569             JAVA_ARCH="alpha"
6570             JAVA_TOOLKIT="server"
6571             ;;
6572         arm*)
6573             JAVA_ARCH="arm"
6574             JAVA_TOOLKIT="server"
6575             ;;
6576         hppa)
6577             JAVA_ARCH="hppa"
6578             JAVA_TOOLKIT="server"
6579             ;;
6580         i*86)
6581             JAVA_ARCH="i386"
6582             case "$JDK" in
6583             [Ii][Bb][Mm]*)
6584                 JAVA_ARCH=
6585                 JRE_BASE_DIR="$JAVA_HOME/jre/bin"
6586                 JAVALIB="-L$JAVA_HOME/$LIB64 -L$JRE_BASE_DIR -L$JRE_BASE_DIR/classic -L$JRE_BASE_DIR/native_thread"
6587                 ;;
6588             [Bb][Ee][Aa]*)
6589                 JAVA_TOOLKIT="jrockit"
6590                 ;;
6591             *)
6592                 JAVA_TOOLKIT="client"
6593                 ;;
6594             esac
6595             ;;
6596         ia64)
6597             JAVA_ARCH="ia64"
6598             JAVA_TOOLKIT="server"
6599             ;;
6600         m68k)
6601             JAVA_ARCH="mk68"
6602             JAVA_TOOLKIT="server"
6603             ;;
6604         mips|mips64|mipsel|mips64el)
6605             JAVA_ARCH="$host_cpu"
6606             JAVA_TOOLKIT="server"
6607             ;;
6608         mips32)
6609             JAVA_ARCH="$host_cpu"
6610             JAVA_TOOLKIT="client"
6611             ;;
6612         powerpc)
6613             JAVA_ARCH="ppc"
6614             case "$JDK" in
6615             [Ii][Bb][Mm]*)
6616                 JAVA_TOOLKIT="classic"
6617                 ;;
6618             gcj)
6619                 JAVA_TOOLKIT="client"
6620                 ;;
6621             *)
6622                 JAVA_TOOLKIT="server"
6623                 ;;
6624             esac
6625             ;;
6626         powerpc64)
6627             JAVA_ARCH="ppc64"
6628             if test "$JDK" = "gcj"; then
6629                 JAVA_TOOLKIT="client"
6630             else
6631                 JAVA_TOOLKIT="server"
6632             fi
6633             ;;
6634         sparc)
6635             JAVA_ARCH="sparc"
6636             JAVA_TOOLKIT="server"
6637             ;;
6638         s390)
6639             JAVA_ARCH="s390"
6640             JAVA_TOOLKIT="server"
6641             ;;
6642         s390x)
6643             JAVA_ARCH="s390x"
6644             JAVA_TOOLKIT="server"
6645             ;;
6646         x86_64)
6647             JAVA_ARCH="amd64"
6648             JAVA_TOOLKIT="server"
6649             ;;
6650         *)
6651             AC_MSG_ERROR([No JAVALIB definition host_cpu $host_cpu for host_os $host_os])
6652             ;;
6653         esac
6654         JAVAINC="-I$JAVA_HOME/include"
6655         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
6656         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6657         ;;
6659     linux-androideabi*)
6661         case "$host_cpu" in
6663     arm|armel)
6664             JAVA_ARCH="arm"
6665             JAVA_TOOLKIT="server"
6666             ;;
6667         esac
6668         ;;
6670     mingw*)
6671         x_JAVALIB=[\#]
6672         JAVAINC="-I$JAVA_HOME/include"
6673         ;;
6675     *netbsd*)
6677         case "$host_cpu" in
6678         i*86)
6679             JAVA_ARCH="i386"
6680             JAVA_TOOLKIT="client"
6681             ;;
6682         powerpc)
6683             JAVA_ARCH="pcc"
6684             JAVA_TOOLKIT="classic"
6685             ;;
6686         sparc)
6687             JAVA_ARCH="sparc"
6688             JAVA_TOOLKIT="client"
6689             ;;
6690         x86_64)
6691             JAVA_ARCH="amd64"
6692             JAVA_TOOLKIT="client"
6693             ;;
6694         esac
6695         JAVAINC="-I$JAVA_HOME/include"
6696         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
6697         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6698        ;;
6700     openbsd*)
6701         case "$host_cpu" in
6702         i*86)
6703             JAVA_ARCH="i386"
6704             JAVA_TOOLKIT="client"
6705             ;;
6706         x86_64)
6707             JAVA_ARCH="amd64"
6708             JAVA_TOOLKIT="server"
6709             ;;
6710         esac
6711         JAVAINC="-I$JAVA_HOME/include"
6712         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
6713         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6714         ;;
6716     solaris*)
6718         JAVA_TOOLKIT="xawt"
6719         case "$host_cpu" in
6720         i*86)
6721             JAVA_ARCH="i386"
6722             ;;
6723         sparc)
6724             JAVA_ARCH="sparc"
6725             ;;
6726         esac
6727         JAVAINC="-I$JAVA_HOME/include"
6728         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
6729         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6730         ;;
6731     esac
6733     if test -n "$JAVA_ARCH"; then
6734         JRE_BASE_DIR="$JAVA_HOME/jre/lib/$JAVA_ARCH"
6735         JAVALIB="-L$JAVA_HOME/$LIB64"
6736         test -d "$JRE_BASE_DIR" && JAVALIB="$JAVALIB -L$JRE_BASE_DIR"
6737         test -d "$JRE_BASE_DIR/$JAVA_TOOLKIT" && JAVALIB="$JAVALIB -L$JRE_BASE_DIR/$JAVA_TOOLKIT"
6738         test -d "$JRE_BASE_DIR/native_thread" && JAVALIB="$JAVALIB -L$JRE_BASE_DIR/native_thread"
6739     fi
6740 elif test -z "$SOLAR_JAVA"; then
6741     x_JAVALIB=[\#]
6742     x_JDKLIB=[\#]
6744 SOLARINC="$SOLARINC $JAVAINC"
6746 AC_SUBST(JAVALIB)
6747 AC_SUBST(JAVACOMPILER)
6748 AC_SUBST(JAVADOC)
6749 AC_SUBST(JAVAINTERPRETER)
6750 AC_SUBST(JAVAIFLAGS)
6751 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
6752 AC_SUBST(JAVA_HOME)
6753 AC_SUBST(JAVA_SOURCE_VER)
6754 AC_SUBST(JAVA_TARGET_VER)
6755 AC_SUBST(JDK)
6756 AC_SUBST(JDKLIB)
6757 AC_SUBST(x_JAVALIB)
6758 AC_SUBST(x_JDKLIB)
6761 AC_MSG_CHECKING([which C preprocessor to use in idlc])
6762 if test -n "$with_idlc_cpp"; then
6763     AC_MSG_RESULT([$with_idlc_cpp])
6764     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
6765 else
6766     AC_MSG_RESULT([ucpp])
6767     AC_MSG_CHECKING([which ucpp tp use])
6768     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
6769         AC_MSG_RESULT([external])
6770         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
6771     else
6772         AC_MSG_RESULT([internal])
6773         BUILD_TYPE="$BUILD_TYPE UCPP"
6774     fi
6776 AC_SUBST(SYSTEM_UCPP)
6778 dnl ===================================================================
6779 dnl Check for epm (not needed for Windows)
6780 dnl ===================================================================
6781 AC_MSG_CHECKING([whether to enable EPM for packing])
6782 if test "$enable_epm" = "yes"; then
6783     AC_MSG_RESULT([yes])
6784     if test "$_os" != "WINNT"; then
6785         if test -n "$with_epm"; then
6786             EPM=$with_epm
6787         else
6788             AC_PATH_PROG(EPM, epm, no)
6789         fi
6790         if test "$EPM" = "no" -o "$EPM" = "internal"; then
6791             echo "EPM will be built."
6792             BUILD_TYPE="$BUILD_TYPE EPM"
6793         else
6794             # Gentoo has some epm which is something different...
6795             AC_MSG_CHECKING([whether the found epm is the right epm])
6796             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
6797                 AC_MSG_RESULT([yes])
6798             else
6799                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
6800             fi
6801             AC_MSG_CHECKING([epm version])
6802             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
6803             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
6804                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
6805                 AC_MSG_RESULT([OK, >= 3.7])
6806                 if test "$_os" = "Darwin"; then
6807                     AC_MSG_CHECKING([which PackageMaker EPM thinks to use])
6808                     _pm=`strings $EPM | grep PackageMaker | cut -d" " -f1`
6809                     if test "$_pm" = "/Developer/Applications/PackageMaker.app/Contents/MacOS/PackageMaker"; then
6810                         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)])
6811                     elif test "$_pm" = "/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker"; then
6812                         AC_MSG_RESULT([$_pm, ok])
6813                     else # we never should get here, but go safe
6814                         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)])
6815                     fi
6816                 fi
6817             else
6818                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
6819                 echo "EPM will be built."
6820                 BUILD_TYPE="$BUILD_TYPE EPM"
6821             fi
6822         fi
6823     fi
6825     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
6826         AC_MSG_CHECKING([for rpm])
6827         for a in "$RPM" rpmbuild rpm; do
6828             $a --usage >/dev/null 2> /dev/null
6829             if test $? -eq 0; then
6830                 RPM=$a
6831                 break
6832             else
6833                 $a --version >/dev/null 2> /dev/null
6834                 if test $? -eq 0; then
6835                     RPM=$a
6836                     break
6837                 fi
6838             fi
6839         done
6840         if test -z "$RPM"; then
6841             AC_MSG_ERROR([not found])
6842         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
6843             RPM_PATH=`which $RPM`
6844             AC_MSG_RESULT([$RPM_PATH])
6845             SCPDEFS="$SCPDEFS -DWITH_RPM"
6846         else
6847             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
6848         fi
6849     fi
6850     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
6851         AC_PATH_PROG(DPKG, dpkg, no)
6852         if test "$DPKG" = "no"; then
6853             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
6854         fi
6855     fi
6856     if echo "$PKGFORMAT" | $EGREP osx 2>&1 >/dev/null; then
6857         if test "$_os" = "Darwin"; then
6858             AC_MSG_CHECKING([for PackageMaker availability])
6859             if ! test -x /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker; then
6860                 AC_MSG_ERROR([not installed. Please install Apples Dev Tools])
6861             else
6862                 AC_MSG_RESULT([ok])
6863             fi
6864         else
6865             AC_MSG_ERROR([PackageMaker needed to build OSX packages and you are not on OSX...])
6866         fi
6867     fi
6868     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
6869        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
6870         if test "$EPM" != "no" -a "$EPM" != "internal"; then
6871             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
6872                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
6873                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
6874                     AC_MSG_RESULT([yes])
6875                 else
6876                     AC_MSG_RESULT([no])
6877                     if echo "$PKGFORMAT" | $GREP -q rpm; then
6878                         _pt="rpm"
6879                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
6880                         add_warning "the rpms will need to be installed with --nodeps"
6881                     else
6882                         _pt="pkg"
6883                     fi
6884                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
6885                     add_warning "the ${_pt}s will not be relocateable"
6886                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
6887                                  relocation will work, you need to patch your epm with the
6888                                  patch in epm/epm-3.7.patch or build with
6889                                  --with-epm=internal which will build a suitable epm])
6890                 fi
6891             fi
6892         fi
6893     fi
6894     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
6895         AC_PATH_PROG(PKGMK, pkgmk, no)
6896         if test "$PKGMK" = "no"; then
6897             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
6898         fi
6899     fi
6900     AC_SUBST(RPM)
6901     AC_SUBST(DPKG)
6902     AC_SUBST(PKGMK)
6903 else
6904     AC_MSG_RESULT([no])
6905     EPM=NO
6907 AC_SUBST(EPM)
6909 dnl ===================================================================
6910 dnl We need winegcc when building MinGW build to be able to cross-build msi tools
6911 dnl ===================================================================
6912 WINEGCC=
6913 if test "$enable_winegcc" = "yes"; then
6914     AC_PATH_PROG(WINEGCC, winegcc)
6915     if test "$WINEGCC" = ""; then
6916         AC_MSG_ERROR([winegcc was not found, please install wine-devel, or wine-devel-32bit])
6917     fi
6918     CC_save="$CC"
6919     ac_exeext_save="$ac_exeext"
6920     CC="$WINEGCC -m32"
6921     ac_exeext=".exe"
6922     AC_LINK_IFELSE([AC_LANG_PROGRAM([
6923 #include <stdio.h>
6924         ],[
6925 printf ("hello world\n");
6926         ])],,
6927         [AC_MSG_ERROR([winegcc cannot build 32bit binaries, please install glibc-devel-32bit and gcc-32bit])]
6928     )
6929     CC="$CC_save"
6930     ac_exeext="$ac_exeext_save"
6932 AC_SUBST(WINEGCC)
6934 if test $_os = iOS; then
6935     enable_mpl_subset=yes
6936     enable_opengl=no
6937     enable_lotuswordpro=no
6938     enable_lpsolve=no
6939     enable_postgresql_sdbc=no
6940     enable_lotuswordpro=no
6941     enable_neon=no
6942     enable_extension_integration=no
6943     with_theme="tango"
6944     with_ppds=no
6947 ENABLE_LWP=
6948 if test "$enable_lotuswordpro" = "yes"; then
6949    ENABLE_LWP="TRUE"
6950    SCPDEFS="$SCPDEFS -DDISABLE_LWP"
6952 AC_SUBST(ENABLE_LWP)
6954 dnl ===================================================================
6955 dnl Check for gperf
6956 dnl ===================================================================
6957 AC_PATH_PROG(GPERF, gperf)
6958 if test -z "$GPERF"; then
6959     AC_MSG_ERROR([gperf not found but needed. Install it.])
6961 AC_MSG_CHECKING([gperf version])
6962 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
6963     AC_MSG_RESULT([OK])
6964 else
6965     AC_MSG_ERROR([too old, you need at least 3.0.0])
6967 AC_SUBST(GPERF)
6969 dnl ===================================================================
6970 dnl Check for building ODK
6971 dnl ===================================================================
6972 if test "$enable_odk" = no; then
6973     unset DOXYGEN
6974 else
6975     if test "$with_doxygen" = no; then
6976         AC_MSG_CHECKING([for doxygen])
6977         unset DOXYGEN
6978         AC_MSG_RESULT([no])
6979     else
6980         if test "$with_doxygen" = yes; then
6981             AC_PATH_PROG([DOXYGEN], [doxygen])
6982             if test -z "$DOXYGEN"; then
6983                 if test "$enable_odk" = "" ; then
6984                     enable_odk="no"
6985                 else
6986                     AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
6987                 fi
6988             fi
6989         else
6990             AC_MSG_CHECKING([for doxygen])
6991             DOXYGEN=$with_doxygen
6992             AC_MSG_RESULT([$DOXYGEN])
6993         fi
6994     fi
6996 AC_SUBST([DOXYGEN])
6998 AC_MSG_CHECKING([whether to build the ODK])
6999 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7000     AC_MSG_RESULT([yes])
7002     if test "$with_java" != "no"; then
7003         AC_MSG_CHECKING([whether to build unowinreg.dll])
7004         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7005             # build on Win by default
7006             enable_build_unowinreg=yes
7007         fi
7008         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7009             AC_MSG_RESULT([no])
7010             BUILD_UNOWINREG=NO
7011         else
7012             AC_MSG_RESULT([yes])
7013             BUILD_UNOWINREG=YES
7014         fi
7015         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "YES"; then
7016             if test -z "$with_mingw_cross_compiler"; then
7017                 dnl Guess...
7018                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7019             elif test -x "$with_mingw_cross_compiler"; then
7020                  MINGWCXX="$with_mingw_cross_compiler"
7021             else
7022                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7023             fi
7025             if test "$MINGWCXX" = "false"; then
7026                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7027             fi
7029             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7030             if test -x "$mingwstrip_test"; then
7031                 MINGWSTRIP="$mingwstrip_test"
7032             else
7033                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7034             fi
7036             if test "$MINGWSTRIP" = "false"; then
7037                 AC_MSG_ERROR(MinGW32 binutils not found.)
7038             fi
7039         fi
7040     fi
7041     BUILD_TYPE="$BUILD_TYPE ODK"
7042 else
7043     AC_MSG_RESULT([no])
7044     BUILD_UNOWINREG=NO
7046 AC_SUBST(BUILD_UNOWINREG)
7047 AC_SUBST(MINGWCXX)
7048 AC_SUBST(MINGWSTRIP)
7050 dnl ===================================================================
7051 dnl Check for system zlib
7052 dnl ===================================================================
7053 if test "$with_system_zlib" = "auto"; then
7054     case "$_os" in
7055     WINNT)
7056         with_system_zlib="$with_system_libs"
7057         ;;
7058     *)
7059         with_system_zlib=yes
7060         ;;
7061     esac
7064 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7065 dnl and has no pkg-config for it at least on some tinderboxes,
7066 dnl so leaving that out for now
7067 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7068 AC_MSG_CHECKING([which zlib to use])
7069 if test "$with_system_zlib" = "yes"; then
7070     AC_MSG_RESULT([external])
7071     SYSTEM_ZLIB=YES
7072     AC_CHECK_HEADER(zlib.h, [],
7073         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7074     AC_CHECK_LIB(z, deflate, [ ZLIB=-lz ],
7075         [AC_MSG_ERROR(zlib not found or functional)], [])
7076 else
7077     AC_MSG_RESULT([internal])
7078     SYSTEM_ZLIB=NO
7079     BUILD_TYPE="$BUILD_TYPE ZLIB"
7080     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7081     ZLIB_LIBS="-L${OUTDIR}/lib -lzlib"
7083 AC_SUBST(ZLIB_CFLAGS)
7084 AC_SUBST(ZLIB_LIBS)
7085 AC_SUBST(SYSTEM_ZLIB)
7087 dnl ===================================================================
7088 dnl Check for system jpeg
7089 dnl ===================================================================
7090 AC_MSG_CHECKING([which jpeg to use])
7091 if test "$with_system_jpeg" = "auto"; then
7092     case "$_os" in
7093     WINNT|Darwin|iOS|Android)
7094         with_system_jpeg="$with_system_libs"
7095         ;;
7096     *)
7097         with_system_jpeg=yes
7098         ;;
7099     esac
7102 if test "$with_system_jpeg" = "yes"; then
7103     AC_MSG_RESULT([external])
7104     SYSTEM_JPEG=YES
7105     AC_CHECK_HEADER(jpeglib.h, [],
7106         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7107     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ JPEG3RDLIB=-ljpeg ],
7108     [AC_MSG_CHECKING(jpeg library not found or fuctional)], [])
7109     AC_MSG_CHECKING([[libjpeg supports JERR_BAD_CROP_SPEC (jpeg-7 API)]])
7110         AC_COMPILE_IFELSE([ AC_LANG_SOURCE(
7111                           [[
7112 #include <stdio.h>
7113 #include <jerror.h>
7114 int main(int c, char**v) { printf("%d\n", JERR_BAD_CROP_SPEC); return 0; }
7115                           ]]) ],
7116                           [AC_MSG_RESULT(yes)],
7117                           [AC_MSG_RESULT(no)
7118                            AC_MSG_ERROR(jpeg library version >= 7 or jpeg-turbo version >= 1.1 required)
7119                           ])
7120     libo_MINGW_CHECK_DLL([libjpeg])
7121 else
7122     AC_MSG_RESULT([internal])
7123     SYSTEM_JPEG=NO
7124     BUILD_TYPE="$BUILD_TYPE JPEG"
7126 AC_SUBST(SYSTEM_JPEG)
7129 dnl ===================================================================
7130 dnl Check for system clucene
7131 dnl ===================================================================
7132 dnl we should rather be using
7133 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7134 dnl but the contribs-lib check seems tricky
7135 AC_MSG_CHECKING([which clucene to use])
7136 if test "$with_system_clucene" = "yes"; then
7137     AC_MSG_RESULT([external])
7138     SYSTEM_CLUCENE=YES
7139     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7140     AC_LANG_PUSH([C++])
7141     save_CXXFLAGS=$CXXFLAGS
7142     save_CPPFLAGS=$CPPFLAGS
7143     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7144     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7145     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7146     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7147     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7148                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7149     CXXFLAGS=$save_CXXFLAGS
7150     CPPFLAGS=$save_CPPFLAGS
7151     AC_LANG_POP([C++])
7153     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7154 else
7155     AC_MSG_RESULT([internal])
7156     SYSTEM_CLUCENE=NO
7157     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7159 AC_SUBST(SYSTEM_CLUCENE)
7160 AC_SUBST(CLUCENE_CFLAGS)
7161 AC_SUBST(CLUCENE_LIBS)
7163 dnl ===================================================================
7164 dnl Check for system expat
7165 dnl ===================================================================
7166 dnl we should use libo_CHECK_SYSTEM_MODULE, but e.g. the mingw tinderbox has no
7167 dnl proper pkg-config for it. It should really be fixed on the tinderbox though.
7168 AC_MSG_CHECKING([which expat to use])
7169 if test "$with_system_expat" = "yes"; then
7170     AC_MSG_RESULT([external])
7171     SYSTEM_EXPAT=YES
7172     AC_CHECK_HEADER(expat.h, [],
7173         [AC_MSG_ERROR(expat.h not found. install expat)], [])
7174     AC_CHECK_LIB([expat], [XML_ParserCreate], [:],
7175         [AC_MSG_RESULT(expat library not found or functional.)], [])
7176     libo_MINGW_CHECK_DLL([libexpat])
7177 else
7178     AC_MSG_RESULT([internal])
7179     SYSTEM_EXPAT=NO
7180     BUILD_TYPE="$BUILD_TYPE EXPAT"
7182 AC_SUBST(SYSTEM_EXPAT)
7184 dnl ===================================================================
7185 dnl Check for system libodfgen
7186 dnl ===================================================================
7187 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.0])
7189 dnl ===================================================================
7190 dnl Check for system libcdr
7191 dnl ===================================================================
7192 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.0 >= 0.0.5])
7194 dnl ===================================================================
7195 dnl Check for system libmspub
7196 dnl ===================================================================
7197 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.0])
7199 dnl ===================================================================
7200 dnl Check for system libmwaw
7201 dnl ===================================================================
7202 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.1])
7204 dnl ===================================================================
7205 dnl Check for system libvisio
7206 dnl ===================================================================
7207 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.0])
7209 dnl ===================================================================
7210 dnl Check for system libcmis
7211 dnl ===================================================================
7212 libo_CHECK_SYSTEM_MODULE([libcmis],[CMIS],[libcmis-0.3 >= 0.3.1])
7214 dnl ===================================================================
7215 dnl Check for system libwpd
7216 dnl ===================================================================
7217 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.9 libwpd-stream-0.9],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${OUTDIR}/lib -lwpdlib"])
7219 dnl ===================================================================
7220 dnl Check for system lcms2
7221 dnl ===================================================================
7222 if test "$with_system_lcms2" = "yes"; then
7223     libo_MINGW_CHECK_DLL([liblcms2])
7224 else
7225     SYSTEM_LCMS2=NO
7227 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${OUTDIR}/lib -llcms2"])
7228 if test "$GCC" = "yes"; then
7229     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7232 dnl ===================================================================
7233 dnl Check for system cppunit
7234 dnl ===================================================================
7235 libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.12.0])
7237 dnl ===================================================================
7238 dnl Check whether freetype is available
7239 dnl ===================================================================
7240 if test  "$test_freetype" = "yes"; then
7241     AC_MSG_CHECKING([whether freetype is available])
7242     # FreeType has 3 different kinds of versions
7243     # * release, like 2.4.10
7244     # * libtool, like 13.0.7 (this what pkg-config returns)
7245     # * soname
7246     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7247     #
7248     # 9.4.3 is 2.1.5; the first FreeType release to provide a freetype2.pc file
7249     # XXX: replace this with a real minimum required version
7250     PKG_CHECK_MODULES( FREETYPE, freetype2 >= 9.4.3 )
7251 else
7252     case "$BUILD_TYPE" in
7253     *FREETYPE*)
7254         FREETYPE_LIBS="-lfreetype"
7255         ;;
7256     esac
7258 AC_SUBST(FREETYPE_CFLAGS)
7259 AC_SUBST(FREETYPE_LIBS)
7261 dnl ===================================================================
7262 dnl Check for system libwps
7263 dnl ===================================================================
7264 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.2],["-I${OUTDIR}/inc/external"],["-L${OUTDIR}/lib -lwpslib"])
7266 dnl ===================================================================
7267 dnl Check for system libwpg
7268 dnl ===================================================================
7269 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.2],["-I${OUTDIR}/inc/external"],["-L${OUTDIR}/lib -lwpglib"])
7271 # ===================================================================
7272 # Check for system libxslt
7273 # to prevent incompatibilities between internal libxml2 and external libxslt,
7274 # or vice versa, use with_system_libxml here
7275 # ===================================================================
7276 if test "$with_system_libxml" = "auto"; then
7277     case "$_os" in
7278     WINNT|iOS|Android)
7279         with_system_libxml="$with_system_libs"
7280         ;;
7281     *)
7282         with_system_libxml=yes
7283         ;;
7284     esac
7287 AC_MSG_CHECKING([which libxslt to use])
7288 if test "$with_system_libxml" = "yes"; then
7289     AC_MSG_RESULT([external])
7290     SYSTEM_LIBXSLT=YES
7291     if test "$_os" = "Darwin"; then
7292         dnl make sure to use SDK path
7293         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7294         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7295         dnl omit -L/usr/lib
7296         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7297         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7298     else
7299         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7300         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7301     fi
7303     dnl Check for xsltproc
7304     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7305     if test "$XSLTPROC" = "no"; then
7306         AC_MSG_ERROR([xsltproc is required])
7307     fi
7309     libo_MINGW_CHECK_DLL([libxslt])
7310     libo_MINGW_CHECK_DLL([libexslt])
7311     libo_MINGW_TRY_DLL([iconv])
7312 else
7313     AC_MSG_RESULT([internal])
7314     SYSTEM_LIBXSLT=NO
7315     LIBXSLT_MAJOR=1
7316     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
7318     if test "$cross_compiling" = "yes"; then
7319         AC_PATH_PROG(XSLTPROC, xsltproc, no)
7320         if test "$XSLTPROC" = "no"; then
7321             AC_MSG_ERROR([xsltproc is required])
7322         fi
7323     fi
7325 AC_SUBST(SYSTEM_LIBXSLT)
7326 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
7327     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
7329 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
7331 AC_SUBST(LIBEXSLT_CFLAGS)
7332 AC_SUBST(LIBEXSLT_LIBS)
7333 AC_SUBST(LIBXSLT_CFLAGS)
7334 AC_SUBST(LIBXSLT_LIBS)
7335 AC_SUBST(LIBXSLT_MAJOR)
7336 AC_SUBST(XSLTPROC)
7338 # ===================================================================
7339 # Check for system libxml
7340 # ===================================================================
7341 AC_MSG_CHECKING([which libxml to use])
7342 if test "$with_system_libxml" = "yes"; then
7343     AC_MSG_RESULT([external])
7344     SYSTEM_LIBXML=YES
7345     if test "$_os" = "Darwin"; then
7346         dnl make sure to use SDK path
7347         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7348         dnl omit -L/usr/lib
7349         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
7350     elif test $_os = iOS; then
7351         dnl make sure to use SDK path
7352         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
7353         LIBXML_CFLAGS="-I$usr/include/libxml2"
7354         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
7355     else
7356         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
7357     fi
7359     dnl Check for xmllint
7360     AC_PATH_PROG(XMLLINT, xmllint, no)
7361     if test "$XMLLINT" = "no"; then
7362         AC_MSG_ERROR([xmllint is required])
7363     fi
7365     libo_MINGW_CHECK_DLL([libxml2])
7366     libo_MINGW_TRY_DLL([zlib1])
7367 else
7368     AC_MSG_RESULT([internal])
7369     SYSTEM_LIBXML=NO
7370     BUILD_TYPE="$BUILD_TYPE LIBXML2"
7372 AC_SUBST(SYSTEM_LIBXML)
7373 AC_SUBST(LIBXML_CFLAGS)
7374 AC_SUBST(LIBXML_LIBS)
7375 AC_SUBST(XMLLINT)
7377 # =====================================================================
7378 # Checking for a Python interpreter with version >= 2.5 needed to build LO.
7379 # runtime requires Python 3 compatible version (>= 2.6)
7380 # Optionally user can pass an option to configure, i. e.
7381 # ./configure PYTHON=/usr/bin/python
7382 # =====================================================================
7383 if test "$build_os" != "cygwin"; then
7384     # This allows a lack of system python with no error, we use internal one in that case.
7385     AM_PATH_PYTHON([2.5],, [:])
7386     # Clean PYTHON_VERSION checked below if cross-compiling
7387     PYTHON_VERSION=""
7388     if test "$PYTHON" != ":"; then
7389         PYTHON_FOR_BUILD=$PYTHON
7390     fi
7392 AC_SUBST(PYTHON_FOR_BUILD)
7394 # Checks for Python to use for Pyuno
7395 AC_MSG_CHECKING([which Python to use for Pyuno])
7396 case "$enable_python" in
7397 no|disable)
7398     if test -z $PYTHON_FOR_BUILD; then
7399         # Python is required to build LibreOffice. In theory we could separate the build-time Python
7400         # requirement from the choice whether to include Python stuff in the installer, but why
7401         # bother?
7402         AC_MSG_ERROR([Python is required at build time.])
7403     fi
7404     enable_python=no
7405     AC_MSG_RESULT([none])
7406     ;;
7407 ""|yes|auto)
7408     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
7409         AC_MSG_RESULT([no, overridden by --disable-scripting])
7410         enable_python=no
7411     elif test $build_os = cygwin; then
7412         dnl When building on Windows we don't attempt to use any installed
7413         dnl "system"  Python.
7414         dnl
7415         dnl (When cross-compiling to Windows from Linux using the mingw32-cross
7416         dnl compiler from OBS, use mingw32-python from OBS, and ditto for other
7417         dnl MinGW cross-compilation setups.)
7418         AC_MSG_RESULT([internal])
7419         enable_python=internal
7420     elif test "$cross_compiling" = yes; then
7421         AC_MSG_RESULT([system])
7422         enable_python=system
7423     else
7424         # Unset variables set by the above AM_PATH_PYTHON so that
7425         # we actually do check anew.
7426         unset PYTHON am_cv_pathless_PYTHON ac_cv_path_PYTHON am_cv_python_version am_cv_python_platform am_cv_python_pythondir am_cv_python_pyexecdir
7427         AM_PATH_PYTHON([3.3],, [:])
7428         if test "$PYTHON" = :; then
7429             AC_MSG_RESULT([internal])
7430             enable_python=internal
7431         else
7432             AC_MSG_RESULT([system])
7433             enable_python=system
7434         fi
7435     fi
7436     ;;
7437 internal)
7438     AC_MSG_RESULT([internal])
7439     ;;
7440 system)
7441     AC_MSG_RESULT([system])
7442     ;;
7444     AC_MSG_ERROR([Incorrect --enable-python option])
7445     ;;
7446 esac
7448 if test $enable_python != no; then
7449     BUILD_TYPE="$BUILD_TYPE PYUNO"
7452 if test $enable_python = system; then
7453     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
7454         # We already have logic above to make sure the system Python
7455         # is used only when building against SDK 10.6 or newer.
7457         # Make sure we use the 2.6 Python when building against the
7458         # 10.6 SDK.
7459         case $with_macosx_sdk in
7460         10.6)
7461             python_version=2.6;;
7462         10.7|10.8)
7463             python_version=2.7;;
7464         *)
7465             # ???
7466             python_version=2.7;;
7467         esac
7468         PYTHON=python$python_version
7469         PYTHON_CFLAGS="-I/Developer/SDKs/MacOSX${with_macosx_sdk}.sdk/System/Library/Frameworks/Python.framework/Versions/${python_version}/include/python${python_version}"
7470         PYTHON_LIBS="-framework Python"
7471     fi
7472     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
7473         # Fallback: Accept these in the environment, or as set above
7474         # for MacOSX.
7475         :
7476     elif test "$cross_compiling" != yes; then
7477         # Unset variables set by the above AM_PATH_PYTHON so that
7478         # we actually do check anew.
7479         unset PYTHON am_cv_pathless_PYTHON ac_cv_path_PYTHON am_cv_python_version am_cv_python_platform am_cv_python_pythondir am_cv_python_pyexecdir
7480         # This causes an error if no python command is found
7481         AM_PATH_PYTHON([3.3])
7482         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
7483         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
7484         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
7485         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
7486         if test -z "$PKG_CONFIG"; then
7487             PYTHON_CFLAGS="-I$python_include"
7488             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
7489         elif $PKG_CONFIG --exists python-$python_version; then
7490             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
7491             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
7492         else
7493             PYTHON_CFLAGS="-I$python_include"
7494             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
7495         fi
7496     else
7497         dnl How to find out the cross-compilation Python installation path?
7498         dnl Let's hardocode what we know for different distributions for now...
7499         for python_version in 2.6; do
7500             if test -f ${MINGW_SYSROOT}/include/python${python_version}/Python.h; then
7501                 PYTHON_CFLAGS="-I${MINGW_SYSROOT}/include/python$python_version"
7502                 PYTHON_LIBS="-L${MINGW_SYSROOT}/lib -lpython$python_version $python_libs"
7503                 AC_MSG_CHECKING([for python.exe])
7504                 libo_MINGW_CHECK_DLL([libpython$python_version])
7505                 libo_MINGW_CHECK_DLL([libreadline6])
7506                 libo_MINGW_CHECK_DLL([libtermcap])
7507                 # could we somehow extract the really mingw python version from
7508                 # actual distro package?
7509                 # 2.6.2 currently on OpenSUSE 12.1?
7510                 # rpm -q mingw32-python => mingw32-python-2.6.2-17.17.noarch
7511                 PYTHON_VERSION=$python_version.2
7512                 PYTHON_VERSION_MAJOR=`echo $python_version | cut -d . -f 1`
7513                 PYTHON_VERSION_MINOR=`echo $python_version | cut -d . -f 2`
7514                 break
7515             fi
7516         done
7517         AC_MSG_CHECKING([for python version])
7518         AS_IF([test -n "$PYTHON_VERSION"],
7519               [AC_MSG_RESULT([$PYTHON_VERSION])],
7520               [AC_MSG_RESULT([not found])
7521                AC_MSG_ERROR([no usable python found])])
7522         test -n "$PYTHON_CFLAGS" && break
7523     fi
7524     # let the PYTHON_FOR_BUILD match the same python installation that
7525     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
7526     # better for PythonTests.
7527     PYTHON_FOR_BUILD=$PYTHON
7530 dnl By now enable_python should be "system", "internal" or "no"
7531 case $enable_python in
7532 system)
7533     SYSTEM_PYTHON=YES
7535     if test "$CROSS_COMPILING" != YES; then
7536         dnl Check if the headers really work
7537         save_CPPFLAGS="$CPPFLAGS"
7538         CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
7539         AC_CHECK_HEADER(Python.h, [],
7540            [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
7541            [])
7542         CPPFLAGS="$save_CPPFLAGS"
7544         AC_LANG_PUSH(C)
7545         CFLAGS="$CFLAGS $PYTHON_CFLAGS"
7546         AC_MSG_CHECKING([for correct python library version])
7547            AC_RUN_IFELSE([AC_LANG_SOURCE([[
7548 #include <Python.h>
7550 int main(int argc, char **argv) {
7551        if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
7552            (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
7553        else return 1;
7555            ]])],[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])],[])
7556         CFLAGS=$save_CFLAGS
7557         AC_LANG_POP(C)
7559         dnl FIXME Check if the Python library can be linked with, too?
7560     fi
7561     ;;
7563 internal)
7564     SYSTEM_PYTHON=NO
7565     PYTHON_VERSION_MAJOR=3
7566     PYTHON_VERSION_MINOR=3
7567     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.0
7568     BUILD_TYPE="$BUILD_TYPE PYTHON"
7569     # Embedded Python dies without Home set
7570     if test "$HOME" = ""; then
7571         export HOME=""
7572     fi
7573     # bz2 tarball and bzip2 is not standard
7574     if test -z "$BZIP2"; then
7575         AC_PATH_PROG( BZIP2, bzip2)
7576         if test -z "$BZIP2"; then
7577             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
7578         fi
7579     fi
7580     ;;
7582     DISABLE_PYTHON=TRUE
7583     SYSTEM_PYTHON=NO
7584     ;;
7586     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
7587     ;;
7588 esac
7590 AC_SUBST(DISABLE_PYTHON)
7591 AC_SUBST(SYSTEM_PYTHON)
7592 AC_SUBST(PYTHON_CFLAGS)
7593 AC_SUBST(PYTHON_LIBS)
7594 AC_SUBST(PYTHON_VERSION)
7595 AC_SUBST(PYTHON_VERSION_MAJOR)
7596 AC_SUBST(PYTHON_VERSION_MINOR)
7598 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
7599 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
7600     AC_MSG_RESULT([yes])
7601     ENABLE_MARIADBC=YES
7602     MARIADBC_MAJOR=1
7603     MARIADBC_MINOR=0
7604     MARIADBC_MICRO=2
7605     BUILD_TYPE="$BUILD_TYPE MARIADBC"
7606 else
7607     AC_MSG_RESULT([no])
7608     ENABLE_MARIADBC=NO
7610 AC_SUBST(ENABLE_MARIADBC)
7611 AC_SUBST(MARIADBC_MAJOR)
7612 AC_SUBST(MARIADBC_MINOR)
7613 AC_SUBST(MARIADBC_MICRO)
7615 if test "$ENABLE_MARIADBC" = "YES"; then
7617     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
7619     dnl ===================================================================
7620     dnl Check for system MariaDB
7621     dnl ===================================================================
7622     AC_MSG_CHECKING([which MariaDB to use])
7623     if test "$with_system_mariadb" = "yes"; then
7624         AC_MSG_RESULT([external])
7625         SYSTEM_MARIADB=YES
7626         AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
7627         if test -z "$MARIADBCONFIG"; then
7628             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
7629             if test -z "$MARIADBCONFIG"; then
7630                 AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL package.])
7631             fi
7632         fi
7633         AC_MSG_CHECKING([MariaDB version])
7634         MARIADB_VERSION=`$MARIADBCONFIG --version`
7635         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
7636         if test "$MARIADB_MAJOR" -ge "5"; then
7637             AC_MSG_RESULT([OK])
7638         else
7639             AC_MSG_ERROR([too old, use 5.0.x or later])
7640         fi
7641         AC_MSG_CHECKING([for MariaDB Client library])
7642         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
7643         MARIADB_LIBS=`$MARIADBCONFIG --libs`
7644         AC_MSG_RESULT([includes $MARIADB_CFLAGS, libraries $MARIADB_LIBS])
7645     else
7646         AC_MSG_RESULT([internal])
7647         SYSTEM_MARIADB=NO
7648         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb/include"
7649         MARIADB_LIBS="-L${OUTDIR}/lib -lmariadblib"
7650         BUILD_TYPE="$BUILD_TYPE MARIADB"
7651     fi
7653     AC_SUBST(SYSTEM_MARIADB)
7654     AC_SUBST(MARIADB_CFLAGS)
7655     AC_SUBST(MARIADB_LIBS)
7657     AC_LANG_PUSH([C++])
7658     dnl ===================================================================
7659     dnl Check for system MySQL C++ Connector
7660     dnl ===================================================================
7661     # FIXME!
7662     # who thought this too-generic cppconn dir was a good idea?
7663     AC_MSG_CHECKING([MySQL Connector/C++])
7664     if test "$with_system_mysql_cppconn" = "yes"; then
7665         AC_MSG_RESULT([external])
7666         SYSTEM_MYSQL_CPPCONN=YES
7667         AC_LANG_PUSH([C++])
7668         AC_CHECK_HEADER(mysql_driver.h, [],
7669                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
7670         AC_CHECK_LIB([mysqlcppconn], [main], [:],
7671                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
7672         save_LIBS=$LIBS
7673         LIBS="$LIBS -lmysqlcppconn"
7674         AC_MSG_CHECKING([version])
7675         AC_RUN_IFELSE([AC_LANG_SOURCE([[
7676 #include <mysql_driver.h>
7678 int main(int argc, char **argv) {
7679     sql::Driver *driver;
7680     driver = get_driver_instance();
7681     if (driver->getMajorVersion() > 1 || \
7682        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
7683        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
7684         return 0;
7685       else
7686         return 1;
7688       ]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR([not suitable, we need >= 1.0.6])],[])
7690         AC_LANG_POP([C++])
7691         LIBS=$save_LIBS
7692     else
7693         AC_MSG_RESULT([internal])
7694         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
7695         SYSTEM_MYSQL_CPPCONN=NO
7696     fi
7697     AC_LANG_POP([C++])
7699 AC_SUBST(SYSTEM_MYSQL_CPPCONN)
7701 dnl ===================================================================
7702 dnl Check for system hsqldb
7703 dnl ===================================================================
7704 if test "$with_java" != "no"; then
7705 HSQLDB_USE_JDBC_4_1=
7706 AC_MSG_CHECKING([which hsqldb to use])
7707 if test "$with_system_hsqldb" = "yes"; then
7708     AC_MSG_RESULT([external])
7709     SYSTEM_HSQLDB=YES
7710     if test -z $HSQLDB_JAR; then
7711         HSQLDB_JAR=/usr/share/java/hsqldb.jar
7712     fi
7713     AC_CHECK_FILE($HSQLDB_JAR, [],
7714                [AC_MSG_ERROR(hsqldb.jar not found.)], [])
7715     AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
7716     export HSQLDB_JAR
7717     if $PERL -e 'use Archive::Zip;
7718             my $file = "$ENV{'HSQLDB_JAR'}";
7719             my $zip = Archive::Zip->new( $file );
7720             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
7721             if ( $mf =~ m/Specification-Version: 1.8.*/ ) {
7722                push @l, split(/\n/, $mf);
7723                foreach my $line (@l) {
7724                   if ($line =~ m/Specification-Version:/) {
7725                       ($t, $version) = split (/:/,$line);
7726                       $version =~ s/^\s//;
7727                       ($a, $b, $c, $d) = split (/\./,$version);
7728                       if ($c == "0" && $d > "8")  {
7729                           exit 0;
7730                       } else {
7731                           exit 1;
7732                       }
7733                   }
7734                }
7735             } else {
7736                 exit 1;
7737             }'; then
7738         AC_MSG_RESULT([yes])
7739     else
7740         AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
7741     fi
7742 else
7743     AC_MSG_RESULT([internal])
7744     SYSTEM_HSQLDB=NO
7745     BUILD_TYPE="$BUILD_TYPE HSQLDB"
7746     AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
7747     javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
7748     if expr "$javanumver" '>=' 000100060000 > /dev/null; then
7749         AC_MSG_RESULT([yes])
7750         HSQLDB_USE_JDBC_4_1=YES
7751     else
7752         AC_MSG_RESULT([no])
7753     fi
7755 AC_SUBST(SYSTEM_HSQLDB)
7756 AC_SUBST(HSQLDB_JAR)
7757 AC_SUBST([HSQLDB_USE_JDBC_4_1])
7760 dnl ===================================================================
7761 dnl Check for PostgreSQL stuff
7762 dnl ===================================================================
7763 if test "x$enable_postgresql_sdbc" != "xno"; then
7764     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
7766     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
7767         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
7768     fi
7769     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
7770         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
7771     fi
7773     AC_MSG_CHECKING([PostgreSQL C interface])
7774     if test "$with_system_postgresql" = "yes"; then
7775         AC_MSG_RESULT([external PostgreSQL])
7776         SYSTEM_POSTGRESQL=YES
7777         if test "$_os" = Darwin; then
7778             supp_path=''
7779             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
7780                 pg_supp_path="$P_SEP$d$pg_supp_path"
7781             done
7782         fi
7783         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
7784         if test -z "$PGCONFIG"; then
7785             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
7786         fi
7787         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
7788         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
7789     else
7790         # if/when anything else than PostgreSQL uses Kerberos,
7791         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
7792         WITH_KRB5=NO
7793         WITH_GSSAPI=no
7794         case "$_os" in
7795         Darwin)
7796             # MacOS X has system MIT Kerberos 5 since 10.4
7797             if test "$with_krb5" != "no"; then
7798                 WITH_KRB5=YES
7799                 save_LIBS=$LIBS
7800                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
7801                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5, try installing libcom_err devel package])])
7802                 KRB5_LIBS=$LIBS
7803                 LIBS=$save_LIBS
7804                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
7805                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5, try installing krb5 devel package])])
7806                 KRB5_LIBS="$KRB5_LIBS $LIBS"
7807                 LIBS=$save_LIBS
7808             fi
7809             if test "$with_gssapi" != "no"; then
7810               WITH_GSSAPI=YES
7811               save_LIBS=$LIBS
7812               AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
7813                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
7814               GSSAPI_LIBS=$LIBS
7815               LIBS=$save_LIBS
7816             fi
7817             ;;
7818         WINNT)
7819             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
7820                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
7821             fi
7822             ;;
7823         Linux|GNU|*BSD|DragonFly)
7824             if test "$with_krb5" != "no"; then
7825                 WITH_KRB5=YES
7826                 save_LIBS=$LIBS
7827                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
7828                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
7829                 KRB5_LIBS=$LIBS
7830                 LIBS=$save_LIBS
7831                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
7832                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
7833                 KRB5_LIBS="$KRB5_LIBS $LIBS"
7834                 LIBS=$save_LIBS
7835             fi
7836             if test "$with_gssapi" != "no"; then
7837                 WITH_GSSAPI=YES
7838                 save_LIBS=$LIBS
7839                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
7840                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
7841                 GSSAPI_LIBS=$LIBS
7842                 LIBS=$save_LIBS
7843             fi
7844             ;;
7845         *)
7846             if test "$with_krb5" = "yes"; then
7847                 WITH_KRB5=YES
7848                 save_LIBS=$LIBS
7849                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
7850                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
7851                 KRB5_LIBS=$LIBS
7852                 LIBS=$save_LIBS
7853                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
7854                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
7855                 KRB5_LIBS="$KRB5_LIBS $LIBS"
7856                 LIBS=$save_LIBS
7857             fi
7858             if test "$with_gssapi" = "yes"; then
7859                 WITH_GSSAPI=YES
7860                 save_LIBS=$LIBS
7861                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
7862                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
7863                 LIBS=$save_LIBS
7864                 GSSAPI_LIBS=$LIBS
7865             fi
7866         esac
7868         if test -n "$with_libpq_path"; then
7869             SYSTEM_POSTGRESQL=YES
7870             AC_MSG_RESULT([external libpq])
7871             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
7872             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
7873         else
7874             SYSTEM_POSTGRESQL=NO
7875             AC_MSG_RESULT([internal])
7876             POSTGRESQL_LIB=""
7877             POSTGRESQL_INC="%OVERRIDE_ME%"
7878             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
7879         fi
7880     fi
7881     if test "${SYSTEM_POSTGRESQL}" = "YES"; then
7882         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
7883         save_CFLAGS=$CFLAGS
7884         save_CPPFLAGS=$CPPFLAGS
7885         save_LIBS=$LIBS
7886         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
7887         LIBS="${LIBS} ${POSTGRESQL_LIB}"
7888         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
7889         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
7890             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
7891         CFLAGS=$save_CFLAGS
7892         CPPFLAGS=$save_CPPFLAGS
7893         LIBS=$save_LIBS
7894     fi
7895     BUILD_POSTGRESQL_SDBC=YES
7897 AC_SUBST(WITH_KRB5)
7898 AC_SUBST(WITH_GSSAPI)
7899 AC_SUBST(GSSAPI_LIBS)
7900 AC_SUBST(KRB5_LIBS)
7901 AC_SUBST(BUILD_POSTGRESQL_SDBC)
7902 AC_SUBST(SYSTEM_POSTGRESQL)
7903 AC_SUBST(POSTGRESQL_INC)
7904 AC_SUBST(POSTGRESQL_LIB)
7906 dnl ===================================================================
7907 dnl Check for system curl
7908 dnl ===================================================================
7909 AC_MSG_CHECKING([which libcurl to use])
7910 if test "$with_system_curl" = "auto"; then
7911     case "$_os" in
7912     Darwin)
7913         with_system_curl=yes
7914         ;;
7915     *)
7916         with_system_curl="$with_system_libs"
7917         ;;
7918     esac
7921 if test "$with_system_curl" = "yes"; then
7922     AC_MSG_RESULT([external])
7923     SYSTEM_CURL=YES
7925     curl_version=""
7926     if test "$cross_compiling" = "yes"; then
7927         dnl At least the OBS mingw32-libcurl-devel package
7928         dnl comes with a proper .pc file
7929         PKG_CHECK_MODULES(CURL, libcurl,, [:])
7930         if test -n "$CURL_PKG_ERRORS"; then
7931             AC_MSG_RESULT([no])
7932         else
7933             curl_version=`$PKG_CONFIG --modversion libcurl`
7934         fi
7935     fi
7936     if test -z "$curl_version"; then
7937         AC_PATH_PROG(CURLCONFIG, curl-config)
7938         if test -z "$CURLCONFIG"; then
7939             AC_MSG_ERROR([install the libcurl development package])
7940         fi
7941         CURL_LIBS=`$CURLCONFIG --libs`
7942         CURL_CFLAGS=`$CURLCONFIG --cflags`
7943         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
7944     fi
7946     AC_MSG_CHECKING([whether libcurl is >= 7.13.1])
7948     case $curl_version in
7949     dnl brackets doubled below because Autoconf uses them as m4 quote characters,
7950     dnl so they need to be doubled to end up in the configure script
7951     7.13.1|7.1[[4-9]].*|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
7952         AC_MSG_RESULT([yes, you have $curl_version])
7953         ;;
7954     *)
7955         AC_MSG_ERROR([no, you have $curl_version])
7956         ;;
7957     esac
7959     libo_MINGW_CHECK_DLL([libcurl])
7960     libo_MINGW_TRY_DLL([libintl])
7961     libo_MINGW_TRY_DLL([libidn])
7962     libo_MINGW_TRY_DLL([libnspr4])
7963     libo_MINGW_TRY_DLL([nssutil3])
7964     libo_MINGW_TRY_DLL([libplc4])
7965     libo_MINGW_TRY_DLL([libplds4])
7966     libo_MINGW_TRY_DLL([nss3])
7967     libo_MINGW_TRY_DLL([ssl3])
7968     libo_MINGW_TRY_DLL([libgpg-error])
7969     libo_MINGW_TRY_DLL([libgcrypt])
7970     libo_MINGW_TRY_DLL([libssh2])
7971 else
7972     AC_MSG_RESULT([internal])
7973     SYSTEM_CURL=NO
7974     BUILD_TYPE="$BUILD_TYPE CURL"
7976 AC_SUBST(SYSTEM_CURL)
7977 AC_SUBST(CURL_CFLAGS)
7978 AC_SUBST(CURL_LIBS)
7980 dnl ===================================================================
7981 dnl Check for system boost
7982 dnl ===================================================================
7983 AC_MSG_CHECKING([which boost to use])
7984 if test "$with_system_boost" = "yes"; then
7985     AC_MSG_RESULT([external])
7986     SYSTEM_BOOST=YES
7987     AX_BOOST_BASE
7988     AX_BOOST_DATE_TIME
7989     mingw_boost_date_time_dll=`echo $BOOST_DATE_TIME_LIB | sed -e 's/^-l//' -e 's/\.dll$//'`
7990     libo_MINGW_TRY_DLL([$mingw_boost_date_time_dll])
7991     if test -z "$MINGW_BOOST_DATE_TIME_DLL"; then
7992         # if not found, try again with 'lib' prefix
7993         libo_MINGW_CHECK_DLL([lib$mingw_boost_date_time_dll])
7994     fi
7995     AC_LANG_PUSH([C++])
7996     save_CXXFLAGS=$CXXFLAGS
7997     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS"
7998     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
7999        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8000     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8001        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8002     AC_CHECK_HEADER(boost/function.hpp, [],
8003        [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
8004     CXXFLAGS="$CXXFLAGS -fno-exceptions"
8005     AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
8006     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp>
8007 ]], [[]])],[ac_cv_cxx_boost_no_exceptions_broken=no],[ac_cv_cxx_boost_no_exceptions_broken=yes])
8008     if test "$ac_cv_cxx_boost_no_exceptions_broken" = "yes"; then
8009         AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
8010     else
8011         AC_MSG_RESULT([yes])
8012     fi
8013     CXXFLAGS=$save_CXXFLAGS
8014     AC_LANG_POP([C++])
8015 else
8016     AC_MSG_RESULT([internal])
8017     BUILD_TYPE="$BUILD_TYPE BOOST"
8018     SYSTEM_BOOST=NO
8020 AC_SUBST(SYSTEM_BOOST)
8022 dnl ===================================================================
8023 dnl Check for system mdds
8024 dnl ===================================================================
8025 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds >= 0.8.1])
8027 dnl ===================================================================
8028 dnl Determine which hash container mdds shall use
8029 dnl ===================================================================
8030 AC_MSG_CHECKING([which hash container mdds shall use])
8031 if test "x$HAVE_CXX0X" = "xTRUE" -a "x$SYSTEM_MDDS" = "xYES"; then
8032     MDDS_CPPFLAGS=$CXXFLAGS_CXX11
8033     AC_MSG_RESULT([std::unordered_map])
8034 else
8035     MDDS_CPPFLAGS="-DMDDS_HASH_CONTAINER_BOOST"
8036     AC_MSG_RESULT([boost::unordered_map])
8038 AC_SUBST([MDDS_CPPFLAGS])
8040 dnl ===================================================================
8041 dnl Check for system vigra
8042 dnl ===================================================================
8043 AC_MSG_CHECKING([which vigra to use])
8044 if test "$with_system_vigra" = "yes"; then
8045     AC_MSG_RESULT([external])
8046     SYSTEM_VIGRA=YES
8047     AC_LANG_PUSH([C++])
8048     AC_CHECK_HEADER(vigra/copyimage.hxx, [],
8049        [AC_MSG_ERROR(vigra/copyimage.hxx not found. install vigra)], [])
8050     AC_LANG_POP([C++])
8051 else
8052     AC_MSG_RESULT([internal])
8053     BUILD_TYPE="$BUILD_TYPE VIGRA"
8054     SYSTEM_VIGRA=NO
8056 AC_SUBST(SYSTEM_VIGRA)
8058 dnl ===================================================================
8059 dnl Check for system odbc
8060 dnl ===================================================================
8061 AC_MSG_CHECKING([which odbc headers to use])
8062 if test "$with_system_odbc" = "yes"; then
8063     AC_MSG_RESULT([external])
8064     SYSTEM_ODBC_HEADERS=YES
8066     AC_CHECK_HEADER(sqlext.h, [],
8067       [AC_MSG_ERROR(odbc not found. install odbc)], [])
8068 elif test "$enable_database_connectivity" != yes; then
8069     AC_MSG_RESULT([none])
8070 else
8071     AC_MSG_RESULT([internal])
8072     SYSTEM_ODBC_HEADERS=NO
8074 AC_SUBST(SYSTEM_ODBC_HEADERS)
8077 dnl ===================================================================
8078 dnl Check for system openldap
8079 dnl ===================================================================
8081 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8082 AC_MSG_CHECKING([which openldap library to use])
8083 if test "$with_system_openldap" = "yes"; then
8084     AC_MSG_RESULT([external])
8085     SYSTEM_OPENLDAP=YES
8086     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8087     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8088     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8089 else
8090     AC_MSG_RESULT([internal])
8091     SYSTEM_OPENLDAP=NO
8092     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8095 AC_SUBST(SYSTEM_OPENLDAP)
8097 dnl ===================================================================
8098 dnl Check for mozilla ab connectivity for windows
8099 dnl ===================================================================
8101 if test "$_os" = "WINNT"; then
8102     AC_MSG_CHECKING([whether to enable build of Mozilla addressbook connectivity driver for Windows])
8103     if test "$enable_win_mozab_driver" = "yes" -a "$WITH_MINGW" != "YES" ; then
8104         WITH_MOZAB4WIN=YES
8105         AC_MSG_RESULT([yes, internal (old windows mozab driver)])
8106         BUILD_TYPE="$BUILD_TYPE MOZ"
8107         MSVC80_DLLS="msvcp80.dll msvcr80.dll Microsoft.VC80.CRT.manifest"
8108         MSVC80_DLL_PATH=`cygpath -u "$TARFILE_LOCATION"`
8109         for dll in $MSVC80_DLLS; do
8110             if ! test -f "$MSVC80_DLL_PATH/$dll"; then
8111                 AC_MSG_ERROR([can not find $dll in $MSVC80_DLL_PATH needed for the pre-built Mozilla libraries])
8112             fi
8113         done
8114     else
8115         AC_MSG_RESULT([no])
8116         WITH_MOZAB4WIN=NO
8117     fi
8119 AC_SUBST(WITH_MOZAB4WIN)
8120 AC_SUBST(MSVC80_DLLS)
8121 AC_SUBST(MSVC80_DLL_PATH)
8123 dnl ===================================================================
8124 dnl Check for TLS/SSL and cryptographic implementation to use
8125 dnl ===================================================================
8126 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8127 if test -n "$with_tls"; then
8128     case $with_tls in
8129     openssl)
8130         AC_DEFINE(USE_TLS_OPENSSL)
8131         TLS=OPENSSL
8133         if test "$enable_openssl" != "yes"; then
8134             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8135         fi
8137         # warn that OpenSSL has been selected but not all TLS code has this option
8138         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS])
8139         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS"
8140         ;;
8141     nss)
8142         AC_DEFINE(USE_TLS_NSS)
8143         TLS=NSS
8144         ;;
8145     *)
8146         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8147 openssl - OpenSSL
8148 nss - Mozilla's Network Security Services (NSS)
8149     ])
8150         ;;
8151     esac
8152 else
8153     if test "$enable_openssl" = "yes"; then
8154         AC_DEFINE(USE_TLS_OPENSSL)
8155         TLS=OPENSSL
8156     else
8157         AC_DEFINE(USE_TLS_NSS)
8158         TLS=NSS
8159     fi
8161 AC_MSG_RESULT([$TLS])
8162 AC_SUBST(TLS)
8164 dnl ===================================================================
8165 dnl Check for system NSS
8166 dnl ===================================================================
8167 libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8168 if test "$with_system_nss" = "yes"; then
8169     libo_MINGW_CHECK_DLL([libnspr4])
8170     libo_MINGW_CHECK_DLL([libplc4])
8171     libo_MINGW_CHECK_DLL([libplds4])
8172     libo_MINGW_CHECK_DLL([nss3])
8173     libo_MINGW_CHECK_DLL([nssutil3])
8174     libo_MINGW_CHECK_DLL([smime3])
8175     libo_MINGW_CHECK_DLL([ssl3])
8176 else
8177     NSS_MAJOR="3"
8178     NSS_MINOR="13"
8179     NSS_PATCH="5"
8181 AC_SUBST(NSS_MAJOR)
8182 AC_SUBST(NSS_MINOR)
8183 AC_SUBST(NSS_PATCH)
8185 dnl ===================================================================
8186 dnl Check for system mozilla headers
8187 dnl ===================================================================
8188 HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=
8189 AC_MSG_CHECKING([which NPAPI headers to use])
8191 if test "$with_system_npapi_headers" = "yes"; then
8192     AC_MSG_RESULT([external])
8193     SYSTEM_NPAPI_HEADERS=YES
8194     # First try npapi-sdk:
8195     PKG_CHECK_MODULES(NPAPI_HEADERS, npapi-sdk, [LOCATED=yes], [LOCATED=no])
8196     # Then go with libxul:
8197     if test "x$LOCATED" != "xyes"; then
8198         PKG_CHECK_MODULES(NPAPI_HEADERS, libxul, [LOCATED=yes], [LOCATED=no])
8199     fi
8200     if test "x$LOCATED" != "xyes"; then
8201         PKG_CHECK_MODULES(NPAPI_HEADERS, mozilla-plugin, [LOCATED=yes], [LOCATED=no])
8202     fi
8203     # if still not found bail out
8204     if test "x$LOCATED" != "xyes"; then
8205         AC_MSG_ERROR([npapi.h header file not found])
8206     fi
8208     AC_LANG_PUSH([C])
8209     save_CFLAGS=$CFLAGS
8210     CFLAGS="$CFLAGS $NPAPI_HEADERS_CFLAGS"
8211     AC_MSG_CHECKING([for NPP_GetMIMEDescription return type])
8212     AC_COMPILE_IFELSE(
8213         [AC_LANG_SOURCE([[
8214             #define XP_UNIX
8215             #include <npapi.h>
8216             const char* NPP_GetMIMEDescription(void) { return "foo"; }
8217             ]])],
8218         [AC_MSG_RESULT([const char*])],
8219         [
8220         AC_MSG_RESULT([char*])
8221         HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=TRUE
8222         ])
8223     CFLAGS=$save_CFLAGS
8224     AC_LANG_POP([C])
8225     NPAPI_HEADERS_CFLAGS="`echo $NPAPI_HEADERS_CFLAGS | sed -e \"s/-I/${ISYSTEM}/g\"`"
8226 else
8227     AC_MSG_RESULT([internal])
8228         dnl ...but will not be built/used unless ENABLE_NPAPI_FROM_BROWSER or
8229         dnl ENABLE_NPAPI_INTO_BROWSER is YES
8230     SYSTEM_NPAPI_HEADERS=NO
8232 AC_SUBST(NPAPI_HEADERS_CFLAGS)
8233 AC_SUBST(SYSTEM_NPAPI_HEADERS)
8234 AC_SUBST(HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION)
8236 dnl ===================================================================
8237 dnl Check for system sane
8238 dnl ===================================================================
8239 AC_MSG_CHECKING([which sane header to use])
8240 if test "$with_system_sane" = "yes"; then
8241     AC_MSG_RESULT([external])
8242     AC_CHECK_HEADER(sane/sane.h, [],
8243       [AC_MSG_ERROR(sane not found. install sane)], [])
8244 else
8245     AC_MSG_RESULT([internal])
8246     BUILD_TYPE="$BUILD_TYPE SANE"
8249 dnl ===================================================================
8250 dnl Check for system icu
8251 dnl ===================================================================
8252 SYSTEM_GENBRK=
8253 SYSTEM_GENCCODE=
8254 SYSTEM_GENCMN=
8256 ICU_MAJOR=51
8257 ICU_MINOR=1
8258 ICU_RECLASSIFIED_CLOSE_PARENTHESIS="YES"
8259 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="YES"
8260 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="YES"
8261 ICU_RECLASSIFIED_HEBREW_LETTER="YES"
8262 AC_MSG_CHECKING([which icu to use])
8263 if test "$with_system_icu" = "yes"; then
8264     AC_MSG_RESULT([external])
8265     SYSTEM_ICU=YES
8266     AC_LANG_PUSH([C++])
8267     AC_MSG_CHECKING([for unicode/rbbi.h])
8268     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
8269     AC_LANG_POP([C++])
8271     if test "$cross_compiling" != "yes" -o "$WITH_MINGW" = "yes"; then
8272         ICUPATH="$PATH"
8273         if test "$WITH_MINGW" = "yes"; then
8274             ICUPATH=`$CC -print-sysroot`/mingw/bin:"$ICUPATH"
8275         fi
8276         AC_PATH_PROG(ICUCONFIG,icu-config,,[$ICUPATH])
8278         AC_MSG_CHECKING([ICU version])
8279         ICU_VERSION=`$ICUCONFIG --noverify --version 2>/dev/null || $ICUCONFIG --version`
8280         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
8281         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
8283         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "2" \); then
8284             AC_MSG_RESULT([OK, $ICU_VERSION])
8285         else
8286             AC_MSG_ERROR([not suitable, only >= 4.2 supported currently])
8287         fi
8288     fi
8290     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
8291         AC_PATH_PROG([ICUCONFIG_FOR_BUILD], [icu-config], [], [$PATH:/usr/sbin:/sbin])
8292         ICU_VERSION_FOR_BUILD=`$ICUCONFIG_FOR_BUILD --noverify --version 2>/dev/null || $ICUCONFIG_FOR_BUILD --version`
8293         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
8294         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
8295         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
8296         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
8297             AC_MSG_RESULT([yes])
8298         else
8299             AC_MSG_RESULT([no])
8300             if test "$with_system_icu_for_build" != "force"; then
8301                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
8302 You can use --with-system-icu-for-build=force to use it anyway.])
8303             fi
8304         fi
8305     fi
8307     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
8308         # using the system icu tools can lead to version confusion, use the
8309         # ones from the build environment when cross-compiling
8310         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
8311         if test -z "$SYSTEM_GENBRK"; then
8312             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
8313         fi
8314         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8315         if test -z "$SYSTEM_GENCCODE"; then
8316             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
8317         fi
8318         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8319         if test -z "$SYSTEM_GENCMN"; then
8320             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
8321         fi
8322         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "4" \); then
8323             ICU_RECLASSIFIED_CLOSE_PARENTHESIS="YES"
8324         else
8325             ICU_RECLASSIFIED_CLOSE_PARENTHESIS="NO"
8326         fi
8327         if test "$ICU_MAJOR" -ge "49"; then
8328             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="YES"
8329             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="YES"
8330             ICU_RECLASSIFIED_HEBREW_LETTER="YES"
8331         else
8332             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="NO"
8333             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="NO"
8334             ICU_RECLASSIFIED_HEBREW_LETTER="NO"
8335         fi
8336     fi
8338     if test "$cross_compiling" = "yes"; then
8339        if test "$ICU_MAJOR" -ge "50"; then
8340             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
8341             ICU_MINOR=""
8342        fi
8343     fi
8345     libo_MINGW_CHECK_DLL([icudata][$ICU_MAJOR][$ICU_MINOR])
8346     libo_MINGW_CHECK_DLL([icui18n][$ICU_MAJOR][$ICU_MINOR])
8347     libo_MINGW_CHECK_DLL([icuuc][$ICU_MAJOR][$ICU_MINOR])
8348 else
8349     AC_MSG_RESULT([internal])
8350     SYSTEM_ICU="NO"
8351     BUILD_TYPE="$BUILD_TYPE ICU"
8352     # surprisingly set these only for "internal" (to be used by various other
8353     # external libs): the system icu-config is quite unhelpful and spits out
8354     # dozens of weird flags and also default path -I/usr/include
8355     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8356     ICU_LIBS=""
8358 AC_SUBST(SYSTEM_ICU)
8359 AC_SUBST(SYSTEM_GENBRK)
8360 AC_SUBST(SYSTEM_GENCCODE)
8361 AC_SUBST(SYSTEM_GENCMN)
8362 AC_SUBST(ICU_MAJOR)
8363 AC_SUBST(ICU_MINOR)
8364 AC_SUBST(ICU_RECLASSIFIED_CLOSE_PARENTHESIS)
8365 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
8366 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
8367 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
8368 AC_SUBST(ICU_CFLAGS)
8369 AC_SUBST(ICU_LIBS)
8371 dnl ===================================================================
8372 dnl Graphite
8373 dnl ===================================================================
8375 AC_MSG_CHECKING([whether to enable graphite support])
8376 if test "$_os" = "WINNT" -o "$_os" = "Linux" && test "$enable_graphite" = "" -o "$enable_graphite" != "no"; then
8377     AC_MSG_RESULT([yes])
8378     ENABLE_GRAPHITE="TRUE"
8379     AC_DEFINE(ENABLE_GRAPHITE)
8380     libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
8381     if test "$with_system_graphite" = "yes"; then
8382         libo_MINGW_CHECK_DLL([libgraphite2])
8383     fi
8384 else
8385     AC_MSG_RESULT([no])
8387 AC_SUBST(ENABLE_GRAPHITE)
8389 dnl ===================================================================
8390 dnl HarfBuzz
8391 dnl ===================================================================
8392 AC_MSG_CHECKING([whether to enable HarfBuzz support])
8393 if test "$_os" != "WINNT" -a "$_os" != "Darwin"; then
8394     AC_MSG_RESULT([yes])
8395     ENABLE_HARFBUZZ="TRUE"
8396     if $PKG_CONFIG --atleast-version 0.9.18 harfbuzz; then
8397         libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.18])
8398     else
8399         libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz >= 0.9.10])
8400     fi
8401 else
8402     AC_MSG_RESULT([no])
8404 AC_SUBST(ENABLE_HARFBUZZ)
8406 dnl ===================================================================
8407 dnl Check for NPAPI interface to plug browser plugins into LibreOffice documents
8408 dnl ===================================================================
8409 AC_MSG_CHECKING([whether to plug browser plugins into LibreOffice documents])
8410 # Obviously no such thing on iOS or Android. Also not possible when building
8411 # 64-bit OS X code as the plugin code uses QuickTime and Carbon.
8412 if test "$_os" != Android -a "$_os" != iOS -a \( $_os != Darwin -o "$BITNESS_OVERRIDE" = "" \) -a \
8413         "$enable_headless" != yes
8414 then
8415     AC_MSG_RESULT([yes])
8416     ENABLE_NPAPI_FROM_BROWSER=YES
8417 else
8418     AC_MSG_RESULT([no])
8419     ENABLE_NPAPI_FROM_BROWSER=NO
8421 AC_SUBST(ENABLE_NPAPI_FROM_BROWSER)
8423 dnl ===================================================================
8424 dnl Check for NPAPI interface to plug LibreOffice into browser windows
8425 dnl ===================================================================
8426 AC_MSG_CHECKING([whether to plug LibreOffice into browser windows])
8427 if test "$_os" == WINNT -o "$_os" != Android -a "$_os" != Darwin -a "$_os" != iOS -a \
8428         "$enable_headless" != yes -a "$enable_gtk" != no
8429 then
8430     AC_MSG_RESULT([yes])
8431     ENABLE_NPAPI_INTO_BROWSER=YES
8432 else
8433     AC_MSG_RESULT([no])
8434     ENABLE_NPAPI_INTO_BROWSER=NO
8436 AC_SUBST(ENABLE_NPAPI_INTO_BROWSER)
8438 AC_MSG_CHECKING([whether to use X11])
8439 dnl ***************************************
8440 dnl testing for X libraries and includes...
8441 dnl ***************************************
8442 WANT_X11="no"
8443 if test $_os != Darwin -a $_os != WINNT -a $_os != Android -a $_os != iOS -a "$enable_headless" != "yes"; then
8444     WANT_X11="yes"
8446 AC_MSG_RESULT([$WANT_X11])
8448 if test "$WANT_X11" = "yes"; then
8449     AC_PATH_X
8450     AC_PATH_XTRA
8451     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
8453     if test -z "$x_includes"; then
8454         x_includes="default_x_includes"
8455     fi
8456     if test -z "$x_libraries"; then
8457         x_libraries="default_x_libraries"
8458     fi
8459     CFLAGS="$CFLAGS $X_CFLAGS"
8460     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
8461     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
8462 else
8463     x_includes="no_x_includes"
8464     x_libraries="no_x_libraries"
8467 if test "$WANT_X11" = "yes"; then
8468     dnl ===================================================================
8469     dnl Check for Composite.h for Mozilla plugin
8470     dnl ===================================================================
8471     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
8472      [#include <X11/Intrinsic.h>])
8474     dnl ===================================================================
8475     dnl Check for extension headers
8476     dnl ===================================================================
8477     AC_MSG_CHECKING([whether to use internal X11 extensions headers])
8478     if test "$with_system_xextensions_headers" != "no"; then
8479         AC_MSG_RESULT([no])
8480         AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
8481         [#include <X11/extensions/shape.h>])
8482     else
8483         AC_MSG_RESULT([yes])
8484         BUILD_TYPE="$BUILD_TYPE X11_EXTENSIONS"
8485     fi
8489 dnl ===================================================================
8490 dnl Check for system Xrender
8491 dnl ===================================================================
8492 AC_MSG_CHECKING([whether to use Xrender])
8493 if test "$WANT_X11" = "yes" -a  "$test_xrender" = "yes"; then
8494     AC_MSG_RESULT([yes])
8495     PKG_CHECK_MODULES(XRENDER, xrender)
8496     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
8497       [AC_MSG_ERROR(libXrender not found or functional)], [])
8498     AC_MSG_CHECKING([which Xrender headers to use])
8499     if test "$with_system_xextensions_headers" != "no"; then
8500         AC_MSG_RESULT([external])
8501         AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
8502           [AC_MSG_ERROR(Xrender not found. install X)], [])
8503     else
8504         AC_MSG_RESULT([internal])
8505     fi
8506 else
8507     AC_MSG_RESULT([no])
8509 AC_SUBST(XRENDER_CFLAGS)
8510 AC_SUBST(XRENDER_LIBS)
8512 dnl ===================================================================
8513 dnl Check for XRandr
8514 dnl ===================================================================
8515 AC_MSG_CHECKING([whether to enable RandR support])
8516 if test "$WANT_X11" = "yes" -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
8517     if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
8518         XRANDR_DLOPEN="TRUE"
8519         AC_MSG_RESULT([configured to dlopen libXrandr at runtime])
8520     else
8521         AC_MSG_RESULT([yes])
8522         XRANDR_DLOPEN="FALSE"
8523         PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
8524         if test "$ENABLE_RANDR" != "TRUE"; then
8525             AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
8526                         [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
8527             XRANDR_CFLAGS=" "
8528             AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
8529               [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
8530             XRANDR_LIBS="-lXrandr "
8531             ENABLE_RANDR="TRUE"
8532         fi
8533     fi
8534 else
8535     ENABLE_RANDR=""
8536     AC_MSG_RESULT([no])
8538 AC_SUBST(XRANDR_DLOPEN)
8539 AC_SUBST(XRANDR_CFLAGS)
8540 AC_SUBST(XRANDR_LIBS)
8541 AC_SUBST(ENABLE_RANDR)
8543 dnl ===================================================================
8544 dnl Check for building neon
8545 dnl ===================================================================
8546 AC_MSG_CHECKING([whether to use neon])
8547 if test "$enable_neon" = "no"; then
8548     AC_MSG_RESULT([no])
8549     DISABLE_NEON=TRUE
8550     AC_SUBST(DISABLE_NEON)
8551 else
8552     AC_MSG_RESULT([yes])
8553 dnl ===================================================================
8554 dnl Check for system neon
8555 dnl ===================================================================
8556 libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
8557 if test "$with_system_neon" = "yes"; then
8558     NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
8559     libo_MINGW_CHECK_DLL([libneon])
8560     libo_MINGW_TRY_DLL([libtasn1])
8561     libo_MINGW_TRY_DLL([libgnutls])
8562 else
8563     NEON_VERSION=0295
8565 AC_SUBST(NEON_VERSION)
8568 dnl ===================================================================
8569 dnl Check for disabling cve_tests
8570 dnl ===================================================================
8571 AC_MSG_CHECKING([whether to execute CVE tests])
8572 if test "$enable_cve_tests" = "no"; then
8573     AC_MSG_RESULT([no])
8574     DISABLE_CVE_TESTS=TRUE
8575     AC_SUBST(DISABLE_CVE_TESTS)
8576 else
8577     AC_MSG_RESULT([yes])
8580 dnl ===================================================================
8581 dnl Check for system openssl
8582 dnl ===================================================================
8583 DISABLE_OPENSSL="NO"
8584 AC_MSG_CHECKING([whether to disable OpenSSL usage])
8585 if test "$enable_openssl" = "yes"; then
8586     AC_MSG_RESULT([no])
8587     if test "$_os" = Darwin -a "${MAC_OS_X_VERSION_MIN_REQUIRED:-0}" -ge 1070; then
8588         # OpenSSL is deprecated when building for 10.7 or later.
8589         #
8590         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
8591         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
8592         #
8593         # They apparently got fed up with the unstable ABI of
8594         # OpenSSL, or something, and recommend you either move to
8595         # their "Common Crypto Architecture", or, if you have to stay
8596         # with OpenSSL, just build it yourself statically and bundle
8597         # with your application.
8599         with_system_openssl=no
8600         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
8601     elif test "$_os" = "Darwin" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o \
8602             "$_os" = "DragonFly" && test "$with_system_openssl" != "no"; then
8603         # Mac OS builds should get out without extra stuff is the Mac porters'
8604         # wish. And pkg-config is although Xcode ships a .pc for openssl
8605         with_system_openssl=yes
8606         SYSTEM_OPENSSL=YES
8607         OPENSSL_CFLAGS=
8608         OPENSSL_LIBS="-lssl -lcrypto"
8609     else
8610         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
8611     fi
8612     if test "$with_system_openssl" = "yes"; then
8613         libo_MINGW_CHECK_DLL([libssl])
8614         libo_MINGW_CHECK_DLL([libcrypto])
8615     fi
8616 else
8617     AC_MSG_RESULT([yes])
8618     DISABLE_OPENSSL=YES
8620     # warn that although OpenSSL is disabled, system libraries may be depending on it
8621     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
8622     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
8625 AC_SUBST([DISABLE_OPENSSL])
8627 dnl ===================================================================
8628 dnl Check for building gnutls
8629 dnl ===================================================================
8630 AC_MSG_CHECKING([whether to use gnutls])
8631 if test "$enable_neon" != "no" && test "$enable_openssl" = "no"; then
8632     AC_MSG_RESULT([yes])
8633     AM_PATH_LIBGCRYPT()
8634     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
8635         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
8636                       available in the system to use as replacement.]]))
8639 AC_SUBST([LIBGCRYPT_CFLAGS])
8640 AC_SUBST([LIBGCRYPT_LIBS])
8642 dnl ===================================================================
8643 dnl Check for system redland
8644 dnl ===================================================================
8645 dnl versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
8646 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8])
8647 if test "$with_system_redland" = "yes"; then
8648     # need at least 2.0.7 for CVE-2012-0037
8649     PKG_CHECK_MODULES([RAPTOR2],[raptor2 >= 2.0.7])
8650     libo_MINGW_CHECK_DLL([librdf])
8651     libo_MINGW_TRY_DLL([libraptor])
8652     libo_MINGW_TRY_DLL([librasqal])
8653     libo_MINGW_TRY_DLL([libsqlite3])
8654 else
8655     RAPTOR_MAJOR="0"
8656     RASQAL_MAJOR="3"
8657     REDLAND_MAJOR="0"
8659 AC_SUBST(RAPTOR_MAJOR)
8660 AC_SUBST(RASQAL_MAJOR)
8661 AC_SUBST(REDLAND_MAJOR)
8663 dnl ===================================================================
8664 dnl Check for system orcus
8665 dnl ===================================================================
8666 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.6 >= 0.5.0])
8667 if test "$with_system_orcus" != "yes"; then
8668     if test "$SYSTEM_BOOST" = "YES"; then
8669         # ===========================================================
8670         # Determine if we are going to need to link with Boost.System
8671         # ===========================================================
8672         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
8673         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
8674         dnl in documentation has no effect.
8675         AC_MSG_CHECKING([if we need to link with Boost.System])
8676         AC_LANG_PUSH([C++])
8677         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
8678                 @%:@include <boost/version.hpp>
8679             ]],[[
8680                 #if BOOST_VERSION >= 105000
8681                 #   error yes, we need to link with Boost.System
8682                 #endif
8683             ]])],[
8684                 AC_MSG_RESULT([no])
8685             ],[
8686                 AC_MSG_RESULT([yes])
8687                 AX_BOOST_SYSTEM
8688         ])
8689         AC_LANG_POP([C++])
8690     fi
8692 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
8693 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
8694 AC_SUBST([BOOST_SYSTEM_LIB])
8695 AC_SUBST(SYSTEM_LIBORCUS)
8697 dnl ===================================================================
8698 dnl Check for system hunspell
8699 dnl ===================================================================
8700 AC_MSG_CHECKING([which libhunspell to use])
8701 if test "$with_system_hunspell" = "yes"; then
8702     AC_MSG_RESULT([external])
8703     SYSTEM_HUNSPELL=YES
8704     AC_LANG_PUSH([C++])
8705     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
8706     if test "$HUNSPELL_PC" != "TRUE"; then
8707         AC_CHECK_HEADER(hunspell.hxx, [],
8708             [
8709             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
8710             [AC_MSG_ERROR(hunspell headers not found.)], [])
8711             ], [])
8712         AC_CHECK_LIB([hunspell], [main], [:],
8713            [ AC_MSG_ERROR(hunspell library not found.) ], [])
8714         HUNSPELL_LIBS=-lhunspell
8715     fi
8716     AC_LANG_POP([C++])
8717     libo_MINGW_CHECK_DLL([libhunspell-1.3])
8718     HUNSPELL_CFLAGS="`echo $HUNSPELL_CFLAGS | sed -e \"s/-I/${ISYSTEM}/g\"`"
8719 else
8720     AC_MSG_RESULT([internal])
8721     SYSTEM_HUNSPELL=NO
8722     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
8723     HUNSPELL_LIBS="-L${OUTDIR}/lib -lhunspell"
8724     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
8726 AC_SUBST(SYSTEM_HUNSPELL)
8727 AC_SUBST(HUNSPELL_CFLAGS)
8728 AC_SUBST(HUNSPELL_LIBS)
8730 dnl ===================================================================
8731 dnl Checking for altlinuxhyph
8732 dnl ===================================================================
8733 AC_MSG_CHECKING([which altlinuxhyph to use])
8734 if test "$with_system_altlinuxhyph" = "yes"; then
8735     AC_MSG_RESULT([external])
8736     SYSTEM_HYPH=YES
8737     AC_CHECK_HEADER(hyphen.h, [],
8738        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
8739     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
8740        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
8741        [#include <hyphen.h>])
8742     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
8743         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
8744     if test -z "$HYPHEN_LIB"; then
8745         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
8746            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
8747     fi
8748     if test -z "$HYPHEN_LIB"; then
8749         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
8750            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
8751     fi
8752     libo_MINGW_CHECK_DLL([libhyphen])
8753 else
8754     AC_MSG_RESULT([internal])
8755     SYSTEM_HYPH=NO
8756     BUILD_TYPE="$BUILD_TYPE HYPHEN"
8758 AC_SUBST(SYSTEM_HYPH)
8759 AC_SUBST(HYPHEN_LIB)
8761 dnl ===================================================================
8762 dnl Checking for mythes
8763 dnl ===================================================================
8764 AC_MSG_CHECKING([which mythes to use])
8765 if test "$with_system_mythes" = "yes"; then
8766     AC_MSG_RESULT([external])
8767     SYSTEM_MYTHES=YES
8768     AC_LANG_PUSH([C++])
8769     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
8770     if test "$MYTHES_PKGCONFIG" = "no"; then
8771         AC_CHECK_HEADER(mythes.hxx, [],
8772             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
8773         AC_CHECK_LIB([mythes-1.2], [main], [:],
8774             [ MYTHES_FOUND=no], [])
8775     if test "$MYTHES_FOUND" = "no"; then
8776         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
8777                 [ MYTHES_FOUND=no], [])
8778     fi
8779     if test "$MYTHES_FOUND" = "no"; then
8780         AC_MSG_ERROR([mythes library not found!.])
8781     fi
8782     fi
8783     AC_LANG_POP([C++])
8784     libo_MINGW_CHECK_DLL([libmythes-1.2])
8785 else
8786     AC_MSG_RESULT([internal])
8787     SYSTEM_MYTHES=NO
8788     BUILD_TYPE="$BUILD_TYPE MYTHES"
8790 AC_SUBST(SYSTEM_MYTHES)
8791 AC_SUBST(MYTHES_CFLAGS)
8792 AC_SUBST(MYTHES_LIBS)
8794 dnl ===================================================================
8795 dnl How should we build the linear programming solver ?
8796 dnl ===================================================================
8797 ENABLE_LPSOLVE=
8798 AC_MSG_CHECKING([whether to build with lpsolve])
8799 if test "$enable_lpsolve" != "no"; then
8800     ENABLE_LPSOLVE=TRUE
8801     AC_MSG_RESULT([yes])
8802 else
8803     AC_MSG_RESULT([no])
8805 AC_SUBST(ENABLE_LPSOLVE)
8807 AC_MSG_CHECKING([which lpsolve to use])
8808 if test "$with_system_lpsolve" = "yes"; then
8809     AC_MSG_RESULT([external])
8810     SYSTEM_LPSOLVE=YES
8811     AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
8812        [ AC_MSG_ERROR(lpsolve headers not found.)], [])
8813     save_LIBS=$LIBS
8814     # some systems need this. Like Ubuntu....
8815     AC_CHECK_LIB(m, floor)
8816     AC_CHECK_LIB(dl, dlopen)
8817     AC_CHECK_LIB([lpsolve55], [make_lp], [:],
8818         [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
8819     LIBS=$save_LIBS
8820     libo_MINGW_CHECK_DLL([lpsolve55])
8821 else
8822     AC_MSG_RESULT([internal])
8823     SYSTEM_LPSOLVE=NO
8824     BUILD_TYPE="$BUILD_TYPE LPSOLVE"
8826 AC_SUBST(SYSTEM_LPSOLVE)
8830 dnl ===================================================================
8831 dnl Checking for libexttextcat
8832 dnl ===================================================================
8833 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.1.1])
8834 if test "$with_system_libexttextcat" = "yes"; then
8835     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
8837 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
8839 dnl ***************************************
8840 dnl testing libc version for Linux...
8841 dnl ***************************************
8842 if test "$_os" = "Linux"; then
8843     AC_MSG_CHECKING([whether libc is >= 2.1.1])
8844     exec 6>/dev/null # no output
8845     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
8846     exec 6>&1 # output on again
8847     if test "$HAVE_LIBC"; then
8848         AC_MSG_RESULT([yes])
8849     else
8850         AC_MSG_ERROR([no, upgrade libc])
8851     fi
8854 if test "$_os" != "WINNT"; then
8855     AC_CHECK_FUNCS(getopt, HAVE_GETOPT=YES, [HAVE_GETOPT=NO])
8856     AC_CHECK_FUNCS(readdir_r, HAVE_READDIR_R=YES, [HAVE_READDIR_R=NO])
8857     if test "$HAVE_GETOPT" = "YES" -a "$HAVE_READDIR_R" = "YES"; then
8858         SYSTEM_LIBC=YES
8859     fi
8860 else
8861     HAVE_GETOPT=NO
8862     HAVE_READDIR_R=NO
8863     SYSTEM_LIBC=YES
8866 if test "$HAVE_GETOPT" = NO -o "$HAVE_READDIR_R" = NO; then
8867     BUILD_TYPE="$BUILD_TYPE GLIBC"
8870 AC_SUBST(HAVE_GETOPT)
8871 AC_SUBST(HAVE_READDIR_R)
8872 AC_SUBST(SYSTEM_LIBC)
8874 dnl =========================================
8875 dnl Check for the Windows  SDK.
8876 dnl =========================================
8877 dnl FIXME: I don't know yet if the Windows SDK works with MinGW, keep it until I know better,
8878 dnl and add "-a \( "$WITH_MINGW" != "yes" \)" then
8879 if test "$_os" = "WINNT"; then
8880     AC_MSG_CHECKING([for Windows SDK])
8881     if test "$build_os" = "cygwin"; then
8882         find_winsdk
8883         WINDOWS_SDK_HOME=$winsdktest
8885         # normalize if found
8886         if test -n "$WINDOWS_SDK_HOME"; then
8887             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
8888             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
8889         fi
8890     fi
8892     if test -n "$WINDOWS_SDK_HOME"; then
8893         # Remove a possible trailing backslash
8894         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
8896         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
8897              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
8898              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
8899             have_windows_sdk_headers=yes
8900         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
8901              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
8902              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
8903             have_windows_sdk_headers=yes
8904         else
8905             have_windows_sdk_headers=no
8906         fi
8908         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
8909             have_windows_sdk_libs=yes
8910         elif test -f "$WINDOWS_SDK_HOME/lib/win8/um/$WINDOWS_SDK_ARCH/user32.lib"; then
8911             have_windows_sdk_libs=yes
8912         else
8913             have_windows_sdk_libs=no
8914         fi
8916         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
8917             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
8918 the  Windows SDK are installed.])
8919         fi
8921         if test ! -f "$WINDOWS_SDK_HOME/bin/msiinfo.exe" \
8922              -o ! -f "$WINDOWS_SDK_HOME/bin/msidb.exe" \
8923              -o ! -f "$WINDOWS_SDK_HOME/bin/uuidgen.exe" \
8924              -o ! -f "$WINDOWS_SDK_HOME/bin/msitran.exe"; then :
8925         elif test ! -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
8926              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
8927              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/uuidgen.exe" \
8928              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
8929         else
8930             AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
8931         fi
8932     fi
8934     if test -z "$WINDOWS_SDK_HOME"; then
8935         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
8936     elif echo $WINDOWS_SDK_HOME | grep "v6.0" >/dev/null 2>/dev/null; then
8937         WINDOWS_SDK_VERSION=60
8938         AC_MSG_RESULT([found Windows SDK 6.0 ($WINDOWS_SDK_HOME)])
8939     elif echo $WINDOWS_SDK_HOME | grep "v6.1" >/dev/null 2>/dev/null; then
8940         WINDOWS_SDK_VERSION=61
8941         AC_MSG_RESULT([found Windows SDK 6.1 ($WINDOWS_SDK_HOME)])
8942     elif echo $WINDOWS_SDK_HOME | grep "v7" >/dev/null 2>/dev/null; then
8943         WINDOWS_SDK_VERSION=70
8944         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
8945     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
8946         WINDOWS_SDK_VERSION=80
8947         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
8948     else
8949         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
8950     fi
8951     PathFormat "$WINDOWS_SDK_HOME"
8952     WINDOWS_SDK_HOME="$formatted_path"
8953     if test "$build_os" = "cygwin"; then
8954         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/include"
8955         if test -d "$WINDOWS_SDK_HOME/include/um"; then
8956             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
8957         fi
8958     fi
8960 AC_SUBST(WINDOWS_SDK_HOME)
8961 AC_SUBST(WINDOWS_SDK_VERSION)
8963 dnl =========================================
8964 dnl Check for uuidgen
8965 dnl =========================================
8966 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
8967     if test "$WITH_MINGW" = "yes"; then
8968         AC_PATH_PROG([UUIDGEN], [uuid])
8969         if test -z "$UUIDGEN"; then
8970             AC_MSG_WARN([uuid is needed for dev-install])
8971         fi
8972     else
8973         # presence is already tested above in the WINDOWS_SDK_HOME check
8974         UUIDGEN=uuidgen.exe
8975         AC_SUBST(UUIDGEN)
8976     fi
8977 else
8978     AC_PATH_PROG([UUIDGEN], [uuidgen])
8979     if test -z "$UUIDGEN"; then
8980         AC_MSG_WARN([uuid is needed for dev-install])
8981     fi
8984 dnl =========================================
8985 dnl Check for the Microsoft DirectX SDK.
8986 dnl =========================================
8987 if test -n "$ENABLE_DIRECTX" -a "$_os" = "WINNT"; then
8988     AC_MSG_CHECKING([for DirectX SDK])
8989     if test "$build_os" = "cygwin"; then
8990         dnl A standard installation of the DirectX SDK sets $DXSDK_DIR
8991         if test -n "$DXSDK_DIR"; then
8992             DIRECTXSDK_HOME=`cygpath -d "$DXSDK_DIR"`
8993             DIRECTXSDK_HOME=`cygpath -u "$DIRECTXSDK_HOME"`
8994         fi
8995         # At this point $DIRECTXSDK_HOME might still be undefined. This will lead to
8996         # the "DirectX SDK not found" error later.
8997         # (Where?)
8999         # Remove a possible trailing backslash
9000         DIRECTXSDK_HOME=`echo $DIRECTXSDK_HOME | $SED 's/\/$//'`
9001     fi
9003     if test -f "$DIRECTXSDK_HOME/Include/ddraw.h" -o -f "$DIRECTXSDK_HOME/Include/d3d9.h"; then
9004         HAVE_DIRECTXSDK_H="yes"
9005     else
9006         HAVE_DIRECTXSDK_H="no"
9007     fi
9009     if test "$BITNESS_OVERRIDE" = 64; then
9010         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x64"
9011     else
9012         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x86"
9013     fi
9014     PathFormat "$DIRECTXSDK_LIB"
9015     DIRECTXSDK_LIB="$formatted_path"
9017     if test -f "$DIRECTXSDK_LIB/ddraw.lib" -o -f "$DIRECTXSDK_LIB/d3d9.lib"; then
9018         HAVE_DIRECTXSDK_LIB="yes"
9019     else
9020         HAVE_DIRECTXSDK_LIB="no"
9021     fi
9023     if test "$HAVE_DIRECTXSDK_H" = "yes" -a "$HAVE_DIRECTXSDK_LIB" = "yes"; then
9024         AC_MSG_RESULT([found])
9025     else
9026         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway])
9027     fi
9028     if test -n "$DIRECTXSDK_HOME"; then
9029         PathFormat "$DIRECTXSDK_HOME"
9030         DIRECTXSDK_HOME="$formatted_path"
9031         SOLARINC="$SOLARINC -I$DIRECTXSDK_HOME/include"
9032     fi
9034 AC_SUBST(DIRECTXSDK_HOME)
9036 dnl ***************************************
9037 dnl Checking for bison and flex
9038 dnl ***************************************
9039 AC_PATH_PROG(BISON, bison)
9040 ANCIENT_BISON="NO"
9041 if test -z "$BISON"; then
9042     AC_MSG_ERROR([no bison found in \$PATH, install it])
9043 else
9044     AC_MSG_CHECKING([the bison version])
9045     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9046     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9047     # Accept newer than 1.875 or older(equal) than 1.75
9048     if test "$_bison_longver" -ge 1875 -o "$_bison_longver" -le 1075; then
9049         if test "$_bison_version" = "1.875"; then
9050             AC_MSG_WARN([suspect ($BISON $_bison_version)])
9051             add_warning "Suspect ($BISON $_bison_version) suggest upgrade"
9052         else
9053             AC_MSG_RESULT([checked ($BISON $_bison_version)])
9054         fi
9055     else
9056         AC_MSG_ERROR([failed ($BISON $_bison_version need 1.875+ (or 1.75 and older))])
9057     fi
9058     if test "$_bison_longver" -lt 2000; then
9059         ANCIENT_BISON="YES"
9060     fi
9062 AC_SUBST(ANCIENT_BISON)
9064 AC_PATH_PROG(FLEX, flex)
9065 if test -z "$FLEX"; then
9066     AC_MSG_ERROR([no flex found in \$PATH, install it])
9068 AC_SUBST([FLEX])
9069 dnl ***************************************
9070 dnl Checking for patch
9071 dnl ***************************************
9072 AC_PATH_PROG(PATCH, patch)
9073 if test -z "$PATCH"; then
9074     AC_MSG_ERROR([\"patch\" not found in \$PATH, install it])
9077 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9078 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9079     if test -z "$with_gnu_patch"; then
9080         GNUPATCH=$PATCH
9081     else
9082         if test -x "$with_gnu_patch"; then
9083             GNUPATCH=$with_gnu_patch
9084         else
9085             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9086         fi
9087     fi
9089     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9090     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9091         AC_MSG_RESULT([yes])
9092     else
9093         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9094     fi
9095 else
9096     GNUPATCH=$PATCH
9099 dnl We also need to check for --with-gnu-cp
9101 if test -z "$with_gnu_cp"; then
9102     # check the place where the good stuff is hidden on Solaris...
9103     if test -x /usr/gnu/bin/cp; then
9104         GNUCP=/usr/gnu/bin/cp
9105     else
9106         AC_PATH_PROGS(GNUCP, gnucp cp)
9107     fi
9108     if test -z $GNUCP; then
9109         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9110     fi
9111 else
9112     if test -x "$with_gnu_cp"; then
9113         GNUCP=$with_gnu_cp
9114     else
9115         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9116     fi
9119 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9120 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9121     AC_MSG_RESULT([yes])
9122 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9123     AC_MSG_RESULT([yes])
9124 else
9125     case "$build_os" in
9126     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9127         x_GNUCP=[\#]
9128         GNUCP=''
9129         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9130         ;;
9131     *)
9132         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9133         ;;
9134     esac
9137 AC_SUBST(GNUPATCH)
9138 AC_SUBST(GNUCP)
9139 AC_SUBST(x_GNUCP)
9141 dnl ***************************************
9142 dnl testing assembler path
9143 dnl ***************************************
9144 ML_EXE=""
9145 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
9146     if test "$BITNESS_OVERRIDE" = ""; then
9147         assembler=ml.exe
9148         assembler_bin=bin
9149     else
9150         assembler=ml64.exe
9151         assembler_bin=bin/amd64
9152     fi
9154     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9155     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9156         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9157         AC_MSG_RESULT([found])
9158         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9159     else
9160         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9161     fi
9163     PathFormat "$ASM_HOME"
9164     ASM_HOME="$formatted_path"
9165 else
9166     ASM_HOME=""
9169 AC_SUBST(ML_EXE)
9171 dnl ===================================================================
9172 dnl We need zip and unzip
9173 dnl ===================================================================
9174 AC_PATH_PROG(ZIP, zip)
9175 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9176 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9177     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],,)
9180 AC_PATH_PROG(UNZIP, unzip)
9181 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9183 dnl ===================================================================
9184 dnl Zip must be a specific type for different build types.
9185 dnl ===================================================================
9186 if test $build_os = cygwin; then
9187     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9188         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9189     fi
9192 dnl ===================================================================
9193 dnl Test which vclplugs have to be built.
9194 dnl ===================================================================
9195 R=""
9196 GTK3_CFLAGS=""
9197 GTK3_LIBS=""
9198 ENABLE_GTK3=""
9199 if test "x$enable_gtk3" = "xyes"; then
9200     if test "$with_system_cairo" != yes; then
9201         AC_MSG_WARN([System cairo required for gtk3 support, please use --with-system-cairo])
9202         add_warning "System cairo required for gtk3 support, please use --with-system-cairo"
9203     fi
9204     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="")
9205     if test "x$ENABLE_GTK3" = "xTRUE"; then
9206         R="gtk3"
9207     else
9208         AC_MSG_ERROR([gtk3 libraries of the correct versions, not found])
9209     fi
9211 AC_SUBST(GTK3_LIBS)
9212 AC_SUBST(GTK3_CFLAGS)
9213 AC_SUBST(ENABLE_GTK3)
9215 AC_MSG_CHECKING([which VCLplugs shall be built])
9216 if test "$GUIBASE" != "unx" -o "$enable_headless" = "yes"; then
9217     enable_gtk=no
9219 ENABLE_GTK=""
9220 if test "x$enable_gtk" = "xyes"; then
9221     ENABLE_GTK="TRUE"
9222     AC_DEFINE(ENABLE_GTK)
9223     R="gtk $R"
9225 AC_SUBST(ENABLE_GTK)
9227 ENABLE_TDE=""
9228 if test "x$enable_tde" = "xyes"; then
9229     # Libs kab and tdeab in connectivity and kdeab and tdeab in shell
9230     # are built from the same sources. So we only allow one of them.
9231     if test "x$enable_kde" = "xyes"; then
9232         AC_MSG_ERROR([enabling both KDE and TDE is not supported])
9233     fi
9234     ENABLE_TDE="TRUE"
9235     AC_DEFINE(ENABLE_TDE)
9236     R="$R tde"
9238 AC_SUBST(ENABLE_TDE)
9240 ENABLE_KDE=""
9241 if test "x$enable_kde" = "xyes"; then
9242     ENABLE_KDE="TRUE"
9243     AC_DEFINE(ENABLE_KDE)
9244     R="$R kde"
9246 AC_SUBST(ENABLE_KDE)
9248 ENABLE_KDE4=""
9249 if test "x$enable_kde4" = "xyes"; then
9250     ENABLE_KDE4="TRUE"
9251     AC_DEFINE(ENABLE_KDE4)
9252     R="$R kde4"
9254 AC_SUBST(ENABLE_KDE4)
9256 ENABLE_HEADLESS=""
9257 if test "x$enable_headless" = "xyes"; then
9258     ENABLE_HEADLESS="TRUE"
9259     SCPDEFS="$SCPDEFS -DLIBO_HEADLESS"
9260     R="headless"
9262 AC_SUBST(ENABLE_HEADLESS)
9264 if test -z "$R"; then
9265     AC_MSG_RESULT([none])
9266 else
9267     AC_MSG_RESULT([$R])
9270 dnl ===================================================================
9271 dnl GCONF check
9272 dnl ===================================================================
9274 ENABLE_GCONF=""
9275 AC_MSG_CHECKING([whether to enable GConf support])
9276 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "iOS" -a "$enable_gconf" = "yes"; then
9277     ENABLE_GCONF="TRUE"
9278     AC_MSG_RESULT([yes])
9279     PKG_CHECK_MODULES( GCONF, gconf-2.0 gobject-2.0 )
9280 else
9281     AC_MSG_RESULT([no])
9283 AC_SUBST(GCONF_LIBS)
9284 AC_SUBST(GCONF_CFLAGS)
9285 AC_SUBST(ENABLE_GCONF)
9287 dnl ===================================================================
9288 dnl Gnome VFS check
9289 dnl ===================================================================
9291 ENABLE_GNOMEVFS=""
9292 AC_MSG_CHECKING([whether to enable GNOME VFS support])
9293 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes" -a "$enable_gconf" = "yes"; then
9294     ENABLE_GNOMEVFS="TRUE"
9295     AC_MSG_RESULT([yes])
9296     PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
9297     AC_DEFINE(ENABLE_GNOME_VFS)
9298 else
9299     AC_MSG_RESULT([no])
9301 AC_SUBST(GNOMEVFS_LIBS)
9302 AC_SUBST(GNOMEVFS_CFLAGS)
9303 AC_SUBST(ENABLE_GNOMEVFS)
9305 dnl ===================================================================
9306 dnl check for dbus support
9307 dnl ===================================================================
9308 ENABLE_DBUS=""
9309 DBUS_CFLAGS=""
9310 DBUS_LIBS=""
9312 if test "$enable_dbus" = "no"; then
9313     test_dbus=no
9316 AC_MSG_CHECKING([whether to enable DBUS support])
9317 if test "$test_dbus" = "yes"; then
9318     ENABLE_DBUS="TRUE"
9319     AC_MSG_RESULT([yes])
9320     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
9321 else
9322     AC_MSG_RESULT([no])
9325 AC_SUBST(ENABLE_DBUS)
9326 AC_SUBST(DBUS_CFLAGS)
9327 AC_SUBST(DBUS_LIBS)
9329 AC_MSG_CHECKING([whether to enable font install via packagekit])
9330 if test "$ENABLE_DBUS" = "TRUE"; then
9331     if test -n "$enable_packagekit" -a "$enable_packagekit" != "no"; then
9332         ENABLE_PACKAGEKIT=YES
9333         AC_MSG_RESULT([yes])
9334     else
9335         ENABLE_PACKAGEKIT=NO
9336         AC_MSG_RESULT([no])
9337     fi
9338 else
9339     AC_MSG_RESULT([no, dbus disabled.])
9341 AC_SUBST(ENABLE_PACKAGEKIT)
9343 AC_MSG_CHECKING([whether to enable Impress remote control])
9344 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
9345     AC_MSG_RESULT([yes])
9346     ENABLE_SDREMOTE=YES
9347     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
9349     # If not explicitly enabled or disabled, default
9350     if test -z "$enable_sdremote_bluetooth"; then
9351         case "$OS" in
9352         LINUX|MACOSX|WNT)
9353             # Default to yes for these
9354             enable_sdremote_bluetooth=yes
9355             ;;
9356         *)
9357             # otherwise no
9358             enable_sdremote_bluetooth=no
9359             ;;
9360         esac
9361     fi
9362     # $enable_sdremote_bluetooth is guaranteed non-empty now
9364     if test "$enable_sdremote_bluetooth" != "no"; then
9365         if test "$OS" = "LINUX"; then
9366             if test "$ENABLE_DBUS" = "TRUE"; then
9367                 AC_MSG_RESULT([yes])
9368                 ENABLE_SDREMOTE_BLUETOOTH=YES
9369                 dnl ===================================================================
9370                 dnl Check for system bluez
9371                 dnl ===================================================================
9372                 AC_MSG_CHECKING([which Bluetooth header to use])
9373                 if test "$with_system_bluez" = "yes"; then
9374                     AC_MSG_RESULT([external])
9375                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
9376                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
9377                 else
9378                     AC_MSG_RESULT([internal])
9379                     BUILD_TYPE="$BUILD_TYPE BLUEZ"
9380                 fi
9381             else
9382                 AC_MSG_RESULT([no, dbus disabled])
9383                 ENABLE_SDREMOTE_BLUETOOTH=NO
9384             fi
9385         else
9386             AC_MSG_RESULT([yes])
9387             ENABLE_SDREMOTE_BLUETOOTH=YES
9388         fi
9389     else
9390         AC_MSG_RESULT([no])
9391         ENABLE_SDREMOTE_BLUETOOTH=NO
9392     fi
9393 else
9394     ENABLE_SDREMOTE=NO
9395     AC_MSG_RESULT([no])
9397 AC_SUBST(ENABLE_SDREMOTE)
9398 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
9400 dnl ===================================================================
9401 dnl Check whether the gtk 2.0 libraries are available.
9402 dnl ===================================================================
9404 GTK_CFLAGS=""
9405 GTK_LIBS=""
9406 ENABLE_SYSTRAY_GTK=""
9407 if test  "$test_gtk" = "yes"; then
9409     if test "$ENABLE_GTK" = "TRUE"; then
9410         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]))
9411         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]))
9412         BUILD_TYPE="$BUILD_TYPE GTK"
9414     AC_MSG_CHECKING([whether to enable the systray quickstarter])
9415         if test "x$enable_systray" = "xyes"; then
9416         AC_MSG_RESULT([yes])
9417             PKG_CHECK_MODULES( GTK210, gtk+-2.0 >= 2.10.0,
9418                             [ ENABLE_SYSTRAY_GTK="TRUE" ],
9419                             [ ENABLE_SYSTRAY_GTK="" ])
9420         else
9421         AC_MSG_RESULT([no])
9422         fi
9424         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
9425         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
9426                           [ENABLE_GTK_PRINT="TRUE"],
9427                           [ENABLE_GTK_PRINT=""])
9429         AC_MSG_CHECKING([whether to enable GIO support])
9430         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
9431             if test "$ENABLE_GNOMEVFS" = "TRUE"; then
9432                 AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
9433             fi
9434             dnl Need at least 2.26 for the dbus support.
9435             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
9436                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
9437             if test "$ENABLE_GIO" = "TRUE"; then
9438                 AC_DEFINE(ENABLE_GIO)
9439             fi
9440         else
9441             AC_MSG_RESULT([no])
9442         fi
9443     fi
9445 AC_SUBST(ENABLE_GIO)
9446 AC_SUBST(GIO_CFLAGS)
9447 AC_SUBST(GIO_LIBS)
9448 AC_SUBST(ENABLE_SYSTRAY_GTK)
9449 AC_SUBST(GTK_CFLAGS)
9450 AC_SUBST(GTK_LIBS)
9451 AC_SUBST(GTHREAD_CFLAGS)
9452 AC_SUBST(GTHREAD_LIBS)
9453 AC_SUBST([ENABLE_GTK_PRINT])
9454 AC_SUBST([GTK_PRINT_CFLAGS])
9455 AC_SUBST([GTK_PRINT_LIBS])
9458 dnl ===================================================================
9459 dnl Check whether the Telepathy libraries are available.
9460 dnl ===================================================================
9462 ENABLE_TELEPATHY=""
9463 TELEPATHY_CFLAGS=""
9464 TELEPATHY_LIBS=""
9466 AC_MSG_CHECKING([whether to enable Telepathy support])
9467 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_telepathy" = "yes"; then
9468     ENABLE_TELEPATHY="TRUE"
9469     AC_DEFINE(ENABLE_TELEPATHY)
9470     AC_MSG_RESULT([yes])
9471     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 )
9472 else
9473     AC_MSG_RESULT([no])
9476 AC_SUBST(ENABLE_TELEPATHY)
9477 AC_SUBST(TELEPATHY_CFLAGS)
9478 AC_SUBST(TELEPATHY_LIBS)
9481 dnl ===================================================================
9483 SPLIT_APP_MODULES=""
9484 if test "$enable_split_app_modules" = "yes"; then
9485     SPLIT_APP_MODULES="YES"
9487 AC_SUBST(SPLIT_APP_MODULES)
9489 SPLIT_OPT_FEATURES=""
9490 if test "$enable_split_opt_features" = "yes"; then
9491     SPLIT_OPT_FEATURES="YES"
9493 AC_SUBST(SPLIT_OPT_FEATURES)
9495 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
9496     if test "$enable_cairo_canvas" = yes; then
9497         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
9498     fi
9499     enable_cairo_canvas=no
9500 elif test -z "$enable_cairo_canvas"; then
9501     enable_cairo_canvas=yes
9504 ENABLE_CAIRO_CANVAS=""
9505 if test "$enable_cairo_canvas" = "yes"; then
9506     test_cairo=yes
9507     ENABLE_CAIRO_CANVAS="TRUE"
9509 AC_SUBST(ENABLE_CAIRO_CANVAS)
9511 dnl ===================================================================
9512 dnl Check whether the GStreamer libraries are available.
9513 dnl ===================================================================
9515 ENABLE_GSTREAMER=""
9517 if test "$build_gstreamer" = "yes"; then
9519     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
9520     if test "x$enable_gstreamer" != "xno"; then
9521         ENABLE_GSTREAMER="TRUE"
9522         AC_MSG_RESULT([yes])
9523         PKG_CHECK_MODULES( GSTREAMER, gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-video-1.0 )
9524         GSTREAMER_CFLAGS="`echo $GSTREAMER_CFLAGS | sed -e \"s/-I/${ISYSTEM}/g\"`"
9525     else
9526         AC_MSG_RESULT([no])
9527     fi
9529 AC_SUBST(GSTREAMER_CFLAGS)
9530 AC_SUBST(GSTREAMER_LIBS)
9531 AC_SUBST(ENABLE_GSTREAMER)
9534 ENABLE_GSTREAMER_0_10=""
9535 if test "$build_gstreamer_0_10" = "yes"; then
9537     AC_MSG_CHECKING([whether to enable the GStreamer avmedia backend])
9538     if test "x$enable_gstreamer_0_10" != "xno"; then
9539         ENABLE_GSTREAMER_0_10="TRUE"
9540         AC_MSG_RESULT([yes])
9541         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-interfaces-0.10],, [
9542             PKG_CHECK_MODULES(  [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10] )
9543         ])
9544         GSTREAMER_0_10_CFLAGS="`echo $GSTREAMER_0_10_CFLAGS | sed -e \"s/-I/${ISYSTEM}/g\"`"
9545     else
9546         AC_MSG_RESULT([no])
9547     fi
9550 AC_SUBST(GSTREAMER_0_10_CFLAGS)
9551 AC_SUBST(GSTREAMER_0_10_LIBS)
9552 AC_SUBST(ENABLE_GSTREAMER_0_10)
9554 dnl ===================================================================
9555 dnl Check whether the OpenGL libraries are available
9556 dnl ===================================================================
9558 AC_MSG_CHECKING([whether to build the OpenGL Transitions component])
9559 ENABLE_OPENGL=
9561 if test -z "$enable_opengl"; then
9562     if test $_os = WINNT; then
9563         # By default disable the OpenGL transitions for Windows (the code compiles but works very
9564         # badly and crashes). In other words, use --enable-opengl only if you plan to hack on that
9565         # code for Windows.
9566         enable_opengl=no
9567     elif test $_os = iOS; then
9568         # As such with some suitable minor tweaks the Mac OpenGL transitions code would presumably
9569         # build fine for iOS, too, but let's leave that for later
9570         enable_opengl=no
9571     elif test "$enable_headless" = "yes"; then
9572         enable_opengl=no
9573     else
9574         enable_opengl=yes
9575     fi
9578 if test "x$enable_opengl" = "xno"; then
9579     AC_MSG_RESULT([no])
9580 elif test "$_os" = "Darwin"; then
9581     # We use frameworks on Mac OS X, no need for detail checks
9582     ENABLE_OPENGL=TRUE
9583     SYSTEM_MESA_HEADERS=YES
9584     AC_MSG_RESULT([yes])
9585 elif test $_os = WINNT; then
9586     # Experimental: try to use OpenGL on Windows
9587     ENABLE_OPENGL=TRUE
9588     # We need the internal "Mesa" headers.
9589     SYSTEM_MESA_HEADERS=NO
9590     BUILD_TYPE="$BUILD_TYPE MESA"
9591     AC_MSG_RESULT([yes])
9592 else
9593     save_LDFLAGS=$LDFLAGS
9594     LDFLAGS="$LDFLAGS -lm"
9595     AC_MSG_RESULT([yes])
9596     AC_CHECK_LIB([GL], [main], [:],
9597               [AC_MSG_ERROR(libGL not installed or functional)], [])
9598     LDFLAGS="$LDFLAGS -lGL"
9599     AC_CHECK_LIB([GLU], [main], [:],
9600               [AC_MSG_ERROR(libGLU not installed or functional)], [])
9601     ENABLE_OPENGL=TRUE
9602     LDFLAGS=$save_LDFLAGS
9604     dnl ===================================================================
9605     dnl Check for system Mesa
9606     dnl ===================================================================
9607     AC_MSG_CHECKING([which Mesa headers to use])
9608     if test "$with_system_mesa_headers" = "yes"; then
9609         AC_MSG_RESULT([external])
9610         SYSTEM_MESA_HEADERS=YES
9611         AC_LANG_PUSH(C)
9612         AC_CHECK_HEADER(GL/glxext.h, [],
9613            [ AC_MSG_ERROR(mesa headers not found.)], [#include <GL/glx.h>])
9614         AC_MSG_CHECKING([whether GL/glxext.h defines PFNGLXBINDTEXIMAGEEXTPROC])
9615         AC_EGREP_HEADER(PFNGLXBINDTEXIMAGEEXTPROC, GL/glxext.h, [AC_MSG_RESULT([yes])], AC_MSG_ERROR(no))
9616         AC_LANG_POP(C)
9617     else
9618         AC_MSG_RESULT([internal])
9619         SYSTEM_MESA_HEADERS=NO
9620         BUILD_TYPE="$BUILD_TYPE MESA"
9621     fi
9624 AC_SUBST(SYSTEM_MESA_HEADERS)
9625 AC_SUBST(ENABLE_OPENGL)
9627 # presenter minimizer extension?
9628 AC_MSG_CHECKING([whether to build the Presentation Minimizer extension])
9629 if test "x$enable_ext_presenter_minimizer" != "xno" -a "x$enable_extension_integration" != "xno"; then
9630    AC_MSG_RESULT([yes])
9631    ENABLE_MINIMIZER=YES
9632 else
9633    AC_MSG_RESULT([no])
9634    ENABLE_MINIMIZER=NO
9635    SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MINIMIZER"
9637 AC_SUBST(ENABLE_MINIMIZER)
9639 # pdf import?
9640 AC_MSG_CHECKING([whether to build the PDF import])
9641 if test "$_os" != Android -a "$_os" != iOS -a "$ENABLE_PDFIMPORT" != FALSE; then
9642   AC_MSG_RESULT([yes])
9643   ENABLE_PDFIMPORT=TRUE
9645   dnl ===================================================================
9646   dnl Check for system poppler
9647   dnl ===================================================================
9648   AC_MSG_CHECKING([which pdf backend to use])
9649   if test "$with_system_poppler" = "yes"; then
9650       AC_MSG_RESULT([external])
9651       SYSTEM_POPPLER=YES
9652       PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
9653       AC_LANG_PUSH([C++])
9654       save_CXXFLAGS=$CXXFLAGS
9655       save_CPPFLAGS=$CPPFLAGS
9656       CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
9657       CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
9658       AC_CHECK_HEADER([cpp/poppler-version.h], [],
9659                    [AC_MSG_ERROR([cpp/poppler-version.h not found. Install poppler])], [])
9660       CXXFLAGS=$save_CXXFLAGS
9661       CPPFLAGS=$save_CPPFLAGS
9662       AC_LANG_POP([C++])
9663       libo_MINGW_CHECK_DLL([libpoppler])
9664   else
9665       AC_MSG_RESULT([internal])
9666       SYSTEM_POPPLER=NO
9667       BUILD_TYPE="$BUILD_TYPE XPDF"
9668   fi
9669 else
9670   AC_MSG_RESULT([no])
9671   ENABLE_PDFIMPORT=FALSE
9673 AC_SUBST(ENABLE_PDFIMPORT)
9674 AC_SUBST(SYSTEM_POPPLER)
9675 AC_SUBST(POPPLER_CFLAGS)
9676 AC_SUBST(POPPLER_LIBS)
9678 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
9679 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
9680   AC_MSG_RESULT([yes])
9681   ENABLE_MEDIAWIKI=YES
9682   BUILD_TYPE="$BUILD_TYPE XSLTML"
9683   if test  "x$with_java" = "xno"; then
9684     AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
9685   fi
9686 else
9687   AC_MSG_RESULT([no])
9688   ENABLE_MEDIAWIKI=NO
9689   SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
9691 AC_SUBST(ENABLE_MEDIAWIKI)
9693 if test "$ENABLE_MEDIAWIKI" = "YES"; then
9694     AC_MSG_CHECKING([which Servlet API Jar to use])
9695     if test "$with_system_servlet_api" = "yes"; then
9696         AC_MSG_RESULT([external])
9697         SYSTEM_SERVLETAPI=YES
9698         if test -z "$SERVLETAPI_JAR"; then
9699             for version in '' -3.3 -3.2 -3.1 -3.0 -2.5 -2.4; do
9700                 if test -r "/usr/share/java/servlet-api${version}.jar"; then
9701                     SERVLETAPI_JAR=/usr/share/java/servlet-api${version}.jar
9702                 fi
9703             done
9704         fi
9705         AC_CHECK_FILE($SERVLETAPI_JAR, [],
9706               [AC_MSG_ERROR(servlet-api.jar not found.)], [])
9707     else
9708         AC_MSG_RESULT([internal])
9709         SYSTEM_SERVLETAPI=NO
9710         BUILD_TYPE="$BUILD_TYPE TOMCAT"
9711     fi
9713 AC_SUBST(SYSTEM_SERVLETAPI)
9714 AC_SUBST(SERVLETAPI_JAR)
9716 AC_MSG_CHECKING([whether to build the Report Builder extension])
9717 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
9718     AC_MSG_RESULT([yes])
9719     ENABLE_REPORTBUILDER=TRUE
9720     AC_MSG_CHECKING([which jfreereport libs to use])
9721     if test "$with_system_jfreereport" = "yes"; then
9722         SYSTEM_JFREEREPORT=YES
9723         AC_MSG_RESULT([external])
9724         if test -z $SAC_JAR; then
9725             SAC_JAR=/usr/share/java/sac.jar
9726         fi
9727         AC_CHECK_FILE($SAC_JAR, [],
9728              [AC_MSG_ERROR(sac.jar not found.)], [])
9730         if test -z $LIBXML_JAR; then
9731             AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
9732                 [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
9733                 [
9734                     AC_CHECK_FILE(/usr/share/java/libxml.jar,
9735                        [ LIBXML_JAR=/usr/share/java/libxml.jar ],
9736                        [AC_MSG_ERROR(libxml.jar replacement not found.)]
9737                     )
9738                 ]
9739             )
9740         else
9741             AC_CHECK_FILE($LIBXML_JAR, [],
9742                  [AC_MSG_ERROR(libxml.jar not found.)], [])
9743         fi
9745         if test -z $FLUTE_JAR; then
9746             AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
9747                 [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
9748                 [
9749                     AC_CHECK_FILE(/usr/share/java/flute.jar,
9750                         [ FLUTE_JAR=/usr/share/java/flute.jar ],
9751                         [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
9752                     )
9753                 ]
9754             )
9755         else
9756             AC_CHECK_FILE($FLUTE_JAR, [],
9757                  [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
9758         fi
9760         if test -z $JFREEREPORT_JAR; then
9761             AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
9762                 [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
9763                 [
9764                     AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
9765                         [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
9766                         [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
9767                     )
9768                 ]
9769             )
9770         else
9771             AC_CHECK_FILE($JFREEREPORT_JAR, [],
9772                  [AC_MSG_ERROR(jfreereport.jar not found.)], [])
9773         fi
9775         if test -z $LIBLAYOUT_JAR; then
9776             AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
9777                 [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
9778                 [
9779                     AC_CHECK_FILE(/usr/share/java/liblayout.jar,
9780                         [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
9781                         [AC_MSG_ERROR(liblayout.jar replacement not found.)]
9782                     )
9783                 ]
9784             )
9785         else
9786             AC_CHECK_FILE($LIBLAYOUT_JAR, [],
9787                  [AC_MSG_ERROR(liblayout.jar not found.)], [])
9788         fi
9790         if test -z $LIBLOADER_JAR; then
9791             AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
9792                 [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
9793                 [
9794                     AC_CHECK_FILE(/usr/share/java/libloader.jar,
9795                        [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
9796                        [AC_MSG_ERROR(libloader.jar replacement not found.)]
9797                     )
9798                 ]
9799             )
9800         else
9801             AC_CHECK_FILE($LIBLOADER_JAR, [],
9802                 [AC_MSG_ERROR(libloader.jar not found.)], [])
9803         fi
9805         if test -z $LIBFORMULA_JAR; then
9806             AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
9807                  [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
9808                  [
9809                      AC_CHECK_FILE(/usr/share/java/libformula.jar,
9810                          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
9811                          [AC_MSG_ERROR(libformula.jar replacement not found.)]
9812                      )
9813                  ]
9814             )
9815         else
9816             AC_CHECK_FILE($LIBFORMULA_JAR, [],
9817                 [AC_MSG_ERROR(libformula.jar not found.)], [])
9818         fi
9820         if test -z $LIBREPOSITORY_JAR; then
9821             AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
9822                 [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
9823                 [
9824                     AC_CHECK_FILE(/usr/share/java/librepository.jar,
9825                         [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
9826                         [AC_MSG_ERROR(librepository.jar replacement not found.)]
9827                     )
9828                 ]
9829             )
9830         else
9831             AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
9832                 [AC_MSG_ERROR(librepository.jar not found.)], [])
9833         fi
9835         if test -z $LIBFONTS_JAR; then
9836             AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
9837                 [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
9838                 [
9839                     AC_CHECK_FILE(/usr/share/java/libfonts.jar,
9840                         [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
9841                         [AC_MSG_ERROR(libfonts.jar replacement not found.)]
9842                     )
9843                 ]
9844             )
9845         else
9846             AC_CHECK_FILE($LIBFONTS_JAR, [],
9847                 [AC_MSG_ERROR(libfonts.jar not found.)], [])
9848         fi
9850         if test -z $LIBSERIALIZER_JAR; then
9851             AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
9852                 [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
9853                 [
9854                     AC_CHECK_FILE(/usr/share/java/libserializer.jar,
9855                         [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
9856                         [AC_MSG_ERROR(libserializer.jar replacement not found.)]
9857                     )
9858                 ]
9859             )
9860         else
9861             AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
9862                 [AC_MSG_ERROR(libserializer.jar not found.)], [])
9863         fi
9865         if test -z $LIBBASE_JAR; then
9866             AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
9867                 [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
9868                 [
9869                     AC_CHECK_FILE(/usr/share/java/libbase.jar,
9870                         [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
9871                         [AC_MSG_ERROR(libbase.jar replacement not found.)]
9872                     )
9873                 ]
9874             )
9875         else
9876             AC_CHECK_FILE($LIBBASE_JAR, [],
9877                 [AC_MSG_ERROR(libbase.jar not found.)], [])
9878         fi
9880     else
9881         AC_MSG_RESULT([internal])
9882         SYSTEM_JFREEREPORT=NO
9883         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
9884     fi
9885 else
9886     AC_MSG_RESULT([no])
9887     ENABLE_REPORTBUILDER=FALSE
9888     SYSTEM_JFREEREPORT=NO
9890 AC_SUBST(ENABLE_REPORTBUILDER)
9891 AC_SUBST(SYSTEM_JFREEREPORT)
9892 AC_SUBST(SAC_JAR)
9893 AC_SUBST(LIBXML_JAR)
9894 AC_SUBST(FLUTE_JAR)
9895 AC_SUBST(JFREEREPORT_JAR)
9896 AC_SUBST(LIBBASE_JAR)
9897 AC_SUBST(LIBLAYOUT_JAR)
9898 AC_SUBST(LIBLOADER_JAR)
9899 AC_SUBST(LIBFORMULA_JAR)
9900 AC_SUBST(LIBREPOSITORY_JAR)
9901 AC_SUBST(LIBFONTS_JAR)
9902 AC_SUBST(LIBSERIALIZER_JAR)
9904 # this has to be here because both the Wiki Publisher and the SRB use
9905 # commons-logging
9906 if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "TRUE"; then
9907     AC_MSG_CHECKING([which Apache commons-* libs to use])
9908     if test "$with_system_apache_commons" = "yes"; then
9909         SYSTEM_APACHE_COMMONS=YES
9910         AC_MSG_RESULT([external])
9911         if test "$ENABLE_MEDIAWIKI" = "YES"; then
9912             if test -z $COMMONS_CODEC_JAR; then
9913                 AC_CHECK_FILE(/usr/share/java/commons-codec-1.6.jar,
9914                     [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec-1.6.jar ],
9915                     [
9916                         AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
9917                             [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
9918                             [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
9919                         )
9920                     ]
9921                 )
9922             else
9923                 AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
9924                     [AC_MSG_ERROR(commons-codec.jar not found.)], [])
9925             fi
9927             if test -z $COMMONS_LANG_JAR; then
9928                 AC_CHECK_FILE(/usr/share/java/commons-lang-2.4.jar,
9929                     [ COMMONS_LANG_JAR=/usr/share/java/commons-lang-2.4.jar ],
9930                     [
9931                         AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
9932                             [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
9933                             [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
9934                             )
9935                     ]
9936                 )
9937             else
9938                 AC_CHECK_FILE($COMMONS_LANG_JAR, [],
9939                     [AC_MSG_ERROR(commons-lang.jar not found.)], [])
9940             fi
9942             if test -z $COMMONS_HTTPCLIENT_JAR; then
9943                 AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
9944                     [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
9945                     [
9946                         AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
9947                             [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
9948                             [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
9949                         )
9950                     ]
9951                 )
9952             else
9953                 AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
9954                     [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
9955             fi
9956         fi
9957         if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "TRUE"; then
9958             if test -z $COMMONS_LOGGING_JAR; then
9959                 AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.1.jar,
9960                    [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.1.jar ],
9961                    [
9962                         AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
9963                             [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
9964                             [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
9965                         )
9966                     ]
9967                 )
9968             else
9969                 AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
9970                     [AC_MSG_ERROR(commons-logging.jar not found.)], [])
9971             fi
9972         fi
9973     else
9974         AC_MSG_RESULT([internal])
9975         SYSTEM_APACHE_COMMONS=NO
9976         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
9977     fi
9979 AC_SUBST(SYSTEM_APACHE_COMMONS)
9980 AC_SUBST(COMMONS_CODEC_JAR)
9981 AC_SUBST(COMMONS_LANG_JAR)
9982 AC_SUBST(COMMONS_HTTPCLIENT_JAR)
9983 AC_SUBST(COMMONS_LOGGING_JAR)
9985 # scripting provider for BeanShell?
9986 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
9987 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
9988    AC_MSG_RESULT([yes])
9989    ENABLE_SCRIPTING_BEANSHELL=YES
9991    dnl ===================================================================
9992    dnl Check for system beanshell
9993    dnl ===================================================================
9994    AC_MSG_CHECKING([which beanshell to use])
9995    if test "$with_system_beanshell" = "yes"; then
9996        AC_MSG_RESULT([external])
9997        SYSTEM_BSH=YES
9998        if test -z $BSH_JAR; then
9999            BSH_JAR=/usr/share/java/bsh.jar
10000        fi
10001        AC_CHECK_FILE($BSH_JAR, [],
10002                   [AC_MSG_ERROR(bsh.jar not found.)], [])
10003    else
10004        AC_MSG_RESULT([internal])
10005        SYSTEM_BSH=NO
10006        BUILD_TYPE="$BUILD_TYPE BSH"
10007    fi
10008 else
10009    AC_MSG_RESULT([no])
10010    ENABLE_SCRIPTING_BEANSHELL=NO
10011    SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10013 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10014 AC_SUBST(SYSTEM_BSH)
10015 AC_SUBST(BSH_JAR)
10017 # scripting provider for JavaScript?
10018 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10019 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10020    AC_MSG_RESULT([yes])
10021    ENABLE_SCRIPTING_JAVASCRIPT=YES
10023    dnl ===================================================================
10024    dnl Check for system rhino
10025    dnl ===================================================================
10026    AC_MSG_CHECKING([which rhino to use])
10027    if test "$with_system_rhino" = "yes"; then
10028        AC_MSG_RESULT([external])
10029        SYSTEM_RHINO=YES
10030        if test -z $RHINO_JAR; then
10031            RHINO_JAR=/usr/share/java/js.jar
10032        fi
10033        AC_CHECK_FILE($RHINO_JAR, [],
10034                   [AC_MSG_ERROR(js.jar not found.)], [])
10035    else
10036        AC_MSG_RESULT([internal])
10037        SYSTEM_RHINO=NO
10038        BUILD_TYPE="$BUILD_TYPE RHINO"
10039    fi
10040 else
10041    AC_MSG_RESULT([no])
10042    ENABLE_SCRIPTING_JAVASCRIPT=NO
10043    SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10045 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10046 AC_SUBST(SYSTEM_RHINO)
10047 AC_SUBST(RHINO_JAR)
10049 supports_multilib=
10050 case "$host_cpu" in
10051 x86_64 | powerpc64 | s390x)
10052     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10053         supports_multilib="yes"
10054     fi
10055     ;;
10057     ;;
10058 esac
10060 dnl ===================================================================
10061 dnl Check whether the TQt and TDE libraries are available.
10062 dnl ===================================================================
10064 TDE_CFLAGS=""
10065 TDE_LIBS=""
10066 if test "$_os" != "OpenBSD"; then
10067     MOC="moc"
10069 if test "$test_tde" = "yes" -a "$ENABLE_TDE" = "TRUE"; then
10070     dnl Search paths for TQt and TDE
10071     if test -z "$supports_multilib"; then
10072         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"
10073         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"
10074     else
10075         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"
10076         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"
10077     fi
10078     if test -n "$TQTDIR"; then
10079         tqt_incdirs="$TQTDIR/include $tqt_incdirs"
10080         if test -z "$supports_multilib"; then
10081             tqt_libdirs="$TQTDIR/lib $tqt_libdirs"
10082         else
10083             tqt_libdirs="$TQTDIR/lib64 $TQTDIR/lib $tqt_libdirs"
10084         fi
10085     fi
10086     if test -z "$supports_multilib"; then
10087         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"
10088         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"
10089     else
10090         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"
10091         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"
10092     fi
10093     if test -n "$TDEDIR"; then
10094         tde_incdirs="$TDEDIR/include $tde_incdirs"
10095         if test -z "$supports_multilib"; then
10096             tde_libdirs="$TDEDIR/lib $tde_libdirs"
10097         else
10098             tde_libdirs="$TDEDIR/lib64 $TDEDIR/lib $tde_libdirs"
10099         fi
10100     fi
10102     dnl What to test
10103     tqt_test_include="ntqstyle.h"
10104     tde_test_include="kapp.h"
10106     if test "$_os" != "OpenBSD"; then
10107         tqt_test_library="libtqt-mt.so"
10108         tde_test_library="libDCOP.so"
10109     else
10110         tqt_test_library="libtqt-mt.so*"
10111         tde_test_library="libDCOP.so*"
10112     fi
10114     dnl Check for TQt headers
10115     AC_MSG_CHECKING([for TQt headers])
10116     tqt_incdir="no"
10117     for tde_check in $tqt_incdirs; do
10118         if test -r "$tde_check/$tqt_test_include"; then
10119             tqt_incdir="$tde_check"
10120             break
10121         fi
10122     done
10123     AC_MSG_RESULT([$tqt_incdir])
10124     if test "x$tqt_incdir" = "xno"; then
10125         AC_MSG_ERROR([TQt headers not found.  Please specify the root of
10126 your TQt installation by exporting TQTDIR before running "configure".])
10127     fi
10129     dnl Check for TQt libraries
10130     AC_MSG_CHECKING([for TQt libraries])
10131     tqt_libdir="no"
10132     for tqt_check in $tqt_libdirs; do
10133         if test -r "`ls $tqt_check/$tqt_test_library 2>/dev/null | head -1`"; then
10134             tqt_libdir="$tqt_check"
10135             break
10136         fi
10137     done
10138     AC_MSG_RESULT([$tqt_libdir])
10139     if test "x$tqt_libdir" = "xno"; then
10140         AC_MSG_ERROR([TQt libraries not found.  Please specify the root of
10141 your TQt installation by exporting TQTDIR before running "configure".])
10142     fi
10144     dnl Check for Meta Object Compiler
10145     AC_PATH_PROG( MOC, moc, no, [`dirname $tqt_libdir`/bin:$TQTDIR/bin:$PATH] )
10146     if test "$MOC" = "no"; then
10147         AC_MSG_ERROR([TQt Meta Object Compiler not found.  Please specify
10148 the root of your TQt installation by exporting TQTDIR before running "configure".])
10149     fi
10151     dnl Check for TDE headers
10152     AC_MSG_CHECKING([for TDE headers])
10153     tde_incdir="no"
10154     for tde_check in $tde_incdirs; do
10155         if test -r "$tde_check/$tde_test_include"; then
10156             tde_incdir="$tde_check"
10157             break
10158         fi
10159     done
10160     AC_MSG_RESULT([$tde_incdir])
10161     if test "x$tde_incdir" = "xno"; then
10162         AC_MSG_ERROR([TDE headers not found.  Please specify the root of
10163 your TDE installation by exporting TDEDIR before running "configure".])
10164     fi
10166     dnl Check for TDE libraries
10167     AC_MSG_CHECKING([for TDE libraries])
10168     tde_libdir="no"
10169     for tde_check in $tde_libdirs; do
10170         if test -r "`ls $tde_check/$tde_test_library 2>/dev/null | head -1`"; then
10171             tde_libdir="$tde_check"
10172             break
10173         fi
10174     done
10175     AC_MSG_RESULT([$tde_libdir])
10176     if test "x$tde_libdir" = "xno"; then
10177         AC_MSG_ERROR([TDE libraries not found.  Please specify the root of
10178 your TDE installation by exporting TDEDIR before running "configure".])
10179     fi
10181     dnl Set the variables
10182     TDE_CFLAGS="-I$tqt_incdir -I$tde_incdir -I/usr/include/tqt -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10183     TDE_LIBS="-L$tde_libdir -L$tqt_libdir -ltdeio -ltdeui -ltdecore -ltqt -ltqt-mt"
10185 AC_SUBST(TDE_CFLAGS)
10186 AC_SUBST(TDE_LIBS)
10187 AC_SUBST(MOC)
10189 dnl ===================================================================
10190 dnl Check whether the Qt3 and KDE3 libraries are available.
10191 dnl ===================================================================
10193 KDE_CFLAGS=""
10194 KDE_LIBS=""
10195 if test "$_os" != "OpenBSD"; then
10196     MOC="moc"
10198 if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE"; then
10199     dnl Search paths for Qt3 and KDE3
10200     if test -z "$supports_multilib"; then
10201         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"
10202         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"
10203     else
10204         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"
10205         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"
10206     fi
10207     if test -n "$QTDIR"; then
10208         qt_incdirs="$QTDIR/include $qt_incdirs"
10209         if test -z "$supports_multilib"; then
10210             qt_libdirs="$QTDIR/lib $qt_libdirs"
10211         else
10212             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
10213         fi
10214     fi
10215     if test -z "$supports_multilib"; then
10216         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"
10217         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"
10218     else
10219         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"
10220         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"
10221     fi
10222     if test -n "$KDEDIR"; then
10223         kde_incdirs="$KDEDIR/include $kde_incdirs"
10224         if test -z "$supports_multilib"; then
10225             kde_libdirs="$KDEDIR/lib $kde_libdirs"
10226         else
10227             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
10228         fi
10229     fi
10231     dnl What to test
10232     qt_test_include="qstyle.h"
10233     kde_test_include="kapp.h"
10235     if test "$_os" != "OpenBSD"; then
10236         qt_test_library="libqt-mt.so"
10237         kde_test_library="libDCOP.so"
10238     else
10239         qt_test_library="libqt-mt.so*"
10240         kde_test_library="libDCOP.so*"
10241     fi
10243     dnl Check for Qt3 headers
10244     AC_MSG_CHECKING([for Qt3 headers])
10245     qt_incdir="no"
10246     for kde_check in $qt_incdirs; do
10247         if test -r "$kde_check/$qt_test_include"; then
10248             qt_incdir="$kde_check"
10249             break
10250         fi
10251     done
10252     AC_MSG_RESULT([$qt_incdir])
10253     if test "x$qt_incdir" = "xno"; then
10254         AC_MSG_ERROR([Qt3 headers not found.  Please specify the root of
10255 your Qt3 installation by exporting QTDIR before running "configure".])
10256     fi
10258     dnl Check for Qt3 libraries
10259     AC_MSG_CHECKING([for Qt3 libraries])
10260     qt_libdir="no"
10261     for qt_check in $qt_libdirs; do
10262         if test -r "`ls $qt_check/$qt_test_library 2>/dev/null | head -1`"; then
10263             qt_libdir="$qt_check"
10264             break
10265         fi
10266     done
10267     AC_MSG_RESULT([$qt_libdir])
10268     if test "x$qt_libdir" = "xno"; then
10269         AC_MSG_ERROR([Qt3 libraries not found.  Please specify the root of
10270 your Qt3 installation by exporting QTDIR before running "configure".])
10271     fi
10273     dnl Check for Meta Object Compiler
10274     AC_PATH_PROG( MOC, moc, no, [`dirname $qt_libdir`/bin:$QTDIR/bin:$PATH] )
10275     if test "$MOC" = "no"; then
10276         AC_MSG_ERROR([Qt3 Meta Object Compiler not found.  Please specify
10277 the root of your Qt3 installation by exporting QTDIR before running "configure".])
10278     fi
10280     dnl Check for KDE3 headers
10281     AC_MSG_CHECKING([for KDE3 headers])
10282     kde_incdir="no"
10283     for kde_check in $kde_incdirs; do
10284         if test -r "$kde_check/$kde_test_include"; then
10285             kde_incdir="$kde_check"
10286             break
10287         fi
10288     done
10289     AC_MSG_RESULT([$kde_incdir])
10290     if test "x$kde_incdir" = "xno"; then
10291         AC_MSG_ERROR([KDE3 headers not found.  Please specify the root of
10292 your KDE3 installation by exporting KDEDIR before running "configure".])
10293     fi
10295     dnl Check for KDE3 libraries
10296     AC_MSG_CHECKING([for KDE3 libraries])
10297     kde_libdir="no"
10298     for kde_check in $kde_libdirs; do
10299         if test -r "`ls $kde_check/$kde_test_library 2>/dev/null | head -1`"; then
10300             kde_libdir="$kde_check"
10301             break
10302         fi
10303     done
10304     AC_MSG_RESULT([$kde_libdir])
10305     if test "x$kde_libdir" = "xno"; then
10306         AC_MSG_ERROR([KDE3 libraries not found.  Please specify the root of
10307 your KDE3 installation by exporting KDEDIR before running "configure".])
10308     fi
10310     dnl Set the variables
10311     KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10312     KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
10314 AC_SUBST(KDE_CFLAGS)
10315 AC_SUBST(KDE_LIBS)
10316 AC_SUBST(MOC)
10318 dnl ===================================================================
10319 dnl KDE4 Integration
10320 dnl ===================================================================
10322 KDE4_CFLAGS=""
10323 KDE4_LIBS=""
10324 QMAKE4="qmake"
10325 MOC4="moc"
10326 KDE_GLIB_CFLAGS=""
10327 KDE_GLIB_LIBS=""
10328 KDE_HAVE_GLIB=""
10329 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
10330     qt_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
10331     qt_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
10333     kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
10334     kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
10336     if test -n "$supports_multilib"; then
10337         qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
10338         kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
10339     fi
10341     if test -n "$QTDIR"; then
10342         qt_incdirs="$QTDIR/include $qt_incdirs"
10343         if test -z "$supports_multilib"; then
10344             qt_libdirs="$QTDIR/lib $qt_libdirs"
10345         else
10346             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
10347         fi
10348     fi
10349     if test -n "$QT4DIR"; then
10350         qt_incdirs="$QT4DIR/include $qt_incdirs"
10351         if test -z "$supports_multilib"; then
10352             qt_libdirs="$QT4DIR/lib $qt_libdirs"
10353         else
10354             qt_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt_libdirs"
10355         fi
10356     fi
10358     if test -n "$KDEDIR"; then
10359         kde_incdirs="$KDEDIR/include $kde_incdirs"
10360         if test -z "$supports_multilib"; then
10361             kde_libdirs="$KDEDIR/lib $kde_libdirs"
10362         else
10363             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
10364         fi
10365     fi
10366     if test -n "$KDE4DIR"; then
10367         kde_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde_incdirs"
10368         if test -z "$supports_multilib"; then
10369             kde_libdirs="$KDE4DIR/lib $kde_libdirs"
10370         else
10371             kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
10372         fi
10373     fi
10375     qt_test_include="Qt/qobject.h"
10376     qt_test_library="libQtCore.so"
10377     kde_test_include="kwindowsystem.h"
10378     kde_test_library="libsolid.so"
10380     AC_MSG_CHECKING([for Qt4 headers])
10381     qt_header_dir="no"
10382     for inc_dir in $qt_incdirs; do
10383         if test -r "$inc_dir/$qt_test_include"; then
10384             qt_header_dir="$inc_dir"
10385             break
10386         fi
10387     done
10389     AC_MSG_RESULT([$qt_header_dir])
10390     if test "x$qt_header_dir" = "xno"; then
10391         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10392     fi
10394     dnl Check for qmake
10395     AC_PATH_PROG( QMAKEQT4, qmake-qt4, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
10396     QMAKE4="$QMAKEQT4"
10397     if test "$QMAKE4" = "no"; then
10398         AC_PATH_PROG( QMAKE4, qmake, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
10399         if test "$QMAKE4" = "no"; then
10400             AC_MSG_ERROR([Qmake not found.  Please specify
10401 the root of your Qt installation by exporting QT4DIR before running "configure".])
10402         fi
10403     fi
10405     qt_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt_libdirs"
10406     AC_MSG_CHECKING([for Qt4 libraries])
10407     qt_lib_dir="no"
10408     for lib_dir in $qt_libdirs; do
10409         if test -r "$lib_dir/$qt_test_library"; then
10410             qt_lib_dir="$lib_dir"
10411             PKG_CONFIG_PATH="$qt_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
10412             break
10413         fi
10414     done
10416     AC_MSG_RESULT([$qt_lib_dir])
10418     if test "x$qt_lib_dir" = "xno"; then
10419         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10420     fi
10422     dnl Check for Meta Object Compiler
10424     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10425     MOC4="$MOCQT4"
10426     if test "$MOC4" = "no"; then
10427         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10428         if test "$MOC4" = "no"; then
10429             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10430 the root of your Qt installation by exporting QT4DIR before running "configure".])
10431         fi
10432     fi
10434     dnl Check for KDE4 headers
10435     AC_MSG_CHECKING([for KDE4 headers])
10436     kde_incdir="no"
10437     for kde_check in $kde_incdirs; do
10438         if test -r "$kde_check/$kde_test_include"; then
10439             kde_incdir="$kde_check"
10440             break
10441         fi
10442     done
10443     AC_MSG_RESULT([$kde_incdir])
10444     if test "x$kde_incdir" = "xno"; then
10445         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10446     fi
10448     dnl Check for KDE4 libraries
10449     AC_MSG_CHECKING([for KDE4 libraries])
10450     kde_libdir="no"
10451     for kde_check in $kde_libdirs; do
10452         if test -r "$kde_check/$kde_test_library"; then
10453             kde_libdir="$kde_check"
10454             break
10455         fi
10456     done
10458     AC_MSG_RESULT([$kde_libdir])
10459     if test "x$kde_libdir" = "xno"; then
10460         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10461     fi
10463     KDE4_CFLAGS="`pkg-config --cflags QtCore` `pkg-config --cflags QtGui` -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10464     KDE4_LIBS="-L$kde_libdir -L$qt_lib_dir -lkio -lkfile -lkdeui -lkdecore -lQtCore -lQtGui"
10466     AC_LANG_PUSH([C++])
10467     save_CXXFLAGS=$CXXFLAGS
10468     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10469     AC_MSG_CHECKING([whether KDE is >= 4.2])
10470        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10471 #include <kdeversion.h>
10473 int main(int argc, char **argv) {
10474        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
10475        else return 1;
10477        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
10478     CXXFLAGS=$save_CXXFLAGS
10479     AC_LANG_POP([C++])
10481     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
10482     # Sets also KDE_GLIB_CFLAGS/KDE_GLIB_LIBS if successful.
10483     PKG_CHECK_MODULES(KDE_GLIB,[glib-2.0 >= 2.4],
10484         [
10485         KDE_HAVE_GLIB=1
10486         AC_DEFINE(KDE_HAVE_GLIB,1)
10487         ],
10488         AC_MSG_WARN([[No Glib found, KDE4 support will not integrate with Qt's Glib event loop support]]))
10490 AC_SUBST(KDE4_CFLAGS)
10491 AC_SUBST(KDE4_LIBS)
10492 AC_SUBST(MOC4)
10493 AC_SUBST(KDE_GLIB_CFLAGS)
10494 AC_SUBST(KDE_GLIB_LIBS)
10495 AC_SUBST(KDE_HAVE_GLIB)
10497 dnl ===================================================================
10498 dnl Test for the enabling the lockdown pieces
10499 dnl ===================================================================
10500 AC_MSG_CHECKING([whether to enable the lockdown pieces])
10501 ENABLE_LOCKDOWN=""
10502 if test -n "$enable_lockdown" -a "$enable_lockdown" != "no"; then
10503     ENABLE_LOCKDOWN=YES
10504     AC_MSG_RESULT([yes])
10505 else
10506     AC_MSG_RESULT([no])
10508 AC_SUBST(ENABLE_LOCKDOWN)
10510 dnl ===================================================================
10511 dnl Test whether to include Evolution 2 support
10512 dnl ===================================================================
10513 AC_MSG_CHECKING([whether to enable evolution 2 support])
10514 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
10515     AC_MSG_RESULT([yes])
10516     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
10517     ENABLE_EVOAB2="TRUE"
10518 else
10519     ENABLE_EVOAB2=""
10520     AC_MSG_RESULT([no])
10522 AC_SUBST(ENABLE_EVOAB2)
10523 AC_SUBST(GOBJECT_CFLAGS)
10524 AC_SUBST(GOBJECT_LIBS)
10526 dnl ===================================================================
10527 dnl Test whether to include TDE AB support
10528 dnl ===================================================================
10529 AC_MSG_CHECKING([whether to enable TDE address book support])
10530 if test "$enable_tdeab" = "yes" -a "$enable_tde" = "yes"; then
10531     AC_MSG_RESULT([yes])
10532     AC_LANG_PUSH([C++])
10533     save_CXXFLAGS=$CXXFLAGS
10534     CXXFLAGS="$CXXFLAGS $TDE_CFLAGS"
10535     AC_MSG_CHECKING([whether TDE is at least R14.0])
10536        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10537 #include <tdeversion.h>
10539 int main(int argc, char **argv) {
10540        if (TDE_VERSION_MAJOR >= 14) return 0;
10541        else return 1;
10543        ]])],[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])],[])
10544     CXXFLAGS=$save_CXXFLAGS
10545     AC_LANG_POP([C++])
10546     ENABLE_TDEAB=TRUE
10547 else
10548     AC_MSG_RESULT([no])
10549     ENABLE_TDEAB=
10551 AC_SUBST(ENABLE_TDEAB)
10553 dnl ===================================================================
10554 dnl Test whether to include KDE AB support
10555 dnl ===================================================================
10556 AC_MSG_CHECKING([whether to enable KDE address book support])
10557 if test "$enable_kdeab" = "yes" -a "$enable_kde" = "yes"; then
10558     AC_MSG_RESULT([yes])
10559     AC_LANG_PUSH([C++])
10560     save_CXXFLAGS=$CXXFLAGS
10561     CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
10562     AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
10563        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10564 #include <kdeversion.h>
10566 int main(int argc, char **argv) {
10567        if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
10568        else return 1;
10570        ]])],[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])],[])
10571     CXXFLAGS=$save_CXXFLAGS
10572     AC_LANG_POP([C++])
10573     ENABLE_KAB=TRUE
10574 else
10575     AC_MSG_RESULT([no])
10576     ENABLE_KAB=
10578 AC_SUBST(ENABLE_KAB)
10580 dnl ===================================================================
10581 dnl Test which themes to include
10582 dnl ===================================================================
10583 AC_MSG_CHECKING([which themes to include])
10584 # if none given use default subset of available themes
10585 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
10586     with_theme="crystal default hicontrast oxygen tango"
10587     test "$ENABLE_RELEASE_BUILD" = "FALSE" && with_theme="$with_theme tango_testing"
10590 WITH_THEMES=""
10591 if test "x$with_theme" != "xno"; then
10592     for theme in $with_theme; do
10593         case $theme in
10594             crystal|default|galaxy|hicontrast|human|industrial|oxygen|tango|tango_testing) : ;;
10595             *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
10596         esac
10597         WITH_THEMES="$WITH_THEMES $theme"
10598         SCPDEFS="$SCPDEFS -DTHEME_`echo $theme|tr '[[:lower:]]' '[[:upper:]]'`"
10599     done
10601 AC_MSG_RESULT([$WITH_THEMES])
10602 AC_SUBST([WITH_THEMES])
10604 dnl ===================================================================
10605 dnl Test whether to integrate helppacks into the product's installer
10606 dnl ===================================================================
10607 AC_MSG_CHECKING([for helppack integration])
10608 if test "$with_helppack_integration" = "no"; then
10609     WITH_HELPPACK_INTEGRATION=NO
10610     AC_MSG_RESULT([no integration])
10611 else
10612     WITH_HELPPACK_INTEGRATION=YES
10613     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
10614     AC_MSG_RESULT([integration])
10616 AC_SUBST(WITH_HELPPACK_INTEGRATION)
10618 dnl ===================================================================
10619 dnl Test whether to use CoreText framework
10620 dnl ===================================================================
10621 ENABLE_CORETEXT=NO
10622 if test "$_os" = "Darwin"; then
10623     AC_MSG_CHECKING([whether to use CoreText framework])
10624     if test "$enable_coretext" != no -o "$BITNESS_OVERRIDE" = 64; then
10625         AC_MSG_RESULT([yes])
10626         ENABLE_CORETEXT=YES
10627     else
10628         AC_MSG_RESULT([no])
10629     fi
10631 AC_SUBST(ENABLE_CORETEXT)
10633 ###############################################################################
10634 # Extensions checking
10635 ###############################################################################
10636 AC_MSG_CHECKING([for extensions integration])
10637 if test "x$enable_extension_integration" != "xno"; then
10638     WITH_EXTENSION_INTEGRATION=YES
10639     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
10640     AC_MSG_RESULT([yes, use integration])
10641 else
10642     WITH_EXTENSION_INTEGRATION=NO
10643     AC_MSG_RESULT([no, do not integrate])
10645 AC_SUBST(WITH_EXTENSION_INTEGRATION)
10647 dnl Should any extra extensions be included?
10648 dnl There are standalone tests for each of these below.
10649 WITH_EXTRA_EXTENSIONS=
10650 AC_SUBST([WITH_EXTRA_EXTENSIONS])
10652 libo_CHECK_EXTENSION([Watch Window],[WATCH_WINDOW],[watch_window],[watch-window],[23bd75552206dfcd8fd4e29137dcac84-WatchWindow_1.2.0.0.oxt])
10653 libo_CHECK_EXTENSION([SmART Gallery (Diagram)],[DIAGRAM],[diagram],[diagram],[8d74685d41f8bffe8c3e71fe8deac09d-SmART_0.9.5.oxt])
10654 libo_CHECK_EXTENSION([Validator],[VALIDATOR],[validator],[validator],[bbdd5639ada63e3130761daaecae1a10-Validator_1.1.0.0.oxt])
10655 libo_CHECK_EXTENSION([Barcode],[BARCODE],[barcode],[barcode],[3ed18025a766f1e955707b969c8113a5-Barcode_1.3.5.0.oxt])
10656 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
10657 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
10658 libo_CHECK_EXTENSION([Hungarian Cross-reference Toolbar],[HUNART],[hunart],[hunart],[b632bdd25649cc4067bcb410bae23d2b-hunart_0.3.oxt])
10659 libo_CHECK_EXTENSION([Typography Toolbar],[TYPO],[typo],[typo],[9d60b6cfa3ef1926848710bbcd11115b-typo_0.4.2.oxt])
10660 libo_CHECK_EXTENSION([Google Docs],[GOOGLE_DOCS],[google_docs],[google-docs],[27211596cf0ad97cab7321239406fde0-gdocs_3.0.1_modified.oxt])
10661 if test "x$with_java" != "xno"; then
10662     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
10663     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
10666 dnl ===================================================================
10667 dnl Test whether to include Sun Professional Template Pack
10668 dnl ===================================================================
10669 AC_MSG_CHECKING([for Sun Professional Template Pack integration (only supported languages displayed)])
10670 if test "$with_sun_templates" = "" -o "$with_sun_templates" = "no"; then
10671     AC_MSG_RESULT([no integration])
10672 else
10673     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_SUN_TEMPLATE_PACK"
10674     sun_supported_langs="en-US de it fr es hu"
10675     if test "$with_sun_templates" = "yes"; then
10676         wanted_sun_templates="$sun_supported_langs"
10677     else
10678         # check whether the langs are supported by Sun
10679         wanted_sun_templates=
10680         for lang in $with_sun_templates; do
10681             if test -n "`echo $sun_supported_langs | grep "$lang"`"; then
10682                 wanted_sun_templates="$wanted_sun_templates $lang"
10683             fi
10684         done
10685     fi
10686     SUNTEMPLATES_LANG=
10687     SUNTEMPLATES_DE_PACK=
10688     SUNTEMPLATES_EN_US_PACK=
10689     SUNTEMPLATES_ES_PACK=
10690     SUNTEMPLATES_FR_PACK=
10691     SUNTEMPLATES_HU_PACK=
10692     SUNTEMPLATES_IT_PACK=
10693     # check whether the langs are requested at all
10694     for lang in $wanted_sun_templates; do
10695     if test "$with_lang" = "ALL" -o -n "`echo $with_lang | grep "$lang"`"; then
10696         SUNTEMPLATES_LANG="$SUNTEMPLATES_LANG $lang"
10697         case $lang in
10698         "de") SUNTEMPLATES_DE_PACK="53ca5e56ccd4cab3693ad32c6bd13343-Sun-ODF-Template-Pack-de_1.0.0.oxt";;
10699         "en-US") SUNTEMPLATES_EN_US_PACK="472ffb92d82cf502be039203c606643d-Sun-ODF-Template-Pack-en-US_1.0.0.oxt";;
10700         "es") SUNTEMPLATES_ES_PACK="4ad003e7bbda5715f5f38fde1f707af2-Sun-ODF-Template-Pack-es_1.0.0.oxt";;
10701         "fr") SUNTEMPLATES_FR_PACK="a53080dc876edcddb26eb4c3c7537469-Sun-ODF-Template-Pack-fr_1.0.0.oxt";;
10702         "hu") SUNTEMPLATES_HU_PACK="09ec2dac030e1dcd5ef7fa1692691dc0-Sun-ODF-Template-Pack-hu_1.0.0.oxt";;
10703         "it") SUNTEMPLATES_IT_PACK="b33775feda3bcf823cad7ac361fd49a6-Sun-ODF-Template-Pack-it_1.0.0.oxt";;
10704         esac
10705     fi
10706     done
10707     WITH_EXTRA_EXTENSIONS=YES
10708     AC_MSG_RESULT([$SUNTEMPLATES_LANG])
10710 AC_SUBST(SUNTEMPLATES_DE_PACK)
10711 AC_SUBST(SUNTEMPLATES_EN_US_PACK)
10712 AC_SUBST(SUNTEMPLATES_ES_PACK)
10713 AC_SUBST(SUNTEMPLATES_FR_PACK)
10714 AC_SUBST(SUNTEMPLATES_HU_PACK)
10715 AC_SUBST(SUNTEMPLATES_IT_PACK)
10717 dnl ===================================================================
10718 dnl Test whether to include fonts
10719 dnl ===================================================================
10720 AC_MSG_CHECKING([whether to include third-party fonts])
10721 if test "$with_fonts" != "no"; then
10722     AC_MSG_RESULT([yes])
10723     WITH_FONTS=YES
10724     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
10725 else
10726     AC_MSG_RESULT([no])
10727     WITH_FONTS=NO
10728     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
10730 AC_SUBST(WITH_FONTS)
10732 dnl ===================================================================
10733 dnl Test whether to include ppds
10734 dnl ===================================================================
10735 AC_MSG_CHECKING([whether to include PPDs])
10736 if test "$with_ppds" != "no"; then
10737     AC_MSG_RESULT([yes])
10738 else
10739     AC_MSG_RESULT([no])
10740     WITHOUT_PPDS=YES
10741     SCPDEFS="$SCPDEFS -DWITHOUT_PPDS"
10743 AC_SUBST(WITHOUT_PPDS)
10745 dnl ===================================================================
10746 dnl Test whether to include afms
10747 dnl ===================================================================
10748 AC_MSG_CHECKING([whether to include AFMs])
10749 if test "$with_afms" != "no"; then
10750     AC_MSG_RESULT([yes])
10751     BUILD_TYPE="$BUILD_TYPE AFMS"
10752 else
10753     AC_MSG_RESULT([no])
10754     WITHOUT_AFMS=YES
10755     SCPDEFS="$SCPDEFS -DWITHOUT_AFMS"
10757 AC_SUBST(WITHOUT_AFMS)
10759 dnl ===================================================================
10760 dnl Test whether to include extra galleries
10761 dnl ===================================================================
10762 AC_MSG_CHECKING([whether to include extra galleries])
10763 if test "$enable_extra_gallery" = "" -o "$enable_extra_gallery" = "no"; then
10764     AC_MSG_RESULT([no])
10765     WITH_EXTRA_GALLERY=NO
10766     OOOP_GALLERY_PACK=""
10767 else
10768     AC_MSG_RESULT([yes])
10769     WITH_EXTRA_GALLERY=YES
10770     BUILD_TYPE="$BUILD_TYPE EXTRA_GALLERY"
10771     SCPDEFS="$SCPDEFS -DWITH_EXTRA_GALLERY"
10772     OOOP_GALLERY_PACK="af9314c5972d95a5d6da23ffad818f68-OOOP-gallery-pack-2.8.0.0.zip"
10774 AC_SUBST(WITH_EXTRA_GALLERY)
10775 AC_SUBST(OOOP_GALLERY_PACK)
10777 dnl ===================================================================
10778 dnl Test whether to include extra templates
10779 dnl ===================================================================
10780 AC_MSG_CHECKING([whether to include extra templates])
10781 if test "$enable_extra_template" = "" -o "$enable_extra_template" = "no"; then
10782     AC_MSG_RESULT([no])
10783     WITH_EXTRA_TEMPLATE=NO
10784     OOOP_TEMPLATES_PACK=""
10785 else
10786     AC_MSG_RESULT([yes])
10787     WITH_EXTRA_TEMPLATE=YES
10788     BUILD_TYPE="$BUILD_TYPE EXTRA_TEMPLATE"
10789     SCPDEFS="$SCPDEFS -DWITH_EXTRA_TEMPLATE"
10790     OOOP_TEMPLATES_PACK="1be202fbbbc13f10592a98f70a4a87fb-OOOP-templates-pack-2.9.0.0.zip"
10792 AC_SUBST(WITH_EXTRA_TEMPLATE)
10793 AC_SUBST(OOOP_TEMPLATES_PACK)
10795 dnl ===================================================================
10796 dnl Test whether to include extra samples
10797 dnl ===================================================================
10798 AC_MSG_CHECKING([whether to include extra samples])
10799 if test "$enable_extra_sample" = "" -o "$enable_extra_sample" = "no"; then
10800     AC_MSG_RESULT([no])
10801     WITH_EXTRA_SAMPLE=NO
10802     OOOP_SAMPLES_PACK=""
10803 else
10804     AC_MSG_RESULT([yes])
10805     WITH_EXTRA_SAMPLE=YES
10806     BUILD_TYPE="$BUILD_TYPE EXTRA_SAMPLE"
10807     SCPDEFS="$SCPDEFS -DWITH_EXTRA_SAMPLE"
10808     OOOP_SAMPLES_PACK="a6bccacf44914969e6e7b2f8faf4132c-OOOP-samples-pack-2.7.0.0.zip"
10810 AC_SUBST(WITH_EXTRA_SAMPLE)
10811 AC_SUBST(OOOP_SAMPLES_PACK)
10813 dnl ===================================================================
10814 dnl Test whether to include extra fonts
10815 dnl ===================================================================
10816 AC_MSG_CHECKING([whether to include extra fonts])
10817 if test "$enable_extra_font" = "" -o "$enable_extra_font" = "no"; then
10818     AC_MSG_RESULT([no])
10819     WITH_EXTRA_FONT=NO
10820     OOOP_FONTS_PACK=""
10821 else
10822     AC_MSG_RESULT([yes])
10823     WITH_EXTRA_FONT=YES
10824     BUILD_TYPE="$BUILD_TYPE EXTRA_FONT"
10825     SCPDEFS="$SCPDEFS -DWITH_EXTRA_FONT"
10826     OOOP_FONTS_PACK="a10aa597411643326e27d7fc128af12d-OOOP-fonts-pack-2.9.0.0.zip"
10828 AC_SUBST(WITH_EXTRA_FONT)
10829 AC_SUBST(OOOP_FONTS_PACK)
10831 dnl ===================================================================
10832 dnl Test whether to enable online update service
10833 dnl ===================================================================
10834 AC_MSG_CHECKING([whether to enable online update])
10835 ENABLE_ONLINE_UPDATE=
10836 if test "$enable_online_update" = ""; then
10837     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
10838         AC_MSG_RESULT([yes])
10839         ENABLE_ONLINE_UPDATE="TRUE"
10840     else
10841         AC_MSG_RESULT([no])
10842     fi
10843 else
10844     if test "$enable_online_update" = "yes"; then
10845         AC_MSG_RESULT([yes])
10846         ENABLE_ONLINE_UPDATE="TRUE"
10847     else
10848         AC_MSG_RESULT([no])
10849     fi
10851 AC_SUBST(ENABLE_ONLINE_UPDATE)
10853 dnl ===================================================================
10854 dnl Test whether to create MSI with LIMITUI=1 (silent install)
10855 dnl ===================================================================
10856 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
10857 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
10858     AC_MSG_RESULT([no])
10859     ENABLE_SILENT_MSI="FALSE"
10860 else
10861     AC_MSG_RESULT([yes])
10862     ENABLE_SILENT_MSI="TRUE"
10863     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
10865 AC_SUBST(ENABLE_SILENT_MSI)
10867 AC_MSG_CHECKING([whether and how to use Xinerama])
10868 if test "$_os" = "Darwin"; then
10869     USE_XINERAMA=YES
10870     XINERAMA_LINK=dynamic
10871     AC_MSG_RESULT([yes])
10872 elif test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
10873     if test "$x_libraries" = "default_x_libraries"; then
10874         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
10875         if test "x$XINERAMALIB" = x; then
10876            XINERAMALIB="/usr/lib"
10877         fi
10878     else
10879         XINERAMALIB="$x_libraries"
10880     fi
10881     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
10882         # we have both versions, let the user decide but use the dynamic one
10883         # per default
10884         USE_XINERAMA=YES
10885         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
10886             XINERAMA_LINK=dynamic
10887         else
10888             XINERAMA_LINK=static
10889         fi
10890     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
10891         # we have only the dynamic version
10892         USE_XINERAMA=YES
10893         XINERAMA_LINK=dynamic
10894     elif test -e "$XINERAMALIB/libXinerama.a"; then
10895         # static version
10896         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
10897             USE_XINERAMA=YES
10898             XINERAMA_LINK=static
10899         else
10900             USE_XINERAMA=NO
10901             XINERAMA_LINK=none
10902         fi
10903     else
10904         # no Xinerama
10905         USE_XINERAMA=NO
10906         XINERAMA_LINK=none
10907     fi
10908     if test "$USE_XINERAMA" = "YES"; then
10909         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
10910         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
10911             [AC_MSG_ERROR(Xinerama header not found.)], [])
10912         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
10913         if test "x$XEXTLIB" = x; then
10914            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
10915         fi
10916         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
10917         if test "$_os" = "FreeBSD"; then
10918             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
10919         fi
10920         if test "$_os" = "Linux"; then
10921             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
10922         fi
10923         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
10924             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
10925     else
10926         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
10927     fi
10928 else
10929     USE_XINERAMA=NO
10930     XINERAMA_LINK=none
10931     AC_MSG_RESULT([no])
10933 AC_SUBST(USE_XINERAMA)
10934 AC_SUBST(XINERAMA_LINK)
10936 dnl ===================================================================
10937 dnl Test whether to build cairo or rely on the system version
10938 dnl ===================================================================
10940 if test "$GUIBASE" = "unx"; then
10941     # Used in vcl/Library_vclplug_gen.mk
10942     test_cairo=yes
10945 if test "$test_cairo" = "yes"; then
10946     AC_MSG_CHECKING([whether to use the system cairo])
10948     if test "$with_system_cairo" = "yes"; then
10949         SYSTEM_CAIRO=YES
10950         AC_MSG_RESULT([yes])
10952         PKG_CHECK_MODULES( CAIRO, cairo >= 1.0.2 )
10954         if test "$test_xrender" = "yes"; then
10955             if test "$with_system_xextensions_headers" != "no"; then
10956                 AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
10957                 AC_LANG_PUSH([C])
10958                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
10959 #ifdef PictStandardA8
10960 #else
10961       return fail;
10962 #endif
10963 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
10965                 AC_LANG_POP([C])
10966             fi
10967         fi
10968         libo_MINGW_CHECK_DLL([libcairo])
10969         libo_MINGW_TRY_DLL([libfontconfig])
10970         libo_MINGW_TRY_DLL([libfreetype])
10971         libo_MINGW_TRY_DLL([libpixman])
10972         libo_MINGW_TRY_DLL([libpng15])
10973     else
10974         SYSTEM_CAIRO=NO
10975         AC_MSG_RESULT([no])
10977         BUILD_TYPE="$BUILD_TYPE CAIRO"
10978         SCPDEFS="$SCPDEFS -DNEED_CAIRO"
10979     fi
10982 AC_SUBST(SYSTEM_CAIRO)
10983 AC_SUBST(CAIRO_CFLAGS)
10984 AC_SUBST(CAIRO_LIBS)
10986 dnl ===================================================================
10987 dnl Test whether to use liblangtag
10988 dnl ===================================================================
10989 ENABLE_LIBLANGTAG=
10990 SYSTEM_LIBLANGTAG=
10991 AC_MSG_CHECKING([whether to use liblangtag])
10992 if test "$enable_liblangtag" = "yes" -o \( "$enable_liblangtag" = "" -a $_os != Android -a $_os != iOS \); then
10993     ENABLE_LIBLANGTAG=YES
10994     AC_MSG_RESULT([yes])
10995     AC_MSG_CHECKING([whether to use system liblangtag])
10996     if test "$with_system_liblangtag" = yes; then
10997         SYSTEM_LIBLANGTAG=YES
10998         AC_MSG_RESULT([yes])
10999         PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11000         libo_MINGW_CHECK_DLL([liblangtag])
11001     else
11002         SYSTEM_LIBLANGTAG=NO
11003         AC_MSG_RESULT([no])
11004         BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11005     fi
11006 else
11007     ENABLE_LIBLANGTAG=NO
11008     AC_MSG_RESULT([no])
11010 AC_SUBST(ENABLE_LIBLANGTAG)
11011 AC_SUBST(SYSTEM_LIBLANGTAG)
11012 AC_SUBST(LIBLANGTAG_CFLAGS)
11013 AC_SUBST(LIBLANGTAG_LIBS)
11015 dnl ===================================================================
11016 dnl Test whether to build libpng or rely on the system version
11017 dnl ===================================================================
11019 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/png"],["-L${OUTDIR}/lib -lpng"])
11021 dnl ===================================================================
11022 dnl Check for runtime JVM search path
11023 dnl ===================================================================
11024 if test "$SOLAR_JAVA" != ""; then
11025     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11026     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11027         AC_MSG_RESULT([yes])
11028         if ! test -d "$with_jvm_path"; then
11029             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11030         fi
11031         if ! test -d "$with_jvm_path"jvm; then
11032             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11033         fi
11034         JVM_ONE_PATH_CHECK="$with_jvm_path"
11035         AC_SUBST(JVM_ONE_PATH_CHECK)
11036     else
11037         AC_MSG_RESULT([no])
11038     fi
11041 dnl ===================================================================
11042 dnl Test for the presence of Ant and that it works
11043 dnl ===================================================================
11045 if test "$SOLAR_JAVA" != ""; then
11046     ANT_HOME=; export ANT_HOME
11047     WITH_ANT_HOME=; export WITH_ANT_HOME
11048     if test -z "$with_ant_home"; then
11049         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11050     else
11051         if test "$_os" = "WINNT"; then
11052             with_ant_home=`cygpath -u "$with_ant_home"`
11053         fi
11054         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11055         WITH_ANT_HOME=$with_ant_home
11056         ANT_HOME=$with_ant_home
11057     fi
11059     if test -z "$ANT"; then
11060         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11061     else
11062         # resolve relative or absolute symlink
11063         while test -h "$ANT"; do
11064             a_cwd=`pwd`
11065             a_basename=`basename "$ANT"`
11066             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11067             cd "`dirname "$ANT"`"
11068             cd "`dirname "$a_script"`"
11069             ANT="`pwd`"/"`basename "$a_script"`"
11070             cd "$a_cwd"
11071         done
11073         AC_MSG_CHECKING([if $ANT works])
11074         cat > conftest.java << EOF
11075         public class conftest {
11076             int testmethod(int a, int b) {
11077                     return a + b;
11078             }
11079         }
11082         cat > conftest.xml << EOF
11083         <project name="conftest" default="conftest">
11084         <target name="conftest">
11085             <javac srcdir="." includes="conftest.java">
11086             </javac>
11087         </target>
11088         </project>
11091         oldJAVA_HOME=$JAVA_HOME
11092         if test "$JAVACISGCJ" = "yes"; then
11093             JAVA_HOME=; export JAVA_HOME
11094             ant_gcj="-Dbuild.compiler=gcj"
11095         fi
11096         AC_TRY_COMMAND("$ANT" $ant_gcj -buildfile conftest.xml 1>&2)
11097         if test $? = 0 -a -f ./conftest.class; then
11098             AC_MSG_RESULT([Ant works])
11099             if test -z "$WITH_ANT_HOME"; then
11100                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11101                 if test -z "$ANT_HOME"; then
11102                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11103                 fi
11104             else
11105                 ANT_HOME="$WITH_ANT_HOME"
11106             fi
11107         else
11108             echo "configure: Ant test failed" >&5
11109             cat conftest.java >&5
11110             cat conftest.xml >&5
11111             AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
11112             ANT_HOME=""
11113             add_warning "Ant does not work - Some Java projects will not build!"
11114         fi
11115         JAVA_HOME=$oldJAVA_HOME
11116         rm -f conftest* core core.* *.core
11117     fi
11118     if test -z "$ANT_HOME"; then
11119         ANT_HOME="NO_ANT_HOME"
11120     else
11121         PathFormat "$ANT_HOME"
11122         ANT_HOME="$formatted_path"
11123         PathFormat "$ANT"
11124         ANT="$ANT"
11125     fi
11126     AC_SUBST(ANT_HOME)
11127     AC_SUBST(ANT)
11129     dnl Checking for ant.jar
11130     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11131         AC_MSG_CHECKING([Ant lib directory])
11132         if test -f $ANT_HOME/lib/ant.jar; then
11133             ANT_LIB="$ANT_HOME/lib"
11134         else
11135             if test -f $ANT_HOME/ant.jar; then
11136                 ANT_LIB="$ANT_HOME"
11137             else
11138                 if test -f /usr/share/java/ant.jar; then
11139                     ANT_LIB=/usr/share/java
11140                 else
11141                     if test -f /usr/share/ant-core/lib/ant.jar; then
11142                         ANT_LIB=/usr/share/ant-core/lib
11143                     else
11144                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11145                             ANT_LIB="$ANT_HOME/lib/ant"
11146                         else
11147                             if test -f /usr/share/lib/ant/ant.jar; then
11148                                 ANT_LIB=/usr/share/lib/ant
11149                             else
11150                                 AC_MSG_ERROR([Ant libraries not found!])
11151                             fi
11152                         fi
11153                     fi
11154                 fi
11155             fi
11156         fi
11157         PathFormat "$ANT_LIB"
11158         ANT_LIB="$formatted_path"
11159         AC_MSG_RESULT([Ant lib directory found.])
11160     fi
11161     AC_SUBST(ANT_LIB)
11163     ant_minver=1.6.0
11164     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11166     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11167     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11168     ant_version_major=`echo $ant_version | cut -d. -f1`
11169     ant_version_minor=`echo $ant_version | cut -d. -f2`
11170     echo "configure: ant_version $ant_version " >&5
11171     echo "configure: ant_version_major $ant_version_major " >&5
11172     echo "configure: ant_version_minor $ant_version_minor " >&5
11173     if test "$ant_version_major" -ge "2"; then
11174         AC_MSG_RESULT([yes, $ant_version])
11175     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11176         AC_MSG_RESULT([yes, $ant_version])
11177     else
11178         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11179     fi
11181     if test "$ENABLE_MEDIAWIKI" = "YES"; then
11182         AC_MSG_CHECKING([whether Ant supports mapper type="regexp"])
11183         rm -rf confdir
11184         mkdir confdir
11185         cat > conftest.java << EOF
11186             public class conftest {
11187                 int testmethod(int a, int b) {
11188                     return a + b;
11189                 }
11190             }
11193         cat > conftest.xml << EOF
11194             <project name="conftest" default="conftest">
11195             <target name="conftest" depends="copytest">
11196                 <javac srcdir="." includes="conftest.java">
11197                 </javac>
11198             </target>
11199             <target name="copytest">
11200                  <copy todir="confdir">
11201                  <fileset dir="confdir" includes="**/*.abc" casesensitive="yes"/>
11202                  <filterset/>
11203                  <mapper type="regexp" from="^(.*[/\\])foo([/\\].*)" to="\1baa\2"/>
11204                  </copy>
11205             </target>
11206             </project>
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([yes])
11216             rm -rf confdir
11217         else
11218             echo "configure: Ant test failed" >&5
11219             cat conftest.java >&5
11220             cat conftest.xml >&5
11221             rm -rf confdir
11222             AC_MSG_ERROR([no. Did you install ant-apache-regexp?])
11223         fi
11224     fi
11225     rm -f conftest* core core.* *.core
11228 OOO_JUNIT_JAR=
11229 if test "$SOLAR_JAVA" != "" -a "$with_junit" != "no"; then
11230     AC_MSG_CHECKING([for JUnit 4])
11231     if test "$with_junit" = "yes"; then
11232         if test -e /usr/share/java/junit4.jar; then
11233             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11234         else
11235            if test -e /usr/share/lib/java/junit.jar; then
11236               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11237            else
11238               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11239            fi
11240         fi
11241     else
11242         OOO_JUNIT_JAR=$with_junit
11243     fi
11244     if test "$_os" = "WINNT"; then
11245         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11246     fi
11247     "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" 2>&5 | \
11248         grep org/junit/Before.class > /dev/null 2>&5
11249     if test $? -eq 0; then
11250         # check if either class-path entry is available for hamcrest or
11251         # it's bundled
11252         if "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" |$GREP -q hamcrest || \
11253             "$UNZIP" -c "$OOO_JUNIT_JAR" META-INF/MANIFEST.MF |$GREP 'Class-Path:' | $GREP -q 'hamcrest'; then
11254             AC_MSG_RESULT([$OOO_JUNIT_JAR])
11255         else
11256             AC_MSG_ERROR([your junit jar neither sets a classpath nor includes hamcrest; please
11257 provide a full junit jar or use --without-junit])
11258         fi
11259     else
11260         AC_MSG_RESULT([no])
11261         AC_MSG_ERROR([cannot find JUnit 4 jar; please install one in the default
11262 location (/usr/share/java), specify its pathname via
11263 --with-junit=..., or disable it via --without-junit])
11264     fi
11265     if test $OOO_JUNIT_JAR != ""; then
11266     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11267     fi
11269 AC_SUBST(OOO_JUNIT_JAR)
11272 AC_SUBST(SCPDEFS)
11275 # check for wget and md5sum
11277 WGET=
11278 MD5SUM=
11279 CURL=
11281 if test "$enable_fetch_external" != "no"; then
11283 CURL=`which curl 2>/dev/null`
11285 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
11286     eval "$i --version" > /dev/null 2>&1
11287     ret=$?
11288     if test $ret -eq 0; then
11289         WGET=$i
11290         break
11291     fi
11292 done
11294 if test -z "$WGET" -a -z "$CURL"; then
11295     AC_MSG_ERROR([neither wget nor curl found!])
11298 for i in md5 md5sum /usr/local/bin/md5sum gmd5sum /usr/sfw/bin/md5sum /opt/sfw/bin/gmd5sum /opt/local/bin/md5sum; do
11299     if test "$i" = "md5"; then
11300         eval "$i -x" > /dev/null 2>&1
11301     else
11302         eval "$i --version" > /dev/null 2>&1
11303     fi
11304     ret=$?
11305     if test $ret -eq 0; then
11306         MD5SUM=$i
11307         break
11308     fi
11309 done
11311 if test "$MD5SUM" = "md5"; then
11312     if md5 -r < /dev/null > /dev/null 2>/dev/null; then
11313         MD5SUM="$MD5SUM -r"
11314     elif md5 -n < /dev/null > /dev/null 2>/dev/null; then
11315         MD5SUM="$MD5SUM -n"
11316     fi
11319 if test -z "$MD5SUM"; then
11320     AC_MSG_ERROR([no md5sum: found!])
11325 AC_SUBST(WGET)
11326 AC_SUBST(CURL)
11327 AC_SUBST(MD5SUM)
11329 dnl ===================================================================
11330 dnl Product version
11331 dnl ===================================================================
11332 AC_MSG_CHECKING([for product version])
11333 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
11334 AC_MSG_RESULT([$PRODUCTVERSION])
11335 AC_SUBST(PRODUCTVERSION)
11337 dnl ===================================================================
11338 dnl Dealing with l10n options
11339 dnl ===================================================================
11340 AC_MSG_CHECKING([which languages to be built])
11341 # get list of all languages
11342 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
11343 # the sed command does the following:
11344 #   + if a line ends with a backslash, append the next line to it
11345 #   + adds " on the beginning of the value (after =)
11346 #   + adds " at the end of the value
11347 #   + removes en-US; we want to put it on the beginning
11348 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
11349 [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)]
11350 ALL_LANGS="en-US $completelangiso"
11351 # check the configured localizations
11352 WITH_LANG="$with_lang"
11353 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
11354     AC_MSG_RESULT([en-US])
11355 else
11356     AC_MSG_RESULT([$WITH_LANG])
11357     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
11359 # check that the list is valid
11360 for lang in $WITH_LANG; do
11361     test "$lang" = "ALL" && continue
11362     # need to check for the exact string, so add space before and after the list of all languages
11363     for vl in $ALL_LANGS; do
11364         if test "$vl" = "$lang"; then
11365            break
11366         fi
11367     done
11368     if test "$vl" != "$lang"; then
11369         # if you're reading this - you prolly quoted your languages remove the quotes ...
11370         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
11371     fi
11372 done
11373 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
11374     echo $WITH_LANG | grep -q en-US
11375     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
11377 # list with substituted ALL
11378 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
11379 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
11380 test "$WITH_LANG" = "en-US" && WITH_LANG=
11381 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
11382     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
11383     ALL_LANGS=`echo $ALL_LANGS qtz`
11385 AC_SUBST(ALL_LANGS)
11386 AC_SUBST(WITH_LANG)
11387 AC_SUBST(WITH_LANG_LIST)
11388 AC_SUBST(GIT_NEEDED_SUBMODULES)
11390 WITH_POOR_HELP_LOCALIZATIONS=
11391 if test -d "$SRC_ROOT/translations/source"; then
11392     for l in `ls -1 $SRC_ROOT/translations/source`; do
11393         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
11394             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
11395         fi
11396     done
11398 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
11400 dnl git submodule update --reference
11401 dnl ===================================================================
11402 if test -n "${GIT_REFERENCE_SRC}"; then
11403     for repo in ${GIT_NEEDED_SUBMODULES}; do
11404         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
11405             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
11406         fi
11407     done
11409 AC_SUBST(GIT_REFERENCE_SRC)
11411 dnl branding
11412 dnl ===================================================================
11413 AC_MSG_CHECKING([for alternative branding images directory])
11414 # initialize mapped arrays
11415 BRAND_INTRO_IMAGES="flat_logo.svg intro.png"
11416 brand_files="$BRAND_INTRO_IMAGES about.svg \
11417     backing_left.png backing_right.png \
11418     backing_rtl_left.png backing_rtl_right.png \
11419     backing_space.png"
11421 if test -z "$with_branding" -o "$with_branding" = "no"; then
11422     AC_MSG_RESULT([none])
11423     DEFAULT_BRAND_IMAGES="$brand_files"
11424 else
11425     if ! test -d $with_branding ; then
11426         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
11427     else
11428         AC_MSG_RESULT([$with_branding])
11429         CUSTOM_BRAND_DIR="$with_branding"
11430         for lfile in $brand_files
11431         do
11432             if ! test -f $with_branding/$lfile ; then
11433                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
11434                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
11435             else
11436                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
11437             fi
11438         done
11439         check_for_progress="yes"
11440     fi
11442 AC_SUBST([BRAND_INTRO_IMAGES])
11443 AC_SUBST([CUSTOM_BRAND_DIR])
11444 AC_SUBST([CUSTOM_BRAND_IMAGES])
11445 AC_SUBST([DEFAULT_BRAND_IMAGES])
11448 AC_MSG_CHECKING([for 'intro' progress settings])
11449 PROGRESSBARCOLOR=
11450 PROGRESSSIZE=
11451 PROGRESSPOSITION=
11452 PROGRESSFRAMECOLOR=
11453 PROGRESSTEXTCOLOR=
11454 PROGRESSTEXTBASELINE=
11456 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
11457     source "$with_branding/progress.conf"
11458     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
11459 else
11460     AC_MSG_RESULT([none])
11463 AC_SUBST(PROGRESSBARCOLOR)
11464 AC_SUBST(PROGRESSSIZE)
11465 AC_SUBST(PROGRESSPOSITION)
11466 AC_SUBST(PROGRESSFRAMECOLOR)
11467 AC_SUBST(PROGRESSTEXTCOLOR)
11468 AC_SUBST(PROGRESSTEXTBASELINE)
11471 EXTRA_BUILDID=
11472 AC_MSG_CHECKING([for extra build ID])
11473 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
11474     EXTRA_BUILDID="$with_extra_buildid"
11475     AC_MSG_RESULT([$EXTRA_BUILDID])
11476 else
11477     AC_MSG_RESULT([not set])
11479 AC_SUBST(EXTRA_BUILDID)
11481 OOO_VENDOR=
11482 AC_MSG_CHECKING([for vendor])
11483 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
11484     OOO_VENDOR="$USERNAME"
11486     if test -z "$OOO_VENDOR"; then
11487         OOO_VENDOR="$USER"
11488     fi
11490     if test -z "$OOO_VENDOR"; then
11491         OOO_VENDOR="`id -u -n`"
11492     fi
11494     AC_MSG_RESULT([not set, using $OOO_VENDOR])
11495 else
11496     OOO_VENDOR="$with_vendor"
11497     AC_MSG_RESULT([$OOO_VENDOR])
11499 AC_SUBST(OOO_VENDOR)
11501 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
11502 if test "$with_compat_oowrappers" = "yes"; then
11503     WITH_COMPAT_OOWRAPPERS=YES
11504     AC_MSG_RESULT(yes)
11505 else
11506     WITH_COMPAT_OOWRAPPERS=
11507     AC_MSG_RESULT(no)
11509 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
11511 AC_MSG_CHECKING([for product name])
11512 PRODUCTNAME=AC_PACKAGE_NAME
11513 AC_MSG_RESULT([$PRODUCTNAME])
11514 AC_SUBST(PRODUCTNAME)
11516 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | tr '[[:upper:]]' '[[:lower:]]'`
11517 AC_MSG_CHECKING([for install dirname])
11518 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
11519    INSTALLDIRNAME="$with_install_dirname"
11521 AC_MSG_RESULT([$INSTALLDIRNAME])
11522 AC_SUBST(INSTALLDIRNAME)
11524 AC_MSG_CHECKING([for prefix])
11525 test "x$prefix" = xNONE && prefix=$ac_default_prefix
11526 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
11527 PREFIXDIR="$prefix"
11528 AC_MSG_RESULT([$PREFIXDIR])
11529 AC_SUBST(PREFIXDIR)
11531 LIBDIR=[$(eval echo $(eval echo $libdir))]
11532 AC_SUBST(LIBDIR)
11534 DATADIR=[$(eval echo $(eval echo $datadir))]
11535 AC_SUBST(DATADIR)
11537 MANDIR=[$(eval echo $(eval echo $mandir))]
11538 AC_SUBST(MANDIR)
11540 DOCDIR=[$(eval echo $(eval echo $docdir))]
11541 AC_SUBST(DOCDIR)
11543 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
11544 AC_SUBST(INSTALLDIR)
11546 DEVINSTALLDIR="$OUTDIR/installation"
11547 AC_SUBST(DEVINSTALLDIR)
11549 # ===================================================================
11550 # De- or increase default verbosity of build process
11551 # ===================================================================
11552 AC_MSG_CHECKING([build verbosity])
11553 if test -n "$enable_verbose"; then
11554     if test "$enable_verbose" = "yes"; then
11555         VERBOSE="TRUE"
11556         AC_MSG_RESULT([high])
11557     fi
11558     if test "$enable_verbose" = "no"; then
11559         VERBOSE="FALSE"
11560         AC_MSG_RESULT([low])
11561     fi
11562 else
11563     AC_MSG_RESULT([not set])
11565 AC_SUBST(VERBOSE)
11567 dnl ===================================================================
11568 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
11569 dnl --enable-dependency-tracking configure option
11570 dnl ===================================================================
11571 AC_MSG_CHECKING([whether to enable dependency tracking])
11572 if test "$enable_dependency_tracking" = "no"; then
11573     nodep=TRUE
11574     AC_MSG_RESULT([no])
11575 else
11576     AC_MSG_RESULT([yes])
11578 AC_SUBST(nodep)
11580 dnl ===================================================================
11581 dnl Number of CPUs to use during the build
11582 dnl ===================================================================
11583 AC_MSG_CHECKING([for number of processors to use])
11584 # plain --with-parallelism is just the default
11585 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
11586     if test "$with_parallelism" = "no"; then
11587         PARALLELISM=1
11588     else
11589         PARALLELISM=$with_parallelism
11590     fi
11591 else
11592     if test "$enable_icecream" = "yes"; then
11593         PARALLELISM="10"
11594     else
11595         case `uname -s` in
11597         Darwin|FreeBSD|NetBSD|OpenBSD)
11598             PARALLELISM=`sysctl -n hw.ncpu`
11599             ;;
11601         Linux)
11602             PARALLELISM=`getconf _NPROCESSORS_ONLN`
11603         ;;
11604         # what else than above does profit here *and* has /proc?
11605         *)
11606             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
11607             ;;
11608         esac
11610         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
11611         # unexpected format, 'wc -l' will have returned 0.
11612         if test "$PARALLELISM" -eq 0; then
11613             PARALLELISM=1
11614         fi
11615     fi
11618 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
11619     if test -z "$with_parallelism"; then
11620             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
11621             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
11622             PARALLELISM="1"
11623     else
11624         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."
11625     fi
11628 AC_MSG_RESULT([$PARALLELISM])
11629 AC_SUBST(PARALLELISM)
11631 # ===================================================================
11632 # Number of parallel jobs to be executed during subsequenttest
11633 # ===================================================================
11634 AC_MSG_CHECKING([for maximum no. of jobs during subsequenttest])
11635 CHECK_PARALLELISM=$PARALLELISM
11636 if test "$with_check_jobs" != ""; then
11637     CHECK_PARALLELISM="$with_check_jobs"
11639 AC_MSG_RESULT([$CHECK_PARALLELISM])
11640 AC_SUBST(CHECK_PARALLELISM)
11643 # Set up ILIB for MSVC build
11645 if test "$build_os" = "cygwin"; then
11646     ILIB=".;${SOLARVER}/$INPATH/lib"
11647     if test -n "$JAVA_HOME" -a "$JAVA_HOME" != "NO_JAVA_HOME"; then
11648         ILIB="$ILIB;$JAVA_HOME/lib"
11649     fi
11650     if test "$BITNESS_OVERRIDE" = 64; then
11651         ILIB="$ILIB;$COMPATH/lib/amd64"
11652         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
11653         if test "$WINDOWS_SDK_VERSION" = "80"; then
11654             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/win8/um/x64"
11655         fi
11656     else
11657         ILIB="$ILIB;$COMPATH/lib"
11658         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
11659         if test "$WINDOWS_SDK_VERSION" = "80"; then
11660             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/win8/um/x86"
11661         fi
11662     fi
11663     ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
11665     if test "$ENABLE_DIRECTX" = "TRUE"; then
11666         ILIB="$ILIB;$DIRECTXSDK_LIB"
11667     fi
11668     AC_SUBST(ILIB)
11672 # ===================================================================
11673 # Creating bigger shared library to link against
11674 # ===================================================================
11675 AC_MSG_CHECKING([whether to create huge library])
11676 MERGELIBS=
11678 if test $_os = iOS -o $_os = Android; then
11679     # Never any point in mergelibs for these as we build just static
11680     # libraries anyway...
11681     enable_mergelibs=no
11684 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
11685     if test $_os != Linux -a $_os != WINNT; then
11686         add_warning "--enable-mergelibs is not tested for this platform"
11687     fi
11688     if test "$enable_mergelibs" = "all"; then
11689         MERGELIBS="ALL"
11690         URELIBS="TRUE"
11691     else
11692         MERGELIBS="CORE"
11693     fi
11694     AC_MSG_RESULT([yes])
11695 else
11696     AC_MSG_RESULT([no])
11698 AC_SUBST([MERGELIBS])
11699 AC_SUBST([URELIBS])
11701 # ===================================================================
11702 # Create hardlinks on deliver instead of copying for smaller size and speed up
11703 # ===================================================================
11704 AC_MSG_CHECKING([whether to create hardlinks for delivering files])
11705 HARDLINKDELIVER=
11706 if test "$enable_hardlink_deliver" = "yes"; then
11707     HARDLINKDELIVER="TRUE"
11708     AC_MSG_RESULT([yes])
11709 else
11710     AC_MSG_RESULT([no])
11712 AC_SUBST(HARDLINKDELIVER)
11714 dnl ===================================================================
11715 dnl icerun is a wrapper that stops us spawning tens of processes
11716 dnl locally - for tools that can't be executed on the compile cluster
11717 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
11718 dnl ===================================================================
11719 AC_MSG_CHECKING([whether to use icerun wrapper])
11720 ICECREAM_RUN=
11721 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
11722     ICECREAM_RUN=icerun
11723     AC_MSG_RESULT([yes])
11724 else
11725     AC_MSG_RESULT([no])
11727 AC_SUBST(ICECREAM_RUN)
11729 dnl ===================================================================
11731 AC_MSG_CHECKING([MPL subset])
11732 MPL_SUBSET=
11734 if test "$enable_mpl_subset" = "yes"; then
11735    if test "x$enable_postgresql_sdbc" != "xno"; then
11736         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the postgress database backend.])
11737    fi
11738    if test "$enable_lotuswordpro" = "yes"; then
11739         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
11740    fi
11741    if test "$enable_neon" != "no" -o "x$DISABLE_NEON" != "xTRUE"; then
11742         AC_MSG_ERROR([need to --disable-neon - webdav support.])
11743    fi
11744    if test "x$enable_ext_mariadb_connector" = "xyes"; then
11745         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
11746    fi
11747    if test "x$ENABLE_PDFIMPORT" != "xFALSE"; then
11748         if test "x$SYSTEM_POPPLER" != "xNO"; then
11749                 AC_MSG_ERROR([need to disable PDF import via xpdf/poplar or use system library])
11750         fi
11751    fi
11752    # cf. m4/libo_check_extension.m4
11753    if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
11754         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
11755    fi
11756    for theme in $WITH_THEMES; do
11757         case $theme in
11758             crystal|default|hicontrast|human|oxygen)
11759                 AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
11760             *) : ;;
11761         esac
11762    done
11763    if test "$enable_opengl" != "no" -o "x$ENABLE_OPENGL" == "xTRUE"; then
11764         AC_MSG_ERROR([need to --disable-opengl - GL transitions support.])
11765    fi
11766    if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" == "xTRUE"; then
11767         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
11768    fi
11770    MPL_SUBSET="TRUE"
11771    AC_DEFINE(MPL_HAVE_SUBSET)
11772    AC_MSG_RESULT([only])
11773 else
11774    AC_MSG_RESULT([no restrictions])
11776 AC_SUBST(MPL_SUBSET)
11779 dnl ===================================================================
11780 dnl Setting up the environment.
11781 dnl ===================================================================
11782 echo "setting up the build environment variables..."
11784 AC_SUBST(COMPATH)
11786 if test "$build_os" = "cygwin"; then
11787     if test "$DISABLE_ACTIVEX" = "YES"; then
11788         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
11789         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
11790     else
11791         ATL_LIB="$COMPATH/atlmfc/lib"
11792         ATL_INCLUDE="$COMPATH/atlmfc/include"
11793     fi
11794     if test "$BITNESS_OVERRIDE" = 64; then
11795         ATL_LIB="$ATL_LIB/amd64"
11796     fi
11797     PathFormat "/usr/bin/grep.exe"
11798     WIN_GREP="$formatted_path"
11799     PathFormat "/usr/bin/find.exe"
11800     WIN_FIND="$formatted_path"
11801     PathFormat "/usr/bin/ls.exe"
11802     WIN_LS="$formatted_path"
11803     PathFormat "/usr/bin/touch.exe"
11804     WIN_TOUCH="$formatted_path"
11807 AC_SUBST(ATL_INCLUDE)
11808 AC_SUBST(ATL_LIB)
11809 AC_SUBST(WIN_FIND)
11810 AC_SUBST(WIN_GREP)
11811 AC_SUBST(WIN_LS)
11812 AC_SUBST(WIN_TOUCH)
11814 AC_SUBST(BUILD_TYPE)
11816 AC_SUBST(SOLARINC)
11817 AC_SUBST(SOLARLIB)
11819 PathFormat "$PERL"
11820 PERL="$formatted_path"
11821 AC_SUBST(PERL)
11823 if test -n "$TMPDIR"; then
11824     TEMP_DIRECTORY="$TMPDIR"
11825 else
11826     TEMP_DIRECTORY="/tmp"
11828 if test "$build_os" = "cygwin"; then
11829     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
11831 AC_SUBST(TEMP_DIRECTORY)
11833 # setup the PATH for the environment
11834 if test -n "$LO_PATH_FOR_BUILD"; then
11835     LO_PATH="$LO_PATH_FOR_BUILD"
11836 else
11837     LO_PATH="$PATH"
11839     case "$host_os" in
11841     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
11842         if test "$SOLAR_JAVA" != "" -a "$JDK"!="gcj"; then
11843             pathmunge "$JAVA_HOME/bin" "after"
11844         fi
11845         ;;
11847     cygwin*)
11848         pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
11849         pathmunge "$ASM_HOME" "before"
11850         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
11851         pathmunge "$CSC_PATH" "before"
11852         pathmunge "$MIDL_PATH" "before"
11853         pathmunge "$AL_PATH" "before"
11854         pathmunge "$MSPDB_PATH" "before"
11855         if test "$BITNESS_OVERRIDE" = 64; then
11856             pathmunge "$COMPATH/bin/amd64" "before"
11857             pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
11858         else
11859             pathmunge "$COMPATH/bin" "before"
11860             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
11861         fi
11862         if test "$SOLAR_JAVA" != "" -a "$JDK"!="gcj"; then
11863             if test -d "$JAVA_HOME/jre/bin/client"; then
11864                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
11865             fi
11866             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
11867                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
11868             fi
11869             pathmunge "$JAVA_HOME/bin" "before"
11870         fi
11871         ;;
11873     solaris*)
11874         pathmunge "/usr/css/bin" "before"
11875         if test "$SOLAR_JAVA" != "" -a "$JDK"!="gcj"; then
11876             pathmunge "$JAVA_HOME/bin" "after"
11877         fi
11878         ;;
11879     esac
11881     pathmunge "$SRC_ROOT/solenv/$OUTPATH/bin" "before"
11882     pathmunge "$SRC_ROOT/solenv/bin" "before"
11883     pathmunge "." "before"
11886 AC_SUBST(LO_PATH)
11888 # Generate a configuration md5 we can use for deps
11889 if test -f config_host.mk; then
11890     config_md5=`$MD5SUM config_host.mk | sed "s/ .*//"`
11893 AC_CONFIG_FILES([config_host.mk Makefile lo.xcent instsetoo_native/util/openoffice.lst])
11894 AC_CONFIG_HEADERS([config_host/config_clang.h])
11895 AC_CONFIG_HEADERS([config_host/config_features.h])
11896 AC_CONFIG_HEADERS([config_host/config_global.h])
11897 AC_CONFIG_HEADERS([config_host/config_graphite.h])
11898 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
11899 AC_CONFIG_HEADERS([config_host/config_mpl.h])
11900 AC_CONFIG_HEADERS([config_host/config_kde4.h])
11901 AC_CONFIG_HEADERS([config_host/config_mingw.h])
11902 AC_CONFIG_HEADERS([config_host/config_oox.h])
11903 AC_CONFIG_HEADERS([config_host/config_telepathy.h])
11904 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
11905 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
11906 AC_CONFIG_HEADERS([config_host/config_version.h])
11907 AC_OUTPUT
11909 if test "$CROSS_COMPILING" = YES; then
11910     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
11913 # touch the config timestamp file
11914 if test ! -f config_host.mk.stamp; then
11915     echo > config_host.mk.stamp
11916 elif test "$config_md5" = `$MD5SUM config_host.mk | sed "s/ .*//"`; then
11917     echo "Configuration unchanged - avoiding scp2 stamp update"
11918 else
11919     echo > config_host.mk.stamp
11923 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
11924 cat << _EOS
11925 ****************************************************************************
11926 WARNING:
11927 Your make version is known to be horribly slow, and hard to debug
11928 problems with. To get a reasonably functional make please do:
11930 to install a pre-compiled binary make for cygwin
11932 mkdir -p /opt/lo/bin
11933 cd /opt/lo/bin
11934 wget http://dev-www.libreoffice.org/bin/cygwin/make
11935 chmod +x make
11937 to install from source:
11938 place yourself in a working directory of you choice.
11940 git clone git://anongit.freedesktop.org/libreoffice/contrib/dev-tools
11941 cd dev-tools/make-3.82-gbuild
11942 ./configure --prefix=/opt/lo
11943 make
11944 sudo make install
11946 Then re-run autogen.sh
11948 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
11949 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
11951 _EOS
11954 cat << _EOF
11955 ****************************************************************************
11956 To build, issue:
11957 $GNUMAKE
11959 run: $GNUMAKE help
11960 for details
11962 _EOF
11964 if test $_os != WINNT -a "$CROSS_COMPILING" != YES; then
11965     cat << _EOF
11967 To install when the build is finished, issue:
11968 $GNUMAKE install
11970 If you want to develop LibreOffice, you might prefer:
11971 $GNUMAKE dev-install
11973 If you want to run the smoketest, issue:
11974 $GNUMAKE check
11976 _EOF
11979 if test -f warn; then
11980     cat warn
11981     rm warn
11984 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: