Bump version to 4.2-29
[LibreOffice.git] / configure.ac
blobfac5eb4f28ce53b62f5832604b10e25e813458e5
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.2.10.29],[],[],[https://libreoffice-from-collabora.com/])
14 AC_PREREQ([2.59])
16 if test -n "$BUILD_TYPE"; then
17     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
20 save_CC=$CC
21 save_CXX=$CXX
23 BUILD_TYPE="LibO"
24 SCPDEFS=""
25 GIT_NEEDED_SUBMODULES=""
26 LO_PATH= # used by path_munge to construct a PATH variable
28 PathFormat()
30     formatted_path="$1"
31     if test "$build_os" = "cygwin"; then
32         pf_part1=
33         pf_conv_to_dos=
34         for pf_part in $formatted_path; do
35             if test -z "$pf_part1"; then
36                 pf_part1="$pf_part"
37             else
38                 pf_conv_to_dos="yes"
39             fi
40         done
41         if test "$pf_conv_to_dos" = "yes"; then
42             formatted_path=`cygpath -d "$formatted_path"`
43             if test $? -ne 0;  then
44                 AC_MSG_ERROR([path conversion failed for "$1".])
45             fi
46         fi
47         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
48         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
49         if test "$fp_count_slash$fp_count_colon" != "00"; then
50             if test "$fp_count_colon" = "0"; then
51                 formatted_path=`realpath "$formatted_path"`
52                 if test $? -ne 0;  then
53                     AC_MSG_ERROR([realpath failed for "$1".])
54                 fi
55             fi
56             formatted_path=`cygpath -m "$formatted_path"`
57             if test $? -ne 0;  then
58                 AC_MSG_ERROR([path conversion failed for "$1".])
59             fi
60         fi
61     fi
64 rm -f warn
65 have_WARNINGS="no"
66 add_warning()
68     if test "$have_WARNINGS" = "no"; then
69         echo "*************************************" > warn
70         have_WARNINGS="yes"
71         if which tput >/dev/null 2>/dev/null && test `tput colors` -ge 8; then
72             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
73             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
74         else
75             COLORWARN="* WARNING :"
76         fi
77     fi
78     echo "$COLORWARN $@" >> warn
81 echo "********************************************************************"
82 echo "*"
83 echo "*   Running ${PACKAGE_NAME} build configuration."
84 echo "*"
85 echo "********************************************************************"
86 echo ""
88 dnl ===================================================================
89 dnl checks build and host OSes
90 dnl do this before argument processing to allow for platform dependent defaults
91 dnl ===================================================================
92 AC_CANONICAL_HOST
94 AC_MSG_CHECKING([for product name])
95 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
96     PRODUCTNAME=AC_PACKAGE_NAME"Dev"
97 else
98     PRODUCTNAME=AC_PACKAGE_NAME
100 AC_MSG_RESULT([$PRODUCTNAME])
101 AC_SUBST(PRODUCTNAME)
103 dnl ===================================================================
104 dnl Our version is defined by the AC_INIT() at the top of this script.
105 dnl ===================================================================
107 set `echo AC_PACKAGE_VERSION | sed "s/\./ /g"`
109 LIBO_VERSION_MAJOR=$1
110 LIBO_VERSION_MINOR=$2
111 LIBO_VERSION_MICRO=$3
112 LIBO_VERSION_PATCH=$4
114 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
115 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
116 # no way to encode that into an integer in general.
117 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
119 LIBO_VERSION_SUFFIX=$5
120 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
121 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
122 # they get undoubled before actually passed to sed.
123 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
124 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
125 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
126 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
128 AC_SUBST(LIBO_VERSION_MAJOR)
129 AC_SUBST(LIBO_VERSION_MINOR)
130 AC_SUBST(LIBO_VERSION_MICRO)
131 AC_SUBST(LIBO_VERSION_PATCH)
132 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
133 AC_SUBST(LIBO_VERSION_SUFFIX)
134 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
136 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
137 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
138 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
139 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
141 LIBO_THIS_YEAR=`date +%Y`
142 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
144 # This UPD silly thing must go away soon
145 UPD="${LIBO_VERSION_MAJOR}${LIBO_VERSION_MINOR}0"
146 AC_SUBST(UPD)
148 # This too should go away
149 SOURCEVERSION="OOO$UPD"
150 AC_SUBST(SOURCEVERSION)
152 dnl ===================================================================
153 dnl Product version
154 dnl ===================================================================
155 AC_MSG_CHECKING([for product version])
156 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
157 AC_MSG_RESULT([$PRODUCTVERSION])
158 AC_SUBST(PRODUCTVERSION)
160 AC_PROG_EGREP
161 # AC_PROG_EGREP doesn't set GREP on all systems as well
162 AC_PATH_PROG(GREP, grep)
164 BUILDDIR=`pwd`
165 cd $srcdir
166 SRC_ROOT=`pwd`
167 cd $BUILDDIR
168 x_Cygwin=[\#]
170 if test "$build_os" = "cygwin"; then
171     PathFormat "$SRC_ROOT"
172     SRC_ROOT="$formatted_path"
173     PathFormat "$BUILDDIR"
174     BUILDDIR="$formatted_path"
175     x_Cygwin=
178 AC_SUBST(SRC_ROOT)
179 AC_SUBST(BUILDDIR)
180 AC_SUBST(x_Cygwin)
181 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
182 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
184 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
185     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
188 # need sed in os checks...
189 AC_PATH_PROGS(SED, sed)
190 if test -z "$SED"; then
191     AC_MSG_ERROR([install sed to run this script])
194 dnl ===================================================================
195 dnl When building for Android, --with-android-ndk,
196 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
197 dnl mandatory
198 dnl ===================================================================
200 AC_ARG_WITH(android-ndk,
201     AS_HELP_STRING([--with-android-ndk],
202         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
205 AC_ARG_WITH(android-ndk-toolchain-version,
206     AS_HELP_STRING([--with-android-ndk-toolchain-version],
207         [Specify which toolchain version to use, of those present in the
208         Android NDK you are using. Mandatory if the NDK used has several
209         toolchain versions for the host architecture you are building for.]), ,)
211 AC_ARG_WITH(android-sdk,
212     AS_HELP_STRING([--with-android-sdk],
213         [Specify location of the Android SDK. Mandatory when building for Android,
214         or when building the Impress Remote Android app.]),
217 ANDROID_NDK_HOME=
218 if test -n "$with_android_ndk"; then
219     ANDROID_NDK_HOME=$with_android_ndk
221     # Set up a lot of pre-canned defaults
223     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
224         AC_MSG_ERROR([Unrecognized Android NDK. Only r8* versions supported.])
225     fi
226     ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
228     case $ANDROID_NDK_VERSION in
229     r8*|r9*)
230         ;;
231     *)
232         AC_MSG_ERROR([Unsupported NDK version $ANDROID_NDK_VERSION, only r8* and r9* versions are supported])
233         ;;
234     esac
236     if test $host_cpu = arm; then
237         android_cpu=arm
238         android_platform_prefix=$android_cpu-linux-androideabi
239     elif test $host_cpu = mips; then
240         android_cpu=mips
241         android_platform_prefix=$android_cpu-linux-androideabi
242     else
243         # host_cpu is something like "i386" or "i686" I guess, NDK uses
244         # "x86" in some contexts
245         android_cpu=x86
246         android_platform_prefix=$android_cpu
247     fi
249     case "$with_android_ndk_toolchain_version" in
250     4.6|4.7|4.8)
251         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$with_android_ndk_toolchain_version
252         ANDROID_COMPILER_DIR=$ANDROID_BINUTILS_DIR
253         ;;
254     clang3.1|clang3.2)
255         AC_MSG_WARN([Building with the Clang tool-chain is known to break in the bridges module, fix that please])
256         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-4.6
257         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm-${with_android_ndk_toolchain_version#clang}
258         ANDROID_USING_CLANG=true
259         ;;
260     esac
262     if test ! -d $ANDROID_BINUTILS_DIR; then
263         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
264     elif test $ANDROID_COMPILER_DIR != $ANDROID_BINUTILS_DIR -a ! -d $ANDROID_COMPILER_DIR; then
265         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
266     fi
268     # Check if there is a 64-bit tool-chain. Google provides a NDK with 64-bit tool-chain binaries in
269     # NDK r8e and later, and for earlier NDKs it was possible to build one yourself. Using a 64-bit
270     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
271     # manage to link the (app-specific) single huge .so that is built for the apps in
272     # android/experimental/* if there is debug information in a significant part of the object files.
273     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
274     # all objects have been built with debug information.)
275     toolchain_system='*'
276     if test $build_os = linux-gnu; then
277         ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/linux-x86/bin
278         ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/linux-x86
279         if test $build_cpu = x86_64; then
280             if test -d $ANDROID_COMPILER_DIR/prebuilt/linux-x86_64; then
281                 ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/linux-x86_64/bin
282             fi
283             if test -d $ANDROID_BINUTILS_DIR/prebuilt/linux-x86_64; then
284                 ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/linux-x86_64
285             fi
286         fi
287         ANDROID_BINUTILS_BIN=$ANDROID_BINUTILS_PREBUILT_ROOT/bin
288     fi
290     # This stays empty if there is just one version of the toolchain in the NDK
291     ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=
292     case "`echo $ANDROID_NDK_HOME/toolchains/$android_cpu*-*/prebuilt/*/bin`" in
293     */bin\ */bin*)
294         # Trailing slash intentional and necessary, compare to how this is used
295         if test -n "$ANDROID_USING_CLANG"; then
296             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=4.6/
297         else
298             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
299         fi
300         ;;
301     esac
303     if test $host_cpu = arm; then
304        android_gnu_prefix=arm-linux-androideabi
305     elif test $host_cpu = mips; then
306        android_gnu_prefix=mipsel-linux-android
307     elif test $ANDROID_NDK_VERSION = r8; then
308         # The prefix used for the x86 tool-chain changed between NDK r8 and r8b
309         android_gnu_prefix=i686-android-linux
310     else
311         android_gnu_prefix=i686-linux-android
312     fi
314     test -z "$SYSBASE" && export SYSBASE=$ANDROID_NDK_HOME/platforms/android-9/arch-$android_cpu
315     test -z "$AR" && AR=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ar
316     test -z "$NM" && NM=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-nm
317     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-objdump
318     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ranlib
319     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-strip
321     if test $host_cpu = arm; then
322         ANDROID_APP_ABI=armeabi-v7a
323         if test -n "$ANDROID_USING_CLANG"; then
324             ANDROIDCFLAGS="-gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT"
325             ANDROIDCFLAGS="$ANDROIDCFLAGS -target armv7-none-linux-androideabi"
326             ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes"
327         else
328             :
329         fi
330         ANDROIDCFLAGS="$ANDROIDCFLAGS -mthumb"
331         ANDROIDCFLAGS="$ANDROIDCFLAGS -march=armv7-a -mfloat-abi=softfp -mfpu=neon"
332     elif test $host_cpu = mips; then
333         ANDROID_APP_ABI=mips
334         ANDROIDCFLAGS=""
335     else # x86
336         ANDROID_APP_ABI=x86
337         ANDROIDCFLAGS="-march=atom"
338     fi
339     ANDROIDCFLAGS="$ANDROIDCFLAGS -ffunction-sections"
340     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/$ANDROID_APP_ABI"
341     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot $ANDROID_NDK_HOME/platforms/android-9/arch-$android_cpu"
342     ANDROIDCFLAGS="$ANDROIDCFLAGS -Wl,--fix-cortex-a8"
344     if test -n "$ANDROID_USING_CLANG"; then
345         ANDROIDCFLAGS="$ANDROIDCFLAGS -Qunused-arguments"
346     else
347         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wno-psabi"
348     fi
350     # When using the 4.6 or newer toolchain, use the gold linker
351     case "$with_android_ndk_toolchain_version" in
352     4.[[6789]]*|[[56789]].*|clang*)
353         # The NDK doesn't have ld.gold for MIPS for some reason
354         if test "$host_cpu" != mips; then
355             ANDROIDCFLAGS="$ANDROIDCFLAGS -fuse-ld=gold"
356         fi
357         ;;
358     esac
360     # gdbserver can be in different locations
361     if test -f $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver; then
362         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver
363     elif test -f $ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver; then
364         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver
365     else
366         AC_MSG_ERROR([Can't find gdbserver for your Android target])
367     fi
369     if test $host_cpu = arm; then
370         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"
371     elif test $host_cpu = mips; then
372         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"
373     else # x86
374         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"
375     fi
377     if test -z "$CC"; then
378         case "$with_android_ndk_toolchain_version" in
379         4.*)
380             CC="$ANDROID_COMPILER_BIN/$android_gnu_prefix-gcc $ANDROIDCFLAGS"
381             ;;
382         clang*)
383             CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
384         esac
385     fi
386     if test -z "$CXX"; then
387         case "$with_android_ndk_toolchain_version" in
388         4.*)
389             CXX="$ANDROID_COMPILER_BIN/$android_gnu_prefix-g++ $ANDROIDCXXFLAGS"
390             ;;
391         clang*)
392             CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
393             ;;
394         esac
395     fi
397 AC_SUBST(ANDROID_NDK_GDBSERVER)
398 AC_SUBST(ANDROID_APP_ABI)
400 dnl ===================================================================
401 dnl Also --with-android-sdk is mandatory
402 dnl ===================================================================
403 ANDROID_SDK_HOME=
404 if test -n "$with_android_sdk"; then
405     ANDROID_SDK_HOME=$with_android_sdk
406     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
408 AC_SUBST(ANDROID_SDK_HOME)
410 dnl ===================================================================
411 dnl The following is a list of supported systems.
412 dnl Sequential to keep the logic very simple
413 dnl These values may be checked and reset later.
414 dnl ===================================================================
415 #defaults unless the os test overrides this:
416 test_randr=yes
417 test_xrender=yes
418 test_cups=yes
419 test_dbus=yes
420 test_fontconfig=yes
421 test_cairo=no
423 # Default values, as such probably valid just for Linux, set
424 # differently below just for Mac OSX,but at least better than
425 # hardcoding these as we used to do. Much of this is duplicated also
426 # in solenv for old build system and for gbuild, ideally we should
427 # perhaps define stuff like this only here in configure.ac?
429 LINKFLAGSSHL="-shared"
430 PICSWITCH="-fpic"
431 DLLPOST=".so"
433 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
435 INSTROOTSUFFIX=
436 SDKDIRNAME=sdk
438 case "$host_os" in
440 solaris*)
441     test_gtk=yes
442     build_gstreamer=yes
443     build_gstreamer_0_10=yes
444     test_tde=yes
445     test_kde=yes
446     test_freetype=yes
447     test_gstreamer=yes
448     _os=SunOS
450     dnl ===========================================================
451     dnl Check whether we're using Solaris 10 - SPARC or Intel.
452     dnl ===========================================================
453     AC_MSG_CHECKING([the Solaris operating system release])
454     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
455     if test "$_os_release" -lt "10"; then
456         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
457     else
458         AC_MSG_RESULT([ok ($_os_release)])
459     fi
461     dnl Check whether we're using a SPARC or i386 processor
462     AC_MSG_CHECKING([the processor type])
463     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
464         AC_MSG_RESULT([ok ($host_cpu)])
465     else
466         AC_MSG_ERROR([only SPARC and i386 processors are supported])
467     fi
468     ;;
470 linux-gnu*|k*bsd*-gnu*)
471     test_gtk=yes
472     build_gstreamer=yes
473     build_gstreamer_0_10=yes
474     test_tde=yes
475     test_kde=yes
476     test_kde4=yes
477     test_freetype=yes
478     _os=Linux
479     ;;
481 gnu)
482     test_randr=no
483     test_xrender=no
484     _os=GNU
485      ;;
487 cygwin*|interix*|mingw32*)
489     # When building on Windows normally with MSVC under Cygwin,
490     # configure thinks that the host platform (the platform the
491     # built code will run on) is Cygwin, even if it obviously is
492     # Windows, which in Autoconf terminology is called
493     # "mingw32". (Which is misleading as MinGW is the name of the
494     # tool-chain, not an operating system.)
496     # Somewhat confusing, yes. But this configure script doesn't
497     # look at $host etc that much, it mostly uses its own $_os
498     # variable, set here in this case statement.
500     # When cross-compiling to Windows from Unix, the host platform
501     # is "mingw32" (because in that case it is the MinGW
502     # tool-chain that is used).
504     test_cups=no
505     test_dbus=no
506     test_randr=no
507     test_xrender=no
508     test_freetype=no
509     test_fontconfig=no
510     _os=WINNT
512     DLLPOST=".dll"
513     LINKFLAGSNOUNDEFS=
515     # If the host OS matches "mingw32*", that means we are using the
516     # MinGW cross-compiler, because we don't see the point in building
517     # LibreOffice using MinGW on Windows. If you want to build on
518     # Windows, use MSVC. If you want to use MinGW, surely you want to
519     # cross-compile (from Linux or some other Unix).
521     case "$host_os" in
522     mingw32*)
523         WITH_MINGW=yes
524         if test -z "$CC"; then
525             CC="$host_cpu-$host_vendor-$host_os-gcc"
526         fi
527         if test -z "$CXX"; then
528             CXX="$host_cpu-$host_vendor-$host_os-g++"
529         fi
530         ;;
531     esac
532     ;;
534 darwin*) # Mac OS X or iOS
535     test_gtk=yes
536     test_randr=no
537     test_xrender=no
538     test_freetype=no
539     test_fontconfig=no
540     test_dbus=no
541     if test "$host_cpu" = "arm"; then
542         _os=iOS
543         test_gtk=no
544         test_cups=no
545     else
546         _os=Darwin
547         INSTROOTSUFFIX=/$PRODUCTNAME.app/Contents
548         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
549     fi
550     enable_systray=no
551     # See comment above the case "$host_os"
552     LINKFLAGSSHL="-dynamiclib -single_module"
554     # -fPIC is default
555     PICSWITCH=""
557     DLLPOST=".dylib"
559     # -undefined error is the default
560     LINKFLAGSNOUNDEFS=""
563 freebsd*)
564     test_gtk=yes
565     build_gstreamer=yes
566     build_gstreamer_0_10=yes
567     test_tde=yes
568     test_kde=yes
569     test_kde4=yes
570     test_freetype=yes
571     AC_MSG_CHECKING([the FreeBSD operating system release])
572     if test -n "$with_os_version"; then
573         OSVERSION="$with_os_version"
574     else
575         OSVERSION=`/sbin/sysctl -n kern.osreldate`
576     fi
577     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
578     AC_MSG_CHECKING([which thread library to use])
579     if test "$OSVERSION" -lt "500016"; then
580         PTHREAD_CFLAGS="-D_THREAD_SAFE"
581         PTHREAD_LIBS="-pthread"
582     elif test "$OSVERSION" -lt "502102"; then
583         PTHREAD_CFLAGS="-D_THREAD_SAFE"
584         PTHREAD_LIBS="-lc_r"
585     else
586         PTHREAD_CFLAGS=""
587         PTHREAD_LIBS="-pthread"
588     fi
589     AC_MSG_RESULT([$PTHREAD_LIBS])
590     _os=FreeBSD
591     ;;
593 *netbsd*)
594     test_gtk=yes
595     build_gstreamer=yes
596     build_gstreamer_0_10=yes
597     test_tde=no
598     test_kde=no
599     test_kde4=yes
600     test_freetype=yes
601     PTHREAD_LIBS="-pthread -lpthread"
602     _os=NetBSD
603     ;;
605 aix*)
606     test_randr=no
607     test_freetype=yes
608     PTHREAD_LIBS=-pthread
609     _os=AIX
610     ;;
612 openbsd*)
613     test_gtk=yes
614     test_tde=yes
615     test_kde=yes
616     test_freetype=yes
617     PTHREAD_CFLAGS="-D_THREAD_SAFE"
618     PTHREAD_LIBS="-pthread"
619     _os=OpenBSD
620     ;;
622 dragonfly*)
623     test_gtk=yes
624     build_gstreamer=yes
625     build_gstreamer_0_10=yes
626     test_tde=yes
627     test_kde=yes
628     test_kde4=yes
629     test_freetype=yes
630     PTHREAD_LIBS="-pthread"
631     _os=DragonFly
632     ;;
634 linux-android*)
635     build_gstreamer=no
636     build_gstreamer_0_10=no
637     enable_lotuswordpro=no
638     enable_mpl_subset=yes
639     enable_opengl=no
640     enable_coinmp=no
641     enable_lpsolve=no
642     enable_report_builder=no
643     with_theme="tango"
644     test_cups=no
645     test_dbus=no
646     test_fontconfig=no
647     test_freetype=no
648     test_gtk=no
649     test_tde=no
650     test_kde=no
651     test_kde4=no
652     test_randr=no
653     test_xrender=no
654     _os=Android
656     if test -z "$with_android_ndk"; then
657         AC_MSG_ERROR([the --with-android-ndk option is mandatory])
658     fi
660     if test -z "$with_android_ndk_toolchain_version"; then
661         AC_MSG_ERROR([the --with-android-ndk-toolchain-version option is mandatory])
662     fi
664     # Verify that the NDK and SDK options are proper
665     if test ! -f "$ANDROID_NDK_HOME/platforms/android-9/arch-arm/usr/lib/libc.a"; then
666         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
667     fi
669     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
670     BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
671     ;;
674     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
675     ;;
676 esac
678 if echo "$host_os" | grep -q linux-android || test "$enable_sdremote_android" = "yes"; then
679     if test -z "$with_android_sdk"; then
680         AC_MSG_ERROR([the --with-android-sdk option is mandatory])
681     fi
683     if test ! -d "$ANDROID_SDK_HOME/platforms"; then
684         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
685     fi
688 if test "$_os" = "AIX"; then
689     AC_PATH_PROG(GAWK, gawk)
690     if test -z "$GAWK"; then
691         AC_MSG_ERROR([gawk not found in \$PATH])
692     fi
695 AC_SUBST(SDKDIRNAME)
697 AC_SUBST(WITH_MINGW)
698 AC_SUBST(PTHREAD_CFLAGS)
699 AC_SUBST(PTHREAD_LIBS)
701 ###############################################################################
702 # Extensions switches --enable/--disable
703 ###############################################################################
704 # By default these should be enabled unless having extra dependencies.
705 # If there is extra dependency over configure options then the enable should
706 # be automagic based on whether the requiring feature is enabled or not.
707 # All this options change anything only with --enable-extension-integration.
709 # The name of this option and its help string makes it sound as if
710 # extensions are built anyway, just not integrated in the installer,
711 # if you use --disable-extension-integration. Is that really the
712 # case?
714 AC_ARG_ENABLE(extension-integration,
715     AS_HELP_STRING([--disable-extension-integration],
716         [Disable integration of the built extensions in the installer of the
717          product. Use this switch to disable the integration.])
720 AC_ARG_ENABLE(export,
721     AS_HELP_STRING([--disable-export],
722         [Disable (some) code for document export. Useful when building viewer-only apps that lack
723          save/export functionality, to avoid having an excessive amount of code and data used
724          only for exporrt linked in. Work in progress, use only if you are hacking on it.])
727 AC_ARG_ENABLE(database-connectivity,
728     AS_HELP_STRING([--disable-database-connectivity],
729         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
732 # This doesn't mean not building (or "integrating") extensions
733 # (although it probably should; i.e. it should imply
734 # --disable-extension-integration I guess), it means not supporting
735 # any extension mechanism at all
736 AC_ARG_ENABLE(extensions,
737     AS_HELP_STRING([--disable-extensions],
738         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
741 AC_ARG_ENABLE(scripting,
742     AS_HELP_STRING([--disable-scripting],
743         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
746 # This is mainly for Android and iOS, but could potentially be used in some
747 # special case otherwise, too, so factored out as a separate setting
749 AC_ARG_ENABLE(dynamic-loading,
750     AS_HELP_STRING([--disable-dynamic-loading],
751         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
754 AC_ARG_ENABLE(ext-mariadb-connector,
755     AS_HELP_STRING([--enable-ext-mariadb-connector],
756         [Enable the build of the MariaDB/MySQL Connector extension.])
759 AC_ARG_ENABLE(report-builder,
760     AS_HELP_STRING([--disable-report-builder],
761         [Disable the Report Builder.])
764 AC_ARG_ENABLE(ext-wiki-publisher,
765     AS_HELP_STRING([--enable-ext-wiki-publisher],
766         [Enable the Wiki Publisher extension.])
769 AC_ARG_ENABLE(lpsolve,
770     AS_HELP_STRING([--disable-lpsolve],
771         [Disable compilation of the lp solve solver ])
774 AC_ARG_ENABLE(pdfimport,
775     AS_HELP_STRING([--disable-pdfimport],
776         [Disable building the PDF import feature.])
779 ###############################################################################
781 dnl ---------- *** ----------
783 AC_ARG_ENABLE([hardlink-deliver],
784     AS_HELP_STRING([--enable-hardlink-deliver],
785         [Put files into deliver folder as hardlinks instead of copying them
786         over. Saves space and speeds up build.])
789 AC_ARG_ENABLE(mergelibs,
790     AS_HELP_STRING([--enable-mergelibs=<all/yes>],
791         [Enables linking of big, merged, library. Experimental feature tested
792         only for Linux. 'all' will link a lot of libraries into libmerged
793         while 'yes' will do it for just a core set of libraries.])
796 AC_ARG_ENABLE(graphite,
797     AS_HELP_STRING([--enable-graphite],
798         [Enables the compilation of Graphite smart font rendering.])
801 AC_ARG_ENABLE(orcus,
802     AS_HELP_STRING([--enable-orcus],
803         [Enables orcus for extra file import filters for Calc.])
806 AC_ARG_ENABLE(fetch-external,
807     AS_HELP_STRING([--disable-fetch-external],
808         [Disables fetching external tarballs from web sources.])
811 AC_ARG_ENABLE(lockdown,
812     AS_HELP_STRING([--disable-lockdown],
813         [Disables the gconf integration work in LibreOffice.]),
816 AC_ARG_ENABLE(vba,
817     AS_HELP_STRING([--disable-vba],
818         [Disables the vba compatibility feature.])
821 AC_ARG_ENABLE(pch,
822     AS_HELP_STRING([--enable-pch],
823         [Enables precompiled header support for C++.])
826 AC_ARG_ENABLE(win-mozab-driver,
827     AS_HELP_STRING([--enable-win-mozab-driver],
828         [LibreOffice includes a driver to connect to Mozilla
829          address books under Windows, to build with this version, use this option.])
832 AC_ARG_ENABLE(epm,
833     AS_HELP_STRING([--enable-epm],
834         [LibreOffice includes self-packaging code, that requires epm, however epm is
835          useless for large scale package building.])
838 AC_ARG_ENABLE(odk,
839     AS_HELP_STRING([--disable-odk],
840         [LibreOffice includes an ODK, office development kit which some packagers may
841          wish to build without.])
844 AC_ARG_ENABLE(mpl-subset,
845     AS_HELP_STRING([--enable-mpl-subset],
846         [Don't compile any pieces which are not MPL or more liberally licensed])
849 AC_ARG_ENABLE(evolution2,
850     AS_HELP_STRING([--enable-evolution2],
851         [Allows the built-in evolution 2 addressbook connectivity build to be
852          enabled.])
855 AC_ARG_ENABLE(directx,
856     AS_HELP_STRING([--disable-directx],
857         [Remove DirectX implementation for the new XCanvas interface.
858          The DirectX support requires more stuff installed on Windows to
859          compile. (DirectX SDK, GDI+ libs)])
862 AC_ARG_ENABLE(activex,
863     AS_HELP_STRING([--disable-activex],
864         [Disable the use of ActiveX for a Windows build.
865         This switch is mandatory when using an Express edition of Visual Studio.])
868 AC_ARG_ENABLE(atl,
869     AS_HELP_STRING([--disable-atl],
870         [Disable the use of ATL for a Windows build.])
871     [
872         This switch is mandatory when using an Express edition of Visual Studio.
873     ],
876 AC_ARG_ENABLE(avahi,
877     AS_HELP_STRING([--enable-avahi],
878         [Determines whether to use Avahi to advertise Impress to remote controls.]),
881 AC_ARG_ENABLE(werror,
882     AS_HELP_STRING([--enable-werror],
883         [Turn warnings to errors. (Has no effect in modules where the treating
884          of warnings as errors is disabled explicitly.)]),
887 AC_ARG_ENABLE(assert-always-abort,
888     AS_HELP_STRING([--enable-assert-always-abort],
889         [make assert() abort even in release code.]),
892 AC_ARG_ENABLE(dbgutil,
893     AS_HELP_STRING([--enable-dbgutil],
894         [Provide debugging support from --enable-debug and include additional debugging
895          utilities such as object counting or more expensive checks.
896          This is the recommended option for developers.
897          Note that this makes the build ABI incompatible, it is not possible to mix object
898          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
900 AC_ARG_ENABLE(debug,
901     AS_HELP_STRING([--enable-debug],
902         [Include debugging information, disable compiler optimization and inlining plus
903          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
905 AC_ARG_ENABLE(selective-debuginfo,
906     AS_HELP_STRING([--enable-selective-debuginfo],
907         [If --enable-debug or --enable-dbgutil is used, build debugging information
908          (-g compiler flag) only for the specified gbuild build targets
909          (where all means everything, - prepended means not to enable, / appended means
910          everything in the directory; there is no ordering, more specific overrides
911          more general, and disabling takes precedence).
912          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
914 AC_ARG_ENABLE(symbols,
915     AS_HELP_STRING([--enable-symbols],
916         [Include debugging symbols in output while preserve optimization.
917          This enables -g compiler flag for GCC or equivalent,
918          without changing anything else compared to productive code.]))
920 AC_ARG_ENABLE(compiler-plugins,
921     AS_HELP_STRING([--enable-compiler-plugins],
922         [Enable compiler plugins that will perform additional checks during
923          building. Enabled automatically by --enable-dbgutil.]))
925 AC_ARG_ENABLE(ooenv,
926     AS_HELP_STRING([--disable-ooenv],
927         [Disable ooenv for the instdir installation.]))
929 AC_ARG_ENABLE(lto,
930     AS_HELP_STRING([--enable-lto],
931         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
932          longer but libraries and executables are optimized for speed. (For GCC, best to use GCC 4.6
933          or later and 'gold' linker. Works fine (and is turned on automatically in an optimising
934          build) for MSVC, otherwise experimental work in progress that shouldn't be used unless you
935          are working on it.)]))
937 AC_ARG_ENABLE(crashdump,
938     AS_HELP_STRING([--enable-crashdump],
939         [Enable the crashdump feature.]))
941 AC_ARG_ENABLE(python,
942     AS_HELP_STRING([--enable-python=<no/auto/system/internal>],
943         [Enables or disables Python support at run-time and build-time.
944          Also specifies what Python to use. 'auto' is the
945          default. Note that Python can be disabled with
946          --disable-python or --enable-python=no only if no
947          translations are required.]))
949 AC_ARG_ENABLE(gtk,
950     AS_HELP_STRING([--disable-gtk],
951         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
952 ,enable_gtk=yes)
954 AC_ARG_ENABLE(gtk3,
955     AS_HELP_STRING([--enable-gtk3],
956         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
957 ,enable_gtk3=no)
959 AC_ARG_ENABLE(systray,
960     AS_HELP_STRING([--disable-systray],
961         [Determines whether to build the systray quickstarter.]),
962 ,enable_systray=yes)
964 AC_ARG_ENABLE(split-app-modules,
965     AS_HELP_STRING([--enable-split-app-modules],
966         [Split file lists for app modules, e.g. base, calc.
967          Has effect only with make distro-pack-install]),
970 AC_ARG_ENABLE(split-opt-features,
971     AS_HELP_STRING([--enable-split-opt-features],
972         [Split file lists for some optional features, .e.g. pyuno, testtool.
973          Has effect only with make distro-pack-install]),
976 AC_ARG_ENABLE(cairo-canvas,
977 [  --disable-cairo-canvas  Determines whether to build the Cairo canvas on
978                           platforms where Cairo is available.
981 AC_ARG_ENABLE(opengl,
982     AS_HELP_STRING([--disable-opengl],
983         [Determines whether to build the OpenGL 3D slide transitions and canvas component.]))
985 AC_ARG_ENABLE(opencl,
986     AS_HELP_STRING([--disable-opencl],
987         [Determines whether to build with OpenCL support.]))
989 AC_ARG_ENABLE(dbus,
990     AS_HELP_STRING([--disable-dbus],
991         [Determines whether to enable features that depend on dbus.
992          e.g. Presentation mode screensaver control, bluetooth presentation control]),
993 ,enable_dbus=yes)
995 AC_ARG_ENABLE(packagekit,
996     AS_HELP_STRING([--enable-packagekit],
997         [Determines whether to enable features using packagekit.
998          Right now that is auto font install]),
1001 AC_ARG_ENABLE(sdremote,
1002     AS_HELP_STRING([--disable-sdremote],
1003         [Determines whether to enable Impress remote control (i.e. the server component).]),
1004 ,enable_sdremote=yes)
1006 AC_ARG_ENABLE(sdremote-bluetooth,
1007     AS_HELP_STRING([--disable-sdremote-bluetooth],
1008         [Determines whether to build sdremote with bluetooth support.
1009          Requires dbus on Linux.]))
1011 AC_ARG_ENABLE(sdremote-android,
1012     AS_HELP_STRING([--enable-sdremote-android],
1013         [Determines whether to build the Impress Remote Android app -- requires
1014         a correctly configured android sdk.]),
1015 ,enable_sdremote_android=no)
1017 AC_ARG_ENABLE(gconf,
1018     AS_HELP_STRING([--disable-gconf],
1019         [Determines whether to use the GConf support.]),
1020 ,enable_gconf=yes)
1022 AC_ARG_ENABLE(gnome-vfs,
1023     AS_HELP_STRING([--enable-gnome-vfs],
1024         [Determines whether to use the Gnome Virtual Filing System on platforms
1025          where that VFS is available.]),
1026 ,enable_gnome_vfs=no)
1028 AC_ARG_ENABLE(gio,
1029     AS_HELP_STRING([--disable-gio],
1030         [Determines whether to use the GIO support.]),
1031 ,enable_gio=yes)
1033 AC_ARG_ENABLE(telepathy,
1034     AS_HELP_STRING([--enable-telepathy],
1035         [Determines whether to enable Telepathy for collaboration.]),
1036 ,enable_telepathy=no)
1038 AC_ARG_ENABLE(tde,
1039     AS_HELP_STRING([--enable-tde],
1040         [Determines whether to use TQt/TDE vclplug on platforms where TQt and
1041          TDE are available.]),
1044 AC_ARG_ENABLE(tdeab,
1045     AS_HELP_STRING([--disable-tdeab],
1046         [Disable the TDE address book support.]),
1048     if test "$enable_tde" = "yes"; then
1049         enable_tdeab=yes
1050     fi
1053 AC_ARG_ENABLE(kde,
1054     AS_HELP_STRING([--enable-kde],
1055         [Determines whether to use Qt3/KDE3 vclplug on platforms where Qt3 and
1056          KDE3 are available.]),
1059 AC_ARG_ENABLE(kdeab,
1060     AS_HELP_STRING([--disable-kdeab],
1061         [Disable the KDE3 address book support.]),
1063     if test "$enable_kde" = "yes"; then
1064         enable_kdeab=yes
1065     fi
1068 AC_ARG_ENABLE(kde4,
1069     AS_HELP_STRING([--enable-kde4],
1070         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1071          KDE4 are available. May be used with --enable-kde if you want to support
1072          both KDE3 and KDE4.]),
1075 AC_ARG_ENABLE(headless,
1076     AS_HELP_STRING([--enable-headless],
1077         [Disable building of GUIs to reduce dependencies. Useful for
1078         server usage. Work in progress, use only if you are hacking on
1079         it. Not related to the --headless option.]), ,)
1081 AC_ARG_ENABLE(randr,
1082     AS_HELP_STRING([--disable-randr],
1083         [Disable RandR support in the vcl project.]),
1084 ,enable_randr=yes)
1086 AC_ARG_ENABLE(randr-link,
1087     AS_HELP_STRING([--disable-randr-link],
1088         [Disable linking with libXrandr, instead dynamically open it at runtime.]),
1089 ,enable_randr_link=yes)
1091 AC_ARG_ENABLE(gstreamer,
1092     AS_HELP_STRING([--enable-gstreamer],
1093         [Enable building with the new gstreamer 1.0 avmedia backend.]),
1094 ,enable_gstreamer=no)
1096 AC_ARG_ENABLE(gstreamer-0-10,
1097     AS_HELP_STRING([--disable-gstreamer-0-10],
1098         [Disable building the gstreamer avmedia backend.]),
1099 ,enable_gstreamer_0_10=yes)
1101 AC_ARG_ENABLE(vlc,
1102     AS_HELP_STRING([--enable-vlc],
1103         [Enable building with the VLC avmedia backend.]),
1104 ,enable_vlc=no)
1106 AC_ARG_ENABLE(neon,
1107     AS_HELP_STRING([--disable-neon],
1108         [Disable neon and the compilation of webdav binding.]),
1111 AC_ARG_ENABLE([eot],
1112     [AS_HELP_STRING([--enable-eot],
1113         [Enable support for Embedded OpenType fonts.])],
1114 , [enable_eot=no])
1116 AC_ARG_ENABLE(cve-tests,
1117     AS_HELP_STRING([--disable-cve-tests],
1118         [Prevent CVE tests to be executed]),
1121 AC_ARG_ENABLE(build-unowinreg,
1122     AS_HELP_STRING([--enable-build-unowinreg],
1123         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1124          compiler is needed on Linux.])
1125     [
1126                           Usage:     --enable-build-unowinreg
1127     ],
1130 AC_ARG_ENABLE(verbose,
1131     AS_HELP_STRING([--enable-verbose],
1132         [Increase build verbosity.])[
1133   --disable-verbose       Decrease build verbosity.],
1136 AC_ARG_ENABLE(dependency-tracking,
1137     AS_HELP_STRING([--enable-dependency-tracking],
1138         [Do not reject slow dependency extractors.])[
1139   --disable-dependency-tracking
1140                           Disables generation of dependency information.
1141                           Speed up one-time builds.],
1144 AC_ARG_ENABLE(icecream,
1145     AS_HELP_STRING([--enable-icecream],
1146         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1147          It defaults to /opt/icecream for the location of the icecream gcc/g++
1148          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1151 AC_ARG_ENABLE(cups,
1152     AS_HELP_STRING([--disable-cups],
1153         [Do not build cups support.])
1156 AC_ARG_ENABLE(ccache,
1157     AS_HELP_STRING([--disable-ccache],
1158         [Do not try to use ccache automatically.
1159          By default, we will try to detect if ccache is available; in that case if
1160          CC/CXX are not yet set, and --enable-icecream is not given, we
1161          attempt to use ccache. --disable-ccache disables ccache completely.
1165 AC_ARG_ENABLE(64-bit,
1166     AS_HELP_STRING([--enable-64-bit],
1167         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit. Works fine for OS
1168          X. In other cases this option is experimental and possibly quite broken, use only if you are
1169          hacking on 64-bit support.]), ,)
1171 AC_ARG_ENABLE(extra-gallery,
1172     AS_HELP_STRING([--enable-extra-gallery],
1173         [Add extra gallery content.]),
1176 AC_ARG_ENABLE(extra-template,
1177     AS_HELP_STRING([--enable-extra-template],
1178         [Add extra template content.]),
1181 AC_ARG_ENABLE(extra-sample,
1182     AS_HELP_STRING([--enable-extra-sample],
1183         [Add extra sample content.]),
1186 AC_ARG_ENABLE(extra-font,
1187     AS_HELP_STRING([--enable-extra-font],
1188         [Add extra font content.]),
1191 AC_ARG_ENABLE(online-update,
1192     AS_HELP_STRING([--enable-online-update],
1193         [Enable the online update service that will check for new versions of
1194          LibreOffice. By default, it is on on Windows and Mac, and off on Linux.]),
1197 AC_ARG_ENABLE(release-build,
1198     AS_HELP_STRING([--enable-release-build],
1199         [Enable release build.
1200          See http://wiki.documentfoundation.org/DevBuild]),
1203 AC_ARG_ENABLE(windows-build-signing,
1204     AS_HELP_STRING([--enable-windows-build-signing],
1205         [Enable signing of windows binaries (*.exe, *.dll)]),
1208 AC_ARG_ENABLE(silent-msi,
1209     AS_HELP_STRING([--enable-silent-msi],
1210         [Enable MSI with LIMITUI=1 (silent install).]),
1213 AC_ARG_ENABLE(macosx-code-signing,
1214     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1215         [Sign executables, dylibs, frameworks and the app bundle. If you
1216          don't provide an identity the first suitable certificate
1217          in your keychain is used.]),
1220 AC_ARG_ENABLE(macosx-package-signing,
1221     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1222         [Create a .pkg suitable for uploading to the Mac App Store and sign
1223          it. If you don't provide an identity the first suitable certificate
1224          in your keychain is used.]),
1227 AC_ARG_ENABLE(macosx-sandbox,
1228     AS_HELP_STRING([--enable-macosx-sandbox],
1229         [Make the app bundle run in a sandbox. Requires code signing.
1230          Is required by apps distributed in the Mac App Store, and implies
1231          adherence to App Store rules.]),
1234 AC_ARG_WITH(macosx-teamid,
1235     AS_HELP_STRING([--with-macosx-teamid=<teamid>],
1236         [The "team id" to be used for com.apple.application-identifier
1237          in the entitlements when building a sandboxed LibreOffice.]),
1240 AC_ARG_ENABLE(canonical-installation-tree-structure,
1241     AS_HELP_STRING([--enable-canonical-installation-tree-structure],
1242         [Make the installation tree structure be more canonical for
1243          the platform. Implemented only for OS X. Experimental and currently broken.]),
1247 AC_ARG_WITH(macosx-bundle-identifier,
1248     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1249         [Define the OS X bundle identifier. Default is the somewhat weird
1250          org.libreoffice.script ("script", huh?).]),
1251 ,with_macosx_bundle_identifier=org.libreoffice.script)
1253 AC_ARG_WITH(macosx-app-name,
1254     AS_HELP_STRING([--with-macosx-app-name='My Own Office Suite'],
1255         [Define the OS X app name. Default is AC_PACKAGE_NAME.]),
1256 ,with_macosx_app_name=$PRODUCTNAME)
1258 AC_ARG_ENABLE(libc++,
1259     AS_HELP_STRING([--enable-libc++],
1260         [Use the libc++ C++ library instead of GNU libstdc++ on OS X. Only effective
1261          if --with-macosx-version-min-required is 10.7 or later. Experimental work in
1262          progress, very likely breaks something, don't use unless you plan to fix that.]),
1265 AC_ARG_ENABLE(ios-simulator,
1266     AS_HELP_STRING([--enable-ios-simulator],
1267         [Build for the iOS Simulator, not iOS device.]),
1270 AC_ARG_ENABLE(readonly-installset,
1271     AS_HELP_STRING([--enable-readonly-installset],
1272         [Prevents any attempts by LibreOffice to write into its installation. That means
1273          at least that no "system-wide" extensions can be added. Experimental work in
1274          progress.]),
1277 AC_ARG_ENABLE(postgresql-sdbc,
1278     AS_HELP_STRING([--disable-postgresql-sdbc],
1279         [Disable the build of the PostgreSQL-SDBC driver.])
1282 AC_ARG_ENABLE(lotuswordpro,
1283     AS_HELP_STRING([--disable-lotuswordpro],
1284         [Disable the build of the Lotus Word Pro filter.]),
1285 ,enable_lotuswordpro=yes)
1287 AC_ARG_ENABLE(firebird-sdbc,
1288     AS_HELP_STRING([--disable-firebird-sdbc],
1289         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1290 ,enable_firebird_sdbc=yes)
1292 AC_ARG_ENABLE(coretext,
1293     AS_HELP_STRING([--disable-coretext],
1294         [Don't use CoreText on Mac (but the obsolete ATSU instead).
1295          In a 64-bit LibreOffice CoreText is by necessity always used.]),
1298 AC_ARG_ENABLE(winegcc,
1299     AS_HELP_STRING([--enable-winegcc],
1300         [Enable use of winegcc during the build, in order to create msi* tools
1301          needed for MinGW cross-compilation.]),
1304 AC_ARG_ENABLE(liblangtag,
1305     AS_HELP_STRING([--disable-liblangtag],
1306         [Disable use of liblangtag, and instead use an own simple
1307          implementation.]),
1310 AC_ARG_ENABLE(bogus-pkg-config,
1311     AS_HELP_STRING([--enable-bogus-pkg-config],
1312         [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.]),
1315 AC_ARG_ENABLE(openssl,
1316     AS_HELP_STRING([--disable-openssl],
1317         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1318          components will either use GNUTLS or NSS. Work in progress,
1319          use only if you are hacking on it.]),
1320 ,enable_openssl=yes)
1322 AC_ARG_ENABLE(library-bin-tar,
1323     AS_HELP_STRING([--enable-library-bin-tar],
1324         [Enable the building and reused of tarball of binary build for some 'external' libraries
1325         Some libraries can save their build result in a tarball
1326         stored in TARFILE_LOCATION. that binary tarball is
1327         uniquely identified by the source tarbal,
1328         the content of the config_host.mk file and the content
1329         of the top-level directory in core for that library
1330         If this option is enabled, then if such a tarfile exist, it will be untarred
1331         isntead of the source tarfile, and the build step will be skipped for that
1332         library.
1333         If a proper tarfile does not exist, then the normal source-based
1334         build is done for taht library and a proper binary tarfile is created
1335         for the next time.]),
1338 dnl ===================================================================
1339 dnl Optional Packages (--with/without-)
1340 dnl ===================================================================
1342 AC_ARG_WITH(gnu-patch,
1343     AS_HELP_STRING([--with-gnu-patch],
1344         [Specify location of GNU patch on Solaris or FreeBSD.]),
1347 AC_ARG_WITH(build-platform-configure-options,
1348         [Specify options for the configure script run for the *build* platform in a cross-compilation])
1350 AC_ARG_WITH(gnu-cp,
1351     AS_HELP_STRING([--with-gnu-cp],
1352         [Specify location of GNU cp on Solaris or FreeBSD.]),
1355 AC_ARG_WITH(external-tar,
1356     AS_HELP_STRING([--with-external-tar=<TARFILE PATH>],
1357         [Specify path to tarfiles manually.]),
1358     TARFILE_LOCATION=$withval ,
1361 AC_ARG_WITH(referenced-git,
1362     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1363         [Specify another checkout directory to reference. This makes use of
1364                  git submodule update --reference, and saves a lot of diskspace
1365                  when having multiple trees side-by-side.]),
1366     GIT_REFERENCE_SRC=$withval ,
1369 AC_ARG_WITH(linked-git,
1370     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1371         [Specify a directory where the repositories of submodules are located.
1372          This uses a method similar to git-new-workdir to get submodules.]),
1373     GIT_LINK_SRC=$withval ,
1376 AC_ARG_WITH(galleries,
1377     AS_HELP_STRING([--with-galleries],
1378         [Specify how galleries should be built. It is possible either to
1379          build these internally from source ("build"), or to (optionally
1380          download and) unpack them them from a package ("package"), or
1381          to disable them ("no")]),
1384 AC_ARG_WITH(theme,
1385     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1386         [Choose which themes to include. By default those themes with an '*' are included.
1387          Possible choices: *crystal, *default (galaxy), *hicontrast, human, industrial, *oxygen, *sifr, *tango, *tango_testing.]),
1390 AC_ARG_WITH(helppack-integration,
1392   --without-helppack-integration      It will not integrate the helppacks to the installer
1393                           of the product.
1394                           Please use this switch to use the online help or separate help packages.],
1397 AC_ARG_WITH(fonts,
1398     AS_HELP_STRING([--without-fonts],
1399         [LibreOffice includes some third-party fonts to provide a reliable basis for
1400          help content, templates, samples, etc. When these fonts are already
1401          known to be available on the system then you should use this option.]),
1404 AC_ARG_WITH(ppds,
1405     AS_HELP_STRING([--without-ppds],
1406         [Removes Postscript Printer definition files from LibreOffice
1407          installation set, for people building for specific distributions where
1408          PPDs are known to be already available (every recent distro with CUPS backend).]),
1411 AC_ARG_WITH(afms,
1412     AS_HELP_STRING([--without-afms],
1413         [Removes bitmap font files from LibreOffice installation set, for people
1414          building for specific distributions where AFM files or TrueType Fonts
1415          are known to be available.]),
1418 AC_ARG_WITH(epm,
1419     AS_HELP_STRING([--with-epm],
1420         [Decides which epm to use. Default is to use the one from the system if
1421          one is built. When either this is not there or you say =internal epm
1422          will be built.]),
1425 AC_ARG_WITH(package-format,
1426     AS_HELP_STRING([--with-package-format],
1427         [Specify package format(s) for LibreOffice installation sets. The
1428          implicit --without-package-format leads to no installation sets being
1429          generated. Possible values: aix, archive, bsd, deb, dmg,
1430          installed, msi, native, pkg, portable, and rpm.
1431          Example: --with-package-format='deb rpm']),
1434 AC_ARG_WITH(tls,
1435     AS_HELP_STRING([--with-tls],
1436         [Decides which TLS/SSL and cryptographic implementations to use for
1437          LibreOffice's code. Notice that this doesn't apply for depending
1438          libraries like "neon", for example. Default is to use OpenSSL
1439          although NSS is also possible. Notice that selecting NSS restricts
1440          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1441          restrict by now the usage of NSS in LO's code. Possible values:
1442          openssl, nss. Example: --with-tls="nss"]),
1445 AC_ARG_WITH(system-libs,
1446     AS_HELP_STRING([--with-system-libs],
1447         [Use libraries already on system -- enables all --with-system-* flags.]),
1450 AC_ARG_WITH(system-headers,
1451     AS_HELP_STRING([--with-system-headers],
1452         [Use headers already on system -- enables all --with-system-* flags for
1453          external packages whose headers are the only entities used i.e.
1454          boost/vigra/odbc/sane-header(s).]),,
1455     [with_system_headers="$with_system_libs"])
1457 AC_ARG_WITH(system-jars,
1458     AS_HELP_STRING([--without-system-jars],
1459         [When building with --with-system-libs, also the needed jars are expected
1460          on the system. Use this to disable that]),,
1461     [with_system_jars="$with_system_libs"])
1463 AC_ARG_WITH(system-cairo,
1464     AS_HELP_STRING([--with-system-cairo],
1465         [Use cairo libraries already on system.  Happens automatically for
1466          (implicit) --enable-gtk and for --enable-gtk3.]))
1468 AC_ARG_WITH(myspell-dicts,
1469     AS_HELP_STRING([--with-myspell-dicts],
1470         [Adds myspell dictionaries to the LibreOffice installation set]),
1473 AC_ARG_WITH(system-dicts,
1474     AS_HELP_STRING([--without-system-dicts],
1475         [Do not use dictionaries from system paths.]),
1478 AC_ARG_WITH(external-dict-dir,
1479     AS_HELP_STRING([--with-external-dict-dir],
1480         [Specify external dictionary dir.]),
1483 AC_ARG_WITH(external-hyph-dir,
1484     AS_HELP_STRING([--with-external-hyph-dir],
1485         [Specify external hyphenation pattern dir.]),
1488 AC_ARG_WITH(external-thes-dir,
1489     AS_HELP_STRING([--with-external-thes-dir],
1490         [Specify external thesaurus dir.]),
1493 AC_ARG_WITH(system-zlib,
1494     AS_HELP_STRING([--with-system-zlib],
1495         [Use zlib already on system.]),,
1496     [with_system_zlib=auto])
1498 AC_ARG_WITH(system-jpeg,
1499     AS_HELP_STRING([--with-system-jpeg],
1500         [Use jpeg already on system.]),,
1501     [with_system_jpeg=auto])
1503 AC_ARG_WITH(system-clucene,
1504     AS_HELP_STRING([--with-system-clucene],
1505         [Use clucene already on system.]),,
1506     [with_system_clucene="$with_system_libs"])
1508 AC_ARG_WITH(system-expat,
1509     AS_HELP_STRING([--with-system-expat],
1510         [Use expat already on system.]),,
1511     [with_system_expat="$with_system_libs"])
1513 AC_ARG_WITH(system-libeot,
1514     AS_HELP_STRING([--with-system-libeot],
1515         [Use libeot already on system.]),,
1516     [with_system_libeot="$with_system_libs"])
1518 AC_ARG_WITH(system-libxml,
1519     AS_HELP_STRING([--with-system-libxml],
1520         [Use libxml/libxslt already on system.]),,
1521     [with_system_libxml=auto])
1523 AC_ARG_WITH(system-icu,
1524     AS_HELP_STRING([--with-system-icu],
1525         [Use icu already on system.]),,
1526     [with_system_icu="$with_system_libs"])
1528 AC_ARG_WITH(system-ucpp,
1529     AS_HELP_STRING([--with-system-ucpp],
1530         [Use ucpp already on system.]),,
1531     [])
1533 AC_ARG_WITH(system-openldap,
1534     AS_HELP_STRING([--with-system-openldap],
1535         [Use the OpenLDAP LDAP SDK already on system.]),,
1536     [with_system_openldap="$with_system_libs"])
1538 AC_ARG_WITH(system-poppler,
1539     AS_HELP_STRING([--with-system-poppler],
1540         [Use system poppler (only needed for PDF import).]),,
1541     [with_system_poppler="$with_system_libs"])
1543 AC_ARG_WITH(system-apache-commons,
1544     AS_HELP_STRING([--with-system-apache-commons],
1545         [Use Apache commons libraries already on system.]),,
1546     [with_system_apache_commons="$with_system_jars"])
1548 AC_ARG_WITH(system-mariadb,
1549     AS_HELP_STRING([--with-system-mariadb],
1550         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1551          extension.]),,
1552     [with_system_mariadb="$with_system_libs"])
1554 AC_ARG_ENABLE(bundle-mariadb,
1555     AS_HELP_STRING([--enable-bundle-mariadb],
1556         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1559 AC_ARG_WITH(system-mysql-cppconn,
1560     AS_HELP_STRING([--with-system-mysql-cppconn],
1561         [Use MySQL C++ Connector libraries already on system.]),,
1562     [with_system_mysql_cppconn="$with_system_libs"])
1564 AC_ARG_WITH(system-postgresql,
1565     AS_HELP_STRING([--with-system-postgresql],
1566         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1567          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1568     [with_system_postgresql="$with_system_libs"])
1570 AC_ARG_WITH(libpq-path,
1571     AS_HELP_STRING([--with-libpq-path],
1572         [Use this PostgreSQL C interface (libpq) installation for building
1573          the PostgreSQL-SDBC extension.])
1574     [
1575                           Usage:     --with-libpq-path=<absolute path to
1576                                                   your libpq installation>
1577     ],
1580 AC_ARG_WITH(system-firebird,
1581     AS_HELP_STRING([--with-system-firebird],
1582         [Use Firebird libraries already on system, for building the Firebird-SDBC
1583          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1584     [with_system_firebird="$with_system_libs"])
1586 AC_ARG_WITH(system-hsqldb,
1587     AS_HELP_STRING([--with-system-hsqldb],
1588         [Use hsqldb already on system.]))
1590 AC_ARG_WITH(hsqldb-jar,
1591     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1592         [Specify path to jarfile manually.]),
1593     HSQLDB_JAR=$withval)
1595 AC_ARG_ENABLE(scripting-beanshell,
1596     AS_HELP_STRING([--disable-scripting-beanshell],
1597         [Disable support for scripts in BeanShell.]),
1601 AC_ARG_WITH(system-beanshell,
1602     AS_HELP_STRING([--with-system-beanshell],
1603         [Use beanshell already on system.]),,
1604     [with_system_beanshell="$with_system_jars"])
1606 AC_ARG_WITH(beanshell-jar,
1607     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1608         [Specify path to jarfile manually.]),
1609     BSH_JAR=$withval)
1611 AC_ARG_ENABLE(scripting-javascript,
1612     AS_HELP_STRING([--disable-scripting-javascript],
1613         [Disable support for scripts in JavaScript.]),
1617 AC_ARG_WITH(system-rhino,
1618     AS_HELP_STRING([--with-system-rhino],
1619         [Use rhino already on system.]),,)
1620 #    [with_system_rhino="$with_system_jars"])
1621 # Above is not used as we have different debug interface
1622 # patched into internal rhino. This code needs to be fixed
1623 # before we can enable it by default.
1625 AC_ARG_WITH(rhino-jar,
1626     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1627         [Specify path to jarfile manually.]),
1628     RHINO_JAR=$withval)
1630 AC_ARG_WITH(commons-codec-jar,
1631     AS_HELP_STRING([--with-commons-codec-jar=JARFILE],
1632         [Specify path to jarfile manually.]),
1633     COMMONS_CODEC_JAR=$withval)
1635 AC_ARG_WITH(commons-lang-jar,
1636     AS_HELP_STRING([--with-commons-lang-jar=JARFILE],
1637         [Specify path to jarfile manually.]),
1638     COMMONS_LANG_JAR=$withval)
1640 AC_ARG_WITH(commons-httpclient-jar,
1641     AS_HELP_STRING([--with-commons-httpclient-jar=JARFILE],
1642         [Specify path to jarfile manually.]),
1643     COMMONS_HTTPCLIENT_JAR=$withval)
1645 AC_ARG_WITH(commons-logging-jar,
1646     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1647         [Specify path to jarfile manually.]),
1648     COMMONS_LOGGING_JAR=$withval)
1650 AC_ARG_WITH(system-jfreereport,
1651     AS_HELP_STRING([--with-system-jfreereport],
1652         [Use JFreeReport already on system.]),,
1653     [with_system_jfreereport="$with_system_jars"])
1655 AC_ARG_WITH(sac-jar,
1656     AS_HELP_STRING([--with-sac-jar=JARFILE],
1657         [Specify path to jarfile manually.]),
1658     SAC_JAR=$withval)
1660 AC_ARG_WITH(libxml-jar,
1661     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1662         [Specify path to jarfile manually.]),
1663     LIBXML_JAR=$withval)
1665 AC_ARG_WITH(flute-jar,
1666     AS_HELP_STRING([--with-flute-jar=JARFILE],
1667         [Specify path to jarfile manually.]),
1668     FLUTE_JAR=$withval)
1670 AC_ARG_WITH(jfreereport-jar,
1671     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1672         [Specify path to jarfile manually.]),
1673     JFREEREPORT_JAR=$withval)
1675 AC_ARG_WITH(liblayout-jar,
1676     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1677         [Specify path to jarfile manually.]),
1678     LIBLAYOUT_JAR=$withval)
1680 AC_ARG_WITH(libloader-jar,
1681     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1682         [Specify path to jarfile manually.]),
1683     LIBLOADER_JAR=$withval)
1685 AC_ARG_WITH(libloader-jar,
1686     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1687         [Specify path to jarfile manually.]),
1688     LIBLOADER_JAR=$withval)
1690 AC_ARG_WITH(libformula-jar,
1691     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1692         [Specify path to jarfile manually.]),
1693     LIBFORMULA_JAR=$withval)
1695 AC_ARG_WITH(librepository-jar,
1696     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1697         [Specify path to jarfile manually.]),
1698     LIBREPOSITORY_JAR=$withval)
1700 AC_ARG_WITH(libfonts-jar,
1701     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1702         [Specify path to jarfile manually.]),
1703     LIBFONTS_JAR=$withval)
1705 AC_ARG_WITH(libserializer-jar,
1706     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1707         [Specify path to jarfile manually.]),
1708     LIBSERIALIZER_JAR=$withval)
1710 AC_ARG_WITH(libbase-jar,
1711     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1712         [Specify path to jarfile manually.]),
1713     LIBBASE_JAR=$withval)
1715 AC_ARG_WITH(system-odbc,
1716     AS_HELP_STRING([--with-system-odbc],
1717         [Use the odbc headers already on system.]),,
1718     [with_system_odbc="$with_system_headers"])
1720 AC_ARG_WITH(system-sane,
1721     AS_HELP_STRING([--with-system-sane],
1722         [Use sane.h already on system.]),,
1723     [with_system_sane="$with_system_headers"])
1725 AC_ARG_WITH(system-bluez,
1726     AS_HELP_STRING([--with-system-bluez],
1727         [Use bluetooth.h already on system.]),,
1728     [with_system_bluez="$with_system_headers"])
1730 AC_ARG_WITH(system-mesa-headers,
1731     AS_HELP_STRING([--with-system-mesa-headers],
1732         [Use Mesa headers already on system.]),,
1733     [with_system_mesa_headers="$with_system_headers"])
1735 AC_ARG_WITH(system-curl,
1736     AS_HELP_STRING([--with-system-curl],
1737         [Use curl already on system.]),,
1738     [with_system_curl=auto])
1740 AC_ARG_WITH(system-boost,
1741     AS_HELP_STRING([--with-system-boost],
1742         [Use boost already on system.]),,
1743     [with_system_boost="$with_system_headers"])
1745 AC_ARG_WITH(system-vigra,
1746     AS_HELP_STRING([--with-system-vigra],
1747         [Use vigra already on system.]),,
1748     [with_system_vigra="$with_system_headers"])
1750 AC_ARG_WITH(system-hunspell,
1751     AS_HELP_STRING([--with-system-hunspell],
1752         [Use libhunspell already on system.]),,
1753     [with_system_hunspell="$with_system_libs"])
1755 AC_ARG_WITH(system-mythes,
1756     AS_HELP_STRING([--with-system-mythes],
1757         [Use mythes already on system.]),,
1758     [with_system_mythes="$with_system_libs"])
1760 AC_ARG_WITH(system-altlinuxhyph,
1761     AS_HELP_STRING([--with-system-altlinuxhyph],
1762         [Use ALTLinuxhyph already on system.]),,
1763     [with_system_altlinuxhyph="$with_system_libs"])
1765 AC_ARG_WITH(system-lpsolve,
1766     AS_HELP_STRING([--with-system-lpsolve],
1767         [Use lpsolve already on system.]),,
1768     [with_system_lpsolve="$with_system_libs"])
1770 AC_ARG_WITH(system-liblangtag,
1771     AS_HELP_STRING([--with-system-liblangtag],
1772         [Use liblangtag library already on system.]),,
1773     [with_system_liblangtag="$with_system_libs"])
1775 AC_ARG_WITH(system-npapi-headers,
1776     AS_HELP_STRING([--with-system-npapi-headers],
1777         [Use NPAPI headers provided by system instead of bundled ones. Used in
1778          extensions/source/nsplugin (ENABLE_NPAPI_INTO_BROWSER=TRUE) and
1779          extensions/source/plugin (ENABLE_NPAPI_FROM_BROWSER=TRUE)]),,
1780     [with_system_npapi_headers="$with_system_headers"]
1783 AC_ARG_WITH(webdav,
1784     AS_HELP_STRING([--with-webdav],
1785         [Specify which library to use for webdav implementation.
1786          Possible values: "neon", "serf", "no". The default value is "neon".
1787          Example: --with-webdav="serf"]),
1788     WITH_WEBDAV=$withval,
1789     WITH_WEBDAV="neon")
1791 AC_ARG_WITH(linker-hash-style,
1792     AS_HELP_STRING([--with-linker-hash-style],
1793         [Use linker with --hash-style=<style> when linking shared objects.
1794          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1795          if supported on the build system, and "sysv" otherwise.]))
1797 AC_ARG_WITH(jdk-home,
1798     AS_HELP_STRING([--with-jdk-home],
1799         [If you have installed JDK 1.3 or later on your system please supply the
1800          path here. Note that this is not the location of the java command but the
1801          location of the entire distribution.])
1802     [
1803                           Usage:     --with-jdk-home=<absolute path to JDK home>
1804     ],
1807 AC_ARG_WITH(help,
1808     AS_HELP_STRING([--with-help],
1809         [Enable the build of help. There is a special parameter "common" that
1810          can be used to bundle only the common part, .e.g help-specific icons.
1811          This is useful when you build the helpcontent separately.])
1812     [
1813                           Usage:     --with-help    build the entire local help
1814                                  --without-help     no local help (default)
1815                                  --with-help=common bundle common files for the local
1816                                                     help but do not build the whole help
1817     ],
1820 AC_ARG_WITH(java,
1821     AS_HELP_STRING([--with-java],
1822         [Specify the name of the Java interpreter command. Typically "java"
1823          which is the default.
1825          To build without support for Java components, applets, accessibility
1826          or the XML filters written in Java, use --without-java or --with-java=no.])
1827     [
1828                           Usage:     --with-java==<java command>
1829                                      --without-java
1830     ],
1831     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1832     [ with_java=java ]
1835 AC_ARG_WITH(jvm-path,
1836     AS_HELP_STRING([--with-jvm-path],
1837         [Use a specific JVM search path at runtime.])
1838     [
1839                           Usage:     --with-jvm-path=<absolute path to parent of jvm home>
1841                           e. g.: --with-jvm-path=/usr/lib/
1842                                  to find JRE/JDK in /usr/lib/jvm/
1843     ],
1846 AC_ARG_WITH(ant-home,
1847     AS_HELP_STRING([--with-ant-home],
1848         [If you have installed Jakarta Ant on your system, please supply the path here.
1849          Note that this is not the location of the Ant binary but the location
1850          of the entire distribution.])
1851     [
1852                           Usage:     --with-ant-home=<absolute path to Ant home>
1853     ],
1856 AC_ARG_WITH(junit,
1857     AS_HELP_STRING([--with-junit],
1858         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
1859          --without-junit disables those tests. Not relevant in the --without-java case.])
1860     [
1861                           Usage:     --with-junit=<absolute path to JUnit 4 jar>
1862     ],
1863 ,with_junit=yes)
1865 AC_ARG_WITH(perl-home,
1866     AS_HELP_STRING([--with-perl-home],
1867         [If you have installed Perl 5 Distribution, on your system, please
1868          supply the path here. Note that this is not the location of the Perl
1869          binary but the location of the entire distribution.])
1870     [
1871                           Usage:     --with-perl-home=<abs. path to Perl 5 home>
1872     ],
1875 AC_ARG_WITH(
1876     [doxygen],
1877     AS_HELP_STRING(
1878         [--with-doxygen],
1879         [Specifies the doxygen executable to use when generating ODK C/C++
1880          documentation. --without-doxygen disables generation of ODK C/C++
1881          documentation. Not relevant in the --disable-odk case.])
1882     [
1883                           Usage:     --with-doxygen=<absolute path to doxygen executable>
1884     ],,
1885     [with_doxygen=yes])
1887 AC_ARG_WITH(visual-studio,
1888     AS_HELP_STRING([--with-visual-studio=<2012/2010/2013>],
1889         [Specify which Visual Studio version to use in case several are
1890          are installed. If not specified, the order of preference is
1891          2012, 2010, 2013 (including Express editions).])
1892     [
1893                           Usage:     --with-visual-studio=<2012/2010/2013>
1894     ],
1897 AC_ARG_WITH(windows-sdk,
1898     AS_HELP_STRING([--with-windows-sdk=<6.0(A)/7.0(A)/7.1(A)/8.0(A)>],
1899         [Specify which Windows SDK, or "Windows Kit", version to use
1900          in case the one that came with the selected Visual Studio
1901          is not what you want for some reason. Note that not all compiler/SDK
1902          combinations are supported. The intent is that this option should not
1903          be needed.])
1904     [
1905                           Usage:     --with-windows-sdk=6.0(A)/7.0(A)/7.1(A)/8.0(A)>
1906     ],
1909 AC_ARG_WITH(lang,
1910     AS_HELP_STRING([--with-lang],
1911         [Use this option to build LibreOffice with additional language support.
1912          English (US) is always included by default.
1913          Separate multiple languages with space.
1914          For all languages, use --with-lang=ALL.])
1915     [
1916                           Usage:     --with-lang="es sw tu cs sk"
1917     ],
1920 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
1921 AC_ARG_WITH(krb5,
1922     AS_HELP_STRING([--with-krb5],
1923         [Enable MIT Kerberos 5 support in modules that support it.
1924          By default automatically enabled on platforms
1925          where a good system Kerberos 5 is available.]),
1928 AC_ARG_WITH(gssapi,
1929     AS_HELP_STRING([--with-gssapi],
1930         [Enable GSSAPI support in modules that support it.
1931          By default automatically enabled on platforms
1932          where a good system GSSAPI is available.]),
1935 dnl ===================================================================
1936 dnl Branding
1937 dnl ===================================================================
1939 AC_ARG_WITH(branding,
1940     AS_HELP_STRING([--with-branding],
1941         [Use given path to retrieve branding images set.])
1942     [
1943                           Search for intro.png about.svg flat_logo.svg
1944                           backing_left.png backing_right.png
1945                           backing_rtl_left.png backing_rtl_right.png
1946                           backing_space.png. If any is missing, default
1947                           ones will be used instead.
1949                           Search also progress.conf for progress
1950                           settings on intro screen :
1952                           PROGRESSBARCOLOR="255,255,255" Set color of
1953                           progress bar. Comma separated RGB decimal values.
1954                           PROGRESSSIZE="407,6" Set size of progress bar.
1955                           Comma separated decimal values (width, height).
1956                           PROGRESSPOSITION="61,317" Set position of progress
1957                           bar from left,top. Comma separated decimal values.
1958                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
1959                           bar frame. Comma separated RGB decimal values.
1960                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
1961                           bar text. Comma separated RGB decimal values.
1962                           PROGRESSTEXTBASELINE="287" Set vertical position of
1963                           progress bar text from top. Decimal value.
1965                           Default values will be used if not found.
1967                           Usage:     --with-branding=/path/to/images
1968     ],
1972 AC_ARG_WITH(extra-buildid,
1973     AS_HELP_STRING([--with-extra-buildid],
1974         [Show addition build identification in about dialog.])
1975     [
1976                           Usage:     --with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"
1977     ],
1981 AC_ARG_WITH(vendor,
1982     AS_HELP_STRING([--with-vendor],
1983         [Set vendor of the build.])
1984     [
1985                           Usage:     --with-vendor="John the Builder"
1986     ],
1989 AC_ARG_WITH(compat-oowrappers,
1990     AS_HELP_STRING([--with-compat-oowrappers],
1991         [Install oo* wrappers in parallel with
1992          lo* ones to keep backward compatibility.
1993          Has effect only with make distro-pack-install]),
1996 AC_ARG_WITH(os-version,
1997     AS_HELP_STRING([--with-os-version],
1998         [For FreeBSD users, use this option option to override the detected OSVERSION.])
1999     [
2000                           Usage:     --with-os-version=<OSVERSION>
2001     ],
2004 AC_ARG_WITH(mingw-cross-compiler,
2005     AS_HELP_STRING([--with-mingw-cross-compiler],
2006         [Specify the MinGW cross-compiler to use.])
2007     [
2008                           Usage:     --with-mingw-cross-compiler=<mingw32-g++ command>
2010                           When building on the ODK on Unix and building unowinreg.dll,
2011                           specify the MinGW C++ cross-compiler.
2012     ],
2015 AC_ARG_WITH(idlc-cpp,
2016     AS_HELP_STRING([--with-idlc-cpp],
2017         [Specify the C Preprocessor to use for idlc.])
2018     [
2019                           Usage:     --with-idlc-cpp=cpp
2021                           Default is ucpp.
2022     ]
2025 AC_ARG_WITH(build-version,
2026     AS_HELP_STRING([--with-build-version],
2027         [Allows the builder to add a custom version tag that will appear in the
2028          Help/About box for QA purposes.])
2029     [
2030                           Usage:     --with-build-version="Built by Jim"
2031     ],
2032     with_build_version=$withval ,
2035 AC_ARG_WITH(alloc,
2036     AS_HELP_STRING([--with-alloc],
2037         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
2038          Note that on FreeBSD/NetBSD system==jemalloc]),
2041 AC_ARG_WITH(sun-templates,
2042     AS_HELP_STRING([--with-sun-templates],
2043         [Integrate Sun template packages.]),
2046 AC_ARG_WITH(parallelism,
2047     AS_HELP_STRING([--with-parallelism],
2048         [Number of jobs to run simultaneously during build. Parallel builds can
2049         save a lot of time on multi-cpu machines. Defaults to the number of
2050         CPUs on the machine, unless you configure --enable-icecream - then to
2051         10.]),
2054 AC_ARG_WITH(check-jobs,
2055     AS_HELP_STRING([--with-check-jobs],
2056         [Maximum number of jobs that will be issued at the same time during 'make subsequenttest'.
2057          Default value is the same as 'parallelism'. Useful because the subsequent tests are very lightweight.]),
2060 AC_ARG_WITH(all-tarballs,
2061     AS_HELP_STRING([--with-all-tarballs],
2062         [Download all external tarballs unconditionally]))
2064 AC_ARG_WITH(gdrive-client-id,
2065     AS_HELP_STRING([--with-gdrive-client-id],
2066         [Provides the client id of the application for OAuth2 authentication
2067         on Google Drive. If either this or --with-gdrive-client-secret is
2068         empty, the feature will be disabled]),
2071 AC_ARG_WITH(gdrive-client-secret,
2072     AS_HELP_STRING([--with-gdrive-client-secret],
2073         [Provides the client secret of the application for OAuth2
2074         authentication on Google Drive. If either this or
2075         --with-gdrive-client-id is empty, the feature will be disabled]),
2078 AC_ARG_WITH(alfresco-cloud-client-id,
2079     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2080         [Provides the client id of the application for OAuth2 authentication
2081         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2082         empty, the feature will be disabled]),
2085 AC_ARG_WITH(alfresco-cloud-client-secret,
2086     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2087         [Provides the client secret of the application for OAuth2
2088         authentication on Alfresco Cloud. If either this or
2089         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2092 dnl ===================================================================
2093 dnl Do we want to use pre-build binary tarball for recompile
2094 dnl ===================================================================
2096 if test "$enable_library_bin_tar" = "yes" ; then
2097    USE_LIBRARY_BIN_TAR=YES
2098 else
2099    USE_LIBRARY_BIN_TAR=NO
2101 AC_SUBST(USE_LIBRARY_BIN_TAR)
2103 dnl ===================================================================
2104 dnl Test whether build target is Release Build
2105 dnl ===================================================================
2106 AC_MSG_CHECKING([whether build target is Release Build])
2107 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2108     AC_MSG_RESULT([no])
2109     ENABLE_RELEASE_BUILD=
2110 else
2111     AC_MSG_RESULT([yes])
2112     ENABLE_RELEASE_BUILD=TRUE
2114 AC_SUBST(ENABLE_RELEASE_BUILD)
2116 dnl ===================================================================
2117 dnl Test whether to sign Windows Build
2118 dnl ===================================================================
2119 AC_MSG_CHECKING([whether to sign windows build])
2120 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT" -a "$WITH_MINGW" != "YES" ; then
2121     AC_MSG_RESULT([yes])
2122     WINDOWS_BUILD_SIGNING="TRUE"
2123 else
2124     AC_MSG_RESULT([no])
2125     WINDOWS_BUILD_SIGNING="FALSE"
2127 AC_SUBST(WINDOWS_BUILD_SIGNING)
2129 dnl ===================================================================
2130 dnl MacOSX build and runtime environment options
2131 dnl ===================================================================
2133 AC_ARG_WITH(macosx-sdk,
2134     AS_HELP_STRING([--with-macosx-sdk],
2135         [Use a specific SDK for building.])
2136     [
2137                           Usage:     --with-macosx-sdk=<version>
2139                           e. g.: --with-macosx-sdk=10.6
2141                           there are 3 options to control the MacOSX build:
2142                           --with-macosx-sdk (refered as 'sdk' below)
2143                           --with-macosx-version-min-required (refered as 'min' below)
2144                           --with-macosx-version-max-allowed (refered as 'max' below)
2146                           the connection between these value and the default they take is as follow:
2147                           ( ? means not specified on the command line, s means the SDK version found,
2148                           constraint: x <= y <= z)
2150                           ==========================================
2151                            command line      || config result
2152                           ==========================================
2153                           min  | max  | sdk  || min  | max  | sdk  |
2154                           ?    | ?    | ?    || 10.6 | 10.s | 10.s |
2155                           ?    | ?    | 10.x || 10.6 | 10.x | 10.x |
2156                           ?    | 10.x | ?    || 10.6 | 10.s | 10.s |
2157                           ?    | 10.x | 10.y || 10.6 | 10.x | 10.y |
2158                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2159                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2160                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2161                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2164                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2165                           for a detailled technical explanation of these variables
2167                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2169                           Note that even if in theory using a --with-macosx-version-max-allowed
2170                           (i.e. the MAC_OS_X_VERSION_MAX_ALLOWED macro) less than the SDK version
2171                           should work, in practice Apple doesn't seem to test that, and at least
2172                           compiling with -DMAC_OS_X_VERSION_MAX_ALLOWED=1060 against the 10.7 SDK
2173                           fails in a couple of places. Just because of oversights in ifdefs in the SDK
2174                           headers, but still.
2175     ],
2178 AC_ARG_WITH(macosx-version-min-required,
2179     AS_HELP_STRING([--with-macosx-version-min-required],
2180         [set the minimum OS version needed to run the built LibreOffice])
2181     [
2182                           Usage:     --with-macosx-version-min-required=<version>
2184                           e. g.: --with-macos-version-min-required=10.6
2185                           see --with-macosx-sdk for more info
2186     ],
2189 AC_ARG_WITH(macosx-version-max-allowed,
2190     AS_HELP_STRING([--with-macosx-version-max-allowed],
2191         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2192     [
2193                           Usage:     --with-macosx-version-max-allowed=<version>
2195                           e. g.: --with-macos-version-max-allowed=10.6
2196                           see --with-macosx-sdk for more info
2197     ],
2201 dnl ===================================================================
2202 dnl options for stuff used during cross-compilation build
2203 dnl These are superseded by --with-build-platform-configure-options.
2204 dnl Or are they? Look for the complicated tests for "$cross_compiling" = "yes" -a \(
2205 dnl "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \)
2206 dnl far below. Could whoever understands MinGW cross-compilation clean up this please.
2207 dnl ===================================================================
2209 AC_ARG_WITH(system-boost-for-build,
2210     AS_HELP_STRING([--with-system-boost-for-build],
2211         [Use boost already on system for build tools (cross-compilation only).]))
2213 AC_ARG_WITH(system-cppunit-for-build,
2214     AS_HELP_STRING([--with-system-cppunit-for-build],
2215         [Use cppunit already on system for build tools (cross-compilation only).]))
2217 AC_ARG_WITH(system-expat-for-build,
2218     AS_HELP_STRING([--with-system-expat-for-build],
2219         [Use expat already on system for build tools (cross-compilation only).]))
2221 AC_ARG_WITH(system-icu-for-build,
2222     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2223         [Use icu already on system for build tools (cross-compilation only).]))
2225 AC_ARG_WITH(system-libxml-for-build,
2226     AS_HELP_STRING([--with-system-libxml-for-build],
2227         [Use libxml/libxslt already on system for build tools (cross-compilation only).]))
2230 dnl ===================================================================
2231 dnl check for required programs (grep, awk, sed, bash)
2232 dnl ===================================================================
2234 pathmunge ()
2236     if test -n "$1"; then
2237         if test "$build_os" = "cygwin"; then
2238             PathFormat "$1"
2239             new_path=`cygpath -u "$formatted_path"`
2240         else
2241             new_path="$1"
2242         fi
2243         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2244             if test "$2" = "after"; then
2245                 LO_PATH="$LO_PATH:$new_path"
2246             else
2247                 LO_PATH="$new_path:$LO_PATH"
2248             fi
2249         fi
2250         unset new_path
2251     fi
2254 AC_PROG_AWK
2255 AC_PATH_PROG( AWK, $AWK)
2256 if test -z "$AWK"; then
2257     AC_MSG_ERROR([install awk to run this script])
2260 AC_PATH_PROG(BASH, bash)
2261 if test -z "$BASH"; then
2262     AC_MSG_ERROR([bash not found in \$PATH])
2264 AC_SUBST(BASH)
2266 AC_MSG_CHECKING([for GNU or BSD tar])
2267 for a in $GNUTAR gtar gnutar tar /usr/sfw/bin/gtar; do
2268     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2269     if test $? -eq 0;  then
2270         GNUTAR=$a
2271         break
2272     fi
2273 done
2274 AC_MSG_RESULT($GNUTAR)
2275 if test -z "$GNUTAR"; then
2276     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2278 AC_SUBST(GNUTAR)
2280 AC_MSG_CHECKING([for tar's option to strip components])
2281 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2282 if test $? -eq 0; then
2283     STRIP_COMPONENTS="--strip-components"
2284 else
2285     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2286     if test $? -eq 0; then
2287         STRIP_COMPONENTS="--strip-path"
2288     else
2289         STRIP_COMPONENTS="unsupported"
2290     fi
2292 AC_MSG_RESULT($STRIP_COMPONENTS)
2293 if test x$STRIP_COMPONENTS = xunsupported; then
2294     AC_MSG_ERROR([you need a tar that is able to strip components.])
2296 AC_SUBST(STRIP_COMPONENTS)
2298 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2299 dnl desktop OSes from "mobile" ones.
2301 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2302 dnl In other words, that when building for an OS that is not a
2303 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2305 dnl Note the direction of the implication; there is no assumption that
2306 dnl cross-compiling would imply a non-desktop OS.
2308 if test $_os != iOS -a $_os != Android; then
2309     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2310     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2311     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2314 DISABLE_EXPORT=''
2315 if test "$enable_export" != no; then
2316     BUILD_TYPE="$BUILD_TYPE EXPORT"
2317 else
2318     DISABLE_EXPORT='TRUE'
2319     SCPDEFS="$SCPDES -DDISABLE_EXPORT"
2321 AC_SUBST(DISABLE_EXPORT)
2323 dnl Decide whether to build database connectivity stuff (including
2324 dnl Base) or not. We probably don't want to on non-desktop OSes.
2326 if test -z "$enable_database_connectivity"; then
2327     # Do enable database connectivity for Android for now as otherwise
2328     # we presumably will get linking errors... We are not as far in
2329     # the work for iOS, so we might as well disable it for iOS already.
2331     # And actually, do enable it for iOS, too. Let's get back to
2332     # figuring out what to do with this later, if ever.
2334     # (Note that with "enable", I mean "enable building the related
2335     # code". Very likely little of it will make any sense at run-time
2336     # on Android or iOS and won't even be shipped with/linked into any
2337     # app.)
2339     #if test $_os != iOS; then
2340         enable_database_connectivity=yes
2341     #fi
2344 DISABLE_DBCONNECTIVITY=''
2345 if test "$enable_database_connectivity" = yes; then
2346     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2347 else
2348     DISABLE_DBCONNECTIVITY='TRUE'
2349     SCPDEFS="$SCPDEFS -DDISABLE_DBCONNECTIVITY"
2351 AC_SUBST(DISABLE_DBCONNECTIVITY)
2353 if test -z "$enable_extensions"; then
2354     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2355     if test $_os != iOS -a $_os != Android; then
2356         enable_extensions=yes
2357     fi
2360 if test "$enable_extensions" = yes; then
2361     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2362     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2365 if test -z "$enable_scripting"; then
2366     # Disable scripting for iOS unless specifically overridden
2367     # with --enable-scripting.
2368     if test $_os != iOS; then
2369         enable_scripting=yes
2370     fi
2373 DISABLE_SCRIPTING=''
2374 if test "$enable_scripting" = yes; then
2375     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2376 else
2377     DISABLE_SCRIPTING='TRUE'
2378     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2380 AC_SUBST(DISABLE_SCRIPTING)
2382 if test $_os = iOS -o $_os = Android; then
2383     # Disable dynamic_loading always for iOS and Android
2384     enable_dynamic_loading=no
2385 elif test -z "$enable_dynamic_loading"; then
2386     # Otherwise enable it unless speficically disabled
2387     enable_dynamic_loading=yes
2390 DISABLE_DYNLOADING=''
2391 if test "$enable_dynamic_loading" = yes; then
2392     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2393 else
2394     DISABLE_DYNLOADING='TRUE'
2395     SCPDEFS="$SCPDEFS -DDISABLE_DYNLOADING"
2397 AC_SUBST(DISABLE_DYNLOADING)
2399 # remenber SYSBASE value
2400 AC_SUBST(SYSBASE)
2402 dnl ===================================================================
2403 dnl  Sort out various gallery compilation options
2404 dnl ===================================================================
2405 AC_MSG_CHECKING([how to build and package galleries])
2406 if test -n "${with_galleries}"; then
2407     if test "$with_galleries" = "build"; then
2408         WITH_GALLERY_BUILD=YES
2409         AC_MSG_RESULT([build from source images internally])
2410     elif test "$with_galleries" = "package"; then
2411         WITH_GALLERY_BUILD=PACKAGE
2412         AC_MSG_ERROR([FIXME - implement build from pre-compiled package])
2413     elif test "$with_galleries" = "no"; then
2414         WITH_GALLERY_BUILD=
2415         AC_MSG_RESULT([disable non-internal gallery build])
2416     else
2417         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2418     fi
2419 else
2420     if test $_os != iOS -a $_os != Android; then
2421         WITH_GALLERY_BUILD=YES
2422         AC_MSG_RESULT([internal src images for desktop])
2423     else
2424         WITH_GALLERY_BUILD=
2425         AC_MSG_RESULT([disable src imgage build])
2426     fi
2428 AC_SUBST(WITH_GALLERY_BUILD)
2430 dnl ===================================================================
2431 dnl  Checks if ccache is available
2432 dnl ===================================================================
2433 if test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2434     case "%$CC%$CXX%" in
2435     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some verison number etc),
2436     # assume that's good then
2437     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2438         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2439         ;;
2440     *)
2441         AC_PATH_PROG([CCACHE],[ccache],[not found])
2442         if test "$CCACHE" = "not found"; then
2443             CCACHE=""
2444         else
2445             # Need to check for ccache version: otherwise prevents
2446             # caching of the results (like "-x objective-c++" for Mac)
2447             if test $_os = Darwin -o $_os = iOS; then
2448                 # Check ccache version
2449                 AC_MSG_CHECKING([whether version of ccache is suitable])
2450                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2451                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2452                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2453                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2454                 else
2455                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2456                     CCACHE=""
2457                 fi
2458             fi
2459         fi
2460         ;;
2461     esac
2462 else
2463     CCACHE=""
2466 if test "$CCACHE" != ""; then
2467     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2468     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2469     if test "$ccache_size" = ""; then
2470         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2471         if test "$ccache_size" = ""; then
2472             ccache_size=0
2473         fi
2474         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2475         if test $ccache_size -lt 1024; then
2476             CCACHE=""
2477             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-producive: Disabling auto-ccache detection])
2478             add_warning "ccache's cache size is less than 1GB using it is counter-producive: auto-ccache detection disabled"
2479         else
2480             # warn that ccache may be too small for debug build
2481             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build])
2482             add_warning "ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build"
2483         fi
2484     else
2485         if test $ccache_size -lt 5; then
2486             #warn that ccache may be too small for debug build
2487             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build])
2488             add_warning "ccache's cache size is less than 5GB using it may be counter-producive for debug or symbol-enabled build"
2489         fi
2490     fi
2493 dnl ===================================================================
2494 dnl  Checks for C compiler,
2495 dnl  The check for the C++ compiler is later on.
2496 dnl ===================================================================
2497 if test "$_os" != "WINNT" -a "$WITH_MINGW" != "yes"; then
2498     GCC_HOME_SET="true"
2499     AC_MSG_CHECKING([gcc home])
2500     if test -z "$with_gcc_home"; then
2501         if test "$enable_icecream" = "yes"; then
2502             if test -d "/usr/lib/icecc/bin"; then
2503                 GCC_HOME="/usr/lib/icecc/"
2504             else
2505                 GCC_HOME="/opt/icecream/"
2506             fi
2507         else
2508             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2509             GCC_HOME_SET="false"
2510         fi
2511     else
2512         GCC_HOME="$with_gcc_home"
2513     fi
2514     AC_MSG_RESULT($GCC_HOME)
2515     AC_SUBST(GCC_HOME)
2517     if test "$GCC_HOME_SET" = "true"; then
2518         if test -z "$CC"; then
2519             CC="$GCC_HOME/bin/gcc"
2520         fi
2521         if test -z "$CXX"; then
2522             CXX="$GCC_HOME/bin/g++"
2523         fi
2524     fi
2527 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
2528 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
2529     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
2530     save_CFLAGS=$CFLAGS
2531     AC_PROG_CC
2532     CFLAGS=$save_CFLAGS
2535 COMPATH=`dirname "$CC"`
2536 if test "$COMPATH" = "."; then
2537     AC_PATH_PROGS(COMPATH, $CC)
2538     dnl double square bracket to get single because of M4 quote...
2539     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2541 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2543 # Set the ENABLE_LTO variable
2544 # ===================================================================
2545 AC_MSG_CHECKING([whether to use link-time optimization])
2546 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
2547     ENABLE_LTO="TRUE"
2548     AC_MSG_RESULT([yes])
2549 else
2550     ENABLE_LTO=""
2551     AC_MSG_RESULT([no])
2553 AC_SUBST(ENABLE_LTO)
2555 dnl ===================================================================
2556 dnl Java support
2557 dnl ===================================================================
2558 AC_MSG_CHECKING([whether to build with Java support])
2559 if test "$with_java" != "no"; then
2560     if test "$DISABLE_SCRIPTING" = TRUE; then
2561         AC_MSG_RESULT([no, overridden by --disable-scripting])
2562         ENABLE_JAVA=""
2563         with_java=no
2564     else
2565         AC_MSG_RESULT([yes])
2566         ENABLE_JAVA="TRUE"
2567         AC_DEFINE(HAVE_FEATURE_JAVA)
2568     fi
2569 else
2570     AC_MSG_RESULT([no])
2571     ENABLE_JAVA=""
2574 AC_SUBST(ENABLE_JAVA)
2576 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2578 dnl ENABLE_JAVA="" indicate no Java support at all
2580 dnl ===================================================================
2581 dnl  Test the Solaris compiler version
2582 dnl ===================================================================
2583 if test "$_os" = "SunOS"; then
2584     if test "$CC" = "cc"; then
2585         AC_PATH_PROGS(_cc, cc)
2586         COMPATH=`echo $_cc | $SED -n "s/\/bin\/cc//p"`
2587         AC_MSG_CHECKING([the SunStudio C/C++ compiler version])
2588         dnl cc -V outputs to standard error!!!!
2589         _sunstudio_string=`$CC -V 2>&1 | grep '^cc' | $SED -e 's/.* C //'`
2590         _sunstudio_version=`echo $_sunstudio_string | $AWK '{ print $1 }'`
2591         _sunstudio_major=`echo $_sunstudio_version | $AWK -F. '{ print $1 }'`
2592         if test "$_sunstudio_major" != "5"; then
2593             AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2594         else
2595             _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" }'`
2596             if test "$_sunstudio_minor" = "false"; then
2597                 AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
2598             else
2599                 dnl compiler will do
2600                 AC_MSG_RESULT([checked])
2601             fi
2602         fi
2603     fi
2607 dnl ===================================================================
2608 dnl Check OS X SDK and compiler
2609 dnl ===================================================================
2611 if test $_os = Darwin; then
2613     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
2614         bitness=-m32
2615     else
2616         bitness=-m64
2617         BITNESS_OVERRIDE=64
2618     fi
2620     # If no --with-macosx-sdk option is given, look for 10.6, 10.7,
2621     # 10.8 and 10.9 SDKs, in that order. If not found in some (old)
2622     # default locations, try the xcode-select tool.
2624     # The intent is that for "most" Mac-based developers, a suitable
2625     # SDK will be found automatically without any configure options.
2627     # For developers still using Xcode 3, in /Developer, either
2628     # because it is the only Xcode they have, or they have that in
2629     # addition to Xcode 4 in /Applications/Xcode.app, the 10.6 SDK
2630     # should be found.
2632     # For developers with a current Xcode, the lowest-numbered SDK
2633     # should be found.
2635     AC_MSG_CHECKING([what Mac OS X SDK to use])
2637     if test -z "$with_macosx_sdk"; then
2638         if test -d /Developer/SDKs/MacOSX10.6.sdk; then
2639             with_macosx_sdk=10.6
2640         elif test -d /Developer-old/SDKs/MacOSX10.6.sdk; then
2641             with_macosx_sdk=10.6
2642         elif test -d /Xcode3/SDKs/MacOSX10.6.sdk; then
2643             with_macosx_sdk=10.6
2644         elif test -d /Developer/SDKs/MacOSX10.7.sdk; then
2645             with_macosx_sdk=10.7
2646         elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk"; then
2647             with_macosx_sdk=10.6
2648         elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"; then
2649             with_macosx_sdk=10.7
2650         elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk"; then
2651             with_macosx_sdk=10.8
2652         elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk"; then
2653             with_macosx_sdk=10.9
2654         elif test -x /usr/bin/xcode-select; then
2655             xcodepath="`xcode-select -print-path`"
2656             if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk"; then
2657                 with_macosx_sdk=10.6
2658             elif test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"; then
2659                 with_macosx_sdk=10.7
2660             elif test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk"; then
2661                 with_macosx_sdk=10.8
2662             elif test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk"; then
2663                 with_macosx_sdk=10.9
2664             fi
2665         fi
2666         if test -z "$with_macosx_sdk"; then
2667             AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2668         fi
2669     fi
2671     case $with_macosx_sdk in
2672     10.6)
2673         MACOSX_SDK_VERSION=1060
2674         ;;
2675     10.7)
2676         MACOSX_SDK_VERSION=1070
2677         ;;
2678     10.8)
2679         MACOSX_SDK_VERSION=1080
2680         ;;
2681     10.9)
2682         MACOSX_SDK_VERSION=1090
2683         ;;
2684     10.10)
2685         MACOSX_SDK_VERSION=101000
2686         ;;
2687     *)
2688         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.6--10])
2689         ;;
2690     esac
2692     # Next find it (again, if we deduced its version above by finding
2693     # it... but we need to look for it once more in case
2694     # --with-macosx-sdk was given so that the above search did not
2695     # happen).
2696     if test -z "$MACOSX_SDK_PATH"; then
2697         case $with_macosx_sdk in
2698         10.6)
2699             if test -d /Developer/SDKs/MacOSX10.6.sdk; then
2700                 MACOSX_SDK_PATH=/Developer/SDKs/MacOSX10.6.sdk
2701             elif test -d /Developer-old/SDKs/MacOSX10.6.sdk; then
2702                 MACOSX_SDK_PATH=/Developer-old/SDKs/MacOSX10.6.sdk
2703             elif test -d /Xcode3/SDKs/MacOSX10.6.sdk; then
2704                 MACOSX_SDK_PATH=/Xcode3/SDKs/MacOSX10.6.sdk
2705             elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2706                 MACOSX_SDK_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk
2707             elif test -x /usr/bin/xcode-select; then
2708                 xcodepath="`xcode-select -print-path`"
2709                 if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2710                     MACOSX_SDK_PATH="$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"
2711                 fi
2712             fi
2713             ;;
2714         10.7)
2715             if test -d /Developer/SDKs/MacOSX$with_macosx_sdk.sdk; then
2716                 MACOSX_SDK_PATH=/Developer/SDKs/MacOSX$with_macosx_sdk.sdk
2717             elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2718                 MACOSX_SDK_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk
2719             elif test -x /usr/bin/xcode-select; then
2720                 xcodepath="`xcode-select -print-path`"
2721                 if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2722                     MACOSX_SDK_PATH="$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"
2723                 fi
2724             fi
2725             ;;
2726         10.8|10.9|10.10)
2727             xcodepath="`xcode-select -print-path`"
2728             if test -d "$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"; then
2729                 MACOSX_SDK_PATH="$xcodepath/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$with_macosx_sdk.sdk"
2730             fi
2731             ;;
2732         esac
2733         if test -z "$MACOSX_SDK_PATH"; then
2734             AC_MSG_ERROR([Could not figure out the location of Mac OS X $with_macosx_sdk SDK])
2735         fi
2736     fi
2737     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2739     if test "$with_macosx_version_min_required" = ""; then
2740         with_macosx_version_min_required="10.6"
2741     fi
2743     if test "$with_macosx_version_max_allowed" = ""; then
2744         with_macosx_version_max_allowed="$with_macosx_sdk"
2745     fi
2747     # export this so that "xcrun" invocations later return matching values
2748     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2749     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2750     export DEVELOPER_DIR
2751     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2752     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2754     case "$with_macosx_version_min_required" in
2755     10.6)
2756         MAC_OS_X_VERSION_MIN_REQUIRED="1060"
2757         ;;
2758     10.7)
2759         MAC_OS_X_VERSION_MIN_REQUIRED="1070"
2760         ;;
2761     10.8)
2762         MAC_OS_X_VERSION_MIN_REQUIRED="1080"
2763         ;;
2764     10.9)
2765         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2766         ;;
2767     10.10)
2768         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2769         ;;
2770     *)
2771         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.6--10])
2772         ;;
2773     esac
2775     if test "$BITNESS_OVERRIDE" = ""; then
2776         case "$with_macosx_version_min_required" in
2777         10.6)
2778             case "$with_macosx_sdk" in
2779             10.6)
2780                 ;;
2781             *)
2782                 AC_MSG_WARN([Building with a SDK > 10.6 possibly breaks 10.6 compatibility. Do not use for the TDF build])
2783                 add_warning "Building with a SDK > 10.6 possibly breaks 10.6 compatibility. Do not use for the TDF build"
2784                 ;;
2785             esac
2786             ;;
2787         *)
2788             AC_MSG_WARN([Building with a minimum version requirement > 10.6 breaks 10.6 compatibility. Do not use for the TDF build])
2789             add_warning "Building with a minimum version requirement > 10.6 breaks 10.6 compatibility. Do not use for the TDF build"
2790             ;;
2791         esac
2792     fi
2794     # If no CC and CXX environment vars, try to guess where the compiler is
2795     LIBTOOL=libtool
2796     if test -z "$save_CC"; then
2797         AC_MSG_CHECKING([what compiler to use])
2798         case $with_macosx_sdk in
2799         10.6)
2800             if test "$enable_libc__" = yes; then
2801                 AC_MSG_ERROR([--enable-libc++ requires --with-macosx-version-min-required >= 10.7])
2802             fi
2803             # did someone copy her 10.6 sdk into xcode 4 (needed on Mountain Lion)?
2804             if test "$(echo $MACOSX_SDK_PATH | cut -c1-23)" = "/Applications/Xcode.app"; then
2805                 CC="`xcrun -find gcc` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2806                 CXX="`xcrun -find g++` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2807             else
2808                 CC="gcc-4.2 $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2809                 CXX="g++-4.2 $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2810             fi
2811             INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2812             LIBTOOL=libtool
2813             ;;
2814         10.7|10.8|10.9|10.10)
2815             if test "$enable_libc__" = yes; then
2816                 if test "$with_macosx_version_min_required" = 10.6; then
2817                     AC_MSG_ERROR([--enable-libc++ requires --with-macosx-version-min-required >= 10.7])
2818                 fi
2819                 # Use libc++ instead of libstdc++ when possible
2820                 stdlib=-stdlib=libc++
2821             fi
2822             if test "$ENABLE_LTO" = TRUE; then
2823                 lto=-flto
2824             fi
2825             CC="`xcrun -find clang` $bitness $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2826             CXX="`xcrun -find clang++` $bitness $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2827             INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2828             AR=`xcrun -find ar`
2829             NM=`xcrun -find nm`
2830             STRIP=`xcrun -find strip`
2831             LIBTOOL=`xcrun -find libtool`
2832             RANLIB=`xcrun -find ranlib`
2833             ;;
2834         esac
2835         AC_MSG_RESULT([$CC and $CXX])
2836     fi
2838     case "$with_macosx_version_max_allowed" in
2839     10.6)
2840         MAC_OS_X_VERSION_MAX_ALLOWED="1060"
2841         ;;
2842     10.7)
2843         MAC_OS_X_VERSION_MAX_ALLOWED="1070"
2844         ;;
2845     10.8)
2846         MAC_OS_X_VERSION_MAX_ALLOWED="1080"
2847         ;;
2848     10.9)
2849         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2850         ;;
2851     10.10)
2852         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2853         ;;
2854     *)
2855         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.6--10])
2856         ;;
2857     esac
2859     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2860     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2861         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2862     else
2863         AC_MSG_RESULT([ok])
2864     fi
2866     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2867     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2868         AC_MSG_ERROR([the version maximum allowed cannot be greater thatn the sdk level])
2869     else
2870         AC_MSG_RESULT([ok])
2871     fi
2872     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2873     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2875     AC_MSG_CHECKING([whether to do code signing])
2877     if test "$enable_macosx_code_signing" = yes; then
2878         # By default use the first suitable certificate (?).
2880         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2881         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2882         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2883         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the the
2884         # "Developer ID Application" one.
2886         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | awk '{print $2}' |head -1`
2887         if test -n "$identity"; then
2888             MACOSX_CODESIGNING_IDENTITY=$identity
2889             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2890             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2891         fi
2892     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2893         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2894         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2895         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2896     else
2897         AC_MSG_RESULT([no])
2898     fi
2900     AC_MSG_CHECKING([whether to create a Mac App Store package])
2902     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2903         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2904     elif test "$enable_macosx_package_signing" = yes; then
2905         # By default use the first suitable certificate.
2906         # It should be a "3rd Party Mac Developer Installer" one
2908         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2909         if test -n "$identity"; then
2910             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2911             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2912             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2913         else
2914             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2915         fi
2916     elif test -n "$enable_macosx_package_signing"; then
2917         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2918         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2919         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2920     else
2921         AC_MSG_RESULT([no])
2922     fi
2924     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2925         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2926     fi
2928     AC_MSG_CHECKING([whether to sandbox the application])
2930     if test -n "$with_macosx_teamid" -a "$with_macosx_teamid != yes -a "$with_macosx_teamid != no; then
2931         MACOSX_TEAMID="$with_macosx_teamid"
2932     fi
2934     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2935         AC_MSG_ERROR([OS X sandboxing requires code signing])
2936     elif test -z "$MACOSX_TEAMID" -a "$enable_macosx_sandbox" = yes; then
2937         AC_MSG_ERROR([OS X sandboxing requires a team id])
2938     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2939         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2940     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2941         ENABLE_MACOSX_SANDBOX=TRUE
2942         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2943         AC_MSG_RESULT([yes])
2944     else
2945         AC_MSG_RESULT([no])
2946     fi
2948     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2949     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2950     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2952     AC_MSG_CHECKING([what OS X app name to use])
2953     MACOSX_APP_NAME="$with_macosx_app_name"
2954     AC_MSG_RESULT([$MACOSX_APP_NAME])
2956 AC_SUBST(MACOSX_SDK_PATH)
2957 AC_SUBST(MACOSX_SDK_VERSION)
2958 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2959 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2960 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2961 AC_SUBST(INSTALL_NAME_TOOL)
2962 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2963 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2964 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2965 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2966 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2967 AC_SUBST(MACOSX_TEAMID)
2968 AC_SUBST(MACOSX_APP_NAME)
2970 dnl ===================================================================
2971 dnl Check iOS SDK and compiler
2972 dnl ===================================================================
2974 if test $_os = iOS; then
2976     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
2977         :
2978     else
2979         BITNESS_OVERRIDE=64
2980     fi
2982     AC_MSG_CHECKING([what iOS SDK to use])
2984     if test "$enable_ios_simulator" = yes; then
2985         platform=iPhoneSimulator
2986     else
2987         platform=iPhoneOS
2988     fi
2990     xcode_developer=`xcode-select -print-path`
2992     pref_sdk_ver=7.0
2993     for sdkver in 7.0 6.1 6.0; do
2994         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2995         if test -d $t; then
2996             ios_sdk=$sdkver
2997             sysroot=$t
2998             break
2999         fi
3000     done
3002     if test -z "$sysroot"; then
3003         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${pref_sdk_ver}])
3004     fi
3006     AC_MSG_RESULT($sysroot)
3008     if test "$enable_ios_simulator" = yes; then
3009         if test "$BITNESS_OVERRIDE" = 64; then
3010             arch=x86_64
3011             versionmin=-mios-simulator-version-min=7.0
3012         else
3013             arch=i386
3014             case $sdkver in
3015             7.*)
3016                 versionmin=-mios-simulator-version-min=6.1
3017                 ;;
3018             *)
3019                 versionmin=-mmacosx-version-min=10.7
3020                 ;;
3021             esac
3022         fi
3023     else
3024         platform=iPhoneOS
3025         if test "$BITNESS_OVERRIDE" = 64; then
3026             arch=arm64
3027             versionmin=-miphoneos-version-min=7.0
3028         else
3029             arch=armv7
3030             versionmin=-miphoneos-version-min=6.1
3031         fi
3032     fi
3034     # LTO is not really recommended for iOS builds,
3035     # the link time will be astronomical
3036     if test "$ENABLE_LTO" = TRUE; then
3037         lto=-flto
3038     fi
3039     # Just add -fvisibility=hidden to CC and CXX directly so that the 3rd-party libs also
3040     # get compiled with it, to avoid ld warnings when linking all that together into one
3041     # executable.
3042     # Use libc++ if opted in only, and only when building against iOS 7 SDK or newer.
3044     XCODE_CLANG_CXX_LIBRARY=libstdc++
3045     case $ios_sdk in
3046     6.*)
3047         if test "$enable_libc__" = yes; then
3048             AC_MSG_ERROR([--enable-libc++ requires using Xcode 5 and iOS SDK 7 or newer it seems])
3049         fi
3050         ;;
3051     *)
3052         if test "$enable_libc__" = yes; then
3053             XCODE_CLANG_CXX_LIBRARY=libc++
3054         fi
3055         ;;
3056     esac
3058     stdlib="-stdlib=$XCODE_CLANG_CXX_LIBRARY"
3060     CC="`xcrun -find clang` -arch $arch -fvisibility=hidden -isysroot $sysroot $lto $versionmin"
3061     CXX="`xcrun -find clang++` -arch $arch -fvisibility=hidden $stdlib -isysroot $sysroot $lto $versionmin"
3063     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3064     AR=`xcrun -find ar`
3065     NM=`xcrun -find nm`
3066     STRIP=`xcrun -find strip`
3067     LIBTOOL=`xcrun -find libtool`
3068     RANLIB=`xcrun -find ranlib`
3071 AC_SUBST(XCODE_CLANG_CXX_LIBRARY)
3073 AC_MSG_CHECKING([whether to treat the installation as read-only])
3075 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3076         "$enable_extensions" != yes; then
3077     enable_readonly_installset=yes
3079 if test "$enable_readonly_installset" = yes; then
3080     AC_MSG_RESULT([yes])
3081     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3082 else
3083     AC_MSG_RESULT([no])
3086 dnl ===================================================================
3087 dnl Structure of install set
3088 dnl ===================================================================
3090 if test $_os = Darwin -a "$enable_canonical_installation_tree_structure" = yes; then
3091     LIBO_BIN_FOLDER=MacOS
3092     LIBO_ETC_FOLDER=Resources
3093     LIBO_LIBEXEC_FOLDER=MacOS
3094     LIBO_LIB_FOLDER=Frameworks
3095     LIBO_SHARE_FOLDER=Resources
3096     LIBO_SHARE_HELP_FOLDER=Resources/help
3097     LIBO_SHARE_JAVA_FOLDER=Resources/java
3098     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3099     LIBO_LIB_PYUNO_FOLDER=Resources
3100     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3101     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3102     LIBO_URE_BIN_FOLDER=MacOS
3103     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3104     LIBO_URE_LIB_FOLDER=Frameworks
3105     LIBO_URE_SHARE_FOLDER=Resources/ure/share
3106     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3107     ENABLE_MACOSX_MACLIKE_APP_STRUCTURE=TRUE
3108     AC_DEFINE(HAVE_FEATURE_MACOSX_MACLIKE_APP_STRUCTURE)
3109 elif test $_os = Darwin; then
3110     LIBO_BIN_FOLDER=MacOS
3111     LIBO_ETC_FOLDER=MacOS
3112     LIBO_LIBEXEC_FOLDER=MacOS
3113     LIBO_LIB_FOLDER=MacOS
3114     LIBO_LIB_PYUNO_FOLDER=MacOS
3115     LIBO_SHARE_FOLDER=share
3116     LIBO_SHARE_HELP_FOLDER=help
3117     LIBO_SHARE_JAVA_FOLDER=MacOS/classes
3118     LIBO_SHARE_PRESETS_FOLDER=presets
3119     LIBO_SHARE_RESOURCE_FOLDER=MacOS/resource
3120     LIBO_SHARE_SHELL_FOLDER=MacOS/shell
3121     LIBO_URE_BIN_FOLDER=ure-link/bin
3122     LIBO_URE_ETC_FOLDER=ure-link/lib
3123     LIBO_URE_LIB_FOLDER=ure-link/lib
3124     LIBO_URE_SHARE_FOLDER=ure-link/share
3125     LIBO_URE_SHARE_JAVA_FOLDER=ure-link/share/java
3126 elif test $_os = WINNT; then
3127     LIBO_BIN_FOLDER=program
3128     LIBO_ETC_FOLDER=program
3129     LIBO_LIBEXEC_FOLDER=program
3130     LIBO_LIB_FOLDER=program
3131     LIBO_LIB_PYUNO_FOLDER=program
3132     LIBO_SHARE_FOLDER=share
3133     LIBO_SHARE_HELP_FOLDER=help
3134     LIBO_SHARE_JAVA_FOLDER=program/classes
3135     LIBO_SHARE_PRESETS_FOLDER=presets
3136     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3137     LIBO_SHARE_SHELL_FOLDER=program/shell
3138     LIBO_URE_BIN_FOLDER=URE/bin
3139     LIBO_URE_ETC_FOLDER=URE/bin
3140     LIBO_URE_LIB_FOLDER=URE/bin
3141     LIBO_URE_SHARE_FOLDER=URE
3142     LIBO_URE_SHARE_JAVA_FOLDER=URE/java
3143 else
3144     LIBO_BIN_FOLDER=program
3145     LIBO_ETC_FOLDER=program
3146     LIBO_LIBEXEC_FOLDER=program
3147     LIBO_LIB_FOLDER=program
3148     LIBO_LIB_PYUNO_FOLDER=program
3149     LIBO_SHARE_FOLDER=share
3150     LIBO_SHARE_HELP_FOLDER=help
3151     LIBO_SHARE_JAVA_FOLDER=program/classes
3152     LIBO_SHARE_PRESETS_FOLDER=presets
3153     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3154     LIBO_SHARE_SHELL_FOLDER=program/shell
3155     LIBO_URE_BIN_FOLDER=ure/bin
3156     LIBO_URE_ETC_FOLDER=ure/lib
3157     LIBO_URE_LIB_FOLDER=ure/lib
3158     LIBO_URE_SHARE_FOLDER=ure/share
3159     LIBO_URE_SHARE_JAVA_FOLDER=ure/share/java
3161 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3162 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3163 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3164 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3165 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3166 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3167 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3168 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3169 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3170 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3171 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3172 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3173 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3174 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3175 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_FOLDER,"$LIBO_URE_SHARE_FOLDER")
3176 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3178 # Not all of them needed in config_host.mk, add more if need arises
3179 AC_SUBST(LIBO_BIN_FOLDER)
3180 AC_SUBST(LIBO_ETC_FOLDER)
3181 AC_SUBST(LIBO_LIB_FOLDER)
3182 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3183 AC_SUBST(LIBO_SHARE_FOLDER)
3184 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3185 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3186 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3187 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3188 AC_SUBST(LIBO_URE_BIN_FOLDER)
3189 AC_SUBST(LIBO_URE_ETC_FOLDER)
3190 AC_SUBST(LIBO_URE_LIB_FOLDER)
3191 AC_SUBST(LIBO_URE_SHARE_FOLDER)
3192 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3193 AC_SUBST(ENABLE_MACOSX_MACLIKE_APP_STRUCTURE)
3195 dnl ===================================================================
3196 dnl Windows specific tests and stuff
3197 dnl ===================================================================
3199 # Get a value from the 32-bit side of the Registry
3200 reg_get_value_32()
3202     # Return value: $regvalue
3203     unset regvalue
3204     _regvalue=`cat "/proc/registry32/$1" 2> /dev/null`
3206     if test $? -eq 0; then
3207         regvalue=$_regvalue
3208     fi
3211 # Get a value from the 64-bit side of the Registry
3212 reg_get_value_64()
3214     # Return value: $regvalue
3215     unset regvalue
3216     _regvalue=`cat "/proc/registry64/$1" 2> /dev/null`
3218     if test $? -eq 0; then
3219         regvalue=$_regvalue
3220     fi
3223 if test "$_os" = "WINNT"; then
3224     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3225     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3226         AC_MSG_RESULT([no])
3227         WINDOWS_SDK_ARCH="x86"
3228     else
3229         AC_MSG_RESULT([yes])
3230         WINDOWS_SDK_ARCH="x64"
3231         BITNESS_OVERRIDE=64
3232     fi
3235 if test "$_os" = "WINNT" -a "$WITH_MINGW" != yes; then
3236     AC_MSG_CHECKING([whether to use DirectX])
3237     if test "$enable_directx" = "yes" -o "$enable_directx" = ""; then
3238         ENABLE_DIRECTX="TRUE"
3239         AC_MSG_RESULT([yes])
3240     else
3241         ENABLE_DIRECTX=""
3242         AC_MSG_RESULT([no])
3243     fi
3245     AC_MSG_CHECKING([whether to use ActiveX])
3246     if test "$enable_activex" = "yes" -o "$enable_activex" = ""; then
3247         DISABLE_ACTIVEX=""
3248         AC_MSG_RESULT([yes])
3249     else
3250         DISABLE_ACTIVEX="TRUE"
3251         AC_MSG_RESULT([no])
3252     fi
3254     AC_MSG_CHECKING([whether to use ATL])
3255     if test "$enable_atl" = "yes" -o "$enable_atl" = ""; then
3256         DISABLE_ATL=""
3257         AC_MSG_RESULT([yes])
3258     else
3259         DISABLE_ATL="TRUE"
3260         AC_MSG_RESULT([no])
3261     fi
3262 else
3263     ENABLE_DIRECTX=""
3264     DISABLE_ACTIVEX="TRUE"
3265     DISABLE_ATL="TRUE"
3268 AC_SUBST(ENABLE_DIRECTX)
3269 AC_SUBST(DISABLE_ACTIVEX)
3270 AC_SUBST(DISABLE_ATL)
3272 if test "$cross_compiling" = "yes"; then
3273     CROSS_COMPILING=YES
3274     SCPDEFS="$SCPDEFS -DCROSS_COMPILING"
3275 else
3276     CROSS_COMPILING=
3277     BUILD_TYPE="$BUILD_TYPE NATIVE"
3279 AC_SUBST(CROSS_COMPILING)
3281 dnl ===================================================================
3282 dnl  Is GCC actually Clang?
3283 dnl ===================================================================
3285 COM_GCC_IS_CLANG=
3286 if test "$GCC" = "yes"; then
3287     AC_MSG_CHECKING([whether GCC is actually Clang])
3288     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3289         #ifndef __clang__
3290         you lose
3291         #endif
3292         int foo=42;
3293         ]])],
3294         [AC_MSG_RESULT([yes])
3295          COM_GCC_IS_CLANG=TRUE],
3296         [AC_MSG_RESULT([no])])
3298     if test "$COM_GCC_IS_CLANG" = TRUE; then
3299         AC_MSG_CHECKING([the Clang version])
3300         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC -E -P -`
3301         CLANG_FULL_VERSION=`echo __clang_version__ | $CC -E -P -`
3302         CLANGVER=`echo $clang_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3303         AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3304         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3305     fi
3307 AC_SUBST(COM_GCC_IS_CLANG)
3309 if test "$CCACHE" != "" -a "$COM_GCC_IS_CLANG" = TRUE; then
3310     if test -z "$CCACHE_CPP2"; then
3311             AC_MSG_WARN([Using ccache with Clang without CCACHE_CPP2 set causes spurious warnings.])
3312             add_warning "Using ccache with Clang without CCACHE_CPP2 set causes spurious warnings."
3313     fi
3316 dnl ===================================================================
3317 dnl  Test the gcc version
3318 dnl ===================================================================
3319 if test "$GCC" = "yes" -a -z "$COM_GCC_IS_CLANG"; then
3320     AC_MSG_CHECKING([the GCC version])
3321     _gcc_version=`$CC -dumpversion`
3322     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3324     AC_MSG_RESULT([gcc $_gcc_version])
3325     if test "$GCC_VERSION" -lt 0401; then
3326         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.1.0])
3327     fi
3328 else
3329     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3330     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3331     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3332     # (which reports itself as GCC 4.2.1).
3333     GCC_VERSION=
3335 AC_SUBST(GCC_VERSION)
3337 # ===================================================================
3338 # check various GCC options that Clang does not support now but maybe
3339 # will somewhen in the future, check them even for GCC, so that the
3340 # flags are set
3341 # ===================================================================
3343 HAVE_GCC_GGDB2=
3344 HAVE_GCC_FINLINE_LIMIT=
3345 HAVE_GCC_FNO_INLINE=
3346 if test "$GCC" = "yes"; then
3347     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3348     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3349         # Option just ignored and silly warning that isn't a real
3350         # warning printed
3351         :
3352     else
3353         save_CFLAGS=$CFLAGS
3354         CFLAGS="$CFLAGS -Werror -ggdb2"
3355         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3356         CFLAGS=$save_CFLAGS
3357     fi
3358     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3359         AC_MSG_RESULT([yes])
3360     else
3361         AC_MSG_RESULT([no])
3362     fi
3364     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3365     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3366         # As above
3367         :
3368     else
3369         save_CFLAGS=$CFLAGS
3370         CFLAGS="$CFLAGS -Werror -finline-limit=0"
3371         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3372         CFLAGS=$save_CFLAGS
3373     fi
3374     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3375         AC_MSG_RESULT([yes])
3376     else
3377         AC_MSG_RESULT([no])
3378     fi
3380     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3381     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3382         # Ditto
3383         :
3384     else
3385         save_CFLAGS=$CFLAGS
3386         CFLAGS="$CFLAGS -Werror -fno-inline"
3387         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3388         CFLAGS=$save_CFLAGS
3389     fi
3390     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3391         AC_MSG_RESULT([yes])
3392     else
3393         AC_MSG_RESULT([no])
3394     fi
3396 AC_SUBST(HAVE_GCC_GGDB2)
3397 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3398 AC_SUBST(HAVE_GCC_FNO_INLINE)
3400 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3401 if test "$GCC" = "yes"; then
3402     AC_MSG_CHECKING( for -Bsymbolic-functions linker support )
3403     bsymbolic_functions_ldflags_save=$LDFLAGS
3404     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3405     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3406 #include <stdio.h>
3407         ],[
3408 printf ("hello world\n");
3409         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3410     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3411         AC_MSG_RESULT( found )
3412     else
3413         AC_MSG_RESULT( not found )
3414     fi
3415     LDFLAGS=$bsymbolic_functions_ldflags_save
3417 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3419 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3420 # NOTE: must _not_ be used for bundled external libraries!
3421 ISYSTEM=
3422 if test "$GCC" = "yes"; then
3423     AC_MSG_CHECKING( for -isystem )
3424     save_CFLAGS=$CFLAGS
3425     CFLAGS="$CFLAGS -Werror"
3426     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM=-isystem ],[])
3427     CFLAGS=$save_CFLAGS
3428     if test -n "$ISYSTEM"; then
3429         AC_MSG_RESULT(yes)
3430     else
3431         AC_MSG_RESULT(no)
3432     fi
3434 if test -z "$ISYSTEM"; then
3435     # fall back to using -I
3436     ISYSTEM=-I
3438 AC_SUBST(ISYSTEM)
3440 dnl ===================================================================
3441 dnl  Check which Visual Studio or MinGW compiler is used
3442 dnl ===================================================================
3444 map_vs_year_to_version()
3446     # Return value: $vsversion
3448     unset vsversion
3450     case $1 in
3451     2010)
3452         vsversion=10.0;;
3453     2012)
3454         vsversion=11.0;;
3455     2013)
3456         vsversion=12.0;;
3457     *)
3458         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3459     esac
3462 vs_versions_to_check()
3464     # Args: $1 (optional) : versions to check, in the order of preference
3465     # Return value: $vsversions
3467     unset vsversions
3469     if test -n "$1"; then
3470         map_vs_year_to_version "$1"
3471         vsversions=$vsversion
3472     else
3473         # By default we prefer 2012, then 2010, then 2013
3474         vsversions="11.0 10.0 12.0"
3475     fi
3478 find_msvs()
3480     # Find Visual Studio 2012/2010/2013
3481     # Args: $1 (optional) : versions to check, in the order of preference
3482     # Return value: $vstest
3484     unset vstest
3486     vs_versions_to_check "$1"
3488     for ver in $vsversions; do
3489         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/ProductDir
3490         if test -n "$regvalue"; then
3491             vstest=$regvalue
3492             break
3493         fi
3494         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VS/ProductDir
3495         if test -n "$regvalue"; then
3496             vstest=$regvalue
3497             break
3498         fi
3499     done
3502 find_msvc()
3504     # Find Visual C++ 2012/2010/2013
3505     # Args: $1 (optional) : The VS version year
3506     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot
3508     unset vctest vcnum vcnumwithdot
3510     vs_versions_to_check "$1"
3512     for ver in $vsversions; do
3513         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3514         if test -n "$regvalue"; then
3515             vctest=$regvalue
3516             break
3517         fi
3518         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VC/ProductDir
3519         if test -n "$regvalue"; then
3520             vctest=$regvalue
3521             break
3522         fi
3523     done
3524     if test -n "$vctest"; then
3525         vcnumwithdot=$ver
3526         case "$vcnumwithdot" in
3527         10.0)
3528             vcyear=2010
3529             vcnum=100
3530             ;;
3531         11.0)
3532             vcyear=2012
3533             vcnum=110
3534             ;;
3535         12.0)
3536             vcyear=2013
3537             vcnum=120
3538             ;;
3539         esac
3540     fi
3543 SHOWINCLUDES_PREFIX=
3544 if test "$_os" = "WINNT"; then
3545     if test "$WITH_MINGW" != "yes"; then
3546         AC_MSG_CHECKING([Visual C++])
3548         find_msvc "$with_visual_studio"
3550         if test -z "$vctest"; then
3551             if test -n "$with_visual_studio"; then
3552                 AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3553             else
3554                 AC_MSG_ERROR([No Visual Studio 2012, 2010 or 2013 installation found])
3555             fi
3556         fi
3558         if test "$BITNESS_OVERRIDE" = ""; then
3559             if test -f "$vctest/bin/cl.exe"; then
3560                 VC_PRODUCT_DIR=$vctest
3561             else
3562                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3563             fi
3564         else
3565             if test -f "$vctest/bin/amd64/cl.exe"; then
3566                 VC_PRODUCT_DIR=$vctest
3567             else
3568                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/amd64/cl.exe])
3569             fi
3570         fi
3572         VC_PRODUCT_DIR=`cygpath -d "$VC_PRODUCT_DIR"`
3573         VC_PRODUCT_DIR=`cygpath -u "$VC_PRODUCT_DIR"`
3574         AC_MSG_RESULT([$VC_PRODUCT_DIR])
3576         dnl ===========================================================
3577         dnl  Check for the corresponding mspdb*.dll
3578         dnl ===========================================================
3580         MSPDB_PATH=
3582         if test "$BITNESS_OVERRIDE" = ""; then
3583                         if test "$vcnum" = "120"; then
3584                                 MSPDB_PATH="$VC_PRODUCT_DIR/../VC/bin"
3585                         else
3586                                 MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3587                         fi
3588         else
3589             MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3590         fi
3592         mspdbnum=$vcnum
3594         if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3595             AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3596         fi
3598         MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3599         MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3601         dnl The path needs to be added before cl is called
3602         PATH="$MSPDB_PATH:$PATH"
3604         AC_MSG_CHECKING([cl.exe])
3606         # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3607         # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3608         # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3609         # is not enough?
3611         if test -z "$CC"; then
3612             if test "$BITNESS_OVERRIDE" = ""; then
3613                 if test -f "$VC_PRODUCT_DIR/bin/cl.exe"; then
3614                     CC="$VC_PRODUCT_DIR/bin/cl.exe"
3615                 fi
3616             else
3617                 if test -f "$VC_PRODUCT_DIR/bin/amd64/cl.exe"; then
3618                     CC="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3619                 fi
3620             fi
3622             # This gives us a posix path with 8.3 filename restrictions
3623             CC=`cygpath -d "$CC"`
3624             CC=`cygpath -u "$CC"`
3625         fi
3627         if test -n "$CC"; then
3628             # Remove /cl.exe from CC case insensitive
3629             AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3630             if test "$BITNESS_OVERRIDE" = ""; then
3631                 COMPATH=`echo $CC | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3632             else
3633                 if test -n "$VC_PRODUCT_DIR"; then
3634                     # Huh, why not just an assignment?
3635                     COMPATH=`echo $VC_PRODUCT_DIR`
3636                 fi
3637             fi
3638             export INCLUDE=`cygpath -d "$COMPATH/Include"`
3640             PathFormat "$COMPATH"
3641             COMPATH="$formatted_path"
3643             VCVER=$vcnum
3644             MSVSVER=$vcyear
3646             # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3647             # are always "better", we list them in reverse chronological order.
3649             case $vcnum in
3650             100)
3651                 COMEX=13
3652                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="7.1A 7.1 7.0A 6.0A"
3653                 if test "$ENABLE_LTO" = TRUE; then
3655                     AC_MSG_WARN([LTO is known to cause problems with MSVC 2010])
3656                     add_warning "LTO is known to cause problems with MSVC 2010"
3657                 fi
3658                 ;;
3659             110)
3660                 COMEX=14
3661                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="8.0 7.1A"
3662                 ;;
3663             120)
3664                 COMEX=15
3665                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="8.1A 8.1 8.0"
3666                 ;;
3667             esac
3669             # The expectation is that --with-windows-sdk should not need to be used
3670             if test -n "$with_windows_sdk"; then
3671                 case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3672                 *" "$with_windows_sdk" "*)
3673                     WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3674                     ;;
3675                 *)
3676                     AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work witn VS $MSVSVER])
3677                     ;;
3678                 esac
3679             fi
3681             # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3682             ac_objext=obj
3683             ac_exeext=exe
3685         else
3686             AC_MSG_ERROR([Visual C++ not found after all, huh])
3687         fi
3689         dnl We need to guess the prefix of the -showIncludes output, it can be
3690         dnl localized
3691         AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3692         echo "#include <stdlib.h>" > conftest.c
3693         SHOWINCLUDES_PREFIX=`$CC -c -showIncludes conftest.c 2>/dev/null | \
3694             grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3695         rm -f conftest.c conftest.obj
3696         if test -z "$SHOWINCLUDES_PREFIX"; then
3697             AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3698         else
3699             AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3700         fi
3702         # Check for 64-bit (cross-)compiler to use to build the 64-bit
3703         # version of the Explorer extension (and maybe other small
3704         # bits, too) needed when installing a 32-bit LibreOffice on a
3705         # 64-bit OS. The 64-bit Explorer extension is a feature that
3706         # has been present since long in OOo. Don't confuse it with
3707         # building LibreOffice itself as 64-bit code, which is
3708         # unfinished work and highly experimental.
3710         BUILD_X64=
3711         CXX_X64_BINARY=
3712         LINK_X64_BINARY=
3714         if test "$BITNESS_OVERRIDE" = ""; then
3715             AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3716             if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3717                 # Prefer native x64 compiler to cross-compiler, in case we are running
3718                 # the build on a 64-bit OS.
3719                 if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3720                     BUILD_X64=TRUE
3721                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3722                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3723                 elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3724                     BUILD_X64=TRUE
3725                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3726                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3727                 fi
3728             fi
3729             if test "$BUILD_X64" = TRUE; then
3730                 AC_MSG_RESULT([found])
3731             else
3732                 AC_MSG_RESULT([not found])
3733                 AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3734             fi
3735         fi
3736         AC_SUBST(BUILD_X64)
3738         # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3739         AC_SUBST(CXX_X64_BINARY)
3740         AC_SUBST(LINK_X64_BINARY)
3741     else
3742         AC_MSG_CHECKING([the compiler is MinGW])
3743         MACHINE_PREFIX=`$CC -dumpmachine`
3744         if echo $MACHINE_PREFIX | $GREP -q mingw32; then
3745             COMPATH=`echo "$COMPATH" | sed -e 's,/bin$,,'`
3746             AC_MSG_RESULT([yes])
3747         else
3748             AC_MSG_ERROR([Compiler is not MinGW.])
3749         fi
3750     fi
3752 AC_SUBST(VCVER)
3753 PathFormat "$MSPDB_PATH"
3754 MSPDB_PATH="$formatted_path"
3755 AC_SUBST(SHOWINCLUDES_PREFIX)
3758 # dbghelp.dll
3760 if test "$_os" = "WINNT"; then
3761     BUILD_TYPE="$BUILD_TYPE DBGHELP"
3765 # unowinreg.dll
3767 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3768 AC_SUBST(UNOWINREG_DLL)
3771 # prefix C with ccache if needed
3773 if test "$CCACHE" != ""; then
3774     AC_MSG_CHECKING([whether $CC is already ccached])
3776     AC_LANG_PUSH([C])
3777     save_CFLAGS=$CFLAGS
3778     CFLAGS="$CFLAGS --ccache-skip -O2"
3779     dnl an empty program will do, we're checking the compiler flags
3780     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3781                       [use_ccache=yes], [use_ccache=no])
3782     if test $use_ccache = yes; then
3783         AC_MSG_RESULT([yes])
3784     else
3785         CC="$CCACHE $CC"
3786         AC_MSG_RESULT([no])
3787     fi
3788     CFLAGS=$save_CFLAGS
3789     AC_LANG_POP([C])
3792 dnl Set the ENABLE_DBGUTIL variable
3793 dnl ===================================================================
3794 AC_MSG_CHECKING([whether to build with additional debug utilities])
3795 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3796     ENABLE_DBGUTIL="TRUE"
3797     # this is an extra var so it can have different default on different MSVC
3798     # versions (in case there are version specific problems with it)
3799     MSVC_USE_DEBUG_RUNTIME="TRUE"
3801     AC_MSG_RESULT([yes])
3802     # cppunit and graphite expose STL in public headers
3803     if test "$with_system_cppunit" = "yes"; then
3804         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3805     else
3806         with_system_cppunit=no
3807     fi
3808     if test "$with_system_graphite" = "yes"; then
3809         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3810     else
3811         with_system_graphite=no
3812     fi
3813     if test "$with_system_mysql_cppconn" = "yes"; then
3814         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3815     else
3816         with_system_mysql_cppconn=no
3817     fi
3818     if test "$with_system_orcus" = "yes"; then
3819         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3820     else
3821         with_system_orcus=no
3822     fi
3823     if test "$with_system_libcmis" = "yes"; then
3824         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3825     else
3826         with_system_libcmis=no
3827     fi
3828     if test "$enable_win_mozab_driver" = "yes"; then
3829         AC_MSG_ERROR([--enable-win-mozab-driver conflicts with --enable-dbgutil])
3830     fi
3831 else
3832     ENABLE_DBGUTIL=""
3833     MSVC_USE_DEBUG_RUNTIME=""
3834     AC_MSG_RESULT([no])
3836 AC_SUBST(ENABLE_DBGUTIL)
3837 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3839 dnl Set the ENABLE_DEBUG variable.
3840 dnl ===================================================================
3841 AC_MSG_CHECKING([whether to do a debug build])
3842 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3843     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3845 if test -n "$ENABLE_DBGUTIL"; then
3846     if test "$enable_debug" = "no"; then
3847         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3848     fi
3849     ENABLE_DEBUG="TRUE"
3850     AC_MSG_RESULT([yes (dbgutil)])
3851 elif test -n "$enable_debug" && test "$enable_debug" != "no"; then
3852     ENABLE_DEBUG="TRUE"
3853     AC_MSG_RESULT([yes])
3854 else
3855     ENABLE_DEBUG=""
3856     AC_MSG_RESULT([no])
3858 AC_SUBST(ENABLE_DEBUG)
3860 dnl Selective debuginfo
3861 ENABLE_DEBUGINFO_FOR=
3862 if test -n "$ENABLE_DEBUG"; then
3863     AC_MSG_CHECKING([whether to use selective debuginfo])
3864     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3865         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3866         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3867     else
3868         ENABLE_DEBUGINFO_FOR=all
3869         AC_MSG_RESULT([no, for all])
3870     fi
3872 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3874 dnl Check for enable symbols option
3875 dnl ===================================================================
3876 AC_MSG_CHECKING([whether to include symbols while preserve optimization])
3877 if test -n "$enable_symbols" -a "$enable_symbols" != "no"; then
3878     ENABLE_SYMBOLS="TRUE"
3879     if test -n "$ENABLE_DBGUTIL"; then
3880         AC_MSG_ERROR([--enable-dbgutil cannot be used with --enable-symbols])
3881     elif test -n "$ENABLE_DEBUG"; then
3882         AC_MSG_ERROR([--enable-debug cannot be used with --enable-symbols])
3883     fi
3884     AC_MSG_RESULT([yes])
3885 else
3886     if test -n "$enable_symbols" -a "$enable_symbols" = "no"; then
3887         ENABLE_SYMBOLS="FALSE"
3888     else
3889         ENABLE_SYMBOLS=
3890     fi
3891     AC_MSG_RESULT([no])
3893 AC_SUBST(ENABLE_SYMBOLS)
3895 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
3896 # By default use the ones specified by our build system,
3897 # but explicit override is possible.
3898 AC_MSG_CHECKING(for explicit AFLAGS)
3899 if test -n "$AFLAGS"; then
3900     AC_MSG_RESULT([$AFLAGS])
3901     x_AFLAGS=
3902 else
3903     AC_MSG_RESULT(no)
3904     x_AFLAGS=[\#]
3906 AC_MSG_CHECKING(for explicit CFLAGS)
3907 if test -n "$CFLAGS"; then
3908     AC_MSG_RESULT([$CFLAGS])
3909     x_CFLAGS=
3910 else
3911     AC_MSG_RESULT(no)
3912     x_CFLAGS=[\#]
3914 AC_MSG_CHECKING(for explicit CXXFLAGS)
3915 if test -n "$CXXFLAGS"; then
3916     AC_MSG_RESULT([$CXXFLAGS])
3917     x_CXXFLAGS=
3918 else
3919     AC_MSG_RESULT(no)
3920     x_CXXFLAGS=[\#]
3922 AC_MSG_CHECKING(for explicit OBJCFLAGS)
3923 if test -n "$OBJCFLAGS"; then
3924     AC_MSG_RESULT([$OBJCFLAGS])
3925     x_OBJCFLAGS=
3926 else
3927     AC_MSG_RESULT(no)
3928     x_OBJCFLAGS=[\#]
3930 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
3931 if test -n "$OBJCXXFLAGS"; then
3932     AC_MSG_RESULT([$OBJCXXFLAGS])
3933     x_OBJCXXFLAGS=
3934 else
3935     AC_MSG_RESULT(no)
3936     x_OBJCXXFLAGS=[\#]
3938 AC_MSG_CHECKING(for explicit LDFLAGS)
3939 if test -n "$LDFLAGS"; then
3940     AC_MSG_RESULT([$LDFLAGS])
3941     x_LDFLAGS=
3942 else
3943     AC_MSG_RESULT(no)
3944     x_LDFLAGS=[\#]
3946 AC_SUBST(AFLAGS)
3947 AC_SUBST(CFLAGS)
3948 AC_SUBST(CXXFLAGS)
3949 AC_SUBST(OBJCFLAGS)
3950 AC_SUBST(OBJCXXFLAGS)
3951 AC_SUBST(LDFLAGS)
3952 AC_SUBST(x_AFLAGS)
3953 AC_SUBST(x_CFLAGS)
3954 AC_SUBST(x_CXXFLAGS)
3955 AC_SUBST(x_OBJCFLAGS)
3956 AC_SUBST(x_OBJCXXFLAGS)
3957 AC_SUBST(x_LDFLAGS)
3960 # determine CPUNAME, GUIBASE, ...
3962 LIB64="lib"
3963 SOLARINC=
3965 case "$host_os" in
3967 aix*)
3968     COM=GCC
3969     CPUNAME=POWERPC
3970     GUIBASE=unx
3971     OS=AIX
3972     RTL_OS=AIX
3973     RTL_ARCH=PowerPC
3974     PLATFORMID=aix_powerpc
3975     OUTPATH=unxaigppc
3976     P_SEP=:
3977     ;;
3979 cygwin*)
3980     COM=MSC
3981     GUIBASE=not-used
3982     OS=WNT
3983     RTL_OS=Windows
3984     P_SEP=";"
3986     case "$host_cpu" in
3987     i*86|x86_64)
3988         if test "$BITNESS_OVERRIDE" = 64; then
3989             CPUNAME=X86_64
3990             RTL_ARCH=X86_64
3991             LIB64="lib/x64"
3992             PLATFORMID=windows_x86_64
3993             OUTPATH=wntmscx$COMEX
3994         else
3995             CPUNAME=INTEL
3996             RTL_ARCH=x86
3997             PLATFORMID=windows_x86
3998             OUTPATH=wntmsci$COMEX
3999         fi
4000         ;;
4001     *)
4002         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4003         ;;
4004     esac
4005     SCPDEFS="$SCPDEFS -D_MSC_VER"
4006     ;;
4008 darwin*)
4009     COM=GCC
4010     GUIBASE=not-used
4011     OS=MACOSX
4012     RTL_OS=MacOSX
4013     P_SEP=:
4015     case "$host_cpu" in
4016     arm*)
4017         CPUNAME=ARM
4018         RTL_ARCH=ARM_EABI
4019         PLATFORMID=ios_arm
4020         OUTPATH=unxiosr
4021         OS=IOS
4022         SDKDIR=sdk
4023         ;;
4024     i*86)
4025         if test "$BITNESS_OVERRIDE" = 64; then
4026             AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4027         fi
4028         CPUNAME=INTEL
4029         RTL_ARCH=x86
4030         PLATFORMID=macosx_x86
4031         OUTPATH=unxmacxi
4032         ;;
4033     x86_64)
4034         if test "$BITNESS_OVERRIDE" = 64; then
4035             CPUNAME=X86_64
4036             RTL_ARCH=X86_64
4037             PLATFORMID=macosx_x86_64
4038             OUTPATH=unxmacxx
4039         else
4040             CPUNAME=INTEL
4041             RTL_ARCH=x86
4042             PLATFORMID=macosx_x86
4043             OUTPATH=unxmacxi
4044         fi
4045         ;;
4046     *)
4047         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4048         ;;
4049     esac
4050     ;;
4052 dragonfly*)
4053     COM=GCC
4054     GUIBASE=unx
4055     OS=DRAGONFLY
4056     RTL_OS=DragonFly
4057     OUTPATH=unxdfly
4058     P_SEP=:
4060     case "$host_cpu" in
4061     i*86)
4062         CPUNAME=INTEL
4063         RTL_ARCH=x86
4064         PLATFORMID=dragonfly_x86
4065         ;;
4066     x86_64)
4067         CPUNAME=X86_64
4068         RTL_ARCH=X86_64
4069         PLATFORMID=dragonfly_x86_64
4070         ;;
4071     *)
4072         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4073         ;;
4074     esac
4075     ;;
4077 freebsd*)
4078     COM=GCC
4079     GUIBASE=unx
4080     RTL_OS=FreeBSD
4081     OS=FREEBSD
4082     OUTPATH=unxfbsd
4083     P_SEP=:
4085     case "$host_cpu" in
4086     i*86)
4087         CPUNAME=INTEL
4088         RTL_ARCH=x86
4089         PLATFORMID=freebsd_x86
4090         OUTPATH=unxfbsdi
4091         ;;
4092     x86_64)
4093         CPUNAME=X86_64
4094         RTL_ARCH=X86_64
4095         PLATFORMID=freebsd_x86_64
4096         ;;
4097     *)
4098         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4099         ;;
4100     esac
4101     ;;
4103 kfreebsd*)
4104     COM=GCC
4105     GUIBASE=unx
4106     OS=LINUX
4107     RTL_OS=kFreeBSD
4108     P_SEP=:
4110     case "$host_cpu" in
4112     i*86)
4113         CPUNAME=INTEL
4114         RTL_ARCH=x86
4115         PLATFORMID=kfreebsd_x86
4116         OUTPATH=unxkfgi6
4117         ;;
4118     x86_64)
4119         CPUNAME=X86_64
4120         RTL_ARCH=X86_64
4121         LIB64="lib64"
4122         PLATFORMID=kfreebsd_x86_64
4123         OUTPATH=unxkfgx6
4124         ;;
4125     *)
4126         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4127         ;;
4128     esac
4129     ;;
4131 linux-gnu*)
4132     COM=GCC
4133     GUIBASE=unx
4134     OS=LINUX
4135     RTL_OS=Linux
4136     P_SEP=:
4138     case "$host_cpu" in
4140     alpha)
4141         CPUNAME=AXP
4142         RTL_ARCH=ALPHA
4143         PLATFORMID=linux_alpha
4144         OUTPATH=unxlngaxp
4145         ;;
4146     arm*)
4147         CPUNAME=ARM
4148         EPM_FLAGS="-a arm"
4149         OUTPATH=unxlngr
4150         RTL_ARCH=ARM_EABI
4151         PLATFORMID=linux_arm_eabi
4152         case "$host_cpu" in
4153         arm*-linux)
4154             RTL_ARCH=ARM_OABI
4155             PLATFORMID=linux_arm_oabi
4156             ;;
4157         esac
4158         ;;
4159     hppa)
4160         CPUNAME=HPPA
4161         RTL_ARCH=HPPA
4162         EPM_FLAGS="-a hppa"
4163         PLATFORMID=linux_hppa
4164         OUTPATH=unxlnghppa
4165         ;;
4166     i*86)
4167         CPUNAME=INTEL
4168         RTL_ARCH=x86
4169         PLATFORMID=linux_x86
4170         OUTPATH=unxlngi6
4171         ;;
4172     ia64)
4173         CPUNAME=IA64
4174         RTL_ARCH=IA64
4175         PLATFORMID=linux_ia64
4176         OUTPATH=unxlnga
4177         ;;
4178     mips)
4179         CPUNAME=GODSON
4180         RTL_ARCH=MIPS_EB
4181         EPM_FLAGS="-a mips"
4182         PLATFORMID=linux_mips_eb
4183         OUTPATH=unxlngmips
4184         ;;
4185     mips64)
4186         CPUNAME=GODSON
4187         RTL_ARCH=MIPS_EB
4188         EPM_FLAGS="-a mips64"
4189         PLATFORMID=linux_mips_eb
4190         OUTPATH=unxlngmips
4191         ;;
4192     mips64el)
4193         CPUNAME=GODSON
4194         RTL_ARCH=MIPS_EL
4195         EPM_FLAGS="-a mips64el"
4196         PLATFORMID=linux_mips_el
4197         OUTPATH=unxlngmips
4198         ;;
4199     mipsel)
4200         CPUNAME=GODSON
4201         RTL_ARCH=MIPS_EL
4202         EPM_FLAGS="-a mipsel"
4203         PLATFORMID=linux_mips_el
4204         OUTPATH=unxlngmips
4205         ;;
4206     m68k)
4207         CPUNAME=M68K
4208         RTL_ARCH=M68K
4209         PLATFORMID=linux_m68k
4210         OUTPATH=unxlngm68k
4211         ;;
4212     powerpc)
4213         CPUNAME=POWERPC
4214         RTL_ARCH=PowerPC
4215         PLATFORMID=linux_powerpc
4216         OUTPATH=unxlngppc
4217         ;;
4218     powerpc64)
4219         CPUNAME=POWERPC64
4220         RTL_ARCH=PowerPC_64
4221         LIB64="lib64"
4222         PLATFORMID=linux_powerpc_64
4223         OUTPATH=unxlngppc64
4224         ;;
4225     sparc)
4226         CPUNAME=SPARC
4227         RTL_ARCH=SPARC
4228         PLATFORMID=linux_sparc
4229         OUTPATH=unxlngs
4230         ;;
4231     s390)
4232         CPUNAME=S390
4233         RTL_ARCH=S390
4234         PLATFORMID=linux_s390
4235         OUTPATH=unxlngs390
4236         ;;
4237     s390x)
4238         CPUNAME=S390X
4239         RTL_ARCH=S390x
4240         LIB64="lib64"
4241         PLATFORMID=linux_s390x
4242         OUTPATH=unxlngs390x
4243         ;;
4244     x86_64)
4245         CPUNAME=X86_64
4246         RTL_ARCH=X86_64
4247         LIB64="lib64"
4248         PLATFORMID=linux_x86_64
4249         OUTPATH=unxlngx6
4250         ;;
4251     *)
4252         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4253         ;;
4254     esac
4255     ;;
4257 linux-android*)
4258     COM=GCC
4259     GUIBASE=not-used
4260     OS=ANDROID
4261     RTL_OS=Android
4262     P_SEP=:
4264     case "$host_cpu" in
4266     arm|armel)
4267         CPUNAME=ARM
4268         RTL_ARCH=ARM_EABI
4269         PLATFORMID=android_arm_eabi
4270         OUTPATH=unxandr
4271         ;;
4272     mips|mipsel)
4273         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4274         RTL_ARCH=MIPS_EL
4275         PLATFORMID=android_mips_el
4276         OUTPATH=unxandm
4277         ;;
4278     i*86)
4279         CPUNAME=INTEL
4280         RTL_ARCH=x86
4281         PLATFORMID=android_x86
4282         OUTPATH=unxandi
4283         ;;
4284     *)
4285         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4286         ;;
4287     esac
4288     ;;
4290 mingw*)
4291     COM=GCC
4292     GUIBASE=not-used
4293     OS=WNT
4294     RTL_OS=Windows
4295     P_SEP=:
4297     case "$host_cpu" in
4298     i*86|x86_64)
4299         if test "$BITNESS_OVERRIDE" = 64; then
4300             CPUNAME=X86_64
4301             RTL_ARCH=X86_84
4302             PLATFORMID=windows_x86_64
4303             OUTPATH=wntgccx$COMEX
4304             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgccx"
4305         else
4306             CPUNAME=INTEL
4307             RTL_ARCH=x86
4308             PLATFORMID=windows_x86
4309             OUTPATH=wntgcci$COMEX
4310             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgcci"
4311         fi
4312         ;;
4313     *)
4314         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4315         ;;
4316     esac
4318     ;;
4320 *netbsd*)
4322     COM=GCC
4323     GUIBASE=unx
4324     OS=NETBSD
4325     RTL_OS=NetBSD
4326     OUTPATH=unxnbsd
4327     P_SEP=:
4329     case "$host_cpu" in
4330     i*86)
4331         CPUNAME=INTEL
4332         RTL_ARCH=x86
4333         PLATFORMID=netbsd_x86
4334         ;;
4335     powerpc)
4336         CPUNAME=POWERPC
4337         RTL_ARCH=PowerPC
4338         PLATFORMID=netbsd_powerpc
4339         ;;
4340     sparc)
4341         CPUNAME=SPARC
4342         RTL_ARCH=SPARC
4343         PLATFORMID=netbsd_sparc
4344         ;;
4345     x86_64)
4346         CPUNAME=X86_64
4347         RTL_ARCH=X86_64
4348         PLATFORMID=netbsd_x86_64
4349         ;;
4350     *)
4351         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4352         ;;
4353     esac
4354     ;;
4356 openbsd*)
4357     COM=GCC
4358     GUIBASE=unx
4359     OS=OPENBSD
4360     RTL_OS=OpenBSD
4361     OUTPATH=unxobsd
4362     P_SEP=:
4364     case "$host_cpu" in
4365     i*86)
4366         CPUNAME=INTEL
4367         RTL_ARCH=x86
4368         PLATFORMID=openbsd_x86
4369         ;;
4370     x86_64)
4371         CPUNAME=X86_64
4372         RTL_ARCH=X86_64
4373         PLATFORMID=openbsd_x86_64
4374         ;;
4375     *)
4376         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4377         ;;
4378     esac
4379     SOLARINC="$SOLARINC -I/usr/local/include"
4380     SOLARLIB="$SOLARLIB -L/usr/local/lib"
4382     ;;
4384 solaris*)
4386     COM=GCC
4387     GUIBASE=unx
4388     OS=SOLARIS
4389     RTL_OS=Solaris
4390     P_SEP=:
4392     case "$host_cpu" in
4393     i*86)
4394         CPUNAME=INTEL
4395         RTL_ARCH=x86
4396         PLATFORMID=solaris_x86
4397         OUTPATH=unxsogi
4398         ;;
4399     sparc)
4400         CPUNAME=SPARC
4401         RTL_ARCH=SPARC
4402         PLATFORMID=solaris_sparc
4403         OUTPATH=unxsogs
4404         ;;
4405     sparc64)
4406         CPUNAME=SPARC64
4407         RTL_ARCH=SPARC64
4408         PLATFORMID=solaris_sparc64
4409         OUTPATH=unxsogu
4410         ;;
4411     *)
4412         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4413         ;;
4414     esac
4415     SOLARINC="$SOLARINC -I/usr/local/include"
4416     SOLARLIB="$SOLARLIB -L$COMPATH/lib"
4417     SOLARLIB="$SOLARLIB -L/usr/local/bin -L/usr/dt/lib -L/usr/openwin/lib"
4418     ;;
4421     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4422     ;;
4423 esac
4425 if test "$enable_headless" = "yes"; then
4426     if test "$GUIBASE" != "unx"; then
4427         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --enable-headless])
4428     fi
4429     GUIBASE=not-used
4432 WORKDIR="${BUILDDIR}/workdir"
4433 INSTDIR="${BUILDDIR}/instdir"
4434 INSTROOT="${INSTDIR}${INSTROOTSUFFIX}"
4435 SOLARINC="-I. -I$SRC_ROOT/include $SOLARINC"
4436 AC_SUBST(COM)
4437 AC_SUBST(CPUNAME)
4438 AC_SUBST(RTL_OS)
4439 AC_SUBST(RTL_ARCH)
4440 AC_SUBST(EPM_FLAGS)
4441 AC_SUBST(GUIBASE)
4442 AC_SUBST([INSTDIR])
4443 AC_SUBST([INSTROOT])
4444 AC_SUBST(OS)
4445 AC_SUBST(OUTPATH)
4446 AC_SUBST(P_SEP)
4447 AC_SUBST(WORKDIR)
4448 AC_SUBST(PLATFORMID)
4449 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4451 dnl ===================================================================
4452 dnl Test which package format to use
4453 dnl ===================================================================
4454 AC_MSG_CHECKING([which package format to use])
4455 if test -n "$with_package_format" -a "$with_package_format" != no; then
4456     for i in $with_package_format; do
4457         case "$i" in
4458         aix | bsd | deb | pkg | rpm | native | portable | archive | dmg | installed | msi)
4459             ;;
4460         *)
4461             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4462 aix - AIX software distribution
4463 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4464 deb - Debian software distribution
4465 pkg - Solaris software distribution
4466 rpm - RedHat software distribution
4467 native - "Native" software distribution for the platform
4468 portable - Portable software distribution
4470 LibreOffice additionally supports:
4471 archive - .tar.gz or .zip
4472 dmg - Mac OS X .dmg
4473 installed - installation tree
4474 msi - Windows .msi
4475         ])
4476             ;;
4477         esac
4478     done
4479     PKGFORMAT="$with_package_format"
4480     AC_MSG_RESULT([$PKGFORMAT])
4481 else
4482     PKGFORMAT=
4483     AC_MSG_RESULT([none])
4485 AC_SUBST(PKGFORMAT)
4487 dnl ===================================================================
4488 dnl Set up a different compiler to produce tools to run on the build
4489 dnl machine when doing cross-compilation
4490 dnl ===================================================================
4492 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4493 if test "$cross_compiling" = "yes"; then
4494     AC_MSG_CHECKING([for BUILD platform configuration])
4495     echo
4496     rm -rf CONF-FOR-BUILD config_build.mk
4497     mkdir CONF-FOR-BUILD
4498     # Here must be listed all files needed when running the configure script. In particular, also
4499     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4500     # keep them in the same order as there.
4501     (cd $SRC_ROOT && tar cf - \
4502         config.guess \
4503         bin/get_config_variables \
4504         solenv/bin/getcompver.awk \
4505         solenv/inc/langlist.mk \
4506         config_host.mk.in \
4507         Makefile.in \
4508         lo.xcent.in \
4509         instsetoo_native/util/openoffice.lst.in \
4510         config_host/*.in \
4511         sysui/desktop/macosx/Info.plist.in \
4512         ios/lo.xcconfig.in \
4513         ure/source/unorc.in) \
4514     | (cd CONF-FOR-BUILD && tar xf -)
4515     cp configure CONF-FOR-BUILD
4516     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4517     (
4518     unset COM GUIBASE OS CPUNAME
4519     unset CC CXX SYSBASE CFLAGS
4520     unset AR NM OBJDUMP PKG_CONFIG RANLIB STRIP
4521     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4522     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
4523     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4524     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4525     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4526     cd CONF-FOR-BUILD
4527     sub_conf_opts=""
4528     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4529     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4530     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4531     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4532     test -n "$with_system_boost_for_build" && sub_conf_opts="$sub_conf_opts --with-system-boost"
4533     test -n "$with_system_cppunit_for_build" && sub_conf_opts="$sub_conf_opts --with-system-cppunit"
4534     test -n "$with_system_expat_for_build" && sub_conf_opts="$sub_conf_opts --with-system-expat"
4535     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4536     test -n "$with_system_libxml_for_build" && sub_conf_opts="$sub_conf_opts --with-system-libxml"
4537     # we need the msi build tools on mingw if we are creating the
4538     # installation set
4539     if test "$WITH_MINGW" = "yes"; then
4540         enable_winegcc_for_build=
4541         for pkgformat in $PKGFORMAT; do
4542             case "$pkgformat" in
4543             msi|native) enable_winegcc_for_build=yes ;;
4544             esac
4545         done
4546         test -n "$enable_winegcc_for_build" && sub_conf_opts="$sub_conf_opts --enable-winegcc"
4547     fi
4548     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4549     # Don't bother having configure look for stuff not needed for the build platform anyway
4550     ./configure \
4551         --disable-graphite \
4552         --disable-pdfimport \
4553         --disable-postgresql-sdbc \
4554         --with-parallelism="$with_parallelism" \
4555         --without-doxygen \
4556         --without-java \
4557         $sub_conf_opts \
4558         --srcdir=$srcdir \
4559         2>&1 | sed -e 's/^/    /'
4560     test -f ./config_host.mk 2>/dev/null || exit
4561     cp config_host.mk ../config_build.mk
4562     mv config.log ../config.Build.log
4563     mkdir -p ../config_build
4564     mv config_host/*.h ../config_build
4565     . ./bin/get_config_variables CC CXX INSTDIR INSTROOT LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER OS PATH SDKDIRNAME SYSTEM_LIBXSLT WORKDIR
4567     for V in CC CXX LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER OS SDKDIRNAME SYSTEM_LIBXSLT; do
4568         VV='$'$V
4569         VV=`eval "echo $VV"`
4570         if test -n "$VV"; then
4571             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4572             echo "$line" >>build-config
4573         fi
4574     done
4576     for V in INSTDIR INSTROOT WORKDIR; do
4577         VV='$'$V
4578         VV=`eval "echo $VV"`
4579         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4580         if test -n "$VV"; then
4581             line="${V}_FOR_BUILD='$VV'"
4582             echo "$line" >>build-config
4583         fi
4584     done
4586     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4587     echo "$line" >>build-config
4589     )
4590     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4591     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])
4592     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4593              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4595     eval `cat CONF-FOR-BUILD/build-config`
4597     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4599     rm -rf CONF-FOR-BUILD
4600 else
4601     OS_FOR_BUILD="$OS"
4602     CC_FOR_BUILD="$CC"
4603     CXX_FOR_BUILD="$CXX"
4604     INSTDIR_FOR_BUILD="$INSTDIR"
4605     INSTROOT_FOR_BUILD="$INSTROOT"
4606     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4607     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4608     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4609     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4610     WORKDIR_FOR_BUILD="$WORKDIR"
4612 AC_SUBST(OS_FOR_BUILD)
4613 AC_SUBST(INSTDIR_FOR_BUILD)
4614 AC_SUBST(INSTROOT_FOR_BUILD)
4615 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4616 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4617 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4618 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4619 AC_SUBST(WORKDIR_FOR_BUILD)
4621 dnl ===================================================================
4622 dnl Check for syslog header
4623 dnl ===================================================================
4624 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4626 dnl ===================================================================
4627 dnl Set the ENABLE_CRASHDUMP variable.
4628 dnl ===================================================================
4629 AC_MSG_CHECKING([whether to enable crashdump feature])
4630 if test "$enable_crashdump" = "yes"; then
4631     ENABLE_CRASHDUMP="TRUE"
4632     BUILD_TYPE="$BUILD_TYPE CRASHREP"
4633     AC_MSG_RESULT([yes])
4634 else
4635     ENABLE_CRASHDUMP=""
4636     AC_MSG_RESULT([no])
4638 AC_SUBST(ENABLE_CRASHDUMP)
4641 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4642 dnl ===================================================================
4643 AC_MSG_CHECKING([whether to turn warnings to errors])
4644 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4645     EXTERNAL_WARNINGS_NOT_ERRORS="FALSE"
4646     AC_MSG_RESULT([yes])
4647 else
4648     EXTERNAL_WARNINGS_NOT_ERRORS="TRUE"
4649     AC_MSG_RESULT([no])
4651 AC_SUBST(EXTERNAL_WARNINGS_NOT_ERRORS)
4653 dnl Set the ASSERT_ALWAYS_ABORT variable. (Activate --enable-assert-always-abort)
4654 dnl ===================================================================
4655 AC_MSG_CHECKING([whether to have assert to abort in release code])
4656 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4657     ASSERT_ALWAYS_ABORT="TRUE"
4658     AC_MSG_RESULT([yes])
4659 else
4660     ASSERT_ALWAYS_ABORT="FALSE"
4661     AC_MSG_RESULT([no])
4663 AC_SUBST(ASSERT_ALWAYS_ABORT)
4665 # Determine whether to use ooenv for the instdir installation
4666 # ===================================================================
4667 if test $_os != "WINNT" -a $_os != "Darwin"; then
4668     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4669     if test "$enable_ooenv" = "no"; then
4670         AC_MSG_RESULT([no])
4671     else
4672         ENABLE_OOENV="TRUE"
4673         AC_MSG_RESULT([yes])
4674     fi
4676 AC_SUBST(ENABLE_OOENV)
4678 if test "$enable_headless" = "yes"; then
4679     # be sure to do not mess with uneeded stuff
4680     test_randr=no
4681     test_xrender=no
4682     test_cups=no
4683     test_dbus=no
4684     test_fontconfig=yes
4685     test_gtk=no
4686     build_gstreamer=no
4687     build_gstreamer_0_10=no
4688     test_tde=no
4689     test_kde=no
4690     test_kde4=no
4691     enable_cairo_canvas=no
4692     enable_gnome_vfs=no
4695 dnl ===================================================================
4696 dnl check for cups support
4697 dnl ===================================================================
4698 ENABLE_CUPS=""
4700 if test "$enable_cups" = "no"; then
4701     test_cups=no
4704 AC_MSG_CHECKING([whether to enable CUPS support])
4705 if test "$test_cups" = "yes"; then
4706     ENABLE_CUPS="TRUE"
4707     AC_MSG_RESULT([yes])
4709     AC_MSG_CHECKING([whether cups support is present])
4710     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4711     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4712     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4713         AC_MSG_ERROR([Could not find CUPS. Install libcupsys2-dev or cups-devel.])
4714     fi
4716 else
4717     AC_MSG_RESULT([no])
4720 AC_SUBST(ENABLE_CUPS)
4722 # fontconfig checks
4723 if test "$test_fontconfig" = "yes"; then
4724     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.2.0])
4725     SYSTEM_FONTCONFIG=YES
4727 AC_SUBST(FONTCONFIG_CFLAGS)
4728 AC_SUBST(FONTCONFIG_LIBS)
4729 AC_SUBST([SYSTEM_FONTCONFIG])
4731 dnl whether to find & fetch external tarballs?
4732 dnl ===================================================================
4733 if test -z "$TARFILE_LOCATION"; then
4734     TARFILE_LOCATION="$SRC_ROOT/src"
4736 AC_SUBST(TARFILE_LOCATION)
4738 AC_MSG_CHECKING([whether we want to fetch tarballs])
4739 if test "$enable_fetch_external" != "no"; then
4740     if test "$with_all_tarballs" = "yes"; then
4741         AC_MSG_RESULT(["yes, all of them"])
4742         DO_FETCH_TARBALLS="ALL"
4743     else
4744         AC_MSG_RESULT(["yes, if we use them"])
4745         DO_FETCH_TARBALLS="YES"
4746     fi
4747 else
4748     AC_MSG_RESULT([no])
4749     DO_FETCH_TARBALLS="NO"
4751 AC_SUBST(DO_FETCH_TARBALLS)
4753 AC_MSG_CHECKING([whether to build help])
4754 HELP_COMMON_ONLY=FALSE
4755 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4756     BUILD_TYPE="$BUILD_TYPE HELP"
4757     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4758     if test "$with_help" = "common" ; then
4759         HELP_COMMON_ONLY=TRUE
4760         AC_MSG_RESULT([common only])
4761     else
4762         SCPDEFS="$SCPDEFS -DWITH_HELP"
4763         AC_MSG_RESULT([yes])
4764     fi
4765 else
4766     AC_MSG_RESULT([no])
4768 AC_SUBST(HELP_COMMON_ONLY)
4770 dnl Test whether to include MySpell dictionaries
4771 dnl ===================================================================
4772 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4773 if test "$with_myspell_dicts" = "yes"; then
4774     AC_MSG_RESULT([yes])
4775     WITH_MYSPELL_DICTS=YES
4776     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4777     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4778 else
4779     AC_MSG_RESULT([no])
4780     WITH_MYSPELL_DICTS=NO
4782 AC_SUBST(WITH_MYSPELL_DICTS)
4784 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4785 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4786     if test "$with_system_dicts" = yes; then
4787         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4788     fi
4789     with_system_dicts=no
4792 AC_MSG_CHECKING([whether to use dicts from external paths])
4793 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4794     AC_MSG_RESULT([yes])
4795     SYSTEM_DICTS=YES
4796     AC_MSG_CHECKING([for spelling dictionary directory])
4797     if test -n "$with_external_dict_dir"; then
4798         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4799     else
4800         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4801         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4802             DICT_SYSTEM_DIR=file:///usr/share/myspell
4803         fi
4804     fi
4805     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4806     AC_MSG_CHECKING([for hyphenation patterns directory])
4807     if test -n "$with_external_hyph_dir"; then
4808         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4809     else
4810         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4811     fi
4812     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4813     AC_MSG_CHECKING([for thesaurus directory])
4814     if test -n "$with_external_thes_dir"; then
4815         THES_SYSTEM_DIR=file://$with_external_thes_dir
4816     else
4817         THES_SYSTEM_DIR=file:///usr/share/mythes
4818     fi
4819     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4820 else
4821     AC_MSG_RESULT([no])
4822     SYSTEM_DICTS=NO
4824 AC_SUBST(SYSTEM_DICTS)
4825 AC_SUBST(DICT_SYSTEM_DIR)
4826 AC_SUBST(HYPH_SYSTEM_DIR)
4827 AC_SUBST(THES_SYSTEM_DIR)
4829 dnl ===================================================================
4830 AC_MSG_CHECKING([whether to enable pch feature])
4831 if test -n "$enable_pch" && test "$enable_pch" != "no"; then
4832     if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
4833         ENABLE_PCH="TRUE"
4834         AC_MSG_RESULT([yes])
4835     elif test "$GCC" = "yes"; then
4836         ENABLE_PCH="TRUE"
4837         AC_MSG_RESULT([yes])
4838     else
4839         ENABLE_PCH=""
4840         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4841     fi
4842 else
4843     ENABLE_PCH=""
4844     AC_MSG_RESULT([no])
4846 AC_SUBST(ENABLE_PCH)
4848 dnl ===================================================================
4849 dnl Search all the common names for GNU make
4850 dnl ===================================================================
4851 AC_MSG_CHECKING([for GNU make])
4853 # try to use our own make if it is available and GNUMAKE was not already defined
4854 if test -z "$GNUMAKE"; then
4855     if test -x "/opt/lo/bin/make"; then
4856         GNUMAKE="/opt/lo/bin/make"
4857     fi
4860 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
4861     if test -n "$a"; then
4862         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
4863         if test $? -eq 0;  then
4864             if test "$build_os" = "cygwin"; then
4865                 if test -n "$($a -v | grep 'Built for Windows')" ; then
4866                     AC_MSG_NOTICE([$a is a native Win32 make, which is not supported on this old branch.])
4867                     unset GNUMAKE
4868                 else
4869                     GNUMAKE=`which $a`
4870                     break
4871                 fi
4872             else
4873                 GNUMAKE=`which $a`
4874                 break
4875             fi
4876         fi
4877     fi
4878 done
4879 AC_MSG_RESULT($GNUMAKE)
4880 if test -z "$GNUMAKE"; then
4881     AC_MSG_ERROR([not found. install GNU make.])
4884 TAB=`printf '\t'`
4886 AC_MSG_CHECKING([the GNU make version])
4887 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4888 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4889 if test "$_make_longver" -ge "038200"; then
4890     AC_MSG_RESULT([$GNUMAKE $_make_version])
4892 elif test "$_make_longver" -ge "038100"; then
4893     if test "$build_os" = "cygwin"; then
4894         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4895     fi
4896     AC_MSG_RESULT([$GNUMAKE $_make_version])
4898     dnl ===================================================================
4899     dnl Search all the common names for sha1sum
4900     dnl ===================================================================
4901     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4902     if test -z "$SHA1SUM"; then
4903         AC_MSG_ERROR([install the approproate SHA-1 checksumming program for this OS])
4904     elif test "$SHA1SUM" = "openssl"; then
4905         SHA1SUM="openssl sha1"
4906     fi
4907     AC_MSG_CHECKING([for GNU make bug 20033])
4908     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4909     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4910 A := \$(wildcard *.a)
4912 .PHONY: all
4913 all: \$(A:.a=.b)
4914 <TAB>@echo survived bug20033.
4916 .PHONY: setup
4917 setup:
4918 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4920 define d1
4921 @echo lala \$(1)
4922 @sleep 1
4923 endef
4925 define d2
4926 @echo tyty \$(1)
4927 @sleep 1
4928 endef
4930 %.b : %.a
4931 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4932 <TAB>\$(call d1,\$(CHECKSUM)),\
4933 <TAB>\$(call d2,\$(CHECKSUM)))
4935     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4936         no_parallelism_make="YES"
4937         AC_MSG_RESULT([yes, disable parallelism])
4938     else
4939         AC_MSG_RESULT([no, keep parallelism enabled])
4940     fi
4941     rm -rf $TESTGMAKEBUG20033
4942 else
4943     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4946 # find if gnumake support file function
4947 AC_MSG_CHECKING([whether GNU make supports the 'file' function])
4948 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4949 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4950 \$(file >test.txt,Success )
4952 .PHONY: all
4953 all:
4954 <TAB>@cat test.txt
4957 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4958 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4959     HAVE_GNUMAKE_FILE_FUNC="YES"
4960     AC_MSG_RESULT([yes])
4961 else
4962     AC_MSG_RESULT([no])
4964 rm -rf $TESTGMAKEFILEFUNC
4965 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4966 AC_SUBST(GNUMAKE)
4968 _make_ver_check=`$GNUMAKE --version | grep LibreOffice`
4969 STALE_MAKE=
4970 make_warning=
4971 if test "$_make_ver_check" = ""; then
4972    STALE_MAKE=TRUE
4975 HAVE_LD_HASH_STYLE=FALSE
4976 WITH_LINKER_HASH_STYLE=
4977 AC_MSG_CHECKING( for --hash-style gcc linker support )
4978 if test "$GCC" = "yes"; then
4979     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4980         hash_styles="gnu sysv"
4981     elif test "$with_linker_hash_style" = "no"; then
4982         hash_styles=
4983     else
4984         hash_styles="$with_linker_hash_style"
4985     fi
4987     for hash_style in $hash_styles; do
4988         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4989         hash_style_ldflags_save=$LDFLAGS
4990         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
4992         AC_LINK_IFELSE([AC_LANG_PROGRAM(
4993             [
4994 #include <stdio.h>
4995             ],[
4996 printf ("");
4997             ])],
4998             [ if ./conftest$EXEEXT; then
4999                   HAVE_LD_HASH_STYLE=TRUE
5000                   WITH_LINKER_HASH_STYLE=$hash_style
5001               fi],
5002             [HAVE_LD_HASH_STYLE=FALSE])
5003         LDFLAGS=$hash_style_ldflags_save
5004     done
5006     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5007         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5008     else
5009         AC_MSG_RESULT( no )
5010     fi
5011     LDFLAGS=$hash_style_ldflags_save
5012 else
5013     AC_MSG_RESULT( no )
5015 AC_SUBST(HAVE_LD_HASH_STYLE)
5016 AC_SUBST(WITH_LINKER_HASH_STYLE)
5018 dnl ===================================================================
5019 dnl Check whether there's a Perl version available.
5020 dnl ===================================================================
5021 if test -z "$with_perl_home"; then
5022     AC_PATH_PROG(PERL, perl)
5023 else
5024     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5025     _perl_path="$with_perl_home/bin/perl"
5026     if test -x "$_perl_path"; then
5027         PERL=$_perl_path
5028     else
5029         AC_MSG_ERROR([$_perl_path not found])
5030     fi
5033 dnl ===================================================================
5034 dnl Testing for Perl version 5 or greater.
5035 dnl $] is the Perl version variable, it is returned as an integer
5036 dnl ===================================================================
5037 if test "$PERL"; then
5038     AC_MSG_CHECKING([the Perl version])
5039     ${PERL} -e "exit($]);"
5040     _perl_version=$?
5041     if test "$_perl_version" -lt 5; then
5042         AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
5043     fi
5044     AC_MSG_RESULT([checked (perl $_perl_version)])
5045 else
5046     AC_MSG_ERROR([Perl not found, install version 5 of Perl])
5049 dnl ===================================================================
5050 dnl Testing for required Perl modules
5051 dnl ===================================================================
5053 AC_MSG_CHECKING([for required Perl modules])
5054 if `$PERL -e 'use Archive::Zip; use Cwd; use Digest::MD5'>/dev/null 2>&1`; then
5055     AC_MSG_RESULT([all modules found])
5056 else
5057     AC_MSG_RESULT([failed to find some modules])
5058     # Find out which modules are missing.
5059     missing_perl_modules=
5060     if ! `$PERL -e 'use Archive::Zip;'>/dev/null 2>&1`; then
5061        missing_perl_modules=Archive::Zip
5062     fi
5063     if ! `$PERL -e 'use Cwd;'>/dev/null 2>&1`; then
5064        missing_perl_modules="$missing_perl_modules Cwd"
5065     fi
5066     if ! `$PERL -e 'use Digest::MD5;'>/dev/null 2>&1`; then
5067        missing_perl_modules="$missing_perl_modules Digest::MD5"
5068     fi
5069        AC_MSG_ERROR([
5070     The missing Perl modules are: $missing_perl_modules
5071     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5074 dnl ===================================================================
5075 dnl Check for pkg-config
5076 dnl ===================================================================
5077 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5078     PKG_PROG_PKG_CONFIG
5081 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5083     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5084     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5085     # explicitly. Or put /path/to/compiler in PATH yourself.
5087     AC_CHECK_TOOL(AR,ar)
5088     AC_CHECK_TOOL(NM,nm)
5089     AC_CHECK_TOOL(OBJDUMP,objdump)
5090     AC_CHECK_TOOL(RANLIB,ranlib)
5091     AC_CHECK_TOOL(STRIP,strip)
5092     if test "$_os" = "WINNT"; then
5093         AC_CHECK_TOOL(DLLTOOL,dlltool)
5094         AC_CHECK_TOOL(WINDRES,windres)
5095     fi
5097 AC_SUBST(AR)
5098 AC_SUBST(DLLTOOL)
5099 AC_SUBST(NM)
5100 AC_SUBST(OBJDUMP)
5101 AC_SUBST(PKG_CONFIG)
5102 AC_SUBST(RANLIB)
5103 AC_SUBST(STRIP)
5104 AC_SUBST(WINDRES)
5106 dnl ===================================================================
5107 dnl pkg-config checks on Mac OS X
5108 dnl ===================================================================
5110 if test $_os = Darwin; then
5111     AC_MSG_CHECKING([for bogus pkg-config])
5112     if test -n "$PKG_CONFIG"; then
5113         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5114             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5115         else
5116             if test "$enable_bogus_pkg_config" = "yes"; then
5117                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5118             else
5119                 AC_MSG_ERROR([yes, from unknown origin. This *will* break the build. Please remove or hide $PKG_CONFIG])
5120             fi
5121         fi
5122     else
5123         AC_MSG_RESULT([no, good])
5124     fi
5127 find_csc()
5129     # Return value: $csctest
5131     unset csctest
5133     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5134     if test -n "$regvalue"; then
5135         csctest=$regvalue
5136         return
5137     fi
5140 find_al()
5142     # Return value: $altest
5144     unset altest
5146     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5147         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5148         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5149             altest=$regvalue
5150             return
5151         fi
5152     done
5155 find_dotnetsdk()
5157     # Return value: $frametest (that's a silly name...)
5159     unset frametest
5161     for ver in 1.1 2.0; do
5162         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
5163         if test -n "$regvalue"; then
5164             frametest=$regvalue
5165             return
5166         fi
5167     done
5170 find_winsdk_version()
5172     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5173     # Return value: $winsdktest
5175     unset winsdktest
5177     # Why we look for them in this particular order I don't know. But OTOH I
5178     case "$1" in
5179     6.0*|7.*)
5180         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5181         if test -n "$regvalue"; then
5182             winsdktest=$regvalue
5183             return
5184         fi
5185         ;;
5186     8.*)
5187         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5188         if test -n "$regvalue"; then
5189             winsdktest=$regvalue
5190             return
5191         fi
5192         ;;
5193     esac
5196 find_winsdk()
5198     # Args: $1 (optional) : list of acceptable SDK versions
5199     # Return value: $winsdktest
5201     unset winsdktest
5203     if test -n "$1"; then
5204         sdkversions=$1
5205     else
5206         sdkversions="$WINDOWS_SDK_ACCEPTABLE_VERSIONS"
5207     fi
5209     for ver in $sdkversions; do
5210         find_winsdk_version $ver
5211         if test -n "$winsdktest"; then
5212             return
5213         fi
5214     done
5217 find_msms()
5219     for ver in 10.0 11.0; do
5220         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5221         if test -n "$regvalue"; then
5222             if test -e "$regvalue/Microsoft_VC${VCVER}_CRT_x86.msm"; then
5223                 msmdir=$regvalue
5224                 break
5225             fi
5226         fi
5227     done
5228     if test -z "$msmdir"; then
5229         AC_MSG_NOTICE([no registry entry for Merge Module directory - trying "$COMMONPROGRAMFILES\Merge Modules"])
5230         msmdir="$COMMONPROGRAMFILES\Merge Modules"
5231     fi
5232     msmdir=`cygpath -m "$msmdir"`
5233     if test -z "$msmdir"; then
5234         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5235             AC_MSG_ERROR([Merge modules not found in $msmdir])
5236         else
5237             AC_MSG_WARN([Merge modules not found in $msmdir])
5238             msmdir=""
5239         fi
5240     fi
5243 find_msvc_x64_dlls()
5245     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5246     msvcdlls="msvcp${VCVER}.dll msvcr${VCVER}.dll"
5247     for dll in $msvcdlls; do
5248         if ! test -f "$msvcdllpath/$dll"; then
5249             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5250         fi
5251     done
5254 if test "$build_os" = "cygwin"; then
5255     dnl Check midl.exe
5256     AC_MSG_CHECKING([for midl.exe])
5258     find_winsdk
5259     if test -f "$winsdktest/Bin/midl.exe"; then
5260         MIDL_PATH="$winsdktest/Bin"
5261     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5262         MIDL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5263     fi
5264     if test ! -f "$MIDL_PATH/midl.exe"; then
5265         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5266     else
5267         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5268     fi
5270     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5271     MIDL_PATH=`cygpath -d "$MIDL_PATH"`
5272     MIDL_PATH=`cygpath -u "$MIDL_PATH"`
5274     dnl Check csc.exe
5275     AC_MSG_CHECKING([for csc.exe])
5276     find_csc
5277     if test -f "$csctest/csc.exe"; then
5278         CSC_PATH="$csctest"
5279     fi
5280     if test ! -f "$CSC_PATH/csc.exe"; then
5281         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5282     else
5283         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5284     fi
5286     CSC_PATH=`cygpath -d "$CSC_PATH"`
5287     CSC_PATH=`cygpath -u "$CSC_PATH"`
5289     dnl Check al.exe
5290     AC_MSG_CHECKING([for al.exe])
5291     find_winsdk
5292     if test -f "$winsdktest/Bin/al.exe"; then
5293         AL_PATH="$winsdktest/Bin"
5294     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5295         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5296     fi
5298     if test -z "$AL_PATH"; then
5299         find_al
5300         if test -f "$altest/bin/al.exe"; then
5301             AL_PATH="$altest/bin"
5302         elif test -f "$altest/al.exe"; then
5303             AL_PATH="$altest"
5304         fi
5305     fi
5306     if test ! -f "$AL_PATH/al.exe"; then
5307         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5308     else
5309         AC_MSG_RESULT([$AL_PATH/al.exe])
5310     fi
5312     AL_PATH=`cygpath -d "$AL_PATH"`
5313     AL_PATH=`cygpath -u "$AL_PATH"`
5315     dnl Check mscoree.lib / .NET Framework dir
5316     AC_MSG_CHECKING(.NET Framework)
5317     find_dotnetsdk
5318     if test -f "$frametest/lib/mscoree.lib"; then
5319         DOTNET_FRAMEWORK_HOME="$frametest"
5320     else
5321         find_winsdk
5322         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/win8/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5323             DOTNET_FRAMEWORK_HOME="$winsdktest"
5324         fi
5325     fi
5327     if test ! -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib" -a ! -f "$DOTNET_FRAMEWORK_HOME/lib/win8/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5328         AC_MSG_ERROR([mscoree.lib (.NET Framework) not found])
5329     fi
5330     AC_MSG_RESULT(found)
5332     PathFormat "$MIDL_PATH"
5333     MIDL_PATH="$formatted_path"
5335     PathFormat "$AL_PATH"
5336     AL_PATH="$formatted_path"
5338     PathFormat "$DOTNET_FRAMEWORK_HOME"
5339     DOTNET_FRAMEWORK_HOME="$formatted_path"
5341     PathFormat "$CSC_PATH"
5342     CSC_PATH="$formatted_path"
5345 dnl ===================================================================
5346 dnl Check if stdc headers are available excluding MSVC.
5347 dnl ===================================================================
5348 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5349     AC_HEADER_STDC
5352 dnl ===================================================================
5353 dnl Testing for C++ compiler and version...
5354 dnl ===================================================================
5356 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5357     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5358     save_CXXFLAGS=$CXXFLAGS
5359     AC_PROG_CXX
5360     CXXFLAGS=$save_CXXFLAGS
5361 else
5362     if test -n "$CC" -a -z "$CXX"; then
5363         CXX="$CC"
5364     fi
5367 dnl check if we are using a buggy version of g++ (currently 3.4.0, 3.4.1 and trunk)
5368 if test "$GXX" = "yes"; then
5369     AC_MSG_CHECKING([the GNU C++ compiler version])
5371     _gpp_version=`$CXX -dumpversion`
5372     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5374     AC_MSG_RESULT([checked (g++ $_gpp_version)])
5376     if test "$_gpp_majmin" = "304"; then
5377         AC_MSG_CHECKING([whether $CXX has the enum bug])
5378         AC_RUN_IFELSE([AC_LANG_SOURCE([[
5379             extern "C" void abort (void);
5380             extern "C" void exit (int status);
5382             enum E { E0, E1, E2, E3, E4, E5 };
5384             void test (enum E e)
5385             {
5386                 if (e == E2 || e == E3 || e == E1)
5387                     exit (1);
5388             }
5390             int main (void)
5391             {
5392                 test (E4);
5393                 test (E5);
5394                 test (E0);
5395                 return 0;
5396             }
5397             ]])],[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])],[])
5398     fi
5399     dnl see https://code.google.com/p/android/issues/detail?id=41770
5400     if test "$_gpp_majmin" -ge "407"; then
5401             glibcxx_threads=no
5402             AC_LANG_PUSH([C++])
5403             AC_REQUIRE_CPP
5404             AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5405             AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5406                 #include <bits/c++config.h>]],[[
5407                 #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5408                 && !defined(_GLIBCXX__PTHREADS) \
5409                 && !defined(_GLIBCXX_HAS_GTHREADS)
5410                 choke me
5411                 #endif
5412             ]])],[AC_MSG_RESULT([yes])
5413             glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5414             AC_LANG_POP([C++])
5415             if test $glibcxx_threads = yes; then
5416                   BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5417             fi
5418      fi
5420 AC_SUBST(BOOST_CXXFLAGS)
5423 # prefx CXX with ccache if needed
5425 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5426     if test "$CCACHE" != ""; then
5427         AC_MSG_CHECKING([whether $CXX is already ccached])
5428         AC_LANG_PUSH([C++])
5429         save_CXXFLAGS=$CXXFLAGS
5430         CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5431         dnl an empty program will do, we're checking the compiler flags
5432         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5433                           [use_ccache=yes], [use_ccache=no])
5434         if test $use_ccache = yes; then
5435             AC_MSG_RESULT([yes])
5436         else
5437             CXX="$CCACHE $CXX"
5438             AC_MSG_RESULT([no])
5439         fi
5440         CXXFLAGS=$save_CXXFLAGS
5441         AC_LANG_POP([C++])
5442     fi
5445 dnl ===================================================================
5446 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5447 dnl ===================================================================
5449 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5450     AC_PROG_CXXCPP
5452     dnl Check whether there's a C pre-processor.
5453     dnl ===================================================================
5454     dnl When using SunStudio compiler, there is a bug with the cc
5455     dnl preprocessor, so use CC preprocessor as the cc preprocessor
5456     dnl See Issuezilla #445.
5457     dnl ===================================================================
5458     if test "$_os" = "SunOS"; then
5459         CPP=$CXXCPP
5460     else
5461         AC_PROG_CPP
5462     fi
5466 dnl ===================================================================
5467 dnl Find integral type sizes and alignments
5468 dnl ===================================================================
5470 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5472     AC_CHECK_SIZEOF(long)
5473     AC_CHECK_SIZEOF(short)
5474     AC_CHECK_SIZEOF(int)
5475     AC_CHECK_SIZEOF(long long)
5476     AC_CHECK_SIZEOF(double)
5477     AC_CHECK_SIZEOF(void*)
5479     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5480     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5481     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5482     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5483     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5485     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5486     m4_pattern_allow([AC_CHECK_ALIGNOF])
5487     m4_ifdef([AC_CHECK_ALIGNOF],
5488         [
5489             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5490             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5491             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5492             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5493         ],
5494         [
5495             case "$_os-$host_cpu" in
5496             Linux-i686)
5497                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5498                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5499                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5500                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5501                 ;;
5502             Linux-x86_64)
5503                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5504                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5505                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5506                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5507                 ;;
5508             *)
5509                 if test -z "$ac_cv_alignof_short" -o \
5510                         -z "$ac_cv_alignof_int" -o \
5511                         -z "$ac_cv_alignof_long" -o \
5512                         -z "$ac_cv_alignof_double"; then
5513                    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.])
5514                 fi
5515                 ;;
5516             esac
5517         ])
5519     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5520     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5521     if test $ac_cv_sizeof_long -eq 8; then
5522         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5523     elif test $ac_cv_sizeof_double -eq 8; then
5524         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5525     else
5526         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5527     fi
5529     dnl Check for large file support
5530     AC_SYS_LARGEFILE
5531     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5532         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5533     fi
5534     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5535         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5536     fi
5537 else
5538     # Hardcode for MSVC
5539     SAL_TYPES_SIZEOFSHORT=2
5540     SAL_TYPES_SIZEOFINT=4
5541     SAL_TYPES_SIZEOFLONG=4
5542     SAL_TYPES_SIZEOFLONGLONG=8
5543     if test "$BITNESS_OVERRIDE" = ""; then
5544         SAL_TYPES_SIZEOFPOINTER=4
5545     else
5546         SAL_TYPES_SIZEOFPOINTER=8
5547     fi
5548     SAL_TYPES_ALIGNMENT2=2
5549     SAL_TYPES_ALIGNMENT4=4
5550     SAL_TYPES_ALIGNMENT8=8
5551     LFS_CFLAGS=''
5553 AC_SUBST(LFS_CFLAGS)
5555 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5556 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5557 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5558 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5559 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5560 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5561 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5562 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5564 dnl ===================================================================
5565 dnl Check if valgrind headers are available
5566 dnl ===================================================================
5567 ENABLE_VALGRIND=
5568 if test "$cross_compiling" != yes; then
5569     prev_cppflags=$CPPFLAGS
5570     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5571     # or where does it come from?
5572     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5573     AC_CHECK_HEADER([valgrind/valgrind.h],
5574         [ENABLE_VALGRIND=TRUE])
5575     CPPFLAGS=$prev_cppflags
5577 AC_SUBST([ENABLE_VALGRIND])
5578 if test -z "$ENABLE_VALGRIND"; then
5579     VALGRIND_CFLAGS=
5581 AC_SUBST([VALGRIND_CFLAGS])
5584 dnl ===================================================================
5585 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5586 dnl ===================================================================
5588 # We need at least the sys/sdt.h include header.
5589 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5590 if test "$SDT_H_FOUND" = "TRUE"; then
5591   # Found sys/sdt.h header, now make sure the c++ compiler works.
5592   # Old g++ versions had problems with probes in constructors/destructors.
5593   AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5594   AC_LANG_PUSH([C++])
5595   AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5596     #include <sys/sdt.h>
5597     class ProbeClass
5598     {
5599     private:
5600       int& ref;
5601       const char *name;
5603     public:
5604       ProbeClass(int& v, const char *n) : ref(v), name(n)
5605       {
5606         DTRACE_PROBE2(_test_, cons, name, ref);
5607       }
5609       void method(int min)
5610       {
5611         DTRACE_PROBE3(_test_, meth, name, ref, min);
5612         ref -= min;
5613       }
5615       ~ProbeClass()
5616       {
5617         DTRACE_PROBE2(_test_, dest, name, ref);
5618       }
5619     };
5620   ]],[[
5621     int i = 64;
5622     DTRACE_PROBE1(_test_, call, i);
5623     ProbeClass inst = ProbeClass(i, "call");
5624     inst.method(24);
5625   ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5626         [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5627   AC_LANG_POP([C++])
5629 AC_CONFIG_HEADERS([config_host/config_probes.h])
5631 dnl ===================================================================
5632 dnl Compiler plugins
5633 dnl ===================================================================
5635 COMPILER_PLUGINS=
5636 # currently only Clang
5637 if test "$COM_GCC_IS_CLANG" = "TRUE"; then
5638     if test -n "$enable_compiler_plugins"; then
5639         compiler_plugins="$enable_compiler_plugins"
5640     elif test -n "$ENABLE_DBGUTIL"; then
5641         compiler_plugins=test
5642     else
5643         compiler_plugins=no
5644     fi
5645     if test "$compiler_plugins" != "no"; then
5646         dnl The prefix where Clang resides, override to where Clang resides if
5647         dnl using a source build:
5648         if test -z "$CLANGDIR"; then
5649             CLANGDIR=/usr
5650         fi
5651         dnl The build directory (different from CLANGDIR if using a Clang out-
5652         dnl of-source build):
5653         if test -z "$CLANGBUILD"; then
5654             CLANGBUILD=/usr
5655         fi
5656         AC_LANG_PUSH([C++])
5657         save_CPPFLAGS=$CPPFLAGS
5658         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"
5659         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
5660             [COMPILER_PLUGINS=TRUE],
5661             [
5662             if test "$compiler_plugins" = "yes"; then
5663                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
5664             else
5665                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
5666                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
5667             fi
5668             ])
5669         CPPFLAGS=$save_CPPFLAGS
5670         AC_LANG_POP([C++])
5671     fi
5672 else
5673     if test "$enable_compiler_plugins" = "yes"; then
5674         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
5675     fi
5677 AC_SUBST(COMPILER_PLUGINS)
5678 AC_SUBST(CLANGDIR)
5679 AC_SUBST(CLANGBUILD)
5681 dnl ===================================================================
5682 dnl Set the MinGW sys-root
5683 dnl ===================================================================
5684 if test "$WITH_MINGW" = "yes"; then
5685     AC_MSG_CHECKING([for MinGW sysroot])
5686     sysroot=`$CC -print-sysroot`
5687     AS_IF([test -d "$sysroot"/mingw],
5688           [MINGW_SYSROOT="$sysroot"/mingw
5689            AC_MSG_RESULT([$MINGW_SYSROOT])],
5690           [AC_MSG_RESULT([not found])
5691            AC_MSG_ERROR([cannot determine MinGW sysroot])])
5693 AC_SUBST([MINGW_DLLS])
5694 AC_SUBST([MINGW_SYSROOT])
5696 dnl ===================================================================
5697 dnl Set the MinGW include directories
5698 dnl ===================================================================
5699 if test "$WITH_MINGW" = "yes"; then
5700     AC_MSG_CHECKING([for MinGW include path])
5701     cat >conftest.$ac_ext <<_ACEOF
5702 #include <stddef.h>
5703 #include <bits/c++config.h>
5704 _ACEOF
5705     _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`
5706     rm conftest.$ac_ext
5707     if test -z "$_mingw_lib_include_path"; then
5708         _mingw_lib_include_path="NO_LIB_INCLUDE"
5709         AC_MSG_RESULT([no MinGW include path])
5710     else
5711         AC_MSG_RESULT([$_mingw_lib_include_path])
5712     fi
5713     MINGW_LIB_INCLUDE_PATH="$_mingw_lib_include_path"
5714     AC_SUBST(MINGW_LIB_INCLUDE_PATH)
5716     AC_LANG_PUSH([C++])
5718     AC_MSG_CHECKING([for dynamic libgcc])
5719     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5720 #include <iostream>
5721 using namespace std;
5722 ]], [[ try { throw 42; } catch (int e) { cout << "Yep, " << e << endl; } ]])],[
5723             MINGW_GCCDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libgcc' | $SED -e 's@.*DLL Name: @@'`
5724             if test -n "$MINGW_GCCDLL"; then
5725                 MINGW_SHARED_GCCLIB=YES
5726                 AC_MSG_RESULT([ $MINGW_GCCDLL])
5727             else
5728                 MINGW_SHARED_GCCLIB=NO
5729                 AC_MSG_RESULT([no])
5730             fi
5731        ],[ AC_MSG_RESULT([no])
5733     ])
5735     AC_MSG_CHECKING([for dynamic libstdc++])
5736     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5737 #include <iostream>
5738 using namespace std;
5739 ]], [[ cout << "Hello there." << endl; ]])],[
5740             MINGW_GXXDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libstdc++' | $SED -e 's@.*DLL Name: @@'`
5741             if test -n "$MINGW_GXXDLL"; then
5742                 mingw_gxxdll_root=${MINGW_GXXDLL%.dll}
5743                 mingw_gxxdll_root=${mingw_gxxdll_root#lib}
5744                 if test "$CROSS_COMPILING" = "YES"; then
5745                     dnl m4 escaping!
5746                     mingw_gxxdll_root=${mingw_gxxdll_root%-[[0-9]]}
5747                 fi
5748                 MINGW_SHARED_LIBSTDCPP=-l$mingw_gxxdll_root
5749                 MINGW_SHARED_GXXLIB=YES
5750                 AC_MSG_RESULT([$MINGW_GXXDLL])
5751             else
5752                 MINGW_SHARED_GXXLIB=NO
5753                 AC_MSG_RESULT([no])
5754             fi
5755        ],[ AC_MSG_RESULT([no])
5757     ])
5759     AC_LANG_POP([C++])
5761     AC_SUBST(MINGW_SHARED_GCCLIB)
5762     AC_SUBST(MINGW_SHARED_GXXLIB)
5763     AC_SUBST(MINGW_SHARED_LIBSTDCPP)
5764     AC_SUBST(MINGW_GCCDLL)
5765     AC_SUBST(MINGW_GXXDLL)
5768 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
5769     AC_DEFINE(HAVE_FMERGENEUTRALITEMS)
5772 if test "$WITH_MINGW" = "yes"; then
5773     AC_MSG_CHECKING([for fMergeNeutralItems in SCRIPT_CONTROL])
5774     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
5775     [
5776     #include <usp10.h>
5777     ],
5778     [
5779     SCRIPT_CONTROL c;
5780     c.fMergeNeutralItems = 1;
5781     ])],
5782     [
5783     AC_MSG_RESULT(yes)
5784     AC_DEFINE(HAVE_FMERGENEUTRALITEMS)
5785     ],
5786     [AC_MSG_RESULT(no)])
5789 dnl ===================================================================
5790 dnl Extra checking for the SunOS compiler
5791 dnl ===================================================================
5792 if test "$_os" = "SunOS"; then
5793     dnl SunStudio C++ compiler packaged with SunStudio C compiler
5794     if test "$CC" = "cc"; then
5795     AC_MSG_CHECKING([SunStudio C++ Compiler])
5796         if test "$CXX" != "CC"; then
5797             AC_MSG_WARN([SunStudio C++ was not found])
5798             add_warning "SunStudio C++ was not found"
5799         else
5800             AC_MSG_RESULT([checked])
5801         fi
5802     fi
5805 dnl *************************************************************
5806 dnl Testing for exception handling - dwarf2 or sjlj exceptions...
5807 dnl *************************************************************
5808 if test "$WITH_MINGW" = "yes"; then
5809     AC_MSG_CHECKING([exception type])
5810     AC_LANG_PUSH([C++])
5811     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iostream>
5813         extern "C" void _Unwind_SjLj_RaiseException(void) __attribute__ ((__noreturn__));
5815         ]], [[_Unwind_SjLj_RaiseException() ]])],[exceptions_type="sjlj"],[exceptions_type="dwarf2"
5816     ])
5817     AC_MSG_RESULT($exceptions_type)
5818     AC_LANG_POP([C++])
5821 EXCEPTIONS="$exceptions_type"
5822 AC_SUBST(EXCEPTIONS)
5824 dnl ===================================================================
5825 dnl thread-safe statics
5826 dnl ===================================================================
5827 AC_MSG_CHECKING([whether $CXX supports thread safe statics])
5828 unset HAVE_THREADSAFE_STATICS
5829 if test "$GCC" = "yes"; then
5830     dnl -fthreadsafe-statics is available since GCC 4, so always available for
5831     dnl us.  However, some C++ runtimes use a single lock for all static
5832     dnl variables, which can cause deadlock in multi-threaded applications.
5833     dnl This is not easily tested here; for POSIX-based systems, if executing
5834     dnl the following C++ program does not terminate then the tool chain
5835     dnl apparently has this problem:
5836     dnl
5837     dnl   #include <pthread.h>
5838     dnl   int h() { return 0; }
5839     dnl   void * g(void * unused) {
5840     dnl     static int n = h();
5841     dnl     return &n;
5842     dnl   }
5843     dnl   int f() {
5844     dnl     pthread_t t;
5845     dnl     pthread_create(&t, 0, g, 0);
5846     dnl     pthread_join(t, 0);
5847     dnl     return 0;
5848     dnl   }
5849     dnl   int main() {
5850     dnl     static int n = f();
5851     dnl     return n;
5852     dnl   }
5853     dnl
5854     dnl Mac OS X up to at least 10.7.1 is known to have this problem, as is at
5855     dnl least one instance of GCC 4.2.4 (used on a "Linux ooobuild1.osuosl.org
5856     dnl 2.6.9-101.plus.c4smp #1 SMP Thu Jul 21 19:08:15 EDT 2011 i686 i686 i386
5857     dnl GNU/Linux" machine); see the definition of __cxa_guard_acquire in GCC's
5858     dnl libstdc++-v3/libsupc++/guard.cc for what #ifdefs actually make a
5859     dnl difference there.  Conservative advice from Jakub Jelinek is to assume
5860     dnl it working in GCC >= 4.3, so conservative way to check here is to use
5861     dnl GCC_VERSION for GCC but resort to __GLIBCXX__ corresponding to libstdc++
5862     dnl shipped with GCC 4.3.0 (cf. <http://gcc.gnu.org/onlinedocs/libstdc++/
5863     dnl manual/abi.html#abi.versioning.history>; 4.3.0 is 20080306, 4.2.4 is
5864     dnl 20080519, 4.3.1 is 20080606) for Clang (for which GCC_VERSION is notoriously
5865     dnl "too old"):
5866     if test "$_os" != Darwin -a "$_os" != Android; then
5867         if test "$COM_GCC_IS_CLANG" = TRUE; then
5868             AC_LANG_PUSH([C++])
5869             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5870 #include <list>
5871 #if !defined __GLIBCXX__ ||(__GLIBCXX__ < 20080606 && __GLIBCXX__ != 20080306)
5872 #error
5873 #endif
5874                 ]])],[HAVE_THREADSAFE_STATICS=TRUE],[])
5875             AC_LANG_POP([C++])
5876         elif test "${GCC_VERSION?}" -ge 0403; then
5877             HAVE_THREADSAFE_STATICS=TRUE
5878         fi
5879     fi
5880     if test "$HAVE_THREADSAFE_STATICS" = TRUE; then
5881         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5882         AC_MSG_RESULT([yes])
5883     else
5884         AC_MSG_RESULT([broken (i.e., no)])
5885     fi
5886 else
5887     AC_MSG_RESULT([unknown (assuming no)])
5889 AC_SUBST(HAVE_THREADSAFE_STATICS)
5891 dnl ===================================================================
5892 dnl visibility and other gcc features
5893 dnl ===================================================================
5894 if test "$GCC" = "yes"; then
5895     AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
5896     save_CFLAGS=$CFLAGS
5897     CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
5898     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_VISIBILITY_FEATURE=TRUE ],[])
5899     CFLAGS=$save_CFLAGS
5901     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5902         AC_MSG_RESULT([yes])
5903     else
5904         AC_MSG_RESULT([no])
5905     fi
5907     AC_MSG_CHECKING([whether $CC supports -Wno-long-double])
5908     save_CFLAGS=$CFLAGS
5909     CFLAGS="$CFLAGS -Werror -Wno-long-double"
5910     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_NO_LONG_DOUBLE=TRUE ],[])
5911     CFLAGS=$save_CFLAGS
5912     if test "$HAVE_GCC_NO_LONG_DOUBLE" = "TRUE"; then
5913         AC_MSG_RESULT([yes])
5914     else
5915         AC_MSG_RESULT([no])
5916     fi
5918     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5919     save_CFLAGS=$CFLAGS
5920     CFLAGS="$CFLAGS -Werror -mno-avx"
5921     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5922     CFLAGS=$save_CFLAGS
5923     if test "$HAVE_GCC_AVX" = "TRUE"; then
5924         AC_MSG_RESULT([yes])
5925     else
5926         AC_MSG_RESULT([no])
5927     fi
5929     AC_MSG_CHECKING([whether $CC supports atomic functions])
5930     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5931     int v = 0;
5932     if (__sync_add_and_fetch(&v, 1) != 1 ||
5933         __sync_sub_and_fetch(&v, 1) != 0)
5934         return 1;
5935     __sync_synchronize();
5936     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5937         v != 1)
5938         return 1;
5939     return 0;
5940 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5941     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5942         AC_MSG_RESULT([yes])
5943         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5944     else
5945         AC_MSG_RESULT([no])
5946     fi
5948     AC_MSG_CHECKING(
5949         [whether $CC supports pragma GCC diagnostic error/ignored/warning])
5950     save_CFLAGS=$CFLAGS
5951     CFLAGS="$CFLAGS -Werror -Wunknown-pragmas -Wunused-parameter"
5952     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5953             #pragma GCC diagnostic ignored "-Wunused-parameter"
5954             void dummy(int n) {}
5955         ])], [
5956             AC_DEFINE([HAVE_GCC_PRAGMA_DIAGNOSTIC_MODIFY],[1])
5957             AC_MSG_RESULT([yes])
5958         ], [AC_MSG_RESULT([no])])
5959     CFLAGS=$save_CFLAGS
5961     AC_MSG_CHECKING([whether $CC supports pragma GCC diagnostic push/pop])
5962     save_CFLAGS=$CFLAGS
5963     CFLAGS="$CFLAGS -Werror -Wunknown-pragmas -Wunused-parameter"
5964     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5965             #pragma GCC diagnostic push
5966             #pragma GCC diagnostic ignored "-Wunused-parameter"
5967             void dummy(int n) {}
5968             #pragma GCC diagnostic pop
5969         ])], [
5970             AC_DEFINE([HAVE_GCC_PRAGMA_DIAGNOSTIC_SCOPE],[1])
5971             AC_MSG_RESULT([yes])
5972         ], [AC_MSG_RESULT([no])])
5973     CFLAGS=$save_CFLAGS
5975     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5976     save_CFLAGS=$CFLAGS
5977     CFLAGS="$CFLAGS -Werror"
5978     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5979             __attribute__((deprecated("test"))) void f();
5980         ])], [
5981             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5982             AC_MSG_RESULT([yes])
5983         ], [AC_MSG_RESULT([no])])
5984     CFLAGS=$save_CFLAGS
5986     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
5987     AC_LANG_PUSH([C++])
5988     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5989             #include <cxxabi.h>
5990             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
5991         ])], [
5992             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
5993             AC_MSG_RESULT([yes])
5994         ], [AC_MSG_RESULT([no])])
5995     AC_LANG_POP([C++])
5997     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
5998     AC_LANG_PUSH([C++])
5999     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6000             #include <cxxabi.h>
6001             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6002         ])], [
6003             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_GET_GLOBALS],[1])
6004             AC_MSG_RESULT([yes])
6005         ], [AC_MSG_RESULT([no])])
6006     AC_LANG_POP([C++])
6008     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6009     AC_LANG_PUSH([C++])
6010     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6011             #include <cxxabi.h>
6012             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6013         ])], [
6014             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_THROW],[1])
6015             AC_MSG_RESULT([yes])
6016         ], [AC_MSG_RESULT([no])])
6017     AC_LANG_POP([C++])
6019     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6020     AC_LANG_PUSH([C++])
6021     save_CXXFLAGS=$CXXFLAGS
6022     CXXFLAGS="$CFLAGS -Werror -Wunknown-pragmas"
6023     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6024             struct __attribute__((warn_unused)) dummy {};
6025         ])], [
6026             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6027             AC_MSG_RESULT([yes])
6028         ], [AC_MSG_RESULT([no])])
6029     CXXFLAGS=$save_CXXFLAGS
6030     AC_LANG_POP([C++])
6032     AC_MSG_CHECKING([whether STL uses __attribute__((warn_unused))])
6033     AC_LANG_PUSH([C++])
6034     save_CXXFLAGS=$CXXFLAGS
6035     CXXFLAGS="$CFLAGS -Werror -Wunused"
6036     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6037             #include <string>
6038             void f() { std::string s; }
6039         ])], [
6040             AC_MSG_RESULT([no])
6041         ], [
6042             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED_STL],[1])
6043             AC_MSG_RESULT([yes])])
6044     CXXFLAGS=$save_CXXFLAGS
6045     AC_LANG_POP([C++])
6048 AC_SUBST(HAVE_GCC_NO_LONG_DOUBLE)
6049 AC_SUBST(HAVE_GCC_AVX)
6050 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6052 dnl ===================================================================
6053 dnl Identify the C++ library
6054 dnl ===================================================================
6056 AC_MSG_CHECKING([What the C++ library is])
6057 AC_LANG_PUSH([C++])
6058 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6059 #include <utility>
6060 #ifndef __GLIBCXX__
6061 foo bar
6062 #endif
6063 ]])],
6064     [CPP_LIBRARY=GLIBCXX
6065      cpp_library_name="GNU libstdc++"
6066     ],
6067     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6068 #include <utility>
6069 #ifndef _LIBCPP_VERSION
6070 foo bar
6071 #endif
6072 ]])],
6073     [CPP_LIBRARY=LIBCPP
6074      cpp_library_name="LLVM libc++"
6075     ],
6076     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6077 #include <utility>
6078 #ifndef _MSC_VER
6079 foo bar
6080 #endif
6081 ]])],
6082     [CPP_LIBRARY=MSVCRT
6083      cpp_library_name="Microsoft"
6084     ],
6085     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6086 AC_MSG_RESULT([$cpp_library_name])
6087 AC_LANG_POP([C++])
6088 AC_SUBST(CPP_LIBRARY)
6090 dnl ===================================================================
6091 dnl C++11
6092 dnl ===================================================================
6094 CXXFLAGS_CXX11=
6095 HAVE_CXX11=
6096 if test "$COM" = MSC; then
6097     AC_MSG_CHECKING([whether $CXX supports C++11])
6098     AC_MSG_RESULT(yes)
6099     # MSVC supports (a subset of) CXX11 without any switch
6100     HAVE_CXX11=TRUE
6101     CXXFLAGS_CXX11=
6102 elif test "$GCC" = "yes"; then
6103     CXXFLAGS_CXX11=
6104     AC_MSG_CHECKING([whether $CXX supports C++11])
6105     for flag in -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x ; do
6106         save_CXXFLAGS=$CXXFLAGS
6107         CXXFLAGS="$CXXFLAGS $flag -Werror"
6108         AC_LANG_PUSH([C++])
6109         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[void f() {}]])],[CXXFLAGS_CXX11=$flag])
6110         AC_LANG_POP([C++])
6111         CXXFLAGS=$save_CXXFLAGS
6112         if test -n "$CXXFLAGS_CXX11"; then
6113             HAVE_CXX11=TRUE
6114             break
6115         fi
6116     done
6117     if test "$HAVE_CXX11" = TRUE; then
6118         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6119     else
6120         AC_MSG_RESULT(no)
6121     fi
6124 if test $CPP_LIBRARY = GLIBCXX -a "$HAVE_CXX11" = TRUE; then
6125     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6126     AC_LANG_PUSH([C++])
6127     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6128 #include <list>
6129 #if !defined(__GLIBCXX__)
6130 /* ok */
6131 #elif __GLIBCXX__ < 20111004
6132 /* before breakage */
6133 #elif __GLIBCXX__ > 20120703
6134 /* after breakage */
6135 #else
6136 abi broken
6137 #endif
6138         ]])], [AC_MSG_RESULT(no, ok)],
6139         [AC_MSG_RESULT(yes, disabling C++11)
6140          HAVE_CXX11=])
6141     AC_LANG_POP([C++])
6144 if test "$HAVE_CXX11" = TRUE; then
6145     AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6146     save_CXXFLAGS=$CXXFLAGS
6147     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6148     AC_LANG_PUSH([C++])
6150     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6151 #include <stddef.h>
6153 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6155 namespace
6157         struct b
6158         {
6159                 int i;
6160                 int j;
6161         };
6163 ]], [[
6164 struct a
6166         int i;
6167         int j;
6169 a thinga[]={{0,0}, {1,1}};
6170 b thingb[]={{0,0}, {1,1}};
6171 size_t i = sizeof(sal_n_array_size(thinga));
6172 size_t j = sizeof(sal_n_array_size(thingb));
6173 return !(i != 0 && j != 0);
6175         ], [ AC_MSG_RESULT(yes) ],
6176         [ AC_MSG_RESULT(no)
6177           HAVE_CXX11=
6178         ])
6179     AC_LANG_POP([C++])
6180     CXXFLAGS=$save_CXXFLAGS
6183 if test "$HAVE_CXX11" = TRUE; then
6184     AC_MSG_CHECKING([whether $CXX supports C++11 without __float128 compile error])
6185     save_CXXFLAGS=$CXXFLAGS
6186     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6187     AC_LANG_PUSH([C++])
6189     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6190 #include <vector>
6191     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6192     // (__float128)
6194     ],[ AC_MSG_RESULT(yes) ],
6195     [
6196         AC_MSG_RESULT(no)
6197         # The only reason why libstdc++ headers fail with Clang in C++11 mode is because
6198         # they use the __float128 type that Clang doesn't know (libstdc++ checks whether
6199         # __float128 is available during its build, but it's usually built using GCC,
6200         # and so c++config.h hardcodes __float128 being supported). As the only place
6201         # where __float128 is actually used is in a template specialization,
6202         # -D__float128=void will avoid the problem there while still causing a problem
6203         # if somebody actually uses the type.
6204         AC_MSG_CHECKING([whether -D__float128=void workaround helps])
6205         CXXFLAGS="$CXXFLAGS -D__float128=void"
6206         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6207 #include <vector>
6208     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6209     // (__float128)
6211         ],
6212         [
6213          AC_MSG_RESULT(yes)
6214          CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -D__float128=void"
6215         ],
6216         [
6217          AC_MSG_RESULT(no)
6218          HAVE_CXX11=
6219         ])
6220     ])
6222     AC_LANG_POP([C++])
6223     CXXFLAGS=$save_CXXFLAGS
6226 if test "$HAVE_CXX11" = "TRUE"; then
6227     AC_DEFINE(HAVE_CXX11)
6228 elif test -n "$CXXFLAGS_CXX11"; then
6229     AC_MSG_NOTICE([Disabling C++11 support])
6230     CXXFLAGS_CXX11=
6231 elif test "$CPP_LIBRARY" = LIBCPP -a $_os = Darwin; then
6232     AC_MSG_ERROR([Selected libc++ but C++11 support broken])
6235 AC_SUBST(CXXFLAGS_CXX11)
6236 AC_SUBST(HAVE_CXX11)
6238 dnl ==================================
6239 dnl Check for C++11 "= delete" support
6240 dnl ==================================
6242 if test "$HAVE_CXX11" = "TRUE"; then
6243     AC_MSG_CHECKING([whether $CXX supports C++11 = delete syntax])
6244     save_CXXFLAGS=$CXXFLAGS
6245     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6246     AC_LANG_PUSH([C++])
6247     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6248 struct A
6249     {
6250     void test() = delete;
6251     };
6252 ]])],[HAVE_CXX11_DELETE=TRUE],[])
6254     AC_LANG_POP([C++])
6255     CXXFLAGS=$save_CXXFLAGS
6256     if test "$HAVE_CXX11_DELETE" = "TRUE"; then
6257         AC_MSG_RESULT([yes])
6258         AC_DEFINE([HAVE_CXX11_DELETE])
6259     else
6260         AC_MSG_RESULT([no])
6261     fi
6264 dnl ==================================
6265 dnl Check for C++11 "override" support
6266 dnl ==================================
6268 if test "$HAVE_CXX11" = "TRUE"; then
6269     AC_MSG_CHECKING([whether $CXX supports C++11 "override" syntax])
6270     save_CXXFLAGS=$CXXFLAGS
6271     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6272     AC_LANG_PUSH([C++])
6273     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6274 struct A
6276         virtual void test();
6279 struct B : A
6281         virtual void test() override;
6283 ]])],[HAVE_CXX11_OVERRIDE=TRUE],[])
6285     AC_LANG_POP([C++])
6286     CXXFLAGS=$save_CXXFLAGS
6287     if test "$HAVE_CXX11_OVERRIDE" = "TRUE"; then
6288         AC_MSG_RESULT([yes])
6289         AC_DEFINE([HAVE_CXX11_OVERRIDE])
6290     else
6291         AC_MSG_RESULT([no])
6292     fi
6295 dnl ==================================
6296 dnl Check for C++11 "final" support
6297 dnl ==================================
6299 if test "$HAVE_CXX11" = "TRUE"; then
6300     AC_MSG_CHECKING([whether $CXX supports C++11 "final" syntax])
6301     save_CXXFLAGS=$CXXFLAGS
6302     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6303     AC_LANG_PUSH([C++])
6304     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6305 // First check that this correct program that uses "final" compiles
6306 struct A final
6310 struct B
6312         virtual void test();
6315 struct C : B
6317         void test() final;
6319 ]])],[have_final=yes],[])
6321     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6322 // Then check that the "final" works as expected,
6323 // that this program fails to compile
6324 struct A final
6328 struct B : A
6331 ]])],[],[final_class_works=yes])
6333     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6334 // Also this should fail to compile
6335 struct B
6337         virtual void test();
6340 struct C : B
6342         void test() final;
6345 struct D : C
6347         void test();
6349 ]])],[],[final_method_works=yes])
6350     AC_LANG_POP([C++])
6352     CXXFLAGS=$save_CXXFLAGS
6354     if test "$have_final" = yes -a "$final_class_works" = yes -a "$final_method_works" = yes; then
6355         AC_MSG_RESULT([yes])
6356         AC_DEFINE([HAVE_CXX11_FINAL])
6357     else
6358         AC_MSG_RESULT([no])
6359     fi
6362 dnl ===================================================================
6363 dnl Check for C++11 perfect forwarding support
6364 dnl ===================================================================
6365 if test "$HAVE_CXX11" = "TRUE"; then
6366     AC_MSG_CHECKING([whether $CXX supports C++11 perfect forwarding])
6367     save_CXXFLAGS=$CXXFLAGS
6368     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6369     AC_LANG_PUSH([C++])
6370     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6371         #include <utility>
6372         template<typename T, typename... Args> T * f(Args &&... v) {
6373             return new T(std::forward<Args>(v)...);
6374         }
6375         ]], [[
6376         f<int>(0);
6377         ]])], [perfect_forwarding=yes], [perfect_forwarding=no])
6378     AC_LANG_POP([C++])
6379     CXXFLAGS=$save_CXXFLAGS
6380     AC_MSG_RESULT([$perfect_forwarding])
6381     if test "$perfect_forwarding" = yes; then
6382         AC_DEFINE([HAVE_CXX11_PERFECT_FORWARDING])
6383     fi
6386 HAVE_GCC_PRAGMA_OPERATOR=
6387 dnl _Pragma support (may require C++11)
6388 if test "$GCC" = "yes"; then
6389     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6390     AC_LANG_PUSH([C++])
6391     save_CXXFLAGS=$CXXFLAGS
6392     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6393     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6394             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6395         ])], [
6396             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6397             HAVE_GCC_PRAGMA_OPERATOR=1
6398             AC_MSG_RESULT([yes])
6399         ], [AC_MSG_RESULT([no])])
6400     AC_LANG_POP([C++])
6401     CXXFLAGS=$save_CXXFLAGS
6403 AC_SUBST(HAVE_GCC_PRAGMA_OPERATOR)
6405 dnl ===================================================================
6406 dnl system stl sanity tests
6407 dnl ===================================================================
6408 HAVE_GCC_VISIBILITY_BROKEN=
6409 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \); then
6411     AC_LANG_PUSH([C++])
6413     save_CPPFLAGS="$CPPFLAGS"
6414     if test -n "$MACOSX_SDK_PATH"; then
6415         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6416     fi
6418     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6419     # only.
6420     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$CPP_LIBRARY" = GLIBCXX; then
6421         dnl gcc#19664, gcc#22482, rhbz#162935
6422         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6423         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6424         AC_MSG_RESULT([$stlvisok])
6425         if test "$stlvisok" = "no"; then
6426             AC_MSG_WARN([Your libstdc++ headers are not visibility safe. Disabling visibility])
6427             add_warning "Your libstdc++ headers are not visibility safe. Disabling visibility"
6428             unset HAVE_GCC_VISIBILITY_FEATURE
6429         fi
6430     fi
6432     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
6433         sharedlink_ldflags_save=$LDFLAGS
6434         LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden $PICSWITCH $LINKFLAGSSHL"
6436         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
6437         AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6438 #include <sstream>
6439 using namespace std;
6440             ]], [[
6441 istringstream strm( "test" ); return 0;
6442             ]])],
6443             # Ugh, surely bad to assume an error message will contain
6444             # the word "unresolvable", a problem with
6445             # -fvisibility-inlines-hidden and STL headers might cause
6446             # some more obscure message on some platform, and anway,
6447             # the error message could be localised.
6448             [$EGREP -q unresolvable conftest.err;
6449             if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi],[gccvisok=no
6450         ])
6451         AC_MSG_RESULT([$gccvisok])
6452         if test "$gccvisok" = "no"; then
6453             AC_MSG_WARN([Your gcc is not -fvisibility-inlines-hidden safe, disabling that.])
6454             add_warning "Your gcc is not -fvisibility-inlines-hidden safe, disabling that."
6455             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
6456         fi
6458         LDFLAGS=$sharedlink_ldflags_save
6459     fi
6461     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6462     # when we don't make any dynamic libraries?
6463     if test "$DISABLE_DYNLOADING" = "" -a "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$HAVE_GCC_VISIBILITY_BROKEN" != "TRUE"; then
6464         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6465         cat > conftestlib1.cc <<_ACEOF
6466 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6467 struct S2: S1<int> { virtual ~S2(); };
6468 S2::~S2() {}
6469 _ACEOF
6470         cat > conftestlib2.cc <<_ACEOF
6471 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6472 struct S2: S1<int> { virtual ~S2(); };
6473 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6474 _ACEOF
6475         gccvisinlineshiddenok=yes
6476         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6477             gccvisinlineshiddenok=no
6478         else
6479             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $LINKFLAGSNOUNDEFS -o libconftest2$DLLPOST >/dev/null 2>&5; then
6480                 gccvisinlineshiddenok=no
6481             fi
6482         fi
6484         rm -fr libconftest*
6485         AC_MSG_RESULT([$gccvisinlineshiddenok])
6486         if test "$gccvisinlineshiddenok" = "no"; then
6487             AC_MSG_WARN([Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that.])
6488             add_warning "Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that."
6489             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
6490         fi
6491     fi
6493     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
6494         AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6495         cat >visibility.cxx <<_ACEOF
6496 #pragma GCC visibility push(hidden)
6497 struct __attribute__ ((visibility ("default"))) TestStruct {
6498   static void Init();
6500 __attribute__ ((visibility ("default"))) void TestFunc() {
6501   TestStruct::Init();
6503 _ACEOF
6504         if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx 2>/dev/null > /dev/null; then
6505             gccvisbroken=yes
6506         else
6507             case "$host_cpu" in
6508             i?86|x86_64)
6509                 if test "$_os" = "Darwin" -o "$WITH_MINGW" = "yes"; then
6510                     gccvisbroken=no
6511                 else
6512                     if $EGREP -q '@PLT|@GOT' visibility.s; then
6513                         gccvisbroken=no
6514                     else
6515                         gccvisbroken=yes
6516                     fi
6517                 fi
6518                 ;;
6519             *)
6520                 gccvisbroken=no
6521                 ;;
6522             esac
6523         fi
6524         rm -f visibility.s visibility.cxx
6526         AC_MSG_RESULT([$gccvisbroken])
6527         if test "$gccvisbroken" = "yes"; then
6528             AC_MSG_WARN([Your gcc is not -fvisibility=hidden safe. Disabling visibility])
6529             add_warning "Your gcc is not -fvisibility=hidden safe. Disabling visibility"
6530             unset HAVE_GCC_VISIBILITY_FEATURE
6531         fi
6532     fi
6534     CPPFLAGS="$save_CPPFLAGS"
6536     AC_LANG_POP([C++])
6539 AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE)
6540 AC_SUBST(HAVE_GCC_VISIBILITY_BROKEN)
6542 dnl ===================================================================
6543 dnl  Clang++ tests
6544 dnl ===================================================================
6546 HAVE_GCC_FNO_DEFAULT_INLINE=
6547 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6548 if test "$GCC" = "yes"; then
6549     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6550     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6551         # Option just ignored and silly warning that isn't a real
6552         # warning printed
6553         :
6554     else
6555         AC_LANG_PUSH([C++])
6556         save_CXXFLAGS=$CXXFLAGS
6557         CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6558         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6559         CXXFLAGS=$save_CXXFLAGS
6560         AC_LANG_POP([C++])
6561     fi
6562     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6563         AC_MSG_RESULT([yes])
6564     else
6565         AC_MSG_RESULT([no])
6566     fi
6568     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6569     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6570         # As above
6571         :
6572     else
6573         AC_LANG_PUSH([C++])
6574         save_CXXFLAGS=$CXXFLAGS
6575         CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6576         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6577         CXXFLAGS=$save_CXXFLAGS
6578         AC_LANG_POP([C++])
6579     fi
6580     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6581         AC_MSG_RESULT([yes])
6582     else
6583         AC_MSG_RESULT([no])
6584     fi
6586 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6587 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6590 dnl ===================================================================
6591 dnl allocator
6592 dnl ===================================================================
6593 AC_MSG_CHECKING([which memory allocator to use])
6594 if test "$with_alloc" = "system"; then
6595     AC_MSG_RESULT([system])
6596     ALLOC="SYS_ALLOC"
6597     AC_CHECK_FUNCS([malloc realloc calloc free])
6599 if test "$with_alloc" = "tcmalloc"; then
6600     AC_MSG_RESULT(tcmalloc)
6601     if ! echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6602         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
6603     fi
6604     AC_CHECK_LIB([tcmalloc], [malloc], [:],
6605         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
6606     ALLOC="TCMALLOC"
6608 if test "$with_alloc" = "jemalloc"; then
6609     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
6610         AC_MSG_RESULT(jemalloc)
6611         save_CFLAGS=$CFLAGS
6612         CFLAGS="$CFLAGS -pthread"
6613         AC_CHECK_LIB([jemalloc], [malloc], [:],
6614             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
6615         ALLOC="JEMALLOC"
6616         CFLAGS=$save_CFLAGS
6617     else
6618         AC_MSG_RESULT([system])
6619         ALLOC="SYS_ALLOC"
6620         AC_CHECK_FUNCS([malloc realloc calloc free])
6621     fi
6623 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6624     AC_MSG_RESULT([internal])
6626 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6627 AC_SUBST(HAVE_POSIX_FALLOCATE)
6628 AC_SUBST(ALLOC)
6630 dnl ===================================================================
6631 dnl Custom build version
6632 dnl ===================================================================
6634 AC_MSG_CHECKING([whether to add custom build version])
6635 if test "$with_build_version" != ""; then
6636     BUILD_VER_STRING=$with_build_version
6637     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6638 else
6639     BUILD_VER_STRING=
6640     AC_MSG_RESULT([no])
6642 AC_SUBST(BUILD_VER_STRING)
6644 JITC_PROCESSOR_TYPE=""
6645 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6646     # IBMs JDK needs this...
6647     JITC_PROCESSOR_TYPE=6
6648     export JITC_PROCESSOR_TYPE
6650 AC_SUBST([JITC_PROCESSOR_TYPE])
6652 # Misc Windows Stuff
6653 if test $_os = "WINNT" -a "$WITH_MINGW" != yes; then
6654     find_msvc_x64_dlls
6655     find_msms
6656     MSVC_DLL_PATH="$msvcdllpath"
6657     MSVC_DLLS="$msvcdlls"
6658     MSM_PATH="$msmdir"
6659     SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6662 AC_SUBST(MSVC_DLL_PATH)
6663 AC_SUBST(MSVC_DLLS)
6664 AC_SUBST(MSM_PATH)
6666 dnl ===================================================================
6667 dnl Checks for Java
6668 dnl ===================================================================
6669 if test "$ENABLE_JAVA" != ""; then
6671     # Windows-specific tests
6672     if test "$build_os" = "cygwin"; then
6673         if test "$BITNESS_OVERRIDE" = 64; then
6674             bitness=64
6675         else
6676             bitness=32
6677         fi
6679         if test -z "$with_jdk_home"; then
6680             for ver in 1.7 1.6; do
6681                reg_get_value_$bitness "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6682                if test -n "$regvalue"; then
6683                    _jdk_home=$regvalue
6684                    break
6685                fi
6686             done
6687             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6688                 with_jdk_home="$_jdk_home"
6689                 howfound="found automatically"
6690             else
6691                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6692             fi
6693         else
6694             test "$build_os" = "cygwin" && with_jdk_home=`cygpath -u "$with_jdk_home"`
6695             howfound="you passed"
6696         fi
6697     fi
6699     JAVA_HOME=; export JAVA_HOME
6700     if test -z "$with_jdk_home"; then
6701         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6702     else
6703         _java_path="$with_jdk_home/bin/$with_java"
6704         dnl Check if there is a Java interpreter at all.
6705         if test -x "$_java_path"; then
6706             JAVAINTERPRETER=$_java_path
6707         else
6708             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6709         fi
6710     fi
6712     if test "$build_os" = "cygwin"; then
6713         # Check that the JDK found is correct architecture
6714         # Why is this necessary, we don't link with any library from the JDK I think,
6716         shortjdkhome=`cygpath -d "$with_jdk_home"`
6717         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
6718             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6719             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6720         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
6721             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6722             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6723         fi
6725         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6726             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6727         fi
6728         JAVAINTERPRETER=`cygpath -d "$JAVAINTERPRETER"`
6729         JAVAINTERPRETER=`cygpath -u "$JAVAINTERPRETER"`
6730     elif test $_os = Darwin -a "$BITNESS_OVERRIDE" = ""; then
6731         dnl HACK:  There currently is only a 32 bit version of LibreOffice for Mac OS X,
6732         dnl and Tiger Java complains about -d32 while Snow Leopard Java needs it
6733         dnl to run in 32 bit mode and be able to load LibreOffice jnilibs:
6734         AC_MSG_CHECKING([whether to pass -d32 to Java interpreter])
6735         if "$JAVAINTERPRETER" -d32 >&5 2>&5; then
6736             AC_MSG_RESULT([yes])
6737             JAVAIFLAGS=-d32
6738         else
6739             AC_MSG_RESULT([no])
6740         fi
6741     fi
6744 dnl ===================================================================
6745 dnl Checks for JDK.
6746 dnl ===================================================================
6748 # Note that JAVA_HOME as for now always means the *build* platform's
6749 # JAVA_HOME. Whether all the complexity here actually is needed any
6750 # more or not, no idea.
6752 if test "$ENABLE_JAVA" != ""; then
6753     _gij_longver=0
6754     AC_MSG_CHECKING([the installed JDK])
6755     if test -n "$JAVAINTERPRETER"; then
6756         dnl java -version sends output to stderr!
6757         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6758             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6759         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6760             JDK=gcj
6761             AC_MSG_RESULT([checked (gcj)])
6762             _gij_version=`$JAVAINTERPRETER --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6763             _gij_longver=`echo $_gij_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6765         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6766             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6767         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6768             JDK=ibm
6770             dnl IBM JDK specific tests
6771             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6772             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6774             if test "$_jdk_ver" -lt 10500; then
6775                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.5])
6776             fi
6778             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6780             if test "$with_jdk_home" = ""; then
6781                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6782 you must use the "--with-jdk-home" configure option explicitly])
6783             fi
6785            JAVA_HOME=$with_jdk_home
6787         else
6788             JDK=sun
6790             dnl Sun JDK specific tests
6791             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6792             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6794             if test "$_jdk_ver" -lt 10500; then
6795                 AC_MSG_ERROR([JDK is too old, you need at least 1.5])
6796             fi
6797             if test "$_jdk_ver" -gt 10600; then
6798                 JAVA_CLASSPATH_NOT_SET="1"
6799             fi
6801             AC_MSG_RESULT([checked (JDK $_jdk)])
6802             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6803             if test "$_os" = "WINNT"; then
6804                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6805             fi
6806         fi
6807     else
6808         AC_MSG_ERROR([Java not found. You need at least jdk-1.5, or gcj-4])
6809     fi
6810 else
6811     dnl Java disabled
6812     JAVA_HOME=NO_JAVA_HOME ; export JAVA_HOME
6815 dnl ===================================================================
6816 dnl Set target Java bytecode version
6817 dnl ===================================================================
6818 if test "$ENABLE_JAVA" != ""; then
6819     _java_target_ver="1.5"
6821     JAVA_SOURCE_VER="$_java_target_ver"
6822     JAVA_TARGET_VER="$_java_target_ver"
6825 dnl ===================================================================
6826 dnl Checks for javac
6827 dnl ===================================================================
6828 if test "$ENABLE_JAVA" != ""; then
6829     if test "$JDK" = "gcj"; then
6830         javacompiler=`echo $with_java | $SED -e "s/gij/gcj/g" | $SED -e "s/java/javac/g"`
6831     else
6832         javacompiler="javac"
6833     fi
6834     if test -z "$with_jdk_home"; then
6835         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6836     else
6837         _javac_path="$with_jdk_home/bin/$javacompiler"
6838         dnl Check if there is a Java compiler at all.
6839         if test -x "$_javac_path"; then
6840             JAVACOMPILER=$_javac_path
6841         fi
6842     fi
6843     if test -z "$JAVACOMPILER"; then
6844         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6845     fi
6846     if test "$build_os" = "cygwin"; then
6847         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6848             JAVACOMPILER="${JAVACOMPILER}.exe"
6849         fi
6850         JAVACOMPILER=`cygpath -d "$JAVACOMPILER"`
6851         JAVACOMPILER=`cygpath -u "$JAVACOMPILER"`
6852     fi
6854     if test `$JAVACOMPILER -version 2>&1 | $GREP -c "Eclipse Java Compiler"` -gt 0; then
6855         AC_MSG_CHECKING([re-checking JDK])
6856         JDK=gcj
6857         AC_MSG_RESULT([checked (ecj)])
6858         _gij_longver="40200"
6859     fi
6862 JAVACISGCJ=""
6863 dnl ===================================================================
6864 dnl Checks that javac is gcj
6865 dnl ===================================================================
6866 if test "$ENABLE_JAVA" != ""; then
6867     if test `$JAVACOMPILER --version 2>&1 | $GREP -c "GCC"` -gt 0; then
6868         JAVACISGCJ="yes"
6869     fi
6871 AC_SUBST(JAVACISGCJ)
6873 dnl ===================================================================
6874 dnl Checks for javadoc
6875 dnl ===================================================================
6876 if test "$ENABLE_JAVA" != ""; then
6877     if test -z "$with_jdk_home"; then
6878         AC_PATH_PROG(JAVADOC, javadoc)
6879     else
6880         _javadoc_path="$with_jdk_home/bin/javadoc"
6881         dnl Check if there is a javadoc at all.
6882         if test -x "$_javadoc_path"; then
6883             JAVADOC=$_javadoc_path
6884         else
6885             AC_PATH_PROG(JAVADOC, javadoc)
6886         fi
6887     fi
6888     if test -z "$JAVADOC"; then
6889         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6890     fi
6891     if test "$build_os" = "cygwin"; then
6892         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6893             JAVADOC="${JAVADOC}.exe"
6894         fi
6895         JAVADOC=`cygpath -d "$JAVADOC"`
6896         JAVADOC=`cygpath -u "$JAVADOC"`
6897     fi
6899     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6900     JAVADOCISGJDOC="yes"
6901     fi
6903 AC_SUBST(JAVADOCISGJDOC)
6905 if test "$ENABLE_JAVA" != ""; then
6906     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
6907     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
6908         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
6909            # try to recover first by looking whether we have a alternatives
6910            # system as in Debian or newer SuSEs where following /usr/bin/javac
6911            # over /etc/alternatives/javac leads to the right bindir where we
6912            # just need to strip a bit away to get a valid JAVA_HOME
6913            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
6914         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
6915             # maybe only one level of symlink (e.g. on Mac)
6916             JAVA_HOME=$(readlink $JAVACOMPILER)
6917             if test "$(dirname $JAVA_HOME)" = "."; then
6918                 # we've got no path to trim back
6919                 JAVA_HOME=""
6920             fi
6921         else
6922             # else warn
6923             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
6924             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
6925             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
6926             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
6927         fi
6928         dnl now that we have the path to the real javac, make a JAVA_HOME out of it..
6929         if test "$JAVA_HOME" != "/usr"; then
6930             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6931                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
6932                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
6933                 dnl Tiger already returns a JDK path..
6934                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
6935             else
6936                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
6937             fi
6938         fi
6939     fi
6940     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
6942     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
6943     if test -z "$JAVA_HOME"; then
6944         if test "x$with_jdk_home" = "x"; then
6945             cat > findhome.java <<_ACEOF
6946 [import java.io.File;
6948 class findhome
6950     public static void main(String args[])
6951     {
6952         String jrelocation = System.getProperty("java.home");
6953         File jre = new File(jrelocation);
6954         System.out.println(jre.getParent());
6955     }
6957 _ACEOF
6958             AC_MSG_CHECKING([if javac works])
6959             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
6960             AC_TRY_EVAL(javac_cmd)
6961             if test $? = 0 -a -f ./findhome.class; then
6962                 AC_MSG_RESULT([javac works])
6963             else
6964                 echo "configure: javac test failed" >&5
6965                 cat findhome.java >&5
6966                 AC_MSG_ERROR([javac does not work - java projects will not build!])
6967             fi
6968             AC_MSG_CHECKING([if gij knows its java.home])
6969             JAVA_HOME=`$JAVAINTERPRETER findhome`
6970             if test $? = 0 -a "$JAVA_HOME" != ""; then
6971                 AC_MSG_RESULT([$JAVA_HOME])
6972             else
6973                 echo "configure: java test failed" >&5
6974                 cat findhome.java >&5
6975                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
6976             fi
6977             # clean-up after ourselves
6978             rm -f ./findhome.java ./findhome.class
6979         else
6980             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
6981         fi
6982     fi
6984     dnl second sanity check JAVA_HOME if possible
6985     if test "$JDK" != "gcj" -o "$_gij_longver" -ge "40200"; then
6986         # now check if $JAVA_HOME is really valid
6987         if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6988             if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
6989                 JAVA_HOME_OK="NO"
6990             fi
6991         elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
6992             JAVA_HOME_OK="NO"
6993         fi
6994         if test "$JAVA_HOME_OK" = "NO"; then
6995             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
6996             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
6997             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
6998             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
6999             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7000             add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
7001         fi
7002     fi
7003     PathFormat "$JAVA_HOME"
7004     JAVA_HOME="$formatted_path"
7007 AWTLIB=
7009 if test "$ENABLE_JAVA" != ""; then
7010     AC_MSG_CHECKING([for jawt lib name])
7011     if test "$JDK" = "gcj"; then
7012         save_CFLAGS=$CFLAGS
7013         save_LDFLAGS=$LDFLAGS
7014         CFLAGS="$CFLAGS -I$JAVA_HOME/include"
7015         LDFLAGS="$LDFLAGS -L$JAVA_HOME/lib -lgcj"
7016         exec 6>/dev/null # no output
7017         AC_CHECK_HEADER(jni.h, [],
7018                     [AC_MSG_ERROR([jni.h could not be found. Mismatch between gcc and libgcj or libgcj-devel missing?])], [])
7019         AC_CHECK_LIB(gcjawt, JAWT_GetAWT, [ AWTLIB="-lgcjawt -lgcj"] )
7020         exec 6>&1 # output on again
7021         CFLAGS=$save_CFLAGS
7022         LDFLAGS=$save_LDFLAGS
7023     fi
7024     # IBM SDK 1.5.0-sr5 includes libjawt.so with unresolved symbols.
7025     # A workaround is to link also against libpmawt.so
7026     if test "$JDK" = "ibm"; then
7027         save_CFLAGS=$CFLAGS
7028         save_LDFLAGS=$LDFLAGS
7029         save_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
7030         CFLAGS="$CFLAGS -I$JAVA_HOME/include"
7031         LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin"
7032         LD_LIBRARY_PATH=$JAVA_HOME/jre/bin:$JAVA_HOME/jre/bin/classic:$JAVA_HOME/jre/bin/xawt:$LD_LIBRARY_PATH
7033         export LD_LIBRARY_PATH
7034         exec 6>/dev/null # no output
7035         AC_CHECK_HEADER(jni.h, [],
7036                     [AC_MSG_ERROR([jni.h could not be found.])], [])
7037         AC_CHECK_LIB(jawt, JAWT_GetAWT, [ AWTLIB="-ljawt"] )
7038         if test -z "$AWTLIB"; then
7039             LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin/xawt -ljawt"
7040             AC_CHECK_LIB(mawt, JAWT_GetAWT, [ AWTLIB="-L$JAVA_HOME/jre/bin/xawt -ljawt -lmawt"])
7041         fi
7042         exec 6>&1 # output on again
7043         CFLAGS=$save_CFLAGS
7044         LDFLAGS=$save_LDFLAGS
7045         LD_LIBRARY_PATH=$save_LD_LIBRARY_PATH
7046     fi
7047     if test -z "$AWTLIB"; then
7048         if test $_os = WINNT -a "$WITH_MINGW" != yes; then
7049             AWTLIB=jawt.lib
7050         else
7051             AWTLIB=-ljawt
7052         fi
7053     fi
7054     AC_MSG_RESULT([$AWTLIB])
7055     AC_SUBST(AWTLIB)
7059 if test -n "$ENABLE_JAVA" -a \( -z "$JAVALIB" -o -z "$JAVAINC" \); then
7061 # Determine JAVALIB
7062 # If your platform follow the common pattern
7063 # just define JAVA_ARCH and JAVA_TOOLKIT for it
7064 # if not, leave JAVA_ARCH empty and define JAVALIB manually
7065 # if you don't want JAVALIB to be exported at all
7066 # define x_JAVALIB=[\#]
7068     JAVA_ARCH=
7069     JAVA_TOOLKIT=
7070     x_JAVALIB=
7071     x_JDKLIB=[\#]
7073     case "$host_os" in
7075     aix*)
7076         JAVA_ARCH="ppc"
7077         JAVA_TOOLKIT="classic"
7078         JAVAINC="-I$JAVA_HOME/include"
7079         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7080         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7082         case "$JDK" in
7083         [Ii][Bb][Mm]*)
7084             JAVA_ARCH=
7085             JRE_BASE_DIR="$JAVA_HOME/jre/bin"
7086             JAVALIB="-L$JRE_BASE_DIR -L$JRE_BASE_DIR/classic"
7087             ;;
7088         *)
7089             ;;
7090         esac
7092         ;;
7094     cygwin*)
7095         x_JDKLIB=
7096         JDKLIB="$JAVA_HOME/lib"
7097         JAVAINC="-I$JAVA_HOME/include/win32"
7098         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7099         ;;
7101     darwin*)
7102         x_JAVALIB=[\#]
7103         JAVAINC="${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers ${ISYSTEM}$FRAMEWORKSHOME/JavaVM/Headers"
7104         ;;
7106     dragonfly*)
7107         case "$host_cpu" in
7108         i*86)
7109             JAVA_ARCH="i386"
7110             JAVA_TOOLKIT="client"
7111             ;;
7112         x86_64)
7113             JAVA_ARCH="amd64"
7114             JAVA_TOOLKIT="server"
7115             ;;
7116         esac
7117         JAVAINC="-I$JAVA_HOME/include"
7118         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7119         ;;
7121     freebsd*)
7122         case "$host_cpu" in
7123         i*86)
7124             JAVA_ARCH="i386"
7125             JAVA_TOOLKIT="client"
7126             ;;
7127         x86_64)
7128             if test "`echo $JAVA_HOME | sed -e 's,.*/,,'`" = "linux"; then
7129                 JAVA_ARCH="i386"
7130                 JAVA_TOOLKIT="client"
7131             else
7132                 JAVA_ARCH="amd64"
7133                 JAVA_TOOLKIT="server"
7134             fi
7135             ;;
7136         esac
7137         JAVAINC="-I$JAVA_HOME/include"
7138         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7139         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7140         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7141         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7142         ;;
7144     k*bsd*-gnu*)
7145         case "$host_cpu" in
7146         i*86)
7147             JAVA_ARCH="i386"
7148             JAVA_TOOLKIT="client"
7149             ;;
7150         x86_64)
7151             JAVA_ARCH="amd64"
7152             JAVA_TOOLKIT="server"
7153             ;;
7154         esac
7155         JAVAINC="-I$JAVA_HOME/include"
7156         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7157         ;;
7159     linux-gnu*)
7161         case "$host_cpu" in
7163         alpha)
7164             JAVA_ARCH="alpha"
7165             JAVA_TOOLKIT="server"
7166             ;;
7167         arm*)
7168             JAVA_ARCH="arm"
7169             JAVA_TOOLKIT="server"
7170             ;;
7171         hppa)
7172             JAVA_ARCH="hppa"
7173             JAVA_TOOLKIT="server"
7174             ;;
7175         i*86)
7176             JAVA_ARCH="i386"
7177             case "$JDK" in
7178             [Ii][Bb][Mm]*)
7179                 JAVA_ARCH=
7180                 JRE_BASE_DIR="$JAVA_HOME/jre/bin"
7181                 JAVALIB="-L$JAVA_HOME/$LIB64 -L$JRE_BASE_DIR -L$JRE_BASE_DIR/classic -L$JRE_BASE_DIR/native_thread"
7182                 ;;
7183             [Bb][Ee][Aa]*)
7184                 JAVA_TOOLKIT="jrockit"
7185                 ;;
7186             *)
7187                 JAVA_TOOLKIT="client"
7188                 ;;
7189             esac
7190             ;;
7191         ia64)
7192             JAVA_ARCH="ia64"
7193             JAVA_TOOLKIT="server"
7194             ;;
7195         m68k)
7196             JAVA_ARCH="mk68"
7197             JAVA_TOOLKIT="server"
7198             ;;
7199         mips|mips64|mipsel|mips64el)
7200             JAVA_ARCH="$host_cpu"
7201             JAVA_TOOLKIT="server"
7202             ;;
7203         mips32)
7204             JAVA_ARCH="$host_cpu"
7205             JAVA_TOOLKIT="client"
7206             ;;
7207         powerpc)
7208             JAVA_ARCH="ppc"
7209             case "$JDK" in
7210             [Ii][Bb][Mm]*)
7211                 JAVA_TOOLKIT="classic"
7212                 ;;
7213             gcj)
7214                 JAVA_TOOLKIT="client"
7215                 ;;
7216             *)
7217                 JAVA_TOOLKIT="server"
7218                 ;;
7219             esac
7220             ;;
7221         powerpc64)
7222             JAVA_ARCH="ppc64"
7223             if test "$JDK" = "gcj"; then
7224                 JAVA_TOOLKIT="client"
7225             else
7226                 JAVA_TOOLKIT="server"
7227             fi
7228             ;;
7229         sparc)
7230             JAVA_ARCH="sparc"
7231             JAVA_TOOLKIT="server"
7232             ;;
7233         s390)
7234             JAVA_ARCH="s390"
7235             JAVA_TOOLKIT="server"
7236             ;;
7237         s390x)
7238             JAVA_ARCH="s390x"
7239             JAVA_TOOLKIT="server"
7240             ;;
7241         x86_64)
7242             JAVA_ARCH="amd64"
7243             JAVA_TOOLKIT="server"
7244             ;;
7245         *)
7246             AC_MSG_ERROR([No JAVALIB definition host_cpu $host_cpu for host_os $host_os])
7247             ;;
7248         esac
7249         JAVAINC="-I$JAVA_HOME/include"
7250         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7251         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7252         ;;
7254     linux-androideabi*)
7256         case "$host_cpu" in
7258         arm|armel)
7259             JAVA_ARCH="arm"
7260             JAVA_TOOLKIT="server"
7261             ;;
7262         esac
7263         ;;
7265     mingw*)
7266         x_JAVALIB=[\#]
7267         JAVAINC="-I$JAVA_HOME/include"
7268         ;;
7270     *netbsd*)
7272         case "$host_cpu" in
7273         i*86)
7274             JAVA_ARCH="i386"
7275             JAVA_TOOLKIT="client"
7276             ;;
7277         powerpc)
7278             JAVA_ARCH="pcc"
7279             JAVA_TOOLKIT="classic"
7280             ;;
7281         sparc)
7282             JAVA_ARCH="sparc"
7283             JAVA_TOOLKIT="client"
7284             ;;
7285         x86_64)
7286             JAVA_ARCH="amd64"
7287             JAVA_TOOLKIT="client"
7288             ;;
7289         esac
7290         JAVAINC="-I$JAVA_HOME/include"
7291         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7292         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7293        ;;
7295     openbsd*)
7296         case "$host_cpu" in
7297         i*86)
7298             JAVA_ARCH="i386"
7299             JAVA_TOOLKIT="client"
7300             ;;
7301         x86_64)
7302             JAVA_ARCH="amd64"
7303             JAVA_TOOLKIT="server"
7304             ;;
7305         esac
7306         JAVAINC="-I$JAVA_HOME/include"
7307         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7308         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7309         ;;
7311     solaris*)
7313         JAVA_TOOLKIT="xawt"
7314         case "$host_cpu" in
7315         i*86)
7316             JAVA_ARCH="i386"
7317             ;;
7318         sparc)
7319             JAVA_ARCH="sparc"
7320             ;;
7321         esac
7322         JAVAINC="-I$JAVA_HOME/include"
7323         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7324         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7325         ;;
7326     esac
7328     if test -n "$JAVA_ARCH"; then
7329         JRE_BASE_DIR="$JAVA_HOME/jre/lib/$JAVA_ARCH"
7330         JAVALIB="-L$JAVA_HOME/$LIB64"
7331         test -d "$JRE_BASE_DIR" && JAVALIB="$JAVALIB -L$JRE_BASE_DIR"
7332         test -d "$JRE_BASE_DIR/$JAVA_TOOLKIT" && JAVALIB="$JAVALIB -L$JRE_BASE_DIR/$JAVA_TOOLKIT"
7333         test -d "$JRE_BASE_DIR/native_thread" && JAVALIB="$JAVALIB -L$JRE_BASE_DIR/native_thread"
7334     fi
7335 elif test -z "$ENABLE_JAVA"; then
7336     x_JAVALIB=[\#]
7337     x_JDKLIB=[\#]
7339 SOLARINC="$SOLARINC $JAVAINC"
7341 AC_SUBST(JAVALIB)
7342 AC_SUBST(JAVACOMPILER)
7343 AC_SUBST(JAVADOC)
7344 AC_SUBST(JAVAINTERPRETER)
7345 AC_SUBST(JAVAIFLAGS)
7346 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7347 AC_SUBST(JAVA_HOME)
7348 AC_SUBST(JAVA_SOURCE_VER)
7349 AC_SUBST(JAVA_TARGET_VER)
7350 AC_SUBST(JDK)
7351 AC_SUBST(JDKLIB)
7352 AC_SUBST(x_JAVALIB)
7353 AC_SUBST(x_JDKLIB)
7356 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7357 if test -n "$with_idlc_cpp"; then
7358     AC_MSG_RESULT([$with_idlc_cpp])
7359     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7360 else
7361     AC_MSG_RESULT([ucpp])
7362     AC_MSG_CHECKING([which ucpp tp use])
7363     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7364         AC_MSG_RESULT([external])
7365         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7366     else
7367         AC_MSG_RESULT([internal])
7368         BUILD_TYPE="$BUILD_TYPE UCPP"
7369     fi
7371 AC_SUBST(SYSTEM_UCPP)
7373 dnl ===================================================================
7374 dnl Check for epm (not needed for Windows)
7375 dnl ===================================================================
7376 AC_MSG_CHECKING([whether to enable EPM for packing])
7377 if test "$enable_epm" = "yes"; then
7378     AC_MSG_RESULT([yes])
7379     if test "$_os" != "WINNT"; then
7380         if test $_os = Darwin; then
7381             EPM=internal
7382         elif test -n "$with_epm"; then
7383             EPM=$with_epm
7384         else
7385             AC_PATH_PROG(EPM, epm, no)
7386         fi
7387         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7388             echo "EPM will be built."
7389             BUILD_TYPE="$BUILD_TYPE EPM"
7390             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7391         else
7392             # Gentoo has some epm which is something different...
7393             AC_MSG_CHECKING([whether the found epm is the right epm])
7394             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7395                 AC_MSG_RESULT([yes])
7396             else
7397                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7398             fi
7399             AC_MSG_CHECKING([epm version])
7400             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7401             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7402                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7403                 AC_MSG_RESULT([OK, >= 3.7])
7404             else
7405                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7406                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7407             fi
7408         fi
7409     fi
7411     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7412         AC_MSG_CHECKING([for rpm])
7413         for a in "$RPM" rpmbuild rpm; do
7414             $a --usage >/dev/null 2> /dev/null
7415             if test $? -eq 0; then
7416                 RPM=$a
7417                 break
7418             else
7419                 $a --version >/dev/null 2> /dev/null
7420                 if test $? -eq 0; then
7421                     RPM=$a
7422                     break
7423                 fi
7424             fi
7425         done
7426         if test -z "$RPM"; then
7427             AC_MSG_ERROR([not found])
7428         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7429             RPM_PATH=`which $RPM`
7430             AC_MSG_RESULT([$RPM_PATH])
7431             SCPDEFS="$SCPDEFS -DWITH_RPM"
7432         else
7433             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7434         fi
7435     fi
7436     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7437         AC_PATH_PROG(DPKG, dpkg, no)
7438         if test "$DPKG" = "no"; then
7439             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7440         fi
7441     fi
7442     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7443        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7444         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7445             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7446                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7447                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7448                     AC_MSG_RESULT([yes])
7449                 else
7450                     AC_MSG_RESULT([no])
7451                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7452                         _pt="rpm"
7453                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7454                         add_warning "the rpms will need to be installed with --nodeps"
7455                     else
7456                         _pt="pkg"
7457                     fi
7458                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
7459                     add_warning "the ${_pt}s will not be relocateable"
7460                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7461                                  relocation will work, you need to patch your epm with the
7462                                  patch in epm/epm-3.7.patch or build with
7463                                  --with-epm=internal which will build a suitable epm])
7464                 fi
7465             fi
7466         fi
7467     fi
7468     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7469         AC_PATH_PROG(PKGMK, pkgmk, no)
7470         if test "$PKGMK" = "no"; then
7471             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7472         fi
7473     fi
7474     AC_SUBST(RPM)
7475     AC_SUBST(DPKG)
7476     AC_SUBST(PKGMK)
7477 else
7478     for i in $PKGFORMAT; do
7479         case "$i" in
7480         aix | bsd | deb | pkg | rpm | native | portable)
7481             AC_MSG_ERROR(
7482                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7483             ;;
7484         esac
7485     done
7486     AC_MSG_RESULT([no])
7487     EPM=NO
7489 AC_SUBST(EPM)
7491 dnl ===================================================================
7492 dnl We need winegcc when building MinGW build to be able to cross-build msi tools
7493 dnl ===================================================================
7494 WINEGCC=
7495 if test "$enable_winegcc" = "yes"; then
7496     AC_PATH_PROG(WINEGCC, winegcc)
7497     if test "$WINEGCC" = ""; then
7498         AC_MSG_ERROR([winegcc was not found, please install wine-devel, or wine-devel-32bit])
7499     fi
7500     CC_save="$CC"
7501     ac_exeext_save="$ac_exeext"
7502     CC="$WINEGCC -m32"
7503     ac_exeext=".exe"
7504     AC_LINK_IFELSE([AC_LANG_PROGRAM([
7505 #include <stdio.h>
7506         ],[
7507 printf ("hello world\n");
7508         ])],,
7509         [AC_MSG_ERROR([winegcc cannot build 32bit binaries, please install glibc-devel-32bit and gcc-32bit])]
7510     )
7511     CC="$CC_save"
7512     ac_exeext="$ac_exeext_save"
7514 AC_SUBST(WINEGCC)
7516 if test $_os = iOS; then
7517     enable_mpl_subset=yes
7518     enable_opengl=no
7519     enable_lotuswordpro=no
7520     enable_coinmp=no
7521     enable_lpsolve=no
7522     enable_postgresql_sdbc=no
7523     enable_lotuswordpro=no
7524     enable_extension_integration=no
7525     enable_report_builder=no
7526     with_theme="tango"
7527     with_ppds=no
7530 ENABLE_LWP=
7531 if test "$enable_lotuswordpro" = "yes"; then
7532     ENABLE_LWP="TRUE"
7533     SCPDEFS="$SCPDEFS -DDISABLE_LWP"
7535 AC_SUBST(ENABLE_LWP)
7537 dnl ===================================================================
7538 dnl Check for gperf
7539 dnl ===================================================================
7540 AC_PATH_PROG(GPERF, gperf)
7541 if test -z "$GPERF"; then
7542     AC_MSG_ERROR([gperf not found but needed. Install it.])
7544 AC_MSG_CHECKING([gperf version])
7545 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
7546     AC_MSG_RESULT([OK])
7547 else
7548     AC_MSG_ERROR([too old, you need at least 3.0.0])
7550 AC_SUBST(GPERF)
7552 dnl ===================================================================
7553 dnl Check for building ODK
7554 dnl ===================================================================
7555 if test "$enable_odk" = no; then
7556     unset DOXYGEN
7557 else
7558     if test "$with_doxygen" = no; then
7559         AC_MSG_CHECKING([for doxygen])
7560         unset DOXYGEN
7561         AC_MSG_RESULT([no])
7562     else
7563         if test "$with_doxygen" = yes; then
7564             AC_PATH_PROG([DOXYGEN], [doxygen])
7565             if test -z "$DOXYGEN"; then
7566                 if test "$enable_odk" = "" ; then
7567                     enable_odk="no"
7568                 else
7569                     AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7570                 fi
7571             fi
7572         else
7573             AC_MSG_CHECKING([for doxygen])
7574             DOXYGEN=$with_doxygen
7575             AC_MSG_RESULT([$DOXYGEN])
7576         fi
7577         if test -n "$DOXYGEN"; then
7578            DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7579            DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7580            if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7581               AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7582            fi
7583         fi
7584     fi
7586 AC_SUBST([DOXYGEN])
7588 AC_MSG_CHECKING([whether to build the ODK])
7589 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7590     AC_MSG_RESULT([yes])
7592     if test "$with_java" != "no"; then
7593         AC_MSG_CHECKING([whether to build unowinreg.dll])
7594         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7595             # build on Win by default
7596             enable_build_unowinreg=yes
7597         fi
7598         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7599             AC_MSG_RESULT([no])
7600             BUILD_UNOWINREG=NO
7601         else
7602             AC_MSG_RESULT([yes])
7603             BUILD_UNOWINREG=YES
7604         fi
7605         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "YES"; then
7606             if test -z "$with_mingw_cross_compiler"; then
7607                 dnl Guess...
7608                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7609             elif test -x "$with_mingw_cross_compiler"; then
7610                  MINGWCXX="$with_mingw_cross_compiler"
7611             else
7612                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7613             fi
7615             if test "$MINGWCXX" = "false"; then
7616                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7617             fi
7619             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7620             if test -x "$mingwstrip_test"; then
7621                 MINGWSTRIP="$mingwstrip_test"
7622             else
7623                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7624             fi
7626             if test "$MINGWSTRIP" = "false"; then
7627                 AC_MSG_ERROR(MinGW32 binutils not found.)
7628             fi
7629         fi
7630     fi
7631     BUILD_TYPE="$BUILD_TYPE ODK"
7632 else
7633     AC_MSG_RESULT([no])
7634     BUILD_UNOWINREG=NO
7636 AC_SUBST(BUILD_UNOWINREG)
7637 AC_SUBST(MINGWCXX)
7638 AC_SUBST(MINGWSTRIP)
7640 dnl ===================================================================
7641 dnl Check for system zlib
7642 dnl ===================================================================
7643 if test "$with_system_zlib" = "auto"; then
7644     case "$_os" in
7645     WINNT)
7646         with_system_zlib="$with_system_libs"
7647         ;;
7648     *)
7649         with_system_zlib=yes
7650         ;;
7651     esac
7654 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7655 dnl and has no pkg-config for it at least on some tinderboxes,
7656 dnl so leaving that out for now
7657 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7658 AC_MSG_CHECKING([which zlib to use])
7659 if test "$with_system_zlib" = "yes"; then
7660     AC_MSG_RESULT([external])
7661     SYSTEM_ZLIB=YES
7662     AC_CHECK_HEADER(zlib.h, [],
7663         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7664     AC_CHECK_LIB(z, deflate, [ ZLIB=-lz ],
7665         [AC_MSG_ERROR(zlib not found or functional)], [])
7666 else
7667     AC_MSG_RESULT([internal])
7668     SYSTEM_ZLIB=NO
7669     BUILD_TYPE="$BUILD_TYPE ZLIB"
7670     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7671     ZLIB_LIBS="-lzlib"
7673 AC_SUBST(ZLIB_CFLAGS)
7674 AC_SUBST(ZLIB_LIBS)
7675 AC_SUBST(SYSTEM_ZLIB)
7677 dnl ===================================================================
7678 dnl Check for system jpeg
7679 dnl ===================================================================
7680 AC_MSG_CHECKING([which jpeg to use])
7681 if test "$with_system_jpeg" = "auto"; then
7682     case "$_os" in
7683     WINNT|Darwin|iOS|Android)
7684         with_system_jpeg="$with_system_libs"
7685         ;;
7686     *)
7687         with_system_jpeg=yes
7688         ;;
7689     esac
7692 if test "$with_system_jpeg" = "yes"; then
7693     AC_MSG_RESULT([external])
7694     SYSTEM_JPEG=YES
7695     AC_CHECK_HEADER(jpeglib.h, [],
7696         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7697     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ JPEG3RDLIB=-ljpeg ],
7698     [AC_MSG_CHECKING(jpeg library not found or fuctional)], [])
7699     libo_MINGW_CHECK_DLL([libjpeg])
7700 else
7701     AC_MSG_RESULT([internal])
7702     SYSTEM_JPEG=NO
7703     BUILD_TYPE="$BUILD_TYPE JPEG"
7705 AC_SUBST(SYSTEM_JPEG)
7708 dnl ===================================================================
7709 dnl Check for system clucene
7710 dnl ===================================================================
7711 dnl we should rather be using
7712 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7713 dnl but the contribs-lib check seems tricky
7714 AC_MSG_CHECKING([which clucene to use])
7715 if test "$with_system_clucene" = "yes"; then
7716     AC_MSG_RESULT([external])
7717     SYSTEM_CLUCENE=YES
7718     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7719     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7720     AC_LANG_PUSH([C++])
7721     save_CXXFLAGS=$CXXFLAGS
7722     save_CPPFLAGS=$CPPFLAGS
7723     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7724     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7725     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7726     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7727     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7728                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7729     CXXFLAGS=$save_CXXFLAGS
7730     CPPFLAGS=$save_CPPFLAGS
7731     AC_LANG_POP([C++])
7733     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7734 else
7735     AC_MSG_RESULT([internal])
7736     SYSTEM_CLUCENE=NO
7737     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7739 AC_SUBST(SYSTEM_CLUCENE)
7740 AC_SUBST(CLUCENE_CFLAGS)
7741 AC_SUBST(CLUCENE_LIBS)
7743 dnl ===================================================================
7744 dnl Check for system expat
7745 dnl ===================================================================
7746 dnl we should use libo_CHECK_SYSTEM_MODULE, but e.g. the mingw tinderbox has no
7747 dnl proper pkg-config for it. It should really be fixed on the tinderbox though.
7748 AC_MSG_CHECKING([which expat to use])
7749 if test "$with_system_expat" = "yes"; then
7750     AC_MSG_RESULT([external])
7751     SYSTEM_EXPAT=YES
7752     AC_CHECK_HEADER(expat.h, [],
7753         [AC_MSG_ERROR(expat.h not found. install expat)], [])
7754     AC_CHECK_LIB([expat], [XML_ParserCreate], [:],
7755         [AC_MSG_RESULT(expat library not found or functional.)], [])
7756     libo_MINGW_CHECK_DLL([libexpat])
7757 else
7758     AC_MSG_RESULT([internal])
7759     SYSTEM_EXPAT=NO
7760     BUILD_TYPE="$BUILD_TYPE EXPAT"
7762 AC_SUBST(SYSTEM_EXPAT)
7764 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7765 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7766     ENABLE_EOT="TRUE"
7767     AC_DEFINE([ENABLE_EOT])
7768     AC_MSG_RESULT([yes])
7770     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7771 else
7772     ENABLE_EOT=
7773     AC_MSG_RESULT([no])
7775 AC_SUBST([ENABLE_EOT])
7777 dnl ===================================================================
7778 dnl Check for system libe-book
7779 dnl ===================================================================
7780 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.0 >= 0.0.2],["-I${WORKDIR}/UnpackedTarball/libebook/inc"],["-L${WORKDIR}/UnpackedTarball/libebook/src/lib/.libs -le-book-0.0"])
7782 dnl ===================================================================
7783 dnl Check for system libetonyek
7784 dnl ===================================================================
7785 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.0],["-I${WORKDIR}/UnpackedTarball/libetonyek/inc"],["-L${WORKDIR}/UnpackedTarball/libetonyek/src/lib/.libs -letonyek-0.0"])
7787 dnl ===================================================================
7788 dnl Check for system libfreehand
7789 dnl ===================================================================
7790 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.0],["-I${WORKDIR}/UnpackedTarball/libfreehand/inc"],["-L${WORKDIR}/UnpackedTarball/libfreehand/src/lib/.libs -lfreehand-0.0"])
7792 dnl ===================================================================
7793 dnl Check for system libodfgen
7794 dnl ===================================================================
7795 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.0 >= 0.0.3])
7797 dnl ===================================================================
7798 dnl Check for system libcdr
7799 dnl ===================================================================
7800 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.0 >= 0.0.5])
7802 dnl ===================================================================
7803 dnl Check for system libmspub
7804 dnl ===================================================================
7805 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.0])
7807 dnl ===================================================================
7808 dnl Check for system libmwaw
7809 dnl ===================================================================
7810 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.2])
7812 dnl ===================================================================
7813 dnl Check for system libvisio
7814 dnl ===================================================================
7815 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.0])
7817 dnl ===================================================================
7818 dnl Check for system libcmis
7819 dnl ===================================================================
7820 libo_CHECK_SYSTEM_MODULE([libcmis],[CMIS],[libcmis-0.4 >= 0.4.0])
7822 dnl ===================================================================
7823 dnl Check for system libwpd
7824 dnl ===================================================================
7825 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.9 >= 0.9.5 libwpd-stream-0.9 >= 0.9.5],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs -lwpd-0.9"])
7827 dnl ===================================================================
7828 dnl Check for system lcms2
7829 dnl ===================================================================
7830 if test "$with_system_lcms2" = "yes"; then
7831     libo_MINGW_CHECK_DLL([liblcms2])
7832 else
7833     SYSTEM_LCMS2=NO
7835 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7836 if test "$GCC" = "yes"; then
7837     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7839 if test "$COM" = "MSC"; then # override the above
7840     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7843 dnl ===================================================================
7844 dnl Check for system cppunit
7845 dnl ===================================================================
7846 if test "$cross_compiling" != "yes"; then
7847     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.12.0])
7850 dnl ===================================================================
7851 dnl Check whether freetype is available
7852 dnl ===================================================================
7853 if test  "$test_freetype" = "yes"; then
7854     AC_MSG_CHECKING([whether freetype is available])
7855     # FreeType has 3 different kinds of versions
7856     # * release, like 2.4.10
7857     # * libtool, like 13.0.7 (this what pkg-config returns)
7858     # * soname
7859     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7860     #
7861     # 9.9.3 is 2.2.0
7862     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7863     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7864     SYSTEM_FREETYPE=YES
7865     _save_libs="$LIBS"
7866     _save_cflags="$CFLAGS"
7867     LIBS="$LIBS $FREETYPE_LIBS"
7868     CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
7869     AC_CHECK_FUNC(FT_Face_GetCharVariantIndex, AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX), [])
7870     LIBS="$_save_libs"
7871     CFLAGS="$_save_cflags"
7873 AC_SUBST(FREETYPE_CFLAGS)
7874 AC_SUBST(FREETYPE_LIBS)
7875 AC_SUBST([SYSTEM_FREETYPE])
7877 dnl ===================================================================
7878 dnl Check for system libabw
7879 dnl ===================================================================
7880 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.0],["-I${WORKDIR}/UnpackedTarball/libabw/inc"],["-L${WORKDIR}/UnpackedTarball/libabw/src/lib/.libs -labw-0.0"])
7882 dnl ===================================================================
7883 dnl Check for system libwps
7884 dnl ===================================================================
7885 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.2],["-I${WORKDIR}/UnpackedTarball/libwps/inc"],["-L${WORKDIR}/UnpackedTarball/libwps/src/lib/.libs -lwps-0.2"])
7887 dnl ===================================================================
7888 dnl Check for system libwpg
7889 dnl ===================================================================
7890 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.2],["-I${WORKDIR}/UnpackedTarball/libwpg/inc"],["-L${WORKDIR}/UnpackedTarball/libwpg/src/lib/.libs -lwpg-0.2"])
7892 # ===================================================================
7893 # Check for system libxslt
7894 # to prevent incompatibilities between internal libxml2 and external libxslt,
7895 # or vice versa, use with_system_libxml here
7896 # ===================================================================
7897 if test "$with_system_libxml" = "auto"; then
7898     case "$_os" in
7899     WINNT|iOS|Android)
7900         with_system_libxml="$with_system_libs"
7901         ;;
7902     *)
7903         with_system_libxml=yes
7904         ;;
7905     esac
7908 AC_MSG_CHECKING([which libxslt to use])
7909 if test "$with_system_libxml" = "yes"; then
7910     AC_MSG_RESULT([external])
7911     SYSTEM_LIBXSLT=YES
7912     if test "$_os" = "Darwin"; then
7913         dnl make sure to use SDK path
7914         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7915         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7916         dnl omit -L/usr/lib
7917         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7918         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7919     else
7920         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7921         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7922         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7923         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7924     fi
7926     dnl Check for xsltproc
7927     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7928     if test "$XSLTPROC" = "no"; then
7929         AC_MSG_ERROR([xsltproc is required])
7930     fi
7932     libo_MINGW_CHECK_DLL([libxslt])
7933     libo_MINGW_CHECK_DLL([libexslt])
7934     libo_MINGW_TRY_DLL([iconv])
7935 else
7936     AC_MSG_RESULT([internal])
7937     SYSTEM_LIBXSLT=NO
7938     LIBXSLT_MAJOR=1
7939     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
7941     if test "$cross_compiling" = "yes"; then
7942         AC_PATH_PROG(XSLTPROC, xsltproc, no)
7943         if test "$XSLTPROC" = "no"; then
7944             AC_MSG_ERROR([xsltproc is required])
7945         fi
7946     fi
7948 AC_SUBST(SYSTEM_LIBXSLT)
7949 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
7950     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
7952 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
7954 AC_SUBST(LIBEXSLT_CFLAGS)
7955 AC_SUBST(LIBEXSLT_LIBS)
7956 AC_SUBST(LIBXSLT_CFLAGS)
7957 AC_SUBST(LIBXSLT_LIBS)
7958 AC_SUBST(LIBXSLT_MAJOR)
7959 AC_SUBST(XSLTPROC)
7961 # ===================================================================
7962 # Check for system libxml
7963 # ===================================================================
7964 AC_MSG_CHECKING([which libxml to use])
7965 if test "$with_system_libxml" = "yes"; then
7966     AC_MSG_RESULT([external])
7967     SYSTEM_LIBXML=YES
7968     if test "$_os" = "Darwin"; then
7969         dnl make sure to use SDK path
7970         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7971         dnl omit -L/usr/lib
7972         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
7973     elif test $_os = iOS; then
7974         dnl make sure to use SDK path
7975         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
7976         LIBXML_CFLAGS="-I$usr/include/libxml2"
7977         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
7978     else
7979         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
7980         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7981     fi
7983     dnl Check for xmllint
7984     AC_PATH_PROG(XMLLINT, xmllint, no)
7985     if test "$XMLLINT" = "no"; then
7986         AC_MSG_ERROR([xmllint is required])
7987     fi
7989     libo_MINGW_CHECK_DLL([libxml2])
7990     libo_MINGW_TRY_DLL([zlib1])
7991 else
7992     AC_MSG_RESULT([internal])
7993     SYSTEM_LIBXML=NO
7994     BUILD_TYPE="$BUILD_TYPE LIBXML2"
7996 AC_SUBST(SYSTEM_LIBXML)
7997 AC_SUBST(LIBXML_CFLAGS)
7998 AC_SUBST(LIBXML_LIBS)
7999 AC_SUBST(XMLLINT)
8001 # =====================================================================
8002 # Checking for a Python interpreter with version >= 2.5 needed to build LO.
8003 # runtime requires Python 3 compatible version (>= 2.6)
8004 # Optionally user can pass an option to configure, i. e.
8005 # ./configure PYTHON=/usr/bin/python
8006 # =====================================================================
8007 if test "$build_os" != "cygwin"; then
8008     # This allows a lack of system python with no error, we use internal one in that case.
8009     AM_PATH_PYTHON([2.5],, [:])
8010     # Clean PYTHON_VERSION checked below if cross-compiling
8011     PYTHON_VERSION=""
8012     if test "$PYTHON" != ":"; then
8013         PYTHON_FOR_BUILD=$PYTHON
8014     fi
8016 AC_SUBST(PYTHON_FOR_BUILD)
8018 # Checks for Python to use for Pyuno
8019 AC_MSG_CHECKING([which Python to use for Pyuno])
8020 case "$enable_python" in
8021 no|disable)
8022     if test -z $PYTHON_FOR_BUILD; then
8023         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8024         # requirement from the choice whether to include Python stuff in the installer, but why
8025         # bother?
8026         AC_MSG_ERROR([Python is required at build time.])
8027     fi
8028     enable_python=no
8029     AC_MSG_RESULT([none])
8030     ;;
8031 ""|yes|auto)
8032     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8033         AC_MSG_RESULT([no, overridden by --disable-scripting])
8034         enable_python=no
8035     elif test $build_os = cygwin; then
8036         dnl When building on Windows we don't attempt to use any installed
8037         dnl "system"  Python.
8038         dnl
8039         dnl (When cross-compiling to Windows from Linux using the mingw32-cross
8040         dnl compiler from OBS, use mingw32-python from OBS, and ditto for other
8041         dnl MinGW cross-compilation setups.)
8042         AC_MSG_RESULT([internal])
8043         enable_python=internal
8044     elif test "$cross_compiling" = yes; then
8045         AC_MSG_RESULT([system])
8046         enable_python=system
8047     else
8048         # Unset variables set by the above AM_PATH_PYTHON so that
8049         # we actually do check anew.
8050         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
8051         AM_PATH_PYTHON([3.3],, [:])
8052         if test "$PYTHON" = :; then
8053             AC_MSG_RESULT([internal])
8054             enable_python=internal
8055         else
8056             AC_MSG_RESULT([system])
8057             enable_python=system
8058         fi
8059     fi
8060     ;;
8061 internal)
8062     AC_MSG_RESULT([internal])
8063     ;;
8064 system)
8065     AC_MSG_RESULT([system])
8066     ;;
8068     AC_MSG_ERROR([Incorrect --enable-python option])
8069     ;;
8070 esac
8072 if test $enable_python != no; then
8073     BUILD_TYPE="$BUILD_TYPE PYUNO"
8076 if test $enable_python = system; then
8077     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8078         # We already have logic above to make sure the system Python
8079         # is used only when building against SDK 10.6 or newer.
8081         # Make sure we use the 2.6 Python when building against the
8082         # 10.6 SDK.
8083         case $with_macosx_sdk in
8084         10.6)
8085             python_version=2.6;;
8086         10.7|10.8)
8087             python_version=2.7;;
8088         *)
8089             # ???
8090             python_version=2.7;;
8091         esac
8092         PYTHON=python$python_version
8093         PYTHON_CFLAGS="-I/Developer/SDKs/MacOSX${with_macosx_sdk}.sdk/System/Library/Frameworks/Python.framework/Versions/${python_version}/include/python${python_version}"
8094         PYTHON_LIBS="-framework Python"
8095     fi
8096     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8097         # Fallback: Accept these in the environment, or as set above
8098         # for MacOSX.
8099         :
8100     elif test "$cross_compiling" != yes; then
8101         # Unset variables set by the above AM_PATH_PYTHON so that
8102         # we actually do check anew.
8103         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
8104         # This causes an error if no python command is found
8105         AM_PATH_PYTHON([3.3])
8106         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8107         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8108         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8109         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8110         if test -z "$PKG_CONFIG"; then
8111             PYTHON_CFLAGS="-I$python_include"
8112             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8113         elif $PKG_CONFIG --exists python-$python_version; then
8114             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8115             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8116         else
8117             PYTHON_CFLAGS="-I$python_include"
8118             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8119         fi
8120     else
8121         dnl How to find out the cross-compilation Python installation path?
8122         dnl Let's hardocode what we know for different distributions for now...
8123         for python_version in 2.6; do
8124             if test -f ${MINGW_SYSROOT}/include/python${python_version}/Python.h; then
8125                 PYTHON_CFLAGS="-I${MINGW_SYSROOT}/include/python$python_version"
8126                 PYTHON_LIBS="-L${MINGW_SYSROOT}/lib -lpython$python_version $python_libs"
8127                 AC_MSG_CHECKING([for python.exe])
8128                 libo_MINGW_CHECK_DLL([libpython$python_version])
8129                 libo_MINGW_CHECK_DLL([libreadline6])
8130                 libo_MINGW_CHECK_DLL([libtermcap])
8131                 # could we somehow extract the really mingw python version from
8132                 # actual distro package?
8133                 # 2.6.2 currently on OpenSUSE 12.1?
8134                 # rpm -q mingw32-python => mingw32-python-2.6.2-17.17.noarch
8135                 PYTHON_VERSION=$python_version.2
8136                 PYTHON_VERSION_MAJOR=`echo $python_version | cut -d . -f 1`
8137                 PYTHON_VERSION_MINOR=`echo $python_version | cut -d . -f 2`
8138                 break
8139             fi
8140         done
8141         AC_MSG_CHECKING([for python version])
8142         AS_IF([test -n "$PYTHON_VERSION"],
8143               [AC_MSG_RESULT([$PYTHON_VERSION])],
8144               [AC_MSG_RESULT([not found])
8145                AC_MSG_ERROR([no usable python found])])
8146         test -n "$PYTHON_CFLAGS" && break
8147     fi
8148     # let the PYTHON_FOR_BUILD match the same python installation that
8149     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8150     # better for PythonTests.
8151     PYTHON_FOR_BUILD=$PYTHON
8154 dnl By now enable_python should be "system", "internal" or "no"
8155 case $enable_python in
8156 system)
8157     SYSTEM_PYTHON=YES
8159     if test "$CROSS_COMPILING" != YES; then
8160         dnl Check if the headers really work
8161         save_CPPFLAGS="$CPPFLAGS"
8162         CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8163         AC_CHECK_HEADER(Python.h, [],
8164            [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
8165            [])
8166         CPPFLAGS="$save_CPPFLAGS"
8168         AC_LANG_PUSH(C)
8169         CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8170         AC_MSG_CHECKING([for correct python library version])
8171            AC_RUN_IFELSE([AC_LANG_SOURCE([[
8172 #include <Python.h>
8174 int main(int argc, char **argv) {
8175        if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
8176            (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8177        else return 1;
8179            ]])],[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])],[])
8180         CFLAGS=$save_CFLAGS
8181         AC_LANG_POP(C)
8183         dnl FIXME Check if the Python library can be linked with, too?
8184     fi
8185     ;;
8187 internal)
8188     SYSTEM_PYTHON=NO
8189     PYTHON_VERSION_MAJOR=3
8190     PYTHON_VERSION_MINOR=3
8191     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.3
8192     BUILD_TYPE="$BUILD_TYPE PYTHON"
8193     # Embedded Python dies without Home set
8194     if test "$HOME" = ""; then
8195         export HOME=""
8196     fi
8197     # bz2 tarball and bzip2 is not standard
8198     if test -z "$BZIP2"; then
8199         AC_PATH_PROG( BZIP2, bzip2)
8200         if test -z "$BZIP2"; then
8201             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
8202         fi
8203     fi
8204     ;;
8206     DISABLE_PYTHON=TRUE
8207     SYSTEM_PYTHON=NO
8208     ;;
8210     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8211     ;;
8212 esac
8214 AC_SUBST(DISABLE_PYTHON)
8215 AC_SUBST(SYSTEM_PYTHON)
8216 AC_SUBST(PYTHON_CFLAGS)
8217 AC_SUBST(PYTHON_LIBS)
8218 AC_SUBST(PYTHON_VERSION)
8219 AC_SUBST(PYTHON_VERSION_MAJOR)
8220 AC_SUBST(PYTHON_VERSION_MINOR)
8222 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8223 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8224     AC_MSG_RESULT([yes])
8225     ENABLE_MARIADBC=TRUE
8226     MARIADBC_MAJOR=1
8227     MARIADBC_MINOR=0
8228     MARIADBC_MICRO=2
8229     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8230 else
8231     AC_MSG_RESULT([no])
8232     ENABLE_MARIADBC=
8234 AC_SUBST(ENABLE_MARIADBC)
8235 AC_SUBST(MARIADBC_MAJOR)
8236 AC_SUBST(MARIADBC_MINOR)
8237 AC_SUBST(MARIADBC_MICRO)
8239 if test "$ENABLE_MARIADBC" = "TRUE"; then
8241     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8243     dnl ===================================================================
8244     dnl Check for system MariaDB
8245     dnl ===================================================================
8246     AC_MSG_CHECKING([which MariaDB to use])
8247     if test "$with_system_mariadb" = "yes"; then
8248         AC_MSG_RESULT([external])
8249         SYSTEM_MARIADB=YES
8250         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8251         if test -z "$MARIADBCONFIG"; then
8252             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8253             if test -z "$MARIADBCONFIG"; then
8254                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL package.])
8255                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8256             fi
8257         fi
8258         AC_MSG_CHECKING([MariaDB version])
8259         MARIADB_VERSION=`$MARIADBCONFIG --version`
8260         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8261         if test "$MARIADB_MAJOR" -ge "5"; then
8262             AC_MSG_RESULT([OK])
8263         else
8264             AC_MSG_ERROR([too old, use 5.0.x or later])
8265         fi
8266         AC_MSG_CHECKING([for MariaDB Client library])
8267         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8268         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8269         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8270         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8271         if test "$enable_bundle_mariadb" = "yes"; then
8272             AC_MSG_RESULT([yes])
8273             BUNDLE_MARIADB=YES
8274             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\+-l/\n/g' | grep -E '(mysqlclient|mariadb)')
8275             if test "$_os" = "Darwin"; then
8276                 LIBMARIADB=${LIBMARIADB}.dylib
8277             elif test "$_os" = "WINNT"; then
8278                 LIBMARIADB=${LIBMARIADB}.dll
8279             else
8280                 LIBMARIADB=${LIBMARIADB}.so
8281             fi
8282             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8283             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8284             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8285                 AC_MSG_RESULT([found.])
8286                 PathFormat "$LIBMARIADB_PATH"
8287                 LIBMARIADB_PATH="$formatted_path"
8288             else
8289                 AC_MSG_ERROR([not found.])
8290             fi
8291         else
8292             AC_MSG_RESULT([no])
8293             BUNDLE_MARIADB=NO
8294         fi
8295     else
8296         AC_MSG_RESULT([internal])
8297         AC_MSG_ERROR([libmariadb is known to be broken as of 2013-10; use libmysqlclient])
8298         SYSTEM_MARIADB=NO
8299         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb/include"
8300         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadblib"
8301         BUILD_TYPE="$BUILD_TYPE MARIADB"
8302     fi
8304     AC_SUBST(SYSTEM_MARIADB)
8305     AC_SUBST(MARIADB_CFLAGS)
8306     AC_SUBST(MARIADB_LIBS)
8307     AC_SUBST(LIBMARIADB)
8308     AC_SUBST(LIBMARIADB_PATH)
8309     AC_SUBST(BUNDLE_MARIADB)
8311     AC_LANG_PUSH([C++])
8312     dnl ===================================================================
8313     dnl Check for system MySQL C++ Connector
8314     dnl ===================================================================
8315     # FIXME!
8316     # who thought this too-generic cppconn dir was a good idea?
8317     AC_MSG_CHECKING([MySQL Connector/C++])
8318     if test "$with_system_mysql_cppconn" = "yes"; then
8319         AC_MSG_RESULT([external])
8320         SYSTEM_MYSQL_CPPCONN=YES
8321         AC_LANG_PUSH([C++])
8322         AC_CHECK_HEADER(mysql_driver.h, [],
8323                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8324         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8325                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8326         save_LIBS=$LIBS
8327         LIBS="$LIBS -lmysqlcppconn"
8328         AC_MSG_CHECKING([version])
8329         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8330 #include <mysql_driver.h>
8332 int main(int argc, char **argv) {
8333     sql::Driver *driver;
8334     driver = get_driver_instance();
8335     if (driver->getMajorVersion() > 1 || \
8336        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8337        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8338         return 0;
8339       else
8340         return 1;
8342       ]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR([not suitable, we need >= 1.0.6])],[])
8344         AC_LANG_POP([C++])
8345         LIBS=$save_LIBS
8346     else
8347         AC_MSG_RESULT([internal])
8348         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
8349         SYSTEM_MYSQL_CPPCONN=NO
8350     fi
8351     AC_LANG_POP([C++])
8353 AC_SUBST(SYSTEM_MYSQL_CPPCONN)
8355 dnl ===================================================================
8356 dnl Check for system hsqldb
8357 dnl ===================================================================
8358 if test "$with_java" != "no"; then
8359 HSQLDB_USE_JDBC_4_1=
8360 AC_MSG_CHECKING([which hsqldb to use])
8361 if test "$with_system_hsqldb" = "yes"; then
8362     AC_MSG_RESULT([external])
8363     SYSTEM_HSQLDB=YES
8364     if test -z $HSQLDB_JAR; then
8365         HSQLDB_JAR=/usr/share/java/hsqldb.jar
8366     fi
8367     AC_CHECK_FILE($HSQLDB_JAR, [],
8368                [AC_MSG_ERROR(hsqldb.jar not found.)], [])
8369     AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8370     export HSQLDB_JAR
8371     if $PERL -e 'use Archive::Zip;
8372             my $file = "$ENV{'HSQLDB_JAR'}";
8373             my $zip = Archive::Zip->new( $file );
8374             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8375             if ( $mf =~ m/Specification-Version: 1.8.*/ ) {
8376                push @l, split(/\n/, $mf);
8377                foreach my $line (@l) {
8378                   if ($line =~ m/Specification-Version:/) {
8379                       ($t, $version) = split (/:/,$line);
8380                       $version =~ s/^\s//;
8381                       ($a, $b, $c, $d) = split (/\./,$version);
8382                       if ($c == "0" && $d > "8")  {
8383                           exit 0;
8384                       } else {
8385                           exit 1;
8386                       }
8387                   }
8388                }
8389             } else {
8390                 exit 1;
8391             }'; then
8392         AC_MSG_RESULT([yes])
8393     else
8394         AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8395     fi
8396 else
8397     AC_MSG_RESULT([internal])
8398     SYSTEM_HSQLDB=NO
8399     BUILD_TYPE="$BUILD_TYPE HSQLDB"
8400     AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8401     javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8402     if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8403         AC_MSG_RESULT([yes])
8404         HSQLDB_USE_JDBC_4_1=YES
8405     else
8406         AC_MSG_RESULT([no])
8407     fi
8409 AC_SUBST(SYSTEM_HSQLDB)
8410 AC_SUBST(HSQLDB_JAR)
8411 AC_SUBST([HSQLDB_USE_JDBC_4_1])
8414 dnl ===================================================================
8415 dnl Check for PostgreSQL stuff
8416 dnl ===================================================================
8417 if test "x$enable_postgresql_sdbc" != "xno"; then
8418     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8420     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8421         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8422     fi
8423     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8424         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8425     fi
8427     AC_MSG_CHECKING([PostgreSQL C interface])
8428     if test "$with_system_postgresql" = "yes"; then
8429         AC_MSG_RESULT([external PostgreSQL])
8430         SYSTEM_POSTGRESQL=YES
8431         if test "$_os" = Darwin; then
8432             supp_path=''
8433             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8434                 pg_supp_path="$P_SEP$d$pg_supp_path"
8435             done
8436         fi
8437         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8438         if test -z "$PGCONFIG"; then
8439             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8440         fi
8441         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8442         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8443     else
8444         # if/when anything else than PostgreSQL uses Kerberos,
8445         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8446         WITH_KRB5=NO
8447         WITH_GSSAPI=no
8448         case "$_os" in
8449         Darwin)
8450             # MacOS X has system MIT Kerberos 5 since 10.4
8451             if test "$with_krb5" != "no"; then
8452                 WITH_KRB5=YES
8453                 save_LIBS=$LIBS
8454                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8455                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5, try installing libcom_err devel package])])
8456                 KRB5_LIBS=$LIBS
8457                 LIBS=$save_LIBS
8458                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8459                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5, try installing krb5 devel package])])
8460                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8461                 LIBS=$save_LIBS
8462             fi
8463             if test "$with_gssapi" != "no"; then
8464               WITH_GSSAPI=YES
8465               save_LIBS=$LIBS
8466               AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8467                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8468               GSSAPI_LIBS=$LIBS
8469               LIBS=$save_LIBS
8470             fi
8471             ;;
8472         WINNT)
8473             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8474                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8475             fi
8476             ;;
8477         Linux|GNU|*BSD|DragonFly)
8478             if test "$with_krb5" != "no"; then
8479                 WITH_KRB5=YES
8480                 save_LIBS=$LIBS
8481                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8482                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8483                 KRB5_LIBS=$LIBS
8484                 LIBS=$save_LIBS
8485                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8486                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8487                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8488                 LIBS=$save_LIBS
8489             fi
8490             if test "$with_gssapi" != "no"; then
8491                 WITH_GSSAPI=YES
8492                 save_LIBS=$LIBS
8493                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8494                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8495                 GSSAPI_LIBS=$LIBS
8496                 LIBS=$save_LIBS
8497             fi
8498             ;;
8499         *)
8500             if test "$with_krb5" = "yes"; then
8501                 WITH_KRB5=YES
8502                 save_LIBS=$LIBS
8503                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8504                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8505                 KRB5_LIBS=$LIBS
8506                 LIBS=$save_LIBS
8507                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8508                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8509                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8510                 LIBS=$save_LIBS
8511             fi
8512             if test "$with_gssapi" = "yes"; then
8513                 WITH_GSSAPI=YES
8514                 save_LIBS=$LIBS
8515                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8516                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8517                 LIBS=$save_LIBS
8518                 GSSAPI_LIBS=$LIBS
8519             fi
8520         esac
8522         if test -n "$with_libpq_path"; then
8523             SYSTEM_POSTGRESQL=YES
8524             AC_MSG_RESULT([external libpq])
8525             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8526             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8527         else
8528             SYSTEM_POSTGRESQL=NO
8529             AC_MSG_RESULT([internal])
8530             POSTGRESQL_LIB=""
8531             POSTGRESQL_INC="%OVERRIDE_ME%"
8532             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8533         fi
8534     fi
8535     if test "${SYSTEM_POSTGRESQL}" = "YES"; then
8536         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8537         save_CFLAGS=$CFLAGS
8538         save_CPPFLAGS=$CPPFLAGS
8539         save_LIBS=$LIBS
8540         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8541         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8542         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8543         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8544             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8545         CFLAGS=$save_CFLAGS
8546         CPPFLAGS=$save_CPPFLAGS
8547         LIBS=$save_LIBS
8548     fi
8549     BUILD_POSTGRESQL_SDBC=YES
8551 AC_SUBST(WITH_KRB5)
8552 AC_SUBST(WITH_GSSAPI)
8553 AC_SUBST(GSSAPI_LIBS)
8554 AC_SUBST(KRB5_LIBS)
8555 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8556 AC_SUBST(SYSTEM_POSTGRESQL)
8557 AC_SUBST(POSTGRESQL_INC)
8558 AC_SUBST(POSTGRESQL_LIB)
8560 dnl ===================================================================
8561 dnl Check for Firebird stuff
8562 dnl ===================================================================
8563 ENABLE_FIREBIRD_SDBC=""
8564 if test "x$enable_firebird_sdbc" = "xyes"; then
8565     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8567     dnl ===================================================================
8568     dnl Check for system Firebird
8569     dnl ===================================================================
8570     AC_MSG_CHECKING([which Firebird to use])
8571     if test "$with_system_firebird" = "yes"; then
8572         AC_MSG_RESULT([external])
8573         SYSTEM_FIREBIRD=YES
8574         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8575         if test -z "$FIREBIRDCONFIG"; then
8576             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8577             PKG_CHECK_MODULES(FIREBIRD, fbembed)
8578             FIREBIRD_VERSION=`pkg-config --modversion fbembed`
8579         else
8580             AC_MSG_NOTICE([fb_config found])
8581             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8582             AC_MSG_CHECKING([for Firebird Client library])
8583             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8584             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8585         fi
8586         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8587         AC_MSG_CHECKING([Firebird version])
8588         if test -n "${FIREBIRD_VERSION}"; then
8589             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8590             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8591             if test "$FIREBIRD_MAJOR" -eq "2" -a "$FIREBIRD_MINOR" -eq "5"; then
8592                 AC_MSG_RESULT([OK])
8593             else
8594                 AC_MSG_ERROR([Ensure firebird 2.5.x is installed])
8595             fi
8596         else
8597             __save_CFLAGS="${CFLAGS}"
8598             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8599             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8600 #if defined(FB_API_VER) && FB_API_VER == 25
8601 #else
8602 #error "Wrong Firebird API version"
8603 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 2.5.x is installed]))
8604             CFLAGS="${__save_CFLAGS}"
8605         fi
8606         ENABLE_FIREBIRD_SDBC="TRUE"
8607     elif test "$enable_database_connectivity" != yes; then
8608         AC_MSG_RESULT([none])
8609     elif test "$cross_compiling" = "yes"; then
8610         AC_MSG_RESULT([none])
8611     else
8612         dnl We need libatomic-ops for any non X86/X64 system
8613         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8614             dnl ===================================================================
8615             dnl Check for system libatomic-ops
8616             dnl ===================================================================
8617             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8618             if test "$with_system_libatomic_ops" = "yes"; then
8619                 SYSTEM_LIBATOMIC_OPS=YES
8620                 AC_CHECK_HEADERS(atomic_ops.h, [],
8621                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8622             else
8623                 SYSTEM_LIBATOMIC_OPS=NO
8624                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8625                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8626                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8627             fi
8628         fi
8630         AC_MSG_RESULT([internal])
8631         SYSTEM_FIREBIRD=NO
8632         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/include"
8633         FIREBIRD_LIBS="-lfbembed"
8635         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8636         ENABLE_FIREBIRD_SDBC="TRUE"
8637     fi
8640 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8641 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8642 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8643 AC_SUBST(LIBATOMIC_OPS_LIBS)
8644 AC_SUBST(SYSTEM_FIREBIRD)
8645 AC_SUBST(FIREBIRD_CFLAGS)
8646 AC_SUBST(FIREBIRD_LIBS)
8647 dnl AC_SUBST([TOMMATH_CFLAGS])
8648 dnl AC_SUBST([TOMMATH_LIBS])
8650 dnl ===================================================================
8651 dnl Check for system curl
8652 dnl ===================================================================
8653 AC_MSG_CHECKING([which libcurl to use])
8654 if test "$with_system_curl" = "auto"; then
8655     case "$_os" in
8656     Darwin)
8657         with_system_curl=yes
8658         ;;
8659     *)
8660         with_system_curl="$with_system_libs"
8661         ;;
8662     esac
8665 if test "$with_system_curl" = "yes"; then
8666     AC_MSG_RESULT([external])
8667     SYSTEM_CURL=YES
8669     curl_version=""
8670     if test "$cross_compiling" = "yes"; then
8671         dnl At least the OBS mingw32-libcurl-devel package
8672         dnl comes with a proper .pc file
8673         PKG_CHECK_MODULES(CURL, libcurl,, [:])
8674         if test -n "$CURL_PKG_ERRORS"; then
8675             AC_MSG_RESULT([no])
8676         else
8677             curl_version=`$PKG_CONFIG --modversion libcurl`
8678         fi
8679     fi
8680     if test -z "$curl_version"; then
8681         AC_PATH_PROG(CURLCONFIG, curl-config)
8682         if test -z "$CURLCONFIG"; then
8683             AC_MSG_ERROR([install the libcurl development package])
8684         fi
8685         CURL_LIBS=`$CURLCONFIG --libs`
8686         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8687         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8688     fi
8690     AC_MSG_CHECKING([whether libcurl is >= 7.13.1])
8692     case $curl_version in
8693     dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8694     dnl so they need to be doubled to end up in the configure script
8695     7.13.1|7.1[[4-9]].*|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8696         AC_MSG_RESULT([yes, you have $curl_version])
8697         ;;
8698     *)
8699         AC_MSG_ERROR([no, you have $curl_version])
8700         ;;
8701     esac
8703     libo_MINGW_CHECK_DLL([libcurl])
8704     libo_MINGW_TRY_DLL([libintl])
8705     libo_MINGW_TRY_DLL([libidn])
8706     libo_MINGW_TRY_DLL([libnspr4])
8707     libo_MINGW_TRY_DLL([nssutil3])
8708     libo_MINGW_TRY_DLL([libplc4])
8709     libo_MINGW_TRY_DLL([libplds4])
8710     libo_MINGW_TRY_DLL([nss3])
8711     libo_MINGW_TRY_DLL([ssl3])
8712     libo_MINGW_TRY_DLL([libgpg-error])
8713     libo_MINGW_TRY_DLL([libgcrypt])
8714     libo_MINGW_TRY_DLL([libssh2])
8715 else
8716     AC_MSG_RESULT([internal])
8717     SYSTEM_CURL=NO
8718     BUILD_TYPE="$BUILD_TYPE CURL"
8720 AC_SUBST(SYSTEM_CURL)
8721 AC_SUBST(CURL_CFLAGS)
8722 AC_SUBST(CURL_LIBS)
8724 dnl ===================================================================
8725 dnl Check for system boost
8726 dnl ===================================================================
8727 AC_MSG_CHECKING([which boost to use])
8728 if test "$with_system_boost" = "yes"; then
8729     AC_MSG_RESULT([external])
8730     SYSTEM_BOOST=YES
8731     AX_BOOST_BASE(1.47)
8732     AX_BOOST_DATE_TIME
8733     mingw_boost_date_time_dll=`echo $BOOST_DATE_TIME_LIB | sed -e 's/^-l//' -e 's/\.dll$//'`
8734     libo_MINGW_TRY_DLL([$mingw_boost_date_time_dll])
8735     if test -z "$MINGW_BOOST_DATE_TIME_DLL"; then
8736         # if not found, try again with 'lib' prefix
8737         libo_MINGW_CHECK_DLL([lib$mingw_boost_date_time_dll])
8738     fi
8739     AC_LANG_PUSH([C++])
8740     save_CXXFLAGS=$CXXFLAGS
8741     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS"
8742     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8743        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8744     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8745        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8746     AC_CHECK_HEADER(boost/function.hpp, [],
8747        [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
8748     CXXFLAGS="$CXXFLAGS -fno-exceptions"
8749     AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
8750     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp>
8751 ]], [[]])],[ac_cv_cxx_boost_no_exceptions_broken=no],[ac_cv_cxx_boost_no_exceptions_broken=yes])
8752     if test "$ac_cv_cxx_boost_no_exceptions_broken" = "yes"; then
8753         AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
8754     else
8755         AC_MSG_RESULT([yes])
8756     fi
8757     CXXFLAGS=$save_CXXFLAGS
8758     AC_LANG_POP([C++])
8759 else
8760     AC_MSG_RESULT([internal])
8761     BUILD_TYPE="$BUILD_TYPE BOOST"
8762     SYSTEM_BOOST=NO
8764 AC_SUBST(SYSTEM_BOOST)
8766 dnl ===================================================================
8767 dnl Check for system mdds
8768 dnl ===================================================================
8769 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds >= 0.10.3])
8771 dnl ===================================================================
8772 dnl Determine which hash container mdds shall use
8773 dnl ===================================================================
8774 AC_MSG_CHECKING([which hash container mdds shall use])
8775 if test "x$HAVE_CXX11" = "xTRUE" -a "x$SYSTEM_MDDS" = "xYES"; then
8776     MDDS_CPPFLAGS=$CXXFLAGS_CXX11
8777     AC_MSG_RESULT([std::unordered_map])
8778 else
8779     MDDS_CPPFLAGS="-DMDDS_HASH_CONTAINER_BOOST"
8780     AC_MSG_RESULT([boost::unordered_map])
8782 AC_SUBST([MDDS_CPPFLAGS])
8784 dnl ===================================================================
8785 dnl Check for system vigra
8786 dnl ===================================================================
8787 AC_MSG_CHECKING([which vigra to use])
8788 if test "$with_system_vigra" = "yes"; then
8789     AC_MSG_RESULT([external])
8790     SYSTEM_VIGRA=YES
8791     AC_LANG_PUSH([C++])
8792     AC_CHECK_HEADER(vigra/copyimage.hxx, [],
8793        [AC_MSG_ERROR(vigra/copyimage.hxx not found. install vigra)], [])
8794     AC_LANG_POP([C++])
8795 else
8796     AC_MSG_RESULT([internal])
8797     BUILD_TYPE="$BUILD_TYPE VIGRA"
8798     SYSTEM_VIGRA=NO
8800 AC_SUBST(SYSTEM_VIGRA)
8802 dnl ===================================================================
8803 dnl Check for system odbc
8804 dnl ===================================================================
8805 AC_MSG_CHECKING([which odbc headers to use])
8806 if test "$with_system_odbc" = "yes"; then
8807     AC_MSG_RESULT([external])
8808     SYSTEM_ODBC_HEADERS=YES
8810     AC_CHECK_HEADER(sqlext.h, [],
8811       [AC_MSG_ERROR(odbc not found. install odbc)], [])
8812 elif test "$enable_database_connectivity" != yes; then
8813     AC_MSG_RESULT([none])
8814 else
8815     AC_MSG_RESULT([internal])
8816     SYSTEM_ODBC_HEADERS=NO
8818 AC_SUBST(SYSTEM_ODBC_HEADERS)
8821 dnl ===================================================================
8822 dnl Check for system openldap
8823 dnl ===================================================================
8825 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8826 AC_MSG_CHECKING([which openldap library to use])
8827 if test "$with_system_openldap" = "yes"; then
8828     AC_MSG_RESULT([external])
8829     SYSTEM_OPENLDAP=YES
8830     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8831     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8832     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8833 else
8834     AC_MSG_RESULT([internal])
8835     SYSTEM_OPENLDAP=NO
8836     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8839 AC_SUBST(SYSTEM_OPENLDAP)
8841 dnl ===================================================================
8842 dnl Check for mozilla ab connectivity for windows
8843 dnl ===================================================================
8845 if test "$_os" = "WINNT"; then
8846     AC_MSG_CHECKING([whether to enable build of Mozilla addressbook connectivity driver for Windows])
8847     if test "$enable_win_mozab_driver" = "yes" -a "$WITH_MINGW" != "YES" ; then
8848         WITH_MOZAB4WIN=YES
8849         AC_MSG_RESULT([yes, internal (old windows mozab driver)])
8850         BUILD_TYPE="$BUILD_TYPE MOZ"
8851         MSVC80_DLLS="msvcp80.dll msvcr80.dll Microsoft.VC80.CRT.manifest"
8852         MSVC80_DLL_PATH=`cygpath -u "$TARFILE_LOCATION"`
8853         for dll in $MSVC80_DLLS; do
8854             if ! test -f "$MSVC80_DLL_PATH/$dll"; then
8855                 AC_MSG_ERROR([can not find $dll in $MSVC80_DLL_PATH needed for the pre-built Mozilla libraries])
8856             fi
8857         done
8858     else
8859         AC_MSG_RESULT([no])
8860         WITH_MOZAB4WIN=NO
8861     fi
8863 AC_SUBST(WITH_MOZAB4WIN)
8864 AC_SUBST(MSVC80_DLLS)
8865 AC_SUBST(MSVC80_DLL_PATH)
8867 dnl ===================================================================
8868 dnl Check for TLS/SSL and cryptographic implementation to use
8869 dnl ===================================================================
8870 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8871 if test -n "$with_tls"; then
8872     case $with_tls in
8873     openssl)
8874         AC_DEFINE(USE_TLS_OPENSSL)
8875         TLS=OPENSSL
8877         if test "$enable_openssl" != "yes"; then
8878             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8879         fi
8881         # warn that OpenSSL has been selected but not all TLS code has this option
8882         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS])
8883         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS"
8884         ;;
8885     nss)
8886         AC_DEFINE(USE_TLS_NSS)
8887         TLS=NSS
8888         ;;
8889     *)
8890         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8891 openssl - OpenSSL
8892 nss - Mozilla's Network Security Services (NSS)
8893     ])
8894         ;;
8895     esac
8896 elif test $_os = iOS -o $_os = Android; then
8897     # We don't build NSS for iOS and Android
8898     AC_DEFINE(USE_TLS_OPENSSL)
8899     TLS=OPENSSL
8900 else
8901     # default to using NSS, it results in smaller oox lib
8902     AC_DEFINE(USE_TLS_NSS)
8903     TLS=NSS
8905 AC_MSG_RESULT([$TLS])
8906 AC_SUBST(TLS)
8908 dnl ===================================================================
8909 dnl Check for system NSS
8910 dnl ===================================================================
8911 libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8912 if test "$with_system_nss" = "yes"; then
8913     libo_MINGW_CHECK_DLL([libnspr4])
8914     libo_MINGW_CHECK_DLL([libplc4])
8915     libo_MINGW_CHECK_DLL([libplds4])
8916     libo_MINGW_CHECK_DLL([nss3])
8917     libo_MINGW_CHECK_DLL([nssutil3])
8918     libo_MINGW_CHECK_DLL([smime3])
8919     libo_MINGW_CHECK_DLL([ssl3])
8922 dnl ===================================================================
8923 dnl Check for system mozilla headers
8924 dnl ===================================================================
8925 HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=
8926 AC_MSG_CHECKING([which NPAPI headers to use])
8928 if test "$with_system_npapi_headers" = "yes"; then
8929     AC_MSG_RESULT([external])
8930     SYSTEM_NPAPI_HEADERS=YES
8931     # First try npapi-sdk:
8932     PKG_CHECK_MODULES(NPAPI_HEADERS, npapi-sdk, [LOCATED=yes], [LOCATED=no])
8933     # Then go with libxul:
8934     if test "x$LOCATED" != "xyes"; then
8935         PKG_CHECK_MODULES(NPAPI_HEADERS, libxul, [LOCATED=yes], [LOCATED=no])
8936     fi
8937     if test "x$LOCATED" != "xyes"; then
8938         PKG_CHECK_MODULES(NPAPI_HEADERS, mozilla-plugin, [LOCATED=yes], [LOCATED=no])
8939     fi
8940     # if still not found bail out
8941     if test "x$LOCATED" != "xyes"; then
8942         AC_MSG_ERROR([npapi.h header file not found])
8943     fi
8945     AC_LANG_PUSH([C])
8946     save_CFLAGS=$CFLAGS
8947     CFLAGS="$CFLAGS $NPAPI_HEADERS_CFLAGS"
8948     AC_MSG_CHECKING([for NPP_GetMIMEDescription return type])
8949     AC_COMPILE_IFELSE(
8950         [AC_LANG_SOURCE([[
8951             #define XP_UNIX
8952             #include <npapi.h>
8953             const char* NPP_GetMIMEDescription(void) { return "foo"; }
8954             ]])],
8955         [AC_MSG_RESULT([const char*])],
8956         [
8957         AC_MSG_RESULT([char*])
8958         HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=TRUE
8959         ])
8960     CFLAGS=$save_CFLAGS
8961     AC_LANG_POP([C])
8962     NPAPI_HEADERS_CFLAGS=$(printf '%s' "$NPAPI_HEADERS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8963 else
8964     AC_MSG_RESULT([internal])
8965         dnl ...but will not be built/used unless ENABLE_NPAPI_FROM_BROWSER or
8966         dnl ENABLE_NPAPI_INTO_BROWSER is TRUE
8967     SYSTEM_NPAPI_HEADERS=NO
8969 AC_SUBST(NPAPI_HEADERS_CFLAGS)
8970 AC_SUBST(SYSTEM_NPAPI_HEADERS)
8971 AC_SUBST(HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION)
8973 dnl ===================================================================
8974 dnl Check for system sane
8975 dnl ===================================================================
8976 AC_MSG_CHECKING([which sane header to use])
8977 if test "$with_system_sane" = "yes"; then
8978     AC_MSG_RESULT([external])
8979     AC_CHECK_HEADER(sane/sane.h, [],
8980       [AC_MSG_ERROR(sane not found. install sane)], [])
8981 else
8982     AC_MSG_RESULT([internal])
8983     BUILD_TYPE="$BUILD_TYPE SANE"
8986 dnl ===================================================================
8987 dnl Check for system icu
8988 dnl ===================================================================
8989 SYSTEM_GENBRK=
8990 SYSTEM_GENCCODE=
8991 SYSTEM_GENCMN=
8993 ICU_MAJOR=52
8994 ICU_MINOR=1
8995 ICU_RECLASSIFIED_CLOSE_PARENTHESIS="YES"
8996 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="YES"
8997 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="YES"
8998 ICU_RECLASSIFIED_HEBREW_LETTER="YES"
8999 AC_MSG_CHECKING([which icu to use])
9000 if test "$with_system_icu" = "yes"; then
9001     AC_MSG_RESULT([external])
9002     SYSTEM_ICU=YES
9003     AC_LANG_PUSH([C++])
9004     AC_MSG_CHECKING([for unicode/rbbi.h])
9005     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9006     AC_LANG_POP([C++])
9008     if test "$cross_compiling" != "yes" -o "$WITH_MINGW" = "yes"; then
9009         ICUPATH="$PATH"
9010         if test "$WITH_MINGW" = "yes"; then
9011             ICUPATH=`$CC -print-sysroot`/mingw/bin:"$ICUPATH"
9012         fi
9013         AC_PATH_PROG(ICUCONFIG,icu-config,,[$ICUPATH])
9015         AC_MSG_CHECKING([ICU version])
9016         ICU_VERSION=`$ICUCONFIG --noverify --version 2>/dev/null || $ICUCONFIG --version`
9017         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9018         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9020         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "2" \); then
9021             AC_MSG_RESULT([OK, $ICU_VERSION])
9022         else
9023             AC_MSG_ERROR([not suitable, only >= 4.2 supported currently])
9024         fi
9025     fi
9027     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9028         AC_PATH_PROG([ICUCONFIG_FOR_BUILD], [icu-config], [], [$PATH:/usr/sbin:/sbin])
9029         ICU_VERSION_FOR_BUILD=`$ICUCONFIG_FOR_BUILD --noverify --version 2>/dev/null || $ICUCONFIG_FOR_BUILD --version`
9030         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9031         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9032         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9033         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9034             AC_MSG_RESULT([yes])
9035         else
9036             AC_MSG_RESULT([no])
9037             if test "$with_system_icu_for_build" != "force"; then
9038                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9039 You can use --with-system-icu-for-build=force to use it anyway.])
9040             fi
9041         fi
9042     fi
9044     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9045         # using the system icu tools can lead to version confusion, use the
9046         # ones from the build environment when cross-compiling
9047         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9048         if test -z "$SYSTEM_GENBRK"; then
9049             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9050         fi
9051         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9052         if test -z "$SYSTEM_GENCCODE"; then
9053             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9054         fi
9055         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9056         if test -z "$SYSTEM_GENCMN"; then
9057             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9058         fi
9059         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "4" \); then
9060             ICU_RECLASSIFIED_CLOSE_PARENTHESIS="YES"
9061         else
9062             ICU_RECLASSIFIED_CLOSE_PARENTHESIS="NO"
9063         fi
9064         if test "$ICU_MAJOR" -ge "49"; then
9065             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="YES"
9066             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="YES"
9067             ICU_RECLASSIFIED_HEBREW_LETTER="YES"
9068         else
9069             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="NO"
9070             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="NO"
9071             ICU_RECLASSIFIED_HEBREW_LETTER="NO"
9072         fi
9073     fi
9075     if test "$cross_compiling" = "yes"; then
9076        if test "$ICU_MAJOR" -ge "50"; then
9077             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9078             ICU_MINOR=""
9079        fi
9080     fi
9082     libo_MINGW_CHECK_DLL([icudata][$ICU_MAJOR][$ICU_MINOR])
9083     libo_MINGW_CHECK_DLL([icui18n][$ICU_MAJOR][$ICU_MINOR])
9084     libo_MINGW_CHECK_DLL([icuuc][$ICU_MAJOR][$ICU_MINOR])
9085 else
9086     AC_MSG_RESULT([internal])
9087     SYSTEM_ICU="NO"
9088     BUILD_TYPE="$BUILD_TYPE ICU"
9089     # surprisingly set these only for "internal" (to be used by various other
9090     # external libs): the system icu-config is quite unhelpful and spits out
9091     # dozens of weird flags and also default path -I/usr/include
9092     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9093     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9095 AC_SUBST(SYSTEM_ICU)
9096 AC_SUBST(SYSTEM_GENBRK)
9097 AC_SUBST(SYSTEM_GENCCODE)
9098 AC_SUBST(SYSTEM_GENCMN)
9099 AC_SUBST(ICU_MAJOR)
9100 AC_SUBST(ICU_MINOR)
9101 AC_SUBST(ICU_RECLASSIFIED_CLOSE_PARENTHESIS)
9102 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9103 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9104 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9105 AC_SUBST(ICU_CFLAGS)
9106 AC_SUBST(ICU_LIBS)
9108 dnl ===================================================================
9109 dnl Graphite
9110 dnl ===================================================================
9112 AC_MSG_CHECKING([whether to enable graphite support])
9113 if test $_os != Darwin -a $_os != Android -a $_os != iOS -a \( -z "$enable_graphite" -o "$enable_graphite" != no \); then
9114     AC_MSG_RESULT([yes])
9115     ENABLE_GRAPHITE="TRUE"
9116     AC_DEFINE(ENABLE_GRAPHITE)
9117     libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
9118     if test "$with_system_graphite" = "yes"; then
9119         libo_MINGW_CHECK_DLL([libgraphite2])
9120     fi
9121 else
9122     AC_MSG_RESULT([no])
9124 AC_SUBST(ENABLE_GRAPHITE)
9126 dnl ===================================================================
9127 dnl Orcus
9128 dnl ===================================================================
9130 AC_MSG_CHECKING([whether to enable orcus])
9131 if test -z "$enable_orcus" -o "$enable_orcus" != no; then
9132     AC_MSG_RESULT([yes])
9133     ENABLE_ORCUS="TRUE"
9134     AC_DEFINE(ENABLE_ORCUS)
9136     libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.6 >= 0.5.0])
9137     if test "$with_system_orcus" != "yes"; then
9138         if test "$SYSTEM_BOOST" = "YES"; then
9139             # ===========================================================
9140             # Determine if we are going to need to link with Boost.System
9141             # ===========================================================
9142             dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9143             dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9144             dnl in documentation has no effect.
9145             AC_MSG_CHECKING([if we need to link with Boost.System])
9146             AC_LANG_PUSH([C++])
9147             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9148                     @%:@include <boost/version.hpp>
9149                 ]],[[
9150                     #if BOOST_VERSION >= 105000
9151                     #   error yes, we need to link with Boost.System
9152                     #endif
9153                 ]])],[
9154                     AC_MSG_RESULT([no])
9155                 ],[
9156                     AC_MSG_RESULT([yes])
9157                     AX_BOOST_SYSTEM
9158             ])
9159             AC_LANG_POP([C++])
9160         fi
9161     fi
9162     dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9163     SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9164     AC_SUBST([BOOST_SYSTEM_LIB])
9165     AC_SUBST(SYSTEM_LIBORCUS)
9167 else
9168     AC_MSG_RESULT([no])
9170 AC_SUBST(ENABLE_ORCUS)
9172 dnl ===================================================================
9173 dnl HarfBuzz
9174 dnl ===================================================================
9175 AC_MSG_CHECKING([whether to enable HarfBuzz support])
9176 if test $_os != WINNT -a $_os != Darwin -a $_os != iOS; then
9177     AC_MSG_RESULT([yes])
9178     ENABLE_HARFBUZZ="TRUE"
9179     if $PKG_CONFIG --atleast-version 0.9.18 harfbuzz; then
9180         libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.18],["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz -lharfbuzz-icu"])
9181     else
9182         libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz >= 0.9.10],[-I${WORKDIR}/UnpackedTarball/harfbuzz/src],["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz -lharfbuzz-icu"])
9183     fi
9184 else
9185     AC_MSG_RESULT([no])
9187 AC_SUBST(ENABLE_HARFBUZZ)
9189 dnl ===================================================================
9190 dnl Check for NPAPI interface to plug browser plugins into LibreOffice documents
9191 dnl ===================================================================
9192 AC_MSG_CHECKING([whether to plug browser plugins into LibreOffice documents])
9193 # Obviously no such thing on iOS or Android. Also not possible when building
9194 # 64-bit OS X code as the plugin code uses QuickTime and Carbon.
9195 if test "$_os" != Android -a "$_os" != iOS -a \( $_os != Darwin -o "$BITNESS_OVERRIDE" = "" \) -a \
9196         "$enable_headless" != yes -a "$enable_mpl_subset" != yes
9197 then
9198     AC_MSG_RESULT([yes])
9199     ENABLE_NPAPI_FROM_BROWSER=TRUE
9200 else
9201     AC_MSG_RESULT([no])
9202     ENABLE_NPAPI_FROM_BROWSER=
9204 AC_SUBST(ENABLE_NPAPI_FROM_BROWSER)
9206 dnl ===================================================================
9207 dnl Check for NPAPI interface to plug LibreOffice into browser windows
9208 dnl ===================================================================
9209 AC_MSG_CHECKING([whether to plug LibreOffice into browser windows])
9210 if test "$enable_mpl_subset" != yes -a \( "$_os" = WINNT -o "$_os" != Android -a "$_os" != Darwin -a "$_os" != iOS -a \
9211         "$enable_headless" != yes -a "$enable_gtk" != no \)
9212 then
9213     AC_MSG_RESULT([yes])
9214     ENABLE_NPAPI_INTO_BROWSER=TRUE
9215 else
9216     AC_MSG_RESULT([no])
9217     ENABLE_NPAPI_INTO_BROWSER=
9219 AC_SUBST(ENABLE_NPAPI_INTO_BROWSER)
9221 AC_MSG_CHECKING([whether to use X11])
9222 dnl ***************************************
9223 dnl testing for X libraries and includes...
9224 dnl ***************************************
9225 WANT_X11="no"
9226 if test $_os != Darwin -a $_os != WINNT -a $_os != Android -a $_os != iOS -a "$enable_headless" != "yes"; then
9227     WANT_X11="yes"
9228     AC_DEFINE(HAVE_FEATURE_X11)
9230 AC_MSG_RESULT([$WANT_X11])
9232 if test "$WANT_X11" = "yes"; then
9233     AC_PATH_X
9234     AC_PATH_XTRA
9235     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9237     if test -z "$x_includes"; then
9238         x_includes="default_x_includes"
9239     fi
9240     if test -z "$x_libraries"; then
9241         x_libraries="default_x_libraries"
9242     fi
9243     CFLAGS="$CFLAGS $X_CFLAGS"
9244     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9245     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9246 else
9247     x_includes="no_x_includes"
9248     x_libraries="no_x_libraries"
9251 if test "$WANT_X11" = "yes"; then
9252     dnl ===================================================================
9253     dnl Check for Composite.h for Mozilla plugin
9254     dnl ===================================================================
9255     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
9256      [#include <X11/Intrinsic.h>])
9258     # ENABLE_NPAPI_FROM_BROWSER requires Xt library
9259     AC_CHECK_LIB([Xt], [XtToolkitInitialize], [:],
9260         [AC_MSG_ERROR(Xt library not found)])
9262     dnl ===================================================================
9263     dnl Check for extension headers
9264     dnl ===================================================================
9265     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9266      [#include <X11/extensions/shape.h>])
9268     # vcl needs ICE and SM
9269     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9270     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9271         [AC_MSG_ERROR(ICE library not found)])
9272     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9273     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9274         [AC_MSG_ERROR(SM library not found)])
9277 dnl ===================================================================
9278 dnl Check for system Xrender
9279 dnl ===================================================================
9280 AC_MSG_CHECKING([whether to use Xrender])
9281 if test "$WANT_X11" = "yes" -a  "$test_xrender" = "yes"; then
9282     AC_MSG_RESULT([yes])
9283     PKG_CHECK_MODULES(XRENDER, xrender)
9284     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9285     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9286       [AC_MSG_ERROR(libXrender not found or functional)], [])
9287     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9288       [AC_MSG_ERROR(Xrender not found. install X)], [])
9289 else
9290     AC_MSG_RESULT([no])
9292 AC_SUBST(XRENDER_CFLAGS)
9293 AC_SUBST(XRENDER_LIBS)
9295 dnl ===================================================================
9296 dnl Check for XRandr
9297 dnl ===================================================================
9298 AC_MSG_CHECKING([whether to enable RandR support])
9299 if test "$WANT_X11" = "yes" -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9300     if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
9301         XRANDR_DLOPEN="TRUE"
9302         AC_MSG_RESULT([configured to dlopen libXrandr at runtime])
9303     else
9304         AC_MSG_RESULT([yes])
9305         XRANDR_DLOPEN="FALSE"
9306         PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9307         if test "$ENABLE_RANDR" != "TRUE"; then
9308             AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9309                         [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9310             XRANDR_CFLAGS=" "
9311             AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9312               [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9313             XRANDR_LIBS="-lXrandr "
9314             ENABLE_RANDR="TRUE"
9315         fi
9316         XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9317     fi
9318 else
9319     ENABLE_RANDR=""
9320     AC_MSG_RESULT([no])
9322 AC_SUBST(XRANDR_DLOPEN)
9323 AC_SUBST(XRANDR_CFLAGS)
9324 AC_SUBST(XRANDR_LIBS)
9325 AC_SUBST(ENABLE_RANDR)
9327 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9328     WITH_WEBDAV="serf"
9330 if test $_os = iOS -o $_os = Android; then
9331     WITH_WEBDAV="no"
9333 AC_MSG_CHECKING([for webdav library])
9334 case "$WITH_WEBDAV" in
9335 serf)
9336     AC_MSG_RESULT([serf])
9337     # Check for system apr-util
9338     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9339                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9340                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9341     if test "$COM" = "MSC"; then
9342         APR_LIB_DIR="LibR"
9343         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9344         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9345     fi
9347     # Check for system serf
9348     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9349                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9350     if test "$COM" = "MSC"; then
9351         SERF_LIB_DIR="Release"
9352         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9353         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9354     fi
9355     ;;
9356 neon)
9357     AC_MSG_RESULT([neon])
9358     # Check for system neon
9359     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9360     if test "$with_system_neon" = "yes"; then
9361         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9362         libo_MINGW_CHECK_DLL([libneon])
9363         libo_MINGW_TRY_DLL([libtasn1])
9364         libo_MINGW_TRY_DLL([libgnutls])
9365     else
9366         SCPDEFS="$SCPDEFS -DNEED_NEON"
9367         NEON_VERSION=0295
9368     fi
9369     AC_SUBST(NEON_VERSION)
9370     ;;
9372     AC_MSG_RESULT([none, disabled])
9373     WITH_WEBDAV=""
9374     ;;
9375 esac
9376 AC_SUBST(WITH_WEBDAV)
9378 dnl ===================================================================
9379 dnl Check for disabling cve_tests
9380 dnl ===================================================================
9381 AC_MSG_CHECKING([whether to execute CVE tests])
9382 if test "$enable_cve_tests" = "no"; then
9383     AC_MSG_RESULT([no])
9384     DISABLE_CVE_TESTS=TRUE
9385     AC_SUBST(DISABLE_CVE_TESTS)
9386 else
9387     AC_MSG_RESULT([yes])
9390 dnl ===================================================================
9391 dnl Check for system openssl
9392 dnl ===================================================================
9393 DISABLE_OPENSSL=
9394 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9395 if test "$enable_openssl" = "yes"; then
9396     AC_MSG_RESULT([no])
9397     if test "$_os" = Darwin -a "${MAC_OS_X_VERSION_MIN_REQUIRED:-0}" -ge 1070; then
9398         # OpenSSL is deprecated when building for 10.7 or later.
9399         #
9400         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9401         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9402         #
9403         # They apparently got fed up with the unstable ABI of
9404         # OpenSSL, or something, and recommend you either move to
9405         # their "Common Crypto Architecture", or, if you have to stay
9406         # with OpenSSL, just build it yourself statically and bundle
9407         # with your application.
9409         with_system_openssl=no
9410         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9411     elif test "$_os" = "Darwin" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o \
9412             "$_os" = "DragonFly" && test "$with_system_openssl" != "no"; then
9413         # Mac OS builds should get out without extra stuff is the Mac porters'
9414         # wish. And pkg-config is although Xcode ships a .pc for openssl
9415         with_system_openssl=yes
9416         SYSTEM_OPENSSL=YES
9417         OPENSSL_CFLAGS=
9418         OPENSSL_LIBS="-lssl -lcrypto"
9419     else
9420         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9421     fi
9422     if test "$with_system_openssl" = "yes"; then
9423         libo_MINGW_CHECK_DLL([libssl])
9424         libo_MINGW_CHECK_DLL([libcrypto])
9425         AC_MSG_CHECKING([whether openssl supports SHA512])
9426         AC_LANG_PUSH([C])
9427         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9428             SHA512_CTX context;
9429 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9430         AC_LANG_POP(C)
9431     fi
9432 else
9433     AC_MSG_RESULT([yes])
9434     DISABLE_OPENSSL=TRUE
9436     # warn that although OpenSSL is disabled, system libraries may be depending on it
9437     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9438     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9441 AC_SUBST([DISABLE_OPENSSL])
9443 dnl ===================================================================
9444 dnl Check for building gnutls
9445 dnl ===================================================================
9446 AC_MSG_CHECKING([whether to use gnutls])
9447 if test "$WITH_WEBDAV" = "neon" && test "$enable_openssl" = "no"; then
9448     AC_MSG_RESULT([yes])
9449     AM_PATH_LIBGCRYPT()
9450     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9451         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9452                       available in the system to use as replacement.]]))
9455 AC_SUBST([LIBGCRYPT_CFLAGS])
9456 AC_SUBST([LIBGCRYPT_LIBS])
9458 dnl ===================================================================
9459 dnl Check for system redland
9460 dnl ===================================================================
9461 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9462 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9463 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9464 if test "$with_system_redland" = "yes"; then
9465     libo_MINGW_CHECK_DLL([librdf])
9466     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9467             [AC_MSG_ERROR(librdf too old. Need >= 1.16)], [])
9468     libo_MINGW_TRY_DLL([libraptor])
9469     libo_MINGW_TRY_DLL([librasqal])
9470     libo_MINGW_TRY_DLL([libsqlite3])
9471 else
9472     RAPTOR_MAJOR="0"
9473     RASQAL_MAJOR="3"
9474     REDLAND_MAJOR="0"
9476 AC_SUBST(RAPTOR_MAJOR)
9477 AC_SUBST(RASQAL_MAJOR)
9478 AC_SUBST(REDLAND_MAJOR)
9480 dnl ===================================================================
9481 dnl Check for system hunspell
9482 dnl ===================================================================
9483 AC_MSG_CHECKING([which libhunspell to use])
9484 if test "$with_system_hunspell" = "yes"; then
9485     AC_MSG_RESULT([external])
9486     SYSTEM_HUNSPELL=YES
9487     AC_LANG_PUSH([C++])
9488     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9489     if test "$HUNSPELL_PC" != "TRUE"; then
9490         AC_CHECK_HEADER(hunspell.hxx, [],
9491             [
9492             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9493             [AC_MSG_ERROR(hunspell headers not found.)], [])
9494             ], [])
9495         AC_CHECK_LIB([hunspell], [main], [:],
9496            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9497         HUNSPELL_LIBS=-lhunspell
9498     fi
9499     AC_LANG_POP([C++])
9500     libo_MINGW_CHECK_DLL([libhunspell-1.3])
9501     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9502 else
9503     AC_MSG_RESULT([internal])
9504     SYSTEM_HUNSPELL=NO
9505     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9506     if test "$COM" = "MSC"; then
9507         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9508     else
9509         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.3"
9510     fi
9511     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9513 AC_SUBST(SYSTEM_HUNSPELL)
9514 AC_SUBST(HUNSPELL_CFLAGS)
9515 AC_SUBST(HUNSPELL_LIBS)
9517 dnl ===================================================================
9518 dnl Checking for altlinuxhyph
9519 dnl ===================================================================
9520 AC_MSG_CHECKING([which altlinuxhyph to use])
9521 if test "$with_system_altlinuxhyph" = "yes"; then
9522     AC_MSG_RESULT([external])
9523     SYSTEM_HYPH=YES
9524     AC_CHECK_HEADER(hyphen.h, [],
9525        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9526     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9527        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9528        [#include <hyphen.h>])
9529     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9530         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9531     if test -z "$HYPHEN_LIB"; then
9532         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9533            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9534     fi
9535     if test -z "$HYPHEN_LIB"; then
9536         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9537            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9538     fi
9539     libo_MINGW_CHECK_DLL([libhyphen])
9540 else
9541     AC_MSG_RESULT([internal])
9542     SYSTEM_HYPH=NO
9543     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9544     if test "$COM" = "MSC"; then
9545         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9546     else
9547         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9548     fi
9550 AC_SUBST(SYSTEM_HYPH)
9551 AC_SUBST(HYPHEN_LIB)
9553 dnl ===================================================================
9554 dnl Checking for mythes
9555 dnl ===================================================================
9556 AC_MSG_CHECKING([which mythes to use])
9557 if test "$with_system_mythes" = "yes"; then
9558     AC_MSG_RESULT([external])
9559     SYSTEM_MYTHES=YES
9560     AC_LANG_PUSH([C++])
9561     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9562     if test "$MYTHES_PKGCONFIG" = "no"; then
9563         AC_CHECK_HEADER(mythes.hxx, [],
9564             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9565         AC_CHECK_LIB([mythes-1.2], [main], [:],
9566             [ MYTHES_FOUND=no], [])
9567     if test "$MYTHES_FOUND" = "no"; then
9568         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9569                 [ MYTHES_FOUND=no], [])
9570     fi
9571     if test "$MYTHES_FOUND" = "no"; then
9572         AC_MSG_ERROR([mythes library not found!.])
9573     fi
9574     fi
9575     AC_LANG_POP([C++])
9576     libo_MINGW_CHECK_DLL([libmythes-1.2])
9577     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9578 else
9579     AC_MSG_RESULT([internal])
9580     SYSTEM_MYTHES=NO
9581     BUILD_TYPE="$BUILD_TYPE MYTHES"
9582     if test "$COM" = "MSC"; then
9583         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9584     else
9585         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9586     fi
9588 AC_SUBST(SYSTEM_MYTHES)
9589 AC_SUBST(MYTHES_CFLAGS)
9590 AC_SUBST(MYTHES_LIBS)
9592 dnl ===================================================================
9593 dnl How should we build the linear programming solver ?
9594 dnl ===================================================================
9596 ENABLE_COINMP=
9597 AC_MSG_CHECKING([whether to build with CoinMP])
9598 if test "$enable_coinmp" != "no"; then
9599     ENABLE_COINMP=TRUE
9600     AC_MSG_RESULT([yes])
9601     # Should we check for system CoinMP ? How to do that ?
9602     BUILD_TYPE="$BUILD_TYPE COINMP"
9603 else
9604     AC_MSG_RESULT([no])
9606 AC_SUBST(ENABLE_COINMP)
9608 ENABLE_LPSOLVE=
9609 AC_MSG_CHECKING([whether to build with lpsolve])
9610 if test "$enable_lpsolve" != "no"; then
9611     ENABLE_LPSOLVE=TRUE
9612     AC_MSG_RESULT([yes])
9613 else
9614     AC_MSG_RESULT([no])
9616 AC_SUBST(ENABLE_LPSOLVE)
9618 AC_MSG_CHECKING([which lpsolve to use])
9619 if test "$with_system_lpsolve" = "yes"; then
9620     AC_MSG_RESULT([external])
9621     SYSTEM_LPSOLVE=YES
9622     AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9623        [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9624     save_LIBS=$LIBS
9625     # some systems need this. Like Ubuntu....
9626     AC_CHECK_LIB(m, floor)
9627     AC_CHECK_LIB(dl, dlopen)
9628     AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9629         [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9630     LIBS=$save_LIBS
9631     libo_MINGW_CHECK_DLL([lpsolve55])
9632 else
9633     AC_MSG_RESULT([internal])
9634     SYSTEM_LPSOLVE=NO
9635     BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9637 AC_SUBST(SYSTEM_LPSOLVE)
9641 dnl ===================================================================
9642 dnl Checking for libexttextcat
9643 dnl ===================================================================
9644 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.1.1])
9645 if test "$with_system_libexttextcat" = "yes"; then
9646     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9648 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9650 dnl ***************************************
9651 dnl testing libc version for Linux...
9652 dnl ***************************************
9653 if test "$_os" = "Linux"; then
9654     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9655     exec 6>/dev/null # no output
9656     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9657     exec 6>&1 # output on again
9658     if test "$HAVE_LIBC"; then
9659         AC_MSG_RESULT([yes])
9660     else
9661         AC_MSG_ERROR([no, upgrade libc])
9662     fi
9665 dnl =========================================
9666 dnl Check for the Windows  SDK.
9667 dnl =========================================
9668 dnl FIXME: I don't know yet if the Windows SDK works with MinGW, keep it until I know better,
9669 dnl and add "-a \( "$WITH_MINGW" != "yes" \)" then
9670 if test "$_os" = "WINNT"; then
9671     AC_MSG_CHECKING([for Windows SDK])
9672     if test "$build_os" = "cygwin"; then
9673         find_winsdk
9674         WINDOWS_SDK_HOME=$winsdktest
9676         # normalize if found
9677         if test -n "$WINDOWS_SDK_HOME"; then
9678             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
9679             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
9680         fi
9681     fi
9683     if test -n "$WINDOWS_SDK_HOME"; then
9684         # Remove a possible trailing backslash
9685         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
9687         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
9688              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
9689              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
9690             have_windows_sdk_headers=yes
9691         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
9692              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
9693              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
9694             have_windows_sdk_headers=yes
9695         else
9696             have_windows_sdk_headers=no
9697         fi
9699         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
9700             have_windows_sdk_libs=yes
9701         elif test -f "$WINDOWS_SDK_HOME/lib/win8/um/$WINDOWS_SDK_ARCH/user32.lib"; then
9702             have_windows_sdk_libs=yes
9703         else
9704             have_windows_sdk_libs=no
9705         fi
9707         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
9708             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
9709 the  Windows SDK are installed.])
9710         fi
9712         if test ! -f "$WINDOWS_SDK_HOME/bin/msiinfo.exe" \
9713              -o ! -f "$WINDOWS_SDK_HOME/bin/msidb.exe" \
9714              -o ! -f "$WINDOWS_SDK_HOME/bin/uuidgen.exe" \
9715              -o ! -f "$WINDOWS_SDK_HOME/bin/msitran.exe"; then :
9716         elif test ! -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
9717              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
9718              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/uuidgen.exe" \
9719              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
9720         else
9721             AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
9722         fi
9723     fi
9725     if test -z "$WINDOWS_SDK_HOME"; then
9726         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
9727     elif echo $WINDOWS_SDK_HOME | grep "v6.0" >/dev/null 2>/dev/null; then
9728         WINDOWS_SDK_VERSION=60
9729         AC_MSG_RESULT([found Windows SDK 6.0 ($WINDOWS_SDK_HOME)])
9730     elif echo $WINDOWS_SDK_HOME | grep "v6.1" >/dev/null 2>/dev/null; then
9731         WINDOWS_SDK_VERSION=61
9732         AC_MSG_RESULT([found Windows SDK 6.1 ($WINDOWS_SDK_HOME)])
9733     elif echo $WINDOWS_SDK_HOME | grep "v7" >/dev/null 2>/dev/null; then
9734         WINDOWS_SDK_VERSION=70
9735         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
9736     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
9737         WINDOWS_SDK_VERSION=80
9738         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
9739         # compatibility warning if usind VS 2012 and not explicitly choosing the 80 SDK
9740         if test "$VCVER" = "110" -a -z "$with_windows_sdk"; then
9741             AC_MSG_WARN([If a build created with VS 2012 should run on Windows XP,])
9742             AC_MSG_WARN([use --with-windows-sdk=7.1A (requires VS 2012 Update 1 or newer)])
9743             add_warning "If a build created with VS 2012 should run on Windows XP,"
9744             add_warning "use --with-windows-sdk=7.1A (requires VS 2012 Update 1 or newer)"
9745         fi
9746     else
9747         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
9748     fi
9749     PathFormat "$WINDOWS_SDK_HOME"
9750     WINDOWS_SDK_HOME="$formatted_path"
9751     if test "$build_os" = "cygwin"; then
9752         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/include"
9753         if test -d "$WINDOWS_SDK_HOME/include/um"; then
9754             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
9755         fi
9756     fi
9758     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
9759     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
9760     dnl but not in v8.0), so allow this to be overriden with a
9761     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
9762     dnl and configuration error if no WiLangId.vbs is found would arguably be
9763     dnl better, but I do not know under which conditions exactly it is needed by
9764     dnl msiglobal.pm:
9765     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
9766         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
9767         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9768             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
9769         fi
9770         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9771             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.0/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
9772         fi
9773         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9774             AC_MSG_WARN([WiLangId.vbs not found - building translated packages will fail])
9775             add_warning "WiLangId.vbs not found - building translated packages will fail"
9776         fi
9777     fi
9779 AC_SUBST(WINDOWS_SDK_HOME)
9780 AC_SUBST(WINDOWS_SDK_VERSION)
9781 AC_SUBST(WINDOWS_SDK_WILANGID)
9783 dnl =========================================
9784 dnl Check for uuidgen
9785 dnl =========================================
9786 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9787     if test "$WITH_MINGW" = "yes"; then
9788         AC_PATH_PROG([UUIDGEN], [uuid])
9789         if test -z "$UUIDGEN"; then
9790             AC_MSG_WARN([uuid is needed for dev-install])
9791         fi
9792     else
9793         # presence is already tested above in the WINDOWS_SDK_HOME check
9794         UUIDGEN=uuidgen.exe
9795         AC_SUBST(UUIDGEN)
9796     fi
9797 else
9798     AC_PATH_PROG([UUIDGEN], [uuidgen])
9799     if test -z "$UUIDGEN"; then
9800         AC_MSG_WARN([uuid is needed for dev-install])
9801     fi
9804 dnl =========================================
9805 dnl Check for the Microsoft DirectX SDK.
9806 dnl =========================================
9807 if test -n "$ENABLE_DIRECTX" -a "$_os" = "WINNT"; then
9808     AC_MSG_CHECKING([for DirectX SDK])
9809     if test "$build_os" = "cygwin"; then
9810         dnl A standard installation of the DirectX SDK sets $DXSDK_DIR
9811         if test -n "$DXSDK_DIR"; then
9812             DIRECTXSDK_HOME=`cygpath -d "$DXSDK_DIR"`
9813             DIRECTXSDK_HOME=`cygpath -u "$DIRECTXSDK_HOME"`
9814         fi
9815         # At this point $DIRECTXSDK_HOME might still be undefined. This will lead to
9816         # the "DirectX SDK not found" error later.
9817         # (Where?)
9819         # Remove a possible trailing backslash
9820         DIRECTXSDK_HOME=`echo $DIRECTXSDK_HOME | $SED 's/\/$//'`
9821     fi
9823     if test -f "$DIRECTXSDK_HOME/Include/ddraw.h" -o -f "$DIRECTXSDK_HOME/Include/d3d9.h"; then
9824         HAVE_DIRECTXSDK_H="yes"
9825     else
9826         HAVE_DIRECTXSDK_H="no"
9827     fi
9829     if test "$BITNESS_OVERRIDE" = 64; then
9830         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x64"
9831     else
9832         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x86"
9833     fi
9834     PathFormat "$DIRECTXSDK_LIB"
9835     DIRECTXSDK_LIB="$formatted_path"
9837     if test -f "$DIRECTXSDK_LIB/ddraw.lib" -o -f "$DIRECTXSDK_LIB/d3d9.lib"; then
9838         HAVE_DIRECTXSDK_LIB="yes"
9839     else
9840         HAVE_DIRECTXSDK_LIB="no"
9841     fi
9843     if test "$HAVE_DIRECTXSDK_H" = "yes" -a "$HAVE_DIRECTXSDK_LIB" = "yes"; then
9844         AC_MSG_RESULT([found])
9845     else
9846         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway])
9847     fi
9848     if test -n "$DIRECTXSDK_HOME"; then
9849         PathFormat "$DIRECTXSDK_HOME"
9850         DIRECTXSDK_HOME="$formatted_path"
9851         SOLARINC="$SOLARINC -I$DIRECTXSDK_HOME/include"
9852     fi
9854 AC_SUBST(DIRECTXSDK_HOME)
9856 dnl ***************************************
9857 dnl Checking for bison and flex
9858 dnl ***************************************
9859 AC_PATH_PROG(BISON, bison)
9860 if test -z "$BISON"; then
9861     AC_MSG_ERROR([no bison found in \$PATH, install it])
9862 else
9863     AC_MSG_CHECKING([the bison version])
9864     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9865     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9866     # Accept newer than 2.0
9867     if test "$_bison_longver" -lt 2000; then
9868         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9869     fi
9872 AC_PATH_PROG(FLEX, flex)
9873 if test -z "$FLEX"; then
9874     AC_MSG_ERROR([no flex found in \$PATH, install it])
9875 else
9876     AC_MSG_CHECKING([the flex version])
9877     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9878     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9879         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9880     fi
9882 AC_SUBST([FLEX])
9883 dnl ***************************************
9884 dnl Checking for patch
9885 dnl ***************************************
9886 AC_PATH_PROG(PATCH, patch)
9887 if test -z "$PATCH"; then
9888     AC_MSG_ERROR([\"patch\" not found in \$PATH, install it])
9891 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9892 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9893     if test -z "$with_gnu_patch"; then
9894         GNUPATCH=$PATCH
9895     else
9896         if test -x "$with_gnu_patch"; then
9897             GNUPATCH=$with_gnu_patch
9898         else
9899             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9900         fi
9901     fi
9903     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9904     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9905         AC_MSG_RESULT([yes])
9906     else
9907         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9908     fi
9909 else
9910     GNUPATCH=$PATCH
9913 dnl We also need to check for --with-gnu-cp
9915 if test -z "$with_gnu_cp"; then
9916     # check the place where the good stuff is hidden on Solaris...
9917     if test -x /usr/gnu/bin/cp; then
9918         GNUCP=/usr/gnu/bin/cp
9919     else
9920         AC_PATH_PROGS(GNUCP, gnucp cp)
9921     fi
9922     if test -z $GNUCP; then
9923         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9924     fi
9925 else
9926     if test -x "$with_gnu_cp"; then
9927         GNUCP=$with_gnu_cp
9928     else
9929         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9930     fi
9933 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9934 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9935     AC_MSG_RESULT([yes])
9936 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9937     AC_MSG_RESULT([yes])
9938 else
9939     case "$build_os" in
9940     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9941         x_GNUCP=[\#]
9942         GNUCP=''
9943         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9944         ;;
9945     *)
9946         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9947         ;;
9948     esac
9951 AC_SUBST(GNUPATCH)
9952 AC_SUBST(GNUCP)
9953 AC_SUBST(x_GNUCP)
9955 dnl ***************************************
9956 dnl testing assembler path
9957 dnl ***************************************
9958 ML_EXE=""
9959 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
9960     if test "$BITNESS_OVERRIDE" = ""; then
9961         assembler=ml.exe
9962         assembler_bin=bin
9963     else
9964         assembler=ml64.exe
9965         assembler_bin=bin/amd64
9966     fi
9968     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9969     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9970         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9971         AC_MSG_RESULT([found])
9972         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9973     else
9974         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9975     fi
9977     PathFormat "$ASM_HOME"
9978     ASM_HOME="$formatted_path"
9979 else
9980     ASM_HOME=""
9983 AC_SUBST(ML_EXE)
9985 dnl ===================================================================
9986 dnl We need zip and unzip
9987 dnl ===================================================================
9988 AC_PATH_PROG(ZIP, zip)
9989 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9990 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9991     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],,)
9994 AC_PATH_PROG(UNZIP, unzip)
9995 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9997 dnl ===================================================================
9998 dnl Zip must be a specific type for different build types.
9999 dnl ===================================================================
10000 if test $build_os = cygwin; then
10001     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10002         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10003     fi
10006 dnl ===================================================================
10007 dnl Test which vclplugs have to be built.
10008 dnl ===================================================================
10009 R=""
10010 GTK3_CFLAGS=""
10011 GTK3_LIBS=""
10012 ENABLE_GTK3=""
10013 if test "x$enable_gtk3" = "xyes"; then
10014     if test "$with_system_cairo" = no; then
10015         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10016     fi
10017     : ${with_system_cairo:=yes}
10018     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="")
10019     if test "x$ENABLE_GTK3" = "xTRUE"; then
10020         R="gtk3"
10021     else
10022         AC_MSG_ERROR([gtk3 libraries of the correct versions, not found])
10023     fi
10024     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10026 AC_SUBST(GTK3_LIBS)
10027 AC_SUBST(GTK3_CFLAGS)
10028 AC_SUBST(ENABLE_GTK3)
10030 AC_MSG_CHECKING([which VCLplugs shall be built])
10031 if test "$GUIBASE" != "unx" -o "$enable_headless" = "yes"; then
10032     enable_gtk=no
10034 ENABLE_GTK=""
10035 if test "x$enable_gtk" = "xyes"; then
10036     if test "$with_system_cairo" = no; then
10037         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
10038     fi
10039     : ${with_system_cairo:=yes}
10040     ENABLE_GTK="TRUE"
10041     AC_DEFINE(ENABLE_GTK)
10042     R="gtk $R"
10044 AC_SUBST(ENABLE_GTK)
10046 ENABLE_TDE=""
10047 if test "x$enable_tde" = "xyes"; then
10048     # Libs kab and tdeab in connectivity and kdeab and tdeab in shell
10049     # are built from the same sources. So we only allow one of them.
10050     if test "x$enable_kde" = "xyes"; then
10051         AC_MSG_ERROR([enabling both KDE and TDE is not supported])
10052     fi
10053     ENABLE_TDE="TRUE"
10054     AC_DEFINE(ENABLE_TDE)
10055     R="$R tde"
10057 AC_SUBST(ENABLE_TDE)
10059 ENABLE_KDE=""
10060 if test "x$enable_kde" = "xyes"; then
10061     ENABLE_KDE="TRUE"
10062     AC_DEFINE(ENABLE_KDE)
10063     R="$R kde"
10065 AC_SUBST(ENABLE_KDE)
10067 ENABLE_KDE4=""
10068 if test "x$enable_kde4" = "xyes"; then
10069     ENABLE_KDE4="TRUE"
10070     AC_DEFINE(ENABLE_KDE4)
10071     R="$R kde4"
10073 AC_SUBST(ENABLE_KDE4)
10075 ENABLE_HEADLESS=""
10076 if test "x$enable_headless" = "xyes"; then
10077     ENABLE_HEADLESS="TRUE"
10078     SCPDEFS="$SCPDEFS -DLIBO_HEADLESS"
10079     R="headless"
10081 AC_SUBST(ENABLE_HEADLESS)
10083 if test -z "$R"; then
10084     AC_MSG_RESULT([none])
10085 else
10086     AC_MSG_RESULT([$R])
10089 dnl ===================================================================
10090 dnl GCONF check
10091 dnl ===================================================================
10093 ENABLE_GCONF=
10094 AC_MSG_CHECKING([whether to enable GConf support])
10095 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "iOS" -a "$enable_gconf" = "yes"; then
10096     ENABLE_GCONF="TRUE"
10097     AC_MSG_RESULT([yes])
10098     PKG_CHECK_MODULES( GCONF, gconf-2.0 gobject-2.0 )
10099     GCONF_CFLAGS=$(printf '%s' "$GCONF_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10100 else
10101     AC_MSG_RESULT([no])
10103 AC_SUBST(GCONF_LIBS)
10104 AC_SUBST(GCONF_CFLAGS)
10105 AC_SUBST(ENABLE_GCONF)
10107 dnl ===================================================================
10108 dnl Gnome VFS check
10109 dnl ===================================================================
10111 ENABLE_GNOMEVFS=""
10112 AC_MSG_CHECKING([whether to enable GNOME VFS support])
10113 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes" -a "$enable_gconf" = "yes"; then
10114     ENABLE_GNOMEVFS="TRUE"
10115     AC_MSG_RESULT([yes])
10116     PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
10117     GNOMEVFS_CFLAGS=$(printf '%s' "$GNOMEVFS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10118     AC_DEFINE(ENABLE_GNOME_VFS)
10119 else
10120     AC_MSG_RESULT([no])
10122 AC_SUBST(GNOMEVFS_LIBS)
10123 AC_SUBST(GNOMEVFS_CFLAGS)
10124 AC_SUBST(ENABLE_GNOMEVFS)
10126 dnl ===================================================================
10127 dnl check for dbus support
10128 dnl ===================================================================
10129 ENABLE_DBUS=""
10130 DBUS_CFLAGS=""
10131 DBUS_LIBS=""
10133 if test "$enable_dbus" = "no"; then
10134     test_dbus=no
10137 AC_MSG_CHECKING([whether to enable DBUS support])
10138 if test "$test_dbus" = "yes"; then
10139     ENABLE_DBUS="TRUE"
10140     AC_MSG_RESULT([yes])
10141     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
10142     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10143 else
10144     AC_MSG_RESULT([no])
10147 AC_SUBST(ENABLE_DBUS)
10148 AC_SUBST(DBUS_CFLAGS)
10149 AC_SUBST(DBUS_LIBS)
10151 AC_MSG_CHECKING([whether to enable font install via packagekit])
10152 if test "$ENABLE_DBUS" = "TRUE"; then
10153     if test -n "$enable_packagekit" -a "$enable_packagekit" != "no"; then
10154         ENABLE_PACKAGEKIT=TRUE
10155         AC_MSG_RESULT([yes])
10156     else
10157         ENABLE_PACKAGEKIT=
10158         AC_MSG_RESULT([no])
10159     fi
10160 else
10161     AC_MSG_RESULT([no, dbus disabled.])
10163 AC_SUBST(ENABLE_PACKAGEKIT)
10165 AC_MSG_CHECKING([whether to enable Impress remote control])
10166 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10167     AC_MSG_RESULT([yes])
10168     ENABLE_SDREMOTE=TRUE
10169     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10171     # If not explicitly enabled or disabled, default
10172     if test -z "$enable_sdremote_bluetooth"; then
10173         case "$OS" in
10174         LINUX|MACOSX|WNT)
10175             # Default to yes for these
10176             enable_sdremote_bluetooth=yes
10177             ;;
10178         *)
10179             # otherwise no
10180             enable_sdremote_bluetooth=no
10181             ;;
10182         esac
10183     fi
10184     # $enable_sdremote_bluetooth is guaranteed non-empty now
10186     if test "$enable_sdremote_bluetooth" != "no"; then
10187         if test "$OS" = "LINUX"; then
10188             if test "$ENABLE_DBUS" = "TRUE"; then
10189                 AC_MSG_RESULT([yes])
10190                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10191                 dnl ===================================================================
10192                 dnl Check for system bluez
10193                 dnl ===================================================================
10194                 AC_MSG_CHECKING([which Bluetooth header to use])
10195                 if test "$with_system_bluez" = "yes"; then
10196                     AC_MSG_RESULT([external])
10197                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10198                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10199                     SYSTEM_BLUEZ=YES
10200                 else
10201                     AC_MSG_RESULT([internal])
10202                     SYSTEM_BLUEZ=NO
10203                 fi
10204             else
10205                 AC_MSG_RESULT([no, dbus disabled])
10206                 ENABLE_SDREMOTE_BLUETOOTH=
10207                 SYSTEM_BLUEZ=NO
10208             fi
10209         else
10210             AC_MSG_RESULT([yes])
10211             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10212             SYSTEM_BLUEZ=NO
10213         fi
10214     else
10215         AC_MSG_RESULT([no])
10216         ENABLE_SDREMOTE_BLUETOOTH=
10217         SYSTEM_BLUEZ=NO
10218     fi
10219 else
10220     ENABLE_SDREMOTE=
10221     SYSTEM_BLUEZ=NO
10222     AC_MSG_RESULT([no])
10224 AC_SUBST(ENABLE_SDREMOTE)
10225 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10226 AC_SUBST(SYSTEM_BLUEZ)
10228 AC_MSG_CHECKING([whether to enable Impress remote control android app])
10229 if echo "$host_os" | grep -q linux-android || test "$enable_sdremote_android" = "yes"; then
10230     AC_MSG_RESULT([yes])
10231     ENABLE_SDREMOTE_ANDROID=TRUE
10232 else
10233     AC_MSG_RESULT([no])
10234     ENABLE_SDREMOTE_ANDROID=
10236 AC_SUBST(ENABLE_SDREMOTE_ANDROID)
10238 dnl ===================================================================
10239 dnl Check whether the gtk 2.0 libraries are available.
10240 dnl ===================================================================
10242 GTK_CFLAGS=""
10243 GTK_LIBS=""
10244 ENABLE_SYSTRAY_GTK=""
10245 if test  "$test_gtk" = "yes"; then
10247     if test "$ENABLE_GTK" = "TRUE"; then
10248         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]))
10249         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10250         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]))
10251         BUILD_TYPE="$BUILD_TYPE GTK"
10252         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10254     AC_MSG_CHECKING([whether to enable the systray quickstarter])
10255         if test "x$enable_systray" = "xyes"; then
10256             AC_MSG_RESULT([yes])
10257             PKG_CHECK_MODULES( GTK210, gtk+-2.0 >= 2.10.0,
10258                             [ ENABLE_SYSTRAY_GTK="TRUE" ],
10259                             [ ENABLE_SYSTRAY_GTK="" ])
10260         else
10261             AC_MSG_RESULT([no])
10262         fi
10264         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10265         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10266                           [ENABLE_GTK_PRINT="TRUE"],
10267                           [ENABLE_GTK_PRINT=""])
10268         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10270         AC_MSG_CHECKING([whether to enable GIO support])
10271         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10272             if test "$ENABLE_GNOMEVFS" = "TRUE"; then
10273                 AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
10274             fi
10275             dnl Need at least 2.26 for the dbus support.
10276             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10277                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10278             if test "$ENABLE_GIO" = "TRUE"; then
10279                 AC_DEFINE(ENABLE_GIO)
10280                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10281             fi
10282         else
10283             AC_MSG_RESULT([no])
10284         fi
10285     fi
10287 AC_SUBST(ENABLE_GIO)
10288 AC_SUBST(GIO_CFLAGS)
10289 AC_SUBST(GIO_LIBS)
10290 AC_SUBST(ENABLE_SYSTRAY_GTK)
10291 AC_SUBST(GTK_CFLAGS)
10292 AC_SUBST(GTK_LIBS)
10293 AC_SUBST(GTHREAD_CFLAGS)
10294 AC_SUBST(GTHREAD_LIBS)
10295 AC_SUBST([ENABLE_GTK_PRINT])
10296 AC_SUBST([GTK_PRINT_CFLAGS])
10297 AC_SUBST([GTK_PRINT_LIBS])
10300 dnl ===================================================================
10301 dnl Check whether the Telepathy libraries are available.
10302 dnl ===================================================================
10304 ENABLE_TELEPATHY=""
10305 TELEPATHY_CFLAGS=""
10306 TELEPATHY_LIBS=""
10308 AC_MSG_CHECKING([whether to enable Telepathy support])
10309 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_telepathy" = "yes"; then
10310     ENABLE_TELEPATHY="TRUE"
10311     AC_DEFINE(ENABLE_TELEPATHY)
10312     AC_MSG_RESULT([yes])
10313     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 )
10314     TELEPATHY_CFLAGS=$(printf '%s' "$TELEPATHY_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10315 else
10316     AC_MSG_RESULT([no])
10319 AC_SUBST(ENABLE_TELEPATHY)
10320 AC_SUBST(TELEPATHY_CFLAGS)
10321 AC_SUBST(TELEPATHY_LIBS)
10324 dnl ===================================================================
10326 SPLIT_APP_MODULES=""
10327 if test "$enable_split_app_modules" = "yes"; then
10328     SPLIT_APP_MODULES="YES"
10330 AC_SUBST(SPLIT_APP_MODULES)
10332 SPLIT_OPT_FEATURES=""
10333 if test "$enable_split_opt_features" = "yes"; then
10334     SPLIT_OPT_FEATURES="YES"
10336 AC_SUBST(SPLIT_OPT_FEATURES)
10338 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10339     if test "$enable_cairo_canvas" = yes; then
10340         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10341     fi
10342     enable_cairo_canvas=no
10343 elif test -z "$enable_cairo_canvas"; then
10344     enable_cairo_canvas=yes
10347 ENABLE_CAIRO_CANVAS=""
10348 if test "$enable_cairo_canvas" = "yes"; then
10349     test_cairo=yes
10350     ENABLE_CAIRO_CANVAS="TRUE"
10352 AC_SUBST(ENABLE_CAIRO_CANVAS)
10354 dnl ===================================================================
10355 dnl Check whether the GStreamer libraries are available.
10356 dnl ===================================================================
10358 ENABLE_GSTREAMER=""
10360 if test "$build_gstreamer" = "yes"; then
10362     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10363     if test "x$enable_gstreamer" != "xno"; then
10364         ENABLE_GSTREAMER="TRUE"
10365         AC_MSG_RESULT([yes])
10366         PKG_CHECK_MODULES( GSTREAMER, gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-video-1.0 )
10367         GSTREAMER_CFLAGS=$(printf '%s' "$GSTREAMER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10368     else
10369         AC_MSG_RESULT([no])
10370     fi
10372 AC_SUBST(GSTREAMER_CFLAGS)
10373 AC_SUBST(GSTREAMER_LIBS)
10374 AC_SUBST(ENABLE_GSTREAMER)
10377 ENABLE_GSTREAMER_0_10=""
10378 if test "$build_gstreamer_0_10" = "yes"; then
10380     AC_MSG_CHECKING([whether to enable the GStreamer avmedia backend])
10381     if test "x$enable_gstreamer_0_10" != "xno"; then
10382         ENABLE_GSTREAMER_0_10="TRUE"
10383         AC_MSG_RESULT([yes])
10384         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-interfaces-0.10],, [
10385             PKG_CHECK_MODULES(  [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10] )
10386         ])
10387         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10388     else
10389         AC_MSG_RESULT([no])
10390     fi
10393 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10394 AC_SUBST(GSTREAMER_0_10_LIBS)
10395 AC_SUBST(ENABLE_GSTREAMER_0_10)
10397 dnl ===================================================================
10398 dnl Check whether to build the VLC avmedia backend
10399 dnl ===================================================================
10401 ENABLE_VLC=""
10403 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10404 if test $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10405     ENABLE_VLC="TRUE"
10406     AC_MSG_RESULT([yes])
10407 else
10408     AC_MSG_RESULT([no])
10410 AC_SUBST(ENABLE_VLC)
10412 dnl ===================================================================
10413 dnl Check whether the OpenGL libraries are available
10414 dnl ===================================================================
10416 AC_MSG_CHECKING([whether to build the OpenGL Transitions component])
10417 ENABLE_OPENGL=
10419 if test -z "$enable_opengl"; then
10420     if test $_os = WINNT; then
10421         # By default disable the OpenGL transitions for Windows (the code compiles but works very
10422         # badly and crashes). In other words, use --enable-opengl only if you plan to hack on that
10423         # code for Windows.
10424         enable_opengl=no
10425     elif test $_os = iOS; then
10426         # As such with some suitable minor tweaks the Mac OpenGL transitions code would presumably
10427         # build fine for iOS, too, but let's leave that for later
10428         enable_opengl=no
10429     elif test "$enable_headless" = "yes"; then
10430         enable_opengl=no
10431     else
10432         enable_opengl=yes
10433     fi
10436 if test "x$enable_opengl" = "xno"; then
10437     AC_MSG_RESULT([no])
10438 elif test "$_os" = "Darwin"; then
10439     # We use frameworks on Mac OS X, no need for detail checks
10440     ENABLE_OPENGL=TRUE
10441     ENABLE_OPENGL_CANVAS=
10442     add_warning "openGL canvas not adapted for Mac yet - disabling"
10443     SYSTEM_MESA_HEADERS=YES
10444     AC_MSG_RESULT([yes])
10445 elif test $_os = WINNT; then
10446     # Experimental: try to use OpenGL on Windows
10447     ENABLE_OPENGL=TRUE
10448     ENABLE_OPENGL_CANVAS=TRUE
10449     # We need the internal "Mesa" headers.
10450     SYSTEM_MESA_HEADERS=NO
10451     BUILD_TYPE="$BUILD_TYPE MESA"
10452     AC_MSG_RESULT([yes])
10453 else
10454     save_LDFLAGS=$LDFLAGS
10455     LDFLAGS="$LDFLAGS -lm"
10456     AC_MSG_RESULT([yes])
10457     AC_CHECK_LIB([GL], [main],
10458         [AC_CHECK_LIB([GL], [glCreateShader], [ENABLE_OPENGL_CANVAS=TRUE],
10459             [add_warning "no shader support in libGL - will enable openGL transitions, but not openGL canvas"
10460              AC_MSG_WARN([no shader support in libGL - will enable openGL transitions, but not openGL canvas])
10461              ENABLE_OPENGL_CANVAS=], [])],
10462         [AC_MSG_ERROR(libGL not installed or functional)], [])
10463     LDFLAGS="$LDFLAGS -lGL"
10464     AC_CHECK_LIB([GLU], [main], [:],
10465               [AC_MSG_ERROR(libGLU not installed or functional)], [])
10466     ENABLE_OPENGL=TRUE
10467     LDFLAGS=$save_LDFLAGS
10469     dnl ===================================================================
10470     dnl Check for system Mesa
10471     dnl ===================================================================
10472     AC_MSG_CHECKING([which Mesa headers to use])
10473     if test "$with_system_mesa_headers" = "yes"; then
10474         AC_MSG_RESULT([external])
10475         SYSTEM_MESA_HEADERS=YES
10476         AC_LANG_PUSH(C)
10477         AC_CHECK_HEADER(GL/glxext.h, [],
10478            [ AC_MSG_ERROR(mesa headers not found.)], [#include <GL/glx.h>])
10479         AC_MSG_CHECKING([whether GL/glxext.h defines PFNGLXBINDTEXIMAGEEXTPROC])
10480         AC_EGREP_HEADER(PFNGLXBINDTEXIMAGEEXTPROC, GL/glxext.h, [AC_MSG_RESULT([yes])], AC_MSG_ERROR(no))
10481         AC_LANG_POP(C)
10482     else
10483         AC_MSG_RESULT([internal])
10484         SYSTEM_MESA_HEADERS=NO
10485         BUILD_TYPE="$BUILD_TYPE MESA"
10486     fi
10489 AC_SUBST(SYSTEM_MESA_HEADERS)
10490 AC_SUBST(ENABLE_OPENGL)
10491 AC_SUBST(ENABLE_OPENGL_CANVAS)
10493 dnl =================================================
10494 dnl Check whether to build with OpenCL support.
10495 dnl =================================================
10497 AC_MSG_CHECKING([whether to build with the OpenCL support.])
10498 ENABLE_OPENCL=
10500 if test $_os != iOS -a $_os != Android -a "x$enable_opencl" != "xno"; then
10501     AC_MSG_RESULT([yes])
10502     enable_opencl=yes
10503     ENABLE_OPENCL=TRUE
10504     AC_DEFINE(HAVE_FEATURE_OPENCL)
10505 else
10506     AC_MSG_RESULT([no])
10507     enable_opencl=no
10510 AC_SUBST(ENABLE_OPENCL)
10512 # pdf import?
10513 AC_MSG_CHECKING([whether to build the PDF import feature])
10514 ENABLE_PDFIMPORT=
10515 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10516     AC_MSG_RESULT([yes])
10517     ENABLE_PDFIMPORT=TRUE
10519     dnl ===================================================================
10520     dnl Check for system poppler
10521     dnl ===================================================================
10522     AC_MSG_CHECKING([which PDF import backend to use])
10523     if test "$with_system_poppler" = "yes"; then
10524         AC_MSG_RESULT([external])
10525         SYSTEM_POPPLER=YES
10526         PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
10527         AC_LANG_PUSH([C++])
10528         save_CXXFLAGS=$CXXFLAGS
10529         save_CPPFLAGS=$CPPFLAGS
10530         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10531         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10532         AC_CHECK_HEADER([cpp/poppler-version.h], [],
10533                    [AC_MSG_ERROR([cpp/poppler-version.h not found. Install poppler])], [])
10534         CXXFLAGS=$save_CXXFLAGS
10535         CPPFLAGS=$save_CPPFLAGS
10536         AC_LANG_POP([C++])
10537         libo_MINGW_CHECK_DLL([libpoppler])
10538         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10539     else
10540         AC_MSG_RESULT([internal])
10541         SYSTEM_POPPLER=NO
10542         BUILD_TYPE="$BUILD_TYPE POPPLER"
10543     fi
10544 else
10545     AC_MSG_RESULT([no])
10547 AC_SUBST(ENABLE_PDFIMPORT)
10548 AC_SUBST(SYSTEM_POPPLER)
10549 AC_SUBST(POPPLER_CFLAGS)
10550 AC_SUBST(POPPLER_LIBS)
10552 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10553 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10554     AC_MSG_RESULT([yes])
10555     ENABLE_MEDIAWIKI=TRUE
10556     BUILD_TYPE="$BUILD_TYPE XSLTML"
10557     if test  "x$with_java" = "xno"; then
10558         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10559     fi
10560 else
10561     AC_MSG_RESULT([no])
10562     ENABLE_MEDIAWIKI=
10563     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10565 AC_SUBST(ENABLE_MEDIAWIKI)
10567 AC_MSG_CHECKING([whether to build the Report Builder])
10568 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10569     AC_MSG_RESULT([yes])
10570     ENABLE_REPORTBUILDER=TRUE
10571     AC_MSG_CHECKING([which jfreereport libs to use])
10572     if test "$with_system_jfreereport" = "yes"; then
10573         SYSTEM_JFREEREPORT=YES
10574         AC_MSG_RESULT([external])
10575         if test -z $SAC_JAR; then
10576             SAC_JAR=/usr/share/java/sac.jar
10577         fi
10578         AC_CHECK_FILE($SAC_JAR, [],
10579              [AC_MSG_ERROR(sac.jar not found.)], [])
10581         if test -z $LIBXML_JAR; then
10582             AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
10583                 [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
10584                 [
10585                     AC_CHECK_FILE(/usr/share/java/libxml.jar,
10586                        [ LIBXML_JAR=/usr/share/java/libxml.jar ],
10587                        [AC_MSG_ERROR(libxml.jar replacement not found.)]
10588                     )
10589                 ]
10590             )
10591         else
10592             AC_CHECK_FILE($LIBXML_JAR, [],
10593                  [AC_MSG_ERROR(libxml.jar not found.)], [])
10594         fi
10596         if test -z $FLUTE_JAR; then
10597             AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
10598                 [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
10599                 [
10600                     AC_CHECK_FILE(/usr/share/java/flute.jar,
10601                         [ FLUTE_JAR=/usr/share/java/flute.jar ],
10602                         [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
10603                     )
10604                 ]
10605             )
10606         else
10607             AC_CHECK_FILE($FLUTE_JAR, [],
10608                  [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
10609         fi
10611         if test -z $JFREEREPORT_JAR; then
10612             AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
10613                 [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
10614                 [
10615                     AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
10616                         [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
10617                         [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
10618                     )
10619                 ]
10620             )
10621         else
10622             AC_CHECK_FILE($JFREEREPORT_JAR, [],
10623                  [AC_MSG_ERROR(jfreereport.jar not found.)], [])
10624         fi
10626         if test -z $LIBLAYOUT_JAR; then
10627             AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
10628                 [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
10629                 [
10630                     AC_CHECK_FILE(/usr/share/java/liblayout.jar,
10631                         [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
10632                         [AC_MSG_ERROR(liblayout.jar replacement not found.)]
10633                     )
10634                 ]
10635             )
10636         else
10637             AC_CHECK_FILE($LIBLAYOUT_JAR, [],
10638                  [AC_MSG_ERROR(liblayout.jar not found.)], [])
10639         fi
10641         if test -z $LIBLOADER_JAR; then
10642             AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
10643                 [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
10644                 [
10645                     AC_CHECK_FILE(/usr/share/java/libloader.jar,
10646                        [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
10647                        [AC_MSG_ERROR(libloader.jar replacement not found.)]
10648                     )
10649                 ]
10650             )
10651         else
10652             AC_CHECK_FILE($LIBLOADER_JAR, [],
10653                 [AC_MSG_ERROR(libloader.jar not found.)], [])
10654         fi
10656         if test -z $LIBFORMULA_JAR; then
10657             AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
10658                  [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
10659                  [
10660                      AC_CHECK_FILE(/usr/share/java/libformula.jar,
10661                          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
10662                          [AC_MSG_ERROR(libformula.jar replacement not found.)]
10663                      )
10664                  ]
10665             )
10666         else
10667             AC_CHECK_FILE($LIBFORMULA_JAR, [],
10668                 [AC_MSG_ERROR(libformula.jar not found.)], [])
10669         fi
10671         if test -z $LIBREPOSITORY_JAR; then
10672             AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
10673                 [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
10674                 [
10675                     AC_CHECK_FILE(/usr/share/java/librepository.jar,
10676                         [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
10677                         [AC_MSG_ERROR(librepository.jar replacement not found.)]
10678                     )
10679                 ]
10680             )
10681         else
10682             AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
10683                 [AC_MSG_ERROR(librepository.jar not found.)], [])
10684         fi
10686         if test -z $LIBFONTS_JAR; then
10687             AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
10688                 [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
10689                 [
10690                     AC_CHECK_FILE(/usr/share/java/libfonts.jar,
10691                         [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
10692                         [AC_MSG_ERROR(libfonts.jar replacement not found.)]
10693                     )
10694                 ]
10695             )
10696         else
10697             AC_CHECK_FILE($LIBFONTS_JAR, [],
10698                 [AC_MSG_ERROR(libfonts.jar not found.)], [])
10699         fi
10701         if test -z $LIBSERIALIZER_JAR; then
10702             AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
10703                 [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
10704                 [
10705                     AC_CHECK_FILE(/usr/share/java/libserializer.jar,
10706                         [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
10707                         [AC_MSG_ERROR(libserializer.jar replacement not found.)]
10708                     )
10709                 ]
10710             )
10711         else
10712             AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
10713                 [AC_MSG_ERROR(libserializer.jar not found.)], [])
10714         fi
10716         if test -z $LIBBASE_JAR; then
10717             AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
10718                 [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
10719                 [
10720                     AC_CHECK_FILE(/usr/share/java/libbase.jar,
10721                         [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
10722                         [AC_MSG_ERROR(libbase.jar replacement not found.)]
10723                     )
10724                 ]
10725             )
10726         else
10727             AC_CHECK_FILE($LIBBASE_JAR, [],
10728                 [AC_MSG_ERROR(libbase.jar not found.)], [])
10729         fi
10731     else
10732         AC_MSG_RESULT([internal])
10733         SYSTEM_JFREEREPORT=NO
10734         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10735     fi
10736 else
10737     AC_MSG_RESULT([no])
10738     ENABLE_REPORTBUILDER=
10739     SYSTEM_JFREEREPORT=NO
10741 AC_SUBST(ENABLE_REPORTBUILDER)
10742 AC_SUBST(SYSTEM_JFREEREPORT)
10743 AC_SUBST(SAC_JAR)
10744 AC_SUBST(LIBXML_JAR)
10745 AC_SUBST(FLUTE_JAR)
10746 AC_SUBST(JFREEREPORT_JAR)
10747 AC_SUBST(LIBBASE_JAR)
10748 AC_SUBST(LIBLAYOUT_JAR)
10749 AC_SUBST(LIBLOADER_JAR)
10750 AC_SUBST(LIBFORMULA_JAR)
10751 AC_SUBST(LIBREPOSITORY_JAR)
10752 AC_SUBST(LIBFONTS_JAR)
10753 AC_SUBST(LIBSERIALIZER_JAR)
10755 # this has to be here because both the Wiki Publisher and the SRB use
10756 # commons-logging
10757 if test "$ENABLE_MEDIAWIKI" = "TRUE" -o "$ENABLE_REPORTBUILDER" = "TRUE"; then
10758     AC_MSG_CHECKING([which Apache commons-* libs to use])
10759     if test "$with_system_apache_commons" = "yes"; then
10760         SYSTEM_APACHE_COMMONS=YES
10761         AC_MSG_RESULT([external])
10762         if test "$ENABLE_MEDIAWIKI" = "TRUE"; then
10763             if test -z $COMMONS_CODEC_JAR; then
10764                 AC_CHECK_FILE(/usr/share/java/commons-codec-1.6.jar,
10765                     [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec-1.6.jar ],
10766                     [
10767                         AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
10768                             [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
10769                             [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
10770                         )
10771                     ]
10772                 )
10773             else
10774                 AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
10775                     [AC_MSG_ERROR(commons-codec.jar not found.)], [])
10776             fi
10778             if test -z $COMMONS_LANG_JAR; then
10779                 AC_CHECK_FILE(/usr/share/java/commons-lang-2.4.jar,
10780                     [ COMMONS_LANG_JAR=/usr/share/java/commons-lang-2.4.jar ],
10781                     [
10782                         AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
10783                             [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
10784                             [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
10785                             )
10786                     ]
10787                 )
10788             else
10789                 AC_CHECK_FILE($COMMONS_LANG_JAR, [],
10790                     [AC_MSG_ERROR(commons-lang.jar not found.)], [])
10791             fi
10793             if test -z $COMMONS_HTTPCLIENT_JAR; then
10794                 AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
10795                     [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
10796                     [
10797                         AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
10798                             [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
10799                             [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
10800                         )
10801                     ]
10802                 )
10803             else
10804                 AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
10805                     [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
10806             fi
10807         fi
10808         if test "$ENABLE_MEDIAWIKI" = "TRUE" -o "$ENABLE_REPORTBUILDER" = "TRUE"; then
10809             if test -z $COMMONS_LOGGING_JAR; then
10810                 AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.1.jar,
10811                    [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.1.jar ],
10812                    [
10813                         AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
10814                             [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
10815                             [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
10816                         )
10817                     ]
10818                 )
10819             else
10820                 AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
10821                     [AC_MSG_ERROR(commons-logging.jar not found.)], [])
10822             fi
10823         fi
10824     else
10825         AC_MSG_RESULT([internal])
10826         SYSTEM_APACHE_COMMONS=NO
10827         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
10828     fi
10830 AC_SUBST(SYSTEM_APACHE_COMMONS)
10831 AC_SUBST(COMMONS_CODEC_JAR)
10832 AC_SUBST(COMMONS_LANG_JAR)
10833 AC_SUBST(COMMONS_HTTPCLIENT_JAR)
10834 AC_SUBST(COMMONS_LOGGING_JAR)
10836 # scripting provider for BeanShell?
10837 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10838 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10839     AC_MSG_RESULT([yes])
10840     ENABLE_SCRIPTING_BEANSHELL=TRUE
10842     dnl ===================================================================
10843     dnl Check for system beanshell
10844     dnl ===================================================================
10845     AC_MSG_CHECKING([which beanshell to use])
10846     if test "$with_system_beanshell" = "yes"; then
10847         AC_MSG_RESULT([external])
10848         SYSTEM_BSH=YES
10849         if test -z $BSH_JAR; then
10850             BSH_JAR=/usr/share/java/bsh.jar
10851         fi
10852         AC_CHECK_FILE($BSH_JAR, [],
10853                    [AC_MSG_ERROR(bsh.jar not found.)], [])
10854     else
10855         AC_MSG_RESULT([internal])
10856         SYSTEM_BSH=NO
10857         BUILD_TYPE="$BUILD_TYPE BSH"
10858     fi
10859 else
10860     AC_MSG_RESULT([no])
10861     ENABLE_SCRIPTING_BEANSHELL=
10862     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10864 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10865 AC_SUBST(SYSTEM_BSH)
10866 AC_SUBST(BSH_JAR)
10868 # scripting provider for JavaScript?
10869 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10870 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10871     AC_MSG_RESULT([yes])
10872     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10874     dnl ===================================================================
10875     dnl Check for system rhino
10876     dnl ===================================================================
10877     AC_MSG_CHECKING([which rhino to use])
10878     if test "$with_system_rhino" = "yes"; then
10879         AC_MSG_RESULT([external])
10880         SYSTEM_RHINO=YES
10881         if test -z $RHINO_JAR; then
10882             RHINO_JAR=/usr/share/java/js.jar
10883         fi
10884         AC_CHECK_FILE($RHINO_JAR, [],
10885                    [AC_MSG_ERROR(js.jar not found.)], [])
10886     else
10887         AC_MSG_RESULT([internal])
10888         SYSTEM_RHINO=NO
10889         BUILD_TYPE="$BUILD_TYPE RHINO"
10890     fi
10891 else
10892     AC_MSG_RESULT([no])
10893     ENABLE_SCRIPTING_JAVASCRIPT=
10894     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10896 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10897 AC_SUBST(SYSTEM_RHINO)
10898 AC_SUBST(RHINO_JAR)
10900 supports_multilib=
10901 case "$host_cpu" in
10902 x86_64 | powerpc64 | s390x)
10903     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10904         supports_multilib="yes"
10905     fi
10906     ;;
10908     ;;
10909 esac
10911 dnl ===================================================================
10912 dnl Check whether the TQt and TDE libraries are available.
10913 dnl ===================================================================
10915 TDE_CFLAGS=""
10916 TDE_LIBS=""
10917 if test "$_os" != "OpenBSD"; then
10918     MOC="moc"
10920 if test "$test_tde" = "yes" -a "$ENABLE_TDE" = "TRUE"; then
10921     dnl Search paths for TQt and TDE
10922     if test -z "$supports_multilib"; then
10923         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"
10924         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"
10925     else
10926         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"
10927         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"
10928     fi
10929     if test -n "$TQTDIR"; then
10930         tqt_incdirs="$TQTDIR/include $tqt_incdirs"
10931         if test -z "$supports_multilib"; then
10932             tqt_libdirs="$TQTDIR/lib $tqt_libdirs"
10933         else
10934             tqt_libdirs="$TQTDIR/lib64 $TQTDIR/lib $tqt_libdirs"
10935         fi
10936     fi
10937     if test -z "$supports_multilib"; then
10938         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"
10939         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"
10940     else
10941         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"
10942         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"
10943     fi
10944     if test -n "$TDEDIR"; then
10945         tde_incdirs="$TDEDIR/include $tde_incdirs"
10946         if test -z "$supports_multilib"; then
10947             tde_libdirs="$TDEDIR/lib $tde_libdirs"
10948         else
10949             tde_libdirs="$TDEDIR/lib64 $TDEDIR/lib $tde_libdirs"
10950         fi
10951     fi
10953     dnl What to test
10954     tqt_test_include="ntqstyle.h"
10955     tde_test_include="kapp.h"
10957     if test "$_os" != "OpenBSD"; then
10958         tqt_test_library="libtqt-mt.so"
10959         tde_test_library="libDCOP.so"
10960     else
10961         tqt_test_library="libtqt-mt.so*"
10962         tde_test_library="libDCOP.so*"
10963     fi
10965     dnl Check for TQt headers
10966     AC_MSG_CHECKING([for TQt headers])
10967     tqt_incdir="no"
10968     for tde_check in $tqt_incdirs; do
10969         if test -r "$tde_check/$tqt_test_include"; then
10970             tqt_incdir="$tde_check"
10971             break
10972         fi
10973     done
10974     AC_MSG_RESULT([$tqt_incdir])
10975     if test "x$tqt_incdir" = "xno"; then
10976         AC_MSG_ERROR([TQt headers not found.  Please specify the root of
10977 your TQt installation by exporting TQTDIR before running "configure".])
10978     fi
10980     dnl Check for TQt libraries
10981     AC_MSG_CHECKING([for TQt libraries])
10982     tqt_libdir="no"
10983     for tqt_check in $tqt_libdirs; do
10984         if test -r "`ls $tqt_check/$tqt_test_library 2>/dev/null | head -1`"; then
10985             tqt_libdir="$tqt_check"
10986             break
10987         fi
10988     done
10989     AC_MSG_RESULT([$tqt_libdir])
10990     if test "x$tqt_libdir" = "xno"; then
10991         AC_MSG_ERROR([TQt libraries not found.  Please specify the root of
10992 your TQt installation by exporting TQTDIR before running "configure".])
10993     fi
10995     dnl Check for Meta Object Compiler
10996     AC_PATH_PROG( MOC, moc, no, [`dirname $tqt_libdir`/bin:$TQTDIR/bin:$PATH] )
10997     if test "$MOC" = "no"; then
10998         AC_MSG_ERROR([TQt Meta Object Compiler not found.  Please specify
10999 the root of your TQt installation by exporting TQTDIR before running "configure".])
11000     fi
11002     dnl Check for TDE headers
11003     AC_MSG_CHECKING([for TDE headers])
11004     tde_incdir="no"
11005     for tde_check in $tde_incdirs; do
11006         if test -r "$tde_check/$tde_test_include"; then
11007             tde_incdir="$tde_check"
11008             break
11009         fi
11010     done
11011     AC_MSG_RESULT([$tde_incdir])
11012     if test "x$tde_incdir" = "xno"; then
11013         AC_MSG_ERROR([TDE headers not found.  Please specify the root of
11014 your TDE installation by exporting TDEDIR before running "configure".])
11015     fi
11017     dnl Check for TDE libraries
11018     AC_MSG_CHECKING([for TDE libraries])
11019     tde_libdir="no"
11020     for tde_check in $tde_libdirs; do
11021         if test -r "`ls $tde_check/$tde_test_library 2>/dev/null | head -1`"; then
11022             tde_libdir="$tde_check"
11023             break
11024         fi
11025     done
11026     AC_MSG_RESULT([$tde_libdir])
11027     if test "x$tde_libdir" = "xno"; then
11028         AC_MSG_ERROR([TDE libraries not found.  Please specify the root of
11029 your TDE installation by exporting TDEDIR before running "configure".])
11030     fi
11032     dnl Set the variables
11033     TDE_CFLAGS="-I$tqt_incdir -I$tde_incdir -I/usr/include/tqt -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11034     TDE_LIBS="-L$tde_libdir -L$tqt_libdir -ltdeio -ltdeui -ltdecore -ltqt -ltqt-mt"
11036 AC_SUBST(TDE_CFLAGS)
11037 AC_SUBST(TDE_LIBS)
11038 AC_SUBST(MOC)
11040 dnl ===================================================================
11041 dnl Check whether the Qt3 and KDE3 libraries are available.
11042 dnl ===================================================================
11044 KDE_CFLAGS=""
11045 KDE_LIBS=""
11046 if test "$_os" != "OpenBSD"; then
11047     MOC="moc"
11049 if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE"; then
11050     dnl Search paths for Qt3 and KDE3
11051     if test -z "$supports_multilib"; then
11052         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"
11053         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"
11054     else
11055         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"
11056         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"
11057     fi
11058     if test -n "$QTDIR"; then
11059         qt_incdirs="$QTDIR/include $qt_incdirs"
11060         if test -z "$supports_multilib"; then
11061             qt_libdirs="$QTDIR/lib $qt_libdirs"
11062         else
11063             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
11064         fi
11065     fi
11066     if test -z "$supports_multilib"; then
11067         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"
11068         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"
11069     else
11070         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"
11071         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"
11072     fi
11073     if test -n "$KDEDIR"; then
11074         kde_incdirs="$KDEDIR/include $kde_incdirs"
11075         if test -z "$supports_multilib"; then
11076             kde_libdirs="$KDEDIR/lib $kde_libdirs"
11077         else
11078             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
11079         fi
11080     fi
11082     dnl What to test
11083     qt_test_include="qstyle.h"
11084     kde_test_include="kapp.h"
11086     if test "$_os" != "OpenBSD"; then
11087         qt_test_library="libqt-mt.so"
11088         kde_test_library="libDCOP.so"
11089     else
11090         qt_test_library="libqt-mt.so*"
11091         kde_test_library="libDCOP.so*"
11092     fi
11094     dnl Check for Qt3 headers
11095     AC_MSG_CHECKING([for Qt3 headers])
11096     qt_incdir="no"
11097     for kde_check in $qt_incdirs; do
11098         if test -r "$kde_check/$qt_test_include"; then
11099             qt_incdir="$kde_check"
11100             break
11101         fi
11102     done
11103     AC_MSG_RESULT([$qt_incdir])
11104     if test "x$qt_incdir" = "xno"; then
11105         AC_MSG_ERROR([Qt3 headers not found.  Please specify the root of
11106 your Qt3 installation by exporting QTDIR before running "configure".])
11107     fi
11109     dnl Check for Qt3 libraries
11110     AC_MSG_CHECKING([for Qt3 libraries])
11111     qt_libdir="no"
11112     for qt_check in $qt_libdirs; do
11113         if test -r "`ls $qt_check/$qt_test_library 2>/dev/null | head -1`"; then
11114             qt_libdir="$qt_check"
11115             break
11116         fi
11117     done
11118     AC_MSG_RESULT([$qt_libdir])
11119     if test "x$qt_libdir" = "xno"; then
11120         AC_MSG_ERROR([Qt3 libraries not found.  Please specify the root of
11121 your Qt3 installation by exporting QTDIR before running "configure".])
11122     fi
11124     dnl Check for Meta Object Compiler
11125     AC_PATH_PROG( MOC, moc, no, [`dirname $qt_libdir`/bin:$QTDIR/bin:$PATH] )
11126     if test "$MOC" = "no"; then
11127         AC_MSG_ERROR([Qt3 Meta Object Compiler not found.  Please specify
11128 the root of your Qt3 installation by exporting QTDIR before running "configure".])
11129     fi
11131     dnl Check for KDE3 headers
11132     AC_MSG_CHECKING([for KDE3 headers])
11133     kde_incdir="no"
11134     for kde_check in $kde_incdirs; do
11135         if test -r "$kde_check/$kde_test_include"; then
11136             kde_incdir="$kde_check"
11137             break
11138         fi
11139     done
11140     AC_MSG_RESULT([$kde_incdir])
11141     if test "x$kde_incdir" = "xno"; then
11142         AC_MSG_ERROR([KDE3 headers not found.  Please specify the root of
11143 your KDE3 installation by exporting KDEDIR before running "configure".])
11144     fi
11146     dnl Check for KDE3 libraries
11147     AC_MSG_CHECKING([for KDE3 libraries])
11148     kde_libdir="no"
11149     for kde_check in $kde_libdirs; do
11150         if test -r "`ls $kde_check/$kde_test_library 2>/dev/null | head -1`"; then
11151             kde_libdir="$kde_check"
11152             break
11153         fi
11154     done
11155     AC_MSG_RESULT([$kde_libdir])
11156     if test "x$kde_libdir" = "xno"; then
11157         AC_MSG_ERROR([KDE3 libraries not found.  Please specify the root of
11158 your KDE3 installation by exporting KDEDIR before running "configure".])
11159     fi
11161     dnl Set the variables
11162     KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11163     KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
11164     KDE_CFLAGS=$(printf '%s' "$KDE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11166 AC_SUBST(KDE_CFLAGS)
11167 AC_SUBST(KDE_LIBS)
11168 AC_SUBST(MOC)
11170 dnl ===================================================================
11171 dnl KDE4 Integration
11172 dnl ===================================================================
11174 KDE4_CFLAGS=""
11175 KDE4_LIBS=""
11176 QMAKE4="qmake"
11177 MOC4="moc"
11178 KDE_GLIB_CFLAGS=""
11179 KDE_GLIB_LIBS=""
11180 KDE_HAVE_GLIB=""
11181 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
11182     qt_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
11183     qt_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
11185     kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
11186     kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
11188     if test -n "$supports_multilib"; then
11189         qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
11190         kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
11191     fi
11193     if test -n "$QTDIR"; then
11194         qt_incdirs="$QTDIR/include $qt_incdirs"
11195         if test -z "$supports_multilib"; then
11196             qt_libdirs="$QTDIR/lib $qt_libdirs"
11197         else
11198             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
11199         fi
11200     fi
11201     if test -n "$QT4DIR"; then
11202         qt_incdirs="$QT4DIR/include $qt_incdirs"
11203         if test -z "$supports_multilib"; then
11204             qt_libdirs="$QT4DIR/lib $qt_libdirs"
11205         else
11206             qt_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt_libdirs"
11207         fi
11208     fi
11210     if test -n "$KDEDIR"; then
11211         kde_incdirs="$KDEDIR/include $kde_incdirs"
11212         if test -z "$supports_multilib"; then
11213             kde_libdirs="$KDEDIR/lib $kde_libdirs"
11214         else
11215             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
11216         fi
11217     fi
11218     if test -n "$KDE4DIR"; then
11219         kde_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde_incdirs"
11220         if test -z "$supports_multilib"; then
11221             kde_libdirs="$KDE4DIR/lib $kde_libdirs"
11222         else
11223             kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
11224         fi
11225     fi
11227     qt_test_include="Qt/qobject.h"
11228     qt_test_library="libQtNetwork.so"
11229     kde_test_include="kwindowsystem.h"
11230     kde_test_library="libsolid.so"
11232     AC_MSG_CHECKING([for Qt4 headers])
11233     qt_header_dir="no"
11234     for inc_dir in $qt_incdirs; do
11235         if test -r "$inc_dir/$qt_test_include"; then
11236             qt_header_dir="$inc_dir"
11237             break
11238         fi
11239     done
11241     AC_MSG_RESULT([$qt_header_dir])
11242     if test "x$qt_header_dir" = "xno"; then
11243         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11244     fi
11246     dnl Check for qmake
11247     AC_PATH_PROG( QMAKEQT4, qmake-qt4, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
11248     QMAKE4="$QMAKEQT4"
11249     if test "$QMAKE4" = "no"; then
11250         AC_PATH_PROG( QMAKE4, qmake, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
11251         if test "$QMAKE4" = "no"; then
11252             AC_MSG_ERROR([Qmake not found.  Please specify
11253 the root of your Qt installation by exporting QT4DIR before running "configure".])
11254         fi
11255     fi
11257     qt_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt_libdirs"
11258     AC_MSG_CHECKING([for Qt4 libraries])
11259     qt_lib_dir="no"
11260     for lib_dir in $qt_libdirs; do
11261         if test -r "$lib_dir/$qt_test_library"; then
11262             qt_lib_dir="$lib_dir"
11263             PKG_CONFIG_PATH="$qt_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
11264             break
11265         fi
11266     done
11268     AC_MSG_RESULT([$qt_lib_dir])
11270     if test "x$qt_lib_dir" = "xno"; then
11271         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11272     fi
11274     dnl Check for Meta Object Compiler
11276     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11277     MOC4="$MOCQT4"
11278     if test "$MOC4" = "no"; then
11279         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11280         if test "$MOC4" = "no"; then
11281             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11282 the root of your Qt installation by exporting QT4DIR before running "configure".])
11283         fi
11284     fi
11286     dnl Check for KDE4 headers
11287     AC_MSG_CHECKING([for KDE4 headers])
11288     kde_incdir="no"
11289     for kde_check in $kde_incdirs; do
11290         if test -r "$kde_check/$kde_test_include"; then
11291             kde_incdir="$kde_check"
11292             break
11293         fi
11294     done
11295     AC_MSG_RESULT([$kde_incdir])
11296     if test "x$kde_incdir" = "xno"; then
11297         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11298     fi
11300     dnl Check for KDE4 libraries
11301     AC_MSG_CHECKING([for KDE4 libraries])
11302     kde_libdir="no"
11303     for kde_check in $kde_libdirs; do
11304         if test -r "$kde_check/$kde_test_library"; then
11305             kde_libdir="$kde_check"
11306             break
11307         fi
11308     done
11310     AC_MSG_RESULT([$kde_libdir])
11311     if test "x$kde_libdir" = "xno"; then
11312         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11313     fi
11315     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
11316     KDE4_CFLAGS="-I$kde_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11317     KDE4_LIBS="-L$kde_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt_lib_dir $QT4_LIBS"
11318     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11320     AC_LANG_PUSH([C++])
11321     save_CXXFLAGS=$CXXFLAGS
11322     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11323     AC_MSG_CHECKING([whether KDE is >= 4.2])
11324        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11325 #include <kdeversion.h>
11327 int main(int argc, char **argv) {
11328        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
11329        else return 1;
11331        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11332     CXXFLAGS=$save_CXXFLAGS
11333     AC_LANG_POP([C++])
11335     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11336     # Sets also KDE_GLIB_CFLAGS/KDE_GLIB_LIBS if successful.
11337     PKG_CHECK_MODULES(KDE_GLIB,[glib-2.0 >= 2.4],
11338         [
11339             KDE_HAVE_GLIB=1
11340             AC_DEFINE(KDE_HAVE_GLIB,1)
11341             KDE_GLIB_CFLAGS=$(printf '%s' "$KDE_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11343             qt4_fix_warning=
11345             AC_LANG_PUSH([C++])
11346             save_CXXFLAGS=$CXXFLAGS
11347             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11348             save_LIBS=$LIBS
11349             LIBS="$LIBS $KDE4_LIBS"
11350             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
11352             # Prepare meta object data
11353             TSTBASE="tst_exclude_socket_notifiers"
11354             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11355             ln -fs "${TSTMOC}.hxx"
11356             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11358             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11359 #include "tst_exclude_socket_notifiers.moc"
11361 int main(int argc, char *argv[])
11363     QCoreApplication app(argc, argv);
11364     exit(tst_processEventsExcludeSocket());
11365     return 0;
11367             ]])],[
11368                 AC_MSG_RESULT([yes])
11369             ],[
11370                 AC_MSG_RESULT([no])
11371                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11372                 if test -z "$qt4_fix_warning"; then
11373                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11374                 fi
11375                 qt4_fix_warning=1
11376                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-37380 (needed)"
11377             ])
11379             # Remove meta object data
11380             rm -f "${TSTBASE}."*
11382             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
11384             # Prepare meta object data
11385             TSTBASE="tst_exclude_posted_events"
11386             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11387             ln -fs "${TSTMOC}.hxx"
11388             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11390             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11391 #include "tst_exclude_posted_events.moc"
11393 int main(int argc, char *argv[])
11395     QCoreApplication app(argc, argv);
11396     exit(tst_excludePostedEvents());
11397     return 0;
11399             ]])],[
11400                 AC_MSG_RESULT([yes])
11401             ],[
11402                 AC_MSG_RESULT([no])
11403                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11404                 if test -z "$qt4_fix_warning"; then
11405                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11406                 fi
11407                 qt4_fix_warning=1
11408                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-34614 (needed)"
11409             ])
11411             # Remove meta object data
11412             rm -f "${TSTBASE}."*
11414             if test -n "$qt4_fix_warning"; then
11415                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-38585 (recommended)"
11416             fi
11418             LIBS=$save_LIBS
11419             CXXFLAGS=$save_CXXFLAGS
11420             AC_LANG_POP([C++])
11421         ],
11422         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11424 AC_SUBST(KDE4_CFLAGS)
11425 AC_SUBST(KDE4_LIBS)
11426 AC_SUBST(MOC4)
11427 AC_SUBST(KDE_GLIB_CFLAGS)
11428 AC_SUBST(KDE_GLIB_LIBS)
11429 AC_SUBST(KDE_HAVE_GLIB)
11431 dnl ===================================================================
11432 dnl Test for the enabling the lockdown pieces
11433 dnl ===================================================================
11434 AC_MSG_CHECKING([whether to enable the lockdown pieces])
11435 ENABLE_LOCKDOWN=
11436 if test -n "$enable_lockdown" -a "$enable_lockdown" != "no"; then
11437     ENABLE_LOCKDOWN=TRUE
11438     AC_MSG_RESULT([yes])
11439 else
11440     AC_MSG_RESULT([no])
11442 AC_SUBST(ENABLE_LOCKDOWN)
11444 dnl ===================================================================
11445 dnl Test whether to include Evolution 2 support
11446 dnl ===================================================================
11447 AC_MSG_CHECKING([whether to enable evolution 2 support])
11448 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11449     AC_MSG_RESULT([yes])
11450     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11451     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11452     ENABLE_EVOAB2="TRUE"
11453 else
11454     ENABLE_EVOAB2=""
11455     AC_MSG_RESULT([no])
11457 AC_SUBST(ENABLE_EVOAB2)
11458 AC_SUBST(GOBJECT_CFLAGS)
11459 AC_SUBST(GOBJECT_LIBS)
11461 dnl ===================================================================
11462 dnl Test whether to include TDE AB support
11463 dnl ===================================================================
11464 AC_MSG_CHECKING([whether to enable TDE address book support])
11465 if test "$enable_tdeab" = "yes" -a "$enable_tde" = "yes"; then
11466     AC_MSG_RESULT([yes])
11467     AC_LANG_PUSH([C++])
11468     save_CXXFLAGS=$CXXFLAGS
11469     CXXFLAGS="$CXXFLAGS $TDE_CFLAGS"
11470     AC_MSG_CHECKING([whether TDE is at least R14.0])
11471        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11472 #include <tdeversion.h>
11474 int main(int argc, char **argv) {
11475        if (TDE_VERSION_MAJOR >= 14) return 0;
11476        else return 1;
11478        ]])],[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])],[])
11479     CXXFLAGS=$save_CXXFLAGS
11480     AC_LANG_POP([C++])
11481     ENABLE_TDEAB=TRUE
11482 else
11483     AC_MSG_RESULT([no])
11484     ENABLE_TDEAB=
11486 AC_SUBST(ENABLE_TDEAB)
11488 dnl ===================================================================
11489 dnl Test whether to include KDE AB support
11490 dnl ===================================================================
11491 AC_MSG_CHECKING([whether to enable KDE address book support])
11492 if test "$enable_kdeab" = "yes" -a "$enable_kde" = "yes"; then
11493     AC_MSG_RESULT([yes])
11494     AC_LANG_PUSH([C++])
11495     save_CXXFLAGS=$CXXFLAGS
11496     CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
11497     AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
11498        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11499 #include <kdeversion.h>
11501 int main(int argc, char **argv) {
11502        if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
11503        else return 1;
11505        ]])],[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])],[])
11506     CXXFLAGS=$save_CXXFLAGS
11507     AC_LANG_POP([C++])
11508     ENABLE_KAB=TRUE
11509 else
11510     AC_MSG_RESULT([no])
11511     ENABLE_KAB=
11513 AC_SUBST(ENABLE_KAB)
11515 dnl ===================================================================
11516 dnl Test which themes to include
11517 dnl ===================================================================
11518 AC_MSG_CHECKING([which themes to include])
11519 # if none given use default subset of available themes
11520 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11521     with_theme="crystal default hicontrast oxygen tango sifr"
11522     test -z "$ENABLE_RELEASE_BUILD" && with_theme="$with_theme tango_testing"
11525 WITH_THEMES=""
11526 if test "x$with_theme" != "xno"; then
11527     for theme in $with_theme; do
11528         case $theme in
11529         crystal|default|galaxy|hicontrast|human|industrial|oxygen|sifr|tango|tango_testing) : ;;
11530         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11531         esac
11532         WITH_THEMES="$WITH_THEMES $theme"
11533     done
11535 AC_MSG_RESULT([$WITH_THEMES])
11536 AC_SUBST([WITH_THEMES])
11538 dnl ===================================================================
11539 dnl Test whether to integrate helppacks into the product's installer
11540 dnl ===================================================================
11541 AC_MSG_CHECKING([for helppack integration])
11542 if test "$with_helppack_integration" = "no"; then
11543     WITH_HELPPACK_INTEGRATION=NO
11544     AC_MSG_RESULT([no integration])
11545 else
11546     WITH_HELPPACK_INTEGRATION=YES
11547     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11548     AC_MSG_RESULT([integration])
11550 AC_SUBST(WITH_HELPPACK_INTEGRATION)
11552 dnl ===================================================================
11553 dnl Test whether to use CoreText framework
11554 dnl ===================================================================
11555 ENABLE_CORETEXT=
11556 if test "$_os" = "Darwin"; then
11557     AC_MSG_CHECKING([whether to use CoreText framework])
11558     if test "$enable_coretext" != no -o "$BITNESS_OVERRIDE" = 64; then
11559         AC_MSG_RESULT([yes])
11560         ENABLE_CORETEXT=TRUE
11561     else
11562         AC_MSG_RESULT([no])
11563     fi
11565 AC_SUBST(ENABLE_CORETEXT)
11567 ###############################################################################
11568 # Extensions checking
11569 ###############################################################################
11570 AC_MSG_CHECKING([for extensions integration])
11571 if test "x$enable_extension_integration" != "xno"; then
11572     WITH_EXTENSION_INTEGRATION=YES
11573     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11574     AC_MSG_RESULT([yes, use integration])
11575 else
11576     WITH_EXTENSION_INTEGRATION=NO
11577     AC_MSG_RESULT([no, do not integrate])
11579 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11581 dnl Should any extra extensions be included?
11582 dnl There are standalone tests for each of these below.
11583 WITH_EXTRA_EXTENSIONS=
11584 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11586 libo_CHECK_EXTENSION([Watch Window],[WATCH_WINDOW],[watch_window],[watch-window],[23bd75552206dfcd8fd4e29137dcac84-WatchWindow_1.2.0.0.oxt])
11587 libo_CHECK_EXTENSION([SmART Gallery (Diagram)],[DIAGRAM],[diagram],[diagram],[8d74685d41f8bffe8c3e71fe8deac09d-SmART_0.9.5.oxt])
11588 libo_CHECK_EXTENSION([Validator],[VALIDATOR],[validator],[validator],[bbdd5639ada63e3130761daaecae1a10-Validator_1.1.0.0.oxt])
11589 libo_CHECK_EXTENSION([Barcode],[BARCODE],[barcode],[barcode],[3ed18025a766f1e955707b969c8113a5-Barcode_1.3.5.0.oxt])
11590 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11591 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11592 libo_CHECK_EXTENSION([Hungarian Cross-reference Toolbar],[HUNART],[hunart],[hunart],[b632bdd25649cc4067bcb410bae23d2b-hunart_0.3.oxt])
11593 libo_CHECK_EXTENSION([Typography Toolbar],[TYPO],[typo],[typo],[9d60b6cfa3ef1926848710bbcd11115b-typo_0.4.2.oxt])
11594 libo_CHECK_EXTENSION([Google Docs],[GOOGLE_DOCS],[google_docs],[google-docs],[27211596cf0ad97cab7321239406fde0-gdocs_3.0.1_modified.oxt])
11595 if test "x$with_java" != "xno"; then
11596     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11597     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11600 dnl ===================================================================
11601 dnl Test whether to include Sun Professional Template Pack
11602 dnl ===================================================================
11603 AC_MSG_CHECKING([for Sun Professional Template Pack integration (only supported languages displayed)])
11604 if test "$with_sun_templates" = "" -o "$with_sun_templates" = "no"; then
11605     AC_MSG_RESULT([no integration])
11606 else
11607     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_SUN_TEMPLATE_PACK"
11608     sun_supported_langs="en-US de it fr es hu"
11609     if test "$with_sun_templates" = "yes"; then
11610         wanted_sun_templates="$sun_supported_langs"
11611     else
11612         # check whether the langs are supported by Sun
11613         wanted_sun_templates=
11614         for lang in $with_sun_templates; do
11615             if test -n "`echo $sun_supported_langs | grep "$lang"`"; then
11616                 wanted_sun_templates="$wanted_sun_templates $lang"
11617             fi
11618         done
11619     fi
11620     SUNTEMPLATES_LANG=
11621     SUNTEMPLATES_DE_PACK=
11622     SUNTEMPLATES_EN_US_PACK=
11623     SUNTEMPLATES_ES_PACK=
11624     SUNTEMPLATES_FR_PACK=
11625     SUNTEMPLATES_HU_PACK=
11626     SUNTEMPLATES_IT_PACK=
11627     # check whether the langs are requested at all
11628     for lang in $wanted_sun_templates; do
11629     if test "$with_lang" = "ALL" -o -n "`echo $with_lang | grep "$lang"`"; then
11630         SUNTEMPLATES_LANG="$SUNTEMPLATES_LANG $lang"
11631         case $lang in
11632         "de") SUNTEMPLATES_DE_PACK="53ca5e56ccd4cab3693ad32c6bd13343-Sun-ODF-Template-Pack-de_1.0.0.oxt";;
11633         "en-US") SUNTEMPLATES_EN_US_PACK="472ffb92d82cf502be039203c606643d-Sun-ODF-Template-Pack-en-US_1.0.0.oxt";;
11634         "es") SUNTEMPLATES_ES_PACK="4ad003e7bbda5715f5f38fde1f707af2-Sun-ODF-Template-Pack-es_1.0.0.oxt";;
11635         "fr") SUNTEMPLATES_FR_PACK="a53080dc876edcddb26eb4c3c7537469-Sun-ODF-Template-Pack-fr_1.0.0.oxt";;
11636         "hu") SUNTEMPLATES_HU_PACK="09ec2dac030e1dcd5ef7fa1692691dc0-Sun-ODF-Template-Pack-hu_1.0.0.oxt";;
11637         "it") SUNTEMPLATES_IT_PACK="b33775feda3bcf823cad7ac361fd49a6-Sun-ODF-Template-Pack-it_1.0.0.oxt";;
11638         esac
11639     fi
11640     done
11641     WITH_EXTRA_EXTENSIONS=YES
11642     AC_MSG_RESULT([$SUNTEMPLATES_LANG])
11644 AC_SUBST(SUNTEMPLATES_DE_PACK)
11645 AC_SUBST(SUNTEMPLATES_EN_US_PACK)
11646 AC_SUBST(SUNTEMPLATES_ES_PACK)
11647 AC_SUBST(SUNTEMPLATES_FR_PACK)
11648 AC_SUBST(SUNTEMPLATES_HU_PACK)
11649 AC_SUBST(SUNTEMPLATES_IT_PACK)
11651 dnl ===================================================================
11652 dnl Test whether to include fonts
11653 dnl ===================================================================
11654 AC_MSG_CHECKING([whether to include third-party fonts])
11655 if test "$with_fonts" != "no"; then
11656     AC_MSG_RESULT([yes])
11657     WITH_FONTS=YES
11658     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11659 else
11660     AC_MSG_RESULT([no])
11661     WITH_FONTS=NO
11662     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11664 AC_SUBST(WITH_FONTS)
11666 dnl ===================================================================
11667 dnl Test whether to include ppds
11668 dnl ===================================================================
11669 AC_MSG_CHECKING([whether to include PPDs])
11670 if test "$with_ppds" != "no"; then
11671     AC_MSG_RESULT([yes])
11672 else
11673     AC_MSG_RESULT([no])
11674     WITHOUT_PPDS=YES
11675     SCPDEFS="$SCPDEFS -DWITHOUT_PPDS"
11677 AC_SUBST(WITHOUT_PPDS)
11679 dnl ===================================================================
11680 dnl Test whether to include afms
11681 dnl ===================================================================
11682 AC_MSG_CHECKING([whether to include AFMs])
11683 if test "$with_afms" != "no"; then
11684     AC_MSG_RESULT([yes])
11685     BUILD_TYPE="$BUILD_TYPE AFMS"
11686 else
11687     AC_MSG_RESULT([no])
11688     WITHOUT_AFMS=YES
11689     SCPDEFS="$SCPDEFS -DWITHOUT_AFMS"
11691 AC_SUBST(WITHOUT_AFMS)
11693 dnl ===================================================================
11694 dnl Test whether to include extra galleries
11695 dnl ===================================================================
11696 AC_MSG_CHECKING([whether to include extra galleries])
11697 if test "$enable_extra_gallery" = "" -o "$enable_extra_gallery" = "no"; then
11698     AC_MSG_RESULT([no])
11699     WITH_EXTRA_GALLERY=NO
11700     OOOP_GALLERY_PACK=""
11701 else
11702     AC_MSG_RESULT([yes])
11703     WITH_EXTRA_GALLERY=YES
11704     BUILD_TYPE="$BUILD_TYPE EXTRA_GALLERY"
11705     SCPDEFS="$SCPDEFS -DWITH_EXTRA_GALLERY"
11706     OOOP_GALLERY_PACK="af9314c5972d95a5d6da23ffad818f68-OOOP-gallery-pack-2.8.0.0.zip"
11708 AC_SUBST(WITH_EXTRA_GALLERY)
11709 AC_SUBST(OOOP_GALLERY_PACK)
11711 dnl ===================================================================
11712 dnl Test whether to include extra templates
11713 dnl ===================================================================
11714 AC_MSG_CHECKING([whether to include extra templates])
11715 if test "$enable_extra_template" = "" -o "$enable_extra_template" = "no"; then
11716     AC_MSG_RESULT([no])
11717     WITH_EXTRA_TEMPLATE=NO
11718     OOOP_TEMPLATES_PACK=""
11719 else
11720     AC_MSG_RESULT([yes])
11721     WITH_EXTRA_TEMPLATE=YES
11722     BUILD_TYPE="$BUILD_TYPE EXTRA_TEMPLATE"
11723     SCPDEFS="$SCPDEFS -DWITH_EXTRA_TEMPLATE"
11724     OOOP_TEMPLATES_PACK="1be202fbbbc13f10592a98f70a4a87fb-OOOP-templates-pack-2.9.0.0.zip"
11726 AC_SUBST(WITH_EXTRA_TEMPLATE)
11727 AC_SUBST(OOOP_TEMPLATES_PACK)
11729 dnl ===================================================================
11730 dnl Test whether to include extra samples
11731 dnl ===================================================================
11732 AC_MSG_CHECKING([whether to include extra samples])
11733 if test "$enable_extra_sample" = "" -o "$enable_extra_sample" = "no"; then
11734     AC_MSG_RESULT([no])
11735     WITH_EXTRA_SAMPLE=NO
11736     OOOP_SAMPLES_PACK=""
11737 else
11738     AC_MSG_RESULT([yes])
11739     WITH_EXTRA_SAMPLE=YES
11740     BUILD_TYPE="$BUILD_TYPE EXTRA_SAMPLE"
11741     SCPDEFS="$SCPDEFS -DWITH_EXTRA_SAMPLE"
11742     OOOP_SAMPLES_PACK="a6bccacf44914969e6e7b2f8faf4132c-OOOP-samples-pack-2.7.0.0.zip"
11744 AC_SUBST(WITH_EXTRA_SAMPLE)
11745 AC_SUBST(OOOP_SAMPLES_PACK)
11747 dnl ===================================================================
11748 dnl Test whether to include extra fonts
11749 dnl ===================================================================
11750 AC_MSG_CHECKING([whether to include extra fonts])
11751 if test "$enable_extra_font" = "" -o "$enable_extra_font" = "no"; then
11752     AC_MSG_RESULT([no])
11753     WITH_EXTRA_FONT=NO
11754     OOOP_FONTS_PACK=""
11755 else
11756     AC_MSG_RESULT([yes])
11757     WITH_EXTRA_FONT=YES
11758     BUILD_TYPE="$BUILD_TYPE EXTRA_FONT"
11759     SCPDEFS="$SCPDEFS -DWITH_EXTRA_FONT"
11760     OOOP_FONTS_PACK="a10aa597411643326e27d7fc128af12d-OOOP-fonts-pack-2.9.0.0.zip"
11762 AC_SUBST(WITH_EXTRA_FONT)
11763 AC_SUBST(OOOP_FONTS_PACK)
11765 dnl ===================================================================
11766 dnl Test whether to enable online update service
11767 dnl ===================================================================
11768 AC_MSG_CHECKING([whether to enable online update])
11769 ENABLE_ONLINE_UPDATE=
11770 if test "$enable_online_update" = ""; then
11771     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11772         AC_MSG_RESULT([yes])
11773         ENABLE_ONLINE_UPDATE="TRUE"
11774     else
11775         AC_MSG_RESULT([no])
11776     fi
11777 else
11778     if test "$enable_online_update" = "yes"; then
11779         AC_MSG_RESULT([yes])
11780         ENABLE_ONLINE_UPDATE="TRUE"
11781     else
11782         AC_MSG_RESULT([no])
11783     fi
11785 AC_SUBST(ENABLE_ONLINE_UPDATE)
11787 dnl ===================================================================
11788 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11789 dnl ===================================================================
11790 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11791 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11792     AC_MSG_RESULT([no])
11793     ENABLE_SILENT_MSI=
11794 else
11795     AC_MSG_RESULT([yes])
11796     ENABLE_SILENT_MSI=TRUE
11797     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11799 AC_SUBST(ENABLE_SILENT_MSI)
11801 AC_MSG_CHECKING([whether and how to use Xinerama])
11802 if test "$_os" = "Darwin"; then
11803     USE_XINERAMA=YES
11804     XINERAMA_LINK=dynamic
11805     AC_MSG_RESULT([yes])
11806 elif test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11807     if test "$x_libraries" = "default_x_libraries"; then
11808         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11809         if test "x$XINERAMALIB" = x; then
11810            XINERAMALIB="/usr/lib"
11811         fi
11812     else
11813         XINERAMALIB="$x_libraries"
11814     fi
11815     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11816         # we have both versions, let the user decide but use the dynamic one
11817         # per default
11818         USE_XINERAMA=YES
11819         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11820             XINERAMA_LINK=dynamic
11821         else
11822             XINERAMA_LINK=static
11823         fi
11824     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11825         # we have only the dynamic version
11826         USE_XINERAMA=YES
11827         XINERAMA_LINK=dynamic
11828     elif test -e "$XINERAMALIB/libXinerama.a"; then
11829         # static version
11830         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11831             USE_XINERAMA=YES
11832             XINERAMA_LINK=static
11833         else
11834             USE_XINERAMA=NO
11835             XINERAMA_LINK=none
11836         fi
11837     else
11838         # no Xinerama
11839         USE_XINERAMA=NO
11840         XINERAMA_LINK=none
11841     fi
11842     if test "$USE_XINERAMA" = "YES"; then
11843         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11844         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11845             [AC_MSG_ERROR(Xinerama header not found.)], [])
11846         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11847         if test "x$XEXTLIB" = x; then
11848            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11849         fi
11850         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11851         if test "$_os" = "FreeBSD"; then
11852             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11853         fi
11854         if test "$_os" = "Linux"; then
11855             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11856         fi
11857         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11858             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11859     else
11860         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11861     fi
11862 else
11863     USE_XINERAMA=NO
11864     XINERAMA_LINK=none
11865     AC_MSG_RESULT([no])
11867 AC_SUBST(USE_XINERAMA)
11868 AC_SUBST(XINERAMA_LINK)
11870 dnl ===================================================================
11871 dnl Test whether to build cairo or rely on the system version
11872 dnl ===================================================================
11874 if test "$GUIBASE" = "unx"; then
11875     # Used in vcl/Library_vclplug_gen.mk
11876     test_cairo=yes
11879 if test "$test_cairo" = "yes"; then
11880     AC_MSG_CHECKING([whether to use the system cairo])
11882     : ${with_system_cairo:=$with_system_libs}
11883     if test "$with_system_cairo" = "yes"; then
11884         SYSTEM_CAIRO=YES
11885         AC_MSG_RESULT([yes])
11887         PKG_CHECK_MODULES( CAIRO, cairo >= 1.0.2 )
11888         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11890         if test "$test_xrender" = "yes"; then
11891             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11892             AC_LANG_PUSH([C])
11893             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11894 #ifdef PictStandardA8
11895 #else
11896       return fail;
11897 #endif
11898 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11900             AC_LANG_POP([C])
11901         fi
11902         libo_MINGW_CHECK_DLL([libcairo])
11903         libo_MINGW_TRY_DLL([libfontconfig])
11904         libo_MINGW_TRY_DLL([libfreetype])
11905         libo_MINGW_TRY_DLL([libpixman])
11906         libo_MINGW_TRY_DLL([libpng15])
11907     else
11908         SYSTEM_CAIRO=NO
11909         AC_MSG_RESULT([no])
11911         BUILD_TYPE="$BUILD_TYPE CAIRO"
11912         SCPDEFS="$SCPDEFS -DNEED_CAIRO"
11913     fi
11916 AC_SUBST(SYSTEM_CAIRO)
11917 AC_SUBST(CAIRO_CFLAGS)
11918 AC_SUBST(CAIRO_LIBS)
11920 dnl ===================================================================
11921 dnl Test whether to use avahi
11922 dnl ===================================================================
11923 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11924     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11925                       [ENABLE_AVAHI="TRUE"])
11926     AC_DEFINE(HAVE_FEATURE_AVAHI)
11927     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11930 AC_SUBST(ENABLE_AVAHI)
11931 AC_SUBST(AVAHI_CFLAGS)
11932 AC_SUBST(AVAHI_LIBS)
11934 dnl ===================================================================
11935 dnl Test whether to use liblangtag
11936 dnl ===================================================================
11937 ENABLE_LIBLANGTAG=
11938 SYSTEM_LIBLANGTAG=
11939 AC_MSG_CHECKING([whether to use liblangtag])
11940 if test "$enable_liblangtag" = "yes" -o \( "$enable_liblangtag" = "" -a $_os != Android -a $_os != iOS \); then
11941     ENABLE_LIBLANGTAG=TRUE
11942     AC_MSG_RESULT([yes])
11943     AC_MSG_CHECKING([whether to use system liblangtag])
11944     if test "$with_system_liblangtag" = yes; then
11945         SYSTEM_LIBLANGTAG=YES
11946         AC_MSG_RESULT([yes])
11947         PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11948         LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11949         libo_MINGW_CHECK_DLL([liblangtag])
11950     else
11951         SYSTEM_LIBLANGTAG=NO
11952         AC_MSG_RESULT([no])
11953         BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11954         if test "$COM" = "MSC"; then
11955             LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs/liblangtag.lib"
11956         else
11957             LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs -llangtag"
11958         fi
11959     fi
11960 else
11961     AC_MSG_RESULT([no])
11963 AC_SUBST(ENABLE_LIBLANGTAG)
11964 AC_SUBST(SYSTEM_LIBLANGTAG)
11965 AC_SUBST(LIBLANGTAG_CFLAGS)
11966 AC_SUBST(LIBLANGTAG_LIBS)
11968 dnl ===================================================================
11969 dnl Test whether to build libpng or rely on the system version
11970 dnl ===================================================================
11972 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/png"],["-L${WORKDIR}/LinkTarget/StaticLibrary -lpng"])
11974 dnl ===================================================================
11975 dnl Check for runtime JVM search path
11976 dnl ===================================================================
11977 if test "$ENABLE_JAVA" != ""; then
11978     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11979     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11980         AC_MSG_RESULT([yes])
11981         if ! test -d "$with_jvm_path"; then
11982             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11983         fi
11984         if ! test -d "$with_jvm_path"jvm; then
11985             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11986         fi
11987         JVM_ONE_PATH_CHECK="$with_jvm_path"
11988         AC_SUBST(JVM_ONE_PATH_CHECK)
11989     else
11990         AC_MSG_RESULT([no])
11991     fi
11994 dnl ===================================================================
11995 dnl Test for the presence of Ant and that it works
11996 dnl ===================================================================
11998 if test "$ENABLE_JAVA" != ""; then
11999     ANT_HOME=; export ANT_HOME
12000     WITH_ANT_HOME=; export WITH_ANT_HOME
12001     if test -z "$with_ant_home"; then
12002         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
12003     else
12004         if test "$_os" = "WINNT"; then
12005             with_ant_home=`cygpath -u "$with_ant_home"`
12006         fi
12007         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
12008         WITH_ANT_HOME=$with_ant_home
12009         ANT_HOME=$with_ant_home
12010     fi
12012     if test -z "$ANT"; then
12013         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
12014     else
12015         # resolve relative or absolute symlink
12016         while test -h "$ANT"; do
12017             a_cwd=`pwd`
12018             a_basename=`basename "$ANT"`
12019             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
12020             cd "`dirname "$ANT"`"
12021             cd "`dirname "$a_script"`"
12022             ANT="`pwd`"/"`basename "$a_script"`"
12023             cd "$a_cwd"
12024         done
12026         AC_MSG_CHECKING([if $ANT works])
12027         cat > conftest.java << EOF
12028         public class conftest {
12029             int testmethod(int a, int b) {
12030                     return a + b;
12031             }
12032         }
12035         cat > conftest.xml << EOF
12036         <project name="conftest" default="conftest">
12037         <target name="conftest">
12038             <javac srcdir="." includes="conftest.java">
12039             </javac>
12040         </target>
12041         </project>
12044         oldJAVA_HOME=$JAVA_HOME
12045         if test "$JAVACISGCJ" = "yes"; then
12046             JAVA_HOME=; export JAVA_HOME
12047             ant_gcj="-Dbuild.compiler=gcj"
12048         fi
12049         AC_TRY_COMMAND("$ANT" $ant_gcj -buildfile conftest.xml 1>&2)
12050         if test $? = 0 -a -f ./conftest.class; then
12051             AC_MSG_RESULT([Ant works])
12052             if test -z "$WITH_ANT_HOME"; then
12053                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
12054                 if test -z "$ANT_HOME"; then
12055                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
12056                 fi
12057             else
12058                 ANT_HOME="$WITH_ANT_HOME"
12059             fi
12060         else
12061             echo "configure: Ant test failed" >&5
12062             cat conftest.java >&5
12063             cat conftest.xml >&5
12064             AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
12065             ANT_HOME=""
12066             add_warning "Ant does not work - Some Java projects will not build!"
12067         fi
12068         JAVA_HOME=$oldJAVA_HOME
12069         rm -f conftest* core core.* *.core
12070     fi
12071     if test -z "$ANT_HOME"; then
12072         ANT_HOME="NO_ANT_HOME"
12073     else
12074         PathFormat "$ANT_HOME"
12075         ANT_HOME="$formatted_path"
12076         PathFormat "$ANT"
12077         ANT="$ANT"
12078     fi
12079     AC_SUBST(ANT_HOME)
12080     AC_SUBST(ANT)
12082     dnl Checking for ant.jar
12083     if test "$ANT_HOME" != "NO_ANT_HOME"; then
12084         AC_MSG_CHECKING([Ant lib directory])
12085         if test -f $ANT_HOME/lib/ant.jar; then
12086             ANT_LIB="$ANT_HOME/lib"
12087         else
12088             if test -f $ANT_HOME/ant.jar; then
12089                 ANT_LIB="$ANT_HOME"
12090             else
12091                 if test -f /usr/share/java/ant.jar; then
12092                     ANT_LIB=/usr/share/java
12093                 else
12094                     if test -f /usr/share/ant-core/lib/ant.jar; then
12095                         ANT_LIB=/usr/share/ant-core/lib
12096                     else
12097                         if test -f $ANT_HOME/lib/ant/ant.jar; then
12098                             ANT_LIB="$ANT_HOME/lib/ant"
12099                         else
12100                             if test -f /usr/share/lib/ant/ant.jar; then
12101                                 ANT_LIB=/usr/share/lib/ant
12102                             else
12103                                 AC_MSG_ERROR([Ant libraries not found!])
12104                             fi
12105                         fi
12106                     fi
12107                 fi
12108             fi
12109         fi
12110         PathFormat "$ANT_LIB"
12111         ANT_LIB="$formatted_path"
12112         AC_MSG_RESULT([Ant lib directory found.])
12113     fi
12114     AC_SUBST(ANT_LIB)
12116     ant_minver=1.6.0
12117     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12119     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12120     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
12121     ant_version_major=`echo $ant_version | cut -d. -f1`
12122     ant_version_minor=`echo $ant_version | cut -d. -f2`
12123     echo "configure: ant_version $ant_version " >&5
12124     echo "configure: ant_version_major $ant_version_major " >&5
12125     echo "configure: ant_version_minor $ant_version_minor " >&5
12126     if test "$ant_version_major" -ge "2"; then
12127         AC_MSG_RESULT([yes, $ant_version])
12128     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12129         AC_MSG_RESULT([yes, $ant_version])
12130     else
12131         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12132     fi
12134     if test "$ENABLE_MEDIAWIKI" = "TRUE"; then
12135         AC_MSG_CHECKING([whether Ant supports mapper type="regexp"])
12136         rm -rf confdir
12137         mkdir confdir
12138         cat > conftest.java << EOF
12139             public class conftest {
12140                 int testmethod(int a, int b) {
12141                     return a + b;
12142                 }
12143             }
12146         cat > conftest.xml << EOF
12147             <project name="conftest" default="conftest">
12148             <target name="conftest" depends="copytest">
12149                 <javac srcdir="." includes="conftest.java">
12150                 </javac>
12151             </target>
12152             <target name="copytest">
12153                  <copy todir="confdir">
12154                  <fileset dir="confdir" includes="**/*.abc" casesensitive="yes"/>
12155                  <filterset/>
12156                  <mapper type="regexp" from="^(.*[/\\])foo([/\\].*)" to="\1baa\2"/>
12157                  </copy>
12158             </target>
12159             </project>
12162         if test "$JAVACISGCJ" = "yes"; then
12163             JAVA_HOME=; export JAVA_HOME
12164             ant_gcj="-Dbuild.compiler=gcj"
12165         fi
12166         AC_TRY_COMMAND("$ANT" $ant_gcj -buildfile conftest.xml 1>&2)
12167         if test $? = 0 -a -f ./conftest.class; then
12168             AC_MSG_RESULT([yes])
12169             rm -rf confdir
12170         else
12171             echo "configure: Ant test failed" >&5
12172             cat conftest.java >&5
12173             cat conftest.xml >&5
12174             rm -rf confdir
12175             AC_MSG_ERROR([no. Did you install ant-apache-regexp?])
12176         fi
12177     fi
12178     rm -f conftest* core core.* *.core
12181 OOO_JUNIT_JAR=
12182 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12183     AC_MSG_CHECKING([for JUnit 4])
12184     if test "$with_junit" = "yes"; then
12185         if test -e /usr/share/java/junit4.jar; then
12186             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12187         else
12188            if test -e /usr/share/lib/java/junit.jar; then
12189               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12190            else
12191               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12192            fi
12193         fi
12194     else
12195         OOO_JUNIT_JAR=$with_junit
12196     fi
12197     if test "$_os" = "WINNT"; then
12198         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12199     fi
12200     "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" 2>&5 | \
12201         grep org/junit/Before.class > /dev/null 2>&5
12202     if test $? -eq 0; then
12203         # check if either class-path entry is available for hamcrest or
12204         # it's bundled
12205         if "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" |$GREP -q hamcrest || \
12206             "$UNZIP" -c "$OOO_JUNIT_JAR" META-INF/MANIFEST.MF |$GREP 'Class-Path:' | $GREP -q 'hamcrest'; then
12207             AC_MSG_RESULT([$OOO_JUNIT_JAR])
12208         else
12209             AC_MSG_ERROR([your junit jar neither sets a classpath nor includes hamcrest; please
12210 provide a full junit jar or use --without-junit])
12211         fi
12212     else
12213         AC_MSG_RESULT([no])
12214         AC_MSG_ERROR([cannot find JUnit 4 jar; please install one in the default
12215 location (/usr/share/java), specify its pathname via
12216 --with-junit=..., or disable it via --without-junit])
12217     fi
12218     if test $OOO_JUNIT_JAR != ""; then
12219     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12220     fi
12222 AC_SUBST(OOO_JUNIT_JAR)
12225 AC_SUBST(SCPDEFS)
12228 # check for wget and curl
12230 WGET=
12231 CURL=
12233 if test "$enable_fetch_external" != "no"; then
12235 CURL=`which curl 2>/dev/null`
12237 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12238     eval "$i --version" > /dev/null 2>&1
12239     ret=$?
12240     if test $ret -eq 0; then
12241         WGET=$i
12242         break
12243     fi
12244 done
12246 if test -z "$WGET" -a -z "$CURL"; then
12247     AC_MSG_ERROR([neither wget nor curl found!])
12252 AC_SUBST(WGET)
12253 AC_SUBST(CURL)
12256 # check for md5sum
12258 MD5SUM=
12260 for i in md5 md5sum /usr/local/bin/md5sum gmd5sum /usr/sfw/bin/md5sum /opt/sfw/bin/gmd5sum /opt/local/bin/md5sum; do
12261     if test "$i" = "md5"; then
12262         eval "$i -x" > /dev/null 2>&1
12263     else
12264         eval "$i --version" > /dev/null 2>&1
12265     fi
12266     ret=$?
12267     if test $ret -eq 0; then
12268         MD5SUM=$i
12269         break
12270     fi
12271 done
12273 if test "$MD5SUM" = "md5"; then
12274     if md5 -r < /dev/null > /dev/null 2>/dev/null; then
12275         MD5SUM="$MD5SUM -r"
12276     elif md5 -n < /dev/null > /dev/null 2>/dev/null; then
12277         MD5SUM="$MD5SUM -n"
12278     fi
12281 if test -z "$MD5SUM"; then
12282     AC_MSG_ERROR([no md5sum: found!])
12285 AC_SUBST(MD5SUM)
12287 dnl ===================================================================
12288 dnl Dealing with l10n options
12289 dnl ===================================================================
12290 AC_MSG_CHECKING([which languages to be built])
12291 # get list of all languages
12292 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12293 # the sed command does the following:
12294 #   + if a line ends with a backslash, append the next line to it
12295 #   + adds " on the beginning of the value (after =)
12296 #   + adds " at the end of the value
12297 #   + removes en-US; we want to put it on the beginning
12298 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12299 [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)]
12300 ALL_LANGS="en-US $completelangiso"
12301 # check the configured localizations
12302 WITH_LANG="$with_lang"
12303 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12304     AC_MSG_RESULT([en-US])
12305 else
12306     AC_MSG_RESULT([$WITH_LANG])
12307     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12309 # check that the list is valid
12310 for lang in $WITH_LANG; do
12311     test "$lang" = "ALL" && continue
12312     # need to check for the exact string, so add space before and after the list of all languages
12313     for vl in $ALL_LANGS; do
12314         if test "$vl" = "$lang"; then
12315            break
12316         fi
12317     done
12318     if test "$vl" != "$lang"; then
12319         # if you're reading this - you prolly quoted your languages remove the quotes ...
12320         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12321     fi
12322 done
12323 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12324     echo $WITH_LANG | grep -q en-US
12325     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12327 # list with substituted ALL
12328 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12329 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12330 test "$WITH_LANG" = "en-US" && WITH_LANG=
12331 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12332     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12333     ALL_LANGS=`echo $ALL_LANGS qtz`
12335 AC_SUBST(ALL_LANGS)
12336 AC_SUBST(WITH_LANG)
12337 AC_SUBST(WITH_LANG_LIST)
12338 AC_SUBST(GIT_NEEDED_SUBMODULES)
12340 WITH_POOR_HELP_LOCALIZATIONS=
12341 if test -d "$SRC_ROOT/translations/source"; then
12342     for l in `ls -1 $SRC_ROOT/translations/source`; do
12343         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12344             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12345         fi
12346     done
12348 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12350 dnl git submodule update --reference
12351 dnl ===================================================================
12352 if test -n "${GIT_REFERENCE_SRC}"; then
12353     for repo in ${GIT_NEEDED_SUBMODULES}; do
12354         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12355             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12356         fi
12357     done
12359 AC_SUBST(GIT_REFERENCE_SRC)
12361 dnl git submodules linked dirs
12362 dnl ===================================================================
12363 if test -n "${GIT_LINK_SRC}"; then
12364     for repo in ${GIT_NEEDED_SUBMODULES}; do
12365         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12366             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12367         fi
12368     done
12370 AC_SUBST(GIT_LINK_SRC)
12372 dnl branding
12373 dnl ===================================================================
12374 AC_MSG_CHECKING([for alternative branding images directory])
12375 # initialize mapped arrays
12376 BRAND_INTRO_IMAGES="flat_logo.svg intro.png"
12377 brand_files="$BRAND_INTRO_IMAGES about.svg \
12378     backing_left.png backing_right.png \
12379     backing_rtl_left.png backing_rtl_right.png \
12380     backing_space.png"
12382 if test -z "$with_branding" -o "$with_branding" = "no"; then
12383     AC_MSG_RESULT([none])
12384     DEFAULT_BRAND_IMAGES="$brand_files"
12385 else
12386     if ! test -d $with_branding ; then
12387         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12388     else
12389         AC_MSG_RESULT([$with_branding])
12390         CUSTOM_BRAND_DIR="$with_branding"
12391         for lfile in $brand_files
12392         do
12393             if ! test -f $with_branding/$lfile ; then
12394                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12395                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12396             else
12397                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12398             fi
12399         done
12400         check_for_progress="yes"
12401     fi
12403 AC_SUBST([BRAND_INTRO_IMAGES])
12404 AC_SUBST([CUSTOM_BRAND_DIR])
12405 AC_SUBST([CUSTOM_BRAND_IMAGES])
12406 AC_SUBST([DEFAULT_BRAND_IMAGES])
12409 AC_MSG_CHECKING([for 'intro' progress settings])
12410 PROGRESSBARCOLOR=
12411 PROGRESSSIZE=
12412 PROGRESSPOSITION=
12413 PROGRESSFRAMECOLOR=
12414 PROGRESSTEXTCOLOR=
12415 PROGRESSTEXTBASELINE=
12417 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12418     source "$with_branding/progress.conf"
12419     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12420 else
12421     AC_MSG_RESULT([none])
12424 AC_SUBST(PROGRESSBARCOLOR)
12425 AC_SUBST(PROGRESSSIZE)
12426 AC_SUBST(PROGRESSPOSITION)
12427 AC_SUBST(PROGRESSFRAMECOLOR)
12428 AC_SUBST(PROGRESSTEXTCOLOR)
12429 AC_SUBST(PROGRESSTEXTBASELINE)
12432 AC_MSG_CHECKING([for extra build ID])
12433 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12434     EXTRA_BUILDID="$with_extra_buildid"
12436 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12437 if test -n "$EXTRA_BUILDID" ; then
12438     AC_MSG_RESULT([$EXTRA_BUILDID])
12439 else
12440     AC_MSG_RESULT([not set])
12442 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12444 OOO_VENDOR=
12445 AC_MSG_CHECKING([for vendor])
12446 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12447     OOO_VENDOR="$USERNAME"
12449     if test -z "$OOO_VENDOR"; then
12450         OOO_VENDOR="$USER"
12451     fi
12453     if test -z "$OOO_VENDOR"; then
12454         OOO_VENDOR="`id -u -n`"
12455     fi
12457     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12458 else
12459     OOO_VENDOR="$with_vendor"
12460     AC_MSG_RESULT([$OOO_VENDOR])
12462 AC_SUBST(OOO_VENDOR)
12464 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12465 if test "$with_compat_oowrappers" = "yes"; then
12466     WITH_COMPAT_OOWRAPPERS=YES
12467     AC_MSG_RESULT(yes)
12468 else
12469     WITH_COMPAT_OOWRAPPERS=
12470     AC_MSG_RESULT(no)
12472 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12474 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | tr '[[:upper:]]' '[[:lower:]]'`
12475 AC_MSG_CHECKING([for install dirname])
12476 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12477     INSTALLDIRNAME="$with_install_dirname"
12479 AC_MSG_RESULT([$INSTALLDIRNAME])
12480 AC_SUBST(INSTALLDIRNAME)
12482 AC_MSG_CHECKING([for prefix])
12483 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12484 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12485 PREFIXDIR="$prefix"
12486 AC_MSG_RESULT([$PREFIXDIR])
12487 AC_SUBST(PREFIXDIR)
12489 LIBDIR=[$(eval echo $(eval echo $libdir))]
12490 AC_SUBST(LIBDIR)
12492 DATADIR=[$(eval echo $(eval echo $datadir))]
12493 AC_SUBST(DATADIR)
12495 MANDIR=[$(eval echo $(eval echo $mandir))]
12496 AC_SUBST(MANDIR)
12498 DOCDIR=[$(eval echo $(eval echo $docdir))]
12499 AC_SUBST(DOCDIR)
12501 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12502 AC_SUBST(INSTALLDIR)
12504 TESTINSTALLDIR="${BUILDDIR}/test-install"
12505 AC_SUBST(TESTINSTALLDIR)
12508 # ===================================================================
12509 # OAuth2 id and secrets
12510 # ===================================================================
12512 AC_MSG_CHECKING([for Google Drive client id and secret])
12513 GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12514 GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12515 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12516     GDRIVE_CLIENT_ID="\"\""
12519 if test "$with_gdrive_client_secret" = "no" -o -z "$with_gdrive_client_secret"; then
12520     GDRIVE_CLIENT_SECRET="\"\""
12523 if test -z "$GDRIVE_CLIENT_ID" -o -z "$GDRIVE_CLIENT_SECRET"; then
12524     AC_MSG_RESULT([not set])
12525 else
12526     AC_MSG_RESULT([set])
12529 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12530 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12532 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12533 ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12534 ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12535 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12536     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12539 if test "$with_alfresco_cloud_client_secret" = "no" -o -z "$with_alfresco_cloud_client_secret"; then
12540     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12543 if test -z "$ALFRESCO_CLOUD_CLIENT_ID" -o -z "$ALFRESCO_CLOUD_CLIENT_SECRET"; then
12544     AC_MSG_RESULT([not set])
12545 else
12546     AC_MSG_RESULT([set])
12548 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12549 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12551 # ===================================================================
12552 # De- or increase default verbosity of build process
12553 # ===================================================================
12554 AC_MSG_CHECKING([build verbosity])
12555 if test -n "$enable_verbose"; then
12556     if test "$enable_verbose" = "yes"; then
12557         VERBOSE="TRUE"
12558         AC_MSG_RESULT([high])
12559     fi
12560     if test "$enable_verbose" = "no"; then
12561         VERBOSE="FALSE"
12562         AC_MSG_RESULT([low])
12563     fi
12564 else
12565     AC_MSG_RESULT([not set])
12567 AC_SUBST(VERBOSE)
12569 dnl ===================================================================
12570 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12571 dnl --enable-dependency-tracking configure option
12572 dnl ===================================================================
12573 AC_MSG_CHECKING([whether to enable dependency tracking])
12574 if test "$enable_dependency_tracking" = "no"; then
12575     nodep=TRUE
12576     AC_MSG_RESULT([no])
12577 else
12578     AC_MSG_RESULT([yes])
12580 AC_SUBST(nodep)
12582 dnl ===================================================================
12583 dnl Number of CPUs to use during the build
12584 dnl ===================================================================
12585 AC_MSG_CHECKING([for number of processors to use])
12586 # plain --with-parallelism is just the default
12587 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12588     if test "$with_parallelism" = "no"; then
12589         PARALLELISM=1
12590     else
12591         PARALLELISM=$with_parallelism
12592     fi
12593 else
12594     if test "$enable_icecream" = "yes"; then
12595         PARALLELISM="10"
12596     else
12597         case `uname -s` in
12599         Darwin|FreeBSD|NetBSD|OpenBSD)
12600             PARALLELISM=`sysctl -n hw.ncpu`
12601             ;;
12603         Linux)
12604             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12605         ;;
12606         # what else than above does profit here *and* has /proc?
12607         *)
12608             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12609             ;;
12610         esac
12612         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12613         # unexpected format, 'wc -l' will have returned 0.
12614         if test "$PARALLELISM" -eq 0; then
12615             PARALLELISM=1
12616         fi
12617     fi
12620 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12621     if test -z "$with_parallelism"; then
12622             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12623             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12624             PARALLELISM="1"
12625     else
12626         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."
12627     fi
12630 AC_MSG_RESULT([$PARALLELISM])
12631 AC_SUBST(PARALLELISM)
12634 # Set up ILIB for MSVC build
12636 if test "$build_os" = "cygwin"; then
12637     ILIB="."
12638     if test -n "$JAVA_HOME" -a "$JAVA_HOME" != "NO_JAVA_HOME"; then
12639         ILIB="$ILIB;$JAVA_HOME/lib"
12640     fi
12641     if test "$BITNESS_OVERRIDE" = 64; then
12642         ILIB="$ILIB;$COMPATH/lib/amd64"
12643         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12644         if test "$WINDOWS_SDK_VERSION" = "80"; then
12645             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/win8/um/x64"
12646         fi
12647     else
12648         ILIB="$ILIB;$COMPATH/lib"
12649         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12650         if test "$WINDOWS_SDK_VERSION" = "80"; then
12651             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/win8/um/x86"
12652         fi
12653     fi
12654     ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12656     if test "$ENABLE_DIRECTX" = "TRUE"; then
12657         ILIB="$ILIB;$DIRECTXSDK_LIB"
12658     fi
12659     AC_SUBST(ILIB)
12663 # ===================================================================
12664 # Creating bigger shared library to link against
12665 # ===================================================================
12666 AC_MSG_CHECKING([whether to create huge library])
12667 MERGELIBS=
12669 if test $_os = iOS -o $_os = Android; then
12670     # Never any point in mergelibs for these as we build just static
12671     # libraries anyway...
12672     enable_mergelibs=no
12675 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12676     if test $_os != Linux -a $_os != WINNT; then
12677         add_warning "--enable-mergelibs is not tested for this platform"
12678     fi
12679     if test "$enable_mergelibs" = "all"; then
12680         MERGELIBS="ALL"
12681         URELIBS="TRUE"
12682     else
12683         MERGELIBS="CORE"
12684     fi
12685     AC_MSG_RESULT([yes])
12686 else
12687     AC_MSG_RESULT([no])
12689 AC_SUBST([MERGELIBS])
12690 AC_SUBST([URELIBS])
12692 # ===================================================================
12693 # Create hardlinks on deliver instead of copying for smaller size and speed up
12694 # ===================================================================
12695 AC_MSG_CHECKING([whether to create hardlinks for delivering files])
12696 HARDLINKDELIVER=
12697 if test "$enable_hardlink_deliver" = "yes"; then
12698     HARDLINKDELIVER="TRUE"
12699     AC_MSG_RESULT([yes])
12700 else
12701     AC_MSG_RESULT([no])
12703 AC_SUBST(HARDLINKDELIVER)
12705 dnl ===================================================================
12706 dnl icerun is a wrapper that stops us spawning tens of processes
12707 dnl locally - for tools that can't be executed on the compile cluster
12708 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12709 dnl ===================================================================
12710 AC_MSG_CHECKING([whether to use icerun wrapper])
12711 ICECREAM_RUN=
12712 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12713     ICECREAM_RUN=icerun
12714     AC_MSG_RESULT([yes])
12715 else
12716     AC_MSG_RESULT([no])
12718 AC_SUBST(ICECREAM_RUN)
12720 dnl ===================================================================
12722 AC_MSG_CHECKING([MPL subset])
12723 MPL_SUBSET=
12725 if test "$enable_mpl_subset" = "yes"; then
12726     warn_report=false
12727     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12728         warn_report=true
12729     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12730         warn_report=true
12731     fi
12732     if test "$warn_report" = "true"; then
12733         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12734     fi
12735     if test "x$enable_postgresql_sdbc" != "xno"; then
12736         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the postgress database backend.])
12737     fi
12738     if test "$enable_lotuswordpro" = "yes"; then
12739         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12740     fi
12741     if test "$WITH_WEBDAV" = "neon"; then
12742         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12743     fi
12744     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12745         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12746     fi
12747     if test -n "$ENABLE_PDFIMPORT"; then
12748         if test "x$SYSTEM_POPPLER" = "xNO"; then
12749             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12750         fi
12751     fi
12752     # cf. m4/libo_check_extension.m4
12753     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12754         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12755     fi
12756     for theme in $WITH_THEMES; do
12757         case $theme in
12758         crystal|default|hicontrast|human|oxygen|sifr)
12759             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12760         *) : ;;
12761         esac
12762     done
12763     if test "$enable_opengl" != "no" -o "x$ENABLE_OPENGL" = "xTRUE"; then
12764         AC_MSG_ERROR([need to --disable-opengl - GL transitions support.])
12765     fi
12766     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12767         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12768     fi
12770     MPL_SUBSET="TRUE"
12771     AC_DEFINE(MPL_HAVE_SUBSET)
12772     AC_MSG_RESULT([only])
12773 else
12774     AC_MSG_RESULT([no restrictions])
12776 AC_SUBST(MPL_SUBSET)
12779 dnl ===================================================================
12780 dnl Setting up the environment.
12781 dnl ===================================================================
12782 echo "setting up the build environment variables..."
12784 AC_SUBST(COMPATH)
12786 if test "$build_os" = "cygwin"; then
12787     if test "$DISABLE_ACTIVEX" = "TRUE"; then
12788         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12789         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12790     else
12791         ATL_LIB="$COMPATH/atlmfc/lib"
12792         ATL_INCLUDE="$COMPATH/atlmfc/include"
12793     fi
12794     if test "$BITNESS_OVERRIDE" = 64; then
12795         ATL_LIB="$ATL_LIB/amd64"
12796     fi
12797     PathFormat "/usr/bin/grep.exe"
12798     WIN_GREP="$formatted_path"
12799     PathFormat "/usr/bin/find.exe"
12800     WIN_FIND="$formatted_path"
12801     PathFormat "/usr/bin/ls.exe"
12802     WIN_LS="$formatted_path"
12803     PathFormat "/usr/bin/touch.exe"
12804     WIN_TOUCH="$formatted_path"
12807 AC_SUBST(ATL_INCLUDE)
12808 AC_SUBST(ATL_LIB)
12809 AC_SUBST(WIN_FIND)
12810 AC_SUBST(WIN_GREP)
12811 AC_SUBST(WIN_LS)
12812 AC_SUBST(WIN_TOUCH)
12814 AC_SUBST(BUILD_TYPE)
12816 AC_SUBST(SOLARINC)
12817 AC_SUBST(SOLARLIB)
12819 PathFormat "$PERL"
12820 PERL="$formatted_path"
12821 AC_SUBST(PERL)
12823 if test -n "$TMPDIR"; then
12824     TEMP_DIRECTORY="$TMPDIR"
12825 else
12826     TEMP_DIRECTORY="/tmp"
12828 if test "$build_os" = "cygwin"; then
12829     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12831 AC_SUBST(TEMP_DIRECTORY)
12833 # setup the PATH for the environment
12834 if test -n "$LO_PATH_FOR_BUILD"; then
12835     LO_PATH="$LO_PATH_FOR_BUILD"
12836 else
12837     LO_PATH="$PATH"
12839     case "$host_os" in
12841     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12842         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12843             pathmunge "$JAVA_HOME/bin" "after"
12844         fi
12845         ;;
12847     cygwin*)
12848         pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12849         pathmunge "$ASM_HOME" "before"
12850         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12851         pathmunge "$CSC_PATH" "before"
12852         pathmunge "$MIDL_PATH" "before"
12853         pathmunge "$AL_PATH" "before"
12854         pathmunge "$MSPDB_PATH" "before"
12855         if test "$BITNESS_OVERRIDE" = 64; then
12856             pathmunge "$COMPATH/bin/amd64" "before"
12857             pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
12858         else
12859             pathmunge "$COMPATH/bin" "before"
12860             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
12861         fi
12862         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12863             if test -d "$JAVA_HOME/jre/bin/client"; then
12864                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12865             fi
12866             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12867                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12868             fi
12869             pathmunge "$JAVA_HOME/bin" "before"
12870         fi
12871         ;;
12873     solaris*)
12874         pathmunge "/usr/css/bin" "before"
12875         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12876             pathmunge "$JAVA_HOME/bin" "after"
12877         fi
12878         ;;
12879     esac
12881     pathmunge "$SRC_ROOT/solenv/bin" "before"
12882     pathmunge "." "before"
12885 AC_SUBST(LO_PATH)
12887 # Generate a configuration md5 we can use for deps
12888 if test -f config_host.mk; then
12889     config_md5=`$MD5SUM config_host.mk | sed "s/ .*//"`
12892 AC_CONFIG_FILES([config_host.mk
12893                  Makefile
12894                  lo.xcent
12895                  instsetoo_native/util/openoffice.lst
12896                  sysui/desktop/macosx/Info.plist
12897                  ios/lo.xcconfig
12898                  ure/source/unorc])
12899 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12900 AC_CONFIG_HEADERS([config_host/config_clang.h])
12901 AC_CONFIG_HEADERS([config_host/config_eot.h])
12902 AC_CONFIG_HEADERS([config_host/config_features.h])
12903 AC_CONFIG_HEADERS([config_host/config_folders.h])
12904 AC_CONFIG_HEADERS([config_host/config_gcc.h])
12905 AC_CONFIG_HEADERS([config_host/config_global.h])
12906 AC_CONFIG_HEADERS([config_host/config_graphite.h])
12907 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12908 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12909 AC_CONFIG_HEADERS([config_host/config_orcus.h])
12910 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12911 AC_CONFIG_HEADERS([config_host/config_mingw.h])
12912 AC_CONFIG_HEADERS([config_host/config_oox.h])
12913 AC_CONFIG_HEADERS([config_host/config_telepathy.h])
12914 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12915 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12916 AC_CONFIG_HEADERS([config_host/config_version.h])
12917 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12918 AC_OUTPUT
12920 if test "$CROSS_COMPILING" = YES; then
12921     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12924 # touch the config timestamp file
12925 if test ! -f config_host.mk.stamp; then
12926     echo > config_host.mk.stamp
12927 elif test "$config_md5" = `$MD5SUM config_host.mk | sed "s/ .*//"`; then
12928     echo "Configuration unchanged - avoiding scp2 stamp update"
12929 else
12930     echo > config_host.mk.stamp
12934 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12935 cat << _EOS
12936 ****************************************************************************
12937 WARNING:
12938 Your make version is known to be horribly slow, and hard to debug
12939 problems with. To get a reasonably functional make please do:
12941 to install a pre-compiled binary make for cygwin
12943 mkdir -p /opt/lo/bin
12944 cd /opt/lo/bin
12945 wget http://dev-www.libreoffice.org/bin/cygwin/make
12946 chmod +x make
12948 to install from source:
12949 place yourself in a working directory of you choice.
12951 git clone git://anongit.freedesktop.org/libreoffice/contrib/dev-tools
12952 cd dev-tools/make-3.82-gbuild
12953 ./configure --prefix=/opt/lo
12954 make
12955 make install
12957 Then re-run autogen.sh
12959 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12960 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12962 _EOS
12965 cat << _EOF
12966 ****************************************************************************
12968 To build, issue:
12969 $GNUMAKE
12971 For details, run:
12972 $GNUMAKE help
12974 _EOF
12976 if test $_os != WINNT -a "$CROSS_COMPILING" != YES; then
12977     cat << _EOF
12978 After the build has finished, your can immediately run it using:
12979 instdir/program/soffice
12981 If you want to run the smoketest, issue:
12982 $GNUMAKE check
12984 _EOF
12987 if test -f warn; then
12988     cat warn
12989     rm warn
12992 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: